Skip to content

Commit

Permalink
Improving test files formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jtyr committed Jan 12, 2018
1 parent a141026 commit ce1439c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
24 changes: 17 additions & 7 deletions pkg/core/car/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ func TestGetModel(t *testing.T) {
}{
{
key: "root",
model: map[string]ModelElement{ "root": { Bg: "255", Fg: "red", Fm: "bold", Text: "test", }, },
expectedOutput: map[string]ModelElement{ "root": { Bg: "255", Fg: "red", Fm: "bold", Text: "test", }, },
model: map[string]ModelElement{
"root": { Bg: "255", Fg: "red", Fm: "bold", Text: "test", },
},
expectedOutput: map[string]ModelElement{
"root": { Bg: "255", Fg: "red", Fm: "bold", Text: "test", },
},
},
}

Expand Down Expand Up @@ -134,7 +138,7 @@ func TestFormat(t *testing.T) {
}{
{
model: map[string]ModelElement{
"root": { Bg: "222", Fg: "red", Fm: "bold", Text: "test", },
"root": { Bg: "222", Fg: "red", Fm: "bold", Text: "test", },
},
// TODO: This isn't what's actually generated on the command line.
expectedOutput: "\x1b[48;5;222m\x1b[38;5;1m\x1b[1m\x1b[21mtest",
Expand All @@ -143,7 +147,7 @@ func TestFormat(t *testing.T) {
},
{
model: map[string]ModelElement{
"root": { Bg: "222", Fg: "red", Fm: "bold", Text: "{{ Unknown }}", },
"root": { Bg: "222", Fg: "red", Fm: "bold", Text: "{{ Unknown }}", },
},
// TODO: This isn't what's actually generated on the command line.
expectedOutput: "\x1b[48;5;222m\x1b[38;5;1m\x1b[1m\x1b[21m{{ Unknown }}",
Expand All @@ -161,7 +165,9 @@ func TestFormat(t *testing.T) {
shell: "plain",
},
{
model: map[string]ModelElement{ "root": { Bg: "222", Fg: "red", Fm: "bold", Text: "text", }, },
model: map[string]ModelElement{
"root": { Bg: "222", Fg: "red", Fm: "bold", Text: "text", },
},
expectedOutput: "",
display: false,
shell: "plain",
Expand Down Expand Up @@ -194,14 +200,18 @@ func TestDecorateElement(t *testing.T) {
}{
{
element: "root",
model: map[string]ModelElement{ "root": { Bg: "222", Fg: "red", Fm: "bold", Text: "test", }, },
model: map[string]ModelElement{
"root": { Bg: "222", Fg: "red", Fm: "bold", Text: "test", },
},
expectedOutput: "\x1b[48;5;222m\x1b[38;5;1m\x1b[1m\x1b[21m",
display: true,
shell: "plain",
},
{
element: "User",
model: map[string]ModelElement{ "User": { Bg: "222", Fg: "red", Fm: "bold", Text: "test", }, },
model: map[string]ModelElement{
"User": { Bg: "222", Fg: "red", Fm: "bold", Text: "test", },
},
expectedOutput: "\x1b[48;5;222m\x1b[38;5;1m\x1b[1mtest\x1b[21m",
display: true,
shell: "plain",
Expand Down
4 changes: 2 additions & 2 deletions pkg/core/utils/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ func TestRun(t *testing.T) {
stderr string
}{
{ cmd: []string{"find", "/", "-maxdepth", "1", "-name", "tmp"}, rc: 0, stdout: "/tmp", stderr: "", },
{ cmd: []string{"curl", "-s", "-S", "http://localhost:12345"}, rc: 7, stdout: "", stderr: "curl: (7) Failed to connect to localhost port 12345: Connection refused", },
{ cmd: []string{"unknown_command"}, rc: 1, stdout: "", stderr: "exec: \"unknown_command\": executable file not found in $PATH", },
{ cmd: []string{"curl", "-s", "-S", "http://localhost:12345"}, rc: 7, stdout: "", stderr: "curl: (7) Failed to connect to localhost port 12345: Connection refused", },
{ cmd: []string{"unknown_command"}, rc: 1, stdout: "", stderr: "exec: \"unknown_command\": executable file not found in $PATH", },
}

for i, test := range tests {
Expand Down

0 comments on commit ce1439c

Please sign in to comment.