diff --git a/programs/cmd/tests/batch.c b/programs/cmd/tests/batch.c index 0c94d7e339a..162e9cfa151 100644 --- a/programs/cmd/tests/batch.c +++ b/programs/cmd/tests/batch.c @@ -165,6 +165,7 @@ static const char *compare_line(const char *out_line, const char *out_end, const static const char path_cmd[] = {'@','p','a','t','h','@'}; static const char shortpath_cmd[] = {'@','s','h','o','r','t','p','a','t','h','@'}; static const char space_cmd[] = {'@','s','p','a','c','e','@'}; + static const char spaces_cmd[] = {'@','s','p','a','c','e','s','@'}; static const char tab_cmd[] = {'@','t','a','b','@'}; static const char or_broken_cmd[] = {'@','o','r','_','b','r','o','k','e','n','@'}; @@ -223,6 +224,15 @@ static const char *compare_line(const char *out_line, const char *out_end, const } else { err = out_end; } + }else if(exp_ptr+sizeof(spaces_cmd) <= exp_end + && !memcmp(exp_ptr, spaces_cmd, sizeof(spaces_cmd))) { + exp_ptr += sizeof(spaces_cmd); + if(out_ptr < out_end && *out_ptr == ' ') { + while (out_ptr < out_end && *out_ptr == ' ') out_ptr++; + continue; + } else { + err = out_end; + } }else if(exp_ptr+sizeof(tab_cmd) <= exp_end && !memcmp(exp_ptr, tab_cmd, sizeof(tab_cmd))) { exp_ptr += sizeof(tab_cmd); @@ -250,10 +260,8 @@ static const char *compare_line(const char *out_line, const char *out_end, const while(exp_ptr+sizeof(or_broken_cmd) <= exp_end && memcmp(exp_ptr, or_broken_cmd, sizeof(or_broken_cmd))) exp_ptr++; - if(!exp_ptr) - return err; - exp_ptr += sizeof(or_broken_cmd); + if (exp_ptr > exp_end) return err; out_ptr = out_line; err = NULL; continue; diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index bb27c6d3907..01ddc4d5d51 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -1392,22 +1392,22 @@ bar\baz removed @drive@@path@foobar @pwd@ ------------ Testing attrib ------------ -A @drive@@path@foobar\foo@or_broken@A @drive@@path@foobar\foo@or_broken@A I @drive@@path@foobar\foo +A@spaces@@drive@@path@foobar\foo@or_broken@A I@spaces@@drive@@path@foobar\foo --- read-only attribute -A R @drive@@path@foobar\foo@or_broken@A R @drive@@path@foobar\foo@or_broken@A R I @drive@@path@foobar\foo +A R@spaces@@drive@@path@foobar\foo@or_broken@A R I@spaces@@drive@@path@foobar\foo foo foo original contents Read-only file not deleted Read-only file forcibly deleted --- recursive behaviour -A @drive@@path@foobar\baz\level2@or_broken@A @drive@@path@foobar\baz\level2@or_broken@A I @drive@@path@foobar\baz\level2 -A R @drive@@path@foobar\level1@or_broken@A R @drive@@path@foobar\level1@or_broken@A R I @drive@@path@foobar\level1 -A R @drive@@path@foobar\baz\level2@or_broken@A R @drive@@path@foobar\baz\level2@or_broken@A R I @drive@@path@foobar\baz\level2 -A @drive@@path@foobar\bar@or_broken@A @drive@@path@foobar\bar@or_broken@A I @drive@@path@foobar\bar +A@spaces@@drive@@path@foobar\baz\level2@or_broken@A I@spaces@@drive@@path@foobar\baz\level2 +A R@spaces@@drive@@path@foobar\level1@or_broken@A R I@spaces@@drive@@path@foobar\level1 +A R@spaces@@drive@@path@foobar\baz\level2@or_broken@A R I@spaces@@drive@@path@foobar\baz\level2 +A@spaces@@drive@@path@foobar\bar@or_broken@A I@spaces@@drive@@path@foobar\bar --- folders processing - @drive@@path@foobar@or_broken@ @drive@@path@foobar@or_broken@ I @drive@@path@foobar -@todo_wine@ R @drive@@path@foobar\baz@or_broken@ R @drive@@path@foobar\baz@or_broken@ @drive@@path@foobar\baz@or_broken@ R I @drive@@path@foobar\baz -A @drive@@path@foobar\baz\toto@or_broken@A @drive@@path@foobar\baz\toto@or_broken@A I @drive@@path@foobar\baz\toto +@spaces@@drive@@path@foobar@or_broken@ I@spaces@@drive@@path@foobar +@todo_wine@ R@spaces@@drive@@path@foobar\baz@or_broken@@spaces@@drive@@path@foobar\baz@or_broken@ R I@spaces@@drive@@path@foobar\baz +A@spaces@@drive@@path@foobar\baz\toto@or_broken@A I@spaces@@drive@@path@foobar\baz\toto toto lulu file created in read-only dir