Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
3aaac883
Commit
3aaac883
authored
Jul 20, 2018
by
Cristian Maglie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed lib list regression and added test
parent
01666cd6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
4 deletions
+28
-4
commands/commands.go
commands/commands.go
+8
-0
commands/commands_test.go
commands/commands_test.go
+20
-4
No files found.
commands/commands.go
View file @
3aaac883
...
...
@@ -138,6 +138,14 @@ func InitLibraryManager(pm *packagemanager.PackageManager) *librariesmanager.Lib
formatter
.
PrintError
(
err
,
"Error loading libraries index"
)
os
.
Exit
(
ErrGeneric
)
}
// Scan for libraries
if
err
:=
lm
.
RescanLibraries
();
err
!=
nil
{
logrus
.
WithError
(
err
)
.
Error
(
"Error during libraries rescan"
)
formatter
.
PrintError
(
err
,
"Error during libraries rescan"
)
os
.
Exit
(
ErrGeneric
)
}
return
lm
}
...
...
commands/commands_test.go
View file @
3aaac883
...
...
@@ -36,6 +36,8 @@ import (
"os"
"testing"
"github.com/arduino/go-paths-helper"
"github.com/bcmi-labs/arduino-cli/commands/root"
"github.com/bcmi-labs/arduino-cli/configs"
"github.com/bouk/monkey"
...
...
@@ -144,12 +146,17 @@ func TestLibSearch(t *testing.T) {
require
.
Equal
(
t
,
""
,
string
(
output
))
}
func
TestLibDownload
(
t
*
testing
.
T
)
{
func
TestLibDownload
AndInstall
(
t
*
testing
.
T
)
{
// Set staging folder to a temporary folder
tmp
,
err
:=
ioutil
.
TempDir
(
os
.
TempDir
()
,
"test"
)
tmp
,
err
:=
paths
.
MkTempDir
(
""
,
"test"
)
require
.
NoError
(
t
,
err
,
"making temporary staging dir"
)
defer
os
.
RemoveAll
(
tmp
)
configs
.
ArduinoDataFolder
.
SetPath
(
tmp
)
defer
tmp
.
RemoveAll
()
configs
.
ArduinoDataFolder
.
SetPath
(
tmp
.
String
())
tmpSketchbook
,
err
:=
paths
.
MkTempDir
(
""
,
"test"
)
require
.
NoError
(
t
,
err
,
"making temporary staging dir"
)
defer
tmpSketchbook
.
RemoveAll
()
configs
.
ArduinoHomeFolder
.
SetPath
(
tmpSketchbook
.
String
())
exitCode
,
d
:=
executeWithArgs
(
t
,
"core"
,
"update-index"
)
require
.
Zero
(
t
,
exitCode
,
"exit code"
)
...
...
@@ -170,6 +177,15 @@ func TestLibDownload(t *testing.T) {
exitCode
,
d
=
executeWithArgs
(
t
,
"lib"
,
"download"
,
"Audio@1.2.3-nonexistent"
)
require
.
NotZero
(
t
,
exitCode
,
"exit code"
)
require
.
Contains
(
t
,
string
(
d
),
"not found"
)
exitCode
,
d
=
executeWithArgs
(
t
,
"lib"
,
"install"
,
"Audio"
)
require
.
Zero
(
t
,
exitCode
,
"exit code"
)
require
.
Contains
(
t
,
string
(
d
),
"Audio@"
)
require
.
Contains
(
t
,
string
(
d
),
"Installed"
)
exitCode
,
d
=
executeWithArgs
(
t
,
"lib"
,
"list"
)
require
.
Zero
(
t
,
exitCode
,
"exit code"
)
require
.
Contains
(
t
,
string
(
d
),
"Audio"
)
}
func
updateCoreIndex
(
t
*
testing
.
T
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment