Kernel-Tests.js 196 KB

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