Kernel-Tests.js 192 KB

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