1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2019 - Samuel GOUGEON
5 // This file is distributed under the same license as the Scilab package.
6 // =============================================================================
8 // <-- CLI SHELL MODE -->
9 // <-- NO CHECK REF -->
11 // <-- Non-regression test for bug 16178 -->
13 // <-- Bugzilla URL -->
14 // http://bugzilla.scilab.org/16178
16 // <-- Short Description -->
17 // sci2exp() yielded an error for any input macro without argout
18 // -------------------------------------------------------------
23 assert_checkequal(sci2exp(Q1), "createfun([""%fun()"";""a.b""])");
24 assert_checkequal(sci2exp(Q1,"Q"), "createfun([""Q()"";""a.b""])");
27 // The used internal createfun() failed for a function returning nothing:
28 // ---------------------------------------------------------------------
29 //--> f=createfun(["b=fun(a)";"b=a.b"])
33 //--> f=createfun(["fun(a)";"b=a.b"])
34 // at line 1 of executed string
35 // at line 10 of function deff ( SCI\modules\functions\macros\deff.sci line 10 )
36 // at line 15 of function createfun ( SCI\modules\functions\macros\createfun.sci line 27 )
40 // Error: syntax error, unexpected identifier, expecting end of line or "," or ; or line comment
44 %fghw = createfun(["fun(a)";"b=a.b"]); // without output
45 assert_checkequal(type(%fghw), 13)
47 %fghw2 = createfun(["b=fun(a)";"b=a.b"]); // with output
48 assert_checkequal(type(%fghw2), 13)
50 assert_checkequal(%fghw2(s), %pi)