From 48d86ce57ddf5c12d31f1da9fdc996b5105c00b7 Mon Sep 17 00:00:00 2001 From: Franco Ramirez Date: Sat, 21 Sep 2024 06:00:06 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Tests=20improved=20for=20TS=20le?= =?UTF-8?q?xer=20with=20recursive=20JSX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lexers/testdata/typescript.actual | 11 +++- lexers/testdata/typescript.expected | 78 +++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) diff --git a/lexers/testdata/typescript.actual b/lexers/testdata/typescript.actual index dcf51389c..658147d86 100644 --- a/lexers/testdata/typescript.actual +++ b/lexers/testdata/typescript.actual @@ -6,4 +6,13 @@ declare module "../../compiler/types" {} type TestType = { [Key keyof T]: Required> -} \ No newline at end of file +} + +const TestComponent = ({ a, b }) => ( + + This is a component + + +) + +export { TestComponent } \ No newline at end of file diff --git a/lexers/testdata/typescript.expected b/lexers/testdata/typescript.expected index 992541595..63e0261dc 100644 --- a/lexers/testdata/typescript.expected +++ b/lexers/testdata/typescript.expected @@ -64,5 +64,83 @@ {"type":"NameAttribute","value":"Key"}, {"type":"Punctuation","value":"\u003e\u003e"}, {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n\n"}, + {"type":"KeywordReserved","value":"const"}, + {"type":"Text","value":" "}, + {"type":"NameOther","value":"TestComponent"}, + {"type":"Text","value":" "}, + {"type":"Operator","value":"="}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"({"}, + {"type":"Text","value":" "}, + {"type":"NameOther","value":"a"}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":" "}, + {"type":"NameOther","value":"b"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"})"}, + {"type":"Text","value":" "}, + {"type":"Operator","value":"=\u003e"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"("}, + {"type":"Text","value":"\n "}, + {"type":"Punctuation","value":"\u003c"}, + {"type":"NameTag","value":"Component"}, + {"type":"Text","value":" "}, + {"type":"NameAttribute","value":"width"}, + {"type":"Operator","value":"="}, + {"type":"Punctuation","value":"{"}, + {"type":"LiteralNumberInteger","value":"100"}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":" "}, + {"type":"NameAttribute","value":"prop"}, + {"type":"Operator","value":"="}, + {"type":"Punctuation","value":"{{"}, + {"type":"Text","value":" "}, + {"type":"NameOther","value":"a"}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"..."}, + {"type":"NameOther","value":"b"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"}}"}, + {"type":"Text","value":" "}, + {"type":"NameAttribute","value":"attr"}, + {"type":"Operator","value":"="}, + {"type":"LiteralString","value":"\"text\""}, + {"type":"Punctuation","value":"\u003e"}, + {"type":"Text","value":"\n "}, + {"type":"Punctuation","value":"\u003c"}, + {"type":"NameTag","value":"span"}, + {"type":"Punctuation","value":"\u003e"}, + {"type":"NameOther","value":"This"}, + {"type":"Text","value":" "}, + {"type":"Keyword","value":"is"}, + {"type":"Text","value":" "}, + {"type":"NameOther","value":"a"}, + {"type":"Text","value":" "}, + {"type":"NameOther","value":"component"}, + {"type":"Punctuation","value":"\u003c/"}, + {"type":"NameTag","value":"span"}, + {"type":"Punctuation","value":"\u003e"}, + {"type":"Text","value":"\n "}, + {"type":"Punctuation","value":"\u003c"}, + {"type":"NameTag","value":"SomethingElse"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"/\u003e"}, + {"type":"Text","value":"\n "}, + {"type":"Punctuation","value":"\u003c/"}, + {"type":"NameTag","value":"Component"}, + {"type":"Punctuation","value":"\u003e"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":")"}, + {"type":"Text","value":"\n\n"}, + {"type":"KeywordReserved","value":"export"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":" "}, + {"type":"NameOther","value":"TestComponent"}, + {"type":"Text","value":" "}, {"type":"Punctuation","value":"}"} ]