authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-02-13 00:49:42+01:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-02-13 12:13:56+01:00
logf93c219f30b4b4f3bb9280d39be7b585ddcd8447
tree446d89523be9dce80f0ea219d0e17e3f9cb446ad
parentc5260f7f867fd4ccb4eb3fd5b0ab91759cf94546

Minor changes for a test case


1 files changed, 8 insertions(+), 11 deletions(-)

lib/std/os/test.zig+8-11
......@@ -276,8 +276,11 @@ test "mmap" {
276276 testing.expectEqual(@as(usize, 1234), data.len);
277277
278278 // By definition the data returned by mmap is zero-filled
279 std.mem.set(u8, data[0 .. data.len - 1], 0x55);
280 testing.expect(mem.indexOfScalar(u8, data, 0).? == 1234 - 1);
279 testing.expect(mem.eql(u8, data, &[_]u8{0x00} ** 1234));
280
281 // Make sure the memory is writeable as requested
282 std.mem.set(u8, data, 0x55);
283 testing.expect(mem.eql(u8, data, &[_]u8{0x55} ** 1234));
281284 }
282285
283286 const test_out_file = "os_tmp_test";
......@@ -300,10 +303,7 @@ test "mmap" {
300303
301304 // Map the whole file
302305 {
303 const file = try fs.cwd().createFile(test_out_file, .{
304 .read = true,
305 .truncate = false,
306 });
306 const file = try fs.cwd().openFile(test_out_file, .{});
307307 defer file.close();
308308
309309 const data = try os.mmap(
......@@ -327,15 +327,12 @@ test "mmap" {
327327
328328 // Map the upper half of the file
329329 {
330 const file = try fs.cwd().createFile(test_out_file, .{
331 .read = true,
332 .truncate = false,
333 });
330 const file = try fs.cwd().openFile(test_out_file, .{});
334331 defer file.close();
335332
336333 const data = try os.mmap(
337334 null,
338 alloc_size,
335 alloc_size / 2,
339336 os.PROT_READ,
340337 os.MAP_PRIVATE,
341338 file.handle,