forked from seancribbs/erlyjs
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
From now on, all JS functions have the arity 1 and take a list of arguments of arbitrary length, which is available within JS functions as the `arguments` variable. Arguments that are specified in a JS function's signature but are omitted when calling it are initialized with the value `undefined`. At present, the `arguments` variable is not really useful, as there's currently no way to retrieve the arguments from the `arguments` variable yet. This has to wait until we support proper objects.
- Loading branch information
1 parent
ee74281
commit 19e9ef9
Showing
6 changed files
with
204 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Mandatory. Return here a description of the test case. | ||
function test_description() { | ||
return "varargs"; | ||
} | ||
|
||
// Mandatory. Return here an array of arguments the testsuite will use | ||
// to invoke the test() function. For no arguments return an empty array. | ||
function test_args() { | ||
return []; | ||
} | ||
|
||
// Mandatory. Return here the expected test result. | ||
function test_ok() { | ||
return undefined; | ||
} | ||
|
||
// Optional. Provide here any global code. | ||
|
||
|
||
// Mandatory. The actual test. | ||
// Testsuite invokes this function with the arguments from test_args() | ||
// and compares the return value with the expected result from test_ok(). | ||
function test() { | ||
function abc(a, b, c) { | ||
return a; | ||
} | ||
return abc(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Mandatory. Return here a description of the test case. | ||
function test_description() { | ||
return "varargs"; | ||
} | ||
|
||
// Mandatory. Return here an array of arguments the testsuite will use | ||
// to invoke the test() function. For no arguments return an empty array. | ||
function test_args() { | ||
return []; | ||
} | ||
|
||
// Mandatory. Return here the expected test result. | ||
function test_ok() { | ||
return 1; | ||
} | ||
|
||
// Optional. Provide here any global code. | ||
|
||
|
||
// Mandatory. The actual test. | ||
// Testsuite invokes this function with the arguments from test_args() | ||
// and compares the return value with the expected result from test_ok(). | ||
function test() { | ||
function abc(a, b, c) { | ||
return a; | ||
} | ||
return abc(1, 2, 3); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Mandatory. Return here a description of the test case. | ||
function test_description() { | ||
return "varargs"; | ||
} | ||
|
||
// Mandatory. Return here an array of arguments the testsuite will use | ||
// to invoke the test() function. For no arguments return an empty array. | ||
function test_args() { | ||
return []; | ||
} | ||
|
||
// Mandatory. Return here the expected test result. | ||
function test_ok() { | ||
return undefined; | ||
} | ||
|
||
// Optional. Provide here any global code. | ||
|
||
|
||
// Mandatory. The actual test. | ||
// Testsuite invokes this function with the arguments from test_args() | ||
// and compares the return value with the expected result from test_ok(). | ||
function test() { | ||
function abc(a, b, c) { | ||
return c; | ||
} | ||
return abc(1, 2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Mandatory. Return here a description of the test case. | ||
function test_description() { | ||
return "varargs"; | ||
} | ||
|
||
// Mandatory. Return here an array of arguments the testsuite will use | ||
// to invoke the test() function. For no arguments return an empty array. | ||
function test_args() { | ||
return []; | ||
} | ||
|
||
// Mandatory. Return here the expected test result. | ||
function test_ok() { | ||
return 3; | ||
} | ||
|
||
// Optional. Provide here any global code. | ||
|
||
|
||
// Mandatory. The actual test. | ||
// Testsuite invokes this function with the arguments from test_args() | ||
// and compares the return value with the expected result from test_ok(). | ||
function test() { | ||
function abc(a, b, c) { | ||
return c; | ||
} | ||
return abc(1, 2, 3, 4, 5); | ||
} |