我在使用 QUNIT 时遇到问题,无论我做什么,测试套件都只会识别一个测试或模块,即使我在 javascript 中有多个测试或模块。任何帮助将不胜感激!
<script>
$(document).ready(function(){
QUnit.log = function(result, message)
{
if (window.console && window.console.log)
{
window.console.log(result +' :: '+ message);
}
}
module("Basic Unit Test");
test("Sample test", function()
{
expect(1);
equal(divide(4,2),2, 'Expected 2 as the result, result was ' + divide(4,2));
});
test("Test two", function() {
expect(1);
equal(divide(8,2),2,'Expected 4 as the result, result was ' + divide(8,2));
});
function divide(a,b){
return a / b;
}
});
</script>