summaryrefslogtreecommitdiff
path: root/test/prism/fixtures/unparser
diff options
context:
space:
mode:
Diffstat (limited to 'test/prism/fixtures/unparser')
-rw-r--r--test/prism/fixtures/unparser/LICENSE20
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/alias.txt2
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/assignment.txt53
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/block.txt96
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/case.txt37
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/class.txt35
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/def.txt134
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/defined.txt3
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/defs.txt40
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/dstr.txt37
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/empty.txt0
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/empty_begin.txt1
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/flipflop.txt10
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/for.txt12
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/hookexe.txt7
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/if.txt36
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/kwbegin.txt80
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/lambda.txt13
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/literal.txt91
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/module.txt16
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/opasgn.txt24
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/pattern.txt41
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/pragma.txt4
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/range.txt4
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/rescue.txt3
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/send.txt84
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/since/27.txt4
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/since/30.txt4
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/since/31.txt7
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/since/32.txt11
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/singletons.txt4
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/super.txt21
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/unary.txt8
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/undef.txt2
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/variables.txt10
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/while.txt73
-rw-r--r--test/prism/fixtures/unparser/corpus/semantic/and.txt8
-rw-r--r--test/prism/fixtures/unparser/corpus/semantic/block.txt26
-rw-r--r--test/prism/fixtures/unparser/corpus/semantic/def.txt7
-rw-r--r--test/prism/fixtures/unparser/corpus/semantic/dstr.txt127
-rw-r--r--test/prism/fixtures/unparser/corpus/semantic/kwbegin.txt42
-rw-r--r--test/prism/fixtures/unparser/corpus/semantic/literal.txt14
-rw-r--r--test/prism/fixtures/unparser/corpus/semantic/opasgn.txt1
-rw-r--r--test/prism/fixtures/unparser/corpus/semantic/send.txt6
-rw-r--r--test/prism/fixtures/unparser/corpus/semantic/undef.txt2
-rw-r--r--test/prism/fixtures/unparser/corpus/semantic/while.txt25
46 files changed, 1285 insertions, 0 deletions
diff --git a/test/prism/fixtures/unparser/LICENSE b/test/prism/fixtures/unparser/LICENSE
new file mode 100644
index 0000000000..44863d7afb
--- /dev/null
+++ b/test/prism/fixtures/unparser/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2013 Markus Schirp
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/test/prism/fixtures/unparser/corpus/literal/alias.txt b/test/prism/fixtures/unparser/corpus/literal/alias.txt
new file mode 100644
index 0000000000..fb06a295e8
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/alias.txt
@@ -0,0 +1,2 @@
+alias $foo $bar
+alias :foo :bar
diff --git a/test/prism/fixtures/unparser/corpus/literal/assignment.txt b/test/prism/fixtures/unparser/corpus/literal/assignment.txt
new file mode 100644
index 0000000000..84a74e8928
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/assignment.txt
@@ -0,0 +1,53 @@
+$a = 1
+($a, $b) = [1, 2]
+((a,), b) = 1
+(*a) = []
+(*foo) = [1, 2]
+(@@a, @@b) = [1, 2]
+(@a, @b) = [1, 2]
+(a, (b, c)) = [1, [2, 3]]
+(a, *) = [1, 2]
+(a, *foo) = [1, 2]
+(a, b) = [1, 2]
+(a, b) = foo
+(a,) = foo
+(a.foo, a.bar) = [1, 2]
+(a[*foo], a[1]) = [1, 2]
+(a[0], a[1]) = [1, 2]
+(*c.foo) = 1
+::Foo = ::Bar
+@@a = 1
+@a = 1
+CONST = 1
+Name::Spaced::CONST = 1
+a = ((b, c) = 1)
+a = 1
+foo = foo()
+foo.[]=()
+foo.[]=(1, 2)
+foo.[]=true
+foo[*index] = value
+foo[1..2] = value
+foo[] = 1
+foo[a, b] = value
+foo[index] = value
+x = %()
+x.x=%()
+x[%()] = bar
+a[%()] ||= bar
+@a ||= %()
+x = <<-HEREDOC
+ #{}
+HEREDOC
+x.x=<<-HEREDOC
+ #{}
+HEREDOC
+x[] = <<-HEREDOC
+ #{}
+HEREDOC
+a[<<-HEREDOC] ||= bar
+ #{}
+HEREDOC
+@a ||= <<-HEREDOC
+ #{}
+HEREDOC
diff --git a/test/prism/fixtures/unparser/corpus/literal/block.txt b/test/prism/fixtures/unparser/corpus/literal/block.txt
new file mode 100644
index 0000000000..b2baf1dc12
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/block.txt
@@ -0,0 +1,96 @@
+foo {
+}
+foo { |a|
+}
+foo { |a,|
+}
+foo { |a,; x|
+}
+foo { |a, b|
+}
+foo(1) {
+ nil
+}
+foo { |a, *b|
+ nil
+}
+foo { |a, *|
+ nil
+}
+foo {
+ bar
+}
+foo.bar { |(a, b), c|
+ d
+}
+foo.bar { |*a; b|
+}
+foo.bar { |a; b|
+}
+foo.bar { |; a, b|
+}
+foo.bar { |*|
+ d
+}
+foo.bar { |(*)|
+ d
+}
+foo.bar { |((*))|
+ d
+}
+foo.bar { |(a, (*))|
+ d
+}
+foo.bar { |(a, b)|
+ d
+}
+foo.bar {
+}.baz
+m do
+rescue Exception => e
+end
+m do
+ foo
+rescue Exception => bar
+ bar
+end
+m do
+ bar
+rescue SomeError, *bar
+ baz
+end
+m do
+ bar
+rescue SomeError, *bar => exception
+ baz
+end
+m do
+ bar
+rescue *bar
+ baz
+end
+m do
+ bar
+rescue LoadError
+end
+m do
+ bar
+rescue
+else
+ baz
+end
+m do
+ bar
+rescue *bar => exception
+ baz
+end
+m do
+ensure
+end
+m do
+rescue
+ensure
+end
+bar {
+ _1 + _2
+}
diff --git a/test/prism/fixtures/unparser/corpus/literal/case.txt b/test/prism/fixtures/unparser/corpus/literal/case.txt
new file mode 100644
index 0000000000..c455fd7c39
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/case.txt
@@ -0,0 +1,37 @@
+case
+when bar
+ baz
+when baz
+ bar
+end
+case foo
+when bar
+when baz
+ bar
+end
+case foo
+when bar
+ baz
+when baz
+ bar
+end
+case foo
+when bar, baz
+ :other
+end
+case foo
+when *bar
+ :value
+end
+case foo
+when bar
+ baz
+else
+ :foo
+end
+case foo
+when *bar | baz
+end
+case foo
+when *bar.baz=1
+end
diff --git a/test/prism/fixtures/unparser/corpus/literal/class.txt b/test/prism/fixtures/unparser/corpus/literal/class.txt
new file mode 100644
index 0000000000..f0198625e9
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/class.txt
@@ -0,0 +1,35 @@
+class A
+end
+
+class << a
+end
+
+class << a
+ b
+end
+
+class A::B
+end
+
+class A::B::C
+end
+
+class A < B
+end
+
+class A < B::C
+end
+
+class A::B < C::D
+end
+
+class A
+ include(B.new)
+
+ def foo
+ :bar
+ end
+end
+
+class ::A
+end
diff --git a/test/prism/fixtures/unparser/corpus/literal/def.txt b/test/prism/fixtures/unparser/corpus/literal/def.txt
new file mode 100644
index 0000000000..61339bd4a6
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/def.txt
@@ -0,0 +1,134 @@
+def foo
+ a
+rescue
+ b
+else
+ c
+ensure
+ d
+end
+
+def foo
+ a rescue b
+rescue
+ b
+else
+ c
+ensure
+ d
+end
+
+def foo(bar:, baz:)
+end
+
+def foo
+end
+
+def foo
+ bar
+end
+
+def foo
+ foo
+rescue
+ bar
+ensure
+ baz
+end
+
+def foo
+ bar
+ensure
+ baz
+end
+
+def foo
+ bar
+rescue
+ baz
+end
+
+def foo(bar)
+ bar
+end
+
+def foo(bar, baz)
+ bar
+end
+
+def foo(bar = ())
+ bar
+end
+
+def foo(bar = (baz; nil))
+end
+
+def foo(bar = true)
+ bar
+end
+
+def foo(bar, baz = true)
+ bar
+end
+
+def foo(bar: 1)
+end
+
+def foo(bar: baz)
+end
+
+def foo(bar: bar())
+end
+
+def foo(*)
+ bar
+end
+
+def foo(*bar)
+ bar
+end
+
+def foo(bar, *baz)
+ bar
+end
+
+def foo(baz = true, *bor)
+ bar
+end
+
+def foo(baz = true, *bor, &block)
+ bar
+end
+
+def foo(bar, baz = true, *bor)
+ bar
+end
+
+def foo(&block)
+ bar
+end
+
+def foo(bar, &block)
+ bar
+end
+
+def foo
+ bar
+ baz
+end
+
+def f(((a)))
+end
+
+def foo(bar:, baz: "value")
+end
+
+def f
+ <<-HEREDOC
+ #{}
+ HEREDOC
+end
+
+def f
+ %()
+end
diff --git a/test/prism/fixtures/unparser/corpus/literal/defined.txt b/test/prism/fixtures/unparser/corpus/literal/defined.txt
new file mode 100644
index 0000000000..65e7c370fd
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/defined.txt
@@ -0,0 +1,3 @@
+defined?(@foo)
+defined?(Foo)
+defined?(((a, b) = [1, 2]))
diff --git a/test/prism/fixtures/unparser/corpus/literal/defs.txt b/test/prism/fixtures/unparser/corpus/literal/defs.txt
new file mode 100644
index 0000000000..b70aa9efc5
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/defs.txt
@@ -0,0 +1,40 @@
+def self.foo
+end
+
+def self.foo
+ bar
+end
+
+def self.foo
+ bar
+ baz
+end
+
+def Foo.bar
+ bar
+end
+
+def (foo { |bar|
+}).bar
+ bar
+end
+
+def (foo(1)).bar
+ bar
+end
+
+def (Foo::Bar.baz).bar
+ baz
+end
+
+def (Foo::Bar).bar
+ baz
+end
+
+def Foo.bar
+ baz
+end
+
+def foo.bar
+ baz
+end
diff --git a/test/prism/fixtures/unparser/corpus/literal/dstr.txt b/test/prism/fixtures/unparser/corpus/literal/dstr.txt
new file mode 100644
index 0000000000..8a912d28ed
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/dstr.txt
@@ -0,0 +1,37 @@
+if true
+ "#{}a"
+end
+if true
+ <<-HEREDOC
+a
+#{}a
+b
+ HEREDOC
+ x
+end
+<<-HEREDOC
+\#{}\#{}
+#{}
+#{}
+#{}
+HEREDOC
+<<-HEREDOC rescue nil
+#{}
+a
+HEREDOC
+"a#$1"
+"a#$a"
+"a#@a"
+"a#@@a"
+if true
+ return <<-HEREDOC
+ #{42}
+ HEREDOC
+end
+foo(<<-HEREDOC)
+ #{bar}
+HEREDOC
+foo(<<-HEREDOC) { |x|
+ #{bar}
+HEREDOC
+}
diff --git a/test/prism/fixtures/unparser/corpus/literal/empty.txt b/test/prism/fixtures/unparser/corpus/literal/empty.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/empty.txt
diff --git a/test/prism/fixtures/unparser/corpus/literal/empty_begin.txt b/test/prism/fixtures/unparser/corpus/literal/empty_begin.txt
new file mode 100644
index 0000000000..6a452c185a
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/empty_begin.txt
@@ -0,0 +1 @@
+()
diff --git a/test/prism/fixtures/unparser/corpus/literal/flipflop.txt b/test/prism/fixtures/unparser/corpus/literal/flipflop.txt
new file mode 100644
index 0000000000..139904a53f
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/flipflop.txt
@@ -0,0 +1,10 @@
+if ((i == 4)..(i == 4))
+ foo
+end
+if ((i == 4)...(i == 4))
+ foo
+end
+if ..foo
+end
+if foo..;
+end
diff --git a/test/prism/fixtures/unparser/corpus/literal/for.txt b/test/prism/fixtures/unparser/corpus/literal/for.txt
new file mode 100644
index 0000000000..4c19a352d9
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/for.txt
@@ -0,0 +1,12 @@
+bar(for a in bar do
+ baz
+end)
+for a in bar do
+ baz
+end
+for (a, *b) in bar do
+ baz
+end
+for (a, b) in bar do
+ baz
+end
diff --git a/test/prism/fixtures/unparser/corpus/literal/hookexe.txt b/test/prism/fixtures/unparser/corpus/literal/hookexe.txt
new file mode 100644
index 0000000000..08f14f47b3
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/hookexe.txt
@@ -0,0 +1,7 @@
+BEGIN {
+ foo
+}
+bar
+END {
+ baz
+}
diff --git a/test/prism/fixtures/unparser/corpus/literal/if.txt b/test/prism/fixtures/unparser/corpus/literal/if.txt
new file mode 100644
index 0000000000..0c13801f9e
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/if.txt
@@ -0,0 +1,36 @@
+if /foo/
+ bar
+end
+if 3
+ 9
+end
+if 4
+ 5
+else
+ 6
+end
+unless 3
+ nil
+end
+unless 3
+ 9
+end
+if foo
+end
+
+module A
+ foo = bar if foo
+end
+
+module B
+ foo = bar unless foo
+end
+unless foo
+ foo = bar
+end
+if foo { |pair|
+ pair
+}
+ pair = :foo
+ foo
+end
diff --git a/test/prism/fixtures/unparser/corpus/literal/kwbegin.txt b/test/prism/fixtures/unparser/corpus/literal/kwbegin.txt
new file mode 100644
index 0000000000..6cc1e74ca6
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/kwbegin.txt
@@ -0,0 +1,80 @@
+begin
+rescue
+end
+
+begin
+ensure
+end
+
+begin
+ a
+end
+
+begin
+ a
+rescue
+ b
+end
+
+begin
+ a
+ b
+rescue
+ b
+end
+
+begin
+rescue A
+end
+
+begin
+rescue A => foo
+end
+
+begin
+ a
+rescue A
+ b
+rescue B
+ c
+ensure
+ d
+end
+
+begin
+ begin
+ foo
+ bar
+ rescue
+ end
+rescue
+ baz
+ bar
+end
+
+begin
+ raise(Exception) rescue foo = bar
+rescue Exception
+end
+
+begin
+ foo
+rescue => bar
+ bar
+end
+
+begin
+ foo
+rescue Exception, Other => bar
+ bar
+end
+
+begin
+ bar
+rescue SomeError, *bar => exception
+ baz
+end
+
+class << self
+ undef :bar rescue nil
+end
diff --git a/test/prism/fixtures/unparser/corpus/literal/lambda.txt b/test/prism/fixtures/unparser/corpus/literal/lambda.txt
new file mode 100644
index 0000000000..4eb722dad1
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/lambda.txt
@@ -0,0 +1,13 @@
+lambda {
+}
+lambda { |a, b|
+ a
+}
+->() {
+}
+->(a) {
+}
+->(a, b) {
+}
+->(a, b; c) {
+}
diff --git a/test/prism/fixtures/unparser/corpus/literal/literal.txt b/test/prism/fixtures/unparser/corpus/literal/literal.txt
new file mode 100644
index 0000000000..2fc7cd1d79
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/literal.txt
@@ -0,0 +1,91 @@
+{ "foo" => <<-HEREDOC, "bar" => :baz }
+ #{}
+HEREDOC
+{ "foo" => %(), "bar" => :baz }
+["foo", %()]
+a(<<-HEREDOC).a
+ #{}
+HEREDOC
+a(%()).a
+{ "foo" => <<-HEREDOC, **baz }
+ #{}
+HEREDOC
+{ "foo" => %(), **baz }
+"#@a #@@a #$a"
+0
+++1
+1
+1
+1r
+1.5r
+1.3r
+5i
+-5i
+0.6i
+-0.6i
+1000000000000000000000000000000i
+1ri
+"foo" "bar"
+"foobar #{baz}"
+"foo#{1}bar"
+"\\\\#{}"
+"#{}\#{}"
+"\#{}#{}"
+"foo\\\#{@bar}"
+"\""
+"foo bar"
+"foo\nbar"
+`foo`
+`foo#{@bar}`
+`)`
+`\``
+`"`
+:foo
+:"A B"
+:foo
+:"A B"
+:"A\"B"
+:""
+/foo/
+/[^-+',.\/:@[:alnum:]\[\]]+/
+/foo#{@bar}/
+/foo#{@bar}/imx
+/#{"\u0000"}/
+/\n/
+/\n/
+/\n/x
+/\/\//x
+:"foo#{bar}baz"
+:"#{"foo"}"
+(0.0 / 0.0)..1
+1..(0.0 / 0.0)
+(0.0 / 0.0)..100
+-0.1
+0.1
+[1, 2]
+[1, (), n2]
+[1]
+[]
+[1, *@foo]
+[*@foo, 1]
+[*@foo, *@baz]
+{}
+{ () => () }
+{ 1 => 2 }
+{ 1 => 2, 3 => 4 }
+{ a: (1 rescue foo), b: 2 }
+{ a: 1, b: 2 }
+{ a: :a }
+{ :"a b" => 1 }
+{ :-@ => 1 }
+"#{}
+#{}\na"
+foo {
+ "#{}
+#{}\na"
+}
+:"a\\
+b"
+` x
+#{foo}
+#`
diff --git a/test/prism/fixtures/unparser/corpus/literal/module.txt b/test/prism/fixtures/unparser/corpus/literal/module.txt
new file mode 100644
index 0000000000..cec03f3bfd
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/module.txt
@@ -0,0 +1,16 @@
+module A
+end
+
+module A::B
+end
+
+module A::B::C
+end
+
+module A
+ include(B.new)
+
+ def foo
+ :bar
+ end
+end
diff --git a/test/prism/fixtures/unparser/corpus/literal/opasgn.txt b/test/prism/fixtures/unparser/corpus/literal/opasgn.txt
new file mode 100644
index 0000000000..5858d773d0
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/opasgn.txt
@@ -0,0 +1,24 @@
+a += 2
+a -= 2
+a **= 2
+a *= 2
+a /= 2
+a &&= b
+a ||= 2
+(a ||= 2).bar
+(h ||= {})[k] = v
+a.b += 2
+a.b -= 2
+a.b **= 2
+a.b *= 2
+a.b /= 2
+a.b &&= b
+a.b ||= 2
+a[b] += 2
+a[b] -= 2
+a[b] **= 2
+a[b] *= 2
+a[b] /= 2
+a[b] &&= b
+a[b] ||= 2
+foo.A += 1
diff --git a/test/prism/fixtures/unparser/corpus/literal/pattern.txt b/test/prism/fixtures/unparser/corpus/literal/pattern.txt
new file mode 100644
index 0000000000..7cfaa4dc67
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/pattern.txt
@@ -0,0 +1,41 @@
+case foo
+in A[1, 2, *a, 3] then
+ true
+in [1, 2, ] then
+ y
+in A(x:) then
+ true
+in {**a} then
+ true
+in {} if true then
+ true
+in [x, y, *] then
+ true
+in {a: 1, aa: 2} then
+ true
+in {} then
+ true
+in {**nil} then
+ true
+in {"a": 1} then
+ true
+in 1 | 2 then
+ true
+in 1 => a then
+ true
+in ^x then
+ true
+in 1
+in 2 then
+ true
+else
+ true
+end
+case foo
+in A[1, 2, *a, 3]
+end
+case foo
+in A
+else
+end
+1 in [a]
diff --git a/test/prism/fixtures/unparser/corpus/literal/pragma.txt b/test/prism/fixtures/unparser/corpus/literal/pragma.txt
new file mode 100644
index 0000000000..4f6dd71b38
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/pragma.txt
@@ -0,0 +1,4 @@
+__ENCODING__
+__FILE__
+__LINE__
+__dir__
diff --git a/test/prism/fixtures/unparser/corpus/literal/range.txt b/test/prism/fixtures/unparser/corpus/literal/range.txt
new file mode 100644
index 0000000000..eb1f3874c0
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/range.txt
@@ -0,0 +1,4 @@
+(1..)
+1..2
+(1...)
+1...2
diff --git a/test/prism/fixtures/unparser/corpus/literal/rescue.txt b/test/prism/fixtures/unparser/corpus/literal/rescue.txt
new file mode 100644
index 0000000000..a787816808
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/rescue.txt
@@ -0,0 +1,3 @@
+foo rescue bar
+foo rescue return bar
+x = (foo rescue return bar)
diff --git a/test/prism/fixtures/unparser/corpus/literal/send.txt b/test/prism/fixtures/unparser/corpus/literal/send.txt
new file mode 100644
index 0000000000..1e9c2a94be
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/send.txt
@@ -0,0 +1,84 @@
+module A
+ foo ||= ((a, _) = b)
+end
+
+module A
+ local = 1
+ local.bar
+end
+class A
+end.bar
+module A
+end.bar
+begin
+rescue
+end.bar
+case (def foo
+end; :bar)
+when bar
+end.baz
+case foo
+when bar
+end.baz
+class << self
+end.bar
+def self.foo
+end.bar
+def foo
+end.bar
+until foo
+end.bar
+while foo
+end.bar
+loop {
+}.bar
+if foo
+end.baz
+(/bar/ =~ :foo).foo
+(1..2).max
+(foo =~ /bar/).foo
+/bar/ =~ :foo
+/bar/ =~ foo
+1..2.max
+A.foo
+FOO()
+a&.b
+a.foo
+foo
+foo << (bar * baz)
+foo =~ /bar/
+foo(&(foo || bar))
+foo(&block)
+foo(*args, &block)
+foo(*arguments)
+foo(1, 2)
+foo(bar)
+foo(bar, *args)
+foo(foo =~ /bar/)
+foo.bar(&baz)
+foo.bar(*arga, foo, *argb)
+foo.bar(*args)
+foo.bar(*args, foo)
+foo.bar(:baz, &baz)
+foo.bar(baz: boz)
+foo.bar(foo, "baz" => boz)
+foo.bar(foo, *args)
+foo.bar(foo, *args, &block)
+foo.bar(foo, {})
+foo.bar({ foo: boz }, boz)
+foo.bar=:baz
+foo(a: b)
+foo.&(a: b)
+foo.&(**a)
+foo[*baz]
+foo[1, 2]
+foo[]
+self.foo
+self.foo=:bar
+(a + b) / (c - d)
+(a + b) / c.-(e, f)
+(a + b) / c.-(*f)
+x(**foo)
+foo&.!
+foo.~(b)
+a&.+(b)
diff --git a/test/prism/fixtures/unparser/corpus/literal/since/27.txt b/test/prism/fixtures/unparser/corpus/literal/since/27.txt
new file mode 100644
index 0000000000..c332f9e48e
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/since/27.txt
@@ -0,0 +1,4 @@
+-> {
+ _1 + _2
+}
+(..1)
diff --git a/test/prism/fixtures/unparser/corpus/literal/since/30.txt b/test/prism/fixtures/unparser/corpus/literal/since/30.txt
new file mode 100644
index 0000000000..b73328a4b0
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/since/30.txt
@@ -0,0 +1,4 @@
+1 => [a]
+1 => [*]
+1 in [*, 42, *]
+1 in [*, a, *foo]
diff --git a/test/prism/fixtures/unparser/corpus/literal/since/31.txt b/test/prism/fixtures/unparser/corpus/literal/since/31.txt
new file mode 100644
index 0000000000..504eb94d5b
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/since/31.txt
@@ -0,0 +1,7 @@
+def foo(&)
+ bar(&)
+end
+
+def foo(a, &)
+ bar(&)
+end
diff --git a/test/prism/fixtures/unparser/corpus/literal/since/32.txt b/test/prism/fixtures/unparser/corpus/literal/since/32.txt
new file mode 100644
index 0000000000..b8e096d8fc
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/since/32.txt
@@ -0,0 +1,11 @@
+def foo(argument, **)
+ bar(argument, **)
+end
+
+def foo(argument, *)
+ bar(argument, *)
+end
+
+def foo(**)
+ { default: 1, ** }
+end
diff --git a/test/prism/fixtures/unparser/corpus/literal/singletons.txt b/test/prism/fixtures/unparser/corpus/literal/singletons.txt
new file mode 100644
index 0000000000..496e6a41ce
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/singletons.txt
@@ -0,0 +1,4 @@
+false
+nil
+self
+true
diff --git a/test/prism/fixtures/unparser/corpus/literal/super.txt b/test/prism/fixtures/unparser/corpus/literal/super.txt
new file mode 100644
index 0000000000..0e73e6f052
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/super.txt
@@ -0,0 +1,21 @@
+super
+super()
+super(a)
+super(a, b)
+super(&block)
+super(a, &block)
+super(a {
+ foo
+})
+super {
+ foo
+}
+super(a) {
+ foo
+}
+super() {
+ foo
+}
+super(a, b) {
+ foo
+}
diff --git a/test/prism/fixtures/unparser/corpus/literal/unary.txt b/test/prism/fixtures/unparser/corpus/literal/unary.txt
new file mode 100644
index 0000000000..77685cb71d
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/unary.txt
@@ -0,0 +1,8 @@
+!1
+!(!1)
+!(!(foo || bar))
+!(!1).baz
+~a
+-a
++a
+-(-a).foo
diff --git a/test/prism/fixtures/unparser/corpus/literal/undef.txt b/test/prism/fixtures/unparser/corpus/literal/undef.txt
new file mode 100644
index 0000000000..a65d8d0cc4
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/undef.txt
@@ -0,0 +1,2 @@
+undef :foo
+undef :foo, :bar
diff --git a/test/prism/fixtures/unparser/corpus/literal/variables.txt b/test/prism/fixtures/unparser/corpus/literal/variables.txt
new file mode 100644
index 0000000000..1de938f376
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/variables.txt
@@ -0,0 +1,10 @@
+a
+@a
+@@a
+$a
+$1
+$`
+CONST
+SCOPED::CONST
+::TOPLEVEL
+::TOPLEVEL::CONST
diff --git a/test/prism/fixtures/unparser/corpus/literal/while.txt b/test/prism/fixtures/unparser/corpus/literal/while.txt
new file mode 100644
index 0000000000..19a60ef5ff
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/literal/while.txt
@@ -0,0 +1,73 @@
+module A
+ foo { |bar|
+ while foo
+ foo = bar
+ end
+ }
+end
+
+def foo
+ foo = bar while foo != baz
+end
+
+module A
+ foo = bar while foo
+end
+
+module A
+ foo = bar until foo
+end
+
+module A
+ while foo
+ foo = bar
+ end
+end
+
+module A
+ each { |baz|
+ while foo
+ foo = bar
+ end
+ }
+end
+
+module A
+ each { |foo|
+ while foo
+ foo = bar
+ end
+ }
+end
+x = (begin
+ foo
+end while baz)
+begin
+ foo
+end while baz
+begin
+ foo
+ bar
+end until baz
+begin
+ foo
+ bar
+end while baz
+while false
+end
+while false
+ 3
+end
+while (foo {
+})
+ :body
+end
+until false
+end
+until false
+ 3
+end
+until (foo {
+})
+ :body
+end
diff --git a/test/prism/fixtures/unparser/corpus/semantic/and.txt b/test/prism/fixtures/unparser/corpus/semantic/and.txt
new file mode 100644
index 0000000000..43d1712445
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/semantic/and.txt
@@ -0,0 +1,8 @@
+a...b or c...d
+a...b and c...d
+
+if a...b or c...d
+end
+
+if a...b and c...d
+end
diff --git a/test/prism/fixtures/unparser/corpus/semantic/block.txt b/test/prism/fixtures/unparser/corpus/semantic/block.txt
new file mode 100644
index 0000000000..5891690025
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/semantic/block.txt
@@ -0,0 +1,26 @@
+foo do
+end
+
+foo do
+rescue
+end
+
+foo do
+ nil rescue nil
+ nil
+end
+
+foo do |a|
+end
+
+foo(<<-DOC) do |a|
+ b
+DOC
+ a
+end
+
+foo(<<-DOC) do
+ b
+DOC
+ a
+end
diff --git a/test/prism/fixtures/unparser/corpus/semantic/def.txt b/test/prism/fixtures/unparser/corpus/semantic/def.txt
new file mode 100644
index 0000000000..7574619392
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/semantic/def.txt
@@ -0,0 +1,7 @@
+def foo
+ (a - b)
+end
+
+def foo
+ a rescue Exception
+end
diff --git a/test/prism/fixtures/unparser/corpus/semantic/dstr.txt b/test/prism/fixtures/unparser/corpus/semantic/dstr.txt
new file mode 100644
index 0000000000..919e736077
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/semantic/dstr.txt
@@ -0,0 +1,127 @@
+<<DOC
+DOC
+
+<<'DOC'
+DOC
+
+<<~DOC
+DOC
+
+<<~'DOC'
+DOC
+
+<<DOC
+ a
+DOC
+
+<<'DOC'
+ a
+DOC
+
+<<DOC
+ a
+ #{}
+DOC
+
+<<~DOC
+ a
+ #{}
+DOC
+
+<<~DOC
+ a
+ #{}
+ b
+DOC
+
+<<~DOC
+ a
+ b
+DOC
+
+<<'DOC'
+a
+
+b
+DOC
+
+<<'DOC'
+ a
+
+ b
+DOC
+
+<<'DOC'
+ a\nb
+DOC
+
+<<DOC
+#{}a
+ #{}a
+DOC
+
+<<DOC
+ #{}
+ \#{}
+DOC
+
+<<DOC
+ a#{}b
+ c
+DOC
+
+<<~DOC
+ #{}
+DOC
+
+if true
+ <<~DOC
+ #{}
+ DOC
+end
+
+if true
+ <<~DOC
+ b#{}
+ DOC
+end
+
+if true
+ <<~DOC
+ #{}a
+ DOC
+end
+
+if true
+ <<-'DOC'
+ a
+
+ b
+ DOC
+end
+
+"#{}a"
+
+%(\n"#{}"\n)
+
+%Q(-\n"#{}"\n)
+
+"a
+#{}
+b"
+
+"a\n#{}
+b"
+
+"a
+#{}\nb"
+
+'a' \
+"#{}"
+
+"" "" ""
+
+"a#{@a}" "b"
+"a#@a" "b"
+"a#$a" "b"
+"a#@@a" "b"
diff --git a/test/prism/fixtures/unparser/corpus/semantic/kwbegin.txt b/test/prism/fixtures/unparser/corpus/semantic/kwbegin.txt
new file mode 100644
index 0000000000..d275a96a5c
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/semantic/kwbegin.txt
@@ -0,0 +1,42 @@
+begin
+rescue
+end
+
+begin
+rescue
+else
+end
+
+begin
+ a
+end
+
+begin
+ a
+rescue
+ b
+end
+
+begin
+ a
+ b
+rescue
+ b
+end
+
+begin
+rescue A
+else
+end
+
+begin; rescue A; else; end
+
+begin
+ a
+rescue A
+ b
+rescue B
+ c
+ensure
+ d
+end
diff --git a/test/prism/fixtures/unparser/corpus/semantic/literal.txt b/test/prism/fixtures/unparser/corpus/semantic/literal.txt
new file mode 100644
index 0000000000..c424db5a53
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/semantic/literal.txt
@@ -0,0 +1,14 @@
+1.0r
+-0r
+0x1
+1_000
+1e10
+10e10000000000
+-10e10000000000
+?c
+%r(/)
+%r(\))
+%r(#{@bar}baz)
+10.2e10000000000
+-10.2e10000000000
+w(foo bar)
diff --git a/test/prism/fixtures/unparser/corpus/semantic/opasgn.txt b/test/prism/fixtures/unparser/corpus/semantic/opasgn.txt
new file mode 100644
index 0000000000..8b4bc5d239
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/semantic/opasgn.txt
@@ -0,0 +1 @@
+y["#{42}\n"] += "#{42}\n"
diff --git a/test/prism/fixtures/unparser/corpus/semantic/send.txt b/test/prism/fixtures/unparser/corpus/semantic/send.txt
new file mode 100644
index 0000000000..a65b27d2f2
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/semantic/send.txt
@@ -0,0 +1,6 @@
+foo
+foo(1)
+
+a.===(b).c == d
+
+a == d.c.===(c)
diff --git a/test/prism/fixtures/unparser/corpus/semantic/undef.txt b/test/prism/fixtures/unparser/corpus/semantic/undef.txt
new file mode 100644
index 0000000000..47debc3114
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/semantic/undef.txt
@@ -0,0 +1,2 @@
+undef foo
+undef foo, bar
diff --git a/test/prism/fixtures/unparser/corpus/semantic/while.txt b/test/prism/fixtures/unparser/corpus/semantic/while.txt
new file mode 100644
index 0000000000..a55dcc52fc
--- /dev/null
+++ b/test/prism/fixtures/unparser/corpus/semantic/while.txt
@@ -0,0 +1,25 @@
+a until b? {}
+
+until b? {}
+ a
+end
+
+foo = bar while foo
+
+a until b && a { }
+
+while a = b
+ a
+end
+
+a until b(<<-FOO) do
+FOO
+ c
+end
+
+module A
+ foo = exp
+ while foo
+ foo = bar
+ end
+end