-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbash-test.sh
More file actions
executable file
·36 lines (30 loc) · 986 Bytes
/
Copy pathbash-test.sh
File metadata and controls
executable file
·36 lines (30 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
set -euo pipefail
source test/support/assertions.sh
__clean_shell() {
env -i \
TERM="$TERM" \
HOME="$HOME" \
SSH_AUTH_SOCK="${SSH_AUTH_SOCK-}" \
"$SHELL" \
"$@"
}
test_interactive_login_shell() {
local stdout
stdout=$(__clean_shell --login -i -c true 2>&1)
local status=$?
[[ $status = 0 ]] || fail_test "error in bash init for interactive login shell"
assert_equal '' "$stdout"
}
test_interactive_nonlogin_shell() {
local stdout
# For now, don't redirect stderr to stdout. Having bash-completion@2
# installed causes lines similar to the following printed to stderr:
#
# bash: warning: setlocale: LC_CTYPE: cannot change locale (): Bad file descriptor
stdout=$(__clean_shell -i -c true)
local status=$?
[[ $status = 0 ]] || fail_test "error in bash init for interactive non-login shell"
assert_equal '' "$stdout"
}
TEST_SOURCE=$0 source test/support/suite.sh