Files
Sourcetrail/ide_plugins/vs/vs2015/SourcetrailPlugin/SourcetrailPlugin.IntegrationTests/UnitTests/CompilationDatabaseTests.cs
T
malte_langkabel 7010b9a6fb logic: update Visual Studio plugin to support Visual Studio 2017
* changed description text of Visual Studio plugin
* changed plugin install targets to include VS 2017
* add license file with MIT license
* updated vsix for deployment

* implement wrapper for all used classes of VCProjectEngine.dll since you cannot just use the oldest version of this
  assembly (see https://stackoverflow.com/questions/44288050/typecast-fails-when-visual-studio-extension-uses-reference-to-older-assembly).
* improved serialization and deserialization of compile commands and compilation databases.
* updated used JSON package
* rename CommandObject to CompileCommand
* changed implementation to keep non-existent file paths in cdb
* made methods of SolutionParser non-static
* replace spaces with tabs

* added IntegrationTests project
* configured tests to simulate a new instance of VisualStudio
* added cinder as test project for integration tests
* remove all absolute paths from expected output of integration tests

fortune cookie message = A stranger will bring great meaning to your life.
2017-06-02 14:48:29 +02:00

61 lines
1.8 KiB
C#

using Microsoft.VisualStudio.TestTools.UnitTesting;
using CoatiSoftware.SourcetrailPlugin.SolutionParser;
namespace CoatiSoftware.SourcetrailPlugin.IntegrationTests.UnitTests
{
[TestClass]
public class CompilationDatabaseTests
{
[TestMethod]
public void TestComparingCompileCommandWithSelfByValueWorks()
{
CompileCommand command1 = new CompileCommand();
command1.File = "test.cpp";
command1.Directory = "./";
command1.Command = "D test test.cpp";
CompileCommand command2 = new CompileCommand();
command2.File = "test.cpp";
command2.Directory = "./";
command2.Command = "D test test.cpp";
Assert.IsTrue(command1 == command2);
}
[TestMethod]
public void TestComparingCompilationDatabaseWithSelfByValueWorks()
{
CompileCommand command = new CompileCommand();
command.File = "test.cpp";
command.Directory = "./";
command.Command = "D test test.cpp";
CompilationDatabase cdb1 = new CompilationDatabase();
cdb1.AddCommandObject(command);
CompilationDatabase cdb2 = new CompilationDatabase();
cdb2.AddCommandObject(command);
Assert.IsTrue(cdb1 == cdb2);
}
[TestMethod]
public void TestCompilationDatabaseRetainsEscapedQuotesWhenDeserializedAfterSerialization()
{
CompileCommand command = new CompileCommand();
command.File = "test.cpp";
command.Directory = "./";
command.Command = "D DEFINE=\"value\" test.cpp";
CompilationDatabase originalCompilationDatabase = new CompilationDatabase();
originalCompilationDatabase.AddCommandObject(command);
string serialized = originalCompilationDatabase.SerializeToJson();
CompilationDatabase deserializedCompilationDatabase = new CompilationDatabase();
deserializedCompilationDatabase.DeserializeFromJson(serialized);
Assert.IsTrue(deserializedCompilationDatabase == originalCompilationDatabase);
}
}
}