Skip to content

Commit 81079eb

Browse files
Earlopainkddnewton
authored andcommitted
[ruby/prism] Import code samples for Ruby 3.3 from the parser gem
Slightly tweaking the import script becaues of backtrace format changes in Ruby 3.4 Most tests pass in all parsers, with only a handful of failures overall ruby/prism@9b5b785aa4
1 parent ca81142 commit 81079eb

37 files changed

+322
-9
lines changed

test/prism/fixtures/whitequark/LICENSE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Copyright (c) 2013-2016 whitequark <[email protected]>
1+
Copyright (c) 2013-2024 parser project contributors
2+
Copyright (c) 2013-2016 Catherine <[email protected]>
23

34
Parts of the source are derived from ruby_parser:
45
Copyright (c) Ryan Davis, seattle.rb
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
def f &b; end
2+
3+
def f *r, &b; end
4+
5+
def f *r, p, &b; end
6+
7+
def f ; end
8+
9+
def f a, &b; end
10+
11+
def f a, *r, &b; end
12+
13+
def f a, *r, p, &b; end
14+
15+
def f a, o=1, &b; end
16+
17+
def f a, o=1, *r, &b; end
18+
19+
def f a, o=1, *r, p, &b; end
20+
21+
def f a, o=1, p, &b; end
22+
23+
def f o=1, &b; end
24+
25+
def f o=1, *r, &b; end
26+
27+
def f o=1, *r, p, &b; end
28+
29+
def f o=1, p, &b; end
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
f{ }
2+
3+
f{ | | }
4+
5+
f{ |&b| }
6+
7+
f{ |*, &b| }
8+
9+
f{ |*r, p, &b| }
10+
11+
f{ |*s, &b| }
12+
13+
f{ |*s| }
14+
15+
f{ |*| }
16+
17+
f{ |;
18+
a
19+
| }
20+
21+
f{ |;a| }
22+
23+
f{ |a, &b| }
24+
25+
f{ |a, *, &b| }
26+
27+
f{ |a, *r, p, &b| }
28+
29+
f{ |a, *s, &b| }
30+
31+
f{ |a, *s| }
32+
33+
f{ |a, *| }
34+
35+
f{ |a, c| }
36+
37+
f{ |a, o=1, &b| }
38+
39+
f{ |a, o=1, *r, p, &b| }
40+
41+
f{ |a, o=1, o1=2, *r, &b| }
42+
43+
f{ |a, o=1, p, &b| }
44+
45+
f{ |a,| }
46+
47+
f{ |a| }
48+
49+
f{ |o=1, &b| }
50+
51+
f{ |o=1, *r, &b| }
52+
53+
f{ |o=1, *r, p, &b| }
54+
55+
f{ |o=1, p, &b| }
56+
57+
f{ || }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f{ |foo:| }
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
f{ |**baz, &b| }
2+
3+
f{ |foo: 1, &b| }
4+
5+
f{ |foo: 1, bar: 2, **baz, &b| }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f{ |a| }
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
case foo; in *, 42, * then true; end
2+
3+
case foo; in Array[*, 1, *] then true; end
4+
5+
case foo; in String(*, 1, *) then true; end
6+
7+
case foo; in [*x, 1 => a, *y] then true; end
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def f (foo: 1, &b); end
2+
3+
def f (foo: 1, bar: 2, **baz, &b); end
4+
5+
def f **baz, &b; end
6+
7+
def f *, **; end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def f foo:
2+
; end
3+
4+
def f foo: -1
5+
; end
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
/(?<a>a)/ =~ 'a'; /#{}(?<b>b)/ =~ 'b'; a; b
2+
13
/(?<match>bar)/ =~ 'bar'; match

0 commit comments

Comments
 (0)