octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #62780] oruntests looks in file without respec


From: Colin Macdonald
Subject: [Octave-bug-tracker] [bug #62780] oruntests looks in file without respecting .oct-config
Date: Sat, 23 Jul 2022 16:14:39 -0400 (EDT)

Follow-up Comment #6, bug #62780 (project octave):

I'm trying this but it does not seem to be helping...  I'm testing by doing
`oruntests("test_encoding")` from inside the doctest "test_extra" directory.

It fails like:

error: regexp: the input string is invalid UTF-8
error: called from
    oruntests>has_tests at line 155 column 10
    oruntests>run_all_tests at line 82 column 11
    oruntests at line 62 column 5

(line numbers are a little off b/c I'm debugging)

I've echoed some debugging stuff here:

  str = fread (fid, "*char").';
  fclose (fid);
  disp(fileparts(f))
  enc = dir_encoding (fileparts (f))
  if (! strcmp (enc, "utf-8"))
    disp("convertx from input encoding to UTF-8")
    str = native2unicode (uint8 (str), enc);
  endif
  disp(str)
  disp("about to regexp")
  retval = ! isempty (regexp (str,
                              '^%!(assert|error|fail|test|xtest|warning)',
                              'lineanchors', 'once'));


>From here, I learn that `enc` is set to "utf-8" despite the .oct-config file
containing `encoding=windows-1252`.

AFAICT, the issue is that `dir_encoding(foo)` only tells you how Octave *will*
consider the encoding...  But if the path hasn't been yet loaded (e.g., with
addpath) then it just (incorrently) says "utf-8".


- - - - - - - - -

Here's a fresh session:


>> s =
dir_encoding("/home/cbm/src/octave-doctest.git/test_extra/test_encoding")
s = utf-8
>> addpath("/home/cbm/src/octave-doctest.git/test_extra/test_encoding")
>> s =
dir_encoding("/home/cbm/src/octave-doctest.git/test_extra/test_encoding")
s = windows-1252


So here oruntest has not yet accessed the path when we query the
`dir_encoding`...?


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62780>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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