@@ -17,7 +17,6 @@ package daemon_test
17
17
18
18
import (
19
19
"context"
20
- "encoding/json"
21
20
"fmt"
22
21
"io"
23
22
"testing"
@@ -35,35 +34,6 @@ func TestDaemonBundleLibInstall(t *testing.T) {
35
34
fmt .Printf ("INIT> %v\n " , ir .GetMessage ())
36
35
}))
37
36
38
- // Install libraries in bundled dir (should fail)
39
- {
40
- instCl , err := grpcInst .LibraryInstall (context .Background (), "Arduino_BuiltIn" , "" , false , false , true )
41
- require .NoError (t , err )
42
- for {
43
- msg , err := instCl .Recv ()
44
- if err == io .EOF {
45
- require .FailNow (t , "LibraryInstall is supposed to fail because builtin libraries directory is not set" )
46
- }
47
- if err != nil {
48
- fmt .Println ("LIB INSTALL ERROR:" , err )
49
- break
50
- }
51
- fmt .Printf ("LIB INSTALL> %+v\n " , msg )
52
- }
53
- }
54
-
55
- // Set builtin libraries dir
56
- builtinLibsDir := cli .DataDir ().Join ("libraries" )
57
- jsonBuiltinLibsDir , err := json .Marshal (builtinLibsDir )
58
- require .NoError (t , err )
59
- err = cli .SetValue ("directories.builtin.libraries" , string (jsonBuiltinLibsDir ))
60
- require .NoError (t , err )
61
-
62
- // Re-init
63
- require .NoError (t , grpcInst .Init ("" , "" , func (ir * commands.InitResponse ) {
64
- fmt .Printf ("INIT> %v\n " , ir .GetMessage ())
65
- }))
66
-
67
37
// Install libraries in bundled dir
68
38
{
69
39
instCl , err := grpcInst .LibraryInstall (context .Background (), "Arduino_BuiltIn" , "" , false , false , true )
@@ -123,4 +93,30 @@ func TestDaemonBundleLibInstall(t *testing.T) {
123
93
require .Equal (t , libsAndLocation ["SD" ], commands .LibraryLocation_LIBRARY_LOCATION_BUILTIN )
124
94
require .Equal (t , libsAndLocation ["Firmata" ], commands .LibraryLocation_LIBRARY_LOCATION_BUILTIN )
125
95
}
96
+
97
+ // Un-Set builtin libraries dir
98
+ err := cli .SetValue ("directories.builtin.libraries" , `""` )
99
+ require .NoError (t , err )
100
+
101
+ // Re-init
102
+ require .NoError (t , grpcInst .Init ("" , "" , func (ir * commands.InitResponse ) {
103
+ fmt .Printf ("INIT> %v\n " , ir .GetMessage ())
104
+ }))
105
+
106
+ // Install libraries in bundled dir (should now fail)
107
+ {
108
+ instCl , err := grpcInst .LibraryInstall (context .Background (), "Arduino_BuiltIn" , "" , false , false , true )
109
+ require .NoError (t , err )
110
+ for {
111
+ msg , err := instCl .Recv ()
112
+ if err == io .EOF {
113
+ require .FailNow (t , "LibraryInstall is supposed to fail because builtin libraries directory is not set" )
114
+ }
115
+ if err != nil {
116
+ fmt .Println ("LIB INSTALL ERROR:" , err )
117
+ break
118
+ }
119
+ fmt .Printf ("LIB INSTALL> %+v\n " , msg )
120
+ }
121
+ }
126
122
}
0 commit comments