@@ -28,86 +28,99 @@ define-function: (
2828)
2929
3030// 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"})
3232// 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)"})
3434// 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 ")'})
3838
3939// 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)
4242
4343store-value: (repeat_o, '/following-sibling::*[@class="original"]')
4444store-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"')
4950
5051// 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"})
5354// 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"})
5657
5758// We "expand" the macro (because the line starts with a string, the label is not at the "top
5859// level" of the `<code>`, so we need to use a different selector).
59- click: "#expand-50"
60+ click: "#" + |expand_id|
6061// 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"})
6364// 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"})
6667
6768// We collapse the macro.
68- click: "#expand-50"
69+ click: "#" + |expand_id|
6970// 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"})
7273// 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"})
7576
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
7778// 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 ")')
8183// The "original" content should be expanded.
82- assert-css: ("#expand-46 ~ .original", {"display": "inline"})
84+ assert-css: ("#" + |expand_id| + " ~ .original", {"display": "inline"})
8385// The expanded macro should be hidden.
84- assert-css: ("#expand-46 ~ .expanded", {"display": "none"})
86+ assert-css: ("#" + |expand_id| + " ~ .expanded", {"display": "none"})
8587
8688// We "expand" the macro.
87- click: "#expand-46"
89+ click: "#" + |expand_id|
8890// The "original" content is hidden.
89- assert-css: ("#expand-46 ~ .original", {"display": "none"})
91+ assert-css: ("#" + |expand_id| + " ~ .original", {"display": "none"})
9092// The expanded macro is visible.
91- assert-css: ("#expand-46 ~ .expanded", {"display": "inline"})
93+ assert-css: ("#" + |expand_id| + " ~ .expanded", {"display": "inline"})
9294
9395// We collapse the macro.
94- click: "#expand-46"
96+ click: "#" + |expand_id|
9597// The "original" content is expanded.
96- assert-css: ("#expand-46 ~ .original", {"display": "inline"})
98+ assert-css: ("#" + |expand_id| + " ~ .original", {"display": "inline"})
9799// The expanded macro is hidden.
98- assert-css: ("#expand-46 ~ .expanded", {"display": "none"})
100+ assert-css: ("#" + |expand_id| + " ~ .expanded", {"display": "none"})
99101
100102// Ensure that the toggles are focusable and can be interacted with keyboard.
101- focus: "//a[@id='27 ']"
103+ focus: "//a[@id='29 ']"
102104press-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"})
106109// We now expand the macro.
107110press-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"})
110113// We collapse the macro.
111114press-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