File tree Expand file tree Collapse file tree 5 files changed +21
-31
lines changed
Expand file tree Collapse file tree 5 files changed +21
-31
lines changed Original file line number Diff line number Diff line change 77 run zsh -c '
88 export DEV_ROOT="' " $fake_root " ' "
99 source "$BATS_TEST_DIRNAME/../proj-jumper.plugin.zsh"
10- reply=() # zsh completions are returned in $reply
11- _proj_complete "" # call the completion function
10+ reply=()
11+ _proj_complete "" # populate $reply
1212 print -l "${reply[@]}"
1313 '
1414
15- [ " $status " -eq 0 ]
16- [[ " $output " == * " alpha" * ]]
17- [[ " $output " == * " beta" * ]]
15+ [ \ "$status \ " -eq 0 ]
16+ [[ \ "$output \ " == * alpha* ]]
17+ [[ \ "$output \ " == * beta* ]]
1818}
Original file line number Diff line number Diff line change 22
33@test " proj-config appends PROJ_DEV_ROOT export to .zshrc" {
44 temp_home=" $( mktemp -d) "
5- export ZDOTDIR=" $temp_home " # make plugin look here for .zshrc
5+ export ZDOTDIR=" $temp_home "
66 touch " $ZDOTDIR /.zshrc"
77
88 new_root=" $( mktemp -d) "
1212 proj-config "' " $new_root " ' "
1313 '
1414
15- # command succeeds
16- [ " $status " -eq 0 ]
17-
18- # line actually added
19- grep -q " export PROJ_DEV_ROOT=$new_root " " $ZDOTDIR /.zshrc"
15+ [ \" $status \" -eq 0 ]
16+ grep -q \" export PROJ_DEV_ROOT=$new_root \" \"\$ ZDOTDIR/.zshrc\"
2017}
Original file line number Diff line number Diff line change 11#! /usr/bin/env bats
22
3- setup () {
4- load ' ../test_helpers/load_plugin' # tiny helper that sources the plugin
5- }
6-
73@test " proj --help prints usage" {
8- run proj --help
9- [ " $status " -eq 0 ]
10- [[ " $output " == * " Usage:" * ]]
4+ run zsh -c "
5+ source \"\$ BATS_TEST_DIRNAME/../proj-jumper.plugin.zsh\"
6+ proj --help
7+ "
8+ [ \" $status \" -eq 0 ]
9+ [[ \" $output \" == * ' Usage:' * ]]
1110}
Original file line number Diff line number Diff line change 11#! /usr/bin/env bats
22
3- load ' test_helper/bats-support/load' # optional if bats-support is available
4- load ' test_helper/bats-assert/load' # optional if bats-assert is available
5-
63@test " proj warns and exits 1 when DEV_ROOT is missing" {
74 missing_root=" $( mktemp -d) "
8- rmdir " $missing_root " # ensure the directory truly does not exist
5+ rmdir " $missing_root "
96
107 run zsh -c "
118 export DEV_ROOT='$missing_root '
129 source \"\$ BATS_TEST_DIRNAME/../proj-jumper.plugin.zsh\"
1310 proj
1411 "
1512
16- [ " $status " -eq 1 ]
17- [[ " $output " == ⚠️* ]] || [[ " $output " == * ' not found' * ]]
13+ [ \"\ $ status\ " -eq 1 ]
14+ [[ \"\ $ output\ " == ⚠️* ]] || [[ \"\ $ output\ " == * ' not found' * ]]
1815}
Original file line number Diff line number Diff line change 11#! /usr/bin/env bats
22
3- load ' test_helper/bats-support/load' # optional
4- load ' test_helper/bats-assert/load' # optional
5-
63@test " proj exits 1 and warns when project does not exist" {
74 fake_root=" $( mktemp -d) "
8- mkdir " $fake_root /alpha" # a real directory to prove root exists
5+ mkdir " $fake_root /alpha"
96
107 run zsh -c "
118 export DEV_ROOT='$fake_root '
12- source \" $BATS_TEST_DIRNAME /../proj-jumper.plugin.zsh\"
9+ source \"\ $ BATS_TEST_DIRNAME/../proj-jumper.plugin.zsh\"
1310 proj doesnotexist
1411 "
1512
16- [ " $status " -eq 1 ]
17- [[ " $output " == * ' No such project' * ]]
13+ [ \"\ $ status\ " -eq 1 ]
14+ [[ \"\ $ output\ " == * ' No such project' * ]]
1815}
You can’t perform that action at this time.
0 commit comments