From fc8c0e410697928d644f06dea772b51c3abc0e3f Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 14 Jun 2017 17:56:49 +0300 Subject: Add support for ln testscript builtin --- tests/test/script/builtin/buildfile | 2 +- tests/test/script/builtin/ln.test | 184 ++++++++++++++++++++++++++++++++++++ 2 files changed, 185 insertions(+), 1 deletion(-) create mode 100644 tests/test/script/builtin/ln.test (limited to 'tests/test/script/builtin') diff --git a/tests/test/script/builtin/buildfile b/tests/test/script/builtin/buildfile index f72688d..43649db 100644 --- a/tests/test/script/builtin/buildfile +++ b/tests/test/script/builtin/buildfile @@ -2,4 +2,4 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -./: test{cat cp echo mkdir rm rmdir sed test touch} $b +./: test{*} $b diff --git a/tests/test/script/builtin/ln.test b/tests/test/script/builtin/ln.test new file mode 100644 index 0000000..99e2bcb --- /dev/null +++ b/tests/test/script/builtin/ln.test @@ -0,0 +1,184 @@ +# file : tests/test/script/builtin/ln.test +# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +.include ../common.test + +: args +: +{ + : -s-option + : + $c <'ln 2>"ln: missing -s 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 + : + $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 + 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 + EOI + } +} + +: dir +: +: Test creating a directory symlink. +: +{ + : non-existing-link-path + : + $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 + 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 + EOI + } +} + +: multiple-targets +: +: Test creating links for multiple targets in the specified directory. +: +{ + $c <