Kernel-Tests.js 202 KB

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