-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve golden test formatting (#110)
Make sure golden tests write all the generated definitions, and use the FileDefinition path so that they are formatted correctly. I made the `CodeGenerator` less stateful by removing the `scanner` from it; it is no longer necessary to read the `Definitions` field from the `scanner` as `GenerateDefinitions` will return them directly.
- Loading branch information
Showing
15 changed files
with
130 additions
and
386 deletions.
There are no files selected for viewing
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
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
Large diffs are not rendered by default.
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
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
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
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
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
12 changes: 9 additions & 3 deletions
12
.../pkg/jsonast/testdata/AdditionalProperties/Generates_field_if_other_fields_present.golden
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,8 +1,14 @@ | ||
type | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
// This is a generated file. Please do not make manual changes. | ||
package v20200101 | ||
|
||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
/* Generated from: https://test.test/schemas/2020-01-01/test.json */ | ||
Test struct { | ||
type Test struct { | ||
Tags *struct { | ||
OtherField *string `json:"otherField"` | ||
additionalProperties map[string]float64 `json:"additionalProperties"` | ||
} `json:"tags"` | ||
} | ||
} |
12 changes: 9 additions & 3 deletions
12
...alProperties/Generates_map[string]interface{}_if_unset_and_no_other_fields_present.golden
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,5 +1,11 @@ | ||
type | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
// This is a generated file. Please do not make manual changes. | ||
package v20200101 | ||
|
||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
/* Generated from: https://test.test/schemas/2020-01-01/test.json */ | ||
Test struct { | ||
type Test struct { | ||
Tags *map[string]interface{} `json:"tags"` | ||
} | ||
} |
12 changes: 9 additions & 3 deletions
12
...sonast/testdata/AdditionalProperties/Generates_map_type_if_no_other_fields_present.golden
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,5 +1,11 @@ | ||
type | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
// This is a generated file. Please do not make manual changes. | ||
package v20200101 | ||
|
||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
/* Generated from: https://test.test/schemas/2020-01-01/test.json */ | ||
Test struct { | ||
type Test struct { | ||
Tags *map[string]float64 `json:"tags"` | ||
} | ||
} |
12 changes: 9 additions & 3 deletions
12
...ator/pkg/jsonast/testdata/AdditionalProperties/Generates_nothing_if_set_to_'false'.golden
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,6 +1,12 @@ | ||
type | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
// This is a generated file. Please do not make manual changes. | ||
package v20200101 | ||
|
||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
/* Generated from: https://test.test/schemas/2020-01-01/test.json */ | ||
Test struct { | ||
type Test struct { | ||
Tags *struct { | ||
} `json:"tags"` | ||
} | ||
} |
12 changes: 9 additions & 3 deletions
12
.../testdata/AdditionalProperties/Generates_nothing_if_unset_and_other_fields_present.golden
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,7 +1,13 @@ | ||
type | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
// This is a generated file. Please do not make manual changes. | ||
package v20200101 | ||
|
||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
/* Generated from: https://test.test/schemas/2020-01-01/test.json */ | ||
Test struct { | ||
type Test struct { | ||
Tags *struct { | ||
OtherField *string `json:"otherField"` | ||
} `json:"tags"` | ||
} | ||
} |
Oops, something went wrong.