From dbed808c7d534069f76e63a1a68a85f30d2be81c Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 10 Sep 2019 23:23:43 +0300 Subject: Move testscript builtins to libbutl --- tests/test/script/builtin/ln.testscript | 180 ++++++-------------------------- 1 file changed, 31 insertions(+), 149 deletions(-) (limited to 'tests/test/script/builtin/ln.testscript') diff --git a/tests/test/script/builtin/ln.testscript b/tests/test/script/builtin/ln.testscript index 072c197..456126a 100644 --- a/tests/test/script/builtin/ln.testscript +++ b/tests/test/script/builtin/ln.testscript @@ -4,119 +4,25 @@ .include ../common.testscript -: unknown-option -: -$c <"ln: unknown option '-u'" == 1 -EOI - -: args -: -{ - : -s-option - : - $c <'ln 2>"ln: missing -s|--symbolic option" == 1' && $b - - : none - : - $c <'ln -s 2>"ln: missing arguments" == 1' && $b - - : no-target - : - $c <'ln -s a 2>"ln: missing target path" == 1' && $b - - : no-trailing-sep - : - $c <"ln: multiple target paths with non-directory link path" == 1 - EOI - - : empty - : - { - : link - : - $c <"ln: invalid path ''" == 1 - EOI - - : target1 - : - $c <"ln: invalid path ''" == 1 - EOI - - : target2 - : - $c <"ln: invalid path ''" == 1 - EOI - } -} - : file : : Test creating a file symlink. : { - : non-existing-link-path + : cleanup : $c <>/~%EOE% != 0 - %( - %ln: unable to create .+link '.+/b' to '.+/a': .+%| - %ln: unable to copy file '.+/a' to '.+/b': .+% - %) - EOE - EOI - - : dir - : - $c <>/~%EOE% != 0 - %( - %ln: unable to create .+link '.+/b' to '.+/a': .+%| - %ln: unable to copy file '.+/a' to '.+/b': .+% - %) - EOE - EOI - } - - : non-existing - { - : target - : - $c <>/~%EOE% != 0 - %ln: unable to create symlink to '.+/a': no such file or directory% - EOE + ln -s a b EOI - : link-dir - : - $c <>/~%EOE% != 0 - %( - %ln: unable to create .+link '.+/b/c' to '.+/a': .+%| - %ln: unable to copy file '.+/a' to '.+/b/c': .+% - %) - EOE + ln -s --no-cleanup a b; + rm b EOI - } } : dir @@ -124,57 +30,22 @@ EOI : Test creating a directory symlink. : { - : non-existing-link-path + : cleanup : $c <>/~%EOE% != 0 - %( - %ln: unable to create .+link '.+/b' to '.+/a': .+%| - %ln: unable to copy directory '.+/a' to '.+/b': .+% - %) - EOE - EOI - - : file - : - $c <>/~%EOE% != 0 - %( - %ln: unable to create .+link '.+/b' to '.+/a': .+%| - %ln: unable to copy directory '.+/a' to '.+/b': .+% - %) - EOE + touch a/b; + ln -s a c EOI - } - : non-existing - { - : link-dir - : - $c <>/~%EOE% != 0 - %( - %ln: unable to create .+link '.+/b/c' to '.+/a': .+%| - %ln: unable to copy directory '.+/a' to '.+/b/c': .+% - %) - EOE + touch a/b; + ln -s --no-cleanup a c; + rm -r c EOI - } } : multiple-targets @@ -182,9 +53,20 @@ EOI : Test creating links for multiple targets in the specified directory. : { + : cleanup + : $c <