Skip to content

Commit

Permalink
remove escaping from errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Reuven committed Feb 28, 2024
1 parent 2ce6d6f commit dd64ae0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions internal/run_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ import (
func Test_InvalidFileUnix(t *testing.T) {
var stderr bytes.Buffer
require.Equal(t, 102, internal.Run(cmdToArgs("oasdiff diff no-file ../data/openapi-test3.yaml"), io.Discard, &stderr))
require.Equal(t, "Error: failed to load base spec from \"no-file\": open no-file: no such file or directory\n", stderr.String())
require.Equal(t, `Error: failed to load base spec from "no-file": open no-file: no such file or directory
`, stderr.String())
}

func Test_ComposedModeInvalidFileUnix(t *testing.T) {
var stderr bytes.Buffer
require.Equal(t, 103, internal.Run(cmdToArgs("oasdiff diff ../data/allof/* ../data/allof/* --composed --flatten"), io.Discard, &stderr))
require.Equal(t, "Error: failed to load base specs from glob \"../data/allof/*\": failed to flatten allOf in \"../data/allof/invalid.yaml\": unable to resolve Type conflict: all Type values must be identical\n", stderr.String())
require.Equal(t, `Error: failed to load base specs from glob "../data/allof/*": failed to flatten allOf in "../data/allof/invalid.yaml": unable to resolve Type conflict: all Type values must be identical
`, stderr.String())
}
6 changes: 4 additions & 2 deletions internal/run_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ import (
func Test_InvalidFileWindows(t *testing.T) {
var stderr bytes.Buffer
require.Equal(t, 102, internal.Run(cmdToArgs("oasdiff diff no-file ../data/openapi-test3.yaml"), io.Discard, &stderr))
require.Equal(t, "Error: failed to load base spec from \"no-file\": open no-file: The system cannot find the file specified.\n", stderr.String())
require.Equal(t, `Error: failed to load base spec from "no-file": open no-file: The system cannot find the file specified.
`, stderr.String())
}

func Test_ComposedModeInvalidFileWindows(t *testing.T) {
var stderr bytes.Buffer
require.Equal(t, 103, internal.Run(cmdToArgs("oasdiff diff ../data/allof/* ../data/allof/* --composed --flatten"), io.Discard, &stderr))
require.Equal(t, "Error: failed to load base specs from glob \"../data/allof/*\": failed to flatten allOf in \"..\\data\\allof\\invalid.yaml\": unable to resolve Type conflict: all Type values must be identical\n", stderr.String())
require.Equal(t, `Error: failed to load base specs from glob "../data/allof/*": failed to flatten allOf in "..\\data\\allof\\invalid.yaml": unable to resolve Type conflict: all Type values must be identical
`, stderr.String())
}

0 comments on commit dd64ae0

Please sign in to comment.