Browse Source

Regression tests for GH-286.

Herbert Vojčík 11 years ago
parent
commit
31f2fd78af
3 changed files with 78 additions and 0 deletions
  1. 30 0
      js/Kernel-Tests.deploy.js
  2. 40 0
      js/Kernel-Tests.js
  3. 8 0
      st/Kernel-Tests.st

+ 30 - 0
js/Kernel-Tests.deploy.js

@@ -1,5 +1,35 @@
 smalltalk.addPackage('Kernel-Tests', {});
 smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
+smalltalk.addMethod(
+"_testCanClearInterval",
+smalltalk.method({
+selector: "testCanClearInterval",
+fn: function (){
+var self=this;
+smalltalk.send(self,"_shouldnt_raise_",[(function(){
+return smalltalk.send(smalltalk.send((function(){
+return smalltalk.send(smalltalk.send((smalltalk.Error || Error),"_new",[]),"_signal",[]);
+}),"_valueWithInterval_",[(0)]),"_clearInterval",[]);
+}),(smalltalk.Error || Error)]);
+return self}
+}),
+smalltalk.BlockClosureTest);
+
+smalltalk.addMethod(
+"_testCanClearTimeout",
+smalltalk.method({
+selector: "testCanClearTimeout",
+fn: function (){
+var self=this;
+smalltalk.send(self,"_shouldnt_raise_",[(function(){
+return smalltalk.send(smalltalk.send((function(){
+return smalltalk.send(smalltalk.send((smalltalk.Error || Error),"_new",[]),"_signal",[]);
+}),"_valueWithTimeout_",[(0)]),"_clearTimeout",[]);
+}),(smalltalk.Error || Error)]);
+return self}
+}),
+smalltalk.BlockClosureTest);
+
 smalltalk.addMethod(
 "_testCompiledSource",
 smalltalk.method({

+ 40 - 0
js/Kernel-Tests.js

@@ -1,5 +1,45 @@
 smalltalk.addPackage('Kernel-Tests', {});
 smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
+smalltalk.addMethod(
+"_testCanClearInterval",
+smalltalk.method({
+selector: "testCanClearInterval",
+category: 'tests',
+fn: function (){
+var self=this;
+smalltalk.send(self,"_shouldnt_raise_",[(function(){
+return smalltalk.send(smalltalk.send((function(){
+return smalltalk.send(smalltalk.send((smalltalk.Error || Error),"_new",[]),"_signal",[]);
+}),"_valueWithInterval_",[(0)]),"_clearInterval",[]);
+}),(smalltalk.Error || Error)]);
+return self},
+args: [],
+source: "testCanClearInterval\x0a\x09self shouldnt: [([Error new signal] valueWithInterval: 0) clearInterval] raise: Error",
+messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
+referencedClasses: ["Error"]
+}),
+smalltalk.BlockClosureTest);
+
+smalltalk.addMethod(
+"_testCanClearTimeout",
+smalltalk.method({
+selector: "testCanClearTimeout",
+category: 'tests',
+fn: function (){
+var self=this;
+smalltalk.send(self,"_shouldnt_raise_",[(function(){
+return smalltalk.send(smalltalk.send((function(){
+return smalltalk.send(smalltalk.send((smalltalk.Error || Error),"_new",[]),"_signal",[]);
+}),"_valueWithTimeout_",[(0)]),"_clearTimeout",[]);
+}),(smalltalk.Error || Error)]);
+return self},
+args: [],
+source: "testCanClearTimeout\x0a\x09self shouldnt: [([Error new signal] valueWithTimeout: 0) clearTimeout] raise: Error",
+messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
+referencedClasses: ["Error"]
+}),
+smalltalk.BlockClosureTest);
+
 smalltalk.addMethod(
 "_testCompiledSource",
 smalltalk.method({

+ 8 - 0
st/Kernel-Tests.st

@@ -5,6 +5,14 @@ TestCase subclass: #BlockClosureTest
 
 !BlockClosureTest methodsFor: 'tests'!
 
+testCanClearInterval
+	self shouldnt: [([Error new signal] valueWithInterval: 0) clearInterval] raise: Error
+!
+
+testCanClearTimeout
+	self shouldnt: [([Error new signal] valueWithTimeout: 0) clearTimeout] raise: Error
+!
+
 testCompiledSource
 	self assert: ([1+1] compiledSource includesSubString: 'function')
 !