Mercurial > octave
diff test/io.tst @ 16590:2d968b7830d6
handle A, R, and W fopen modes correctly (bug #38851)
* file-io.cc (normalize_fopen_mode): New function. Handle 'A'. Also
handle 'b' and 't' suffixes here. Use Octave:fopen-mode warning id.
(fopen_mode_to_ios_mode): Only convert from mode string to ios mode.
(do_stream_open): Call normalize_fopen_mode before calling
fopen_mode_to_ios_mode. Don't process mode string directly.
* io.tst: Update test for fopen modes.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 29 Apr 2013 13:46:55 -0400 |
parents | 6fe6ac8bbfdb |
children | 57fad64de019 |
line wrap: on
line diff
--- a/test/io.tst Mon Apr 29 00:47:36 2013 -0400 +++ b/test/io.tst Mon Apr 29 13:46:55 2013 -0400 @@ -335,21 +335,25 @@ %% test/octave.test/io/fopen-1.m %!test -%! arch_list = ["native"; "ieee-le"; "ieee-be"; "vaxd"; "vaxg"; "cray"]; -%! +%! arch_list = {"native"; "ieee-le"; "ieee-be"; "vaxd"; "vaxg"; "cray"}; +%! warning ("off", "Octave:fopen-mode") %! status = 1; %! %! for i = 1:6 -%! arch = deblank (arch_list (i,:)); -%! for j = 1:6 +%! arch = arch_list{i}; +%! for j = 1:4 %! if (j == 1) -%! mode_list = ["w"; "r"; "a"]; +%! mode_list = {"w"; "r"; "a"}; %! elseif (j == 2) -%! mode_list = ["w+"; "r+"; "a+"]; +%! mode_list = {"w+"; "r+"; "a+"}; +%! elseif (j == 3) +%! mode_list = {"W"; "R"; "A"}; +%! elseif (j == 4) +%! mode_list = {"W+"; "R+"; "A+"}; %! endif %! nm = tmpnam (); %! for k = 1:3 -%! mode = deblank (mode_list (k,:)); +%! mode = mode_list{k}; %! [id, err] = fopen (nm, mode, arch); %! if (id < 0) %! __printf_assert__ ("open failed: %s (%s, %s): %s\n", nm, mode, arch, err);