mirror of
https://github.com/jimeh/dotify.git
synced 2026-02-19 10:06:39 +00:00
30 lines
719 B
Bash
Executable File
30 lines
719 B
Bash
Executable File
#! /usr/bin/env bash
|
|
source "../test-helper.sh"
|
|
source "../../src/lib/dotify-action.sh"
|
|
|
|
#
|
|
# dotify-action() tests
|
|
#
|
|
|
|
# Set required option ENV
|
|
DOTIFY_OPT_DEFAULT_ACTION="link"
|
|
|
|
# Simple mock for link action.
|
|
dotify-action-link() {
|
|
echo "link stub: $@"
|
|
}
|
|
|
|
|
|
# Given a specific action.
|
|
assert "dotify-action link ackrc .ackrc" "link stub: ackrc .ackrc"
|
|
|
|
# Given "default" action, it uses configured default action.
|
|
assert "dotify-action default ackrc .ackrc" "link stub: ackrc .ackrc"
|
|
|
|
# Given a invalid action.
|
|
assert_raises "dotify-action foo ackrc .ackrc" 1
|
|
assert "dotify-action foo ackrc .ackrc" ""
|
|
assert "dotify-action foo ackrc .ackrc 2>&1" "ERROR: \"foo\" is not a valid action."
|
|
|
|
assert_end "dotify-action()"
|