Kernel-Tests.deploy.js 118 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. "_testCanClearInterval",
  5. smalltalk.method({
  6. selector: "testCanClearInterval",
  7. fn: function () {
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) { _st(self)._shouldnt_raise_((function(){
  10. return smalltalk.withContext(function($ctx2) { return _st(_st((function(){
  11. return smalltalk.withContext(function($ctx3) { return _st(_st((smalltalk.Error || Error))._new())._signal();
  12. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._valueWithInterval_((0)))._clearInterval();
  13. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  14. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{}, smalltalk.BlockClosureTest)});}
  15. }),
  16. smalltalk.BlockClosureTest);
  17. smalltalk.addMethod(
  18. "_testCanClearTimeout",
  19. smalltalk.method({
  20. selector: "testCanClearTimeout",
  21. fn: function () {
  22. var self=this;
  23. return smalltalk.withContext(function($ctx1) { _st(self)._shouldnt_raise_((function(){
  24. return smalltalk.withContext(function($ctx2) { return _st(_st((function(){
  25. return smalltalk.withContext(function($ctx3) { return _st(_st((smalltalk.Error || Error))._new())._signal();
  26. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._valueWithTimeout_((0)))._clearTimeout();
  27. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  28. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{}, smalltalk.BlockClosureTest)});}
  29. }),
  30. smalltalk.BlockClosureTest);
  31. smalltalk.addMethod(
  32. "_testCompiledSource",
  33. smalltalk.method({
  34. selector: "testCompiledSource",
  35. fn: function () {
  36. var self=this;
  37. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((function(){
  38. return smalltalk.withContext(function($ctx2) { return _st((1)).__plus((1));
  39. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._compiledSource())._includesSubString_("function"));
  40. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{}, smalltalk.BlockClosureTest)});}
  41. }),
  42. smalltalk.BlockClosureTest);
  43. smalltalk.addMethod(
  44. "_testCurrySelf",
  45. smalltalk.method({
  46. selector: "testCurrySelf",
  47. fn: function () {
  48. var self=this;
  49. var curriedMethod,array;
  50. return smalltalk.withContext(function($ctx1) { curriedMethod=_st(_st((function(selfarg,x){
  51. return smalltalk.withContext(function($ctx2) { return _st(selfarg)._at_(x);
  52. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1)})}))._currySelf())._asCompiledMethod_("foo:");
  53. array=[(3), (1), (4)];
  54. _st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._installMethod_forClass_category_(curriedMethod,(smalltalk.Array || Array),"**test helper");
  55. _st((function(){
  56. return smalltalk.withContext(function($ctx2) { return _st(self)._assert_equals_((1),_st(array)._foo_((2)));
  57. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  58. return smalltalk.withContext(function($ctx2) { return _st((smalltalk.Array || Array))._removeCompiledMethod_(curriedMethod);
  59. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  60. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array}, smalltalk.BlockClosureTest)});}
  61. }),
  62. smalltalk.BlockClosureTest);
  63. smalltalk.addMethod(
  64. "_testEnsure",
  65. smalltalk.method({
  66. selector: "testEnsure",
  67. fn: function () {
  68. var self=this;
  69. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_((3),_st((function(){
  70. return smalltalk.withContext(function($ctx2) { return (3);
  71. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  72. return smalltalk.withContext(function($ctx2) { return (4);
  73. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  74. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{}, smalltalk.BlockClosureTest)});}
  75. }),
  76. smalltalk.BlockClosureTest);
  77. smalltalk.addMethod(
  78. "_testEnsureRaises",
  79. smalltalk.method({
  80. selector: "testEnsureRaises",
  81. fn: function () {
  82. var self=this;
  83. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  84. return smalltalk.withContext(function($ctx2) { return _st((function(){
  85. return smalltalk.withContext(function($ctx3) { return _st(_st((smalltalk.Error || Error))._new())._signal();
  86. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._ensure_((function(){
  87. return smalltalk.withContext(function($ctx3) { return true;
  88. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  89. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  90. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{}, smalltalk.BlockClosureTest)});}
  91. }),
  92. smalltalk.BlockClosureTest);
  93. smalltalk.addMethod(
  94. "_testExceptionSemantics",
  95. smalltalk.method({
  96. selector: "testExceptionSemantics",
  97. fn: function () {
  98. var self=this;
  99. return smalltalk.withContext(function($ctx1) { _st(self)._timeout_((100));
  100. _st(_st(self)._async_((function(){
  101. return smalltalk.withContext(function($ctx2) { return _st((function(){
  102. return smalltalk.withContext(function($ctx3) { _st(self)._assert_(true);
  103. _st((smalltalk.Error || Error))._signal();
  104. _st(self)._deny_(true);
  105. return _st(self)._finished();
  106. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(ex){
  107. return smalltalk.withContext(function($ctx3) { return _st(self)._finished();
  108. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx1)})}));
  109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((0));
  110. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{}, smalltalk.BlockClosureTest)});}
  111. }),
  112. smalltalk.BlockClosureTest);
  113. smalltalk.addMethod(
  114. "_testNumArgs",
  115. smalltalk.method({
  116. selector: "testNumArgs",
  117. fn: function () {
  118. var self=this;
  119. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((function(){
  120. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._numArgs(),(0));
  121. _st(self)._assert_equals_(_st((function(a,b){
  122. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._numArgs(),(2));
  123. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{}, smalltalk.BlockClosureTest)});}
  124. }),
  125. smalltalk.BlockClosureTest);
  126. smalltalk.addMethod(
  127. "_testOnDo",
  128. smalltalk.method({
  129. selector: "testOnDo",
  130. fn: function () {
  131. var self=this;
  132. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((function(){
  133. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Error || Error))._new())._signal();
  134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(ex){
  135. return smalltalk.withContext(function($ctx2) { return true;
  136. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})})));
  137. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{}, smalltalk.BlockClosureTest)});}
  138. }),
  139. smalltalk.BlockClosureTest);
  140. smalltalk.addMethod(
  141. "_testValue",
  142. smalltalk.method({
  143. selector: "testValue",
  144. fn: function () {
  145. var self=this;
  146. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((function(){
  147. return smalltalk.withContext(function($ctx2) { return _st((1)).__plus((1));
  148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._value(),(2));
  149. _st(self)._assert_equals_(_st((function(x){
  150. return smalltalk.withContext(function($ctx2) { return _st(x).__plus((1));
  151. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}))._value_((2)),(3));
  152. _st(self)._assert_equals_(_st((function(x,y){
  153. return smalltalk.withContext(function($ctx2) { return _st(x).__star(y);
  154. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1)})}))._value_value_((2),(4)),(8));
  155. _st(self)._assert_equals_(_st((function(a,b,c){
  156. return smalltalk.withContext(function($ctx2) { return (1);
  157. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1)})}))._value(),(1));
  158. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{}, smalltalk.BlockClosureTest)});}
  159. }),
  160. smalltalk.BlockClosureTest);
  161. smalltalk.addMethod(
  162. "_testValueWithPossibleArguments",
  163. smalltalk.method({
  164. selector: "testValueWithPossibleArguments",
  165. fn: function () {
  166. var self=this;
  167. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((function(){
  168. return smalltalk.withContext(function($ctx2) { return (1);
  169. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(1));
  170. _st(self)._assert_equals_(_st((function(a){
  171. return smalltalk.withContext(function($ctx2) { return _st(a).__plus((4));
  172. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(7));
  173. _st(self)._assert_equals_(_st((function(a,b){
  174. return smalltalk.withContext(function($ctx2) { return _st(a).__plus(b);
  175. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  176. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{}, smalltalk.BlockClosureTest)});}
  177. }),
  178. smalltalk.BlockClosureTest);
  179. smalltalk.addMethod(
  180. "_testWhileFalse",
  181. smalltalk.method({
  182. selector: "testWhileFalse",
  183. fn: function () {
  184. var self=this;
  185. var i;
  186. return smalltalk.withContext(function($ctx1) { i=(0);
  187. _st((function(){
  188. return smalltalk.withContext(function($ctx2) { return _st(i).__gt((5));
  189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  190. return smalltalk.withContext(function($ctx2) { i=_st(i).__plus((1));
  191. return i;
  192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  193. _st(self)._assert_equals_(i,(6));
  194. i=(0);
  195. _st((function(){
  196. return smalltalk.withContext(function($ctx2) { i=_st(i).__plus((1));
  197. i;
  198. return _st(i).__gt((5));
  199. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse();
  200. _st(self)._assert_equals_(i,(6));
  201. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i}, smalltalk.BlockClosureTest)});}
  202. }),
  203. smalltalk.BlockClosureTest);
  204. smalltalk.addMethod(
  205. "_testWhileTrue",
  206. smalltalk.method({
  207. selector: "testWhileTrue",
  208. fn: function () {
  209. var self=this;
  210. var i;
  211. return smalltalk.withContext(function($ctx1) { i=(0);
  212. _st((function(){
  213. return smalltalk.withContext(function($ctx2) { return _st(i).__lt((5));
  214. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  215. return smalltalk.withContext(function($ctx2) { i=_st(i).__plus((1));
  216. return i;
  217. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  218. _st(self)._assert_equals_(i,(5));
  219. i=(0);
  220. _st((function(){
  221. return smalltalk.withContext(function($ctx2) { i=_st(i).__plus((1));
  222. i;
  223. return _st(i).__lt((5));
  224. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue();
  225. _st(self)._assert_equals_(i,(5));
  226. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i}, smalltalk.BlockClosureTest)});}
  227. }),
  228. smalltalk.BlockClosureTest);
  229. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  230. smalltalk.addMethod(
  231. "_testEquality",
  232. smalltalk.method({
  233. selector: "testEquality",
  234. fn: function () {
  235. var self=this;
  236. return smalltalk.withContext(function($ctx1) { _st(self)._deny_(_st((0)).__eq(false));
  237. _st(self)._deny_(_st(false).__eq((0)));
  238. _st(self)._deny_(_st("").__eq(false));
  239. _st(self)._deny_(_st(false).__eq(""));
  240. _st(self)._assert_(_st(true).__eq(true));
  241. _st(self)._deny_(_st(false).__eq(true));
  242. _st(self)._deny_(_st(true).__eq(false));
  243. _st(self)._assert_(_st(false).__eq(false));
  244. _st(self)._assert_(_st(_st(true)._yourself()).__eq(true));
  245. _st(self)._assert_(_st(_st(true)._yourself()).__eq(_st(true)._yourself()));
  246. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{}, smalltalk.BooleanTest)});}
  247. }),
  248. smalltalk.BooleanTest);
  249. smalltalk.addMethod(
  250. "_testIdentity",
  251. smalltalk.method({
  252. selector: "testIdentity",
  253. fn: function () {
  254. var self=this;
  255. return smalltalk.withContext(function($ctx1) { _st(self)._deny_(_st((0)).__eq_eq(false));
  256. _st(self)._deny_(_st(false).__eq_eq((0)));
  257. _st(self)._deny_(_st("").__eq_eq(false));
  258. _st(self)._deny_(_st(false).__eq_eq(""));
  259. _st(self)._assert_(_st(true).__eq_eq(true));
  260. _st(self)._deny_(_st(false).__eq_eq(true));
  261. _st(self)._deny_(_st(true).__eq_eq(false));
  262. _st(self)._assert_(_st(false).__eq_eq(false));
  263. _st(self)._assert_(_st(_st(true)._yourself()).__eq_eq(true));
  264. _st(self)._assert_(_st(_st(true)._yourself()).__eq_eq(_st(true)._yourself()));
  265. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{}, smalltalk.BooleanTest)});}
  266. }),
  267. smalltalk.BooleanTest);
  268. smalltalk.addMethod(
  269. "_testIfTrueIfFalse",
  270. smalltalk.method({
  271. selector: "testIfTrueIfFalse",
  272. fn: function () {
  273. var self=this;
  274. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4,$6,$5,$7,$9,$8,$10,$12,$11,$13,$15,$14,$16,$18,$17,$19,$21,$20,$22,$24,$23;
  275. $1=self;
  276. if(smalltalk.assert(true)){
  277. $3="alternative block";
  278. };
  279. $2=_st($3).__eq("alternative block");
  280. _st($1)._assert_($2);
  281. $4=self;
  282. if(! smalltalk.assert(true)){
  283. $6="alternative block";
  284. };
  285. $5=_st($6).__eq(nil);
  286. _st($4)._assert_($5);
  287. $7=self;
  288. if(smalltalk.assert(false)){
  289. $9="alternative block";
  290. };
  291. $8=_st($9).__eq(nil);
  292. _st($7)._assert_($8);
  293. $10=self;
  294. if(! smalltalk.assert(false)){
  295. $12="alternative block";
  296. };
  297. $11=_st($12).__eq("alternative block");
  298. _st($10)._assert_($11);
  299. $13=self;
  300. if(smalltalk.assert(false)){
  301. $15="alternative block";
  302. } else {
  303. $15="alternative block2";
  304. };
  305. $14=_st($15).__eq("alternative block2");
  306. _st($13)._assert_($14);
  307. $16=self;
  308. if(smalltalk.assert(false)){
  309. $18="alternative block2";
  310. } else {
  311. $18="alternative block";
  312. };
  313. $17=_st($18).__eq("alternative block");
  314. _st($16)._assert_($17);
  315. $19=self;
  316. if(smalltalk.assert(true)){
  317. $21="alternative block";
  318. } else {
  319. $21="alternative block2";
  320. };
  321. $20=_st($21).__eq("alternative block");
  322. _st($19)._assert_($20);
  323. $22=self;
  324. if(smalltalk.assert(true)){
  325. $24="alternative block2";
  326. } else {
  327. $24="alternative block";
  328. };
  329. $23=_st($24).__eq("alternative block2");
  330. _st($22)._assert_($23);
  331. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{}, smalltalk.BooleanTest)});}
  332. }),
  333. smalltalk.BooleanTest);
  334. smalltalk.addMethod(
  335. "_testIfTrueIfFalseWithBoxing",
  336. smalltalk.method({
  337. selector: "testIfTrueIfFalseWithBoxing",
  338. fn: function () {
  339. var self=this;
  340. return smalltalk.withContext(function($ctx1) { var $1,$4,$3,$2,$5,$8,$7,$6,$9,$12,$11,$10,$13,$16,$15,$14,$17,$20,$19,$18,$21,$24,$23,$22,$25,$28,$27,$26,$29,$32,$31,$30;
  341. $1=self;
  342. $4=_st(true)._yourself();
  343. if(smalltalk.assert($4)){
  344. $3="alternative block";
  345. };
  346. $2=_st($3).__eq("alternative block");
  347. _st($1)._assert_($2);
  348. $5=self;
  349. $8=_st(true)._yourself();
  350. if(! smalltalk.assert($8)){
  351. $7="alternative block";
  352. };
  353. $6=_st($7).__eq(nil);
  354. _st($5)._assert_($6);
  355. $9=self;
  356. $12=_st(false)._yourself();
  357. if(smalltalk.assert($12)){
  358. $11="alternative block";
  359. };
  360. $10=_st($11).__eq(nil);
  361. _st($9)._assert_($10);
  362. $13=self;
  363. $16=_st(false)._yourself();
  364. if(! smalltalk.assert($16)){
  365. $15="alternative block";
  366. };
  367. $14=_st($15).__eq("alternative block");
  368. _st($13)._assert_($14);
  369. $17=self;
  370. $20=_st(false)._yourself();
  371. if(smalltalk.assert($20)){
  372. $19="alternative block";
  373. } else {
  374. $19="alternative block2";
  375. };
  376. $18=_st($19).__eq("alternative block2");
  377. _st($17)._assert_($18);
  378. $21=self;
  379. $24=_st(false)._yourself();
  380. if(smalltalk.assert($24)){
  381. $23="alternative block2";
  382. } else {
  383. $23="alternative block";
  384. };
  385. $22=_st($23).__eq("alternative block");
  386. _st($21)._assert_($22);
  387. $25=self;
  388. $28=_st(true)._yourself();
  389. if(smalltalk.assert($28)){
  390. $27="alternative block";
  391. } else {
  392. $27="alternative block2";
  393. };
  394. $26=_st($27).__eq("alternative block");
  395. _st($25)._assert_($26);
  396. $29=self;
  397. $32=_st(true)._yourself();
  398. if(smalltalk.assert($32)){
  399. $31="alternative block2";
  400. } else {
  401. $31="alternative block";
  402. };
  403. $30=_st($31).__eq("alternative block2");
  404. _st($29)._assert_($30);
  405. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{}, smalltalk.BooleanTest)});}
  406. }),
  407. smalltalk.BooleanTest);
  408. smalltalk.addMethod(
  409. "_testLogic",
  410. smalltalk.method({
  411. selector: "testLogic",
  412. fn: function () {
  413. var self=this;
  414. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5,$6,$7,$8;
  415. $1=self;
  416. _st($1)._assert_(_st(true).__and(true));
  417. _st($1)._deny_(_st(true).__and(false));
  418. _st($1)._deny_(_st(false).__and(true));
  419. $2=_st($1)._deny_(_st(false).__and(false));
  420. $3=self;
  421. _st($3)._assert_(_st(true).__or(true));
  422. _st($3)._assert_(_st(true).__or(false));
  423. _st($3)._assert_(_st(false).__or(true));
  424. $4=_st($3)._deny_(_st(false).__or(false));
  425. $5=self;
  426. _st($5)._assert_(_st(true).__and(_st((1)).__gt((0))));
  427. _st($5)._deny_(_st(_st((1)).__gt((0))).__and(false));
  428. $6=_st($5)._deny_(_st(_st((1)).__gt((0))).__and(_st((1)).__gt((2))));
  429. $7=self;
  430. _st($7)._assert_(_st(false).__or(_st((1)).__gt((0))));
  431. _st($7)._assert_(_st(_st((1)).__gt((0))).__or(false));
  432. $8=_st($7)._assert_(_st(_st((1)).__gt((0))).__or(_st((1)).__gt((2))));
  433. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{}, smalltalk.BooleanTest)});}
  434. }),
  435. smalltalk.BooleanTest);
  436. smalltalk.addMethod(
  437. "_testLogicKeywords",
  438. smalltalk.method({
  439. selector: "testLogicKeywords",
  440. fn: function () {
  441. var self=this;
  442. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5,$6,$7,$8;
  443. $1=self;
  444. _st($1)._assert_(_st(true)._and_((function(){
  445. return smalltalk.withContext(function($ctx2) { return true;
  446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  447. _st($1)._deny_(_st(true)._and_((function(){
  448. return smalltalk.withContext(function($ctx2) { return false;
  449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  450. _st($1)._deny_(_st(false)._and_((function(){
  451. return smalltalk.withContext(function($ctx2) { return true;
  452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  453. $2=_st($1)._deny_(_st(false)._and_((function(){
  454. return smalltalk.withContext(function($ctx2) { return false;
  455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  456. $3=self;
  457. _st($3)._assert_(_st(true)._or_((function(){
  458. return smalltalk.withContext(function($ctx2) { return true;
  459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  460. _st($3)._assert_(_st(true)._or_((function(){
  461. return smalltalk.withContext(function($ctx2) { return false;
  462. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  463. _st($3)._assert_(_st(false)._or_((function(){
  464. return smalltalk.withContext(function($ctx2) { return true;
  465. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  466. $4=_st($3)._deny_(_st(false)._or_((function(){
  467. return smalltalk.withContext(function($ctx2) { return false;
  468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  469. $5=self;
  470. _st($5)._assert_(_st(true)._and_((function(){
  471. return smalltalk.withContext(function($ctx2) { return _st((1)).__gt((0));
  472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  473. _st($5)._deny_(_st(_st((1)).__gt((0)))._and_((function(){
  474. return smalltalk.withContext(function($ctx2) { return false;
  475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  476. $6=_st($5)._deny_(_st(_st((1)).__gt((0)))._and_((function(){
  477. return smalltalk.withContext(function($ctx2) { return _st((1)).__gt((2));
  478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  479. $7=self;
  480. _st($7)._assert_(_st(false)._or_((function(){
  481. return smalltalk.withContext(function($ctx2) { return _st((1)).__gt((0));
  482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  483. _st($7)._assert_(_st(_st((1)).__gt((0)))._or_((function(){
  484. return smalltalk.withContext(function($ctx2) { return false;
  485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  486. $8=_st($7)._assert_(_st(_st((1)).__gt((0)))._or_((function(){
  487. return smalltalk.withContext(function($ctx2) { return _st((1)).__gt((2));
  488. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  489. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{}, smalltalk.BooleanTest)});}
  490. }),
  491. smalltalk.BooleanTest);
  492. smalltalk.addMethod(
  493. "_testNonBooleanError",
  494. smalltalk.method({
  495. selector: "testNonBooleanError",
  496. fn: function () {
  497. var self=this;
  498. return smalltalk.withContext(function($ctx1) { var $1,$2;
  499. $1=self;
  500. $2=(function(){
  501. return smalltalk.withContext(function($ctx2) { if(smalltalk.assert("")){
  502. } else {
  503. };
  504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  505. _st($1)._should_raise_($2,(smalltalk.NonBooleanReceiver || NonBooleanReceiver));
  506. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{}, smalltalk.BooleanTest)});}
  507. }),
  508. smalltalk.BooleanTest);
  509. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  510. smalltalk.addMethod(
  511. "_setUp",
  512. smalltalk.method({
  513. selector: "setUp",
  514. fn: function () {
  515. var self=this;
  516. return smalltalk.withContext(function($ctx1) { self["@builder"]=_st((smalltalk.ClassBuilder || ClassBuilder))._new();
  517. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{}, smalltalk.ClassBuilderTest)});}
  518. }),
  519. smalltalk.ClassBuilderTest);
  520. smalltalk.addMethod(
  521. "_tearDown",
  522. smalltalk.method({
  523. selector: "tearDown",
  524. fn: function () {
  525. var self=this;
  526. return smalltalk.withContext(function($ctx1) { var $1;
  527. $1=self["@theClass"];
  528. if(($receiver = $1) == nil || $receiver == undefined){
  529. $1;
  530. } else {
  531. _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_(self["@theClass"]);
  532. self["@theClass"]=nil;
  533. self["@theClass"];
  534. };
  535. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{}, smalltalk.ClassBuilderTest)});}
  536. }),
  537. smalltalk.ClassBuilderTest);
  538. smalltalk.addMethod(
  539. "_testClassCopy",
  540. smalltalk.method({
  541. selector: "testClassCopy",
  542. fn: function () {
  543. var self=this;
  544. return smalltalk.withContext(function($ctx1) { self["@theClass"]=_st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  545. _st(self)._assert_(_st(_st(self["@theClass"])._superclass()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._superclass()));
  546. _st(self)._assert_(_st(_st(self["@theClass"])._instanceVariableNames()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._instanceVariableNames()));
  547. _st(self)._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  548. _st(self)._assert_(_st(_st(self["@theClass"])._package()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._package()));
  549. _st(self)._assert_equals_(_st(_st(self["@theClass"])._methodDictionary())._keys(),_st(_st((smalltalk.ObjectMock || ObjectMock))._methodDictionary())._keys());
  550. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{}, smalltalk.ClassBuilderTest)});}
  551. }),
  552. smalltalk.ClassBuilderTest);
  553. smalltalk.addMethod(
  554. "_testClassMigration",
  555. smalltalk.method({
  556. selector: "testClassMigration",
  557. fn: function () {
  558. var self=this;
  559. var instance,oldClass;
  560. return smalltalk.withContext(function($ctx1) { oldClass=_st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  561. instance=_st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("ObjectMock2"))._new();
  562. _st((smalltalk.ObjectMock || ObjectMock))._subclass_instanceVariableNames_package_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("ObjectMock2"),"","Kernel-Tests");
  563. _st(self)._deny_(_st(oldClass).__eq_eq((smalltalk.ObjectMock2 || ObjectMock2)));
  564. _st(self)._assert_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._superclass()).__eq_eq((smalltalk.ObjectMock || ObjectMock)));
  565. _st(self)._assert_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._instanceVariableNames())._isEmpty());
  566. _st(self)._assert_equals_(_st((smalltalk.ObjectMock2 || ObjectMock2))._selectors(),_st(oldClass)._selectors());
  567. _st(self)._assert_equals_(_st((smalltalk.ObjectMock2 || ObjectMock2))._comment(),_st(oldClass)._comment());
  568. _st(self)._assert_equals_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._package())._name(),"Kernel-Tests");
  569. _st(self)._deny_(_st(_st(instance)._class()).__eq_eq((smalltalk.ObjectMock2 || ObjectMock2)));
  570. _st(self)._assert_equals_(_st(_st(instance)._class())._name(),"OldObjectMock2");
  571. _st(self)._assert_(_st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("OldObjectMock2"))._isNil());
  572. _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_((smalltalk.ObjectMock2 || ObjectMock2));
  573. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass}, smalltalk.ClassBuilderTest)});}
  574. }),
  575. smalltalk.ClassBuilderTest);
  576. smalltalk.addMethod(
  577. "_testClassMigrationWithClassInstanceVariables",
  578. smalltalk.method({
  579. selector: "testClassMigrationWithClassInstanceVariables",
  580. fn: function () {
  581. var self=this;
  582. return smalltalk.withContext(function($ctx1) { _st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  583. _st(_st((smalltalk.ObjectMock2 || ObjectMock2))._class())._instanceVariableNames_("foo bar");
  584. _st((smalltalk.ObjectMock || ObjectMock))._subclass_instanceVariableNames_package_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("ObjectMock2"),"","Kernel-Tests");
  585. _st(self)._assert_equals_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._class())._instanceVariableNames(),["foo", "bar"]);
  586. _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_((smalltalk.ObjectMock2 || ObjectMock2));
  587. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{}, smalltalk.ClassBuilderTest)});}
  588. }),
  589. smalltalk.ClassBuilderTest);
  590. smalltalk.addMethod(
  591. "_testClassMigrationWithSubclasses",
  592. smalltalk.method({
  593. selector: "testClassMigrationWithSubclasses",
  594. fn: function () {
  595. var self=this;
  596. return smalltalk.withContext(function($ctx1) { _st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  597. _st((smalltalk.ObjectMock2 || ObjectMock2))._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  598. _st((smalltalk.ObjectMock3 || ObjectMock3))._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  599. _st((smalltalk.ObjectMock || ObjectMock))._subclass_instanceVariableNames_package_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("ObjectMock2"),"","Kernel-Tests");
  600. _st(self)._assert_(_st(_st((smalltalk.ObjectMock || ObjectMock))._subclasses())._includes_((smalltalk.ObjectMock2 || ObjectMock2)));
  601. _st(self)._assert_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._subclasses())._includes_((smalltalk.ObjectMock3 || ObjectMock3)));
  602. _st(self)._assert_(_st(_st((smalltalk.ObjectMock3 || ObjectMock3))._subclasses())._includes_((smalltalk.ObjectMock4 || ObjectMock4)));
  603. _st(_st((smalltalk.ObjectMock || ObjectMock))._allSubclasses())._do_((function(each){
  604. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_(each);
  605. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  606. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{}, smalltalk.ClassBuilderTest)});}
  607. }),
  608. smalltalk.ClassBuilderTest);
  609. smalltalk.addMethod(
  610. "_testInstanceVariableNames",
  611. smalltalk.method({
  612. selector: "testInstanceVariableNames",
  613. fn: function () {
  614. var self=this;
  615. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  616. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{}, smalltalk.ClassBuilderTest)});}
  617. }),
  618. smalltalk.ClassBuilderTest);
  619. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  620. smalltalk.addMethod(
  621. "_assertSameContents_as_",
  622. smalltalk.method({
  623. selector: "assertSameContents:as:",
  624. fn: function (aCollection, anotherCollection) {
  625. var self=this;
  626. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(aCollection)._size()).__eq(_st(anotherCollection)._size()));
  627. _st(aCollection)._do_((function(each){
  628. return smalltalk.withContext(function($ctx2) { return _st(self)._assert_(_st(_st(aCollection)._occurrencesOf_(each)).__eq(_st(anotherCollection)._occurrencesOf_(each)));
  629. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  630. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection}, smalltalk.CollectionTest)});}
  631. }),
  632. smalltalk.CollectionTest);
  633. smalltalk.addMethod(
  634. "_collection",
  635. smalltalk.method({
  636. selector: "collection",
  637. fn: function () {
  638. var self=this;
  639. return smalltalk.withContext(function($ctx1) { var $1;
  640. $1=_st(_st(self)._collectionClass())._withAll_(_st(self)._defaultValues());
  641. return $1;
  642. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.CollectionTest)});}
  643. }),
  644. smalltalk.CollectionTest);
  645. smalltalk.addMethod(
  646. "_collectionClass",
  647. smalltalk.method({
  648. selector: "collectionClass",
  649. fn: function () {
  650. var self=this;
  651. return smalltalk.withContext(function($ctx1) { var $1;
  652. $1=_st(_st(self)._class())._collectionClass();
  653. return $1;
  654. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.CollectionTest)});}
  655. }),
  656. smalltalk.CollectionTest);
  657. smalltalk.addMethod(
  658. "_collectionWithDuplicates",
  659. smalltalk.method({
  660. selector: "collectionWithDuplicates",
  661. fn: function () {
  662. var self=this;
  663. return smalltalk.withContext(function($ctx1) { var $1;
  664. $1=_st(_st(self)._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  665. return $1;
  666. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.CollectionTest)});}
  667. }),
  668. smalltalk.CollectionTest);
  669. smalltalk.addMethod(
  670. "_defaultValues",
  671. smalltalk.method({
  672. selector: "defaultValues",
  673. fn: function () {
  674. var self=this;
  675. return smalltalk.withContext(function($ctx1) { return [(1), (2), (3), (-4)];
  676. }, function($ctx1) {$ctx1.fill(self,"defaultValues",{}, smalltalk.CollectionTest)});}
  677. }),
  678. smalltalk.CollectionTest);
  679. smalltalk.addMethod(
  680. "_isCollectionReadOnly",
  681. smalltalk.method({
  682. selector: "isCollectionReadOnly",
  683. fn: function () {
  684. var self=this;
  685. return smalltalk.withContext(function($ctx1) { return false;
  686. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{}, smalltalk.CollectionTest)});}
  687. }),
  688. smalltalk.CollectionTest);
  689. smalltalk.addMethod(
  690. "_testAsArray",
  691. smalltalk.method({
  692. selector: "testAsArray",
  693. fn: function () {
  694. var self=this;
  695. return smalltalk.withContext(function($ctx1) { _st(self)._assertSameContents_as_(_st(self)._collection(),_st(_st(self)._collection())._asArray());
  696. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{}, smalltalk.CollectionTest)});}
  697. }),
  698. smalltalk.CollectionTest);
  699. smalltalk.addMethod(
  700. "_testAsOrderedCollection",
  701. smalltalk.method({
  702. selector: "testAsOrderedCollection",
  703. fn: function () {
  704. var self=this;
  705. return smalltalk.withContext(function($ctx1) { _st(self)._assertSameContents_as_(_st(self)._collection(),_st(_st(self)._collection())._asOrderedCollection());
  706. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{}, smalltalk.CollectionTest)});}
  707. }),
  708. smalltalk.CollectionTest);
  709. smalltalk.addMethod(
  710. "_testAsSet",
  711. smalltalk.method({
  712. selector: "testAsSet",
  713. fn: function () {
  714. var self=this;
  715. var c,set;
  716. return smalltalk.withContext(function($ctx1) { c=_st(self)._collectionWithDuplicates();
  717. set=_st(c)._asSet();
  718. _st(self)._assert_(_st(_st(set)._size()).__eq((5)));
  719. _st(c)._do_((function(each){
  720. return smalltalk.withContext(function($ctx2) { return _st(self)._assert_(_st(set)._includes_(each));
  721. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  722. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set}, smalltalk.CollectionTest)});}
  723. }),
  724. smalltalk.CollectionTest);
  725. smalltalk.addMethod(
  726. "_testCollect",
  727. smalltalk.method({
  728. selector: "testCollect",
  729. fn: function () {
  730. var self=this;
  731. var newCollection;
  732. return smalltalk.withContext(function($ctx1) { newCollection=[(1), (2), (3), (4)];
  733. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  734. return smalltalk.withContext(function($ctx2) { return _st(each)._abs();
  735. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  736. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection}, smalltalk.CollectionTest)});}
  737. }),
  738. smalltalk.CollectionTest);
  739. smalltalk.addMethod(
  740. "_testDetect",
  741. smalltalk.method({
  742. selector: "testDetect",
  743. fn: function () {
  744. var self=this;
  745. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._detect_((function(each){
  746. return smalltalk.withContext(function($ctx2) { return _st(each).__lt((0));
  747. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__eq((-4)));
  748. _st(self)._should_raise_((function(){
  749. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._detect_((function(each){
  750. return smalltalk.withContext(function($ctx3) { return _st(each).__eq((6));
  751. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  753. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{}, smalltalk.CollectionTest)});}
  754. }),
  755. smalltalk.CollectionTest);
  756. smalltalk.addMethod(
  757. "_testDo",
  758. smalltalk.method({
  759. selector: "testDo",
  760. fn: function () {
  761. var self=this;
  762. var newCollection;
  763. return smalltalk.withContext(function($ctx1) { newCollection=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  764. _st(_st(self)._collection())._do_((function(each){
  765. return smalltalk.withContext(function($ctx2) { return _st(newCollection)._add_(each);
  766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  767. _st(self)._assertSameContents_as_(_st(self)._collection(),newCollection);
  768. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection}, smalltalk.CollectionTest)});}
  769. }),
  770. smalltalk.CollectionTest);
  771. smalltalk.addMethod(
  772. "_testIsEmpty",
  773. smalltalk.method({
  774. selector: "testIsEmpty",
  775. fn: function () {
  776. var self=this;
  777. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collectionClass())._new())._isEmpty());
  778. _st(self)._deny_(_st(_st(self)._collection())._isEmpty());
  779. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{}, smalltalk.CollectionTest)});}
  780. }),
  781. smalltalk.CollectionTest);
  782. smalltalk.addMethod(
  783. "_testSelect",
  784. smalltalk.method({
  785. selector: "testSelect",
  786. fn: function () {
  787. var self=this;
  788. var newCollection;
  789. return smalltalk.withContext(function($ctx1) { newCollection=[(2), (-4)];
  790. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  791. return smalltalk.withContext(function($ctx2) { return _st(each)._even();
  792. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  793. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection}, smalltalk.CollectionTest)});}
  794. }),
  795. smalltalk.CollectionTest);
  796. smalltalk.addMethod(
  797. "_testSize",
  798. smalltalk.method({
  799. selector: "testSize",
  800. fn: function () {
  801. var self=this;
  802. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(_st(self)._collectionClass())._new())._size()).__eq((0)));
  803. _st(self)._assert_(_st(_st(_st(self)._collection())._size()).__eq((4)));
  804. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{}, smalltalk.CollectionTest)});}
  805. }),
  806. smalltalk.CollectionTest);
  807. smalltalk.addMethod(
  808. "_collectionClass",
  809. smalltalk.method({
  810. selector: "collectionClass",
  811. fn: function () {
  812. var self=this;
  813. return smalltalk.withContext(function($ctx1) { return nil;
  814. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.CollectionTest.klass)});}
  815. }),
  816. smalltalk.CollectionTest.klass);
  817. smalltalk.addMethod(
  818. "_isAbstract",
  819. smalltalk.method({
  820. selector: "isAbstract",
  821. fn: function () {
  822. var self=this;
  823. return smalltalk.withContext(function($ctx1) { var $1;
  824. $1=_st(_st(self)._collectionClass())._isNil();
  825. return $1;
  826. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{}, smalltalk.CollectionTest.klass)});}
  827. }),
  828. smalltalk.CollectionTest.klass);
  829. smalltalk.addClass('HashedCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  830. smalltalk.addMethod(
  831. "_collection",
  832. smalltalk.method({
  833. selector: "collection",
  834. fn: function () {
  835. var self=this;
  836. return smalltalk.withContext(function($ctx1) { var $1;
  837. $1=smalltalk.HashedCollection._fromPairs_([_st("a").__minus_gt((1)),_st("b").__minus_gt((2)),_st("c").__minus_gt((3)),_st("d").__minus_gt((-4))]);
  838. return $1;
  839. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.HashedCollectionTest)});}
  840. }),
  841. smalltalk.HashedCollectionTest);
  842. smalltalk.addMethod(
  843. "_collectionWithDuplicates",
  844. smalltalk.method({
  845. selector: "collectionWithDuplicates",
  846. fn: function () {
  847. var self=this;
  848. return smalltalk.withContext(function($ctx1) { var $1;
  849. $1=smalltalk.HashedCollection._fromPairs_([_st("a").__minus_gt((1)),_st("b").__minus_gt((2)),_st("c").__minus_gt((3)),_st("d").__minus_gt((-4)),_st("e").__minus_gt((1)),_st("f").__minus_gt((2)),_st("g").__minus_gt((10))]);
  850. return $1;
  851. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.HashedCollectionTest)});}
  852. }),
  853. smalltalk.HashedCollectionTest);
  854. smalltalk.addMethod(
  855. "_collectionClass",
  856. smalltalk.method({
  857. selector: "collectionClass",
  858. fn: function () {
  859. var self=this;
  860. return smalltalk.withContext(function($ctx1) { var $1;
  861. $1=(smalltalk.HashedCollection || HashedCollection);
  862. return $1;
  863. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.HashedCollectionTest.klass)});}
  864. }),
  865. smalltalk.HashedCollectionTest.klass);
  866. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  867. smalltalk.addMethod(
  868. "_collection",
  869. smalltalk.method({
  870. selector: "collection",
  871. fn: function () {
  872. var self=this;
  873. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  874. $2=_st((smalltalk.Dictionary || Dictionary))._new();
  875. _st($2)._at_put_((1),(1));
  876. _st($2)._at_put_("a",(2));
  877. _st($2)._at_put_(true,(3));
  878. _st($2)._at_put_((4),(-4));
  879. $3=_st($2)._yourself();
  880. $1=$3;
  881. return $1;
  882. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.DictionaryTest)});}
  883. }),
  884. smalltalk.DictionaryTest);
  885. smalltalk.addMethod(
  886. "_collectionWithDuplicates",
  887. smalltalk.method({
  888. selector: "collectionWithDuplicates",
  889. fn: function () {
  890. var self=this;
  891. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  892. $2=_st((smalltalk.Dictionary || Dictionary))._new();
  893. _st($2)._at_put_((1),(1));
  894. _st($2)._at_put_("a",(2));
  895. _st($2)._at_put_(true,(3));
  896. _st($2)._at_put_((4),(-4));
  897. _st($2)._at_put_("b",(1));
  898. _st($2)._at_put_((3),(3));
  899. _st($2)._at_put_(false,(12));
  900. $3=_st($2)._yourself();
  901. $1=$3;
  902. return $1;
  903. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.DictionaryTest)});}
  904. }),
  905. smalltalk.DictionaryTest);
  906. smalltalk.addMethod(
  907. "_testAccessing",
  908. smalltalk.method({
  909. selector: "testAccessing",
  910. fn: function () {
  911. var self=this;
  912. var d;
  913. return smalltalk.withContext(function($ctx1) { d=_st((smalltalk.Dictionary || Dictionary))._new();
  914. _st(d)._at_put_("hello","world");
  915. _st(self)._assert_(_st(_st(d)._at_("hello")).__eq("world"));
  916. _st(self)._assert_(_st(_st(d)._at_ifAbsent_("hello",(function(){
  917. return smalltalk.withContext(function($ctx2) { return nil;
  918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq("world"));
  919. _st(self)._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  920. return smalltalk.withContext(function($ctx2) { return nil;
  921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq("world"));
  922. _st(d)._at_put_((1),(2));
  923. _st(self)._assert_(_st(_st(d)._at_((1))).__eq((2)));
  924. _st(d)._at_put_(_st((1)).__at((3)),(3));
  925. _st(self)._assert_(_st(_st(d)._at_(_st((1)).__at((3)))).__eq((3)));
  926. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d}, smalltalk.DictionaryTest)});}
  927. }),
  928. smalltalk.DictionaryTest);
  929. smalltalk.addMethod(
  930. "_testDynamicDictionaries",
  931. smalltalk.method({
  932. selector: "testDynamicDictionaries",
  933. fn: function () {
  934. var self=this;
  935. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(smalltalk.HashedCollection._fromPairs_([_st("hello").__minus_gt((1))]))._asDictionary()).__eq(_st((smalltalk.Dictionary || Dictionary))._with_(_st("hello").__minus_gt((1)))));
  936. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{}, smalltalk.DictionaryTest)});}
  937. }),
  938. smalltalk.DictionaryTest);
  939. smalltalk.addMethod(
  940. "_testEquality",
  941. smalltalk.method({
  942. selector: "testEquality",
  943. fn: function () {
  944. var self=this;
  945. var d1,d2;
  946. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  947. _st(self)._assert_(_st(_st((smalltalk.Dictionary || Dictionary))._new()).__eq(_st((smalltalk.Dictionary || Dictionary))._new()));
  948. $1=_st((smalltalk.Dictionary || Dictionary))._new();
  949. _st($1)._at_put_((1),(2));
  950. $2=_st($1)._yourself();
  951. d1=$2;
  952. $3=_st((smalltalk.Dictionary || Dictionary))._new();
  953. _st($3)._at_put_((1),(2));
  954. $4=_st($3)._yourself();
  955. d2=$4;
  956. _st(self)._assert_(_st(d1).__eq(d2));
  957. $5=_st((smalltalk.Dictionary || Dictionary))._new();
  958. _st($5)._at_put_((1),(3));
  959. $6=_st($5)._yourself();
  960. d2=$6;
  961. _st(self)._deny_(_st(d1).__eq(d2));
  962. $7=_st((smalltalk.Dictionary || Dictionary))._new();
  963. _st($7)._at_put_((2),(2));
  964. $8=_st($7)._yourself();
  965. d2=$8;
  966. _st(self)._deny_(_st(d1).__eq(d2));
  967. $9=_st((smalltalk.Dictionary || Dictionary))._new();
  968. _st($9)._at_put_((1),(2));
  969. _st($9)._at_put_((3),(4));
  970. $10=_st($9)._yourself();
  971. d2=$10;
  972. _st(self)._deny_(_st(d1).__eq(d2));
  973. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2}, smalltalk.DictionaryTest)});}
  974. }),
  975. smalltalk.DictionaryTest);
  976. smalltalk.addMethod(
  977. "_testIfAbsent",
  978. smalltalk.method({
  979. selector: "testIfAbsent",
  980. fn: function () {
  981. var self=this;
  982. var d,visited;
  983. return smalltalk.withContext(function($ctx1) { visited=false;
  984. d=_st((smalltalk.Dictionary || Dictionary))._new();
  985. _st(d)._at_ifAbsent_("hello",(function(){
  986. return smalltalk.withContext(function($ctx2) { visited=true;
  987. return visited;
  988. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  989. _st(self)._assert_(visited);
  990. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited}, smalltalk.DictionaryTest)});}
  991. }),
  992. smalltalk.DictionaryTest);
  993. smalltalk.addMethod(
  994. "_testIfPresent",
  995. smalltalk.method({
  996. selector: "testIfPresent",
  997. fn: function () {
  998. var self=this;
  999. var d,visited,absent;
  1000. return smalltalk.withContext(function($ctx1) { visited=false;
  1001. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1002. _st(d)._at_put_("hello","world");
  1003. _st(d)._at_ifPresent_("hello",(function(value){
  1004. return smalltalk.withContext(function($ctx2) { visited=value;
  1005. return visited;
  1006. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1007. _st(self)._assert_(_st(visited).__eq("world"));
  1008. absent=_st(d)._at_ifPresent_("bye",(function(value){
  1009. return smalltalk.withContext(function($ctx2) { visited=value;
  1010. return visited;
  1011. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1012. _st(self)._assert_(_st(absent)._isNil());
  1013. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent}, smalltalk.DictionaryTest)});}
  1014. }),
  1015. smalltalk.DictionaryTest);
  1016. smalltalk.addMethod(
  1017. "_testIfPresentIfAbsent",
  1018. smalltalk.method({
  1019. selector: "testIfPresentIfAbsent",
  1020. fn: function () {
  1021. var self=this;
  1022. var d,visited;
  1023. return smalltalk.withContext(function($ctx1) { visited=false;
  1024. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1025. _st(d)._at_put_("hello","world");
  1026. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  1027. return smalltalk.withContext(function($ctx2) { visited=value;
  1028. return visited;
  1029. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1030. return smalltalk.withContext(function($ctx2) { visited=true;
  1031. return visited;
  1032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1033. _st(self)._assert_(_st(visited).__eq("world"));
  1034. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  1035. return smalltalk.withContext(function($ctx2) { visited=value;
  1036. return visited;
  1037. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1038. return smalltalk.withContext(function($ctx2) { visited=true;
  1039. return visited;
  1040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1041. _st(self)._assert_(visited);
  1042. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited}, smalltalk.DictionaryTest)});}
  1043. }),
  1044. smalltalk.DictionaryTest);
  1045. smalltalk.addMethod(
  1046. "_testKeys",
  1047. smalltalk.method({
  1048. selector: "testKeys",
  1049. fn: function () {
  1050. var self=this;
  1051. var d;
  1052. return smalltalk.withContext(function($ctx1) { d=_st((smalltalk.Dictionary || Dictionary))._new();
  1053. _st(d)._at_put_((1),(2));
  1054. _st(d)._at_put_((2),(3));
  1055. _st(d)._at_put_((3),(4));
  1056. _st(self)._assert_(_st(_st(d)._keys()).__eq([(1), (2), (3)]));
  1057. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d}, smalltalk.DictionaryTest)});}
  1058. }),
  1059. smalltalk.DictionaryTest);
  1060. smalltalk.addMethod(
  1061. "_testPrintString",
  1062. smalltalk.method({
  1063. selector: "testPrintString",
  1064. fn: function () {
  1065. var self=this;
  1066. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1067. $1=_st((smalltalk.Dictionary || Dictionary))._new();
  1068. _st($1)._at_put_("firstname","James");
  1069. _st($1)._at_put_("lastname","Bond");
  1070. $2=_st($1)._printString();
  1071. _st(self)._assert_equals_("a Dictionary('firstname'->'James' , 'lastname'->'Bond')",$2);
  1072. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{}, smalltalk.DictionaryTest)});}
  1073. }),
  1074. smalltalk.DictionaryTest);
  1075. smalltalk.addMethod(
  1076. "_testRemoveKey",
  1077. smalltalk.method({
  1078. selector: "testRemoveKey",
  1079. fn: function () {
  1080. var self=this;
  1081. var d,key;
  1082. return smalltalk.withContext(function($ctx1) { d=_st((smalltalk.Dictionary || Dictionary))._new();
  1083. _st(d)._at_put_((1),(2));
  1084. _st(d)._at_put_((2),(3));
  1085. _st(d)._at_put_((3),(4));
  1086. key=(2);
  1087. _st(self)._assert_(_st(_st(d)._keys()).__eq([(1), (2), (3)]));
  1088. _st(d)._removeKey_(key);
  1089. _st(self)._assert_(_st(_st(d)._keys()).__eq([(1), (3)]));
  1090. _st(self)._assert_(_st(_st(d)._values()).__eq([(2), (4)]));
  1091. _st(self)._deny_(_st(d)._includesKey_((2)));
  1092. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key}, smalltalk.DictionaryTest)});}
  1093. }),
  1094. smalltalk.DictionaryTest);
  1095. smalltalk.addMethod(
  1096. "_testRemoveKeyIfAbsent",
  1097. smalltalk.method({
  1098. selector: "testRemoveKeyIfAbsent",
  1099. fn: function () {
  1100. var self=this;
  1101. var d,key;
  1102. return smalltalk.withContext(function($ctx1) { d=_st((smalltalk.Dictionary || Dictionary))._new();
  1103. _st(d)._at_put_((1),(2));
  1104. _st(d)._at_put_((2),(3));
  1105. _st(d)._at_put_((3),(4));
  1106. key=(2);
  1107. _st(self)._assert_(_st(_st(d)._removeKey_(key)).__eq((3)));
  1108. key=(3);
  1109. _st(self)._assert_(_st(_st(d)._removeKey_ifAbsent_(key,(function(){
  1110. return smalltalk.withContext(function($ctx2) { return (42);
  1111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq((4)));
  1112. key="why";
  1113. _st(self)._assert_(_st(_st(d)._removeKey_ifAbsent_(key,(function(){
  1114. return smalltalk.withContext(function($ctx2) { return (42);
  1115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq((42)));
  1116. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key}, smalltalk.DictionaryTest)});}
  1117. }),
  1118. smalltalk.DictionaryTest);
  1119. smalltalk.addMethod(
  1120. "_testSize",
  1121. smalltalk.method({
  1122. selector: "testSize",
  1123. fn: function () {
  1124. var self=this;
  1125. var d;
  1126. return smalltalk.withContext(function($ctx1) { d=_st((smalltalk.Dictionary || Dictionary))._new();
  1127. _st(self)._assert_(_st(_st(d)._size()).__eq((0)));
  1128. _st(d)._at_put_((1),(2));
  1129. _st(self)._assert_(_st(_st(d)._size()).__eq((1)));
  1130. _st(d)._at_put_((2),(3));
  1131. _st(self)._assert_(_st(_st(d)._size()).__eq((2)));
  1132. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d}, smalltalk.DictionaryTest)});}
  1133. }),
  1134. smalltalk.DictionaryTest);
  1135. smalltalk.addMethod(
  1136. "_testValues",
  1137. smalltalk.method({
  1138. selector: "testValues",
  1139. fn: function () {
  1140. var self=this;
  1141. var d;
  1142. return smalltalk.withContext(function($ctx1) { d=_st((smalltalk.Dictionary || Dictionary))._new();
  1143. _st(d)._at_put_((1),(2));
  1144. _st(d)._at_put_((2),(3));
  1145. _st(d)._at_put_((3),(4));
  1146. _st(self)._assert_(_st(_st(d)._values()).__eq([(2), (3), (4)]));
  1147. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d}, smalltalk.DictionaryTest)});}
  1148. }),
  1149. smalltalk.DictionaryTest);
  1150. smalltalk.addMethod(
  1151. "_collectionClass",
  1152. smalltalk.method({
  1153. selector: "collectionClass",
  1154. fn: function () {
  1155. var self=this;
  1156. return smalltalk.withContext(function($ctx1) { var $1;
  1157. $1=(smalltalk.Dictionary || Dictionary);
  1158. return $1;
  1159. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.DictionaryTest.klass)});}
  1160. }),
  1161. smalltalk.DictionaryTest.klass);
  1162. smalltalk.addClass('SequenceableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1163. smalltalk.addMethod(
  1164. "_testAt",
  1165. smalltalk.method({
  1166. selector: "testAt",
  1167. fn: function () {
  1168. var self=this;
  1169. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._at_((4))).__eq((-4)));
  1170. _st(self)._should_raise_((function(){
  1171. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._at_((5));
  1172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1173. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.SequenceableCollectionTest)});}
  1174. }),
  1175. smalltalk.SequenceableCollectionTest);
  1176. smalltalk.addMethod(
  1177. "_testAtIfAbsent",
  1178. smalltalk.method({
  1179. selector: "testAtIfAbsent",
  1180. fn: function () {
  1181. var self=this;
  1182. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._at_ifAbsent_(_st(_st(_st(self)._collection())._size()).__plus((1)),(function(){
  1183. return smalltalk.withContext(function($ctx2) { return "none";
  1184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq("none"));
  1185. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{}, smalltalk.SequenceableCollectionTest)});}
  1186. }),
  1187. smalltalk.SequenceableCollectionTest);
  1188. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1189. smalltalk.addMethod(
  1190. "_testAtIfAbsent",
  1191. smalltalk.method({
  1192. selector: "testAtIfAbsent",
  1193. fn: function () {
  1194. var self=this;
  1195. var array;
  1196. return smalltalk.withContext(function($ctx1) { array=["hello", "world"];
  1197. _st(self)._assert_equals_(_st(array)._at_((1)),"hello");
  1198. _st(self)._assert_equals_(_st(array)._at_((2)),"world");
  1199. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((2),(function(){
  1200. return smalltalk.withContext(function($ctx2) { return "not found";
  1201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"world");
  1202. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((0),(function(){
  1203. return smalltalk.withContext(function($ctx2) { return "not found";
  1204. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1205. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((-10),(function(){
  1206. return smalltalk.withContext(function($ctx2) { return "not found";
  1207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1208. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((3),(function(){
  1209. return smalltalk.withContext(function($ctx2) { return "not found";
  1210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1211. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array}, smalltalk.ArrayTest)});}
  1212. }),
  1213. smalltalk.ArrayTest);
  1214. smalltalk.addMethod(
  1215. "_testFirstN",
  1216. smalltalk.method({
  1217. selector: "testFirstN",
  1218. fn: function () {
  1219. var self=this;
  1220. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_([(1),(2),(3)],_st([(1),(2),(3),(4),(5)])._first_((3)));
  1221. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{}, smalltalk.ArrayTest)});}
  1222. }),
  1223. smalltalk.ArrayTest);
  1224. smalltalk.addMethod(
  1225. "_testIfEmpty",
  1226. smalltalk.method({
  1227. selector: "testIfEmpty",
  1228. fn: function () {
  1229. var self=this;
  1230. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("zork",_st("")._ifEmpty_((function(){
  1231. return smalltalk.withContext(function($ctx2) { return "zork";
  1232. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  1233. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{}, smalltalk.ArrayTest)});}
  1234. }),
  1235. smalltalk.ArrayTest);
  1236. smalltalk.addMethod(
  1237. "_testPrintString",
  1238. smalltalk.method({
  1239. selector: "testPrintString",
  1240. fn: function () {
  1241. var self=this;
  1242. var array;
  1243. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  1244. array=_st((smalltalk.Array || Array))._new();
  1245. _st(self)._assert_equals_("a Array ()",_st(array)._printString());
  1246. $1=array;
  1247. _st($1)._add_((1));
  1248. $2=_st($1)._add_((3));
  1249. _st(self)._assert_equals_("a Array (1 3)",_st(array)._printString());
  1250. _st(array)._add_("foo");
  1251. _st(self)._assert_equals_("a Array (1 3 'foo')",_st(array)._printString());
  1252. $3=array;
  1253. _st($3)._remove_((1));
  1254. $4=_st($3)._remove_((3));
  1255. _st(self)._assert_equals_("a Array ('foo')",_st(array)._printString());
  1256. _st(array)._addLast_((3));
  1257. _st(self)._assert_equals_("a Array ('foo' 3)",_st(array)._printString());
  1258. _st(array)._addLast_((3));
  1259. _st(self)._assert_equals_("a Array ('foo' 3 3)",_st(array)._printString());
  1260. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array}, smalltalk.ArrayTest)});}
  1261. }),
  1262. smalltalk.ArrayTest);
  1263. smalltalk.addMethod(
  1264. "_collectionClass",
  1265. smalltalk.method({
  1266. selector: "collectionClass",
  1267. fn: function () {
  1268. var self=this;
  1269. return smalltalk.withContext(function($ctx1) { var $1;
  1270. $1=(smalltalk.Array || Array);
  1271. return $1;
  1272. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.ArrayTest.klass)});}
  1273. }),
  1274. smalltalk.ArrayTest.klass);
  1275. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1276. smalltalk.addMethod(
  1277. "_collection",
  1278. smalltalk.method({
  1279. selector: "collection",
  1280. fn: function () {
  1281. var self=this;
  1282. return smalltalk.withContext(function($ctx1) { return "hello";
  1283. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.StringTest)});}
  1284. }),
  1285. smalltalk.StringTest);
  1286. smalltalk.addMethod(
  1287. "_collectionWithDuplicates",
  1288. smalltalk.method({
  1289. selector: "collectionWithDuplicates",
  1290. fn: function () {
  1291. var self=this;
  1292. return smalltalk.withContext(function($ctx1) { return "abbaerte";
  1293. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.StringTest)});}
  1294. }),
  1295. smalltalk.StringTest);
  1296. smalltalk.addMethod(
  1297. "_testAddRemove",
  1298. smalltalk.method({
  1299. selector: "testAddRemove",
  1300. fn: function () {
  1301. var self=this;
  1302. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1303. return smalltalk.withContext(function($ctx2) { return _st("hello")._add_("a");
  1304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1305. _st(self)._should_raise_((function(){
  1306. return smalltalk.withContext(function($ctx2) { return _st("hello")._remove_("h");
  1307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1308. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{}, smalltalk.StringTest)});}
  1309. }),
  1310. smalltalk.StringTest);
  1311. smalltalk.addMethod(
  1312. "_testAsArray",
  1313. smalltalk.method({
  1314. selector: "testAsArray",
  1315. fn: function () {
  1316. var self=this;
  1317. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st("hello")._asArray()).__eq(["h", "e", "l", "l", "o"]));
  1318. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{}, smalltalk.StringTest)});}
  1319. }),
  1320. smalltalk.StringTest);
  1321. smalltalk.addMethod(
  1322. "_testAt",
  1323. smalltalk.method({
  1324. selector: "testAt",
  1325. fn: function () {
  1326. var self=this;
  1327. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st("hello")._at_((1))).__eq("h"));
  1328. _st(self)._assert_(_st(_st("hello")._at_((5))).__eq("o"));
  1329. _st(self)._assert_(_st(_st("hello")._at_ifAbsent_((6),(function(){
  1330. return smalltalk.withContext(function($ctx2) { return nil;
  1331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq(nil));
  1332. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.StringTest)});}
  1333. }),
  1334. smalltalk.StringTest);
  1335. smalltalk.addMethod(
  1336. "_testAtPut",
  1337. smalltalk.method({
  1338. selector: "testAtPut",
  1339. fn: function () {
  1340. var self=this;
  1341. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1342. return smalltalk.withContext(function($ctx2) { return _st("hello")._at_put_((1),"a");
  1343. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1344. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{}, smalltalk.StringTest)});}
  1345. }),
  1346. smalltalk.StringTest);
  1347. smalltalk.addMethod(
  1348. "_testCollect",
  1349. smalltalk.method({
  1350. selector: "testCollect",
  1351. fn: function () {
  1352. var self=this;
  1353. var newCollection;
  1354. return smalltalk.withContext(function($ctx1) { newCollection="hheelllloo";
  1355. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  1356. return smalltalk.withContext(function($ctx2) { return _st(each).__comma(each);
  1357. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1358. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection}, smalltalk.StringTest)});}
  1359. }),
  1360. smalltalk.StringTest);
  1361. smalltalk.addMethod(
  1362. "_testCopyWithoutAll",
  1363. smalltalk.method({
  1364. selector: "testCopyWithoutAll",
  1365. fn: function () {
  1366. var self=this;
  1367. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("hello world",_st("*hello* *world*")._copyWithoutAll_("*"));
  1368. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{}, smalltalk.StringTest)});}
  1369. }),
  1370. smalltalk.StringTest);
  1371. smalltalk.addMethod(
  1372. "_testDetect",
  1373. smalltalk.method({
  1374. selector: "testDetect",
  1375. fn: function () {
  1376. var self=this;
  1377. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._detect_((function(each){
  1378. return smalltalk.withContext(function($ctx2) { return _st(each).__eq("h");
  1379. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__eq("h"));
  1380. _st(self)._should_raise_((function(){
  1381. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._detect_((function(each){
  1382. return smalltalk.withContext(function($ctx3) { return _st(each).__eq((6));
  1383. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  1384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1385. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{}, smalltalk.StringTest)});}
  1386. }),
  1387. smalltalk.StringTest);
  1388. smalltalk.addMethod(
  1389. "_testEquality",
  1390. smalltalk.method({
  1391. selector: "testEquality",
  1392. fn: function () {
  1393. var self=this;
  1394. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st("hello").__eq("hello"));
  1395. _st(self)._deny_(_st("hello").__eq("world"));
  1396. _st(self)._assert_(_st("hello").__eq(_st("hello")._yourself()));
  1397. _st(self)._assert_(_st(_st("hello")._yourself()).__eq("hello"));
  1398. _st(self)._deny_(_st("").__eq((0)));
  1399. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{}, smalltalk.StringTest)});}
  1400. }),
  1401. smalltalk.StringTest);
  1402. smalltalk.addMethod(
  1403. "_testIdentity",
  1404. smalltalk.method({
  1405. selector: "testIdentity",
  1406. fn: function () {
  1407. var self=this;
  1408. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st("hello").__eq_eq("hello"));
  1409. _st(self)._deny_(_st("hello").__eq_eq("world"));
  1410. _st(self)._assert_(_st("hello").__eq_eq(_st("hello")._yourself()));
  1411. _st(self)._assert_(_st(_st("hello")._yourself()).__eq_eq("hello"));
  1412. _st(self)._deny_(_st("").__eq_eq((0)));
  1413. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{}, smalltalk.StringTest)});}
  1414. }),
  1415. smalltalk.StringTest);
  1416. smalltalk.addMethod(
  1417. "_testIncludesSubString",
  1418. smalltalk.method({
  1419. selector: "testIncludesSubString",
  1420. fn: function () {
  1421. var self=this;
  1422. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st("amber")._includesSubString_("ber"));
  1423. _st(self)._deny_(_st("amber")._includesSubString_("zork"));
  1424. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{}, smalltalk.StringTest)});}
  1425. }),
  1426. smalltalk.StringTest);
  1427. smalltalk.addMethod(
  1428. "_testJoin",
  1429. smalltalk.method({
  1430. selector: "testJoin",
  1431. fn: function () {
  1432. var self=this;
  1433. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("hello,world",_st(",")._join_(["hello", "world"]));
  1434. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{}, smalltalk.StringTest)});}
  1435. }),
  1436. smalltalk.StringTest);
  1437. smalltalk.addMethod(
  1438. "_testSelect",
  1439. smalltalk.method({
  1440. selector: "testSelect",
  1441. fn: function () {
  1442. var self=this;
  1443. var newCollection;
  1444. return smalltalk.withContext(function($ctx1) { newCollection="o";
  1445. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  1446. return smalltalk.withContext(function($ctx2) { return _st(each).__eq("o");
  1447. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1448. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection}, smalltalk.StringTest)});}
  1449. }),
  1450. smalltalk.StringTest);
  1451. smalltalk.addMethod(
  1452. "_testSize",
  1453. smalltalk.method({
  1454. selector: "testSize",
  1455. fn: function () {
  1456. var self=this;
  1457. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st("smalltalk")._size(),(9));
  1458. _st(self)._assert_equals_(_st("")._size(),(0));
  1459. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{}, smalltalk.StringTest)});}
  1460. }),
  1461. smalltalk.StringTest);
  1462. smalltalk.addMethod(
  1463. "_testStreamContents",
  1464. smalltalk.method({
  1465. selector: "testStreamContents",
  1466. fn: function () {
  1467. var self=this;
  1468. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1469. _st(self)._assert_equals_("hello world",_st((smalltalk.String || String))._streamContents_((function(aStream){
  1470. return smalltalk.withContext(function($ctx2) { $1=aStream;
  1471. _st($1)._nextPutAll_("hello");
  1472. _st($1)._space();
  1473. $2=_st($1)._nextPutAll_("world");
  1474. return $2;
  1475. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})})));
  1476. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{}, smalltalk.StringTest)});}
  1477. }),
  1478. smalltalk.StringTest);
  1479. smalltalk.addMethod(
  1480. "_collectionClass",
  1481. smalltalk.method({
  1482. selector: "collectionClass",
  1483. fn: function () {
  1484. var self=this;
  1485. return smalltalk.withContext(function($ctx1) { var $1;
  1486. $1=(smalltalk.String || String);
  1487. return $1;
  1488. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.StringTest.klass)});}
  1489. }),
  1490. smalltalk.StringTest.klass);
  1491. smalltalk.addClass('SymbolTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1492. smalltalk.addMethod(
  1493. "_collection",
  1494. smalltalk.method({
  1495. selector: "collection",
  1496. fn: function () {
  1497. var self=this;
  1498. return smalltalk.withContext(function($ctx1) { return smalltalk.symbolFor("hello");
  1499. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.SymbolTest)});}
  1500. }),
  1501. smalltalk.SymbolTest);
  1502. smalltalk.addMethod(
  1503. "_collectionWithDuplicates",
  1504. smalltalk.method({
  1505. selector: "collectionWithDuplicates",
  1506. fn: function () {
  1507. var self=this;
  1508. return smalltalk.withContext(function($ctx1) { return smalltalk.symbolFor("phhaaarorra");
  1509. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.SymbolTest)});}
  1510. }),
  1511. smalltalk.SymbolTest);
  1512. smalltalk.addMethod(
  1513. "_testAsString",
  1514. smalltalk.method({
  1515. selector: "testAsString",
  1516. fn: function () {
  1517. var self=this;
  1518. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(smalltalk.symbolFor("hello"))._asString(),"hello");
  1519. return self}, function($ctx1) {$ctx1.fill(self,"testAsString",{}, smalltalk.SymbolTest)});}
  1520. }),
  1521. smalltalk.SymbolTest);
  1522. smalltalk.addMethod(
  1523. "_testAsSymbol",
  1524. smalltalk.method({
  1525. selector: "testAsSymbol",
  1526. fn: function () {
  1527. var self=this;
  1528. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq_eq(_st(smalltalk.symbolFor("hello"))._asSymbol()));
  1529. return self}, function($ctx1) {$ctx1.fill(self,"testAsSymbol",{}, smalltalk.SymbolTest)});}
  1530. }),
  1531. smalltalk.SymbolTest);
  1532. smalltalk.addMethod(
  1533. "_testAt",
  1534. smalltalk.method({
  1535. selector: "testAt",
  1536. fn: function () {
  1537. var self=this;
  1538. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._at_((1))).__eq("h"));
  1539. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._at_((5))).__eq("o"));
  1540. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._at_ifAbsent_((6),(function(){
  1541. return smalltalk.withContext(function($ctx2) { return nil;
  1542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq(nil));
  1543. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.SymbolTest)});}
  1544. }),
  1545. smalltalk.SymbolTest);
  1546. smalltalk.addMethod(
  1547. "_testAtPut",
  1548. smalltalk.method({
  1549. selector: "testAtPut",
  1550. fn: function () {
  1551. var self=this;
  1552. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1553. return smalltalk.withContext(function($ctx2) { return _st("hello")._at_put_((1),"a");
  1554. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1555. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{}, smalltalk.SymbolTest)});}
  1556. }),
  1557. smalltalk.SymbolTest);
  1558. smalltalk.addMethod(
  1559. "_testCollect",
  1560. smalltalk.method({
  1561. selector: "testCollect",
  1562. fn: function () {
  1563. var self=this;
  1564. var newCollection;
  1565. return smalltalk.withContext(function($ctx1) { newCollection=smalltalk.symbolFor("hheelllloo");
  1566. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  1567. return smalltalk.withContext(function($ctx2) { return _st(each).__comma(each);
  1568. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1569. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection}, smalltalk.SymbolTest)});}
  1570. }),
  1571. smalltalk.SymbolTest);
  1572. smalltalk.addMethod(
  1573. "_testComparing",
  1574. smalltalk.method({
  1575. selector: "testComparing",
  1576. fn: function () {
  1577. var self=this;
  1578. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__gt(smalltalk.symbolFor("aa")));
  1579. _st(self)._deny_(_st(smalltalk.symbolFor("ab")).__gt(smalltalk.symbolFor("ba")));
  1580. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__lt(smalltalk.symbolFor("ba")));
  1581. _st(self)._deny_(_st(smalltalk.symbolFor("bb")).__lt(smalltalk.symbolFor("ba")));
  1582. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__gt_eq(smalltalk.symbolFor("aa")));
  1583. _st(self)._deny_(_st(smalltalk.symbolFor("ab")).__gt_eq(smalltalk.symbolFor("ba")));
  1584. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__lt_eq(smalltalk.symbolFor("ba")));
  1585. _st(self)._deny_(_st(smalltalk.symbolFor("bb")).__lt_eq(smalltalk.symbolFor("ba")));
  1586. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{}, smalltalk.SymbolTest)});}
  1587. }),
  1588. smalltalk.SymbolTest);
  1589. smalltalk.addMethod(
  1590. "_testCopying",
  1591. smalltalk.method({
  1592. selector: "testCopying",
  1593. fn: function () {
  1594. var self=this;
  1595. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._copy()).__eq_eq(smalltalk.symbolFor("hello")));
  1596. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._deepCopy()).__eq_eq(smalltalk.symbolFor("hello")));
  1597. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{}, smalltalk.SymbolTest)});}
  1598. }),
  1599. smalltalk.SymbolTest);
  1600. smalltalk.addMethod(
  1601. "_testDetect",
  1602. smalltalk.method({
  1603. selector: "testDetect",
  1604. fn: function () {
  1605. var self=this;
  1606. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._detect_((function(each){
  1607. return smalltalk.withContext(function($ctx2) { return _st(each).__eq("h");
  1608. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__eq("h"));
  1609. _st(self)._should_raise_((function(){
  1610. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._detect_((function(each){
  1611. return smalltalk.withContext(function($ctx3) { return _st(each).__eq("z");
  1612. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  1613. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1614. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{}, smalltalk.SymbolTest)});}
  1615. }),
  1616. smalltalk.SymbolTest);
  1617. smalltalk.addMethod(
  1618. "_testEquality",
  1619. smalltalk.method({
  1620. selector: "testEquality",
  1621. fn: function () {
  1622. var self=this;
  1623. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(smalltalk.symbolFor("hello")));
  1624. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq(smalltalk.symbolFor("world")));
  1625. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(_st(smalltalk.symbolFor("hello"))._yourself()));
  1626. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._yourself()).__eq(smalltalk.symbolFor("hello")));
  1627. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq("hello"));
  1628. _st(self)._deny_(_st("hello").__eq(smalltalk.symbolFor("hello")));
  1629. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{}, smalltalk.SymbolTest)});}
  1630. }),
  1631. smalltalk.SymbolTest);
  1632. smalltalk.addMethod(
  1633. "_testIdentity",
  1634. smalltalk.method({
  1635. selector: "testIdentity",
  1636. fn: function () {
  1637. var self=this;
  1638. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq_eq(smalltalk.symbolFor("hello")));
  1639. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq_eq(smalltalk.symbolFor("world")));
  1640. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(_st(smalltalk.symbolFor("hello"))._yourself()));
  1641. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._yourself()).__eq(_st(_st(smalltalk.symbolFor("hello"))._asString())._asSymbol()));
  1642. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{}, smalltalk.SymbolTest)});}
  1643. }),
  1644. smalltalk.SymbolTest);
  1645. smalltalk.addMethod(
  1646. "_testIsEmpty",
  1647. smalltalk.method({
  1648. selector: "testIsEmpty",
  1649. fn: function () {
  1650. var self=this;
  1651. return smalltalk.withContext(function($ctx1) { _st(self)._deny_(_st(_st(self)._collection())._isEmpty());
  1652. _st(self)._assert_(_st(_st("")._asSymbol())._isEmpty());
  1653. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{}, smalltalk.SymbolTest)});}
  1654. }),
  1655. smalltalk.SymbolTest);
  1656. smalltalk.addMethod(
  1657. "_testIsSymbolIsString",
  1658. smalltalk.method({
  1659. selector: "testIsSymbolIsString",
  1660. fn: function () {
  1661. var self=this;
  1662. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("hello"))._isSymbol());
  1663. _st(self)._deny_(_st("hello")._isSymbol());
  1664. _st(self)._deny_(_st(smalltalk.symbolFor("hello"))._isString());
  1665. _st(self)._assert_(_st("hello")._isString());
  1666. return self}, function($ctx1) {$ctx1.fill(self,"testIsSymbolIsString",{}, smalltalk.SymbolTest)});}
  1667. }),
  1668. smalltalk.SymbolTest);
  1669. smalltalk.addMethod(
  1670. "_testSelect",
  1671. smalltalk.method({
  1672. selector: "testSelect",
  1673. fn: function () {
  1674. var self=this;
  1675. var newCollection;
  1676. return smalltalk.withContext(function($ctx1) { newCollection="o";
  1677. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  1678. return smalltalk.withContext(function($ctx2) { return _st(each).__eq("o");
  1679. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1680. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection}, smalltalk.SymbolTest)});}
  1681. }),
  1682. smalltalk.SymbolTest);
  1683. smalltalk.addMethod(
  1684. "_testSize",
  1685. smalltalk.method({
  1686. selector: "testSize",
  1687. fn: function () {
  1688. var self=this;
  1689. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(smalltalk.symbolFor("a"))._size(),(1));
  1690. _st(self)._assert_equals_(_st(smalltalk.symbolFor("aaaaa"))._size(),(5));
  1691. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{}, smalltalk.SymbolTest)});}
  1692. }),
  1693. smalltalk.SymbolTest);
  1694. smalltalk.addMethod(
  1695. "_collectionClass",
  1696. smalltalk.method({
  1697. selector: "collectionClass",
  1698. fn: function () {
  1699. var self=this;
  1700. return smalltalk.withContext(function($ctx1) { var $1;
  1701. $1=(smalltalk.Symbol || Symbol);
  1702. return $1;
  1703. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.SymbolTest.klass)});}
  1704. }),
  1705. smalltalk.SymbolTest.klass);
  1706. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1707. smalltalk.addMethod(
  1708. "_jsObject",
  1709. smalltalk.method({
  1710. selector: "jsObject",
  1711. fn: function (){
  1712. var self=this;
  1713. return smalltalk.withContext(function($ctx1) { return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined};
  1714. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{}, smalltalk.JSObjectProxyTest)})}
  1715. }),
  1716. smalltalk.JSObjectProxyTest);
  1717. smalltalk.addMethod(
  1718. "_testAtIfAbsent",
  1719. smalltalk.method({
  1720. selector: "testAtIfAbsent",
  1721. fn: function (){
  1722. var self=this;
  1723. var testObject;
  1724. return smalltalk.withContext(function($ctx1) { testObject=_st(self)._jsObject();
  1725. _st(self)._assert_equals_("Property does not exist",_st(testObject)._at_ifAbsent_("abc",(function(){
  1726. return smalltalk.withContext(function($ctx2) { return "Property does not exist";
  1727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  1728. _st(self)._assert_equals_(nil,_st(testObject)._at_ifAbsent_("e",(function(){
  1729. return smalltalk.withContext(function($ctx2) { return "Property does not exist";
  1730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  1731. _st(self)._assert_equals_((1),_st(testObject)._at_ifAbsent_("a",(function(){
  1732. return smalltalk.withContext(function($ctx2) { return "Property does not exist";
  1733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  1734. _st(self)._assert_equals_(nil,_st(testObject)._at_ifAbsent_("f",(function(){
  1735. return smalltalk.withContext(function($ctx2) { return "Property does not exist";
  1736. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  1737. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject}, smalltalk.JSObjectProxyTest)})}
  1738. }),
  1739. smalltalk.JSObjectProxyTest);
  1740. smalltalk.addMethod(
  1741. "_testDNU",
  1742. smalltalk.method({
  1743. selector: "testDNU",
  1744. fn: function () {
  1745. var self=this;
  1746. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1747. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._jsObject())._foo();
  1748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1749. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{}, smalltalk.JSObjectProxyTest)});}
  1750. }),
  1751. smalltalk.JSObjectProxyTest);
  1752. smalltalk.addMethod(
  1753. "_testMessageSend",
  1754. smalltalk.method({
  1755. selector: "testMessageSend",
  1756. fn: function () {
  1757. var self=this;
  1758. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st(self)._jsObject())._a(),(1));
  1759. _st(self)._assert_equals_(_st(_st(self)._jsObject())._b(),(2));
  1760. _st(self)._assert_equals_(_st(_st(self)._jsObject())._c_((3)),(3));
  1761. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{}, smalltalk.JSObjectProxyTest)});}
  1762. }),
  1763. smalltalk.JSObjectProxyTest);
  1764. smalltalk.addMethod(
  1765. "_testMethodWithArguments",
  1766. smalltalk.method({
  1767. selector: "testMethodWithArguments",
  1768. fn: function () {
  1769. var self=this;
  1770. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st(self)._jsObject())._c_((1)),(1));
  1771. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{}, smalltalk.JSObjectProxyTest)});}
  1772. }),
  1773. smalltalk.JSObjectProxyTest);
  1774. smalltalk.addMethod(
  1775. "_testPrinting",
  1776. smalltalk.method({
  1777. selector: "testPrinting",
  1778. fn: function () {
  1779. var self=this;
  1780. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._jsObject())._printString()).__eq("[object Object]"));
  1781. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{}, smalltalk.JSObjectProxyTest)});}
  1782. }),
  1783. smalltalk.JSObjectProxyTest);
  1784. smalltalk.addMethod(
  1785. "_testPropertyThatReturnsEmptyString",
  1786. smalltalk.method({
  1787. selector: "testPropertyThatReturnsEmptyString",
  1788. fn: function () {
  1789. var self=this;
  1790. var object;
  1791. return smalltalk.withContext(function($ctx1) { object=_st(self)._jsObject();
  1792. _st(self)._assert_equals_("",_st(object)._d());
  1793. _st(object)._d_("hello");
  1794. _st(self)._assert_equals_("hello",_st(object)._d());
  1795. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object}, smalltalk.JSObjectProxyTest)});}
  1796. }),
  1797. smalltalk.JSObjectProxyTest);
  1798. smalltalk.addMethod(
  1799. "_testPropertyThatReturnsUndefined",
  1800. smalltalk.method({
  1801. selector: "testPropertyThatReturnsUndefined",
  1802. fn: function () {
  1803. var self=this;
  1804. var object;
  1805. return smalltalk.withContext(function($ctx1) { object=_st(self)._jsObject();
  1806. _st(self)._shouldnt_raise_((function(){
  1807. return smalltalk.withContext(function($ctx2) { return _st(object)._e();
  1808. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1809. _st(self)._assert_(_st(_st(object)._e())._isNil());
  1810. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object}, smalltalk.JSObjectProxyTest)});}
  1811. }),
  1812. smalltalk.JSObjectProxyTest);
  1813. smalltalk.addMethod(
  1814. "_testValue",
  1815. smalltalk.method({
  1816. selector: "testValue",
  1817. fn: function (){
  1818. var self=this;
  1819. var testObject;
  1820. return smalltalk.withContext(function($ctx1) { testObject=_st(self)._jsObject();
  1821. _st(self)._assert_equals_("[object Object]",_st(_st(testObject)._value())._printString());
  1822. _st(testObject)._at_put_("value","aValue");
  1823. _st(self)._assert_equals_("aValue",_st(testObject)._value());
  1824. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject}, smalltalk.JSObjectProxyTest)})}
  1825. }),
  1826. smalltalk.JSObjectProxyTest);
  1827. smalltalk.addMethod(
  1828. "_testYourself",
  1829. smalltalk.method({
  1830. selector: "testYourself",
  1831. fn: function () {
  1832. var self=this;
  1833. var object;
  1834. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1835. $1=_st(self)._jsObject();
  1836. _st($1)._d_("test");
  1837. $2=_st($1)._yourself();
  1838. object=$2;
  1839. _st(self)._assert_equals_(_st(object)._d(),"test");
  1840. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object}, smalltalk.JSObjectProxyTest)});}
  1841. }),
  1842. smalltalk.JSObjectProxyTest);
  1843. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1844. smalltalk.addMethod(
  1845. "_testCatchingException",
  1846. smalltalk.method({
  1847. selector: "testCatchingException",
  1848. fn: function () {
  1849. var self=this;
  1850. return smalltalk.withContext(function($ctx1) { _st((function(){
  1851. return smalltalk.withContext(function($ctx2) { return _st(self)._throwException();
  1852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(error){
  1853. return smalltalk.withContext(function($ctx2) { return _st(self)._assert_(_st(_st(error)._exception()).__eq("test"));
  1854. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  1855. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{}, smalltalk.JavaScriptExceptionTest)});}
  1856. }),
  1857. smalltalk.JavaScriptExceptionTest);
  1858. smalltalk.addMethod(
  1859. "_testRaisingException",
  1860. smalltalk.method({
  1861. selector: "testRaisingException",
  1862. fn: function () {
  1863. var self=this;
  1864. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1865. return smalltalk.withContext(function($ctx2) { return _st(self)._throwException();
  1866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.JavaScriptException || JavaScriptException));
  1867. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{}, smalltalk.JavaScriptExceptionTest)});}
  1868. }),
  1869. smalltalk.JavaScriptExceptionTest);
  1870. smalltalk.addMethod(
  1871. "_throwException",
  1872. smalltalk.method({
  1873. selector: "throwException",
  1874. fn: function () {
  1875. var self=this;
  1876. return smalltalk.withContext(function($ctx1) { throw 'test';
  1877. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{}, smalltalk.JavaScriptExceptionTest)});}
  1878. }),
  1879. smalltalk.JavaScriptExceptionTest);
  1880. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1881. smalltalk.addMethod(
  1882. "_testAbs",
  1883. smalltalk.method({
  1884. selector: "testAbs",
  1885. fn: function () {
  1886. var self=this;
  1887. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((4))._abs()).__eq((4)));
  1888. _st(self)._assert_(_st(_st((-4))._abs()).__eq((4)));
  1889. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{}, smalltalk.NumberTest)});}
  1890. }),
  1891. smalltalk.NumberTest);
  1892. smalltalk.addMethod(
  1893. "_testArithmetic",
  1894. smalltalk.method({
  1895. selector: "testArithmetic",
  1896. fn: function () {
  1897. var self=this;
  1898. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((1.5)).__plus((1))).__eq((2.5)));
  1899. _st(self)._assert_(_st(_st((2)).__minus((1))).__eq((1)));
  1900. _st(self)._assert_(_st(_st((-2)).__minus((1))).__eq((-3)));
  1901. _st(self)._assert_(_st(_st((12)).__slash((2))).__eq((6)));
  1902. _st(self)._assert_(_st(_st((3)).__star((4))).__eq((12)));
  1903. _st(self)._assert_(_st(_st(_st((1)).__plus((2))).__star((3))).__eq((9)));
  1904. _st(self)._assert_(_st(_st((1)).__plus(_st((2)).__star((3)))).__eq((7)));
  1905. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{}, smalltalk.NumberTest)});}
  1906. }),
  1907. smalltalk.NumberTest);
  1908. smalltalk.addMethod(
  1909. "_testComparison",
  1910. smalltalk.method({
  1911. selector: "testComparison",
  1912. fn: function () {
  1913. var self=this;
  1914. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((3)).__gt((2)));
  1915. _st(self)._assert_(_st((2)).__lt((3)));
  1916. _st(self)._deny_(_st((3)).__lt((2)));
  1917. _st(self)._deny_(_st((2)).__gt((3)));
  1918. _st(self)._assert_(_st((3)).__gt_eq((3)));
  1919. _st(self)._assert_(_st((3.1)).__gt_eq((3)));
  1920. _st(self)._assert_(_st((3)).__lt_eq((3)));
  1921. _st(self)._assert_(_st((3)).__lt_eq((3.1)));
  1922. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{}, smalltalk.NumberTest)});}
  1923. }),
  1924. smalltalk.NumberTest);
  1925. smalltalk.addMethod(
  1926. "_testCopying",
  1927. smalltalk.method({
  1928. selector: "testCopying",
  1929. fn: function () {
  1930. var self=this;
  1931. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((1))._copy()).__eq_eq((1)));
  1932. _st(self)._assert_(_st(_st((1))._deepCopy()).__eq_eq((1)));
  1933. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{}, smalltalk.NumberTest)});}
  1934. }),
  1935. smalltalk.NumberTest);
  1936. smalltalk.addMethod(
  1937. "_testEquality",
  1938. smalltalk.method({
  1939. selector: "testEquality",
  1940. fn: function () {
  1941. var self=this;
  1942. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((1)).__eq((1)));
  1943. _st(self)._assert_(_st((0)).__eq((0)));
  1944. _st(self)._deny_(_st((1)).__eq((0)));
  1945. _st(self)._assert_(_st(_st((1))._yourself()).__eq((1)));
  1946. _st(self)._assert_(_st((1)).__eq(_st((1))._yourself()));
  1947. _st(self)._assert_(_st(_st((1))._yourself()).__eq(_st((1))._yourself()));
  1948. _st(self)._deny_(_st((0)).__eq(false));
  1949. _st(self)._deny_(_st(false).__eq((0)));
  1950. _st(self)._deny_(_st("").__eq((0)));
  1951. _st(self)._deny_(_st((0)).__eq(""));
  1952. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{}, smalltalk.NumberTest)});}
  1953. }),
  1954. smalltalk.NumberTest);
  1955. smalltalk.addMethod(
  1956. "_testHexNumbers",
  1957. smalltalk.method({
  1958. selector: "testHexNumbers",
  1959. fn: function () {
  1960. var self=this;
  1961. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((9)).__eq((9)));
  1962. _st(self)._assert_(_st(_st((10))._truncated()).__eq((10)));
  1963. _st(self)._assert_(_st(_st((11))._truncated()).__eq((11)));
  1964. _st(self)._assert_(_st(_st((12))._truncated()).__eq((12)));
  1965. _st(self)._assert_(_st(_st((13))._truncated()).__eq((13)));
  1966. _st(self)._assert_(_st(_st((14))._truncated()).__eq((14)));
  1967. _st(self)._assert_(_st(_st((15))._truncated()).__eq((15)));
  1968. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{}, smalltalk.NumberTest)});}
  1969. }),
  1970. smalltalk.NumberTest);
  1971. smalltalk.addMethod(
  1972. "_testIdentity",
  1973. smalltalk.method({
  1974. selector: "testIdentity",
  1975. fn: function () {
  1976. var self=this;
  1977. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((1)).__eq_eq((1)));
  1978. _st(self)._assert_(_st((0)).__eq_eq((0)));
  1979. _st(self)._deny_(_st((1)).__eq_eq((0)));
  1980. _st(self)._assert_(_st(_st((1))._yourself()).__eq_eq((1)));
  1981. _st(self)._assert_(_st((1)).__eq_eq(_st((1))._yourself()));
  1982. _st(self)._assert_(_st(_st((1))._yourself()).__eq_eq(_st((1))._yourself()));
  1983. _st(self)._deny_(_st((1)).__eq_eq((2)));
  1984. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{}, smalltalk.NumberTest)});}
  1985. }),
  1986. smalltalk.NumberTest);
  1987. smalltalk.addMethod(
  1988. "_testInvalidHexNumbers",
  1989. smalltalk.method({
  1990. selector: "testInvalidHexNumbers",
  1991. fn: function () {
  1992. var self=this;
  1993. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1994. return smalltalk.withContext(function($ctx2) { return _st((16))._rG();
  1995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1996. _st(self)._should_raise_((function(){
  1997. return smalltalk.withContext(function($ctx2) { return _st((16))._rg();
  1998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  1999. _st(self)._should_raise_((function(){
  2000. return smalltalk.withContext(function($ctx2) { return _st((16))._rH();
  2001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2002. _st(self)._should_raise_((function(){
  2003. return smalltalk.withContext(function($ctx2) { return _st((16))._rh();
  2004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2005. _st(self)._should_raise_((function(){
  2006. return smalltalk.withContext(function($ctx2) { return _st((16))._rI();
  2007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2008. _st(self)._should_raise_((function(){
  2009. return smalltalk.withContext(function($ctx2) { return _st((16))._ri();
  2010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2011. _st(self)._should_raise_((function(){
  2012. return smalltalk.withContext(function($ctx2) { return _st((16))._rJ();
  2013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2014. _st(self)._should_raise_((function(){
  2015. return smalltalk.withContext(function($ctx2) { return _st((16))._rj();
  2016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2017. _st(self)._should_raise_((function(){
  2018. return smalltalk.withContext(function($ctx2) { return _st((16))._rK();
  2019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2020. _st(self)._should_raise_((function(){
  2021. return smalltalk.withContext(function($ctx2) { return _st((16))._rk();
  2022. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2023. _st(self)._should_raise_((function(){
  2024. return smalltalk.withContext(function($ctx2) { return _st((16))._rL();
  2025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2026. _st(self)._should_raise_((function(){
  2027. return smalltalk.withContext(function($ctx2) { return _st((16))._rl();
  2028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2029. _st(self)._should_raise_((function(){
  2030. return smalltalk.withContext(function($ctx2) { return _st((16))._rM();
  2031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2032. _st(self)._should_raise_((function(){
  2033. return smalltalk.withContext(function($ctx2) { return _st((16))._rm();
  2034. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2035. _st(self)._should_raise_((function(){
  2036. return smalltalk.withContext(function($ctx2) { return _st((16))._rN();
  2037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2038. _st(self)._should_raise_((function(){
  2039. return smalltalk.withContext(function($ctx2) { return _st((16))._rn();
  2040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2041. _st(self)._should_raise_((function(){
  2042. return smalltalk.withContext(function($ctx2) { return _st((16))._rO();
  2043. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2044. _st(self)._should_raise_((function(){
  2045. return smalltalk.withContext(function($ctx2) { return _st((16))._ro();
  2046. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2047. _st(self)._should_raise_((function(){
  2048. return smalltalk.withContext(function($ctx2) { return _st((16))._rP();
  2049. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2050. _st(self)._should_raise_((function(){
  2051. return smalltalk.withContext(function($ctx2) { return _st((16))._rp();
  2052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2053. _st(self)._should_raise_((function(){
  2054. return smalltalk.withContext(function($ctx2) { return _st((16))._rQ();
  2055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2056. _st(self)._should_raise_((function(){
  2057. return smalltalk.withContext(function($ctx2) { return _st((16))._rq();
  2058. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2059. _st(self)._should_raise_((function(){
  2060. return smalltalk.withContext(function($ctx2) { return _st((16))._rR();
  2061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2062. _st(self)._should_raise_((function(){
  2063. return smalltalk.withContext(function($ctx2) { return _st((16))._rr();
  2064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2065. _st(self)._should_raise_((function(){
  2066. return smalltalk.withContext(function($ctx2) { return _st((16))._rS();
  2067. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2068. _st(self)._should_raise_((function(){
  2069. return smalltalk.withContext(function($ctx2) { return _st((16))._rs();
  2070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2071. _st(self)._should_raise_((function(){
  2072. return smalltalk.withContext(function($ctx2) { return _st((16))._rT();
  2073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2074. _st(self)._should_raise_((function(){
  2075. return smalltalk.withContext(function($ctx2) { return _st((16))._rt();
  2076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2077. _st(self)._should_raise_((function(){
  2078. return smalltalk.withContext(function($ctx2) { return _st((16))._rU();
  2079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2080. _st(self)._should_raise_((function(){
  2081. return smalltalk.withContext(function($ctx2) { return _st((16))._ru();
  2082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2083. _st(self)._should_raise_((function(){
  2084. return smalltalk.withContext(function($ctx2) { return _st((16))._rV();
  2085. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2086. _st(self)._should_raise_((function(){
  2087. return smalltalk.withContext(function($ctx2) { return _st((16))._rv();
  2088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2089. _st(self)._should_raise_((function(){
  2090. return smalltalk.withContext(function($ctx2) { return _st((16))._rW();
  2091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2092. _st(self)._should_raise_((function(){
  2093. return smalltalk.withContext(function($ctx2) { return _st((16))._rw();
  2094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2095. _st(self)._should_raise_((function(){
  2096. return smalltalk.withContext(function($ctx2) { return _st((16))._rX();
  2097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2098. _st(self)._should_raise_((function(){
  2099. return smalltalk.withContext(function($ctx2) { return _st((16))._rx();
  2100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2101. _st(self)._should_raise_((function(){
  2102. return smalltalk.withContext(function($ctx2) { return _st((16))._rY();
  2103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2104. _st(self)._should_raise_((function(){
  2105. return smalltalk.withContext(function($ctx2) { return _st((16))._ry();
  2106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2107. _st(self)._should_raise_((function(){
  2108. return smalltalk.withContext(function($ctx2) { return _st((16))._rZ();
  2109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2110. _st(self)._should_raise_((function(){
  2111. return smalltalk.withContext(function($ctx2) { return _st((16))._rz();
  2112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2113. _st(self)._should_raise_((function(){
  2114. return smalltalk.withContext(function($ctx2) { return _st((11259375))._Z();
  2115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2116. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{}, smalltalk.NumberTest)});}
  2117. }),
  2118. smalltalk.NumberTest);
  2119. smalltalk.addMethod(
  2120. "_testMinMax",
  2121. smalltalk.method({
  2122. selector: "testMinMax",
  2123. fn: function () {
  2124. var self=this;
  2125. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((2))._max_((5)),(5));
  2126. _st(self)._assert_equals_(_st((2))._min_((5)),(2));
  2127. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{}, smalltalk.NumberTest)});}
  2128. }),
  2129. smalltalk.NumberTest);
  2130. smalltalk.addMethod(
  2131. "_testNegated",
  2132. smalltalk.method({
  2133. selector: "testNegated",
  2134. fn: function () {
  2135. var self=this;
  2136. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((3))._negated()).__eq((-3)));
  2137. _st(self)._assert_(_st(_st((-3))._negated()).__eq((3)));
  2138. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{}, smalltalk.NumberTest)});}
  2139. }),
  2140. smalltalk.NumberTest);
  2141. smalltalk.addMethod(
  2142. "_testPrintShowingDecimalPlaces",
  2143. smalltalk.method({
  2144. selector: "testPrintShowingDecimalPlaces",
  2145. fn: function () {
  2146. var self=this;
  2147. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("23.00",_st((23))._printShowingDecimalPlaces_((2)));
  2148. _st(self)._assert_equals_("23.57",_st((23.5698))._printShowingDecimalPlaces_((2)));
  2149. _st(self)._assert_equals_("-234.56700",_st(_st((234.567))._negated())._printShowingDecimalPlaces_((5)));
  2150. _st(self)._assert_equals_("23",_st((23.4567))._printShowingDecimalPlaces_((0)));
  2151. _st(self)._assert_equals_("24",_st((23.5567))._printShowingDecimalPlaces_((0)));
  2152. _st(self)._assert_equals_("-23",_st(_st((23.4567))._negated())._printShowingDecimalPlaces_((0)));
  2153. _st(self)._assert_equals_("-24",_st(_st((23.5567))._negated())._printShowingDecimalPlaces_((0)));
  2154. _st(self)._assert_equals_("100000000.0",_st((100000000))._printShowingDecimalPlaces_((1)));
  2155. _st(self)._assert_equals_("0.98000",_st((0.98))._printShowingDecimalPlaces_((5)));
  2156. _st(self)._assert_equals_("-0.98",_st(_st((0.98))._negated())._printShowingDecimalPlaces_((2)));
  2157. _st(self)._assert_equals_("2.57",_st((2.567))._printShowingDecimalPlaces_((2)));
  2158. _st(self)._assert_equals_("-2.57",_st((-2.567))._printShowingDecimalPlaces_((2)));
  2159. _st(self)._assert_equals_("0.00",_st((0))._printShowingDecimalPlaces_((2)));
  2160. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{}, smalltalk.NumberTest)});}
  2161. }),
  2162. smalltalk.NumberTest);
  2163. smalltalk.addMethod(
  2164. "_testRounded",
  2165. smalltalk.method({
  2166. selector: "testRounded",
  2167. fn: function () {
  2168. var self=this;
  2169. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((3))._rounded()).__eq((3)));
  2170. _st(self)._assert_(_st(_st((3.212))._rounded()).__eq((3)));
  2171. _st(self)._assert_(_st(_st((3.51))._rounded()).__eq((4)));
  2172. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{}, smalltalk.NumberTest)});}
  2173. }),
  2174. smalltalk.NumberTest);
  2175. smalltalk.addMethod(
  2176. "_testSqrt",
  2177. smalltalk.method({
  2178. selector: "testSqrt",
  2179. fn: function () {
  2180. var self=this;
  2181. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((4))._sqrt()).__eq((2)));
  2182. _st(self)._assert_(_st(_st((16))._sqrt()).__eq((4)));
  2183. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{}, smalltalk.NumberTest)});}
  2184. }),
  2185. smalltalk.NumberTest);
  2186. smalltalk.addMethod(
  2187. "_testSquared",
  2188. smalltalk.method({
  2189. selector: "testSquared",
  2190. fn: function () {
  2191. var self=this;
  2192. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((4))._squared()).__eq((16)));
  2193. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{}, smalltalk.NumberTest)});}
  2194. }),
  2195. smalltalk.NumberTest);
  2196. smalltalk.addMethod(
  2197. "_testTimesRepeat",
  2198. smalltalk.method({
  2199. selector: "testTimesRepeat",
  2200. fn: function () {
  2201. var self=this;
  2202. var i;
  2203. return smalltalk.withContext(function($ctx1) { i=(0);
  2204. _st((0))._timesRepeat_((function(){
  2205. return smalltalk.withContext(function($ctx2) { i=_st(i).__plus((1));
  2206. return i;
  2207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2208. _st(self)._assert_equals_(i,(0));
  2209. _st((5))._timesRepeat_((function(){
  2210. return smalltalk.withContext(function($ctx2) { i=_st(i).__plus((1));
  2211. return i;
  2212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2213. _st(self)._assert_equals_(i,(5));
  2214. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i}, smalltalk.NumberTest)});}
  2215. }),
  2216. smalltalk.NumberTest);
  2217. smalltalk.addMethod(
  2218. "_testTo",
  2219. smalltalk.method({
  2220. selector: "testTo",
  2221. fn: function () {
  2222. var self=this;
  2223. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((1))._to_((5)),[(1), (2), (3), (4), (5)]);
  2224. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{}, smalltalk.NumberTest)});}
  2225. }),
  2226. smalltalk.NumberTest);
  2227. smalltalk.addMethod(
  2228. "_testToBy",
  2229. smalltalk.method({
  2230. selector: "testToBy",
  2231. fn: function () {
  2232. var self=this;
  2233. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((0))._to_by_((6),(2)),[(0), (2), (4), (6)]);
  2234. _st(self)._should_raise_((function(){
  2235. return smalltalk.withContext(function($ctx2) { return _st((1))._to_by_((4),(0));
  2236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  2237. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{}, smalltalk.NumberTest)});}
  2238. }),
  2239. smalltalk.NumberTest);
  2240. smalltalk.addMethod(
  2241. "_testTruncated",
  2242. smalltalk.method({
  2243. selector: "testTruncated",
  2244. fn: function () {
  2245. var self=this;
  2246. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((3))._truncated()).__eq((3)));
  2247. _st(self)._assert_(_st(_st((3.212))._truncated()).__eq((3)));
  2248. _st(self)._assert_(_st(_st((3.51))._truncated()).__eq((3)));
  2249. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{}, smalltalk.NumberTest)});}
  2250. }),
  2251. smalltalk.NumberTest);
  2252. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  2253. smalltalk.addMethod(
  2254. "_foo",
  2255. smalltalk.method({
  2256. selector: "foo",
  2257. fn: function () {
  2258. var self=this;
  2259. return smalltalk.withContext(function($ctx1) { var $1;
  2260. $1=self["@foo"];
  2261. return $1;
  2262. }, function($ctx1) {$ctx1.fill(self,"foo",{}, smalltalk.ObjectMock)});}
  2263. }),
  2264. smalltalk.ObjectMock);
  2265. smalltalk.addMethod(
  2266. "_foo_",
  2267. smalltalk.method({
  2268. selector: "foo:",
  2269. fn: function (anObject) {
  2270. var self=this;
  2271. return smalltalk.withContext(function($ctx1) { self["@foo"]=anObject;
  2272. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject}, smalltalk.ObjectMock)});}
  2273. }),
  2274. smalltalk.ObjectMock);
  2275. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2276. smalltalk.addMethod(
  2277. "_notDefined",
  2278. smalltalk.method({
  2279. selector: "notDefined",
  2280. fn: function () {
  2281. var self=this;
  2282. return smalltalk.withContext(function($ctx1) { return undefined;;
  2283. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{}, smalltalk.ObjectTest)});}
  2284. }),
  2285. smalltalk.ObjectTest);
  2286. smalltalk.addMethod(
  2287. "_testBasicAccess",
  2288. smalltalk.method({
  2289. selector: "testBasicAccess",
  2290. fn: function () {
  2291. var self=this;
  2292. var o;
  2293. return smalltalk.withContext(function($ctx1) { o=_st((smalltalk.Object || Object))._new();
  2294. _st(o)._basicAt_put_("a",(1));
  2295. _st(self)._assert_equals_(_st(o)._basicAt_("a"),(1));
  2296. _st(self)._assert_equals_(_st(o)._basicAt_("b"),nil);
  2297. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o}, smalltalk.ObjectTest)});}
  2298. }),
  2299. smalltalk.ObjectTest);
  2300. smalltalk.addMethod(
  2301. "_testBasicPerform",
  2302. smalltalk.method({
  2303. selector: "testBasicPerform",
  2304. fn: function () {
  2305. var self=this;
  2306. var o;
  2307. return smalltalk.withContext(function($ctx1) { o=_st((smalltalk.Object || Object))._new();
  2308. _st(o)._basicAt_put_("func",(function(){
  2309. return smalltalk.withContext(function($ctx2) { return "hello";
  2310. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2311. _st(o)._basicAt_put_("func2",(function(a){
  2312. return smalltalk.withContext(function($ctx2) { return _st(a).__plus((1));
  2313. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}));
  2314. _st(self)._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  2315. _st(self)._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  2316. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o}, smalltalk.ObjectTest)});}
  2317. }),
  2318. smalltalk.ObjectTest);
  2319. smalltalk.addMethod(
  2320. "_testDNU",
  2321. smalltalk.method({
  2322. selector: "testDNU",
  2323. fn: function () {
  2324. var self=this;
  2325. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  2326. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Object || Object))._new())._foo();
  2327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2328. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{}, smalltalk.ObjectTest)});}
  2329. }),
  2330. smalltalk.ObjectTest);
  2331. smalltalk.addMethod(
  2332. "_testEquality",
  2333. smalltalk.method({
  2334. selector: "testEquality",
  2335. fn: function () {
  2336. var self=this;
  2337. var o;
  2338. return smalltalk.withContext(function($ctx1) { o=_st((smalltalk.Object || Object))._new();
  2339. _st(self)._deny_(_st(o).__eq(_st((smalltalk.Object || Object))._new()));
  2340. _st(self)._assert_(_st(o).__eq(o));
  2341. _st(self)._assert_(_st(_st(o)._yourself()).__eq(o));
  2342. _st(self)._assert_(_st(o).__eq(_st(o)._yourself()));
  2343. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o}, smalltalk.ObjectTest)});}
  2344. }),
  2345. smalltalk.ObjectTest);
  2346. smalltalk.addMethod(
  2347. "_testHalt",
  2348. smalltalk.method({
  2349. selector: "testHalt",
  2350. fn: function () {
  2351. var self=this;
  2352. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  2353. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Object || Object))._new())._halt();
  2354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  2355. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{}, smalltalk.ObjectTest)});}
  2356. }),
  2357. smalltalk.ObjectTest);
  2358. smalltalk.addMethod(
  2359. "_testIdentity",
  2360. smalltalk.method({
  2361. selector: "testIdentity",
  2362. fn: function () {
  2363. var self=this;
  2364. var o;
  2365. return smalltalk.withContext(function($ctx1) { o=_st((smalltalk.Object || Object))._new();
  2366. _st(self)._deny_(_st(o).__eq_eq(_st((smalltalk.Object || Object))._new()));
  2367. _st(self)._assert_(_st(o).__eq_eq(o));
  2368. _st(self)._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  2369. _st(self)._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  2370. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o}, smalltalk.ObjectTest)});}
  2371. }),
  2372. smalltalk.ObjectTest);
  2373. smalltalk.addMethod(
  2374. "_testIfNil",
  2375. smalltalk.method({
  2376. selector: "testIfNil",
  2377. fn: function () {
  2378. var self=this;
  2379. return smalltalk.withContext(function($ctx1) { var $1,$4,$3,$2,$5,$8,$7,$6,$9,$12,$11,$10;
  2380. _st(self)._deny_(_st(_st((smalltalk.Object || Object))._new())._isNil());
  2381. $1=self;
  2382. $4=_st((smalltalk.Object || Object))._new();
  2383. if(($receiver = $4) == nil || $receiver == undefined){
  2384. $3=true;
  2385. } else {
  2386. $3=$4;
  2387. };
  2388. $2=_st($3).__eq(true);
  2389. _st($1)._deny_($2);
  2390. $5=self;
  2391. $8=_st((smalltalk.Object || Object))._new();
  2392. if(($receiver = $8) == nil || $receiver == undefined){
  2393. $7=$8;
  2394. } else {
  2395. $7=true;
  2396. };
  2397. $6=_st($7).__eq(true);
  2398. _st($5)._assert_($6);
  2399. $9=self;
  2400. $12=_st((smalltalk.Object || Object))._new();
  2401. if(($receiver = $12) == nil || $receiver == undefined){
  2402. $11=false;
  2403. } else {
  2404. $11=true;
  2405. };
  2406. $10=_st($11).__eq(true);
  2407. _st($9)._assert_($10);
  2408. _st(self)._assert_(_st(_st(_st((smalltalk.Object || Object))._new())._ifNotNil_ifNil_((function(){
  2409. return smalltalk.withContext(function($ctx2) { return true;
  2410. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  2411. return smalltalk.withContext(function($ctx2) { return false;
  2412. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq(true));
  2413. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{}, smalltalk.ObjectTest)});}
  2414. }),
  2415. smalltalk.ObjectTest);
  2416. smalltalk.addMethod(
  2417. "_testInstVars",
  2418. smalltalk.method({
  2419. selector: "testInstVars",
  2420. fn: function () {
  2421. var self=this;
  2422. var o;
  2423. return smalltalk.withContext(function($ctx1) { o=_st((smalltalk.ObjectMock || ObjectMock))._new();
  2424. _st(self)._assert_equals_(_st(o)._instVarAt_(smalltalk.symbolFor("foo")),nil);
  2425. _st(o)._instVarAt_put_(smalltalk.symbolFor("foo"),(1));
  2426. _st(self)._assert_equals_(_st(o)._instVarAt_(smalltalk.symbolFor("foo")),(1));
  2427. _st(self)._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  2428. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o}, smalltalk.ObjectTest)});}
  2429. }),
  2430. smalltalk.ObjectTest);
  2431. smalltalk.addMethod(
  2432. "_testNilUndefined",
  2433. smalltalk.method({
  2434. selector: "testNilUndefined",
  2435. fn: function () {
  2436. var self=this;
  2437. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(nil).__eq(_st(self)._notDefined()));
  2438. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{}, smalltalk.ObjectTest)});}
  2439. }),
  2440. smalltalk.ObjectTest);
  2441. smalltalk.addMethod(
  2442. "_testYourself",
  2443. smalltalk.method({
  2444. selector: "testYourself",
  2445. fn: function () {
  2446. var self=this;
  2447. var o;
  2448. return smalltalk.withContext(function($ctx1) { o=_st((smalltalk.ObjectMock || ObjectMock))._new();
  2449. _st(self)._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  2450. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o}, smalltalk.ObjectTest)});}
  2451. }),
  2452. smalltalk.ObjectTest);
  2453. smalltalk.addMethod(
  2454. "_testidentityHash",
  2455. smalltalk.method({
  2456. selector: "testidentityHash",
  2457. fn: function () {
  2458. var self=this;
  2459. var o1,o2;
  2460. return smalltalk.withContext(function($ctx1) { o1=_st((smalltalk.Object || Object))._new();
  2461. o2=_st((smalltalk.Object || Object))._new();
  2462. _st(self)._assert_(_st(_st(o1)._identityHash()).__eq_eq(_st(o1)._identityHash()));
  2463. _st(self)._deny_(_st(_st(o1)._identityHash()).__eq_eq(_st(o2)._identityHash()));
  2464. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2}, smalltalk.ObjectTest)});}
  2465. }),
  2466. smalltalk.ObjectTest);
  2467. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  2468. smalltalk.addMethod(
  2469. "_setUp",
  2470. smalltalk.method({
  2471. selector: "setUp",
  2472. fn: function () {
  2473. var self=this;
  2474. return smalltalk.withContext(function($ctx1) { var $1,$2;
  2475. self["@backUpCommitPathJs"]=_st((smalltalk.Package || Package))._defaultCommitPathJs();
  2476. self["@backUpCommitPathSt"]=_st((smalltalk.Package || Package))._defaultCommitPathSt();
  2477. _st((smalltalk.Package || Package))._resetCommitPaths();
  2478. self["@zorkPackage"]=_st(_st((smalltalk.Package || Package))._new())._name_("Zork");
  2479. $1=_st((smalltalk.Package || Package))._new();
  2480. _st($1)._name_("Grul");
  2481. _st($1)._commitPathJs_("server/grul/js");
  2482. _st($1)._commitPathSt_("grul/st");
  2483. $2=_st($1)._yourself();
  2484. self["@grulPackage"]=$2;
  2485. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{}, smalltalk.PackageTest)});}
  2486. }),
  2487. smalltalk.PackageTest);
  2488. smalltalk.addMethod(
  2489. "_tearDown",
  2490. smalltalk.method({
  2491. selector: "tearDown",
  2492. fn: function () {
  2493. var self=this;
  2494. return smalltalk.withContext(function($ctx1) { var $1,$2;
  2495. $1=(smalltalk.Package || Package);
  2496. _st($1)._defaultCommitPathJs_(self["@backUpCommitPathJs"]);
  2497. $2=_st($1)._defaultCommitPathSt_(self["@backUpCommitPathSt"]);
  2498. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{}, smalltalk.PackageTest)});}
  2499. }),
  2500. smalltalk.PackageTest);
  2501. smalltalk.addMethod(
  2502. "_testGrulCommitPathJsShouldBeServerGrulJs",
  2503. smalltalk.method({
  2504. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2505. fn: function () {
  2506. var self=this;
  2507. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("server/grul/js",_st(self["@grulPackage"])._commitPathJs());
  2508. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{}, smalltalk.PackageTest)});}
  2509. }),
  2510. smalltalk.PackageTest);
  2511. smalltalk.addMethod(
  2512. "_testGrulCommitPathStShouldBeGrulSt",
  2513. smalltalk.method({
  2514. selector: "testGrulCommitPathStShouldBeGrulSt",
  2515. fn: function () {
  2516. var self=this;
  2517. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("grul/st",_st(self["@grulPackage"])._commitPathSt());
  2518. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{}, smalltalk.PackageTest)});}
  2519. }),
  2520. smalltalk.PackageTest);
  2521. smalltalk.addMethod(
  2522. "_testZorkCommitPathJsShouldBeJs",
  2523. smalltalk.method({
  2524. selector: "testZorkCommitPathJsShouldBeJs",
  2525. fn: function () {
  2526. var self=this;
  2527. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("js",_st(self["@zorkPackage"])._commitPathJs());
  2528. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJs",{}, smalltalk.PackageTest)});}
  2529. }),
  2530. smalltalk.PackageTest);
  2531. smalltalk.addMethod(
  2532. "_testZorkCommitPathStShouldBeSt",
  2533. smalltalk.method({
  2534. selector: "testZorkCommitPathStShouldBeSt",
  2535. fn: function () {
  2536. var self=this;
  2537. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("st",_st(self["@zorkPackage"])._commitPathSt());
  2538. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSt",{}, smalltalk.PackageTest)});}
  2539. }),
  2540. smalltalk.PackageTest);
  2541. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  2542. smalltalk.addMethod(
  2543. "_setUp",
  2544. smalltalk.method({
  2545. selector: "setUp",
  2546. fn: function () {
  2547. var self=this;
  2548. return smalltalk.withContext(function($ctx1) { var $1,$2;
  2549. smalltalk.PackageTest.fn.prototype._setUp.apply(_st(self), []);
  2550. $1=(smalltalk.Package || Package);
  2551. _st($1)._defaultCommitPathJs_("javascripts/");
  2552. $2=_st($1)._defaultCommitPathSt_("smalltalk/");
  2553. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)});}
  2554. }),
  2555. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2556. smalltalk.addMethod(
  2557. "_testGrulCommitPathJsShouldBeServerGrulJs",
  2558. smalltalk.method({
  2559. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2560. fn: function () {
  2561. var self=this;
  2562. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("server/grul/js",_st(self["@grulPackage"])._commitPathJs());
  2563. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)});}
  2564. }),
  2565. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2566. smalltalk.addMethod(
  2567. "_testGrulCommitPathStShouldBeGrulSt",
  2568. smalltalk.method({
  2569. selector: "testGrulCommitPathStShouldBeGrulSt",
  2570. fn: function () {
  2571. var self=this;
  2572. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("grul/st",_st(self["@grulPackage"])._commitPathSt());
  2573. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)});}
  2574. }),
  2575. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2576. smalltalk.addMethod(
  2577. "_testZorkCommitPathJsShouldBeJavascript",
  2578. smalltalk.method({
  2579. selector: "testZorkCommitPathJsShouldBeJavascript",
  2580. fn: function () {
  2581. var self=this;
  2582. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("javascripts/",_st(self["@zorkPackage"])._commitPathJs());
  2583. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJavascript",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)});}
  2584. }),
  2585. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2586. smalltalk.addMethod(
  2587. "_testZorkCommitPathStShouldBeSmalltalk",
  2588. smalltalk.method({
  2589. selector: "testZorkCommitPathStShouldBeSmalltalk",
  2590. fn: function () {
  2591. var self=this;
  2592. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("smalltalk/",_st(self["@zorkPackage"])._commitPathSt());
  2593. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSmalltalk",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)});}
  2594. }),
  2595. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2596. smalltalk.addMethod(
  2597. "_shouldInheritSelectors",
  2598. smalltalk.method({
  2599. selector: "shouldInheritSelectors",
  2600. fn: function () {
  2601. var self=this;
  2602. return smalltalk.withContext(function($ctx1) { return false;
  2603. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{}, smalltalk.PackageWithDefaultCommitPathChangedTest.klass)});}
  2604. }),
  2605. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  2606. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2607. smalltalk.addMethod(
  2608. "_testAccessing",
  2609. smalltalk.method({
  2610. selector: "testAccessing",
  2611. fn: function () {
  2612. var self=this;
  2613. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st((smalltalk.Point || Point))._x_y_((3),(4)))._x(),(3));
  2614. _st(self)._assert_equals_(_st(_st((smalltalk.Point || Point))._x_y_((3),(4)))._y(),(4));
  2615. _st(self)._assert_equals_(_st(_st(_st((smalltalk.Point || Point))._new())._x_((3)))._x(),(3));
  2616. _st(self)._assert_equals_(_st(_st(_st((smalltalk.Point || Point))._new())._y_((4)))._y(),(4));
  2617. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{}, smalltalk.PointTest)});}
  2618. }),
  2619. smalltalk.PointTest);
  2620. smalltalk.addMethod(
  2621. "_testArithmetic",
  2622. smalltalk.method({
  2623. selector: "testArithmetic",
  2624. fn: function () {
  2625. var self=this;
  2626. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st((3)).__at((4))).__star(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((9),(16)));
  2627. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__plus(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((6),(8)));
  2628. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__minus(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((0),(0)));
  2629. _st(self)._assert_equals_(_st(_st((6)).__at((8))).__slash(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((2),(2)));
  2630. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{}, smalltalk.PointTest)});}
  2631. }),
  2632. smalltalk.PointTest);
  2633. smalltalk.addMethod(
  2634. "_testAt",
  2635. smalltalk.method({
  2636. selector: "testAt",
  2637. fn: function () {
  2638. var self=this;
  2639. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((3)).__at((4)),_st((smalltalk.Point || Point))._x_y_((3),(4)));
  2640. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.PointTest)});}
  2641. }),
  2642. smalltalk.PointTest);
  2643. smalltalk.addMethod(
  2644. "_testEgality",
  2645. smalltalk.method({
  2646. selector: "testEgality",
  2647. fn: function () {
  2648. var self=this;
  2649. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((3)).__at((4))).__eq(_st((3)).__at((4))));
  2650. _st(self)._deny_(_st(_st((3)).__at((5))).__eq(_st((3)).__at((6))));
  2651. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{}, smalltalk.PointTest)});}
  2652. }),
  2653. smalltalk.PointTest);
  2654. smalltalk.addMethod(
  2655. "_testTranslateBy",
  2656. smalltalk.method({
  2657. selector: "testTranslateBy",
  2658. fn: function () {
  2659. var self=this;
  2660. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((3)).__at((4)),_st(_st((3)).__at((3)))._translateBy_(_st((0)).__at((1))));
  2661. _st(self)._assert_equals_(_st((3)).__at((2)),_st(_st((3)).__at((3)))._translateBy_(_st((0)).__at(_st((1))._negated())));
  2662. _st(self)._assert_equals_(_st((5)).__at((6)),_st(_st((3)).__at((3)))._translateBy_(_st((2)).__at((3))));
  2663. _st(self)._assert_equals_(_st((0)).__at((3)),_st(_st((3)).__at((3)))._translateBy_(_st(_st((3))._negated()).__at((0))));
  2664. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{}, smalltalk.PointTest)});}
  2665. }),
  2666. smalltalk.PointTest);
  2667. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2668. smalltalk.addMethod(
  2669. "_textNext",
  2670. smalltalk.method({
  2671. selector: "textNext",
  2672. fn: function () {
  2673. var self=this;
  2674. return smalltalk.withContext(function($ctx1) { _st((10000))._timesRepeat_((function(){
  2675. var current,next;
  2676. return smalltalk.withContext(function($ctx2) { next=_st(_st((smalltalk.Random || Random))._new())._next();
  2677. next;
  2678. _st(self)._assert_(_st(next).__gt_eq((0)));
  2679. _st(self)._assert_(_st(next).__lt((1)));
  2680. _st(self)._deny_(_st(current).__eq(next));
  2681. return _st(next).__eq(current);
  2682. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1)})}));
  2683. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{}, smalltalk.RandomTest)});}
  2684. }),
  2685. smalltalk.RandomTest);
  2686. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2687. smalltalk.addMethod(
  2688. "_testAddRemove",
  2689. smalltalk.method({
  2690. selector: "testAddRemove",
  2691. fn: function () {
  2692. var self=this;
  2693. var set;
  2694. return smalltalk.withContext(function($ctx1) { set=_st((smalltalk.Set || Set))._new();
  2695. _st(self)._assert_(_st(set)._isEmpty());
  2696. _st(set)._add_((3));
  2697. _st(self)._assert_(_st(set)._includes_((3)));
  2698. _st(set)._add_((5));
  2699. _st(self)._assert_(_st(set)._includes_((5)));
  2700. _st(set)._remove_((3));
  2701. _st(self)._deny_(_st(set)._includes_((3)));
  2702. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set}, smalltalk.SetTest)});}
  2703. }),
  2704. smalltalk.SetTest);
  2705. smalltalk.addMethod(
  2706. "_testAt",
  2707. smalltalk.method({
  2708. selector: "testAt",
  2709. fn: function () {
  2710. var self=this;
  2711. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  2712. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Set || Set))._new())._at_put_((1),(2));
  2713. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  2714. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.SetTest)});}
  2715. }),
  2716. smalltalk.SetTest);
  2717. smalltalk.addMethod(
  2718. "_testCollect",
  2719. smalltalk.method({
  2720. selector: "testCollect",
  2721. fn: function (){
  2722. var self=this;
  2723. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st([(0), (2)])._asSet(),_st(_st([(5), (6), (8)])._asSet())._collect_((function(x){
  2724. return smalltalk.withContext(function($ctx2) { return _st(x).__backslash_backslash((3));
  2725. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})));
  2726. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{}, smalltalk.SetTest)})}
  2727. }),
  2728. smalltalk.SetTest);
  2729. smalltalk.addMethod(
  2730. "_testComparing",
  2731. smalltalk.method({
  2732. selector: "testComparing",
  2733. fn: function () {
  2734. var self=this;
  2735. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st([(0), (2)])._asSet(),_st([(0), (2)])._asSet());
  2736. _st(self)._assert_equals_(_st([(2), (0)])._asSet(),_st([(0), (2)])._asSet());
  2737. _st(self)._deny_(_st(_st([(0), (2), (3)])._asSet()).__eq(_st([(0), (2)])._asSet()));
  2738. _st(self)._deny_(_st(_st([(1), (2)])._asSet()).__eq(_st([(0), (2)])._asSet()));
  2739. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{}, smalltalk.SetTest)});}
  2740. }),
  2741. smalltalk.SetTest);
  2742. smalltalk.addMethod(
  2743. "_testPrintString",
  2744. smalltalk.method({
  2745. selector: "testPrintString",
  2746. fn: function () {
  2747. var self=this;
  2748. var set;
  2749. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  2750. set=_st((smalltalk.Set || Set))._new();
  2751. _st(self)._assert_equals_("a Set ()",_st(set)._printString());
  2752. $1=set;
  2753. _st($1)._add_((1));
  2754. $2=_st($1)._add_((3));
  2755. _st(self)._assert_equals_("a Set (1 3)",_st(set)._printString());
  2756. _st(set)._add_("foo");
  2757. _st(self)._assert_equals_("a Set (1 3 'foo')",_st(set)._printString());
  2758. $3=set;
  2759. _st($3)._remove_((1));
  2760. $4=_st($3)._remove_((3));
  2761. _st(self)._assert_equals_("a Set ('foo')",_st(set)._printString());
  2762. _st(set)._add_((3));
  2763. _st(self)._assert_equals_("a Set ('foo' 3)",_st(set)._printString());
  2764. _st(set)._add_((3));
  2765. _st(self)._assert_equals_("a Set ('foo' 3)",_st(set)._printString());
  2766. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set}, smalltalk.SetTest)});}
  2767. }),
  2768. smalltalk.SetTest);
  2769. smalltalk.addMethod(
  2770. "_testSize",
  2771. smalltalk.method({
  2772. selector: "testSize",
  2773. fn: function () {
  2774. var self=this;
  2775. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._new())._size(),(0));
  2776. _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._withAll_([(1), (2), (3), (4)]))._size(),(4));
  2777. _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._withAll_([(1), (1), (1), (1)]))._size(),(1));
  2778. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{}, smalltalk.SetTest)});}
  2779. }),
  2780. smalltalk.SetTest);
  2781. smalltalk.addMethod(
  2782. "_testUnicity",
  2783. smalltalk.method({
  2784. selector: "testUnicity",
  2785. fn: function () {
  2786. var self=this;
  2787. var set;
  2788. return smalltalk.withContext(function($ctx1) { set=_st((smalltalk.Set || Set))._new();
  2789. _st(set)._add_((21));
  2790. _st(set)._add_("hello");
  2791. _st(set)._add_((21));
  2792. _st(self)._assert_(_st(_st(set)._size()).__eq((2)));
  2793. _st(set)._add_("hello");
  2794. _st(self)._assert_(_st(_st(set)._size()).__eq((2)));
  2795. _st(self)._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  2796. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set}, smalltalk.SetTest)});}
  2797. }),
  2798. smalltalk.SetTest);
  2799. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2800. smalltalk.addMethod(
  2801. "_testCopying",
  2802. smalltalk.method({
  2803. selector: "testCopying",
  2804. fn: function () {
  2805. var self=this;
  2806. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(nil)._copy(),nil);
  2807. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{}, smalltalk.UndefinedTest)});}
  2808. }),
  2809. smalltalk.UndefinedTest);
  2810. smalltalk.addMethod(
  2811. "_testDeepCopy",
  2812. smalltalk.method({
  2813. selector: "testDeepCopy",
  2814. fn: function () {
  2815. var self=this;
  2816. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(nil)._deepCopy()).__eq(nil));
  2817. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{}, smalltalk.UndefinedTest)});}
  2818. }),
  2819. smalltalk.UndefinedTest);
  2820. smalltalk.addMethod(
  2821. "_testIfNil",
  2822. smalltalk.method({
  2823. selector: "testIfNil",
  2824. fn: function () {
  2825. var self=this;
  2826. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$5,$4,$6,$7;
  2827. $1=self;
  2828. if(($receiver = nil) == nil || $receiver == undefined){
  2829. $2=true;
  2830. } else {
  2831. $2=nil;
  2832. };
  2833. _st($1)._assert_equals_($2,true);
  2834. $3=self;
  2835. if(($receiver = nil) == nil || $receiver == undefined){
  2836. $5=nil;
  2837. } else {
  2838. $5=true;
  2839. };
  2840. $4=_st($5).__eq(true);
  2841. _st($3)._deny_($4);
  2842. $6=self;
  2843. if(($receiver = nil) == nil || $receiver == undefined){
  2844. $7=true;
  2845. } else {
  2846. $7=false;
  2847. };
  2848. _st($6)._assert_equals_($7,true);
  2849. _st(self)._deny_(_st(_st(nil)._ifNotNil_ifNil_((function(){
  2850. return smalltalk.withContext(function($ctx2) { return true;
  2851. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  2852. return smalltalk.withContext(function($ctx2) { return false;
  2853. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq(true));
  2854. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{}, smalltalk.UndefinedTest)});}
  2855. }),
  2856. smalltalk.UndefinedTest);
  2857. smalltalk.addMethod(
  2858. "_testIsNil",
  2859. smalltalk.method({
  2860. selector: "testIsNil",
  2861. fn: function () {
  2862. var self=this;
  2863. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(nil)._isNil());
  2864. _st(self)._deny_(_st(nil)._notNil());
  2865. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{}, smalltalk.UndefinedTest)});}
  2866. }),
  2867. smalltalk.UndefinedTest);