1
0

Kernel-Tests.deploy.js 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('ArrayTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. "_testAtIfAbsent",
  5. smalltalk.method({
  6. selector: "testAtIfAbsent",
  7. fn: function () {
  8. var self=this;
  9. var array=nil;
  10. (array=["hello", "world"]);
  11. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_", [(1)]), "hello"]);
  12. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_", [(2)]), "world"]);
  13. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(2), (function(){return "not found";})]), "world"]);
  14. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(0), (function(){return "not found";})]), "not found"]);
  15. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(-10), (function(){return "not found";})]), "not found"]);
  16. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(3), (function(){return "not found";})]), "not found"]);
  17. return self;}
  18. }),
  19. smalltalk.ArrayTest);
  20. smalltalk.addMethod(
  21. "_testFirstN",
  22. smalltalk.method({
  23. selector: "testFirstN",
  24. fn: function () {
  25. var self=this;
  26. smalltalk.send(self, "_assert_equals_", [[(1),(2),(3)], smalltalk.send([(1),(2),(3),(4),(5)], "_first_", [(3)])]);
  27. return self;}
  28. }),
  29. smalltalk.ArrayTest);
  30. smalltalk.addMethod(
  31. "_testIfEmpty",
  32. smalltalk.method({
  33. selector: "testIfEmpty",
  34. fn: function () {
  35. var self=this;
  36. smalltalk.send(self, "_assert_equals_", ["zork", smalltalk.send("", "_ifEmpty_", [(function(){return "zork";})])]);
  37. return self;}
  38. }),
  39. smalltalk.ArrayTest);
  40. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  41. smalltalk.addMethod(
  42. "_testCompiledSource",
  43. smalltalk.method({
  44. selector: "testCompiledSource",
  45. fn: function () {
  46. var self=this;
  47. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((function(){return (1) + (1);}), "_compiledSource", []), "_includesSubString_", ["function"])]);
  48. return self;}
  49. }),
  50. smalltalk.BlockClosureTest);
  51. smalltalk.addMethod(
  52. "_testEnsure",
  53. smalltalk.method({
  54. selector: "testEnsure",
  55. fn: function () {
  56. var self=this;
  57. smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send((smalltalk.Error || Error), "_new", []);}), "_ensure_", [(function(){return true;})])]);
  58. return self;}
  59. }),
  60. smalltalk.BlockClosureTest);
  61. smalltalk.addMethod(
  62. "_testNumArgs",
  63. smalltalk.method({
  64. selector: "testNumArgs",
  65. fn: function () {
  66. var self=this;
  67. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return nil;}), "_numArgs", []), (0)]);
  68. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return nil;}), "_numArgs", []), (2)]);
  69. return self;}
  70. }),
  71. smalltalk.BlockClosureTest);
  72. smalltalk.addMethod(
  73. "_testOnDo",
  74. smalltalk.method({
  75. selector: "testOnDo",
  76. fn: function () {
  77. var self=this;
  78. smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send(smalltalk.send((smalltalk.Error || Error), "_new", []), "_signal", []);}), "_on_do_", [(smalltalk.Error || Error), (function(ex){return true;})])]);
  79. return self;}
  80. }),
  81. smalltalk.BlockClosureTest);
  82. smalltalk.addMethod(
  83. "_testValue",
  84. smalltalk.method({
  85. selector: "testValue",
  86. fn: function () {
  87. var self=this;
  88. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_value", []), (2)]);
  89. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(x){return ((($receiver = x).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));}), "_value_", [(2)]), (3)]);
  90. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(x, y){return ((($receiver = x).klass === smalltalk.Number) ? $receiver *y : smalltalk.send($receiver, "__star", [y]));}), "_value_value_", [(2), (4)]), (8)]);
  91. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b, c){return (1);}), "_value", []), (1)]);
  92. return self;}
  93. }),
  94. smalltalk.BlockClosureTest);
  95. smalltalk.addMethod(
  96. "_testValueWithPossibleArguments",
  97. smalltalk.method({
  98. selector: "testValueWithPossibleArguments",
  99. fn: function () {
  100. var self=this;
  101. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1);}), "_valueWithPossibleArguments_", [[(3), (4)]]), (1)]);
  102. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +(4) : smalltalk.send($receiver, "__plus", [(4)]));}), "_valueWithPossibleArguments_", [[(3), (4)]]), (7)]);
  103. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +b : smalltalk.send($receiver, "__plus", [b]));}), "_valueWithPossibleArguments_", [[(3), (4), (5)]]), (7)]);
  104. return self;}
  105. }),
  106. smalltalk.BlockClosureTest);
  107. smalltalk.addMethod(
  108. "_testWhileFalse",
  109. smalltalk.method({
  110. selector: "testWhileFalse",
  111. fn: function () {
  112. var self=this;
  113. var i=nil;
  114. (i=(0));
  115. (function(){while(!(function(){return ((($receiver = i).klass === smalltalk.Number) ? $receiver >(5) : smalltalk.send($receiver, "__gt", [(5)]));})()) {(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
  116. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  117. (i=(0));
  118. (function(){while(!(function(){(i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return ((($receiver = i).klass === smalltalk.Number) ? $receiver >(5) : smalltalk.send($receiver, "__gt", [(5)]));})()) {}})();
  119. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  120. return self;}
  121. }),
  122. smalltalk.BlockClosureTest);
  123. smalltalk.addMethod(
  124. "_testWhileTrue",
  125. smalltalk.method({
  126. selector: "testWhileTrue",
  127. fn: function () {
  128. var self=this;
  129. var i=nil;
  130. (i=(0));
  131. (function(){while((function(){return ((($receiver = i).klass === smalltalk.Number) ? $receiver <(5) : smalltalk.send($receiver, "__lt", [(5)]));})()) {(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
  132. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  133. (i=(0));
  134. (function(){while((function(){(i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return ((($receiver = i).klass === smalltalk.Number) ? $receiver <(5) : smalltalk.send($receiver, "__lt", [(5)]));})()) {}})();
  135. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  136. return self;}
  137. }),
  138. smalltalk.BlockClosureTest);
  139. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  140. smalltalk.addMethod(
  141. "_testEquality",
  142. smalltalk.method({
  143. selector: "testEquality",
  144. fn: function () {
  145. var self=this;
  146. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  147. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  148. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [false])]);
  149. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [""])]);
  150. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq", [true])]);
  151. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [true])]);
  152. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq", [false])]);
  153. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq", [false])]);
  154. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [true])]);
  155. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [smalltalk.send(true, "_yourself", [])])]);
  156. return self;}
  157. }),
  158. smalltalk.BooleanTest);
  159. smalltalk.addMethod(
  160. "_testIfTrueIfFalse",
  161. smalltalk.method({
  162. selector: "testIfTrueIfFalse",
  163. fn: function () {
  164. var self=this;
  165. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return "alternative block";})])), "__eq", ["alternative block"])]);
  166. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return "alternative block";})])), "__eq", [nil])]);
  167. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return "alternative block";})])), "__eq", [nil])]);
  168. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return "alternative block";})])), "__eq", ["alternative block"])]);
  169. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block2"])]);
  170. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block"])]);
  171. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block"])]);
  172. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block2"])]);
  173. return self;}
  174. }),
  175. smalltalk.BooleanTest);
  176. smalltalk.addMethod(
  177. "_testLogic",
  178. smalltalk.method({
  179. selector: "testLogic",
  180. fn: function () {
  181. var self=this;
  182. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [true])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_&", [false])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [false])]);})(self);
  183. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [true])]);smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [false])]);smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_|", [false])]);})(self);
  184. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [(1) > (0)])]);smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [false])]);return smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [(1) > (2)])]);})(self);
  185. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [(1) > (0)])]);smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [false])]);return smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [(1) > (2)])]);})(self);
  186. return self;}
  187. }),
  188. smalltalk.BooleanTest);
  189. smalltalk.addMethod(
  190. "_testLogicKeywords",
  191. smalltalk.method({
  192. selector: "testLogicKeywords",
  193. fn: function () {
  194. var self=this;
  195. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_and_", [(function(){return true;})])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_and_", [(function(){return false;})])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_and_", [(function(){return true;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_and_", [(function(){return false;})])]);})(self);
  196. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_or_", [(function(){return true;})])]);smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_or_", [(function(){return false;})])]);smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_or_", [(function(){return true;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_or_", [(function(){return false;})])]);})(self);
  197. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_and_", [(function(){return (1) > (0);})])]);smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_and_", [(function(){return false;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_and_", [(function(){return (1) > (2);})])]);})(self);
  198. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_or_", [(function(){return (1) > (0);})])]);smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_or_", [(function(){return false;})])]);return smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_or_", [(function(){return (1) > (2);})])]);})(self);
  199. return self;}
  200. }),
  201. smalltalk.BooleanTest);
  202. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  203. smalltalk.addMethod(
  204. "_setUp",
  205. smalltalk.method({
  206. selector: "setUp",
  207. fn: function () {
  208. var self=this;
  209. (self['@builder']=smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []));
  210. return self;}
  211. }),
  212. smalltalk.ClassBuilderTest);
  213. smalltalk.addMethod(
  214. "_tearDown",
  215. smalltalk.method({
  216. selector: "tearDown",
  217. fn: function () {
  218. var self=this;
  219. (($receiver = self['@theClass']) != nil && $receiver != undefined) ? (function(){smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_removeClass_", [self['@theClass']]);return (self['@theClass']=nil);})() : nil;
  220. return self;}
  221. }),
  222. smalltalk.ClassBuilderTest);
  223. smalltalk.addMethod(
  224. "_testClassCopy",
  225. smalltalk.method({
  226. selector: "testClassCopy",
  227. fn: function () {
  228. var self=this;
  229. (self['@theClass']=smalltalk.send(self['@builder'], "_copyClass_named_", [(smalltalk.ObjectMock || ObjectMock), "ObjectMock2"]));
  230. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_superclass", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_superclass", [])])]);
  231. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_instanceVariableNames", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_instanceVariableNames", [])])]);
  232. smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@theClass'], "_name", []), "ObjectMock2"]);
  233. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_package", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_package", [])])]);
  234. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self['@theClass'], "_methodDictionary", []), "_keys", []), smalltalk.send(smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_methodDictionary", []), "_keys", [])]);
  235. return self;}
  236. }),
  237. smalltalk.ClassBuilderTest);
  238. smalltalk.addMethod(
  239. "_testInstanceVariableNames",
  240. smalltalk.method({
  241. selector: "testInstanceVariableNames",
  242. fn: function () {
  243. var self=this;
  244. smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@builder'], "_instanceVariableNamesFor_", [" hello world "]), ["hello", "world"]]);
  245. return self;}
  246. }),
  247. smalltalk.ClassBuilderTest);
  248. smalltalk.addClass('DictionaryTest', smalltalk.TestCase, [], 'Kernel-Tests');
  249. smalltalk.addMethod(
  250. "_testAccessing",
  251. smalltalk.method({
  252. selector: "testAccessing",
  253. fn: function () {
  254. var self=this;
  255. var d=nil;
  256. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  257. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  258. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", ["hello"]), "__eq", ["world"])]);
  259. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["hello", (function(){return nil;})]), "__eq", ["world"])]);
  260. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["foo", (function(){return nil;})]), "__eq", ["world"])]);
  261. smalltalk.send(d, "_at_put_", [(1), (2)]);
  262. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [(1)]), "__eq", [(2)])]);
  263. smalltalk.send(d, "_at_put_", [smalltalk.send((1), "__at", [(3)]), (3)]);
  264. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [smalltalk.send((1), "__at", [(3)])]), "__eq", [(3)])]);
  265. return self;}
  266. }),
  267. smalltalk.DictionaryTest);
  268. smalltalk.addMethod(
  269. "_testDynamicDictionaries",
  270. smalltalk.method({
  271. selector: "testDynamicDictionaries",
  272. fn: function () {
  273. var self=this;
  274. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.HashedCollection._fromPairs_([smalltalk.send("hello", "__minus_gt", [(1)])]), "_asDictionary", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_with_", [smalltalk.send("hello", "__minus_gt", [(1)])])])]);
  275. return self;}
  276. }),
  277. smalltalk.DictionaryTest);
  278. smalltalk.addMethod(
  279. "_testEquality",
  280. smalltalk.method({
  281. selector: "testEquality",
  282. fn: function () {
  283. var self=this;
  284. var d1=nil;
  285. var d2=nil;
  286. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])])]);
  287. (d1=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  288. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  289. smalltalk.send(self, "_assert_", [smalltalk.send(d1, "__eq", [d2])]);
  290. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (3)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  291. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  292. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(2), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  293. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  294. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);smalltalk.send($rec, "_at_put_", [(3), (4)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  295. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  296. return self;}
  297. }),
  298. smalltalk.DictionaryTest);
  299. smalltalk.addMethod(
  300. "_testKeys",
  301. smalltalk.method({
  302. selector: "testKeys",
  303. fn: function () {
  304. var self=this;
  305. var d=nil;
  306. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  307. smalltalk.send(d, "_at_put_", [(1), (2)]);
  308. smalltalk.send(d, "_at_put_", [(2), (3)]);
  309. smalltalk.send(d, "_at_put_", [(3), (4)]);
  310. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  311. return self;}
  312. }),
  313. smalltalk.DictionaryTest);
  314. smalltalk.addMethod(
  315. "_testPrintString",
  316. smalltalk.method({
  317. selector: "testPrintString",
  318. fn: function () {
  319. var self=this;
  320. smalltalk.send(self, "_assert_equals_", [unescape("a%20Dictionary%28%27firstname%27%20-%3E%20%27James%27%20%2C%20%27lastname%27%20-%3E%20%27Bond%27%29"), (function($rec){smalltalk.send($rec, "_at_put_", ["firstname", "James"]);smalltalk.send($rec, "_at_put_", ["lastname", "Bond"]);return smalltalk.send($rec, "_printString", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []))]);
  321. return self;}
  322. }),
  323. smalltalk.DictionaryTest);
  324. smalltalk.addMethod(
  325. "_testRemoveKey",
  326. smalltalk.method({
  327. selector: "testRemoveKey",
  328. fn: function () {
  329. var self=this;
  330. var d=nil;
  331. var key=nil;
  332. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  333. smalltalk.send(d, "_at_put_", [(1), (2)]);
  334. smalltalk.send(d, "_at_put_", [(2), (3)]);
  335. smalltalk.send(d, "_at_put_", [(3), (4)]);
  336. (key=(2));
  337. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  338. smalltalk.send(d, "_removeKey_", [key]);
  339. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (3)]])]);
  340. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (4)]])]);
  341. smalltalk.send(self, "_deny_", [smalltalk.send(d, "_includesKey_", [(2)])]);
  342. return self;}
  343. }),
  344. smalltalk.DictionaryTest);
  345. smalltalk.addMethod(
  346. "_testRemoveKeyIfAbsent",
  347. smalltalk.method({
  348. selector: "testRemoveKeyIfAbsent",
  349. fn: function () {
  350. var self=this;
  351. var d=nil;
  352. var key=nil;
  353. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  354. smalltalk.send(d, "_at_put_", [(1), (2)]);
  355. smalltalk.send(d, "_at_put_", [(2), (3)]);
  356. smalltalk.send(d, "_at_put_", [(3), (4)]);
  357. (key=(2));
  358. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_", [key]), "__eq", [(3)])]);
  359. (key=(3));
  360. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_ifAbsent_", [key, (function(){return (42);})]), "__eq", [(4)])]);
  361. (key="why");
  362. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_ifAbsent_", [key, (function(){return (42);})]), "__eq", [(42)])]);
  363. return self;}
  364. }),
  365. smalltalk.DictionaryTest);
  366. smalltalk.addMethod(
  367. "_testSize",
  368. smalltalk.method({
  369. selector: "testSize",
  370. fn: function () {
  371. var self=this;
  372. var d=nil;
  373. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  374. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(0)])]);
  375. smalltalk.send(d, "_at_put_", [(1), (2)]);
  376. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(1)])]);
  377. smalltalk.send(d, "_at_put_", [(2), (3)]);
  378. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(2)])]);
  379. return self;}
  380. }),
  381. smalltalk.DictionaryTest);
  382. smalltalk.addMethod(
  383. "_testValues",
  384. smalltalk.method({
  385. selector: "testValues",
  386. fn: function () {
  387. var self=this;
  388. var d=nil;
  389. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  390. smalltalk.send(d, "_at_put_", [(1), (2)]);
  391. smalltalk.send(d, "_at_put_", [(2), (3)]);
  392. smalltalk.send(d, "_at_put_", [(3), (4)]);
  393. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (3), (4)]])]);
  394. return self;}
  395. }),
  396. smalltalk.DictionaryTest);
  397. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  398. smalltalk.addMethod(
  399. "_jsObject",
  400. smalltalk.method({
  401. selector: "jsObject",
  402. fn: function () {
  403. var self=this;
  404. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}};
  405. return self;}
  406. }),
  407. smalltalk.JSObjectProxyTest);
  408. smalltalk.addMethod(
  409. "_testDNU",
  410. smalltalk.method({
  411. selector: "testDNU",
  412. fn: function () {
  413. var self=this;
  414. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send(self, "_jsObject", []), "_foo", []);}), (smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  415. return self;}
  416. }),
  417. smalltalk.JSObjectProxyTest);
  418. smalltalk.addMethod(
  419. "_testMessageSend",
  420. smalltalk.method({
  421. selector: "testMessageSend",
  422. fn: function () {
  423. var self=this;
  424. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_a", []), (1)]);
  425. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_b", []), (2)]);
  426. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_c_", [(3)]), (3)]);
  427. return self;}
  428. }),
  429. smalltalk.JSObjectProxyTest);
  430. smalltalk.addMethod(
  431. "_testMethodWithArguments",
  432. smalltalk.method({
  433. selector: "testMethodWithArguments",
  434. fn: function () {
  435. var self=this;
  436. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  437. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_addClass_", ["amber"]);
  438. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  439. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_removeClass_", ["amber"]);
  440. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  441. return self;}
  442. }),
  443. smalltalk.JSObjectProxyTest);
  444. smalltalk.addMethod(
  445. "_testPrinting",
  446. smalltalk.method({
  447. selector: "testPrinting",
  448. fn: function () {
  449. var self=this;
  450. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_jsObject", []), "_printString", []), "__eq", [unescape("%5Bobject%20Object%5D")])]);
  451. return self;}
  452. }),
  453. smalltalk.JSObjectProxyTest);
  454. smalltalk.addMethod(
  455. "_testPropertyThatReturnsEmptyString",
  456. smalltalk.method({
  457. selector: "testPropertyThatReturnsEmptyString",
  458. fn: function () {
  459. var self=this;
  460. document.location.hash = '';
  461. smalltalk.send(self, "_assert_equals_", ["", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  462. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", ["test"]);
  463. smalltalk.send(self, "_assert_equals_", [unescape("%23test"), smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  464. return self;}
  465. }),
  466. smalltalk.JSObjectProxyTest);
  467. smalltalk.addMethod(
  468. "_testYourself",
  469. smalltalk.method({
  470. selector: "testYourself",
  471. fn: function () {
  472. var self=this;
  473. var body=nil;
  474. (body=(function($rec){smalltalk.send($rec, "_addClass_", ["amber"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send("body", "_asJQuery", [])));
  475. smalltalk.send(self, "_assert_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  476. smalltalk.send(body, "_removeClass_", ["amber"]);
  477. smalltalk.send(self, "_deny_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  478. return self;}
  479. }),
  480. smalltalk.JSObjectProxyTest);
  481. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  482. smalltalk.addMethod(
  483. "_testArithmetic",
  484. smalltalk.method({
  485. selector: "testArithmetic",
  486. fn: function () {
  487. var self=this;
  488. smalltalk.send(self, "_assert_", [smalltalk.send((1.5) + (1), "__eq", [(2.5)])]);
  489. smalltalk.send(self, "_assert_", [smalltalk.send((2) - (1), "__eq", [(1)])]);
  490. smalltalk.send(self, "_assert_", [smalltalk.send((-2) - (1), "__eq", [(-3)])]);
  491. smalltalk.send(self, "_assert_", [smalltalk.send((12) / (2), "__eq", [(6)])]);
  492. smalltalk.send(self, "_assert_", [smalltalk.send((3) * (4), "__eq", [(12)])]);
  493. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = (1) + (2)).klass === smalltalk.Number) ? $receiver *(3) : smalltalk.send($receiver, "__star", [(3)])), "__eq", [(9)])]);
  494. smalltalk.send(self, "_assert_", [smalltalk.send((1) + (2) * (3), "__eq", [(7)])]);
  495. return self;}
  496. }),
  497. smalltalk.NumberTest);
  498. smalltalk.addMethod(
  499. "_testComparison",
  500. smalltalk.method({
  501. selector: "testComparison",
  502. fn: function () {
  503. var self=this;
  504. smalltalk.send(self, "_assert_", [(3) > (2)]);
  505. smalltalk.send(self, "_assert_", [(2) < (3)]);
  506. smalltalk.send(self, "_deny_", [(3) < (2)]);
  507. smalltalk.send(self, "_deny_", [(2) > (3)]);
  508. smalltalk.send(self, "_assert_", [(3) >= (3)]);
  509. smalltalk.send(self, "_assert_", [(3.1) >= (3)]);
  510. smalltalk.send(self, "_assert_", [(3) <= (3)]);
  511. smalltalk.send(self, "_assert_", [(3) <= (3.1)]);
  512. return self;}
  513. }),
  514. smalltalk.NumberTest);
  515. smalltalk.addMethod(
  516. "_testCopying",
  517. smalltalk.method({
  518. selector: "testCopying",
  519. fn: function () {
  520. var self=this;
  521. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq_eq", [(1)])]);
  522. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq_eq", [(1)])]);
  523. return self;}
  524. }),
  525. smalltalk.NumberTest);
  526. smalltalk.addMethod(
  527. "_testEquality",
  528. smalltalk.method({
  529. selector: "testEquality",
  530. fn: function () {
  531. var self=this;
  532. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [(1)])]);
  533. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq", [(0)])]);
  534. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq", [(0)])]);
  535. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [(1)])]);
  536. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  537. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  538. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  539. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  540. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  541. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [""])]);
  542. return self;}
  543. }),
  544. smalltalk.NumberTest);
  545. smalltalk.addMethod(
  546. "_testIdentity",
  547. smalltalk.method({
  548. selector: "testIdentity",
  549. fn: function () {
  550. var self=this;
  551. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [(1)])]);
  552. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq_eq", [(0)])]);
  553. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(0)])]);
  554. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [(1)])]);
  555. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  556. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  557. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(2)])]);
  558. return self;}
  559. }),
  560. smalltalk.NumberTest);
  561. smalltalk.addMethod(
  562. "_testMinMax",
  563. smalltalk.method({
  564. selector: "testMinMax",
  565. fn: function () {
  566. var self=this;
  567. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_max_", [(5)]), (5)]);
  568. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_min_", [(5)]), (2)]);
  569. return self;}
  570. }),
  571. smalltalk.NumberTest);
  572. smalltalk.addMethod(
  573. "_testNegated",
  574. smalltalk.method({
  575. selector: "testNegated",
  576. fn: function () {
  577. var self=this;
  578. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__eq", [(-3)])]);
  579. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((-3), "_negated", []), "__eq", [(3)])]);
  580. return self;}
  581. }),
  582. smalltalk.NumberTest);
  583. smalltalk.addMethod(
  584. "_testPrintShowingDecimalPlaces",
  585. smalltalk.method({
  586. selector: "testPrintShowingDecimalPlaces",
  587. fn: function () {
  588. var self=this;
  589. smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send((23), "_printShowingDecimalPlaces_", [(2)])]);
  590. smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send((23.5698), "_printShowingDecimalPlaces_", [(2)])]);
  591. smalltalk.send(self, "_assert_equals_", [unescape("-234.56700"), smalltalk.send(smalltalk.send((234.567), "_negated", []), "_printShowingDecimalPlaces_", [(5)])]);
  592. smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send((23.4567), "_printShowingDecimalPlaces_", [(0)])]);
  593. smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send((23.5567), "_printShowingDecimalPlaces_", [(0)])]);
  594. smalltalk.send(self, "_assert_equals_", [unescape("-23"), smalltalk.send(smalltalk.send((23.4567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  595. smalltalk.send(self, "_assert_equals_", [unescape("-24"), smalltalk.send(smalltalk.send((23.5567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  596. smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send((100000000), "_printShowingDecimalPlaces_", [(1)])]);
  597. smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send((0.98), "_printShowingDecimalPlaces_", [(5)])]);
  598. smalltalk.send(self, "_assert_equals_", [unescape("-0.98"), smalltalk.send(smalltalk.send((0.98), "_negated", []), "_printShowingDecimalPlaces_", [(2)])]);
  599. smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send((2.567), "_printShowingDecimalPlaces_", [(2)])]);
  600. smalltalk.send(self, "_assert_equals_", [unescape("-2.57"), smalltalk.send((-2.567), "_printShowingDecimalPlaces_", [(2)])]);
  601. smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send((0), "_printShowingDecimalPlaces_", [(2)])]);
  602. return self;}
  603. }),
  604. smalltalk.NumberTest);
  605. smalltalk.addMethod(
  606. "_testRounded",
  607. smalltalk.method({
  608. selector: "testRounded",
  609. fn: function () {
  610. var self=this;
  611. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_rounded", []), "__eq", [(3)])]);
  612. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_rounded", []), "__eq", [(3)])]);
  613. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_rounded", []), "__eq", [(4)])]);
  614. return self;}
  615. }),
  616. smalltalk.NumberTest);
  617. smalltalk.addMethod(
  618. "_testSqrt",
  619. smalltalk.method({
  620. selector: "testSqrt",
  621. fn: function () {
  622. var self=this;
  623. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_sqrt", []), "__eq", [(2)])]);
  624. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((16), "_sqrt", []), "__eq", [(4)])]);
  625. return self;}
  626. }),
  627. smalltalk.NumberTest);
  628. smalltalk.addMethod(
  629. "_testSquared",
  630. smalltalk.method({
  631. selector: "testSquared",
  632. fn: function () {
  633. var self=this;
  634. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_squared", []), "__eq", [(16)])]);
  635. return self;}
  636. }),
  637. smalltalk.NumberTest);
  638. smalltalk.addMethod(
  639. "_testTimesRepeat",
  640. smalltalk.method({
  641. selector: "testTimesRepeat",
  642. fn: function () {
  643. var self=this;
  644. var i=nil;
  645. (i=(0));
  646. smalltalk.send((0), "_timesRepeat_", [(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
  647. smalltalk.send(self, "_assert_equals_", [i, (0)]);
  648. smalltalk.send((5), "_timesRepeat_", [(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
  649. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  650. return self;}
  651. }),
  652. smalltalk.NumberTest);
  653. smalltalk.addMethod(
  654. "_testTo",
  655. smalltalk.method({
  656. selector: "testTo",
  657. fn: function () {
  658. var self=this;
  659. smalltalk.send(self, "_assert_equals_", [smalltalk.send((1), "_to_", [(5)]), [(1), (2), (3), (4), (5)]]);
  660. return self;}
  661. }),
  662. smalltalk.NumberTest);
  663. smalltalk.addMethod(
  664. "_testToBy",
  665. smalltalk.method({
  666. selector: "testToBy",
  667. fn: function () {
  668. var self=this;
  669. smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "_to_by_", [(6), (2)]), [(0), (2), (4), (6)]]);
  670. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send((1), "_to_by_", [(4), (0)]);}), (smalltalk.Error || Error)]);
  671. return self;}
  672. }),
  673. smalltalk.NumberTest);
  674. smalltalk.addMethod(
  675. "_testTruncated",
  676. smalltalk.method({
  677. selector: "testTruncated",
  678. fn: function () {
  679. var self=this;
  680. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_truncated", []), "__eq", [(3)])]);
  681. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_truncated", []), "__eq", [(3)])]);
  682. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_truncated", []), "__eq", [(3)])]);
  683. return self;}
  684. }),
  685. smalltalk.NumberTest);
  686. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  687. smalltalk.addMethod(
  688. "_foo",
  689. smalltalk.method({
  690. selector: "foo",
  691. fn: function () {
  692. var self=this;
  693. return self['@foo'];
  694. return self;}
  695. }),
  696. smalltalk.ObjectMock);
  697. smalltalk.addMethod(
  698. "_foo_",
  699. smalltalk.method({
  700. selector: "foo:",
  701. fn: function (anObject) {
  702. var self=this;
  703. (self['@foo']=anObject);
  704. return self;}
  705. }),
  706. smalltalk.ObjectMock);
  707. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  708. smalltalk.addMethod(
  709. "_testBasicAccess",
  710. smalltalk.method({
  711. selector: "testBasicAccess",
  712. fn: function () {
  713. var self=this;
  714. var o=nil;
  715. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  716. smalltalk.send(o, "_basicAt_put_", ["a", (1)]);
  717. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["a"]), (1)]);
  718. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["b"]), nil]);
  719. return self;}
  720. }),
  721. smalltalk.ObjectTest);
  722. smalltalk.addMethod(
  723. "_testBasicPerform",
  724. smalltalk.method({
  725. selector: "testBasicPerform",
  726. fn: function () {
  727. var self=this;
  728. var o=nil;
  729. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  730. smalltalk.send(o, "_basicAt_put_", ["func", (function(){return "hello";})]);
  731. smalltalk.send(o, "_basicAt_put_", ["func2", (function(a){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  732. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_", ["func"]), "hello"]);
  733. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_withArguments_", ["func2", [(3)]]), (4)]);
  734. return self;}
  735. }),
  736. smalltalk.ObjectTest);
  737. smalltalk.addMethod(
  738. "_testDNU",
  739. smalltalk.method({
  740. selector: "testDNU",
  741. fn: function () {
  742. var self=this;
  743. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_foo", []);}), (smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  744. return self;}
  745. }),
  746. smalltalk.ObjectTest);
  747. smalltalk.addMethod(
  748. "_testEquality",
  749. smalltalk.method({
  750. selector: "testEquality",
  751. fn: function () {
  752. var self=this;
  753. var o=nil;
  754. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  755. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  756. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [o])]);
  757. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq", [o])]);
  758. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [smalltalk.send(o, "_yourself", [])])]);
  759. return self;}
  760. }),
  761. smalltalk.ObjectTest);
  762. smalltalk.addMethod(
  763. "_testHalt",
  764. smalltalk.method({
  765. selector: "testHalt",
  766. fn: function () {
  767. var self=this;
  768. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_halt", []);}), (smalltalk.Error || Error)]);
  769. return self;}
  770. }),
  771. smalltalk.ObjectTest);
  772. smalltalk.addMethod(
  773. "_testIdentity",
  774. smalltalk.method({
  775. selector: "testIdentity",
  776. fn: function () {
  777. var self=this;
  778. var o=nil;
  779. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  780. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq_eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  781. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [o])]);
  782. return self;}
  783. }),
  784. smalltalk.ObjectTest);
  785. smalltalk.addMethod(
  786. "_testIfNil",
  787. smalltalk.method({
  788. selector: "testIfNil",
  789. fn: function () {
  790. var self=this;
  791. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_isNil", [])]);
  792. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, "__eq", [true])]);
  793. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
  794. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  795. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  796. return self;}
  797. }),
  798. smalltalk.ObjectTest);
  799. smalltalk.addMethod(
  800. "_testInstVars",
  801. smalltalk.method({
  802. selector: "testInstVars",
  803. fn: function () {
  804. var self=this;
  805. var o=nil;
  806. (o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []));
  807. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), nil]);
  808. smalltalk.send(o, "_instVarAt_put_", [smalltalk.symbolFor("foo"), (1)]);
  809. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), (1)]);
  810. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", ["foo"]), (1)]);
  811. return self;}
  812. }),
  813. smalltalk.ObjectTest);
  814. smalltalk.addMethod(
  815. "_testNilUndefined",
  816. smalltalk.method({
  817. selector: "testNilUndefined",
  818. fn: function () {
  819. var self=this;
  820. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "__eq", [(typeof undefined == 'undefined' ? nil : undefined)])]);
  821. return self;}
  822. }),
  823. smalltalk.ObjectTest);
  824. smalltalk.addMethod(
  825. "_testYourself",
  826. smalltalk.method({
  827. selector: "testYourself",
  828. fn: function () {
  829. var self=this;
  830. var o=nil;
  831. (o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []));
  832. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  833. return self;}
  834. }),
  835. smalltalk.ObjectTest);
  836. smalltalk.addMethod(
  837. "_testidentityHash",
  838. smalltalk.method({
  839. selector: "testidentityHash",
  840. fn: function () {
  841. var self=this;
  842. var o1=nil;
  843. var o2=nil;
  844. (o1=smalltalk.send((smalltalk.Object || Object), "_new", []));
  845. (o2=smalltalk.send((smalltalk.Object || Object), "_new", []));
  846. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o1, "_identityHash", [])])]);
  847. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o2, "_identityHash", [])])]);
  848. return self;}
  849. }),
  850. smalltalk.ObjectTest);
  851. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  852. smalltalk.addMethod(
  853. "_setUp",
  854. smalltalk.method({
  855. selector: "setUp",
  856. fn: function () {
  857. var self=this;
  858. (self['@backUpCommitPathJs']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathJs", []));
  859. (self['@backUpCommitPathSt']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathSt", []));
  860. smalltalk.send((smalltalk.Package || Package), "_resetCommitPaths", []);
  861. (self['@zorkPackage']=smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_new", []), "_name_", ["Zork"]));
  862. (self['@grulPackage']=(function($rec){smalltalk.send($rec, "_name_", ["Grul"]);smalltalk.send($rec, "_commitPathJs_", [unescape("server/grul/js")]);smalltalk.send($rec, "_commitPathSt_", [unescape("grul/st")]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Package || Package), "_new", [])));
  863. return self;}
  864. }),
  865. smalltalk.PackageTest);
  866. smalltalk.addMethod(
  867. "_tearDown",
  868. smalltalk.method({
  869. selector: "tearDown",
  870. fn: function () {
  871. var self=this;
  872. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);return smalltalk.send($rec, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);})((smalltalk.Package || Package));
  873. return self;}
  874. }),
  875. smalltalk.PackageTest);
  876. smalltalk.addMethod(
  877. "_testGrulCommitPathJsShouldBeServerGrulJs",
  878. smalltalk.method({
  879. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  880. fn: function () {
  881. var self=this;
  882. smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  883. return self;}
  884. }),
  885. smalltalk.PackageTest);
  886. smalltalk.addMethod(
  887. "_testGrulCommitPathStShouldBeGrulSt",
  888. smalltalk.method({
  889. selector: "testGrulCommitPathStShouldBeGrulSt",
  890. fn: function () {
  891. var self=this;
  892. smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  893. return self;}
  894. }),
  895. smalltalk.PackageTest);
  896. smalltalk.addMethod(
  897. "_testZorkCommitPathJsShouldBeJs",
  898. smalltalk.method({
  899. selector: "testZorkCommitPathJsShouldBeJs",
  900. fn: function () {
  901. var self=this;
  902. smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  903. return self;}
  904. }),
  905. smalltalk.PackageTest);
  906. smalltalk.addMethod(
  907. "_testZorkCommitPathStShouldBeSt",
  908. smalltalk.method({
  909. selector: "testZorkCommitPathStShouldBeSt",
  910. fn: function () {
  911. var self=this;
  912. smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  913. return self;}
  914. }),
  915. smalltalk.PackageTest);
  916. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  917. smalltalk.addMethod(
  918. "_setUp",
  919. smalltalk.method({
  920. selector: "setUp",
  921. fn: function () {
  922. var self=this;
  923. smalltalk.send(self, "_setUp", [], smalltalk.PackageTest);
  924. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [unescape("javascripts/")]);return smalltalk.send($rec, "_defaultCommitPathSt_", [unescape("smalltalk/")]);})((smalltalk.Package || Package));
  925. return self;}
  926. }),
  927. smalltalk.PackageWithDefaultCommitPathChangedTest);
  928. smalltalk.addMethod(
  929. "_testGrulCommitPathJsShouldBeServerGrulJs",
  930. smalltalk.method({
  931. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  932. fn: function () {
  933. var self=this;
  934. smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  935. return self;}
  936. }),
  937. smalltalk.PackageWithDefaultCommitPathChangedTest);
  938. smalltalk.addMethod(
  939. "_testGrulCommitPathStShouldBeGrulSt",
  940. smalltalk.method({
  941. selector: "testGrulCommitPathStShouldBeGrulSt",
  942. fn: function () {
  943. var self=this;
  944. smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  945. return self;}
  946. }),
  947. smalltalk.PackageWithDefaultCommitPathChangedTest);
  948. smalltalk.addMethod(
  949. "_testZorkCommitPathJsShouldBeJavascript",
  950. smalltalk.method({
  951. selector: "testZorkCommitPathJsShouldBeJavascript",
  952. fn: function () {
  953. var self=this;
  954. smalltalk.send(self, "_assert_equals_", [unescape("javascripts/"), smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  955. return self;}
  956. }),
  957. smalltalk.PackageWithDefaultCommitPathChangedTest);
  958. smalltalk.addMethod(
  959. "_testZorkCommitPathStShouldBeSmalltalk",
  960. smalltalk.method({
  961. selector: "testZorkCommitPathStShouldBeSmalltalk",
  962. fn: function () {
  963. var self=this;
  964. smalltalk.send(self, "_assert_equals_", [unescape("smalltalk/"), smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  965. return self;}
  966. }),
  967. smalltalk.PackageWithDefaultCommitPathChangedTest);
  968. smalltalk.addMethod(
  969. "_shouldInheritSelectors",
  970. smalltalk.method({
  971. selector: "shouldInheritSelectors",
  972. fn: function () {
  973. var self=this;
  974. return false;
  975. return self;}
  976. }),
  977. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  978. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  979. smalltalk.addMethod(
  980. "_testAccessing",
  981. smalltalk.method({
  982. selector: "testAccessing",
  983. fn: function () {
  984. var self=this;
  985. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_x", []), (3)]);
  986. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_y", []), (4)]);
  987. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_x_", [(3)]), "_x", []), (3)]);
  988. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_y_", [(4)]), "_y", []), (4)]);
  989. return self;}
  990. }),
  991. smalltalk.PointTest);
  992. smalltalk.addMethod(
  993. "_testArithmetic",
  994. smalltalk.method({
  995. selector: "testArithmetic",
  996. fn: function () {
  997. var self=this;
  998. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver *smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__star", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(9), (16)])]);
  999. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver +smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__plus", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(6), (8)])]);
  1000. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver -smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__minus", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(0), (0)])]);
  1001. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((6), "__at", [(8)])).klass === smalltalk.Number) ? $receiver /smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__slash", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(2), (2)])]);
  1002. return self;}
  1003. }),
  1004. smalltalk.PointTest);
  1005. smalltalk.addMethod(
  1006. "_testAt",
  1007. smalltalk.method({
  1008. selector: "testAt",
  1009. fn: function () {
  1010. var self=this;
  1011. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(4)]), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)])]);
  1012. return self;}
  1013. }),
  1014. smalltalk.PointTest);
  1015. smalltalk.addMethod(
  1016. "_testEgality",
  1017. smalltalk.method({
  1018. selector: "testEgality",
  1019. fn: function () {
  1020. var self=this;
  1021. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "__at", [(4)]), "__eq", [smalltalk.send((3), "__at", [(4)])])]);
  1022. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((3), "__at", [(5)]), "__eq", [smalltalk.send((3), "__at", [(6)])])]);
  1023. return self;}
  1024. }),
  1025. smalltalk.PointTest);
  1026. smalltalk.addMethod(
  1027. "_testTranslateBy",
  1028. smalltalk.method({
  1029. selector: "testTranslateBy",
  1030. fn: function () {
  1031. var self=this;
  1032. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(4)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((0), "__at", [(1)])])]);
  1033. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(2)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((0), "__at", [smalltalk.send((1), "_negated", [])])])]);
  1034. smalltalk.send(self, "_assert_equals_", [smalltalk.send((5), "__at", [(6)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((2), "__at", [(3)])])]);
  1035. smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "__at", [(3)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__at", [(0)])])]);
  1036. return self;}
  1037. }),
  1038. smalltalk.PointTest);
  1039. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1040. smalltalk.addMethod(
  1041. "_textNext",
  1042. smalltalk.method({
  1043. selector: "textNext",
  1044. fn: function () {
  1045. var self=this;
  1046. smalltalk.send((10000), "_timesRepeat_", [(function(){var current=nil;
  1047. var next=nil;
  1048. (next=smalltalk.send(smalltalk.send((smalltalk.Random || Random), "_new", []), "_next", []));smalltalk.send(self, "_assert_", [((($receiver = next).klass === smalltalk.Number) ? $receiver >=(0) : smalltalk.send($receiver, "__gt_eq", [(0)]))]);smalltalk.send(self, "_assert_", [((($receiver = next).klass === smalltalk.Number) ? $receiver <(1) : smalltalk.send($receiver, "__lt", [(1)]))]);smalltalk.send(self, "_deny_", [smalltalk.send(current, "__eq", [next])]);return smalltalk.send(next, "__eq", [current]);})]);
  1049. return self;}
  1050. }),
  1051. smalltalk.RandomTest);
  1052. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1053. smalltalk.addMethod(
  1054. "_testAddRemove",
  1055. smalltalk.method({
  1056. selector: "testAddRemove",
  1057. fn: function () {
  1058. var self=this;
  1059. var set=nil;
  1060. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1061. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_isEmpty", [])]);
  1062. smalltalk.send(set, "_add_", [(3)]);
  1063. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(3)])]);
  1064. smalltalk.send(set, "_add_", [(5)]);
  1065. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(5)])]);
  1066. smalltalk.send(set, "_remove_", [(3)]);
  1067. smalltalk.send(self, "_deny_", [smalltalk.send(set, "_includes_", [(3)])]);
  1068. return self;}
  1069. }),
  1070. smalltalk.SetTest);
  1071. smalltalk.addMethod(
  1072. "_testAt",
  1073. smalltalk.method({
  1074. selector: "testAt",
  1075. fn: function () {
  1076. var self=this;
  1077. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_at_put_", [(1), (2)]);}), (smalltalk.Error || Error)]);
  1078. return self;}
  1079. }),
  1080. smalltalk.SetTest);
  1081. smalltalk.addMethod(
  1082. "_testSize",
  1083. smalltalk.method({
  1084. selector: "testSize",
  1085. fn: function () {
  1086. var self=this;
  1087. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_size", []), (0)]);
  1088. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (2), (3), (4)]]), "_size", []), (4)]);
  1089. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (1), (1), (1)]]), "_size", []), (1)]);
  1090. return self;}
  1091. }),
  1092. smalltalk.SetTest);
  1093. smalltalk.addMethod(
  1094. "_testUnicity",
  1095. smalltalk.method({
  1096. selector: "testUnicity",
  1097. fn: function () {
  1098. var self=this;
  1099. var set=nil;
  1100. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1101. smalltalk.send(set, "_add_", [(21)]);
  1102. smalltalk.send(set, "_add_", ["hello"]);
  1103. smalltalk.send(set, "_add_", [(21)]);
  1104. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
  1105. smalltalk.send(set, "_add_", ["hello"]);
  1106. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
  1107. smalltalk.send(self, "_assert_equals_", [smalltalk.send(set, "_asArray", []), [(21), "hello"]]);
  1108. return self;}
  1109. }),
  1110. smalltalk.SetTest);
  1111. smalltalk.addClass('StringTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1112. smalltalk.addMethod(
  1113. "_testAddRemove",
  1114. smalltalk.method({
  1115. selector: "testAddRemove",
  1116. fn: function () {
  1117. var self=this;
  1118. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_add_", ["a"]);}), (smalltalk.Error || Error)]);
  1119. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_remove_", ["h"]);}), (smalltalk.Error || Error)]);
  1120. return self;}
  1121. }),
  1122. smalltalk.StringTest);
  1123. smalltalk.addMethod(
  1124. "_testAsArray",
  1125. smalltalk.method({
  1126. selector: "testAsArray",
  1127. fn: function () {
  1128. var self=this;
  1129. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_asArray", []), "__eq", [["h", "e", "l", "l", "o"]])]);
  1130. return self;}
  1131. }),
  1132. smalltalk.StringTest);
  1133. smalltalk.addMethod(
  1134. "_testAt",
  1135. smalltalk.method({
  1136. selector: "testAt",
  1137. fn: function () {
  1138. var self=this;
  1139. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(1)]), "__eq", ["h"])]);
  1140. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(5)]), "__eq", ["o"])]);
  1141. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  1142. return self;}
  1143. }),
  1144. smalltalk.StringTest);
  1145. smalltalk.addMethod(
  1146. "_testAtPut",
  1147. smalltalk.method({
  1148. selector: "testAtPut",
  1149. fn: function () {
  1150. var self=this;
  1151. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  1152. return self;}
  1153. }),
  1154. smalltalk.StringTest);
  1155. smalltalk.addMethod(
  1156. "_testCopyWithoutAll",
  1157. smalltalk.method({
  1158. selector: "testCopyWithoutAll",
  1159. fn: function () {
  1160. var self=this;
  1161. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send(unescape("*hello*%20*world*"), "_copyWithoutAll_", [unescape("*")])]);
  1162. return self;}
  1163. }),
  1164. smalltalk.StringTest);
  1165. smalltalk.addMethod(
  1166. "_testEquality",
  1167. smalltalk.method({
  1168. selector: "testEquality",
  1169. fn: function () {
  1170. var self=this;
  1171. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", ["hello"])]);
  1172. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", ["world"])]);
  1173. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", [smalltalk.send("hello", "_yourself", [])])]);
  1174. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq", ["hello"])]);
  1175. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  1176. return self;}
  1177. }),
  1178. smalltalk.StringTest);
  1179. smalltalk.addMethod(
  1180. "_testIncludesSubString",
  1181. smalltalk.method({
  1182. selector: "testIncludesSubString",
  1183. fn: function () {
  1184. var self=this;
  1185. smalltalk.send(self, "_assert_", [smalltalk.send("amber", "_includesSubString_", ["ber"])]);
  1186. smalltalk.send(self, "_deny_", [smalltalk.send("amber", "_includesSubString_", ["zork"])]);
  1187. return self;}
  1188. }),
  1189. smalltalk.StringTest);
  1190. smalltalk.addMethod(
  1191. "_testJoin",
  1192. smalltalk.method({
  1193. selector: "testJoin",
  1194. fn: function () {
  1195. var self=this;
  1196. smalltalk.send(self, "_assert_equals_", [unescape("hello%2Cworld"), smalltalk.send(unescape("%2C"), "_join_", [["hello", "world"]])]);
  1197. return self;}
  1198. }),
  1199. smalltalk.StringTest);
  1200. smalltalk.addMethod(
  1201. "_testSize",
  1202. smalltalk.method({
  1203. selector: "testSize",
  1204. fn: function () {
  1205. var self=this;
  1206. smalltalk.send(self, "_assert_equals_", [smalltalk.send("smalltalk", "_size", []), (9)]);
  1207. smalltalk.send(self, "_assert_equals_", [smalltalk.send("", "_size", []), (0)]);
  1208. return self;}
  1209. }),
  1210. smalltalk.StringTest);
  1211. smalltalk.addMethod(
  1212. "_testStreamContents",
  1213. smalltalk.method({
  1214. selector: "testStreamContents",
  1215. fn: function () {
  1216. var self=this;
  1217. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(aStream){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["hello"]);smalltalk.send($rec, "_space", []);return smalltalk.send($rec, "_nextPutAll_", ["world"]);})(aStream);})])]);
  1218. return self;}
  1219. }),
  1220. smalltalk.StringTest);
  1221. smalltalk.addClass('SymbolTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1222. smalltalk.addMethod(
  1223. "_testAsString",
  1224. smalltalk.method({
  1225. selector: "testAsString",
  1226. fn: function () {
  1227. var self=this;
  1228. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "hello"]);
  1229. return self;}
  1230. }),
  1231. smalltalk.SymbolTest);
  1232. smalltalk.addMethod(
  1233. "_testAsSymbol",
  1234. smalltalk.method({
  1235. selector: "testAsSymbol",
  1236. fn: function () {
  1237. var self=this;
  1238. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_asSymbol", [])])]);
  1239. return self;}
  1240. }),
  1241. smalltalk.SymbolTest);
  1242. smalltalk.addMethod(
  1243. "_testAt",
  1244. smalltalk.method({
  1245. selector: "testAt",
  1246. fn: function () {
  1247. var self=this;
  1248. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(1)]), "__eq", ["h"])]);
  1249. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(5)]), "__eq", ["o"])]);
  1250. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  1251. return self;}
  1252. }),
  1253. smalltalk.SymbolTest);
  1254. smalltalk.addMethod(
  1255. "_testAtPut",
  1256. smalltalk.method({
  1257. selector: "testAtPut",
  1258. fn: function () {
  1259. var self=this;
  1260. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  1261. return self;}
  1262. }),
  1263. smalltalk.SymbolTest);
  1264. smalltalk.addMethod(
  1265. "_testComparing",
  1266. smalltalk.method({
  1267. selector: "testComparing",
  1268. fn: function () {
  1269. var self=this;
  1270. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("aa")]))]);
  1271. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("ba")]))]);
  1272. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
  1273. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
  1274. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("aa")]))]);
  1275. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("ba")]))]);
  1276. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
  1277. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
  1278. return self;}
  1279. }),
  1280. smalltalk.SymbolTest);
  1281. smalltalk.addMethod(
  1282. "_testCopying",
  1283. smalltalk.method({
  1284. selector: "testCopying",
  1285. fn: function () {
  1286. var self=this;
  1287. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_copy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1288. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_deepCopy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1289. return self;}
  1290. }),
  1291. smalltalk.SymbolTest);
  1292. smalltalk.addMethod(
  1293. "_testEquality",
  1294. smalltalk.method({
  1295. selector: "testEquality",
  1296. fn: function () {
  1297. var self=this;
  1298. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("hello")])]);
  1299. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("world")])]);
  1300. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1301. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.symbolFor("hello")])]);
  1302. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", ["hello"])]);
  1303. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", [smalltalk.symbolFor("hello")])]);
  1304. return self;}
  1305. }),
  1306. smalltalk.SymbolTest);
  1307. smalltalk.addMethod(
  1308. "_testIdentity",
  1309. smalltalk.method({
  1310. selector: "testIdentity",
  1311. fn: function () {
  1312. var self=this;
  1313. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1314. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("world")])]);
  1315. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1316. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "_asSymbol", [])])]);
  1317. return self;}
  1318. }),
  1319. smalltalk.SymbolTest);
  1320. smalltalk.addMethod(
  1321. "_testIsSymbolIsString",
  1322. smalltalk.method({
  1323. selector: "testIsSymbolIsString",
  1324. fn: function () {
  1325. var self=this;
  1326. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isSymbol", [])]);
  1327. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "_isSymbol", [])]);
  1328. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isString", [])]);
  1329. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "_isString", [])]);
  1330. return self;}
  1331. }),
  1332. smalltalk.SymbolTest);
  1333. smalltalk.addMethod(
  1334. "_testSize",
  1335. smalltalk.method({
  1336. selector: "testSize",
  1337. fn: function () {
  1338. var self=this;
  1339. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("a"), "_size", []), (1)]);
  1340. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("aaaaa"), "_size", []), (5)]);
  1341. return self;}
  1342. }),
  1343. smalltalk.SymbolTest);
  1344. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1345. smalltalk.addMethod(
  1346. "_testCopying",
  1347. smalltalk.method({
  1348. selector: "testCopying",
  1349. fn: function () {
  1350. var self=this;
  1351. smalltalk.send(self, "_assert_equals_", [smalltalk.send(nil, "_copy", []), nil]);
  1352. return self;}
  1353. }),
  1354. smalltalk.UndefinedTest);
  1355. smalltalk.addMethod(
  1356. "_testDeepCopy",
  1357. smalltalk.method({
  1358. selector: "testDeepCopy",
  1359. fn: function () {
  1360. var self=this;
  1361. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(nil, "_deepCopy", []), "__eq", [nil])]);
  1362. return self;}
  1363. }),
  1364. smalltalk.UndefinedTest);
  1365. smalltalk.addMethod(
  1366. "_testIfNil",
  1367. smalltalk.method({
  1368. selector: "testIfNil",
  1369. fn: function () {
  1370. var self=this;
  1371. smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, true]);
  1372. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
  1373. smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : (function(){return false;})(), true]);
  1374. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  1375. return self;}
  1376. }),
  1377. smalltalk.UndefinedTest);
  1378. smalltalk.addMethod(
  1379. "_testIsNil",
  1380. smalltalk.method({
  1381. selector: "testIsNil",
  1382. fn: function () {
  1383. var self=this;
  1384. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "_isNil", [])]);
  1385. smalltalk.send(self, "_deny_", [smalltalk.send(nil, "_notNil", [])]);
  1386. return self;}
  1387. }),
  1388. smalltalk.UndefinedTest);