1
0

Kernel-Tests.js 176 KB

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