Skip to content

Commit

Permalink
Merge pull request #89 from robgonnella/add-more-coverage-and-update-…
Browse files Browse the repository at this point in the history
…version

Add more coverage and update version
  • Loading branch information
robgonnella authored Sep 4, 2021
2 parents f21aad9 + e52b0a3 commit 93705be
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
21 changes: 20 additions & 1 deletion v2/commands/compile_and_upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ func TestCompileAndUploadCommand(t *testing.T) {
assert.Error(env.T, err)
})

testutil.RunMockIntegrationTest("returns error if build doesn't exist", t, func(env *testutil.MockIntegrationTestEnv) {
env.RunProjectInit()
args := []string{"compile-and-upload", "noop"}
err := env.Execute(args)
assert.Error(env.T, err)
})

testutil.RunMockIntegrationTest("errors if no board is connected and fqbn is missing", t, func(env *testutil.MockIntegrationTestEnv) {
env.RunProjectInit()
expectUsual(env)
Expand Down Expand Up @@ -219,8 +226,20 @@ func TestCompileAndUploadCommand(t *testing.T) {
assert.NoError(env.T, err)
})

testutil.RunMockIntegrationTest("compiles and uploads using provided fqbn and port", t, func(env *testutil.MockIntegrationTestEnv) {
env.RunProjectInit()

env.ArduinoCli.EXPECT().CreateInstance().Return(instance)
env.ArduinoCli.EXPECT().Compile(gomock.Any(), compileReq1, gomock.Any(), gomock.Any(), gomock.Any())
env.ArduinoCli.EXPECT().Upload(gomock.Any(), uploadReq1, gomock.Any(), gomock.Any())

args := []string{"compile-and-upload", sketchPath1, "--fqbn", fqbn1, "--port", board1.Port}
err := env.Execute(args)
assert.NoError(env.T, err)
})

testutil.RunMockIntegrationTest("errors if not a valid project directory", t, func(env *testutil.MockIntegrationTestEnv) {
args := []string{"compile", ".", "--fqbn", fqbn1}
args := []string{"compile-and-upload"}
err := env.Execute(args)
assert.Error(env.T, err)
})
Expand Down
9 changes: 5 additions & 4 deletions v2/commands/help_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ func TestHelpCommand(t *testing.T) {

os.Stdout = w
cmd := &cobra.Command{
Use: "somecmd [args]",
Short: "Longer than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char",
Long: "\nLonger than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char",
Run: func(cmd *cobra.Command, args []string) {},
Use: "somecmd [args]",
Short: "Longer than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char",
Long: "\nLonger than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char Longer than 80char",
Aliases: []string{"many", "aliases", "so", "what", "about", "even", "more", "how", "can", "we", "get", "words", "to", "continue", "forever", "end", "ever", "without", "repeating"},
Run: func(cmd *cobra.Command, args []string) {},
}

commands.Help(cmd, []string{})
Expand Down
1 change: 0 additions & 1 deletion v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ require (
github.com/mitchellh/go-wordwrap v1.0.1
github.com/nsf/termbox-go v1.1.1 // indirect
github.com/oleksandr/bonjour v0.0.0-20210301155756-30f43c61b915 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/segmentio/fasthash v1.0.3 // indirect
github.com/segmentio/stats/v4 v4.6.2 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
Expand Down
3 changes: 0 additions & 3 deletions v2/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/creack/goselect v0.1.1/go.mod h1:a/NhLweNvqIYMuxcMOuWY516Cimucms3DglDzQP3hKY=
github.com/creack/goselect v0.1.2 h1:2DNy14+JPjRBgPzAd1thbQp4BSIihxcBf0IXhQXDRa0=
Expand Down Expand Up @@ -382,8 +381,6 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/schollz/closestmatch v2.1.0+incompatible h1:Uel2GXEpJqOWBrlyI+oY9LTiyyjYS17cCYRqP13/SHk=
github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g=
Expand Down
2 changes: 1 addition & 1 deletion v2/version/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package version

// VERSION latest V2 version of ardi
const VERSION = "2.3.1"
const VERSION = "2.4.0"

0 comments on commit 93705be

Please sign in to comment.