|
5 | 5 | using System.Collections;
|
6 | 6 | using System.Collections.Generic;
|
7 | 7 | using System.IO;
|
8 |
| -using System.Text; |
9 | 8 | using Microsoft.Build.Construction;
|
10 | 9 | using Microsoft.Build.Exceptions;
|
11 | 10 | using Microsoft.Build.Shared;
|
|
17 | 16 |
|
18 | 17 | namespace Microsoft.Build.UnitTests.Construction
|
19 | 18 | {
|
20 |
| - public class SolutionFile_OldParser_Tests |
| 19 | + public class SolutionFile_Tests |
21 | 20 | {
|
22 | 21 | public ITestOutputHelper TestOutputHelper { get; }
|
23 | 22 |
|
24 |
| - public SolutionFile_OldParser_Tests(ITestOutputHelper testOutputHelper) |
| 23 | + public SolutionFile_Tests(ITestOutputHelper testOutputHelper) |
25 | 24 | {
|
26 | 25 | TestOutputHelper = testOutputHelper;
|
27 | 26 | }
|
@@ -105,42 +104,6 @@ public void ParseFirstProjectLineWithDifferentSpacing()
|
105 | 104 | proj.ProjectGuid.ShouldBe("Unique name-GUID");
|
106 | 105 | }
|
107 | 106 |
|
108 |
| - /// <summary> |
109 |
| - /// A slightly more complicated test where there is some different whitespace. |
110 |
| - /// </summary> |
111 |
| - [Fact] |
112 |
| - public void ParseSolutionWithDifferentSpacing() |
113 |
| - { |
114 |
| - string solutionFileContents = |
115 |
| - @" |
116 |
| - Microsoft Visual Studio Solution File, Format Version 9.00 |
117 |
| - # Visual Studio 2005 |
118 |
| - Project(' { Project GUID} ') = ' Project name ', ' Relative path to project file ' , ' {0ABED153-9451-483C-8140-9E8D7306B216} ' |
119 |
| - EndProject |
120 |
| - Global |
121 |
| - GlobalSection(SolutionConfigurationPlatforms) = preSolution |
122 |
| - Debug|AnyCPU = Debug|AnyCPU |
123 |
| - Release|AnyCPU = Release|AnyCPU |
124 |
| - EndGlobalSection |
125 |
| - GlobalSection(ProjectConfigurationPlatforms) = postSolution |
126 |
| - {0ABED153-9451-483C-8140-9E8D7306B216}.Debug|AnyCPU.ActiveCfg = Debug|AnyCPU |
127 |
| - {0ABED153-9451-483C-8140-9E8D7306B216}.Debug|AnyCPU.Build.0 = Debug|AnyCPU |
128 |
| - {0ABED153-9451-483C-8140-9E8D7306B216}.Release|AnyCPU.ActiveCfg = Release|AnyCPU |
129 |
| - {0ABED153-9451-483C-8140-9E8D7306B216}.Release|AnyCPU.Build.0 = Release|AnyCPU |
130 |
| - EndGlobalSection |
131 |
| - GlobalSection(SolutionProperties) = preSolution |
132 |
| - HideSolutionNode = FALSE |
133 |
| - EndGlobalSection |
134 |
| - EndGlobal |
135 |
| - "; |
136 |
| - |
137 |
| - SolutionFile solution = ParseSolutionHelper(solutionFileContents); |
138 |
| - |
139 |
| - Assert.Equal("Project name", solution.ProjectsInOrder[0].ProjectName); |
140 |
| - Assert.Equal("Relative path to project file", solution.ProjectsInOrder[0].RelativePath); |
141 |
| - Assert.Equal("{0ABED153-9451-483C-8140-9E8D7306B216}", solution.ProjectsInOrder[0].ProjectGuid); |
142 |
| - } |
143 |
| - |
144 | 107 | /// <summary>
|
145 | 108 | /// First project line with an empty project name. This is somewhat malformed, but we should
|
146 | 109 | /// still behave reasonably instead of crashing.
|
@@ -724,43 +687,6 @@ public void ParseFirstProjectLineWhereProjectNameHasSpecialCharacters()
|
724 | 687 | proj.ProjectGuid.ShouldBe("Unique name-GUID");
|
725 | 688 | }
|
726 | 689 |
|
727 |
| - /// <summary> |
728 |
| - /// Test some characters that are valid in a file name but that also could be |
729 |
| - /// considered a delimiter by a parser. Does quoting work for special characters? |
730 |
| - /// </summary> |
731 |
| - [Fact] |
732 |
| - public void ParseSolutionWhereProjectNameHasSpecialCharacters() |
733 |
| - { |
734 |
| - string solutionFileContents = |
735 |
| - @" |
736 |
| - Microsoft Visual Studio Solution File, Format Version 9.00 |
737 |
| - # Visual Studio 2005 |
738 |
| - Project('{Project GUID}') = 'MyProject,(=IsGreat)', 'Relative path to project file' , '{0ABED153-9451-483C-8140-9E8D7306B216}' |
739 |
| - EndProject |
740 |
| - Global |
741 |
| - GlobalSection(SolutionConfigurationPlatforms) = preSolution |
742 |
| - Debug|AnyCPU = Debug|AnyCPU |
743 |
| - Release|AnyCPU = Release|AnyCPU |
744 |
| - EndGlobalSection |
745 |
| - GlobalSection(ProjectConfigurationPlatforms) = postSolution |
746 |
| - {0ABED153-9451-483C-8140-9E8D7306B216}.Debug|AnyCPU.ActiveCfg = Debug|AnyCPU |
747 |
| - {0ABED153-9451-483C-8140-9E8D7306B216}.Debug|AnyCPU.Build.0 = Debug|AnyCPU |
748 |
| - {0ABED153-9451-483C-8140-9E8D7306B216}.Release|AnyCPU.ActiveCfg = Release|AnyCPU |
749 |
| - {0ABED153-9451-483C-8140-9E8D7306B216}.Release|AnyCPU.Build.0 = Release|AnyCPU |
750 |
| - EndGlobalSection |
751 |
| - GlobalSection(SolutionProperties) = preSolution |
752 |
| - HideSolutionNode = FALSE |
753 |
| - EndGlobalSection |
754 |
| - EndGlobal |
755 |
| - "; |
756 |
| - |
757 |
| - SolutionFile solution = ParseSolutionHelper(solutionFileContents); |
758 |
| - |
759 |
| - Assert.Equal("MyProject,(=IsGreat)", solution.ProjectsInOrder[0].ProjectName); |
760 |
| - Assert.Equal("Relative path to project file", solution.ProjectsInOrder[0].RelativePath); |
761 |
| - Assert.Equal("{0ABED153-9451-483C-8140-9E8D7306B216}", solution.ProjectsInOrder[0].ProjectGuid); |
762 |
| - } |
763 |
| - |
764 | 690 | /// <summary>
|
765 | 691 | /// Test some characters that are valid in a file name but that also could be
|
766 | 692 | /// considered a delimiter by a parser. Does quoting work for special characters?
|
@@ -2429,58 +2355,5 @@ public void ParseSolutionWithParentedPaths()
|
2429 | 2355 | solution.ProjectsInOrder[0].AbsolutePath.ShouldBe(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(solution.FullPath)!, expectedRelativePath)));
|
2430 | 2356 | solution.ProjectsInOrder[0].ProjectGuid.ShouldBe("{0ABED153-9451-483C-8140-9E8D7306B216}");
|
2431 | 2357 | }
|
2432 |
| - |
2433 |
| - /// <summary> |
2434 |
| - /// Parse solution file with comments |
2435 |
| - /// </summary> |
2436 |
| - [Fact] |
2437 |
| - public void ParseSolutionWithComments() |
2438 |
| - { |
2439 |
| - const string solutionFileContent = @" |
2440 |
| - Microsoft Visual Studio Solution File, Format Version 12.00 |
2441 |
| - # Visual Studio Version 16 |
2442 |
| - VisualStudioVersion = 16.0.29123.89 |
2443 |
| - MinimumVisualStudioVersion = 10.0.40219.1 |
2444 |
| - Project('{9A19103F-16F7-4668-BE54-9A1E7A4F7556}') = 'SlnCommentTest', 'SlnCommentTest.csproj', '{00000000-0000-0000-FFFF-FFFFFFFFFFFF}' |
2445 |
| - EndProject |
2446 |
| - Project('{2150E333-8FDC-42A3-9474-1A3956D46DE8}') = 'Solution Items', 'Solution Items', '{054DED3B-B890-4652-B449-839F581E5D86}' |
2447 |
| - ProjectSection(SolutionItems) = preProject |
2448 |
| - SlnFile.txt = SlnFile.txt |
2449 |
| - EndProjectSection |
2450 |
| - EndProject |
2451 |
| - Global |
2452 |
| - GlobalSection(SolutionConfigurationPlatforms) = preSolution |
2453 |
| - Debug|Any CPU = Debug|Any CPU |
2454 |
| - Release|Any CPU = Release|Any CPU |
2455 |
| - EndGlobalSection |
2456 |
| - GlobalSection(ProjectConfigurationPlatforms) = postSolution |
2457 |
| - {00000000-0000-0000-FFFF-FFFFFFFFFFFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
2458 |
| - {00000000-0000-0000-FFFF-FFFFFFFFFFFF}.Debug|Any CPU.Build.0 = Debug|Any CPU |
2459 |
| - {00000000-0000-0000-FFFF-FFFFFFFFFFFF}.Release|Any CPU.ActiveCfg = Release|Any CPU |
2460 |
| - {00000000-0000-0000-FFFF-FFFFFFFFFFFF}.Release|Any CPU.Build.0 = Release|Any CPU |
2461 |
| - EndGlobalSection |
2462 |
| - GlobalSection(SolutionProperties) = preSolution |
2463 |
| - HideSolutionNode = FALSE |
2464 |
| - EndGlobalSection |
2465 |
| - GlobalSection(ExtensibilityGlobals) = postSolution |
2466 |
| - SolutionGuid = {FFFFFFFF-FFFF-FFFF-0000-000000000000} |
2467 |
| - EndGlobalSection |
2468 |
| - EndGlobal |
2469 |
| - "; |
2470 |
| - |
2471 |
| - StringBuilder stringBuilder = new StringBuilder(); |
2472 |
| - |
2473 |
| - // Put comment between all lines |
2474 |
| - const string comment = "\t# comment"; |
2475 |
| - string[] lines = solutionFileContent.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); |
2476 |
| - for (int i = 0; i < lines.Length; i++) |
2477 |
| - { |
2478 |
| - stringBuilder.AppendLine(comment); |
2479 |
| - stringBuilder.AppendLine(lines[i]); |
2480 |
| - } |
2481 |
| - stringBuilder.AppendLine(comment); |
2482 |
| - |
2483 |
| - Should.NotThrow(() => ParseSolutionHelper(stringBuilder.ToString())); |
2484 |
| - } |
2485 | 2358 | }
|
2486 | 2359 | }
|
0 commit comments