1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:27:45 +00:00

Userland: Tests: Use mkstemp temporary files in tests

This commit is contained in:
Brendan Coles 2020-11-14 23:18:39 +00:00 committed by Andreas Kling
parent 12d923bb7e
commit d739483ee8
3 changed files with 24 additions and 15 deletions

View file

@ -137,9 +137,10 @@ static void test_write_to_file()
u8 glyph_width = 1;
auto font = Gfx::Font::create(glyph_height, glyph_width, true, Gfx::FontTypes::Default);
const char* font_path = "/tmp/new.font";
assert(font->write_to_file(font_path));
unlink(font_path);
char path[] = "/tmp/new.font.XXXXXX";
assert(mkstemp(path) != -1);
assert(font->write_to_file(path));
unlink(path);
}
int main(int, char**)