summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-18 09:06:59 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-18 09:06:59 -0400
commitcff8506a90984086d4a3455396d38f996b17ab73 (patch)
tree11635347bbfa441307664389acb8e7176a48fa26 /tools
parent6d12396da33352a47aa821b48e51512c3601b124 (diff)
Fix issue with odinfmt stripping the semicolon after a switch init with no condition
Diffstat (limited to 'tools')
-rw-r--r--tools/odinfmt/tests/.snapshots/switch.odin17
-rw-r--r--tools/odinfmt/tests/switch.odin19
2 files changed, 36 insertions, 0 deletions
diff --git a/tools/odinfmt/tests/.snapshots/switch.odin b/tools/odinfmt/tests/.snapshots/switch.odin
new file mode 100644
index 0000000..f4bd9ac
--- /dev/null
+++ b/tools/odinfmt/tests/.snapshots/switch.odin
@@ -0,0 +1,17 @@
+package odinfmt_test
+
+main :: proc() {
+ foos := []string{"foo", "bar"}
+
+ for i in 0 ..< len(foos) {
+ switch foo := foo[i]; {
+ case "foo":
+ }
+ }
+
+ for i in 0 ..< len(foos) {
+ switch foo := foo[i]; foo {
+ case "foo":
+ }
+ }
+}
diff --git a/tools/odinfmt/tests/switch.odin b/tools/odinfmt/tests/switch.odin
new file mode 100644
index 0000000..f17d010
--- /dev/null
+++ b/tools/odinfmt/tests/switch.odin
@@ -0,0 +1,19 @@
+package odinfmt_test
+
+main :: proc() {
+ foos := []string{
+ "foo", "bar"}
+
+ for i in 0..<len(foos) {
+ switch foo := foo[i]; {
+ case "foo":
+ }
+ }
+
+ for i in 0..<len(foos) {
+ switch foo := foo[i];
+ foo {
+ case "foo":
+ }
+ }
+}