Kernel-Tests.js 191 KB

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