From 74566422c732d4f0631658629a0048482586400d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delanoy?= Date: Mon, 29 Aug 2011 21:45:19 +0200 Subject: [PATCH] cmd/tests: Add ftype tests. --- programs/cmd/tests/test_builtins.cmd | 42 ++++++++++++++++++++++++ programs/cmd/tests/test_builtins.cmd.exp | 10 ++++++ 2 files changed, 52 insertions(+) diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index 9dd2b6053dc..b975d385dbc 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -1113,6 +1113,48 @@ type baz echo *** cd .. & rd /s/q foobar +echo ------------ Testing ftype -------------- +rem FIXME Can't test error messages in the current test system, so we have to use some kludges +rem FIXME Revise once || conditional execution is fixed +mkdir foobar & cd foobar +echo ...setting association +ftype footype> baz +type baz +echo *** + +ftype footype=foo_opencmd +assoc .foo=footype +ftype footype + +rem association set system-wide +echo @echo off> tmp.cmd +echo echo +++>> tmp.cmd +echo ftype footype>> tmp.cmd +cmd /c tmp.cmd + +echo ...resetting association +assoc .foo= + +rem Removing a file type association doesn't work on XP due to a bug, so a workaround is needed +setlocal EnableDelayedExpansion +set FOO=original value +ftype footype= +ftype footype > baz +for /F %%i in ('type baz') do (set FOO=buggyXP) +rem Resetting actually works on wine/NT4, but is reported as failing due to the peculiar test (and non-support for EnabledDelayedExpansion) +rem FIXME Revisit once a grep-like program like ftype is implemented +rem (e.g. to check baz's size using dir /b instead) +echo !FOO! + +rem cleanup registry +echo REGEDIT4> regCleanup.reg +echo.>> regCleanup.reg +echo [-HKEY_CLASSES_ROOT\footype]>> regCleanup.reg +regedit /s regCleanup.reg +set FOO= +endlocal +cd .. & rd /s/q foobar + echo ------------ Testing CALL -------------- mkdir foobar & cd foobar rem External script diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index 296f9b80972..54194760ccb 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -665,6 +665,16 @@ file created in read-only dir *** +++ *** +------------ Testing ftype -------------- +...setting association +*** +footype=foo_opencmd +.foo=footype +footype=foo_opencmd ++++ +footype=foo_opencmd +...resetting association +@todo_wine@original value@or_broken@buggyXP@or_broken@!FOO! ------------ Testing CALL -------------- foo@space@ foo 8