Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add command to create a symbolic link
- Loading branch information
Showing
4 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
bold=$'\e'[1m | ||
yellow=$'\e'[33m | ||
magenta=$'\e'[35m | ||
reset=$'\e'[0m | ||
|
||
@test symlink { | ||
[ ! -f /tmp/symlink.kitfile ] | ||
[ ! -f /tmp/exists ] | ||
|
||
run ./kitout.sh tests/symlink.kitfile | ||
echo "$output" | ||
|
||
[ $status -eq 1 ] | ||
|
||
[ -f /tmp/symlink.kitfile ] | ||
[ -L /tmp/symlink-to-symlink.kitfile ] | ||
[ "${lines[2]}" == "${yellow}=== symbolic linking '/tmp/symlink-to-symlink.kitfile' to '/tmp/symlink.kitfile'${reset}" ] | ||
|
||
[ -e /tmp/exists -a ! -L /tmp/exists ] | ||
[ "${lines[3]}" == "${yellow}=== symbolic linking '/tmp/exists' to '/tmp/symlink.kitfile'${reset}" ] | ||
[ "${lines[4]}" == "${bold}${magenta}*** cannot create symlink: '/tmp/exists' already exists${reset}" ] | ||
} | ||
|
||
function setup_file { | ||
teardown | ||
} | ||
|
||
function teardown { | ||
rm -f /tmp/symlink.kitfile /tmp/exists | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# make sure file exists | ||
install tests/symlink.kitfile /tmp/symlink.kitfile | ||
install tests/symlink.kitfile /tmp/exists | ||
|
||
# link to it | ||
symlink /tmp/symlink.kitfile /tmp/symlink-to-symlink.kitfile | ||
|
||
# should not work, cannot replace files | ||
symlink /tmp/symlink.kitfile /tmp/exists |