Skip to content

Commit 843629f

Browse files
committed
Organize some test JSON better to prevent confusion
It was not clear which of thes were JSON for derivation vs JSON for derivation options.
1 parent 0db70b8 commit 843629f

File tree

9 files changed

+23
-25
lines changed

9 files changed

+23
-25
lines changed

doc/manual/source/protocols/json/derivation/options.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,39 @@
77
#### Default options
88

99
```json
10-
{{#include ../schema/derivation-options-v1/ia/defaults.json}}
10+
{{#include ../schema/derivation-options-v1/ia/derivation-options/defaults.json}}
1111
```
1212

1313
#### All options set
1414

1515
```json
16-
{{#include ../schema/derivation-options-v1/ia/all_set.json}}
16+
{{#include ../schema/derivation-options-v1/ia/derivation-options/all_set.json}}
1717
```
1818

1919
#### Default options (structured attributes)
2020

2121
```json
22-
{{#include ../schema/derivation-options-v1/ia/structuredAttrs_defaults.json}}
22+
{{#include ../schema/derivation-options-v1/ia/derivation-options/structuredAttrs_defaults.json}}
2323
```
2424

2525
#### All options set (structured attributes)
2626

2727
```json
28-
{{#include ../schema/derivation-options-v1/ia/structuredAttrs_all_set.json}}
28+
{{#include ../schema/derivation-options-v1/ia/derivation-options/structuredAttrs_all_set.json}}
2929
```
3030

3131
### Content-addressed derivations
3232

3333
#### All options set
3434

3535
```json
36-
{{#include ../schema/derivation-options-v1/ca/all_set.json}}
36+
{{#include ../schema/derivation-options-v1/ca/derivation-options/all_set.json}}
3737
```
3838

3939
#### All options set (structured attributes)
4040

4141
```json
42-
{{#include ../schema/derivation-options-v1/ca/structuredAttrs_all_set.json}}
42+
{{#include ../schema/derivation-options-v1/ca/derivation-options/structuredAttrs_all_set.json}}
4343
```
4444

4545
<!-- need to convert YAML to JSON first

src/json-schema-checks/meson.build

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ schemas = [
7373
'stem' : 'derivation-options',
7474
'schema' : schema_dir / 'derivation-options-v1.yaml',
7575
'files' : [
76-
'ia' / 'defaults.json',
77-
'ia' / 'all_set.json',
78-
'ia' / 'structuredAttrs_defaults.json',
79-
'ia' / 'structuredAttrs_all_set.json',
80-
'ca' / 'all_set.json',
81-
'ca' / 'structuredAttrs_all_set.json',
76+
'ia' / 'derivation-options' / 'defaults.json',
77+
'ia' / 'derivation-options' / 'all_set.json',
78+
'ia' / 'derivation-options' / 'structuredAttrs_defaults.json',
79+
'ia' / 'derivation-options' / 'structuredAttrs_all_set.json',
80+
'ca' / 'derivation-options' / 'all_set.json',
81+
'ca' / 'derivation-options' / 'structuredAttrs_all_set.json',
8282
],
8383
},
8484
]

src/libstore-tests/derivation-advanced-attrs.cc

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ namespace nix {
1616

1717
using namespace nlohmann;
1818

19-
class DerivationAdvancedAttrsTest : public JsonCharacterizationTest<Derivation>,
20-
public JsonCharacterizationTest<DerivationOptions<SingleDerivedPath>>,
21-
public LibStoreTest
19+
class DerivationAdvancedAttrsTest : public JsonCharacterizationTest<Derivation>, public LibStoreTest
2220
{
2321
protected:
2422
std::filesystem::path unitTestData = getUnitTestData() / "derivation" / "ia";
@@ -496,16 +494,16 @@ TEST_F(CaDerivationAdvancedAttrsTest, advancedAttributes_structuredAttrs)
496494
{"rainbow", "uid-range", "ca-derivations"});
497495
};
498496

499-
#define TEST_JSON_OPTIONS(FIXUTURE, VAR, VAR2) \
500-
TEST_F(FIXUTURE, DerivationOptions_##VAR##_from_json) \
501-
{ \
502-
this->JsonCharacterizationTest<DerivationOptions<SingleDerivedPath>>::readJsonTest( \
503-
#VAR, advancedAttributes_##VAR2); \
504-
} \
505-
TEST_F(FIXUTURE, DerivationOptions_##VAR##_to_json) \
506-
{ \
507-
this->JsonCharacterizationTest<DerivationOptions<SingleDerivedPath>>::writeJsonTest( \
508-
#VAR, advancedAttributes_##VAR2); \
497+
#define TEST_JSON_OPTIONS(FIXUTURE, VAR, VAR2) \
498+
TEST_F(FIXUTURE, DerivationOptions_##VAR##_from_json) \
499+
{ \
500+
nix::readJsonTest<DerivationOptions<SingleDerivedPath>>( \
501+
*this, "derivation-options/" #VAR, advancedAttributes_##VAR2); \
502+
} \
503+
TEST_F(FIXUTURE, DerivationOptions_##VAR##_to_json) \
504+
{ \
505+
nix::readJsonTest<DerivationOptions<SingleDerivedPath>>( \
506+
*this, "derivation-options/" #VAR, advancedAttributes_##VAR2); \
509507
}
510508

511509
TEST_JSON_OPTIONS(DerivationAdvancedAttrsTest, defaults, defaults)

0 commit comments

Comments
 (0)