Skip to content

Commit 5f53791

Browse files
committed
test: assert outline membership and kinds from signature text
Three suites located the kind column or the E/- marker at a fixed token position, which signature lines no longer have; membership is now asserted on indentation depth and kind coverage on the declaration keywords the signature itself carries. The R var-kind check moved to the assignment's own source text for the same reason.
1 parent 89c4b2e commit 5f53791

2 files changed

Lines changed: 36 additions & 21 deletions

File tree

crates/aft/tests/integration/commands_test.rs

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -214,35 +214,42 @@ fn test_outline_typescript_nested_structure() {
214214
add_user_line
215215
);
216216

217-
// Verify all expected symbol kind abbreviations are present
218-
assert!(text.contains(" fn "), "should have fn (function) kind");
219-
assert!(text.contains(" cls "), "should have cls (class) kind");
220-
assert!(text.contains(" ifc "), "should have ifc (interface) kind");
221-
assert!(text.contains(" enum "), "should have enum kind");
217+
// Signature lines carry the declaration's own keywords rather than a
218+
// kind-abbreviation column, so kind coverage is asserted on the
219+
// signature text itself.
222220
assert!(
223-
text.contains(" type "),
224-
"should have type (type_alias) kind"
221+
text.contains("function "),
222+
"should show a function signature"
225223
);
224+
assert!(text.contains("class "), "should show a class signature");
225+
assert!(
226+
text.contains("interface "),
227+
"should show an interface signature"
228+
);
229+
assert!(text.contains("enum "), "should show an enum signature");
230+
assert!(text.contains("type "), "should show a type-alias signature");
226231

227232
// greet should be exported: its line's first non-space chars are "E "
228233
let greet_line = text
229234
.lines()
230235
.find(|l| l.contains("greet") && !l.contains("UserService"))
231236
.expect("greet line should be in outline");
237+
// TypeScript captures the inner declaration, so the signature text has
238+
// no export keyword; the minimal E marker is what carries exported-ness.
232239
assert!(
233-
greet_line.trim_start().starts_with("E "),
234-
"greet should be exported, got: {:?}",
240+
greet_line.trim_start().starts_with("E function "),
241+
"greet should carry the E marker before its bare signature, got: {:?}",
235242
greet_line
236243
);
237244

238-
// internalHelper should not be exported: its line's first non-space chars are "- "
245+
// internalHelper is a plain function: no export keyword and no marker.
239246
let internal_line = text
240247
.lines()
241248
.find(|l| l.contains("internalHelper"))
242249
.expect("internalHelper line should be in outline");
243250
assert!(
244-
internal_line.trim_start().starts_with("- "),
245-
"internalHelper should not be exported, got: {:?}",
251+
internal_line.trim_start().starts_with("function "),
252+
"internalHelper should render its bare signature, got: {:?}",
246253
internal_line
247254
);
248255

@@ -266,13 +273,15 @@ fn test_outline_python_multi_level_nesting() {
266273
.as_str()
267274
.expect("text field should be a string");
268275

269-
// OuterClass should be present at top level (2-space indent: starts with " E" or " -")
276+
// OuterClass should be present at top level. Signature lines carry no
277+
// visibility/kind prefix, so top-level membership is asserted on the
278+
// indentation itself: exactly two spaces before the content.
270279
let outer_class_line = text
271280
.lines()
272281
.find(|l| l.contains("OuterClass"))
273282
.expect("OuterClass should be in outline");
274283
assert!(
275-
outer_class_line.starts_with(" E") || outer_class_line.starts_with(" -"),
284+
outer_class_line.starts_with(" ") && !outer_class_line.starts_with(" "),
276285
"OuterClass should be at top level (2-space indent), got: {:?}",
277286
outer_class_line
278287
);
@@ -283,8 +292,8 @@ fn test_outline_python_multi_level_nesting() {
283292
.find(|l| l.contains("InnerClass"))
284293
.expect("InnerClass should be in outline");
285294
assert!(
286-
!(inner_class_line.starts_with(" E") || inner_class_line.starts_with(" -")),
287-
"InnerClass should be nested, not at top level, got: {:?}",
295+
inner_class_line.starts_with(" "),
296+
"InnerClass should be nested deeper than top level, got: {:?}",
288297
inner_class_line
289298
);
290299

@@ -294,8 +303,8 @@ fn test_outline_python_multi_level_nesting() {
294303
.find(|l| l.contains("inner_method"))
295304
.expect("inner_method should be in outline");
296305
assert!(
297-
!(inner_method_line.starts_with(" E") || inner_method_line.starts_with(" -")),
298-
"inner_method should be nested, not at top level, got: {:?}",
306+
inner_method_line.starts_with(" "),
307+
"inner_method should be nested deeper than top level, got: {:?}",
299308
inner_method_line
300309
);
301310

crates/aft/tests/integration/r_test.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,16 @@ label = "ready"
8686
"missing {expected} in outline: {text}"
8787
);
8888
}
89-
assert!(text.contains("fn"), "functions should have fn kind: {text}");
89+
// Signature lines carry the declaration text itself rather than a kind
90+
// column, so function coverage is asserted on the R function syntax.
9091
assert!(
91-
text.contains("var"),
92-
"assignments should have var kind: {text}"
92+
text.contains("function("),
93+
"functions should show their function(...) signatures: {text}"
94+
);
95+
// Assignments likewise render as their own source text.
96+
assert!(
97+
text.contains("threshold <- 10"),
98+
"assignments should show their assignment signatures: {text}"
9399
);
94100

95101
let zoom_resp = send(

0 commit comments

Comments
 (0)