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/mv.testscript | 231 +++++++++----------------------- 1 file changed, 66 insertions(+), 165 deletions(-) (limited to 'tests/test/script/builtin/mv.testscript') diff --git a/tests/test/script/builtin/mv.testscript b/tests/test/script/builtin/mv.testscript index eb4860e..d703faf 100644 --- a/tests/test/script/builtin/mv.testscript +++ b/tests/test/script/builtin/mv.testscript @@ -4,52 +4,6 @@ .include ../common.testscript -: unknown-option -: -$c <"mv: unknown option '-u'" == 1 -EOI - -: args -: -{ - : none - : - $c <'mv 2>"mv: missing arguments" == 1' && $b - - : no-source - : - $c <'mv a 2>"mv: missing source path" == 1' && $b - - : no-trailing-sep - : - $c <"mv: multiple source paths without trailing separator for destination directory" == 1 - EOI - - : empty - : - { - : dest - : - $c <"mv: invalid path ''" == 1 - EOI - - : src1 - : - $c <"mv: invalid path ''" == 1 - EOI - - : src2 - : - $c <"mv: invalid path ''" == 1 - EOI - } -} - : synopsis-1 : : Move an entity to the specified path. @@ -58,43 +12,6 @@ EOI : file : { - : existing - : - { - : to-non-existing - : - $c <>/~%EOE% != 0 - %mv: unable to move entity '.+/a' to itself% - EOE - EOI - - : to-dir - : - $c <>/~%EOE% != 0 - %mv: unable to move entity '.+/a' to '.+/b': .+% - EOE - EOI - } - : outside-scope : : Need to use a path that unlikely exists (not to remove something useful). @@ -105,10 +22,10 @@ EOI : Moving path outside the testscript working directory fails. : $c <>/~%EOE% == 1 - %mv: '.+/fail/a/b/c' is out of working directory '.+/fail/test'% - EOE - EOI + mv ../../a/b/c ./c 2>>/~%EOE% == 1 + %mv: '.+/fail/a/b/c' is out of working directory '.+/fail/test'% + EOE + EOI : force : @@ -117,15 +34,30 @@ EOI : exist. : $c <>/~%EOE% == 1 - %mv: unable to move entity '.+/force/a/b/c' to '.+/c': .+% - EOE - EOI + mv -f ../../a/b/c ./c 2>>/~%EOE% == 1 + %mv: unable to move entity '.+/force/a/b/c' to '.+/c': .+% + EOE + EOI } : cleanup : { + : enabled + : + $c <>/~%EOE% != 0 - %mv: unable to move entity '.+/a' to '.+/b': .+% - EOE - EOI + mv $~ b 2>"mv: '$~' contains test working directory '$~'" != 0 + EOI - : to-non-dir + : dst : $c <>/~%EOE% != 0 - %mv: unable to move entity '.+/a' to '.+/b': .+% - EOE - EOI + mkdir a; + mv a "$~" 2>"mv: '$~' contains test working directory '$~'" != 0 + EOI } - : working-dir + : cleanup : { - : src + : enabled : - { - $c <"mv: '([string] $~)' contains test working directory '$~'" != 0 + $c <"mv: '$~' contains test working directory '$~'" != 0 + mv --no-cleanup a b &!a/; + rm -r b EOI - } - } - - : overlap - : - $c <>/~%EOE% != 0 - %mv: unable to move entity '.+/a' to '.+/a/b': .+% - EOE - EOI - : cleanup - : - { : sub-entry : - { + $c <>/~%EOE% != 0 - %mv: unable to move entity '.+/a' to '.+/b': .+% - EOE - EOI - } } : synopsis-2 @@ -249,10 +140,20 @@ EOI : Move entities into the specified directory. : { + : cleanup + : $c <