| author | |
| committer | |
| log | 699c50a375fb6755a4116c94e6068620d070bd98 |
| tree | 3ea0c8b81c73bd471cf9889fc9941a4939621a3f |
| parent | ab4ea5d3cf5a96cd596df14515521843ca4dccad |
14 files changed, 58 insertions(+), 92 deletions(-)
lib/std/array_list.zig+3-11| ... | ... | @@ -244,10 +244,7 @@ pub fn AlignedArrayList(comptime T: type, comptime alignment: ?u29) type { |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | test "std.ArrayList.init" { |
| 247 | var bytes: [1024]u8 = undefined; | |
| 248 | const allocator = &std.heap.FixedBufferAllocator.init(bytes[0..]).allocator; | |
| 249 | ||
| 250 | var list = ArrayList(i32).init(allocator); | |
| 247 | var list = ArrayList(i32).init(testing.allocator); | |
| 251 | 248 | defer list.deinit(); |
| 252 | 249 | |
| 253 | 250 | testing.expect(list.len == 0); |
| ... | ... | @@ -255,19 +252,14 @@ test "std.ArrayList.init" { |
| 255 | 252 | } |
| 256 | 253 | |
| 257 | 254 | test "std.ArrayList.initCapacity" { |
| 258 | var bytes: [1024]u8 = undefined; | |
| 259 | const allocator = &std.heap.FixedBufferAllocator.init(bytes[0..]).allocator; | |
| 260 | var list = try ArrayList(i8).initCapacity(allocator, 200); | |
| 255 | var list = try ArrayList(i8).initCapacity(testing.allocator, 200); | |
| 261 | 256 | defer list.deinit(); |
| 262 | 257 | testing.expect(list.len == 0); |
| 263 | 258 | testing.expect(list.capacity() >= 200); |
| 264 | 259 | } |
| 265 | 260 | |
| 266 | 261 | test "std.ArrayList.basic" { |
| 267 | var bytes: [1024]u8 = undefined; | |
| 268 | const allocator = &std.heap.FixedBufferAllocator.init(bytes[0..]).allocator; | |
| 269 | ||
| 270 | var list = ArrayList(i32).init(allocator); | |
| 262 | var list = ArrayList(i32).init(testing.allocator); | |
| 271 | 263 | defer list.deinit(); |
| 272 | 264 | |
| 273 | 265 | // setting on empty list is out of bounds |
lib/std/ascii.zig+2-3| ... | ... | @@ -236,9 +236,8 @@ pub fn allocLowerString(allocator: *std.mem.Allocator, ascii_string: []const u8) |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | test "allocLowerString" { |
| 239 | var buf: [100]u8 = undefined; | |
| 240 | const allocator = &std.heap.FixedBufferAllocator.init(&buf).allocator; | |
| 241 | const result = try allocLowerString(allocator, "aBcDeFgHiJkLmNOPqrst0234+💩!"); | |
| 239 | const result = try allocLowerString(std.testing.allocator, "aBcDeFgHiJkLmNOPqrst0234+💩!"); | |
| 240 | defer std.testing.allocator.free(result); | |
| 242 | 241 | std.testing.expect(std.mem.eql(u8, "abcdefghijklmnopqrst0234+💩!", result)); |
| 243 | 242 | } |
| 244 | 243 |
lib/std/cstr.zig+2-3| ... | ... | @@ -41,9 +41,8 @@ pub fn addNullByte(allocator: *mem.Allocator, slice: []const u8) ![:0]u8 { |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | test "addNullByte" { |
| 44 | var buf: [30]u8 = undefined; | |
| 45 | const allocator = &std.heap.FixedBufferAllocator.init(&buf).allocator; | |
| 46 | const slice = try addNullByte(allocator, "hello"[0..4]); | |
| 44 | const slice = try addNullByte(std.testing.allocator, "hello"[0..4]); | |
| 45 | defer std.testing.allocator.free(slice); | |
| 47 | 46 | testing.expect(slice.len == 4); |
| 48 | 47 | testing.expect(slice[4] == 0); |
| 49 | 48 | } |
lib/std/fs/get_app_data_dir.zig+2-4| ... | ... | @@ -56,9 +56,7 @@ pub fn getAppDataDir(allocator: *mem.Allocator, appname: []const u8) GetAppDataD |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | test "getAppDataDir" { |
| 59 | var buf: [512]u8 = undefined; | |
| 60 | const allocator = &std.heap.FixedBufferAllocator.init(buf[0..]).allocator; | |
| 61 | ||
| 62 | 59 | // We can't actually validate the result |
| 63 | _ = getAppDataDir(allocator, "zig") catch return; | |
| 60 | const dir = getAppDataDir(std.testing.allocator, "zig") catch return; | |
| 61 | defer std.testing.allocator.free(dir); | |
| 64 | 62 | } |
lib/std/fs/path.zig+4-6| ... | ... | @@ -89,16 +89,14 @@ pub fn joinPosix(allocator: *Allocator, paths: []const []const u8) ![]u8 { |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | fn testJoinWindows(paths: []const []const u8, expected: []const u8) void { |
| 92 | var buf: [1024]u8 = undefined; | |
| 93 | const a = &std.heap.FixedBufferAllocator.init(&buf).allocator; | |
| 94 | const actual = joinWindows(a, paths) catch @panic("fail"); | |
| 92 | const actual = joinWindows(testing.allocator, paths) catch @panic("fail"); | |
| 93 | defer testing.allocator.free(actual); | |
| 95 | 94 | testing.expectEqualSlices(u8, expected, actual); |
| 96 | 95 | } |
| 97 | 96 | |
| 98 | 97 | fn testJoinPosix(paths: []const []const u8, expected: []const u8) void { |
| 99 | var buf: [1024]u8 = undefined; | |
| 100 | const a = &std.heap.FixedBufferAllocator.init(&buf).allocator; | |
| 101 | const actual = joinPosix(a, paths) catch @panic("fail"); | |
| 98 | const actual = joinPosix(testing.allocator, paths) catch @panic("fail"); | |
| 99 | defer testing.allocator.free(actual); | |
| 102 | 100 | testing.expectEqualSlices(u8, expected, actual); |
| 103 | 101 | } |
| 104 | 102 |
lib/std/http/headers.zig+22-26| ... | ... | @@ -83,12 +83,8 @@ const HeaderEntry = struct { |
| 83 | 83 | } |
| 84 | 84 | }; |
| 85 | 85 | |
| 86 | var test_memory: [32 * 1024]u8 = undefined; | |
| 87 | var test_fba_state = std.heap.FixedBufferAllocator.init(&test_memory); | |
| 88 | const test_allocator = &test_fba_state.allocator; | |
| 89 | ||
| 90 | 86 | test "HeaderEntry" { |
| 91 | var e = try HeaderEntry.init(test_allocator, "foo", "bar", null); | |
| 87 | var e = try HeaderEntry.init(testing.allocator, "foo", "bar", null); | |
| 92 | 88 | defer e.deinit(); |
| 93 | 89 | testing.expectEqualSlices(u8, "foo", e.name); |
| 94 | 90 | testing.expectEqualSlices(u8, "bar", e.value); |
| ... | ... | @@ -368,7 +364,7 @@ pub const Headers = struct { |
| 368 | 364 | }; |
| 369 | 365 | |
| 370 | 366 | test "Headers.iterator" { |
| 371 | var h = Headers.init(test_allocator); | |
| 367 | var h = Headers.init(testing.allocator); | |
| 372 | 368 | defer h.deinit(); |
| 373 | 369 | try h.append("foo", "bar", null); |
| 374 | 370 | try h.append("cookie", "somevalue", null); |
| ... | ... | @@ -390,7 +386,7 @@ test "Headers.iterator" { |
| 390 | 386 | } |
| 391 | 387 | |
| 392 | 388 | test "Headers.contains" { |
| 393 | var h = Headers.init(test_allocator); | |
| 389 | var h = Headers.init(testing.allocator); | |
| 394 | 390 | defer h.deinit(); |
| 395 | 391 | try h.append("foo", "bar", null); |
| 396 | 392 | try h.append("cookie", "somevalue", null); |
| ... | ... | @@ -400,7 +396,7 @@ test "Headers.contains" { |
| 400 | 396 | } |
| 401 | 397 | |
| 402 | 398 | test "Headers.delete" { |
| 403 | var h = Headers.init(test_allocator); | |
| 399 | var h = Headers.init(testing.allocator); | |
| 404 | 400 | defer h.deinit(); |
| 405 | 401 | try h.append("foo", "bar", null); |
| 406 | 402 | try h.append("baz", "qux", null); |
| ... | ... | @@ -428,7 +424,7 @@ test "Headers.delete" { |
| 428 | 424 | } |
| 429 | 425 | |
| 430 | 426 | test "Headers.orderedRemove" { |
| 431 | var h = Headers.init(test_allocator); | |
| 427 | var h = Headers.init(testing.allocator); | |
| 432 | 428 | defer h.deinit(); |
| 433 | 429 | try h.append("foo", "bar", null); |
| 434 | 430 | try h.append("baz", "qux", null); |
| ... | ... | @@ -451,7 +447,7 @@ test "Headers.orderedRemove" { |
| 451 | 447 | } |
| 452 | 448 | |
| 453 | 449 | test "Headers.swapRemove" { |
| 454 | var h = Headers.init(test_allocator); | |
| 450 | var h = Headers.init(testing.allocator); | |
| 455 | 451 | defer h.deinit(); |
| 456 | 452 | try h.append("foo", "bar", null); |
| 457 | 453 | try h.append("baz", "qux", null); |
| ... | ... | @@ -474,7 +470,7 @@ test "Headers.swapRemove" { |
| 474 | 470 | } |
| 475 | 471 | |
| 476 | 472 | test "Headers.at" { |
| 477 | var h = Headers.init(test_allocator); | |
| 473 | var h = Headers.init(testing.allocator); | |
| 478 | 474 | defer h.deinit(); |
| 479 | 475 | try h.append("foo", "bar", null); |
| 480 | 476 | try h.append("cookie", "somevalue", null); |
| ... | ... | @@ -494,7 +490,7 @@ test "Headers.at" { |
| 494 | 490 | } |
| 495 | 491 | |
| 496 | 492 | test "Headers.getIndices" { |
| 497 | var h = Headers.init(test_allocator); | |
| 493 | var h = Headers.init(testing.allocator); | |
| 498 | 494 | defer h.deinit(); |
| 499 | 495 | try h.append("foo", "bar", null); |
| 500 | 496 | try h.append("set-cookie", "x=1", null); |
| ... | ... | @@ -506,27 +502,27 @@ test "Headers.getIndices" { |
| 506 | 502 | } |
| 507 | 503 | |
| 508 | 504 | test "Headers.get" { |
| 509 | var h = Headers.init(test_allocator); | |
| 505 | var h = Headers.init(testing.allocator); | |
| 510 | 506 | defer h.deinit(); |
| 511 | 507 | try h.append("foo", "bar", null); |
| 512 | 508 | try h.append("set-cookie", "x=1", null); |
| 513 | 509 | try h.append("set-cookie", "y=2", null); |
| 514 | 510 | |
| 515 | 511 | { |
| 516 | const v = try h.get(test_allocator, "not-present"); | |
| 512 | const v = try h.get(testing.allocator, "not-present"); | |
| 517 | 513 | testing.expect(null == v); |
| 518 | 514 | } |
| 519 | 515 | { |
| 520 | const v = (try h.get(test_allocator, "foo")).?; | |
| 521 | defer test_allocator.free(v); | |
| 516 | const v = (try h.get(testing.allocator, "foo")).?; | |
| 517 | defer testing.allocator.free(v); | |
| 522 | 518 | const e = v[0]; |
| 523 | 519 | testing.expectEqualSlices(u8, "foo", e.name); |
| 524 | 520 | testing.expectEqualSlices(u8, "bar", e.value); |
| 525 | 521 | testing.expectEqual(false, e.never_index); |
| 526 | 522 | } |
| 527 | 523 | { |
| 528 | const v = (try h.get(test_allocator, "set-cookie")).?; | |
| 529 | defer test_allocator.free(v); | |
| 524 | const v = (try h.get(testing.allocator, "set-cookie")).?; | |
| 525 | defer testing.allocator.free(v); | |
| 530 | 526 | { |
| 531 | 527 | const e = v[0]; |
| 532 | 528 | testing.expectEqualSlices(u8, "set-cookie", e.name); |
| ... | ... | @@ -543,30 +539,30 @@ test "Headers.get" { |
| 543 | 539 | } |
| 544 | 540 | |
| 545 | 541 | test "Headers.getCommaSeparated" { |
| 546 | var h = Headers.init(test_allocator); | |
| 542 | var h = Headers.init(testing.allocator); | |
| 547 | 543 | defer h.deinit(); |
| 548 | 544 | try h.append("foo", "bar", null); |
| 549 | 545 | try h.append("set-cookie", "x=1", null); |
| 550 | 546 | try h.append("set-cookie", "y=2", null); |
| 551 | 547 | |
| 552 | 548 | { |
| 553 | const v = try h.getCommaSeparated(test_allocator, "not-present"); | |
| 549 | const v = try h.getCommaSeparated(testing.allocator, "not-present"); | |
| 554 | 550 | testing.expect(null == v); |
| 555 | 551 | } |
| 556 | 552 | { |
| 557 | const v = (try h.getCommaSeparated(test_allocator, "foo")).?; | |
| 558 | defer test_allocator.free(v); | |
| 553 | const v = (try h.getCommaSeparated(testing.allocator, "foo")).?; | |
| 554 | defer testing.allocator.free(v); | |
| 559 | 555 | testing.expectEqualSlices(u8, "bar", v); |
| 560 | 556 | } |
| 561 | 557 | { |
| 562 | const v = (try h.getCommaSeparated(test_allocator, "set-cookie")).?; | |
| 563 | defer test_allocator.free(v); | |
| 558 | const v = (try h.getCommaSeparated(testing.allocator, "set-cookie")).?; | |
| 559 | defer testing.allocator.free(v); | |
| 564 | 560 | testing.expectEqualSlices(u8, "x=1,y=2", v); |
| 565 | 561 | } |
| 566 | 562 | } |
| 567 | 563 | |
| 568 | 564 | test "Headers.sort" { |
| 569 | var h = Headers.init(test_allocator); | |
| 565 | var h = Headers.init(testing.allocator); | |
| 570 | 566 | defer h.deinit(); |
| 571 | 567 | try h.append("foo", "bar", null); |
| 572 | 568 | try h.append("cookie", "somevalue", null); |
| ... | ... | @@ -587,7 +583,7 @@ test "Headers.sort" { |
| 587 | 583 | } |
| 588 | 584 | |
| 589 | 585 | test "Headers.format" { |
| 590 | var h = Headers.init(test_allocator); | |
| 586 | var h = Headers.init(testing.allocator); | |
| 591 | 587 | defer h.deinit(); |
| 592 | 588 | try h.append("foo", "bar", null); |
| 593 | 589 | try h.append("cookie", "somevalue", null); |
lib/std/io.zig+4-8| ... | ... | @@ -223,15 +223,13 @@ test "io.BufferedInStream" { |
| 223 | 223 | } |
| 224 | 224 | }; |
| 225 | 225 | |
| 226 | var buf: [100]u8 = undefined; | |
| 227 | const allocator = &std.heap.FixedBufferAllocator.init(buf[0..]).allocator; | |
| 228 | ||
| 229 | 226 | const str = "This is a test"; |
| 230 | 227 | var one_byte_stream = OneByteReadInStream.init(str); |
| 231 | 228 | var buf_in_stream = BufferedInStream(OneByteReadInStream.Error).init(&one_byte_stream.stream); |
| 232 | 229 | const stream = &buf_in_stream.stream; |
| 233 | 230 | |
| 234 | const res = try stream.readAllAlloc(allocator, str.len + 1); | |
| 231 | const res = try stream.readAllAlloc(testing.allocator, str.len + 1); | |
| 232 | defer testing.allocator.free(res); | |
| 235 | 233 | testing.expectEqualSlices(u8, str, res); |
| 236 | 234 | } |
| 237 | 235 | |
| ... | ... | @@ -874,10 +872,8 @@ pub fn readLineFrom(stream: var, buf: *std.Buffer) ![]u8 { |
| 874 | 872 | } |
| 875 | 873 | |
| 876 | 874 | test "io.readLineFrom" { |
| 877 | var bytes: [128]u8 = undefined; | |
| 878 | const allocator = &std.heap.FixedBufferAllocator.init(bytes[0..]).allocator; | |
| 879 | ||
| 880 | var buf = try std.Buffer.initSize(allocator, 0); | |
| 875 | var buf = try std.Buffer.initSize(testing.allocator, 0); | |
| 876 | defer buf.deinit(); | |
| 881 | 877 | var mem_stream = SliceInStream.init( |
| 882 | 878 | \\Line 1 |
| 883 | 879 | \\Line 22 |
lib/std/io/test.zig+4-9| ... | ... | @@ -11,9 +11,6 @@ const fs = std.fs; |
| 11 | 11 | const File = std.fs.File; |
| 12 | 12 | |
| 13 | 13 | test "write a file, read it, then delete it" { |
| 14 | var raw_bytes: [200 * 1024]u8 = undefined; | |
| 15 | var allocator = &std.heap.FixedBufferAllocator.init(raw_bytes[0..]).allocator; | |
| 16 | ||
| 17 | 14 | const cwd = fs.cwd(); |
| 18 | 15 | |
| 19 | 16 | var data: [1024]u8 = undefined; |
| ... | ... | @@ -53,8 +50,8 @@ test "write a file, read it, then delete it" { |
| 53 | 50 | var file_in_stream = file.inStream(); |
| 54 | 51 | var buf_stream = io.BufferedInStream(File.ReadError).init(&file_in_stream.stream); |
| 55 | 52 | const st = &buf_stream.stream; |
| 56 | const contents = try st.readAllAlloc(allocator, 2 * 1024); | |
| 57 | defer allocator.free(contents); | |
| 53 | const contents = try st.readAllAlloc(std.testing.allocator, 2 * 1024); | |
| 54 | defer std.testing.allocator.free(contents); | |
| 58 | 55 | |
| 59 | 56 | expect(mem.eql(u8, contents[0.."begin".len], "begin")); |
| 60 | 57 | expect(mem.eql(u8, contents["begin".len .. contents.len - "end".len], &data)); |
| ... | ... | @@ -64,10 +61,8 @@ test "write a file, read it, then delete it" { |
| 64 | 61 | } |
| 65 | 62 | |
| 66 | 63 | test "BufferOutStream" { |
| 67 | var bytes: [100]u8 = undefined; | |
| 68 | var allocator = &std.heap.FixedBufferAllocator.init(bytes[0..]).allocator; | |
| 69 | ||
| 70 | var buffer = try std.Buffer.initSize(allocator, 0); | |
| 64 | var buffer = try std.Buffer.initSize(std.testing.allocator, 0); | |
| 65 | defer buffer.deinit(); | |
| 71 | 66 | var buf_stream = &std.io.BufferOutStream.init(&buffer).stream; |
| 72 | 67 | |
| 73 | 68 | const x: i32 = 42; |
lib/std/os/test.zig+2-3| ... | ... | @@ -95,8 +95,6 @@ test "cpu count" { |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | test "AtomicFile" { |
| 98 | var buffer: [1024]u8 = undefined; | |
| 99 | const allocator = &std.heap.FixedBufferAllocator.init(buffer[0..]).allocator; | |
| 100 | 98 | const test_out_file = "tmp_atomic_file_test_dest.txt"; |
| 101 | 99 | const test_content = |
| 102 | 100 | \\ hello! |
| ... | ... | @@ -108,7 +106,8 @@ test "AtomicFile" { |
| 108 | 106 | try af.file.write(test_content); |
| 109 | 107 | try af.finish(); |
| 110 | 108 | } |
| 111 | const content = try io.readFileAlloc(allocator, test_out_file); | |
| 109 | const content = try io.readFileAlloc(testing.allocator, test_out_file); | |
| 110 | defer testing.allocator.free(content); | |
| 112 | 111 | expect(mem.eql(u8, content, test_content)); |
| 113 | 112 | |
| 114 | 113 | try fs.cwd().deleteFile(test_out_file); |
lib/std/process.zig+2-4| ... | ... | @@ -27,10 +27,8 @@ pub fn getCwdAlloc(allocator: *Allocator) ![]u8 { |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | test "getCwdAlloc" { |
| 30 | // at least call it so it gets compiled | |
| 31 | var buf: [1000]u8 = undefined; | |
| 32 | const allocator = &std.heap.FixedBufferAllocator.init(&buf).allocator; | |
| 33 | _ = getCwdAlloc(allocator) catch undefined; | |
| 30 | const cwd = try getCwdAlloc(testing.allocator); | |
| 31 | testing.allocator.free(cwd); | |
| 34 | 32 | } |
| 35 | 33 | |
| 36 | 34 | /// Caller must free result when done. |
lib/std/sort.zig+4-4| ... | ... | @@ -1220,16 +1220,16 @@ test "sort fuzz testing" { |
| 1220 | 1220 | const test_case_count = 10; |
| 1221 | 1221 | var i: usize = 0; |
| 1222 | 1222 | while (i < test_case_count) : (i += 1) { |
| 1223 | fuzzTest(&prng.random); | |
| 1223 | try fuzzTest(&prng.random); | |
| 1224 | 1224 | } |
| 1225 | 1225 | } |
| 1226 | 1226 | |
| 1227 | 1227 | var fixed_buffer_mem: [100 * 1024]u8 = undefined; |
| 1228 | 1228 | |
| 1229 | fn fuzzTest(rng: *std.rand.Random) void { | |
| 1229 | fn fuzzTest(rng: *std.rand.Random) !void { | |
| 1230 | 1230 | const array_size = rng.range(usize, 0, 1000); |
| 1231 | var fixed_allocator = std.heap.FixedBufferAllocator.init(fixed_buffer_mem[0..]); | |
| 1232 | var array = fixed_allocator.allocator.alloc(IdAndValue, array_size) catch unreachable; | |
| 1231 | var array = try testing.allocator.alloc(IdAndValue, array_size); | |
| 1232 | defer testing.allocator.free(array); | |
| 1233 | 1233 | // populate with random data |
| 1234 | 1234 | for (array) |*item, index| { |
| 1235 | 1235 | item.id = index; |
lib/std/unicode.zig+4-6| ... | ... | @@ -617,16 +617,14 @@ test "utf8ToUtf16Le" { |
| 617 | 617 | |
| 618 | 618 | test "utf8ToUtf16LeWithNull" { |
| 619 | 619 | { |
| 620 | var bytes: [128]u8 = undefined; | |
| 621 | const allocator = &std.heap.FixedBufferAllocator.init(bytes[0..]).allocator; | |
| 622 | const utf16 = try utf8ToUtf16LeWithNull(allocator, "𐐷"); | |
| 620 | const utf16 = try utf8ToUtf16LeWithNull(testing.allocator, "𐐷"); | |
| 621 | defer testing.allocator.free(utf16); | |
| 623 | 622 | testing.expectEqualSlices(u8, "\x01\xd8\x37\xdc", @sliceToBytes(utf16[0..])); |
| 624 | 623 | testing.expect(utf16[2] == 0); |
| 625 | 624 | } |
| 626 | 625 | { |
| 627 | var bytes: [128]u8 = undefined; | |
| 628 | const allocator = &std.heap.FixedBufferAllocator.init(bytes[0..]).allocator; | |
| 629 | const utf16 = try utf8ToUtf16LeWithNull(allocator, "\u{10FFFF}"); | |
| 626 | const utf16 = try utf8ToUtf16LeWithNull(testing.allocator, "\u{10FFFF}"); | |
| 627 | defer testing.allocator.free(utf16); | |
| 630 | 628 | testing.expectEqualSlices(u8, "\xff\xdb\xff\xdf", @sliceToBytes(utf16[0..])); |
| 631 | 629 | testing.expect(utf16[2] == 0); |
| 632 | 630 | } |
lib/std/zig/parser_test.zig+1-2| ... | ... | @@ -2886,8 +2886,7 @@ fn testCanonical(source: []const u8) !void { |
| 2886 | 2886 | } |
| 2887 | 2887 | |
| 2888 | 2888 | fn testError(source: []const u8) !void { |
| 2889 | var fixed_allocator = std.heap.FixedBufferAllocator.init(fixed_buffer_mem[0..]); | |
| 2890 | const tree = try std.zig.parse(&fixed_allocator.allocator, source); | |
| 2889 | const tree = try std.zig.parse(std.testing.allocator, source); | |
| 2891 | 2890 | defer tree.deinit(); |
| 2892 | 2891 | |
| 2893 | 2892 | std.testing.expect(tree.errors.len != 0); |
test/stage1/behavior/bugs/1851.zig+2-3| ... | ... | @@ -6,10 +6,9 @@ test "allocation and looping over 3-byte integer" { |
| 6 | 6 | expect(@sizeOf([1]u24) == 4); |
| 7 | 7 | expect(@alignOf(u24) == 4); |
| 8 | 8 | expect(@alignOf([1]u24) == 4); |
| 9 | var buffer: [100]u8 = undefined; | |
| 10 | const a = &std.heap.FixedBufferAllocator.init(&buffer).allocator; | |
| 11 | 9 | |
| 12 | var x = a.alloc(u24, 2) catch unreachable; | |
| 10 | var x = try std.testing.allocator.alloc(u24, 2); | |
| 11 | defer std.testing.allocator.free(x); | |
| 13 | 12 | expect(x.len == 2); |
| 14 | 13 | x[0] = 0xFFFFFF; |
| 15 | 14 | x[1] = 0xFFFFFF; |