From 782de76c3de1ce02a16443a571f136baa90a4c32 Mon Sep 17 00:00:00 2001 From: Konstantin Ulitin Date: Fri, 17 Jul 2020 16:37:32 +0200 Subject: [PATCH] move ancient json parsing tests GitOrigin-RevId: bce5ccdefaed613a250ff504b890c814dc4e4de3 --- .../com/intellij/json/JsonParsingTest.java | 8 ++++ json/tests/testData/psi/Real.json | 8 ++++ json/tests/testData/psi/Real.txt | 46 +++++++++++++++++++ json/tests/testData/psi/Simple.json | 1 + json/tests/testData/psi/Simple.txt | 40 ++++++++++++++++ 5 files changed, 103 insertions(+) create mode 100644 json/tests/testData/psi/Real.json create mode 100644 json/tests/testData/psi/Real.txt create mode 100644 json/tests/testData/psi/Simple.json create mode 100644 json/tests/testData/psi/Simple.txt diff --git a/json/tests/test/com/intellij/json/JsonParsingTest.java b/json/tests/test/com/intellij/json/JsonParsingTest.java index 14f44e2d6a0d..b257a04cbe18 100644 --- a/json/tests/test/com/intellij/json/JsonParsingTest.java +++ b/json/tests/test/com/intellij/json/JsonParsingTest.java @@ -77,6 +77,10 @@ public class JsonParsingTest extends ParsingTestCase { // Moved from JavaScript + public void testSimple() { + doTest(); + } + public void testSimple1() { doTest(); } @@ -89,6 +93,10 @@ public class JsonParsingTest extends ParsingTestCase { doTest(); } + public void testReal() { + doTest(); + } + // TODO: ask about these tests //public void testSimple3() { // doTest(); diff --git a/json/tests/testData/psi/Real.json b/json/tests/testData/psi/Real.json new file mode 100644 index 000000000000..b8926d999ca4 --- /dev/null +++ b/json/tests/testData/psi/Real.json @@ -0,0 +1,8 @@ +{ + navigation: [ + { + name: "Demo Applications", + demos: [ "Mail", "Moxie" ] + } + ] +} diff --git a/json/tests/testData/psi/Real.txt b/json/tests/testData/psi/Real.txt new file mode 100644 index 000000000000..c0baf5cb1240 --- /dev/null +++ b/json/tests/testData/psi/Real.txt @@ -0,0 +1,46 @@ +JsonFile: Real.json + JsonObject + PsiElement({)('{') + PsiWhiteSpace('\n ') + JsonProperty + JsonReferenceExpression + PsiElement(IDENTIFIER)('navigation') + PsiElement(:)(':') + PsiWhiteSpace(' ') + JsonArray + PsiElement([)('[') + PsiWhiteSpace('\n ') + JsonObject + PsiElement({)('{') + PsiWhiteSpace('\n ') + JsonProperty + JsonReferenceExpression + PsiElement(IDENTIFIER)('name') + PsiElement(:)(':') + PsiWhiteSpace(' ') + JsonStringLiteral + PsiElement(DOUBLE_QUOTED_STRING)('"Demo Applications"') + PsiElement(,)(',') + PsiWhiteSpace('\n ') + JsonProperty + JsonReferenceExpression + PsiElement(IDENTIFIER)('demos') + PsiElement(:)(':') + PsiWhiteSpace(' ') + JsonArray + PsiElement([)('[') + PsiWhiteSpace(' ') + JsonStringLiteral + PsiElement(DOUBLE_QUOTED_STRING)('"Mail"') + PsiElement(,)(',') + PsiWhiteSpace(' ') + JsonStringLiteral + PsiElement(DOUBLE_QUOTED_STRING)('"Moxie"') + PsiWhiteSpace(' ') + PsiElement(])(']') + PsiWhiteSpace('\n ') + PsiElement(})('}') + PsiWhiteSpace('\n ') + PsiElement(])(']') + PsiWhiteSpace('\n') + PsiElement(})('}') \ No newline at end of file diff --git a/json/tests/testData/psi/Simple.json b/json/tests/testData/psi/Simple.json new file mode 100644 index 000000000000..70afdeb1aa0c --- /dev/null +++ b/json/tests/testData/psi/Simple.json @@ -0,0 +1 @@ +{ "x": "x value", "y": "y value", "z": "z value", "z2":[] } \ No newline at end of file diff --git a/json/tests/testData/psi/Simple.txt b/json/tests/testData/psi/Simple.txt new file mode 100644 index 000000000000..03eff9221c64 --- /dev/null +++ b/json/tests/testData/psi/Simple.txt @@ -0,0 +1,40 @@ +JsonFile: Simple.json + JsonObject + PsiElement({)('{') + PsiWhiteSpace(' ') + JsonProperty + JsonStringLiteral + PsiElement(DOUBLE_QUOTED_STRING)('"x"') + PsiElement(:)(':') + PsiWhiteSpace(' ') + JsonStringLiteral + PsiElement(DOUBLE_QUOTED_STRING)('"x value"') + PsiElement(,)(',') + PsiWhiteSpace(' ') + JsonProperty + JsonStringLiteral + PsiElement(DOUBLE_QUOTED_STRING)('"y"') + PsiElement(:)(':') + PsiWhiteSpace(' ') + JsonStringLiteral + PsiElement(DOUBLE_QUOTED_STRING)('"y value"') + PsiElement(,)(',') + PsiWhiteSpace(' ') + JsonProperty + JsonStringLiteral + PsiElement(DOUBLE_QUOTED_STRING)('"z"') + PsiElement(:)(':') + PsiWhiteSpace(' ') + JsonStringLiteral + PsiElement(DOUBLE_QUOTED_STRING)('"z value"') + PsiElement(,)(',') + PsiWhiteSpace(' ') + JsonProperty + JsonStringLiteral + PsiElement(DOUBLE_QUOTED_STRING)('"z2"') + PsiElement(:)(':') + JsonArray + PsiElement([)('[') + PsiElement(])(']') + PsiWhiteSpace(' ') + PsiElement(})('}') \ No newline at end of file