diff options
| author | Egor Tensin <egor@tensin.name> | 2026-09-27 15:32:05 +0500 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-09-27 15:33:42 +0500 |
| commit | 8cdbc58be21ed83644dab6a5391014ab4e35c9ab (patch) | |
| tree | 78ecb2897146b593601da52b1438d89434b560a8 /test/local | |
| parent | test/local: allow filtering tests (diff) | |
| download | config-links-8cdbc58be21ed83644dab6a5391014ab4e35c9ab.tar.gz config-links-8cdbc58be21ed83644dab6a5391014ab4e35c9ab.zip | |
test: move the linux-home test to test/local/
Diffstat (limited to 'test/local')
| -rw-r--r-- | test/local/tst-linux-home.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/local/tst-linux-home.sh b/test/local/tst-linux-home.sh new file mode 100644 index 0000000..4d099ee --- /dev/null +++ b/test/local/tst-linux-home.sh @@ -0,0 +1,42 @@ +[ -z "${CI+y}" ] && test_should_fail=y + +test_run() { + if [ -z "${CI+y}" ]; then + fail "Don't run this test locally, it'll mess up your \$HOME" + return 1 + fi + + readonly src_name=linux-home + src_url="https://github.com/egor-tensin/$src_name.git" + readonly src_url + + test_root_dir="$( mktemp -d )" + # mktemp returns /var/..., which is actually in /private/var/... on macOS. + test_root_dir="$( readlink -e -- "$test_root_dir" )" + + test_src_dir="$test_root_dir/$src_name" + + log "Cloning $src_url to $test_src_dir..." + git clone -q -- "$src_url" "$test_src_dir" + + test_run_update + # Again: + test_run_update + + log "Checking a couple of well-known files..." + local file + for file in .gitconfig .ssh/config; do + local actual + actual="$( readlink -e -- "$HOME/$file" )" + + local expected + expected="$test_src_dir/%HOME%/$file" + + if [ "$actual" != "$expected" ]; then + fail "There was a problem with symlink $file:" + fail_details "Expected target: $expected" + fail_details "Actual target: $actual" + return 1 + fi + done +} |
