OSDN Git Service

funcproto用のSpecRunnerを追加
authordhrname <dhrname@users.sourceforge.jp>
Fri, 13 Sep 2013 12:23:04 +0000 (21:23 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Fri, 13 Sep 2013 12:23:04 +0000 (21:23 +0900)
tool/funcproto/FuncSpecRunner.html [new file with mode: 0644]
tool/funcproto/openfile.js

diff --git a/tool/funcproto/FuncSpecRunner.html b/tool/funcproto/FuncSpecRunner.html
new file mode 100644 (file)
index 0000000..e186684
--- /dev/null
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"\r
+  "http://www.w3.org/TR/html4/loose.dtd">\r
+<html>\r
+<head>\r
+  <title>Jasmine Test Runner for Function Prototype</title>\r
+  <link rel="stylesheet" type="text/css" href="../Spec/lib/jasmine-1.0.1/jasmine.css">\r
+  <script type="text/javascript" src="../Spec/lib/jasmine-1.0.1/jasmine.js"></script>\r
+  <script type="text/javascript" src="../Spec/lib/jasmine-1.0.1/jasmine-html.js"></script>\r
+</head>\r
+<body>\r
+<!-- Copyright (c) 2008-2010 Pivotal Labs\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining\r
+a copy of this software and associated documentation files (the\r
+"Software"), to deal in the Software without restriction, including\r
+without limitation the rights to use, copy, modify, merge, publish,\r
+distribute, sublicense, and/or sell copies of the Software, and to\r
+permit persons to whom the Software is furnished to do so, subject to\r
+the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be\r
+included in all copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ -->\r
+<script  type="text/javascript">\r
+  function __start_() {\r
+    jasmine.getEnv().addReporter(new jasmine.TrivialReporter());\r
+    jasmine.getEnv().execute();\r
+  }\r
+</script>\r
+  <!-- include source files here... -->\r
+<script type="text/javascript" src="openfile.js"></script>\r
+<script type="text/javascript" src="sleep.js"></script>\r
+  <!-- include spec files here... -->\r
+\r
+</body>\r
+</html>\r
index fc23ef2..8760a03 100644 (file)
@@ -16,6 +16,7 @@ Function.prototype.open = function() {
     xhr.open("POST", fileName);\r
     xhr.setRequestHeader("Content-Type" , "application/x-www-form-urlencoded");\r
     xhr.send(text);\r
+    return text;\r
   };\r
   xhr.onreadystatechange = function() {\r
     if (xhr.readyState === 4) {\r
@@ -26,19 +27,21 @@ Function.prototype.open = function() {
           fileName = fileNames.shift();\r
           f();\r
         } else {                                  //Load End\r
-          xhr.onreadystatechange = function() {}; //to solve the problem about a memory leak for IE 8\r
+          xhr.onreadystatechange = Function.empty; //to solve the problem about a memory leak for IE 8\r
           that(handle);\r
-          text = fileNames = xhr = handle = f = void 0;\r
+          text = fileNames = xhr = handle = f = that = void 0;\r
         }\r
       }\r
     }\r
   };\r
   var f = function() {\r
     xhr.open("GET", fileName);\r
-    xhr.send();\r
+    xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");\r
+    xhr.send(null);\r
   };\r
   f();\r
 };\r
+Function.empty = function(){};\r
 \r
 f.open("a.txt", "b.txt", "UNDEF.txt", "UNDEF.txt", "b.txt");\r
 \r
@@ -54,6 +57,7 @@ function f (file) {
       expect(file[2]).toEqual("");\r
       expect(file[3]).toEqual("");\r
       expect(file[4]).toEqual("5678");\r
+      expect(file.write("30d")).toEqual("30d");\r
     });\r
   });\r
   __start_();\r