Kernel-Tests.deploy.js 83 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. "_testCompiledSource",
  5. smalltalk.method({
  6. selector: "testCompiledSource",
  7. fn: function () {
  8. var self = this;
  9. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(function () {return smalltalk.send(1, "__plus", [1]);}, "_compiledSource", []), "_includesSubString_", ["function"])]);
  10. return self;
  11. }
  12. }),
  13. smalltalk.BlockClosureTest);
  14. smalltalk.addMethod(
  15. "_testEnsure",
  16. smalltalk.method({
  17. selector: "testEnsure",
  18. fn: function () {
  19. var self = this;
  20. smalltalk.send(self, "_assert_", [smalltalk.send(function () {return smalltalk.send(smalltalk.Error || Error, "_new", []);}, "_ensure_", [function () {return true;}])]);
  21. return self;
  22. }
  23. }),
  24. smalltalk.BlockClosureTest);
  25. smalltalk.addMethod(
  26. "_testNumArgs",
  27. smalltalk.method({
  28. selector: "testNumArgs",
  29. fn: function () {
  30. var self = this;
  31. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function () {}, "_numArgs", []), 0]);
  32. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function (a, b) {}, "_numArgs", []), 2]);
  33. return self;
  34. }
  35. }),
  36. smalltalk.BlockClosureTest);
  37. smalltalk.addMethod(
  38. "_testOnDo",
  39. smalltalk.method({
  40. selector: "testOnDo",
  41. fn: function () {
  42. var self = this;
  43. 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;}])]);
  44. return self;
  45. }
  46. }),
  47. smalltalk.BlockClosureTest);
  48. smalltalk.addMethod(
  49. "_testValue",
  50. smalltalk.method({
  51. selector: "testValue",
  52. fn: function () {
  53. var self = this;
  54. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function () {return smalltalk.send(1, "__plus", [1]);}, "_value", []), 2]);
  55. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function (x) {return smalltalk.send(x, "__plus", [1]);}, "_value_", [2]), 3]);
  56. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function (x, y) {return smalltalk.send(x, "__star", [y]);}, "_value_value_", [2, 4]), 8]);
  57. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function (a, b, c) {return 1;}, "_value", []), 1]);
  58. return self;
  59. }
  60. }),
  61. smalltalk.BlockClosureTest);
  62. smalltalk.addMethod(
  63. "_testValueWithPossibleArguments",
  64. smalltalk.method({
  65. selector: "testValueWithPossibleArguments",
  66. fn: function () {
  67. var self = this;
  68. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function () {return 1;}, "_valueWithPossibleArguments_", [[3, 4]]), 1]);
  69. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function (a) {return smalltalk.send(a, "__plus", [4]);}, "_valueWithPossibleArguments_", [[3, 4]]), 7]);
  70. smalltalk.send(self, "_assert_equals_", [smalltalk.send(function (a, b) {return smalltalk.send(a, "__plus", [b]);}, "_valueWithPossibleArguments_", [[3, 4, 5]]), 7]);
  71. return self;
  72. }
  73. }),
  74. smalltalk.BlockClosureTest);
  75. smalltalk.addMethod(
  76. "_testWhileFalse",
  77. smalltalk.method({
  78. selector: "testWhileFalse",
  79. fn: function () {
  80. var self = this;
  81. var i;
  82. i = 0;
  83. smalltalk.send(function () {return smalltalk.send(i, "__gt", [5]);}, "_whileFalse_", [function () {i = smalltalk.send(i, "__plus", [1]);return i;}]);
  84. smalltalk.send(self, "_assert_equals_", [i, 6]);
  85. i = 0;
  86. smalltalk.send(function () {i = smalltalk.send(i, "__plus", [1]);i;return smalltalk.send(i, "__gt", [5]);}, "_whileFalse", []);
  87. smalltalk.send(self, "_assert_equals_", [i, 6]);
  88. return self;
  89. }
  90. }),
  91. smalltalk.BlockClosureTest);
  92. smalltalk.addMethod(
  93. "_testWhileTrue",
  94. smalltalk.method({
  95. selector: "testWhileTrue",
  96. fn: function () {
  97. var self = this;
  98. var i;
  99. i = 0;
  100. smalltalk.send(function () {return smalltalk.send(i, "__lt", [5]);}, "_whileTrue_", [function () {i = smalltalk.send(i, "__plus", [1]);return i;}]);
  101. smalltalk.send(self, "_assert_equals_", [i, 5]);
  102. i = 0;
  103. smalltalk.send(function () {i = smalltalk.send(i, "__plus", [1]);i;return smalltalk.send(i, "__lt", [5]);}, "_whileTrue", []);
  104. smalltalk.send(self, "_assert_equals_", [i, 5]);
  105. return self;
  106. }
  107. }),
  108. smalltalk.BlockClosureTest);
  109. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  110. smalltalk.addMethod(
  111. "_testEquality",
  112. smalltalk.method({
  113. selector: "testEquality",
  114. fn: function () {
  115. var self = this;
  116. smalltalk.send(self, "_deny_", [smalltalk.send(0, "__eq", [false])]);
  117. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [0])]);
  118. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [false])]);
  119. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [""])]);
  120. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq", [true])]);
  121. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [true])]);
  122. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq", [false])]);
  123. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq", [false])]);
  124. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [true])]);
  125. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [smalltalk.send(true, "_yourself", [])])]);
  126. return self;
  127. }
  128. }),
  129. smalltalk.BooleanTest);
  130. smalltalk.addMethod(
  131. "_testIdentity",
  132. smalltalk.method({
  133. selector: "testIdentity",
  134. fn: function () {
  135. var self = this;
  136. smalltalk.send(self, "_deny_", [smalltalk.send(0, "__eq_eq", [false])]);
  137. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [0])]);
  138. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq_eq", [false])]);
  139. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [""])]);
  140. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq_eq", [true])]);
  141. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [true])]);
  142. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq_eq", [false])]);
  143. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq_eq", [false])]);
  144. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [true])]);
  145. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [smalltalk.send(true, "_yourself", [])])]);
  146. return self;
  147. }
  148. }),
  149. smalltalk.BooleanTest);
  150. smalltalk.addMethod(
  151. "_testIfTrueIfFalse",
  152. smalltalk.method({
  153. selector: "testIfTrueIfFalse",
  154. fn: function () {
  155. var self = this;
  156. var $1, $2, $3, $4, $5, $6, $7, $8;
  157. if (smalltalk.assert(true)) {
  158. $1 = "alternative block";
  159. }
  160. smalltalk.send(self, "_assert_", [smalltalk.send($1, "__eq", ["alternative block"])]);
  161. if (!smalltalk.assert(true)) {
  162. $2 = "alternative block";
  163. }
  164. smalltalk.send(self, "_assert_", [smalltalk.send($2, "__eq", [nil])]);
  165. if (smalltalk.assert(false)) {
  166. $3 = "alternative block";
  167. }
  168. smalltalk.send(self, "_assert_", [smalltalk.send($3, "__eq", [nil])]);
  169. if (!smalltalk.assert(false)) {
  170. $4 = "alternative block";
  171. }
  172. smalltalk.send(self, "_assert_", [smalltalk.send($4, "__eq", ["alternative block"])]);
  173. if (smalltalk.assert(false)) {
  174. $5 = "alternative block";
  175. } else {
  176. $5 = "alternative block2";
  177. }
  178. smalltalk.send(self, "_assert_", [smalltalk.send($5, "__eq", ["alternative block2"])]);
  179. if (smalltalk.assert(false)) {
  180. $6 = "alternative block2";
  181. } else {
  182. $6 = "alternative block";
  183. }
  184. smalltalk.send(self, "_assert_", [smalltalk.send($6, "__eq", ["alternative block"])]);
  185. if (smalltalk.assert(true)) {
  186. $7 = "alternative block";
  187. } else {
  188. $7 = "alternative block2";
  189. }
  190. smalltalk.send(self, "_assert_", [smalltalk.send($7, "__eq", ["alternative block"])]);
  191. if (smalltalk.assert(true)) {
  192. $8 = "alternative block2";
  193. } else {
  194. $8 = "alternative block";
  195. }
  196. smalltalk.send(self, "_assert_", [smalltalk.send($8, "__eq", ["alternative block2"])]);
  197. return self;
  198. }
  199. }),
  200. smalltalk.BooleanTest);
  201. smalltalk.addMethod(
  202. "_testLogic",
  203. smalltalk.method({
  204. selector: "testLogic",
  205. fn: function () {
  206. var self = this;
  207. var $1, $2, $3, $4;
  208. smalltalk.send(self, "_assert_", [smalltalk.send(true, "_&", [true])]);
  209. smalltalk.send(self, "_deny_", [smalltalk.send(true, "_&", [false])]);
  210. smalltalk.send(self, "_deny_", [smalltalk.send(false, "_&", [true])]);
  211. $1 = smalltalk.send(self, "_deny_", [smalltalk.send(false, "_&", [false])]);
  212. smalltalk.send(self, "_assert_", [smalltalk.send(true, "_|", [true])]);
  213. smalltalk.send(self, "_assert_", [smalltalk.send(true, "_|", [false])]);
  214. smalltalk.send(self, "_assert_", [smalltalk.send(false, "_|", [true])]);
  215. $2 = smalltalk.send(self, "_deny_", [smalltalk.send(false, "_|", [false])]);
  216. smalltalk.send(self, "_assert_", [smalltalk.send(true, "_&", [smalltalk.send(1, "__gt", [0])])]);
  217. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(1, "__gt", [0]), "_&", [false])]);
  218. $3 = smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(1, "__gt", [0]), "_&", [smalltalk.send(1, "__gt", [2])])]);
  219. smalltalk.send(self, "_assert_", [smalltalk.send(false, "_|", [smalltalk.send(1, "__gt", [0])])]);
  220. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "__gt", [0]), "_|", [false])]);
  221. $4 = smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "__gt", [0]), "_|", [smalltalk.send(1, "__gt", [2])])]);
  222. return self;
  223. }
  224. }),
  225. smalltalk.BooleanTest);
  226. smalltalk.addMethod(
  227. "_testLogicKeywords",
  228. smalltalk.method({
  229. selector: "testLogicKeywords",
  230. fn: function () {
  231. var self = this;
  232. var $1, $2, $3, $4;
  233. smalltalk.send(self, "_assert_", [smalltalk.send(true, "_and_", [function () {return true;}])]);
  234. smalltalk.send(self, "_deny_", [smalltalk.send(true, "_and_", [function () {return false;}])]);
  235. smalltalk.send(self, "_deny_", [smalltalk.send(false, "_and_", [function () {return true;}])]);
  236. $1 = smalltalk.send(self, "_deny_", [smalltalk.send(false, "_and_", [function () {return false;}])]);
  237. smalltalk.send(self, "_assert_", [smalltalk.send(true, "_or_", [function () {return true;}])]);
  238. smalltalk.send(self, "_assert_", [smalltalk.send(true, "_or_", [function () {return false;}])]);
  239. smalltalk.send(self, "_assert_", [smalltalk.send(false, "_or_", [function () {return true;}])]);
  240. $2 = smalltalk.send(self, "_deny_", [smalltalk.send(false, "_or_", [function () {return false;}])]);
  241. smalltalk.send(self, "_assert_", [smalltalk.send(true, "_and_", [function () {return smalltalk.send(1, "__gt", [0]);}])]);
  242. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(1, "__gt", [0]), "_and_", [function () {return false;}])]);
  243. $3 = smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(1, "__gt", [0]), "_and_", [function () {return smalltalk.send(1, "__gt", [2]);}])]);
  244. smalltalk.send(self, "_assert_", [smalltalk.send(false, "_or_", [function () {return smalltalk.send(1, "__gt", [0]);}])]);
  245. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "__gt", [0]), "_or_", [function () {return false;}])]);
  246. $4 = smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "__gt", [0]), "_or_", [function () {return smalltalk.send(1, "__gt", [2]);}])]);
  247. return self;
  248. }
  249. }),
  250. smalltalk.BooleanTest);
  251. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  252. smalltalk.addMethod(
  253. "_setUp",
  254. smalltalk.method({
  255. selector: "setUp",
  256. fn: function () {
  257. var self = this;
  258. self['@builder'] = smalltalk.send(smalltalk.ClassBuilder || ClassBuilder, "_new", []);
  259. return self;
  260. }
  261. }),
  262. smalltalk.ClassBuilderTest);
  263. smalltalk.addMethod(
  264. "_tearDown",
  265. smalltalk.method({
  266. selector: "tearDown",
  267. fn: function () {
  268. var self = this;
  269. if (($receiver = self['@theClass']) == nil || $receiver == undefined) {
  270. self['@theClass'];
  271. } else {
  272. smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_removeClass_", [self['@theClass']]);
  273. self['@theClass'] = nil;
  274. self['@theClass'];
  275. }
  276. return self;
  277. }
  278. }),
  279. smalltalk.ClassBuilderTest);
  280. smalltalk.addMethod(
  281. "_testClassCopy",
  282. smalltalk.method({
  283. selector: "testClassCopy",
  284. fn: function () {
  285. var self = this;
  286. self['@theClass'] = smalltalk.send(self['@builder'], "_copyClass_named_", [smalltalk.ObjectMock || ObjectMock, "ObjectMock2"]);
  287. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_superclass", []), "__eq_eq", [smalltalk.send(smalltalk.ObjectMock || ObjectMock, "_superclass", [])])]);
  288. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_instanceVariableNames", []), "__eq_eq", [smalltalk.send(smalltalk.ObjectMock || ObjectMock, "_instanceVariableNames", [])])]);
  289. smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@theClass'], "_name", []), "ObjectMock2"]);
  290. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_package", []), "__eq_eq", [smalltalk.send(smalltalk.ObjectMock || ObjectMock, "_package", [])])]);
  291. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self['@theClass'], "_methodDictionary", []), "_keys", []), smalltalk.send(smalltalk.send(smalltalk.ObjectMock || ObjectMock, "_methodDictionary", []), "_keys", [])]);
  292. return self;
  293. }
  294. }),
  295. smalltalk.ClassBuilderTest);
  296. smalltalk.addMethod(
  297. "_testInstanceVariableNames",
  298. smalltalk.method({
  299. selector: "testInstanceVariableNames",
  300. fn: function () {
  301. var self = this;
  302. smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@builder'], "_instanceVariableNamesFor_", [" hello world "]), ["hello", "world"]]);
  303. return self;
  304. }
  305. }),
  306. smalltalk.ClassBuilderTest);
  307. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  308. smalltalk.addMethod(
  309. "_assertSameContents_as_",
  310. smalltalk.method({
  311. selector: "assertSameContents:as:",
  312. fn: function (aCollection, anotherCollection) {
  313. var self = this;
  314. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(aCollection, "_size", []), "__eq", [smalltalk.send(anotherCollection, "_size", [])])]);
  315. smalltalk.send(aCollection, "_do_", [function (each) {return smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(aCollection, "_occurrencesOf_", [each]), "__eq", [smalltalk.send(anotherCollection, "_occurrencesOf_", [each])])]);}]);
  316. return self;
  317. }
  318. }),
  319. smalltalk.CollectionTest);
  320. smalltalk.addMethod(
  321. "_collection",
  322. smalltalk.method({
  323. selector: "collection",
  324. fn: function () {
  325. var self = this;
  326. var $1;
  327. $1 = smalltalk.send(smalltalk.send(self, "_collectionClass", []), "_withAll_", [smalltalk.send(self, "_defaultValues", [])]);
  328. return $1;
  329. }
  330. }),
  331. smalltalk.CollectionTest);
  332. smalltalk.addMethod(
  333. "_collectionClass",
  334. smalltalk.method({
  335. selector: "collectionClass",
  336. fn: function () {
  337. var self = this;
  338. var $1;
  339. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_collectionClass", []);
  340. return $1;
  341. }
  342. }),
  343. smalltalk.CollectionTest);
  344. smalltalk.addMethod(
  345. "_collectionWithDuplicates",
  346. smalltalk.method({
  347. selector: "collectionWithDuplicates",
  348. fn: function () {
  349. var self = this;
  350. var $1;
  351. $1 = smalltalk.send(smalltalk.send(self, "_collectionClass", []), "_withAll_", [["a", "b", "c", 1, 2, 1, "a"]]);
  352. return $1;
  353. }
  354. }),
  355. smalltalk.CollectionTest);
  356. smalltalk.addMethod(
  357. "_defaultValues",
  358. smalltalk.method({
  359. selector: "defaultValues",
  360. fn: function () {
  361. var self = this;
  362. return [1, 2, 3, -4];
  363. }
  364. }),
  365. smalltalk.CollectionTest);
  366. smalltalk.addMethod(
  367. "_isCollectionReadOnly",
  368. smalltalk.method({
  369. selector: "isCollectionReadOnly",
  370. fn: function () {
  371. var self = this;
  372. return false;
  373. }
  374. }),
  375. smalltalk.CollectionTest);
  376. smalltalk.addMethod(
  377. "_testAsArray",
  378. smalltalk.method({
  379. selector: "testAsArray",
  380. fn: function () {
  381. var self = this;
  382. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(self, "_collection", []), smalltalk.send(smalltalk.send(self, "_collection", []), "_asArray", [])]);
  383. return self;
  384. }
  385. }),
  386. smalltalk.CollectionTest);
  387. smalltalk.addMethod(
  388. "_testAsOrderedCollection",
  389. smalltalk.method({
  390. selector: "testAsOrderedCollection",
  391. fn: function () {
  392. var self = this;
  393. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(self, "_collection", []), smalltalk.send(smalltalk.send(self, "_collection", []), "_asOrderedCollection", [])]);
  394. return self;
  395. }
  396. }),
  397. smalltalk.CollectionTest);
  398. smalltalk.addMethod(
  399. "_testAsSet",
  400. smalltalk.method({
  401. selector: "testAsSet",
  402. fn: function () {
  403. var self = this;
  404. var c;
  405. var set;
  406. c = smalltalk.send(self, "_collectionWithDuplicates", []);
  407. set = smalltalk.send(c, "_asSet", []);
  408. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [5])]);
  409. smalltalk.send(c, "_do_", [function (each) {return smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [each])]);}]);
  410. return self;
  411. }
  412. }),
  413. smalltalk.CollectionTest);
  414. smalltalk.addMethod(
  415. "_testCollect",
  416. smalltalk.method({
  417. selector: "testCollect",
  418. fn: function () {
  419. var self = this;
  420. var newCollection;
  421. newCollection = [1, 2, 3, 4];
  422. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_collect_", [function (each) {return smalltalk.send(each, "_abs", []);}]), newCollection]);
  423. return self;
  424. }
  425. }),
  426. smalltalk.CollectionTest);
  427. smalltalk.addMethod(
  428. "_testDetect",
  429. smalltalk.method({
  430. selector: "testDetect",
  431. fn: function () {
  432. var self = this;
  433. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_detect_", [function (each) {return smalltalk.send(each, "__lt", [0]);}]), "__eq", [-4])]);
  434. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(smalltalk.send(self, "_collection", []), "_detect_", [function (each) {return smalltalk.send(each, "__eq", [6]);}]);}, smalltalk.Error || Error]);
  435. return self;
  436. }
  437. }),
  438. smalltalk.CollectionTest);
  439. smalltalk.addMethod(
  440. "_testDo",
  441. smalltalk.method({
  442. selector: "testDo",
  443. fn: function () {
  444. var self = this;
  445. var newCollection;
  446. newCollection = smalltalk.send(smalltalk.OrderedCollection || OrderedCollection, "_new", []);
  447. smalltalk.send(smalltalk.send(self, "_collection", []), "_do_", [function (each) {return smalltalk.send(newCollection, "_add_", [each]);}]);
  448. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(self, "_collection", []), newCollection]);
  449. return self;
  450. }
  451. }),
  452. smalltalk.CollectionTest);
  453. smalltalk.addMethod(
  454. "_testIsEmpty",
  455. smalltalk.method({
  456. selector: "testIsEmpty",
  457. fn: function () {
  458. var self = this;
  459. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collectionClass", []), "_new", []), "_isEmpty", [])]);
  460. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_isEmpty", [])]);
  461. return self;
  462. }
  463. }),
  464. smalltalk.CollectionTest);
  465. smalltalk.addMethod(
  466. "_testSelect",
  467. smalltalk.method({
  468. selector: "testSelect",
  469. fn: function () {
  470. var self = this;
  471. var newCollection;
  472. newCollection = [2, -4];
  473. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_select_", [function (each) {return smalltalk.send(each, "_even", []);}]), newCollection]);
  474. return self;
  475. }
  476. }),
  477. smalltalk.CollectionTest);
  478. smalltalk.addMethod(
  479. "_testSize",
  480. smalltalk.method({
  481. selector: "testSize",
  482. fn: function () {
  483. var self = this;
  484. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_collectionClass", []), "_new", []), "_size", []), "__eq", [0])]);
  485. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_size", []), "__eq", [4])]);
  486. return self;
  487. }
  488. }),
  489. smalltalk.CollectionTest);
  490. smalltalk.addMethod(
  491. "_collectionClass",
  492. smalltalk.method({
  493. selector: "collectionClass",
  494. fn: function () {
  495. var self = this;
  496. return nil;
  497. }
  498. }),
  499. smalltalk.CollectionTest.klass);
  500. smalltalk.addMethod(
  501. "_isAbstract",
  502. smalltalk.method({
  503. selector: "isAbstract",
  504. fn: function () {
  505. var self = this;
  506. var $1;
  507. $1 = smalltalk.send(smalltalk.send(self, "_collectionClass", []), "_isNil", []);
  508. return $1;
  509. }
  510. }),
  511. smalltalk.CollectionTest.klass);
  512. smalltalk.addClass('HashedCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  513. smalltalk.addMethod(
  514. "_collection",
  515. smalltalk.method({
  516. selector: "collection",
  517. fn: function () {
  518. var self = this;
  519. var $1;
  520. $1 = smalltalk.HashedCollection._fromPairs_([smalltalk.send("a", "__minus_gt", [1]), smalltalk.send("b", "__minus_gt", [2]), smalltalk.send("c", "__minus_gt", [3]), smalltalk.send("d", "__minus_gt", [-4])]);
  521. return $1;
  522. }
  523. }),
  524. smalltalk.HashedCollectionTest);
  525. smalltalk.addMethod(
  526. "_collectionWithDuplicates",
  527. smalltalk.method({
  528. selector: "collectionWithDuplicates",
  529. fn: function () {
  530. var self = this;
  531. var $1;
  532. $1 = smalltalk.HashedCollection._fromPairs_([smalltalk.send("a", "__minus_gt", [1]), smalltalk.send("b", "__minus_gt", [2]), smalltalk.send("c", "__minus_gt", [3]), smalltalk.send("d", "__minus_gt", [-4]), smalltalk.send("e", "__minus_gt", [1]), smalltalk.send("f", "__minus_gt", [2]), smalltalk.send("g", "__minus_gt", [10])]);
  533. return $1;
  534. }
  535. }),
  536. smalltalk.HashedCollectionTest);
  537. smalltalk.addMethod(
  538. "_collectionClass",
  539. smalltalk.method({
  540. selector: "collectionClass",
  541. fn: function () {
  542. var self = this;
  543. return smalltalk.HashedCollection || HashedCollection;
  544. }
  545. }),
  546. smalltalk.HashedCollectionTest.klass);
  547. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  548. smalltalk.addMethod(
  549. "_collection",
  550. smalltalk.method({
  551. selector: "collection",
  552. fn: function () {
  553. var self = this;
  554. var $2, $3, $1;
  555. $2 = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  556. smalltalk.send($2, "_at_put_", [1, 1]);
  557. smalltalk.send($2, "_at_put_", ["a", 2]);
  558. smalltalk.send($2, "_at_put_", [true, 3]);
  559. smalltalk.send($2, "_at_put_", [4, -4]);
  560. $3 = smalltalk.send($2, "_yourself", []);
  561. $1 = $3;
  562. return $1;
  563. }
  564. }),
  565. smalltalk.DictionaryTest);
  566. smalltalk.addMethod(
  567. "_collectionWithDuplicates",
  568. smalltalk.method({
  569. selector: "collectionWithDuplicates",
  570. fn: function () {
  571. var self = this;
  572. var $2, $3, $1;
  573. $2 = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  574. smalltalk.send($2, "_at_put_", [1, 1]);
  575. smalltalk.send($2, "_at_put_", ["a", 2]);
  576. smalltalk.send($2, "_at_put_", [true, 3]);
  577. smalltalk.send($2, "_at_put_", [4, -4]);
  578. smalltalk.send($2, "_at_put_", ["b", 1]);
  579. smalltalk.send($2, "_at_put_", [3, 3]);
  580. smalltalk.send($2, "_at_put_", [false, 12]);
  581. $3 = smalltalk.send($2, "_yourself", []);
  582. $1 = $3;
  583. return $1;
  584. }
  585. }),
  586. smalltalk.DictionaryTest);
  587. smalltalk.addMethod(
  588. "_testAccessing",
  589. smalltalk.method({
  590. selector: "testAccessing",
  591. fn: function () {
  592. var self = this;
  593. var d;
  594. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  595. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  596. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", ["hello"]), "__eq", ["world"])]);
  597. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["hello", function () {return nil;}]), "__eq", ["world"])]);
  598. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["foo", function () {return nil;}]), "__eq", ["world"])]);
  599. smalltalk.send(d, "_at_put_", [1, 2]);
  600. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [1]), "__eq", [2])]);
  601. smalltalk.send(d, "_at_put_", [smalltalk.send(1, "__at", [3]), 3]);
  602. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [smalltalk.send(1, "__at", [3])]), "__eq", [3])]);
  603. return self;
  604. }
  605. }),
  606. smalltalk.DictionaryTest);
  607. smalltalk.addMethod(
  608. "_testDynamicDictionaries",
  609. smalltalk.method({
  610. selector: "testDynamicDictionaries",
  611. fn: function () {
  612. var self = this;
  613. 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])])])]);
  614. return self;
  615. }
  616. }),
  617. smalltalk.DictionaryTest);
  618. smalltalk.addMethod(
  619. "_testEquality",
  620. smalltalk.method({
  621. selector: "testEquality",
  622. fn: function () {
  623. var self = this;
  624. var $1, $2, $3, $4, $5, $6, $7, $8, $9, $10;
  625. var d1;
  626. var d2;
  627. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []), "__eq", [smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", [])])]);
  628. $1 = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  629. smalltalk.send($1, "_at_put_", [1, 2]);
  630. $2 = smalltalk.send($1, "_yourself", []);
  631. d1 = $2;
  632. $3 = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  633. smalltalk.send($3, "_at_put_", [1, 2]);
  634. $4 = smalltalk.send($3, "_yourself", []);
  635. d2 = $4;
  636. smalltalk.send(self, "_assert_", [smalltalk.send(d1, "__eq", [d2])]);
  637. $5 = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  638. smalltalk.send($5, "_at_put_", [1, 3]);
  639. $6 = smalltalk.send($5, "_yourself", []);
  640. d2 = $6;
  641. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  642. $7 = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  643. smalltalk.send($7, "_at_put_", [2, 2]);
  644. $8 = smalltalk.send($7, "_yourself", []);
  645. d2 = $8;
  646. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  647. $9 = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  648. smalltalk.send($9, "_at_put_", [1, 2]);
  649. smalltalk.send($9, "_at_put_", [3, 4]);
  650. $10 = smalltalk.send($9, "_yourself", []);
  651. d2 = $10;
  652. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  653. return self;
  654. }
  655. }),
  656. smalltalk.DictionaryTest);
  657. smalltalk.addMethod(
  658. "_testIfAbsent",
  659. smalltalk.method({
  660. selector: "testIfAbsent",
  661. fn: function () {
  662. var self = this;
  663. var d;
  664. var visited;
  665. visited = false;
  666. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  667. smalltalk.send(d, "_at_ifAbsent_", ["hello", function () {visited = true;return visited;}]);
  668. smalltalk.send(self, "_assert_", [visited]);
  669. return self;
  670. }
  671. }),
  672. smalltalk.DictionaryTest);
  673. smalltalk.addMethod(
  674. "_testIfPresent",
  675. smalltalk.method({
  676. selector: "testIfPresent",
  677. fn: function () {
  678. var self = this;
  679. var d;
  680. var visited;
  681. var absent;
  682. visited = false;
  683. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  684. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  685. smalltalk.send(d, "_at_ifPresent_", ["hello", function (value) {visited = value;return visited;}]);
  686. smalltalk.send(self, "_assert_", [smalltalk.send(visited, "__eq", ["world"])]);
  687. absent = smalltalk.send(d, "_at_ifPresent_", ["bye", function (value) {visited = value;return visited;}]);
  688. smalltalk.send(self, "_assert_", [smalltalk.send(absent, "_isNil", [])]);
  689. return self;
  690. }
  691. }),
  692. smalltalk.DictionaryTest);
  693. smalltalk.addMethod(
  694. "_testIfPresentIfAbsent",
  695. smalltalk.method({
  696. selector: "testIfPresentIfAbsent",
  697. fn: function () {
  698. var self = this;
  699. var d;
  700. var visited;
  701. visited = false;
  702. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  703. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  704. smalltalk.send(d, "_at_ifPresent_ifAbsent_", ["hello", function (value) {visited = value;return visited;}, function () {visited = true;return visited;}]);
  705. smalltalk.send(self, "_assert_", [smalltalk.send(visited, "__eq", ["world"])]);
  706. smalltalk.send(d, "_at_ifPresent_ifAbsent_", ["buy", function (value) {visited = value;return visited;}, function () {visited = true;return visited;}]);
  707. smalltalk.send(self, "_assert_", [visited]);
  708. return self;
  709. }
  710. }),
  711. smalltalk.DictionaryTest);
  712. smalltalk.addMethod(
  713. "_testKeys",
  714. smalltalk.method({
  715. selector: "testKeys",
  716. fn: function () {
  717. var self = this;
  718. var d;
  719. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  720. smalltalk.send(d, "_at_put_", [1, 2]);
  721. smalltalk.send(d, "_at_put_", [2, 3]);
  722. smalltalk.send(d, "_at_put_", [3, 4]);
  723. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[1, 2, 3]])]);
  724. return self;
  725. }
  726. }),
  727. smalltalk.DictionaryTest);
  728. smalltalk.addMethod(
  729. "_testPrintString",
  730. smalltalk.method({
  731. selector: "testPrintString",
  732. fn: function () {
  733. var self = this;
  734. var $1, $2;
  735. $1 = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  736. smalltalk.send($1, "_at_put_", ["firstname", "James"]);
  737. smalltalk.send($1, "_at_put_", ["lastname", "Bond"]);
  738. $2 = smalltalk.send($1, "_printString", []);
  739. smalltalk.send(self, "_assert_equals_", ["a Dictionary('firstname'->'James' , 'lastname'->'Bond')", $2]);
  740. return self;
  741. }
  742. }),
  743. smalltalk.DictionaryTest);
  744. smalltalk.addMethod(
  745. "_testRemoveKey",
  746. smalltalk.method({
  747. selector: "testRemoveKey",
  748. fn: function () {
  749. var self = this;
  750. var d;
  751. var key;
  752. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  753. smalltalk.send(d, "_at_put_", [1, 2]);
  754. smalltalk.send(d, "_at_put_", [2, 3]);
  755. smalltalk.send(d, "_at_put_", [3, 4]);
  756. key = 2;
  757. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[1, 2, 3]])]);
  758. smalltalk.send(d, "_removeKey_", [key]);
  759. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[1, 3]])]);
  760. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[2, 4]])]);
  761. smalltalk.send(self, "_deny_", [smalltalk.send(d, "_includesKey_", [2])]);
  762. return self;
  763. }
  764. }),
  765. smalltalk.DictionaryTest);
  766. smalltalk.addMethod(
  767. "_testRemoveKeyIfAbsent",
  768. smalltalk.method({
  769. selector: "testRemoveKeyIfAbsent",
  770. fn: function () {
  771. var self = this;
  772. var d;
  773. var key;
  774. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  775. smalltalk.send(d, "_at_put_", [1, 2]);
  776. smalltalk.send(d, "_at_put_", [2, 3]);
  777. smalltalk.send(d, "_at_put_", [3, 4]);
  778. key = 2;
  779. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_", [key]), "__eq", [3])]);
  780. key = 3;
  781. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_ifAbsent_", [key, function () {return 42;}]), "__eq", [4])]);
  782. key = "why";
  783. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_ifAbsent_", [key, function () {return 42;}]), "__eq", [42])]);
  784. return self;
  785. }
  786. }),
  787. smalltalk.DictionaryTest);
  788. smalltalk.addMethod(
  789. "_testSize",
  790. smalltalk.method({
  791. selector: "testSize",
  792. fn: function () {
  793. var self = this;
  794. var d;
  795. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  796. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [0])]);
  797. smalltalk.send(d, "_at_put_", [1, 2]);
  798. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [1])]);
  799. smalltalk.send(d, "_at_put_", [2, 3]);
  800. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [2])]);
  801. return self;
  802. }
  803. }),
  804. smalltalk.DictionaryTest);
  805. smalltalk.addMethod(
  806. "_testValues",
  807. smalltalk.method({
  808. selector: "testValues",
  809. fn: function () {
  810. var self = this;
  811. var d;
  812. d = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  813. smalltalk.send(d, "_at_put_", [1, 2]);
  814. smalltalk.send(d, "_at_put_", [2, 3]);
  815. smalltalk.send(d, "_at_put_", [3, 4]);
  816. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[2, 3, 4]])]);
  817. return self;
  818. }
  819. }),
  820. smalltalk.DictionaryTest);
  821. smalltalk.addMethod(
  822. "_collectionClass",
  823. smalltalk.method({
  824. selector: "collectionClass",
  825. fn: function () {
  826. var self = this;
  827. return smalltalk.Dictionary || Dictionary;
  828. }
  829. }),
  830. smalltalk.DictionaryTest.klass);
  831. smalltalk.addClass('SequenceableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  832. smalltalk.addMethod(
  833. "_testAt",
  834. smalltalk.method({
  835. selector: "testAt",
  836. fn: function () {
  837. var self = this;
  838. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_at_", [4]), "__eq", [-4])]);
  839. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(smalltalk.send(self, "_collection", []), "_at_", [5]);}, smalltalk.Error || Error]);
  840. return self;
  841. }
  842. }),
  843. smalltalk.SequenceableCollectionTest);
  844. smalltalk.addMethod(
  845. "_testAtIfAbsent",
  846. smalltalk.method({
  847. selector: "testAtIfAbsent",
  848. fn: function () {
  849. var self = this;
  850. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_at_ifAbsent_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_size", []), "__plus", [1]), function () {return "none";}]), "__eq", ["none"])]);
  851. return self;
  852. }
  853. }),
  854. smalltalk.SequenceableCollectionTest);
  855. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  856. smalltalk.addMethod(
  857. "_testAtIfAbsent",
  858. smalltalk.method({
  859. selector: "testAtIfAbsent",
  860. fn: function () {
  861. var self = this;
  862. var array;
  863. array = ["hello", "world"];
  864. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_", [1]), "hello"]);
  865. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_", [2]), "world"]);
  866. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [2, function () {return "not found";}]), "world"]);
  867. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [0, function () {return "not found";}]), "not found"]);
  868. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [-10, function () {return "not found";}]), "not found"]);
  869. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [3, function () {return "not found";}]), "not found"]);
  870. return self;
  871. }
  872. }),
  873. smalltalk.ArrayTest);
  874. smalltalk.addMethod(
  875. "_testFirstN",
  876. smalltalk.method({
  877. selector: "testFirstN",
  878. fn: function () {
  879. var self = this;
  880. smalltalk.send(self, "_assert_equals_", [[1, 2, 3], smalltalk.send([1, 2, 3, 4, 5], "_first_", [3])]);
  881. return self;
  882. }
  883. }),
  884. smalltalk.ArrayTest);
  885. smalltalk.addMethod(
  886. "_testIfEmpty",
  887. smalltalk.method({
  888. selector: "testIfEmpty",
  889. fn: function () {
  890. var self = this;
  891. smalltalk.send(self, "_assert_equals_", ["zork", smalltalk.send("", "_ifEmpty_", [function () {return "zork";}])]);
  892. return self;
  893. }
  894. }),
  895. smalltalk.ArrayTest);
  896. smalltalk.addMethod(
  897. "_testPrintString",
  898. smalltalk.method({
  899. selector: "testPrintString",
  900. fn: function () {
  901. var self = this;
  902. var $1, $2;
  903. var array;
  904. array = smalltalk.send(smalltalk.Array || Array, "_new", []);
  905. smalltalk.send(self, "_assert_equals_", ["a Array ()", smalltalk.send(array, "_printString", [])]);
  906. smalltalk.send(array, "_add_", [1]);
  907. $1 = smalltalk.send(array, "_add_", [3]);
  908. smalltalk.send(self, "_assert_equals_", ["a Array (1 3)", smalltalk.send(array, "_printString", [])]);
  909. smalltalk.send(array, "_add_", ["foo"]);
  910. smalltalk.send(self, "_assert_equals_", ["a Array (1 3 'foo')", smalltalk.send(array, "_printString", [])]);
  911. smalltalk.send(array, "_remove_", [1]);
  912. $2 = smalltalk.send(array, "_remove_", [3]);
  913. smalltalk.send(self, "_assert_equals_", ["a Array ('foo')", smalltalk.send(array, "_printString", [])]);
  914. smalltalk.send(array, "_addLast_", [3]);
  915. smalltalk.send(self, "_assert_equals_", ["a Array ('foo' 3)", smalltalk.send(array, "_printString", [])]);
  916. smalltalk.send(array, "_addLast_", [3]);
  917. smalltalk.send(self, "_assert_equals_", ["a Array ('foo' 3 3)", smalltalk.send(array, "_printString", [])]);
  918. return self;
  919. }
  920. }),
  921. smalltalk.ArrayTest);
  922. smalltalk.addMethod(
  923. "_collectionClass",
  924. smalltalk.method({
  925. selector: "collectionClass",
  926. fn: function () {
  927. var self = this;
  928. return smalltalk.Array || Array;
  929. }
  930. }),
  931. smalltalk.ArrayTest.klass);
  932. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  933. smalltalk.addMethod(
  934. "_collection",
  935. smalltalk.method({
  936. selector: "collection",
  937. fn: function () {
  938. var self = this;
  939. return "hello";
  940. }
  941. }),
  942. smalltalk.StringTest);
  943. smalltalk.addMethod(
  944. "_collectionWithDuplicates",
  945. smalltalk.method({
  946. selector: "collectionWithDuplicates",
  947. fn: function () {
  948. var self = this;
  949. return "abbaerte";
  950. }
  951. }),
  952. smalltalk.StringTest);
  953. smalltalk.addMethod(
  954. "_testAddRemove",
  955. smalltalk.method({
  956. selector: "testAddRemove",
  957. fn: function () {
  958. var self = this;
  959. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send("hello", "_add_", ["a"]);}, smalltalk.Error || Error]);
  960. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send("hello", "_remove_", ["h"]);}, smalltalk.Error || Error]);
  961. return self;
  962. }
  963. }),
  964. smalltalk.StringTest);
  965. smalltalk.addMethod(
  966. "_testAsArray",
  967. smalltalk.method({
  968. selector: "testAsArray",
  969. fn: function () {
  970. var self = this;
  971. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_asArray", []), "__eq", [["h", "e", "l", "l", "o"]])]);
  972. return self;
  973. }
  974. }),
  975. smalltalk.StringTest);
  976. smalltalk.addMethod(
  977. "_testAt",
  978. smalltalk.method({
  979. selector: "testAt",
  980. fn: function () {
  981. var self = this;
  982. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [1]), "__eq", ["h"])]);
  983. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [5]), "__eq", ["o"])]);
  984. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_ifAbsent_", [6, function () {return nil;}]), "__eq", [nil])]);
  985. return self;
  986. }
  987. }),
  988. smalltalk.StringTest);
  989. smalltalk.addMethod(
  990. "_testAtPut",
  991. smalltalk.method({
  992. selector: "testAtPut",
  993. fn: function () {
  994. var self = this;
  995. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send("hello", "_at_put_", [1, "a"]);}, smalltalk.Error || Error]);
  996. return self;
  997. }
  998. }),
  999. smalltalk.StringTest);
  1000. smalltalk.addMethod(
  1001. "_testCollect",
  1002. smalltalk.method({
  1003. selector: "testCollect",
  1004. fn: function () {
  1005. var self = this;
  1006. var newCollection;
  1007. newCollection = "hheelllloo";
  1008. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_collect_", [function (each) {return smalltalk.send(each, "__comma", [each]);}]), newCollection]);
  1009. return self;
  1010. }
  1011. }),
  1012. smalltalk.StringTest);
  1013. smalltalk.addMethod(
  1014. "_testCopyWithoutAll",
  1015. smalltalk.method({
  1016. selector: "testCopyWithoutAll",
  1017. fn: function () {
  1018. var self = this;
  1019. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send("*hello* *world*", "_copyWithoutAll_", ["*"])]);
  1020. return self;
  1021. }
  1022. }),
  1023. smalltalk.StringTest);
  1024. smalltalk.addMethod(
  1025. "_testDetect",
  1026. smalltalk.method({
  1027. selector: "testDetect",
  1028. fn: function () {
  1029. var self = this;
  1030. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_detect_", [function (each) {return smalltalk.send(each, "__eq", ["h"]);}]), "__eq", ["h"])]);
  1031. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(smalltalk.send(self, "_collection", []), "_detect_", [function (each) {return smalltalk.send(each, "__eq", [6]);}]);}, smalltalk.Error || Error]);
  1032. return self;
  1033. }
  1034. }),
  1035. smalltalk.StringTest);
  1036. smalltalk.addMethod(
  1037. "_testEquality",
  1038. smalltalk.method({
  1039. selector: "testEquality",
  1040. fn: function () {
  1041. var self = this;
  1042. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", ["hello"])]);
  1043. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", ["world"])]);
  1044. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", [smalltalk.send("hello", "_yourself", [])])]);
  1045. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq", ["hello"])]);
  1046. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [0])]);
  1047. return self;
  1048. }
  1049. }),
  1050. smalltalk.StringTest);
  1051. smalltalk.addMethod(
  1052. "_testIdentity",
  1053. smalltalk.method({
  1054. selector: "testIdentity",
  1055. fn: function () {
  1056. var self = this;
  1057. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", ["hello"])]);
  1058. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq_eq", ["world"])]);
  1059. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", [smalltalk.send("hello", "_yourself", [])])]);
  1060. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq_eq", ["hello"])]);
  1061. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq_eq", [0])]);
  1062. return self;
  1063. }
  1064. }),
  1065. smalltalk.StringTest);
  1066. smalltalk.addMethod(
  1067. "_testIncludesSubString",
  1068. smalltalk.method({
  1069. selector: "testIncludesSubString",
  1070. fn: function () {
  1071. var self = this;
  1072. smalltalk.send(self, "_assert_", [smalltalk.send("amber", "_includesSubString_", ["ber"])]);
  1073. smalltalk.send(self, "_deny_", [smalltalk.send("amber", "_includesSubString_", ["zork"])]);
  1074. return self;
  1075. }
  1076. }),
  1077. smalltalk.StringTest);
  1078. smalltalk.addMethod(
  1079. "_testJoin",
  1080. smalltalk.method({
  1081. selector: "testJoin",
  1082. fn: function () {
  1083. var self = this;
  1084. smalltalk.send(self, "_assert_equals_", ["hello,world", smalltalk.send(",", "_join_", [["hello", "world"]])]);
  1085. return self;
  1086. }
  1087. }),
  1088. smalltalk.StringTest);
  1089. smalltalk.addMethod(
  1090. "_testSelect",
  1091. smalltalk.method({
  1092. selector: "testSelect",
  1093. fn: function () {
  1094. var self = this;
  1095. var newCollection;
  1096. newCollection = "o";
  1097. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_select_", [function (each) {return smalltalk.send(each, "__eq", ["o"]);}]), newCollection]);
  1098. return self;
  1099. }
  1100. }),
  1101. smalltalk.StringTest);
  1102. smalltalk.addMethod(
  1103. "_testSize",
  1104. smalltalk.method({
  1105. selector: "testSize",
  1106. fn: function () {
  1107. var self = this;
  1108. smalltalk.send(self, "_assert_equals_", [smalltalk.send("smalltalk", "_size", []), 9]);
  1109. smalltalk.send(self, "_assert_equals_", [smalltalk.send("", "_size", []), 0]);
  1110. return self;
  1111. }
  1112. }),
  1113. smalltalk.StringTest);
  1114. smalltalk.addMethod(
  1115. "_testStreamContents",
  1116. smalltalk.method({
  1117. selector: "testStreamContents",
  1118. fn: function () {
  1119. var self = this;
  1120. var $1;
  1121. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send(smalltalk.String || String, "_streamContents_", [function (aStream) {smalltalk.send(aStream, "_nextPutAll_", ["hello"]);smalltalk.send(aStream, "_space", []);$1 = smalltalk.send(aStream, "_nextPutAll_", ["world"]);return $1;}])]);
  1122. return self;
  1123. }
  1124. }),
  1125. smalltalk.StringTest);
  1126. smalltalk.addMethod(
  1127. "_collectionClass",
  1128. smalltalk.method({
  1129. selector: "collectionClass",
  1130. fn: function () {
  1131. var self = this;
  1132. return smalltalk.String || String;
  1133. }
  1134. }),
  1135. smalltalk.StringTest.klass);
  1136. smalltalk.addClass('SymbolTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1137. smalltalk.addMethod(
  1138. "_collection",
  1139. smalltalk.method({
  1140. selector: "collection",
  1141. fn: function () {
  1142. var self = this;
  1143. return smalltalk.symbolFor("hello");
  1144. }
  1145. }),
  1146. smalltalk.SymbolTest);
  1147. smalltalk.addMethod(
  1148. "_collectionWithDuplicates",
  1149. smalltalk.method({
  1150. selector: "collectionWithDuplicates",
  1151. fn: function () {
  1152. var self = this;
  1153. return smalltalk.symbolFor("phhaaarorra");
  1154. }
  1155. }),
  1156. smalltalk.SymbolTest);
  1157. smalltalk.addMethod(
  1158. "_testAsString",
  1159. smalltalk.method({
  1160. selector: "testAsString",
  1161. fn: function () {
  1162. var self = this;
  1163. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "hello"]);
  1164. return self;
  1165. }
  1166. }),
  1167. smalltalk.SymbolTest);
  1168. smalltalk.addMethod(
  1169. "_testAsSymbol",
  1170. smalltalk.method({
  1171. selector: "testAsSymbol",
  1172. fn: function () {
  1173. var self = this;
  1174. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_asSymbol", [])])]);
  1175. return self;
  1176. }
  1177. }),
  1178. smalltalk.SymbolTest);
  1179. smalltalk.addMethod(
  1180. "_testAt",
  1181. smalltalk.method({
  1182. selector: "testAt",
  1183. fn: function () {
  1184. var self = this;
  1185. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [1]), "__eq", ["h"])]);
  1186. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [5]), "__eq", ["o"])]);
  1187. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_ifAbsent_", [6, function () {return nil;}]), "__eq", [nil])]);
  1188. return self;
  1189. }
  1190. }),
  1191. smalltalk.SymbolTest);
  1192. smalltalk.addMethod(
  1193. "_testAtPut",
  1194. smalltalk.method({
  1195. selector: "testAtPut",
  1196. fn: function () {
  1197. var self = this;
  1198. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send("hello", "_at_put_", [1, "a"]);}, smalltalk.Error || Error]);
  1199. return self;
  1200. }
  1201. }),
  1202. smalltalk.SymbolTest);
  1203. smalltalk.addMethod(
  1204. "_testCollect",
  1205. smalltalk.method({
  1206. selector: "testCollect",
  1207. fn: function () {
  1208. var self = this;
  1209. var newCollection;
  1210. newCollection = smalltalk.symbolFor("hheelllloo");
  1211. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_collect_", [function (each) {return smalltalk.send(each, "__comma", [each]);}]), newCollection]);
  1212. return self;
  1213. }
  1214. }),
  1215. smalltalk.SymbolTest);
  1216. smalltalk.addMethod(
  1217. "_testComparing",
  1218. smalltalk.method({
  1219. selector: "testComparing",
  1220. fn: function () {
  1221. var self = this;
  1222. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("ab"), "__gt", [smalltalk.symbolFor("aa")])]);
  1223. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("ab"), "__gt", [smalltalk.symbolFor("ba")])]);
  1224. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("ab"), "__lt", [smalltalk.symbolFor("ba")])]);
  1225. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("bb"), "__lt", [smalltalk.symbolFor("ba")])]);
  1226. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("ab"), "__gt_eq", [smalltalk.symbolFor("aa")])]);
  1227. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("ab"), "__gt_eq", [smalltalk.symbolFor("ba")])]);
  1228. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("ab"), "__lt_eq", [smalltalk.symbolFor("ba")])]);
  1229. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("bb"), "__lt_eq", [smalltalk.symbolFor("ba")])]);
  1230. return self;
  1231. }
  1232. }),
  1233. smalltalk.SymbolTest);
  1234. smalltalk.addMethod(
  1235. "_testCopying",
  1236. smalltalk.method({
  1237. selector: "testCopying",
  1238. fn: function () {
  1239. var self = this;
  1240. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_copy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1241. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_deepCopy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1242. return self;
  1243. }
  1244. }),
  1245. smalltalk.SymbolTest);
  1246. smalltalk.addMethod(
  1247. "_testDetect",
  1248. smalltalk.method({
  1249. selector: "testDetect",
  1250. fn: function () {
  1251. var self = this;
  1252. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_detect_", [function (each) {return smalltalk.send(each, "__eq", ["h"]);}]), "__eq", ["h"])]);
  1253. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(smalltalk.send(self, "_collection", []), "_detect_", [function (each) {return smalltalk.send(each, "__eq", ["z"]);}]);}, smalltalk.Error || Error]);
  1254. return self;
  1255. }
  1256. }),
  1257. smalltalk.SymbolTest);
  1258. smalltalk.addMethod(
  1259. "_testEquality",
  1260. smalltalk.method({
  1261. selector: "testEquality",
  1262. fn: function () {
  1263. var self = this;
  1264. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("hello")])]);
  1265. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("world")])]);
  1266. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1267. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.symbolFor("hello")])]);
  1268. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", ["hello"])]);
  1269. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", [smalltalk.symbolFor("hello")])]);
  1270. return self;
  1271. }
  1272. }),
  1273. smalltalk.SymbolTest);
  1274. smalltalk.addMethod(
  1275. "_testIdentity",
  1276. smalltalk.method({
  1277. selector: "testIdentity",
  1278. fn: function () {
  1279. var self = this;
  1280. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1281. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("world")])]);
  1282. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1283. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "_asSymbol", [])])]);
  1284. return self;
  1285. }
  1286. }),
  1287. smalltalk.SymbolTest);
  1288. smalltalk.addMethod(
  1289. "_testIsEmpty",
  1290. smalltalk.method({
  1291. selector: "testIsEmpty",
  1292. fn: function () {
  1293. var self = this;
  1294. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_isEmpty", [])]);
  1295. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("", "_asSymbol", []), "_isEmpty", [])]);
  1296. return self;
  1297. }
  1298. }),
  1299. smalltalk.SymbolTest);
  1300. smalltalk.addMethod(
  1301. "_testIsSymbolIsString",
  1302. smalltalk.method({
  1303. selector: "testIsSymbolIsString",
  1304. fn: function () {
  1305. var self = this;
  1306. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isSymbol", [])]);
  1307. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "_isSymbol", [])]);
  1308. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isString", [])]);
  1309. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "_isString", [])]);
  1310. return self;
  1311. }
  1312. }),
  1313. smalltalk.SymbolTest);
  1314. smalltalk.addMethod(
  1315. "_testSelect",
  1316. smalltalk.method({
  1317. selector: "testSelect",
  1318. fn: function () {
  1319. var self = this;
  1320. var newCollection;
  1321. newCollection = "o";
  1322. smalltalk.send(self, "_assertSameContents_as_", [smalltalk.send(smalltalk.send(self, "_collection", []), "_select_", [function (each) {return smalltalk.send(each, "__eq", ["o"]);}]), newCollection]);
  1323. return self;
  1324. }
  1325. }),
  1326. smalltalk.SymbolTest);
  1327. smalltalk.addMethod(
  1328. "_testSize",
  1329. smalltalk.method({
  1330. selector: "testSize",
  1331. fn: function () {
  1332. var self = this;
  1333. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("a"), "_size", []), 1]);
  1334. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("aaaaa"), "_size", []), 5]);
  1335. return self;
  1336. }
  1337. }),
  1338. smalltalk.SymbolTest);
  1339. smalltalk.addMethod(
  1340. "_collectionClass",
  1341. smalltalk.method({
  1342. selector: "collectionClass",
  1343. fn: function () {
  1344. var self = this;
  1345. return smalltalk.Symbol || Symbol;
  1346. }
  1347. }),
  1348. smalltalk.SymbolTest.klass);
  1349. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1350. smalltalk.addMethod(
  1351. "_jsObject",
  1352. smalltalk.method({
  1353. selector: "jsObject",
  1354. fn: function () {
  1355. var self = this;
  1356. return jsObject = {a: 1, b: function () {return 2;}, c: function (object) {return object;}, d: ""};
  1357. return self;
  1358. }
  1359. }),
  1360. smalltalk.JSObjectProxyTest);
  1361. smalltalk.addMethod(
  1362. "_testDNU",
  1363. smalltalk.method({
  1364. selector: "testDNU",
  1365. fn: function () {
  1366. var self = this;
  1367. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(smalltalk.send(self, "_jsObject", []), "_foo", []);}, smalltalk.MessageNotUnderstood || MessageNotUnderstood]);
  1368. return self;
  1369. }
  1370. }),
  1371. smalltalk.JSObjectProxyTest);
  1372. smalltalk.addMethod(
  1373. "_testMessageSend",
  1374. smalltalk.method({
  1375. selector: "testMessageSend",
  1376. fn: function () {
  1377. var self = this;
  1378. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_a", []), 1]);
  1379. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_b", []), 2]);
  1380. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_c_", [3]), 3]);
  1381. return self;
  1382. }
  1383. }),
  1384. smalltalk.JSObjectProxyTest);
  1385. smalltalk.addMethod(
  1386. "_testMethodWithArguments",
  1387. smalltalk.method({
  1388. selector: "testMethodWithArguments",
  1389. fn: function () {
  1390. var self = this;
  1391. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_c_", [1]), 1]);
  1392. return self;
  1393. }
  1394. }),
  1395. smalltalk.JSObjectProxyTest);
  1396. smalltalk.addMethod(
  1397. "_testPrinting",
  1398. smalltalk.method({
  1399. selector: "testPrinting",
  1400. fn: function () {
  1401. var self = this;
  1402. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_jsObject", []), "_printString", []), "__eq", ["[object Object]"])]);
  1403. return self;
  1404. }
  1405. }),
  1406. smalltalk.JSObjectProxyTest);
  1407. smalltalk.addMethod(
  1408. "_testPropertyThatReturnsEmptyString",
  1409. smalltalk.method({
  1410. selector: "testPropertyThatReturnsEmptyString",
  1411. fn: function () {
  1412. var self = this;
  1413. var object;
  1414. object = smalltalk.send(self, "_jsObject", []);
  1415. smalltalk.send(self, "_assert_equals_", ["", smalltalk.send(object, "_d", [])]);
  1416. smalltalk.send(object, "_d_", ["hello"]);
  1417. smalltalk.send(self, "_assert_equals_", ["hello", smalltalk.send(object, "_d", [])]);
  1418. return self;
  1419. }
  1420. }),
  1421. smalltalk.JSObjectProxyTest);
  1422. smalltalk.addMethod(
  1423. "_testYourself",
  1424. smalltalk.method({
  1425. selector: "testYourself",
  1426. fn: function () {
  1427. var self = this;
  1428. var $1, $2;
  1429. var object;
  1430. $1 = smalltalk.send(self, "_jsObject", []);
  1431. smalltalk.send($1, "_d_", ["test"]);
  1432. $2 = smalltalk.send($1, "_yourself", []);
  1433. object = $2;
  1434. smalltalk.send(self, "_assert_equals_", [smalltalk.send(object, "_d", []), "test"]);
  1435. return self;
  1436. }
  1437. }),
  1438. smalltalk.JSObjectProxyTest);
  1439. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1440. smalltalk.addMethod(
  1441. "_testAbs",
  1442. smalltalk.method({
  1443. selector: "testAbs",
  1444. fn: function () {
  1445. var self = this;
  1446. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(4, "_abs", []), "__eq", [4])]);
  1447. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(-4, "_abs", []), "__eq", [4])]);
  1448. return self;
  1449. }
  1450. }),
  1451. smalltalk.NumberTest);
  1452. smalltalk.addMethod(
  1453. "_testArithmetic",
  1454. smalltalk.method({
  1455. selector: "testArithmetic",
  1456. fn: function () {
  1457. var self = this;
  1458. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1.5, "__plus", [1]), "__eq", [2.5])]);
  1459. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(2, "__minus", [1]), "__eq", [1])]);
  1460. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(-2, "__minus", [1]), "__eq", [-3])]);
  1461. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(12, "__slash", [2]), "__eq", [6])]);
  1462. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3, "__star", [4]), "__eq", [12])]);
  1463. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(1, "__plus", [2]), "__star", [3]), "__eq", [9])]);
  1464. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "__plus", [smalltalk.send(2, "__star", [3])]), "__eq", [7])]);
  1465. return self;
  1466. }
  1467. }),
  1468. smalltalk.NumberTest);
  1469. smalltalk.addMethod(
  1470. "_testComparison",
  1471. smalltalk.method({
  1472. selector: "testComparison",
  1473. fn: function () {
  1474. var self = this;
  1475. smalltalk.send(self, "_assert_", [smalltalk.send(3, "__gt", [2])]);
  1476. smalltalk.send(self, "_assert_", [smalltalk.send(2, "__lt", [3])]);
  1477. smalltalk.send(self, "_deny_", [smalltalk.send(3, "__lt", [2])]);
  1478. smalltalk.send(self, "_deny_", [smalltalk.send(2, "__gt", [3])]);
  1479. smalltalk.send(self, "_assert_", [smalltalk.send(3, "__gt_eq", [3])]);
  1480. smalltalk.send(self, "_assert_", [smalltalk.send(3.1, "__gt_eq", [3])]);
  1481. smalltalk.send(self, "_assert_", [smalltalk.send(3, "__lt_eq", [3])]);
  1482. smalltalk.send(self, "_assert_", [smalltalk.send(3, "__lt_eq", [3.1])]);
  1483. return self;
  1484. }
  1485. }),
  1486. smalltalk.NumberTest);
  1487. smalltalk.addMethod(
  1488. "_testCopying",
  1489. smalltalk.method({
  1490. selector: "testCopying",
  1491. fn: function () {
  1492. var self = this;
  1493. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "_copy", []), "__eq_eq", [1])]);
  1494. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "_deepCopy", []), "__eq_eq", [1])]);
  1495. return self;
  1496. }
  1497. }),
  1498. smalltalk.NumberTest);
  1499. smalltalk.addMethod(
  1500. "_testEquality",
  1501. smalltalk.method({
  1502. selector: "testEquality",
  1503. fn: function () {
  1504. var self = this;
  1505. smalltalk.send(self, "_assert_", [smalltalk.send(1, "__eq", [1])]);
  1506. smalltalk.send(self, "_assert_", [smalltalk.send(0, "__eq", [0])]);
  1507. smalltalk.send(self, "_deny_", [smalltalk.send(1, "__eq", [0])]);
  1508. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "_yourself", []), "__eq", [1])]);
  1509. smalltalk.send(self, "_assert_", [smalltalk.send(1, "__eq", [smalltalk.send(1, "_yourself", [])])]);
  1510. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "_yourself", []), "__eq", [smalltalk.send(1, "_yourself", [])])]);
  1511. smalltalk.send(self, "_deny_", [smalltalk.send(0, "__eq", [false])]);
  1512. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [0])]);
  1513. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [0])]);
  1514. smalltalk.send(self, "_deny_", [smalltalk.send(0, "__eq", [""])]);
  1515. return self;
  1516. }
  1517. }),
  1518. smalltalk.NumberTest);
  1519. smalltalk.addMethod(
  1520. "_testIdentity",
  1521. smalltalk.method({
  1522. selector: "testIdentity",
  1523. fn: function () {
  1524. var self = this;
  1525. smalltalk.send(self, "_assert_", [smalltalk.send(1, "__eq_eq", [1])]);
  1526. smalltalk.send(self, "_assert_", [smalltalk.send(0, "__eq_eq", [0])]);
  1527. smalltalk.send(self, "_deny_", [smalltalk.send(1, "__eq_eq", [0])]);
  1528. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "_yourself", []), "__eq_eq", [1])]);
  1529. smalltalk.send(self, "_assert_", [smalltalk.send(1, "__eq_eq", [smalltalk.send(1, "_yourself", [])])]);
  1530. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(1, "_yourself", []), "__eq_eq", [smalltalk.send(1, "_yourself", [])])]);
  1531. smalltalk.send(self, "_deny_", [smalltalk.send(1, "__eq_eq", [2])]);
  1532. return self;
  1533. }
  1534. }),
  1535. smalltalk.NumberTest);
  1536. smalltalk.addMethod(
  1537. "_testMinMax",
  1538. smalltalk.method({
  1539. selector: "testMinMax",
  1540. fn: function () {
  1541. var self = this;
  1542. smalltalk.send(self, "_assert_equals_", [smalltalk.send(2, "_max_", [5]), 5]);
  1543. smalltalk.send(self, "_assert_equals_", [smalltalk.send(2, "_min_", [5]), 2]);
  1544. return self;
  1545. }
  1546. }),
  1547. smalltalk.NumberTest);
  1548. smalltalk.addMethod(
  1549. "_testNegated",
  1550. smalltalk.method({
  1551. selector: "testNegated",
  1552. fn: function () {
  1553. var self = this;
  1554. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3, "_negated", []), "__eq", [-3])]);
  1555. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(-3, "_negated", []), "__eq", [3])]);
  1556. return self;
  1557. }
  1558. }),
  1559. smalltalk.NumberTest);
  1560. smalltalk.addMethod(
  1561. "_testPrintShowingDecimalPlaces",
  1562. smalltalk.method({
  1563. selector: "testPrintShowingDecimalPlaces",
  1564. fn: function () {
  1565. var self = this;
  1566. smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send(23, "_printShowingDecimalPlaces_", [2])]);
  1567. smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send(23.5698, "_printShowingDecimalPlaces_", [2])]);
  1568. smalltalk.send(self, "_assert_equals_", ["-234.56700", smalltalk.send(smalltalk.send(234.567, "_negated", []), "_printShowingDecimalPlaces_", [5])]);
  1569. smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send(23.4567, "_printShowingDecimalPlaces_", [0])]);
  1570. smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send(23.5567, "_printShowingDecimalPlaces_", [0])]);
  1571. smalltalk.send(self, "_assert_equals_", ["-23", smalltalk.send(smalltalk.send(23.4567, "_negated", []), "_printShowingDecimalPlaces_", [0])]);
  1572. smalltalk.send(self, "_assert_equals_", ["-24", smalltalk.send(smalltalk.send(23.5567, "_negated", []), "_printShowingDecimalPlaces_", [0])]);
  1573. smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send(100000000, "_printShowingDecimalPlaces_", [1])]);
  1574. smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send(0.98, "_printShowingDecimalPlaces_", [5])]);
  1575. smalltalk.send(self, "_assert_equals_", ["-0.98", smalltalk.send(smalltalk.send(0.98, "_negated", []), "_printShowingDecimalPlaces_", [2])]);
  1576. smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send(2.567, "_printShowingDecimalPlaces_", [2])]);
  1577. smalltalk.send(self, "_assert_equals_", ["-2.57", smalltalk.send(-2.567, "_printShowingDecimalPlaces_", [2])]);
  1578. smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send(0, "_printShowingDecimalPlaces_", [2])]);
  1579. return self;
  1580. }
  1581. }),
  1582. smalltalk.NumberTest);
  1583. smalltalk.addMethod(
  1584. "_testRounded",
  1585. smalltalk.method({
  1586. selector: "testRounded",
  1587. fn: function () {
  1588. var self = this;
  1589. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3, "_rounded", []), "__eq", [3])]);
  1590. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3.212, "_rounded", []), "__eq", [3])]);
  1591. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3.51, "_rounded", []), "__eq", [4])]);
  1592. return self;
  1593. }
  1594. }),
  1595. smalltalk.NumberTest);
  1596. smalltalk.addMethod(
  1597. "_testSqrt",
  1598. smalltalk.method({
  1599. selector: "testSqrt",
  1600. fn: function () {
  1601. var self = this;
  1602. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(4, "_sqrt", []), "__eq", [2])]);
  1603. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(16, "_sqrt", []), "__eq", [4])]);
  1604. return self;
  1605. }
  1606. }),
  1607. smalltalk.NumberTest);
  1608. smalltalk.addMethod(
  1609. "_testSquared",
  1610. smalltalk.method({
  1611. selector: "testSquared",
  1612. fn: function () {
  1613. var self = this;
  1614. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(4, "_squared", []), "__eq", [16])]);
  1615. return self;
  1616. }
  1617. }),
  1618. smalltalk.NumberTest);
  1619. smalltalk.addMethod(
  1620. "_testTimesRepeat",
  1621. smalltalk.method({
  1622. selector: "testTimesRepeat",
  1623. fn: function () {
  1624. var self = this;
  1625. var i;
  1626. i = 0;
  1627. smalltalk.send(0, "_timesRepeat_", [function () {i = smalltalk.send(i, "__plus", [1]);return i;}]);
  1628. smalltalk.send(self, "_assert_equals_", [i, 0]);
  1629. smalltalk.send(5, "_timesRepeat_", [function () {i = smalltalk.send(i, "__plus", [1]);return i;}]);
  1630. smalltalk.send(self, "_assert_equals_", [i, 5]);
  1631. return self;
  1632. }
  1633. }),
  1634. smalltalk.NumberTest);
  1635. smalltalk.addMethod(
  1636. "_testTo",
  1637. smalltalk.method({
  1638. selector: "testTo",
  1639. fn: function () {
  1640. var self = this;
  1641. smalltalk.send(self, "_assert_equals_", [smalltalk.send(1, "_to_", [5]), [1, 2, 3, 4, 5]]);
  1642. return self;
  1643. }
  1644. }),
  1645. smalltalk.NumberTest);
  1646. smalltalk.addMethod(
  1647. "_testToBy",
  1648. smalltalk.method({
  1649. selector: "testToBy",
  1650. fn: function () {
  1651. var self = this;
  1652. smalltalk.send(self, "_assert_equals_", [smalltalk.send(0, "_to_by_", [6, 2]), [0, 2, 4, 6]]);
  1653. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(1, "_to_by_", [4, 0]);}, smalltalk.Error || Error]);
  1654. return self;
  1655. }
  1656. }),
  1657. smalltalk.NumberTest);
  1658. smalltalk.addMethod(
  1659. "_testTruncated",
  1660. smalltalk.method({
  1661. selector: "testTruncated",
  1662. fn: function () {
  1663. var self = this;
  1664. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3, "_truncated", []), "__eq", [3])]);
  1665. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3.212, "_truncated", []), "__eq", [3])]);
  1666. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3.51, "_truncated", []), "__eq", [3])]);
  1667. return self;
  1668. }
  1669. }),
  1670. smalltalk.NumberTest);
  1671. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  1672. smalltalk.addMethod(
  1673. "_foo",
  1674. smalltalk.method({
  1675. selector: "foo",
  1676. fn: function () {
  1677. var self = this;
  1678. return self['@foo'];
  1679. }
  1680. }),
  1681. smalltalk.ObjectMock);
  1682. smalltalk.addMethod(
  1683. "_foo_",
  1684. smalltalk.method({
  1685. selector: "foo:",
  1686. fn: function (anObject) {
  1687. var self = this;
  1688. self['@foo'] = anObject;
  1689. return self;
  1690. }
  1691. }),
  1692. smalltalk.ObjectMock);
  1693. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1694. smalltalk.addMethod(
  1695. "_testBasicAccess",
  1696. smalltalk.method({
  1697. selector: "testBasicAccess",
  1698. fn: function () {
  1699. var self = this;
  1700. var o;
  1701. o = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1702. smalltalk.send(o, "_basicAt_put_", ["a", 1]);
  1703. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["a"]), 1]);
  1704. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["b"]), nil]);
  1705. return self;
  1706. }
  1707. }),
  1708. smalltalk.ObjectTest);
  1709. smalltalk.addMethod(
  1710. "_testBasicPerform",
  1711. smalltalk.method({
  1712. selector: "testBasicPerform",
  1713. fn: function () {
  1714. var self = this;
  1715. var o;
  1716. o = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1717. smalltalk.send(o, "_basicAt_put_", ["func", function () {return "hello";}]);
  1718. smalltalk.send(o, "_basicAt_put_", ["func2", function (a) {return smalltalk.send(a, "__plus", [1]);}]);
  1719. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_", ["func"]), "hello"]);
  1720. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_withArguments_", ["func2", [3]]), 4]);
  1721. return self;
  1722. }
  1723. }),
  1724. smalltalk.ObjectTest);
  1725. smalltalk.addMethod(
  1726. "_testDNU",
  1727. smalltalk.method({
  1728. selector: "testDNU",
  1729. fn: function () {
  1730. var self = this;
  1731. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(smalltalk.send(smalltalk.Object || Object, "_new", []), "_foo", []);}, smalltalk.MessageNotUnderstood || MessageNotUnderstood]);
  1732. return self;
  1733. }
  1734. }),
  1735. smalltalk.ObjectTest);
  1736. smalltalk.addMethod(
  1737. "_testEquality",
  1738. smalltalk.method({
  1739. selector: "testEquality",
  1740. fn: function () {
  1741. var self = this;
  1742. var o;
  1743. o = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1744. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq", [smalltalk.send(smalltalk.Object || Object, "_new", [])])]);
  1745. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [o])]);
  1746. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq", [o])]);
  1747. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [smalltalk.send(o, "_yourself", [])])]);
  1748. return self;
  1749. }
  1750. }),
  1751. smalltalk.ObjectTest);
  1752. smalltalk.addMethod(
  1753. "_testHalt",
  1754. smalltalk.method({
  1755. selector: "testHalt",
  1756. fn: function () {
  1757. var self = this;
  1758. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(smalltalk.send(smalltalk.Object || Object, "_new", []), "_halt", []);}, smalltalk.Error || Error]);
  1759. return self;
  1760. }
  1761. }),
  1762. smalltalk.ObjectTest);
  1763. smalltalk.addMethod(
  1764. "_testIdentity",
  1765. smalltalk.method({
  1766. selector: "testIdentity",
  1767. fn: function () {
  1768. var self = this;
  1769. var o;
  1770. o = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1771. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq_eq", [smalltalk.send(smalltalk.Object || Object, "_new", [])])]);
  1772. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [o])]);
  1773. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  1774. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [smalltalk.send(o, "_yourself", [])])]);
  1775. return self;
  1776. }
  1777. }),
  1778. smalltalk.ObjectTest);
  1779. smalltalk.addMethod(
  1780. "_testIfNil",
  1781. smalltalk.method({
  1782. selector: "testIfNil",
  1783. fn: function () {
  1784. var self = this;
  1785. var $2, $1, $4, $3, $6, $5;
  1786. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(smalltalk.Object || Object, "_new", []), "_isNil", [])]);
  1787. $2 = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1788. if (($receiver = $2) == nil || $receiver == undefined) {
  1789. $1 = true;
  1790. } else {
  1791. $1 = $2;
  1792. }
  1793. smalltalk.send(self, "_deny_", [smalltalk.send($1, "__eq", [true])]);
  1794. $4 = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1795. if (($receiver = $4) == nil || $receiver == undefined) {
  1796. $3 = $4;
  1797. } else {
  1798. $3 = true;
  1799. }
  1800. smalltalk.send(self, "_assert_", [smalltalk.send($3, "__eq", [true])]);
  1801. $6 = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1802. if (($receiver = $6) == nil || $receiver == undefined) {
  1803. $5 = false;
  1804. } else {
  1805. $5 = true;
  1806. }
  1807. smalltalk.send(self, "_assert_", [smalltalk.send($5, "__eq", [true])]);
  1808. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Object || Object, "_new", []), "_ifNotNil_ifNil_", [function () {return true;}, function () {return false;}]), "__eq", [true])]);
  1809. return self;
  1810. }
  1811. }),
  1812. smalltalk.ObjectTest);
  1813. smalltalk.addMethod(
  1814. "_testInstVars",
  1815. smalltalk.method({
  1816. selector: "testInstVars",
  1817. fn: function () {
  1818. var self = this;
  1819. var o;
  1820. o = smalltalk.send(smalltalk.ObjectMock || ObjectMock, "_new", []);
  1821. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), nil]);
  1822. smalltalk.send(o, "_instVarAt_put_", [smalltalk.symbolFor("foo"), 1]);
  1823. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), 1]);
  1824. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", ["foo"]), 1]);
  1825. return self;
  1826. }
  1827. }),
  1828. smalltalk.ObjectTest);
  1829. smalltalk.addMethod(
  1830. "_testNilUndefined",
  1831. smalltalk.method({
  1832. selector: "testNilUndefined",
  1833. fn: function () {
  1834. var self = this;
  1835. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "__eq", [undefined])]);
  1836. return self;
  1837. }
  1838. }),
  1839. smalltalk.ObjectTest);
  1840. smalltalk.addMethod(
  1841. "_testYourself",
  1842. smalltalk.method({
  1843. selector: "testYourself",
  1844. fn: function () {
  1845. var self = this;
  1846. var o;
  1847. o = smalltalk.send(smalltalk.ObjectMock || ObjectMock, "_new", []);
  1848. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  1849. return self;
  1850. }
  1851. }),
  1852. smalltalk.ObjectTest);
  1853. smalltalk.addMethod(
  1854. "_testidentityHash",
  1855. smalltalk.method({
  1856. selector: "testidentityHash",
  1857. fn: function () {
  1858. var self = this;
  1859. var o1;
  1860. var o2;
  1861. o1 = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1862. o2 = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1863. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o1, "_identityHash", [])])]);
  1864. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o2, "_identityHash", [])])]);
  1865. return self;
  1866. }
  1867. }),
  1868. smalltalk.ObjectTest);
  1869. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  1870. smalltalk.addMethod(
  1871. "_setUp",
  1872. smalltalk.method({
  1873. selector: "setUp",
  1874. fn: function () {
  1875. var self = this;
  1876. var $1, $2;
  1877. self['@backUpCommitPathJs'] = smalltalk.send(smalltalk.Package || Package, "_defaultCommitPathJs", []);
  1878. self['@backUpCommitPathSt'] = smalltalk.send(smalltalk.Package || Package, "_defaultCommitPathSt", []);
  1879. smalltalk.send(smalltalk.Package || Package, "_resetCommitPaths", []);
  1880. self['@zorkPackage'] = smalltalk.send(smalltalk.send(smalltalk.Package || Package, "_new", []), "_name_", ["Zork"]);
  1881. $1 = smalltalk.send(smalltalk.Package || Package, "_new", []);
  1882. smalltalk.send($1, "_name_", ["Grul"]);
  1883. smalltalk.send($1, "_commitPathJs_", ["server/grul/js"]);
  1884. smalltalk.send($1, "_commitPathSt_", ["grul/st"]);
  1885. $2 = smalltalk.send($1, "_yourself", []);
  1886. self['@grulPackage'] = $2;
  1887. return self;
  1888. }
  1889. }),
  1890. smalltalk.PackageTest);
  1891. smalltalk.addMethod(
  1892. "_tearDown",
  1893. smalltalk.method({
  1894. selector: "tearDown",
  1895. fn: function () {
  1896. var self = this;
  1897. var $1;
  1898. smalltalk.send(smalltalk.Package || Package, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);
  1899. $1 = smalltalk.send(smalltalk.Package || Package, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);
  1900. return self;
  1901. }
  1902. }),
  1903. smalltalk.PackageTest);
  1904. smalltalk.addMethod(
  1905. "_testGrulCommitPathJsShouldBeServerGrulJs",
  1906. smalltalk.method({
  1907. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  1908. fn: function () {
  1909. var self = this;
  1910. smalltalk.send(self, "_assert_equals_", ["server/grul/js", smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  1911. return self;
  1912. }
  1913. }),
  1914. smalltalk.PackageTest);
  1915. smalltalk.addMethod(
  1916. "_testGrulCommitPathStShouldBeGrulSt",
  1917. smalltalk.method({
  1918. selector: "testGrulCommitPathStShouldBeGrulSt",
  1919. fn: function () {
  1920. var self = this;
  1921. smalltalk.send(self, "_assert_equals_", ["grul/st", smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  1922. return self;
  1923. }
  1924. }),
  1925. smalltalk.PackageTest);
  1926. smalltalk.addMethod(
  1927. "_testZorkCommitPathJsShouldBeJs",
  1928. smalltalk.method({
  1929. selector: "testZorkCommitPathJsShouldBeJs",
  1930. fn: function () {
  1931. var self = this;
  1932. smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  1933. return self;
  1934. }
  1935. }),
  1936. smalltalk.PackageTest);
  1937. smalltalk.addMethod(
  1938. "_testZorkCommitPathStShouldBeSt",
  1939. smalltalk.method({
  1940. selector: "testZorkCommitPathStShouldBeSt",
  1941. fn: function () {
  1942. var self = this;
  1943. smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  1944. return self;
  1945. }
  1946. }),
  1947. smalltalk.PackageTest);
  1948. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  1949. smalltalk.addMethod(
  1950. "_setUp",
  1951. smalltalk.method({
  1952. selector: "setUp",
  1953. fn: function () {
  1954. var self = this;
  1955. var $1;
  1956. smalltalk.send(self, "_setUp", [], smalltalk.PackageTest);
  1957. smalltalk.send(smalltalk.Package || Package, "_defaultCommitPathJs_", ["javascripts/"]);
  1958. $1 = smalltalk.send(smalltalk.Package || Package, "_defaultCommitPathSt_", ["smalltalk/"]);
  1959. return self;
  1960. }
  1961. }),
  1962. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1963. smalltalk.addMethod(
  1964. "_testGrulCommitPathJsShouldBeServerGrulJs",
  1965. smalltalk.method({
  1966. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  1967. fn: function () {
  1968. var self = this;
  1969. smalltalk.send(self, "_assert_equals_", ["server/grul/js", smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  1970. return self;
  1971. }
  1972. }),
  1973. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1974. smalltalk.addMethod(
  1975. "_testGrulCommitPathStShouldBeGrulSt",
  1976. smalltalk.method({
  1977. selector: "testGrulCommitPathStShouldBeGrulSt",
  1978. fn: function () {
  1979. var self = this;
  1980. smalltalk.send(self, "_assert_equals_", ["grul/st", smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  1981. return self;
  1982. }
  1983. }),
  1984. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1985. smalltalk.addMethod(
  1986. "_testZorkCommitPathJsShouldBeJavascript",
  1987. smalltalk.method({
  1988. selector: "testZorkCommitPathJsShouldBeJavascript",
  1989. fn: function () {
  1990. var self = this;
  1991. smalltalk.send(self, "_assert_equals_", ["javascripts/", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  1992. return self;
  1993. }
  1994. }),
  1995. smalltalk.PackageWithDefaultCommitPathChangedTest);
  1996. smalltalk.addMethod(
  1997. "_testZorkCommitPathStShouldBeSmalltalk",
  1998. smalltalk.method({
  1999. selector: "testZorkCommitPathStShouldBeSmalltalk",
  2000. fn: function () {
  2001. var self = this;
  2002. smalltalk.send(self, "_assert_equals_", ["smalltalk/", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  2003. return self;
  2004. }
  2005. }),
  2006. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2007. smalltalk.addMethod(
  2008. "_shouldInheritSelectors",
  2009. smalltalk.method({
  2010. selector: "shouldInheritSelectors",
  2011. fn: function () {
  2012. var self = this;
  2013. return false;
  2014. }
  2015. }),
  2016. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  2017. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2018. smalltalk.addMethod(
  2019. "_testAccessing",
  2020. smalltalk.method({
  2021. selector: "testAccessing",
  2022. fn: function () {
  2023. var self = this;
  2024. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.Point || Point, "_x_y_", [3, 4]), "_x", []), 3]);
  2025. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.Point || Point, "_x_y_", [3, 4]), "_y", []), 4]);
  2026. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Point || Point, "_new", []), "_x_", [3]), "_x", []), 3]);
  2027. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Point || Point, "_new", []), "_y_", [4]), "_y", []), 4]);
  2028. return self;
  2029. }
  2030. }),
  2031. smalltalk.PointTest);
  2032. smalltalk.addMethod(
  2033. "_testArithmetic",
  2034. smalltalk.method({
  2035. selector: "testArithmetic",
  2036. fn: function () {
  2037. var self = this;
  2038. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(3, "__at", [4]), "__star", [smalltalk.send(3, "__at", [4])]), smalltalk.send(smalltalk.Point || Point, "_x_y_", [9, 16])]);
  2039. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(3, "__at", [4]), "__plus", [smalltalk.send(3, "__at", [4])]), smalltalk.send(smalltalk.Point || Point, "_x_y_", [6, 8])]);
  2040. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(3, "__at", [4]), "__minus", [smalltalk.send(3, "__at", [4])]), smalltalk.send(smalltalk.Point || Point, "_x_y_", [0, 0])]);
  2041. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(6, "__at", [8]), "__slash", [smalltalk.send(3, "__at", [4])]), smalltalk.send(smalltalk.Point || Point, "_x_y_", [2, 2])]);
  2042. return self;
  2043. }
  2044. }),
  2045. smalltalk.PointTest);
  2046. smalltalk.addMethod(
  2047. "_testAt",
  2048. smalltalk.method({
  2049. selector: "testAt",
  2050. fn: function () {
  2051. var self = this;
  2052. smalltalk.send(self, "_assert_equals_", [smalltalk.send(3, "__at", [4]), smalltalk.send(smalltalk.Point || Point, "_x_y_", [3, 4])]);
  2053. return self;
  2054. }
  2055. }),
  2056. smalltalk.PointTest);
  2057. smalltalk.addMethod(
  2058. "_testEgality",
  2059. smalltalk.method({
  2060. selector: "testEgality",
  2061. fn: function () {
  2062. var self = this;
  2063. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(3, "__at", [4]), "__eq", [smalltalk.send(3, "__at", [4])])]);
  2064. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(3, "__at", [5]), "__eq", [smalltalk.send(3, "__at", [6])])]);
  2065. return self;
  2066. }
  2067. }),
  2068. smalltalk.PointTest);
  2069. smalltalk.addMethod(
  2070. "_testTranslateBy",
  2071. smalltalk.method({
  2072. selector: "testTranslateBy",
  2073. fn: function () {
  2074. var self = this;
  2075. smalltalk.send(self, "_assert_equals_", [smalltalk.send(3, "__at", [4]), smalltalk.send(smalltalk.send(3, "__at", [3]), "_translateBy_", [smalltalk.send(0, "__at", [1])])]);
  2076. 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", [])])])]);
  2077. smalltalk.send(self, "_assert_equals_", [smalltalk.send(5, "__at", [6]), smalltalk.send(smalltalk.send(3, "__at", [3]), "_translateBy_", [smalltalk.send(2, "__at", [3])])]);
  2078. 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])])]);
  2079. return self;
  2080. }
  2081. }),
  2082. smalltalk.PointTest);
  2083. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2084. smalltalk.addMethod(
  2085. "_textNext",
  2086. smalltalk.method({
  2087. selector: "textNext",
  2088. fn: function () {
  2089. var self = this;
  2090. smalltalk.send(10000, "_timesRepeat_", [function () {var current;var next;next = smalltalk.send(smalltalk.send(smalltalk.Random || Random, "_new", []), "_next", []);smalltalk.send(self, "_assert_", [smalltalk.send(next, "__gt_eq", [0])]);smalltalk.send(self, "_assert_", [smalltalk.send(next, "__lt", [1])]);smalltalk.send(self, "_deny_", [smalltalk.send(current, "__eq", [next])]);return smalltalk.send(next, "__eq", [current]);}]);
  2091. return self;
  2092. }
  2093. }),
  2094. smalltalk.RandomTest);
  2095. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2096. smalltalk.addMethod(
  2097. "_testAddRemove",
  2098. smalltalk.method({
  2099. selector: "testAddRemove",
  2100. fn: function () {
  2101. var self = this;
  2102. var set;
  2103. set = smalltalk.send(smalltalk.Set || Set, "_new", []);
  2104. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_isEmpty", [])]);
  2105. smalltalk.send(set, "_add_", [3]);
  2106. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [3])]);
  2107. smalltalk.send(set, "_add_", [5]);
  2108. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [5])]);
  2109. smalltalk.send(set, "_remove_", [3]);
  2110. smalltalk.send(self, "_deny_", [smalltalk.send(set, "_includes_", [3])]);
  2111. return self;
  2112. }
  2113. }),
  2114. smalltalk.SetTest);
  2115. smalltalk.addMethod(
  2116. "_testAt",
  2117. smalltalk.method({
  2118. selector: "testAt",
  2119. fn: function () {
  2120. var self = this;
  2121. smalltalk.send(self, "_should_raise_", [function () {return smalltalk.send(smalltalk.send(smalltalk.Set || Set, "_new", []), "_at_put_", [1, 2]);}, smalltalk.Error || Error]);
  2122. return self;
  2123. }
  2124. }),
  2125. smalltalk.SetTest);
  2126. smalltalk.addMethod(
  2127. "_testPrintString",
  2128. smalltalk.method({
  2129. selector: "testPrintString",
  2130. fn: function () {
  2131. var self = this;
  2132. var $1, $2;
  2133. var set;
  2134. set = smalltalk.send(smalltalk.Set || Set, "_new", []);
  2135. smalltalk.send(self, "_assert_equals_", ["a Set ()", smalltalk.send(set, "_printString", [])]);
  2136. smalltalk.send(set, "_add_", [1]);
  2137. $1 = smalltalk.send(set, "_add_", [3]);
  2138. smalltalk.send(self, "_assert_equals_", ["a Set (1 3)", smalltalk.send(set, "_printString", [])]);
  2139. smalltalk.send(set, "_add_", ["foo"]);
  2140. smalltalk.send(self, "_assert_equals_", ["a Set (1 3 'foo')", smalltalk.send(set, "_printString", [])]);
  2141. smalltalk.send(set, "_remove_", [1]);
  2142. $2 = smalltalk.send(set, "_remove_", [3]);
  2143. smalltalk.send(self, "_assert_equals_", ["a Set ('foo')", smalltalk.send(set, "_printString", [])]);
  2144. smalltalk.send(set, "_add_", [3]);
  2145. smalltalk.send(self, "_assert_equals_", ["a Set ('foo' 3)", smalltalk.send(set, "_printString", [])]);
  2146. smalltalk.send(set, "_add_", [3]);
  2147. smalltalk.send(self, "_assert_equals_", ["a Set ('foo' 3)", smalltalk.send(set, "_printString", [])]);
  2148. return self;
  2149. }
  2150. }),
  2151. smalltalk.SetTest);
  2152. smalltalk.addMethod(
  2153. "_testSize",
  2154. smalltalk.method({
  2155. selector: "testSize",
  2156. fn: function () {
  2157. var self = this;
  2158. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.Set || Set, "_new", []), "_size", []), 0]);
  2159. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.Set || Set, "_withAll_", [[1, 2, 3, 4]]), "_size", []), 4]);
  2160. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.Set || Set, "_withAll_", [[1, 1, 1, 1]]), "_size", []), 1]);
  2161. return self;
  2162. }
  2163. }),
  2164. smalltalk.SetTest);
  2165. smalltalk.addMethod(
  2166. "_testUnicity",
  2167. smalltalk.method({
  2168. selector: "testUnicity",
  2169. fn: function () {
  2170. var self = this;
  2171. var set;
  2172. set = smalltalk.send(smalltalk.Set || Set, "_new", []);
  2173. smalltalk.send(set, "_add_", [21]);
  2174. smalltalk.send(set, "_add_", ["hello"]);
  2175. smalltalk.send(set, "_add_", [21]);
  2176. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [2])]);
  2177. smalltalk.send(set, "_add_", ["hello"]);
  2178. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [2])]);
  2179. smalltalk.send(self, "_assert_equals_", [smalltalk.send(set, "_asArray", []), [21, "hello"]]);
  2180. return self;
  2181. }
  2182. }),
  2183. smalltalk.SetTest);
  2184. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2185. smalltalk.addMethod(
  2186. "_testCopying",
  2187. smalltalk.method({
  2188. selector: "testCopying",
  2189. fn: function () {
  2190. var self = this;
  2191. smalltalk.send(self, "_assert_equals_", [smalltalk.send(nil, "_copy", []), nil]);
  2192. return self;
  2193. }
  2194. }),
  2195. smalltalk.UndefinedTest);
  2196. smalltalk.addMethod(
  2197. "_testDeepCopy",
  2198. smalltalk.method({
  2199. selector: "testDeepCopy",
  2200. fn: function () {
  2201. var self = this;
  2202. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(nil, "_deepCopy", []), "__eq", [nil])]);
  2203. return self;
  2204. }
  2205. }),
  2206. smalltalk.UndefinedTest);
  2207. smalltalk.addMethod(
  2208. "_testIfNil",
  2209. smalltalk.method({
  2210. selector: "testIfNil",
  2211. fn: function () {
  2212. var self = this;
  2213. var $1, $2, $3;
  2214. if (($receiver = nil) == nil || $receiver == undefined) {
  2215. $1 = true;
  2216. } else {
  2217. $1 = nil;
  2218. }
  2219. smalltalk.send(self, "_assert_equals_", [$1, true]);
  2220. if (($receiver = nil) == nil || $receiver == undefined) {
  2221. $2 = nil;
  2222. } else {
  2223. $2 = true;
  2224. }
  2225. smalltalk.send(self, "_deny_", [smalltalk.send($2, "__eq", [true])]);
  2226. if (($receiver = nil) == nil || $receiver == undefined) {
  2227. $3 = true;
  2228. } else {
  2229. $3 = false;
  2230. }
  2231. smalltalk.send(self, "_assert_equals_", [$3, true]);
  2232. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(nil, "_ifNotNil_ifNil_", [function () {return true;}, function () {return false;}]), "__eq", [true])]);
  2233. return self;
  2234. }
  2235. }),
  2236. smalltalk.UndefinedTest);
  2237. smalltalk.addMethod(
  2238. "_testIsNil",
  2239. smalltalk.method({
  2240. selector: "testIsNil",
  2241. fn: function () {
  2242. var self = this;
  2243. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "_isNil", [])]);
  2244. smalltalk.send(self, "_deny_", [smalltalk.send(nil, "_notNil", [])]);
  2245. return self;
  2246. }
  2247. }),
  2248. smalltalk.UndefinedTest);