-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): Update version number from 0.2.0 to 0.3.0
The version number has been incremented to reflect the new release.
- Loading branch information
Showing
4 changed files
with
50 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
package main | ||
|
||
import ( | ||
"bytes" | ||
"io" | ||
"os" | ||
"testing" | ||
"bytes" | ||
"io" | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestMainRun(t *testing.T) { | ||
origArgs := os.Args | ||
defer func() { os.Args = origArgs }() | ||
|
||
tests := []struct { | ||
name string | ||
args []string | ||
output string | ||
}{ | ||
{ | ||
name: "Help command", | ||
args: []string{"--help"}, | ||
output: "Usage:", | ||
}, | ||
{ | ||
name: "Version command", | ||
args: []string{"--version"}, | ||
output: "cmt 0.2.0\n", | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
os.Args = append([]string{"cmd"}, tt.args...) | ||
|
||
r, w, _ := os.Pipe() | ||
origStdout := os.Stdout | ||
os.Stdout = w | ||
defer func() { os.Stdout = origStdout }() | ||
|
||
main() | ||
|
||
w.Close() | ||
var buf bytes.Buffer | ||
_, err := io.Copy(&buf, r) | ||
if err != nil { | ||
return | ||
} | ||
result := buf.String() | ||
|
||
assert.Contains(t, result, tt.output) | ||
}) | ||
} | ||
origArgs := os.Args | ||
defer func() { os.Args = origArgs }() | ||
|
||
tests := []struct { | ||
name string | ||
args []string | ||
output string | ||
}{ | ||
{ | ||
name: "Help command", | ||
args: []string{"--help"}, | ||
output: "Usage:", | ||
}, | ||
{ | ||
name: "Version command", | ||
args: []string{"--version"}, | ||
output: "cmt 0.3.0\n", | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
os.Args = append([]string{"cmd"}, tt.args...) | ||
|
||
r, w, _ := os.Pipe() | ||
origStdout := os.Stdout | ||
os.Stdout = w | ||
defer func() { os.Stdout = origStdout }() | ||
|
||
main() | ||
|
||
w.Close() | ||
var buf bytes.Buffer | ||
_, err := io.Copy(&buf, r) | ||
if err != nil { | ||
return | ||
} | ||
result := buf.String() | ||
|
||
assert.Contains(t, result, tt.output) | ||
}) | ||
} | ||
} |
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ import ( | |
"fmt" | ||
) | ||
|
||
const VERSION = "0.2.0" | ||
const VERSION = "0.3.0" | ||
|
||
func Help() { | ||
fmt.Println("Usage:") | ||
|
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