Kernel-Tests.deploy.js 70 KB

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