Kernel-Tests.js 179 KB

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