Transpiled version (8562L) is out of date.
1 | svoid test_tok_recordDecls() {
|
2 | LS tok = jtok("record $HappensBefore$<A, B>(A event1, B event2) extends Fact {}");
|
3 | tok_recordDecls(tok); |
4 | print(join(tok)); |
5 | assertTrueVerbose(jMatchStart([[ |
6 | class $HappensBefore$<A, B> extends Fact implements IFieldsToList {
|
7 | A event1; |
8 | B event2; |
9 | ]], tok)); |
10 | |
11 | test_tok_recordDecls_2(); |
12 | } |
13 | |
14 | // we can omit the field types if the type is Object |
15 | svoid test_tok_recordDecls_2() {
|
16 | LS tok = jtok("record Blubb(a, b) {}");
|
17 | tok_recordDecls(tok); |
18 | print(join(tok)); |
19 | assertTrueVerbose(jMatchStart([[ |
20 | class Blubb implements IFieldsToList {
|
21 | Object a; |
22 | Object b; |
23 | ]], tok)); |
24 | |
25 | test_tok_recordDecls_3(); |
26 | } |
27 | |
28 | // handle existing "implements" |
29 | svoid test_tok_recordDecls_3() {
|
30 | LS tok = jtok("record Blubb implements Bla {}");
|
31 | tok_recordDecls(tok); |
32 | print(join(tok)); |
33 | assertTrueVerbose(jMatchStart([[ |
34 | class Blubb implements Bla, IFieldsToList {
|
35 | ]], tok)); |
36 | |
37 | test_tok_recordDecls_4(); |
38 | } |
39 | |
40 | svoid test_tok_recordDecls_4() {
|
41 | LS tok = jtok("record Blubb extends Bla {}");
|
42 | tok_recordDecls(tok); |
43 | print(join(tok)); |
44 | assertTrueVerbose(join(tok), jMatchStart([[ |
45 | class Blubb extends Bla implements IFieldsToList {
|
46 | ]], tok)); |
47 | |
48 | test_tok_recordDecls_5(); |
49 | } |
50 | |
51 | // existing constructor |
52 | svoid test_tok_recordDecls_5() {
|
53 | // constructor in star syntax |
54 | LS tok = jtok("record Blubb(S a) { *(S *a) { otherStuff(); } }");
|
55 | tok_recordDecls(tok); |
56 | print(join(tok)); |
57 | assertEqualsVerbose(1, l(jfindAll(tok, "*(S *a)"))); |
58 | |
59 | // with ... |
60 | tok = jtok("record Blubb(S a) { *(S... *a) { otherStuff(); } }");
|
61 | tok_recordDecls(tok); |
62 | print(join(tok)); |
63 | assertEqualsVerbose(1, l(jfindAll(tok, "*(S... *a)"))); |
64 | |
65 | // !customConstructor |
66 | tok = jtok([[record Blubb(S a) {
|
67 | // !customConstructor |
68 | Blubb(S a) { otherStuff(); }
|
69 | }]]); |
70 | tok_recordDecls(tok); |
71 | print(join(tok)); |
72 | assertEqualsVerbose(0, l(jfindAll(tok, "*(S *a)"))); |
73 | |
74 | // !customConstructor in some inner class |
75 | tok = jtok([[record Blubb(S a) {
|
76 | class Bla {
|
77 | // !customConstructor |
78 | } |
79 | }]]); |
80 | tok_recordDecls(tok); |
81 | print(join(tok)); |
82 | assertEqualsVerbose(1, l(jfindAll(tok, "*(S *a)"))); |
83 | } |
download show line numbers debug dex old transpilations
Travelled to 9 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1025409 |
| Snippet name: | test_tok_recordDecls |
| Eternal ID of this version: | #1025409/14 |
| Text MD5: | 5d60535f52260f63e087400532ce94af |
| Author: | stefan |
| Category: | javax / parsing |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-03-07 21:58:51 |
| Source code size: | 2249 bytes / 83 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 560 / 843 |
| Version history: | 13 change(s) |
| Referenced in: | [show references] |