comparison scripts/testfun/runtests.m @ 21634:96518f623c91

Backed out changeset dcf8922b724b
author Mike Miller <mtmiller@octave.org>
date Wed, 20 Apr 2016 11:06:03 -0700
parents dcf8922b724b
children ffad2baa90f7
comparison
equal deleted inserted replaced
21633:dcf8922b724b 21634:96518f623c91
63 63
64 function run_all_tests (directory, do_class_dirs) 64 function run_all_tests (directory, do_class_dirs)
65 flist = readdir (directory); 65 flist = readdir (directory);
66 dirs = {}; 66 dirs = {};
67 no_tests = {}; 67 no_tests = {};
68 fprintf ("Processing files in %s:\n\n", directory); 68 printf ("Processing files in %s:\n\n", directory);
69 fflush (stdout); 69 fflush (stdout);
70 for i = 1:numel (flist) 70 for i = 1:numel (flist)
71 f = flist{i}; 71 f = flist{i};
72 if ((length (f) > 2 && strcmpi (f((end-1):end), ".m")) 72 if ((length (f) > 2 && strcmpi (f((end-1):end), ".m"))
73 || (length (f) > 3 && strcmpi (f((end-2):end), ".cc"))) 73 || (length (f) > 3 && strcmpi (f((end-2):end), ".cc")))
86 dirs(end+1) = f; 86 dirs(end+1) = f;
87 endif 87 endif
88 endif 88 endif
89 endfor 89 endfor
90 if (! isempty (no_tests)) 90 if (! isempty (no_tests))
91 fprintf ("\nThe following files in %s have no tests:\n\n", directory); 91 printf ("\nThe following files in %s have no tests:\n\n", directory);
92 fprintf ("%s", list_in_columns (no_tests)); 92 printf ("%s", list_in_columns (no_tests));
93 endif 93 endif
94 94
95 ## Recurse into class directories since they are implied in the path 95 ## Recurse into class directories since they are implied in the path
96 if (do_class_dirs) 96 if (do_class_dirs)
97 for i = 1:numel (dirs) 97 for i = 1:numel (dirs)
132 endif 132 endif
133 endfunction 133 endfunction
134 134
135 function print_pass_fail (n, p, xf) 135 function print_pass_fail (n, p, xf)
136 if (n > 0) 136 if (n > 0)
137 fprintf (" PASS %4d/%-4d", p, n); 137 printf (" PASS %4d/%-4d", p, n);
138 nfail = n - p; 138 nfail = n - p;
139 if (nfail > 0) 139 if (nfail > 0)
140 if (nfail != xf) 140 if (nfail != xf)
141 fprintf (" FAIL %d", nfail - xf); 141 printf (" FAIL %d", nfail - xf);
142 else 142 else
143 fprintf (" XFAIL %d", xf); 143 printf (" XFAIL %d", xf);
144 endif 144 endif
145 endif 145 endif
146 endif 146 endif
147 fputs ("\n"); 147 puts ("\n");
148 endfunction 148 endfunction
149 149
150 function print_test_file_name (nm) 150 function print_test_file_name (nm)
151 filler = repmat (".", 1, 55-length (nm)); 151 filler = repmat (".", 1, 55-length (nm));
152 fprintf (" %s %s", nm, filler); 152 printf (" %s %s", nm, filler);
153 endfunction 153 endfunction
154 154
155 155
156 %!error runtests ("foo", 1) 156 %!error runtests ("foo", 1)
157 %!error <DIRECTORY argument> runtests ("#_TOTALLY_/_INVALID_/_PATHNAME_#") 157 %!error <DIRECTORY argument> runtests ("#_TOTALLY_/_INVALID_/_PATHNAME_#")
158