summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Valentine-House <[email protected]>2023-10-20 11:11:08 +0100
committerMatt Valentine-House <[email protected]>2023-10-30 19:44:42 +0000
commit91fba0a3d2d00e3e532f6d84cac9e5477e2bdaa6 (patch)
tree1f66ae8521a251782de4a0e6943757af11671ec8
parent5dfba84cffd149c97e1cb7a1cb3e40869e127c5f (diff)
[Prism] Add ForNode tests
-rw-r--r--test/ruby/test_compile_prism.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb
index 60b669eb0e..9b77df30da 100644
--- a/test/ruby/test_compile_prism.rb
+++ b/test/ruby/test_compile_prism.rb
@@ -535,6 +535,15 @@ module Prism
assert_prism_eval("a = 0; while a != 1; a = a + 1; end")
end
+ def test_ForNode
+ assert_prism_eval("for i in [1,2] do; i; end")
+ assert_prism_eval("for @i in [1,2] do; @i; end")
+ assert_prism_eval("for $i in [1,2] do; $i; end")
+
+ # TODO: multiple assignment in ForNode index
+ #assert_prism_eval("for i, j in {a: 'b'} do; i; j; end")
+ end
+
############################################################################
# Throws #
############################################################################