diff options
| author | J.C. Moyer <jcmoyer32@gmail.com> | 2023-05-21 16:42:48 -0400 |
|---|---|---|
| committer | J.C. Moyer <jcmoyer32@gmail.com> | 2023-05-21 16:42:48 -0400 |
| commit | 249f42f05455fb71bd0b5e4acee445991a988699 (patch) | |
| tree | 8e10ab04291b293ccbd453897120b66d3570cd5f /tests/issues | |
| parent | 963908e50864634dc7554d4a0e1720a2309ae807 (diff) | |
Add test for #2466
Diffstat (limited to 'tests/issues')
| -rw-r--r-- | tests/issues/run.bat | 1 | ||||
| -rwxr-xr-x | tests/issues/run.sh | 1 | ||||
| -rw-r--r-- | tests/issues/test_issue_2466.odin | 22 |
3 files changed, 24 insertions, 0 deletions
diff --git a/tests/issues/run.bat b/tests/issues/run.bat index 87492bc29..bf49bc85b 100644 --- a/tests/issues/run.bat +++ b/tests/issues/run.bat @@ -12,6 +12,7 @@ set COMMON=-collection:tests=..\.. ..\..\..\odin test ..\test_issue_2056.odin %COMMON% -file || exit /b ..\..\..\odin test ..\test_issue_2087.odin %COMMON% -file || exit /b ..\..\..\odin build ..\test_issue_2113.odin %COMMON% -file -debug || exit /b +..\..\..\odin test ..\test_issue_2466.odin %COMMON% -file || exit /b @echo off diff --git a/tests/issues/run.sh b/tests/issues/run.sh index f894f2dae..bbcd6fb28 100755 --- a/tests/issues/run.sh +++ b/tests/issues/run.sh @@ -13,6 +13,7 @@ $ODIN test ../test_issue_1592.odin $COMMON -file $ODIN test ../test_issue_2056.odin $COMMON -file $ODIN test ../test_issue_2087.odin $COMMON -file $ODIN build ../test_issue_2113.odin $COMMON -file -debug +$ODIN test ../test_issue_2466.odin $COMMON -file set +x diff --git a/tests/issues/test_issue_2466.odin b/tests/issues/test_issue_2466.odin new file mode 100644 index 000000000..4810cfea9 --- /dev/null +++ b/tests/issues/test_issue_2466.odin @@ -0,0 +1,22 @@ +// Tests issue #2466 https://github.com/odin-lang/Odin/issues/2466 +package test_issues + +import "core:fmt" +import "core:testing" + +Bug :: struct { + val: int, + arr: []int, +} + +@test +test_compound_literal_local_reuse :: proc(t: ^testing.T) { + v: int = 123 + bug := Bug { + val = v, + arr = {42}, + } + testing.expect(t, bug.val == 123, fmt.tprintf("expected 123, found %d", bug.val)) + testing.expect(t, bug.arr[0] == 42, fmt.tprintf("expected 42, found %d", bug.arr[0])) +} + |