diff --git a/Makefile b/Makefile index e2300f2f999f776f39bb588086cd44dbd56c1171..92335397c817da8fc44d9438395d4984918903ea 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ test: # fails if any command produces exit code != 0 @for test in test/*.sl; do \ echo; \ echo $$test; \ - isis -g -n $$test || exit 1; \ + isis -g -n -q -10 --script $$test || exit 1; \ done @awk -f test/number_of_if_endif_directives.awk share/isisscripts.sl diff --git a/build/isisscripts_prefix.sl b/build/isisscripts_prefix.sl index b0c72787972dd2c37a2df97730c227a0602d8199..fd4260b210c241efcbac0030736f1af4aff09e2d 100644 --- a/build/isisscripts_prefix.sl +++ b/build/isisscripts_prefix.sl @@ -4,11 +4,11 @@ % #ifeval __get_reference("_Isisscripts_Verbose")==NULL -variable _Isisscripts_Verbose=1; +variable _Isisscripts_Verbose=Isis_Verbose; #endif if (Undefined_Type==typeof(_Isisscripts_Verbose)) { - _Isisscripts_Verbose=1; + _Isisscripts_Verbose=Isis_Verbose; } if (_Isisscripts_Verbose>0) { diff --git a/test/test_documentation.sl b/test/test_documentation.sl new file mode 100644 index 0000000000000000000000000000000000000000..926d695f276f5fb1abe27b178b57ff9d9ca22b5d --- /dev/null +++ b/test/test_documentation.sl @@ -0,0 +1,109 @@ +% test for documentation of accessible functions +% No documentation -> No publication + +% get slang internal package +require("slshhelp"); +require("setfuns"); + +% get everything known from global ns and other packages required +variable file = "./share/isisscripts.sl"; +variable fp = fopen(file,"r"); +variable mat,si,s; +variable modules = {}; +variable line; + +foreach line (fp) using ("line") +{ + mat = string_matches(line,"try[ ]*{[ ]*\(require.*\)}"R); + if (length(mat) > 1) + { + si = strchop(mat[1],';',0); + foreach s(si) + { + mat = string_matches(s,".*require(.*\"\(.*\)\".*)"R); + if (length(mat) > 1) + { + list_append(modules, mat[1]); + } + } + } +} + +if (length(modules)) + modules = list_to_array(modules); +else + modules = NULL; +modules = modules[unique(modules)]; +variable m; +foreach m (modules) + try { require(m); } catch AnyError; + +variable knowns = [_apropos("Global", "", 1 | 2), _apropos(current_namespace(), "", 1 | 2)]; + +% import packages to seperate namespaces +variable ns = "isisscripts_test"; +% load isisscript to new ns +require(file, ns); + +variable Local_Functions, Global_Functions; +variable name; +variable nodoc_globals = 0; +variable nodoc_locals = 0; + +% iterate over all functions, and check if we get a help +Local_Functions = _apropos(ns, "", 1 | 2); +Global_Functions = _apropos("Global", "", 1 | 2); + +variable Local_Undoc = {}; +if (Int_Type != typeof(Local_Functions)) { + % remove everything that comes from slang and associated packages + Local_Functions = Local_Functions[complement(Local_Functions, knowns)]; + foreach name (Local_Functions) { + if (NULL == slsh_get_doc_string(name)) { % no help! + nodoc_locals++; + list_append(Local_Undoc, name); + } + } +} else { + Local_Functions = {}; +} + +variable Global_Undoc = {}; +if (Int_Type != typeof(Global_Functions)) { + % remove everything that comes from slang and associated packages + Global_Functions = Global_Functions[complement(Global_Functions, knowns)]; + foreach name (Global_Functions) { + if (NULL == slsh_get_doc_string(name)) { % no help! + nodoc_globals++; + list_append(Global_Undoc, name); + } + } +} else { + Global_Functions = {}; +} + +vmessage(` +ISISSCRIPTS defines + Global functions: %d, %d undocumented + Local functions: %d, %d undocumented +`, + length(Global_Functions), nodoc_globals, + length(Local_Functions), nodoc_locals); + +if (nodoc_globals) { + vmessage("%s Undocumented Globals %s", ("=")[[0:14]/15], dup()); + variable sym; + foreach sym (Global_Undoc) + vmessage(" %s", sym); +} + +if (nodoc_locals) { + vmessage("%s Undocumented Locals %s", ("=")[[0:14]/15], dup()); + foreach sym (Local_Undoc) + vmessage(" %s", sym); +} + +vmessage(""); + +%exit(nodoc_globals || nodoc_locals); +exit(0); % once we have everything documented this should fail on missing documentation