Refactored and fixed test suite to run async tests
This commit is contained in:
parent
cc5625067a
commit
308d771dd1
6 changed files with 43 additions and 5 deletions
8
build/test/data/json.php
Normal file
8
build/test/data/json.php
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?php
|
||||||
|
$json = $_REQUEST['json'];
|
||||||
|
if($json) {
|
||||||
|
echo '[ {"name": "John", "age": 21}, {"name": "Peter", "age": 25 } ]';
|
||||||
|
} else {
|
||||||
|
echo '{ "data": {"lang": "en", "length": 25} }';
|
||||||
|
}
|
||||||
|
?>
|
22
build/test/data/name.php
Normal file
22
build/test/data/name.php
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
$wait = $_REQUEST['wait'];
|
||||||
|
if($wait) {
|
||||||
|
sleep($wait);
|
||||||
|
}
|
||||||
|
$xml = $_REQUEST['xml'];
|
||||||
|
if($xml) {
|
||||||
|
header("Content-type: text/xml");
|
||||||
|
eval("\$result = $xml;");
|
||||||
|
echo "<math><calculation>$xml</calculation><result>$result</result></math>";
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
$name = $_REQUEST['name'];
|
||||||
|
if($name == 'foo') {
|
||||||
|
echo "bar";
|
||||||
|
die();
|
||||||
|
} else if($name == 'peter') {
|
||||||
|
echo "pan";
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
echo "ERROR";
|
||||||
|
?>
|
1
build/test/data/test.js
Normal file
1
build/test/data/test.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
foobar = "bar";
|
|
@ -50,8 +50,8 @@ function runTest(tests) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function test(name, callback) {
|
function test(name, callback) {
|
||||||
Test = [];
|
|
||||||
synchronize(function() {
|
synchronize(function() {
|
||||||
|
Test = [];
|
||||||
try {
|
try {
|
||||||
callback();
|
callback();
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
|
|
@ -34,9 +34,9 @@
|
||||||
<p id="first">Try them out:</p>
|
<p id="first">Try them out:</p>
|
||||||
<ul id="firstUL"></ul>
|
<ul id="firstUL"></ul>
|
||||||
<ol id="empty"></ol>
|
<ol id="empty"></ol>
|
||||||
<form id="form" action="formaction">
|
<form id="form" action="formaction">
|
||||||
<input type="text" value="Test" name="action" id="text1"/>
|
<input type="text" name="action" value="Test" id="text1"/>
|
||||||
<input type="text" value="Test" id="text2" disabled="disabled"/>
|
<input type="text" name="text2" value="Test" id="text2" disabled="disabled"/>
|
||||||
<input type="radio" name="radio1" id="radio1"/>
|
<input type="radio" name="radio1" id="radio1"/>
|
||||||
|
|
||||||
<input type="radio" name="radio2" id="radio2" checked/>
|
<input type="radio" name="radio2" id="radio2" checked/>
|
||||||
|
@ -48,6 +48,8 @@
|
||||||
|
|
||||||
<input type="text" id="name" name="name" value="name" />
|
<input type="text" id="name" name="name" value="name" />
|
||||||
|
|
||||||
|
<button id="button" name="button">Button</button>
|
||||||
|
|
||||||
<textarea id="area1">foobar</textarea>
|
<textarea id="area1">foobar</textarea>
|
||||||
|
|
||||||
<select name="select1" id="select1">
|
<select name="select1" id="select1">
|
||||||
|
|
|
@ -28,7 +28,12 @@ for ( var i = 0; i < jq.length; i++ ) {
|
||||||
if ( jq[i].tests.length > 0 ) {
|
if ( jq[i].tests.length > 0 ) {
|
||||||
var method = jq[i];
|
var method = jq[i];
|
||||||
var name = addParams(method.name, method.params);
|
var name = addParams(method.name, method.params);
|
||||||
testFile[testFile.length] = addTestWrapper(name, method.tests.join("\n").decode());
|
for(var j = 0; j < method.tests.length; j++) {
|
||||||
|
if(j > 0) {
|
||||||
|
name += "x";
|
||||||
|
}
|
||||||
|
testFile[testFile.length] = addTestWrapper(name, method.tests[j].decode()) + "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue