bugGNU Octave - Bugs: bug #29490, Var wrongly declared undefined

 
 

bug #29490: Var wrongly declared undefined

Submitted by:  None
Submitted on:  Fri 09 Apr 2010 09:01:33 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: PhilippOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.2.4
Operating System: Microsoft Windows

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 09 Apr 2010 02:10:42 PM UTC, comment #1:

I can confirm the problem with Octave 3.2.4, but not the current development sources, so I think this problem has already been fixed. Here is what I see when I run your example code with a copy of Octave built from the current sources:

octave:3> CollectTests ('hello', true, 'hello')
{}(1x0)
Unit test "hello" of class "testset",
hello

John W. Eaton <jwe>
Project Administrator
Fri 09 Apr 2010 09:01:33 AM UTC, original submission:

When running the following (modified code from MUnit framework)

file CollectTests.m

function ts = CollectTests(files,recursive,name)
if isa(files,'char')
ts = CollectTests({},recursive,name);
else
tests = cell(1,numel(files));
disp(tests);
ts = testset(name,name,tests); % fails when using this line
% ts = makeTS(name,name,tests); % works when using this line
end
end

function ts = makeTS(name,id,tests)
ts = testset(name,id,tests);
end
=======

I get:
octave:3> CollectTests('hello',true,'hello')
{}(1x0)
error: `tests' undefined near line 7 column 28
error: evaluating argument list element number 3
error: called from:
error: D:\tests\libs\MUnit\tools\CollectTests.m at line 7, column 8
error: D:\tests\libs\MUnit\tools\CollectTests.m at line 3, column 8

Note that 'tests' is displayed a line above where it is used, it is not undefined but {}(1x0) instead.

The call works correctly, when the construction of the testset class is deferred to another function in the same file (uncomment line 8 and comment line 7)

The recursion one CollectTests seems to be important: calling directly works:

octave:3> CollectTests({},true,'hello')
{}(1x0)
Unit test "hello" of class "testset",
hello

Both tests are made right after clean start of octave, while only the path has been set.
testset is the unmodified testset class from MUnit (full code attached) which takes a vararg as input.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #20171:  MUnit.zip added by None (35KiB - application/zip)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 09 Apr 2010 02:10:42 PM UTCjweStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Fri 09 Apr 2010 09:01:33 AM UTCNoneAttached File-=>Added MUnit.zip, #20171

    Back to the top


    Powered by Savane 3.1-cleanup1