diff --git a/tests/cases/fourslash/scriptLexicalStructureMissingName1.ts b/tests/cases/fourslash/scriptLexicalStructureMissingName1.ts new file mode 100644 index 00000000000..60d858b6089 --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureMissingName1.ts @@ -0,0 +1,16 @@ +////export function +/////** +//// * This is a class. +//// */ +////{| "itemName": "C", "kind": "class" |} class C { +//// {| "itemName": "foo", "kind": "method" |} foo() { +//// } +////} + + +test.markers().forEach((marker) => { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +}); + +/// Only have two named elements. +verify.getScriptLexicalStructureListCount(2); diff --git a/tests/cases/fourslash/scriptLexicalStructureMissingName2.ts b/tests/cases/fourslash/scriptLexicalStructureMissingName2.ts new file mode 100644 index 00000000000..0ee0d1197bf --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureMissingName2.ts @@ -0,0 +1,11 @@ +/////** +//// * This is a class. +//// */ +////class /* But it has no name! */ { +//// foo() { +//// } +////} + + +// The class is unnamed, so its method is not included either. +verify.getScriptLexicalStructureListCount(0);