Helper definitions
The spec defines a number of helpers that are used in test-cases. This is a list of all defined helper, including that JavaScript source code.
return_literal_a
Returns the literal string 'a'
function return_literal_a() {
return "a";
}
concat_strings
Concatenates two strings
function concat_strings(e, t) {
return "" + e + t;
}
identity
Returns the first parameter
function identity(e) {
return e;
}
add
Adds two numbers
function add(e, t) {
if (typeof e != "number" || typeof t != "number")
throw new Error("Both parameters must be numbers");
return e + t;
}
if_then_else
returns seconds param if first is true, otherwise the third
function if_then_else(e, t, a) {
if (typeof e != "boolean") throw new Error("Condition must be a boolean");
return e ? t : a;
}