diff --git a/demo/associative-arrays b/demo/associative-arrays index bc66117..f0d8950 100755 --- a/demo/associative-arrays +++ b/demo/associative-arrays @@ -3,7 +3,7 @@ cd "$(dirname "$0")" # Go to the script's directory declare -A DATA -DATA=([one]=111 [two]=222) +export DATA=([one]=111 [two]=222) . ../mo cat < Escaping": { skip: "HTML escaping is not supported" }, + "Lambdas -> Inverted Section": { + // This one passed mostly by accident. Correcting so the test still + // tests what is was designed to illustrate. + data: { + static: "static", + lambda: { + __tag__: 'code', + bash: 'false' + } + } + }, + "Lambdas -> Section - Alternate Delimiters": { + data: { + lambda: { + __tag__: 'code', + bash: 'content=$(cat); echo -n "$content{{planet}}=>|planet|$content"' + } + } + }, + "Lambdas -> Section - Multiple Calls": { + data: { + lambda: { + __tag__: 'code', + bash: 'echo -n "__$(cat)__"' + } + } + }, "Partials -> Recursion": { skip: "Complex objects are not supported and context is reset to the global level, so the recursion will loop forever" }, @@ -158,14 +185,8 @@ function addToEnvironmentObject(name, value) { return `#${name} is null`; } - // Sometimes the __tag__ property of the code in the lambdas may be - // missing. Compensate by detecting commonly defined languages. - if (value.__tag__ === "code" || (value.ruby && value.php && value.perl)) { - if (value.bash) { - return `${name}() { ${value.bash}; }`; - } - - return `${name}() { perl -e 'print ((${value.perl})->("'"$1"'"))'; }`; + if (value.__tag__ === "code") { + return `${name}() { ${value.bash || 'echo "NO BASH VERSION OF CODE"'}; }`; } return addToEnvironmentObjectConvertedToAssociativeArray(name, value); @@ -288,12 +309,12 @@ function runTest(testSet, test) { test.script = buildScript(test); if (test.skip) { - debug("Skipping test:", testSet.fullName, `$(${test.skip})`); + debug("Skipping test:", test.fullName, `(${test.skip})`); return Promise.resolve(); } - debug("Running test:", testSet.fullName); + debug("Running test:", test.fullName); return setupEnvironment(test) .then(() => executeScript(test)) @@ -303,6 +324,8 @@ function runTest(testSet, test) { if (test.isFailure) { showFailureDetails(test); + } else { + debug('Test pass:', test.fullName); } }); } diff --git a/tests/invalid-option b/tests/invalid-option index bba194e..8817896 100755 --- a/tests/invalid-option +++ b/tests/invalid-option @@ -6,6 +6,6 @@ export person="" export template="" export returnCode=1 export arguments=(--something) -export expected=$'ERROR: Unknown option: --something (See --help for options)\n' +export expected=$'ERROR: Unknown option: --something (See --help for options)\n' runTest