cmd/tests: Add tests for NUL handling

Frédéric Delanoy frederic.delanoy at gmail.com
Tue Jul 19 02:49:24 CDT 2011


---
 programs/cmd/tests/test_builtins.cmd     |   31 ++++++++++++++++++++++++++++++
 programs/cmd/tests/test_builtins.cmd.exp |    6 +++++
 2 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd
index 764697b..195afca 100644
--- a/programs/cmd/tests/test_builtins.cmd
+++ b/programs/cmd/tests/test_builtins.cmd
@@ -104,6 +104,37 @@ type foobaz
 echo ***
 del foobaz
 
+echo ------------ Testing NUL ------------
+md foobar && cd foobar
+rem NUL file (non) creation + case insensitivity
+rem Note: "if exist" does not work with NUL, so to check for file existence we use a kludgy workaround
+echo > bar
+echo foo > NUL
+dir /b /a-d
+echo foo > nul
+dir /b /a-d
+echo foo > NuL
+dir /b /a-d
+del bar
+rem NUL not special everywhere
+call :setError 123
+echo NUL> foo
+if not exist foo (echo foo should have been created) else (
+    type foo
+    del foo
+)
+rem Empty file creation
+copy nul foo > nul
+if exist foo (
+    echo foo created
+    del foo
+    type foo
+) else (
+    echo ***
+)
+cd ..
+rd foobar
+
 echo ------------ Testing if/else --------------
 echo if/else should work with blocks
 if 0 == 0 (
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index 07a503ec..67f25a4 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -99,6 +99,12 @@ bar
 ***
 bar
 ***
+------------ Testing NUL ------------
+bar
+bar
+bar
+NUL
+ at todo_wine@foo created
 ------------ Testing if/else --------------
 if/else should work with blocks
 if seems to work
-- 
1.7.6




More information about the wine-patches mailing list