Skip to content

Commit 2ba94ed

Browse files
committed
Make error and snapshot tests multi-version aware
This one has been on my mind for a while now. Currently, there are only tests against the latest syntax version. This changes the snapshot structure as follows: * Snapshots at their current location are tested against all syntax versions * Snapshots inside a version folder like "3.3" are tested against all versions starting from that version * Snapshots inside a version folder like "3.3-4.2" are tested against all versions in the given range. This makes sure that as new syntax is added, older versions still work as expected. I also added a few tests for now valid syntax that should be invalid in older versions (and the other way around as well) These tests run really fast. So even though it does 3x the work for these, I am still able to run the whole test suite in just 11 seconds.
1 parent 7ae3f03 commit 2ba94ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1167
-89
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
@ ProgramNode (location: (1,0)-(1,21))
2+
├── flags: ∅
3+
├── locals: []
4+
└── statements:
5+
@ StatementsNode (location: (1,0)-(1,21))
6+
├── flags: ∅
7+
└── body: (length: 1)
8+
└── @ CallNode (location: (1,0)-(1,21))
9+
├── flags: newline, attribute_write
10+
├── receiver:
11+
│ @ CallNode (location: (1,0)-(1,6))
12+
│ ├── flags: variable_call, ignore_visibility
13+
│ ├── receiver: ∅
14+
│ ├── call_operator_loc: ∅
15+
│ ├── name: :matrix
16+
│ ├── message_loc: (1,0)-(1,6) = "matrix"
17+
│ ├── opening_loc: ∅
18+
│ ├── arguments: ∅
19+
│ ├── closing_loc: ∅
20+
│ └── block: ∅
21+
├── call_operator_loc: ∅
22+
├── name: :[]=
23+
├── message_loc: (1,6)-(1,17) = "[5, &block]"
24+
├── opening_loc: (1,6)-(1,7) = "["
25+
├── arguments:
26+
│ @ ArgumentsNode (location: (1,7)-(1,21))
27+
│ ├── flags: ∅
28+
│ └── arguments: (length: 2)
29+
│ ├── @ IntegerNode (location: (1,7)-(1,8))
30+
│ │ ├── flags: static_literal, decimal
31+
│ │ └── value: 5
32+
│ └── @ IntegerNode (location: (1,20)-(1,21))
33+
│ ├── flags: static_literal, decimal
34+
│ └── value: 8
35+
├── closing_loc: (1,16)-(1,17) = "]"
36+
└── block:
37+
@ BlockArgumentNode (location: (1,10)-(1,16))
38+
├── flags: ∅
39+
├── expression:
40+
│ @ CallNode (location: (1,11)-(1,16))
41+
│ ├── flags: variable_call, ignore_visibility
42+
│ ├── receiver: ∅
43+
│ ├── call_operator_loc: ∅
44+
│ ├── name: :block
45+
│ ├── message_loc: (1,11)-(1,16) = "block"
46+
│ ├── opening_loc: ∅
47+
│ ├── arguments: ∅
48+
│ ├── closing_loc: ∅
49+
│ └── block: ∅
50+
└── operator_loc: (1,10)-(1,11) = "&"

snapshots/3.3-3.3/it.txt

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
@ ProgramNode (location: (1,0)-(5,9))
2+
├── flags: ∅
3+
├── locals: []
4+
└── statements:
5+
@ StatementsNode (location: (1,0)-(5,9))
6+
├── flags: ∅
7+
└── body: (length: 2)
8+
├── @ CallNode (location: (1,0)-(3,3))
9+
│ ├── flags: newline, ignore_visibility
10+
│ ├── receiver: ∅
11+
│ ├── call_operator_loc: ∅
12+
│ ├── name: :x
13+
│ ├── message_loc: (1,0)-(1,1) = "x"
14+
│ ├── opening_loc: ∅
15+
│ ├── arguments: ∅
16+
│ ├── closing_loc: ∅
17+
│ └── block:
18+
│ @ BlockNode (location: (1,2)-(3,3))
19+
│ ├── flags: ∅
20+
│ ├── locals: []
21+
│ ├── parameters: ∅
22+
│ ├── body:
23+
│ │ @ StatementsNode (location: (2,2)-(2,4))
24+
│ │ ├── flags: ∅
25+
│ │ └── body: (length: 1)
26+
│ │ └── @ CallNode (location: (2,2)-(2,4))
27+
│ │ ├── flags: newline, variable_call, ignore_visibility
28+
│ │ ├── receiver: ∅
29+
│ │ ├── call_operator_loc: ∅
30+
│ │ ├── name: :it
31+
│ │ ├── message_loc: (2,2)-(2,4) = "it"
32+
│ │ ├── opening_loc: ∅
33+
│ │ ├── arguments: ∅
34+
│ │ ├── closing_loc: ∅
35+
│ │ └── block: ∅
36+
│ ├── opening_loc: (1,2)-(1,4) = "do"
37+
│ └── closing_loc: (3,0)-(3,3) = "end"
38+
└── @ LambdaNode (location: (5,0)-(5,9))
39+
├── flags: newline
40+
├── locals: []
41+
├── operator_loc: (5,0)-(5,2) = "->"
42+
├── opening_loc: (5,3)-(5,4) = "{"
43+
├── closing_loc: (5,8)-(5,9) = "}"
44+
├── parameters: ∅
45+
└── body:
46+
@ StatementsNode (location: (5,5)-(5,7))
47+
├── flags: ∅
48+
└── body: (length: 1)
49+
└── @ CallNode (location: (5,5)-(5,7))
50+
├── flags: newline, variable_call, ignore_visibility
51+
├── receiver: ∅
52+
├── call_operator_loc: ∅
53+
├── name: :it
54+
├── message_loc: (5,5)-(5,7) = "it"
55+
├── opening_loc: ∅
56+
├── arguments: ∅
57+
├── closing_loc: ∅
58+
└── block: ∅

0 commit comments

Comments
 (0)