Kernel-Tests.js 268 KB

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