Kernel-Tests.deploy.js 74 KB

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