Skip to content

Commit

Permalink
Added test/
Browse files Browse the repository at this point in the history
Added test for check js include
  • Loading branch information
Alexandr Il'ichev committed Aug 3, 2012
1 parent dacb82b commit 45990f6
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/01/run.sh
@@ -0,0 +1,15 @@
#!/bin/bash
echo "Run test"
for i in {1..12}
do
echo "//Success including" >> test-include_$i.js

done

echo "Check not included files"
../../jscollectd.js test-input.js > test-output.js
grep "include(" test-output.js

rm -rf test-include_*

echo "Finish"
33 changes: 33 additions & 0 deletions tests/01/test-input.js
@@ -0,0 +1,33 @@
include("test-include_1.js");

if (true) {
include("test-include_2.js"); // if
} else if (true) {
include("test-include_3.js"); // if in alternate
} else {
include("test-include_4.js"); // alternate in alternate
}

for (var i = 0; i < 2; i++) {
include("test-include_5.js"); // for
}

while (true) {
include("test-include_6.js"); // while
}

switch ("a") {
case "b":
include("test-include_7.js"); // swithc - case
default:
include("test-include_8.js"); // switch - default
}

var a = include("test-include_9.js"); // in variable
b = include("test-include_12.js"); // in variable without declaration
function s() {
include("test-include_10.js"); // in function
}
var c = function() {
include("test-include_11.js"); // in variable with function
}
46 changes: 46 additions & 0 deletions tests/01/test-output.js
@@ -0,0 +1,46 @@
/* root: /home/rewle/jscollect/tests/01 */
/* test-input.js: begin [depth 0] */
/* test-include_1.js: begin [depth 1] */
//Success including
//Success including
//Success including
/* test-include_1.js: end */


if (true) {
/* test-include_2.js: begin [depth 1] */
//Success including
//Success including
//Success including
/* test-include_2.js: end */
// if
} else if (true) {
include("test-include_3.js"); // if in alternate
} else {
include("test-include_4.js"); // alternate in alternate
}

for (var i = 0; i < 2; i++) {
include("test-include_5.js"); // for
}

while (true) {
include("test-include_6.js"); // while
}

switch ("a") {
case "b":
include("test-include_7.js"); // swithc - case
default:
include("test-include_8.js"); // switch - default
}

var a = include("test-include_9.js"); // in variable
b = include("test-include_12.js"); // in variable without declaration
function s() {
include("test-include_10.js"); // in function
}
var c = function() {
include("test-include_11.js"); // in variable with function
}
/* test-input.js: end */

0 comments on commit 45990f6

Please sign in to comment.