From 6b1df3cb5a077807db27c9992d1eaec15bb26fb5 Mon Sep 17 00:00:00 2001 From: Giuseppe Lippolis Date: Thu, 31 Aug 2023 12:34:11 +0200 Subject: [PATCH 1/5] refatcor: Move XmlParserTests to CompletionEngineTests.Parsing --- .../Manipulator/XmlParserTests.cs | 103 ---------------- .../Parsing/XmlParserTests.cs | 111 ++++++++++++++++++ 2 files changed, 111 insertions(+), 103 deletions(-) delete mode 100644 tests/CompletionEngineTests/Manipulator/XmlParserTests.cs create mode 100644 tests/CompletionEngineTests/Parsing/XmlParserTests.cs diff --git a/tests/CompletionEngineTests/Manipulator/XmlParserTests.cs b/tests/CompletionEngineTests/Manipulator/XmlParserTests.cs deleted file mode 100644 index e91503d7..00000000 --- a/tests/CompletionEngineTests/Manipulator/XmlParserTests.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using Avalonia.Ide.CompletionEngine; -using Xunit; - -namespace CompletionEngineTests.Manipulator -{ - /// - /// Tests for XmlParser behavior on which TextManipulator is dependent - /// - public class XmlParserTests - { - [Fact] - public void Should_BeInNoneState_When_OnClosingBrace() - { - var parser = XmlParser.Parse(""); - Assert.Equal(XmlParser.ParserState.None, parser.State); - } - - [Fact] - public void Should_NotBeInClosingTag_When_StartTag() - { - var p = XmlParser.Parse(" +/// Tests for XmlParser behavior on which TextManipulator is dependent +/// +public class XmlParserTests +{ + [Fact] + public void Should_BeInNoneState_When_OnClosingBrace() + { + var parser = XmlParser.Parse(""); + Assert.Equal(XmlParser.ParserState.None, parser.State); + } + + [Fact] + public void Should_NotBeInClosingTag_When_StartTag() + { + var p = XmlParser.Parse(""); + Assert.Equal(0, p.NestingLevel); + } + + [Fact] + public void Should_ReturnCorrectTagName() + { + var p = XmlParser.Parse(" Date: Thu, 31 Aug 2023 12:42:08 +0200 Subject: [PATCH 2/5] Add falling tests --- .../CompletionEngineTests.csproj | 17 ++++++++++ ...ld_GetParentTagName_At_Level_One_Level.xml | 13 ++++++++ ...TagName_At_Level_One_Level_WithComment.xml | 14 ++++++++ ...tTagName_At_Level_One_Level_With_CDATA.xml | 17 ++++++++++ ...agName_At_Level_One_Level_With_Comment.xml | 14 ++++++++ ...ld_GetParentTagName_At_Level_Two_Level.xml | 16 ++++++++++ ...tTagName_At_Level_Two_Level_With_CDATA.xml | 21 ++++++++++++ ...agName_At_Level_Two_Level_With_Comment.xml | 9 ++++++ .../Parsing/XmlParserTests.cs | 32 +++++++++++++++++++ 9 files changed, 153 insertions(+) create mode 100644 tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_One_Level.xml create mode 100644 tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_One_Level_WithComment.xml create mode 100644 tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_One_Level_With_CDATA.xml create mode 100644 tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_One_Level_With_Comment.xml create mode 100644 tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_Two_Level.xml create mode 100644 tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_Two_Level_With_CDATA.xml create mode 100644 tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_Two_Level_With_Comment.xml diff --git a/tests/CompletionEngineTests/CompletionEngineTests.csproj b/tests/CompletionEngineTests/CompletionEngineTests.csproj index cff15f03..d2383b9f 100644 --- a/tests/CompletionEngineTests/CompletionEngineTests.csproj +++ b/tests/CompletionEngineTests/CompletionEngineTests.csproj @@ -8,6 +8,17 @@ ..\..\Key.snk + + + + + + + + + + + @@ -16,6 +27,12 @@ + + + + + + diff --git a/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_One_Level.xml b/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_One_Level.xml new file mode 100644 index 00000000..c643e259 --- /dev/null +++ b/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_One_Level.xml @@ -0,0 +1,13 @@ + + + diff --git a/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_One_Level_WithComment.xml b/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_One_Level_WithComment.xml new file mode 100644 index 00000000..2ec28fb3 --- /dev/null +++ b/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_One_Level_WithComment.xml @@ -0,0 +1,14 @@ + + + + diff --git a/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_One_Level_With_CDATA.xml b/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_One_Level_With_CDATA.xml new file mode 100644 index 00000000..a227213c --- /dev/null +++ b/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_One_Level_With_CDATA.xml @@ -0,0 +1,17 @@ + + + + + diff --git a/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_One_Level_With_Comment.xml b/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_One_Level_With_Comment.xml new file mode 100644 index 00000000..2ec28fb3 --- /dev/null +++ b/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_One_Level_With_Comment.xml @@ -0,0 +1,14 @@ + + + + diff --git a/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_Two_Level.xml b/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_Two_Level.xml new file mode 100644 index 00000000..673573cc --- /dev/null +++ b/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_Two_Level.xml @@ -0,0 +1,16 @@ + + + + + + diff --git a/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_Two_Level_With_CDATA.xml b/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_Two_Level_With_CDATA.xml new file mode 100644 index 00000000..d2f88721 --- /dev/null +++ b/tests/CompletionEngineTests/Parsing/Fragemts/Should_GetParentTagName_At_Level_Two_Level_With_CDATA.xml @@ -0,0 +1,21 @@ + + + + +