1// ============================================================================= 2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3// Copyright (C) 2014 - Scilab Enterprises - Calixte DENIZET 4// 5// This file is distributed under the same license as the Scilab package. 6// ============================================================================= 7// 8// <-- Non-regression test for bug 13226 --> 9// 10// <-- Bugzilla URL --> 11// http://bugzilla.scilab.org/13226 12// 13// <-- Short Description --> 14// Completion with accentued chars could lead to a a crash 15// 16// <-- LINUX ONLY --> 17file_path = SCI + "/modules/console/tests/nonreg_tests/"; 18mkdir(TMPDIR + "/console"); 19cd(TMPDIR + "/console"); 20ilib_verbose(0); 21ilib_name = "console_c"; 22files = "bug_13226.c"; 23for i = 1 : size(files, "*") 24 copyfile(file_path + "/" + files(i), TMPDIR + "/console"); 25end 26if isdir(SCI+"/modules/console/includes") then 27 // Unix source version 28 libs = SCI + "/modules/console/.libs/libsciconsole"; 29 cflags = "-I " + SCI +"/modules/console/includes -I " + SCI + "/modules/localization/includes"; 30else 31 // Unix binary version 32 SCI_LIB = strsubst(SCI,"/share\/scilab$/","lib/scilab" ,"r"); 33 SCI_INCLUDE = strsubst(SCI,"/share\/scilab$/","include/scilab" ,"r"); 34 libs = SCI_LIB + "/libsciconsole"; 35 cflags = "-I " + SCI_INCLUDE; 36end 37// name known in scilab , C function called 38table = ["completecommandline" ,"sci_completecommandline"]; 39ilib_build(ilib_name,table,files,libs,[],"",cflags); 40clear ilib_build; 41clear table; 42clear libs; 43clear files; 44clear ilib_name; 45clear gateway_c_dir; 46clear SCI_LIB; 47clear SCI_INCLUDE; 48ierr = exec(TMPDIR + "/console/loader.sce", "errcatch", -1); 49createdir(TMPDIR+"/Téléchargements"); 50mputl("",TMPDIR+"/Téléchargements/foo.bar"); 51cd(TMPDIR); 52[r,c] = completecommandline("atomsInstall(""./Téléchargements/f",33); 53assert_checkequal(r,"atomsInstall(""./Téléchargements/foo.bar"); 54assert_checkequal(c,39); 55