OSDN Git Service

base.jsのスペックを追加
authordhrname <dhrname@users.sourceforge.jp>
Tue, 31 Dec 2013 15:48:44 +0000 (00:48 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Tue, 31 Dec 2013 15:48:44 +0000 (00:48 +0900)
tool/funcproto/FuncSpecRunner.html
tool/funcproto/base.js

index b8add53..e575704 100644 (file)
@@ -38,6 +38,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   <!-- include source files here... -->\r
 <script type="text/javascript" src="openfile.js"></script>\r
 <script type="text/javascript" src="sleep.js"></script>\r
+<script type="text/javascript" src="base.js"></script>\r
+\r
 <script type="text/javascript">\r
 (function (file) {\r
   describe("Open File to parse XML", function() {\r
@@ -159,6 +161,23 @@ describe("Async::Sleep4", function() {
     }).sleep(0, 12, "he", a);\r
   });\r
 });\r
+\r
+describe("base.js", function() {\r
+  it("cascading inherit", function() {\r
+      var gl = (function(){ return this; })(); // Global Object\r
+      gl.$parent = gl.base( function() {\r
+        this.hoge = function() {\r
+          return 12;\r
+        };\r
+        this.$child = this.base( function() {\r
+          this.hoge = function() {\r
+            return this.$parent.hoge();\r
+          };\r
+        });\r
+      });\r
+      gl.$parent.$child.hoge(); //12\r
+  });\r
+});\r
 </script>\r
   <!-- include spec files here... -->\r
 \r
index 4467fa3..e6f587d 100644 (file)
@@ -4,7 +4,7 @@ Copyright (c) 2013 dhrname*/
 \r
 if (!this.base) {\r
     this.base= function(obj) {\r
-      if (!arguments[0] || (typeof arguments[0] !== "string")) {\r
+      if (!arguments[0]) {\r
         throw new Error("no arguments error");\r
       }\r
       var F = function() {},\r
@@ -23,16 +23,4 @@ if (!this.base) {
       F = void 0;\r
       return s;\r
     };\r
-    this.$parent = this.base( function() {\r
-      this.hoge = function() {\r
-        return 12;\r
-      };\r
-      this.$child = this.base( function() {\r
-        this.hoge = function() {\r
-          return this.$parent.hoge();\r
-        };\r
-      });\r
-    });\r
-    this.$parent.$child.hoge(); //12\r
-  }
 }
\ No newline at end of file