|
@@ -2637,6 +2637,52 @@ return self;
|
|
}; }),
|
|
}; }),
|
|
$globals.ClassTest);
|
|
$globals.ClassTest);
|
|
|
|
|
|
|
|
+$core.addMethod(
|
|
|
|
+$core.method({
|
|
|
|
+selector: "testAlternateConstructorFromSelector",
|
|
|
|
+protocol: "tests",
|
|
|
|
+
|
|
|
|
+args: [],
|
|
|
|
+source: "testAlternateConstructorFromSelector\x0a\x09| instance block |\x0a\x09block := ObjectMock alternateConstructorFromSelector: #foo:.\x0a\x0a\x09instance := block newValue: 4.\x0a\x09self assert: instance class == ObjectMock.\x0a\x09self assert: instance foo equals: 4.\x0a\x09self shouldnt: [ instance foo: 9 ] raise: Error.\x0a\x09self assert: instance foo equals: 9",
|
|
|
|
+referencedClasses: ["ObjectMock", "Error"],
|
|
|
|
+
|
|
|
|
+pragmas: [],
|
|
|
|
+messageSends: ["alternateConstructorFromSelector:", "newValue:", "assert:", "==", "class", "assert:equals:", "foo", "shouldnt:raise:", "foo:"]
|
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
|
+var self=this,$self=this;
|
|
|
|
+var instance,block;
|
|
|
|
+
|
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
|
+
|
|
|
|
+var $1;
|
|
|
|
+block=$recv($globals.ObjectMock)._alternateConstructorFromSelector_("foo:");
|
|
|
|
+instance=$recv(block)._newValue_((4));
|
|
|
|
+$self._assert_($recv($recv(instance)._class()).__eq_eq($globals.ObjectMock));
|
|
|
|
+$1=$recv(instance)._foo();
|
|
|
|
+
|
|
|
|
+$ctx1.sendIdx["foo"]=1;
|
|
|
|
+
|
|
|
|
+$self._assert_equals_($1,(4));
|
|
|
|
+
|
|
|
|
+$ctx1.sendIdx["assert:equals:"]=1;
|
|
|
|
+
|
|
|
|
+$self._shouldnt_raise_((function(){
|
|
|
|
+
|
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
|
+
|
|
|
|
+return $recv(instance)._foo_((9));
|
|
|
|
+
|
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
|
+
|
|
|
|
+}),$globals.Error);
|
|
|
|
+$self._assert_equals_($recv(instance)._foo(),(9));
|
|
|
|
+return self;
|
|
|
|
+
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testAlternateConstructorFromSelector",{instance:instance,block:block})});
|
|
|
|
+
|
|
|
|
+}; }),
|
|
|
|
+$globals.ClassTest);
|
|
|
|
+
|
|
$core.addMethod(
|
|
$core.addMethod(
|
|
$core.method({
|
|
$core.method({
|
|
selector: "testBeJavaScriptSubclassOf",
|
|
selector: "testBeJavaScriptSubclassOf",
|