mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 07:22:43 +01:00
Move unit tests to the location Meson expects them to be
Everything that is a separate subproject should live in the subprojects
directory.
Progress on #2503
This reverts commit 451f8a8c19.
This commit is contained in:
parent
1cd48008f0
commit
e65510da56
270 changed files with 158 additions and 168 deletions
64
src/libutil-tests/executable-path.cc
Normal file
64
src/libutil-tests/executable-path.cc
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "executable-path.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
#ifdef WIN32
|
||||
# define PATH_VAR_SEP L";"
|
||||
#else
|
||||
# define PATH_VAR_SEP ":"
|
||||
#endif
|
||||
|
||||
#define PATH_ENV_ROUND_TRIP(NAME, STRING_LIT, CXX_LIT) \
|
||||
TEST(ExecutablePath, NAME) \
|
||||
{ \
|
||||
OsString s = STRING_LIT; \
|
||||
auto v = ExecutablePath::parse(s); \
|
||||
EXPECT_EQ(v, (ExecutablePath CXX_LIT)); \
|
||||
auto s2 = v.render(); \
|
||||
EXPECT_EQ(s2, s); \
|
||||
}
|
||||
|
||||
PATH_ENV_ROUND_TRIP(emptyRoundTrip, OS_STR(""), ({}))
|
||||
|
||||
PATH_ENV_ROUND_TRIP(
|
||||
oneElemRoundTrip,
|
||||
OS_STR("/foo"),
|
||||
({
|
||||
OS_STR("/foo"),
|
||||
}))
|
||||
|
||||
PATH_ENV_ROUND_TRIP(
|
||||
twoElemsRoundTrip,
|
||||
OS_STR("/foo" PATH_VAR_SEP "/bar"),
|
||||
({
|
||||
OS_STR("/foo"),
|
||||
OS_STR("/bar"),
|
||||
}))
|
||||
|
||||
PATH_ENV_ROUND_TRIP(
|
||||
threeElemsRoundTrip,
|
||||
OS_STR("/foo" PATH_VAR_SEP "." PATH_VAR_SEP "/bar"),
|
||||
({
|
||||
OS_STR("/foo"),
|
||||
OS_STR("."),
|
||||
OS_STR("/bar"),
|
||||
}))
|
||||
|
||||
TEST(ExecutablePath, elementyElemNormalize)
|
||||
{
|
||||
auto v = ExecutablePath::parse(PATH_VAR_SEP PATH_VAR_SEP PATH_VAR_SEP);
|
||||
EXPECT_EQ(
|
||||
v,
|
||||
(ExecutablePath{{
|
||||
OS_STR("."),
|
||||
OS_STR("."),
|
||||
OS_STR("."),
|
||||
OS_STR("."),
|
||||
}}));
|
||||
auto s2 = v.render();
|
||||
EXPECT_EQ(s2, OS_STR("." PATH_VAR_SEP "." PATH_VAR_SEP "." PATH_VAR_SEP "."));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue