mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 03:56:01 +01:00
Minimize the use of C Macros for characterization tests
Fewer macros is better! Introduce a new `JsonChacterizationTest` mixin class to help with this. Also, avoid some needless copies with `GetParam`. Part of my effort shoring up the JSON formats with #13570.
This commit is contained in:
parent
3bf1268ac6
commit
01b2037bc0
15 changed files with 364 additions and 252 deletions
|
|
@ -642,7 +642,7 @@ class ToStringPrimOpTest : public PrimOpTest,
|
|||
|
||||
TEST_P(ToStringPrimOpTest, toString)
|
||||
{
|
||||
const auto [input, output] = GetParam();
|
||||
const auto & [input, output] = GetParam();
|
||||
auto v = eval(input);
|
||||
ASSERT_THAT(v, IsStringEq(output));
|
||||
}
|
||||
|
|
@ -798,7 +798,7 @@ class CompareVersionsPrimOpTest : public PrimOpTest,
|
|||
|
||||
TEST_P(CompareVersionsPrimOpTest, compareVersions)
|
||||
{
|
||||
auto [expression, expectation] = GetParam();
|
||||
const auto & [expression, expectation] = GetParam();
|
||||
auto v = eval(expression);
|
||||
ASSERT_THAT(v, IsIntEq(expectation));
|
||||
}
|
||||
|
|
@ -834,7 +834,7 @@ class ParseDrvNamePrimOpTest
|
|||
|
||||
TEST_P(ParseDrvNamePrimOpTest, parseDrvName)
|
||||
{
|
||||
auto [input, expectedName, expectedVersion] = GetParam();
|
||||
const auto & [input, expectedName, expectedVersion] = GetParam();
|
||||
const auto expr = fmt("builtins.parseDrvName \"%1%\"", input);
|
||||
auto v = eval(expr);
|
||||
ASSERT_THAT(v, IsAttrsOfSize(2));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue