1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2009 - DIGITEO - Allan CORNET
5 // This file is distributed under the same license as the Scilab package.
6 // =============================================================================
14 str_exec = "disp(''OK'');";
15 for i = 1 : size(tab_ref,"*")
16 mkdir(TMPDIR + filesep() + tab_ref(i));
17 fd = mopen(TMPDIR + filesep() + tab_ref(i) + filesep() + tab_ref(i) + ".sce","wt");
20 exec(TMPDIR + filesep() + tab_ref(i) + filesep() + tab_ref(i) + ".sce");
21 mdelete(TMPDIR + filesep() + tab_ref(i) + filesep() + tab_ref(i) + ".sce");
22 rmdir(TMPDIR + filesep() + tab_ref(i));
30 // create a script file
31 mputl("a=1;b=2",TMPDIR+"/myscript");
33 exec(TMPDIR+"/myscript")
37 if isdef("a")<> %t then bugmes();quit;end
38 if isdef("b")<> %t then bugmes();quit;end
39 assert_checkequal(a, 1);
40 assert_checkequal(b, 2);
42 deff("y=foo(x)","a=x+1;y=a^2");
46 if isdef("k")<> %t then bugmes();quit;end
47 if isdef("a")<> %f then bugmes();quit;end
48 assert_checkequal(k, 4);
50 // create a function and call this body as a script
51 deff("script()","a=x+1;y=a^2");
52 x=4; //create x to make it known by script
56 if isdef("y")<> %t then bugmes();quit;end
57 if isdef("a")<> %t then bugmes();quit;end
58 assert_checkequal(y, 25);