Kernel-Tests.js 265 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "testHandlesAnnouncement",
  8. category: 'tests',
  9. fn: function (){
  10. var self=this;
  11. var subscription,announcementClass1,announcementClass2,classBuilder;
  12. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  16. return smalltalk.withContext(function($ctx1) {
  17. var $1,$2,$3,$4;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. $1=_st($AnnouncementSubscription())._new();
  22. subscription=_st($1)._announcementClass_($SystemAnnouncement());
  23. $2=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  24. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  25. self._assert_equals_($2,true);
  26. $ctx1.sendIdx["assert:equals:"]=1;
  27. $3=_st(subscription)._handlesAnnouncement_(announcementClass1);
  28. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  29. self._assert_equals_($3,true);
  30. $ctx1.sendIdx["assert:equals:"]=2;
  31. $4=_st(subscription)._handlesAnnouncement_($Object());
  32. self._assert_equals_($4,false);
  33. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  34. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},smalltalk.AnnouncementSubscriptionTest)})},
  35. args: [],
  36. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  37. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  38. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  39. }),
  40. smalltalk.AnnouncementSubscriptionTest);
  41. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  42. smalltalk.addMethod(
  43. smalltalk.method({
  44. selector: "testCanClearInterval",
  45. category: 'tests',
  46. fn: function (){
  47. var self=this;
  48. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  49. return smalltalk.withContext(function($ctx1) {
  50. self._shouldnt_raise_((function(){
  51. return smalltalk.withContext(function($ctx2) {
  52. return _st(_st((function(){
  53. return smalltalk.withContext(function($ctx3) {
  54. return _st(_st($Error())._new())._signal();
  55. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  56. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  57. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  58. args: [],
  59. source: "testCanClearInterval\x0a\x09self shouldnt: [([Error new signal] valueWithInterval: 0) clearInterval] raise: Error",
  60. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  61. referencedClasses: ["Error"]
  62. }),
  63. smalltalk.BlockClosureTest);
  64. smalltalk.addMethod(
  65. smalltalk.method({
  66. selector: "testCanClearTimeout",
  67. category: 'tests',
  68. fn: function (){
  69. var self=this;
  70. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  71. return smalltalk.withContext(function($ctx1) {
  72. self._shouldnt_raise_((function(){
  73. return smalltalk.withContext(function($ctx2) {
  74. return _st(_st((function(){
  75. return smalltalk.withContext(function($ctx3) {
  76. return _st(_st($Error())._new())._signal();
  77. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  78. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  79. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  80. args: [],
  81. source: "testCanClearTimeout\x0a\x09self shouldnt: [([Error new signal] valueWithTimeout: 0) clearTimeout] raise: Error",
  82. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  83. referencedClasses: ["Error"]
  84. }),
  85. smalltalk.BlockClosureTest);
  86. smalltalk.addMethod(
  87. smalltalk.method({
  88. selector: "testCompiledSource",
  89. category: 'tests',
  90. fn: function (){
  91. var self=this;
  92. return smalltalk.withContext(function($ctx1) {
  93. self._assert_(_st(_st((function(){
  94. return smalltalk.withContext(function($ctx2) {
  95. return (1).__plus((1));
  96. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  97. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  98. args: [],
  99. source: "testCompiledSource\x0a\x09self assert: ([1+1] compiledSource includesSubString: 'function')",
  100. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  101. referencedClasses: []
  102. }),
  103. smalltalk.BlockClosureTest);
  104. smalltalk.addMethod(
  105. smalltalk.method({
  106. selector: "testCurrySelf",
  107. category: 'tests',
  108. fn: function (){
  109. var self=this;
  110. var curriedMethod,array;
  111. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  112. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  113. return smalltalk.withContext(function($ctx1) {
  114. curriedMethod=_st(_st((function(selfarg,x){
  115. return smalltalk.withContext(function($ctx2) {
  116. return _st(selfarg)._at_(x);
  117. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  118. array=[(3), (1), (4)];
  119. _st(_st($ClassBuilder())._new())._installMethod_forClass_category_(curriedMethod,$Array(),"**test helper");
  120. _st((function(){
  121. return smalltalk.withContext(function($ctx2) {
  122. return self._assert_equals_(_st(array)._foo_((2)),(1));
  123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  124. return smalltalk.withContext(function($ctx2) {
  125. return _st($Array())._removeCompiledMethod_(curriedMethod);
  126. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  127. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  128. args: [],
  129. 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 ]",
  130. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:category:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  131. referencedClasses: ["ClassBuilder", "Array"]
  132. }),
  133. smalltalk.BlockClosureTest);
  134. smalltalk.addMethod(
  135. smalltalk.method({
  136. selector: "testEnsure",
  137. category: 'tests',
  138. fn: function (){
  139. var self=this;
  140. return smalltalk.withContext(function($ctx1) {
  141. self._assert_equals_(_st((function(){
  142. return smalltalk.withContext(function($ctx2) {
  143. return (3);
  144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  145. return smalltalk.withContext(function($ctx2) {
  146. return (4);
  147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  148. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  149. args: [],
  150. source: "testEnsure\x0a\x09self assert: ([3] ensure: [4]) equals: 3",
  151. messageSends: ["assert:equals:", "ensure:"],
  152. referencedClasses: []
  153. }),
  154. smalltalk.BlockClosureTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testEnsureRaises",
  158. category: 'tests',
  159. fn: function (){
  160. var self=this;
  161. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  162. return smalltalk.withContext(function($ctx1) {
  163. self._should_raise_((function(){
  164. return smalltalk.withContext(function($ctx2) {
  165. return _st((function(){
  166. return smalltalk.withContext(function($ctx3) {
  167. return _st(_st($Error())._new())._signal();
  168. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  169. return smalltalk.withContext(function($ctx3) {
  170. return true;
  171. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  173. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  174. args: [],
  175. source: "testEnsureRaises\x0a\x09self should: [[Error new signal] ensure: [true]] raise: Error",
  176. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  177. referencedClasses: ["Error"]
  178. }),
  179. smalltalk.BlockClosureTest);
  180. smalltalk.addMethod(
  181. smalltalk.method({
  182. selector: "testExceptionSemantics",
  183. category: 'tests',
  184. fn: function (){
  185. var self=this;
  186. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  187. return smalltalk.withContext(function($ctx1) {
  188. self._timeout_((100));
  189. _st(self._async_((function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return _st((function(){
  192. return smalltalk.withContext(function($ctx3) {
  193. self._assert_(true);
  194. _st($Error())._signal();
  195. self._deny_(true);
  196. return self._finished();
  197. $ctx3.sendIdx["finished"]=1;
  198. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  199. return smalltalk.withContext(function($ctx3) {
  200. return self._finished();
  201. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  202. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  203. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  204. args: [],
  205. 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",
  206. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  207. referencedClasses: ["Error"]
  208. }),
  209. smalltalk.BlockClosureTest);
  210. smalltalk.addMethod(
  211. smalltalk.method({
  212. selector: "testNewWithValues",
  213. category: 'tests',
  214. fn: function (){
  215. var self=this;
  216. return smalltalk.withContext(function($ctx1) {
  217. function theTestPrototype() {this.name = "theTestPrototype";}
  218. function theTestConstructor(arg1, arg2, arg3) {}
  219. theTestConstructor.prototype = new theTestPrototype;
  220. var theWrappedConstructor = _st(theTestConstructor);
  221. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3]);
  222. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  223. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  224. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  225. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  226. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  227. args: [],
  228. source: "testNewWithValues\x0a<\x0a\x09function theTestPrototype() {this.name = \x22theTestPrototype\x22;}\x0a\x09function theTestConstructor(arg1, arg2, arg3) {}\x0a\x09theTestConstructor.prototype = new theTestPrototype;\x0a\x0a\x09var theWrappedConstructor = _st(theTestConstructor);\x0a\x09var theResult = theWrappedConstructor._newWithValues_([1, 2, 3]);\x0a\x09self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}\x0a\x09self._should_raise_(_st(constructionShouldFail), smalltalk.Error);\x0a>",
  229. messageSends: [],
  230. referencedClasses: []
  231. }),
  232. smalltalk.BlockClosureTest);
  233. smalltalk.addMethod(
  234. smalltalk.method({
  235. selector: "testNumArgs",
  236. category: 'tests',
  237. fn: function (){
  238. var self=this;
  239. return smalltalk.withContext(function($ctx1) {
  240. var $1,$2;
  241. $1=_st((function(){
  242. return smalltalk.withContext(function($ctx2) {
  243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  244. $ctx1.sendIdx["numArgs"]=1;
  245. self._assert_equals_($1,(0));
  246. $ctx1.sendIdx["assert:equals:"]=1;
  247. $2=_st((function(a,b){
  248. return smalltalk.withContext(function($ctx2) {
  249. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs();
  250. self._assert_equals_($2,(2));
  251. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  252. args: [],
  253. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [:a :b | ] numArgs equals: 2",
  254. messageSends: ["assert:equals:", "numArgs"],
  255. referencedClasses: []
  256. }),
  257. smalltalk.BlockClosureTest);
  258. smalltalk.addMethod(
  259. smalltalk.method({
  260. selector: "testOnDo",
  261. category: 'tests',
  262. fn: function (){
  263. var self=this;
  264. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  265. return smalltalk.withContext(function($ctx1) {
  266. self._assert_(_st((function(){
  267. return smalltalk.withContext(function($ctx2) {
  268. return _st(_st($Error())._new())._signal();
  269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  270. return smalltalk.withContext(function($ctx2) {
  271. return true;
  272. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  273. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  274. args: [],
  275. source: "testOnDo\x0a\x09self assert: ([Error new signal] on: Error do: [:ex | true])",
  276. messageSends: ["assert:", "on:do:", "signal", "new"],
  277. referencedClasses: ["Error"]
  278. }),
  279. smalltalk.BlockClosureTest);
  280. smalltalk.addMethod(
  281. smalltalk.method({
  282. selector: "testValue",
  283. category: 'tests',
  284. fn: function (){
  285. var self=this;
  286. return smalltalk.withContext(function($ctx1) {
  287. var $1,$2;
  288. $1=_st((function(){
  289. return smalltalk.withContext(function($ctx2) {
  290. return (1).__plus((1));
  291. $ctx2.sendIdx["+"]=1;
  292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  293. $ctx1.sendIdx["value"]=1;
  294. self._assert_equals_($1,(2));
  295. $ctx1.sendIdx["assert:equals:"]=1;
  296. self._assert_equals_(_st((function(x){
  297. return smalltalk.withContext(function($ctx2) {
  298. return _st(x).__plus((1));
  299. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  300. $ctx1.sendIdx["assert:equals:"]=2;
  301. self._assert_equals_(_st((function(x,y){
  302. return smalltalk.withContext(function($ctx2) {
  303. return _st(x).__star(y);
  304. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  305. $ctx1.sendIdx["assert:equals:"]=3;
  306. $2=_st((function(a,b,c){
  307. return smalltalk.withContext(function($ctx2) {
  308. return (1);
  309. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value();
  310. self._assert_equals_($2,(1));
  311. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  312. args: [],
  313. 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",
  314. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  315. referencedClasses: []
  316. }),
  317. smalltalk.BlockClosureTest);
  318. smalltalk.addMethod(
  319. smalltalk.method({
  320. selector: "testValueWithPossibleArguments",
  321. category: 'tests',
  322. fn: function (){
  323. var self=this;
  324. return smalltalk.withContext(function($ctx1) {
  325. var $1,$2,$3;
  326. $1=_st((function(){
  327. return smalltalk.withContext(function($ctx2) {
  328. return (1);
  329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  330. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  331. self._assert_equals_($1,(1));
  332. $ctx1.sendIdx["assert:equals:"]=1;
  333. $2=_st((function(a){
  334. return smalltalk.withContext(function($ctx2) {
  335. return _st(a).__plus((4));
  336. $ctx2.sendIdx["+"]=1;
  337. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  338. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  339. self._assert_equals_($2,(7));
  340. $ctx1.sendIdx["assert:equals:"]=2;
  341. $3=_st((function(a,b){
  342. return smalltalk.withContext(function($ctx2) {
  343. return _st(a).__plus(b);
  344. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]);
  345. self._assert_equals_($3,(7));
  346. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  347. args: [],
  348. 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.",
  349. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  350. referencedClasses: []
  351. }),
  352. smalltalk.BlockClosureTest);
  353. smalltalk.addMethod(
  354. smalltalk.method({
  355. selector: "testWhileFalse",
  356. category: 'tests',
  357. fn: function (){
  358. var self=this;
  359. var i;
  360. return smalltalk.withContext(function($ctx1) {
  361. i=(0);
  362. _st((function(){
  363. return smalltalk.withContext(function($ctx2) {
  364. return _st(i).__gt((5));
  365. $ctx2.sendIdx[">"]=1;
  366. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  367. return smalltalk.withContext(function($ctx2) {
  368. i=_st(i).__plus((1));
  369. $ctx2.sendIdx["+"]=1;
  370. return i;
  371. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  372. self._assert_equals_(i,(6));
  373. $ctx1.sendIdx["assert:equals:"]=1;
  374. i=(0);
  375. _st((function(){
  376. return smalltalk.withContext(function($ctx2) {
  377. i=_st(i).__plus((1));
  378. i;
  379. return _st(i).__gt((5));
  380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  381. self._assert_equals_(i,(6));
  382. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  383. args: [],
  384. 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",
  385. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  386. referencedClasses: []
  387. }),
  388. smalltalk.BlockClosureTest);
  389. smalltalk.addMethod(
  390. smalltalk.method({
  391. selector: "testWhileTrue",
  392. category: 'tests',
  393. fn: function (){
  394. var self=this;
  395. var i;
  396. return smalltalk.withContext(function($ctx1) {
  397. i=(0);
  398. _st((function(){
  399. return smalltalk.withContext(function($ctx2) {
  400. return _st(i).__lt((5));
  401. $ctx2.sendIdx["<"]=1;
  402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  403. return smalltalk.withContext(function($ctx2) {
  404. i=_st(i).__plus((1));
  405. $ctx2.sendIdx["+"]=1;
  406. return i;
  407. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  408. self._assert_equals_(i,(5));
  409. $ctx1.sendIdx["assert:equals:"]=1;
  410. i=(0);
  411. _st((function(){
  412. return smalltalk.withContext(function($ctx2) {
  413. i=_st(i).__plus((1));
  414. i;
  415. return _st(i).__lt((5));
  416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  417. self._assert_equals_(i,(5));
  418. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  419. args: [],
  420. 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",
  421. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  422. referencedClasses: []
  423. }),
  424. smalltalk.BlockClosureTest);
  425. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  426. smalltalk.addMethod(
  427. smalltalk.method({
  428. selector: "testEquality",
  429. category: 'tests',
  430. fn: function (){
  431. var self=this;
  432. return smalltalk.withContext(function($ctx1) {
  433. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$13,$11;
  434. $1=(0).__eq(false);
  435. $ctx1.sendIdx["="]=1;
  436. self._deny_($1);
  437. $ctx1.sendIdx["deny:"]=1;
  438. $2=false.__eq((0));
  439. $ctx1.sendIdx["="]=2;
  440. self._deny_($2);
  441. $ctx1.sendIdx["deny:"]=2;
  442. $3="".__eq(false);
  443. $ctx1.sendIdx["="]=3;
  444. self._deny_($3);
  445. $ctx1.sendIdx["deny:"]=3;
  446. $4=false.__eq("");
  447. $ctx1.sendIdx["="]=4;
  448. self._deny_($4);
  449. $ctx1.sendIdx["deny:"]=4;
  450. $5=true.__eq(true);
  451. $ctx1.sendIdx["="]=5;
  452. self._assert_($5);
  453. $ctx1.sendIdx["assert:"]=1;
  454. $6=false.__eq(true);
  455. $ctx1.sendIdx["="]=6;
  456. self._deny_($6);
  457. $ctx1.sendIdx["deny:"]=5;
  458. $7=true.__eq(false);
  459. $ctx1.sendIdx["="]=7;
  460. self._deny_($7);
  461. $8=false.__eq(false);
  462. $ctx1.sendIdx["="]=8;
  463. self._assert_($8);
  464. $ctx1.sendIdx["assert:"]=2;
  465. $10=true._yourself();
  466. $ctx1.sendIdx["yourself"]=1;
  467. $9=_st($10).__eq(true);
  468. $ctx1.sendIdx["="]=9;
  469. self._assert_($9);
  470. $ctx1.sendIdx["assert:"]=3;
  471. $12=true._yourself();
  472. $ctx1.sendIdx["yourself"]=2;
  473. $13=true._yourself();
  474. $11=_st($12).__eq($13);
  475. self._assert_($11);
  476. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  477. args: [],
  478. 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)",
  479. messageSends: ["deny:", "=", "assert:", "yourself"],
  480. referencedClasses: []
  481. }),
  482. smalltalk.BooleanTest);
  483. smalltalk.addMethod(
  484. smalltalk.method({
  485. selector: "testIdentity",
  486. category: 'tests',
  487. fn: function (){
  488. var self=this;
  489. return smalltalk.withContext(function($ctx1) {
  490. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$13,$11;
  491. $1=(0).__eq_eq(false);
  492. $ctx1.sendIdx["=="]=1;
  493. self._deny_($1);
  494. $ctx1.sendIdx["deny:"]=1;
  495. $2=false.__eq_eq((0));
  496. $ctx1.sendIdx["=="]=2;
  497. self._deny_($2);
  498. $ctx1.sendIdx["deny:"]=2;
  499. $3="".__eq_eq(false);
  500. $ctx1.sendIdx["=="]=3;
  501. self._deny_($3);
  502. $ctx1.sendIdx["deny:"]=3;
  503. $4=false.__eq_eq("");
  504. $ctx1.sendIdx["=="]=4;
  505. self._deny_($4);
  506. $ctx1.sendIdx["deny:"]=4;
  507. $5=true.__eq_eq(true);
  508. $ctx1.sendIdx["=="]=5;
  509. self._assert_($5);
  510. $ctx1.sendIdx["assert:"]=1;
  511. $6=false.__eq_eq(true);
  512. $ctx1.sendIdx["=="]=6;
  513. self._deny_($6);
  514. $ctx1.sendIdx["deny:"]=5;
  515. $7=true.__eq_eq(false);
  516. $ctx1.sendIdx["=="]=7;
  517. self._deny_($7);
  518. $8=false.__eq_eq(false);
  519. $ctx1.sendIdx["=="]=8;
  520. self._assert_($8);
  521. $ctx1.sendIdx["assert:"]=2;
  522. $10=true._yourself();
  523. $ctx1.sendIdx["yourself"]=1;
  524. $9=_st($10).__eq_eq(true);
  525. $ctx1.sendIdx["=="]=9;
  526. self._assert_($9);
  527. $ctx1.sendIdx["assert:"]=3;
  528. $12=true._yourself();
  529. $ctx1.sendIdx["yourself"]=2;
  530. $13=true._yourself();
  531. $11=_st($12).__eq_eq($13);
  532. self._assert_($11);
  533. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  534. args: [],
  535. 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",
  536. messageSends: ["deny:", "==", "assert:", "yourself"],
  537. referencedClasses: []
  538. }),
  539. smalltalk.BooleanTest);
  540. smalltalk.addMethod(
  541. smalltalk.method({
  542. selector: "testIfTrueIfFalse",
  543. category: 'tests',
  544. fn: function (){
  545. var self=this;
  546. return smalltalk.withContext(function($ctx1) {
  547. var $1,$2,$3,$4,$5,$6,$7,$8;
  548. if(smalltalk.assert(true)){
  549. $1="alternative block";
  550. };
  551. self._assert_equals_($1,"alternative block");
  552. $ctx1.sendIdx["assert:equals:"]=1;
  553. if(! smalltalk.assert(true)){
  554. $2="alternative block";
  555. };
  556. self._assert_equals_($2,nil);
  557. $ctx1.sendIdx["assert:equals:"]=2;
  558. if(smalltalk.assert(false)){
  559. $3="alternative block";
  560. };
  561. self._assert_equals_($3,nil);
  562. $ctx1.sendIdx["assert:equals:"]=3;
  563. if(! smalltalk.assert(false)){
  564. $4="alternative block";
  565. };
  566. self._assert_equals_($4,"alternative block");
  567. $ctx1.sendIdx["assert:equals:"]=4;
  568. if(smalltalk.assert(false)){
  569. $5="alternative block";
  570. } else {
  571. $5="alternative block2";
  572. };
  573. self._assert_equals_($5,"alternative block2");
  574. $ctx1.sendIdx["assert:equals:"]=5;
  575. if(smalltalk.assert(false)){
  576. $6="alternative block2";
  577. } else {
  578. $6="alternative block";
  579. };
  580. self._assert_equals_($6,"alternative block");
  581. $ctx1.sendIdx["assert:equals:"]=6;
  582. if(smalltalk.assert(true)){
  583. $7="alternative block";
  584. } else {
  585. $7="alternative block2";
  586. };
  587. self._assert_equals_($7,"alternative block");
  588. $ctx1.sendIdx["assert:equals:"]=7;
  589. if(smalltalk.assert(true)){
  590. $8="alternative block2";
  591. } else {
  592. $8="alternative block";
  593. };
  594. self._assert_equals_($8,"alternative block2");
  595. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  596. args: [],
  597. 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'.",
  598. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  599. referencedClasses: []
  600. }),
  601. smalltalk.BooleanTest);
  602. smalltalk.addMethod(
  603. smalltalk.method({
  604. selector: "testIfTrueIfFalseWithBoxing",
  605. category: 'tests',
  606. fn: function (){
  607. var self=this;
  608. return smalltalk.withContext(function($ctx1) {
  609. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  610. $2=true._yourself();
  611. $ctx1.sendIdx["yourself"]=1;
  612. if(smalltalk.assert($2)){
  613. $1="alternative block";
  614. };
  615. self._assert_equals_($1,"alternative block");
  616. $ctx1.sendIdx["assert:equals:"]=1;
  617. $4=true._yourself();
  618. $ctx1.sendIdx["yourself"]=2;
  619. if(! smalltalk.assert($4)){
  620. $3="alternative block";
  621. };
  622. self._assert_equals_($3,nil);
  623. $ctx1.sendIdx["assert:equals:"]=2;
  624. $6=false._yourself();
  625. $ctx1.sendIdx["yourself"]=3;
  626. if(smalltalk.assert($6)){
  627. $5="alternative block";
  628. };
  629. self._assert_equals_($5,nil);
  630. $ctx1.sendIdx["assert:equals:"]=3;
  631. $8=false._yourself();
  632. $ctx1.sendIdx["yourself"]=4;
  633. if(! smalltalk.assert($8)){
  634. $7="alternative block";
  635. };
  636. self._assert_equals_($7,"alternative block");
  637. $ctx1.sendIdx["assert:equals:"]=4;
  638. $10=false._yourself();
  639. $ctx1.sendIdx["yourself"]=5;
  640. if(smalltalk.assert($10)){
  641. $9="alternative block";
  642. } else {
  643. $9="alternative block2";
  644. };
  645. self._assert_equals_($9,"alternative block2");
  646. $ctx1.sendIdx["assert:equals:"]=5;
  647. $12=false._yourself();
  648. $ctx1.sendIdx["yourself"]=6;
  649. if(smalltalk.assert($12)){
  650. $11="alternative block2";
  651. } else {
  652. $11="alternative block";
  653. };
  654. self._assert_equals_($11,"alternative block");
  655. $ctx1.sendIdx["assert:equals:"]=6;
  656. $14=true._yourself();
  657. $ctx1.sendIdx["yourself"]=7;
  658. if(smalltalk.assert($14)){
  659. $13="alternative block";
  660. } else {
  661. $13="alternative block2";
  662. };
  663. self._assert_equals_($13,"alternative block");
  664. $ctx1.sendIdx["assert:equals:"]=7;
  665. $16=true._yourself();
  666. if(smalltalk.assert($16)){
  667. $15="alternative block2";
  668. } else {
  669. $15="alternative block";
  670. };
  671. self._assert_equals_($15,"alternative block2");
  672. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  673. args: [],
  674. 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'.",
  675. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  676. referencedClasses: []
  677. }),
  678. smalltalk.BooleanTest);
  679. smalltalk.addMethod(
  680. smalltalk.method({
  681. selector: "testLogic",
  682. category: 'tests',
  683. fn: function (){
  684. var self=this;
  685. return smalltalk.withContext(function($ctx1) {
  686. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$26,$24,$23;
  687. $1=true.__and(true);
  688. $ctx1.sendIdx["&"]=1;
  689. self._assert_($1);
  690. $ctx1.sendIdx["assert:"]=1;
  691. $2=true.__and(false);
  692. $ctx1.sendIdx["&"]=2;
  693. self._deny_($2);
  694. $ctx1.sendIdx["deny:"]=1;
  695. $3=false.__and(true);
  696. $ctx1.sendIdx["&"]=3;
  697. self._deny_($3);
  698. $ctx1.sendIdx["deny:"]=2;
  699. $5=false.__and(false);
  700. $ctx1.sendIdx["&"]=4;
  701. $4=self._deny_($5);
  702. $ctx1.sendIdx["deny:"]=3;
  703. $6=true.__or(true);
  704. $ctx1.sendIdx["|"]=1;
  705. self._assert_($6);
  706. $ctx1.sendIdx["assert:"]=2;
  707. $7=true.__or(false);
  708. $ctx1.sendIdx["|"]=2;
  709. self._assert_($7);
  710. $ctx1.sendIdx["assert:"]=3;
  711. $8=false.__or(true);
  712. $ctx1.sendIdx["|"]=3;
  713. self._assert_($8);
  714. $ctx1.sendIdx["assert:"]=4;
  715. $10=false.__or(false);
  716. $ctx1.sendIdx["|"]=4;
  717. $9=self._deny_($10);
  718. $ctx1.sendIdx["deny:"]=4;
  719. $12=(1).__gt((0));
  720. $ctx1.sendIdx[">"]=1;
  721. $11=true.__and($12);
  722. $ctx1.sendIdx["&"]=5;
  723. self._assert_($11);
  724. $ctx1.sendIdx["assert:"]=5;
  725. $14=(1).__gt((0));
  726. $ctx1.sendIdx[">"]=2;
  727. $13=_st($14).__and(false);
  728. $ctx1.sendIdx["&"]=6;
  729. self._deny_($13);
  730. $ctx1.sendIdx["deny:"]=5;
  731. $17=(1).__gt((0));
  732. $ctx1.sendIdx[">"]=3;
  733. $18=(1).__gt((2));
  734. $ctx1.sendIdx[">"]=4;
  735. $16=_st($17).__and($18);
  736. $15=self._deny_($16);
  737. $20=(1).__gt((0));
  738. $ctx1.sendIdx[">"]=5;
  739. $19=false.__or($20);
  740. $ctx1.sendIdx["|"]=5;
  741. self._assert_($19);
  742. $ctx1.sendIdx["assert:"]=6;
  743. $22=(1).__gt((0));
  744. $ctx1.sendIdx[">"]=6;
  745. $21=_st($22).__or(false);
  746. $ctx1.sendIdx["|"]=6;
  747. self._assert_($21);
  748. $ctx1.sendIdx["assert:"]=7;
  749. $25=(1).__gt((0));
  750. $ctx1.sendIdx[">"]=7;
  751. $26=(1).__gt((2));
  752. $24=_st($25).__or($26);
  753. $23=self._assert_($24);
  754. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  755. args: [],
  756. 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))",
  757. messageSends: ["assert:", "&", "deny:", "|", ">"],
  758. referencedClasses: []
  759. }),
  760. smalltalk.BooleanTest);
  761. smalltalk.addMethod(
  762. smalltalk.method({
  763. selector: "testLogicKeywords",
  764. category: 'tests',
  765. fn: function (){
  766. var self=this;
  767. return smalltalk.withContext(function($ctx1) {
  768. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  769. $1=true._and_((function(){
  770. return smalltalk.withContext(function($ctx2) {
  771. return true;
  772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  773. $ctx1.sendIdx["and:"]=1;
  774. self._assert_($1);
  775. $ctx1.sendIdx["assert:"]=1;
  776. $2=true._and_((function(){
  777. return smalltalk.withContext(function($ctx2) {
  778. return false;
  779. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  780. $ctx1.sendIdx["and:"]=2;
  781. self._deny_($2);
  782. $ctx1.sendIdx["deny:"]=1;
  783. $3=false._and_((function(){
  784. return smalltalk.withContext(function($ctx2) {
  785. return true;
  786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  787. $ctx1.sendIdx["and:"]=3;
  788. self._deny_($3);
  789. $ctx1.sendIdx["deny:"]=2;
  790. $5=false._and_((function(){
  791. return smalltalk.withContext(function($ctx2) {
  792. return false;
  793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  794. $ctx1.sendIdx["and:"]=4;
  795. $4=self._deny_($5);
  796. $ctx1.sendIdx["deny:"]=3;
  797. $6=true._or_((function(){
  798. return smalltalk.withContext(function($ctx2) {
  799. return true;
  800. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  801. $ctx1.sendIdx["or:"]=1;
  802. self._assert_($6);
  803. $ctx1.sendIdx["assert:"]=2;
  804. $7=true._or_((function(){
  805. return smalltalk.withContext(function($ctx2) {
  806. return false;
  807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  808. $ctx1.sendIdx["or:"]=2;
  809. self._assert_($7);
  810. $ctx1.sendIdx["assert:"]=3;
  811. $8=false._or_((function(){
  812. return smalltalk.withContext(function($ctx2) {
  813. return true;
  814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  815. $ctx1.sendIdx["or:"]=3;
  816. self._assert_($8);
  817. $ctx1.sendIdx["assert:"]=4;
  818. $10=false._or_((function(){
  819. return smalltalk.withContext(function($ctx2) {
  820. return false;
  821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  822. $ctx1.sendIdx["or:"]=4;
  823. $9=self._deny_($10);
  824. $ctx1.sendIdx["deny:"]=4;
  825. $11=true._and_((function(){
  826. return smalltalk.withContext(function($ctx2) {
  827. return (1).__gt((0));
  828. $ctx2.sendIdx[">"]=1;
  829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  830. $ctx1.sendIdx["and:"]=5;
  831. self._assert_($11);
  832. $ctx1.sendIdx["assert:"]=5;
  833. $13=(1).__gt((0));
  834. $ctx1.sendIdx[">"]=2;
  835. $12=_st($13)._and_((function(){
  836. return smalltalk.withContext(function($ctx2) {
  837. return false;
  838. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  839. $ctx1.sendIdx["and:"]=6;
  840. self._deny_($12);
  841. $ctx1.sendIdx["deny:"]=5;
  842. $16=(1).__gt((0));
  843. $ctx1.sendIdx[">"]=3;
  844. $15=_st($16)._and_((function(){
  845. return smalltalk.withContext(function($ctx2) {
  846. return (1).__gt((2));
  847. $ctx2.sendIdx[">"]=4;
  848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  849. $14=self._deny_($15);
  850. $17=false._or_((function(){
  851. return smalltalk.withContext(function($ctx2) {
  852. return (1).__gt((0));
  853. $ctx2.sendIdx[">"]=5;
  854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  855. $ctx1.sendIdx["or:"]=5;
  856. self._assert_($17);
  857. $ctx1.sendIdx["assert:"]=6;
  858. $19=(1).__gt((0));
  859. $ctx1.sendIdx[">"]=6;
  860. $18=_st($19)._or_((function(){
  861. return smalltalk.withContext(function($ctx2) {
  862. return false;
  863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  864. $ctx1.sendIdx["or:"]=6;
  865. self._assert_($18);
  866. $ctx1.sendIdx["assert:"]=7;
  867. $22=(1).__gt((0));
  868. $ctx1.sendIdx[">"]=7;
  869. $21=_st($22)._or_((function(){
  870. return smalltalk.withContext(function($ctx2) {
  871. return (1).__gt((2));
  872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  873. $20=self._assert_($21);
  874. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  875. args: [],
  876. 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 ])",
  877. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  878. referencedClasses: []
  879. }),
  880. smalltalk.BooleanTest);
  881. smalltalk.addMethod(
  882. smalltalk.method({
  883. selector: "testNonBooleanError",
  884. category: 'tests',
  885. fn: function (){
  886. var self=this;
  887. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  888. return smalltalk.withContext(function($ctx1) {
  889. self._should_raise_((function(){
  890. return smalltalk.withContext(function($ctx2) {
  891. if(smalltalk.assert("")){
  892. } else {
  893. };
  894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  895. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  896. args: [],
  897. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  898. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  899. referencedClasses: ["NonBooleanReceiver"]
  900. }),
  901. smalltalk.BooleanTest);
  902. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  903. smalltalk.addMethod(
  904. smalltalk.method({
  905. selector: "setUp",
  906. category: 'running',
  907. fn: function (){
  908. var self=this;
  909. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  910. return smalltalk.withContext(function($ctx1) {
  911. self["@builder"]=_st($ClassBuilder())._new();
  912. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  913. args: [],
  914. source: "setUp\x0a\x09builder := ClassBuilder new",
  915. messageSends: ["new"],
  916. referencedClasses: ["ClassBuilder"]
  917. }),
  918. smalltalk.ClassBuilderTest);
  919. smalltalk.addMethod(
  920. smalltalk.method({
  921. selector: "tearDown",
  922. category: 'running',
  923. fn: function (){
  924. var self=this;
  925. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  926. return smalltalk.withContext(function($ctx1) {
  927. var $1;
  928. $1=self["@theClass"];
  929. if(($receiver = $1) == nil || $receiver == null){
  930. $1;
  931. } else {
  932. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  933. self["@theClass"]=nil;
  934. self["@theClass"];
  935. };
  936. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  937. args: [],
  938. source: "tearDown\x0a\x09theClass ifNotNil: [Smalltalk current removeClass: theClass. theClass := nil]",
  939. messageSends: ["ifNotNil:", "removeClass:", "current"],
  940. referencedClasses: ["Smalltalk"]
  941. }),
  942. smalltalk.ClassBuilderTest);
  943. smalltalk.addMethod(
  944. smalltalk.method({
  945. selector: "testClassCopy",
  946. category: 'tests',
  947. fn: function (){
  948. var self=this;
  949. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  950. return smalltalk.withContext(function($ctx1) {
  951. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10,$13,$12;
  952. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  953. $2=_st(self["@theClass"])._superclass();
  954. $ctx1.sendIdx["superclass"]=1;
  955. $3=_st($ObjectMock())._superclass();
  956. $1=_st($2).__eq_eq($3);
  957. $ctx1.sendIdx["=="]=1;
  958. self._assert_($1);
  959. $ctx1.sendIdx["assert:"]=1;
  960. $5=_st(self["@theClass"])._instanceVariableNames();
  961. $ctx1.sendIdx["instanceVariableNames"]=1;
  962. $6=_st($ObjectMock())._instanceVariableNames();
  963. $4=_st($5).__eq_eq($6);
  964. $ctx1.sendIdx["=="]=2;
  965. self._assert_($4);
  966. $ctx1.sendIdx["assert:"]=2;
  967. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  968. $ctx1.sendIdx["assert:equals:"]=1;
  969. $8=_st(self["@theClass"])._package();
  970. $ctx1.sendIdx["package"]=1;
  971. $9=_st($ObjectMock())._package();
  972. $7=_st($8).__eq_eq($9);
  973. self._assert_($7);
  974. $11=_st(self["@theClass"])._methodDictionary();
  975. $ctx1.sendIdx["methodDictionary"]=1;
  976. $10=_st($11)._keys();
  977. $ctx1.sendIdx["keys"]=1;
  978. $13=_st($ObjectMock())._methodDictionary();
  979. $12=_st($13)._keys();
  980. self._assert_equals_($10,$12);
  981. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  982. args: [],
  983. 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",
  984. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  985. referencedClasses: ["ObjectMock"]
  986. }),
  987. smalltalk.ClassBuilderTest);
  988. smalltalk.addMethod(
  989. smalltalk.method({
  990. selector: "testClassMigration",
  991. category: 'tests',
  992. fn: function (){
  993. var self=this;
  994. var instance,oldClass;
  995. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  996. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  997. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  998. return smalltalk.withContext(function($ctx1) {
  999. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$10,$11,$13,$12,$16,$18,$17,$15,$14,$19;
  1000. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1001. $2=_st($Smalltalk())._current();
  1002. $ctx1.sendIdx["current"]=1;
  1003. $1=_st($2)._at_("ObjectMock2");
  1004. $ctx1.sendIdx["at:"]=1;
  1005. instance=_st($1)._new();
  1006. $4=_st($Smalltalk())._current();
  1007. $ctx1.sendIdx["current"]=2;
  1008. $3=_st($4)._at_("ObjectMock2");
  1009. $ctx1.sendIdx["at:"]=2;
  1010. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1011. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1012. $ctx1.sendIdx["=="]=1;
  1013. self._deny_($5);
  1014. $ctx1.sendIdx["deny:"]=1;
  1015. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1016. $ctx1.sendIdx["=="]=2;
  1017. self._assert_($6);
  1018. $ctx1.sendIdx["assert:"]=1;
  1019. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1020. $ctx1.sendIdx["assert:"]=2;
  1021. $7=_st($ObjectMock2())._selectors();
  1022. $ctx1.sendIdx["selectors"]=1;
  1023. $8=_st(oldClass)._selectors();
  1024. self._assert_equals_($7,$8);
  1025. $ctx1.sendIdx["assert:equals:"]=1;
  1026. $9=_st($ObjectMock2())._comment();
  1027. $ctx1.sendIdx["comment"]=1;
  1028. $10=_st(oldClass)._comment();
  1029. self._assert_equals_($9,$10);
  1030. $ctx1.sendIdx["assert:equals:"]=2;
  1031. $11=_st(_st($ObjectMock2())._package())._name();
  1032. $ctx1.sendIdx["name"]=1;
  1033. self._assert_equals_($11,"Kernel-Tests");
  1034. $13=_st(instance)._class();
  1035. $ctx1.sendIdx["class"]=1;
  1036. $12=_st($13).__eq_eq($ObjectMock2());
  1037. self._deny_($12);
  1038. $16=_st($Smalltalk())._current();
  1039. $ctx1.sendIdx["current"]=3;
  1040. $18=_st(instance)._class();
  1041. $17=_st($18)._name();
  1042. $15=_st($16)._at_($17);
  1043. $14=_st($15)._isNil();
  1044. self._assert_($14);
  1045. $19=_st($Smalltalk())._current();
  1046. _st($19)._removeClass_($ObjectMock2());
  1047. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  1048. args: [],
  1049. 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",
  1050. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1051. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1052. }),
  1053. smalltalk.ClassBuilderTest);
  1054. smalltalk.addMethod(
  1055. smalltalk.method({
  1056. selector: "testClassMigrationWithClassInstanceVariables",
  1057. category: 'tests',
  1058. fn: function (){
  1059. var self=this;
  1060. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1061. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1062. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1063. return smalltalk.withContext(function($ctx1) {
  1064. var $1,$3,$2,$5,$4,$6;
  1065. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1066. $1=_st($ObjectMock2())._class();
  1067. $ctx1.sendIdx["class"]=1;
  1068. _st($1)._instanceVariableNames_("foo bar");
  1069. $3=_st($Smalltalk())._current();
  1070. $ctx1.sendIdx["current"]=1;
  1071. $2=_st($3)._at_("ObjectMock2");
  1072. _st($ObjectMock())._subclass_instanceVariableNames_package_($2,"","Kernel-Tests");
  1073. $5=_st($ObjectMock2())._class();
  1074. $4=_st($5)._instanceVariableNames();
  1075. self._assert_equals_($4,["foo", "bar"]);
  1076. $6=_st($Smalltalk())._current();
  1077. _st($6)._removeClass_($ObjectMock2());
  1078. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  1079. args: [],
  1080. 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",
  1081. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1082. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1083. }),
  1084. smalltalk.ClassBuilderTest);
  1085. smalltalk.addMethod(
  1086. smalltalk.method({
  1087. selector: "testClassMigrationWithSubclasses",
  1088. category: 'tests',
  1089. fn: function (){
  1090. var self=this;
  1091. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1092. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1093. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1094. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1095. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1096. return smalltalk.withContext(function($ctx1) {
  1097. var $2,$1,$4,$3,$6,$5,$8,$7,$9;
  1098. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1099. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1100. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1101. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1102. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1103. $2=_st($Smalltalk())._current();
  1104. $ctx1.sendIdx["current"]=1;
  1105. $1=_st($2)._at_("ObjectMock2");
  1106. _st($ObjectMock())._subclass_instanceVariableNames_package_($1,"","Kernel-Tests");
  1107. $4=_st($ObjectMock())._subclasses();
  1108. $ctx1.sendIdx["subclasses"]=1;
  1109. $3=_st($4)._includes_($ObjectMock2());
  1110. $ctx1.sendIdx["includes:"]=1;
  1111. self._assert_($3);
  1112. $ctx1.sendIdx["assert:"]=1;
  1113. $6=_st($ObjectMock2())._subclasses();
  1114. $ctx1.sendIdx["subclasses"]=2;
  1115. $5=_st($6)._includes_($ObjectMock3());
  1116. $ctx1.sendIdx["includes:"]=2;
  1117. self._assert_($5);
  1118. $ctx1.sendIdx["assert:"]=2;
  1119. $8=_st($ObjectMock3())._subclasses();
  1120. $7=_st($8)._includes_($ObjectMock4());
  1121. self._assert_($7);
  1122. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1123. return smalltalk.withContext(function($ctx2) {
  1124. $9=_st($Smalltalk())._current();
  1125. return _st($9)._removeClass_(each);
  1126. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1127. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  1128. args: [],
  1129. 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 ]",
  1130. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1131. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1132. }),
  1133. smalltalk.ClassBuilderTest);
  1134. smalltalk.addMethod(
  1135. smalltalk.method({
  1136. selector: "testInstanceVariableNames",
  1137. category: 'tests',
  1138. fn: function (){
  1139. var self=this;
  1140. return smalltalk.withContext(function($ctx1) {
  1141. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1142. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  1143. args: [],
  1144. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1145. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1146. referencedClasses: []
  1147. }),
  1148. smalltalk.ClassBuilderTest);
  1149. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1150. smalltalk.addMethod(
  1151. smalltalk.method({
  1152. selector: "assertSameContents:as:",
  1153. category: 'convenience',
  1154. fn: function (aCollection,anotherCollection){
  1155. var self=this;
  1156. return smalltalk.withContext(function($ctx1) {
  1157. var $2,$3,$1,$5,$6,$4;
  1158. $2=_st(aCollection)._size();
  1159. $ctx1.sendIdx["size"]=1;
  1160. $3=_st(anotherCollection)._size();
  1161. $1=_st($2).__eq($3);
  1162. $ctx1.sendIdx["="]=1;
  1163. self._assert_($1);
  1164. $ctx1.sendIdx["assert:"]=1;
  1165. _st(aCollection)._do_((function(each){
  1166. return smalltalk.withContext(function($ctx2) {
  1167. $5=_st(aCollection)._occurrencesOf_(each);
  1168. $ctx2.sendIdx["occurrencesOf:"]=1;
  1169. $6=_st(anotherCollection)._occurrencesOf_(each);
  1170. $4=_st($5).__eq($6);
  1171. return self._assert_($4);
  1172. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1173. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  1174. args: ["aCollection", "anotherCollection"],
  1175. 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)) ]",
  1176. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1177. referencedClasses: []
  1178. }),
  1179. smalltalk.CollectionTest);
  1180. smalltalk.addMethod(
  1181. smalltalk.method({
  1182. selector: "collection",
  1183. category: 'accessing',
  1184. fn: function (){
  1185. var self=this;
  1186. return smalltalk.withContext(function($ctx1) {
  1187. var $1;
  1188. $1=_st(self._collectionClass())._withAll_(self._defaultValues());
  1189. return $1;
  1190. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  1191. args: [],
  1192. source: "collection\x0a\x09^ self collectionClass withAll: self defaultValues",
  1193. messageSends: ["withAll:", "collectionClass", "defaultValues"],
  1194. referencedClasses: []
  1195. }),
  1196. smalltalk.CollectionTest);
  1197. smalltalk.addMethod(
  1198. smalltalk.method({
  1199. selector: "collectionClass",
  1200. category: 'accessing',
  1201. fn: function (){
  1202. var self=this;
  1203. return smalltalk.withContext(function($ctx1) {
  1204. var $1;
  1205. $1=_st(self._class())._collectionClass();
  1206. return $1;
  1207. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  1208. args: [],
  1209. source: "collectionClass\x0a\x09^ self class collectionClass",
  1210. messageSends: ["collectionClass", "class"],
  1211. referencedClasses: []
  1212. }),
  1213. smalltalk.CollectionTest);
  1214. smalltalk.addMethod(
  1215. smalltalk.method({
  1216. selector: "collectionWithDuplicates",
  1217. category: 'accessing',
  1218. fn: function (){
  1219. var self=this;
  1220. return smalltalk.withContext(function($ctx1) {
  1221. var $1;
  1222. $1=_st(self._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  1223. return $1;
  1224. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1225. args: [],
  1226. source: "collectionWithDuplicates\x0a\x09^ self collectionClass withAll: #('a' 'b' 'c' 1 2 1 'a')",
  1227. messageSends: ["withAll:", "collectionClass"],
  1228. referencedClasses: []
  1229. }),
  1230. smalltalk.CollectionTest);
  1231. smalltalk.addMethod(
  1232. smalltalk.method({
  1233. selector: "defaultValues",
  1234. category: 'accessing',
  1235. fn: function (){
  1236. var self=this;
  1237. return smalltalk.withContext(function($ctx1) {
  1238. var $1;
  1239. $1=[(1), (2), (3), (-4)];
  1240. return $1;
  1241. }, function($ctx1) {$ctx1.fill(self,"defaultValues",{},smalltalk.CollectionTest)})},
  1242. args: [],
  1243. source: "defaultValues\x0a\x09^ #(1 2 3 -4)",
  1244. messageSends: [],
  1245. referencedClasses: []
  1246. }),
  1247. smalltalk.CollectionTest);
  1248. smalltalk.addMethod(
  1249. smalltalk.method({
  1250. selector: "isCollectionReadOnly",
  1251. category: 'testing',
  1252. fn: function (){
  1253. var self=this;
  1254. return smalltalk.withContext(function($ctx1) {
  1255. return false;
  1256. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1257. args: [],
  1258. source: "isCollectionReadOnly\x0a\x09^ false",
  1259. messageSends: [],
  1260. referencedClasses: []
  1261. }),
  1262. smalltalk.CollectionTest);
  1263. smalltalk.addMethod(
  1264. smalltalk.method({
  1265. selector: "testAsArray",
  1266. category: 'tests',
  1267. fn: function (){
  1268. var self=this;
  1269. return smalltalk.withContext(function($ctx1) {
  1270. var $1,$3,$2;
  1271. $1=self._collection();
  1272. $ctx1.sendIdx["collection"]=1;
  1273. $3=self._collection();
  1274. $2=_st($3)._asArray();
  1275. self._assertSameContents_as_($1,$2);
  1276. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1277. args: [],
  1278. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1279. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1280. referencedClasses: []
  1281. }),
  1282. smalltalk.CollectionTest);
  1283. smalltalk.addMethod(
  1284. smalltalk.method({
  1285. selector: "testAsOrderedCollection",
  1286. category: 'tests',
  1287. fn: function (){
  1288. var self=this;
  1289. return smalltalk.withContext(function($ctx1) {
  1290. var $1,$3,$2;
  1291. $1=self._collection();
  1292. $ctx1.sendIdx["collection"]=1;
  1293. $3=self._collection();
  1294. $2=_st($3)._asOrderedCollection();
  1295. self._assertSameContents_as_($1,$2);
  1296. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1297. args: [],
  1298. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1299. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1300. referencedClasses: []
  1301. }),
  1302. smalltalk.CollectionTest);
  1303. smalltalk.addMethod(
  1304. smalltalk.method({
  1305. selector: "testAsSet",
  1306. category: 'tests',
  1307. fn: function (){
  1308. var self=this;
  1309. var c,set;
  1310. return smalltalk.withContext(function($ctx1) {
  1311. c=self._collectionWithDuplicates();
  1312. set=_st(c)._asSet();
  1313. self._assert_equals_(_st(set)._size(),(5));
  1314. _st(c)._do_((function(each){
  1315. return smalltalk.withContext(function($ctx2) {
  1316. return self._assert_(_st(set)._includes_(each));
  1317. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1318. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1319. args: [],
  1320. 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) ]",
  1321. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1322. referencedClasses: []
  1323. }),
  1324. smalltalk.CollectionTest);
  1325. smalltalk.addMethod(
  1326. smalltalk.method({
  1327. selector: "testCollect",
  1328. category: 'tests',
  1329. fn: function (){
  1330. var self=this;
  1331. var newCollection;
  1332. return smalltalk.withContext(function($ctx1) {
  1333. newCollection=[(1), (2), (3), (4)];
  1334. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  1335. return smalltalk.withContext(function($ctx2) {
  1336. return _st(each)._abs();
  1337. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1338. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1339. args: [],
  1340. 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",
  1341. messageSends: ["assertSameContents:as:", "collect:", "collection", "abs"],
  1342. referencedClasses: []
  1343. }),
  1344. smalltalk.CollectionTest);
  1345. smalltalk.addMethod(
  1346. smalltalk.method({
  1347. selector: "testDetect",
  1348. category: 'tests',
  1349. fn: function (){
  1350. var self=this;
  1351. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1352. return smalltalk.withContext(function($ctx1) {
  1353. var $2,$1,$3;
  1354. $2=self._collection();
  1355. $ctx1.sendIdx["collection"]=1;
  1356. $1=_st($2)._detect_((function(each){
  1357. return smalltalk.withContext(function($ctx2) {
  1358. return _st(each).__lt((0));
  1359. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1360. $ctx1.sendIdx["detect:"]=1;
  1361. self._assert_equals_($1,(-4));
  1362. self._should_raise_((function(){
  1363. return smalltalk.withContext(function($ctx2) {
  1364. $3=self._collection();
  1365. return _st($3)._detect_((function(each){
  1366. return smalltalk.withContext(function($ctx3) {
  1367. return _st(each).__eq((6));
  1368. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  1369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  1370. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1371. args: [],
  1372. 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",
  1373. messageSends: ["assert:equals:", "detect:", "collection", "<", "should:raise:", "="],
  1374. referencedClasses: ["Error"]
  1375. }),
  1376. smalltalk.CollectionTest);
  1377. smalltalk.addMethod(
  1378. smalltalk.method({
  1379. selector: "testDo",
  1380. category: 'tests',
  1381. fn: function (){
  1382. var self=this;
  1383. var newCollection;
  1384. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1385. return smalltalk.withContext(function($ctx1) {
  1386. var $1,$2;
  1387. newCollection=_st($OrderedCollection())._new();
  1388. $1=self._collection();
  1389. $ctx1.sendIdx["collection"]=1;
  1390. _st($1)._do_((function(each){
  1391. return smalltalk.withContext(function($ctx2) {
  1392. return _st(newCollection)._add_(each);
  1393. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1394. $2=self._collection();
  1395. self._assertSameContents_as_($2,newCollection);
  1396. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1397. args: [],
  1398. 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",
  1399. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:"],
  1400. referencedClasses: ["OrderedCollection"]
  1401. }),
  1402. smalltalk.CollectionTest);
  1403. smalltalk.addMethod(
  1404. smalltalk.method({
  1405. selector: "testIsEmpty",
  1406. category: 'tests',
  1407. fn: function (){
  1408. var self=this;
  1409. return smalltalk.withContext(function($ctx1) {
  1410. var $1,$2;
  1411. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1412. $ctx1.sendIdx["isEmpty"]=1;
  1413. self._assert_($1);
  1414. $2=_st(self._collection())._isEmpty();
  1415. self._deny_($2);
  1416. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1417. args: [],
  1418. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1419. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1420. referencedClasses: []
  1421. }),
  1422. smalltalk.CollectionTest);
  1423. smalltalk.addMethod(
  1424. smalltalk.method({
  1425. selector: "testSelect",
  1426. category: 'tests',
  1427. fn: function (){
  1428. var self=this;
  1429. var newCollection;
  1430. return smalltalk.withContext(function($ctx1) {
  1431. newCollection=[(2), (-4)];
  1432. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  1433. return smalltalk.withContext(function($ctx2) {
  1434. return _st(each)._even();
  1435. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1436. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1437. args: [],
  1438. 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",
  1439. messageSends: ["assertSameContents:as:", "select:", "collection", "even"],
  1440. referencedClasses: []
  1441. }),
  1442. smalltalk.CollectionTest);
  1443. smalltalk.addMethod(
  1444. smalltalk.method({
  1445. selector: "testSize",
  1446. category: 'tests',
  1447. fn: function (){
  1448. var self=this;
  1449. return smalltalk.withContext(function($ctx1) {
  1450. var $1,$2;
  1451. $1=_st(_st(self._collectionClass())._new())._size();
  1452. $ctx1.sendIdx["size"]=1;
  1453. self._assert_equals_($1,(0));
  1454. $ctx1.sendIdx["assert:equals:"]=1;
  1455. $2=_st(self._collection())._size();
  1456. self._assert_equals_($2,(4));
  1457. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  1458. args: [],
  1459. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self collection size equals: 4",
  1460. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"],
  1461. referencedClasses: []
  1462. }),
  1463. smalltalk.CollectionTest);
  1464. smalltalk.addMethod(
  1465. smalltalk.method({
  1466. selector: "collectionClass",
  1467. category: 'accessing',
  1468. fn: function (){
  1469. var self=this;
  1470. return smalltalk.withContext(function($ctx1) {
  1471. return nil;
  1472. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  1473. args: [],
  1474. source: "collectionClass\x0a\x09^ nil",
  1475. messageSends: [],
  1476. referencedClasses: []
  1477. }),
  1478. smalltalk.CollectionTest.klass);
  1479. smalltalk.addMethod(
  1480. smalltalk.method({
  1481. selector: "isAbstract",
  1482. category: 'testing',
  1483. fn: function (){
  1484. var self=this;
  1485. return smalltalk.withContext(function($ctx1) {
  1486. var $1;
  1487. $1=_st(self._collectionClass())._isNil();
  1488. return $1;
  1489. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  1490. args: [],
  1491. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1492. messageSends: ["isNil", "collectionClass"],
  1493. referencedClasses: []
  1494. }),
  1495. smalltalk.CollectionTest.klass);
  1496. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1497. smalltalk.addMethod(
  1498. smalltalk.method({
  1499. selector: "testAt",
  1500. category: 'tests',
  1501. fn: function (){
  1502. var self=this;
  1503. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1504. return smalltalk.withContext(function($ctx1) {
  1505. var $2,$1,$3;
  1506. $2=self._collection();
  1507. $ctx1.sendIdx["collection"]=1;
  1508. $1=_st($2)._at_((4));
  1509. $ctx1.sendIdx["at:"]=1;
  1510. self._assert_equals_($1,(-4));
  1511. self._should_raise_((function(){
  1512. return smalltalk.withContext(function($ctx2) {
  1513. $3=self._collection();
  1514. return _st($3)._at_((5));
  1515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1516. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  1517. args: [],
  1518. source: "testAt\x0a\x09self assert: (self collection at: 4) equals: -4.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1519. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1520. referencedClasses: ["Error"]
  1521. }),
  1522. smalltalk.IndexableCollectionTest);
  1523. smalltalk.addMethod(
  1524. smalltalk.method({
  1525. selector: "testAtIfAbsent",
  1526. category: 'tests',
  1527. fn: function (){
  1528. var self=this;
  1529. return smalltalk.withContext(function($ctx1) {
  1530. var $2,$5,$4,$3,$1;
  1531. $2=self._collection();
  1532. $ctx1.sendIdx["collection"]=1;
  1533. $5=self._collection();
  1534. $4=_st($5)._size();
  1535. $3=_st($4).__plus((1));
  1536. $1=_st($2)._at_ifAbsent_($3,(function(){
  1537. return smalltalk.withContext(function($ctx2) {
  1538. return "none";
  1539. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1540. self._assert_equals_($1,"none");
  1541. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  1542. args: [],
  1543. source: "testAtIfAbsent\x0a\x09self assert: (self collection at: (self collection size + 1) ifAbsent: [ 'none' ]) equals: 'none'",
  1544. messageSends: ["assert:equals:", "at:ifAbsent:", "collection", "+", "size"],
  1545. referencedClasses: []
  1546. }),
  1547. smalltalk.IndexableCollectionTest);
  1548. smalltalk.addMethod(
  1549. smalltalk.method({
  1550. selector: "testContains",
  1551. category: 'tests',
  1552. fn: function (){
  1553. var self=this;
  1554. var collection;
  1555. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1556. return smalltalk.withContext(function($ctx1) {
  1557. var $2,$4,$3,$1,$6,$5;
  1558. collection=self._collection();
  1559. $ctx1.sendIdx["collection"]=1;
  1560. $2=self._collection();
  1561. $ctx1.sendIdx["collection"]=2;
  1562. $1=_st($2)._contains_((function(each){
  1563. return smalltalk.withContext(function($ctx2) {
  1564. $4=self._collection();
  1565. $ctx2.sendIdx["collection"]=3;
  1566. $3=_st($4)._first();
  1567. return _st(each).__eq($3);
  1568. $ctx2.sendIdx["="]=1;
  1569. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1570. $ctx1.sendIdx["contains:"]=1;
  1571. self._assert_($1);
  1572. $6=self._collection();
  1573. $5=_st($6)._contains_((function(each){
  1574. return smalltalk.withContext(function($ctx2) {
  1575. return _st(each).__eq(_st($Object())._new());
  1576. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1577. self._deny_($5);
  1578. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1579. args: [],
  1580. source: "testContains\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self assert: (self collection contains: [ :each | each = self collection first ]).\x0a\x09self deny: (self collection contains: [ :each | each = Object new ])",
  1581. messageSends: ["collection", "assert:", "contains:", "=", "first", "deny:", "new"],
  1582. referencedClasses: ["Object"]
  1583. }),
  1584. smalltalk.IndexableCollectionTest);
  1585. smalltalk.addMethod(
  1586. smalltalk.method({
  1587. selector: "testIndexOf",
  1588. category: 'tests',
  1589. fn: function (){
  1590. var self=this;
  1591. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1592. return smalltalk.withContext(function($ctx1) {
  1593. var $2,$1,$3,$5,$4;
  1594. $2=self._collection();
  1595. $ctx1.sendIdx["collection"]=1;
  1596. $1=_st($2)._indexOf_((2));
  1597. $ctx1.sendIdx["indexOf:"]=1;
  1598. self._assert_equals_($1,(2));
  1599. $ctx1.sendIdx["assert:equals:"]=1;
  1600. self._should_raise_((function(){
  1601. return smalltalk.withContext(function($ctx2) {
  1602. $3=self._collection();
  1603. $ctx2.sendIdx["collection"]=2;
  1604. return _st($3)._indexOf_((999));
  1605. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1606. $5=self._collection();
  1607. $4=_st($5)._indexOf_ifAbsent_((999),(function(){
  1608. return smalltalk.withContext(function($ctx2) {
  1609. return "sentinel";
  1610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1611. self._assert_equals_($4,"sentinel");
  1612. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  1613. args: [],
  1614. 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'",
  1615. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1616. referencedClasses: ["Error"]
  1617. }),
  1618. smalltalk.IndexableCollectionTest);
  1619. smalltalk.addMethod(
  1620. smalltalk.method({
  1621. selector: "testWithIndexDo",
  1622. category: 'tests',
  1623. fn: function (){
  1624. var self=this;
  1625. var collection;
  1626. return smalltalk.withContext(function($ctx1) {
  1627. var $1;
  1628. collection=self._collection();
  1629. $ctx1.sendIdx["collection"]=1;
  1630. $1=self._collection();
  1631. _st($1)._withIndexDo_((function(each,index){
  1632. return smalltalk.withContext(function($ctx2) {
  1633. return self._assert_equals_(_st(collection)._at_(index),each);
  1634. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  1635. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1636. args: [],
  1637. 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 ]",
  1638. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  1639. referencedClasses: []
  1640. }),
  1641. smalltalk.IndexableCollectionTest);
  1642. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1643. smalltalk.addMethod(
  1644. smalltalk.method({
  1645. selector: "collection",
  1646. category: 'accessing',
  1647. fn: function (){
  1648. var self=this;
  1649. return smalltalk.withContext(function($ctx1) {
  1650. var $2,$3,$4,$5,$1;
  1651. $2="b".__minus_gt((1));
  1652. $ctx1.sendIdx["->"]=1;
  1653. $3="a".__minus_gt((2));
  1654. $ctx1.sendIdx["->"]=2;
  1655. $4="c".__minus_gt((3));
  1656. $ctx1.sendIdx["->"]=3;
  1657. $5="d".__minus_gt((-4));
  1658. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5]);
  1659. return $1;
  1660. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  1661. args: [],
  1662. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  1663. messageSends: ["->"],
  1664. referencedClasses: []
  1665. }),
  1666. smalltalk.HashedCollectionTest);
  1667. smalltalk.addMethod(
  1668. smalltalk.method({
  1669. selector: "collectionWithDuplicates",
  1670. category: 'accessing',
  1671. fn: function (){
  1672. var self=this;
  1673. return smalltalk.withContext(function($ctx1) {
  1674. var $2,$3,$4,$5,$6,$7,$8,$1;
  1675. $2="b".__minus_gt((1));
  1676. $ctx1.sendIdx["->"]=1;
  1677. $3="a".__minus_gt((2));
  1678. $ctx1.sendIdx["->"]=2;
  1679. $4="c".__minus_gt((3));
  1680. $ctx1.sendIdx["->"]=3;
  1681. $5="d".__minus_gt((-4));
  1682. $ctx1.sendIdx["->"]=4;
  1683. $6="e".__minus_gt((1));
  1684. $ctx1.sendIdx["->"]=5;
  1685. $7="f".__minus_gt((2));
  1686. $ctx1.sendIdx["->"]=6;
  1687. $8="g".__minus_gt((10));
  1688. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,$8]);
  1689. return $1;
  1690. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  1691. args: [],
  1692. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  1693. messageSends: ["->"],
  1694. referencedClasses: []
  1695. }),
  1696. smalltalk.HashedCollectionTest);
  1697. smalltalk.addMethod(
  1698. smalltalk.method({
  1699. selector: "testAsDictionary",
  1700. category: 'tests',
  1701. fn: function (){
  1702. var self=this;
  1703. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1704. return smalltalk.withContext(function($ctx1) {
  1705. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  1706. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  1707. args: [],
  1708. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  1709. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  1710. referencedClasses: ["Dictionary"]
  1711. }),
  1712. smalltalk.HashedCollectionTest);
  1713. smalltalk.addMethod(
  1714. smalltalk.method({
  1715. selector: "testAt",
  1716. category: 'tests',
  1717. fn: function (){
  1718. var self=this;
  1719. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1720. return smalltalk.withContext(function($ctx1) {
  1721. var $2,$1,$3;
  1722. $2=self._collection();
  1723. $ctx1.sendIdx["collection"]=1;
  1724. $1=_st($2)._at_("a");
  1725. $ctx1.sendIdx["at:"]=1;
  1726. self._assert_equals_($1,(2));
  1727. self._should_raise_((function(){
  1728. return smalltalk.withContext(function($ctx2) {
  1729. $3=self._collection();
  1730. return _st($3)._at_((5));
  1731. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1732. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.HashedCollectionTest)})},
  1733. args: [],
  1734. source: "testAt\x0a\x09self assert: (self collection at: 'a') equals: 2.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1735. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1736. referencedClasses: ["Error"]
  1737. }),
  1738. smalltalk.HashedCollectionTest);
  1739. smalltalk.addMethod(
  1740. smalltalk.method({
  1741. selector: "testContains",
  1742. category: 'tests',
  1743. fn: function (){
  1744. var self=this;
  1745. var collection;
  1746. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1747. return smalltalk.withContext(function($ctx1) {
  1748. var $2,$5,$4,$3,$1,$7,$6;
  1749. collection=self._collection();
  1750. $ctx1.sendIdx["collection"]=1;
  1751. $2=self._collection();
  1752. $ctx1.sendIdx["collection"]=2;
  1753. $1=_st($2)._contains_((function(each){
  1754. return smalltalk.withContext(function($ctx2) {
  1755. $5=self._collection();
  1756. $ctx2.sendIdx["collection"]=3;
  1757. $4=_st($5)._values();
  1758. $3=_st($4)._first();
  1759. return _st(each).__eq($3);
  1760. $ctx2.sendIdx["="]=1;
  1761. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1762. $ctx1.sendIdx["contains:"]=1;
  1763. self._assert_($1);
  1764. $7=self._collection();
  1765. $6=_st($7)._contains_((function(each){
  1766. return smalltalk.withContext(function($ctx2) {
  1767. return _st(each).__eq(_st($Object())._new());
  1768. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1769. self._deny_($6);
  1770. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.HashedCollectionTest)})},
  1771. args: [],
  1772. source: "testContains\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self assert: (self collection contains: [ :each | each = self collection values first ]).\x0a\x09self deny: (self collection contains: [ :each | each = Object new ])",
  1773. messageSends: ["collection", "assert:", "contains:", "=", "first", "values", "deny:", "new"],
  1774. referencedClasses: ["Object"]
  1775. }),
  1776. smalltalk.HashedCollectionTest);
  1777. smalltalk.addMethod(
  1778. smalltalk.method({
  1779. selector: "testFrom",
  1780. category: 'tests',
  1781. fn: function (){
  1782. var self=this;
  1783. var associations;
  1784. return smalltalk.withContext(function($ctx1) {
  1785. var $1,$2,$3,$5,$6,$4;
  1786. $1="a".__minus_gt((1));
  1787. $ctx1.sendIdx["->"]=1;
  1788. $2="b".__minus_gt((2));
  1789. $ctx1.sendIdx["->"]=2;
  1790. associations=[$1,$2];
  1791. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  1792. $5="a".__minus_gt((1));
  1793. $ctx1.sendIdx["->"]=3;
  1794. $6="b".__minus_gt((2));
  1795. $4=smalltalk.HashedCollection._from_([$5,$6]);
  1796. self._assertSameContents_as_($3,$4);
  1797. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  1798. args: [],
  1799. source: "testFrom\x0a\x22Accept a collection of associations.\x22\x0a| associations |\x0aassociations := { 'a' -> 1. 'b' -> 2 }.\x0aself assertSameContents: ( self class collectionClass from: associations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  1800. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  1801. referencedClasses: []
  1802. }),
  1803. smalltalk.HashedCollectionTest);
  1804. smalltalk.addMethod(
  1805. smalltalk.method({
  1806. selector: "testIndexOf",
  1807. category: 'tests',
  1808. fn: function (){
  1809. var self=this;
  1810. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1811. return smalltalk.withContext(function($ctx1) {
  1812. var $2,$1,$3,$5,$4;
  1813. $2=self._collection();
  1814. $ctx1.sendIdx["collection"]=1;
  1815. $1=_st($2)._indexOf_((2));
  1816. $ctx1.sendIdx["indexOf:"]=1;
  1817. self._assert_equals_($1,"a");
  1818. $ctx1.sendIdx["assert:equals:"]=1;
  1819. self._should_raise_((function(){
  1820. return smalltalk.withContext(function($ctx2) {
  1821. $3=self._collection();
  1822. $ctx2.sendIdx["collection"]=2;
  1823. return _st($3)._indexOf_((999));
  1824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1825. $5=self._collection();
  1826. $4=_st($5)._indexOf_ifAbsent_((999),(function(){
  1827. return smalltalk.withContext(function($ctx2) {
  1828. return "sentinel";
  1829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1830. self._assert_equals_($4,"sentinel");
  1831. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.HashedCollectionTest)})},
  1832. args: [],
  1833. 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'",
  1834. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1835. referencedClasses: ["Error"]
  1836. }),
  1837. smalltalk.HashedCollectionTest);
  1838. smalltalk.addMethod(
  1839. smalltalk.method({
  1840. selector: "testNewFromPairs",
  1841. category: 'tests',
  1842. fn: function (){
  1843. var self=this;
  1844. var flattenedAssociations;
  1845. return smalltalk.withContext(function($ctx1) {
  1846. var $1,$3,$4,$2;
  1847. flattenedAssociations=["a",(1),"b",(2)];
  1848. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  1849. $3="a".__minus_gt((1));
  1850. $ctx1.sendIdx["->"]=1;
  1851. $4="b".__minus_gt((2));
  1852. $2=smalltalk.HashedCollection._from_([$3,$4]);
  1853. self._assertSameContents_as_($1,$2);
  1854. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  1855. args: [],
  1856. source: "testNewFromPairs\x0a\x22Accept an array in which all odd indexes are keys and evens are values.\x22\x0a| flattenedAssociations |\x0aflattenedAssociations := { 'a'. 1. 'b'. 2 }.\x0aself assertSameContents: ( self class collectionClass newFromPairs: flattenedAssociations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  1857. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  1858. referencedClasses: []
  1859. }),
  1860. smalltalk.HashedCollectionTest);
  1861. smalltalk.addMethod(
  1862. smalltalk.method({
  1863. selector: "collectionClass",
  1864. category: 'accessing',
  1865. fn: function (){
  1866. var self=this;
  1867. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1868. return smalltalk.withContext(function($ctx1) {
  1869. return $HashedCollection();
  1870. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  1871. args: [],
  1872. source: "collectionClass\x0a\x09^ HashedCollection",
  1873. messageSends: [],
  1874. referencedClasses: ["HashedCollection"]
  1875. }),
  1876. smalltalk.HashedCollectionTest.klass);
  1877. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  1878. smalltalk.addMethod(
  1879. smalltalk.method({
  1880. selector: "collection",
  1881. category: 'accessing',
  1882. fn: function (){
  1883. var self=this;
  1884. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1885. return smalltalk.withContext(function($ctx1) {
  1886. var $2,$3,$1;
  1887. $2=_st($Dictionary())._new();
  1888. _st($2)._at_put_((1),(1));
  1889. $ctx1.sendIdx["at:put:"]=1;
  1890. _st($2)._at_put_("a",(2));
  1891. $ctx1.sendIdx["at:put:"]=2;
  1892. _st($2)._at_put_(true,(3));
  1893. $ctx1.sendIdx["at:put:"]=3;
  1894. _st($2)._at_put_((4),(-4));
  1895. $3=_st($2)._yourself();
  1896. $1=$3;
  1897. return $1;
  1898. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  1899. args: [],
  1900. 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",
  1901. messageSends: ["at:put:", "new", "yourself"],
  1902. referencedClasses: ["Dictionary"]
  1903. }),
  1904. smalltalk.DictionaryTest);
  1905. smalltalk.addMethod(
  1906. smalltalk.method({
  1907. selector: "collectionWithDuplicates",
  1908. category: 'accessing',
  1909. fn: function (){
  1910. var self=this;
  1911. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1912. return smalltalk.withContext(function($ctx1) {
  1913. var $2,$3,$1;
  1914. $2=_st($Dictionary())._new();
  1915. _st($2)._at_put_((1),(1));
  1916. $ctx1.sendIdx["at:put:"]=1;
  1917. _st($2)._at_put_("a",(2));
  1918. $ctx1.sendIdx["at:put:"]=2;
  1919. _st($2)._at_put_(true,(3));
  1920. $ctx1.sendIdx["at:put:"]=3;
  1921. _st($2)._at_put_((4),(-4));
  1922. $ctx1.sendIdx["at:put:"]=4;
  1923. _st($2)._at_put_("b",(1));
  1924. $ctx1.sendIdx["at:put:"]=5;
  1925. _st($2)._at_put_((3),(3));
  1926. $ctx1.sendIdx["at:put:"]=6;
  1927. _st($2)._at_put_(false,(12));
  1928. $3=_st($2)._yourself();
  1929. $1=$3;
  1930. return $1;
  1931. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  1932. args: [],
  1933. 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",
  1934. messageSends: ["at:put:", "new", "yourself"],
  1935. referencedClasses: ["Dictionary"]
  1936. }),
  1937. smalltalk.DictionaryTest);
  1938. smalltalk.addMethod(
  1939. smalltalk.method({
  1940. selector: "testAccessing",
  1941. category: 'tests',
  1942. fn: function (){
  1943. var self=this;
  1944. var d;
  1945. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1946. return smalltalk.withContext(function($ctx1) {
  1947. var $1,$2,$4,$3,$5,$6,$7,$8,$9,$11,$12,$10,$14,$15,$13,$17,$18,$16;
  1948. d=_st($Dictionary())._new();
  1949. _st(d)._at_put_("hello","world");
  1950. $ctx1.sendIdx["at:put:"]=1;
  1951. $1=_st(d)._at_("hello");
  1952. $ctx1.sendIdx["at:"]=1;
  1953. self._assert_equals_($1,"world");
  1954. $ctx1.sendIdx["assert:equals:"]=1;
  1955. $2=_st(d)._at_ifAbsent_("hello",(function(){
  1956. return smalltalk.withContext(function($ctx2) {
  1957. return nil;
  1958. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1959. $ctx1.sendIdx["at:ifAbsent:"]=1;
  1960. self._assert_equals_($2,"world");
  1961. $ctx1.sendIdx["assert:equals:"]=2;
  1962. $4=_st(d)._at_ifAbsent_("foo",(function(){
  1963. return smalltalk.withContext(function($ctx2) {
  1964. return nil;
  1965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1966. $3=_st($4).__eq("world");
  1967. self._deny_($3);
  1968. $ctx1.sendIdx["deny:"]=1;
  1969. $5=_st(d)._includesKey_("hello");
  1970. $ctx1.sendIdx["includesKey:"]=1;
  1971. self._assert_($5);
  1972. $ctx1.sendIdx["assert:"]=1;
  1973. $6=_st(d)._includesKey_("foo");
  1974. $ctx1.sendIdx["includesKey:"]=2;
  1975. self._deny_($6);
  1976. $ctx1.sendIdx["deny:"]=2;
  1977. _st(d)._at_put_((1),(2));
  1978. $ctx1.sendIdx["at:put:"]=2;
  1979. $7=_st(d)._at_((1));
  1980. $ctx1.sendIdx["at:"]=2;
  1981. self._assert_equals_($7,(2));
  1982. $ctx1.sendIdx["assert:equals:"]=3;
  1983. $8=d;
  1984. $9=(1).__at((3));
  1985. $ctx1.sendIdx["@"]=1;
  1986. _st($8)._at_put_($9,(3));
  1987. $11=d;
  1988. $12=(1).__at((3));
  1989. $ctx1.sendIdx["@"]=2;
  1990. $10=_st($11)._at_($12);
  1991. self._assert_equals_($10,(3));
  1992. $14=d;
  1993. $15=(1).__at((3));
  1994. $ctx1.sendIdx["@"]=3;
  1995. $13=_st($14)._includesKey_($15);
  1996. $ctx1.sendIdx["includesKey:"]=3;
  1997. self._assert_($13);
  1998. $17=d;
  1999. $18=(3).__at((1));
  2000. $16=_st($17)._includesKey_($18);
  2001. self._deny_($16);
  2002. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  2003. args: [],
  2004. 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)",
  2005. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  2006. referencedClasses: ["Dictionary"]
  2007. }),
  2008. smalltalk.DictionaryTest);
  2009. smalltalk.addMethod(
  2010. smalltalk.method({
  2011. selector: "testAsHashedCollection",
  2012. category: 'tests',
  2013. fn: function (){
  2014. var self=this;
  2015. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2016. return smalltalk.withContext(function($ctx1) {
  2017. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2018. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  2019. args: [],
  2020. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2021. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2022. referencedClasses: ["HashedCollection"]
  2023. }),
  2024. smalltalk.DictionaryTest);
  2025. smalltalk.addMethod(
  2026. smalltalk.method({
  2027. selector: "testDynamicDictionaries",
  2028. category: 'tests',
  2029. fn: function (){
  2030. var self=this;
  2031. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2032. return smalltalk.withContext(function($ctx1) {
  2033. var $3,$2,$1,$5,$4;
  2034. $3="hello".__minus_gt((1));
  2035. $ctx1.sendIdx["->"]=1;
  2036. $2=smalltalk.HashedCollection._from_([$3]);
  2037. $1=_st($2)._asDictionary();
  2038. $5="hello".__minus_gt((1));
  2039. $4=_st($Dictionary())._with_($5);
  2040. self._assert_equals_($1,$4);
  2041. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  2042. args: [],
  2043. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  2044. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  2045. referencedClasses: ["Dictionary"]
  2046. }),
  2047. smalltalk.DictionaryTest);
  2048. smalltalk.addMethod(
  2049. smalltalk.method({
  2050. selector: "testEquality",
  2051. category: 'tests',
  2052. fn: function (){
  2053. var self=this;
  2054. var d1,d2;
  2055. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2056. return smalltalk.withContext(function($ctx1) {
  2057. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17;
  2058. $2=_st($Dictionary())._new();
  2059. $ctx1.sendIdx["new"]=1;
  2060. $3=_st($Dictionary())._new();
  2061. $ctx1.sendIdx["new"]=2;
  2062. $1=_st($2).__eq($3);
  2063. $ctx1.sendIdx["="]=1;
  2064. self._assert_($1);
  2065. $ctx1.sendIdx["assert:"]=1;
  2066. $4=_st($Dictionary())._new();
  2067. $ctx1.sendIdx["new"]=3;
  2068. _st($4)._at_put_((1),(2));
  2069. $ctx1.sendIdx["at:put:"]=1;
  2070. $5=_st($4)._yourself();
  2071. $ctx1.sendIdx["yourself"]=1;
  2072. d1=$5;
  2073. $6=_st($Dictionary())._new();
  2074. $ctx1.sendIdx["new"]=4;
  2075. _st($6)._at_put_((1),(2));
  2076. $ctx1.sendIdx["at:put:"]=2;
  2077. $7=_st($6)._yourself();
  2078. $ctx1.sendIdx["yourself"]=2;
  2079. d2=$7;
  2080. $8=_st(d1).__eq(d2);
  2081. $ctx1.sendIdx["="]=2;
  2082. self._assert_($8);
  2083. $9=_st($Dictionary())._new();
  2084. $ctx1.sendIdx["new"]=5;
  2085. _st($9)._at_put_((1),(3));
  2086. $ctx1.sendIdx["at:put:"]=3;
  2087. $10=_st($9)._yourself();
  2088. $ctx1.sendIdx["yourself"]=3;
  2089. d2=$10;
  2090. $11=_st(d1).__eq(d2);
  2091. $ctx1.sendIdx["="]=3;
  2092. self._deny_($11);
  2093. $ctx1.sendIdx["deny:"]=1;
  2094. $12=_st($Dictionary())._new();
  2095. $ctx1.sendIdx["new"]=6;
  2096. _st($12)._at_put_((2),(2));
  2097. $ctx1.sendIdx["at:put:"]=4;
  2098. $13=_st($12)._yourself();
  2099. $ctx1.sendIdx["yourself"]=4;
  2100. d2=$13;
  2101. $14=_st(d1).__eq(d2);
  2102. $ctx1.sendIdx["="]=4;
  2103. self._deny_($14);
  2104. $ctx1.sendIdx["deny:"]=2;
  2105. $15=_st($Dictionary())._new();
  2106. _st($15)._at_put_((1),(2));
  2107. $ctx1.sendIdx["at:put:"]=5;
  2108. _st($15)._at_put_((3),(4));
  2109. $16=_st($15)._yourself();
  2110. d2=$16;
  2111. $17=_st(d1).__eq(d2);
  2112. self._deny_($17);
  2113. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  2114. args: [],
  2115. 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.",
  2116. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  2117. referencedClasses: ["Dictionary"]
  2118. }),
  2119. smalltalk.DictionaryTest);
  2120. smalltalk.addMethod(
  2121. smalltalk.method({
  2122. selector: "testIfAbsent",
  2123. category: 'tests',
  2124. fn: function (){
  2125. var self=this;
  2126. var d,visited;
  2127. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2128. return smalltalk.withContext(function($ctx1) {
  2129. visited=false;
  2130. d=_st($Dictionary())._new();
  2131. _st(d)._at_ifAbsent_("hello",(function(){
  2132. return smalltalk.withContext(function($ctx2) {
  2133. visited=true;
  2134. return visited;
  2135. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2136. self._assert_(visited);
  2137. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  2138. args: [],
  2139. 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.",
  2140. messageSends: ["new", "at:ifAbsent:", "assert:"],
  2141. referencedClasses: ["Dictionary"]
  2142. }),
  2143. smalltalk.DictionaryTest);
  2144. smalltalk.addMethod(
  2145. smalltalk.method({
  2146. selector: "testIfPresent",
  2147. category: 'tests',
  2148. fn: function (){
  2149. var self=this;
  2150. var d,visited,absent;
  2151. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2152. return smalltalk.withContext(function($ctx1) {
  2153. visited=false;
  2154. d=_st($Dictionary())._new();
  2155. _st(d)._at_put_("hello","world");
  2156. _st(d)._at_ifPresent_("hello",(function(value){
  2157. return smalltalk.withContext(function($ctx2) {
  2158. visited=value;
  2159. return visited;
  2160. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}));
  2161. $ctx1.sendIdx["at:ifPresent:"]=1;
  2162. self._assert_equals_(visited,"world");
  2163. absent=_st(d)._at_ifPresent_("bye",(function(value){
  2164. return smalltalk.withContext(function($ctx2) {
  2165. visited=value;
  2166. return visited;
  2167. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,2)})}));
  2168. self._assert_(_st(absent)._isNil());
  2169. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent},smalltalk.DictionaryTest)})},
  2170. args: [],
  2171. 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.",
  2172. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"],
  2173. referencedClasses: ["Dictionary"]
  2174. }),
  2175. smalltalk.DictionaryTest);
  2176. smalltalk.addMethod(
  2177. smalltalk.method({
  2178. selector: "testIfPresentIfAbsent",
  2179. category: 'tests',
  2180. fn: function (){
  2181. var self=this;
  2182. var d,visited;
  2183. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2184. return smalltalk.withContext(function($ctx1) {
  2185. visited=false;
  2186. d=_st($Dictionary())._new();
  2187. _st(d)._at_put_("hello","world");
  2188. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  2189. return smalltalk.withContext(function($ctx2) {
  2190. visited=value;
  2191. return visited;
  2192. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}),(function(){
  2193. return smalltalk.withContext(function($ctx2) {
  2194. visited=true;
  2195. return visited;
  2196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2197. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2198. self._assert_equals_(visited,"world");
  2199. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  2200. return smalltalk.withContext(function($ctx2) {
  2201. visited=value;
  2202. return visited;
  2203. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,3)})}),(function(){
  2204. return smalltalk.withContext(function($ctx2) {
  2205. visited=true;
  2206. return visited;
  2207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  2208. self._assert_(visited);
  2209. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  2210. args: [],
  2211. 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.",
  2212. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"],
  2213. referencedClasses: ["Dictionary"]
  2214. }),
  2215. smalltalk.DictionaryTest);
  2216. smalltalk.addMethod(
  2217. smalltalk.method({
  2218. selector: "testKeys",
  2219. category: 'tests',
  2220. fn: function (){
  2221. var self=this;
  2222. var d;
  2223. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2224. return smalltalk.withContext(function($ctx1) {
  2225. d=_st($Dictionary())._new();
  2226. _st(d)._at_put_((1),(2));
  2227. $ctx1.sendIdx["at:put:"]=1;
  2228. _st(d)._at_put_((2),(3));
  2229. $ctx1.sendIdx["at:put:"]=2;
  2230. _st(d)._at_put_((3),(4));
  2231. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  2232. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  2233. args: [],
  2234. 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)",
  2235. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  2236. referencedClasses: ["Dictionary"]
  2237. }),
  2238. smalltalk.DictionaryTest);
  2239. smalltalk.addMethod(
  2240. smalltalk.method({
  2241. selector: "testPointKey",
  2242. category: 'tests',
  2243. fn: function (){
  2244. var self=this;
  2245. var d;
  2246. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2247. return smalltalk.withContext(function($ctx1) {
  2248. var $1,$2,$4,$5,$3,$6,$7,$9,$10,$8,$11,$12,$14,$15,$13,$17,$18,$16;
  2249. d=_st($Dictionary())._new();
  2250. $1=d;
  2251. $2=(1).__at((1));
  2252. $ctx1.sendIdx["@"]=1;
  2253. _st($1)._at_put_($2,"foo");
  2254. $ctx1.sendIdx["at:put:"]=1;
  2255. $4=d;
  2256. $5=(1).__at((1));
  2257. $ctx1.sendIdx["@"]=2;
  2258. $3=_st($4)._at_($5);
  2259. $ctx1.sendIdx["at:"]=1;
  2260. self._assert_equals_($3,"foo");
  2261. $ctx1.sendIdx["assert:equals:"]=1;
  2262. $6=d;
  2263. $7=(1).__at((1));
  2264. $ctx1.sendIdx["@"]=3;
  2265. _st($6)._at_put_($7,"bar");
  2266. $9=d;
  2267. $10=(1).__at((1));
  2268. $ctx1.sendIdx["@"]=4;
  2269. $8=_st($9)._at_($10);
  2270. self._assert_equals_($8,"bar");
  2271. $ctx1.sendIdx["assert:equals:"]=2;
  2272. $11=d;
  2273. $12=(1).__at((1));
  2274. $ctx1.sendIdx["@"]=5;
  2275. _st($11)._removeKey_($12);
  2276. $14=d;
  2277. $15=(1).__at((1));
  2278. $ctx1.sendIdx["@"]=6;
  2279. $13=_st($14)._at_ifAbsent_($15,(function(){
  2280. return smalltalk.withContext(function($ctx2) {
  2281. return "baz";
  2282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2283. self._assert_equals_($13,"baz");
  2284. $17=d;
  2285. $18=(1).__at((1));
  2286. $16=_st($17)._includesKey_($18);
  2287. self._deny_($16);
  2288. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  2289. args: [],
  2290. 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)",
  2291. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  2292. referencedClasses: ["Dictionary"]
  2293. }),
  2294. smalltalk.DictionaryTest);
  2295. smalltalk.addMethod(
  2296. smalltalk.method({
  2297. selector: "testPrintString",
  2298. category: 'tests',
  2299. fn: function (){
  2300. var self=this;
  2301. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2302. return smalltalk.withContext(function($ctx1) {
  2303. var $2,$3,$1;
  2304. $2=_st($Dictionary())._new();
  2305. _st($2)._at_put_("firstname","James");
  2306. $ctx1.sendIdx["at:put:"]=1;
  2307. _st($2)._at_put_("lastname","Bond");
  2308. $3=_st($2)._printString();
  2309. $1=$3;
  2310. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2311. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  2312. args: [],
  2313. 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'')'",
  2314. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  2315. referencedClasses: ["Dictionary"]
  2316. }),
  2317. smalltalk.DictionaryTest);
  2318. smalltalk.addMethod(
  2319. smalltalk.method({
  2320. selector: "testRemoveKey",
  2321. category: 'tests',
  2322. fn: function (){
  2323. var self=this;
  2324. var d,key;
  2325. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2326. return smalltalk.withContext(function($ctx1) {
  2327. var $1,$2;
  2328. d=_st($Dictionary())._new();
  2329. _st(d)._at_put_((1),(2));
  2330. $ctx1.sendIdx["at:put:"]=1;
  2331. _st(d)._at_put_((2),(3));
  2332. $ctx1.sendIdx["at:put:"]=2;
  2333. _st(d)._at_put_((3),(4));
  2334. key=(2);
  2335. $1=_st(d)._keys();
  2336. $ctx1.sendIdx["keys"]=1;
  2337. self._assert_equals_($1,[(1), (2), (3)]);
  2338. $ctx1.sendIdx["assert:equals:"]=1;
  2339. _st(d)._removeKey_(key);
  2340. $2=_st(d)._keys();
  2341. self._assert_equals_($2,[(1), (3)]);
  2342. $ctx1.sendIdx["assert:equals:"]=2;
  2343. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  2344. self._deny_(_st(d)._includesKey_((2)));
  2345. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  2346. args: [],
  2347. 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)",
  2348. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  2349. referencedClasses: ["Dictionary"]
  2350. }),
  2351. smalltalk.DictionaryTest);
  2352. smalltalk.addMethod(
  2353. smalltalk.method({
  2354. selector: "testRemoveKeyIfAbsent",
  2355. category: 'tests',
  2356. fn: function (){
  2357. var self=this;
  2358. var d,key;
  2359. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2360. return smalltalk.withContext(function($ctx1) {
  2361. var $1,$2;
  2362. d=_st($Dictionary())._new();
  2363. _st(d)._at_put_((1),(2));
  2364. $ctx1.sendIdx["at:put:"]=1;
  2365. _st(d)._at_put_((2),(3));
  2366. $ctx1.sendIdx["at:put:"]=2;
  2367. _st(d)._at_put_((3),(4));
  2368. key=(2);
  2369. self._assert_equals_(_st(d)._removeKey_(key),(3));
  2370. $ctx1.sendIdx["assert:equals:"]=1;
  2371. key=(3);
  2372. $1=_st(d)._removeKey_ifAbsent_(key,(function(){
  2373. return smalltalk.withContext(function($ctx2) {
  2374. return (42);
  2375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2376. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  2377. self._assert_equals_($1,(4));
  2378. $ctx1.sendIdx["assert:equals:"]=2;
  2379. key="why";
  2380. $2=_st(d)._removeKey_ifAbsent_(key,(function(){
  2381. return smalltalk.withContext(function($ctx2) {
  2382. return (42);
  2383. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2384. self._assert_equals_($2,(42));
  2385. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  2386. args: [],
  2387. 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.",
  2388. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  2389. referencedClasses: ["Dictionary"]
  2390. }),
  2391. smalltalk.DictionaryTest);
  2392. smalltalk.addMethod(
  2393. smalltalk.method({
  2394. selector: "testSize",
  2395. category: 'tests',
  2396. fn: function (){
  2397. var self=this;
  2398. var d;
  2399. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2400. return smalltalk.withContext(function($ctx1) {
  2401. var $1,$2,$3;
  2402. d=_st($Dictionary())._new();
  2403. $1=_st(d)._size();
  2404. $ctx1.sendIdx["size"]=1;
  2405. self._assert_equals_($1,(0));
  2406. $ctx1.sendIdx["assert:equals:"]=1;
  2407. _st(d)._at_put_((1),(2));
  2408. $ctx1.sendIdx["at:put:"]=1;
  2409. $2=_st(d)._size();
  2410. $ctx1.sendIdx["size"]=2;
  2411. self._assert_equals_($2,(1));
  2412. $ctx1.sendIdx["assert:equals:"]=2;
  2413. _st(d)._at_put_((2),(3));
  2414. $3=_st(d)._size();
  2415. self._assert_equals_($3,(2));
  2416. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d},smalltalk.DictionaryTest)})},
  2417. args: [],
  2418. 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.",
  2419. messageSends: ["new", "assert:equals:", "size", "at:put:"],
  2420. referencedClasses: ["Dictionary"]
  2421. }),
  2422. smalltalk.DictionaryTest);
  2423. smalltalk.addMethod(
  2424. smalltalk.method({
  2425. selector: "testValues",
  2426. category: 'tests',
  2427. fn: function (){
  2428. var self=this;
  2429. var d;
  2430. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2431. return smalltalk.withContext(function($ctx1) {
  2432. d=_st($Dictionary())._new();
  2433. _st(d)._at_put_((1),(2));
  2434. $ctx1.sendIdx["at:put:"]=1;
  2435. _st(d)._at_put_((2),(3));
  2436. $ctx1.sendIdx["at:put:"]=2;
  2437. _st(d)._at_put_((3),(4));
  2438. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  2439. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  2440. args: [],
  2441. 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)",
  2442. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  2443. referencedClasses: ["Dictionary"]
  2444. }),
  2445. smalltalk.DictionaryTest);
  2446. smalltalk.addMethod(
  2447. smalltalk.method({
  2448. selector: "collectionClass",
  2449. category: 'accessing',
  2450. fn: function (){
  2451. var self=this;
  2452. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2453. return smalltalk.withContext(function($ctx1) {
  2454. return $Dictionary();
  2455. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  2456. args: [],
  2457. source: "collectionClass\x0a\x09^ Dictionary",
  2458. messageSends: [],
  2459. referencedClasses: ["Dictionary"]
  2460. }),
  2461. smalltalk.DictionaryTest.klass);
  2462. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2463. smalltalk.addMethod(
  2464. smalltalk.method({
  2465. selector: "testFirst",
  2466. category: 'tests',
  2467. fn: function (){
  2468. var self=this;
  2469. return smalltalk.withContext(function($ctx1) {
  2470. var $2,$1,$4,$3;
  2471. $2=self._collection();
  2472. $ctx1.sendIdx["collection"]=1;
  2473. $1=_st($2)._first();
  2474. $4=self._collection();
  2475. $3=_st($4)._at_((1));
  2476. self._assert_equals_($1,$3);
  2477. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  2478. args: [],
  2479. source: "testFirst\x0a\x09self assert: (self collection first) equals: (self collection at: 1)",
  2480. messageSends: ["assert:equals:", "first", "collection", "at:"],
  2481. referencedClasses: []
  2482. }),
  2483. smalltalk.SequenceableCollectionTest);
  2484. smalltalk.addMethod(
  2485. smalltalk.method({
  2486. selector: "testFourth",
  2487. category: 'tests',
  2488. fn: function (){
  2489. var self=this;
  2490. return smalltalk.withContext(function($ctx1) {
  2491. var $2,$1,$4,$3;
  2492. $2=self._collection();
  2493. $ctx1.sendIdx["collection"]=1;
  2494. $1=_st($2)._fourth();
  2495. $4=self._collection();
  2496. $3=_st($4)._at_((4));
  2497. self._assert_equals_($1,$3);
  2498. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  2499. args: [],
  2500. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  2501. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  2502. referencedClasses: []
  2503. }),
  2504. smalltalk.SequenceableCollectionTest);
  2505. smalltalk.addMethod(
  2506. smalltalk.method({
  2507. selector: "testLast",
  2508. category: 'tests',
  2509. fn: function (){
  2510. var self=this;
  2511. return smalltalk.withContext(function($ctx1) {
  2512. var $2,$1,$4,$6,$5,$3;
  2513. $2=self._collection();
  2514. $ctx1.sendIdx["collection"]=1;
  2515. $1=_st($2)._last();
  2516. $4=self._collection();
  2517. $ctx1.sendIdx["collection"]=2;
  2518. $6=self._collection();
  2519. $5=_st($6)._size();
  2520. $3=_st($4)._at_($5);
  2521. self._assert_equals_($1,$3);
  2522. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  2523. args: [],
  2524. source: "testLast\x0a\x09self assert: (self collection last) equals: (self collection at: self collection size)",
  2525. messageSends: ["assert:equals:", "last", "collection", "at:", "size"],
  2526. referencedClasses: []
  2527. }),
  2528. smalltalk.SequenceableCollectionTest);
  2529. smalltalk.addMethod(
  2530. smalltalk.method({
  2531. selector: "testSecond",
  2532. category: 'tests',
  2533. fn: function (){
  2534. var self=this;
  2535. return smalltalk.withContext(function($ctx1) {
  2536. var $2,$1,$4,$3;
  2537. $2=self._collection();
  2538. $ctx1.sendIdx["collection"]=1;
  2539. $1=_st($2)._second();
  2540. $4=self._collection();
  2541. $3=_st($4)._at_((2));
  2542. self._assert_equals_($1,$3);
  2543. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  2544. args: [],
  2545. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  2546. messageSends: ["assert:equals:", "second", "collection", "at:"],
  2547. referencedClasses: []
  2548. }),
  2549. smalltalk.SequenceableCollectionTest);
  2550. smalltalk.addMethod(
  2551. smalltalk.method({
  2552. selector: "testThird",
  2553. category: 'tests',
  2554. fn: function (){
  2555. var self=this;
  2556. return smalltalk.withContext(function($ctx1) {
  2557. var $2,$1,$4,$3;
  2558. $2=self._collection();
  2559. $ctx1.sendIdx["collection"]=1;
  2560. $1=_st($2)._third();
  2561. $4=self._collection();
  2562. $3=_st($4)._at_((3));
  2563. self._assert_equals_($1,$3);
  2564. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  2565. args: [],
  2566. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  2567. messageSends: ["assert:equals:", "third", "collection", "at:"],
  2568. referencedClasses: []
  2569. }),
  2570. smalltalk.SequenceableCollectionTest);
  2571. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2572. smalltalk.addMethod(
  2573. smalltalk.method({
  2574. selector: "testAdd",
  2575. category: 'tests',
  2576. fn: function (){
  2577. var self=this;
  2578. var array;
  2579. return smalltalk.withContext(function($ctx1) {
  2580. array=self._collection();
  2581. _st(array)._add_((6));
  2582. self._assert_equals_(_st(array)._last(),(6));
  2583. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  2584. args: [],
  2585. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  2586. messageSends: ["collection", "add:", "assert:equals:", "last"],
  2587. referencedClasses: []
  2588. }),
  2589. smalltalk.ArrayTest);
  2590. smalltalk.addMethod(
  2591. smalltalk.method({
  2592. selector: "testAddFirst",
  2593. category: 'tests',
  2594. fn: function (){
  2595. var self=this;
  2596. return smalltalk.withContext(function($ctx1) {
  2597. var $1,$2;
  2598. $1=self._collection();
  2599. _st($1)._addFirst_((0));
  2600. $2=_st($1)._yourself();
  2601. self._assert_equals_(_st($2)._first(),(0));
  2602. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  2603. args: [],
  2604. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  2605. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  2606. referencedClasses: []
  2607. }),
  2608. smalltalk.ArrayTest);
  2609. smalltalk.addMethod(
  2610. smalltalk.method({
  2611. selector: "testAtIfAbsent",
  2612. category: 'tests',
  2613. fn: function (){
  2614. var self=this;
  2615. var array;
  2616. return smalltalk.withContext(function($ctx1) {
  2617. var $1,$2,$3,$4,$5,$6;
  2618. array=["hello", "world"];
  2619. $1=_st(array)._at_((1));
  2620. $ctx1.sendIdx["at:"]=1;
  2621. self._assert_equals_($1,"hello");
  2622. $ctx1.sendIdx["assert:equals:"]=1;
  2623. $2=_st(array)._at_((2));
  2624. self._assert_equals_($2,"world");
  2625. $ctx1.sendIdx["assert:equals:"]=2;
  2626. $3=_st(array)._at_ifAbsent_((2),(function(){
  2627. return smalltalk.withContext(function($ctx2) {
  2628. return "not found";
  2629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2630. $ctx1.sendIdx["at:ifAbsent:"]=1;
  2631. self._assert_equals_($3,"world");
  2632. $ctx1.sendIdx["assert:equals:"]=3;
  2633. $4=_st(array)._at_ifAbsent_((0),(function(){
  2634. return smalltalk.withContext(function($ctx2) {
  2635. return "not found";
  2636. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2637. $ctx1.sendIdx["at:ifAbsent:"]=2;
  2638. self._assert_equals_($4,"not found");
  2639. $ctx1.sendIdx["assert:equals:"]=4;
  2640. $5=_st(array)._at_ifAbsent_((-10),(function(){
  2641. return smalltalk.withContext(function($ctx2) {
  2642. return "not found";
  2643. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  2644. $ctx1.sendIdx["at:ifAbsent:"]=3;
  2645. self._assert_equals_($5,"not found");
  2646. $ctx1.sendIdx["assert:equals:"]=5;
  2647. $6=_st(array)._at_ifAbsent_((3),(function(){
  2648. return smalltalk.withContext(function($ctx2) {
  2649. return "not found";
  2650. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  2651. self._assert_equals_($6,"not found");
  2652. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array},smalltalk.ArrayTest)})},
  2653. args: [],
  2654. 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'.",
  2655. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2656. referencedClasses: []
  2657. }),
  2658. smalltalk.ArrayTest);
  2659. smalltalk.addMethod(
  2660. smalltalk.method({
  2661. selector: "testFirstN",
  2662. category: 'tests',
  2663. fn: function (){
  2664. var self=this;
  2665. return smalltalk.withContext(function($ctx1) {
  2666. self._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  2667. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.ArrayTest)})},
  2668. args: [],
  2669. source: "testFirstN\x0a\x09self assert: ({1. 2. 3. 4. 5} first: 3) equals: {1. 2. 3}",
  2670. messageSends: ["assert:equals:", "first:"],
  2671. referencedClasses: []
  2672. }),
  2673. smalltalk.ArrayTest);
  2674. smalltalk.addMethod(
  2675. smalltalk.method({
  2676. selector: "testIfEmpty",
  2677. category: 'tests',
  2678. fn: function (){
  2679. var self=this;
  2680. return smalltalk.withContext(function($ctx1) {
  2681. self._assert_equals_(""._ifEmpty_((function(){
  2682. return smalltalk.withContext(function($ctx2) {
  2683. return "zork";
  2684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"zork");
  2685. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{},smalltalk.ArrayTest)})},
  2686. args: [],
  2687. source: "testIfEmpty\x0a\x09self assert: ( '' ifEmpty: ['zork'] ) equals: 'zork'",
  2688. messageSends: ["assert:equals:", "ifEmpty:"],
  2689. referencedClasses: []
  2690. }),
  2691. smalltalk.ArrayTest);
  2692. smalltalk.addMethod(
  2693. smalltalk.method({
  2694. selector: "testPrintString",
  2695. category: 'tests',
  2696. fn: function (){
  2697. var self=this;
  2698. var array;
  2699. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2700. return smalltalk.withContext(function($ctx1) {
  2701. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  2702. array=_st($Array())._new();
  2703. $1=_st(array)._printString();
  2704. $ctx1.sendIdx["printString"]=1;
  2705. self._assert_equals_($1,"an Array ()");
  2706. $ctx1.sendIdx["assert:equals:"]=1;
  2707. $2=array;
  2708. _st($2)._add_((1));
  2709. $ctx1.sendIdx["add:"]=1;
  2710. $3=_st($2)._add_((3));
  2711. $ctx1.sendIdx["add:"]=2;
  2712. $4=_st(array)._printString();
  2713. $ctx1.sendIdx["printString"]=2;
  2714. self._assert_equals_($4,"an Array (1 3)");
  2715. $ctx1.sendIdx["assert:equals:"]=2;
  2716. _st(array)._add_("foo");
  2717. $5=_st(array)._printString();
  2718. $ctx1.sendIdx["printString"]=3;
  2719. self._assert_equals_($5,"an Array (1 3 'foo')");
  2720. $ctx1.sendIdx["assert:equals:"]=3;
  2721. $6=array;
  2722. _st($6)._remove_((1));
  2723. $ctx1.sendIdx["remove:"]=1;
  2724. $7=_st($6)._remove_((3));
  2725. $8=_st(array)._printString();
  2726. $ctx1.sendIdx["printString"]=4;
  2727. self._assert_equals_($8,"an Array ('foo')");
  2728. $ctx1.sendIdx["assert:equals:"]=4;
  2729. _st(array)._addLast_((3));
  2730. $ctx1.sendIdx["addLast:"]=1;
  2731. $9=_st(array)._printString();
  2732. $ctx1.sendIdx["printString"]=5;
  2733. self._assert_equals_($9,"an Array ('foo' 3)");
  2734. $ctx1.sendIdx["assert:equals:"]=5;
  2735. _st(array)._addLast_((3));
  2736. $10=_st(array)._printString();
  2737. self._assert_equals_($10,"an Array ('foo' 3 3)");
  2738. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  2739. args: [],
  2740. 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)'.",
  2741. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  2742. referencedClasses: ["Array"]
  2743. }),
  2744. smalltalk.ArrayTest);
  2745. smalltalk.addMethod(
  2746. smalltalk.method({
  2747. selector: "testRemove",
  2748. category: 'tests',
  2749. fn: function (){
  2750. var self=this;
  2751. var array;
  2752. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2753. return smalltalk.withContext(function($ctx1) {
  2754. array=[(1), (2), (3), (4), (5)];
  2755. _st(array)._remove_((3));
  2756. $ctx1.sendIdx["remove:"]=1;
  2757. self._assert_equals_(array,[(1), (2), (4), (5)]);
  2758. self._should_raise_((function(){
  2759. return smalltalk.withContext(function($ctx2) {
  2760. return _st(array)._remove_((3));
  2761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2762. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  2763. args: [],
  2764. source: "testRemove \x0a\x09| array |\x0a\x09array := #(1 2 3 4 5). \x0a\x09array remove: 3.\x0a\x0a\x09self assert: array equals: #(1 2 4 5).\x0a\x09self should: [ array remove: 3 ] raise: Error",
  2765. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  2766. referencedClasses: ["Error"]
  2767. }),
  2768. smalltalk.ArrayTest);
  2769. smalltalk.addMethod(
  2770. smalltalk.method({
  2771. selector: "testRemoveFromTo",
  2772. category: 'tests',
  2773. fn: function (){
  2774. var self=this;
  2775. return smalltalk.withContext(function($ctx1) {
  2776. var $1,$2,$3;
  2777. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  2778. $ctx1.sendIdx["removeFrom:to:"]=1;
  2779. self._assert_equals_($1,[(4)]);
  2780. $ctx1.sendIdx["assert:equals:"]=1;
  2781. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  2782. $ctx1.sendIdx["removeFrom:to:"]=2;
  2783. self._assert_equals_($2,[(1), (4)]);
  2784. $ctx1.sendIdx["assert:equals:"]=2;
  2785. $3=[(1), (2), (3), (4)]._removeFrom_to_((2),(4));
  2786. self._assert_equals_($3,[(1)]);
  2787. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  2788. args: [],
  2789. source: "testRemoveFromTo\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeFrom: 1 to: 3) equals: #(4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 3) equals: #(1 4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 4) equals: #(1)",
  2790. messageSends: ["assert:equals:", "removeFrom:to:"],
  2791. referencedClasses: []
  2792. }),
  2793. smalltalk.ArrayTest);
  2794. smalltalk.addMethod(
  2795. smalltalk.method({
  2796. selector: "testRemoveIndex",
  2797. category: 'tests',
  2798. fn: function (){
  2799. var self=this;
  2800. return smalltalk.withContext(function($ctx1) {
  2801. var $1,$2,$3;
  2802. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  2803. $ctx1.sendIdx["removeIndex:"]=1;
  2804. self._assert_equals_($1,[(1), (3), (4)]);
  2805. $ctx1.sendIdx["assert:equals:"]=1;
  2806. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  2807. $ctx1.sendIdx["removeIndex:"]=2;
  2808. self._assert_equals_($2,[(2), (3), (4)]);
  2809. $ctx1.sendIdx["assert:equals:"]=2;
  2810. $3=["hello"]._removeIndex_((1));
  2811. self._assert_equals_($3,[]);
  2812. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  2813. args: [],
  2814. source: "testRemoveIndex\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeIndex: 2) equals: #(1 3 4).\x0a\x09self assert: (#(1 2 3 4) removeIndex: 1) equals: #(2 3 4).\x0a\x09self assert: (#('hello') removeIndex: 1) equals: #()",
  2815. messageSends: ["assert:equals:", "removeIndex:"],
  2816. referencedClasses: []
  2817. }),
  2818. smalltalk.ArrayTest);
  2819. smalltalk.addMethod(
  2820. smalltalk.method({
  2821. selector: "testRemoveLast",
  2822. category: 'tests',
  2823. fn: function (){
  2824. var self=this;
  2825. var array;
  2826. return smalltalk.withContext(function($ctx1) {
  2827. array=[(1), (2)];
  2828. _st(array)._removeLast();
  2829. self._assert_equals_(_st(array)._last(),(1));
  2830. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  2831. args: [],
  2832. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  2833. messageSends: ["removeLast", "assert:equals:", "last"],
  2834. referencedClasses: []
  2835. }),
  2836. smalltalk.ArrayTest);
  2837. smalltalk.addMethod(
  2838. smalltalk.method({
  2839. selector: "testReversed",
  2840. category: 'tests',
  2841. fn: function (){
  2842. var self=this;
  2843. var array;
  2844. return smalltalk.withContext(function($ctx1) {
  2845. array=[(5), (4), (3), (2), (1)];
  2846. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  2847. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  2848. args: [],
  2849. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  2850. messageSends: ["assert:equals:", "reversed"],
  2851. referencedClasses: []
  2852. }),
  2853. smalltalk.ArrayTest);
  2854. smalltalk.addMethod(
  2855. smalltalk.method({
  2856. selector: "testSort",
  2857. category: 'tests',
  2858. fn: function (){
  2859. var self=this;
  2860. var array;
  2861. return smalltalk.withContext(function($ctx1) {
  2862. array=[(3), (1), (4), (5), (2)];
  2863. _st(array)._sort();
  2864. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  2865. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  2866. args: [],
  2867. source: "testSort\x0a\x09| array |\x0a\x09array := #(3 1 4 5 2). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 2 3 4 5)",
  2868. messageSends: ["sort", "assert:equals:"],
  2869. referencedClasses: []
  2870. }),
  2871. smalltalk.ArrayTest);
  2872. smalltalk.addMethod(
  2873. smalltalk.method({
  2874. selector: "collectionClass",
  2875. category: 'accessing',
  2876. fn: function (){
  2877. var self=this;
  2878. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2879. return smalltalk.withContext(function($ctx1) {
  2880. return $Array();
  2881. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  2882. args: [],
  2883. source: "collectionClass\x0a\x09^ Array",
  2884. messageSends: [],
  2885. referencedClasses: ["Array"]
  2886. }),
  2887. smalltalk.ArrayTest.klass);
  2888. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2889. smalltalk.addMethod(
  2890. smalltalk.method({
  2891. selector: "collection",
  2892. category: 'accessing',
  2893. fn: function (){
  2894. var self=this;
  2895. return smalltalk.withContext(function($ctx1) {
  2896. return "hello";
  2897. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  2898. args: [],
  2899. source: "collection\x0a\x09^'hello'",
  2900. messageSends: [],
  2901. referencedClasses: []
  2902. }),
  2903. smalltalk.StringTest);
  2904. smalltalk.addMethod(
  2905. smalltalk.method({
  2906. selector: "collectionWithDuplicates",
  2907. category: 'accessing',
  2908. fn: function (){
  2909. var self=this;
  2910. return smalltalk.withContext(function($ctx1) {
  2911. return "abbaerte";
  2912. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  2913. args: [],
  2914. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  2915. messageSends: [],
  2916. referencedClasses: []
  2917. }),
  2918. smalltalk.StringTest);
  2919. smalltalk.addMethod(
  2920. smalltalk.method({
  2921. selector: "testAddRemove",
  2922. category: 'tests',
  2923. fn: function (){
  2924. var self=this;
  2925. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2926. return smalltalk.withContext(function($ctx1) {
  2927. self._should_raise_((function(){
  2928. return smalltalk.withContext(function($ctx2) {
  2929. return "hello"._add_("a");
  2930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2931. $ctx1.sendIdx["should:raise:"]=1;
  2932. self._should_raise_((function(){
  2933. return smalltalk.withContext(function($ctx2) {
  2934. return "hello"._remove_("h");
  2935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  2936. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  2937. args: [],
  2938. source: "testAddRemove\x0a\x09self should: ['hello' add: 'a'] raise: Error.\x0a\x09self should: ['hello' remove: 'h'] raise: Error",
  2939. messageSends: ["should:raise:", "add:", "remove:"],
  2940. referencedClasses: ["Error"]
  2941. }),
  2942. smalltalk.StringTest);
  2943. smalltalk.addMethod(
  2944. smalltalk.method({
  2945. selector: "testAsArray",
  2946. category: 'tests',
  2947. fn: function (){
  2948. var self=this;
  2949. return smalltalk.withContext(function($ctx1) {
  2950. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  2951. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  2952. args: [],
  2953. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  2954. messageSends: ["assert:equals:", "asArray"],
  2955. referencedClasses: []
  2956. }),
  2957. smalltalk.StringTest);
  2958. smalltalk.addMethod(
  2959. smalltalk.method({
  2960. selector: "testAsLowerCase",
  2961. category: 'tests',
  2962. fn: function (){
  2963. var self=this;
  2964. return smalltalk.withContext(function($ctx1) {
  2965. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  2966. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  2967. args: [],
  2968. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  2969. messageSends: ["assert:equals:", "asLowercase"],
  2970. referencedClasses: []
  2971. }),
  2972. smalltalk.StringTest);
  2973. smalltalk.addMethod(
  2974. smalltalk.method({
  2975. selector: "testAsNumber",
  2976. category: 'tests',
  2977. fn: function (){
  2978. var self=this;
  2979. return smalltalk.withContext(function($ctx1) {
  2980. var $1,$2,$3;
  2981. $1="3"._asNumber();
  2982. $ctx1.sendIdx["asNumber"]=1;
  2983. self._assert_equals_($1,(3));
  2984. $ctx1.sendIdx["assert:equals:"]=1;
  2985. $2="-3"._asNumber();
  2986. $ctx1.sendIdx["asNumber"]=2;
  2987. self._assert_equals_($2,(-3));
  2988. $ctx1.sendIdx["assert:equals:"]=2;
  2989. $3="-1.5"._asNumber();
  2990. self._assert_equals_($3,(-1.5));
  2991. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  2992. args: [],
  2993. source: "testAsNumber\x0a\x09self assert: '3' asNumber equals: 3.\x0a\x09self assert: '-3' asNumber equals: -3.\x0a\x09self assert: '-1.5' asNumber equals: -1.5.",
  2994. messageSends: ["assert:equals:", "asNumber"],
  2995. referencedClasses: []
  2996. }),
  2997. smalltalk.StringTest);
  2998. smalltalk.addMethod(
  2999. smalltalk.method({
  3000. selector: "testAsUpperCase",
  3001. category: 'tests',
  3002. fn: function (){
  3003. var self=this;
  3004. return smalltalk.withContext(function($ctx1) {
  3005. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  3006. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  3007. args: [],
  3008. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  3009. messageSends: ["assert:equals:", "asUppercase"],
  3010. referencedClasses: []
  3011. }),
  3012. smalltalk.StringTest);
  3013. smalltalk.addMethod(
  3014. smalltalk.method({
  3015. selector: "testAsciiValue",
  3016. category: 'tests',
  3017. fn: function (){
  3018. var self=this;
  3019. var characterA,characterU;
  3020. return smalltalk.withContext(function($ctx1) {
  3021. var $1,$2;
  3022. characterA="A";
  3023. characterU="U";
  3024. $1=_st(characterA)._asciiValue();
  3025. $ctx1.sendIdx["asciiValue"]=1;
  3026. self._assert_equals_($1,(65));
  3027. $ctx1.sendIdx["assert:equals:"]=1;
  3028. $2=_st(characterU)._asciiValue();
  3029. self._assert_equals_($2,(85));
  3030. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  3031. args: [],
  3032. source: "testAsciiValue\x0a | characterA characterU |\x0a characterA := 'A'.\x0a characterU := 'U'.\x0a self assert: (characterA asciiValue) equals:65.\x0a self assert: (characterU asciiValue) equals:85",
  3033. messageSends: ["assert:equals:", "asciiValue"],
  3034. referencedClasses: []
  3035. }),
  3036. smalltalk.StringTest);
  3037. smalltalk.addMethod(
  3038. smalltalk.method({
  3039. selector: "testAt",
  3040. category: 'tests',
  3041. fn: function (){
  3042. var self=this;
  3043. return smalltalk.withContext(function($ctx1) {
  3044. var $1,$2;
  3045. $1="hello"._at_((1));
  3046. $ctx1.sendIdx["at:"]=1;
  3047. self._assert_equals_($1,"h");
  3048. $ctx1.sendIdx["assert:equals:"]=1;
  3049. $2="hello"._at_((5));
  3050. self._assert_equals_($2,"o");
  3051. $ctx1.sendIdx["assert:equals:"]=2;
  3052. self._assert_equals_("hello"._at_ifAbsent_((6),(function(){
  3053. return smalltalk.withContext(function($ctx2) {
  3054. return nil;
  3055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),nil);
  3056. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.StringTest)})},
  3057. args: [],
  3058. 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",
  3059. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  3060. referencedClasses: []
  3061. }),
  3062. smalltalk.StringTest);
  3063. smalltalk.addMethod(
  3064. smalltalk.method({
  3065. selector: "testAtPut",
  3066. category: 'tests',
  3067. fn: function (){
  3068. var self=this;
  3069. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3070. return smalltalk.withContext(function($ctx1) {
  3071. self._should_raise_((function(){
  3072. return smalltalk.withContext(function($ctx2) {
  3073. return "hello"._at_put_((1),"a");
  3074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3075. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  3076. args: [],
  3077. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  3078. messageSends: ["should:raise:", "at:put:"],
  3079. referencedClasses: ["Error"]
  3080. }),
  3081. smalltalk.StringTest);
  3082. smalltalk.addMethod(
  3083. smalltalk.method({
  3084. selector: "testCapitalized",
  3085. category: 'tests',
  3086. fn: function (){
  3087. var self=this;
  3088. return smalltalk.withContext(function($ctx1) {
  3089. var $1,$2,$3,$4,$5;
  3090. $1="test"._capitalized();
  3091. $ctx1.sendIdx["capitalized"]=1;
  3092. self._assert_equals_($1,"Test");
  3093. $ctx1.sendIdx["assert:equals:"]=1;
  3094. $2="Test"._capitalized();
  3095. $ctx1.sendIdx["capitalized"]=2;
  3096. self._assert_equals_($2,"Test");
  3097. $ctx1.sendIdx["assert:equals:"]=2;
  3098. $3=""._capitalized();
  3099. self._assert_equals_($3,"");
  3100. $ctx1.sendIdx["assert:equals:"]=3;
  3101. $4="Test"._isCapitalized();
  3102. $ctx1.sendIdx["isCapitalized"]=1;
  3103. self._assert_equals_($4,true);
  3104. $ctx1.sendIdx["assert:equals:"]=4;
  3105. $5="test"._isCapitalized();
  3106. self._assert_equals_($5,false);
  3107. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  3108. args: [],
  3109. source: "testCapitalized\x0a\x09self assert: 'test' capitalized equals: 'Test'.\x0a\x09self assert: 'Test' capitalized equals: 'Test'.\x0a\x09self assert: '' capitalized equals: ''.\x0a\x09self assert: 'Test' isCapitalized equals: true.\x0a\x09self assert: 'test' isCapitalized equals: false.",
  3110. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  3111. referencedClasses: []
  3112. }),
  3113. smalltalk.StringTest);
  3114. smalltalk.addMethod(
  3115. smalltalk.method({
  3116. selector: "testCharCodeAt",
  3117. category: 'tests',
  3118. fn: function (){
  3119. var self=this;
  3120. return smalltalk.withContext(function($ctx1) {
  3121. var $1,$2,$3,$4,$5,$6;
  3122. $1="jackie"._charCodeAt_((1));
  3123. $ctx1.sendIdx["charCodeAt:"]=1;
  3124. self._assert_equals_($1,(106));
  3125. $ctx1.sendIdx["assert:equals:"]=1;
  3126. $2="jackie"._charCodeAt_((2));
  3127. $ctx1.sendIdx["charCodeAt:"]=2;
  3128. self._assert_equals_($2,(97));
  3129. $ctx1.sendIdx["assert:equals:"]=2;
  3130. $3="jackie"._charCodeAt_((3));
  3131. $ctx1.sendIdx["charCodeAt:"]=3;
  3132. self._assert_equals_($3,(99));
  3133. $ctx1.sendIdx["assert:equals:"]=3;
  3134. $4="jackie"._charCodeAt_((4));
  3135. $ctx1.sendIdx["charCodeAt:"]=4;
  3136. self._assert_equals_($4,(107));
  3137. $ctx1.sendIdx["assert:equals:"]=4;
  3138. $5="jackie"._charCodeAt_((5));
  3139. $ctx1.sendIdx["charCodeAt:"]=5;
  3140. self._assert_equals_($5,(105));
  3141. $ctx1.sendIdx["assert:equals:"]=5;
  3142. $6="jackie"._charCodeAt_((6));
  3143. self._assert_equals_($6,(101));
  3144. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  3145. args: [],
  3146. source: "testCharCodeAt\x0a\x09self assert: ('jackie' charCodeAt:1) equals: 106.\x0a\x09self assert: ('jackie' charCodeAt:2) equals: 97.\x0a\x09self assert: ('jackie' charCodeAt:3) equals: 99.\x0a\x09self assert: ('jackie' charCodeAt:4) equals: 107.\x0a\x09self assert: ('jackie' charCodeAt:5) equals: 105.\x0a\x09self assert: ('jackie' charCodeAt:6) equals: 101",
  3147. messageSends: ["assert:equals:", "charCodeAt:"],
  3148. referencedClasses: []
  3149. }),
  3150. smalltalk.StringTest);
  3151. smalltalk.addMethod(
  3152. smalltalk.method({
  3153. selector: "testCollect",
  3154. category: 'tests',
  3155. fn: function (){
  3156. var self=this;
  3157. var newCollection;
  3158. return smalltalk.withContext(function($ctx1) {
  3159. newCollection="hheelllloo";
  3160. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  3161. return smalltalk.withContext(function($ctx2) {
  3162. return _st(each).__comma(each);
  3163. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3164. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  3165. args: [],
  3166. 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",
  3167. messageSends: ["assertSameContents:as:", "collect:", "collection", ","],
  3168. referencedClasses: []
  3169. }),
  3170. smalltalk.StringTest);
  3171. smalltalk.addMethod(
  3172. smalltalk.method({
  3173. selector: "testCopyFromTo",
  3174. category: 'tests',
  3175. fn: function (){
  3176. var self=this;
  3177. return smalltalk.withContext(function($ctx1) {
  3178. var $1,$2;
  3179. $1="jackie"._copyFrom_to_((1),(3));
  3180. $ctx1.sendIdx["copyFrom:to:"]=1;
  3181. self._assert_equals_($1,"jac");
  3182. $ctx1.sendIdx["assert:equals:"]=1;
  3183. $2="jackie"._copyFrom_to_((4),(6));
  3184. self._assert_equals_($2,"kie");
  3185. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  3186. args: [],
  3187. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  3188. messageSends: ["assert:equals:", "copyFrom:to:"],
  3189. referencedClasses: []
  3190. }),
  3191. smalltalk.StringTest);
  3192. smalltalk.addMethod(
  3193. smalltalk.method({
  3194. selector: "testCopyWithoutAll",
  3195. category: 'tests',
  3196. fn: function (){
  3197. var self=this;
  3198. return smalltalk.withContext(function($ctx1) {
  3199. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  3200. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  3201. args: [],
  3202. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  3203. messageSends: ["assert:equals:", "copyWithoutAll:"],
  3204. referencedClasses: []
  3205. }),
  3206. smalltalk.StringTest);
  3207. smalltalk.addMethod(
  3208. smalltalk.method({
  3209. selector: "testDetect",
  3210. category: 'tests',
  3211. fn: function (){
  3212. var self=this;
  3213. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3214. return smalltalk.withContext(function($ctx1) {
  3215. var $2,$1,$3;
  3216. $2=self._collection();
  3217. $ctx1.sendIdx["collection"]=1;
  3218. $1=_st($2)._detect_((function(each){
  3219. return smalltalk.withContext(function($ctx2) {
  3220. return _st(each).__eq("h");
  3221. $ctx2.sendIdx["="]=1;
  3222. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  3223. $ctx1.sendIdx["detect:"]=1;
  3224. self._assert_equals_($1,"h");
  3225. self._should_raise_((function(){
  3226. return smalltalk.withContext(function($ctx2) {
  3227. $3=self._collection();
  3228. return _st($3)._detect_((function(each){
  3229. return smalltalk.withContext(function($ctx3) {
  3230. return _st(each).__eq((6));
  3231. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  3232. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3233. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  3234. args: [],
  3235. 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",
  3236. messageSends: ["assert:equals:", "detect:", "collection", "=", "should:raise:"],
  3237. referencedClasses: ["Error"]
  3238. }),
  3239. smalltalk.StringTest);
  3240. smalltalk.addMethod(
  3241. smalltalk.method({
  3242. selector: "testEquality",
  3243. category: 'tests',
  3244. fn: function (){
  3245. var self=this;
  3246. return smalltalk.withContext(function($ctx1) {
  3247. var $1,$2,$3,$4,$5;
  3248. self._assert_equals_("hello","hello");
  3249. $ctx1.sendIdx["assert:equals:"]=1;
  3250. $1="hello".__eq("world");
  3251. $ctx1.sendIdx["="]=1;
  3252. self._deny_($1);
  3253. $ctx1.sendIdx["deny:"]=1;
  3254. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  3255. return smalltalk.withContext(function($ctx2) {
  3256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  3257. $ctx1.sendIdx["="]=2;
  3258. self._deny_($2);
  3259. $ctx1.sendIdx["deny:"]=2;
  3260. $3="hello"._yourself();
  3261. $ctx1.sendIdx["yourself"]=1;
  3262. self._assert_equals_("hello",$3);
  3263. $ctx1.sendIdx["assert:equals:"]=2;
  3264. $4="hello"._yourself();
  3265. self._assert_equals_($4,"hello");
  3266. $5="".__eq((0));
  3267. self._deny_($5);
  3268. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  3269. args: [],
  3270. source: "testEquality\x0a\x09self assert: 'hello' equals: 'hello'.\x0a\x09self deny: 'hello' = 'world'.\x0a\x09\x0a\x09\x22Test for issue 459\x22\x0a\x09self deny: 'hello' = (#() at: 1 ifAbsent: [ ]).\x0a\x0a\x09self assert: 'hello' equals: 'hello' yourself.\x0a\x09self assert: 'hello' yourself equals: 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' = 0",
  3271. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  3272. referencedClasses: []
  3273. }),
  3274. smalltalk.StringTest);
  3275. smalltalk.addMethod(
  3276. smalltalk.method({
  3277. selector: "testIdentity",
  3278. category: 'tests',
  3279. fn: function (){
  3280. var self=this;
  3281. return smalltalk.withContext(function($ctx1) {
  3282. var $1,$2,$4,$3,$6,$5,$7;
  3283. $1="hello".__eq_eq("hello");
  3284. $ctx1.sendIdx["=="]=1;
  3285. self._assert_($1);
  3286. $ctx1.sendIdx["assert:"]=1;
  3287. $2="hello".__eq_eq("world");
  3288. $ctx1.sendIdx["=="]=2;
  3289. self._deny_($2);
  3290. $ctx1.sendIdx["deny:"]=1;
  3291. $4="hello"._yourself();
  3292. $ctx1.sendIdx["yourself"]=1;
  3293. $3="hello".__eq_eq($4);
  3294. $ctx1.sendIdx["=="]=3;
  3295. self._assert_($3);
  3296. $ctx1.sendIdx["assert:"]=2;
  3297. $6="hello"._yourself();
  3298. $5=_st($6).__eq_eq("hello");
  3299. $ctx1.sendIdx["=="]=4;
  3300. self._assert_($5);
  3301. $7="".__eq_eq((0));
  3302. self._deny_($7);
  3303. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  3304. args: [],
  3305. 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",
  3306. messageSends: ["assert:", "==", "deny:", "yourself"],
  3307. referencedClasses: []
  3308. }),
  3309. smalltalk.StringTest);
  3310. smalltalk.addMethod(
  3311. smalltalk.method({
  3312. selector: "testIdentityHash",
  3313. category: 'tests',
  3314. fn: function (){
  3315. var self=this;
  3316. return smalltalk.withContext(function($ctx1) {
  3317. var $1,$2,$4,$5,$3;
  3318. $1="foo"._identityHash();
  3319. $ctx1.sendIdx["identityHash"]=1;
  3320. $2="foo"._identityHash();
  3321. $ctx1.sendIdx["identityHash"]=2;
  3322. self._assert_equals_($1,$2);
  3323. $4="foo"._identityHash();
  3324. $ctx1.sendIdx["identityHash"]=3;
  3325. $5="bar"._identityHash();
  3326. $3=_st($4).__eq($5);
  3327. self._deny_($3);
  3328. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  3329. args: [],
  3330. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  3331. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  3332. referencedClasses: []
  3333. }),
  3334. smalltalk.StringTest);
  3335. smalltalk.addMethod(
  3336. smalltalk.method({
  3337. selector: "testIncludesSubString",
  3338. category: 'tests',
  3339. fn: function (){
  3340. var self=this;
  3341. return smalltalk.withContext(function($ctx1) {
  3342. var $1,$2;
  3343. $1="amber"._includesSubString_("ber");
  3344. $ctx1.sendIdx["includesSubString:"]=1;
  3345. self._assert_($1);
  3346. $2="amber"._includesSubString_("zork");
  3347. self._deny_($2);
  3348. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  3349. args: [],
  3350. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  3351. messageSends: ["assert:", "includesSubString:", "deny:"],
  3352. referencedClasses: []
  3353. }),
  3354. smalltalk.StringTest);
  3355. smalltalk.addMethod(
  3356. smalltalk.method({
  3357. selector: "testIndexOf",
  3358. category: 'tests',
  3359. fn: function (){
  3360. var self=this;
  3361. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3362. return smalltalk.withContext(function($ctx1) {
  3363. var $2,$1,$3,$5,$4;
  3364. $2=self._collection();
  3365. $ctx1.sendIdx["collection"]=1;
  3366. $1=_st($2)._indexOf_("e");
  3367. $ctx1.sendIdx["indexOf:"]=1;
  3368. self._assert_equals_($1,(2));
  3369. $ctx1.sendIdx["assert:equals:"]=1;
  3370. self._should_raise_((function(){
  3371. return smalltalk.withContext(function($ctx2) {
  3372. $3=self._collection();
  3373. $ctx2.sendIdx["collection"]=2;
  3374. return _st($3)._indexOf_((999));
  3375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3376. $5=self._collection();
  3377. $4=_st($5)._indexOf_ifAbsent_((999),(function(){
  3378. return smalltalk.withContext(function($ctx2) {
  3379. return "sentinel";
  3380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3381. self._assert_equals_($4,"sentinel");
  3382. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.StringTest)})},
  3383. args: [],
  3384. 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'",
  3385. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  3386. referencedClasses: ["Error"]
  3387. }),
  3388. smalltalk.StringTest);
  3389. smalltalk.addMethod(
  3390. smalltalk.method({
  3391. selector: "testIsVowel",
  3392. category: 'tests',
  3393. fn: function (){
  3394. var self=this;
  3395. var vowel,consonant;
  3396. return smalltalk.withContext(function($ctx1) {
  3397. var $1,$2;
  3398. vowel="u";
  3399. consonant="z";
  3400. $1=_st(vowel)._isVowel();
  3401. $ctx1.sendIdx["isVowel"]=1;
  3402. self._assert_equals_($1,true);
  3403. $ctx1.sendIdx["assert:equals:"]=1;
  3404. $2=_st(consonant)._isVowel();
  3405. self._assert_equals_($2,false);
  3406. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  3407. args: [],
  3408. source: "testIsVowel\x0a |vowel consonant|\x0a vowel := 'u'.\x0a consonant := 'z'.\x0a self assert: vowel isVowel equals: true.\x0a self assert: consonant isVowel equals: false",
  3409. messageSends: ["assert:equals:", "isVowel"],
  3410. referencedClasses: []
  3411. }),
  3412. smalltalk.StringTest);
  3413. smalltalk.addMethod(
  3414. smalltalk.method({
  3415. selector: "testJoin",
  3416. category: 'tests',
  3417. fn: function (){
  3418. var self=this;
  3419. return smalltalk.withContext(function($ctx1) {
  3420. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  3421. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  3422. args: [],
  3423. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  3424. messageSends: ["assert:equals:", "join:"],
  3425. referencedClasses: []
  3426. }),
  3427. smalltalk.StringTest);
  3428. smalltalk.addMethod(
  3429. smalltalk.method({
  3430. selector: "testReversed",
  3431. category: 'tests',
  3432. fn: function (){
  3433. var self=this;
  3434. return smalltalk.withContext(function($ctx1) {
  3435. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  3436. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  3437. args: [],
  3438. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  3439. messageSends: ["assert:equals:", "reversed"],
  3440. referencedClasses: []
  3441. }),
  3442. smalltalk.StringTest);
  3443. smalltalk.addMethod(
  3444. smalltalk.method({
  3445. selector: "testSelect",
  3446. category: 'tests',
  3447. fn: function (){
  3448. var self=this;
  3449. var newCollection;
  3450. return smalltalk.withContext(function($ctx1) {
  3451. newCollection="o";
  3452. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  3453. return smalltalk.withContext(function($ctx2) {
  3454. return _st(each).__eq("o");
  3455. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3456. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  3457. args: [],
  3458. 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",
  3459. messageSends: ["assertSameContents:as:", "select:", "collection", "="],
  3460. referencedClasses: []
  3461. }),
  3462. smalltalk.StringTest);
  3463. smalltalk.addMethod(
  3464. smalltalk.method({
  3465. selector: "testSize",
  3466. category: 'tests',
  3467. fn: function (){
  3468. var self=this;
  3469. return smalltalk.withContext(function($ctx1) {
  3470. var $1,$2;
  3471. $1="smalltalk"._size();
  3472. $ctx1.sendIdx["size"]=1;
  3473. self._assert_equals_($1,(9));
  3474. $ctx1.sendIdx["assert:equals:"]=1;
  3475. $2=""._size();
  3476. self._assert_equals_($2,(0));
  3477. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  3478. args: [],
  3479. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  3480. messageSends: ["assert:equals:", "size"],
  3481. referencedClasses: []
  3482. }),
  3483. smalltalk.StringTest);
  3484. smalltalk.addMethod(
  3485. smalltalk.method({
  3486. selector: "testStreamContents",
  3487. category: 'tests',
  3488. fn: function (){
  3489. var self=this;
  3490. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3491. return smalltalk.withContext(function($ctx1) {
  3492. var $1;
  3493. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  3494. return smalltalk.withContext(function($ctx2) {
  3495. _st(aStream)._nextPutAll_("hello");
  3496. $ctx2.sendIdx["nextPutAll:"]=1;
  3497. _st(aStream)._space();
  3498. $1=_st(aStream)._nextPutAll_("world");
  3499. return $1;
  3500. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  3501. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  3502. args: [],
  3503. 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'",
  3504. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  3505. referencedClasses: ["String"]
  3506. }),
  3507. smalltalk.StringTest);
  3508. smalltalk.addMethod(
  3509. smalltalk.method({
  3510. selector: "testSubStrings",
  3511. category: 'tests',
  3512. fn: function (){
  3513. var self=this;
  3514. return smalltalk.withContext(function($ctx1) {
  3515. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  3516. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  3517. args: [],
  3518. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  3519. messageSends: ["assert:equals:", "subStrings:"],
  3520. referencedClasses: []
  3521. }),
  3522. smalltalk.StringTest);
  3523. smalltalk.addMethod(
  3524. smalltalk.method({
  3525. selector: "testTrim",
  3526. category: 'tests',
  3527. fn: function (){
  3528. var self=this;
  3529. return smalltalk.withContext(function($ctx1) {
  3530. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  3531. $ctx1.sendIdx["assert:equals:"]=1;
  3532. self._assert_equals_("jackie "._trimRight(),"jackie");
  3533. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  3534. args: [],
  3535. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  3536. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  3537. referencedClasses: []
  3538. }),
  3539. smalltalk.StringTest);
  3540. smalltalk.addMethod(
  3541. smalltalk.method({
  3542. selector: "collectionClass",
  3543. category: 'accessing',
  3544. fn: function (){
  3545. var self=this;
  3546. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3547. return smalltalk.withContext(function($ctx1) {
  3548. return $String();
  3549. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  3550. args: [],
  3551. source: "collectionClass\x0a\x09^ String",
  3552. messageSends: [],
  3553. referencedClasses: ["String"]
  3554. }),
  3555. smalltalk.StringTest.klass);
  3556. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3557. smalltalk.addMethod(
  3558. smalltalk.method({
  3559. selector: "testShow",
  3560. category: 'tests',
  3561. fn: function (){
  3562. var self=this;
  3563. var originalTranscript;
  3564. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  3565. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  3566. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3567. return smalltalk.withContext(function($ctx1) {
  3568. originalTranscript=_st($Transcript())._current();
  3569. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  3570. $ctx1.sendIdx["register:"]=1;
  3571. self._shouldnt_raise_((function(){
  3572. return smalltalk.withContext(function($ctx2) {
  3573. return _st($Transcript())._show_("Hello console!");
  3574. $ctx2.sendIdx["show:"]=1;
  3575. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3576. $ctx1.sendIdx["shouldnt:raise:"]=1;
  3577. self._shouldnt_raise_((function(){
  3578. return smalltalk.withContext(function($ctx2) {
  3579. return _st($Transcript())._show_(console);
  3580. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3581. _st($Transcript())._register_(originalTranscript);
  3582. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  3583. args: [],
  3584. source: "testShow\x0a| originalTranscript |\x0aoriginalTranscript := Transcript current.\x0aTranscript register: ConsoleTranscript new.\x0a\x0aself shouldnt: [ Transcript show: 'Hello console!' ] raise: Error.\x0aself shouldnt: [ Transcript show: console ] raise: Error.\x0a\x0aTranscript register: originalTranscript.",
  3585. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  3586. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  3587. }),
  3588. smalltalk.ConsoleTranscriptTest);
  3589. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3590. smalltalk.addMethod(
  3591. smalltalk.method({
  3592. selector: "jsObject",
  3593. category: 'accessing',
  3594. fn: function (){
  3595. var self=this;
  3596. return smalltalk.withContext(function($ctx1) {
  3597. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  3598. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  3599. args: [],
  3600. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  3601. messageSends: [],
  3602. referencedClasses: []
  3603. }),
  3604. smalltalk.JSObjectProxyTest);
  3605. smalltalk.addMethod(
  3606. smalltalk.method({
  3607. selector: "testAtIfAbsent",
  3608. category: 'tests',
  3609. fn: function (){
  3610. var self=this;
  3611. var testObject;
  3612. return smalltalk.withContext(function($ctx1) {
  3613. var $1,$2,$3,$4;
  3614. testObject=self._jsObject();
  3615. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  3616. return smalltalk.withContext(function($ctx2) {
  3617. return "Property does not exist";
  3618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3619. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3620. self._assert_equals_($1,"Property does not exist");
  3621. $ctx1.sendIdx["assert:equals:"]=1;
  3622. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  3623. return smalltalk.withContext(function($ctx2) {
  3624. return "Property does not exist";
  3625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3626. $ctx1.sendIdx["at:ifAbsent:"]=2;
  3627. self._assert_equals_($2,nil);
  3628. $ctx1.sendIdx["assert:equals:"]=2;
  3629. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  3630. return smalltalk.withContext(function($ctx2) {
  3631. return "Property does not exist";
  3632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  3633. $ctx1.sendIdx["at:ifAbsent:"]=3;
  3634. self._assert_equals_($3,(1));
  3635. $ctx1.sendIdx["assert:equals:"]=3;
  3636. $4=_st(testObject)._at_ifAbsent_("f",(function(){
  3637. return smalltalk.withContext(function($ctx2) {
  3638. return "Property does not exist";
  3639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  3640. self._assert_equals_($4,nil);
  3641. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3642. args: [],
  3643. 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.",
  3644. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  3645. referencedClasses: []
  3646. }),
  3647. smalltalk.JSObjectProxyTest);
  3648. smalltalk.addMethod(
  3649. smalltalk.method({
  3650. selector: "testAtIfPresent",
  3651. category: 'tests',
  3652. fn: function (){
  3653. var self=this;
  3654. var testObject;
  3655. return smalltalk.withContext(function($ctx1) {
  3656. var $2,$1,$4,$3,$6,$5,$8,$7;
  3657. testObject=self._jsObject();
  3658. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  3659. return smalltalk.withContext(function($ctx2) {
  3660. $2=_st(x)._asString();
  3661. $ctx2.sendIdx["asString"]=1;
  3662. return "hello ".__comma($2);
  3663. $ctx2.sendIdx[","]=1;
  3664. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  3665. $ctx1.sendIdx["at:ifPresent:"]=1;
  3666. self._assert_equals_($1,nil);
  3667. $ctx1.sendIdx["assert:equals:"]=1;
  3668. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  3669. return smalltalk.withContext(function($ctx2) {
  3670. $4=_st(x)._asString();
  3671. $ctx2.sendIdx["asString"]=2;
  3672. return "hello ".__comma($4);
  3673. $ctx2.sendIdx[","]=2;
  3674. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  3675. $ctx1.sendIdx["at:ifPresent:"]=2;
  3676. self._assert_equals_($3,"hello nil");
  3677. $ctx1.sendIdx["assert:equals:"]=2;
  3678. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  3679. return smalltalk.withContext(function($ctx2) {
  3680. $6=_st(x)._asString();
  3681. $ctx2.sendIdx["asString"]=3;
  3682. return "hello ".__comma($6);
  3683. $ctx2.sendIdx[","]=3;
  3684. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  3685. $ctx1.sendIdx["at:ifPresent:"]=3;
  3686. self._assert_equals_($5,"hello 1");
  3687. $ctx1.sendIdx["assert:equals:"]=3;
  3688. $7=_st(testObject)._at_ifPresent_("f",(function(x){
  3689. return smalltalk.withContext(function($ctx2) {
  3690. $8=_st(x)._asString();
  3691. return "hello ".__comma($8);
  3692. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})}));
  3693. self._assert_equals_($7,"hello nil");
  3694. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3695. args: [],
  3696. 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'.",
  3697. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  3698. referencedClasses: []
  3699. }),
  3700. smalltalk.JSObjectProxyTest);
  3701. smalltalk.addMethod(
  3702. smalltalk.method({
  3703. selector: "testAtIfPresentIfAbsent",
  3704. category: 'tests',
  3705. fn: function (){
  3706. var self=this;
  3707. var testObject;
  3708. return smalltalk.withContext(function($ctx1) {
  3709. var $2,$1,$4,$3,$6,$5,$8,$7;
  3710. testObject=self._jsObject();
  3711. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  3712. return smalltalk.withContext(function($ctx2) {
  3713. $2=_st(x)._asString();
  3714. $ctx2.sendIdx["asString"]=1;
  3715. return "hello ".__comma($2);
  3716. $ctx2.sendIdx[","]=1;
  3717. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  3718. return smalltalk.withContext(function($ctx2) {
  3719. return "not present";
  3720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3721. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  3722. self._assert_equals_($1,"not present");
  3723. $ctx1.sendIdx["assert:equals:"]=1;
  3724. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  3725. return smalltalk.withContext(function($ctx2) {
  3726. $4=_st(x)._asString();
  3727. $ctx2.sendIdx["asString"]=2;
  3728. return "hello ".__comma($4);
  3729. $ctx2.sendIdx[","]=2;
  3730. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  3731. return smalltalk.withContext(function($ctx2) {
  3732. return "not present";
  3733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  3734. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  3735. self._assert_equals_($3,"hello nil");
  3736. $ctx1.sendIdx["assert:equals:"]=2;
  3737. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  3738. return smalltalk.withContext(function($ctx2) {
  3739. $6=_st(x)._asString();
  3740. $ctx2.sendIdx["asString"]=3;
  3741. return "hello ".__comma($6);
  3742. $ctx2.sendIdx[","]=3;
  3743. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  3744. return smalltalk.withContext(function($ctx2) {
  3745. return "not present";
  3746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  3747. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  3748. self._assert_equals_($5,"hello 1");
  3749. $ctx1.sendIdx["assert:equals:"]=3;
  3750. $7=_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  3751. return smalltalk.withContext(function($ctx2) {
  3752. $8=_st(x)._asString();
  3753. return "hello ".__comma($8);
  3754. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  3755. return smalltalk.withContext(function($ctx2) {
  3756. return "not present";
  3757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  3758. self._assert_equals_($7,"hello nil");
  3759. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3760. args: [],
  3761. 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'.",
  3762. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  3763. referencedClasses: []
  3764. }),
  3765. smalltalk.JSObjectProxyTest);
  3766. smalltalk.addMethod(
  3767. smalltalk.method({
  3768. selector: "testDNU",
  3769. category: 'tests',
  3770. fn: function (){
  3771. var self=this;
  3772. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3773. return smalltalk.withContext(function($ctx1) {
  3774. self._should_raise_((function(){
  3775. return smalltalk.withContext(function($ctx2) {
  3776. return _st(self._jsObject())._foo();
  3777. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3778. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  3779. args: [],
  3780. source: "testDNU\x0a\x09self should: [self jsObject foo] raise: MessageNotUnderstood",
  3781. messageSends: ["should:raise:", "foo", "jsObject"],
  3782. referencedClasses: ["MessageNotUnderstood"]
  3783. }),
  3784. smalltalk.JSObjectProxyTest);
  3785. smalltalk.addMethod(
  3786. smalltalk.method({
  3787. selector: "testMessageSend",
  3788. category: 'tests',
  3789. fn: function (){
  3790. var self=this;
  3791. return smalltalk.withContext(function($ctx1) {
  3792. var $2,$1,$4,$3,$6,$5;
  3793. $2=self._jsObject();
  3794. $ctx1.sendIdx["jsObject"]=1;
  3795. $1=_st($2)._a();
  3796. self._assert_equals_($1,(1));
  3797. $ctx1.sendIdx["assert:equals:"]=1;
  3798. $4=self._jsObject();
  3799. $ctx1.sendIdx["jsObject"]=2;
  3800. $3=_st($4)._b();
  3801. self._assert_equals_($3,(2));
  3802. $ctx1.sendIdx["assert:equals:"]=2;
  3803. $6=self._jsObject();
  3804. $5=_st($6)._c_((3));
  3805. self._assert_equals_($5,(3));
  3806. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  3807. args: [],
  3808. 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",
  3809. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  3810. referencedClasses: []
  3811. }),
  3812. smalltalk.JSObjectProxyTest);
  3813. smalltalk.addMethod(
  3814. smalltalk.method({
  3815. selector: "testMethodWithArguments",
  3816. category: 'tests',
  3817. fn: function (){
  3818. var self=this;
  3819. return smalltalk.withContext(function($ctx1) {
  3820. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  3821. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  3822. args: [],
  3823. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  3824. messageSends: ["assert:equals:", "c:", "jsObject"],
  3825. referencedClasses: []
  3826. }),
  3827. smalltalk.JSObjectProxyTest);
  3828. smalltalk.addMethod(
  3829. smalltalk.method({
  3830. selector: "testPrinting",
  3831. category: 'tests',
  3832. fn: function (){
  3833. var self=this;
  3834. return smalltalk.withContext(function($ctx1) {
  3835. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  3836. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  3837. args: [],
  3838. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  3839. messageSends: ["assert:equals:", "printString", "jsObject"],
  3840. referencedClasses: []
  3841. }),
  3842. smalltalk.JSObjectProxyTest);
  3843. smalltalk.addMethod(
  3844. smalltalk.method({
  3845. selector: "testPropertyThatReturnsEmptyString",
  3846. category: 'tests',
  3847. fn: function (){
  3848. var self=this;
  3849. var object;
  3850. return smalltalk.withContext(function($ctx1) {
  3851. var $1,$2;
  3852. object=self._jsObject();
  3853. $1=_st(object)._d();
  3854. $ctx1.sendIdx["d"]=1;
  3855. self._assert_equals_($1,"");
  3856. $ctx1.sendIdx["assert:equals:"]=1;
  3857. _st(object)._d_("hello");
  3858. $2=_st(object)._d();
  3859. self._assert_equals_($2,"hello");
  3860. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  3861. args: [],
  3862. 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'",
  3863. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  3864. referencedClasses: []
  3865. }),
  3866. smalltalk.JSObjectProxyTest);
  3867. smalltalk.addMethod(
  3868. smalltalk.method({
  3869. selector: "testPropertyThatReturnsUndefined",
  3870. category: 'tests',
  3871. fn: function (){
  3872. var self=this;
  3873. var object;
  3874. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3875. return smalltalk.withContext(function($ctx1) {
  3876. var $2,$1;
  3877. object=self._jsObject();
  3878. self._shouldnt_raise_((function(){
  3879. return smalltalk.withContext(function($ctx2) {
  3880. return _st(object)._e();
  3881. $ctx2.sendIdx["e"]=1;
  3882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3883. $2=_st(object)._e();
  3884. $1=_st($2)._isNil();
  3885. self._assert_($1);
  3886. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  3887. args: [],
  3888. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  3889. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  3890. referencedClasses: ["MessageNotUnderstood"]
  3891. }),
  3892. smalltalk.JSObjectProxyTest);
  3893. smalltalk.addMethod(
  3894. smalltalk.method({
  3895. selector: "testValue",
  3896. category: 'tests',
  3897. fn: function (){
  3898. var self=this;
  3899. var testObject;
  3900. return smalltalk.withContext(function($ctx1) {
  3901. var $2,$1,$3;
  3902. testObject=self._jsObject();
  3903. $2=_st(testObject)._value();
  3904. $ctx1.sendIdx["value"]=1;
  3905. $1=_st($2)._printString();
  3906. self._assert_equals_($1,"[object Object]");
  3907. $ctx1.sendIdx["assert:equals:"]=1;
  3908. _st(testObject)._at_put_("value","aValue");
  3909. $3=_st(testObject)._value();
  3910. self._assert_equals_($3,"aValue");
  3911. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3912. args: [],
  3913. 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'",
  3914. messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"],
  3915. referencedClasses: []
  3916. }),
  3917. smalltalk.JSObjectProxyTest);
  3918. smalltalk.addMethod(
  3919. smalltalk.method({
  3920. selector: "testYourself",
  3921. category: 'tests',
  3922. fn: function (){
  3923. var self=this;
  3924. var object;
  3925. return smalltalk.withContext(function($ctx1) {
  3926. var $1,$2;
  3927. $1=self._jsObject();
  3928. _st($1)._d_("test");
  3929. $2=_st($1)._yourself();
  3930. object=$2;
  3931. self._assert_equals_(_st(object)._d(),"test");
  3932. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  3933. args: [],
  3934. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  3935. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  3936. referencedClasses: []
  3937. }),
  3938. smalltalk.JSObjectProxyTest);
  3939. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3940. smalltalk.addMethod(
  3941. smalltalk.method({
  3942. selector: "testCatchingException",
  3943. category: 'tests',
  3944. fn: function (){
  3945. var self=this;
  3946. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3947. return smalltalk.withContext(function($ctx1) {
  3948. _st((function(){
  3949. return smalltalk.withContext(function($ctx2) {
  3950. return self._throwException();
  3951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  3952. return smalltalk.withContext(function($ctx2) {
  3953. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  3954. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  3955. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  3956. args: [],
  3957. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  3958. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  3959. referencedClasses: ["Error"]
  3960. }),
  3961. smalltalk.JavaScriptExceptionTest);
  3962. smalltalk.addMethod(
  3963. smalltalk.method({
  3964. selector: "testRaisingException",
  3965. category: 'tests',
  3966. fn: function (){
  3967. var self=this;
  3968. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  3969. return smalltalk.withContext(function($ctx1) {
  3970. self._should_raise_((function(){
  3971. return smalltalk.withContext(function($ctx2) {
  3972. return self._throwException();
  3973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  3974. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  3975. args: [],
  3976. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  3977. messageSends: ["should:raise:", "throwException"],
  3978. referencedClasses: ["JavaScriptException"]
  3979. }),
  3980. smalltalk.JavaScriptExceptionTest);
  3981. smalltalk.addMethod(
  3982. smalltalk.method({
  3983. selector: "throwException",
  3984. category: 'helpers',
  3985. fn: function (){
  3986. var self=this;
  3987. return smalltalk.withContext(function($ctx1) {
  3988. throw 'test';
  3989. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  3990. args: [],
  3991. source: "throwException\x0a\x09<throw 'test'>",
  3992. messageSends: [],
  3993. referencedClasses: []
  3994. }),
  3995. smalltalk.JavaScriptExceptionTest);
  3996. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3997. smalltalk.addMethod(
  3998. smalltalk.method({
  3999. selector: "testValue",
  4000. category: 'tests',
  4001. fn: function (){
  4002. var self=this;
  4003. var messageSend;
  4004. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4005. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4006. return smalltalk.withContext(function($ctx1) {
  4007. var $1,$2,$3,$4;
  4008. $1=_st($MessageSend())._new();
  4009. $ctx1.sendIdx["new"]=1;
  4010. $2=$1;
  4011. $3=_st($Object())._new();
  4012. _st($2)._receiver_($3);
  4013. _st($1)._selector_("asString");
  4014. $4=_st($1)._yourself();
  4015. messageSend=$4;
  4016. self._assert_equals_(_st(messageSend)._value(),"an Object");
  4017. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4018. args: [],
  4019. source: "testValue\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: Object new;\x0a\x09\x09selector: #asString;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: messageSend value equals: 'an Object'",
  4020. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  4021. referencedClasses: ["MessageSend", "Object"]
  4022. }),
  4023. smalltalk.MessageSendTest);
  4024. smalltalk.addMethod(
  4025. smalltalk.method({
  4026. selector: "testValueWithArguments",
  4027. category: 'tests',
  4028. fn: function (){
  4029. var self=this;
  4030. var messageSend;
  4031. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4032. return smalltalk.withContext(function($ctx1) {
  4033. var $1,$2;
  4034. $1=_st($MessageSend())._new();
  4035. _st($1)._receiver_((2));
  4036. _st($1)._selector_("+");
  4037. $2=_st($1)._yourself();
  4038. messageSend=$2;
  4039. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  4040. $ctx1.sendIdx["assert:equals:"]=1;
  4041. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  4042. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4043. args: [],
  4044. source: "testValueWithArguments\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: 2;\x0a\x09\x09selector: '+';\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: (messageSend value: 3) equals: 5.\x0a\x09\x0a\x09self assert: (messageSend valueWithPossibleArguments: #(4)) equals: 6",
  4045. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  4046. referencedClasses: ["MessageSend"]
  4047. }),
  4048. smalltalk.MessageSendTest);
  4049. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  4050. smalltalk.addMethod(
  4051. smalltalk.method({
  4052. selector: "codeGeneratorClass",
  4053. category: 'accessing',
  4054. fn: function (){
  4055. var self=this;
  4056. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  4057. return smalltalk.withContext(function($ctx1) {
  4058. return $CodeGenerator();
  4059. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  4060. args: [],
  4061. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  4062. messageSends: [],
  4063. referencedClasses: ["CodeGenerator"]
  4064. }),
  4065. smalltalk.MethodInheritanceTest);
  4066. smalltalk.addMethod(
  4067. smalltalk.method({
  4068. selector: "compiler",
  4069. category: 'factory',
  4070. fn: function (){
  4071. var self=this;
  4072. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  4073. return smalltalk.withContext(function($ctx1) {
  4074. var $2,$3,$1;
  4075. $2=_st($Compiler())._new();
  4076. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  4077. $3=_st($2)._yourself();
  4078. $1=$3;
  4079. return $1;
  4080. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  4081. args: [],
  4082. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  4083. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  4084. referencedClasses: ["Compiler"]
  4085. }),
  4086. smalltalk.MethodInheritanceTest);
  4087. smalltalk.addMethod(
  4088. smalltalk.method({
  4089. selector: "deinstallBottom",
  4090. category: 'testing',
  4091. fn: function (){
  4092. var self=this;
  4093. return smalltalk.withContext(function($ctx1) {
  4094. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  4095. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  4096. args: [],
  4097. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  4098. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  4099. referencedClasses: []
  4100. }),
  4101. smalltalk.MethodInheritanceTest);
  4102. smalltalk.addMethod(
  4103. smalltalk.method({
  4104. selector: "deinstallMiddle",
  4105. category: 'testing',
  4106. fn: function (){
  4107. var self=this;
  4108. return smalltalk.withContext(function($ctx1) {
  4109. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  4110. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  4111. args: [],
  4112. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  4113. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  4114. referencedClasses: []
  4115. }),
  4116. smalltalk.MethodInheritanceTest);
  4117. smalltalk.addMethod(
  4118. smalltalk.method({
  4119. selector: "deinstallTop",
  4120. category: 'testing',
  4121. fn: function (){
  4122. var self=this;
  4123. return smalltalk.withContext(function($ctx1) {
  4124. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  4125. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  4126. args: [],
  4127. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  4128. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  4129. referencedClasses: []
  4130. }),
  4131. smalltalk.MethodInheritanceTest);
  4132. smalltalk.addMethod(
  4133. smalltalk.method({
  4134. selector: "installBottom:",
  4135. category: 'testing',
  4136. fn: function (aString){
  4137. var self=this;
  4138. return smalltalk.withContext(function($ctx1) {
  4139. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassBottom(),"tests");
  4140. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4141. args: ["aString"],
  4142. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom category: 'tests'",
  4143. messageSends: ["install:forClass:category:", "compiler", "targetClassBottom"],
  4144. referencedClasses: []
  4145. }),
  4146. smalltalk.MethodInheritanceTest);
  4147. smalltalk.addMethod(
  4148. smalltalk.method({
  4149. selector: "installMiddle:",
  4150. category: 'testing',
  4151. fn: function (aString){
  4152. var self=this;
  4153. return smalltalk.withContext(function($ctx1) {
  4154. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassMiddle(),"tests");
  4155. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4156. args: ["aString"],
  4157. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle category: 'tests'",
  4158. messageSends: ["install:forClass:category:", "compiler", "targetClassMiddle"],
  4159. referencedClasses: []
  4160. }),
  4161. smalltalk.MethodInheritanceTest);
  4162. smalltalk.addMethod(
  4163. smalltalk.method({
  4164. selector: "installTop:",
  4165. category: 'testing',
  4166. fn: function (aString){
  4167. var self=this;
  4168. return smalltalk.withContext(function($ctx1) {
  4169. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassTop(),"tests");
  4170. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4171. args: ["aString"],
  4172. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop category: 'tests'",
  4173. messageSends: ["install:forClass:category:", "compiler", "targetClassTop"],
  4174. referencedClasses: []
  4175. }),
  4176. smalltalk.MethodInheritanceTest);
  4177. smalltalk.addMethod(
  4178. smalltalk.method({
  4179. selector: "setUp",
  4180. category: 'initialization',
  4181. fn: function (){
  4182. var self=this;
  4183. return smalltalk.withContext(function($ctx1) {
  4184. self["@receiverTop"]=_st(self._targetClassTop())._new();
  4185. $ctx1.sendIdx["new"]=1;
  4186. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  4187. $ctx1.sendIdx["new"]=2;
  4188. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  4189. self["@method"]=nil;
  4190. self["@performBlock"]=(function(){
  4191. return smalltalk.withContext(function($ctx2) {
  4192. return self._error_("performBlock not initialized");
  4193. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  4194. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  4195. args: [],
  4196. source: "setUp\x0a\x09receiverTop := self targetClassTop new.\x0a\x09receiverMiddle := self targetClassMiddle new.\x0a\x09receiverBottom := self targetClassBottom new.\x0a\x09method := nil.\x0a\x09performBlock := [ self error: 'performBlock not initialized' ]",
  4197. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  4198. referencedClasses: []
  4199. }),
  4200. smalltalk.MethodInheritanceTest);
  4201. smalltalk.addMethod(
  4202. smalltalk.method({
  4203. selector: "shouldMNU",
  4204. category: 'testing',
  4205. fn: function (){
  4206. var self=this;
  4207. return smalltalk.withContext(function($ctx1) {
  4208. self._shouldMNUTop();
  4209. self._shouldMNUMiddle();
  4210. self._shouldMNUBottom();
  4211. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  4212. args: [],
  4213. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  4214. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  4215. referencedClasses: []
  4216. }),
  4217. smalltalk.MethodInheritanceTest);
  4218. smalltalk.addMethod(
  4219. smalltalk.method({
  4220. selector: "shouldMNUBottom",
  4221. category: 'testing',
  4222. fn: function (){
  4223. var self=this;
  4224. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4225. return smalltalk.withContext(function($ctx1) {
  4226. self._should_raise_((function(){
  4227. return smalltalk.withContext(function($ctx2) {
  4228. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4229. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4230. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  4231. args: [],
  4232. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  4233. messageSends: ["should:raise:", "value:"],
  4234. referencedClasses: ["MessageNotUnderstood"]
  4235. }),
  4236. smalltalk.MethodInheritanceTest);
  4237. smalltalk.addMethod(
  4238. smalltalk.method({
  4239. selector: "shouldMNUMiddle",
  4240. category: 'testing',
  4241. fn: function (){
  4242. var self=this;
  4243. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4244. return smalltalk.withContext(function($ctx1) {
  4245. self._should_raise_((function(){
  4246. return smalltalk.withContext(function($ctx2) {
  4247. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4249. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  4250. args: [],
  4251. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  4252. messageSends: ["should:raise:", "value:"],
  4253. referencedClasses: ["MessageNotUnderstood"]
  4254. }),
  4255. smalltalk.MethodInheritanceTest);
  4256. smalltalk.addMethod(
  4257. smalltalk.method({
  4258. selector: "shouldMNUTop",
  4259. category: 'testing',
  4260. fn: function (){
  4261. var self=this;
  4262. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4263. return smalltalk.withContext(function($ctx1) {
  4264. self._should_raise_((function(){
  4265. return smalltalk.withContext(function($ctx2) {
  4266. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  4267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4268. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  4269. args: [],
  4270. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  4271. messageSends: ["should:raise:", "value:"],
  4272. referencedClasses: ["MessageNotUnderstood"]
  4273. }),
  4274. smalltalk.MethodInheritanceTest);
  4275. smalltalk.addMethod(
  4276. smalltalk.method({
  4277. selector: "shouldReturn:",
  4278. category: 'testing',
  4279. fn: function (anObject){
  4280. var self=this;
  4281. var result;
  4282. return smalltalk.withContext(function($ctx1) {
  4283. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4284. $ctx1.sendIdx["value:"]=1;
  4285. self._assert_equals_(["top",anObject],["top",result]);
  4286. $ctx1.sendIdx["assert:equals:"]=1;
  4287. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4288. $ctx1.sendIdx["value:"]=2;
  4289. self._assert_equals_(["middle",anObject],["middle",result]);
  4290. $ctx1.sendIdx["assert:equals:"]=2;
  4291. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4292. self._assert_equals_(["bottom",anObject],["bottom",result]);
  4293. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  4294. args: ["anObject"],
  4295. source: "shouldReturn: anObject\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject } equals: { 'bottom'. result }",
  4296. messageSends: ["value:", "assert:equals:"],
  4297. referencedClasses: []
  4298. }),
  4299. smalltalk.MethodInheritanceTest);
  4300. smalltalk.addMethod(
  4301. smalltalk.method({
  4302. selector: "shouldReturn:and:and:",
  4303. category: 'testing',
  4304. fn: function (anObject,anObject2,anObject3){
  4305. var self=this;
  4306. var result;
  4307. return smalltalk.withContext(function($ctx1) {
  4308. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4309. $ctx1.sendIdx["value:"]=1;
  4310. self._assert_equals_(["top",anObject],["top",result]);
  4311. $ctx1.sendIdx["assert:equals:"]=1;
  4312. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4313. $ctx1.sendIdx["value:"]=2;
  4314. self._assert_equals_(["middle",anObject2],["middle",result]);
  4315. $ctx1.sendIdx["assert:equals:"]=2;
  4316. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4317. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  4318. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  4319. args: ["anObject", "anObject2", "anObject3"],
  4320. source: "shouldReturn: anObject and: anObject2 and: anObject3\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject2 } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject3 } equals: { 'bottom'. result }",
  4321. messageSends: ["value:", "assert:equals:"],
  4322. referencedClasses: []
  4323. }),
  4324. smalltalk.MethodInheritanceTest);
  4325. smalltalk.addMethod(
  4326. smalltalk.method({
  4327. selector: "targetClassBottom",
  4328. category: 'accessing',
  4329. fn: function (){
  4330. var self=this;
  4331. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  4332. return smalltalk.withContext(function($ctx1) {
  4333. return $JavaScriptException();
  4334. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  4335. args: [],
  4336. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  4337. messageSends: [],
  4338. referencedClasses: ["JavaScriptException"]
  4339. }),
  4340. smalltalk.MethodInheritanceTest);
  4341. smalltalk.addMethod(
  4342. smalltalk.method({
  4343. selector: "targetClassMiddle",
  4344. category: 'accessing',
  4345. fn: function (){
  4346. var self=this;
  4347. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4348. return smalltalk.withContext(function($ctx1) {
  4349. return $Error();
  4350. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  4351. args: [],
  4352. source: "targetClassMiddle\x0a\x09^ Error",
  4353. messageSends: [],
  4354. referencedClasses: ["Error"]
  4355. }),
  4356. smalltalk.MethodInheritanceTest);
  4357. smalltalk.addMethod(
  4358. smalltalk.method({
  4359. selector: "targetClassTop",
  4360. category: 'accessing',
  4361. fn: function (){
  4362. var self=this;
  4363. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4364. return smalltalk.withContext(function($ctx1) {
  4365. return $Object();
  4366. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  4367. args: [],
  4368. source: "targetClassTop\x0a\x09^ Object",
  4369. messageSends: [],
  4370. referencedClasses: ["Object"]
  4371. }),
  4372. smalltalk.MethodInheritanceTest);
  4373. smalltalk.addMethod(
  4374. smalltalk.method({
  4375. selector: "tearDown",
  4376. category: 'initialization',
  4377. fn: function (){
  4378. var self=this;
  4379. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4380. return smalltalk.withContext(function($ctx1) {
  4381. _st((function(){
  4382. return smalltalk.withContext(function($ctx2) {
  4383. return self._deinstallTop();
  4384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  4385. return smalltalk.withContext(function($ctx2) {
  4386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4387. $ctx1.sendIdx["on:do:"]=1;
  4388. _st((function(){
  4389. return smalltalk.withContext(function($ctx2) {
  4390. return self._deinstallMiddle();
  4391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  4392. return smalltalk.withContext(function($ctx2) {
  4393. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4394. $ctx1.sendIdx["on:do:"]=2;
  4395. _st((function(){
  4396. return smalltalk.withContext(function($ctx2) {
  4397. return self._deinstallBottom();
  4398. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  4399. return smalltalk.withContext(function($ctx2) {
  4400. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  4401. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  4402. args: [],
  4403. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [].\x0a\x09[ self deinstallMiddle ] on: Error do: [].\x0a\x09[ self deinstallBottom ] on: Error do: []",
  4404. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  4405. referencedClasses: ["Error"]
  4406. }),
  4407. smalltalk.MethodInheritanceTest);
  4408. smalltalk.addMethod(
  4409. smalltalk.method({
  4410. selector: "testMNU11",
  4411. category: 'tests',
  4412. fn: function (){
  4413. var self=this;
  4414. return smalltalk.withContext(function($ctx1) {
  4415. self["@performBlock"]=(function(x){
  4416. return smalltalk.withContext(function($ctx2) {
  4417. return _st(x)._foo();
  4418. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4419. self._shouldMNU();
  4420. $ctx1.sendIdx["shouldMNU"]=1;
  4421. self._installTop_("foo ^ false");
  4422. $ctx1.sendIdx["installTop:"]=1;
  4423. self._installTop_("foo ^ true");
  4424. self._deinstallTop();
  4425. self._shouldMNU();
  4426. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  4427. args: [],
  4428. source: "testMNU11\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self deinstallTop.\x0a\x09self shouldMNU",
  4429. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  4430. referencedClasses: []
  4431. }),
  4432. smalltalk.MethodInheritanceTest);
  4433. smalltalk.addMethod(
  4434. smalltalk.method({
  4435. selector: "testMNU22",
  4436. category: 'tests',
  4437. fn: function (){
  4438. var self=this;
  4439. return smalltalk.withContext(function($ctx1) {
  4440. self["@performBlock"]=(function(x){
  4441. return smalltalk.withContext(function($ctx2) {
  4442. return _st(x)._foo();
  4443. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4444. self._shouldMNU();
  4445. $ctx1.sendIdx["shouldMNU"]=1;
  4446. self._installMiddle_("foo ^ false");
  4447. $ctx1.sendIdx["installMiddle:"]=1;
  4448. self._installMiddle_("foo ^ true");
  4449. self._deinstallMiddle();
  4450. self._shouldMNU();
  4451. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  4452. args: [],
  4453. source: "testMNU22\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installMiddle: 'foo ^ false'.\x0a\x09self installMiddle: 'foo ^ true'.\x0a\x09self deinstallMiddle.\x0a\x09self shouldMNU",
  4454. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  4455. referencedClasses: []
  4456. }),
  4457. smalltalk.MethodInheritanceTest);
  4458. smalltalk.addMethod(
  4459. smalltalk.method({
  4460. selector: "testReturns1",
  4461. category: 'tests',
  4462. fn: function (){
  4463. var self=this;
  4464. return smalltalk.withContext(function($ctx1) {
  4465. self["@performBlock"]=(function(x){
  4466. return smalltalk.withContext(function($ctx2) {
  4467. return _st(x)._foo();
  4468. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4469. self._installTop_("foo ^ false");
  4470. $ctx1.sendIdx["installTop:"]=1;
  4471. self._shouldReturn_(false);
  4472. $ctx1.sendIdx["shouldReturn:"]=1;
  4473. self._installTop_("foo ^ true");
  4474. self._shouldReturn_(true);
  4475. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  4476. args: [],
  4477. source: "testReturns1\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self shouldReturn: false.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self shouldReturn: true",
  4478. messageSends: ["foo", "installTop:", "shouldReturn:"],
  4479. referencedClasses: []
  4480. }),
  4481. smalltalk.MethodInheritanceTest);
  4482. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4483. smalltalk.addMethod(
  4484. smalltalk.method({
  4485. selector: "testAbs",
  4486. category: 'tests',
  4487. fn: function (){
  4488. var self=this;
  4489. return smalltalk.withContext(function($ctx1) {
  4490. var $1,$2;
  4491. $1=(4)._abs();
  4492. $ctx1.sendIdx["abs"]=1;
  4493. self._assert_equals_($1,(4));
  4494. $ctx1.sendIdx["assert:equals:"]=1;
  4495. $2=(-4)._abs();
  4496. self._assert_equals_($2,(4));
  4497. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  4498. args: [],
  4499. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  4500. messageSends: ["assert:equals:", "abs"],
  4501. referencedClasses: []
  4502. }),
  4503. smalltalk.NumberTest);
  4504. smalltalk.addMethod(
  4505. smalltalk.method({
  4506. selector: "testArithmetic",
  4507. category: 'tests',
  4508. fn: function (){
  4509. var self=this;
  4510. return smalltalk.withContext(function($ctx1) {
  4511. var $1,$2,$3,$4,$6,$5,$8,$7;
  4512. $1=(1.5).__plus((1));
  4513. $ctx1.sendIdx["+"]=1;
  4514. self._assert_equals_($1,(2.5));
  4515. $ctx1.sendIdx["assert:equals:"]=1;
  4516. $2=(2).__minus((1));
  4517. $ctx1.sendIdx["-"]=1;
  4518. self._assert_equals_($2,(1));
  4519. $ctx1.sendIdx["assert:equals:"]=2;
  4520. $3=(-2).__minus((1));
  4521. self._assert_equals_($3,(-3));
  4522. $ctx1.sendIdx["assert:equals:"]=3;
  4523. self._assert_equals_((12).__slash((2)),(6));
  4524. $ctx1.sendIdx["assert:equals:"]=4;
  4525. $4=(3).__star((4));
  4526. $ctx1.sendIdx["*"]=1;
  4527. self._assert_equals_($4,(12));
  4528. $ctx1.sendIdx["assert:equals:"]=5;
  4529. self._assert_equals_((7).__slash_slash((2)),(3));
  4530. $ctx1.sendIdx["assert:equals:"]=6;
  4531. self._assert_equals_((7).__backslash_backslash((2)),(1));
  4532. $ctx1.sendIdx["assert:equals:"]=7;
  4533. $6=(1).__plus((2));
  4534. $ctx1.sendIdx["+"]=2;
  4535. $5=_st($6).__star((3));
  4536. $ctx1.sendIdx["*"]=2;
  4537. self._assert_equals_($5,(9));
  4538. $ctx1.sendIdx["assert:equals:"]=8;
  4539. $8=(2).__star((3));
  4540. $7=(1).__plus($8);
  4541. self._assert_equals_($7,(7));
  4542. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  4543. args: [],
  4544. 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\x09self assert: 7 // 2 equals: 3.\x0a\x09self assert: 7 \x5c\x5c 2 equals: 1.\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",
  4545. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  4546. referencedClasses: []
  4547. }),
  4548. smalltalk.NumberTest);
  4549. smalltalk.addMethod(
  4550. smalltalk.method({
  4551. selector: "testAsNumber",
  4552. category: 'tests',
  4553. fn: function (){
  4554. var self=this;
  4555. return smalltalk.withContext(function($ctx1) {
  4556. self._assert_equals_((3)._asNumber(),(3));
  4557. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  4558. args: [],
  4559. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  4560. messageSends: ["assert:equals:", "asNumber"],
  4561. referencedClasses: []
  4562. }),
  4563. smalltalk.NumberTest);
  4564. smalltalk.addMethod(
  4565. smalltalk.method({
  4566. selector: "testCeiling",
  4567. category: 'tests',
  4568. fn: function (){
  4569. var self=this;
  4570. return smalltalk.withContext(function($ctx1) {
  4571. var $1,$2,$3;
  4572. $1=(1.2)._ceiling();
  4573. $ctx1.sendIdx["ceiling"]=1;
  4574. self._assert_equals_($1,(2));
  4575. $ctx1.sendIdx["assert:equals:"]=1;
  4576. $2=(-1.2)._ceiling();
  4577. $ctx1.sendIdx["ceiling"]=2;
  4578. self._assert_equals_($2,(-1));
  4579. $ctx1.sendIdx["assert:equals:"]=2;
  4580. $3=(1)._ceiling();
  4581. self._assert_equals_($3,(1));
  4582. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  4583. args: [],
  4584. source: "testCeiling\x0a\x09self assert: 1.2 ceiling equals: 2.\x0a\x09self assert: -1.2 ceiling equals: -1.\x0a\x09self assert: 1.0 ceiling equals: 1.",
  4585. messageSends: ["assert:equals:", "ceiling"],
  4586. referencedClasses: []
  4587. }),
  4588. smalltalk.NumberTest);
  4589. smalltalk.addMethod(
  4590. smalltalk.method({
  4591. selector: "testComparison",
  4592. category: 'tests',
  4593. fn: function (){
  4594. var self=this;
  4595. return smalltalk.withContext(function($ctx1) {
  4596. var $1,$2,$3,$4,$5,$6,$7,$8;
  4597. $1=(3).__gt((2));
  4598. $ctx1.sendIdx[">"]=1;
  4599. self._assert_($1);
  4600. $ctx1.sendIdx["assert:"]=1;
  4601. $2=(2).__lt((3));
  4602. $ctx1.sendIdx["<"]=1;
  4603. self._assert_($2);
  4604. $ctx1.sendIdx["assert:"]=2;
  4605. $3=(3).__lt((2));
  4606. self._deny_($3);
  4607. $ctx1.sendIdx["deny:"]=1;
  4608. $4=(2).__gt((3));
  4609. self._deny_($4);
  4610. $5=(3).__gt_eq((3));
  4611. $ctx1.sendIdx[">="]=1;
  4612. self._assert_($5);
  4613. $ctx1.sendIdx["assert:"]=3;
  4614. $6=(3.1).__gt_eq((3));
  4615. self._assert_($6);
  4616. $ctx1.sendIdx["assert:"]=4;
  4617. $7=(3).__lt_eq((3));
  4618. $ctx1.sendIdx["<="]=1;
  4619. self._assert_($7);
  4620. $ctx1.sendIdx["assert:"]=5;
  4621. $8=(3).__lt_eq((3.1));
  4622. self._assert_($8);
  4623. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  4624. args: [],
  4625. 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",
  4626. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  4627. referencedClasses: []
  4628. }),
  4629. smalltalk.NumberTest);
  4630. smalltalk.addMethod(
  4631. smalltalk.method({
  4632. selector: "testCopying",
  4633. category: 'tests',
  4634. fn: function (){
  4635. var self=this;
  4636. return smalltalk.withContext(function($ctx1) {
  4637. var $1,$2;
  4638. $1=_st((1)._copy()).__eq_eq((1));
  4639. $ctx1.sendIdx["=="]=1;
  4640. self._assert_($1);
  4641. $ctx1.sendIdx["assert:"]=1;
  4642. $2=_st((1)._deepCopy()).__eq_eq((1));
  4643. self._assert_($2);
  4644. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  4645. args: [],
  4646. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  4647. messageSends: ["assert:", "==", "copy", "deepCopy"],
  4648. referencedClasses: []
  4649. }),
  4650. smalltalk.NumberTest);
  4651. smalltalk.addMethod(
  4652. smalltalk.method({
  4653. selector: "testEquality",
  4654. category: 'tests',
  4655. fn: function (){
  4656. var self=this;
  4657. return smalltalk.withContext(function($ctx1) {
  4658. var $1,$2,$3,$5,$4,$7,$6,$9,$10,$8,$11,$12,$13,$14;
  4659. $1=(1).__eq((1));
  4660. $ctx1.sendIdx["="]=1;
  4661. self._assert_($1);
  4662. $ctx1.sendIdx["assert:"]=1;
  4663. $2=(0).__eq((0));
  4664. $ctx1.sendIdx["="]=2;
  4665. self._assert_($2);
  4666. $ctx1.sendIdx["assert:"]=2;
  4667. $3=(1).__eq((0));
  4668. $ctx1.sendIdx["="]=3;
  4669. self._deny_($3);
  4670. $ctx1.sendIdx["deny:"]=1;
  4671. $5=(1)._yourself();
  4672. $ctx1.sendIdx["yourself"]=1;
  4673. $4=_st($5).__eq((1));
  4674. $ctx1.sendIdx["="]=4;
  4675. self._assert_($4);
  4676. $ctx1.sendIdx["assert:"]=3;
  4677. $7=(1)._yourself();
  4678. $ctx1.sendIdx["yourself"]=2;
  4679. $6=(1).__eq($7);
  4680. $ctx1.sendIdx["="]=5;
  4681. self._assert_($6);
  4682. $ctx1.sendIdx["assert:"]=4;
  4683. $9=(1)._yourself();
  4684. $ctx1.sendIdx["yourself"]=3;
  4685. $10=(1)._yourself();
  4686. $8=_st($9).__eq($10);
  4687. $ctx1.sendIdx["="]=6;
  4688. self._assert_($8);
  4689. $11=(0).__eq(false);
  4690. $ctx1.sendIdx["="]=7;
  4691. self._deny_($11);
  4692. $ctx1.sendIdx["deny:"]=2;
  4693. $12=false.__eq((0));
  4694. $ctx1.sendIdx["="]=8;
  4695. self._deny_($12);
  4696. $ctx1.sendIdx["deny:"]=3;
  4697. $13="".__eq((0));
  4698. $ctx1.sendIdx["="]=9;
  4699. self._deny_($13);
  4700. $ctx1.sendIdx["deny:"]=4;
  4701. $14=(0).__eq("");
  4702. self._deny_($14);
  4703. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  4704. args: [],
  4705. 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 = ''",
  4706. messageSends: ["assert:", "=", "deny:", "yourself"],
  4707. referencedClasses: []
  4708. }),
  4709. smalltalk.NumberTest);
  4710. smalltalk.addMethod(
  4711. smalltalk.method({
  4712. selector: "testFloor",
  4713. category: 'tests',
  4714. fn: function (){
  4715. var self=this;
  4716. return smalltalk.withContext(function($ctx1) {
  4717. var $1,$2,$3;
  4718. $1=(1.2)._floor();
  4719. $ctx1.sendIdx["floor"]=1;
  4720. self._assert_equals_($1,(1));
  4721. $ctx1.sendIdx["assert:equals:"]=1;
  4722. $2=(-1.2)._floor();
  4723. $ctx1.sendIdx["floor"]=2;
  4724. self._assert_equals_($2,(-2));
  4725. $ctx1.sendIdx["assert:equals:"]=2;
  4726. $3=(1)._floor();
  4727. self._assert_equals_($3,(1));
  4728. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  4729. args: [],
  4730. source: "testFloor\x0a\x09self assert: 1.2 floor equals: 1.\x0a\x09self assert: -1.2 floor equals: -2.\x0a\x09self assert: 1.0 floor equals: 1.",
  4731. messageSends: ["assert:equals:", "floor"],
  4732. referencedClasses: []
  4733. }),
  4734. smalltalk.NumberTest);
  4735. smalltalk.addMethod(
  4736. smalltalk.method({
  4737. selector: "testHexNumbers",
  4738. category: 'tests',
  4739. fn: function (){
  4740. var self=this;
  4741. return smalltalk.withContext(function($ctx1) {
  4742. var $1,$2,$3,$4,$5,$6;
  4743. self._assert_equals_((9),(9));
  4744. $ctx1.sendIdx["assert:equals:"]=1;
  4745. $1=(10)._truncated();
  4746. $ctx1.sendIdx["truncated"]=1;
  4747. self._assert_equals_($1,(10));
  4748. $ctx1.sendIdx["assert:equals:"]=2;
  4749. $2=(11)._truncated();
  4750. $ctx1.sendIdx["truncated"]=2;
  4751. self._assert_equals_($2,(11));
  4752. $ctx1.sendIdx["assert:equals:"]=3;
  4753. $3=(12)._truncated();
  4754. $ctx1.sendIdx["truncated"]=3;
  4755. self._assert_equals_($3,(12));
  4756. $ctx1.sendIdx["assert:equals:"]=4;
  4757. $4=(13)._truncated();
  4758. $ctx1.sendIdx["truncated"]=4;
  4759. self._assert_equals_($4,(13));
  4760. $ctx1.sendIdx["assert:equals:"]=5;
  4761. $5=(14)._truncated();
  4762. $ctx1.sendIdx["truncated"]=5;
  4763. self._assert_equals_($5,(14));
  4764. $ctx1.sendIdx["assert:equals:"]=6;
  4765. $6=(15)._truncated();
  4766. self._assert_equals_($6,(15));
  4767. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  4768. args: [],
  4769. 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",
  4770. messageSends: ["assert:equals:", "truncated"],
  4771. referencedClasses: []
  4772. }),
  4773. smalltalk.NumberTest);
  4774. smalltalk.addMethod(
  4775. smalltalk.method({
  4776. selector: "testIdentity",
  4777. category: 'tests',
  4778. fn: function (){
  4779. var self=this;
  4780. return smalltalk.withContext(function($ctx1) {
  4781. var $1,$2,$3,$5,$4,$7,$6,$9,$10,$8,$11;
  4782. $1=(1).__eq_eq((1));
  4783. $ctx1.sendIdx["=="]=1;
  4784. self._assert_($1);
  4785. $ctx1.sendIdx["assert:"]=1;
  4786. $2=(0).__eq_eq((0));
  4787. $ctx1.sendIdx["=="]=2;
  4788. self._assert_($2);
  4789. $ctx1.sendIdx["assert:"]=2;
  4790. $3=(1).__eq_eq((0));
  4791. $ctx1.sendIdx["=="]=3;
  4792. self._deny_($3);
  4793. $ctx1.sendIdx["deny:"]=1;
  4794. $5=(1)._yourself();
  4795. $ctx1.sendIdx["yourself"]=1;
  4796. $4=_st($5).__eq_eq((1));
  4797. $ctx1.sendIdx["=="]=4;
  4798. self._assert_($4);
  4799. $ctx1.sendIdx["assert:"]=3;
  4800. $7=(1)._yourself();
  4801. $ctx1.sendIdx["yourself"]=2;
  4802. $6=(1).__eq_eq($7);
  4803. $ctx1.sendIdx["=="]=5;
  4804. self._assert_($6);
  4805. $ctx1.sendIdx["assert:"]=4;
  4806. $9=(1)._yourself();
  4807. $ctx1.sendIdx["yourself"]=3;
  4808. $10=(1)._yourself();
  4809. $8=_st($9).__eq_eq($10);
  4810. $ctx1.sendIdx["=="]=6;
  4811. self._assert_($8);
  4812. $11=(1).__eq_eq((2));
  4813. self._deny_($11);
  4814. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  4815. args: [],
  4816. 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",
  4817. messageSends: ["assert:", "==", "deny:", "yourself"],
  4818. referencedClasses: []
  4819. }),
  4820. smalltalk.NumberTest);
  4821. smalltalk.addMethod(
  4822. smalltalk.method({
  4823. selector: "testInvalidHexNumbers",
  4824. category: 'tests',
  4825. fn: function (){
  4826. var self=this;
  4827. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4828. return smalltalk.withContext(function($ctx1) {
  4829. self._should_raise_((function(){
  4830. return smalltalk.withContext(function($ctx2) {
  4831. return (16)._rG();
  4832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4833. $ctx1.sendIdx["should:raise:"]=1;
  4834. self._should_raise_((function(){
  4835. return smalltalk.withContext(function($ctx2) {
  4836. return (16)._rg();
  4837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  4838. $ctx1.sendIdx["should:raise:"]=2;
  4839. self._should_raise_((function(){
  4840. return smalltalk.withContext(function($ctx2) {
  4841. return (16)._rH();
  4842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  4843. $ctx1.sendIdx["should:raise:"]=3;
  4844. self._should_raise_((function(){
  4845. return smalltalk.withContext(function($ctx2) {
  4846. return (16)._rh();
  4847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  4848. $ctx1.sendIdx["should:raise:"]=4;
  4849. self._should_raise_((function(){
  4850. return smalltalk.withContext(function($ctx2) {
  4851. return (16)._rI();
  4852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  4853. $ctx1.sendIdx["should:raise:"]=5;
  4854. self._should_raise_((function(){
  4855. return smalltalk.withContext(function($ctx2) {
  4856. return (16)._ri();
  4857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  4858. $ctx1.sendIdx["should:raise:"]=6;
  4859. self._should_raise_((function(){
  4860. return smalltalk.withContext(function($ctx2) {
  4861. return (16)._rJ();
  4862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  4863. $ctx1.sendIdx["should:raise:"]=7;
  4864. self._should_raise_((function(){
  4865. return smalltalk.withContext(function($ctx2) {
  4866. return (16)._rj();
  4867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  4868. $ctx1.sendIdx["should:raise:"]=8;
  4869. self._should_raise_((function(){
  4870. return smalltalk.withContext(function($ctx2) {
  4871. return (16)._rK();
  4872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  4873. $ctx1.sendIdx["should:raise:"]=9;
  4874. self._should_raise_((function(){
  4875. return smalltalk.withContext(function($ctx2) {
  4876. return (16)._rk();
  4877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  4878. $ctx1.sendIdx["should:raise:"]=10;
  4879. self._should_raise_((function(){
  4880. return smalltalk.withContext(function($ctx2) {
  4881. return (16)._rL();
  4882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  4883. $ctx1.sendIdx["should:raise:"]=11;
  4884. self._should_raise_((function(){
  4885. return smalltalk.withContext(function($ctx2) {
  4886. return (16)._rl();
  4887. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  4888. $ctx1.sendIdx["should:raise:"]=12;
  4889. self._should_raise_((function(){
  4890. return smalltalk.withContext(function($ctx2) {
  4891. return (16)._rM();
  4892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  4893. $ctx1.sendIdx["should:raise:"]=13;
  4894. self._should_raise_((function(){
  4895. return smalltalk.withContext(function($ctx2) {
  4896. return (16)._rm();
  4897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  4898. $ctx1.sendIdx["should:raise:"]=14;
  4899. self._should_raise_((function(){
  4900. return smalltalk.withContext(function($ctx2) {
  4901. return (16)._rN();
  4902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  4903. $ctx1.sendIdx["should:raise:"]=15;
  4904. self._should_raise_((function(){
  4905. return smalltalk.withContext(function($ctx2) {
  4906. return (16)._rn();
  4907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  4908. $ctx1.sendIdx["should:raise:"]=16;
  4909. self._should_raise_((function(){
  4910. return smalltalk.withContext(function($ctx2) {
  4911. return (16)._rO();
  4912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  4913. $ctx1.sendIdx["should:raise:"]=17;
  4914. self._should_raise_((function(){
  4915. return smalltalk.withContext(function($ctx2) {
  4916. return (16)._ro();
  4917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  4918. $ctx1.sendIdx["should:raise:"]=18;
  4919. self._should_raise_((function(){
  4920. return smalltalk.withContext(function($ctx2) {
  4921. return (16)._rP();
  4922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  4923. $ctx1.sendIdx["should:raise:"]=19;
  4924. self._should_raise_((function(){
  4925. return smalltalk.withContext(function($ctx2) {
  4926. return (16)._rp();
  4927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  4928. $ctx1.sendIdx["should:raise:"]=20;
  4929. self._should_raise_((function(){
  4930. return smalltalk.withContext(function($ctx2) {
  4931. return (16)._rQ();
  4932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  4933. $ctx1.sendIdx["should:raise:"]=21;
  4934. self._should_raise_((function(){
  4935. return smalltalk.withContext(function($ctx2) {
  4936. return (16)._rq();
  4937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  4938. $ctx1.sendIdx["should:raise:"]=22;
  4939. self._should_raise_((function(){
  4940. return smalltalk.withContext(function($ctx2) {
  4941. return (16)._rR();
  4942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  4943. $ctx1.sendIdx["should:raise:"]=23;
  4944. self._should_raise_((function(){
  4945. return smalltalk.withContext(function($ctx2) {
  4946. return (16)._rr();
  4947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  4948. $ctx1.sendIdx["should:raise:"]=24;
  4949. self._should_raise_((function(){
  4950. return smalltalk.withContext(function($ctx2) {
  4951. return (16)._rS();
  4952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  4953. $ctx1.sendIdx["should:raise:"]=25;
  4954. self._should_raise_((function(){
  4955. return smalltalk.withContext(function($ctx2) {
  4956. return (16)._rs();
  4957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  4958. $ctx1.sendIdx["should:raise:"]=26;
  4959. self._should_raise_((function(){
  4960. return smalltalk.withContext(function($ctx2) {
  4961. return (16)._rT();
  4962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  4963. $ctx1.sendIdx["should:raise:"]=27;
  4964. self._should_raise_((function(){
  4965. return smalltalk.withContext(function($ctx2) {
  4966. return (16)._rt();
  4967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  4968. $ctx1.sendIdx["should:raise:"]=28;
  4969. self._should_raise_((function(){
  4970. return smalltalk.withContext(function($ctx2) {
  4971. return (16)._rU();
  4972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  4973. $ctx1.sendIdx["should:raise:"]=29;
  4974. self._should_raise_((function(){
  4975. return smalltalk.withContext(function($ctx2) {
  4976. return (16)._ru();
  4977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  4978. $ctx1.sendIdx["should:raise:"]=30;
  4979. self._should_raise_((function(){
  4980. return smalltalk.withContext(function($ctx2) {
  4981. return (16)._rV();
  4982. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  4983. $ctx1.sendIdx["should:raise:"]=31;
  4984. self._should_raise_((function(){
  4985. return smalltalk.withContext(function($ctx2) {
  4986. return (16)._rv();
  4987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  4988. $ctx1.sendIdx["should:raise:"]=32;
  4989. self._should_raise_((function(){
  4990. return smalltalk.withContext(function($ctx2) {
  4991. return (16)._rW();
  4992. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  4993. $ctx1.sendIdx["should:raise:"]=33;
  4994. self._should_raise_((function(){
  4995. return smalltalk.withContext(function($ctx2) {
  4996. return (16)._rw();
  4997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  4998. $ctx1.sendIdx["should:raise:"]=34;
  4999. self._should_raise_((function(){
  5000. return smalltalk.withContext(function($ctx2) {
  5001. return (16)._rX();
  5002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  5003. $ctx1.sendIdx["should:raise:"]=35;
  5004. self._should_raise_((function(){
  5005. return smalltalk.withContext(function($ctx2) {
  5006. return (16)._rx();
  5007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  5008. $ctx1.sendIdx["should:raise:"]=36;
  5009. self._should_raise_((function(){
  5010. return smalltalk.withContext(function($ctx2) {
  5011. return (16)._rY();
  5012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  5013. $ctx1.sendIdx["should:raise:"]=37;
  5014. self._should_raise_((function(){
  5015. return smalltalk.withContext(function($ctx2) {
  5016. return (16)._ry();
  5017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  5018. $ctx1.sendIdx["should:raise:"]=38;
  5019. self._should_raise_((function(){
  5020. return smalltalk.withContext(function($ctx2) {
  5021. return (16)._rZ();
  5022. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  5023. $ctx1.sendIdx["should:raise:"]=39;
  5024. self._should_raise_((function(){
  5025. return smalltalk.withContext(function($ctx2) {
  5026. return (16)._rz();
  5027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  5028. $ctx1.sendIdx["should:raise:"]=40;
  5029. self._should_raise_((function(){
  5030. return smalltalk.withContext(function($ctx2) {
  5031. return (11259375)._Z();
  5032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  5033. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  5034. args: [],
  5035. 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.",
  5036. 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"],
  5037. referencedClasses: ["MessageNotUnderstood"]
  5038. }),
  5039. smalltalk.NumberTest);
  5040. smalltalk.addMethod(
  5041. smalltalk.method({
  5042. selector: "testLog",
  5043. category: 'tests',
  5044. fn: function (){
  5045. var self=this;
  5046. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  5047. return smalltalk.withContext(function($ctx1) {
  5048. self._assert_equals_((10000)._log(),(4));
  5049. $ctx1.sendIdx["assert:equals:"]=1;
  5050. self._assert_equals_((512)._log_((2)),(9));
  5051. $ctx1.sendIdx["assert:equals:"]=2;
  5052. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  5053. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  5054. args: [],
  5055. source: "testLog\x0a\x09self assert: 10000 log equals: 4.\x0a\x09self assert: (512 log: 2) equals: 9.\x0a\x09self assert: Number e ln equals: 1.",
  5056. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  5057. referencedClasses: ["Number"]
  5058. }),
  5059. smalltalk.NumberTest);
  5060. smalltalk.addMethod(
  5061. smalltalk.method({
  5062. selector: "testMinMax",
  5063. category: 'tests',
  5064. fn: function (){
  5065. var self=this;
  5066. return smalltalk.withContext(function($ctx1) {
  5067. self._assert_equals_((2)._max_((5)),(5));
  5068. $ctx1.sendIdx["assert:equals:"]=1;
  5069. self._assert_equals_((2)._min_((5)),(2));
  5070. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  5071. args: [],
  5072. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  5073. messageSends: ["assert:equals:", "max:", "min:"],
  5074. referencedClasses: []
  5075. }),
  5076. smalltalk.NumberTest);
  5077. smalltalk.addMethod(
  5078. smalltalk.method({
  5079. selector: "testNegated",
  5080. category: 'tests',
  5081. fn: function (){
  5082. var self=this;
  5083. return smalltalk.withContext(function($ctx1) {
  5084. var $1,$2;
  5085. $1=(3)._negated();
  5086. $ctx1.sendIdx["negated"]=1;
  5087. self._assert_equals_($1,(-3));
  5088. $ctx1.sendIdx["assert:equals:"]=1;
  5089. $2=(-3)._negated();
  5090. self._assert_equals_($2,(3));
  5091. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  5092. args: [],
  5093. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  5094. messageSends: ["assert:equals:", "negated"],
  5095. referencedClasses: []
  5096. }),
  5097. smalltalk.NumberTest);
  5098. smalltalk.addMethod(
  5099. smalltalk.method({
  5100. selector: "testPrintShowingDecimalPlaces",
  5101. category: 'tests',
  5102. fn: function (){
  5103. var self=this;
  5104. return smalltalk.withContext(function($ctx1) {
  5105. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$14,$13,$15,$16,$17;
  5106. $1=(23)._printShowingDecimalPlaces_((2));
  5107. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  5108. self._assert_equals_($1,"23.00");
  5109. $ctx1.sendIdx["assert:equals:"]=1;
  5110. $2=(23.5698)._printShowingDecimalPlaces_((2));
  5111. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  5112. self._assert_equals_($2,"23.57");
  5113. $ctx1.sendIdx["assert:equals:"]=2;
  5114. $4=(234.567)._negated();
  5115. $ctx1.sendIdx["negated"]=1;
  5116. $3=_st($4)._printShowingDecimalPlaces_((5));
  5117. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  5118. self._assert_equals_($3,"-234.56700");
  5119. $ctx1.sendIdx["assert:equals:"]=3;
  5120. $5=(23.4567)._printShowingDecimalPlaces_((0));
  5121. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  5122. self._assert_equals_($5,"23");
  5123. $ctx1.sendIdx["assert:equals:"]=4;
  5124. $6=(23.5567)._printShowingDecimalPlaces_((0));
  5125. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  5126. self._assert_equals_($6,"24");
  5127. $ctx1.sendIdx["assert:equals:"]=5;
  5128. $8=(23.4567)._negated();
  5129. $ctx1.sendIdx["negated"]=2;
  5130. $7=_st($8)._printShowingDecimalPlaces_((0));
  5131. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  5132. self._assert_equals_($7,"-23");
  5133. $ctx1.sendIdx["assert:equals:"]=6;
  5134. $10=(23.5567)._negated();
  5135. $ctx1.sendIdx["negated"]=3;
  5136. $9=_st($10)._printShowingDecimalPlaces_((0));
  5137. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  5138. self._assert_equals_($9,"-24");
  5139. $ctx1.sendIdx["assert:equals:"]=7;
  5140. $11=(100000000)._printShowingDecimalPlaces_((1));
  5141. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  5142. self._assert_equals_($11,"100000000.0");
  5143. $ctx1.sendIdx["assert:equals:"]=8;
  5144. $12=(0.98)._printShowingDecimalPlaces_((5));
  5145. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  5146. self._assert_equals_($12,"0.98000");
  5147. $ctx1.sendIdx["assert:equals:"]=9;
  5148. $14=(0.98)._negated();
  5149. $13=_st($14)._printShowingDecimalPlaces_((2));
  5150. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  5151. self._assert_equals_($13,"-0.98");
  5152. $ctx1.sendIdx["assert:equals:"]=10;
  5153. $15=(2.567)._printShowingDecimalPlaces_((2));
  5154. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  5155. self._assert_equals_($15,"2.57");
  5156. $ctx1.sendIdx["assert:equals:"]=11;
  5157. $16=(-2.567)._printShowingDecimalPlaces_((2));
  5158. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  5159. self._assert_equals_($16,"-2.57");
  5160. $ctx1.sendIdx["assert:equals:"]=12;
  5161. $17=(0)._printShowingDecimalPlaces_((2));
  5162. self._assert_equals_($17,"0.00");
  5163. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  5164. args: [],
  5165. 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'.",
  5166. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  5167. referencedClasses: []
  5168. }),
  5169. smalltalk.NumberTest);
  5170. smalltalk.addMethod(
  5171. smalltalk.method({
  5172. selector: "testRaisedTo",
  5173. category: 'tests',
  5174. fn: function (){
  5175. var self=this;
  5176. return smalltalk.withContext(function($ctx1) {
  5177. var $1,$2,$3,$4;
  5178. $1=(2)._raisedTo_((4));
  5179. $ctx1.sendIdx["raisedTo:"]=1;
  5180. self._assert_equals_($1,(16));
  5181. $ctx1.sendIdx["assert:equals:"]=1;
  5182. $2=(2)._raisedTo_((0));
  5183. $ctx1.sendIdx["raisedTo:"]=2;
  5184. self._assert_equals_($2,(1));
  5185. $ctx1.sendIdx["assert:equals:"]=2;
  5186. $3=(2)._raisedTo_((-3));
  5187. $ctx1.sendIdx["raisedTo:"]=3;
  5188. self._assert_equals_($3,(0.125));
  5189. $ctx1.sendIdx["assert:equals:"]=3;
  5190. $4=(4)._raisedTo_((0.5));
  5191. self._assert_equals_($4,(2));
  5192. $ctx1.sendIdx["assert:equals:"]=4;
  5193. self._assert_equals_((2).__star_star((4)),(16));
  5194. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  5195. args: [],
  5196. source: "testRaisedTo\x0a\x09self assert: (2 raisedTo: 4) equals: 16.\x0a\x09self assert: (2 raisedTo: 0) equals: 1.\x0a\x09self assert: (2 raisedTo: -3) equals: 0.125.\x0a\x09self assert: (4 raisedTo: 0.5) equals: 2.\x0a\x09\x0a\x09self assert: 2 ** 4 equals: 16.",
  5197. messageSends: ["assert:equals:", "raisedTo:", "**"],
  5198. referencedClasses: []
  5199. }),
  5200. smalltalk.NumberTest);
  5201. smalltalk.addMethod(
  5202. smalltalk.method({
  5203. selector: "testRounded",
  5204. category: 'tests',
  5205. fn: function (){
  5206. var self=this;
  5207. return smalltalk.withContext(function($ctx1) {
  5208. var $1,$2,$3;
  5209. $1=(3)._rounded();
  5210. $ctx1.sendIdx["rounded"]=1;
  5211. self._assert_equals_($1,(3));
  5212. $ctx1.sendIdx["assert:equals:"]=1;
  5213. $2=(3.212)._rounded();
  5214. $ctx1.sendIdx["rounded"]=2;
  5215. self._assert_equals_($2,(3));
  5216. $ctx1.sendIdx["assert:equals:"]=2;
  5217. $3=(3.51)._rounded();
  5218. self._assert_equals_($3,(4));
  5219. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  5220. args: [],
  5221. 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",
  5222. messageSends: ["assert:equals:", "rounded"],
  5223. referencedClasses: []
  5224. }),
  5225. smalltalk.NumberTest);
  5226. smalltalk.addMethod(
  5227. smalltalk.method({
  5228. selector: "testSign",
  5229. category: 'tests',
  5230. fn: function (){
  5231. var self=this;
  5232. return smalltalk.withContext(function($ctx1) {
  5233. var $1,$2,$3;
  5234. $1=(5)._sign();
  5235. $ctx1.sendIdx["sign"]=1;
  5236. self._assert_equals_($1,(1));
  5237. $ctx1.sendIdx["assert:equals:"]=1;
  5238. $2=(0)._sign();
  5239. $ctx1.sendIdx["sign"]=2;
  5240. self._assert_equals_($2,(0));
  5241. $ctx1.sendIdx["assert:equals:"]=2;
  5242. $3=(-1.4)._sign();
  5243. self._assert_equals_($3,(-1));
  5244. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  5245. args: [],
  5246. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  5247. messageSends: ["assert:equals:", "sign"],
  5248. referencedClasses: []
  5249. }),
  5250. smalltalk.NumberTest);
  5251. smalltalk.addMethod(
  5252. smalltalk.method({
  5253. selector: "testSqrt",
  5254. category: 'tests',
  5255. fn: function (){
  5256. var self=this;
  5257. return smalltalk.withContext(function($ctx1) {
  5258. var $1,$2;
  5259. $1=(4)._sqrt();
  5260. $ctx1.sendIdx["sqrt"]=1;
  5261. self._assert_equals_($1,(2));
  5262. $ctx1.sendIdx["assert:equals:"]=1;
  5263. $2=(16)._sqrt();
  5264. self._assert_equals_($2,(4));
  5265. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  5266. args: [],
  5267. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  5268. messageSends: ["assert:equals:", "sqrt"],
  5269. referencedClasses: []
  5270. }),
  5271. smalltalk.NumberTest);
  5272. smalltalk.addMethod(
  5273. smalltalk.method({
  5274. selector: "testSquared",
  5275. category: 'tests',
  5276. fn: function (){
  5277. var self=this;
  5278. return smalltalk.withContext(function($ctx1) {
  5279. self._assert_equals_((4)._squared(),(16));
  5280. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  5281. args: [],
  5282. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  5283. messageSends: ["assert:equals:", "squared"],
  5284. referencedClasses: []
  5285. }),
  5286. smalltalk.NumberTest);
  5287. smalltalk.addMethod(
  5288. smalltalk.method({
  5289. selector: "testTimesRepeat",
  5290. category: 'tests',
  5291. fn: function (){
  5292. var self=this;
  5293. var i;
  5294. return smalltalk.withContext(function($ctx1) {
  5295. i=(0);
  5296. (0)._timesRepeat_((function(){
  5297. return smalltalk.withContext(function($ctx2) {
  5298. i=_st(i).__plus((1));
  5299. $ctx2.sendIdx["+"]=1;
  5300. return i;
  5301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5302. $ctx1.sendIdx["timesRepeat:"]=1;
  5303. self._assert_equals_(i,(0));
  5304. $ctx1.sendIdx["assert:equals:"]=1;
  5305. (5)._timesRepeat_((function(){
  5306. return smalltalk.withContext(function($ctx2) {
  5307. i=_st(i).__plus((1));
  5308. return i;
  5309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5310. self._assert_equals_(i,(5));
  5311. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  5312. args: [],
  5313. 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",
  5314. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  5315. referencedClasses: []
  5316. }),
  5317. smalltalk.NumberTest);
  5318. smalltalk.addMethod(
  5319. smalltalk.method({
  5320. selector: "testTo",
  5321. category: 'tests',
  5322. fn: function (){
  5323. var self=this;
  5324. return smalltalk.withContext(function($ctx1) {
  5325. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  5326. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  5327. args: [],
  5328. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  5329. messageSends: ["assert:equals:", "to:"],
  5330. referencedClasses: []
  5331. }),
  5332. smalltalk.NumberTest);
  5333. smalltalk.addMethod(
  5334. smalltalk.method({
  5335. selector: "testToBy",
  5336. category: 'tests',
  5337. fn: function (){
  5338. var self=this;
  5339. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5340. return smalltalk.withContext(function($ctx1) {
  5341. var $1;
  5342. $1=(0)._to_by_((6),(2));
  5343. $ctx1.sendIdx["to:by:"]=1;
  5344. self._assert_equals_($1,[(0), (2), (4), (6)]);
  5345. self._should_raise_((function(){
  5346. return smalltalk.withContext(function($ctx2) {
  5347. return (1)._to_by_((4),(0));
  5348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5349. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  5350. args: [],
  5351. 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",
  5352. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  5353. referencedClasses: ["Error"]
  5354. }),
  5355. smalltalk.NumberTest);
  5356. smalltalk.addMethod(
  5357. smalltalk.method({
  5358. selector: "testTrigonometry",
  5359. category: 'tests',
  5360. fn: function (){
  5361. var self=this;
  5362. return smalltalk.withContext(function($ctx1) {
  5363. self._assert_equals_((0)._cos(),(1));
  5364. $ctx1.sendIdx["assert:equals:"]=1;
  5365. self._assert_equals_((0)._sin(),(0));
  5366. $ctx1.sendIdx["assert:equals:"]=2;
  5367. self._assert_equals_((0)._tan(),(0));
  5368. $ctx1.sendIdx["assert:equals:"]=3;
  5369. self._assert_equals_((1)._arcCos(),(0));
  5370. $ctx1.sendIdx["assert:equals:"]=4;
  5371. self._assert_equals_((0)._arcSin(),(0));
  5372. $ctx1.sendIdx["assert:equals:"]=5;
  5373. self._assert_equals_((0)._arcTan(),(0));
  5374. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  5375. args: [],
  5376. source: "testTrigonometry\x0a\x09self assert: 0 cos equals: 1.\x0a\x09self assert: 0 sin equals: 0.\x0a\x09self assert: 0 tan equals: 0.\x0a\x09self assert: 1 arcCos equals: 0.\x0a\x09self assert: 0 arcSin equals: 0.\x0a\x09self assert: 0 arcTan equals: 0.",
  5377. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  5378. referencedClasses: []
  5379. }),
  5380. smalltalk.NumberTest);
  5381. smalltalk.addMethod(
  5382. smalltalk.method({
  5383. selector: "testTruncated",
  5384. category: 'tests',
  5385. fn: function (){
  5386. var self=this;
  5387. return smalltalk.withContext(function($ctx1) {
  5388. var $1,$2,$3;
  5389. $1=(3)._truncated();
  5390. $ctx1.sendIdx["truncated"]=1;
  5391. self._assert_equals_($1,(3));
  5392. $ctx1.sendIdx["assert:equals:"]=1;
  5393. $2=(3.212)._truncated();
  5394. $ctx1.sendIdx["truncated"]=2;
  5395. self._assert_equals_($2,(3));
  5396. $ctx1.sendIdx["assert:equals:"]=2;
  5397. $3=(3.51)._truncated();
  5398. self._assert_equals_($3,(3));
  5399. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  5400. args: [],
  5401. 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",
  5402. messageSends: ["assert:equals:", "truncated"],
  5403. referencedClasses: []
  5404. }),
  5405. smalltalk.NumberTest);
  5406. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  5407. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  5408. smalltalk.addMethod(
  5409. smalltalk.method({
  5410. selector: "foo",
  5411. category: 'not yet classified',
  5412. fn: function (){
  5413. var self=this;
  5414. return smalltalk.withContext(function($ctx1) {
  5415. var $1;
  5416. $1=self["@foo"];
  5417. return $1;
  5418. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  5419. args: [],
  5420. source: "foo\x0a\x09^foo",
  5421. messageSends: [],
  5422. referencedClasses: []
  5423. }),
  5424. smalltalk.ObjectMock);
  5425. smalltalk.addMethod(
  5426. smalltalk.method({
  5427. selector: "foo:",
  5428. category: 'not yet classified',
  5429. fn: function (anObject){
  5430. var self=this;
  5431. return smalltalk.withContext(function($ctx1) {
  5432. self["@foo"]=anObject;
  5433. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  5434. args: ["anObject"],
  5435. source: "foo: anObject\x0a\x09foo := anObject",
  5436. messageSends: [],
  5437. referencedClasses: []
  5438. }),
  5439. smalltalk.ObjectMock);
  5440. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5441. smalltalk.addMethod(
  5442. smalltalk.method({
  5443. selector: "notDefined",
  5444. category: 'tests',
  5445. fn: function (){
  5446. var self=this;
  5447. return smalltalk.withContext(function($ctx1) {
  5448. return void 0;;
  5449. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  5450. args: [],
  5451. source: "notDefined\x0a\x09<return void 0;>",
  5452. messageSends: [],
  5453. referencedClasses: []
  5454. }),
  5455. smalltalk.ObjectTest);
  5456. smalltalk.addMethod(
  5457. smalltalk.method({
  5458. selector: "testBasicAccess",
  5459. category: 'tests',
  5460. fn: function (){
  5461. var self=this;
  5462. var o;
  5463. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5464. return smalltalk.withContext(function($ctx1) {
  5465. var $1,$2;
  5466. o=_st($Object())._new();
  5467. _st(o)._basicAt_put_("a",(1));
  5468. $1=_st(o)._basicAt_("a");
  5469. $ctx1.sendIdx["basicAt:"]=1;
  5470. self._assert_equals_($1,(1));
  5471. $ctx1.sendIdx["assert:equals:"]=1;
  5472. $2=_st(o)._basicAt_("b");
  5473. self._assert_equals_($2,nil);
  5474. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  5475. args: [],
  5476. 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",
  5477. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  5478. referencedClasses: ["Object"]
  5479. }),
  5480. smalltalk.ObjectTest);
  5481. smalltalk.addMethod(
  5482. smalltalk.method({
  5483. selector: "testBasicPerform",
  5484. category: 'tests',
  5485. fn: function (){
  5486. var self=this;
  5487. var o;
  5488. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5489. return smalltalk.withContext(function($ctx1) {
  5490. o=_st($Object())._new();
  5491. _st(o)._basicAt_put_("func",(function(){
  5492. return smalltalk.withContext(function($ctx2) {
  5493. return "hello";
  5494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5495. $ctx1.sendIdx["basicAt:put:"]=1;
  5496. _st(o)._basicAt_put_("func2",(function(a){
  5497. return smalltalk.withContext(function($ctx2) {
  5498. return _st(a).__plus((1));
  5499. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  5500. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  5501. $ctx1.sendIdx["assert:equals:"]=1;
  5502. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  5503. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  5504. args: [],
  5505. 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",
  5506. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  5507. referencedClasses: ["Object"]
  5508. }),
  5509. smalltalk.ObjectTest);
  5510. smalltalk.addMethod(
  5511. smalltalk.method({
  5512. selector: "testDNU",
  5513. category: 'tests',
  5514. fn: function (){
  5515. var self=this;
  5516. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5517. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5518. return smalltalk.withContext(function($ctx1) {
  5519. self._should_raise_((function(){
  5520. return smalltalk.withContext(function($ctx2) {
  5521. return _st(_st($Object())._new())._foo();
  5522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5523. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  5524. args: [],
  5525. source: "testDNU\x0a\x09self should: [Object new foo] raise: MessageNotUnderstood",
  5526. messageSends: ["should:raise:", "foo", "new"],
  5527. referencedClasses: ["Object", "MessageNotUnderstood"]
  5528. }),
  5529. smalltalk.ObjectTest);
  5530. smalltalk.addMethod(
  5531. smalltalk.method({
  5532. selector: "testEquality",
  5533. category: 'tests',
  5534. fn: function (){
  5535. var self=this;
  5536. var o;
  5537. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5538. return smalltalk.withContext(function($ctx1) {
  5539. var $2,$3,$1,$4,$6,$5,$8,$9,$7;
  5540. o=_st($Object())._new();
  5541. $ctx1.sendIdx["new"]=1;
  5542. $2=o;
  5543. $3=_st($Object())._new();
  5544. $1=_st($2).__eq($3);
  5545. $ctx1.sendIdx["="]=1;
  5546. self._deny_($1);
  5547. $4=_st(o).__eq(o);
  5548. $ctx1.sendIdx["="]=2;
  5549. self._assert_($4);
  5550. $ctx1.sendIdx["assert:"]=1;
  5551. $6=_st(o)._yourself();
  5552. $ctx1.sendIdx["yourself"]=1;
  5553. $5=_st($6).__eq(o);
  5554. $ctx1.sendIdx["="]=3;
  5555. self._assert_($5);
  5556. $ctx1.sendIdx["assert:"]=2;
  5557. $8=o;
  5558. $9=_st(o)._yourself();
  5559. $7=_st($8).__eq($9);
  5560. self._assert_($7);
  5561. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  5562. args: [],
  5563. 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)",
  5564. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  5565. referencedClasses: ["Object"]
  5566. }),
  5567. smalltalk.ObjectTest);
  5568. smalltalk.addMethod(
  5569. smalltalk.method({
  5570. selector: "testHalt",
  5571. category: 'tests',
  5572. fn: function (){
  5573. var self=this;
  5574. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5575. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5576. return smalltalk.withContext(function($ctx1) {
  5577. self._should_raise_((function(){
  5578. return smalltalk.withContext(function($ctx2) {
  5579. return _st(_st($Object())._new())._halt();
  5580. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5581. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  5582. args: [],
  5583. source: "testHalt\x0a\x09self should: [Object new halt] raise: Error",
  5584. messageSends: ["should:raise:", "halt", "new"],
  5585. referencedClasses: ["Object", "Error"]
  5586. }),
  5587. smalltalk.ObjectTest);
  5588. smalltalk.addMethod(
  5589. smalltalk.method({
  5590. selector: "testIdentity",
  5591. category: 'tests',
  5592. fn: function (){
  5593. var self=this;
  5594. var o;
  5595. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5596. return smalltalk.withContext(function($ctx1) {
  5597. var $2,$3,$1,$4,$6,$5,$8,$9,$7;
  5598. o=_st($Object())._new();
  5599. $ctx1.sendIdx["new"]=1;
  5600. $2=o;
  5601. $3=_st($Object())._new();
  5602. $1=_st($2).__eq_eq($3);
  5603. $ctx1.sendIdx["=="]=1;
  5604. self._deny_($1);
  5605. $4=_st(o).__eq_eq(o);
  5606. $ctx1.sendIdx["=="]=2;
  5607. self._assert_($4);
  5608. $ctx1.sendIdx["assert:"]=1;
  5609. $6=_st(o)._yourself();
  5610. $ctx1.sendIdx["yourself"]=1;
  5611. $5=_st($6).__eq_eq(o);
  5612. $ctx1.sendIdx["=="]=3;
  5613. self._assert_($5);
  5614. $ctx1.sendIdx["assert:"]=2;
  5615. $8=o;
  5616. $9=_st(o)._yourself();
  5617. $7=_st($8).__eq_eq($9);
  5618. self._assert_($7);
  5619. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  5620. args: [],
  5621. 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",
  5622. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  5623. referencedClasses: ["Object"]
  5624. }),
  5625. smalltalk.ObjectTest);
  5626. smalltalk.addMethod(
  5627. smalltalk.method({
  5628. selector: "testIfNil",
  5629. category: 'tests',
  5630. fn: function (){
  5631. var self=this;
  5632. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5633. return smalltalk.withContext(function($ctx1) {
  5634. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  5635. $2=_st($Object())._new();
  5636. $ctx1.sendIdx["new"]=1;
  5637. $1=_st($2)._isNil();
  5638. self._deny_($1);
  5639. $ctx1.sendIdx["deny:"]=1;
  5640. $5=_st($Object())._new();
  5641. $ctx1.sendIdx["new"]=2;
  5642. if(($receiver = $5) == nil || $receiver == null){
  5643. $4=true;
  5644. } else {
  5645. $4=$5;
  5646. };
  5647. $3=_st($4).__eq(true);
  5648. self._deny_($3);
  5649. $7=_st($Object())._new();
  5650. $ctx1.sendIdx["new"]=3;
  5651. if(($receiver = $7) == nil || $receiver == null){
  5652. $6=$7;
  5653. } else {
  5654. $6=true;
  5655. };
  5656. self._assert_equals_($6,true);
  5657. $ctx1.sendIdx["assert:equals:"]=1;
  5658. $9=_st($Object())._new();
  5659. $ctx1.sendIdx["new"]=4;
  5660. if(($receiver = $9) == nil || $receiver == null){
  5661. $8=false;
  5662. } else {
  5663. $8=true;
  5664. };
  5665. self._assert_equals_($8,true);
  5666. $ctx1.sendIdx["assert:equals:"]=2;
  5667. $11=_st($Object())._new();
  5668. if(($receiver = $11) == nil || $receiver == null){
  5669. $10=false;
  5670. } else {
  5671. $10=true;
  5672. };
  5673. self._assert_equals_($10,true);
  5674. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  5675. args: [],
  5676. 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",
  5677. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  5678. referencedClasses: ["Object"]
  5679. }),
  5680. smalltalk.ObjectTest);
  5681. smalltalk.addMethod(
  5682. smalltalk.method({
  5683. selector: "testInstVars",
  5684. category: 'tests',
  5685. fn: function (){
  5686. var self=this;
  5687. var o;
  5688. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5689. return smalltalk.withContext(function($ctx1) {
  5690. var $1,$2,$3;
  5691. o=_st($ObjectMock())._new();
  5692. $1=_st(o)._instVarAt_("foo");
  5693. $ctx1.sendIdx["instVarAt:"]=1;
  5694. self._assert_equals_($1,nil);
  5695. $ctx1.sendIdx["assert:equals:"]=1;
  5696. _st(o)._instVarAt_put_("foo",(1));
  5697. $2=_st(o)._instVarAt_("foo");
  5698. $ctx1.sendIdx["instVarAt:"]=2;
  5699. self._assert_equals_($2,(1));
  5700. $ctx1.sendIdx["assert:equals:"]=2;
  5701. $3=_st(o)._instVarAt_("foo");
  5702. self._assert_equals_($3,(1));
  5703. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  5704. args: [],
  5705. 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",
  5706. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  5707. referencedClasses: ["ObjectMock"]
  5708. }),
  5709. smalltalk.ObjectTest);
  5710. smalltalk.addMethod(
  5711. smalltalk.method({
  5712. selector: "testNilUndefined",
  5713. category: 'tests',
  5714. fn: function (){
  5715. var self=this;
  5716. return smalltalk.withContext(function($ctx1) {
  5717. self._assert_equals_(self._notDefined(),nil);
  5718. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  5719. args: [],
  5720. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  5721. messageSends: ["assert:equals:", "notDefined"],
  5722. referencedClasses: []
  5723. }),
  5724. smalltalk.ObjectTest);
  5725. smalltalk.addMethod(
  5726. smalltalk.method({
  5727. selector: "testYourself",
  5728. category: 'tests',
  5729. fn: function (){
  5730. var self=this;
  5731. var o;
  5732. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5733. return smalltalk.withContext(function($ctx1) {
  5734. o=_st($ObjectMock())._new();
  5735. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  5736. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  5737. args: [],
  5738. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  5739. messageSends: ["new", "assert:", "==", "yourself"],
  5740. referencedClasses: ["ObjectMock"]
  5741. }),
  5742. smalltalk.ObjectTest);
  5743. smalltalk.addMethod(
  5744. smalltalk.method({
  5745. selector: "testidentityHash",
  5746. category: 'tests',
  5747. fn: function (){
  5748. var self=this;
  5749. var o1,o2;
  5750. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5751. return smalltalk.withContext(function($ctx1) {
  5752. var $2,$3,$1,$5,$6,$4;
  5753. o1=_st($Object())._new();
  5754. $ctx1.sendIdx["new"]=1;
  5755. o2=_st($Object())._new();
  5756. $2=_st(o1)._identityHash();
  5757. $ctx1.sendIdx["identityHash"]=1;
  5758. $3=_st(o1)._identityHash();
  5759. $ctx1.sendIdx["identityHash"]=2;
  5760. $1=_st($2).__eq_eq($3);
  5761. $ctx1.sendIdx["=="]=1;
  5762. self._assert_($1);
  5763. $5=_st(o1)._identityHash();
  5764. $ctx1.sendIdx["identityHash"]=3;
  5765. $6=_st(o2)._identityHash();
  5766. $4=_st($5).__eq_eq($6);
  5767. self._deny_($4);
  5768. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  5769. args: [],
  5770. 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",
  5771. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  5772. referencedClasses: ["Object"]
  5773. }),
  5774. smalltalk.ObjectTest);
  5775. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5776. smalltalk.addMethod(
  5777. smalltalk.method({
  5778. selector: "testAccessing",
  5779. category: 'tests',
  5780. fn: function (){
  5781. var self=this;
  5782. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5783. return smalltalk.withContext(function($ctx1) {
  5784. var $2,$1,$4,$3,$7,$6,$5,$10,$9,$8;
  5785. $2=_st($Point())._x_y_((3),(4));
  5786. $ctx1.sendIdx["x:y:"]=1;
  5787. $1=_st($2)._x();
  5788. $ctx1.sendIdx["x"]=1;
  5789. self._assert_equals_($1,(3));
  5790. $ctx1.sendIdx["assert:equals:"]=1;
  5791. $4=_st($Point())._x_y_((3),(4));
  5792. $3=_st($4)._y();
  5793. $ctx1.sendIdx["y"]=1;
  5794. self._assert_equals_($3,(4));
  5795. $ctx1.sendIdx["assert:equals:"]=2;
  5796. $7=_st($Point())._new();
  5797. $ctx1.sendIdx["new"]=1;
  5798. $6=_st($7)._x_((3));
  5799. $5=_st($6)._x();
  5800. self._assert_equals_($5,(3));
  5801. $ctx1.sendIdx["assert:equals:"]=3;
  5802. $10=_st($Point())._new();
  5803. $9=_st($10)._y_((4));
  5804. $8=_st($9)._y();
  5805. self._assert_equals_($8,(4));
  5806. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  5807. args: [],
  5808. 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",
  5809. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  5810. referencedClasses: ["Point"]
  5811. }),
  5812. smalltalk.PointTest);
  5813. smalltalk.addMethod(
  5814. smalltalk.method({
  5815. selector: "testArithmetic",
  5816. category: 'tests',
  5817. fn: function (){
  5818. var self=this;
  5819. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5820. return smalltalk.withContext(function($ctx1) {
  5821. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$15,$13,$16;
  5822. $2=(3).__at((4));
  5823. $ctx1.sendIdx["@"]=1;
  5824. $3=(3).__at((4));
  5825. $ctx1.sendIdx["@"]=2;
  5826. $1=_st($2).__star($3);
  5827. $4=_st($Point())._x_y_((9),(16));
  5828. $ctx1.sendIdx["x:y:"]=1;
  5829. self._assert_equals_($1,$4);
  5830. $ctx1.sendIdx["assert:equals:"]=1;
  5831. $6=(3).__at((4));
  5832. $ctx1.sendIdx["@"]=3;
  5833. $7=(3).__at((4));
  5834. $ctx1.sendIdx["@"]=4;
  5835. $5=_st($6).__plus($7);
  5836. $8=_st($Point())._x_y_((6),(8));
  5837. $ctx1.sendIdx["x:y:"]=2;
  5838. self._assert_equals_($5,$8);
  5839. $ctx1.sendIdx["assert:equals:"]=2;
  5840. $10=(3).__at((4));
  5841. $ctx1.sendIdx["@"]=5;
  5842. $11=(3).__at((4));
  5843. $ctx1.sendIdx["@"]=6;
  5844. $9=_st($10).__minus($11);
  5845. $12=_st($Point())._x_y_((0),(0));
  5846. $ctx1.sendIdx["x:y:"]=3;
  5847. self._assert_equals_($9,$12);
  5848. $ctx1.sendIdx["assert:equals:"]=3;
  5849. $14=(6).__at((8));
  5850. $ctx1.sendIdx["@"]=7;
  5851. $15=(3).__at((4));
  5852. $13=_st($14).__slash($15);
  5853. $16=_st($Point())._x_y_((2),(2));
  5854. self._assert_equals_($13,$16);
  5855. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  5856. args: [],
  5857. 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)",
  5858. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  5859. referencedClasses: ["Point"]
  5860. }),
  5861. smalltalk.PointTest);
  5862. smalltalk.addMethod(
  5863. smalltalk.method({
  5864. selector: "testAt",
  5865. category: 'tests',
  5866. fn: function (){
  5867. var self=this;
  5868. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5869. return smalltalk.withContext(function($ctx1) {
  5870. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  5871. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  5872. args: [],
  5873. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  5874. messageSends: ["assert:equals:", "@", "x:y:"],
  5875. referencedClasses: ["Point"]
  5876. }),
  5877. smalltalk.PointTest);
  5878. smalltalk.addMethod(
  5879. smalltalk.method({
  5880. selector: "testEgality",
  5881. category: 'tests',
  5882. fn: function (){
  5883. var self=this;
  5884. return smalltalk.withContext(function($ctx1) {
  5885. var $2,$3,$1,$5,$6,$4;
  5886. $2=(3).__at((4));
  5887. $ctx1.sendIdx["@"]=1;
  5888. $3=(3).__at((4));
  5889. $ctx1.sendIdx["@"]=2;
  5890. $1=_st($2).__eq($3);
  5891. $ctx1.sendIdx["="]=1;
  5892. self._assert_($1);
  5893. $5=(3).__at((5));
  5894. $ctx1.sendIdx["@"]=3;
  5895. $6=(3).__at((6));
  5896. $4=_st($5).__eq($6);
  5897. self._deny_($4);
  5898. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  5899. args: [],
  5900. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  5901. messageSends: ["assert:", "=", "@", "deny:"],
  5902. referencedClasses: []
  5903. }),
  5904. smalltalk.PointTest);
  5905. smalltalk.addMethod(
  5906. smalltalk.method({
  5907. selector: "testNew",
  5908. category: 'tests',
  5909. fn: function (){
  5910. var self=this;
  5911. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5912. return smalltalk.withContext(function($ctx1) {
  5913. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8,$14,$13,$12,$11;
  5914. $3=_st($Point())._new();
  5915. $ctx1.sendIdx["new"]=1;
  5916. $2=_st($3)._x_((3));
  5917. $ctx1.sendIdx["x:"]=1;
  5918. $1=_st($2)._y();
  5919. $ctx1.sendIdx["y"]=1;
  5920. self._assert_equals_($1,nil);
  5921. $ctx1.sendIdx["assert:equals:"]=1;
  5922. $7=_st($Point())._new();
  5923. $ctx1.sendIdx["new"]=2;
  5924. $6=_st($7)._x_((3));
  5925. $5=_st($6)._x();
  5926. $ctx1.sendIdx["x"]=1;
  5927. $4=_st($5).__eq((0));
  5928. $ctx1.sendIdx["="]=1;
  5929. self._deny_($4);
  5930. $ctx1.sendIdx["deny:"]=1;
  5931. $10=_st($Point())._new();
  5932. $ctx1.sendIdx["new"]=3;
  5933. $9=_st($10)._y_((4));
  5934. $ctx1.sendIdx["y:"]=1;
  5935. $8=_st($9)._x();
  5936. self._assert_equals_($8,nil);
  5937. $14=_st($Point())._new();
  5938. $13=_st($14)._y_((4));
  5939. $12=_st($13)._y();
  5940. $11=_st($12).__eq((0));
  5941. self._deny_($11);
  5942. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  5943. args: [],
  5944. source: "testNew\x0a\x0a\x09self assert: (Point new x: 3) y equals: nil.\x0a\x09self deny: (Point new x: 3) x = 0.\x0a\x09self assert: (Point new y: 4) x equals: nil.\x0a\x09self deny: (Point new y: 4) y = 0",
  5945. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  5946. referencedClasses: ["Point"]
  5947. }),
  5948. smalltalk.PointTest);
  5949. smalltalk.addMethod(
  5950. smalltalk.method({
  5951. selector: "testTranslateBy",
  5952. category: 'tests',
  5953. fn: function (){
  5954. var self=this;
  5955. return smalltalk.withContext(function($ctx1) {
  5956. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$17,$16,$14,$18;
  5957. $2=(3).__at((3));
  5958. $ctx1.sendIdx["@"]=1;
  5959. $3=(0).__at((1));
  5960. $ctx1.sendIdx["@"]=2;
  5961. $1=_st($2)._translateBy_($3);
  5962. $ctx1.sendIdx["translateBy:"]=1;
  5963. $4=(3).__at((4));
  5964. $ctx1.sendIdx["@"]=3;
  5965. self._assert_equals_($1,$4);
  5966. $ctx1.sendIdx["assert:equals:"]=1;
  5967. $6=(3).__at((3));
  5968. $ctx1.sendIdx["@"]=4;
  5969. $8=(1)._negated();
  5970. $ctx1.sendIdx["negated"]=1;
  5971. $7=(0).__at($8);
  5972. $ctx1.sendIdx["@"]=5;
  5973. $5=_st($6)._translateBy_($7);
  5974. $ctx1.sendIdx["translateBy:"]=2;
  5975. $9=(3).__at((2));
  5976. $ctx1.sendIdx["@"]=6;
  5977. self._assert_equals_($5,$9);
  5978. $ctx1.sendIdx["assert:equals:"]=2;
  5979. $11=(3).__at((3));
  5980. $ctx1.sendIdx["@"]=7;
  5981. $12=(2).__at((3));
  5982. $ctx1.sendIdx["@"]=8;
  5983. $10=_st($11)._translateBy_($12);
  5984. $ctx1.sendIdx["translateBy:"]=3;
  5985. $13=(5).__at((6));
  5986. $ctx1.sendIdx["@"]=9;
  5987. self._assert_equals_($10,$13);
  5988. $ctx1.sendIdx["assert:equals:"]=3;
  5989. $15=(3).__at((3));
  5990. $ctx1.sendIdx["@"]=10;
  5991. $17=(3)._negated();
  5992. $16=_st($17).__at((0));
  5993. $ctx1.sendIdx["@"]=11;
  5994. $14=_st($15)._translateBy_($16);
  5995. $18=(0).__at((3));
  5996. self._assert_equals_($14,$18);
  5997. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  5998. args: [],
  5999. 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.",
  6000. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  6001. referencedClasses: []
  6002. }),
  6003. smalltalk.PointTest);
  6004. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6005. smalltalk.addMethod(
  6006. smalltalk.method({
  6007. selector: "testNextIfAbsent",
  6008. category: 'tests',
  6009. fn: function (){
  6010. var self=this;
  6011. var queue;
  6012. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6013. return smalltalk.withContext(function($ctx1) {
  6014. var $2,$1,$4,$3;
  6015. queue=_st($Queue())._new();
  6016. _st(queue)._nextPut_("index1");
  6017. $2=_st(queue)._nextIfAbsent_("empty");
  6018. $ctx1.sendIdx["nextIfAbsent:"]=1;
  6019. $1=_st($2).__eq("index1");
  6020. $ctx1.sendIdx["="]=1;
  6021. self._assert_($1);
  6022. $4=_st(queue)._nextIfAbsent_("empty");
  6023. $3=_st($4).__eq("index1");
  6024. self._deny_($3);
  6025. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  6026. args: [],
  6027. source: "testNextIfAbsent\x0a\x09| queue |\x0a\x09queue := Queue new.\x0a\x09queue nextPut: 'index1'. \x0a\x0a\x09self assert: (queue nextIfAbsent: 'empty') = 'index1'.\x0a\x09self deny: (queue nextIfAbsent: 'empty') = 'index1'",
  6028. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  6029. referencedClasses: ["Queue"]
  6030. }),
  6031. smalltalk.QueueTest);
  6032. smalltalk.addMethod(
  6033. smalltalk.method({
  6034. selector: "testQueueNext",
  6035. category: 'tests',
  6036. fn: function (){
  6037. var self=this;
  6038. var queue;
  6039. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6040. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6041. return smalltalk.withContext(function($ctx1) {
  6042. var $1,$2,$4,$3,$6,$5;
  6043. queue=_st($Queue())._new();
  6044. $1=queue;
  6045. _st($1)._nextPut_("index1");
  6046. $ctx1.sendIdx["nextPut:"]=1;
  6047. $2=_st($1)._nextPut_("index2");
  6048. $4=_st(queue)._next();
  6049. $ctx1.sendIdx["next"]=1;
  6050. $3=_st($4).__eq("index1");
  6051. $ctx1.sendIdx["="]=1;
  6052. self._assert_($3);
  6053. $6=_st(queue)._next();
  6054. $ctx1.sendIdx["next"]=2;
  6055. $5=_st($6).__eq("index");
  6056. self._deny_($5);
  6057. self._should_raise_((function(){
  6058. return smalltalk.withContext(function($ctx2) {
  6059. return _st(queue)._next();
  6060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6061. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  6062. args: [],
  6063. source: "testQueueNext\x0a\x09| queue | \x0a\x09queue := Queue new.\x0a\x09queue \x0a\x09\x09nextPut: 'index1';\x0a\x09\x09nextPut: 'index2'.\x0a\x0a\x09self assert: queue next = 'index1'.\x0a\x09self deny: queue next = 'index'.\x0a\x09self should: [ queue next ] raise: Error",
  6064. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  6065. referencedClasses: ["Queue", "Error"]
  6066. }),
  6067. smalltalk.QueueTest);
  6068. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6069. smalltalk.addMethod(
  6070. smalltalk.method({
  6071. selector: "testAtRandomNumber",
  6072. category: 'tests',
  6073. fn: function (){
  6074. var self=this;
  6075. var val;
  6076. return smalltalk.withContext(function($ctx1) {
  6077. (100)._timesRepeat_((function(){
  6078. return smalltalk.withContext(function($ctx2) {
  6079. val=(10)._atRandom();
  6080. val;
  6081. self._assert_(_st(val).__gt((0)));
  6082. $ctx2.sendIdx["assert:"]=1;
  6083. return self._assert_(_st(val).__lt((11)));
  6084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6085. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  6086. args: [],
  6087. source: "testAtRandomNumber\x0a\x09|val|\x09\x0a\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 10 atRandom.\x09\x0a\x09\x09self assert: (val > 0).\x0a\x09\x09self assert: (val <11)\x0a\x09]",
  6088. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  6089. referencedClasses: []
  6090. }),
  6091. smalltalk.RandomTest);
  6092. smalltalk.addMethod(
  6093. smalltalk.method({
  6094. selector: "testAtRandomSequenceableCollection",
  6095. category: 'tests',
  6096. fn: function (){
  6097. var self=this;
  6098. var val;
  6099. return smalltalk.withContext(function($ctx1) {
  6100. var $3,$4,$2,$5,$1;
  6101. (100)._timesRepeat_((function(){
  6102. return smalltalk.withContext(function($ctx2) {
  6103. val="abc"._atRandom();
  6104. val;
  6105. $3=_st(val).__eq("a");
  6106. $ctx2.sendIdx["="]=1;
  6107. $4=_st(val).__eq("b");
  6108. $ctx2.sendIdx["="]=2;
  6109. $2=_st($3).__or($4);
  6110. $5=_st(val).__eq("c");
  6111. $1=_st($2).__or($5);
  6112. $ctx2.sendIdx["|"]=1;
  6113. return self._assert_($1);
  6114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6115. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  6116. args: [],
  6117. source: "testAtRandomSequenceableCollection\x0a\x09|val|\x0a\x09\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 'abc' atRandom.\x0a\x09\x09self assert: ((val = 'a') | (val = 'b') | (val = 'c' )).\x0a\x09].",
  6118. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  6119. referencedClasses: []
  6120. }),
  6121. smalltalk.RandomTest);
  6122. smalltalk.addMethod(
  6123. smalltalk.method({
  6124. selector: "textNext",
  6125. category: 'tests',
  6126. fn: function (){
  6127. var self=this;
  6128. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  6129. return smalltalk.withContext(function($ctx1) {
  6130. var $1;
  6131. (10000)._timesRepeat_((function(){
  6132. var current,next;
  6133. return smalltalk.withContext(function($ctx2) {
  6134. next=_st(_st($Random())._new())._next();
  6135. next;
  6136. self._assert_(_st(next).__gt_eq((0)));
  6137. $ctx2.sendIdx["assert:"]=1;
  6138. self._assert_(_st(next).__lt((1)));
  6139. $1=_st(current).__eq(next);
  6140. $ctx2.sendIdx["="]=1;
  6141. self._deny_($1);
  6142. return _st(next).__eq(current);
  6143. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  6144. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  6145. args: [],
  6146. 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]",
  6147. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  6148. referencedClasses: ["Random"]
  6149. }),
  6150. smalltalk.RandomTest);
  6151. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6152. smalltalk.addMethod(
  6153. smalltalk.method({
  6154. selector: "testAddRemove",
  6155. category: 'tests',
  6156. fn: function (){
  6157. var self=this;
  6158. var set;
  6159. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6160. return smalltalk.withContext(function($ctx1) {
  6161. var $1,$2,$3;
  6162. set=_st($Set())._new();
  6163. self._assert_(_st(set)._isEmpty());
  6164. $ctx1.sendIdx["assert:"]=1;
  6165. _st(set)._add_((3));
  6166. $ctx1.sendIdx["add:"]=1;
  6167. $1=_st(set)._includes_((3));
  6168. $ctx1.sendIdx["includes:"]=1;
  6169. self._assert_($1);
  6170. $ctx1.sendIdx["assert:"]=2;
  6171. _st(set)._add_((5));
  6172. $2=_st(set)._includes_((5));
  6173. $ctx1.sendIdx["includes:"]=2;
  6174. self._assert_($2);
  6175. _st(set)._remove_((3));
  6176. $3=_st(set)._includes_((3));
  6177. self._deny_($3);
  6178. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  6179. args: [],
  6180. 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)",
  6181. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  6182. referencedClasses: ["Set"]
  6183. }),
  6184. smalltalk.SetTest);
  6185. smalltalk.addMethod(
  6186. smalltalk.method({
  6187. selector: "testAt",
  6188. category: 'tests',
  6189. fn: function (){
  6190. var self=this;
  6191. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6192. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6193. return smalltalk.withContext(function($ctx1) {
  6194. self._should_raise_((function(){
  6195. return smalltalk.withContext(function($ctx2) {
  6196. return _st(_st($Set())._new())._at_put_((1),(2));
  6197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6198. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  6199. args: [],
  6200. source: "testAt\x0a\x09self should: [Set new at: 1 put: 2] raise: Error",
  6201. messageSends: ["should:raise:", "at:put:", "new"],
  6202. referencedClasses: ["Set", "Error"]
  6203. }),
  6204. smalltalk.SetTest);
  6205. smalltalk.addMethod(
  6206. smalltalk.method({
  6207. selector: "testCollect",
  6208. category: 'tests',
  6209. fn: function (){
  6210. var self=this;
  6211. return smalltalk.withContext(function($ctx1) {
  6212. var $2,$1,$3;
  6213. $2=[(5), (6), (8)]._asSet();
  6214. $ctx1.sendIdx["asSet"]=1;
  6215. $1=_st($2)._collect_((function(x){
  6216. return smalltalk.withContext(function($ctx2) {
  6217. return _st(x).__backslash_backslash((3));
  6218. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  6219. $3=[(0), (2)]._asSet();
  6220. self._assert_equals_($1,$3);
  6221. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  6222. args: [],
  6223. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  6224. messageSends: ["assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  6225. referencedClasses: []
  6226. }),
  6227. smalltalk.SetTest);
  6228. smalltalk.addMethod(
  6229. smalltalk.method({
  6230. selector: "testComparing",
  6231. category: 'tests',
  6232. fn: function (){
  6233. var self=this;
  6234. return smalltalk.withContext(function($ctx1) {
  6235. var $1,$2,$3,$4,$6,$7,$5,$9,$10,$8;
  6236. $1=[(0), (2)]._asSet();
  6237. $ctx1.sendIdx["asSet"]=1;
  6238. $2=[(0), (2)]._asSet();
  6239. $ctx1.sendIdx["asSet"]=2;
  6240. self._assert_equals_($1,$2);
  6241. $ctx1.sendIdx["assert:equals:"]=1;
  6242. $3=[(2), (0)]._asSet();
  6243. $ctx1.sendIdx["asSet"]=3;
  6244. $4=[(0), (2)]._asSet();
  6245. $ctx1.sendIdx["asSet"]=4;
  6246. self._assert_equals_($3,$4);
  6247. $6=[(0), (2), (3)]._asSet();
  6248. $ctx1.sendIdx["asSet"]=5;
  6249. $7=[(0), (2)]._asSet();
  6250. $ctx1.sendIdx["asSet"]=6;
  6251. $5=_st($6).__eq($7);
  6252. $ctx1.sendIdx["="]=1;
  6253. self._deny_($5);
  6254. $ctx1.sendIdx["deny:"]=1;
  6255. $9=[(1), (2)]._asSet();
  6256. $ctx1.sendIdx["asSet"]=7;
  6257. $10=[(0), (2)]._asSet();
  6258. $8=_st($9).__eq($10);
  6259. self._deny_($8);
  6260. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  6261. args: [],
  6262. 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",
  6263. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  6264. referencedClasses: []
  6265. }),
  6266. smalltalk.SetTest);
  6267. smalltalk.addMethod(
  6268. smalltalk.method({
  6269. selector: "testPrintString",
  6270. category: 'tests',
  6271. fn: function (){
  6272. var self=this;
  6273. var set;
  6274. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6275. return smalltalk.withContext(function($ctx1) {
  6276. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  6277. set=_st($Set())._new();
  6278. $1=_st(set)._printString();
  6279. $ctx1.sendIdx["printString"]=1;
  6280. self._assert_equals_($1,"a Set ()");
  6281. $ctx1.sendIdx["assert:equals:"]=1;
  6282. $2=set;
  6283. _st($2)._add_((1));
  6284. $ctx1.sendIdx["add:"]=1;
  6285. $3=_st($2)._add_((3));
  6286. $ctx1.sendIdx["add:"]=2;
  6287. $4=_st(set)._printString();
  6288. $ctx1.sendIdx["printString"]=2;
  6289. self._assert_equals_($4,"a Set (1 3)");
  6290. $ctx1.sendIdx["assert:equals:"]=2;
  6291. _st(set)._add_("foo");
  6292. $ctx1.sendIdx["add:"]=3;
  6293. $5=_st(set)._printString();
  6294. $ctx1.sendIdx["printString"]=3;
  6295. self._assert_equals_($5,"a Set (1 3 'foo')");
  6296. $ctx1.sendIdx["assert:equals:"]=3;
  6297. $6=set;
  6298. _st($6)._remove_((1));
  6299. $ctx1.sendIdx["remove:"]=1;
  6300. $7=_st($6)._remove_((3));
  6301. $8=_st(set)._printString();
  6302. $ctx1.sendIdx["printString"]=4;
  6303. self._assert_equals_($8,"a Set ('foo')");
  6304. $ctx1.sendIdx["assert:equals:"]=4;
  6305. _st(set)._add_((3));
  6306. $ctx1.sendIdx["add:"]=4;
  6307. $9=_st(set)._printString();
  6308. $ctx1.sendIdx["printString"]=5;
  6309. self._assert_equals_($9,"a Set ('foo' 3)");
  6310. $ctx1.sendIdx["assert:equals:"]=5;
  6311. _st(set)._add_((3));
  6312. $10=_st(set)._printString();
  6313. self._assert_equals_($10,"a Set ('foo' 3)");
  6314. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  6315. args: [],
  6316. 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)'",
  6317. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  6318. referencedClasses: ["Set"]
  6319. }),
  6320. smalltalk.SetTest);
  6321. smalltalk.addMethod(
  6322. smalltalk.method({
  6323. selector: "testSize",
  6324. category: 'tests',
  6325. fn: function (){
  6326. var self=this;
  6327. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6328. return smalltalk.withContext(function($ctx1) {
  6329. var $1,$3,$2,$5,$4;
  6330. $1=_st(_st($Set())._new())._size();
  6331. $ctx1.sendIdx["size"]=1;
  6332. self._assert_equals_($1,(0));
  6333. $ctx1.sendIdx["assert:equals:"]=1;
  6334. $3=_st($Set())._withAll_([(1), (2), (3), (4)]);
  6335. $ctx1.sendIdx["withAll:"]=1;
  6336. $2=_st($3)._size();
  6337. $ctx1.sendIdx["size"]=2;
  6338. self._assert_equals_($2,(4));
  6339. $ctx1.sendIdx["assert:equals:"]=2;
  6340. $5=_st($Set())._withAll_([(1), (1), (1), (1)]);
  6341. $4=_st($5)._size();
  6342. self._assert_equals_($4,(1));
  6343. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  6344. args: [],
  6345. 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",
  6346. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  6347. referencedClasses: ["Set"]
  6348. }),
  6349. smalltalk.SetTest);
  6350. smalltalk.addMethod(
  6351. smalltalk.method({
  6352. selector: "testUnboxedObjects",
  6353. category: 'tests',
  6354. fn: function (){
  6355. var self=this;
  6356. return smalltalk.withContext(function($ctx1) {
  6357. var $4,$5,$3,$2,$1;
  6358. $4="foo"._yourself();
  6359. $ctx1.sendIdx["yourself"]=1;
  6360. $5="foo"._yourself();
  6361. $3=[$4,$5];
  6362. $2=_st($3)._asSet();
  6363. $1=_st($2)._asArray();
  6364. self._assert_equals_($1,["foo"]);
  6365. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  6366. args: [],
  6367. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  6368. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  6369. referencedClasses: []
  6370. }),
  6371. smalltalk.SetTest);
  6372. smalltalk.addMethod(
  6373. smalltalk.method({
  6374. selector: "testUnicity",
  6375. category: 'tests',
  6376. fn: function (){
  6377. var self=this;
  6378. var set;
  6379. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6380. return smalltalk.withContext(function($ctx1) {
  6381. var $1,$2;
  6382. set=_st($Set())._new();
  6383. _st(set)._add_((21));
  6384. $ctx1.sendIdx["add:"]=1;
  6385. _st(set)._add_("hello");
  6386. $ctx1.sendIdx["add:"]=2;
  6387. _st(set)._add_((21));
  6388. $ctx1.sendIdx["add:"]=3;
  6389. $1=_st(set)._size();
  6390. $ctx1.sendIdx["size"]=1;
  6391. self._assert_equals_($1,(2));
  6392. $ctx1.sendIdx["assert:equals:"]=1;
  6393. _st(set)._add_("hello");
  6394. $2=_st(set)._size();
  6395. self._assert_equals_($2,(2));
  6396. $ctx1.sendIdx["assert:equals:"]=2;
  6397. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  6398. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  6399. args: [],
  6400. 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')",
  6401. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  6402. referencedClasses: ["Set"]
  6403. }),
  6404. smalltalk.SetTest);
  6405. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6406. smalltalk.addMethod(
  6407. smalltalk.method({
  6408. selector: "collectionClass",
  6409. category: 'accessing',
  6410. fn: function (){
  6411. var self=this;
  6412. return smalltalk.withContext(function($ctx1) {
  6413. var $1;
  6414. $1=_st(self._class())._collectionClass();
  6415. return $1;
  6416. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  6417. args: [],
  6418. source: "collectionClass\x0a\x09^ self class collectionClass",
  6419. messageSends: ["collectionClass", "class"],
  6420. referencedClasses: []
  6421. }),
  6422. smalltalk.StreamTest);
  6423. smalltalk.addMethod(
  6424. smalltalk.method({
  6425. selector: "newCollection",
  6426. category: 'accessing',
  6427. fn: function (){
  6428. var self=this;
  6429. return smalltalk.withContext(function($ctx1) {
  6430. var $1;
  6431. $1=_st(self._collectionClass())._new();
  6432. return $1;
  6433. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  6434. args: [],
  6435. source: "newCollection\x0a\x09^ self collectionClass new",
  6436. messageSends: ["new", "collectionClass"],
  6437. referencedClasses: []
  6438. }),
  6439. smalltalk.StreamTest);
  6440. smalltalk.addMethod(
  6441. smalltalk.method({
  6442. selector: "newStream",
  6443. category: 'accessing',
  6444. fn: function (){
  6445. var self=this;
  6446. return smalltalk.withContext(function($ctx1) {
  6447. var $1;
  6448. $1=_st(_st(self._collectionClass())._new())._stream();
  6449. return $1;
  6450. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  6451. args: [],
  6452. source: "newStream\x0a\x09^ self collectionClass new stream",
  6453. messageSends: ["stream", "new", "collectionClass"],
  6454. referencedClasses: []
  6455. }),
  6456. smalltalk.StreamTest);
  6457. smalltalk.addMethod(
  6458. smalltalk.method({
  6459. selector: "testAtStartAtEnd",
  6460. category: 'tests',
  6461. fn: function (){
  6462. var self=this;
  6463. var stream;
  6464. return smalltalk.withContext(function($ctx1) {
  6465. var $1,$2,$3,$4,$5,$6;
  6466. stream=self._newStream();
  6467. $1=_st(stream)._atStart();
  6468. $ctx1.sendIdx["atStart"]=1;
  6469. self._assert_($1);
  6470. $ctx1.sendIdx["assert:"]=1;
  6471. $2=_st(stream)._atEnd();
  6472. $ctx1.sendIdx["atEnd"]=1;
  6473. self._assert_($2);
  6474. $ctx1.sendIdx["assert:"]=2;
  6475. _st(stream)._nextPutAll_(self._newCollection());
  6476. $3=_st(stream)._atEnd();
  6477. $ctx1.sendIdx["atEnd"]=2;
  6478. self._assert_($3);
  6479. $4=_st(stream)._atStart();
  6480. $ctx1.sendIdx["atStart"]=2;
  6481. self._deny_($4);
  6482. $ctx1.sendIdx["deny:"]=1;
  6483. _st(stream)._position_((1));
  6484. $5=_st(stream)._atEnd();
  6485. self._deny_($5);
  6486. $ctx1.sendIdx["deny:"]=2;
  6487. $6=_st(stream)._atStart();
  6488. self._deny_($6);
  6489. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  6490. args: [],
  6491. 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",
  6492. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  6493. referencedClasses: []
  6494. }),
  6495. smalltalk.StreamTest);
  6496. smalltalk.addMethod(
  6497. smalltalk.method({
  6498. selector: "testContents",
  6499. category: 'tests',
  6500. fn: function (){
  6501. var self=this;
  6502. var stream;
  6503. return smalltalk.withContext(function($ctx1) {
  6504. var $1,$2,$3,$4;
  6505. stream=self._newStream();
  6506. $1=stream;
  6507. $2=self._newCollection();
  6508. $ctx1.sendIdx["newCollection"]=1;
  6509. _st($1)._nextPutAll_($2);
  6510. $3=_st(stream)._contents();
  6511. $4=self._newCollection();
  6512. self._assert_equals_($3,$4);
  6513. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  6514. args: [],
  6515. 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",
  6516. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  6517. referencedClasses: []
  6518. }),
  6519. smalltalk.StreamTest);
  6520. smalltalk.addMethod(
  6521. smalltalk.method({
  6522. selector: "testIsEmpty",
  6523. category: 'tests',
  6524. fn: function (){
  6525. var self=this;
  6526. var stream;
  6527. return smalltalk.withContext(function($ctx1) {
  6528. var $1,$2;
  6529. stream=self._newStream();
  6530. $1=_st(stream)._isEmpty();
  6531. $ctx1.sendIdx["isEmpty"]=1;
  6532. self._assert_($1);
  6533. _st(stream)._nextPutAll_(self._newCollection());
  6534. $2=_st(stream)._isEmpty();
  6535. self._deny_($2);
  6536. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  6537. args: [],
  6538. 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",
  6539. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  6540. referencedClasses: []
  6541. }),
  6542. smalltalk.StreamTest);
  6543. smalltalk.addMethod(
  6544. smalltalk.method({
  6545. selector: "testPosition",
  6546. category: 'tests',
  6547. fn: function (){
  6548. var self=this;
  6549. var collection,stream;
  6550. return smalltalk.withContext(function($ctx1) {
  6551. var $1,$2,$3,$4;
  6552. collection=self._newCollection();
  6553. stream=self._newStream();
  6554. _st(stream)._nextPutAll_(collection);
  6555. $1=_st(stream)._position();
  6556. $ctx1.sendIdx["position"]=1;
  6557. self._assert_equals_($1,_st(collection)._size());
  6558. $ctx1.sendIdx["assert:equals:"]=1;
  6559. _st(stream)._position_((0));
  6560. $2=_st(stream)._position();
  6561. $ctx1.sendIdx["position"]=2;
  6562. self._assert_equals_($2,(0));
  6563. $ctx1.sendIdx["assert:equals:"]=2;
  6564. _st(stream)._next();
  6565. $ctx1.sendIdx["next"]=1;
  6566. $3=_st(stream)._position();
  6567. $ctx1.sendIdx["position"]=3;
  6568. self._assert_equals_($3,(1));
  6569. $ctx1.sendIdx["assert:equals:"]=3;
  6570. _st(stream)._next();
  6571. $4=_st(stream)._position();
  6572. self._assert_equals_($4,(2));
  6573. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  6574. args: [],
  6575. 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",
  6576. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  6577. referencedClasses: []
  6578. }),
  6579. smalltalk.StreamTest);
  6580. smalltalk.addMethod(
  6581. smalltalk.method({
  6582. selector: "testReading",
  6583. category: 'tests',
  6584. fn: function (){
  6585. var self=this;
  6586. var stream,collection;
  6587. return smalltalk.withContext(function($ctx1) {
  6588. var $1,$2,$3,$5,$4;
  6589. collection=self._newCollection();
  6590. stream=self._newStream();
  6591. $1=stream;
  6592. _st($1)._nextPutAll_(collection);
  6593. $2=_st($1)._position_((0));
  6594. _st(collection)._do_((function(each){
  6595. return smalltalk.withContext(function($ctx2) {
  6596. $3=_st(stream)._next();
  6597. $ctx2.sendIdx["next"]=1;
  6598. return self._assert_equals_($3,each);
  6599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6600. $5=_st(stream)._next();
  6601. $4=_st($5)._isNil();
  6602. self._assert_($4);
  6603. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6604. args: [],
  6605. 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",
  6606. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  6607. referencedClasses: []
  6608. }),
  6609. smalltalk.StreamTest);
  6610. smalltalk.addMethod(
  6611. smalltalk.method({
  6612. selector: "testStreamContents",
  6613. category: 'tests',
  6614. fn: function (){
  6615. var self=this;
  6616. return smalltalk.withContext(function($ctx1) {
  6617. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  6618. args: [],
  6619. source: "testStreamContents",
  6620. messageSends: [],
  6621. referencedClasses: []
  6622. }),
  6623. smalltalk.StreamTest);
  6624. smalltalk.addMethod(
  6625. smalltalk.method({
  6626. selector: "testWrite",
  6627. category: 'tests',
  6628. fn: function (){
  6629. var self=this;
  6630. var stream,collection;
  6631. return smalltalk.withContext(function($ctx1) {
  6632. collection=self._newCollection();
  6633. stream=self._newStream();
  6634. _st(collection)._do_((function(each){
  6635. return smalltalk.withContext(function($ctx2) {
  6636. return _st(stream).__lt_lt(each);
  6637. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6638. self._assert_equals_(_st(stream)._contents(),collection);
  6639. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6640. args: [],
  6641. 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",
  6642. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  6643. referencedClasses: []
  6644. }),
  6645. smalltalk.StreamTest);
  6646. smalltalk.addMethod(
  6647. smalltalk.method({
  6648. selector: "testWriting",
  6649. category: 'tests',
  6650. fn: function (){
  6651. var self=this;
  6652. var stream,collection;
  6653. return smalltalk.withContext(function($ctx1) {
  6654. var $1,$2;
  6655. collection=self._newCollection();
  6656. stream=self._newStream();
  6657. $ctx1.sendIdx["newStream"]=1;
  6658. _st(collection)._do_((function(each){
  6659. return smalltalk.withContext(function($ctx2) {
  6660. return _st(stream)._nextPut_(each);
  6661. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6662. $1=_st(stream)._contents();
  6663. $ctx1.sendIdx["contents"]=1;
  6664. self._assert_equals_($1,collection);
  6665. $ctx1.sendIdx["assert:equals:"]=1;
  6666. stream=self._newStream();
  6667. _st(stream)._nextPutAll_(collection);
  6668. $2=_st(stream)._contents();
  6669. self._assert_equals_($2,collection);
  6670. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6671. args: [],
  6672. 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",
  6673. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  6674. referencedClasses: []
  6675. }),
  6676. smalltalk.StreamTest);
  6677. smalltalk.addMethod(
  6678. smalltalk.method({
  6679. selector: "collectionClass",
  6680. category: 'accessing',
  6681. fn: function (){
  6682. var self=this;
  6683. return smalltalk.withContext(function($ctx1) {
  6684. return nil;
  6685. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  6686. args: [],
  6687. source: "collectionClass\x0a\x09^ nil",
  6688. messageSends: [],
  6689. referencedClasses: []
  6690. }),
  6691. smalltalk.StreamTest.klass);
  6692. smalltalk.addMethod(
  6693. smalltalk.method({
  6694. selector: "isAbstract",
  6695. category: 'testing',
  6696. fn: function (){
  6697. var self=this;
  6698. return smalltalk.withContext(function($ctx1) {
  6699. var $1;
  6700. $1=_st(self._collectionClass())._isNil();
  6701. return $1;
  6702. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  6703. args: [],
  6704. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  6705. messageSends: ["isNil", "collectionClass"],
  6706. referencedClasses: []
  6707. }),
  6708. smalltalk.StreamTest.klass);
  6709. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6710. smalltalk.addMethod(
  6711. smalltalk.method({
  6712. selector: "newCollection",
  6713. category: 'accessing',
  6714. fn: function (){
  6715. var self=this;
  6716. return smalltalk.withContext(function($ctx1) {
  6717. var $1;
  6718. $1=[true,(1),(3).__at((4)),"foo"];
  6719. return $1;
  6720. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  6721. args: [],
  6722. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  6723. messageSends: ["@"],
  6724. referencedClasses: []
  6725. }),
  6726. smalltalk.ArrayStreamTest);
  6727. smalltalk.addMethod(
  6728. smalltalk.method({
  6729. selector: "collectionClass",
  6730. category: 'accessing',
  6731. fn: function (){
  6732. var self=this;
  6733. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  6734. return smalltalk.withContext(function($ctx1) {
  6735. return $Array();
  6736. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  6737. args: [],
  6738. source: "collectionClass\x0a\x09^ Array",
  6739. messageSends: [],
  6740. referencedClasses: ["Array"]
  6741. }),
  6742. smalltalk.ArrayStreamTest.klass);
  6743. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6744. smalltalk.addMethod(
  6745. smalltalk.method({
  6746. selector: "newCollection",
  6747. category: 'accessing',
  6748. fn: function (){
  6749. var self=this;
  6750. return smalltalk.withContext(function($ctx1) {
  6751. return "hello world";
  6752. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  6753. args: [],
  6754. source: "newCollection\x0a\x09^ 'hello world'",
  6755. messageSends: [],
  6756. referencedClasses: []
  6757. }),
  6758. smalltalk.StringStreamTest);
  6759. smalltalk.addMethod(
  6760. smalltalk.method({
  6761. selector: "collectionClass",
  6762. category: 'accessing',
  6763. fn: function (){
  6764. var self=this;
  6765. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  6766. return smalltalk.withContext(function($ctx1) {
  6767. return $String();
  6768. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  6769. args: [],
  6770. source: "collectionClass\x0a\x09^ String",
  6771. messageSends: [],
  6772. referencedClasses: ["String"]
  6773. }),
  6774. smalltalk.StringStreamTest.klass);
  6775. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6776. smalltalk.addMethod(
  6777. smalltalk.method({
  6778. selector: "testCopying",
  6779. category: 'tests',
  6780. fn: function (){
  6781. var self=this;
  6782. return smalltalk.withContext(function($ctx1) {
  6783. self._assert_equals_(nil._copy(),nil);
  6784. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  6785. args: [],
  6786. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  6787. messageSends: ["assert:equals:", "copy"],
  6788. referencedClasses: []
  6789. }),
  6790. smalltalk.UndefinedTest);
  6791. smalltalk.addMethod(
  6792. smalltalk.method({
  6793. selector: "testDeepCopy",
  6794. category: 'tests',
  6795. fn: function (){
  6796. var self=this;
  6797. return smalltalk.withContext(function($ctx1) {
  6798. self._assert_(_st(nil._deepCopy()).__eq(nil));
  6799. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  6800. args: [],
  6801. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  6802. messageSends: ["assert:", "=", "deepCopy"],
  6803. referencedClasses: []
  6804. }),
  6805. smalltalk.UndefinedTest);
  6806. smalltalk.addMethod(
  6807. smalltalk.method({
  6808. selector: "testIfNil",
  6809. category: 'tests',
  6810. fn: function (){
  6811. var self=this;
  6812. return smalltalk.withContext(function($ctx1) {
  6813. var $1,$3,$2,$4,$6,$5;
  6814. if(($receiver = nil) == nil || $receiver == null){
  6815. $1=true;
  6816. } else {
  6817. $1=nil;
  6818. };
  6819. self._assert_equals_($1,true);
  6820. $ctx1.sendIdx["assert:equals:"]=1;
  6821. if(($receiver = nil) == nil || $receiver == null){
  6822. $3=nil;
  6823. } else {
  6824. $3=true;
  6825. };
  6826. $2=_st($3).__eq(true);
  6827. $ctx1.sendIdx["="]=1;
  6828. self._deny_($2);
  6829. $ctx1.sendIdx["deny:"]=1;
  6830. if(($receiver = nil) == nil || $receiver == null){
  6831. $4=true;
  6832. } else {
  6833. $4=false;
  6834. };
  6835. self._assert_equals_($4,true);
  6836. if(($receiver = nil) == nil || $receiver == null){
  6837. $6=false;
  6838. } else {
  6839. $6=true;
  6840. };
  6841. $5=_st($6).__eq(true);
  6842. self._deny_($5);
  6843. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  6844. args: [],
  6845. 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",
  6846. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  6847. referencedClasses: []
  6848. }),
  6849. smalltalk.UndefinedTest);
  6850. smalltalk.addMethod(
  6851. smalltalk.method({
  6852. selector: "testIsNil",
  6853. category: 'tests',
  6854. fn: function (){
  6855. var self=this;
  6856. return smalltalk.withContext(function($ctx1) {
  6857. self._assert_(nil._isNil());
  6858. self._deny_(nil._notNil());
  6859. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  6860. args: [],
  6861. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  6862. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  6863. referencedClasses: []
  6864. }),
  6865. smalltalk.UndefinedTest);
  6866. });