# file : tests/dir-iterator/testscript # license : MIT; see accompanying LICENSE file test.options = -v : file : mkdir a; touch a/b; $* a >"reg b" : dir : mkdir -p a/b; $* a >"dir b" : symlink : : If we are not cross-testing let's test dangling and non-dangling symlynks. : On Windows that involves mklink command usability test. If we fail to create : a trial link (say because we are not in the Developer Mode and are running : non-elevated console), then the test group will be silently skipped. : if ($test.target == $build.host) { +if ($cxx.target.class != 'windows') lns = ln -s wd/t wd/l &wd/l else echo 'yes' >=t if cmd /C 'mklink l t' >- 2>- &?l && cat l >'yes' lns = cmd /C 'mklink wd\l t' &wd/l >- end jnc = cmd /C 'mklink /J wd\l wd\t' &wd/l >- end : symlink : if! $empty($lns) { : file : { +mkdir wd +touch --no-cleanup wd/t +touch wd/f +$lns +$* wd >>~%EOO% %(reg f|reg t|sym reg l)%{3} EOO +rm wd/t $* ../wd >- 2>! != 0 : keep $* -i ../wd >'reg f': skip } : dir : { +mkdir wd +mkdir --no-cleanup wd/t +mkdir wd/d +$lns # Note that this test may fail on Windows (see symlinks known issues in # libbutl/filesystem.mxx). # +if ($cxx.target.class != 'windows') $* wd >>~%EOO% %(dir d|dir t|sym dir l)%{3} EOO end +rmdir wd/t $* ../wd >- 2>! != 0 : keep $* -i ../wd >'dir d': skip } } : junction : if! $empty($jnc) { +mkdir wd +mkdir --no-cleanup wd/t +mkdir wd/d +$jnc +$* wd >>~%EOO% %(dir d|dir t|sym dir l)%{3} EOO +rmdir wd/t $* ../wd >- 2>! != 0 : keep $* -i ../wd >'dir d': skip } }