Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/index.html

Issue 4895499043733504: Issue 510 - [Typed objects] Don`t hardcode script load order in unit tests (Closed)
Patch Set: Created Jan. 10, 2015, 12:13 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« test/common.js ('K') | « test/common.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/index.html
===================================================================
--- a/test/index.html
+++ b/test/index.html
@@ -1,44 +1,54 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="qunit.css"/>
- <script>
- var js17supported = false;
- </script>
- <script type="text/javascript;version=1.7">
- js17supported = true;
- </script>
-
<script src="jquery-1.7.1.min.js"></script>
<script src="qunit.js"></script>
<script src="common.js"></script>
<script>
- var libs = [
- "typedObjects/utils.js",
- "typedObjects/hash.js",
- "typedObjects/arrayTypes.js",
- "typedObjects/dictionaryTypes.js",
- "typedObjects/primitiveTypes.js",
- "typedObjects/references.js",
- "typedObjects/objectTypes.js",
- "typedObjects/stringType.js",
- "typedObjects.js"
- ];
- for (var i = 0; i < libs.length; i++)
- addScript("/lib/" + libs[i]);
+ var evalScript = function(source)
+ {
+ return eval(source);
+ };
+ var evalModule = function(source)
+ {
+ var result = {};
+ new Function("exports", source)(result);
+ return result;
+ };
+ var js17supported = false;
+ </script>
- var tests = [
- "typedObjects.js"
- ];
- for (var i = 0; i < tests.length; i++)
- addScript("/tests/" + tests[i]);
+ <script type="text/javascript;version=1.7">
+ evalScript = function(source)
Felix Dahlke 2015/02/03 06:30:24 Missed this before: Why are evalScript and evalMo
Felix Dahlke 2015/02/03 06:39:45 Oh nevermind that, to run it as JS 1.7 code of cou
+ {
+ return eval(source);
Sebastian Noack 2015/02/03 09:21:10 Do you ever plan to run those tests as part of a C
Wladimir Palant 2015/02/03 16:26:04 The tests themselves - yes, sure. However, the fra
+ };
+ evalModule = function(source)
+ {
+ var result = {};
+ new Function("exports", source)(result);
+ return result;
+ };
+ js17supported = true;
+ </script>
+
+ <script>
+ addScript("/lib.js");
+ addScript("/tests.js");
+
+ window.addEventListener("load", function()
+ {
+ for (var i = 0; i < tests.length; i++)
+ evalScript(tests[i]);
+ }, false);
</script>
</head>
<body>
<h1 id="qunit-header">Adblock Plus unit tests</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
« test/common.js ('K') | « test/common.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld