octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: testing error messages with functions needing a file id


From: Daniel J Sebald
Subject: Re: testing error messages with functions needing a file id
Date: Sat, 16 Mar 2013 18:50:24 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16

On 03/16/2013 06:07 PM, PhilipNienhuis wrote:
In textscan.m I'd like to have a test like:

%!error<missing or illegal value for>  textscan (fid, "%s", "headerlines")

but there are a few stumbling blocks:

1. I wouldn't know how to supply a valid file identifier to textscan so that
the test can be made to work (apparently the error message test is
self-contained (left-adjusted against "%!") and cannot comprise multiple
lines).

I'm not completely understanding what the issue is. However, the second last sample test in that file creates a temporary file, writes some data to it, then rewinds the file and passes the FID onto the textscan test. Can you create a file of the type you want in a similar way by writing multiple lines?


2. textscan.m can read from strings as well, but then the whole
'headerlines' processing (incl. error messages) is bypassed so there would
be nothing to test.

You were thinking that as an alternate to using a file with a valid FID, you might skip that and just use a text string?


Is it at all possible to have a test like above?

(FYI at pressent the relevant tests in textscan.m actually invoke textread
instead of textscan. I want to fix them but if the above can't be made to
work I'll have to remove them)

The approach in #1 is what you are after, correct?

Dan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]