xultestrunner 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. data/.gitignore +2 -0
  2. data/.gitmodules +3 -0
  3. data/LICENSE +21 -0
  4. data/README +17 -0
  5. data/Rakefile +50 -0
  6. data/VERSION +1 -0
  7. data/bin/xultest +13 -0
  8. data/lib/xultestrunner.rb +1 -0
  9. data/xulapp/application.ini +9 -0
  10. data/xulapp/chrome/chrome.manifest +2 -0
  11. data/xulapp/chrome/content/interface/boot.xul +20 -0
  12. data/xulapp/chrome/content/interface/testharness.html +30 -0
  13. data/xulapp/chrome/content/lib/xultestcase.js +140 -0
  14. data/xulapp/chrome/content/lib/xultestrunner.js +120 -0
  15. data/xulapp/chrome/content/vendor/prototype/LICENSE +16 -0
  16. data/xulapp/chrome/content/vendor/prototype/prototype.js +4874 -0
  17. data/xulapp/chrome/content/vendor/scriptaculous/LICENSE +20 -0
  18. data/xulapp/chrome/content/vendor/scriptaculous/test.css +90 -0
  19. data/xulapp/chrome/content/vendor/scriptaculous/unittest.js +566 -0
  20. data/xulapp/chrome/content/vendor/xpcomcore/LICENSE +21 -0
  21. data/xulapp/chrome/content/vendor/xpcomcore/README +27 -0
  22. data/xulapp/chrome/content/vendor/xpcomcore/Rakefile +83 -0
  23. data/xulapp/chrome/content/vendor/xpcomcore/VERSION.yml +5 -0
  24. data/xulapp/chrome/content/vendor/xpcomcore/bootstrapper.js +32 -0
  25. data/xulapp/chrome/content/vendor/xpcomcore/components/XPCOMCore.js +120 -0
  26. data/xulapp/chrome/content/vendor/xpcomcore/doc/files.html +241 -0
  27. data/xulapp/chrome/content/vendor/xpcomcore/doc/index.html +243 -0
  28. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/Error.html +256 -0
  29. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/Kernel.html +1030 -0
  30. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/LoadError.html +319 -0
  31. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/SelfConceptError.html +319 -0
  32. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/_global_.html +316 -0
  33. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/src/lib_file.js.html +53 -0
  34. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/src/lib_kernel.js.html +251 -0
  35. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/README.txt +186 -0
  36. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame.js +33 -0
  37. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Chain.js +102 -0
  38. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Dumper.js +144 -0
  39. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Hash.js +84 -0
  40. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Link.js +153 -0
  41. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Namespace.js +10 -0
  42. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Opt.js +134 -0
  43. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Reflection.js +26 -0
  44. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/String.js +93 -0
  45. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Testrun.js +129 -0
  46. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/FOODOC.js +26 -0
  47. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC.js +26 -0
  48. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js +159 -0
  49. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js +16 -0
  50. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js +292 -0
  51. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC.js +104 -0
  52. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/DocComment.js +200 -0
  53. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/DocTag.js +294 -0
  54. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js +126 -0
  55. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js +109 -0
  56. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Lang.js +144 -0
  57. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Parser.js +145 -0
  58. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js +33 -0
  59. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Symbol.js +645 -0
  60. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js +241 -0
  61. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TextStream.js +41 -0
  62. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Token.js +18 -0
  63. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js +332 -0
  64. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js +133 -0
  65. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Util.js +32 -0
  66. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Walker.js +474 -0
  67. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/main.js +111 -0
  68. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/commentSrcJson.js +20 -0
  69. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/frameworkPrototype.js +16 -0
  70. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/functionCall.js +10 -0
  71. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/publishSrcHilite.js +62 -0
  72. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/symbolLink.js +10 -0
  73. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/tagParamConfig.js +31 -0
  74. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/tagSynonyms.js +43 -0
  75. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/run.js +348 -0
  76. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/t/TestDoc.js +144 -0
  77. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/t/runner.js +13 -0
  78. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test.js +325 -0
  79. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/addon.js +24 -0
  80. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/anon_inner.js +14 -0
  81. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/augments.js +31 -0
  82. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/augments2.js +26 -0
  83. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/borrows.js +46 -0
  84. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/borrows2.js +23 -0
  85. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/config.js +22 -0
  86. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/constructs.js +18 -0
  87. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/encoding.js +10 -0
  88. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/encoding_other.js +12 -0
  89. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/event.js +54 -0
  90. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/exports.js +14 -0
  91. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/functions_anon.js +39 -0
  92. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/functions_nested.js +33 -0
  93. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/global.js +13 -0
  94. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/globals.js +25 -0
  95. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/ignore.js +10 -0
  96. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/inner.js +16 -0
  97. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/jsdoc_test.js +477 -0
  98. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/lend.js +33 -0
  99. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/memberof.js +19 -0
  100. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/memberof_constructor.js +17 -0
  101. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/module.js +17 -0
  102. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/name.js +19 -0
  103. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/namespace_nested.js +23 -0
  104. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/nocode.js +13 -0
  105. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/oblit_anon.js +20 -0
  106. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/overview.js +20 -0
  107. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/param_inline.js +37 -0
  108. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/params_optional.js +8 -0
  109. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype.js +17 -0
  110. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_nested.js +9 -0
  111. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_oblit.js +13 -0
  112. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_oblit_constructor.js +24 -0
  113. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/public.js +10 -0
  114. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/scripts/code.js +5 -0
  115. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/scripts/notcode.txt +5 -0
  116. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/shared.js +42 -0
  117. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/shared2.js +2 -0
  118. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/shortcuts.js +22 -0
  119. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/static_this.js +13 -0
  120. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/synonyms.js +31 -0
  121. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/tosource.js +23 -0
  122. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/variable_redefine.js +14 -0
  123. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/changes.txt +96 -0
  124. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/conf/sample.conf +31 -0
  125. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/build.xml +36 -0
  126. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/build_1.4.xml +36 -0
  127. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/classes/js.jar +0 -0
  128. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/src/JsDebugRun.java +21 -0
  129. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/src/JsRun.java +21 -0
  130. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/jsdebug.jar +0 -0
  131. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/jsrun.jar +0 -0
  132. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/jsrun.sh +52 -0
  133. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl +17 -0
  134. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl +56 -0
  135. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/class.tmpl +646 -0
  136. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/index.tmpl +39 -0
  137. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/publish.js +200 -0
  138. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/default.css +162 -0
  139. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/header.html +2 -0
  140. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/index.html +19 -0
  141. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/symbol.tmpl +35 -0
  142. data/xulapp/chrome/content/vendor/xpcomcore/lib/file.js +46 -0
  143. data/xulapp/chrome/content/vendor/xpcomcore/lib/kernel.js +244 -0
  144. data/xulapp/chrome/content/vendor/xpcomcore/test/file_test.js +16 -0
  145. data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/love.js +1 -0
  146. data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/mad_love.js +1 -0
  147. data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/mad_world.js +1 -0
  148. data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/syntax_error.js +1 -0
  149. data/xulapp/chrome/content/vendor/xpcomcore/test/kernel_test.js +88 -0
  150. data/xulapp/components/bootstrap.js +93 -0
  151. data/xulapp/defaults/preferences/prefs.js +14 -0
  152. data/xultestrunner.gemspec +190 -0
  153. metadata +207 -0
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ .DS_Store
2
+ *.gem
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "xulapp/chrome/content/vendor/xpcomcore"]
2
+ path = xulapp/chrome/content/vendor/xpcomcore
3
+ url = git://github.com/gabrielg/xpcomcore.git
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) <2009> <Gabriel Gironda>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,17 @@
1
+ XULTestRunner
2
+ =============
3
+
4
+ This is a XUL based test runner for running the quasi-scriptaculous-unittest.js-based tests that Conflagration and WaterTower and XPCOMCore use.
5
+
6
+ Yes, it is a XUL app in a RubyGem, yes I am in touch with this.
7
+
8
+ NOTE
9
+ ====
10
+
11
+ This project uses git submodules. Remember to 'git submodule init' and 'git submodule update'.
12
+
13
+ TODO
14
+ ====
15
+
16
+ * Better error output.
17
+ * Write its own tests in itself.
data/Rakefile ADDED
@@ -0,0 +1,50 @@
1
+ begin
2
+ require 'jeweler'
3
+ require 'uuidtools'
4
+ require 'pathname'
5
+
6
+ Jeweler::Tasks.new do |s|
7
+ s.name = "xultestrunner"
8
+ s.executables = "xultest"
9
+ s.summary = "XUL based test runner for running your JS unit tests."
10
+ s.email = "contact@gironda.org"
11
+ s.homepage = "http://github.com/gabrielg/xultestrunner"
12
+ s.description = "XUL based test runner for running your JS unit tests."
13
+ s.authors = ["Gabriel Gironda"]
14
+ # FIXME - weird hack around jeweler ignoring the submoduled in xpcomcore.
15
+ s.files = (s.files + FileList["xulapp/chrome/content/vendor/**/*"]).uniq
16
+ end
17
+ Jeweler::GemcutterTasks.new
18
+
19
+ application_ini_path = (Pathname(__FILE__).parent + "xulapp/application.ini").expand_path
20
+
21
+ desc "Writes out a random UUID for the Build ID when we release to the XUL application's application.ini"
22
+ task :write_xul_build_id do
23
+ build_id = UUIDTools::UUID.random_create.to_s
24
+ ini_contents = application_ini_path.read
25
+ application_ini_path.open('w') do |f|
26
+ f << ini_contents.sub(/^BuildID=.*$/, "BuildID=#{build_id}")
27
+ end
28
+ end
29
+
30
+ desc "Writes out the gem version to the XUL application's application.ini"
31
+ task :write_xul_version do
32
+ version = (Pathname(__FILE__).parent + "VERSION").read.chomp
33
+ ini_contents = application_ini_path.read
34
+ application_ini_path.open('w') do |f|
35
+ f << ini_contents.sub(/^Version=.*$/, "Version=#{version}")
36
+ end
37
+ end
38
+
39
+ desc "Commits the application ini before a release"
40
+ task :commit_application_ini do
41
+ system("git", "add", application_ini_path.to_s)
42
+ system("git", "commit", "-m", "Bumping application.ini", application_ini_path.to_s)
43
+ end
44
+
45
+ task :release => [:write_xul_build_id, :write_xul_version, :commit_application_ini]
46
+
47
+ rescue LoadError
48
+ puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
49
+ end
50
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.8
data/bin/xultest ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ firefox_location = [`which firefox-bin`.chomp, `which firefox`.chomp].detect do |loc|
5
+ !loc.length.zero?
6
+ end
7
+
8
+ raise "Could not find `firefox-bin` or `firefox` in your path. Please rectify this and try again." unless firefox_location
9
+
10
+ xulapp_ini_path = (Pathname(__FILE__).parent.parent + "xulapp/application.ini").expand_path
11
+
12
+ puts("")
13
+ exec(firefox_location, *["-app", xulapp_ini_path, *ARGV])
@@ -0,0 +1 @@
1
+ warn("There isn't much here, buddy. Just us lonely old Ruby files.")
@@ -0,0 +1,9 @@
1
+ [App]
2
+ Name=XULTestRunner
3
+ Version=0.2.8
4
+ BuildID=c3a91f64-3063-4bc5-b4ef-4ebf2cc114bf
5
+ ID=XULTestRunner@conflagrationjs.org
6
+ Vendor=Conflagration JS
7
+
8
+ [Gecko]
9
+ MinVersion=1.9.1
@@ -0,0 +1,2 @@
1
+ content xultestrunner file:content/
2
+ resource xultestrunner file:content/
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0"?>
2
+ <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
3
+
4
+ <window id="main" title="XULTestRunner Console" width="800" height="600" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
5
+ <script type="text/javascript">XPCOMCore({scope: this});</script>
6
+ <script type="text/javascript" src="resource://xultestrunner/vendor/prototype/prototype.js" />
7
+ <script type="text/javascript" src="resource://xultestrunner/lib/xultestrunner.js" />
8
+ <script type="text/javascript">
9
+ window.addEventListener('load', function(){
10
+ var cmdService = $Cc["@conflagrationjs.org/xultestrunner/app-startup-clh;1"].getService().wrappedJSObject;
11
+ var harnessURI = "chrome://xultestrunner/content/interface/testharness.html";
12
+ var xulTestRunner = XULTestRunner.initializeFromCmdArgs(cmdService.args, {browser: $('test-browser'), harnessURI: harnessURI});
13
+ xulTestRunner.go();
14
+ }, false);
15
+ </script>
16
+
17
+ <caption label="XULTestRunner Console" />
18
+ <browser src="about:blank" id="test-browser" type="content-primary" flex="1" />
19
+
20
+ </window>
@@ -0,0 +1,30 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <title>Unit Test Harness</title>
5
+ <script type="text/javascript">XPCOMCore({scope: this});</script>
6
+ <script type="text/javascript" src="resource://xultestrunner/vendor/prototype/prototype.js"></script>
7
+ <script type="text/javascript" src="resource://xultestrunner/vendor/scriptaculous/unittest.js"></script>
8
+ <link rel="stylesheet" href="resource://xultestrunner/vendor/scriptaculous/test.css" type="text/css" />
9
+ <script type="text/javascript">
10
+ $(document).observe('dom:loaded', function(){
11
+ // FIXME - add stuff to xpcomcore for doing this jacked up crap
12
+ var ioService = $Cc["@mozilla.org/network/io-service;1"].getService($Ci.nsIIOService);
13
+ var resProt = ioService.getProtocolHandler("resource").QueryInterface($Ci.nsIResProtocolHandler);
14
+ var libPath = ioService.newURI(resProt.resolveURI(ioService.newURI("resource://xultestrunner/lib", null, null)), null, null).QueryInterface(Components.interfaces.nsIURL).path;
15
+
16
+ $LOAD_PATH.push(libPath);
17
+ require("xultestcase");
18
+
19
+ var qp = window.location.search.toQueryParams();
20
+ var testCase = XULTestCase.loadFromFile(qp.testFile);
21
+ testCase.go();
22
+ });
23
+ </script>
24
+ </head>
25
+ <body>
26
+ <h1>Unit Test Harness</h1>
27
+ <!-- Log output -->
28
+ <div id="testlog"></div>
29
+ </body>
30
+ </html>
@@ -0,0 +1,140 @@
1
+ var XULTestCase = Class.create({
2
+ initialize: function(testName, testDef) {
3
+ this.testRunner = new XULTestCase.TestRunner(testDef);
4
+ this.testRunner.name = testName;
5
+ },
6
+
7
+ go: function() {
8
+ this.testRunner.runTests();
9
+ }
10
+
11
+ });
12
+
13
+ Object.extend(XULTestCase, {
14
+ create: function(testName, testDefinitionFunc) {
15
+ var tests = {};
16
+ var setupCollector = function(givenSetup) { tests['setup'] = givenSetup; };
17
+ var teardownCollector = function(givenTeardown) { tests['teardown'] = givenTeardown; };
18
+ var testCollector = function(testName, testDef) { tests["test " + testName] = testDef; };
19
+ testDefinitionFunc(setupCollector, teardownCollector, testCollector);
20
+ var testCase = new XULTestCase(testName, tests);
21
+ this.__LAST_DEFINED_TESTCASE__ = testCase;
22
+ return testCase
23
+ },
24
+
25
+ loadFromFile: function(fileURI) {
26
+ try {
27
+ load(fileURI);
28
+ if (this.__LAST_DEFINED_TESTCASE__) {
29
+ return this.__LAST_DEFINED_TESTCASE__;
30
+ } else {
31
+ throw("Wuh Oh");
32
+ }
33
+ } catch (e) {
34
+ this._handleTestLoadError(fileURI, e);
35
+ } finally {
36
+ this.__LAST_DEFINED_TESTCASE__ = null;
37
+ }
38
+ },
39
+
40
+ _handleTestLoadError: function(fileURI, e) {
41
+ // Notify observers we failed and hope for the best
42
+ // FIXME - this sucks error reporting wise
43
+ var observerService = $Cc["@mozilla.org/observer-service;1"].getService($Ci.nsIObserverService);
44
+ observerService.notifyObservers(null, "xultestrunner-testloaderror", Object.toJSON({file: fileURI, exception: e.toString()}));
45
+ }
46
+
47
+ });
48
+
49
+ XULTestCase.Logger = Class.create(Test.Unit.Logger, {
50
+ consoleOutputMapping: {failed: 'F', error: 'E', passed: '.'},
51
+
52
+ initialize: function($super, log) {
53
+ $super(log);
54
+ this.unpassedTests = [];
55
+ },
56
+
57
+ finish: function ($super, status, summary) {
58
+ $super(status, summary);
59
+ print(this.consoleOutputMapping[status]);
60
+ if (status != "passed") {
61
+ this.unpassedTests.push({name: this.testName, status: status, summary: summary});
62
+ }
63
+ }
64
+ });
65
+
66
+ var testUnitInspect = Test.Unit.inspect;
67
+ Test.Unit.inspect = function(object) {
68
+ // FIXME - kinda seedy way to check if we got an Error rather than
69
+ // anything else and inspect it differently
70
+ if (object.stack && object.message) {
71
+ return "#{name}: #{message}\nFile: #{fileName} - Line: #{lineNumber}\n#{stack}".interpolate(object);
72
+ } else {
73
+ return testUnitInspect(object);
74
+ }
75
+ };
76
+
77
+ XULTestCase.TestRunner = Class.create(Test.Unit.Runner, {
78
+ // FIXME - ugh. straight rip from unittest.js just so we can ditch the settimeout
79
+ // and instantiate our own logger.
80
+
81
+ initialize: function(testcases) {
82
+ this.options = Object.extend({
83
+ testLog: 'testlog'
84
+ }, arguments[1] || {});
85
+ this.options.resultsURL = this.parseResultsURLQueryParameter();
86
+ this.options.tests = this.parseTestsQueryParameter();
87
+ if (this.options.testLog) {
88
+ this.options.testLog = $(this.options.testLog) || null;
89
+ }
90
+ if(this.options.tests) {
91
+ this.tests = [];
92
+ for(var i = 0; i < this.options.tests.length; i++) {
93
+ if(/^test/.test(this.options.tests[i])) {
94
+ this.tests.push(new Test.Unit.Testcase(this.options.tests[i], testcases[this.options.tests[i]], testcases["setup"], testcases["teardown"]));
95
+ }
96
+ }
97
+ } else {
98
+ if (this.options.test) {
99
+ this.tests = [new Test.Unit.Testcase(this.options.test, testcases[this.options.test], testcases["setup"], testcases["teardown"])];
100
+ } else {
101
+ this.tests = [];
102
+ for(var testcase in testcases) {
103
+ if(/^test/.test(testcase)) {
104
+ this.tests.push(
105
+ new Test.Unit.Testcase(
106
+ this.options.context ? ' -> ' + this.options.titles[testcase] : testcase,
107
+ testcases[testcase], testcases["setup"], testcases["teardown"]
108
+ ));
109
+ }
110
+ }
111
+ }
112
+ }
113
+ this.currentTest = 0;
114
+ this.logger = new XULTestCase.Logger(this.options.testLog);
115
+ },
116
+
117
+ postResults: function($super) {
118
+ $super();
119
+ this._finishUpTestCase();
120
+ },
121
+
122
+ _finishUpTestCase: function() {
123
+ var observerService = $Cc["@mozilla.org/observer-service;1"].getService($Ci.nsIObserverService);
124
+ var data = {name: this.name, unpassedTests: this.logger.unpassedTests,
125
+ summary: this._summaryData(), testLength: this.tests.length};
126
+ // Need to pass between observers as JSON to avoid crashes. Wee.
127
+ observerService.notifyObservers(null, "xultestrunner-testdone", Object.toJSON(data));
128
+ },
129
+
130
+ _summaryData: function() {
131
+ var assertions = 0, failures = 0, errors = 0;
132
+ $A(this.tests).each(function(test) {
133
+ assertions += test.assertions;
134
+ failures += test.failures;
135
+ errors += test.errors;
136
+ });
137
+ return {assertions: assertions, failures: failures, errors: errors};
138
+ }
139
+
140
+ });
@@ -0,0 +1,120 @@
1
+ var XULTestRunner = Class.create({
2
+ initialize: function(options) {
3
+ this.options = options;
4
+ this._testResults = [];
5
+ this.appStartup = $Cc["@mozilla.org/toolkit/app-startup;1"].getService($Ci.nsIAppStartup);
6
+ },
7
+
8
+ handleExit: function (exitWithFailure) {
9
+ if (exitWithFailure) {
10
+ puts("Test Failures!");
11
+ // We kill ourselves this way because we need a non-zero exit status. This is really hacky.
12
+ // Really, really hacky.
13
+ var envFile = $Cc["@mozilla.org/file/local;1"].createInstance($Ci.nsILocalFile);
14
+ envFile.initWithPath("/usr/bin/env");
15
+ var process = $Cc["@mozilla.org/process/util;1"].createInstance($Ci.nsIProcess);
16
+ process.init(envFile);
17
+ process.run(true, ["ruby", "-e", "Process.kill(9, Process.ppid)"], 3);
18
+ }
19
+ this.appStartup.quit($Ci.nsIAppStartup.eForceQuit);
20
+ },
21
+
22
+
23
+ go: function () {
24
+ this._registerObservers();
25
+ var testsToRun = $A(this.options.tests).collect(function(testFile) { return '"' + testFile.path + '"'; });
26
+ puts("Running tests...");
27
+ puts(testsToRun.join(" ") + "\n");
28
+ this._runNextTest();
29
+ },
30
+
31
+ observe: function(subject, topic, data) {
32
+ // Need to pass between observers as JSON to avoid XPCOM crashes. Wee.
33
+ var data = data.evalJSON();
34
+ if (topic == "xultestrunner-testdone") {
35
+ this._testResults.push(data);
36
+ } else if (topic == "xultestrunner-testloaderror") {
37
+ puts("There was an error loading test '#{file}': #{exception}".interpolate(data));
38
+ }
39
+ this._runNextTest();
40
+ },
41
+
42
+ _runNextTest: function() {
43
+ var testFile = this.options.tests.shift();
44
+ if (testFile) {
45
+ this._runTest(testFile);
46
+ } else {
47
+ this._finishTestRun()
48
+ }
49
+ },
50
+
51
+ _runTest: function(testFile) {
52
+ var qs = Object.toQueryString({testFile: encodeURI(testFile.path)});
53
+ var harnessWithPath = this.options.harnessURI + "?" + qs;
54
+ this.options.browser.loadURI(harnessWithPath);
55
+ },
56
+
57
+ _finishTestRun: function() {
58
+ print("\n\n");
59
+ var exitWithFailure = this._doSummary();
60
+ this.handleExit(exitWithFailure);
61
+ },
62
+
63
+ _doSummary: function() {
64
+ var testRunners = 0, testCases = 0, unpassedLength = 0, assertions = 0, failures = 0, errors = 0;
65
+ $A(this._testResults).each(function(testResult) {
66
+ $A(testResult.unpassedTests).each(function(unpassedTest) {
67
+ unpassedLength += 1;
68
+ this._showSummaryForTestResult(testResult.name, unpassedTest, unpassedLength);
69
+ }, this);
70
+ testRunners++;
71
+ testCases += testResult.testLength;
72
+ assertions += testResult.summary.assertions;
73
+ failures += testResult.summary.failures;
74
+ errors += testResult.summary.errors;
75
+ }, this);
76
+
77
+ var overallSummary = "\n\n#{runners} runners, #{cases} cases, #{unpassed} unpassed, #{assertions} assertions, #{failures} failures, #{errors} errors.\n";
78
+ puts(overallSummary.interpolate({runners: testRunners, cases: testCases,
79
+ unpassed: unpassedLength, assertions: assertions, failures: failures, errors: errors}));
80
+ return unpassedLength > 0;
81
+ },
82
+
83
+ _showSummaryForTestResult: function(testName, testResult, failureIndex) {
84
+ puts("#{index}) #{testName} - #{name}".interpolate({index: failureIndex, testName: testName, name: testResult.name}));
85
+ puts(" " + testResult.status.toUpperCase() + ":\n");
86
+ puts(testResult.summary.replace(/^/mg, " ") + "\n\n");
87
+ },
88
+
89
+ _registerObservers: function() {
90
+ var observerService = $Cc["@mozilla.org/observer-service;1"].getService($Ci.nsIObserverService);
91
+ observerService.addObserver(this, "xultestrunner-testdone", false);
92
+ observerService.addObserver(this, "xultestrunner-testloaderror", false);
93
+ }
94
+ });
95
+
96
+ Object.extend(XULTestRunner, {
97
+ testFileMatcher: /_test\.js$/,
98
+ initializeFromCmdArgs: function(cmdArgs, options) {
99
+ if (cmdArgs.testDir) {
100
+ var tests = this._findTestsFromDir(cmdArgs.testDir);
101
+ } else if (cmdArgs.testFile) {
102
+ var tests = [cmdArgs.testFile];
103
+ }
104
+ return new this(Object.extend({tests: $A(tests)}, options));
105
+ },
106
+
107
+ _findTestsFromDir: function(rootDir) {
108
+ var testFiles = [];
109
+ var entries = rootDir.directoryEntries;
110
+ while (entries.hasMoreElements()) {
111
+ var entry = entries.getNext().QueryInterface($Ci.nsIFile);
112
+ if (entry.isDirectory()) {
113
+ testFiles = testFiles.concat(this._findTestsFromDir(entry));
114
+ } else if (this.testFileMatcher.test(entry.path)) {
115
+ testFiles.push(entry);
116
+ }
117
+ }
118
+ return testFiles;
119
+ }
120
+ });