@@ -28,86 +28,99 @@ define-function: (
28
28
)
29
29
30
30
// First we check the derive macro expansion at line 33.
31
- call-function: ("check-expansion", {"line": 33 , "original_content": "Debug"})
31
+ call-function: ("check-expansion", {"line": 35 , "original_content": "Debug"})
32
32
// Then we check the `bar` macro expansion at line 41.
33
- call-function: ("check-expansion", {"line": 41 , "original_content": "bar!(y)"})
33
+ call-function: ("check-expansion", {"line": 43 , "original_content": "bar!(y)"})
34
34
// Then we check the `println` macro expansion at line 42-44.
35
- call-function: ("check-expansion", {"line": 42 , "original_content": 'println!("
36
- 43 {y}
37
- 44 ")'})
35
+ call-function: ("check-expansion", {"line": 44 , "original_content": 'println!("
36
+ 45 {y}
37
+ 46 ")'})
38
38
39
39
// Then finally we check when there are two macro calls on a same line.
40
- assert-count: ("#expand-50 ~ .original", 2)
41
- assert-count: ("#expand-50 ~ .expanded", 2)
40
+ assert-count: ("#expand-52 ~ .original", 2)
41
+ assert-count: ("#expand-52 ~ .expanded", 2)
42
42
43
43
store-value: (repeat_o, '/following-sibling::*[@class="original"]')
44
44
store-value: (repeat_e, '/following-sibling::*[@class="expanded"]')
45
- assert-text: ('//*[@id="expand-50"]' + |repeat_o|, "stringify!(foo)")
46
- assert-text: ('//*[@id="expand-50"]' + |repeat_o| + |repeat_o|, "stringify!(bar)")
47
- assert-text: ('//*[@id="expand-50"]' + |repeat_e|, '"foo"')
48
- assert-text: ('//*[@id="expand-50"]' + |repeat_e| + |repeat_e|, '"bar"')
45
+ store-value: (expand_id, "expand-52")
46
+ assert-text: ('//*[@id="' + |expand_id| + '"]' + |repeat_o|, "stringify!(foo)")
47
+ assert-text: ('//*[@id="' + |expand_id| + '"]' + |repeat_o| + |repeat_o|, "stringify!(bar)")
48
+ assert-text: ('//*[@id="' + |expand_id| + '"]' + |repeat_e|, '"foo"')
49
+ assert-text: ('//*[@id="' + |expand_id| + '"]' + |repeat_e| + |repeat_e|, '"bar"')
49
50
50
51
// The "original" content should be expanded.
51
- assert-css: ('//*[@id="expand-50 "]' + |repeat_o|, {"display": "inline"})
52
- assert-css: ('//*[@id="expand-50 "]' + |repeat_o| + |repeat_o|, {"display": "inline"})
52
+ assert-css: ('//*[@id="' + |expand_id| + ' "]' + |repeat_o|, {"display": "inline"})
53
+ assert-css: ('//*[@id="' + |expand_id| + ' "]' + |repeat_o| + |repeat_o|, {"display": "inline"})
53
54
// The expanded macro should be hidden.
54
- assert-css: ('//*[@id="expand-50 "]' + |repeat_e|, {"display": "none"})
55
- assert-css: ('//*[@id="expand-50 "]' + |repeat_e| + |repeat_e|, {"display": "none"})
55
+ assert-css: ('//*[@id="' + |expand_id| + ' "]' + |repeat_e|, {"display": "none"})
56
+ assert-css: ('//*[@id="' + |expand_id| + ' "]' + |repeat_e| + |repeat_e|, {"display": "none"})
56
57
57
58
// We "expand" the macro (because the line starts with a string, the label is not at the "top
58
59
// level" of the `<code>`, so we need to use a different selector).
59
- click: "#expand-50"
60
+ click: "#" + |expand_id|
60
61
// The "original" content is hidden.
61
- assert-css: ('//*[@id="expand-50 "]' + |repeat_o|, {"display": "none"})
62
- assert-css: ('//*[@id="expand-50 "]' + |repeat_o| + |repeat_o|, {"display": "none"})
62
+ assert-css: ('//*[@id="' + |expand_id| + ' "]' + |repeat_o|, {"display": "none"})
63
+ assert-css: ('//*[@id="' + |expand_id| + ' "]' + |repeat_o| + |repeat_o|, {"display": "none"})
63
64
// The expanded macro is visible.
64
- assert-css: ('//*[@id="expand-50 "]' + |repeat_e|, {"display": "inline"})
65
- assert-css: ('//*[@id="expand-50 "]' + |repeat_e| + |repeat_e|, {"display": "inline"})
65
+ assert-css: ('//*[@id="' + |expand_id| + ' "]' + |repeat_e|, {"display": "inline"})
66
+ assert-css: ('//*[@id="' + |expand_id| + ' "]' + |repeat_e| + |repeat_e|, {"display": "inline"})
66
67
67
68
// We collapse the macro.
68
- click: "#expand-50"
69
+ click: "#" + |expand_id|
69
70
// The "original" content is expanded.
70
- assert-css: ('//*[@id="expand-50 "]' + |repeat_o|, {"display": "inline"})
71
- assert-css: ('//*[@id="expand-50 "]' + |repeat_o| + |repeat_o|, {"display": "inline"})
71
+ assert-css: ('//*[@id="' + |expand_id| + ' "]' + |repeat_o|, {"display": "inline"})
72
+ assert-css: ('//*[@id="' + |expand_id| + ' "]' + |repeat_o| + |repeat_o|, {"display": "inline"})
72
73
// The expanded macro is hidden.
73
- assert-css: ('//*[@id="expand-50 "]' + |repeat_e|, {"display": "none"})
74
- assert-css: ('//*[@id="expand-50 "]' + |repeat_e| + |repeat_e|, {"display": "none"})
74
+ assert-css: ('//*[@id="' + |expand_id| + ' "]' + |repeat_e|, {"display": "none"})
75
+ assert-css: ('//*[@id="' + |expand_id| + ' "]' + |repeat_e| + |repeat_e|, {"display": "none"})
75
76
76
- // Checking the line 46 `println` which needs to be handled differently because the line number is
77
+ // Checking the line 48 `println` which needs to be handled differently because the line number is
77
78
// inside a "comment" span.
78
- assert-text: ("#expand-46 ~ .original", 'println!("
79
- 47 {y}
80
- 48 ")')
79
+ store-value: (expand_id, "expand-48")
80
+ assert-text: ("#" + |expand_id| + " ~ .original", 'println!("
81
+ 49 {y}
82
+ 50 ")')
81
83
// The "original" content should be expanded.
82
- assert-css: ("#expand-46 ~ .original", {"display": "inline"})
84
+ assert-css: ("#" + |expand_id| + " ~ .original", {"display": "inline"})
83
85
// The expanded macro should be hidden.
84
- assert-css: ("#expand-46 ~ .expanded", {"display": "none"})
86
+ assert-css: ("#" + |expand_id| + " ~ .expanded", {"display": "none"})
85
87
86
88
// We "expand" the macro.
87
- click: "#expand-46"
89
+ click: "#" + |expand_id|
88
90
// The "original" content is hidden.
89
- assert-css: ("#expand-46 ~ .original", {"display": "none"})
91
+ assert-css: ("#" + |expand_id| + " ~ .original", {"display": "none"})
90
92
// The expanded macro is visible.
91
- assert-css: ("#expand-46 ~ .expanded", {"display": "inline"})
93
+ assert-css: ("#" + |expand_id| + " ~ .expanded", {"display": "inline"})
92
94
93
95
// We collapse the macro.
94
- click: "#expand-46"
96
+ click: "#" + |expand_id|
95
97
// The "original" content is expanded.
96
- assert-css: ("#expand-46 ~ .original", {"display": "inline"})
98
+ assert-css: ("#" + |expand_id| + " ~ .original", {"display": "inline"})
97
99
// The expanded macro is hidden.
98
- assert-css: ("#expand-46 ~ .expanded", {"display": "none"})
100
+ assert-css: ("#" + |expand_id| + " ~ .expanded", {"display": "none"})
99
101
100
102
// Ensure that the toggles are focusable and can be interacted with keyboard.
101
- focus: "//a[@id='27 ']"
103
+ focus: "//a[@id='29 ']"
102
104
press-key: "Tab"
103
- assert: "#expand-27:focus"
104
- assert-css: ("#expand-27 ~ .expanded", {"display": "none"})
105
- assert-css: ("#expand-27 ~ .original", {"display": "inline"})
105
+ store-value: (expand_id, "expand-29")
106
+ assert: "#" + |expand_id| + ":focus"
107
+ assert-css: ("#" + |expand_id| +" ~ .expanded", {"display": "none"})
108
+ assert-css: ("#" + |expand_id| +" ~ .original", {"display": "inline"})
106
109
// We now expand the macro.
107
110
press-key: "Space"
108
- assert-css: ("#expand-27 ~ .expanded", {"display": "inline"})
109
- assert-css: ("#expand-27 ~ .original", {"display": "none"})
111
+ assert-css: ("#" + |expand_id| + " ~ .expanded", {"display": "inline"})
112
+ assert-css: ("#" + |expand_id| + " ~ .original", {"display": "none"})
110
113
// We collapse the macro.
111
114
press-key: "Space"
112
- assert-css: ("#expand-27 ~ .expanded", {"display": "none"})
113
- assert-css: ("#expand-27 ~ .original", {"display": "inline"})
115
+ assert-css: ("#" + |expand_id| + " ~ .expanded", {"display": "none"})
116
+ assert-css: ("#" + |expand_id| + " ~ .original", {"display": "inline"})
117
+
118
+ // Now we check a macro coming from another file.
119
+ store-value: (expand_id, "expand-55")
120
+ // We "expand" the macro.
121
+ click: "#" + |expand_id|
122
+ // The "original" content is hidden.
123
+ assert-css: ("#" + |expand_id| + " ~ .original", {"display": "none"})
124
+ // The expanded macro is visible.
125
+ assert-css: ("#" + |expand_id| + " ~ .expanded", {"display": "inline"})
126
+ assert-text: ("#" + |expand_id| + " ~ .expanded", "{ y += 2; };")
0 commit comments