Skip to content

Commit ccf9c81

Browse files
committed
test: Fix all skipped tests
1 parent e19f3b8 commit ccf9c81

File tree

5 files changed

+50
-51
lines changed

5 files changed

+50
-51
lines changed

pkg/lib/commands/do-plumbing-remove-deps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ do-plumbing-remove-deps() {
2020
fi
2121
fi
2222

23-
if (( #${deps[@]} > 0 )); then
23+
if (( ${#deps[@]} > 0 )); then
2424
log.info "Removing dependencies for '$package'"
2525
fi
2626

pkg/lib/commands/do-upgrade.sh

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,16 @@ do-upgrade() {
3636
fi
3737

3838
for repoSpec; do
39-
# If is local directory
40-
if [ -d "$repoSpec" ]; then
41-
local dir=
42-
dir="$(util.readlink "$repoSpec")"
43-
dir="${dir%/}"
44-
45-
util.extract_data_from_package_dir "$dir"
46-
local site="$REPLY1"
47-
local package="$REPLY2/$REPLY3"
39+
if [[ -d "$repoSpec" && "${repoSpec::1}" == / ]]; then
40+
die "Identifier '$repoSpec' is a directory, not a package"
41+
fi
4842

49-
do_actual_upgrade "$site/$package"
50-
else
51-
util.extract_data_from_input "$repoSpec"
52-
local site="$REPLY2"
53-
local package="$REPLY3"
54-
local ref="$REPLY4"
43+
util.extract_data_from_input "$repoSpec"
44+
local site="$REPLY2"
45+
local package="$REPLY3"
46+
local ref="$REPLY4"
5547

56-
do_actual_upgrade "$site/$package"
57-
fi
48+
do_actual_upgrade "$site/$package"
5849
done
5950
}
6051

tests/do-list.bats

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,28 @@ $site/username2/p2
8888
Branch: master"
8989
}
9090

91+
@test "properly list out of date package" {
92+
local site='github.com'
93+
local pkg='somedir/package'
94+
95+
test_util.create_package "$pkg"
96+
test_util.mock_clone "$pkg" "$site/$pkg"
97+
98+
cd "$BPM_ORIGIN_DIR/$pkg"
99+
touch 'script2.sh'
100+
git add .
101+
git commit -m 'Add script'
102+
cd "$BPM_CWD"
103+
104+
do-list --fetch
105+
run do-list
106+
107+
assert_success
108+
assert_output "github.com/$pkg
109+
Branch: master
110+
State: Out of date"
111+
}
112+
91113
@test "error if tries to list a non-git repository with details" {
92114
local site="github.com"
93115
local pkg='username/outdated'

tests/do-plumbing-link-completions.bats

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,6 @@ load 'util/init.sh'
390390
assert [ ! -f "$BPM_INSTALL_COMPLETIONS/zsh/compsys/prog.zsh" ]
391391
}
392392

393-
@test "zsh completions without file extension have an extension appended" {
394-
skip
395-
}
396-
397-
398393
## FISH ##
399394

400395
@test "adds fish completions determined from bpm.toml" {

tests/do-upgrade.bats

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
load 'util/init.sh'
44

55
@test "simple upgrade" {
6-
skip
7-
86
local site='github.com'
9-
local pkg='username/package'
7+
local pkg='somedir/package'
108

11-
test_util.create_package 'remote'
12-
test_util.mock_clone add 'remote'
9+
test_util.create_package "$pkg"
10+
test_util.mock_clone "$pkg" "$site/$pkg"
1311

14-
cd "$BPM_ORIGIN_DIR/$site/username/local"
12+
cd "$BPM_ORIGIN_DIR/$pkg"
1513
touch 'script2.sh'
1614
git add .
1715
git commit -m 'Add script'
@@ -22,13 +20,13 @@ load 'util/init.sh'
2220
run do-list
2321

2422
assert_success
25-
assert_output ""
23+
assert_output "github.com/$pkg
24+
Branch: master
25+
State: Up to date"
2626
assert [ -f "$BPM_PACKAGES_PATH/$site/$pkg/script2.sh" ]
2727
}
2828

29-
@test "simple upgrade (specifying with directory)" {
30-
skip
31-
29+
@test "simple upgrade fails when specifying full directory" {
3230
local site='github.com'
3331
local pkg='username/package'
3432

@@ -37,24 +35,20 @@ load 'util/init.sh'
3735
}; test_util.finish_pkg
3836
test_util.mock_add "$pkg"
3937

40-
cd "$BPM_ORIGIN_DIR/$site/$pkg"
38+
cd "$BPM_ORIGIN_DIR/$pkg"
4139
touch 'script2.sh'
4240
git add .
4341
git commit -m 'Add script'
4442
cd "$BPM_CWD"
4543

46-
do-upgrade "$BPM_ORIGIN_DIR/$site/$pkg"
44+
run do-upgrade "$BPM_ORIGIN_DIR/$pkg"
4745

48-
run do-list
49-
assert_output ""
50-
51-
assert [ -f "$BPM_PACKAGES_PATH/$site/$pkg/script2.sh" ]
46+
assert_failure
47+
assert_line -p "Identifier '$BPM_ORIGIN_DIR/$pkg' is a directory, not a package"
5248
}
5349

5450

5551
@test "symlinks stay valid after upgrade" {
56-
skip
57-
5852
local site='github.com'
5953
local pkg='username/package'
6054

@@ -64,7 +58,7 @@ load 'util/init.sh'
6458
}; test_util.finish_pkg
6559
test_util.mock_add "$pkg"
6660

67-
cd "$BPM_ORIGIN_DIR/$site/$pkg"
61+
cd "$BPM_ORIGIN_DIR/$pkg"
6862
touch 'script2.sh'
6963
git add .
7064
git commit -m 'Add script'
@@ -76,8 +70,6 @@ load 'util/init.sh'
7670
}
7771

7872
@test "BPM_INSTALL_DIR reflected when package modifies binDirs key" {
79-
skip
80-
8173
local site='github.com'
8274
local pkg='username/package'
8375

@@ -90,7 +82,7 @@ load 'util/init.sh'
9082

9183
[ -f "$BPM_INSTALL_BIN/script3.sh" ]
9284

93-
cd "$BPM_ORIGIN_DIR/$site/$pkg"
85+
cd "$BPM_ORIGIN_DIR/$pkg"
9486
rm 'bpm.toml'
9587
git add .
9688
git commit -m 'Remove bpm.toml'
@@ -101,20 +93,19 @@ load 'util/init.sh'
10193
assert [ ! -f "$BPM_INSTALL_BIN/script3.sh" ]
10294
}
10395

104-
@test "prints warning if user tries to upgrade a 'link'ed package" {
105-
skip
96+
@test "fails if user tries to upgrade a 'link'ed package" {
97+
local pkg='subdir/theta'
10698

10799
test_util.stub_command do-plumbing-add-deps
108100
test_util.stub_command do-plumbing-link-bins
109101
test_util.stub_command do-plumbing-link-completions
110102
test_util.stub_command do-plumbing-link-man
111103

112-
mkdir 'theta'
113-
114-
do-link 'theta'
104+
test_util.create_package "$pkg"
105+
test_util.mock_link "$BPM_ORIGIN_DIR/$pkg"
115106
run 'do-upgrade' 'local/theta'
116107

117-
assert_success
108+
assert_failure
118109
assert_line -p "Package at '$BPM_PACKAGES_PATH/local/theta' is not a Git repository"
119110
}
120111

0 commit comments

Comments
 (0)