# file : tests/function/path/testscript # copyright : Copyright (c) 2014-2016 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file .include ../../common.test if ($cxx.target.class != windows) # @@ TMP ternarry s = '/' else s = '\' end : canonicalize : { $* <'print $canonicalize([path] a/b)' >"a$(s)b" : path $* <'print $canonicalize([paths] a/b a/c)' >"a$(s)b a$(s)c" : paths $* <'print $canonicalize([dir_path] a/b)' >"a$(s)b$s" : dir-path $* <'print $canonicalize([dir_paths] a/b a/c/)' >"a$(s)b$s a$(s)c$s" : dir-paths $* <'print $path.canonicalize(a/b)' >"a$(s)b" : untyped $* <'print $path.canonicalize(a/b/ a/c)' >"a$(s)b$s a$(s)c" : mixed } : normalize : { $* <'print $normalize([path] a/../b)' >"b" : path $* <'print $normalize([paths] a/../b a/../c)' >"b c" : paths $* <'print $normalize([dir_path] a/../b)' >"b$s" : dir-path $* <'print $normalize([dir_paths] a/../b a/../c/)' >"b$s c$s" : dir-paths $* <'print $path.normalize(a/../b)' >"b" : untyped $* <'print $path.normalize(a/../b/ a/../c)' >"b$s c" : mixed } : invalid-path : if ($cxx.target.class != windows) # @@ TMP ternarry p = /../foo else p = c:/../foo end; $* <"\$path.normalize\('$p')" 2>>"EOE" != 0 error: invalid path: '$p' EOE