Skip to content

Commit

Permalink
🐛 Fixed test not finding test mo file
Browse files Browse the repository at this point in the history
  • Loading branch information
AnotherFoxGuy committed Sep 6, 2021
1 parent 9a91cce commit a21710f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
19 changes: 7 additions & 12 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
project(moFileReaderTest)

set(TEST_MO_FILE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/languages")

configure_file("config.cs.in" "config.cs")

set(SOURCE_FILES
${CMAKE_SOURCE_DIR}/src/moFileReader.cs
${CMAKE_CURRENT_BINARY_DIR}/config.cs
)

add_library(test SHARED ${SOURCE_FILES} moFileReader_tests.cs)
Expand All @@ -17,26 +21,17 @@ set(DOTNET_REF
WindowsBase
)

set(NUGET_PKGS_TEST
NUnit_3.13.2
NUnit.Console_3.12.0
)

set(NUGET_PKGS_BENCH
BenchmarkDotNet_0.13.1
)

# Set CLR assembly properties.
set_target_properties(test PROPERTIES
WIN32_EXECUTABLE TRUE
VS_DOTNET_REFERENCES "${DOTNET_REF}"
VS_PACKAGE_REFERENCES "${NUGET_PKGS_TEST}"
VS_DOTNET_REFERENCES "${DOTNET_REF};nunit.framework"
VS_PACKAGE_REFERENCES "NUnit_3.13.2;NUnit.Console_3.12.0"
VS_GLOBAL_ROOTNAMESPACE ${PROJECT_NAME}
)

set_target_properties(bench PROPERTIES
WIN32_EXECUTABLE TRUE
VS_DOTNET_REFERENCES "${DOTNET_REF}"
VS_PACKAGE_REFERENCES "${NUGET_PKGS_BENCH}"
VS_PACKAGE_REFERENCES "BenchmarkDotNet_0.13.1"
VS_GLOBAL_ROOTNAMESPACE ${PROJECT_NAME}
)
4 changes: 4 additions & 0 deletions test/config.cs.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
public static class CmakeData
{
public static string DataDir = "@TEST_MO_FILE_DIR@";
}
8 changes: 2 additions & 6 deletions test/moFileReader_tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@
using System.IO;
using NUnit.Framework;
using static moFileLib.ConvenienceClasses;
using static CmakeData;

namespace moFileLib
{
[TestFixture]
public class moFileLibTests
{
private string MO_TEST_FILE = "languages/nl.mo";

// [SetUp]
// protected void SetUp()
// {
// }
private string MO_TEST_FILE = $"{DataDir}/nl.mo";

[Test]
public void LoadMoFile()
Expand Down

0 comments on commit a21710f

Please sign in to comment.