Kernel-Tests.js 170 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860
  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. category: 'tests',
  8. fn: function (){
  9. var self=this;
  10. return smalltalk.withContext(function($ctx1) { _st(self)._shouldnt_raise_((function(){
  11. return smalltalk.withContext(function($ctx2) { return _st(_st((function(){
  12. return smalltalk.withContext(function($ctx3) { return _st(_st((smalltalk.Error || Error))._new())._signal();
  13. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._valueWithInterval_((0)))._clearInterval();
  14. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  15. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{}, smalltalk.BlockClosureTest)})},
  16. args: [],
  17. source: "testCanClearInterval\x0a\x09self shouldnt: [([Error new signal] valueWithInterval: 0) clearInterval] raise: Error",
  18. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  19. referencedClasses: ["Error"]
  20. }),
  21. smalltalk.BlockClosureTest);
  22. smalltalk.addMethod(
  23. "_testCanClearTimeout",
  24. smalltalk.method({
  25. selector: "testCanClearTimeout",
  26. category: 'tests',
  27. fn: function (){
  28. var self=this;
  29. return smalltalk.withContext(function($ctx1) { _st(self)._shouldnt_raise_((function(){
  30. return smalltalk.withContext(function($ctx2) { return _st(_st((function(){
  31. return smalltalk.withContext(function($ctx3) { return _st(_st((smalltalk.Error || Error))._new())._signal();
  32. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._valueWithTimeout_((0)))._clearTimeout();
  33. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  34. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{}, smalltalk.BlockClosureTest)})},
  35. args: [],
  36. source: "testCanClearTimeout\x0a\x09self shouldnt: [([Error new signal] valueWithTimeout: 0) clearTimeout] raise: Error",
  37. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  38. referencedClasses: ["Error"]
  39. }),
  40. smalltalk.BlockClosureTest);
  41. smalltalk.addMethod(
  42. "_testCompiledSource",
  43. smalltalk.method({
  44. selector: "testCompiledSource",
  45. category: 'tests',
  46. fn: function (){
  47. var self=this;
  48. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((function(){
  49. return smalltalk.withContext(function($ctx2) { return _st((1)).__plus((1));
  50. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._compiledSource())._includesSubString_("function"));
  51. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{}, smalltalk.BlockClosureTest)})},
  52. args: [],
  53. source: "testCompiledSource\x0a\x09self assert: ([1+1] compiledSource includesSubString: 'function')",
  54. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  55. referencedClasses: []
  56. }),
  57. smalltalk.BlockClosureTest);
  58. smalltalk.addMethod(
  59. "_testEnsure",
  60. smalltalk.method({
  61. selector: "testEnsure",
  62. category: 'tests',
  63. fn: function (){
  64. var self=this;
  65. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_((3),_st((function(){
  66. return smalltalk.withContext(function($ctx2) { return (3);
  67. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  68. return smalltalk.withContext(function($ctx2) { return (4);
  69. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  70. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{}, smalltalk.BlockClosureTest)})},
  71. args: [],
  72. source: "testEnsure\x0a\x09self assert: 3 equals: ([3] ensure: [4])",
  73. messageSends: ["assert:equals:", "ensure:"],
  74. referencedClasses: []
  75. }),
  76. smalltalk.BlockClosureTest);
  77. smalltalk.addMethod(
  78. "_testEnsureRaises",
  79. smalltalk.method({
  80. selector: "testEnsureRaises",
  81. category: 'tests',
  82. fn: function (){
  83. var self=this;
  84. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  85. return smalltalk.withContext(function($ctx2) { return _st((function(){
  86. return smalltalk.withContext(function($ctx3) { return _st(_st((smalltalk.Error || Error))._new())._signal();
  87. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._ensure_((function(){
  88. return smalltalk.withContext(function($ctx3) { return true;
  89. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  90. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  91. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{}, smalltalk.BlockClosureTest)})},
  92. args: [],
  93. source: "testEnsureRaises\x0a\x09self should: [[Error new signal] ensure: [true]] raise: Error",
  94. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  95. referencedClasses: ["Error"]
  96. }),
  97. smalltalk.BlockClosureTest);
  98. smalltalk.addMethod(
  99. "_testExceptionSemantics",
  100. smalltalk.method({
  101. selector: "testExceptionSemantics",
  102. category: 'tests',
  103. fn: function (){
  104. var self=this;
  105. return smalltalk.withContext(function($ctx1) { _st(self)._timeout_((100));
  106. _st(_st(self)._async_((function(){
  107. return smalltalk.withContext(function($ctx2) { return _st((function(){
  108. return smalltalk.withContext(function($ctx3) { _st(self)._assert_(true);
  109. _st((smalltalk.Error || Error))._signal();
  110. _st(self)._deny_(true);
  111. return _st(self)._finished();
  112. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(ex){
  113. return smalltalk.withContext(function($ctx3) { return _st(self)._finished();
  114. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx1)})}));
  115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((0));
  116. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{}, smalltalk.BlockClosureTest)})},
  117. args: [],
  118. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a self timeout: 100.\x0a \x0a (self async: [ \x0a \x09[ \x0a \x09self assert: true. \x0a Error signal. \x0a \x22The following should *not* be run\x22\x0a self deny: true.\x0a self finished.\x0a \x09\x09] on: Error do: [ :ex | self finished ] \x0a\x09]) valueWithTimeout: 0",
  119. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "finished", "assert:", "signal", "deny:"],
  120. referencedClasses: ["Error"]
  121. }),
  122. smalltalk.BlockClosureTest);
  123. smalltalk.addMethod(
  124. "_testNumArgs",
  125. smalltalk.method({
  126. selector: "testNumArgs",
  127. category: 'tests',
  128. fn: function (){
  129. var self=this;
  130. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((function(){
  131. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._numArgs(),(0));
  132. _st(self)._assert_equals_(_st((function(a,b){
  133. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._numArgs(),(2));
  134. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{}, smalltalk.BlockClosureTest)})},
  135. args: [],
  136. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [:a :b | ] numArgs equals: 2",
  137. messageSends: ["assert:equals:", "numArgs"],
  138. referencedClasses: []
  139. }),
  140. smalltalk.BlockClosureTest);
  141. smalltalk.addMethod(
  142. "_testOnDo",
  143. smalltalk.method({
  144. selector: "testOnDo",
  145. category: 'tests',
  146. fn: function (){
  147. var self=this;
  148. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((function(){
  149. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Error || Error))._new())._signal();
  150. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(ex){
  151. return smalltalk.withContext(function($ctx2) { return true;
  152. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})})));
  153. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{}, smalltalk.BlockClosureTest)})},
  154. args: [],
  155. source: "testOnDo\x0a\x09self assert: ([Error new signal] on: Error do: [:ex | true])",
  156. messageSends: ["assert:", "on:do:", "signal", "new"],
  157. referencedClasses: ["Error"]
  158. }),
  159. smalltalk.BlockClosureTest);
  160. smalltalk.addMethod(
  161. "_testValue",
  162. smalltalk.method({
  163. selector: "testValue",
  164. category: 'tests',
  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 _st((1)).__plus((1));
  169. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._value(),(2));
  170. _st(self)._assert_equals_(_st((function(x){
  171. return smalltalk.withContext(function($ctx2) { return _st(x).__plus((1));
  172. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}))._value_((2)),(3));
  173. _st(self)._assert_equals_(_st((function(x,y){
  174. return smalltalk.withContext(function($ctx2) { return _st(x).__star(y);
  175. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1)})}))._value_value_((2),(4)),(8));
  176. _st(self)._assert_equals_(_st((function(a,b,c){
  177. return smalltalk.withContext(function($ctx2) { return (1);
  178. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1)})}))._value(),(1));
  179. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{}, smalltalk.BlockClosureTest)})},
  180. args: [],
  181. source: "testValue\x0a\x09self assert: ([1+1] value) equals: 2.\x0a\x09self assert: ([:x | x +1] value: 2) equals: 3.\x0a\x09self assert: ([:x :y | x*y] value: 2 value: 4) equals: 8. \x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([:a :b :c | 1] value) equals: 1",
  182. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  183. referencedClasses: []
  184. }),
  185. smalltalk.BlockClosureTest);
  186. smalltalk.addMethod(
  187. "_testValueWithPossibleArguments",
  188. smalltalk.method({
  189. selector: "testValueWithPossibleArguments",
  190. category: 'tests',
  191. fn: function (){
  192. var self=this;
  193. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((function(){
  194. return smalltalk.withContext(function($ctx2) { return (1);
  195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(1));
  196. _st(self)._assert_equals_(_st((function(a){
  197. return smalltalk.withContext(function($ctx2) { return _st(a).__plus((4));
  198. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(7));
  199. _st(self)._assert_equals_(_st((function(a,b){
  200. return smalltalk.withContext(function($ctx2) { return _st(a).__plus(b);
  201. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  202. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{}, smalltalk.BlockClosureTest)})},
  203. args: [],
  204. source: "testValueWithPossibleArguments\x0a\x09self assert: ([1] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([:a | a + 4] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([:a :b | a + b] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  205. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  206. referencedClasses: []
  207. }),
  208. smalltalk.BlockClosureTest);
  209. smalltalk.addMethod(
  210. "_testWhileFalse",
  211. smalltalk.method({
  212. selector: "testWhileFalse",
  213. category: 'tests',
  214. fn: function (){
  215. var self=this;
  216. var i;
  217. return smalltalk.withContext(function($ctx1) { i=(0);
  218. _st((function(){
  219. return smalltalk.withContext(function($ctx2) { return _st(i).__gt((5));
  220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  221. return smalltalk.withContext(function($ctx2) { i=_st(i).__plus((1));
  222. return i;
  223. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  224. _st(self)._assert_equals_(i,(6));
  225. i=(0);
  226. _st((function(){
  227. return smalltalk.withContext(function($ctx2) { i=_st(i).__plus((1));
  228. i;
  229. return _st(i).__gt((5));
  230. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse();
  231. _st(self)._assert_equals_(i,(6));
  232. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i}, smalltalk.BlockClosureTest)})},
  233. args: [],
  234. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[i > 5] whileFalse: [i := i + 1].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[i := i + 1. i > 5] whileFalse.\x0a\x09self assert: i equals: 6",
  235. messageSends: ["whileFalse:", "+", ">", "assert:equals:", "whileFalse"],
  236. referencedClasses: []
  237. }),
  238. smalltalk.BlockClosureTest);
  239. smalltalk.addMethod(
  240. "_testWhileTrue",
  241. smalltalk.method({
  242. selector: "testWhileTrue",
  243. category: 'tests',
  244. fn: function (){
  245. var self=this;
  246. var i;
  247. return smalltalk.withContext(function($ctx1) { i=(0);
  248. _st((function(){
  249. return smalltalk.withContext(function($ctx2) { return _st(i).__lt((5));
  250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  251. return smalltalk.withContext(function($ctx2) { i=_st(i).__plus((1));
  252. return i;
  253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  254. _st(self)._assert_equals_(i,(5));
  255. i=(0);
  256. _st((function(){
  257. return smalltalk.withContext(function($ctx2) { i=_st(i).__plus((1));
  258. i;
  259. return _st(i).__lt((5));
  260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue();
  261. _st(self)._assert_equals_(i,(5));
  262. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i}, smalltalk.BlockClosureTest)})},
  263. args: [],
  264. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[i < 5] whileTrue: [i := i + 1].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[i := i + 1. i < 5] whileTrue.\x0a\x09self assert: i equals: 5",
  265. messageSends: ["whileTrue:", "+", "<", "assert:equals:", "whileTrue"],
  266. referencedClasses: []
  267. }),
  268. smalltalk.BlockClosureTest);
  269. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  270. smalltalk.addMethod(
  271. "_testEquality",
  272. smalltalk.method({
  273. selector: "testEquality",
  274. category: 'tests',
  275. fn: function (){
  276. var self=this;
  277. return smalltalk.withContext(function($ctx1) { _st(self)._deny_(_st((0)).__eq(false));
  278. _st(self)._deny_(_st(false).__eq((0)));
  279. _st(self)._deny_(_st("").__eq(false));
  280. _st(self)._deny_(_st(false).__eq(""));
  281. _st(self)._assert_(_st(true).__eq(true));
  282. _st(self)._deny_(_st(false).__eq(true));
  283. _st(self)._deny_(_st(true).__eq(false));
  284. _st(self)._assert_(_st(false).__eq(false));
  285. _st(self)._assert_(_st(_st(true)._yourself()).__eq(true));
  286. _st(self)._assert_(_st(_st(true)._yourself()).__eq(_st(true)._yourself()));
  287. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{}, smalltalk.BooleanTest)})},
  288. args: [],
  289. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false. \x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: true = true.\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: false = false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself = true.\x0a\x09self assert: true yourself = true yourself",
  290. messageSends: ["deny:", "=", "assert:", "yourself"],
  291. referencedClasses: []
  292. }),
  293. smalltalk.BooleanTest);
  294. smalltalk.addMethod(
  295. "_testIdentity",
  296. smalltalk.method({
  297. selector: "testIdentity",
  298. category: 'tests',
  299. fn: function (){
  300. var self=this;
  301. return smalltalk.withContext(function($ctx1) { _st(self)._deny_(_st((0)).__eq_eq(false));
  302. _st(self)._deny_(_st(false).__eq_eq((0)));
  303. _st(self)._deny_(_st("").__eq_eq(false));
  304. _st(self)._deny_(_st(false).__eq_eq(""));
  305. _st(self)._assert_(_st(true).__eq_eq(true));
  306. _st(self)._deny_(_st(false).__eq_eq(true));
  307. _st(self)._deny_(_st(true).__eq_eq(false));
  308. _st(self)._assert_(_st(false).__eq_eq(false));
  309. _st(self)._assert_(_st(_st(true)._yourself()).__eq_eq(true));
  310. _st(self)._assert_(_st(_st(true)._yourself()).__eq_eq(_st(true)._yourself()));
  311. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{}, smalltalk.BooleanTest)})},
  312. args: [],
  313. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false. \x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  314. messageSends: ["deny:", "==", "assert:", "yourself"],
  315. referencedClasses: []
  316. }),
  317. smalltalk.BooleanTest);
  318. smalltalk.addMethod(
  319. "_testIfTrueIfFalse",
  320. smalltalk.method({
  321. selector: "testIfTrueIfFalse",
  322. category: 'tests',
  323. fn: function (){
  324. var self=this;
  325. 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;
  326. $1=self;
  327. if(smalltalk.assert(true)){
  328. $3="alternative block";
  329. };
  330. $2=_st($3).__eq("alternative block");
  331. _st($1)._assert_($2);
  332. $4=self;
  333. if(! smalltalk.assert(true)){
  334. $6="alternative block";
  335. };
  336. $5=_st($6).__eq(nil);
  337. _st($4)._assert_($5);
  338. $7=self;
  339. if(smalltalk.assert(false)){
  340. $9="alternative block";
  341. };
  342. $8=_st($9).__eq(nil);
  343. _st($7)._assert_($8);
  344. $10=self;
  345. if(! smalltalk.assert(false)){
  346. $12="alternative block";
  347. };
  348. $11=_st($12).__eq("alternative block");
  349. _st($10)._assert_($11);
  350. $13=self;
  351. if(smalltalk.assert(false)){
  352. $15="alternative block";
  353. } else {
  354. $15="alternative block2";
  355. };
  356. $14=_st($15).__eq("alternative block2");
  357. _st($13)._assert_($14);
  358. $16=self;
  359. if(smalltalk.assert(false)){
  360. $18="alternative block2";
  361. } else {
  362. $18="alternative block";
  363. };
  364. $17=_st($18).__eq("alternative block");
  365. _st($16)._assert_($17);
  366. $19=self;
  367. if(smalltalk.assert(true)){
  368. $21="alternative block";
  369. } else {
  370. $21="alternative block2";
  371. };
  372. $20=_st($21).__eq("alternative block");
  373. _st($19)._assert_($20);
  374. $22=self;
  375. if(smalltalk.assert(true)){
  376. $24="alternative block2";
  377. } else {
  378. $24="alternative block";
  379. };
  380. $23=_st($24).__eq("alternative block2");
  381. _st($22)._assert_($23);
  382. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{}, smalltalk.BooleanTest)})},
  383. args: [],
  384. source: "testIfTrueIfFalse\x0a \x0a\x09self assert: (true ifTrue: ['alternative block']) = 'alternative block'.\x0a\x09self assert: (true ifFalse: ['alternative block']) = nil.\x0a\x0a\x09self assert: (false ifTrue: ['alternative block']) = nil.\x0a\x09self assert: (false ifFalse: ['alternative block']) = 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: ['alternative block'] ifFalse: ['alternative block2']) = 'alternative block2'.\x0a\x09self assert: (false ifFalse: ['alternative block'] ifTrue: ['alternative block2']) = 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: ['alternative block'] ifFalse: ['alternative block2']) = 'alternative block'.\x0a\x09self assert: (true ifFalse: ['alternative block'] ifTrue: ['alternative block2']) = 'alternative block2'.",
  385. messageSends: ["assert:", "=", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  386. referencedClasses: []
  387. }),
  388. smalltalk.BooleanTest);
  389. smalltalk.addMethod(
  390. "_testIfTrueIfFalseWithBoxing",
  391. smalltalk.method({
  392. selector: "testIfTrueIfFalseWithBoxing",
  393. category: 'tests',
  394. fn: function (){
  395. var self=this;
  396. 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;
  397. $1=self;
  398. $4=_st(true)._yourself();
  399. if(smalltalk.assert($4)){
  400. $3="alternative block";
  401. };
  402. $2=_st($3).__eq("alternative block");
  403. _st($1)._assert_($2);
  404. $5=self;
  405. $8=_st(true)._yourself();
  406. if(! smalltalk.assert($8)){
  407. $7="alternative block";
  408. };
  409. $6=_st($7).__eq(nil);
  410. _st($5)._assert_($6);
  411. $9=self;
  412. $12=_st(false)._yourself();
  413. if(smalltalk.assert($12)){
  414. $11="alternative block";
  415. };
  416. $10=_st($11).__eq(nil);
  417. _st($9)._assert_($10);
  418. $13=self;
  419. $16=_st(false)._yourself();
  420. if(! smalltalk.assert($16)){
  421. $15="alternative block";
  422. };
  423. $14=_st($15).__eq("alternative block");
  424. _st($13)._assert_($14);
  425. $17=self;
  426. $20=_st(false)._yourself();
  427. if(smalltalk.assert($20)){
  428. $19="alternative block";
  429. } else {
  430. $19="alternative block2";
  431. };
  432. $18=_st($19).__eq("alternative block2");
  433. _st($17)._assert_($18);
  434. $21=self;
  435. $24=_st(false)._yourself();
  436. if(smalltalk.assert($24)){
  437. $23="alternative block2";
  438. } else {
  439. $23="alternative block";
  440. };
  441. $22=_st($23).__eq("alternative block");
  442. _st($21)._assert_($22);
  443. $25=self;
  444. $28=_st(true)._yourself();
  445. if(smalltalk.assert($28)){
  446. $27="alternative block";
  447. } else {
  448. $27="alternative block2";
  449. };
  450. $26=_st($27).__eq("alternative block");
  451. _st($25)._assert_($26);
  452. $29=self;
  453. $32=_st(true)._yourself();
  454. if(smalltalk.assert($32)){
  455. $31="alternative block2";
  456. } else {
  457. $31="alternative block";
  458. };
  459. $30=_st($31).__eq("alternative block2");
  460. _st($29)._assert_($30);
  461. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{}, smalltalk.BooleanTest)})},
  462. args: [],
  463. source: "testIfTrueIfFalseWithBoxing\x0a \x0a\x09self assert: (true yourself ifTrue: ['alternative block']) = 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: ['alternative block']) = nil.\x0a\x0a\x09self assert: (false yourself ifTrue: ['alternative block']) = nil.\x0a\x09self assert: (false yourself ifFalse: ['alternative block']) = 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: ['alternative block'] ifFalse: ['alternative block2']) = 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: ['alternative block'] ifTrue: ['alternative block2']) = 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: ['alternative block'] ifFalse: ['alternative block2']) = 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: ['alternative block'] ifTrue: ['alternative block2']) = 'alternative block2'.",
  464. messageSends: ["assert:", "=", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  465. referencedClasses: []
  466. }),
  467. smalltalk.BooleanTest);
  468. smalltalk.addMethod(
  469. "_testLogic",
  470. smalltalk.method({
  471. selector: "testLogic",
  472. category: 'tests',
  473. fn: function (){
  474. var self=this;
  475. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5,$6,$7,$8;
  476. $1=self;
  477. _st($1)._assert_(_st(true).__and(true));
  478. _st($1)._deny_(_st(true).__and(false));
  479. _st($1)._deny_(_st(false).__and(true));
  480. $2=_st($1)._deny_(_st(false).__and(false));
  481. $3=self;
  482. _st($3)._assert_(_st(true).__or(true));
  483. _st($3)._assert_(_st(true).__or(false));
  484. _st($3)._assert_(_st(false).__or(true));
  485. $4=_st($3)._deny_(_st(false).__or(false));
  486. $5=self;
  487. _st($5)._assert_(_st(true).__and(_st((1)).__gt((0))));
  488. _st($5)._deny_(_st(_st((1)).__gt((0))).__and(false));
  489. $6=_st($5)._deny_(_st(_st((1)).__gt((0))).__and(_st((1)).__gt((2))));
  490. $7=self;
  491. _st($7)._assert_(_st(false).__or(_st((1)).__gt((0))));
  492. _st($7)._assert_(_st(_st((1)).__gt((0))).__or(false));
  493. $8=_st($7)._assert_(_st(_st((1)).__gt((0))).__or(_st((1)).__gt((2))));
  494. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{}, smalltalk.BooleanTest)})},
  495. args: [],
  496. source: "testLogic\x0a \x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true); deny: (true & false); deny: (false & true); deny: (false & false).\x0a\x09self assert: (true | true); assert: (true | false); assert: (false | true); deny: (false | false).\x0a \x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0)); deny: ((1 > 0) & false); deny: ((1 > 0) & (1 > 2)).\x0a self assert: (false | (1 > 0)); assert: ((1 > 0) | false); assert: ((1 > 0) | (1 > 2))",
  497. messageSends: ["assert:", "&", "deny:", "|", ">"],
  498. referencedClasses: []
  499. }),
  500. smalltalk.BooleanTest);
  501. smalltalk.addMethod(
  502. "_testLogicKeywords",
  503. smalltalk.method({
  504. selector: "testLogicKeywords",
  505. category: 'tests',
  506. fn: function (){
  507. var self=this;
  508. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5,$6,$7,$8;
  509. $1=self;
  510. _st($1)._assert_(_st(true)._and_((function(){
  511. return smalltalk.withContext(function($ctx2) { return true;
  512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  513. _st($1)._deny_(_st(true)._and_((function(){
  514. return smalltalk.withContext(function($ctx2) { return false;
  515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  516. _st($1)._deny_(_st(false)._and_((function(){
  517. return smalltalk.withContext(function($ctx2) { return true;
  518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  519. $2=_st($1)._deny_(_st(false)._and_((function(){
  520. return smalltalk.withContext(function($ctx2) { return false;
  521. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  522. $3=self;
  523. _st($3)._assert_(_st(true)._or_((function(){
  524. return smalltalk.withContext(function($ctx2) { return true;
  525. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  526. _st($3)._assert_(_st(true)._or_((function(){
  527. return smalltalk.withContext(function($ctx2) { return false;
  528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  529. _st($3)._assert_(_st(false)._or_((function(){
  530. return smalltalk.withContext(function($ctx2) { return true;
  531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  532. $4=_st($3)._deny_(_st(false)._or_((function(){
  533. return smalltalk.withContext(function($ctx2) { return false;
  534. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  535. $5=self;
  536. _st($5)._assert_(_st(true)._and_((function(){
  537. return smalltalk.withContext(function($ctx2) { return _st((1)).__gt((0));
  538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  539. _st($5)._deny_(_st(_st((1)).__gt((0)))._and_((function(){
  540. return smalltalk.withContext(function($ctx2) { return false;
  541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  542. $6=_st($5)._deny_(_st(_st((1)).__gt((0)))._and_((function(){
  543. return smalltalk.withContext(function($ctx2) { return _st((1)).__gt((2));
  544. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  545. $7=self;
  546. _st($7)._assert_(_st(false)._or_((function(){
  547. return smalltalk.withContext(function($ctx2) { return _st((1)).__gt((0));
  548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  549. _st($7)._assert_(_st(_st((1)).__gt((0)))._or_((function(){
  550. return smalltalk.withContext(function($ctx2) { return false;
  551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  552. $8=_st($7)._assert_(_st(_st((1)).__gt((0)))._or_((function(){
  553. return smalltalk.withContext(function($ctx2) { return _st((1)).__gt((2));
  554. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  555. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{}, smalltalk.BooleanTest)})},
  556. args: [],
  557. source: "testLogicKeywords\x0a \x0a\x09\x22Trivial logic table\x22\x0a\x09self \x0a\x09\x09assert: (true and: [ true]); \x0a\x09\x09deny: (true and: [ false ]); \x0a\x09\x09deny: (false and: [ true ]); \x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self \x0a\x09\x09assert: (true or: [ true ]); \x0a\x09\x09assert: (true or: [ false ]); \x0a\x09\x09assert: (false or: [ true ]); \x0a\x09\x09deny: (false or: [ false ]).\x0a \x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self \x0a\x09\x09assert: (true and: [ 1 > 0 ]); \x0a\x09\x09deny: ((1 > 0) and: [ false ]); \x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a self \x0a\x09\x09assert: (false or: [ 1 > 0 ]); \x0a\x09\x09assert: ((1 > 0) or: [ false ]); \x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  558. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  559. referencedClasses: []
  560. }),
  561. smalltalk.BooleanTest);
  562. smalltalk.addMethod(
  563. "_testNonBooleanError",
  564. smalltalk.method({
  565. selector: "testNonBooleanError",
  566. category: 'tests',
  567. fn: function (){
  568. var self=this;
  569. return smalltalk.withContext(function($ctx1) { var $1,$2;
  570. $1=self;
  571. $2=(function(){
  572. return smalltalk.withContext(function($ctx2) { if(smalltalk.assert("")){
  573. } else {
  574. };
  575. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  576. _st($1)._should_raise_($2,(smalltalk.NonBooleanReceiver || NonBooleanReceiver));
  577. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{}, smalltalk.BooleanTest)})},
  578. args: [],
  579. source: "testNonBooleanError\x0a self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  580. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  581. referencedClasses: ["NonBooleanReceiver"]
  582. }),
  583. smalltalk.BooleanTest);
  584. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  585. smalltalk.addMethod(
  586. "_setUp",
  587. smalltalk.method({
  588. selector: "setUp",
  589. category: 'running',
  590. fn: function (){
  591. var self=this;
  592. return smalltalk.withContext(function($ctx1) { self["@builder"]=_st((smalltalk.ClassBuilder || ClassBuilder))._new();
  593. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{}, smalltalk.ClassBuilderTest)})},
  594. args: [],
  595. source: "setUp\x0a\x09builder := ClassBuilder new",
  596. messageSends: ["new"],
  597. referencedClasses: ["ClassBuilder"]
  598. }),
  599. smalltalk.ClassBuilderTest);
  600. smalltalk.addMethod(
  601. "_tearDown",
  602. smalltalk.method({
  603. selector: "tearDown",
  604. category: 'running',
  605. fn: function (){
  606. var self=this;
  607. return smalltalk.withContext(function($ctx1) { var $1;
  608. $1=self["@theClass"];
  609. if(($receiver = $1) == nil || $receiver == undefined){
  610. $1;
  611. } else {
  612. _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_(self["@theClass"]);
  613. self["@theClass"]=nil;
  614. self["@theClass"];
  615. };
  616. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{}, smalltalk.ClassBuilderTest)})},
  617. args: [],
  618. source: "tearDown\x0a\x09theClass ifNotNil: [Smalltalk current removeClass: theClass. theClass := nil]",
  619. messageSends: ["ifNotNil:", "removeClass:", "current"],
  620. referencedClasses: ["Smalltalk"]
  621. }),
  622. smalltalk.ClassBuilderTest);
  623. smalltalk.addMethod(
  624. "_testClassCopy",
  625. smalltalk.method({
  626. selector: "testClassCopy",
  627. category: 'running',
  628. fn: function (){
  629. var self=this;
  630. return smalltalk.withContext(function($ctx1) { self["@theClass"]=_st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  631. _st(self)._assert_(_st(_st(self["@theClass"])._superclass()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._superclass()));
  632. _st(self)._assert_(_st(_st(self["@theClass"])._instanceVariableNames()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._instanceVariableNames()));
  633. _st(self)._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  634. _st(self)._assert_(_st(_st(self["@theClass"])._package()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._package()));
  635. _st(self)._assert_equals_(_st(_st(self["@theClass"])._methodDictionary())._keys(),_st(_st((smalltalk.ObjectMock || ObjectMock))._methodDictionary())._keys());
  636. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{}, smalltalk.ClassBuilderTest)})},
  637. args: [],
  638. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  639. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  640. referencedClasses: ["ObjectMock"]
  641. }),
  642. smalltalk.ClassBuilderTest);
  643. smalltalk.addMethod(
  644. "_testClassMigration",
  645. smalltalk.method({
  646. selector: "testClassMigration",
  647. category: 'running',
  648. fn: function (){
  649. var self=this;
  650. var instance,oldClass;
  651. return smalltalk.withContext(function($ctx1) { oldClass=_st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  652. instance=_st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("ObjectMock2"))._new();
  653. _st((smalltalk.ObjectMock || ObjectMock))._subclass_instanceVariableNames_package_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("ObjectMock2"),"","Kernel-Tests");
  654. _st(self)._deny_(_st(oldClass).__eq_eq((smalltalk.ObjectMock2 || ObjectMock2)));
  655. _st(self)._assert_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._superclass()).__eq_eq((smalltalk.ObjectMock || ObjectMock)));
  656. _st(self)._assert_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._instanceVariableNames())._isEmpty());
  657. _st(self)._assert_equals_(_st((smalltalk.ObjectMock2 || ObjectMock2))._selectors(),_st(oldClass)._selectors());
  658. _st(self)._assert_equals_(_st((smalltalk.ObjectMock2 || ObjectMock2))._comment(),_st(oldClass)._comment());
  659. _st(self)._assert_equals_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._package())._name(),"Kernel-Tests");
  660. _st(self)._deny_(_st(_st(instance)._class()).__eq_eq((smalltalk.ObjectMock2 || ObjectMock2)));
  661. _st(self)._assert_equals_(_st(_st(instance)._class())._name(),"OldObjectMock2");
  662. _st(self)._assert_(_st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("OldObjectMock2"))._isNil());
  663. _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_((smalltalk.ObjectMock2 || ObjectMock2));
  664. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass}, smalltalk.ClassBuilderTest)})},
  665. args: [],
  666. source: "testClassMigration\x0a\x09| instance oldClass |\x0a \x0a oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a instance := (Smalltalk current at: 'ObjectMock2') new.\x0a \x0a \x22Change the superclass of ObjectMock2\x22\x0a ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a \x09instanceVariableNames: ''\x0a package: 'Kernel-Tests'.\x0a \x0a self deny: oldClass == ObjectMock2.\x0a \x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a self assert: ObjectMock2 comment equals: oldClass comment.\x0a self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a \x0a\x09self deny: instance class == ObjectMock2.\x0a self assert: instance class name equals: 'OldObjectMock2'.\x0a \x0a self assert: (Smalltalk current at: 'OldObjectMock2') isNil.\x0a \x0a Smalltalk current removeClass: ObjectMock2",
  667. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  668. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  669. }),
  670. smalltalk.ClassBuilderTest);
  671. smalltalk.addMethod(
  672. "_testClassMigrationWithClassInstanceVariables",
  673. smalltalk.method({
  674. selector: "testClassMigrationWithClassInstanceVariables",
  675. category: 'running',
  676. fn: function (){
  677. var self=this;
  678. return smalltalk.withContext(function($ctx1) { _st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  679. _st(_st((smalltalk.ObjectMock2 || ObjectMock2))._class())._instanceVariableNames_("foo bar");
  680. _st((smalltalk.ObjectMock || ObjectMock))._subclass_instanceVariableNames_package_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("ObjectMock2"),"","Kernel-Tests");
  681. _st(self)._assert_equals_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._class())._instanceVariableNames(),["foo", "bar"]);
  682. _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_((smalltalk.ObjectMock2 || ObjectMock2));
  683. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{}, smalltalk.ClassBuilderTest)})},
  684. args: [],
  685. source: "testClassMigrationWithClassInstanceVariables\x0a \x0a builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a \x0a \x22Change the superclass of ObjectMock2\x22\x0a ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a \x09instanceVariableNames: ''\x0a package: 'Kernel-Tests'.\x0a \x0a self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a \x0a Smalltalk current removeClass: ObjectMock2",
  686. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  687. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  688. }),
  689. smalltalk.ClassBuilderTest);
  690. smalltalk.addMethod(
  691. "_testClassMigrationWithSubclasses",
  692. smalltalk.method({
  693. selector: "testClassMigrationWithSubclasses",
  694. category: 'running',
  695. fn: function (){
  696. var self=this;
  697. return smalltalk.withContext(function($ctx1) { _st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  698. _st((smalltalk.ObjectMock2 || ObjectMock2))._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  699. _st((smalltalk.ObjectMock3 || ObjectMock3))._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  700. _st((smalltalk.ObjectMock || ObjectMock))._subclass_instanceVariableNames_package_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("ObjectMock2"),"","Kernel-Tests");
  701. _st(self)._assert_(_st(_st((smalltalk.ObjectMock || ObjectMock))._subclasses())._includes_((smalltalk.ObjectMock2 || ObjectMock2)));
  702. _st(self)._assert_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._subclasses())._includes_((smalltalk.ObjectMock3 || ObjectMock3)));
  703. _st(self)._assert_(_st(_st((smalltalk.ObjectMock3 || ObjectMock3))._subclasses())._includes_((smalltalk.ObjectMock4 || ObjectMock4)));
  704. _st(_st((smalltalk.ObjectMock || ObjectMock))._allSubclasses())._do_((function(each){
  705. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_(each);
  706. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  707. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{}, smalltalk.ClassBuilderTest)})},
  708. args: [],
  709. source: "testClassMigrationWithSubclasses\x0a \x0a builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a \x0a \x22Change the superclass of ObjectMock2\x22\x0a ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a \x09instanceVariableNames: ''\x0a package: 'Kernel-Tests'.\x0a \x0a self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a \x0a ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]",
  710. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "removeClass:", "allSubclasses"],
  711. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  712. }),
  713. smalltalk.ClassBuilderTest);
  714. smalltalk.addMethod(
  715. "_testInstanceVariableNames",
  716. smalltalk.method({
  717. selector: "testInstanceVariableNames",
  718. category: 'running',
  719. fn: function (){
  720. var self=this;
  721. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  722. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{}, smalltalk.ClassBuilderTest)})},
  723. args: [],
  724. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  725. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  726. referencedClasses: []
  727. }),
  728. smalltalk.ClassBuilderTest);
  729. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  730. smalltalk.addMethod(
  731. "_assertSameContents_as_",
  732. smalltalk.method({
  733. selector: "assertSameContents:as:",
  734. category: 'convenience',
  735. fn: function (aCollection,anotherCollection){
  736. var self=this;
  737. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(aCollection)._size()).__eq(_st(anotherCollection)._size()));
  738. _st(aCollection)._do_((function(each){
  739. return smalltalk.withContext(function($ctx2) { return _st(self)._assert_(_st(_st(aCollection)._occurrencesOf_(each)).__eq(_st(anotherCollection)._occurrencesOf_(each)));
  740. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  741. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection}, smalltalk.CollectionTest)})},
  742. args: ["aCollection", "anotherCollection"],
  743. source: "assertSameContents: aCollection \x09as: anotherCollection\x0a\x09self assert: aCollection size = anotherCollection size.\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: (aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each) ]",
  744. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  745. referencedClasses: []
  746. }),
  747. smalltalk.CollectionTest);
  748. smalltalk.addMethod(
  749. "_collection",
  750. smalltalk.method({
  751. selector: "collection",
  752. category: 'accessing',
  753. fn: function (){
  754. var self=this;
  755. return smalltalk.withContext(function($ctx1) { var $1;
  756. $1=_st(_st(self)._collectionClass())._withAll_(_st(self)._defaultValues());
  757. return $1;
  758. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.CollectionTest)})},
  759. args: [],
  760. source: "collection\x0a\x09^ self collectionClass withAll: self defaultValues",
  761. messageSends: ["withAll:", "defaultValues", "collectionClass"],
  762. referencedClasses: []
  763. }),
  764. smalltalk.CollectionTest);
  765. smalltalk.addMethod(
  766. "_collectionClass",
  767. smalltalk.method({
  768. selector: "collectionClass",
  769. category: 'accessing',
  770. fn: function (){
  771. var self=this;
  772. return smalltalk.withContext(function($ctx1) { var $1;
  773. $1=_st(_st(self)._class())._collectionClass();
  774. return $1;
  775. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.CollectionTest)})},
  776. args: [],
  777. source: "collectionClass\x0a\x09^ self class collectionClass",
  778. messageSends: ["collectionClass", "class"],
  779. referencedClasses: []
  780. }),
  781. smalltalk.CollectionTest);
  782. smalltalk.addMethod(
  783. "_collectionWithDuplicates",
  784. smalltalk.method({
  785. selector: "collectionWithDuplicates",
  786. category: 'accessing',
  787. fn: function (){
  788. var self=this;
  789. return smalltalk.withContext(function($ctx1) { var $1;
  790. $1=_st(_st(self)._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  791. return $1;
  792. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.CollectionTest)})},
  793. args: [],
  794. source: "collectionWithDuplicates\x0a\x09^ self collectionClass withAll: #('a' 'b' 'c' 1 2 1 'a')",
  795. messageSends: ["withAll:", "collectionClass"],
  796. referencedClasses: []
  797. }),
  798. smalltalk.CollectionTest);
  799. smalltalk.addMethod(
  800. "_defaultValues",
  801. smalltalk.method({
  802. selector: "defaultValues",
  803. category: 'accessing',
  804. fn: function (){
  805. var self=this;
  806. return smalltalk.withContext(function($ctx1) { return [(1), (2), (3), (-4)];
  807. }, function($ctx1) {$ctx1.fill(self,"defaultValues",{}, smalltalk.CollectionTest)})},
  808. args: [],
  809. source: "defaultValues\x0a\x09^ #(1 2 3 -4)",
  810. messageSends: [],
  811. referencedClasses: []
  812. }),
  813. smalltalk.CollectionTest);
  814. smalltalk.addMethod(
  815. "_isCollectionReadOnly",
  816. smalltalk.method({
  817. selector: "isCollectionReadOnly",
  818. category: 'testing',
  819. fn: function (){
  820. var self=this;
  821. return smalltalk.withContext(function($ctx1) { return false;
  822. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{}, smalltalk.CollectionTest)})},
  823. args: [],
  824. source: "isCollectionReadOnly\x0a\x09^ false",
  825. messageSends: [],
  826. referencedClasses: []
  827. }),
  828. smalltalk.CollectionTest);
  829. smalltalk.addMethod(
  830. "_testAsArray",
  831. smalltalk.method({
  832. selector: "testAsArray",
  833. category: 'tests',
  834. fn: function (){
  835. var self=this;
  836. return smalltalk.withContext(function($ctx1) { _st(self)._assertSameContents_as_(_st(self)._collection(),_st(_st(self)._collection())._asArray());
  837. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{}, smalltalk.CollectionTest)})},
  838. args: [],
  839. source: "testAsArray\x0a\x09self \x0a\x09\x09assertSameContents: self collection \x0a\x09\x09as: self collection asArray",
  840. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  841. referencedClasses: []
  842. }),
  843. smalltalk.CollectionTest);
  844. smalltalk.addMethod(
  845. "_testAsOrderedCollection",
  846. smalltalk.method({
  847. selector: "testAsOrderedCollection",
  848. category: 'tests',
  849. fn: function (){
  850. var self=this;
  851. return smalltalk.withContext(function($ctx1) { _st(self)._assertSameContents_as_(_st(self)._collection(),_st(_st(self)._collection())._asOrderedCollection());
  852. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{}, smalltalk.CollectionTest)})},
  853. args: [],
  854. source: "testAsOrderedCollection\x0a\x09self \x0a\x09\x09assertSameContents: self collection \x0a\x09\x09as: self collection asOrderedCollection",
  855. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  856. referencedClasses: []
  857. }),
  858. smalltalk.CollectionTest);
  859. smalltalk.addMethod(
  860. "_testAsSet",
  861. smalltalk.method({
  862. selector: "testAsSet",
  863. category: 'tests',
  864. fn: function (){
  865. var self=this;
  866. var c,set;
  867. return smalltalk.withContext(function($ctx1) { c=_st(self)._collectionWithDuplicates();
  868. set=_st(c)._asSet();
  869. _st(self)._assert_(_st(_st(set)._size()).__eq((5)));
  870. _st(c)._do_((function(each){
  871. return smalltalk.withContext(function($ctx2) { return _st(self)._assert_(_st(set)._includes_(each));
  872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  873. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set}, smalltalk.CollectionTest)})},
  874. args: [],
  875. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size = 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  876. messageSends: ["collectionWithDuplicates", "asSet", "assert:", "=", "size", "do:", "includes:"],
  877. referencedClasses: []
  878. }),
  879. smalltalk.CollectionTest);
  880. smalltalk.addMethod(
  881. "_testCollect",
  882. smalltalk.method({
  883. selector: "testCollect",
  884. category: 'tests',
  885. fn: function (){
  886. var self=this;
  887. var newCollection;
  888. return smalltalk.withContext(function($ctx1) { newCollection=[(1), (2), (3), (4)];
  889. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  890. return smalltalk.withContext(function($ctx2) { return _st(each)._abs();
  891. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  892. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection}, smalltalk.CollectionTest)})},
  893. args: [],
  894. source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := #(1 2 3 4).\x0a\x09self \x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each abs ])\x0a\x09\x09as: newCollection",
  895. messageSends: ["assertSameContents:as:", "collect:", "abs", "collection"],
  896. referencedClasses: []
  897. }),
  898. smalltalk.CollectionTest);
  899. smalltalk.addMethod(
  900. "_testDetect",
  901. smalltalk.method({
  902. selector: "testDetect",
  903. category: 'tests',
  904. fn: function (){
  905. var self=this;
  906. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._detect_((function(each){
  907. return smalltalk.withContext(function($ctx2) { return _st(each).__lt((0));
  908. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__eq((-4)));
  909. _st(self)._should_raise_((function(){
  910. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._detect_((function(each){
  911. return smalltalk.withContext(function($ctx3) { return _st(each).__eq((6));
  912. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  914. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{}, smalltalk.CollectionTest)})},
  915. args: [],
  916. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each < 0 ]) = -4.\x0a\x09self \x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
  917. messageSends: ["assert:", "=", "detect:", "<", "collection", "should:raise:"],
  918. referencedClasses: ["Error"]
  919. }),
  920. smalltalk.CollectionTest);
  921. smalltalk.addMethod(
  922. "_testDo",
  923. smalltalk.method({
  924. selector: "testDo",
  925. category: 'tests',
  926. fn: function (){
  927. var self=this;
  928. var newCollection;
  929. return smalltalk.withContext(function($ctx1) { newCollection=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  930. _st(_st(self)._collection())._do_((function(each){
  931. return smalltalk.withContext(function($ctx2) { return _st(newCollection)._add_(each);
  932. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  933. _st(self)._assertSameContents_as_(_st(self)._collection(),newCollection);
  934. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection}, smalltalk.CollectionTest)})},
  935. args: [],
  936. source: "testDo\x0a\x09| newCollection |\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collection do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self \x0a\x09\x09assertSameContents: self collection \x0a\x09\x09as: newCollection",
  937. messageSends: ["new", "do:", "add:", "collection", "assertSameContents:as:"],
  938. referencedClasses: ["OrderedCollection"]
  939. }),
  940. smalltalk.CollectionTest);
  941. smalltalk.addMethod(
  942. "_testIsEmpty",
  943. smalltalk.method({
  944. selector: "testIsEmpty",
  945. category: 'tests',
  946. fn: function (){
  947. var self=this;
  948. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collectionClass())._new())._isEmpty());
  949. _st(self)._deny_(_st(_st(self)._collection())._isEmpty());
  950. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{}, smalltalk.CollectionTest)})},
  951. args: [],
  952. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  953. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  954. referencedClasses: []
  955. }),
  956. smalltalk.CollectionTest);
  957. smalltalk.addMethod(
  958. "_testSelect",
  959. smalltalk.method({
  960. selector: "testSelect",
  961. category: 'tests',
  962. fn: function (){
  963. var self=this;
  964. var newCollection;
  965. return smalltalk.withContext(function($ctx1) { newCollection=[(2), (-4)];
  966. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  967. return smalltalk.withContext(function($ctx2) { return _st(each)._even();
  968. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  969. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection}, smalltalk.CollectionTest)})},
  970. args: [],
  971. source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := #(2 -4).\x0a\x09self \x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each even ])\x0a\x09\x09as: newCollection",
  972. messageSends: ["assertSameContents:as:", "select:", "even", "collection"],
  973. referencedClasses: []
  974. }),
  975. smalltalk.CollectionTest);
  976. smalltalk.addMethod(
  977. "_testSize",
  978. smalltalk.method({
  979. selector: "testSize",
  980. category: 'tests',
  981. fn: function (){
  982. var self=this;
  983. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(_st(self)._collectionClass())._new())._size()).__eq((0)));
  984. _st(self)._assert_(_st(_st(_st(self)._collection())._size()).__eq((4)));
  985. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{}, smalltalk.CollectionTest)})},
  986. args: [],
  987. source: "testSize\x0a\x09self assert: self collectionClass new size = 0.\x0a\x09self assert: self collection size = 4",
  988. messageSends: ["assert:", "=", "size", "new", "collectionClass", "collection"],
  989. referencedClasses: []
  990. }),
  991. smalltalk.CollectionTest);
  992. smalltalk.addMethod(
  993. "_collectionClass",
  994. smalltalk.method({
  995. selector: "collectionClass",
  996. category: 'accessing',
  997. fn: function (){
  998. var self=this;
  999. return smalltalk.withContext(function($ctx1) { return nil;
  1000. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.CollectionTest.klass)})},
  1001. args: [],
  1002. source: "collectionClass\x0a\x09^ nil",
  1003. messageSends: [],
  1004. referencedClasses: []
  1005. }),
  1006. smalltalk.CollectionTest.klass);
  1007. smalltalk.addMethod(
  1008. "_isAbstract",
  1009. smalltalk.method({
  1010. selector: "isAbstract",
  1011. category: 'testing',
  1012. fn: function (){
  1013. var self=this;
  1014. return smalltalk.withContext(function($ctx1) { var $1;
  1015. $1=_st(_st(self)._collectionClass())._isNil();
  1016. return $1;
  1017. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{}, smalltalk.CollectionTest.klass)})},
  1018. args: [],
  1019. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1020. messageSends: ["isNil", "collectionClass"],
  1021. referencedClasses: []
  1022. }),
  1023. smalltalk.CollectionTest.klass);
  1024. smalltalk.addClass('HashedCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1025. smalltalk.addMethod(
  1026. "_collection",
  1027. smalltalk.method({
  1028. selector: "collection",
  1029. category: 'accessing',
  1030. fn: function (){
  1031. var self=this;
  1032. return smalltalk.withContext(function($ctx1) { var $1;
  1033. $1=smalltalk.HashedCollection._fromPairs_([_st("a").__minus_gt((1)),_st("b").__minus_gt((2)),_st("c").__minus_gt((3)),_st("d").__minus_gt((-4))]);
  1034. return $1;
  1035. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.HashedCollectionTest)})},
  1036. args: [],
  1037. source: "collection\x0a\x09^ #{ 'a' -> 1. 'b' -> 2. 'c' -> 3. 'd' -> -4 }",
  1038. messageSends: ["->"],
  1039. referencedClasses: []
  1040. }),
  1041. smalltalk.HashedCollectionTest);
  1042. smalltalk.addMethod(
  1043. "_collectionWithDuplicates",
  1044. smalltalk.method({
  1045. selector: "collectionWithDuplicates",
  1046. category: 'accessing',
  1047. fn: function (){
  1048. var self=this;
  1049. return smalltalk.withContext(function($ctx1) { var $1;
  1050. $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))]);
  1051. return $1;
  1052. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.HashedCollectionTest)})},
  1053. args: [],
  1054. source: "collectionWithDuplicates\x0a\x09^ #{ 'a' -> 1. 'b' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  1055. messageSends: ["->"],
  1056. referencedClasses: []
  1057. }),
  1058. smalltalk.HashedCollectionTest);
  1059. smalltalk.addMethod(
  1060. "_collectionClass",
  1061. smalltalk.method({
  1062. selector: "collectionClass",
  1063. category: 'accessing',
  1064. fn: function (){
  1065. var self=this;
  1066. return smalltalk.withContext(function($ctx1) { var $1;
  1067. $1=(smalltalk.HashedCollection || HashedCollection);
  1068. return $1;
  1069. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.HashedCollectionTest.klass)})},
  1070. args: [],
  1071. source: "collectionClass\x0a\x09^ HashedCollection",
  1072. messageSends: [],
  1073. referencedClasses: ["HashedCollection"]
  1074. }),
  1075. smalltalk.HashedCollectionTest.klass);
  1076. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  1077. smalltalk.addMethod(
  1078. "_collection",
  1079. smalltalk.method({
  1080. selector: "collection",
  1081. category: 'accessing',
  1082. fn: function (){
  1083. var self=this;
  1084. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1085. $2=_st((smalltalk.Dictionary || Dictionary))._new();
  1086. _st($2)._at_put_((1),(1));
  1087. _st($2)._at_put_("a",(2));
  1088. _st($2)._at_put_(true,(3));
  1089. _st($2)._at_put_((4),(-4));
  1090. $3=_st($2)._yourself();
  1091. $1=$3;
  1092. return $1;
  1093. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.DictionaryTest)})},
  1094. args: [],
  1095. source: "collection\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09yourself",
  1096. messageSends: ["at:put:", "new", "yourself"],
  1097. referencedClasses: ["Dictionary"]
  1098. }),
  1099. smalltalk.DictionaryTest);
  1100. smalltalk.addMethod(
  1101. "_collectionWithDuplicates",
  1102. smalltalk.method({
  1103. selector: "collectionWithDuplicates",
  1104. category: 'accessing',
  1105. fn: function (){
  1106. var self=this;
  1107. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1108. $2=_st((smalltalk.Dictionary || Dictionary))._new();
  1109. _st($2)._at_put_((1),(1));
  1110. _st($2)._at_put_("a",(2));
  1111. _st($2)._at_put_(true,(3));
  1112. _st($2)._at_put_((4),(-4));
  1113. _st($2)._at_put_("b",(1));
  1114. _st($2)._at_put_((3),(3));
  1115. _st($2)._at_put_(false,(12));
  1116. $3=_st($2)._yourself();
  1117. $1=$3;
  1118. return $1;
  1119. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.DictionaryTest)})},
  1120. args: [],
  1121. source: "collectionWithDuplicates\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09at: 'b' put: 1;\x0a\x09\x09at: 3 put: 3;\x0a\x09\x09at: false put: 12;\x0a\x09\x09yourself",
  1122. messageSends: ["at:put:", "new", "yourself"],
  1123. referencedClasses: ["Dictionary"]
  1124. }),
  1125. smalltalk.DictionaryTest);
  1126. smalltalk.addMethod(
  1127. "_testAccessing",
  1128. smalltalk.method({
  1129. selector: "testAccessing",
  1130. category: 'tests',
  1131. fn: function (){
  1132. var self=this;
  1133. var d;
  1134. return smalltalk.withContext(function($ctx1) { d=_st((smalltalk.Dictionary || Dictionary))._new();
  1135. _st(d)._at_put_("hello","world");
  1136. _st(self)._assert_(_st(_st(d)._at_("hello")).__eq("world"));
  1137. _st(self)._assert_(_st(_st(d)._at_ifAbsent_("hello",(function(){
  1138. return smalltalk.withContext(function($ctx2) { return nil;
  1139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq("world"));
  1140. _st(self)._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  1141. return smalltalk.withContext(function($ctx2) { return nil;
  1142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq("world"));
  1143. _st(d)._at_put_((1),(2));
  1144. _st(self)._assert_(_st(_st(d)._at_((1))).__eq((2)));
  1145. _st(d)._at_put_(_st((1)).__at((3)),(3));
  1146. _st(self)._assert_(_st(_st(d)._at_(_st((1)).__at((3)))).__eq((3)));
  1147. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d}, smalltalk.DictionaryTest)})},
  1148. args: [],
  1149. source: "testAccessing\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' put: 'world'.\x0a\x09self assert: (d at: 'hello') = 'world'.\x0a\x09self assert: (d at: 'hello' ifAbsent: [nil]) = 'world'.\x0a\x09self deny: (d at: 'foo' ifAbsent: [nil]) = 'world'.\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: (d at: 1) = 2.\x0a\x0a\x09d at: 1@3 put: 3.\x0a\x09self assert: (d at: 1@3) = 3",
  1150. messageSends: ["new", "at:put:", "assert:", "=", "at:", "at:ifAbsent:", "deny:", "@"],
  1151. referencedClasses: ["Dictionary"]
  1152. }),
  1153. smalltalk.DictionaryTest);
  1154. smalltalk.addMethod(
  1155. "_testDynamicDictionaries",
  1156. smalltalk.method({
  1157. selector: "testDynamicDictionaries",
  1158. category: 'tests',
  1159. fn: function (){
  1160. var self=this;
  1161. 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)))));
  1162. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{}, smalltalk.DictionaryTest)})},
  1163. args: [],
  1164. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary = (Dictionary with: 'hello' -> 1)",
  1165. messageSends: ["assert:", "=", "with:", "->", "asDictionary"],
  1166. referencedClasses: ["Dictionary"]
  1167. }),
  1168. smalltalk.DictionaryTest);
  1169. smalltalk.addMethod(
  1170. "_testEquality",
  1171. smalltalk.method({
  1172. selector: "testEquality",
  1173. category: 'tests',
  1174. fn: function (){
  1175. var self=this;
  1176. var d1,d2;
  1177. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  1178. _st(self)._assert_(_st(_st((smalltalk.Dictionary || Dictionary))._new()).__eq(_st((smalltalk.Dictionary || Dictionary))._new()));
  1179. $1=_st((smalltalk.Dictionary || Dictionary))._new();
  1180. _st($1)._at_put_((1),(2));
  1181. $2=_st($1)._yourself();
  1182. d1=$2;
  1183. $3=_st((smalltalk.Dictionary || Dictionary))._new();
  1184. _st($3)._at_put_((1),(2));
  1185. $4=_st($3)._yourself();
  1186. d2=$4;
  1187. _st(self)._assert_(_st(d1).__eq(d2));
  1188. $5=_st((smalltalk.Dictionary || Dictionary))._new();
  1189. _st($5)._at_put_((1),(3));
  1190. $6=_st($5)._yourself();
  1191. d2=$6;
  1192. _st(self)._deny_(_st(d1).__eq(d2));
  1193. $7=_st((smalltalk.Dictionary || Dictionary))._new();
  1194. _st($7)._at_put_((2),(2));
  1195. $8=_st($7)._yourself();
  1196. d2=$8;
  1197. _st(self)._deny_(_st(d1).__eq(d2));
  1198. $9=_st((smalltalk.Dictionary || Dictionary))._new();
  1199. _st($9)._at_put_((1),(2));
  1200. _st($9)._at_put_((3),(4));
  1201. $10=_st($9)._yourself();
  1202. d2=$10;
  1203. _st(self)._deny_(_st(d1).__eq(d2));
  1204. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2}, smalltalk.DictionaryTest)})},
  1205. args: [],
  1206. source: "testEquality\x0a\x09| d1 d2 |\x0a\x0a\x09self assert: Dictionary new = Dictionary new.\x0a\x09\x09\x0a\x09d1 := Dictionary new at: 1 put: 2; yourself.\x0a\x09d2 := Dictionary new at: 1 put: 2; yourself.\x0a\x09self assert: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 1 put: 3; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 2 put: 2; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 1 put: 2; at: 3 put: 4; yourself.\x0a\x09self deny: d1 = d2.",
  1207. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  1208. referencedClasses: ["Dictionary"]
  1209. }),
  1210. smalltalk.DictionaryTest);
  1211. smalltalk.addMethod(
  1212. "_testIfAbsent",
  1213. smalltalk.method({
  1214. selector: "testIfAbsent",
  1215. category: 'tests',
  1216. fn: function (){
  1217. var self=this;
  1218. var d,visited;
  1219. return smalltalk.withContext(function($ctx1) { visited=false;
  1220. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1221. _st(d)._at_ifAbsent_("hello",(function(){
  1222. return smalltalk.withContext(function($ctx2) { visited=true;
  1223. return visited;
  1224. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1225. _st(self)._assert_(visited);
  1226. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited}, smalltalk.DictionaryTest)})},
  1227. args: [],
  1228. source: "testIfAbsent\x0a\x0a\x09| d visited |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' ifAbsent: [ visited := true ].\x0a\x09self assert: visited.",
  1229. messageSends: ["new", "at:ifAbsent:", "assert:"],
  1230. referencedClasses: ["Dictionary"]
  1231. }),
  1232. smalltalk.DictionaryTest);
  1233. smalltalk.addMethod(
  1234. "_testIfPresent",
  1235. smalltalk.method({
  1236. selector: "testIfPresent",
  1237. category: 'tests',
  1238. fn: function (){
  1239. var self=this;
  1240. var d,visited,absent;
  1241. return smalltalk.withContext(function($ctx1) { visited=false;
  1242. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1243. _st(d)._at_put_("hello","world");
  1244. _st(d)._at_ifPresent_("hello",(function(value){
  1245. return smalltalk.withContext(function($ctx2) { visited=value;
  1246. return visited;
  1247. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1248. _st(self)._assert_(_st(visited).__eq("world"));
  1249. absent=_st(d)._at_ifPresent_("bye",(function(value){
  1250. return smalltalk.withContext(function($ctx2) { visited=value;
  1251. return visited;
  1252. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1253. _st(self)._assert_(_st(absent)._isNil());
  1254. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent}, smalltalk.DictionaryTest)})},
  1255. args: [],
  1256. source: "testIfPresent\x0a\x0a\x09| d visited absent |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x09d at: 'hello' put: 'world'.\x0a\x0a\x09d at: 'hello' ifPresent: [ :value | visited := value ].\x0a\x09self assert: visited = 'world'.\x0a\x0a\x09absent := d at: 'bye' ifPresent: [ :value | visited := value ].\x0a\x09self assert: absent isNil.",
  1257. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:", "=", "isNil"],
  1258. referencedClasses: ["Dictionary"]
  1259. }),
  1260. smalltalk.DictionaryTest);
  1261. smalltalk.addMethod(
  1262. "_testIfPresentIfAbsent",
  1263. smalltalk.method({
  1264. selector: "testIfPresentIfAbsent",
  1265. category: 'tests',
  1266. fn: function (){
  1267. var self=this;
  1268. var d,visited;
  1269. return smalltalk.withContext(function($ctx1) { visited=false;
  1270. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1271. _st(d)._at_put_("hello","world");
  1272. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  1273. return smalltalk.withContext(function($ctx2) { visited=value;
  1274. return visited;
  1275. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1276. return smalltalk.withContext(function($ctx2) { visited=true;
  1277. return visited;
  1278. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1279. _st(self)._assert_(_st(visited).__eq("world"));
  1280. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  1281. return smalltalk.withContext(function($ctx2) { visited=value;
  1282. return visited;
  1283. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1284. return smalltalk.withContext(function($ctx2) { visited=true;
  1285. return visited;
  1286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1287. _st(self)._assert_(visited);
  1288. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited}, smalltalk.DictionaryTest)})},
  1289. args: [],
  1290. source: "testIfPresentIfAbsent\x0a\x0a\x09| d visited |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x09d at: 'hello' put: 'world'.\x0a\x0a\x09d at: 'hello' ifPresent: [ :value | visited := value ] ifAbsent: [ visited := true ].\x0a\x09self assert: visited = 'world'.\x0a\x0a\x09d at: 'buy' ifPresent: [ :value | visited := value ] ifAbsent: [ visited := true ].\x0a\x09self assert: visited.",
  1291. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:", "="],
  1292. referencedClasses: ["Dictionary"]
  1293. }),
  1294. smalltalk.DictionaryTest);
  1295. smalltalk.addMethod(
  1296. "_testKeys",
  1297. smalltalk.method({
  1298. selector: "testKeys",
  1299. category: 'tests',
  1300. fn: function (){
  1301. var self=this;
  1302. var d;
  1303. return smalltalk.withContext(function($ctx1) { d=_st((smalltalk.Dictionary || Dictionary))._new();
  1304. _st(d)._at_put_((1),(2));
  1305. _st(d)._at_put_((2),(3));
  1306. _st(d)._at_put_((3),(4));
  1307. _st(self)._assert_(_st(_st(d)._keys()).__eq([(1), (2), (3)]));
  1308. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d}, smalltalk.DictionaryTest)})},
  1309. args: [],
  1310. source: "testKeys\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d keys = #(1 2 3)",
  1311. messageSends: ["new", "at:put:", "assert:", "=", "keys"],
  1312. referencedClasses: ["Dictionary"]
  1313. }),
  1314. smalltalk.DictionaryTest);
  1315. smalltalk.addMethod(
  1316. "_testPrintString",
  1317. smalltalk.method({
  1318. selector: "testPrintString",
  1319. category: 'tests',
  1320. fn: function (){
  1321. var self=this;
  1322. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1323. $1=_st((smalltalk.Dictionary || Dictionary))._new();
  1324. _st($1)._at_put_("firstname","James");
  1325. _st($1)._at_put_("lastname","Bond");
  1326. $2=_st($1)._printString();
  1327. _st(self)._assert_equals_("a Dictionary('firstname'->'James' , 'lastname'->'Bond')",$2);
  1328. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{}, smalltalk.DictionaryTest)})},
  1329. args: [],
  1330. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: 'a Dictionary(''firstname''->''James'' , ''lastname''->''Bond'')' \x0a\x09\x09equals: (Dictionary new \x0a \x09at:'firstname' put: 'James';\x0a \x09at:'lastname' put: 'Bond';\x0a \x09printString)",
  1331. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  1332. referencedClasses: ["Dictionary"]
  1333. }),
  1334. smalltalk.DictionaryTest);
  1335. smalltalk.addMethod(
  1336. "_testRemoveKey",
  1337. smalltalk.method({
  1338. selector: "testRemoveKey",
  1339. category: 'tests',
  1340. fn: function (){
  1341. var self=this;
  1342. var d,key;
  1343. return smalltalk.withContext(function($ctx1) { d=_st((smalltalk.Dictionary || Dictionary))._new();
  1344. _st(d)._at_put_((1),(2));
  1345. _st(d)._at_put_((2),(3));
  1346. _st(d)._at_put_((3),(4));
  1347. key=(2);
  1348. _st(self)._assert_(_st(_st(d)._keys()).__eq([(1), (2), (3)]));
  1349. _st(d)._removeKey_(key);
  1350. _st(self)._assert_(_st(_st(d)._keys()).__eq([(1), (3)]));
  1351. _st(self)._assert_(_st(_st(d)._values()).__eq([(2), (4)]));
  1352. _st(self)._deny_(_st(d)._includesKey_((2)));
  1353. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key}, smalltalk.DictionaryTest)})},
  1354. args: [],
  1355. source: "testRemoveKey\x0a | d key |\x0a\x0a d := Dictionary new.\x0a d at: 1 put: 2.\x0a d at: 2 put: 3.\x0a d at: 3 put: 4.\x0a\x0a key := 2.\x0a\x0a self assert: d keys = #(1 2 3).\x0a\x0a d removeKey: key.\x0a self assert: d keys = #(1 3).\x0a self assert: d values = #(2 4).\x0a self deny: (d includesKey: 2)",
  1356. messageSends: ["new", "at:put:", "assert:", "=", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  1357. referencedClasses: ["Dictionary"]
  1358. }),
  1359. smalltalk.DictionaryTest);
  1360. smalltalk.addMethod(
  1361. "_testRemoveKeyIfAbsent",
  1362. smalltalk.method({
  1363. selector: "testRemoveKeyIfAbsent",
  1364. category: 'tests',
  1365. fn: function (){
  1366. var self=this;
  1367. var d,key;
  1368. return smalltalk.withContext(function($ctx1) { d=_st((smalltalk.Dictionary || Dictionary))._new();
  1369. _st(d)._at_put_((1),(2));
  1370. _st(d)._at_put_((2),(3));
  1371. _st(d)._at_put_((3),(4));
  1372. key=(2);
  1373. _st(self)._assert_(_st(_st(d)._removeKey_(key)).__eq((3)));
  1374. key=(3);
  1375. _st(self)._assert_(_st(_st(d)._removeKey_ifAbsent_(key,(function(){
  1376. return smalltalk.withContext(function($ctx2) { return (42);
  1377. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq((4)));
  1378. key="why";
  1379. _st(self)._assert_(_st(_st(d)._removeKey_ifAbsent_(key,(function(){
  1380. return smalltalk.withContext(function($ctx2) { return (42);
  1381. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq((42)));
  1382. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key}, smalltalk.DictionaryTest)})},
  1383. args: [],
  1384. source: "testRemoveKeyIfAbsent\x0a | d key |\x0a\x0a d := Dictionary new.\x0a d at: 1 put: 2.\x0a d at: 2 put: 3.\x0a d at: 3 put: 4.\x0a\x0a key := 2.\x0a self assert: (d removeKey: key) = 3.\x0a\x0a key := 3.\x0a self assert: (d removeKey: key ifAbsent: [42]) = 4.\x0a\x0a key := 'why'.\x0a self assert: (d removeKey: key ifAbsent: [42] ) = 42.",
  1385. messageSends: ["new", "at:put:", "assert:", "=", "removeKey:", "removeKey:ifAbsent:"],
  1386. referencedClasses: ["Dictionary"]
  1387. }),
  1388. smalltalk.DictionaryTest);
  1389. smalltalk.addMethod(
  1390. "_testSize",
  1391. smalltalk.method({
  1392. selector: "testSize",
  1393. category: 'tests',
  1394. fn: function (){
  1395. var self=this;
  1396. var d;
  1397. return smalltalk.withContext(function($ctx1) { d=_st((smalltalk.Dictionary || Dictionary))._new();
  1398. _st(self)._assert_(_st(_st(d)._size()).__eq((0)));
  1399. _st(d)._at_put_((1),(2));
  1400. _st(self)._assert_(_st(_st(d)._size()).__eq((1)));
  1401. _st(d)._at_put_((2),(3));
  1402. _st(self)._assert_(_st(_st(d)._size()).__eq((2)));
  1403. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d}, smalltalk.DictionaryTest)})},
  1404. args: [],
  1405. source: "testSize\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09self assert: d size = 0.\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: d size = 1.\x0a\x0a\x09d at: 2 put: 3.\x0a\x09self assert: d size = 2.",
  1406. messageSends: ["new", "assert:", "=", "size", "at:put:"],
  1407. referencedClasses: ["Dictionary"]
  1408. }),
  1409. smalltalk.DictionaryTest);
  1410. smalltalk.addMethod(
  1411. "_testValues",
  1412. smalltalk.method({
  1413. selector: "testValues",
  1414. category: 'tests',
  1415. fn: function (){
  1416. var self=this;
  1417. var d;
  1418. return smalltalk.withContext(function($ctx1) { d=_st((smalltalk.Dictionary || Dictionary))._new();
  1419. _st(d)._at_put_((1),(2));
  1420. _st(d)._at_put_((2),(3));
  1421. _st(d)._at_put_((3),(4));
  1422. _st(self)._assert_(_st(_st(d)._values()).__eq([(2), (3), (4)]));
  1423. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d}, smalltalk.DictionaryTest)})},
  1424. args: [],
  1425. source: "testValues\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d values = #(2 3 4)",
  1426. messageSends: ["new", "at:put:", "assert:", "=", "values"],
  1427. referencedClasses: ["Dictionary"]
  1428. }),
  1429. smalltalk.DictionaryTest);
  1430. smalltalk.addMethod(
  1431. "_collectionClass",
  1432. smalltalk.method({
  1433. selector: "collectionClass",
  1434. category: 'accessing',
  1435. fn: function (){
  1436. var self=this;
  1437. return smalltalk.withContext(function($ctx1) { var $1;
  1438. $1=(smalltalk.Dictionary || Dictionary);
  1439. return $1;
  1440. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.DictionaryTest.klass)})},
  1441. args: [],
  1442. source: "collectionClass\x0a\x09^ Dictionary",
  1443. messageSends: [],
  1444. referencedClasses: ["Dictionary"]
  1445. }),
  1446. smalltalk.DictionaryTest.klass);
  1447. smalltalk.addClass('SequenceableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1448. smalltalk.addMethod(
  1449. "_testAt",
  1450. smalltalk.method({
  1451. selector: "testAt",
  1452. category: 'tests',
  1453. fn: function (){
  1454. var self=this;
  1455. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._at_((4))).__eq((-4)));
  1456. _st(self)._should_raise_((function(){
  1457. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._at_((5));
  1458. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1459. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.SequenceableCollectionTest)})},
  1460. args: [],
  1461. source: "testAt\x0a\x09self assert: (self collection at: 4) = -4.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1462. messageSends: ["assert:", "=", "at:", "collection", "should:raise:"],
  1463. referencedClasses: ["Error"]
  1464. }),
  1465. smalltalk.SequenceableCollectionTest);
  1466. smalltalk.addMethod(
  1467. "_testAtIfAbsent",
  1468. smalltalk.method({
  1469. selector: "testAtIfAbsent",
  1470. category: 'tests',
  1471. fn: function (){
  1472. var self=this;
  1473. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._at_ifAbsent_(_st(_st(_st(self)._collection())._size()).__plus((1)),(function(){
  1474. return smalltalk.withContext(function($ctx2) { return "none";
  1475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq("none"));
  1476. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{}, smalltalk.SequenceableCollectionTest)})},
  1477. args: [],
  1478. source: "testAtIfAbsent\x0a\x09self assert: (self collection at: (self collection size + 1) ifAbsent: [ 'none' ]) = 'none'",
  1479. messageSends: ["assert:", "=", "at:ifAbsent:", "+", "size", "collection"],
  1480. referencedClasses: []
  1481. }),
  1482. smalltalk.SequenceableCollectionTest);
  1483. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1484. smalltalk.addMethod(
  1485. "_testAtIfAbsent",
  1486. smalltalk.method({
  1487. selector: "testAtIfAbsent",
  1488. category: 'testing',
  1489. fn: function (){
  1490. var self=this;
  1491. var array;
  1492. return smalltalk.withContext(function($ctx1) { array=["hello", "world"];
  1493. _st(self)._assert_equals_(_st(array)._at_((1)),"hello");
  1494. _st(self)._assert_equals_(_st(array)._at_((2)),"world");
  1495. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((2),(function(){
  1496. return smalltalk.withContext(function($ctx2) { return "not found";
  1497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"world");
  1498. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((0),(function(){
  1499. return smalltalk.withContext(function($ctx2) { return "not found";
  1500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1501. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((-10),(function(){
  1502. return smalltalk.withContext(function($ctx2) { return "not found";
  1503. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1504. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((3),(function(){
  1505. return smalltalk.withContext(function($ctx2) { return "not found";
  1506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1507. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array}, smalltalk.ArrayTest)})},
  1508. args: [],
  1509. source: "testAtIfAbsent\x0a\x09| array |\x0a\x09array := #('hello' 'world').\x0a\x09self assert: (array at: 1) equals: 'hello'.\x0a\x09self assert: (array at: 2) equals: 'world'.\x0a\x09self assert: (array at: 2 ifAbsent: ['not found']) equals: 'world'.\x0a\x09self assert: (array at: 0 ifAbsent: ['not found']) equals: 'not found'.\x0a\x09self assert: (array at: -10 ifAbsent: ['not found']) equals: 'not found'.\x0a\x09self assert: (array at: 3 ifAbsent: ['not found']) equals: 'not found'.",
  1510. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  1511. referencedClasses: []
  1512. }),
  1513. smalltalk.ArrayTest);
  1514. smalltalk.addMethod(
  1515. "_testFirstN",
  1516. smalltalk.method({
  1517. selector: "testFirstN",
  1518. category: 'testing',
  1519. fn: function (){
  1520. var self=this;
  1521. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_([(1),(2),(3)],_st([(1),(2),(3),(4),(5)])._first_((3)));
  1522. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{}, smalltalk.ArrayTest)})},
  1523. args: [],
  1524. source: "testFirstN\x0a\x09self assert: {1. 2. 3} equals: ({1. 2. 3. 4. 5} first: 3).",
  1525. messageSends: ["assert:equals:", "first:"],
  1526. referencedClasses: []
  1527. }),
  1528. smalltalk.ArrayTest);
  1529. smalltalk.addMethod(
  1530. "_testIfEmpty",
  1531. smalltalk.method({
  1532. selector: "testIfEmpty",
  1533. category: 'testing',
  1534. fn: function (){
  1535. var self=this;
  1536. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("zork",_st("")._ifEmpty_((function(){
  1537. return smalltalk.withContext(function($ctx2) { return "zork";
  1538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  1539. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{}, smalltalk.ArrayTest)})},
  1540. args: [],
  1541. source: "testIfEmpty\x0a\x09self assert: 'zork' equals: ( '' ifEmpty: ['zork'] )",
  1542. messageSends: ["assert:equals:", "ifEmpty:"],
  1543. referencedClasses: []
  1544. }),
  1545. smalltalk.ArrayTest);
  1546. smalltalk.addMethod(
  1547. "_testPrintString",
  1548. smalltalk.method({
  1549. selector: "testPrintString",
  1550. category: 'testing',
  1551. fn: function (){
  1552. var self=this;
  1553. var array;
  1554. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  1555. array=_st((smalltalk.Array || Array))._new();
  1556. _st(self)._assert_equals_("a Array ()",_st(array)._printString());
  1557. $1=array;
  1558. _st($1)._add_((1));
  1559. $2=_st($1)._add_((3));
  1560. _st(self)._assert_equals_("a Array (1 3)",_st(array)._printString());
  1561. _st(array)._add_("foo");
  1562. _st(self)._assert_equals_("a Array (1 3 'foo')",_st(array)._printString());
  1563. $3=array;
  1564. _st($3)._remove_((1));
  1565. $4=_st($3)._remove_((3));
  1566. _st(self)._assert_equals_("a Array ('foo')",_st(array)._printString());
  1567. _st(array)._addLast_((3));
  1568. _st(self)._assert_equals_("a Array ('foo' 3)",_st(array)._printString());
  1569. _st(array)._addLast_((3));
  1570. _st(self)._assert_equals_("a Array ('foo' 3 3)",_st(array)._printString());
  1571. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array}, smalltalk.ArrayTest)})},
  1572. args: [],
  1573. source: "testPrintString\x0a\x09| array |\x0a\x09array := Array new.\x0a\x09self assert: 'a Array ()' equals: ( array printString ).\x0a\x09array add: 1; add: 3.\x0a\x09self assert: 'a Array (1 3)' equals: ( array printString ).\x0a\x09array add: 'foo'.\x0a\x09self assert: 'a Array (1 3 ''foo'')' equals: ( array printString ).\x0a\x09array remove: 1; remove: 3.\x0a\x09self assert: 'a Array (''foo'')' equals: ( array printString ).\x0a\x09array addLast: 3.\x0a\x09self assert: 'a Array (''foo'' 3)' equals: ( array printString ).\x0a\x09array addLast: 3.\x0a\x09self assert: 'a Array (''foo'' 3 3)' equals: ( array printString ).",
  1574. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  1575. referencedClasses: ["Array"]
  1576. }),
  1577. smalltalk.ArrayTest);
  1578. smalltalk.addMethod(
  1579. "_collectionClass",
  1580. smalltalk.method({
  1581. selector: "collectionClass",
  1582. category: 'accessing',
  1583. fn: function (){
  1584. var self=this;
  1585. return smalltalk.withContext(function($ctx1) { var $1;
  1586. $1=(smalltalk.Array || Array);
  1587. return $1;
  1588. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.ArrayTest.klass)})},
  1589. args: [],
  1590. source: "collectionClass\x0a\x09^ Array",
  1591. messageSends: [],
  1592. referencedClasses: ["Array"]
  1593. }),
  1594. smalltalk.ArrayTest.klass);
  1595. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1596. smalltalk.addMethod(
  1597. "_collection",
  1598. smalltalk.method({
  1599. selector: "collection",
  1600. category: 'accessing',
  1601. fn: function (){
  1602. var self=this;
  1603. return smalltalk.withContext(function($ctx1) { return "hello";
  1604. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.StringTest)})},
  1605. args: [],
  1606. source: "collection\x0a\x09^'hello'",
  1607. messageSends: [],
  1608. referencedClasses: []
  1609. }),
  1610. smalltalk.StringTest);
  1611. smalltalk.addMethod(
  1612. "_collectionWithDuplicates",
  1613. smalltalk.method({
  1614. selector: "collectionWithDuplicates",
  1615. category: 'accessing',
  1616. fn: function (){
  1617. var self=this;
  1618. return smalltalk.withContext(function($ctx1) { return "abbaerte";
  1619. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.StringTest)})},
  1620. args: [],
  1621. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  1622. messageSends: [],
  1623. referencedClasses: []
  1624. }),
  1625. smalltalk.StringTest);
  1626. smalltalk.addMethod(
  1627. "_testAddRemove",
  1628. smalltalk.method({
  1629. selector: "testAddRemove",
  1630. category: 'tests',
  1631. fn: function (){
  1632. var self=this;
  1633. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1634. return smalltalk.withContext(function($ctx2) { return _st("hello")._add_("a");
  1635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1636. _st(self)._should_raise_((function(){
  1637. return smalltalk.withContext(function($ctx2) { return _st("hello")._remove_("h");
  1638. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1639. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{}, smalltalk.StringTest)})},
  1640. args: [],
  1641. source: "testAddRemove\x0a\x09self should: ['hello' add: 'a'] raise: Error.\x0a\x09self should: ['hello' remove: 'h'] raise: Error",
  1642. messageSends: ["should:raise:", "add:", "remove:"],
  1643. referencedClasses: ["Error"]
  1644. }),
  1645. smalltalk.StringTest);
  1646. smalltalk.addMethod(
  1647. "_testAsArray",
  1648. smalltalk.method({
  1649. selector: "testAsArray",
  1650. category: 'tests',
  1651. fn: function (){
  1652. var self=this;
  1653. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st("hello")._asArray()).__eq(["h", "e", "l", "l", "o"]));
  1654. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{}, smalltalk.StringTest)})},
  1655. args: [],
  1656. source: "testAsArray\x0a\x09self assert: 'hello' asArray = #('h' 'e' 'l' 'l' 'o').",
  1657. messageSends: ["assert:", "=", "asArray"],
  1658. referencedClasses: []
  1659. }),
  1660. smalltalk.StringTest);
  1661. smalltalk.addMethod(
  1662. "_testAt",
  1663. smalltalk.method({
  1664. selector: "testAt",
  1665. category: 'tests',
  1666. fn: function (){
  1667. var self=this;
  1668. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st("hello")._at_((1))).__eq("h"));
  1669. _st(self)._assert_(_st(_st("hello")._at_((5))).__eq("o"));
  1670. _st(self)._assert_(_st(_st("hello")._at_ifAbsent_((6),(function(){
  1671. return smalltalk.withContext(function($ctx2) { return nil;
  1672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq(nil));
  1673. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.StringTest)})},
  1674. args: [],
  1675. source: "testAt\x0a\x09self assert: ('hello' at: 1) = 'h'.\x0a\x09self assert: ('hello' at: 5) = 'o'.\x0a\x09self assert: ('hello' at: 6 ifAbsent: [nil]) = nil",
  1676. messageSends: ["assert:", "=", "at:", "at:ifAbsent:"],
  1677. referencedClasses: []
  1678. }),
  1679. smalltalk.StringTest);
  1680. smalltalk.addMethod(
  1681. "_testAtPut",
  1682. smalltalk.method({
  1683. selector: "testAtPut",
  1684. category: 'tests',
  1685. fn: function (){
  1686. var self=this;
  1687. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1688. return smalltalk.withContext(function($ctx2) { return _st("hello")._at_put_((1),"a");
  1689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1690. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{}, smalltalk.StringTest)})},
  1691. args: [],
  1692. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  1693. messageSends: ["should:raise:", "at:put:"],
  1694. referencedClasses: ["Error"]
  1695. }),
  1696. smalltalk.StringTest);
  1697. smalltalk.addMethod(
  1698. "_testCollect",
  1699. smalltalk.method({
  1700. selector: "testCollect",
  1701. category: 'tests',
  1702. fn: function (){
  1703. var self=this;
  1704. var newCollection;
  1705. return smalltalk.withContext(function($ctx1) { newCollection="hheelllloo";
  1706. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  1707. return smalltalk.withContext(function($ctx2) { return _st(each).__comma(each);
  1708. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1709. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection}, smalltalk.StringTest)})},
  1710. args: [],
  1711. source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := 'hheelllloo'.\x0a\x09self \x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each, each ])\x0a\x09\x09as: newCollection",
  1712. messageSends: ["assertSameContents:as:", "collect:", ",", "collection"],
  1713. referencedClasses: []
  1714. }),
  1715. smalltalk.StringTest);
  1716. smalltalk.addMethod(
  1717. "_testCopyWithoutAll",
  1718. smalltalk.method({
  1719. selector: "testCopyWithoutAll",
  1720. category: 'tests',
  1721. fn: function (){
  1722. var self=this;
  1723. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("hello world",_st("*hello* *world*")._copyWithoutAll_("*"));
  1724. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{}, smalltalk.StringTest)})},
  1725. args: [],
  1726. source: "testCopyWithoutAll\x0a\x09self \x0a\x09\x09assert: 'hello world' \x0a\x09\x09equals: ('*hello* *world*' copyWithoutAll: '*')",
  1727. messageSends: ["assert:equals:", "copyWithoutAll:"],
  1728. referencedClasses: []
  1729. }),
  1730. smalltalk.StringTest);
  1731. smalltalk.addMethod(
  1732. "_testDetect",
  1733. smalltalk.method({
  1734. selector: "testDetect",
  1735. category: 'tests',
  1736. fn: function (){
  1737. var self=this;
  1738. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._detect_((function(each){
  1739. return smalltalk.withContext(function($ctx2) { return _st(each).__eq("h");
  1740. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__eq("h"));
  1741. _st(self)._should_raise_((function(){
  1742. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._detect_((function(each){
  1743. return smalltalk.withContext(function($ctx3) { return _st(each).__eq((6));
  1744. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  1745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1746. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{}, smalltalk.StringTest)})},
  1747. args: [],
  1748. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each = 'h' ]) = 'h'.\x0a\x09self \x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
  1749. messageSends: ["assert:", "=", "detect:", "collection", "should:raise:"],
  1750. referencedClasses: ["Error"]
  1751. }),
  1752. smalltalk.StringTest);
  1753. smalltalk.addMethod(
  1754. "_testEquality",
  1755. smalltalk.method({
  1756. selector: "testEquality",
  1757. category: 'tests',
  1758. fn: function (){
  1759. var self=this;
  1760. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st("hello").__eq("hello"));
  1761. _st(self)._deny_(_st("hello").__eq("world"));
  1762. _st(self)._assert_(_st("hello").__eq(_st("hello")._yourself()));
  1763. _st(self)._assert_(_st(_st("hello")._yourself()).__eq("hello"));
  1764. _st(self)._deny_(_st("").__eq((0)));
  1765. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{}, smalltalk.StringTest)})},
  1766. args: [],
  1767. source: "testEquality\x0a\x09self assert: 'hello' = 'hello'.\x0a\x09self deny: 'hello' = 'world'.\x0a\x0a\x09self assert: 'hello' = 'hello' yourself.\x0a\x09self assert: 'hello' yourself = 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' = 0",
  1768. messageSends: ["assert:", "=", "deny:", "yourself"],
  1769. referencedClasses: []
  1770. }),
  1771. smalltalk.StringTest);
  1772. smalltalk.addMethod(
  1773. "_testIdentity",
  1774. smalltalk.method({
  1775. selector: "testIdentity",
  1776. category: 'tests',
  1777. fn: function (){
  1778. var self=this;
  1779. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st("hello").__eq_eq("hello"));
  1780. _st(self)._deny_(_st("hello").__eq_eq("world"));
  1781. _st(self)._assert_(_st("hello").__eq_eq(_st("hello")._yourself()));
  1782. _st(self)._assert_(_st(_st("hello")._yourself()).__eq_eq("hello"));
  1783. _st(self)._deny_(_st("").__eq_eq((0)));
  1784. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{}, smalltalk.StringTest)})},
  1785. args: [],
  1786. source: "testIdentity\x0a\x09self assert: 'hello' == 'hello'.\x0a\x09self deny: 'hello' == 'world'.\x0a\x0a\x09self assert: 'hello' == 'hello' yourself.\x0a\x09self assert: 'hello' yourself == 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' == 0",
  1787. messageSends: ["assert:", "==", "deny:", "yourself"],
  1788. referencedClasses: []
  1789. }),
  1790. smalltalk.StringTest);
  1791. smalltalk.addMethod(
  1792. "_testIncludesSubString",
  1793. smalltalk.method({
  1794. selector: "testIncludesSubString",
  1795. category: 'tests',
  1796. fn: function (){
  1797. var self=this;
  1798. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st("amber")._includesSubString_("ber"));
  1799. _st(self)._deny_(_st("amber")._includesSubString_("zork"));
  1800. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{}, smalltalk.StringTest)})},
  1801. args: [],
  1802. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  1803. messageSends: ["assert:", "includesSubString:", "deny:"],
  1804. referencedClasses: []
  1805. }),
  1806. smalltalk.StringTest);
  1807. smalltalk.addMethod(
  1808. "_testJoin",
  1809. smalltalk.method({
  1810. selector: "testJoin",
  1811. category: 'tests',
  1812. fn: function (){
  1813. var self=this;
  1814. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("hello,world",_st(",")._join_(["hello", "world"]));
  1815. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{}, smalltalk.StringTest)})},
  1816. args: [],
  1817. source: "testJoin\x0a\x09self assert: 'hello,world' equals: (',' join: #('hello' 'world'))",
  1818. messageSends: ["assert:equals:", "join:"],
  1819. referencedClasses: []
  1820. }),
  1821. smalltalk.StringTest);
  1822. smalltalk.addMethod(
  1823. "_testSelect",
  1824. smalltalk.method({
  1825. selector: "testSelect",
  1826. category: 'tests',
  1827. fn: function (){
  1828. var self=this;
  1829. var newCollection;
  1830. return smalltalk.withContext(function($ctx1) { newCollection="o";
  1831. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  1832. return smalltalk.withContext(function($ctx2) { return _st(each).__eq("o");
  1833. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1834. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection}, smalltalk.StringTest)})},
  1835. args: [],
  1836. source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := 'o'.\x0a\x09self \x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each = 'o' ])\x0a\x09\x09as: newCollection",
  1837. messageSends: ["assertSameContents:as:", "select:", "=", "collection"],
  1838. referencedClasses: []
  1839. }),
  1840. smalltalk.StringTest);
  1841. smalltalk.addMethod(
  1842. "_testSize",
  1843. smalltalk.method({
  1844. selector: "testSize",
  1845. category: 'tests',
  1846. fn: function (){
  1847. var self=this;
  1848. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st("smalltalk")._size(),(9));
  1849. _st(self)._assert_equals_(_st("")._size(),(0));
  1850. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{}, smalltalk.StringTest)})},
  1851. args: [],
  1852. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  1853. messageSends: ["assert:equals:", "size"],
  1854. referencedClasses: []
  1855. }),
  1856. smalltalk.StringTest);
  1857. smalltalk.addMethod(
  1858. "_testStreamContents",
  1859. smalltalk.method({
  1860. selector: "testStreamContents",
  1861. category: 'tests',
  1862. fn: function (){
  1863. var self=this;
  1864. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1865. _st(self)._assert_equals_("hello world",_st((smalltalk.String || String))._streamContents_((function(aStream){
  1866. return smalltalk.withContext(function($ctx2) { $1=aStream;
  1867. _st($1)._nextPutAll_("hello");
  1868. _st($1)._space();
  1869. $2=_st($1)._nextPutAll_("world");
  1870. return $2;
  1871. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})})));
  1872. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{}, smalltalk.StringTest)})},
  1873. args: [],
  1874. source: "testStreamContents\x0a\x09self \x0a\x09\x09assert: 'hello world' \x0a\x09\x09equals: (String streamContents: [ :aStream | \x0a\x09\x09\x09aStream \x0a\x09\x09\x09\x09nextPutAll: 'hello'; space; \x0a\x09\x09\x09\x09nextPutAll: 'world' ])",
  1875. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  1876. referencedClasses: ["String"]
  1877. }),
  1878. smalltalk.StringTest);
  1879. smalltalk.addMethod(
  1880. "_collectionClass",
  1881. smalltalk.method({
  1882. selector: "collectionClass",
  1883. category: 'accessing',
  1884. fn: function (){
  1885. var self=this;
  1886. return smalltalk.withContext(function($ctx1) { var $1;
  1887. $1=(smalltalk.String || String);
  1888. return $1;
  1889. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.StringTest.klass)})},
  1890. args: [],
  1891. source: "collectionClass\x0a\x09^ String",
  1892. messageSends: [],
  1893. referencedClasses: ["String"]
  1894. }),
  1895. smalltalk.StringTest.klass);
  1896. smalltalk.addClass('SymbolTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1897. smalltalk.addMethod(
  1898. "_collection",
  1899. smalltalk.method({
  1900. selector: "collection",
  1901. category: 'accessing',
  1902. fn: function (){
  1903. var self=this;
  1904. return smalltalk.withContext(function($ctx1) { return smalltalk.symbolFor("hello");
  1905. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.SymbolTest)})},
  1906. args: [],
  1907. source: "collection\x0a\x09^ #hello",
  1908. messageSends: [],
  1909. referencedClasses: []
  1910. }),
  1911. smalltalk.SymbolTest);
  1912. smalltalk.addMethod(
  1913. "_collectionWithDuplicates",
  1914. smalltalk.method({
  1915. selector: "collectionWithDuplicates",
  1916. category: 'accessing',
  1917. fn: function (){
  1918. var self=this;
  1919. return smalltalk.withContext(function($ctx1) { return smalltalk.symbolFor("phhaaarorra");
  1920. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.SymbolTest)})},
  1921. args: [],
  1922. source: "collectionWithDuplicates\x0a\x09^ #phhaaarorra",
  1923. messageSends: [],
  1924. referencedClasses: []
  1925. }),
  1926. smalltalk.SymbolTest);
  1927. smalltalk.addMethod(
  1928. "_testAsString",
  1929. smalltalk.method({
  1930. selector: "testAsString",
  1931. category: 'tests',
  1932. fn: function (){
  1933. var self=this;
  1934. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(smalltalk.symbolFor("hello"))._asString(),"hello");
  1935. return self}, function($ctx1) {$ctx1.fill(self,"testAsString",{}, smalltalk.SymbolTest)})},
  1936. args: [],
  1937. source: "testAsString\x0a\x09self assert: #hello asString equals: 'hello'",
  1938. messageSends: ["assert:equals:", "asString"],
  1939. referencedClasses: []
  1940. }),
  1941. smalltalk.SymbolTest);
  1942. smalltalk.addMethod(
  1943. "_testAsSymbol",
  1944. smalltalk.method({
  1945. selector: "testAsSymbol",
  1946. category: 'tests',
  1947. fn: function (){
  1948. var self=this;
  1949. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq_eq(_st(smalltalk.symbolFor("hello"))._asSymbol()));
  1950. return self}, function($ctx1) {$ctx1.fill(self,"testAsSymbol",{}, smalltalk.SymbolTest)})},
  1951. args: [],
  1952. source: "testAsSymbol\x0a\x09self assert: #hello == #hello asSymbol",
  1953. messageSends: ["assert:", "==", "asSymbol"],
  1954. referencedClasses: []
  1955. }),
  1956. smalltalk.SymbolTest);
  1957. smalltalk.addMethod(
  1958. "_testAt",
  1959. smalltalk.method({
  1960. selector: "testAt",
  1961. category: 'tests',
  1962. fn: function (){
  1963. var self=this;
  1964. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._at_((1))).__eq("h"));
  1965. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._at_((5))).__eq("o"));
  1966. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._at_ifAbsent_((6),(function(){
  1967. return smalltalk.withContext(function($ctx2) { return nil;
  1968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq(nil));
  1969. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.SymbolTest)})},
  1970. args: [],
  1971. source: "testAt\x0a\x09self assert: (#hello at: 1) = 'h'.\x0a\x09self assert: (#hello at: 5) = 'o'.\x0a\x09self assert: (#hello at: 6 ifAbsent: [nil]) = nil",
  1972. messageSends: ["assert:", "=", "at:", "at:ifAbsent:"],
  1973. referencedClasses: []
  1974. }),
  1975. smalltalk.SymbolTest);
  1976. smalltalk.addMethod(
  1977. "_testAtPut",
  1978. smalltalk.method({
  1979. selector: "testAtPut",
  1980. category: 'tests',
  1981. fn: function (){
  1982. var self=this;
  1983. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  1984. return smalltalk.withContext(function($ctx2) { return _st("hello")._at_put_((1),"a");
  1985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1986. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{}, smalltalk.SymbolTest)})},
  1987. args: [],
  1988. source: "testAtPut\x0a\x09\x22Symbol instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  1989. messageSends: ["should:raise:", "at:put:"],
  1990. referencedClasses: ["Error"]
  1991. }),
  1992. smalltalk.SymbolTest);
  1993. smalltalk.addMethod(
  1994. "_testCollect",
  1995. smalltalk.method({
  1996. selector: "testCollect",
  1997. category: 'tests',
  1998. fn: function (){
  1999. var self=this;
  2000. var newCollection;
  2001. return smalltalk.withContext(function($ctx1) { newCollection=smalltalk.symbolFor("hheelllloo");
  2002. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  2003. return smalltalk.withContext(function($ctx2) { return _st(each).__comma(each);
  2004. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  2005. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection}, smalltalk.SymbolTest)})},
  2006. args: [],
  2007. source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := #hheelllloo.\x0a\x09self \x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each, each ])\x0a\x09\x09as: newCollection",
  2008. messageSends: ["assertSameContents:as:", "collect:", ",", "collection"],
  2009. referencedClasses: []
  2010. }),
  2011. smalltalk.SymbolTest);
  2012. smalltalk.addMethod(
  2013. "_testComparing",
  2014. smalltalk.method({
  2015. selector: "testComparing",
  2016. category: 'tests',
  2017. fn: function (){
  2018. var self=this;
  2019. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__gt(smalltalk.symbolFor("aa")));
  2020. _st(self)._deny_(_st(smalltalk.symbolFor("ab")).__gt(smalltalk.symbolFor("ba")));
  2021. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__lt(smalltalk.symbolFor("ba")));
  2022. _st(self)._deny_(_st(smalltalk.symbolFor("bb")).__lt(smalltalk.symbolFor("ba")));
  2023. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__gt_eq(smalltalk.symbolFor("aa")));
  2024. _st(self)._deny_(_st(smalltalk.symbolFor("ab")).__gt_eq(smalltalk.symbolFor("ba")));
  2025. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__lt_eq(smalltalk.symbolFor("ba")));
  2026. _st(self)._deny_(_st(smalltalk.symbolFor("bb")).__lt_eq(smalltalk.symbolFor("ba")));
  2027. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{}, smalltalk.SymbolTest)})},
  2028. args: [],
  2029. source: "testComparing\x0a\x09self assert: #ab > #aa.\x0a\x09self deny: #ab > #ba.\x0a\x0a\x09self assert: #ab < #ba.\x0a\x09self deny: #bb < #ba.\x0a\x0a\x09self assert: #ab >= #aa.\x0a\x09self deny: #ab >= #ba.\x0a\x0a\x09self assert: #ab <= #ba.\x0a\x09self deny: #bb <= #ba",
  2030. messageSends: ["assert:", ">", "deny:", "<", ">=", "<="],
  2031. referencedClasses: []
  2032. }),
  2033. smalltalk.SymbolTest);
  2034. smalltalk.addMethod(
  2035. "_testCopying",
  2036. smalltalk.method({
  2037. selector: "testCopying",
  2038. category: 'tests',
  2039. fn: function (){
  2040. var self=this;
  2041. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._copy()).__eq_eq(smalltalk.symbolFor("hello")));
  2042. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._deepCopy()).__eq_eq(smalltalk.symbolFor("hello")));
  2043. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{}, smalltalk.SymbolTest)})},
  2044. args: [],
  2045. source: "testCopying\x0a\x09self assert: #hello copy == #hello.\x0a\x09self assert: #hello deepCopy == #hello",
  2046. messageSends: ["assert:", "==", "copy", "deepCopy"],
  2047. referencedClasses: []
  2048. }),
  2049. smalltalk.SymbolTest);
  2050. smalltalk.addMethod(
  2051. "_testDetect",
  2052. smalltalk.method({
  2053. selector: "testDetect",
  2054. category: 'tests',
  2055. fn: function (){
  2056. var self=this;
  2057. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._collection())._detect_((function(each){
  2058. return smalltalk.withContext(function($ctx2) { return _st(each).__eq("h");
  2059. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__eq("h"));
  2060. _st(self)._should_raise_((function(){
  2061. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._collection())._detect_((function(each){
  2062. return smalltalk.withContext(function($ctx3) { return _st(each).__eq("z");
  2063. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  2064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  2065. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{}, smalltalk.SymbolTest)})},
  2066. args: [],
  2067. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each = 'h' ]) = 'h'.\x0a\x09self \x0a\x09\x09should: [ self collection detect: [ :each | each = 'z' ] ]\x0a\x09\x09raise: Error",
  2068. messageSends: ["assert:", "=", "detect:", "collection", "should:raise:"],
  2069. referencedClasses: ["Error"]
  2070. }),
  2071. smalltalk.SymbolTest);
  2072. smalltalk.addMethod(
  2073. "_testEquality",
  2074. smalltalk.method({
  2075. selector: "testEquality",
  2076. category: 'tests',
  2077. fn: function (){
  2078. var self=this;
  2079. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(smalltalk.symbolFor("hello")));
  2080. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq(smalltalk.symbolFor("world")));
  2081. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(_st(smalltalk.symbolFor("hello"))._yourself()));
  2082. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._yourself()).__eq(smalltalk.symbolFor("hello")));
  2083. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq("hello"));
  2084. _st(self)._deny_(_st("hello").__eq(smalltalk.symbolFor("hello")));
  2085. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{}, smalltalk.SymbolTest)})},
  2086. args: [],
  2087. source: "testEquality\x0a\x09self assert: #hello = #hello.\x0a\x09self deny: #hello = #world.\x0a\x0a\x09self assert: #hello = #hello yourself.\x0a\x09self assert: #hello yourself = #hello.\x0a\x0a\x09self deny: #hello = 'hello'.\x0a\x09self deny: 'hello' = #hello.",
  2088. messageSends: ["assert:", "=", "deny:", "yourself"],
  2089. referencedClasses: []
  2090. }),
  2091. smalltalk.SymbolTest);
  2092. smalltalk.addMethod(
  2093. "_testIdentity",
  2094. smalltalk.method({
  2095. selector: "testIdentity",
  2096. category: 'tests',
  2097. fn: function (){
  2098. var self=this;
  2099. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq_eq(smalltalk.symbolFor("hello")));
  2100. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq_eq(smalltalk.symbolFor("world")));
  2101. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(_st(smalltalk.symbolFor("hello"))._yourself()));
  2102. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._yourself()).__eq(_st(_st(smalltalk.symbolFor("hello"))._asString())._asSymbol()));
  2103. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{}, smalltalk.SymbolTest)})},
  2104. args: [],
  2105. source: "testIdentity\x0a\x09self assert: #hello == #hello.\x0a\x09self deny: #hello == #world.\x0a\x0a\x09self assert: #hello = #hello yourself.\x0a\x09self assert: #hello yourself = #hello asString asSymbol",
  2106. messageSends: ["assert:", "==", "deny:", "=", "yourself", "asSymbol", "asString"],
  2107. referencedClasses: []
  2108. }),
  2109. smalltalk.SymbolTest);
  2110. smalltalk.addMethod(
  2111. "_testIsEmpty",
  2112. smalltalk.method({
  2113. selector: "testIsEmpty",
  2114. category: 'tests',
  2115. fn: function (){
  2116. var self=this;
  2117. return smalltalk.withContext(function($ctx1) { _st(self)._deny_(_st(_st(self)._collection())._isEmpty());
  2118. _st(self)._assert_(_st(_st("")._asSymbol())._isEmpty());
  2119. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{}, smalltalk.SymbolTest)})},
  2120. args: [],
  2121. source: "testIsEmpty\x0a\x09self deny: self collection isEmpty.\x0a\x09self assert: '' asSymbol isEmpty",
  2122. messageSends: ["deny:", "isEmpty", "collection", "assert:", "asSymbol"],
  2123. referencedClasses: []
  2124. }),
  2125. smalltalk.SymbolTest);
  2126. smalltalk.addMethod(
  2127. "_testIsSymbolIsString",
  2128. smalltalk.method({
  2129. selector: "testIsSymbolIsString",
  2130. category: 'tests',
  2131. fn: function (){
  2132. var self=this;
  2133. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(smalltalk.symbolFor("hello"))._isSymbol());
  2134. _st(self)._deny_(_st("hello")._isSymbol());
  2135. _st(self)._deny_(_st(smalltalk.symbolFor("hello"))._isString());
  2136. _st(self)._assert_(_st("hello")._isString());
  2137. return self}, function($ctx1) {$ctx1.fill(self,"testIsSymbolIsString",{}, smalltalk.SymbolTest)})},
  2138. args: [],
  2139. source: "testIsSymbolIsString\x0a\x09self assert: #hello isSymbol.\x0a\x09self deny: 'hello' isSymbol.\x0a\x09self deny: #hello isString.\x0a\x09self assert: 'hello' isString",
  2140. messageSends: ["assert:", "isSymbol", "deny:", "isString"],
  2141. referencedClasses: []
  2142. }),
  2143. smalltalk.SymbolTest);
  2144. smalltalk.addMethod(
  2145. "_testSelect",
  2146. smalltalk.method({
  2147. selector: "testSelect",
  2148. category: 'tests',
  2149. fn: function (){
  2150. var self=this;
  2151. var newCollection;
  2152. return smalltalk.withContext(function($ctx1) { newCollection="o";
  2153. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  2154. return smalltalk.withContext(function($ctx2) { return _st(each).__eq("o");
  2155. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  2156. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection}, smalltalk.SymbolTest)})},
  2157. args: [],
  2158. source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := 'o'.\x0a\x09self \x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each = 'o' ])\x0a\x09\x09as: newCollection",
  2159. messageSends: ["assertSameContents:as:", "select:", "=", "collection"],
  2160. referencedClasses: []
  2161. }),
  2162. smalltalk.SymbolTest);
  2163. smalltalk.addMethod(
  2164. "_testSize",
  2165. smalltalk.method({
  2166. selector: "testSize",
  2167. category: 'tests',
  2168. fn: function (){
  2169. var self=this;
  2170. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(smalltalk.symbolFor("a"))._size(),(1));
  2171. _st(self)._assert_equals_(_st(smalltalk.symbolFor("aaaaa"))._size(),(5));
  2172. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{}, smalltalk.SymbolTest)})},
  2173. args: [],
  2174. source: "testSize\x0a\x09self assert: #a size equals: 1.\x0a\x09self assert: #aaaaa size equals: 5",
  2175. messageSends: ["assert:equals:", "size"],
  2176. referencedClasses: []
  2177. }),
  2178. smalltalk.SymbolTest);
  2179. smalltalk.addMethod(
  2180. "_collectionClass",
  2181. smalltalk.method({
  2182. selector: "collectionClass",
  2183. category: 'accessing',
  2184. fn: function (){
  2185. var self=this;
  2186. return smalltalk.withContext(function($ctx1) { var $1;
  2187. $1=(smalltalk.Symbol || Symbol);
  2188. return $1;
  2189. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.SymbolTest.klass)})},
  2190. args: [],
  2191. source: "collectionClass\x0a\x09^ Symbol",
  2192. messageSends: [],
  2193. referencedClasses: ["Symbol"]
  2194. }),
  2195. smalltalk.SymbolTest.klass);
  2196. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2197. smalltalk.addMethod(
  2198. "_jsObject",
  2199. smalltalk.method({
  2200. selector: "jsObject",
  2201. category: 'accessing',
  2202. fn: function (){
  2203. var self=this;
  2204. return smalltalk.withContext(function($ctx1) { return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null};
  2205. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{}, smalltalk.JSObjectProxyTest)})},
  2206. args: [],
  2207. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null}>",
  2208. messageSends: [],
  2209. referencedClasses: []
  2210. }),
  2211. smalltalk.JSObjectProxyTest);
  2212. smalltalk.addMethod(
  2213. "_testDNU",
  2214. smalltalk.method({
  2215. selector: "testDNU",
  2216. category: 'tests',
  2217. fn: function (){
  2218. var self=this;
  2219. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  2220. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._jsObject())._foo();
  2221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2222. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{}, smalltalk.JSObjectProxyTest)})},
  2223. args: [],
  2224. source: "testDNU\x0a\x09self should: [self jsObject foo] raise: MessageNotUnderstood",
  2225. messageSends: ["should:raise:", "foo", "jsObject"],
  2226. referencedClasses: ["MessageNotUnderstood"]
  2227. }),
  2228. smalltalk.JSObjectProxyTest);
  2229. smalltalk.addMethod(
  2230. "_testMessageSend",
  2231. smalltalk.method({
  2232. selector: "testMessageSend",
  2233. category: 'tests',
  2234. fn: function (){
  2235. var self=this;
  2236. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st(self)._jsObject())._a(),(1));
  2237. _st(self)._assert_equals_(_st(_st(self)._jsObject())._b(),(2));
  2238. _st(self)._assert_equals_(_st(_st(self)._jsObject())._c_((3)),(3));
  2239. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{}, smalltalk.JSObjectProxyTest)})},
  2240. args: [],
  2241. source: "testMessageSend\x0a\x0a\x09self assert: self jsObject a equals: 1.\x0a\x09self assert: self jsObject b equals: 2.\x0a\x09self assert: (self jsObject c: 3) equals: 3",
  2242. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  2243. referencedClasses: []
  2244. }),
  2245. smalltalk.JSObjectProxyTest);
  2246. smalltalk.addMethod(
  2247. "_testMethodWithArguments",
  2248. smalltalk.method({
  2249. selector: "testMethodWithArguments",
  2250. category: 'tests',
  2251. fn: function (){
  2252. var self=this;
  2253. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st(self)._jsObject())._c_((1)),(1));
  2254. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{}, smalltalk.JSObjectProxyTest)})},
  2255. args: [],
  2256. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  2257. messageSends: ["assert:equals:", "c:", "jsObject"],
  2258. referencedClasses: []
  2259. }),
  2260. smalltalk.JSObjectProxyTest);
  2261. smalltalk.addMethod(
  2262. "_testPrinting",
  2263. smalltalk.method({
  2264. selector: "testPrinting",
  2265. category: 'tests',
  2266. fn: function (){
  2267. var self=this;
  2268. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(_st(self)._jsObject())._printString()).__eq("[object Object]"));
  2269. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{}, smalltalk.JSObjectProxyTest)})},
  2270. args: [],
  2271. source: "testPrinting\x0a\x09self assert: self jsObject printString = '[object Object]'",
  2272. messageSends: ["assert:", "=", "printString", "jsObject"],
  2273. referencedClasses: []
  2274. }),
  2275. smalltalk.JSObjectProxyTest);
  2276. smalltalk.addMethod(
  2277. "_testPropertyThatReturnsEmptyString",
  2278. smalltalk.method({
  2279. selector: "testPropertyThatReturnsEmptyString",
  2280. category: 'tests',
  2281. fn: function (){
  2282. var self=this;
  2283. var object;
  2284. return smalltalk.withContext(function($ctx1) { object=_st(self)._jsObject();
  2285. _st(self)._assert_equals_("",_st(object)._d());
  2286. _st(object)._d_("hello");
  2287. _st(self)._assert_equals_("hello",_st(object)._d());
  2288. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object}, smalltalk.JSObjectProxyTest)})},
  2289. args: [],
  2290. source: "testPropertyThatReturnsEmptyString\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self assert: '' equals: object d.\x0a\x0a\x09object d: 'hello'.\x0a\x09self assert: 'hello' equals: object d",
  2291. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  2292. referencedClasses: []
  2293. }),
  2294. smalltalk.JSObjectProxyTest);
  2295. smalltalk.addMethod(
  2296. "_testPropertyThatReturnsUndefined",
  2297. smalltalk.method({
  2298. selector: "testPropertyThatReturnsUndefined",
  2299. category: 'tests',
  2300. fn: function (){
  2301. var self=this;
  2302. var object;
  2303. return smalltalk.withContext(function($ctx1) { object=_st(self)._jsObject();
  2304. _st(self)._shouldnt_raise_((function(){
  2305. return smalltalk.withContext(function($ctx2) { return _st(object)._e();
  2306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2307. _st(self)._assert_(_st(_st(object)._e())._isNil());
  2308. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object}, smalltalk.JSObjectProxyTest)})},
  2309. args: [],
  2310. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a self assert: object e isNil",
  2311. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  2312. referencedClasses: ["MessageNotUnderstood"]
  2313. }),
  2314. smalltalk.JSObjectProxyTest);
  2315. smalltalk.addMethod(
  2316. "_testYourself",
  2317. smalltalk.method({
  2318. selector: "testYourself",
  2319. category: 'tests',
  2320. fn: function (){
  2321. var self=this;
  2322. var object;
  2323. return smalltalk.withContext(function($ctx1) { var $1,$2;
  2324. $1=_st(self)._jsObject();
  2325. _st($1)._d_("test");
  2326. $2=_st($1)._yourself();
  2327. object=$2;
  2328. _st(self)._assert_equals_(_st(object)._d(),"test");
  2329. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object}, smalltalk.JSObjectProxyTest)})},
  2330. args: [],
  2331. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  2332. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  2333. referencedClasses: []
  2334. }),
  2335. smalltalk.JSObjectProxyTest);
  2336. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2337. smalltalk.addMethod(
  2338. "_testCatchingException",
  2339. smalltalk.method({
  2340. selector: "testCatchingException",
  2341. category: 'testing',
  2342. fn: function (){
  2343. var self=this;
  2344. return smalltalk.withContext(function($ctx1) { _st((function(){
  2345. return smalltalk.withContext(function($ctx2) { return _st(self)._throwException();
  2346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(error){
  2347. return smalltalk.withContext(function($ctx2) { return _st(self)._assert_(_st(_st(error)._exception()).__eq("test"));
  2348. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  2349. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{}, smalltalk.JavaScriptExceptionTest)})},
  2350. args: [],
  2351. source: "testCatchingException\x0a\x09[ self throwException ]\x0a \x09\x09on: Error\x0a do: [ :error | \x0a\x09\x09\x09self assert: error exception = 'test' ]",
  2352. messageSends: ["on:do:", "assert:", "=", "exception", "throwException"],
  2353. referencedClasses: ["Error"]
  2354. }),
  2355. smalltalk.JavaScriptExceptionTest);
  2356. smalltalk.addMethod(
  2357. "_testRaisingException",
  2358. smalltalk.method({
  2359. selector: "testRaisingException",
  2360. category: 'testing',
  2361. fn: function (){
  2362. var self=this;
  2363. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  2364. return smalltalk.withContext(function($ctx2) { return _st(self)._throwException();
  2365. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.JavaScriptException || JavaScriptException));
  2366. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{}, smalltalk.JavaScriptExceptionTest)})},
  2367. args: [],
  2368. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  2369. messageSends: ["should:raise:", "throwException"],
  2370. referencedClasses: ["JavaScriptException"]
  2371. }),
  2372. smalltalk.JavaScriptExceptionTest);
  2373. smalltalk.addMethod(
  2374. "_throwException",
  2375. smalltalk.method({
  2376. selector: "throwException",
  2377. category: 'helpers',
  2378. fn: function (){
  2379. var self=this;
  2380. return smalltalk.withContext(function($ctx1) { throw 'test';
  2381. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{}, smalltalk.JavaScriptExceptionTest)})},
  2382. args: [],
  2383. source: "throwException\x0a\x09<throw 'test'>",
  2384. messageSends: [],
  2385. referencedClasses: []
  2386. }),
  2387. smalltalk.JavaScriptExceptionTest);
  2388. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2389. smalltalk.addMethod(
  2390. "_testAbs",
  2391. smalltalk.method({
  2392. selector: "testAbs",
  2393. category: 'tests',
  2394. fn: function (){
  2395. var self=this;
  2396. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((4))._abs()).__eq((4)));
  2397. _st(self)._assert_(_st(_st((-4))._abs()).__eq((4)));
  2398. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{}, smalltalk.NumberTest)})},
  2399. args: [],
  2400. source: "testAbs\x0a\x09self assert: 4 abs = 4.\x0a\x09self assert: -4 abs = 4",
  2401. messageSends: ["assert:", "=", "abs"],
  2402. referencedClasses: []
  2403. }),
  2404. smalltalk.NumberTest);
  2405. smalltalk.addMethod(
  2406. "_testArithmetic",
  2407. smalltalk.method({
  2408. selector: "testArithmetic",
  2409. category: 'tests',
  2410. fn: function (){
  2411. var self=this;
  2412. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((1.5)).__plus((1))).__eq((2.5)));
  2413. _st(self)._assert_(_st(_st((2)).__minus((1))).__eq((1)));
  2414. _st(self)._assert_(_st(_st((-2)).__minus((1))).__eq((-3)));
  2415. _st(self)._assert_(_st(_st((12)).__slash((2))).__eq((6)));
  2416. _st(self)._assert_(_st(_st((3)).__star((4))).__eq((12)));
  2417. _st(self)._assert_(_st(_st(_st((1)).__plus((2))).__star((3))).__eq((9)));
  2418. _st(self)._assert_(_st(_st((1)).__plus(_st((2)).__star((3)))).__eq((7)));
  2419. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{}, smalltalk.NumberTest)})},
  2420. args: [],
  2421. source: "testArithmetic\x0a\x09\x0a\x09\x22We rely on JS here, so we won't test complex behavior, just check if \x0a\x09message sends are corrects\x22\x0a\x0a\x09self assert: 1.5 + 1 = 2.5.\x0a\x09self assert: 2 - 1 = 1.\x0a\x09self assert: -2 - 1 = -3.\x0a\x09self assert: 12 / 2 = 6.\x0a\x09self assert: 3 * 4 = 12.\x0a\x0a\x09\x22Simple parenthesis and execution order\x22\x0a\x0a\x09self assert: 1 + 2 * 3 = 9.\x0a\x09self assert: 1 + (2 * 3) = 7",
  2422. messageSends: ["assert:", "=", "+", "-", "/", "*"],
  2423. referencedClasses: []
  2424. }),
  2425. smalltalk.NumberTest);
  2426. smalltalk.addMethod(
  2427. "_testComparison",
  2428. smalltalk.method({
  2429. selector: "testComparison",
  2430. category: 'tests',
  2431. fn: function (){
  2432. var self=this;
  2433. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((3)).__gt((2)));
  2434. _st(self)._assert_(_st((2)).__lt((3)));
  2435. _st(self)._deny_(_st((3)).__lt((2)));
  2436. _st(self)._deny_(_st((2)).__gt((3)));
  2437. _st(self)._assert_(_st((3)).__gt_eq((3)));
  2438. _st(self)._assert_(_st((3.1)).__gt_eq((3)));
  2439. _st(self)._assert_(_st((3)).__lt_eq((3)));
  2440. _st(self)._assert_(_st((3)).__lt_eq((3.1)));
  2441. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{}, smalltalk.NumberTest)})},
  2442. args: [],
  2443. source: "testComparison\x0a\x0a\x09self assert: 3 > 2.\x0a\x09self assert: 2 < 3.\x0a\x09\x0a\x09self deny: 3 < 2.\x0a\x09self deny: 2 > 3.\x0a\x0a\x09self assert: 3 >= 3.\x0a\x09self assert: 3.1 >= 3.\x0a\x09self assert: 3 <= 3.\x0a\x09self assert: 3 <= 3.1",
  2444. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  2445. referencedClasses: []
  2446. }),
  2447. smalltalk.NumberTest);
  2448. smalltalk.addMethod(
  2449. "_testCopying",
  2450. smalltalk.method({
  2451. selector: "testCopying",
  2452. category: 'tests',
  2453. fn: function (){
  2454. var self=this;
  2455. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((1))._copy()).__eq_eq((1)));
  2456. _st(self)._assert_(_st(_st((1))._deepCopy()).__eq_eq((1)));
  2457. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{}, smalltalk.NumberTest)})},
  2458. args: [],
  2459. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  2460. messageSends: ["assert:", "==", "copy", "deepCopy"],
  2461. referencedClasses: []
  2462. }),
  2463. smalltalk.NumberTest);
  2464. smalltalk.addMethod(
  2465. "_testEquality",
  2466. smalltalk.method({
  2467. selector: "testEquality",
  2468. category: 'tests',
  2469. fn: function (){
  2470. var self=this;
  2471. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((1)).__eq((1)));
  2472. _st(self)._assert_(_st((0)).__eq((0)));
  2473. _st(self)._deny_(_st((1)).__eq((0)));
  2474. _st(self)._assert_(_st(_st((1))._yourself()).__eq((1)));
  2475. _st(self)._assert_(_st((1)).__eq(_st((1))._yourself()));
  2476. _st(self)._assert_(_st(_st((1))._yourself()).__eq(_st((1))._yourself()));
  2477. _st(self)._deny_(_st((0)).__eq(false));
  2478. _st(self)._deny_(_st(false).__eq((0)));
  2479. _st(self)._deny_(_st("").__eq((0)));
  2480. _st(self)._deny_(_st((0)).__eq(""));
  2481. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{}, smalltalk.NumberTest)})},
  2482. args: [],
  2483. source: "testEquality\x0a\x09self assert: 1 = 1.\x0a\x09self assert: 0 = 0.\x0a\x09self deny: 1 = 0.\x0a\x0a\x09self assert: 1 yourself = 1.\x0a\x09self assert: 1 = 1 yourself.\x0a\x09self assert: 1 yourself = 1 yourself.\x0a\x09\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = 0.\x0a\x09self deny: 0 = ''",
  2484. messageSends: ["assert:", "=", "deny:", "yourself"],
  2485. referencedClasses: []
  2486. }),
  2487. smalltalk.NumberTest);
  2488. smalltalk.addMethod(
  2489. "_testHexNumbers",
  2490. smalltalk.method({
  2491. selector: "testHexNumbers",
  2492. category: 'tests',
  2493. fn: function (){
  2494. var self=this;
  2495. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((9)).__eq((9)));
  2496. _st(self)._assert_(_st(_st((10))._truncated()).__eq((10)));
  2497. _st(self)._assert_(_st(_st((11))._truncated()).__eq((11)));
  2498. _st(self)._assert_(_st(_st((12))._truncated()).__eq((12)));
  2499. _st(self)._assert_(_st(_st((13))._truncated()).__eq((13)));
  2500. _st(self)._assert_(_st(_st((14))._truncated()).__eq((14)));
  2501. _st(self)._assert_(_st(_st((15))._truncated()).__eq((15)));
  2502. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{}, smalltalk.NumberTest)})},
  2503. args: [],
  2504. source: "testHexNumbers\x0a\x0a\x09self assert: 16r9 = 9.\x0a\x09self assert: 16rA truncated = 10.\x0a\x09self assert: 16rB truncated = 11.\x0a\x09self assert: 16rC truncated = 12.\x0a\x09self assert: 16rD truncated = 13.\x0a\x09self assert: 16rE truncated = 14.\x0a\x09self assert: 16rF truncated = 15",
  2505. messageSends: ["assert:", "=", "truncated"],
  2506. referencedClasses: []
  2507. }),
  2508. smalltalk.NumberTest);
  2509. smalltalk.addMethod(
  2510. "_testIdentity",
  2511. smalltalk.method({
  2512. selector: "testIdentity",
  2513. category: 'tests',
  2514. fn: function (){
  2515. var self=this;
  2516. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st((1)).__eq_eq((1)));
  2517. _st(self)._assert_(_st((0)).__eq_eq((0)));
  2518. _st(self)._deny_(_st((1)).__eq_eq((0)));
  2519. _st(self)._assert_(_st(_st((1))._yourself()).__eq_eq((1)));
  2520. _st(self)._assert_(_st((1)).__eq_eq(_st((1))._yourself()));
  2521. _st(self)._assert_(_st(_st((1))._yourself()).__eq_eq(_st((1))._yourself()));
  2522. _st(self)._deny_(_st((1)).__eq_eq((2)));
  2523. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{}, smalltalk.NumberTest)})},
  2524. args: [],
  2525. source: "testIdentity\x0a\x09self assert: 1 == 1.\x0a\x09self assert: 0 == 0.\x0a\x09self deny: 1 == 0.\x0a\x0a\x09self assert: 1 yourself == 1.\x0a\x09self assert: 1 == 1 yourself.\x0a\x09self assert: 1 yourself == 1 yourself.\x0a\x09\x0a\x09self deny: 1 == 2",
  2526. messageSends: ["assert:", "==", "deny:", "yourself"],
  2527. referencedClasses: []
  2528. }),
  2529. smalltalk.NumberTest);
  2530. smalltalk.addMethod(
  2531. "_testInvalidHexNumbers",
  2532. smalltalk.method({
  2533. selector: "testInvalidHexNumbers",
  2534. category: 'tests',
  2535. fn: function (){
  2536. var self=this;
  2537. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  2538. return smalltalk.withContext(function($ctx2) { return _st((16))._rG();
  2539. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2540. _st(self)._should_raise_((function(){
  2541. return smalltalk.withContext(function($ctx2) { return _st((16))._rg();
  2542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2543. _st(self)._should_raise_((function(){
  2544. return smalltalk.withContext(function($ctx2) { return _st((16))._rH();
  2545. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2546. _st(self)._should_raise_((function(){
  2547. return smalltalk.withContext(function($ctx2) { return _st((16))._rh();
  2548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2549. _st(self)._should_raise_((function(){
  2550. return smalltalk.withContext(function($ctx2) { return _st((16))._rI();
  2551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2552. _st(self)._should_raise_((function(){
  2553. return smalltalk.withContext(function($ctx2) { return _st((16))._ri();
  2554. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2555. _st(self)._should_raise_((function(){
  2556. return smalltalk.withContext(function($ctx2) { return _st((16))._rJ();
  2557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2558. _st(self)._should_raise_((function(){
  2559. return smalltalk.withContext(function($ctx2) { return _st((16))._rj();
  2560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2561. _st(self)._should_raise_((function(){
  2562. return smalltalk.withContext(function($ctx2) { return _st((16))._rK();
  2563. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2564. _st(self)._should_raise_((function(){
  2565. return smalltalk.withContext(function($ctx2) { return _st((16))._rk();
  2566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2567. _st(self)._should_raise_((function(){
  2568. return smalltalk.withContext(function($ctx2) { return _st((16))._rL();
  2569. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2570. _st(self)._should_raise_((function(){
  2571. return smalltalk.withContext(function($ctx2) { return _st((16))._rl();
  2572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2573. _st(self)._should_raise_((function(){
  2574. return smalltalk.withContext(function($ctx2) { return _st((16))._rM();
  2575. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2576. _st(self)._should_raise_((function(){
  2577. return smalltalk.withContext(function($ctx2) { return _st((16))._rm();
  2578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2579. _st(self)._should_raise_((function(){
  2580. return smalltalk.withContext(function($ctx2) { return _st((16))._rN();
  2581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2582. _st(self)._should_raise_((function(){
  2583. return smalltalk.withContext(function($ctx2) { return _st((16))._rn();
  2584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2585. _st(self)._should_raise_((function(){
  2586. return smalltalk.withContext(function($ctx2) { return _st((16))._rO();
  2587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2588. _st(self)._should_raise_((function(){
  2589. return smalltalk.withContext(function($ctx2) { return _st((16))._ro();
  2590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2591. _st(self)._should_raise_((function(){
  2592. return smalltalk.withContext(function($ctx2) { return _st((16))._rP();
  2593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2594. _st(self)._should_raise_((function(){
  2595. return smalltalk.withContext(function($ctx2) { return _st((16))._rp();
  2596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2597. _st(self)._should_raise_((function(){
  2598. return smalltalk.withContext(function($ctx2) { return _st((16))._rQ();
  2599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2600. _st(self)._should_raise_((function(){
  2601. return smalltalk.withContext(function($ctx2) { return _st((16))._rq();
  2602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2603. _st(self)._should_raise_((function(){
  2604. return smalltalk.withContext(function($ctx2) { return _st((16))._rR();
  2605. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2606. _st(self)._should_raise_((function(){
  2607. return smalltalk.withContext(function($ctx2) { return _st((16))._rr();
  2608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2609. _st(self)._should_raise_((function(){
  2610. return smalltalk.withContext(function($ctx2) { return _st((16))._rS();
  2611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2612. _st(self)._should_raise_((function(){
  2613. return smalltalk.withContext(function($ctx2) { return _st((16))._rs();
  2614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2615. _st(self)._should_raise_((function(){
  2616. return smalltalk.withContext(function($ctx2) { return _st((16))._rT();
  2617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2618. _st(self)._should_raise_((function(){
  2619. return smalltalk.withContext(function($ctx2) { return _st((16))._rt();
  2620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2621. _st(self)._should_raise_((function(){
  2622. return smalltalk.withContext(function($ctx2) { return _st((16))._rU();
  2623. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2624. _st(self)._should_raise_((function(){
  2625. return smalltalk.withContext(function($ctx2) { return _st((16))._ru();
  2626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2627. _st(self)._should_raise_((function(){
  2628. return smalltalk.withContext(function($ctx2) { return _st((16))._rV();
  2629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2630. _st(self)._should_raise_((function(){
  2631. return smalltalk.withContext(function($ctx2) { return _st((16))._rv();
  2632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2633. _st(self)._should_raise_((function(){
  2634. return smalltalk.withContext(function($ctx2) { return _st((16))._rW();
  2635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2636. _st(self)._should_raise_((function(){
  2637. return smalltalk.withContext(function($ctx2) { return _st((16))._rw();
  2638. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2639. _st(self)._should_raise_((function(){
  2640. return smalltalk.withContext(function($ctx2) { return _st((16))._rX();
  2641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2642. _st(self)._should_raise_((function(){
  2643. return smalltalk.withContext(function($ctx2) { return _st((16))._rx();
  2644. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2645. _st(self)._should_raise_((function(){
  2646. return smalltalk.withContext(function($ctx2) { return _st((16))._rY();
  2647. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2648. _st(self)._should_raise_((function(){
  2649. return smalltalk.withContext(function($ctx2) { return _st((16))._ry();
  2650. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2651. _st(self)._should_raise_((function(){
  2652. return smalltalk.withContext(function($ctx2) { return _st((16))._rZ();
  2653. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2654. _st(self)._should_raise_((function(){
  2655. return smalltalk.withContext(function($ctx2) { return _st((16))._rz();
  2656. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2657. _st(self)._should_raise_((function(){
  2658. return smalltalk.withContext(function($ctx2) { return _st((11259375))._Z();
  2659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2660. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{}, smalltalk.NumberTest)})},
  2661. args: [],
  2662. source: "testInvalidHexNumbers\x0a\x0a\x09self should: [16rG] raise: MessageNotUnderstood.\x0a \x09self should: [16rg] raise: MessageNotUnderstood.\x0a\x09self should: [16rH] raise: MessageNotUnderstood.\x0a \x09self should: [16rh] raise: MessageNotUnderstood.\x0a\x09self should: [16rI] raise: MessageNotUnderstood.\x0a \x09self should: [16ri] raise: MessageNotUnderstood.\x0a\x09self should: [16rJ] raise: MessageNotUnderstood.\x0a \x09self should: [16rj] raise: MessageNotUnderstood.\x0a\x09self should: [16rK] raise: MessageNotUnderstood.\x0a \x09self should: [16rk] raise: MessageNotUnderstood.\x0a\x09self should: [16rL] raise: MessageNotUnderstood.\x0a \x09self should: [16rl] raise: MessageNotUnderstood.\x0a\x09self should: [16rM] raise: MessageNotUnderstood.\x0a \x09self should: [16rm] raise: MessageNotUnderstood.\x0a\x09self should: [16rN] raise: MessageNotUnderstood.\x0a \x09self should: [16rn] raise: MessageNotUnderstood.\x0a\x09self should: [16rO] raise: MessageNotUnderstood.\x0a \x09self should: [16ro] raise: MessageNotUnderstood.\x0a\x09self should: [16rP] raise: MessageNotUnderstood.\x0a \x09self should: [16rp] raise: MessageNotUnderstood.\x0a\x09self should: [16rQ] raise: MessageNotUnderstood.\x0a \x09self should: [16rq] raise: MessageNotUnderstood.\x0a\x09self should: [16rR] raise: MessageNotUnderstood.\x0a \x09self should: [16rr] raise: MessageNotUnderstood.\x0a\x09self should: [16rS] raise: MessageNotUnderstood.\x0a \x09self should: [16rs] raise: MessageNotUnderstood.\x0a\x09self should: [16rT] raise: MessageNotUnderstood.\x0a \x09self should: [16rt] raise: MessageNotUnderstood.\x0a\x09self should: [16rU] raise: MessageNotUnderstood.\x0a \x09self should: [16ru] raise: MessageNotUnderstood.\x0a\x09self should: [16rV] raise: MessageNotUnderstood.\x0a \x09self should: [16rv] raise: MessageNotUnderstood.\x0a\x09self should: [16rW] raise: MessageNotUnderstood.\x0a \x09self should: [16rw] raise: MessageNotUnderstood.\x0a\x09self should: [16rX] raise: MessageNotUnderstood.\x0a \x09self should: [16rx] raise: MessageNotUnderstood.\x0a\x09self should: [16rY] raise: MessageNotUnderstood.\x0a \x09self should: [16ry] raise: MessageNotUnderstood.\x0a\x09self should: [16rZ] raise: MessageNotUnderstood.\x0a \x09self should: [16rz] raise: MessageNotUnderstood.\x0a self should: [16rABcdEfZ] raise: MessageNotUnderstood.",
  2663. messageSends: ["should:raise:", "rG", "rg", "rH", "rh", "rI", "ri", "rJ", "rj", "rK", "rk", "rL", "rl", "rM", "rm", "rN", "rn", "rO", "ro", "rP", "rp", "rQ", "rq", "rR", "rr", "rS", "rs", "rT", "rt", "rU", "ru", "rV", "rv", "rW", "rw", "rX", "rx", "rY", "ry", "rZ", "rz", "Z"],
  2664. referencedClasses: ["MessageNotUnderstood"]
  2665. }),
  2666. smalltalk.NumberTest);
  2667. smalltalk.addMethod(
  2668. "_testMinMax",
  2669. smalltalk.method({
  2670. selector: "testMinMax",
  2671. category: 'tests',
  2672. fn: function (){
  2673. var self=this;
  2674. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((2))._max_((5)),(5));
  2675. _st(self)._assert_equals_(_st((2))._min_((5)),(2));
  2676. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{}, smalltalk.NumberTest)})},
  2677. args: [],
  2678. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  2679. messageSends: ["assert:equals:", "max:", "min:"],
  2680. referencedClasses: []
  2681. }),
  2682. smalltalk.NumberTest);
  2683. smalltalk.addMethod(
  2684. "_testNegated",
  2685. smalltalk.method({
  2686. selector: "testNegated",
  2687. category: 'tests',
  2688. fn: function (){
  2689. var self=this;
  2690. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((3))._negated()).__eq((-3)));
  2691. _st(self)._assert_(_st(_st((-3))._negated()).__eq((3)));
  2692. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{}, smalltalk.NumberTest)})},
  2693. args: [],
  2694. source: "testNegated\x0a\x09self assert: 3 negated = -3.\x0a\x09self assert: -3 negated = 3",
  2695. messageSends: ["assert:", "=", "negated"],
  2696. referencedClasses: []
  2697. }),
  2698. smalltalk.NumberTest);
  2699. smalltalk.addMethod(
  2700. "_testPrintShowingDecimalPlaces",
  2701. smalltalk.method({
  2702. selector: "testPrintShowingDecimalPlaces",
  2703. category: 'tests',
  2704. fn: function (){
  2705. var self=this;
  2706. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("23.00",_st((23))._printShowingDecimalPlaces_((2)));
  2707. _st(self)._assert_equals_("23.57",_st((23.5698))._printShowingDecimalPlaces_((2)));
  2708. _st(self)._assert_equals_("-234.56700",_st(_st((234.567))._negated())._printShowingDecimalPlaces_((5)));
  2709. _st(self)._assert_equals_("23",_st((23.4567))._printShowingDecimalPlaces_((0)));
  2710. _st(self)._assert_equals_("24",_st((23.5567))._printShowingDecimalPlaces_((0)));
  2711. _st(self)._assert_equals_("-23",_st(_st((23.4567))._negated())._printShowingDecimalPlaces_((0)));
  2712. _st(self)._assert_equals_("-24",_st(_st((23.5567))._negated())._printShowingDecimalPlaces_((0)));
  2713. _st(self)._assert_equals_("100000000.0",_st((100000000))._printShowingDecimalPlaces_((1)));
  2714. _st(self)._assert_equals_("0.98000",_st((0.98))._printShowingDecimalPlaces_((5)));
  2715. _st(self)._assert_equals_("-0.98",_st(_st((0.98))._negated())._printShowingDecimalPlaces_((2)));
  2716. _st(self)._assert_equals_("2.57",_st((2.567))._printShowingDecimalPlaces_((2)));
  2717. _st(self)._assert_equals_("-2.57",_st((-2.567))._printShowingDecimalPlaces_((2)));
  2718. _st(self)._assert_equals_("0.00",_st((0))._printShowingDecimalPlaces_((2)));
  2719. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{}, smalltalk.NumberTest)})},
  2720. args: [],
  2721. source: "testPrintShowingDecimalPlaces\x0a\x09self assert: '23.00' equals: (23 printShowingDecimalPlaces: 2).\x0a\x09self assert: '23.57' equals: (23.5698 printShowingDecimalPlaces: 2).\x0a\x09self assert: '-234.56700' equals:( 234.567 negated printShowingDecimalPlaces: 5).\x0a\x09self assert: '23' equals: (23.4567 printShowingDecimalPlaces: 0).\x0a\x09self assert: '24' equals: (23.5567 printShowingDecimalPlaces: 0).\x0a\x09self assert: '-23' equals: (23.4567 negated printShowingDecimalPlaces: 0).\x0a\x09self assert: '-24' equals: (23.5567 negated printShowingDecimalPlaces: 0).\x0a\x09self assert: '100000000.0' equals: (100000000 printShowingDecimalPlaces: 1).\x0a\x09self assert: '0.98000' equals: (0.98 printShowingDecimalPlaces: 5).\x0a\x09self assert: '-0.98' equals: (0.98 negated printShowingDecimalPlaces: 2).\x0a\x09self assert: '2.57' equals: (2.567 printShowingDecimalPlaces: 2).\x0a\x09self assert: '-2.57' equals: (-2.567 printShowingDecimalPlaces: 2).\x0a\x09self assert: '0.00' equals: (0 printShowingDecimalPlaces: 2).",
  2722. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  2723. referencedClasses: []
  2724. }),
  2725. smalltalk.NumberTest);
  2726. smalltalk.addMethod(
  2727. "_testRounded",
  2728. smalltalk.method({
  2729. selector: "testRounded",
  2730. category: 'tests',
  2731. fn: function (){
  2732. var self=this;
  2733. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((3))._rounded()).__eq((3)));
  2734. _st(self)._assert_(_st(_st((3.212))._rounded()).__eq((3)));
  2735. _st(self)._assert_(_st(_st((3.51))._rounded()).__eq((4)));
  2736. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{}, smalltalk.NumberTest)})},
  2737. args: [],
  2738. source: "testRounded\x0a\x09\x0a\x09self assert: 3 rounded = 3.\x0a\x09self assert: 3.212 rounded = 3.\x0a\x09self assert: 3.51 rounded = 4",
  2739. messageSends: ["assert:", "=", "rounded"],
  2740. referencedClasses: []
  2741. }),
  2742. smalltalk.NumberTest);
  2743. smalltalk.addMethod(
  2744. "_testSqrt",
  2745. smalltalk.method({
  2746. selector: "testSqrt",
  2747. category: 'tests',
  2748. fn: function (){
  2749. var self=this;
  2750. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((4))._sqrt()).__eq((2)));
  2751. _st(self)._assert_(_st(_st((16))._sqrt()).__eq((4)));
  2752. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{}, smalltalk.NumberTest)})},
  2753. args: [],
  2754. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt = 2.\x0a\x09self assert: 16 sqrt = 4",
  2755. messageSends: ["assert:", "=", "sqrt"],
  2756. referencedClasses: []
  2757. }),
  2758. smalltalk.NumberTest);
  2759. smalltalk.addMethod(
  2760. "_testSquared",
  2761. smalltalk.method({
  2762. selector: "testSquared",
  2763. category: 'tests',
  2764. fn: function (){
  2765. var self=this;
  2766. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((4))._squared()).__eq((16)));
  2767. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{}, smalltalk.NumberTest)})},
  2768. args: [],
  2769. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared = 16",
  2770. messageSends: ["assert:", "=", "squared"],
  2771. referencedClasses: []
  2772. }),
  2773. smalltalk.NumberTest);
  2774. smalltalk.addMethod(
  2775. "_testTimesRepeat",
  2776. smalltalk.method({
  2777. selector: "testTimesRepeat",
  2778. category: 'tests',
  2779. fn: function (){
  2780. var self=this;
  2781. var i;
  2782. return smalltalk.withContext(function($ctx1) { i=(0);
  2783. _st((0))._timesRepeat_((function(){
  2784. return smalltalk.withContext(function($ctx2) { i=_st(i).__plus((1));
  2785. return i;
  2786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2787. _st(self)._assert_equals_(i,(0));
  2788. _st((5))._timesRepeat_((function(){
  2789. return smalltalk.withContext(function($ctx2) { i=_st(i).__plus((1));
  2790. return i;
  2791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2792. _st(self)._assert_equals_(i,(5));
  2793. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i}, smalltalk.NumberTest)})},
  2794. args: [],
  2795. source: "testTimesRepeat\x0a\x09| i |\x0a\x0a\x09i := 0.\x0a\x090 timesRepeat: [i := i + 1].\x0a\x09self assert: i equals: 0.\x0a\x0a\x095 timesRepeat: [i := i + 1].\x0a\x09self assert: i equals: 5",
  2796. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  2797. referencedClasses: []
  2798. }),
  2799. smalltalk.NumberTest);
  2800. smalltalk.addMethod(
  2801. "_testTo",
  2802. smalltalk.method({
  2803. selector: "testTo",
  2804. category: 'tests',
  2805. fn: function (){
  2806. var self=this;
  2807. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((1))._to_((5)),[(1), (2), (3), (4), (5)]);
  2808. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{}, smalltalk.NumberTest)})},
  2809. args: [],
  2810. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  2811. messageSends: ["assert:equals:", "to:"],
  2812. referencedClasses: []
  2813. }),
  2814. smalltalk.NumberTest);
  2815. smalltalk.addMethod(
  2816. "_testToBy",
  2817. smalltalk.method({
  2818. selector: "testToBy",
  2819. category: 'tests',
  2820. fn: function (){
  2821. var self=this;
  2822. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((0))._to_by_((6),(2)),[(0), (2), (4), (6)]);
  2823. _st(self)._should_raise_((function(){
  2824. return smalltalk.withContext(function($ctx2) { return _st((1))._to_by_((4),(0));
  2825. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  2826. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{}, smalltalk.NumberTest)})},
  2827. args: [],
  2828. source: "testToBy\x0a\x09self assert: (0 to: 6 by: 2) equals: #(0 2 4 6).\x0a\x0a\x09self should: [1 to: 4 by: 0] raise: Error",
  2829. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  2830. referencedClasses: ["Error"]
  2831. }),
  2832. smalltalk.NumberTest);
  2833. smalltalk.addMethod(
  2834. "_testTruncated",
  2835. smalltalk.method({
  2836. selector: "testTruncated",
  2837. category: 'tests',
  2838. fn: function (){
  2839. var self=this;
  2840. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((3))._truncated()).__eq((3)));
  2841. _st(self)._assert_(_st(_st((3.212))._truncated()).__eq((3)));
  2842. _st(self)._assert_(_st(_st((3.51))._truncated()).__eq((3)));
  2843. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{}, smalltalk.NumberTest)})},
  2844. args: [],
  2845. source: "testTruncated\x0a\x09\x0a\x09self assert: 3 truncated = 3.\x0a\x09self assert: 3.212 truncated = 3.\x0a\x09self assert: 3.51 truncated = 3",
  2846. messageSends: ["assert:", "=", "truncated"],
  2847. referencedClasses: []
  2848. }),
  2849. smalltalk.NumberTest);
  2850. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  2851. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes."
  2852. smalltalk.addMethod(
  2853. "_foo",
  2854. smalltalk.method({
  2855. selector: "foo",
  2856. category: 'not yet classified',
  2857. fn: function (){
  2858. var self=this;
  2859. return smalltalk.withContext(function($ctx1) { var $1;
  2860. $1=self["@foo"];
  2861. return $1;
  2862. }, function($ctx1) {$ctx1.fill(self,"foo",{}, smalltalk.ObjectMock)})},
  2863. args: [],
  2864. source: "foo\x0a\x09^foo",
  2865. messageSends: [],
  2866. referencedClasses: []
  2867. }),
  2868. smalltalk.ObjectMock);
  2869. smalltalk.addMethod(
  2870. "_foo_",
  2871. smalltalk.method({
  2872. selector: "foo:",
  2873. category: 'not yet classified',
  2874. fn: function (anObject){
  2875. var self=this;
  2876. return smalltalk.withContext(function($ctx1) { self["@foo"]=anObject;
  2877. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject}, smalltalk.ObjectMock)})},
  2878. args: ["anObject"],
  2879. source: "foo: anObject\x0a\x09foo := anObject",
  2880. messageSends: [],
  2881. referencedClasses: []
  2882. }),
  2883. smalltalk.ObjectMock);
  2884. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2885. smalltalk.addMethod(
  2886. "_notDefined",
  2887. smalltalk.method({
  2888. selector: "notDefined",
  2889. category: 'tests',
  2890. fn: function (){
  2891. var self=this;
  2892. return smalltalk.withContext(function($ctx1) { return undefined;;
  2893. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{}, smalltalk.ObjectTest)})},
  2894. args: [],
  2895. source: "notDefined\x0a\x09<return undefined;>",
  2896. messageSends: [],
  2897. referencedClasses: []
  2898. }),
  2899. smalltalk.ObjectTest);
  2900. smalltalk.addMethod(
  2901. "_testBasicAccess",
  2902. smalltalk.method({
  2903. selector: "testBasicAccess",
  2904. category: 'tests',
  2905. fn: function (){
  2906. var self=this;
  2907. var o;
  2908. return smalltalk.withContext(function($ctx1) { o=_st((smalltalk.Object || Object))._new();
  2909. _st(o)._basicAt_put_("a",(1));
  2910. _st(self)._assert_equals_(_st(o)._basicAt_("a"),(1));
  2911. _st(self)._assert_equals_(_st(o)._basicAt_("b"),nil);
  2912. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o}, smalltalk.ObjectTest)})},
  2913. args: [],
  2914. source: "testBasicAccess\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'a' put: 1.\x0a\x09self assert: (o basicAt: 'a') equals: 1.\x0a\x09self assert: (o basicAt: 'b') equals: nil",
  2915. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  2916. referencedClasses: ["Object"]
  2917. }),
  2918. smalltalk.ObjectTest);
  2919. smalltalk.addMethod(
  2920. "_testBasicPerform",
  2921. smalltalk.method({
  2922. selector: "testBasicPerform",
  2923. category: 'tests',
  2924. fn: function (){
  2925. var self=this;
  2926. var o;
  2927. return smalltalk.withContext(function($ctx1) { o=_st((smalltalk.Object || Object))._new();
  2928. _st(o)._basicAt_put_("func",(function(){
  2929. return smalltalk.withContext(function($ctx2) { return "hello";
  2930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2931. _st(o)._basicAt_put_("func2",(function(a){
  2932. return smalltalk.withContext(function($ctx2) { return _st(a).__plus((1));
  2933. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}));
  2934. _st(self)._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  2935. _st(self)._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  2936. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o}, smalltalk.ObjectTest)})},
  2937. args: [],
  2938. source: "testBasicPerform\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'func' put: ['hello'].\x09\x0a\x09o basicAt: 'func2' put: [:a | a + 1].\x0a\x0a\x09self assert: (o basicPerform: 'func')\x09 equals: 'hello'.\x0a\x09self assert: (o basicPerform: 'func2' withArguments: #(3)) equals: 4",
  2939. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  2940. referencedClasses: ["Object"]
  2941. }),
  2942. smalltalk.ObjectTest);
  2943. smalltalk.addMethod(
  2944. "_testDNU",
  2945. smalltalk.method({
  2946. selector: "testDNU",
  2947. category: 'tests',
  2948. fn: function (){
  2949. var self=this;
  2950. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  2951. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Object || Object))._new())._foo();
  2952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2953. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{}, smalltalk.ObjectTest)})},
  2954. args: [],
  2955. source: "testDNU\x0a\x09self should: [Object new foo] raise: MessageNotUnderstood",
  2956. messageSends: ["should:raise:", "foo", "new"],
  2957. referencedClasses: ["Object", "MessageNotUnderstood"]
  2958. }),
  2959. smalltalk.ObjectTest);
  2960. smalltalk.addMethod(
  2961. "_testEquality",
  2962. smalltalk.method({
  2963. selector: "testEquality",
  2964. category: 'tests',
  2965. fn: function (){
  2966. var self=this;
  2967. var o;
  2968. return smalltalk.withContext(function($ctx1) { o=_st((smalltalk.Object || Object))._new();
  2969. _st(self)._deny_(_st(o).__eq(_st((smalltalk.Object || Object))._new()));
  2970. _st(self)._assert_(_st(o).__eq(o));
  2971. _st(self)._assert_(_st(_st(o)._yourself()).__eq(o));
  2972. _st(self)._assert_(_st(o).__eq(_st(o)._yourself()));
  2973. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o}, smalltalk.ObjectTest)})},
  2974. args: [],
  2975. source: "testEquality\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o = Object new.\x0a\x09self assert: o = o.\x0a\x09self assert: o yourself = o.\x0a\x09self assert: o = o yourself",
  2976. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  2977. referencedClasses: ["Object"]
  2978. }),
  2979. smalltalk.ObjectTest);
  2980. smalltalk.addMethod(
  2981. "_testHalt",
  2982. smalltalk.method({
  2983. selector: "testHalt",
  2984. category: 'tests',
  2985. fn: function (){
  2986. var self=this;
  2987. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  2988. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Object || Object))._new())._halt();
  2989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  2990. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{}, smalltalk.ObjectTest)})},
  2991. args: [],
  2992. source: "testHalt\x0a\x09self should: [Object new halt] raise: Error",
  2993. messageSends: ["should:raise:", "halt", "new"],
  2994. referencedClasses: ["Object", "Error"]
  2995. }),
  2996. smalltalk.ObjectTest);
  2997. smalltalk.addMethod(
  2998. "_testIdentity",
  2999. smalltalk.method({
  3000. selector: "testIdentity",
  3001. category: 'tests',
  3002. fn: function (){
  3003. var self=this;
  3004. var o;
  3005. return smalltalk.withContext(function($ctx1) { o=_st((smalltalk.Object || Object))._new();
  3006. _st(self)._deny_(_st(o).__eq_eq(_st((smalltalk.Object || Object))._new()));
  3007. _st(self)._assert_(_st(o).__eq_eq(o));
  3008. _st(self)._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  3009. _st(self)._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  3010. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o}, smalltalk.ObjectTest)})},
  3011. args: [],
  3012. source: "testIdentity\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o == Object new.\x0a\x09self assert: o == o.\x0a\x09self assert: o yourself == o.\x0a\x09self assert: o == o yourself",
  3013. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  3014. referencedClasses: ["Object"]
  3015. }),
  3016. smalltalk.ObjectTest);
  3017. smalltalk.addMethod(
  3018. "_testIfNil",
  3019. smalltalk.method({
  3020. selector: "testIfNil",
  3021. category: 'tests',
  3022. fn: function (){
  3023. var self=this;
  3024. return smalltalk.withContext(function($ctx1) { var $1,$4,$3,$2,$5,$8,$7,$6,$9,$12,$11,$10;
  3025. _st(self)._deny_(_st(_st((smalltalk.Object || Object))._new())._isNil());
  3026. $1=self;
  3027. $4=_st((smalltalk.Object || Object))._new();
  3028. if(($receiver = $4) == nil || $receiver == undefined){
  3029. $3=true;
  3030. } else {
  3031. $3=$4;
  3032. };
  3033. $2=_st($3).__eq(true);
  3034. _st($1)._deny_($2);
  3035. $5=self;
  3036. $8=_st((smalltalk.Object || Object))._new();
  3037. if(($receiver = $8) == nil || $receiver == undefined){
  3038. $7=$8;
  3039. } else {
  3040. $7=true;
  3041. };
  3042. $6=_st($7).__eq(true);
  3043. _st($5)._assert_($6);
  3044. $9=self;
  3045. $12=_st((smalltalk.Object || Object))._new();
  3046. if(($receiver = $12) == nil || $receiver == undefined){
  3047. $11=false;
  3048. } else {
  3049. $11=true;
  3050. };
  3051. $10=_st($11).__eq(true);
  3052. _st($9)._assert_($10);
  3053. _st(self)._assert_(_st(_st(_st((smalltalk.Object || Object))._new())._ifNotNil_ifNil_((function(){
  3054. return smalltalk.withContext(function($ctx2) { return true;
  3055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  3056. return smalltalk.withContext(function($ctx2) { return false;
  3057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq(true));
  3058. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{}, smalltalk.ObjectTest)})},
  3059. args: [],
  3060. source: "testIfNil\x0a\x09self deny: Object new isNil.\x0a\x09self deny: (Object new ifNil: [true]) = true.\x0a\x09self assert: (Object new ifNotNil: [true]) = true.\x0a\x0a\x09self assert: (Object new ifNil: [false] ifNotNil: [true]) = true.\x0a\x09self assert: (Object new ifNotNil: [true] ifNil: [false]) = true",
  3061. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  3062. referencedClasses: ["Object"]
  3063. }),
  3064. smalltalk.ObjectTest);
  3065. smalltalk.addMethod(
  3066. "_testInstVars",
  3067. smalltalk.method({
  3068. selector: "testInstVars",
  3069. category: 'tests',
  3070. fn: function (){
  3071. var self=this;
  3072. var o;
  3073. return smalltalk.withContext(function($ctx1) { o=_st((smalltalk.ObjectMock || ObjectMock))._new();
  3074. _st(self)._assert_equals_(_st(o)._instVarAt_(smalltalk.symbolFor("foo")),nil);
  3075. _st(o)._instVarAt_put_(smalltalk.symbolFor("foo"),(1));
  3076. _st(self)._assert_equals_(_st(o)._instVarAt_(smalltalk.symbolFor("foo")),(1));
  3077. _st(self)._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  3078. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o}, smalltalk.ObjectTest)})},
  3079. args: [],
  3080. source: "testInstVars\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: (o instVarAt: #foo) equals: nil.\x0a\x0a\x09o instVarAt: #foo put: 1.\x0a\x09self assert: (o instVarAt: #foo) equals: 1.\x0a\x09self assert: (o instVarAt: 'foo') equals: 1",
  3081. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  3082. referencedClasses: ["ObjectMock"]
  3083. }),
  3084. smalltalk.ObjectTest);
  3085. smalltalk.addMethod(
  3086. "_testNilUndefined",
  3087. smalltalk.method({
  3088. selector: "testNilUndefined",
  3089. category: 'tests',
  3090. fn: function (){
  3091. var self=this;
  3092. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(nil).__eq(_st(self)._notDefined()));
  3093. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{}, smalltalk.ObjectTest)})},
  3094. args: [],
  3095. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: nil = self notDefined",
  3096. messageSends: ["assert:", "=", "notDefined"],
  3097. referencedClasses: []
  3098. }),
  3099. smalltalk.ObjectTest);
  3100. smalltalk.addMethod(
  3101. "_testYourself",
  3102. smalltalk.method({
  3103. selector: "testYourself",
  3104. category: 'tests',
  3105. fn: function (){
  3106. var self=this;
  3107. var o;
  3108. return smalltalk.withContext(function($ctx1) { o=_st((smalltalk.ObjectMock || ObjectMock))._new();
  3109. _st(self)._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  3110. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o}, smalltalk.ObjectTest)})},
  3111. args: [],
  3112. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  3113. messageSends: ["new", "assert:", "==", "yourself"],
  3114. referencedClasses: ["ObjectMock"]
  3115. }),
  3116. smalltalk.ObjectTest);
  3117. smalltalk.addMethod(
  3118. "_testidentityHash",
  3119. smalltalk.method({
  3120. selector: "testidentityHash",
  3121. category: 'tests',
  3122. fn: function (){
  3123. var self=this;
  3124. var o1,o2;
  3125. return smalltalk.withContext(function($ctx1) { o1=_st((smalltalk.Object || Object))._new();
  3126. o2=_st((smalltalk.Object || Object))._new();
  3127. _st(self)._assert_(_st(_st(o1)._identityHash()).__eq_eq(_st(o1)._identityHash()));
  3128. _st(self)._deny_(_st(_st(o1)._identityHash()).__eq_eq(_st(o2)._identityHash()));
  3129. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2}, smalltalk.ObjectTest)})},
  3130. args: [],
  3131. source: "testidentityHash\x0a\x09| o1 o2 |\x0a\x09\x0a\x09o1 := Object new.\x0a\x09o2 := Object new.\x0a\x0a\x09self assert: o1 identityHash == o1 identityHash.\x0a\x09self deny: o1 identityHash == o2 identityHash",
  3132. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  3133. referencedClasses: ["Object"]
  3134. }),
  3135. smalltalk.ObjectTest);
  3136. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  3137. smalltalk.addMethod(
  3138. "_setUp",
  3139. smalltalk.method({
  3140. selector: "setUp",
  3141. category: 'running',
  3142. fn: function (){
  3143. var self=this;
  3144. return smalltalk.withContext(function($ctx1) { var $1,$2;
  3145. self["@backUpCommitPathJs"]=_st((smalltalk.Package || Package))._defaultCommitPathJs();
  3146. self["@backUpCommitPathSt"]=_st((smalltalk.Package || Package))._defaultCommitPathSt();
  3147. _st((smalltalk.Package || Package))._resetCommitPaths();
  3148. self["@zorkPackage"]=_st(_st((smalltalk.Package || Package))._new())._name_("Zork");
  3149. $1=_st((smalltalk.Package || Package))._new();
  3150. _st($1)._name_("Grul");
  3151. _st($1)._commitPathJs_("server/grul/js");
  3152. _st($1)._commitPathSt_("grul/st");
  3153. $2=_st($1)._yourself();
  3154. self["@grulPackage"]=$2;
  3155. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{}, smalltalk.PackageTest)})},
  3156. args: [],
  3157. source: "setUp\x0a\x09backUpCommitPathJs := Package defaultCommitPathJs.\x0a\x09backUpCommitPathSt := Package defaultCommitPathSt.\x0a\x0a\x09Package resetCommitPaths.\x0a\x0a\x09zorkPackage := Package new name: 'Zork'.\x0a\x09grulPackage := Package new \x0a\x09\x09\x09\x09\x09name: 'Grul';\x0a\x09\x09\x09\x09\x09commitPathJs: 'server/grul/js';\x0a\x09\x09\x09\x09\x09commitPathSt: 'grul/st';\x0a\x09\x09\x09\x09\x09yourself",
  3158. messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"],
  3159. referencedClasses: ["Package"]
  3160. }),
  3161. smalltalk.PackageTest);
  3162. smalltalk.addMethod(
  3163. "_tearDown",
  3164. smalltalk.method({
  3165. selector: "tearDown",
  3166. category: 'running',
  3167. fn: function (){
  3168. var self=this;
  3169. return smalltalk.withContext(function($ctx1) { var $1,$2;
  3170. $1=(smalltalk.Package || Package);
  3171. _st($1)._defaultCommitPathJs_(self["@backUpCommitPathJs"]);
  3172. $2=_st($1)._defaultCommitPathSt_(self["@backUpCommitPathSt"]);
  3173. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{}, smalltalk.PackageTest)})},
  3174. args: [],
  3175. source: "tearDown\x0a\x09 Package \x0a\x09\x09defaultCommitPathJs: backUpCommitPathJs;\x0a\x09\x09defaultCommitPathSt: backUpCommitPathSt",
  3176. messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"],
  3177. referencedClasses: ["Package"]
  3178. }),
  3179. smalltalk.PackageTest);
  3180. smalltalk.addMethod(
  3181. "_testGrulCommitPathJsShouldBeServerGrulJs",
  3182. smalltalk.method({
  3183. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  3184. category: 'tests',
  3185. fn: function (){
  3186. var self=this;
  3187. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("server/grul/js",_st(self["@grulPackage"])._commitPathJs());
  3188. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{}, smalltalk.PackageTest)})},
  3189. args: [],
  3190. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: 'server/grul/js' equals: grulPackage commitPathJs",
  3191. messageSends: ["assert:equals:", "commitPathJs"],
  3192. referencedClasses: []
  3193. }),
  3194. smalltalk.PackageTest);
  3195. smalltalk.addMethod(
  3196. "_testGrulCommitPathStShouldBeGrulSt",
  3197. smalltalk.method({
  3198. selector: "testGrulCommitPathStShouldBeGrulSt",
  3199. category: 'tests',
  3200. fn: function (){
  3201. var self=this;
  3202. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("grul/st",_st(self["@grulPackage"])._commitPathSt());
  3203. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{}, smalltalk.PackageTest)})},
  3204. args: [],
  3205. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: 'grul/st' equals: grulPackage commitPathSt",
  3206. messageSends: ["assert:equals:", "commitPathSt"],
  3207. referencedClasses: []
  3208. }),
  3209. smalltalk.PackageTest);
  3210. smalltalk.addMethod(
  3211. "_testZorkCommitPathJsShouldBeJs",
  3212. smalltalk.method({
  3213. selector: "testZorkCommitPathJsShouldBeJs",
  3214. category: 'tests',
  3215. fn: function (){
  3216. var self=this;
  3217. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("js",_st(self["@zorkPackage"])._commitPathJs());
  3218. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJs",{}, smalltalk.PackageTest)})},
  3219. args: [],
  3220. source: "testZorkCommitPathJsShouldBeJs\x0a\x09self assert: 'js' equals: zorkPackage commitPathJs",
  3221. messageSends: ["assert:equals:", "commitPathJs"],
  3222. referencedClasses: []
  3223. }),
  3224. smalltalk.PackageTest);
  3225. smalltalk.addMethod(
  3226. "_testZorkCommitPathStShouldBeSt",
  3227. smalltalk.method({
  3228. selector: "testZorkCommitPathStShouldBeSt",
  3229. category: 'tests',
  3230. fn: function (){
  3231. var self=this;
  3232. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("st",_st(self["@zorkPackage"])._commitPathSt());
  3233. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSt",{}, smalltalk.PackageTest)})},
  3234. args: [],
  3235. source: "testZorkCommitPathStShouldBeSt\x0a\x09self assert: 'st' equals: zorkPackage commitPathSt",
  3236. messageSends: ["assert:equals:", "commitPathSt"],
  3237. referencedClasses: []
  3238. }),
  3239. smalltalk.PackageTest);
  3240. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  3241. smalltalk.addMethod(
  3242. "_setUp",
  3243. smalltalk.method({
  3244. selector: "setUp",
  3245. category: 'running',
  3246. fn: function (){
  3247. var self=this;
  3248. return smalltalk.withContext(function($ctx1) { var $1,$2;
  3249. smalltalk.PackageTest.fn.prototype._setUp.apply(_st(self), []);
  3250. $1=(smalltalk.Package || Package);
  3251. _st($1)._defaultCommitPathJs_("javascripts/");
  3252. $2=_st($1)._defaultCommitPathSt_("smalltalk/");
  3253. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  3254. args: [],
  3255. source: "setUp\x0a\x09super setUp.\x0a\x0a\x09Package\x0a\x09\x09defaultCommitPathJs: 'javascripts/';\x0a\x09\x09defaultCommitPathSt: 'smalltalk/'.",
  3256. messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"],
  3257. referencedClasses: ["Package"]
  3258. }),
  3259. smalltalk.PackageWithDefaultCommitPathChangedTest);
  3260. smalltalk.addMethod(
  3261. "_testGrulCommitPathJsShouldBeServerGrulJs",
  3262. smalltalk.method({
  3263. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  3264. category: 'tests',
  3265. fn: function (){
  3266. var self=this;
  3267. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("server/grul/js",_st(self["@grulPackage"])._commitPathJs());
  3268. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  3269. args: [],
  3270. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: 'server/grul/js' equals: grulPackage commitPathJs",
  3271. messageSends: ["assert:equals:", "commitPathJs"],
  3272. referencedClasses: []
  3273. }),
  3274. smalltalk.PackageWithDefaultCommitPathChangedTest);
  3275. smalltalk.addMethod(
  3276. "_testGrulCommitPathStShouldBeGrulSt",
  3277. smalltalk.method({
  3278. selector: "testGrulCommitPathStShouldBeGrulSt",
  3279. category: 'tests',
  3280. fn: function (){
  3281. var self=this;
  3282. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("grul/st",_st(self["@grulPackage"])._commitPathSt());
  3283. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  3284. args: [],
  3285. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: 'grul/st' equals: grulPackage commitPathSt",
  3286. messageSends: ["assert:equals:", "commitPathSt"],
  3287. referencedClasses: []
  3288. }),
  3289. smalltalk.PackageWithDefaultCommitPathChangedTest);
  3290. smalltalk.addMethod(
  3291. "_testZorkCommitPathJsShouldBeJavascript",
  3292. smalltalk.method({
  3293. selector: "testZorkCommitPathJsShouldBeJavascript",
  3294. category: 'tests',
  3295. fn: function (){
  3296. var self=this;
  3297. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("javascripts/",_st(self["@zorkPackage"])._commitPathJs());
  3298. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJavascript",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  3299. args: [],
  3300. source: "testZorkCommitPathJsShouldBeJavascript\x0a\x09self assert: 'javascripts/' equals: zorkPackage commitPathJs",
  3301. messageSends: ["assert:equals:", "commitPathJs"],
  3302. referencedClasses: []
  3303. }),
  3304. smalltalk.PackageWithDefaultCommitPathChangedTest);
  3305. smalltalk.addMethod(
  3306. "_testZorkCommitPathStShouldBeSmalltalk",
  3307. smalltalk.method({
  3308. selector: "testZorkCommitPathStShouldBeSmalltalk",
  3309. category: 'tests',
  3310. fn: function (){
  3311. var self=this;
  3312. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_("smalltalk/",_st(self["@zorkPackage"])._commitPathSt());
  3313. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSmalltalk",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  3314. args: [],
  3315. source: "testZorkCommitPathStShouldBeSmalltalk\x0a\x09self assert: 'smalltalk/' equals: zorkPackage commitPathSt",
  3316. messageSends: ["assert:equals:", "commitPathSt"],
  3317. referencedClasses: []
  3318. }),
  3319. smalltalk.PackageWithDefaultCommitPathChangedTest);
  3320. smalltalk.addMethod(
  3321. "_shouldInheritSelectors",
  3322. smalltalk.method({
  3323. selector: "shouldInheritSelectors",
  3324. category: 'accessing',
  3325. fn: function (){
  3326. var self=this;
  3327. return smalltalk.withContext(function($ctx1) { return false;
  3328. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{}, smalltalk.PackageWithDefaultCommitPathChangedTest.klass)})},
  3329. args: [],
  3330. source: "shouldInheritSelectors\x0a\x09^ false",
  3331. messageSends: [],
  3332. referencedClasses: []
  3333. }),
  3334. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  3335. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3336. smalltalk.addMethod(
  3337. "_testAccessing",
  3338. smalltalk.method({
  3339. selector: "testAccessing",
  3340. category: 'tests',
  3341. fn: function (){
  3342. var self=this;
  3343. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st((smalltalk.Point || Point))._x_y_((3),(4)))._x(),(3));
  3344. _st(self)._assert_equals_(_st(_st((smalltalk.Point || Point))._x_y_((3),(4)))._y(),(4));
  3345. _st(self)._assert_equals_(_st(_st(_st((smalltalk.Point || Point))._new())._x_((3)))._x(),(3));
  3346. _st(self)._assert_equals_(_st(_st(_st((smalltalk.Point || Point))._new())._y_((4)))._y(),(4));
  3347. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{}, smalltalk.PointTest)})},
  3348. args: [],
  3349. source: "testAccessing\x0a\x09self assert: (Point x: 3 y: 4) x equals: 3.\x0a\x09self assert: (Point x: 3 y: 4) y equals: 4.\x0a\x09self assert: (Point new x: 3) x equals: 3.\x0a\x09self assert: (Point new y: 4) y equals: 4",
  3350. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  3351. referencedClasses: ["Point"]
  3352. }),
  3353. smalltalk.PointTest);
  3354. smalltalk.addMethod(
  3355. "_testArithmetic",
  3356. smalltalk.method({
  3357. selector: "testArithmetic",
  3358. category: 'tests',
  3359. fn: function (){
  3360. var self=this;
  3361. 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)));
  3362. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__plus(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((6),(8)));
  3363. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__minus(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((0),(0)));
  3364. _st(self)._assert_equals_(_st(_st((6)).__at((8))).__slash(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((2),(2)));
  3365. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{}, smalltalk.PointTest)})},
  3366. args: [],
  3367. source: "testArithmetic\x0a\x09self assert: 3@4 * (3@4 ) equals: (Point x: 9 y: 16).\x0a\x09self assert: 3@4 + (3@4 ) equals: (Point x: 6 y: 8).\x0a\x09self assert: 3@4 - (3@4 ) equals: (Point x: 0 y: 0).\x0a\x09self assert: 6@8 / (3@4 ) equals: (Point x: 2 y: 2)",
  3368. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  3369. referencedClasses: ["Point"]
  3370. }),
  3371. smalltalk.PointTest);
  3372. smalltalk.addMethod(
  3373. "_testAt",
  3374. smalltalk.method({
  3375. selector: "testAt",
  3376. category: 'tests',
  3377. fn: function (){
  3378. var self=this;
  3379. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((3)).__at((4)),_st((smalltalk.Point || Point))._x_y_((3),(4)));
  3380. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.PointTest)})},
  3381. args: [],
  3382. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  3383. messageSends: ["assert:equals:", "@", "x:y:"],
  3384. referencedClasses: ["Point"]
  3385. }),
  3386. smalltalk.PointTest);
  3387. smalltalk.addMethod(
  3388. "_testEgality",
  3389. smalltalk.method({
  3390. selector: "testEgality",
  3391. category: 'tests',
  3392. fn: function (){
  3393. var self=this;
  3394. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st((3)).__at((4))).__eq(_st((3)).__at((4))));
  3395. _st(self)._deny_(_st(_st((3)).__at((5))).__eq(_st((3)).__at((6))));
  3396. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{}, smalltalk.PointTest)})},
  3397. args: [],
  3398. source: "testEgality\x0a\x09self assert: 3@4 = (3@4).\x0a\x09self deny: 3@5 = (3@6)",
  3399. messageSends: ["assert:", "=", "@", "deny:"],
  3400. referencedClasses: []
  3401. }),
  3402. smalltalk.PointTest);
  3403. smalltalk.addMethod(
  3404. "_testTranslateBy",
  3405. smalltalk.method({
  3406. selector: "testTranslateBy",
  3407. category: 'tests',
  3408. fn: function (){
  3409. var self=this;
  3410. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st((3)).__at((4)),_st(_st((3)).__at((3)))._translateBy_(_st((0)).__at((1))));
  3411. _st(self)._assert_equals_(_st((3)).__at((2)),_st(_st((3)).__at((3)))._translateBy_(_st((0)).__at(_st((1))._negated())));
  3412. _st(self)._assert_equals_(_st((5)).__at((6)),_st(_st((3)).__at((3)))._translateBy_(_st((2)).__at((3))));
  3413. _st(self)._assert_equals_(_st((0)).__at((3)),_st(_st((3)).__at((3)))._translateBy_(_st(_st((3))._negated()).__at((0))));
  3414. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{}, smalltalk.PointTest)})},
  3415. args: [],
  3416. source: "testTranslateBy\x0a\x09self assert: 3@4 equals: (3@3 translateBy: 0@1).\x0a\x09self assert: 3@2 equals: (3@3 translateBy: 0@1 negated).\x0a\x09self assert: 5@6 equals: (3@3 translateBy: 2@3).\x0a\x09self assert: 0@3 equals: (3@3 translateBy: 3 negated @0).",
  3417. messageSends: ["assert:equals:", "@", "translateBy:", "negated"],
  3418. referencedClasses: []
  3419. }),
  3420. smalltalk.PointTest);
  3421. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3422. smalltalk.addMethod(
  3423. "_textNext",
  3424. smalltalk.method({
  3425. selector: "textNext",
  3426. category: 'tests',
  3427. fn: function (){
  3428. var self=this;
  3429. return smalltalk.withContext(function($ctx1) { _st((10000))._timesRepeat_((function(){
  3430. var current,next;
  3431. return smalltalk.withContext(function($ctx2) { next=_st(_st((smalltalk.Random || Random))._new())._next();
  3432. next;
  3433. _st(self)._assert_(_st(next).__gt_eq((0)));
  3434. _st(self)._assert_(_st(next).__lt((1)));
  3435. _st(self)._deny_(_st(current).__eq(next));
  3436. return _st(next).__eq(current);
  3437. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1)})}));
  3438. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{}, smalltalk.RandomTest)})},
  3439. args: [],
  3440. source: "textNext\x0a\x0a\x0910000 timesRepeat: [\x0a\x09\x09\x09| current next | \x0a\x09\x09\x09next := Random new next.\x0a\x09\x09\x09self assert: (next >= 0).\x0a\x09\x09\x09self assert: (next < 1).\x0a\x09\x09\x09self deny: current = next.\x0a\x09\x09\x09next = current]",
  3441. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  3442. referencedClasses: ["Random"]
  3443. }),
  3444. smalltalk.RandomTest);
  3445. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3446. smalltalk.addMethod(
  3447. "_testAddRemove",
  3448. smalltalk.method({
  3449. selector: "testAddRemove",
  3450. category: 'tests',
  3451. fn: function (){
  3452. var self=this;
  3453. var set;
  3454. return smalltalk.withContext(function($ctx1) { set=_st((smalltalk.Set || Set))._new();
  3455. _st(self)._assert_(_st(set)._isEmpty());
  3456. _st(set)._add_((3));
  3457. _st(self)._assert_(_st(set)._includes_((3)));
  3458. _st(set)._add_((5));
  3459. _st(self)._assert_(_st(set)._includes_((5)));
  3460. _st(set)._remove_((3));
  3461. _st(self)._deny_(_st(set)._includes_((3)));
  3462. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set}, smalltalk.SetTest)})},
  3463. args: [],
  3464. source: "testAddRemove\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09\x0a\x09self assert: set isEmpty.\x0a\x0a\x09set add: 3.\x0a\x09self assert: (set includes: 3).\x0a\x0a\x09set add: 5.\x0a\x09self assert: (set includes: 5).\x0a\x0a\x09set remove: 3.\x0a\x09self deny: (set includes: 3)",
  3465. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  3466. referencedClasses: ["Set"]
  3467. }),
  3468. smalltalk.SetTest);
  3469. smalltalk.addMethod(
  3470. "_testAt",
  3471. smalltalk.method({
  3472. selector: "testAt",
  3473. category: 'tests',
  3474. fn: function (){
  3475. var self=this;
  3476. return smalltalk.withContext(function($ctx1) { _st(self)._should_raise_((function(){
  3477. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Set || Set))._new())._at_put_((1),(2));
  3478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  3479. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.SetTest)})},
  3480. args: [],
  3481. source: "testAt\x0a\x09self should: [Set new at: 1 put: 2] raise: Error",
  3482. messageSends: ["should:raise:", "at:put:", "new"],
  3483. referencedClasses: ["Set", "Error"]
  3484. }),
  3485. smalltalk.SetTest);
  3486. smalltalk.addMethod(
  3487. "_testPrintString",
  3488. smalltalk.method({
  3489. selector: "testPrintString",
  3490. category: 'tests',
  3491. fn: function (){
  3492. var self=this;
  3493. var set;
  3494. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  3495. set=_st((smalltalk.Set || Set))._new();
  3496. _st(self)._assert_equals_("a Set ()",_st(set)._printString());
  3497. $1=set;
  3498. _st($1)._add_((1));
  3499. $2=_st($1)._add_((3));
  3500. _st(self)._assert_equals_("a Set (1 3)",_st(set)._printString());
  3501. _st(set)._add_("foo");
  3502. _st(self)._assert_equals_("a Set (1 3 'foo')",_st(set)._printString());
  3503. $3=set;
  3504. _st($3)._remove_((1));
  3505. $4=_st($3)._remove_((3));
  3506. _st(self)._assert_equals_("a Set ('foo')",_st(set)._printString());
  3507. _st(set)._add_((3));
  3508. _st(self)._assert_equals_("a Set ('foo' 3)",_st(set)._printString());
  3509. _st(set)._add_((3));
  3510. _st(self)._assert_equals_("a Set ('foo' 3)",_st(set)._printString());
  3511. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set}, smalltalk.SetTest)})},
  3512. args: [],
  3513. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: 'a Set ()' equals: ( set printString ).\x0a\x09set add: 1; add: 3.\x0a\x09self assert: 'a Set (1 3)' equals: ( set printString ).\x0a\x09set add: 'foo'.\x0a\x09self assert: 'a Set (1 3 ''foo'')' equals: ( set printString ).\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: 'a Set (''foo'')' equals: ( set printString ).\x0a\x09set add: 3.\x0a\x09self assert: 'a Set (''foo'' 3)' equals: ( set printString ).\x0a\x09set add: 3.\x0a\x09self assert: 'a Set (''foo'' 3)' equals: ( set printString ).",
  3514. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  3515. referencedClasses: ["Set"]
  3516. }),
  3517. smalltalk.SetTest);
  3518. smalltalk.addMethod(
  3519. "_testSize",
  3520. smalltalk.method({
  3521. selector: "testSize",
  3522. category: 'tests',
  3523. fn: function (){
  3524. var self=this;
  3525. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._new())._size(),(0));
  3526. _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._withAll_([(1), (2), (3), (4)]))._size(),(4));
  3527. _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._withAll_([(1), (1), (1), (1)]))._size(),(1));
  3528. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{}, smalltalk.SetTest)})},
  3529. args: [],
  3530. source: "testSize\x0a\x09self assert: Set new size equals: 0.\x0a\x09self assert: (Set withAll: #(1 2 3 4)) size equals: 4.\x0a\x09self assert: (Set withAll: #(1 1 1 1)) size equals: 1",
  3531. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  3532. referencedClasses: ["Set"]
  3533. }),
  3534. smalltalk.SetTest);
  3535. smalltalk.addMethod(
  3536. "_testUnicity",
  3537. smalltalk.method({
  3538. selector: "testUnicity",
  3539. category: 'tests',
  3540. fn: function (){
  3541. var self=this;
  3542. var set;
  3543. return smalltalk.withContext(function($ctx1) { set=_st((smalltalk.Set || Set))._new();
  3544. _st(set)._add_((21));
  3545. _st(set)._add_("hello");
  3546. _st(set)._add_((21));
  3547. _st(self)._assert_(_st(_st(set)._size()).__eq((2)));
  3548. _st(set)._add_("hello");
  3549. _st(self)._assert_(_st(_st(set)._size()).__eq((2)));
  3550. _st(self)._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  3551. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set}, smalltalk.SetTest)})},
  3552. args: [],
  3553. source: "testUnicity\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09set add: 21.\x0a\x09set add: 'hello'.\x0a\x0a\x09set add: 21.\x0a\x09self assert: set size = 2.\x0a\x09\x0a\x09set add: 'hello'.\x0a\x09self assert: set size = 2.\x0a\x0a\x09self assert: set asArray equals: #(21 'hello')",
  3554. messageSends: ["new", "add:", "assert:", "=", "size", "assert:equals:", "asArray"],
  3555. referencedClasses: ["Set"]
  3556. }),
  3557. smalltalk.SetTest);
  3558. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3559. smalltalk.addMethod(
  3560. "_testCopying",
  3561. smalltalk.method({
  3562. selector: "testCopying",
  3563. category: 'tests',
  3564. fn: function (){
  3565. var self=this;
  3566. return smalltalk.withContext(function($ctx1) { _st(self)._assert_equals_(_st(nil)._copy(),nil);
  3567. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{}, smalltalk.UndefinedTest)})},
  3568. args: [],
  3569. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  3570. messageSends: ["assert:equals:", "copy"],
  3571. referencedClasses: []
  3572. }),
  3573. smalltalk.UndefinedTest);
  3574. smalltalk.addMethod(
  3575. "_testDeepCopy",
  3576. smalltalk.method({
  3577. selector: "testDeepCopy",
  3578. category: 'tests',
  3579. fn: function (){
  3580. var self=this;
  3581. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(_st(nil)._deepCopy()).__eq(nil));
  3582. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{}, smalltalk.UndefinedTest)})},
  3583. args: [],
  3584. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  3585. messageSends: ["assert:", "=", "deepCopy"],
  3586. referencedClasses: []
  3587. }),
  3588. smalltalk.UndefinedTest);
  3589. smalltalk.addMethod(
  3590. "_testIfNil",
  3591. smalltalk.method({
  3592. selector: "testIfNil",
  3593. category: 'tests',
  3594. fn: function (){
  3595. var self=this;
  3596. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$5,$4,$6,$7;
  3597. $1=self;
  3598. if(($receiver = nil) == nil || $receiver == undefined){
  3599. $2=true;
  3600. } else {
  3601. $2=nil;
  3602. };
  3603. _st($1)._assert_equals_($2,true);
  3604. $3=self;
  3605. if(($receiver = nil) == nil || $receiver == undefined){
  3606. $5=nil;
  3607. } else {
  3608. $5=true;
  3609. };
  3610. $4=_st($5).__eq(true);
  3611. _st($3)._deny_($4);
  3612. $6=self;
  3613. if(($receiver = nil) == nil || $receiver == undefined){
  3614. $7=true;
  3615. } else {
  3616. $7=false;
  3617. };
  3618. _st($6)._assert_equals_($7,true);
  3619. _st(self)._deny_(_st(_st(nil)._ifNotNil_ifNil_((function(){
  3620. return smalltalk.withContext(function($ctx2) { return true;
  3621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  3622. return smalltalk.withContext(function($ctx2) { return false;
  3623. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq(true));
  3624. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{}, smalltalk.UndefinedTest)})},
  3625. args: [],
  3626. source: "testIfNil\x0a\x09self assert: (nil ifNil: [true]) equals: true.\x0a\x09self deny: (nil ifNotNil: [true]) = true.\x0a\x09self assert: (nil ifNil: [true] ifNotNil: [false]) equals: true.\x0a\x09self deny: (nil ifNotNil: [true] ifNil: [false]) = true",
  3627. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  3628. referencedClasses: []
  3629. }),
  3630. smalltalk.UndefinedTest);
  3631. smalltalk.addMethod(
  3632. "_testIsNil",
  3633. smalltalk.method({
  3634. selector: "testIsNil",
  3635. category: 'tests',
  3636. fn: function (){
  3637. var self=this;
  3638. return smalltalk.withContext(function($ctx1) { _st(self)._assert_(_st(nil)._isNil());
  3639. _st(self)._deny_(_st(nil)._notNil());
  3640. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{}, smalltalk.UndefinedTest)})},
  3641. args: [],
  3642. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  3643. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  3644. referencedClasses: []
  3645. }),
  3646. smalltalk.UndefinedTest);