macr2tree fixed and test updated
[scilab.git] / scilab / modules / core / tests / nonreg_tests / bug_1304.dia.ref
1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2010 - DIGITEO - Vincent COUVERT
4 //
5 //  This file is distributed under the same license as the Scilab package.
6 // =============================================================================
7 // <-- Non-regression test for bug 1304 -->
8 //
9 // <-- Bugzilla URL -->
10 // http://bugzilla.scilab.org/show_bug.cgi?id=1304
11 //
12 // <-- Short Description -->
13 // macr2tree(expression) doesn't work
14 //
15 // TESTS WITH A 'SIMPLE' FUNCTION
16 //
17 function bug_1304()
18     disp("bug_1304")
19 endfunction
20 // Reference tree generated using sci2exp
21 reftree = tlist(["program","name","outputs","inputs","statements","nblines"],"bug_1304",list(),..
22 list(),..
23 list(list("EOL"),..
24 tlist(["equal","expression","lhs","endsymbol"],..
25 tlist(["funcall","rhs","name","lhsnb"],list(tlist(["cste","value"],"bug_1304")),"disp",1),..
26 list(tlist(["variable","name"],"ans")),""),list("EOL"),..
27 tlist(["funcall","rhs","name","lhsnb"],[],"return",0),list("EOL")),3);
28 if ~and(macr2tree(bug_1304)==reftree) then bugmes();quit;end
29 if ~and(macr2tree(evstr("bug_1304"))==reftree) then bugmes();quit;end
30 clear bug_1304
31 //
32 // TESTS WITH A FUNCTION DEFINING AN OTHER FUNCTION
33 //
34 function f = bug_1304()
35     function internal_bug_1304()
36         disp("internal_bug_1304()")
37     endfunction
38     f = internal_bug_1304
39 endfunction
40 // Reference tree generated using sci2exp
41 reftree = tlist(["program","name","outputs","inputs","statements","nblines"],"bug_1304",..
42 list(tlist(["variable","name"],"f")),list(),..
43 list(list("EOL"),..
44 tlist(["inline","prototype","definition"],"internal_bug_1304()",..
45 ["disp(""internal_bug_1304()"")"]),list("EOL"),..
46 tlist(["equal","expression","lhs","endsymbol"],..
47 tlist(["variable","name"],"internal_bug_1304"),list(tlist(["variable","name"],"f")),""),..
48 list("EOL"),tlist(["funcall","rhs","name","lhsnb"],[],"return",0),list("EOL")),..
49 6);
50 if ~and(macr2tree(bug_1304)==reftree) then bugmes();quit;end
51 if ~and(macr2tree(evstr("bug_1304"))==reftree) then bugmes();quit;end
52 // Reference tree generated using sci2exp
53 reftree = tlist(["program","name","outputs","inputs","statements","nblines"],"internal_bug_1304",..
54 list(),list(),..
55 list(list("EOL"),..
56 tlist(["equal","expression","lhs","endsymbol"],..
57 tlist(["funcall","rhs","name","lhsnb"],list(tlist(["cste","value"],"internal_bug_1304()")),..
58 "disp",1),list(tlist(["variable","name"],"ans")),""),list("EOL"),..
59 tlist(["funcall","rhs","name","lhsnb"],[],"return",0),list("EOL")),3);
60 if ~and(macr2tree(bug_1304())==reftree) then bugmes();quit;end