-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from tfadeyi/improve-test-coverage
Improve test coverage in the internal packages
- Loading branch information
Showing
18 changed files
with
360 additions
and
77 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
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 +1,24 @@ | ||
package generate | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestIsValidOutputFormat(t *testing.T) { | ||
t.Run("Successfully return true if the input format is json", func(t *testing.T) { | ||
assert.True(t, IsValidOutputFormat("json")) | ||
}) | ||
t.Run("Successfully return true if the input format is yaml", func(t *testing.T) { | ||
assert.True(t, IsValidOutputFormat("yaml")) | ||
}) | ||
t.Run("Successfully return true if the input format is YAML", func(t *testing.T) { | ||
assert.True(t, IsValidOutputFormat("YAML")) | ||
}) | ||
t.Run("Successfully return true if the input format is YAML with whitespace", func(t *testing.T) { | ||
assert.True(t, IsValidOutputFormat(" YAML ")) | ||
}) | ||
t.Run("Fail to return true if the input format is not supported", func(t *testing.T) { | ||
assert.False(t, IsValidOutputFormat("toml")) | ||
}) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package lang | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestIsSupportedLanguage(t *testing.T) { | ||
t.Parallel() | ||
|
||
t.Run("Successfully return true if Go is the target language", func(t *testing.T) { | ||
assert.True(t, IsSupportedLanguage(Go)) | ||
}) | ||
|
||
t.Run("Successfully return true if Rust is the target language", func(t *testing.T) { | ||
assert.True(t, IsSupportedLanguage(Rust)) | ||
}) | ||
|
||
t.Run("Fail to return true if the language is different from the supported ones", func(t *testing.T) { | ||
assert.False(t, IsSupportedLanguage("Python")) | ||
}) | ||
} |
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
Oops, something went wrong.