Move shared contracts into independently versioned directories
This commit is contained in:
@@ -16,7 +16,7 @@ func TestCommand(t *testing.T) {
|
||||
out string
|
||||
err string
|
||||
}{
|
||||
{"valid", []string{"-root", "../..", "../../examples/party.yml"}, 0, "valid (maximumdirect.party.v1)", ""},
|
||||
{"valid", []string{"-root", "../..", "../../examples/party.yml"}, 0, "valid (maximumdirect.rpg.party.v1)", ""},
|
||||
{"continue after failure", []string{"-root", "../..", "../../tests/invalid/semantic-duplicate-id.yml", "../../examples/weather.json"}, 1, "weather.json: valid", "semantic:"},
|
||||
{"structural", []string{"-root", "../..", "../../tests/invalid/structure-missing-name.yml"}, 1, "", "structure:"},
|
||||
{"decode", []string{"-root", "../..", "../../tests/invalid/decode-duplicate-key.yml"}, 1, "", "decode:"},
|
||||
@@ -38,7 +38,7 @@ func TestCommand(t *testing.T) {
|
||||
|
||||
func TestJSONSyntax(t *testing.T) {
|
||||
file := filepath.Join(t.TempDir(), "document.json")
|
||||
if err := os.WriteFile(file, []byte("schema_version: maximumdirect.campaign.v1\nid: sample"), 0600); err != nil {
|
||||
if err := os.WriteFile(file, []byte("schema_version: maximumdirect.rpg.campaign.v1\nid: sample"), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var stdout, stderr bytes.Buffer
|
||||
@@ -53,8 +53,8 @@ func TestDocumentDecoding(t *testing.T) {
|
||||
body string
|
||||
code int
|
||||
}{
|
||||
{"escaped.json", `{"schema_version":"maximumdirect.campaign.v1","id":"weather","name":"Weather \ud83c\udf27"}`, 0},
|
||||
{"malformed-float.yml", "schema_version: maximumdirect.campaign.v1\nid: weather\nreading: !!float e3\n", 1},
|
||||
{"escaped.json", `{"schema_version":"maximumdirect.rpg.campaign.v1","id":"weather","name":"Weather \ud83c\udf27"}`, 0},
|
||||
{"malformed-float.yml", "schema_version: maximumdirect.rpg.campaign.v1\nid: weather\nreading: !!float e3\n", 1},
|
||||
} {
|
||||
t.Run(test.file, func(t *testing.T) {
|
||||
file := filepath.Join(t.TempDir(), test.file)
|
||||
@@ -65,7 +65,7 @@ func TestDocumentDecoding(t *testing.T) {
|
||||
if code := run([]string{"-root", "../..", file}, &stdout, &stderr); code != test.code {
|
||||
t.Fatalf("want exit %d, got %d: stdout=%q stderr=%q", test.code, code, &stdout, &stderr)
|
||||
}
|
||||
if test.code == 0 && !strings.Contains(stdout.String(), "valid (maximumdirect.campaign.v1)") {
|
||||
if test.code == 0 && !strings.Contains(stdout.String(), "valid (maximumdirect.rpg.campaign.v1)") {
|
||||
t.Fatalf("missing success report: %q", &stdout)
|
||||
}
|
||||
if test.code != 0 && !strings.Contains(stderr.String(), "decode:") {
|
||||
|
||||
Reference in New Issue
Block a user