1
+ # Parser tests howto
2
+
1
3
The folders here contains golden files and test file that are used for testing
2
4
parser.
3
5
@@ -10,6 +12,8 @@ Folder `goldenFiles` contains golden files for tests, where the parsed source
10
12
for the test is a string. The structure is that the folder is class name, where
11
13
the test is and the name of file is to the of the test. So for example:
12
14
15
+
16
+ ``` java
13
17
public class AssignmentTests extends ParserTestBase {
14
18
15
19
@Test
@@ -18,6 +22,7 @@ public class AssignmentTests extends ParserTestBase {
18
22
}
19
23
20
24
}
25
+ ```
21
26
22
27
creates file assignment01.tast (if not exists yet) in folder ` AssignmentTests `
23
28
in ` goldenFiles ` folder.
@@ -28,6 +33,7 @@ that is tested.
28
33
29
34
For example:
30
35
36
+ ``` java
31
37
public class RuntimeFileTests extends ParserTestBase {
32
38
33
39
@Test
@@ -36,6 +42,7 @@ public class RuntimeFileTests extends ParserTestBase {
36
42
}
37
43
38
44
}
45
+ ```
39
46
40
47
This test is looking for file ` testFiles/RuntimeFileTests/_collections_abc.py `
41
48
and after first run are created ` testFiles/RuntimeFileTests/_collections_abc.scope `
@@ -46,22 +53,17 @@ source. The golden file is generated with the old parser and compares the result
46
53
from new parser. If the old parser generate wrong tree, then it should be
47
54
manually corrected or reused the output from new parser.
48
55
49
-
50
56
If there is a change in a tree, that causes failing many tests, then it can be
51
57
done by deleting all ` .tast ` files, then run parser tests and check, whether
52
58
the diffs are correct.
53
59
54
60
These commands should do it:
55
61
56
- --------------------------------------------------
57
-
58
- $ cd graalpython/com.oracle.graal.python.test/testData
59
-
60
- $ find . -name "*.tast" -delete
61
-
62
- $ mx punittest com.oracle.graal.python.test.parser
63
-
64
- --------------------------------------------------
62
+ ``` shell
63
+ cd graalpython/com.oracle.graal.python.test/testData
64
+ find . -name " *.tast" -delete
65
+ mx punittest com.oracle.graal.python.test.parser
66
+ ```
65
67
66
68
After this all ` .tast ` files are regenerated. Currently after the regeneration
67
69
there are two test failing ` DictAndSetTests.dict09 ` and ` DictAndSetTests.dict10 ` .
0 commit comments