Kernel-Tests.js 178 KB

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