@@ -21,6 +21,58 @@ load 'util/init.sh'
21
21
assert_output " it works :)"
22
22
}
23
23
24
- @test " properly restores options" {
25
- :
24
+ @test " works with file argument" {
25
+ local site=' github.com'
26
+ local pkg=" user/project2"
27
+
28
+ BPM_REPO_SOURCE=" $BPM_TEST_REPO_ROOT /../source"
29
+ BPM_CELLAR=" $BPM_TEST_DIR /cellar"
30
+
31
+ test_util.setup_pkg " $pkg " ; {
32
+ echo " printf '%s\n' 'it works :)'" > ' file.bash'
33
+ }; test_util.finish_pkg
34
+ test_util.mock_add " $pkg "
35
+
36
+ source bpm-load
37
+ run bpm-load --global " $pkg " ' file.bash'
38
+
39
+ assert_success
40
+ assert_output " it works :)"
41
+ }
42
+
43
+ @test " errors if used incorrectly (soucing with arguments passed)" {
44
+ local site=' github.com'
45
+ local pkg=" user/project2"
46
+
47
+ BPM_REPO_SOURCE=" $BPM_TEST_REPO_ROOT /../source"
48
+ BPM_CELLAR=" $BPM_TEST_DIR /cellar"
49
+
50
+ test_util.setup_pkg " $pkg " ; {
51
+ echo " printf '%s\n' 'it works :)'" > ' load.bash'
52
+ }; test_util.finish_pkg
53
+ test_util.mock_add " $pkg "
54
+
55
+ run source bpm-load --global " $pkg "
56
+
57
+ assert_failure
58
+ assert_line -p " Incorrect usage. See documentation"
59
+ }
60
+
61
+ @test " errors if used incorrectly (running function with no arguments passed)" {
62
+ local site=' github.com'
63
+ local pkg=" user/project2"
64
+
65
+ BPM_REPO_SOURCE=" $BPM_TEST_REPO_ROOT /../source"
66
+ BPM_CELLAR=" $BPM_TEST_DIR /cellar"
67
+
68
+ test_util.setup_pkg " $pkg " ; {
69
+ echo " printf '%s\n' 'it works :)'" > ' load.bash'
70
+ }; test_util.finish_pkg
71
+ test_util.mock_add " $pkg "
72
+
73
+ source bpm-load
74
+ run bpm-load
75
+
76
+ assert_failure
77
+ assert_line -p " Error: Must pass in package name as first parameter"
26
78
}
0 commit comments