Laytan Laats 2 years ago
parent
commit
a3e2d90f4c
3 changed files with 21 additions and 0 deletions
  1. 1 0
      tests/issues/run.bat
  2. 1 0
      tests/issues/run.sh
  3. 19 0
      tests/issues/test_issue_2615.odin

+ 1 - 0
tests/issues/run.bat

@@ -13,6 +13,7 @@ set COMMON=-collection:tests=..\..
 ..\..\..\odin test ..\test_issue_2087.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 build ..\test_issue_2113.odin %COMMON% -file -debug || exit /b
 ..\..\..\odin test ..\test_issue_2466.odin %COMMON% -file || exit /b
 ..\..\..\odin test ..\test_issue_2466.odin %COMMON% -file || exit /b
+..\..\..\odin test ..\test_issue_2615.odin %COMMON% -file || exit /b
 
 
 @echo off
 @echo off
 
 

+ 1 - 0
tests/issues/run.sh

@@ -16,6 +16,7 @@ $ODIN test ../test_issue_2056.odin $COMMON -file
 $ODIN test ../test_issue_2087.odin $COMMON -file
 $ODIN test ../test_issue_2087.odin $COMMON -file
 $ODIN build ../test_issue_2113.odin $COMMON -file -debug
 $ODIN build ../test_issue_2113.odin $COMMON -file -debug
 $ODIN test ../test_issue_2466.odin $COMMON -file
 $ODIN test ../test_issue_2466.odin $COMMON -file
+$ODIN test ../test_issue_2615.odin $COMMON -file
 if [[ $($ODIN build ../test_issue_2395.odin $COMMON -file 2>&1 >/dev/null | grep -c "$NO_NIL_ERR") -eq 2 ]] ; then
 if [[ $($ODIN build ../test_issue_2395.odin $COMMON -file 2>&1 >/dev/null | grep -c "$NO_NIL_ERR") -eq 2 ]] ; then
 	echo "SUCCESSFUL 1/1"
 	echo "SUCCESSFUL 1/1"
 else
 else

+ 19 - 0
tests/issues/test_issue_2615.odin

@@ -0,0 +1,19 @@
+// Tests issue https://github.com/odin-lang/Odin/issues/2615
+// Cannot iterate over string literals
+package test_issues
+
+import "core:testing"
+
+@(test)
+test_cannot_iterate_over_string_literal :: proc(t: ^testing.T) {
+	for c, i in "fo世" {
+		switch i {
+		case 0:
+			testing.expect_value(t, c, 'f')
+		case 1:
+			testing.expect_value(t, c, 'o')
+		case 2:
+			testing.expect_value(t, c, '世')
+		}
+	}
+}