Skip to content

Commit 77897d6

Browse files
authored
Merge pull request #65 from SimonBaeumer/add-godoc
Add godoc badge
2 parents 2d67307 + c03b31a commit 77897d6

File tree

8 files changed

+19
-5
lines changed

8 files changed

+19
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[![Build Status](https://travis-ci.org/SimonBaeumer/commander.svg?branch=master)](https://travis-ci.org/SimonBaeumer/commander)
2+
[![GoDoc](https://godoc.org/github.com/SimonBaeumer/commander?status.svg)](https://godoc.org/github.com/SimonBaeumer/commander)
23
[![Go Report Card](https://goreportcard.com/badge/github.com/SimonBaeumer/commander)](https://goreportcard.com/report/github.com/SimonBaeumer/commander)
34
[![Maintainability](https://api.codeclimate.com/v1/badges/cc848165784e0f809a51/maintainability)](https://codeclimate.com/github/SimonBaeumer/commander/maintainability)
45
[![Test Coverage](https://api.codeclimate.com/v1/badges/cc848165784e0f809a51/test_coverage)](https://codeclimate.com/github/SimonBaeumer/commander/test_coverage)

pkg/app/add_command.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import (
77
"gopkg.in/yaml.v2"
88
)
99

10+
// AddCommand executes the add command
11+
// command is the command which should be added to the test suite
12+
// existed holds the existing yaml content
1013
func AddCommand(command string, existed []byte) ([]byte, error) {
1114
conf := suite.YAMLConfig{
1215
Tests: make(map[string]suite.YAMLTest),

pkg/app/app.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package app
33
import "github.com/urfave/cli"
44

55
const (
6-
//Defines the app name
6+
//AppName defines the app name
77
AppName = "Commander"
8-
//Default config file which is loaded
8+
//CommanderFile holds the default config file which is loaded
99
CommanderFile = "commander.yaml"
1010
)
1111

pkg/app/test_command.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import (
1010
"os"
1111
)
1212

13+
// TestCommand executes the test argument
14+
// file is the path to the configuration file
15+
// title ist the title of test which should be executed, if empty it will execute all tests
16+
// ctx holds the command flags
1317
func TestCommand(file string, title string, ctx AddCommandContext) error {
1418
if ctx.Verbose == true {
1519
log.SetOutput(os.Stdout)

pkg/cmd/command.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ func NewCommand(cmd string) *Command {
3030
}
3131
}
3232

33+
// AddEnv adds an environment variable to the command
3334
func (c *Command) AddEnv(key string, value string) {
3435
c.Env = append(c.Env, fmt.Sprintf("%s=%s", key, value))
3536
}
@@ -84,7 +85,8 @@ func (c *Command) isExecuted(property string) {
8485
}
8586
}
8687

87-
//Execute executes the commande
88+
// Execute executes the command and writes the results into it's own instance
89+
// The results can be received with the Stdout(), Stderr() and ExitCode() methods
8890
func (c *Command) Execute() error {
8991
cmd := createBaseCommand(c)
9092
cmd.Env = c.Env

pkg/runtime/runtime.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ type TestResult struct {
8888
Tries int
8989
}
9090

91-
// Start starts the given test suite
91+
// Start starts the given test suite and executes all tests
92+
// maxConcurrent configures the amount of go routines which will be started
9293
func Start(tests []TestCase, maxConcurrent int) <-chan TestResult {
9394
in := make(chan TestCase)
9495
out := make(chan TestResult)
@@ -133,6 +134,7 @@ func Start(tests []TestCase, maxConcurrent int) <-chan TestResult {
133134
return out
134135
}
135136

137+
// runTest executes the current test case
136138
func runTest(test TestCase) TestResult {
137139
// cut = command under test
138140
cut := cmd.NewCommand(test.Command.Cmd)
@@ -169,6 +171,7 @@ func runTest(test TestCase) TestResult {
169171
return Validate(test)
170172
}
171173

174+
// GetRetries returns the retries of the command
172175
func (c *CommandUnderTest) GetRetries() int {
173176
if c.Retries == 0 {
174177
return 1

pkg/runtime/validator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func newValidationResult(m matcher.MatcherResult) ValidationResult {
2020
}
2121

2222
// Validate validates the test results with the expected values
23+
// The test should hold the result and expected to validate the result
2324
func Validate(test TestCase) TestResult {
2425
equalMatcher := matcher.NewMatcher(matcher.Equal)
2526

pkg/suite/yaml_suite.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (s YAMLSuite) GetTestByTitle(title string) (runtime.TestCase, error) {
5252
return runtime.TestCase{}, fmt.Errorf("Could not find test " + title)
5353
}
5454

55-
//GetGlobalConfig returns the global suite configuraiton
55+
//GetGlobalConfig returns the global suite configuration
5656
func (s YAMLSuite) GetGlobalConfig() runtime.TestConfig {
5757
return s.Config
5858
}

0 commit comments

Comments
 (0)