diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2022-12-24 02:33:06 -0500 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2022-12-24 02:40:33 -0500 |
| commit | 6cd80042133c28d37bb30eba49d022a4fb23c058 (patch) | |
| tree | 145473c2257fc2d9ed6d8538e9304b286d64ccdf /test/behavior/array.zig | |
| parent | 0559cdb5542a2acb50ce49363c1973f3ca70365e (diff) | |
| download | zig-6cd80042133c28d37bb30eba49d022a4fb23c058.tar.gz zig-6cd80042133c28d37bb30eba49d022a4fb23c058.zip | |
Sema: relax undefined checks for concat
Closes #14037
Diffstat (limited to 'test/behavior/array.zig')
| -rw-r--r-- | test/behavior/array.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/behavior/array.zig b/test/behavior/array.zig index 155ac294cf..0faa58a7d4 100644 --- a/test/behavior/array.zig +++ b/test/behavior/array.zig @@ -45,6 +45,19 @@ fn getArrayLen(a: []const u32) usize { return a.len; } +test "array concat with undefined" { + { + var array = "hello".* ++ @as([5]u8, undefined); + array[5..10].* = "world".*; + try std.testing.expect(std.mem.eql(u8, &array, "helloworld")); + } + { + var array = @as([5]u8, undefined) ++ "world".*; + array[0..5].* = "hello".*; + try std.testing.expect(std.mem.eql(u8, &array, "helloworld")); + } +} + test "array concat with tuple" { const array: [2]u8 = .{ 1, 2 }; { |
