forked from NixOS/nix
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "move
libexpr
unit test logic to functional test"
This reverts commit 87605c539cdf361b2a416a7e12c1e3e5da85161d.
- Loading branch information
1 parent
84654d8
commit 129ed19
Showing
15 changed files
with
54 additions
and
29 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include "gtest/gtest.h" | ||
#include <string> | ||
#include "tests/characterization.hh" | ||
#include "tests/libexpr.hh" | ||
#include "derivations.hh" | ||
|
||
namespace nix { | ||
|
||
class DerivationTest : public CharacterizationTest, public LibExprTest | ||
{ | ||
Path unitTestData = getUnitTestData() + "/derivation"; | ||
|
||
public: | ||
Path goldenMaster(std::string_view testStem) const override | ||
{ | ||
return unitTestData + "/" + testStem; | ||
} | ||
}; | ||
|
||
#define EXPR_DRV_TEST(NAME, STEM) \ | ||
TEST_F(DerivationTest, Derivation_##NAME) \ | ||
{ \ | ||
writeTest( \ | ||
STEM ".drv", \ | ||
[&]() -> Derivation { \ | ||
Value v = eval(readFile(goldenMaster(STEM ".nix"))); \ | ||
Symbol s = state.symbols.create("drvPath"); \ | ||
auto attr = v.attrs() -> get(s); \ | ||
state.forceValueDeep(*attr->value); \ | ||
NixStringContext context; \ | ||
auto storePath = state.coerceToStorePath(attr->pos, *attr->value, context, ""); \ | ||
\ | ||
return store->readDerivation(storePath); \ | ||
}, \ | ||
[&](const auto & file) { \ | ||
auto s = readFile(file); \ | ||
return parseDerivation(*store, std::move(s), STEM); \ | ||
}, \ | ||
[&](const auto & file, const auto & got) { \ | ||
auto s = got.unparse(*store, false); \ | ||
return writeFile(file, std::move(s)); \ | ||
}); \ | ||
} | ||
|
||
EXPR_DRV_TEST(advancedAttributes, "advanced-attributes"); | ||
EXPR_DRV_TEST(advancedAttributes_defaults, "advanced-attributes-defaults"); | ||
EXPR_DRV_TEST(advancedAttributes_structuredAttrs, "advanced-attributes-structured-attrs"); | ||
EXPR_DRV_TEST(advancedAttributes_structuredAttrs_defaults, "advanced-attributes-structured-attrs-defaults"); | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
tests/unit/libstore/data/derivation/advanced-attributes-defaults.drv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
../../../../functional/derivation/advanced-attributes-defaults.drv | ||
../../../libexpr/data/derivation/advanced-attributes-defaults.drv |
2 changes: 1 addition & 1 deletion
2
tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs-defaults.drv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
../../../../functional/derivation/advanced-attributes-structured-attrs-defaults.drv | ||
../../../libexpr/data/derivation/advanced-attributes-structured-attrs-defaults.drv |
2 changes: 1 addition & 1 deletion
2
tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs.drv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
../../../../functional/derivation/advanced-attributes-structured-attrs.drv | ||
../../../libexpr/data/derivation/advanced-attributes-structured-attrs.drv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
../../../../functional/derivation/advanced-attributes.drv | ||
../../../libexpr/data/derivation/advanced-attributes.drv |