1
0

Kernel-Tests.js 272 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200
  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: "testIfEmptyFamily",
  1445. category: 'tests',
  1446. fn: function (){
  1447. var self=this;
  1448. return smalltalk.withContext(function($ctx1) {
  1449. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1450. $3=self._collectionClass();
  1451. $ctx1.sendIdx["collectionClass"]=1;
  1452. $2=_st($3)._new();
  1453. $ctx1.sendIdx["new"]=1;
  1454. $1=_st($2)._ifEmpty_((function(){
  1455. return smalltalk.withContext(function($ctx2) {
  1456. return (42);
  1457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1458. $ctx1.sendIdx["ifEmpty:"]=1;
  1459. self._assert_equals_($1,(42));
  1460. $ctx1.sendIdx["assert:equals:"]=1;
  1461. $5=self._collection();
  1462. $ctx1.sendIdx["collection"]=1;
  1463. $4=_st($5)._ifEmpty_((function(){
  1464. return smalltalk.withContext(function($ctx2) {
  1465. return (42);
  1466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1467. $6=self._collection();
  1468. $ctx1.sendIdx["collection"]=2;
  1469. self._assert_equals_($4,$6);
  1470. $ctx1.sendIdx["assert:equals:"]=2;
  1471. $9=self._collectionClass();
  1472. $ctx1.sendIdx["collectionClass"]=2;
  1473. $8=_st($9)._new();
  1474. $ctx1.sendIdx["new"]=2;
  1475. $7=_st($8)._ifNotEmpty_((function(){
  1476. return smalltalk.withContext(function($ctx2) {
  1477. return (42);
  1478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1479. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1480. $11=self._collectionClass();
  1481. $ctx1.sendIdx["collectionClass"]=3;
  1482. $10=_st($11)._new();
  1483. $ctx1.sendIdx["new"]=3;
  1484. self._assert_equals_($7,$10);
  1485. $ctx1.sendIdx["assert:equals:"]=3;
  1486. $13=self._collection();
  1487. $ctx1.sendIdx["collection"]=3;
  1488. $12=_st($13)._ifNotEmpty_((function(){
  1489. return smalltalk.withContext(function($ctx2) {
  1490. return (42);
  1491. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1492. self._assert_equals_($12,(42));
  1493. $ctx1.sendIdx["assert:equals:"]=4;
  1494. $16=self._collectionClass();
  1495. $ctx1.sendIdx["collectionClass"]=4;
  1496. $15=_st($16)._new();
  1497. $ctx1.sendIdx["new"]=4;
  1498. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1499. return smalltalk.withContext(function($ctx2) {
  1500. return (42);
  1501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1502. return smalltalk.withContext(function($ctx2) {
  1503. return (999);
  1504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1505. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1506. self._assert_equals_($14,(42));
  1507. $ctx1.sendIdx["assert:equals:"]=5;
  1508. $18=self._collection();
  1509. $ctx1.sendIdx["collection"]=4;
  1510. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1511. return smalltalk.withContext(function($ctx2) {
  1512. return (42);
  1513. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1514. return smalltalk.withContext(function($ctx2) {
  1515. return (999);
  1516. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1517. self._assert_equals_($17,(999));
  1518. $ctx1.sendIdx["assert:equals:"]=6;
  1519. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1520. return smalltalk.withContext(function($ctx2) {
  1521. return (42);
  1522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1523. return smalltalk.withContext(function($ctx2) {
  1524. return (999);
  1525. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1526. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1527. self._assert_equals_($19,(999));
  1528. $ctx1.sendIdx["assert:equals:"]=7;
  1529. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1530. return smalltalk.withContext(function($ctx2) {
  1531. return (42);
  1532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1533. return smalltalk.withContext(function($ctx2) {
  1534. return (999);
  1535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1536. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1537. args: [],
  1538. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42",
  1539. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1540. referencedClasses: []
  1541. }),
  1542. smalltalk.CollectionTest);
  1543. smalltalk.addMethod(
  1544. smalltalk.method({
  1545. selector: "testIsEmpty",
  1546. category: 'tests',
  1547. fn: function (){
  1548. var self=this;
  1549. return smalltalk.withContext(function($ctx1) {
  1550. var $1;
  1551. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1552. $ctx1.sendIdx["isEmpty"]=1;
  1553. self._assert_($1);
  1554. self._deny_(_st(self._collection())._isEmpty());
  1555. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1556. args: [],
  1557. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1558. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1559. referencedClasses: []
  1560. }),
  1561. smalltalk.CollectionTest);
  1562. smalltalk.addMethod(
  1563. smalltalk.method({
  1564. selector: "testRemoveAll",
  1565. category: 'tests',
  1566. fn: function (){
  1567. var self=this;
  1568. return smalltalk.withContext(function($ctx1) {
  1569. var $1,$2;
  1570. $1=self._collection();
  1571. _st($1)._removeAll();
  1572. $2=_st($1)._yourself();
  1573. self._assert_equals_($2,_st(self._collectionClass())._new());
  1574. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  1575. args: [],
  1576. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  1577. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  1578. referencedClasses: []
  1579. }),
  1580. smalltalk.CollectionTest);
  1581. smalltalk.addMethod(
  1582. smalltalk.method({
  1583. selector: "testSelect",
  1584. category: 'tests',
  1585. fn: function (){
  1586. var self=this;
  1587. var newCollection;
  1588. return smalltalk.withContext(function($ctx1) {
  1589. newCollection=[(2), (-4)];
  1590. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  1591. return smalltalk.withContext(function($ctx2) {
  1592. return _st(each)._even();
  1593. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1594. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1595. args: [],
  1596. 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",
  1597. messageSends: ["assertSameContents:as:", "select:", "collection", "even"],
  1598. referencedClasses: []
  1599. }),
  1600. smalltalk.CollectionTest);
  1601. smalltalk.addMethod(
  1602. smalltalk.method({
  1603. selector: "testSize",
  1604. category: 'tests',
  1605. fn: function (){
  1606. var self=this;
  1607. return smalltalk.withContext(function($ctx1) {
  1608. var $1;
  1609. $1=_st(_st(self._collectionClass())._new())._size();
  1610. $ctx1.sendIdx["size"]=1;
  1611. self._assert_equals_($1,(0));
  1612. $ctx1.sendIdx["assert:equals:"]=1;
  1613. self._assert_equals_(_st(self._collection())._size(),(4));
  1614. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  1615. args: [],
  1616. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self collection size equals: 4",
  1617. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"],
  1618. referencedClasses: []
  1619. }),
  1620. smalltalk.CollectionTest);
  1621. smalltalk.addMethod(
  1622. smalltalk.method({
  1623. selector: "collectionClass",
  1624. category: 'accessing',
  1625. fn: function (){
  1626. var self=this;
  1627. return smalltalk.withContext(function($ctx1) {
  1628. return nil;
  1629. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  1630. args: [],
  1631. source: "collectionClass\x0a\x09^ nil",
  1632. messageSends: [],
  1633. referencedClasses: []
  1634. }),
  1635. smalltalk.CollectionTest.klass);
  1636. smalltalk.addMethod(
  1637. smalltalk.method({
  1638. selector: "isAbstract",
  1639. category: 'testing',
  1640. fn: function (){
  1641. var self=this;
  1642. return smalltalk.withContext(function($ctx1) {
  1643. var $1;
  1644. $1=_st(self._collectionClass())._isNil();
  1645. return $1;
  1646. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  1647. args: [],
  1648. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1649. messageSends: ["isNil", "collectionClass"],
  1650. referencedClasses: []
  1651. }),
  1652. smalltalk.CollectionTest.klass);
  1653. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1654. smalltalk.addMethod(
  1655. smalltalk.method({
  1656. selector: "testAt",
  1657. category: 'tests',
  1658. fn: function (){
  1659. var self=this;
  1660. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1661. return smalltalk.withContext(function($ctx1) {
  1662. var $2,$1;
  1663. $2=self._collection();
  1664. $ctx1.sendIdx["collection"]=1;
  1665. $1=_st($2)._at_((4));
  1666. $ctx1.sendIdx["at:"]=1;
  1667. self._assert_equals_($1,(-4));
  1668. self._should_raise_((function(){
  1669. return smalltalk.withContext(function($ctx2) {
  1670. return _st(self._collection())._at_((5));
  1671. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1672. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  1673. args: [],
  1674. source: "testAt\x0a\x09self assert: (self collection at: 4) equals: -4.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1675. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1676. referencedClasses: ["Error"]
  1677. }),
  1678. smalltalk.IndexableCollectionTest);
  1679. smalltalk.addMethod(
  1680. smalltalk.method({
  1681. selector: "testAtIfAbsent",
  1682. category: 'tests',
  1683. fn: function (){
  1684. var self=this;
  1685. return smalltalk.withContext(function($ctx1) {
  1686. var $2,$1;
  1687. $2=self._collection();
  1688. $ctx1.sendIdx["collection"]=1;
  1689. $1=_st($2)._at_ifAbsent_(_st(_st(self._collection())._size()).__plus((1)),(function(){
  1690. return smalltalk.withContext(function($ctx2) {
  1691. return "none";
  1692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1693. self._assert_equals_($1,"none");
  1694. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  1695. args: [],
  1696. source: "testAtIfAbsent\x0a\x09self assert: (self collection at: (self collection size + 1) ifAbsent: [ 'none' ]) equals: 'none'",
  1697. messageSends: ["assert:equals:", "at:ifAbsent:", "collection", "+", "size"],
  1698. referencedClasses: []
  1699. }),
  1700. smalltalk.IndexableCollectionTest);
  1701. smalltalk.addMethod(
  1702. smalltalk.method({
  1703. selector: "testContains",
  1704. category: 'tests',
  1705. fn: function (){
  1706. var self=this;
  1707. var collection;
  1708. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1709. return smalltalk.withContext(function($ctx1) {
  1710. var $2,$4,$3,$1;
  1711. collection=self._collection();
  1712. $ctx1.sendIdx["collection"]=1;
  1713. $2=self._collection();
  1714. $ctx1.sendIdx["collection"]=2;
  1715. $1=_st($2)._contains_((function(each){
  1716. return smalltalk.withContext(function($ctx2) {
  1717. $4=self._collection();
  1718. $ctx2.sendIdx["collection"]=3;
  1719. $3=_st($4)._first();
  1720. return _st(each).__eq($3);
  1721. $ctx2.sendIdx["="]=1;
  1722. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1723. $ctx1.sendIdx["contains:"]=1;
  1724. self._assert_($1);
  1725. self._deny_(_st(self._collection())._contains_((function(each){
  1726. return smalltalk.withContext(function($ctx2) {
  1727. return _st(each).__eq(_st($Object())._new());
  1728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1729. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1730. args: [],
  1731. 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 ])",
  1732. messageSends: ["collection", "assert:", "contains:", "=", "first", "deny:", "new"],
  1733. referencedClasses: ["Object"]
  1734. }),
  1735. smalltalk.IndexableCollectionTest);
  1736. smalltalk.addMethod(
  1737. smalltalk.method({
  1738. selector: "testIndexOf",
  1739. category: 'tests',
  1740. fn: function (){
  1741. var self=this;
  1742. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1743. return smalltalk.withContext(function($ctx1) {
  1744. var $2,$1,$3;
  1745. $2=self._collection();
  1746. $ctx1.sendIdx["collection"]=1;
  1747. $1=_st($2)._indexOf_((2));
  1748. $ctx1.sendIdx["indexOf:"]=1;
  1749. self._assert_equals_($1,(2));
  1750. $ctx1.sendIdx["assert:equals:"]=1;
  1751. self._should_raise_((function(){
  1752. return smalltalk.withContext(function($ctx2) {
  1753. $3=self._collection();
  1754. $ctx2.sendIdx["collection"]=2;
  1755. return _st($3)._indexOf_((999));
  1756. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1757. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1758. return smalltalk.withContext(function($ctx2) {
  1759. return "sentinel";
  1760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  1761. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  1762. args: [],
  1763. 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'",
  1764. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1765. referencedClasses: ["Error"]
  1766. }),
  1767. smalltalk.IndexableCollectionTest);
  1768. smalltalk.addMethod(
  1769. smalltalk.method({
  1770. selector: "testWithIndexDo",
  1771. category: 'tests',
  1772. fn: function (){
  1773. var self=this;
  1774. var collection;
  1775. return smalltalk.withContext(function($ctx1) {
  1776. collection=self._collection();
  1777. $ctx1.sendIdx["collection"]=1;
  1778. _st(self._collection())._withIndexDo_((function(each,index){
  1779. return smalltalk.withContext(function($ctx2) {
  1780. return self._assert_equals_(_st(collection)._at_(index),each);
  1781. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  1782. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1783. args: [],
  1784. 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 ]",
  1785. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  1786. referencedClasses: []
  1787. }),
  1788. smalltalk.IndexableCollectionTest);
  1789. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1790. smalltalk.addMethod(
  1791. smalltalk.method({
  1792. selector: "collection",
  1793. category: 'accessing',
  1794. fn: function (){
  1795. var self=this;
  1796. return smalltalk.withContext(function($ctx1) {
  1797. var $2,$3,$4,$1;
  1798. $2="b".__minus_gt((1));
  1799. $ctx1.sendIdx["->"]=1;
  1800. $3="a".__minus_gt((2));
  1801. $ctx1.sendIdx["->"]=2;
  1802. $4="c".__minus_gt((3));
  1803. $ctx1.sendIdx["->"]=3;
  1804. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  1805. return $1;
  1806. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  1807. args: [],
  1808. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  1809. messageSends: ["->"],
  1810. referencedClasses: []
  1811. }),
  1812. smalltalk.HashedCollectionTest);
  1813. smalltalk.addMethod(
  1814. smalltalk.method({
  1815. selector: "collectionWithDuplicates",
  1816. category: 'accessing',
  1817. fn: function (){
  1818. var self=this;
  1819. return smalltalk.withContext(function($ctx1) {
  1820. var $2,$3,$4,$5,$6,$7,$1;
  1821. $2="b".__minus_gt((1));
  1822. $ctx1.sendIdx["->"]=1;
  1823. $3="a".__minus_gt((2));
  1824. $ctx1.sendIdx["->"]=2;
  1825. $4="c".__minus_gt((3));
  1826. $ctx1.sendIdx["->"]=3;
  1827. $5="d".__minus_gt((-4));
  1828. $ctx1.sendIdx["->"]=4;
  1829. $6="e".__minus_gt((1));
  1830. $ctx1.sendIdx["->"]=5;
  1831. $7="f".__minus_gt((2));
  1832. $ctx1.sendIdx["->"]=6;
  1833. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  1834. return $1;
  1835. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  1836. args: [],
  1837. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  1838. messageSends: ["->"],
  1839. referencedClasses: []
  1840. }),
  1841. smalltalk.HashedCollectionTest);
  1842. smalltalk.addMethod(
  1843. smalltalk.method({
  1844. selector: "testAsDictionary",
  1845. category: 'tests',
  1846. fn: function (){
  1847. var self=this;
  1848. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1849. return smalltalk.withContext(function($ctx1) {
  1850. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  1851. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  1852. args: [],
  1853. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  1854. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  1855. referencedClasses: ["Dictionary"]
  1856. }),
  1857. smalltalk.HashedCollectionTest);
  1858. smalltalk.addMethod(
  1859. smalltalk.method({
  1860. selector: "testAt",
  1861. category: 'tests',
  1862. fn: function (){
  1863. var self=this;
  1864. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1865. return smalltalk.withContext(function($ctx1) {
  1866. var $2,$1;
  1867. $2=self._collection();
  1868. $ctx1.sendIdx["collection"]=1;
  1869. $1=_st($2)._at_("a");
  1870. $ctx1.sendIdx["at:"]=1;
  1871. self._assert_equals_($1,(2));
  1872. self._should_raise_((function(){
  1873. return smalltalk.withContext(function($ctx2) {
  1874. return _st(self._collection())._at_((5));
  1875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1876. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.HashedCollectionTest)})},
  1877. args: [],
  1878. source: "testAt\x0a\x09self assert: (self collection at: 'a') equals: 2.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1879. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1880. referencedClasses: ["Error"]
  1881. }),
  1882. smalltalk.HashedCollectionTest);
  1883. smalltalk.addMethod(
  1884. smalltalk.method({
  1885. selector: "testContains",
  1886. category: 'tests',
  1887. fn: function (){
  1888. var self=this;
  1889. var collection;
  1890. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1891. return smalltalk.withContext(function($ctx1) {
  1892. var $2,$5,$4,$3,$1;
  1893. collection=self._collection();
  1894. $ctx1.sendIdx["collection"]=1;
  1895. $2=self._collection();
  1896. $ctx1.sendIdx["collection"]=2;
  1897. $1=_st($2)._contains_((function(each){
  1898. return smalltalk.withContext(function($ctx2) {
  1899. $5=self._collection();
  1900. $ctx2.sendIdx["collection"]=3;
  1901. $4=_st($5)._values();
  1902. $3=_st($4)._first();
  1903. return _st(each).__eq($3);
  1904. $ctx2.sendIdx["="]=1;
  1905. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1906. $ctx1.sendIdx["contains:"]=1;
  1907. self._assert_($1);
  1908. self._deny_(_st(self._collection())._contains_((function(each){
  1909. return smalltalk.withContext(function($ctx2) {
  1910. return _st(each).__eq(_st($Object())._new());
  1911. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1912. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.HashedCollectionTest)})},
  1913. args: [],
  1914. 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 ])",
  1915. messageSends: ["collection", "assert:", "contains:", "=", "first", "values", "deny:", "new"],
  1916. referencedClasses: ["Object"]
  1917. }),
  1918. smalltalk.HashedCollectionTest);
  1919. smalltalk.addMethod(
  1920. smalltalk.method({
  1921. selector: "testFrom",
  1922. category: 'tests',
  1923. fn: function (){
  1924. var self=this;
  1925. var associations;
  1926. return smalltalk.withContext(function($ctx1) {
  1927. var $1,$2,$3,$5,$4;
  1928. $1="a".__minus_gt((1));
  1929. $ctx1.sendIdx["->"]=1;
  1930. $2="b".__minus_gt((2));
  1931. $ctx1.sendIdx["->"]=2;
  1932. associations=[$1,$2];
  1933. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  1934. $5="a".__minus_gt((1));
  1935. $ctx1.sendIdx["->"]=3;
  1936. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  1937. self._assertSameContents_as_($3,$4);
  1938. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  1939. args: [],
  1940. 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 }.",
  1941. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  1942. referencedClasses: []
  1943. }),
  1944. smalltalk.HashedCollectionTest);
  1945. smalltalk.addMethod(
  1946. smalltalk.method({
  1947. selector: "testIndexOf",
  1948. category: 'tests',
  1949. fn: function (){
  1950. var self=this;
  1951. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1952. return smalltalk.withContext(function($ctx1) {
  1953. var $2,$1,$3;
  1954. $2=self._collection();
  1955. $ctx1.sendIdx["collection"]=1;
  1956. $1=_st($2)._indexOf_((2));
  1957. $ctx1.sendIdx["indexOf:"]=1;
  1958. self._assert_equals_($1,"a");
  1959. $ctx1.sendIdx["assert:equals:"]=1;
  1960. self._should_raise_((function(){
  1961. return smalltalk.withContext(function($ctx2) {
  1962. $3=self._collection();
  1963. $ctx2.sendIdx["collection"]=2;
  1964. return _st($3)._indexOf_((999));
  1965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1966. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1967. return smalltalk.withContext(function($ctx2) {
  1968. return "sentinel";
  1969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  1970. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.HashedCollectionTest)})},
  1971. args: [],
  1972. 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'",
  1973. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1974. referencedClasses: ["Error"]
  1975. }),
  1976. smalltalk.HashedCollectionTest);
  1977. smalltalk.addMethod(
  1978. smalltalk.method({
  1979. selector: "testNewFromPairs",
  1980. category: 'tests',
  1981. fn: function (){
  1982. var self=this;
  1983. var flattenedAssociations;
  1984. return smalltalk.withContext(function($ctx1) {
  1985. var $1,$3,$2;
  1986. flattenedAssociations=["a",(1),"b",(2)];
  1987. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  1988. $3="a".__minus_gt((1));
  1989. $ctx1.sendIdx["->"]=1;
  1990. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  1991. self._assertSameContents_as_($1,$2);
  1992. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  1993. args: [],
  1994. 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 }.",
  1995. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  1996. referencedClasses: []
  1997. }),
  1998. smalltalk.HashedCollectionTest);
  1999. smalltalk.addMethod(
  2000. smalltalk.method({
  2001. selector: "collectionClass",
  2002. category: 'accessing',
  2003. fn: function (){
  2004. var self=this;
  2005. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2006. return smalltalk.withContext(function($ctx1) {
  2007. return $HashedCollection();
  2008. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  2009. args: [],
  2010. source: "collectionClass\x0a\x09^ HashedCollection",
  2011. messageSends: [],
  2012. referencedClasses: ["HashedCollection"]
  2013. }),
  2014. smalltalk.HashedCollectionTest.klass);
  2015. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  2016. smalltalk.addMethod(
  2017. smalltalk.method({
  2018. selector: "collection",
  2019. category: 'accessing',
  2020. fn: function (){
  2021. var self=this;
  2022. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2023. return smalltalk.withContext(function($ctx1) {
  2024. var $2,$3,$1;
  2025. $2=_st($Dictionary())._new();
  2026. _st($2)._at_put_((1),(1));
  2027. $ctx1.sendIdx["at:put:"]=1;
  2028. _st($2)._at_put_("a",(2));
  2029. $ctx1.sendIdx["at:put:"]=2;
  2030. _st($2)._at_put_(true,(3));
  2031. $ctx1.sendIdx["at:put:"]=3;
  2032. _st($2)._at_put_((4),(-4));
  2033. $3=_st($2)._yourself();
  2034. $1=$3;
  2035. return $1;
  2036. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  2037. args: [],
  2038. 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",
  2039. messageSends: ["at:put:", "new", "yourself"],
  2040. referencedClasses: ["Dictionary"]
  2041. }),
  2042. smalltalk.DictionaryTest);
  2043. smalltalk.addMethod(
  2044. smalltalk.method({
  2045. selector: "collectionWithDuplicates",
  2046. category: 'accessing',
  2047. fn: function (){
  2048. var self=this;
  2049. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2050. return smalltalk.withContext(function($ctx1) {
  2051. var $2,$3,$1;
  2052. $2=_st($Dictionary())._new();
  2053. _st($2)._at_put_((1),(1));
  2054. $ctx1.sendIdx["at:put:"]=1;
  2055. _st($2)._at_put_("a",(2));
  2056. $ctx1.sendIdx["at:put:"]=2;
  2057. _st($2)._at_put_(true,(3));
  2058. $ctx1.sendIdx["at:put:"]=3;
  2059. _st($2)._at_put_((4),(-4));
  2060. $ctx1.sendIdx["at:put:"]=4;
  2061. _st($2)._at_put_("b",(1));
  2062. $ctx1.sendIdx["at:put:"]=5;
  2063. _st($2)._at_put_((3),(3));
  2064. $ctx1.sendIdx["at:put:"]=6;
  2065. _st($2)._at_put_(false,(12));
  2066. $3=_st($2)._yourself();
  2067. $1=$3;
  2068. return $1;
  2069. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  2070. args: [],
  2071. 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",
  2072. messageSends: ["at:put:", "new", "yourself"],
  2073. referencedClasses: ["Dictionary"]
  2074. }),
  2075. smalltalk.DictionaryTest);
  2076. smalltalk.addMethod(
  2077. smalltalk.method({
  2078. selector: "testAccessing",
  2079. category: 'tests',
  2080. fn: function (){
  2081. var self=this;
  2082. var d;
  2083. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2084. return smalltalk.withContext(function($ctx1) {
  2085. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  2086. d=_st($Dictionary())._new();
  2087. _st(d)._at_put_("hello","world");
  2088. $ctx1.sendIdx["at:put:"]=1;
  2089. $1=_st(d)._at_("hello");
  2090. $ctx1.sendIdx["at:"]=1;
  2091. self._assert_equals_($1,"world");
  2092. $ctx1.sendIdx["assert:equals:"]=1;
  2093. $2=_st(d)._at_ifAbsent_("hello",(function(){
  2094. return smalltalk.withContext(function($ctx2) {
  2095. return nil;
  2096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2097. $ctx1.sendIdx["at:ifAbsent:"]=1;
  2098. self._assert_equals_($2,"world");
  2099. $ctx1.sendIdx["assert:equals:"]=2;
  2100. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  2101. return smalltalk.withContext(function($ctx2) {
  2102. return nil;
  2103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  2104. $ctx1.sendIdx["deny:"]=1;
  2105. $3=_st(d)._includesKey_("hello");
  2106. $ctx1.sendIdx["includesKey:"]=1;
  2107. self._assert_($3);
  2108. $ctx1.sendIdx["assert:"]=1;
  2109. $4=_st(d)._includesKey_("foo");
  2110. $ctx1.sendIdx["includesKey:"]=2;
  2111. self._deny_($4);
  2112. $ctx1.sendIdx["deny:"]=2;
  2113. _st(d)._at_put_((1),(2));
  2114. $ctx1.sendIdx["at:put:"]=2;
  2115. $5=_st(d)._at_((1));
  2116. $ctx1.sendIdx["at:"]=2;
  2117. self._assert_equals_($5,(2));
  2118. $ctx1.sendIdx["assert:equals:"]=3;
  2119. $6=d;
  2120. $7=(1).__at((3));
  2121. $ctx1.sendIdx["@"]=1;
  2122. _st($6)._at_put_($7,(3));
  2123. $9=d;
  2124. $10=(1).__at((3));
  2125. $ctx1.sendIdx["@"]=2;
  2126. $8=_st($9)._at_($10);
  2127. self._assert_equals_($8,(3));
  2128. $12=d;
  2129. $13=(1).__at((3));
  2130. $ctx1.sendIdx["@"]=3;
  2131. $11=_st($12)._includesKey_($13);
  2132. $ctx1.sendIdx["includesKey:"]=3;
  2133. self._assert_($11);
  2134. self._deny_(_st(d)._includesKey_((3).__at((1))));
  2135. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  2136. args: [],
  2137. 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)",
  2138. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  2139. referencedClasses: ["Dictionary"]
  2140. }),
  2141. smalltalk.DictionaryTest);
  2142. smalltalk.addMethod(
  2143. smalltalk.method({
  2144. selector: "testAsHashedCollection",
  2145. category: 'tests',
  2146. fn: function (){
  2147. var self=this;
  2148. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2149. return smalltalk.withContext(function($ctx1) {
  2150. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2151. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  2152. args: [],
  2153. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2154. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2155. referencedClasses: ["HashedCollection"]
  2156. }),
  2157. smalltalk.DictionaryTest);
  2158. smalltalk.addMethod(
  2159. smalltalk.method({
  2160. selector: "testDynamicDictionaries",
  2161. category: 'tests',
  2162. fn: function (){
  2163. var self=this;
  2164. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2165. return smalltalk.withContext(function($ctx1) {
  2166. var $3,$2,$1;
  2167. $3="hello".__minus_gt((1));
  2168. $ctx1.sendIdx["->"]=1;
  2169. $2=smalltalk.HashedCollection._from_([$3]);
  2170. $1=_st($2)._asDictionary();
  2171. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  2172. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  2173. args: [],
  2174. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  2175. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  2176. referencedClasses: ["Dictionary"]
  2177. }),
  2178. smalltalk.DictionaryTest);
  2179. smalltalk.addMethod(
  2180. smalltalk.method({
  2181. selector: "testEquality",
  2182. category: 'tests',
  2183. fn: function (){
  2184. var self=this;
  2185. var d1,d2;
  2186. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2187. return smalltalk.withContext(function($ctx1) {
  2188. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  2189. $2=_st($Dictionary())._new();
  2190. $ctx1.sendIdx["new"]=1;
  2191. $3=_st($Dictionary())._new();
  2192. $ctx1.sendIdx["new"]=2;
  2193. $1=_st($2).__eq($3);
  2194. $ctx1.sendIdx["="]=1;
  2195. self._assert_($1);
  2196. $ctx1.sendIdx["assert:"]=1;
  2197. $4=_st($Dictionary())._new();
  2198. $ctx1.sendIdx["new"]=3;
  2199. _st($4)._at_put_((1),(2));
  2200. $ctx1.sendIdx["at:put:"]=1;
  2201. $5=_st($4)._yourself();
  2202. $ctx1.sendIdx["yourself"]=1;
  2203. d1=$5;
  2204. $6=_st($Dictionary())._new();
  2205. $ctx1.sendIdx["new"]=4;
  2206. _st($6)._at_put_((1),(2));
  2207. $ctx1.sendIdx["at:put:"]=2;
  2208. $7=_st($6)._yourself();
  2209. $ctx1.sendIdx["yourself"]=2;
  2210. d2=$7;
  2211. $8=_st(d1).__eq(d2);
  2212. $ctx1.sendIdx["="]=2;
  2213. self._assert_($8);
  2214. $9=_st($Dictionary())._new();
  2215. $ctx1.sendIdx["new"]=5;
  2216. _st($9)._at_put_((1),(3));
  2217. $ctx1.sendIdx["at:put:"]=3;
  2218. $10=_st($9)._yourself();
  2219. $ctx1.sendIdx["yourself"]=3;
  2220. d2=$10;
  2221. $11=_st(d1).__eq(d2);
  2222. $ctx1.sendIdx["="]=3;
  2223. self._deny_($11);
  2224. $ctx1.sendIdx["deny:"]=1;
  2225. $12=_st($Dictionary())._new();
  2226. $ctx1.sendIdx["new"]=6;
  2227. _st($12)._at_put_((2),(2));
  2228. $ctx1.sendIdx["at:put:"]=4;
  2229. $13=_st($12)._yourself();
  2230. $ctx1.sendIdx["yourself"]=4;
  2231. d2=$13;
  2232. $14=_st(d1).__eq(d2);
  2233. $ctx1.sendIdx["="]=4;
  2234. self._deny_($14);
  2235. $ctx1.sendIdx["deny:"]=2;
  2236. $15=_st($Dictionary())._new();
  2237. _st($15)._at_put_((1),(2));
  2238. $ctx1.sendIdx["at:put:"]=5;
  2239. _st($15)._at_put_((3),(4));
  2240. $16=_st($15)._yourself();
  2241. d2=$16;
  2242. self._deny_(_st(d1).__eq(d2));
  2243. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  2244. args: [],
  2245. 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.",
  2246. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  2247. referencedClasses: ["Dictionary"]
  2248. }),
  2249. smalltalk.DictionaryTest);
  2250. smalltalk.addMethod(
  2251. smalltalk.method({
  2252. selector: "testIfAbsent",
  2253. category: 'tests',
  2254. fn: function (){
  2255. var self=this;
  2256. var d,visited;
  2257. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2258. return smalltalk.withContext(function($ctx1) {
  2259. visited=false;
  2260. d=_st($Dictionary())._new();
  2261. _st(d)._at_ifAbsent_("hello",(function(){
  2262. return smalltalk.withContext(function($ctx2) {
  2263. visited=true;
  2264. return visited;
  2265. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2266. self._assert_(visited);
  2267. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  2268. args: [],
  2269. 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.",
  2270. messageSends: ["new", "at:ifAbsent:", "assert:"],
  2271. referencedClasses: ["Dictionary"]
  2272. }),
  2273. smalltalk.DictionaryTest);
  2274. smalltalk.addMethod(
  2275. smalltalk.method({
  2276. selector: "testIfPresent",
  2277. category: 'tests',
  2278. fn: function (){
  2279. var self=this;
  2280. var d,visited,absent;
  2281. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2282. return smalltalk.withContext(function($ctx1) {
  2283. visited=false;
  2284. d=_st($Dictionary())._new();
  2285. _st(d)._at_put_("hello","world");
  2286. _st(d)._at_ifPresent_("hello",(function(value){
  2287. return smalltalk.withContext(function($ctx2) {
  2288. visited=value;
  2289. return visited;
  2290. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}));
  2291. $ctx1.sendIdx["at:ifPresent:"]=1;
  2292. self._assert_equals_(visited,"world");
  2293. absent=_st(d)._at_ifPresent_("bye",(function(value){
  2294. return smalltalk.withContext(function($ctx2) {
  2295. visited=value;
  2296. return visited;
  2297. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,2)})}));
  2298. self._assert_(_st(absent)._isNil());
  2299. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent},smalltalk.DictionaryTest)})},
  2300. args: [],
  2301. 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.",
  2302. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"],
  2303. referencedClasses: ["Dictionary"]
  2304. }),
  2305. smalltalk.DictionaryTest);
  2306. smalltalk.addMethod(
  2307. smalltalk.method({
  2308. selector: "testIfPresentIfAbsent",
  2309. category: 'tests',
  2310. fn: function (){
  2311. var self=this;
  2312. var d,visited;
  2313. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2314. return smalltalk.withContext(function($ctx1) {
  2315. visited=false;
  2316. d=_st($Dictionary())._new();
  2317. _st(d)._at_put_("hello","world");
  2318. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  2319. return smalltalk.withContext(function($ctx2) {
  2320. visited=value;
  2321. return visited;
  2322. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}),(function(){
  2323. return smalltalk.withContext(function($ctx2) {
  2324. visited=true;
  2325. return visited;
  2326. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2327. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2328. self._assert_equals_(visited,"world");
  2329. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  2330. return smalltalk.withContext(function($ctx2) {
  2331. visited=value;
  2332. return visited;
  2333. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,3)})}),(function(){
  2334. return smalltalk.withContext(function($ctx2) {
  2335. visited=true;
  2336. return visited;
  2337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  2338. self._assert_(visited);
  2339. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  2340. args: [],
  2341. 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.",
  2342. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"],
  2343. referencedClasses: ["Dictionary"]
  2344. }),
  2345. smalltalk.DictionaryTest);
  2346. smalltalk.addMethod(
  2347. smalltalk.method({
  2348. selector: "testKeys",
  2349. category: 'tests',
  2350. fn: function (){
  2351. var self=this;
  2352. var d;
  2353. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2354. return smalltalk.withContext(function($ctx1) {
  2355. d=_st($Dictionary())._new();
  2356. _st(d)._at_put_((1),(2));
  2357. $ctx1.sendIdx["at:put:"]=1;
  2358. _st(d)._at_put_((2),(3));
  2359. $ctx1.sendIdx["at:put:"]=2;
  2360. _st(d)._at_put_((3),(4));
  2361. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  2362. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  2363. args: [],
  2364. 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)",
  2365. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  2366. referencedClasses: ["Dictionary"]
  2367. }),
  2368. smalltalk.DictionaryTest);
  2369. smalltalk.addMethod(
  2370. smalltalk.method({
  2371. selector: "testPointKey",
  2372. category: 'tests',
  2373. fn: function (){
  2374. var self=this;
  2375. var d;
  2376. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2377. return smalltalk.withContext(function($ctx1) {
  2378. var $1,$2,$4,$5,$3,$6,$7,$9,$10,$8,$11,$12,$14,$15,$13;
  2379. d=_st($Dictionary())._new();
  2380. $1=d;
  2381. $2=(1).__at((1));
  2382. $ctx1.sendIdx["@"]=1;
  2383. _st($1)._at_put_($2,"foo");
  2384. $ctx1.sendIdx["at:put:"]=1;
  2385. $4=d;
  2386. $5=(1).__at((1));
  2387. $ctx1.sendIdx["@"]=2;
  2388. $3=_st($4)._at_($5);
  2389. $ctx1.sendIdx["at:"]=1;
  2390. self._assert_equals_($3,"foo");
  2391. $ctx1.sendIdx["assert:equals:"]=1;
  2392. $6=d;
  2393. $7=(1).__at((1));
  2394. $ctx1.sendIdx["@"]=3;
  2395. _st($6)._at_put_($7,"bar");
  2396. $9=d;
  2397. $10=(1).__at((1));
  2398. $ctx1.sendIdx["@"]=4;
  2399. $8=_st($9)._at_($10);
  2400. self._assert_equals_($8,"bar");
  2401. $ctx1.sendIdx["assert:equals:"]=2;
  2402. $11=d;
  2403. $12=(1).__at((1));
  2404. $ctx1.sendIdx["@"]=5;
  2405. _st($11)._removeKey_($12);
  2406. $14=d;
  2407. $15=(1).__at((1));
  2408. $ctx1.sendIdx["@"]=6;
  2409. $13=_st($14)._at_ifAbsent_($15,(function(){
  2410. return smalltalk.withContext(function($ctx2) {
  2411. return "baz";
  2412. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2413. self._assert_equals_($13,"baz");
  2414. self._deny_(_st(d)._includesKey_((1).__at((1))));
  2415. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  2416. args: [],
  2417. 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)",
  2418. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  2419. referencedClasses: ["Dictionary"]
  2420. }),
  2421. smalltalk.DictionaryTest);
  2422. smalltalk.addMethod(
  2423. smalltalk.method({
  2424. selector: "testPrintString",
  2425. category: 'tests',
  2426. fn: function (){
  2427. var self=this;
  2428. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2429. return smalltalk.withContext(function($ctx1) {
  2430. var $2,$3,$1;
  2431. $2=_st($Dictionary())._new();
  2432. _st($2)._at_put_("firstname","James");
  2433. $ctx1.sendIdx["at:put:"]=1;
  2434. _st($2)._at_put_("lastname","Bond");
  2435. $3=_st($2)._printString();
  2436. $1=$3;
  2437. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2438. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  2439. args: [],
  2440. 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'')'",
  2441. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  2442. referencedClasses: ["Dictionary"]
  2443. }),
  2444. smalltalk.DictionaryTest);
  2445. smalltalk.addMethod(
  2446. smalltalk.method({
  2447. selector: "testRemoveKey",
  2448. category: 'tests',
  2449. fn: function (){
  2450. var self=this;
  2451. var d,key;
  2452. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2453. return smalltalk.withContext(function($ctx1) {
  2454. var $1;
  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. key=(2);
  2462. $1=_st(d)._keys();
  2463. $ctx1.sendIdx["keys"]=1;
  2464. self._assert_equals_($1,[(1), (2), (3)]);
  2465. $ctx1.sendIdx["assert:equals:"]=1;
  2466. _st(d)._removeKey_(key);
  2467. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  2468. $ctx1.sendIdx["assert:equals:"]=2;
  2469. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  2470. self._deny_(_st(d)._includesKey_((2)));
  2471. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  2472. args: [],
  2473. 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)",
  2474. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  2475. referencedClasses: ["Dictionary"]
  2476. }),
  2477. smalltalk.DictionaryTest);
  2478. smalltalk.addMethod(
  2479. smalltalk.method({
  2480. selector: "testRemoveKeyIfAbsent",
  2481. category: 'tests',
  2482. fn: function (){
  2483. var self=this;
  2484. var d,key;
  2485. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2486. return smalltalk.withContext(function($ctx1) {
  2487. var $1;
  2488. d=_st($Dictionary())._new();
  2489. _st(d)._at_put_((1),(2));
  2490. $ctx1.sendIdx["at:put:"]=1;
  2491. _st(d)._at_put_((2),(3));
  2492. $ctx1.sendIdx["at:put:"]=2;
  2493. _st(d)._at_put_((3),(4));
  2494. key=(2);
  2495. self._assert_equals_(_st(d)._removeKey_(key),(3));
  2496. $ctx1.sendIdx["assert:equals:"]=1;
  2497. key=(3);
  2498. $1=_st(d)._removeKey_ifAbsent_(key,(function(){
  2499. return smalltalk.withContext(function($ctx2) {
  2500. return (42);
  2501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2502. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  2503. self._assert_equals_($1,(4));
  2504. $ctx1.sendIdx["assert:equals:"]=2;
  2505. key="why";
  2506. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  2507. return smalltalk.withContext(function($ctx2) {
  2508. return (42);
  2509. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  2510. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  2511. args: [],
  2512. 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.",
  2513. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  2514. referencedClasses: ["Dictionary"]
  2515. }),
  2516. smalltalk.DictionaryTest);
  2517. smalltalk.addMethod(
  2518. smalltalk.method({
  2519. selector: "testSize",
  2520. category: 'tests',
  2521. fn: function (){
  2522. var self=this;
  2523. var d;
  2524. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2525. return smalltalk.withContext(function($ctx1) {
  2526. var $1,$2;
  2527. d=_st($Dictionary())._new();
  2528. $1=_st(d)._size();
  2529. $ctx1.sendIdx["size"]=1;
  2530. self._assert_equals_($1,(0));
  2531. $ctx1.sendIdx["assert:equals:"]=1;
  2532. _st(d)._at_put_((1),(2));
  2533. $ctx1.sendIdx["at:put:"]=1;
  2534. $2=_st(d)._size();
  2535. $ctx1.sendIdx["size"]=2;
  2536. self._assert_equals_($2,(1));
  2537. $ctx1.sendIdx["assert:equals:"]=2;
  2538. _st(d)._at_put_((2),(3));
  2539. self._assert_equals_(_st(d)._size(),(2));
  2540. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d},smalltalk.DictionaryTest)})},
  2541. args: [],
  2542. 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.",
  2543. messageSends: ["new", "assert:equals:", "size", "at:put:"],
  2544. referencedClasses: ["Dictionary"]
  2545. }),
  2546. smalltalk.DictionaryTest);
  2547. smalltalk.addMethod(
  2548. smalltalk.method({
  2549. selector: "testValues",
  2550. category: 'tests',
  2551. fn: function (){
  2552. var self=this;
  2553. var d;
  2554. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2555. return smalltalk.withContext(function($ctx1) {
  2556. d=_st($Dictionary())._new();
  2557. _st(d)._at_put_((1),(2));
  2558. $ctx1.sendIdx["at:put:"]=1;
  2559. _st(d)._at_put_((2),(3));
  2560. $ctx1.sendIdx["at:put:"]=2;
  2561. _st(d)._at_put_((3),(4));
  2562. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  2563. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  2564. args: [],
  2565. 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)",
  2566. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  2567. referencedClasses: ["Dictionary"]
  2568. }),
  2569. smalltalk.DictionaryTest);
  2570. smalltalk.addMethod(
  2571. smalltalk.method({
  2572. selector: "collectionClass",
  2573. category: 'accessing',
  2574. fn: function (){
  2575. var self=this;
  2576. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2577. return smalltalk.withContext(function($ctx1) {
  2578. return $Dictionary();
  2579. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  2580. args: [],
  2581. source: "collectionClass\x0a\x09^ Dictionary",
  2582. messageSends: [],
  2583. referencedClasses: ["Dictionary"]
  2584. }),
  2585. smalltalk.DictionaryTest.klass);
  2586. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2587. smalltalk.addMethod(
  2588. smalltalk.method({
  2589. selector: "testFirst",
  2590. category: 'tests',
  2591. fn: function (){
  2592. var self=this;
  2593. return smalltalk.withContext(function($ctx1) {
  2594. var $2,$1;
  2595. $2=self._collection();
  2596. $ctx1.sendIdx["collection"]=1;
  2597. $1=_st($2)._first();
  2598. self._assert_equals_($1,_st(self._collection())._at_((1)));
  2599. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  2600. args: [],
  2601. source: "testFirst\x0a\x09self assert: (self collection first) equals: (self collection at: 1)",
  2602. messageSends: ["assert:equals:", "first", "collection", "at:"],
  2603. referencedClasses: []
  2604. }),
  2605. smalltalk.SequenceableCollectionTest);
  2606. smalltalk.addMethod(
  2607. smalltalk.method({
  2608. selector: "testFourth",
  2609. category: 'tests',
  2610. fn: function (){
  2611. var self=this;
  2612. return smalltalk.withContext(function($ctx1) {
  2613. var $2,$1;
  2614. $2=self._collection();
  2615. $ctx1.sendIdx["collection"]=1;
  2616. $1=_st($2)._fourth();
  2617. self._assert_equals_($1,_st(self._collection())._at_((4)));
  2618. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  2619. args: [],
  2620. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  2621. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  2622. referencedClasses: []
  2623. }),
  2624. smalltalk.SequenceableCollectionTest);
  2625. smalltalk.addMethod(
  2626. smalltalk.method({
  2627. selector: "testLast",
  2628. category: 'tests',
  2629. fn: function (){
  2630. var self=this;
  2631. return smalltalk.withContext(function($ctx1) {
  2632. var $2,$1,$4,$3;
  2633. $2=self._collection();
  2634. $ctx1.sendIdx["collection"]=1;
  2635. $1=_st($2)._last();
  2636. $4=self._collection();
  2637. $ctx1.sendIdx["collection"]=2;
  2638. $3=_st($4)._at_(_st(self._collection())._size());
  2639. self._assert_equals_($1,$3);
  2640. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  2641. args: [],
  2642. source: "testLast\x0a\x09self assert: (self collection last) equals: (self collection at: self collection size)",
  2643. messageSends: ["assert:equals:", "last", "collection", "at:", "size"],
  2644. referencedClasses: []
  2645. }),
  2646. smalltalk.SequenceableCollectionTest);
  2647. smalltalk.addMethod(
  2648. smalltalk.method({
  2649. selector: "testSecond",
  2650. category: 'tests',
  2651. fn: function (){
  2652. var self=this;
  2653. return smalltalk.withContext(function($ctx1) {
  2654. var $2,$1;
  2655. $2=self._collection();
  2656. $ctx1.sendIdx["collection"]=1;
  2657. $1=_st($2)._second();
  2658. self._assert_equals_($1,_st(self._collection())._at_((2)));
  2659. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  2660. args: [],
  2661. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  2662. messageSends: ["assert:equals:", "second", "collection", "at:"],
  2663. referencedClasses: []
  2664. }),
  2665. smalltalk.SequenceableCollectionTest);
  2666. smalltalk.addMethod(
  2667. smalltalk.method({
  2668. selector: "testThird",
  2669. category: 'tests',
  2670. fn: function (){
  2671. var self=this;
  2672. return smalltalk.withContext(function($ctx1) {
  2673. var $2,$1;
  2674. $2=self._collection();
  2675. $ctx1.sendIdx["collection"]=1;
  2676. $1=_st($2)._third();
  2677. self._assert_equals_($1,_st(self._collection())._at_((3)));
  2678. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  2679. args: [],
  2680. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  2681. messageSends: ["assert:equals:", "third", "collection", "at:"],
  2682. referencedClasses: []
  2683. }),
  2684. smalltalk.SequenceableCollectionTest);
  2685. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2686. smalltalk.addMethod(
  2687. smalltalk.method({
  2688. selector: "testAdd",
  2689. category: 'tests',
  2690. fn: function (){
  2691. var self=this;
  2692. var array;
  2693. return smalltalk.withContext(function($ctx1) {
  2694. array=self._collection();
  2695. _st(array)._add_((6));
  2696. self._assert_equals_(_st(array)._last(),(6));
  2697. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  2698. args: [],
  2699. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  2700. messageSends: ["collection", "add:", "assert:equals:", "last"],
  2701. referencedClasses: []
  2702. }),
  2703. smalltalk.ArrayTest);
  2704. smalltalk.addMethod(
  2705. smalltalk.method({
  2706. selector: "testAddFirst",
  2707. category: 'tests',
  2708. fn: function (){
  2709. var self=this;
  2710. return smalltalk.withContext(function($ctx1) {
  2711. var $1,$2;
  2712. $1=self._collection();
  2713. _st($1)._addFirst_((0));
  2714. $2=_st($1)._yourself();
  2715. self._assert_equals_(_st($2)._first(),(0));
  2716. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  2717. args: [],
  2718. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  2719. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  2720. referencedClasses: []
  2721. }),
  2722. smalltalk.ArrayTest);
  2723. smalltalk.addMethod(
  2724. smalltalk.method({
  2725. selector: "testAtIfAbsent",
  2726. category: 'tests',
  2727. fn: function (){
  2728. var self=this;
  2729. var array;
  2730. return smalltalk.withContext(function($ctx1) {
  2731. var $1,$2,$3,$4;
  2732. array=["hello", "world"];
  2733. $1=_st(array)._at_((1));
  2734. $ctx1.sendIdx["at:"]=1;
  2735. self._assert_equals_($1,"hello");
  2736. $ctx1.sendIdx["assert:equals:"]=1;
  2737. self._assert_equals_(_st(array)._at_((2)),"world");
  2738. $ctx1.sendIdx["assert:equals:"]=2;
  2739. $2=_st(array)._at_ifAbsent_((2),(function(){
  2740. return smalltalk.withContext(function($ctx2) {
  2741. return "not found";
  2742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2743. $ctx1.sendIdx["at:ifAbsent:"]=1;
  2744. self._assert_equals_($2,"world");
  2745. $ctx1.sendIdx["assert:equals:"]=3;
  2746. $3=_st(array)._at_ifAbsent_((0),(function(){
  2747. return smalltalk.withContext(function($ctx2) {
  2748. return "not found";
  2749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2750. $ctx1.sendIdx["at:ifAbsent:"]=2;
  2751. self._assert_equals_($3,"not found");
  2752. $ctx1.sendIdx["assert:equals:"]=4;
  2753. $4=_st(array)._at_ifAbsent_((-10),(function(){
  2754. return smalltalk.withContext(function($ctx2) {
  2755. return "not found";
  2756. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  2757. $ctx1.sendIdx["at:ifAbsent:"]=3;
  2758. self._assert_equals_($4,"not found");
  2759. $ctx1.sendIdx["assert:equals:"]=5;
  2760. self._assert_equals_(_st(array)._at_ifAbsent_((3),(function(){
  2761. return smalltalk.withContext(function($ctx2) {
  2762. return "not found";
  2763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),"not found");
  2764. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array},smalltalk.ArrayTest)})},
  2765. args: [],
  2766. 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'.",
  2767. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2768. referencedClasses: []
  2769. }),
  2770. smalltalk.ArrayTest);
  2771. smalltalk.addMethod(
  2772. smalltalk.method({
  2773. selector: "testFirstN",
  2774. category: 'tests',
  2775. fn: function (){
  2776. var self=this;
  2777. return smalltalk.withContext(function($ctx1) {
  2778. self._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  2779. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.ArrayTest)})},
  2780. args: [],
  2781. source: "testFirstN\x0a\x09self assert: ({1. 2. 3. 4. 5} first: 3) equals: {1. 2. 3}",
  2782. messageSends: ["assert:equals:", "first:"],
  2783. referencedClasses: []
  2784. }),
  2785. smalltalk.ArrayTest);
  2786. smalltalk.addMethod(
  2787. smalltalk.method({
  2788. selector: "testIfEmpty",
  2789. category: 'tests',
  2790. fn: function (){
  2791. var self=this;
  2792. return smalltalk.withContext(function($ctx1) {
  2793. self._assert_equals_(""._ifEmpty_((function(){
  2794. return smalltalk.withContext(function($ctx2) {
  2795. return "zork";
  2796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"zork");
  2797. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{},smalltalk.ArrayTest)})},
  2798. args: [],
  2799. source: "testIfEmpty\x0a\x09self assert: ( '' ifEmpty: [ 'zork' ] ) equals: 'zork'",
  2800. messageSends: ["assert:equals:", "ifEmpty:"],
  2801. referencedClasses: []
  2802. }),
  2803. smalltalk.ArrayTest);
  2804. smalltalk.addMethod(
  2805. smalltalk.method({
  2806. selector: "testPrintString",
  2807. category: 'tests',
  2808. fn: function (){
  2809. var self=this;
  2810. var array;
  2811. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2812. return smalltalk.withContext(function($ctx1) {
  2813. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  2814. array=_st($Array())._new();
  2815. $1=_st(array)._printString();
  2816. $ctx1.sendIdx["printString"]=1;
  2817. self._assert_equals_($1,"an Array ()");
  2818. $ctx1.sendIdx["assert:equals:"]=1;
  2819. $2=array;
  2820. _st($2)._add_((1));
  2821. $ctx1.sendIdx["add:"]=1;
  2822. $3=_st($2)._add_((3));
  2823. $ctx1.sendIdx["add:"]=2;
  2824. $4=_st(array)._printString();
  2825. $ctx1.sendIdx["printString"]=2;
  2826. self._assert_equals_($4,"an Array (1 3)");
  2827. $ctx1.sendIdx["assert:equals:"]=2;
  2828. _st(array)._add_("foo");
  2829. $5=_st(array)._printString();
  2830. $ctx1.sendIdx["printString"]=3;
  2831. self._assert_equals_($5,"an Array (1 3 'foo')");
  2832. $ctx1.sendIdx["assert:equals:"]=3;
  2833. $6=array;
  2834. _st($6)._remove_((1));
  2835. $ctx1.sendIdx["remove:"]=1;
  2836. $7=_st($6)._remove_((3));
  2837. $8=_st(array)._printString();
  2838. $ctx1.sendIdx["printString"]=4;
  2839. self._assert_equals_($8,"an Array ('foo')");
  2840. $ctx1.sendIdx["assert:equals:"]=4;
  2841. _st(array)._addLast_((3));
  2842. $ctx1.sendIdx["addLast:"]=1;
  2843. $9=_st(array)._printString();
  2844. $ctx1.sendIdx["printString"]=5;
  2845. self._assert_equals_($9,"an Array ('foo' 3)");
  2846. $ctx1.sendIdx["assert:equals:"]=5;
  2847. _st(array)._addLast_((3));
  2848. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  2849. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  2850. args: [],
  2851. 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)'.",
  2852. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  2853. referencedClasses: ["Array"]
  2854. }),
  2855. smalltalk.ArrayTest);
  2856. smalltalk.addMethod(
  2857. smalltalk.method({
  2858. selector: "testRemove",
  2859. category: 'tests',
  2860. fn: function (){
  2861. var self=this;
  2862. var array;
  2863. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2864. return smalltalk.withContext(function($ctx1) {
  2865. array=[(1), (2), (3), (4), (5)];
  2866. _st(array)._remove_((3));
  2867. $ctx1.sendIdx["remove:"]=1;
  2868. self._assert_equals_(array,[(1), (2), (4), (5)]);
  2869. self._should_raise_((function(){
  2870. return smalltalk.withContext(function($ctx2) {
  2871. return _st(array)._remove_((3));
  2872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2873. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  2874. args: [],
  2875. 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",
  2876. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  2877. referencedClasses: ["Error"]
  2878. }),
  2879. smalltalk.ArrayTest);
  2880. smalltalk.addMethod(
  2881. smalltalk.method({
  2882. selector: "testRemoveFromTo",
  2883. category: 'tests',
  2884. fn: function (){
  2885. var self=this;
  2886. return smalltalk.withContext(function($ctx1) {
  2887. var $1,$2;
  2888. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  2889. $ctx1.sendIdx["removeFrom:to:"]=1;
  2890. self._assert_equals_($1,[(4)]);
  2891. $ctx1.sendIdx["assert:equals:"]=1;
  2892. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  2893. $ctx1.sendIdx["removeFrom:to:"]=2;
  2894. self._assert_equals_($2,[(1), (4)]);
  2895. $ctx1.sendIdx["assert:equals:"]=2;
  2896. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  2897. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  2898. args: [],
  2899. 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)",
  2900. messageSends: ["assert:equals:", "removeFrom:to:"],
  2901. referencedClasses: []
  2902. }),
  2903. smalltalk.ArrayTest);
  2904. smalltalk.addMethod(
  2905. smalltalk.method({
  2906. selector: "testRemoveIndex",
  2907. category: 'tests',
  2908. fn: function (){
  2909. var self=this;
  2910. return smalltalk.withContext(function($ctx1) {
  2911. var $1,$2;
  2912. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  2913. $ctx1.sendIdx["removeIndex:"]=1;
  2914. self._assert_equals_($1,[(1), (3), (4)]);
  2915. $ctx1.sendIdx["assert:equals:"]=1;
  2916. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  2917. $ctx1.sendIdx["removeIndex:"]=2;
  2918. self._assert_equals_($2,[(2), (3), (4)]);
  2919. $ctx1.sendIdx["assert:equals:"]=2;
  2920. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  2921. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  2922. args: [],
  2923. 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: #()",
  2924. messageSends: ["assert:equals:", "removeIndex:"],
  2925. referencedClasses: []
  2926. }),
  2927. smalltalk.ArrayTest);
  2928. smalltalk.addMethod(
  2929. smalltalk.method({
  2930. selector: "testRemoveLast",
  2931. category: 'tests',
  2932. fn: function (){
  2933. var self=this;
  2934. var array;
  2935. return smalltalk.withContext(function($ctx1) {
  2936. array=[(1), (2)];
  2937. _st(array)._removeLast();
  2938. self._assert_equals_(_st(array)._last(),(1));
  2939. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  2940. args: [],
  2941. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  2942. messageSends: ["removeLast", "assert:equals:", "last"],
  2943. referencedClasses: []
  2944. }),
  2945. smalltalk.ArrayTest);
  2946. smalltalk.addMethod(
  2947. smalltalk.method({
  2948. selector: "testReversed",
  2949. category: 'tests',
  2950. fn: function (){
  2951. var self=this;
  2952. var array;
  2953. return smalltalk.withContext(function($ctx1) {
  2954. array=[(5), (4), (3), (2), (1)];
  2955. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  2956. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  2957. args: [],
  2958. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  2959. messageSends: ["assert:equals:", "reversed"],
  2960. referencedClasses: []
  2961. }),
  2962. smalltalk.ArrayTest);
  2963. smalltalk.addMethod(
  2964. smalltalk.method({
  2965. selector: "testSort",
  2966. category: 'tests',
  2967. fn: function (){
  2968. var self=this;
  2969. var array;
  2970. return smalltalk.withContext(function($ctx1) {
  2971. array=[(3), (1), (4), (5), (2)];
  2972. _st(array)._sort();
  2973. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  2974. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  2975. args: [],
  2976. 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)",
  2977. messageSends: ["sort", "assert:equals:"],
  2978. referencedClasses: []
  2979. }),
  2980. smalltalk.ArrayTest);
  2981. smalltalk.addMethod(
  2982. smalltalk.method({
  2983. selector: "collectionClass",
  2984. category: 'accessing',
  2985. fn: function (){
  2986. var self=this;
  2987. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2988. return smalltalk.withContext(function($ctx1) {
  2989. return $Array();
  2990. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  2991. args: [],
  2992. source: "collectionClass\x0a\x09^ Array",
  2993. messageSends: [],
  2994. referencedClasses: ["Array"]
  2995. }),
  2996. smalltalk.ArrayTest.klass);
  2997. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2998. smalltalk.addMethod(
  2999. smalltalk.method({
  3000. selector: "collection",
  3001. category: 'accessing',
  3002. fn: function (){
  3003. var self=this;
  3004. return smalltalk.withContext(function($ctx1) {
  3005. return "hello";
  3006. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  3007. args: [],
  3008. source: "collection\x0a\x09^ 'hello'",
  3009. messageSends: [],
  3010. referencedClasses: []
  3011. }),
  3012. smalltalk.StringTest);
  3013. smalltalk.addMethod(
  3014. smalltalk.method({
  3015. selector: "collectionWithDuplicates",
  3016. category: 'accessing',
  3017. fn: function (){
  3018. var self=this;
  3019. return smalltalk.withContext(function($ctx1) {
  3020. return "abbaerte";
  3021. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  3022. args: [],
  3023. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  3024. messageSends: [],
  3025. referencedClasses: []
  3026. }),
  3027. smalltalk.StringTest);
  3028. smalltalk.addMethod(
  3029. smalltalk.method({
  3030. selector: "testAddRemove",
  3031. category: 'tests',
  3032. fn: function (){
  3033. var self=this;
  3034. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3035. return smalltalk.withContext(function($ctx1) {
  3036. self._should_raise_((function(){
  3037. return smalltalk.withContext(function($ctx2) {
  3038. return "hello"._add_("a");
  3039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3040. $ctx1.sendIdx["should:raise:"]=1;
  3041. self._should_raise_((function(){
  3042. return smalltalk.withContext(function($ctx2) {
  3043. return "hello"._remove_("h");
  3044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3045. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  3046. args: [],
  3047. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  3048. messageSends: ["should:raise:", "add:", "remove:"],
  3049. referencedClasses: ["Error"]
  3050. }),
  3051. smalltalk.StringTest);
  3052. smalltalk.addMethod(
  3053. smalltalk.method({
  3054. selector: "testAsArray",
  3055. category: 'tests',
  3056. fn: function (){
  3057. var self=this;
  3058. return smalltalk.withContext(function($ctx1) {
  3059. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  3060. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  3061. args: [],
  3062. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  3063. messageSends: ["assert:equals:", "asArray"],
  3064. referencedClasses: []
  3065. }),
  3066. smalltalk.StringTest);
  3067. smalltalk.addMethod(
  3068. smalltalk.method({
  3069. selector: "testAsLowerCase",
  3070. category: 'tests',
  3071. fn: function (){
  3072. var self=this;
  3073. return smalltalk.withContext(function($ctx1) {
  3074. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  3075. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  3076. args: [],
  3077. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  3078. messageSends: ["assert:equals:", "asLowercase"],
  3079. referencedClasses: []
  3080. }),
  3081. smalltalk.StringTest);
  3082. smalltalk.addMethod(
  3083. smalltalk.method({
  3084. selector: "testAsNumber",
  3085. category: 'tests',
  3086. fn: function (){
  3087. var self=this;
  3088. return smalltalk.withContext(function($ctx1) {
  3089. var $1,$2;
  3090. $1="3"._asNumber();
  3091. $ctx1.sendIdx["asNumber"]=1;
  3092. self._assert_equals_($1,(3));
  3093. $ctx1.sendIdx["assert:equals:"]=1;
  3094. $2="-3"._asNumber();
  3095. $ctx1.sendIdx["asNumber"]=2;
  3096. self._assert_equals_($2,(-3));
  3097. $ctx1.sendIdx["assert:equals:"]=2;
  3098. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  3099. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  3100. args: [],
  3101. 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.",
  3102. messageSends: ["assert:equals:", "asNumber"],
  3103. referencedClasses: []
  3104. }),
  3105. smalltalk.StringTest);
  3106. smalltalk.addMethod(
  3107. smalltalk.method({
  3108. selector: "testAsUpperCase",
  3109. category: 'tests',
  3110. fn: function (){
  3111. var self=this;
  3112. return smalltalk.withContext(function($ctx1) {
  3113. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  3114. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  3115. args: [],
  3116. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  3117. messageSends: ["assert:equals:", "asUppercase"],
  3118. referencedClasses: []
  3119. }),
  3120. smalltalk.StringTest);
  3121. smalltalk.addMethod(
  3122. smalltalk.method({
  3123. selector: "testAsciiValue",
  3124. category: 'tests',
  3125. fn: function (){
  3126. var self=this;
  3127. var characterA,characterU;
  3128. return smalltalk.withContext(function($ctx1) {
  3129. var $1;
  3130. characterA="A";
  3131. characterU="U";
  3132. $1=_st(characterA)._asciiValue();
  3133. $ctx1.sendIdx["asciiValue"]=1;
  3134. self._assert_equals_($1,(65));
  3135. $ctx1.sendIdx["assert:equals:"]=1;
  3136. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  3137. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  3138. args: [],
  3139. 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",
  3140. messageSends: ["assert:equals:", "asciiValue"],
  3141. referencedClasses: []
  3142. }),
  3143. smalltalk.StringTest);
  3144. smalltalk.addMethod(
  3145. smalltalk.method({
  3146. selector: "testAt",
  3147. category: 'tests',
  3148. fn: function (){
  3149. var self=this;
  3150. return smalltalk.withContext(function($ctx1) {
  3151. var $1;
  3152. $1="hello"._at_((1));
  3153. $ctx1.sendIdx["at:"]=1;
  3154. self._assert_equals_($1,"h");
  3155. $ctx1.sendIdx["assert:equals:"]=1;
  3156. self._assert_equals_("hello"._at_((5)),"o");
  3157. $ctx1.sendIdx["assert:equals:"]=2;
  3158. self._assert_equals_("hello"._at_ifAbsent_((6),(function(){
  3159. return smalltalk.withContext(function($ctx2) {
  3160. return nil;
  3161. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),nil);
  3162. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.StringTest)})},
  3163. args: [],
  3164. 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",
  3165. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  3166. referencedClasses: []
  3167. }),
  3168. smalltalk.StringTest);
  3169. smalltalk.addMethod(
  3170. smalltalk.method({
  3171. selector: "testAtPut",
  3172. category: 'tests',
  3173. fn: function (){
  3174. var self=this;
  3175. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3176. return smalltalk.withContext(function($ctx1) {
  3177. self._should_raise_((function(){
  3178. return smalltalk.withContext(function($ctx2) {
  3179. return "hello"._at_put_((1),"a");
  3180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3181. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  3182. args: [],
  3183. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  3184. messageSends: ["should:raise:", "at:put:"],
  3185. referencedClasses: ["Error"]
  3186. }),
  3187. smalltalk.StringTest);
  3188. smalltalk.addMethod(
  3189. smalltalk.method({
  3190. selector: "testCapitalized",
  3191. category: 'tests',
  3192. fn: function (){
  3193. var self=this;
  3194. return smalltalk.withContext(function($ctx1) {
  3195. var $1,$2,$3;
  3196. $1="test"._capitalized();
  3197. $ctx1.sendIdx["capitalized"]=1;
  3198. self._assert_equals_($1,"Test");
  3199. $ctx1.sendIdx["assert:equals:"]=1;
  3200. $2="Test"._capitalized();
  3201. $ctx1.sendIdx["capitalized"]=2;
  3202. self._assert_equals_($2,"Test");
  3203. $ctx1.sendIdx["assert:equals:"]=2;
  3204. self._assert_equals_(""._capitalized(),"");
  3205. $ctx1.sendIdx["assert:equals:"]=3;
  3206. $3="Test"._isCapitalized();
  3207. $ctx1.sendIdx["isCapitalized"]=1;
  3208. self._assert_equals_($3,true);
  3209. $ctx1.sendIdx["assert:equals:"]=4;
  3210. self._assert_equals_("test"._isCapitalized(),false);
  3211. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  3212. args: [],
  3213. 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.",
  3214. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  3215. referencedClasses: []
  3216. }),
  3217. smalltalk.StringTest);
  3218. smalltalk.addMethod(
  3219. smalltalk.method({
  3220. selector: "testCharCodeAt",
  3221. category: 'tests',
  3222. fn: function (){
  3223. var self=this;
  3224. return smalltalk.withContext(function($ctx1) {
  3225. var $1,$2,$3,$4,$5;
  3226. $1="jackie"._charCodeAt_((1));
  3227. $ctx1.sendIdx["charCodeAt:"]=1;
  3228. self._assert_equals_($1,(106));
  3229. $ctx1.sendIdx["assert:equals:"]=1;
  3230. $2="jackie"._charCodeAt_((2));
  3231. $ctx1.sendIdx["charCodeAt:"]=2;
  3232. self._assert_equals_($2,(97));
  3233. $ctx1.sendIdx["assert:equals:"]=2;
  3234. $3="jackie"._charCodeAt_((3));
  3235. $ctx1.sendIdx["charCodeAt:"]=3;
  3236. self._assert_equals_($3,(99));
  3237. $ctx1.sendIdx["assert:equals:"]=3;
  3238. $4="jackie"._charCodeAt_((4));
  3239. $ctx1.sendIdx["charCodeAt:"]=4;
  3240. self._assert_equals_($4,(107));
  3241. $ctx1.sendIdx["assert:equals:"]=4;
  3242. $5="jackie"._charCodeAt_((5));
  3243. $ctx1.sendIdx["charCodeAt:"]=5;
  3244. self._assert_equals_($5,(105));
  3245. $ctx1.sendIdx["assert:equals:"]=5;
  3246. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  3247. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  3248. args: [],
  3249. 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",
  3250. messageSends: ["assert:equals:", "charCodeAt:"],
  3251. referencedClasses: []
  3252. }),
  3253. smalltalk.StringTest);
  3254. smalltalk.addMethod(
  3255. smalltalk.method({
  3256. selector: "testCollect",
  3257. category: 'tests',
  3258. fn: function (){
  3259. var self=this;
  3260. var newCollection;
  3261. return smalltalk.withContext(function($ctx1) {
  3262. newCollection="hheelllloo";
  3263. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  3264. return smalltalk.withContext(function($ctx2) {
  3265. return _st(each).__comma(each);
  3266. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3267. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  3268. args: [],
  3269. 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",
  3270. messageSends: ["assertSameContents:as:", "collect:", "collection", ","],
  3271. referencedClasses: []
  3272. }),
  3273. smalltalk.StringTest);
  3274. smalltalk.addMethod(
  3275. smalltalk.method({
  3276. selector: "testCopyFromTo",
  3277. category: 'tests',
  3278. fn: function (){
  3279. var self=this;
  3280. return smalltalk.withContext(function($ctx1) {
  3281. var $1;
  3282. $1="jackie"._copyFrom_to_((1),(3));
  3283. $ctx1.sendIdx["copyFrom:to:"]=1;
  3284. self._assert_equals_($1,"jac");
  3285. $ctx1.sendIdx["assert:equals:"]=1;
  3286. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  3287. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  3288. args: [],
  3289. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  3290. messageSends: ["assert:equals:", "copyFrom:to:"],
  3291. referencedClasses: []
  3292. }),
  3293. smalltalk.StringTest);
  3294. smalltalk.addMethod(
  3295. smalltalk.method({
  3296. selector: "testCopyWithoutAll",
  3297. category: 'tests',
  3298. fn: function (){
  3299. var self=this;
  3300. return smalltalk.withContext(function($ctx1) {
  3301. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  3302. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  3303. args: [],
  3304. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  3305. messageSends: ["assert:equals:", "copyWithoutAll:"],
  3306. referencedClasses: []
  3307. }),
  3308. smalltalk.StringTest);
  3309. smalltalk.addMethod(
  3310. smalltalk.method({
  3311. selector: "testDetect",
  3312. category: 'tests',
  3313. fn: function (){
  3314. var self=this;
  3315. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3316. return smalltalk.withContext(function($ctx1) {
  3317. var $2,$1;
  3318. $2=self._collection();
  3319. $ctx1.sendIdx["collection"]=1;
  3320. $1=_st($2)._detect_((function(each){
  3321. return smalltalk.withContext(function($ctx2) {
  3322. return _st(each).__eq("h");
  3323. $ctx2.sendIdx["="]=1;
  3324. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  3325. $ctx1.sendIdx["detect:"]=1;
  3326. self._assert_equals_($1,"h");
  3327. self._should_raise_((function(){
  3328. return smalltalk.withContext(function($ctx2) {
  3329. return _st(self._collection())._detect_((function(each){
  3330. return smalltalk.withContext(function($ctx3) {
  3331. return _st(each).__eq((6));
  3332. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  3333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3334. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  3335. args: [],
  3336. 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",
  3337. messageSends: ["assert:equals:", "detect:", "collection", "=", "should:raise:"],
  3338. referencedClasses: ["Error"]
  3339. }),
  3340. smalltalk.StringTest);
  3341. smalltalk.addMethod(
  3342. smalltalk.method({
  3343. selector: "testEquality",
  3344. category: 'tests',
  3345. fn: function (){
  3346. var self=this;
  3347. return smalltalk.withContext(function($ctx1) {
  3348. var $1,$2,$3;
  3349. self._assert_equals_("hello","hello");
  3350. $ctx1.sendIdx["assert:equals:"]=1;
  3351. $1="hello".__eq("world");
  3352. $ctx1.sendIdx["="]=1;
  3353. self._deny_($1);
  3354. $ctx1.sendIdx["deny:"]=1;
  3355. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  3356. return smalltalk.withContext(function($ctx2) {
  3357. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  3358. $ctx1.sendIdx["="]=2;
  3359. self._deny_($2);
  3360. $ctx1.sendIdx["deny:"]=2;
  3361. $3="hello"._yourself();
  3362. $ctx1.sendIdx["yourself"]=1;
  3363. self._assert_equals_("hello",$3);
  3364. $ctx1.sendIdx["assert:equals:"]=2;
  3365. self._assert_equals_("hello"._yourself(),"hello");
  3366. self._deny_("".__eq((0)));
  3367. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  3368. args: [],
  3369. 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",
  3370. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  3371. referencedClasses: []
  3372. }),
  3373. smalltalk.StringTest);
  3374. smalltalk.addMethod(
  3375. smalltalk.method({
  3376. selector: "testIdentity",
  3377. category: 'tests',
  3378. fn: function (){
  3379. var self=this;
  3380. return smalltalk.withContext(function($ctx1) {
  3381. var $1,$2,$4,$3,$5;
  3382. $1="hello".__eq_eq("hello");
  3383. $ctx1.sendIdx["=="]=1;
  3384. self._assert_($1);
  3385. $ctx1.sendIdx["assert:"]=1;
  3386. $2="hello".__eq_eq("world");
  3387. $ctx1.sendIdx["=="]=2;
  3388. self._deny_($2);
  3389. $ctx1.sendIdx["deny:"]=1;
  3390. $4="hello"._yourself();
  3391. $ctx1.sendIdx["yourself"]=1;
  3392. $3="hello".__eq_eq($4);
  3393. $ctx1.sendIdx["=="]=3;
  3394. self._assert_($3);
  3395. $ctx1.sendIdx["assert:"]=2;
  3396. $5=_st("hello"._yourself()).__eq_eq("hello");
  3397. $ctx1.sendIdx["=="]=4;
  3398. self._assert_($5);
  3399. self._deny_("".__eq_eq((0)));
  3400. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  3401. args: [],
  3402. 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",
  3403. messageSends: ["assert:", "==", "deny:", "yourself"],
  3404. referencedClasses: []
  3405. }),
  3406. smalltalk.StringTest);
  3407. smalltalk.addMethod(
  3408. smalltalk.method({
  3409. selector: "testIdentityHash",
  3410. category: 'tests',
  3411. fn: function (){
  3412. var self=this;
  3413. return smalltalk.withContext(function($ctx1) {
  3414. var $1,$2,$4,$3;
  3415. $1="foo"._identityHash();
  3416. $ctx1.sendIdx["identityHash"]=1;
  3417. $2="foo"._identityHash();
  3418. $ctx1.sendIdx["identityHash"]=2;
  3419. self._assert_equals_($1,$2);
  3420. $4="foo"._identityHash();
  3421. $ctx1.sendIdx["identityHash"]=3;
  3422. $3=_st($4).__eq("bar"._identityHash());
  3423. self._deny_($3);
  3424. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  3425. args: [],
  3426. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  3427. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  3428. referencedClasses: []
  3429. }),
  3430. smalltalk.StringTest);
  3431. smalltalk.addMethod(
  3432. smalltalk.method({
  3433. selector: "testIncludesSubString",
  3434. category: 'tests',
  3435. fn: function (){
  3436. var self=this;
  3437. return smalltalk.withContext(function($ctx1) {
  3438. var $1;
  3439. $1="amber"._includesSubString_("ber");
  3440. $ctx1.sendIdx["includesSubString:"]=1;
  3441. self._assert_($1);
  3442. self._deny_("amber"._includesSubString_("zork"));
  3443. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  3444. args: [],
  3445. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  3446. messageSends: ["assert:", "includesSubString:", "deny:"],
  3447. referencedClasses: []
  3448. }),
  3449. smalltalk.StringTest);
  3450. smalltalk.addMethod(
  3451. smalltalk.method({
  3452. selector: "testIndexOf",
  3453. category: 'tests',
  3454. fn: function (){
  3455. var self=this;
  3456. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3457. return smalltalk.withContext(function($ctx1) {
  3458. var $2,$1,$3;
  3459. $2=self._collection();
  3460. $ctx1.sendIdx["collection"]=1;
  3461. $1=_st($2)._indexOf_("e");
  3462. $ctx1.sendIdx["indexOf:"]=1;
  3463. self._assert_equals_($1,(2));
  3464. $ctx1.sendIdx["assert:equals:"]=1;
  3465. self._should_raise_((function(){
  3466. return smalltalk.withContext(function($ctx2) {
  3467. $3=self._collection();
  3468. $ctx2.sendIdx["collection"]=2;
  3469. return _st($3)._indexOf_((999));
  3470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3471. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  3472. return smalltalk.withContext(function($ctx2) {
  3473. return "sentinel";
  3474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  3475. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.StringTest)})},
  3476. args: [],
  3477. 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'",
  3478. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  3479. referencedClasses: ["Error"]
  3480. }),
  3481. smalltalk.StringTest);
  3482. smalltalk.addMethod(
  3483. smalltalk.method({
  3484. selector: "testIsVowel",
  3485. category: 'tests',
  3486. fn: function (){
  3487. var self=this;
  3488. var vowel,consonant;
  3489. return smalltalk.withContext(function($ctx1) {
  3490. var $1;
  3491. vowel="u";
  3492. consonant="z";
  3493. $1=_st(vowel)._isVowel();
  3494. $ctx1.sendIdx["isVowel"]=1;
  3495. self._assert_equals_($1,true);
  3496. $ctx1.sendIdx["assert:equals:"]=1;
  3497. self._assert_equals_(_st(consonant)._isVowel(),false);
  3498. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  3499. args: [],
  3500. 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",
  3501. messageSends: ["assert:equals:", "isVowel"],
  3502. referencedClasses: []
  3503. }),
  3504. smalltalk.StringTest);
  3505. smalltalk.addMethod(
  3506. smalltalk.method({
  3507. selector: "testJoin",
  3508. category: 'tests',
  3509. fn: function (){
  3510. var self=this;
  3511. return smalltalk.withContext(function($ctx1) {
  3512. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  3513. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  3514. args: [],
  3515. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  3516. messageSends: ["assert:equals:", "join:"],
  3517. referencedClasses: []
  3518. }),
  3519. smalltalk.StringTest);
  3520. smalltalk.addMethod(
  3521. smalltalk.method({
  3522. selector: "testRemoveAll",
  3523. category: 'tests',
  3524. fn: function (){
  3525. var self=this;
  3526. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3527. return smalltalk.withContext(function($ctx1) {
  3528. self._should_raise_((function(){
  3529. return smalltalk.withContext(function($ctx2) {
  3530. return _st(self._collection())._removeAll();
  3531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3532. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  3533. args: [],
  3534. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  3535. messageSends: ["should:raise:", "removeAll", "collection"],
  3536. referencedClasses: ["Error"]
  3537. }),
  3538. smalltalk.StringTest);
  3539. smalltalk.addMethod(
  3540. smalltalk.method({
  3541. selector: "testReversed",
  3542. category: 'tests',
  3543. fn: function (){
  3544. var self=this;
  3545. return smalltalk.withContext(function($ctx1) {
  3546. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  3547. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  3548. args: [],
  3549. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  3550. messageSends: ["assert:equals:", "reversed"],
  3551. referencedClasses: []
  3552. }),
  3553. smalltalk.StringTest);
  3554. smalltalk.addMethod(
  3555. smalltalk.method({
  3556. selector: "testSelect",
  3557. category: 'tests',
  3558. fn: function (){
  3559. var self=this;
  3560. var newCollection;
  3561. return smalltalk.withContext(function($ctx1) {
  3562. newCollection="o";
  3563. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  3564. return smalltalk.withContext(function($ctx2) {
  3565. return _st(each).__eq("o");
  3566. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3567. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  3568. args: [],
  3569. 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",
  3570. messageSends: ["assertSameContents:as:", "select:", "collection", "="],
  3571. referencedClasses: []
  3572. }),
  3573. smalltalk.StringTest);
  3574. smalltalk.addMethod(
  3575. smalltalk.method({
  3576. selector: "testSize",
  3577. category: 'tests',
  3578. fn: function (){
  3579. var self=this;
  3580. return smalltalk.withContext(function($ctx1) {
  3581. var $1;
  3582. $1="smalltalk"._size();
  3583. $ctx1.sendIdx["size"]=1;
  3584. self._assert_equals_($1,(9));
  3585. $ctx1.sendIdx["assert:equals:"]=1;
  3586. self._assert_equals_(""._size(),(0));
  3587. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  3588. args: [],
  3589. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  3590. messageSends: ["assert:equals:", "size"],
  3591. referencedClasses: []
  3592. }),
  3593. smalltalk.StringTest);
  3594. smalltalk.addMethod(
  3595. smalltalk.method({
  3596. selector: "testStreamContents",
  3597. category: 'tests',
  3598. fn: function (){
  3599. var self=this;
  3600. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3601. return smalltalk.withContext(function($ctx1) {
  3602. var $1;
  3603. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  3604. return smalltalk.withContext(function($ctx2) {
  3605. _st(aStream)._nextPutAll_("hello");
  3606. $ctx2.sendIdx["nextPutAll:"]=1;
  3607. _st(aStream)._space();
  3608. $1=_st(aStream)._nextPutAll_("world");
  3609. return $1;
  3610. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  3611. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  3612. args: [],
  3613. 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'",
  3614. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  3615. referencedClasses: ["String"]
  3616. }),
  3617. smalltalk.StringTest);
  3618. smalltalk.addMethod(
  3619. smalltalk.method({
  3620. selector: "testSubStrings",
  3621. category: 'tests',
  3622. fn: function (){
  3623. var self=this;
  3624. return smalltalk.withContext(function($ctx1) {
  3625. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  3626. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  3627. args: [],
  3628. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  3629. messageSends: ["assert:equals:", "subStrings:"],
  3630. referencedClasses: []
  3631. }),
  3632. smalltalk.StringTest);
  3633. smalltalk.addMethod(
  3634. smalltalk.method({
  3635. selector: "testTrim",
  3636. category: 'tests',
  3637. fn: function (){
  3638. var self=this;
  3639. return smalltalk.withContext(function($ctx1) {
  3640. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  3641. $ctx1.sendIdx["assert:equals:"]=1;
  3642. self._assert_equals_("jackie "._trimRight(),"jackie");
  3643. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  3644. args: [],
  3645. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  3646. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  3647. referencedClasses: []
  3648. }),
  3649. smalltalk.StringTest);
  3650. smalltalk.addMethod(
  3651. smalltalk.method({
  3652. selector: "collectionClass",
  3653. category: 'accessing',
  3654. fn: function (){
  3655. var self=this;
  3656. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3657. return smalltalk.withContext(function($ctx1) {
  3658. return $String();
  3659. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  3660. args: [],
  3661. source: "collectionClass\x0a\x09^ String",
  3662. messageSends: [],
  3663. referencedClasses: ["String"]
  3664. }),
  3665. smalltalk.StringTest.klass);
  3666. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3667. smalltalk.addMethod(
  3668. smalltalk.method({
  3669. selector: "testShow",
  3670. category: 'tests',
  3671. fn: function (){
  3672. var self=this;
  3673. var originalTranscript;
  3674. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  3675. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  3676. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3677. return smalltalk.withContext(function($ctx1) {
  3678. originalTranscript=_st($Transcript())._current();
  3679. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  3680. $ctx1.sendIdx["register:"]=1;
  3681. self._shouldnt_raise_((function(){
  3682. return smalltalk.withContext(function($ctx2) {
  3683. return _st($Transcript())._show_("Hello console!");
  3684. $ctx2.sendIdx["show:"]=1;
  3685. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3686. $ctx1.sendIdx["shouldnt:raise:"]=1;
  3687. self._shouldnt_raise_((function(){
  3688. return smalltalk.withContext(function($ctx2) {
  3689. return _st($Transcript())._show_(console);
  3690. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3691. _st($Transcript())._register_(originalTranscript);
  3692. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  3693. args: [],
  3694. 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.",
  3695. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  3696. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  3697. }),
  3698. smalltalk.ConsoleTranscriptTest);
  3699. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3700. smalltalk.addMethod(
  3701. smalltalk.method({
  3702. selector: "jsObject",
  3703. category: 'accessing',
  3704. fn: function (){
  3705. var self=this;
  3706. return smalltalk.withContext(function($ctx1) {
  3707. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  3708. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  3709. args: [],
  3710. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  3711. messageSends: [],
  3712. referencedClasses: []
  3713. }),
  3714. smalltalk.JSObjectProxyTest);
  3715. smalltalk.addMethod(
  3716. smalltalk.method({
  3717. selector: "testAtIfAbsent",
  3718. category: 'tests',
  3719. fn: function (){
  3720. var self=this;
  3721. var testObject;
  3722. return smalltalk.withContext(function($ctx1) {
  3723. var $1,$2,$3;
  3724. testObject=self._jsObject();
  3725. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  3726. return smalltalk.withContext(function($ctx2) {
  3727. return "Property does not exist";
  3728. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3729. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3730. self._assert_equals_($1,"Property does not exist");
  3731. $ctx1.sendIdx["assert:equals:"]=1;
  3732. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  3733. return smalltalk.withContext(function($ctx2) {
  3734. return "Property does not exist";
  3735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3736. $ctx1.sendIdx["at:ifAbsent:"]=2;
  3737. self._assert_equals_($2,nil);
  3738. $ctx1.sendIdx["assert:equals:"]=2;
  3739. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  3740. return smalltalk.withContext(function($ctx2) {
  3741. return "Property does not exist";
  3742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  3743. $ctx1.sendIdx["at:ifAbsent:"]=3;
  3744. self._assert_equals_($3,(1));
  3745. $ctx1.sendIdx["assert:equals:"]=3;
  3746. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  3747. return smalltalk.withContext(function($ctx2) {
  3748. return "Property does not exist";
  3749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  3750. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3751. args: [],
  3752. 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.",
  3753. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  3754. referencedClasses: []
  3755. }),
  3756. smalltalk.JSObjectProxyTest);
  3757. smalltalk.addMethod(
  3758. smalltalk.method({
  3759. selector: "testAtIfPresent",
  3760. category: 'tests',
  3761. fn: function (){
  3762. var self=this;
  3763. var testObject;
  3764. return smalltalk.withContext(function($ctx1) {
  3765. var $2,$1,$4,$3,$6,$5;
  3766. testObject=self._jsObject();
  3767. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  3768. return smalltalk.withContext(function($ctx2) {
  3769. $2=_st(x)._asString();
  3770. $ctx2.sendIdx["asString"]=1;
  3771. return "hello ".__comma($2);
  3772. $ctx2.sendIdx[","]=1;
  3773. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  3774. $ctx1.sendIdx["at:ifPresent:"]=1;
  3775. self._assert_equals_($1,nil);
  3776. $ctx1.sendIdx["assert:equals:"]=1;
  3777. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  3778. return smalltalk.withContext(function($ctx2) {
  3779. $4=_st(x)._asString();
  3780. $ctx2.sendIdx["asString"]=2;
  3781. return "hello ".__comma($4);
  3782. $ctx2.sendIdx[","]=2;
  3783. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  3784. $ctx1.sendIdx["at:ifPresent:"]=2;
  3785. self._assert_equals_($3,"hello nil");
  3786. $ctx1.sendIdx["assert:equals:"]=2;
  3787. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  3788. return smalltalk.withContext(function($ctx2) {
  3789. $6=_st(x)._asString();
  3790. $ctx2.sendIdx["asString"]=3;
  3791. return "hello ".__comma($6);
  3792. $ctx2.sendIdx[","]=3;
  3793. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  3794. $ctx1.sendIdx["at:ifPresent:"]=3;
  3795. self._assert_equals_($5,"hello 1");
  3796. $ctx1.sendIdx["assert:equals:"]=3;
  3797. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  3798. return smalltalk.withContext(function($ctx2) {
  3799. return "hello ".__comma(_st(x)._asString());
  3800. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  3801. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3802. args: [],
  3803. 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'.",
  3804. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  3805. referencedClasses: []
  3806. }),
  3807. smalltalk.JSObjectProxyTest);
  3808. smalltalk.addMethod(
  3809. smalltalk.method({
  3810. selector: "testAtIfPresentIfAbsent",
  3811. category: 'tests',
  3812. fn: function (){
  3813. var self=this;
  3814. var testObject;
  3815. return smalltalk.withContext(function($ctx1) {
  3816. var $2,$1,$4,$3,$6,$5;
  3817. testObject=self._jsObject();
  3818. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  3819. return smalltalk.withContext(function($ctx2) {
  3820. $2=_st(x)._asString();
  3821. $ctx2.sendIdx["asString"]=1;
  3822. return "hello ".__comma($2);
  3823. $ctx2.sendIdx[","]=1;
  3824. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  3825. return smalltalk.withContext(function($ctx2) {
  3826. return "not present";
  3827. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3828. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  3829. self._assert_equals_($1,"not present");
  3830. $ctx1.sendIdx["assert:equals:"]=1;
  3831. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  3832. return smalltalk.withContext(function($ctx2) {
  3833. $4=_st(x)._asString();
  3834. $ctx2.sendIdx["asString"]=2;
  3835. return "hello ".__comma($4);
  3836. $ctx2.sendIdx[","]=2;
  3837. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  3838. return smalltalk.withContext(function($ctx2) {
  3839. return "not present";
  3840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  3841. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  3842. self._assert_equals_($3,"hello nil");
  3843. $ctx1.sendIdx["assert:equals:"]=2;
  3844. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  3845. return smalltalk.withContext(function($ctx2) {
  3846. $6=_st(x)._asString();
  3847. $ctx2.sendIdx["asString"]=3;
  3848. return "hello ".__comma($6);
  3849. $ctx2.sendIdx[","]=3;
  3850. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  3851. return smalltalk.withContext(function($ctx2) {
  3852. return "not present";
  3853. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  3854. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  3855. self._assert_equals_($5,"hello 1");
  3856. $ctx1.sendIdx["assert:equals:"]=3;
  3857. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  3858. return smalltalk.withContext(function($ctx2) {
  3859. return "hello ".__comma(_st(x)._asString());
  3860. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  3861. return smalltalk.withContext(function($ctx2) {
  3862. return "not present";
  3863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  3864. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3865. args: [],
  3866. 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'.",
  3867. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  3868. referencedClasses: []
  3869. }),
  3870. smalltalk.JSObjectProxyTest);
  3871. smalltalk.addMethod(
  3872. smalltalk.method({
  3873. selector: "testDNU",
  3874. category: 'tests',
  3875. fn: function (){
  3876. var self=this;
  3877. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3878. return smalltalk.withContext(function($ctx1) {
  3879. self._should_raise_((function(){
  3880. return smalltalk.withContext(function($ctx2) {
  3881. return _st(self._jsObject())._foo();
  3882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3883. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  3884. args: [],
  3885. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  3886. messageSends: ["should:raise:", "foo", "jsObject"],
  3887. referencedClasses: ["MessageNotUnderstood"]
  3888. }),
  3889. smalltalk.JSObjectProxyTest);
  3890. smalltalk.addMethod(
  3891. smalltalk.method({
  3892. selector: "testMessageSend",
  3893. category: 'tests',
  3894. fn: function (){
  3895. var self=this;
  3896. return smalltalk.withContext(function($ctx1) {
  3897. var $2,$1,$4,$3;
  3898. $2=self._jsObject();
  3899. $ctx1.sendIdx["jsObject"]=1;
  3900. $1=_st($2)._a();
  3901. self._assert_equals_($1,(1));
  3902. $ctx1.sendIdx["assert:equals:"]=1;
  3903. $4=self._jsObject();
  3904. $ctx1.sendIdx["jsObject"]=2;
  3905. $3=_st($4)._b();
  3906. self._assert_equals_($3,(2));
  3907. $ctx1.sendIdx["assert:equals:"]=2;
  3908. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  3909. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  3910. args: [],
  3911. 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",
  3912. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  3913. referencedClasses: []
  3914. }),
  3915. smalltalk.JSObjectProxyTest);
  3916. smalltalk.addMethod(
  3917. smalltalk.method({
  3918. selector: "testMethodWithArguments",
  3919. category: 'tests',
  3920. fn: function (){
  3921. var self=this;
  3922. return smalltalk.withContext(function($ctx1) {
  3923. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  3924. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  3925. args: [],
  3926. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  3927. messageSends: ["assert:equals:", "c:", "jsObject"],
  3928. referencedClasses: []
  3929. }),
  3930. smalltalk.JSObjectProxyTest);
  3931. smalltalk.addMethod(
  3932. smalltalk.method({
  3933. selector: "testPrinting",
  3934. category: 'tests',
  3935. fn: function (){
  3936. var self=this;
  3937. return smalltalk.withContext(function($ctx1) {
  3938. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  3939. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  3940. args: [],
  3941. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  3942. messageSends: ["assert:equals:", "printString", "jsObject"],
  3943. referencedClasses: []
  3944. }),
  3945. smalltalk.JSObjectProxyTest);
  3946. smalltalk.addMethod(
  3947. smalltalk.method({
  3948. selector: "testPropertyThatReturnsEmptyString",
  3949. category: 'tests',
  3950. fn: function (){
  3951. var self=this;
  3952. var object;
  3953. return smalltalk.withContext(function($ctx1) {
  3954. var $1;
  3955. object=self._jsObject();
  3956. $1=_st(object)._d();
  3957. $ctx1.sendIdx["d"]=1;
  3958. self._assert_equals_($1,"");
  3959. $ctx1.sendIdx["assert:equals:"]=1;
  3960. _st(object)._d_("hello");
  3961. self._assert_equals_(_st(object)._d(),"hello");
  3962. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  3963. args: [],
  3964. 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'",
  3965. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  3966. referencedClasses: []
  3967. }),
  3968. smalltalk.JSObjectProxyTest);
  3969. smalltalk.addMethod(
  3970. smalltalk.method({
  3971. selector: "testPropertyThatReturnsUndefined",
  3972. category: 'tests',
  3973. fn: function (){
  3974. var self=this;
  3975. var object;
  3976. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3977. return smalltalk.withContext(function($ctx1) {
  3978. object=self._jsObject();
  3979. self._shouldnt_raise_((function(){
  3980. return smalltalk.withContext(function($ctx2) {
  3981. return _st(object)._e();
  3982. $ctx2.sendIdx["e"]=1;
  3983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3984. self._assert_(_st(_st(object)._e())._isNil());
  3985. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  3986. args: [],
  3987. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  3988. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  3989. referencedClasses: ["MessageNotUnderstood"]
  3990. }),
  3991. smalltalk.JSObjectProxyTest);
  3992. smalltalk.addMethod(
  3993. smalltalk.method({
  3994. selector: "testValue",
  3995. category: 'tests',
  3996. fn: function (){
  3997. var self=this;
  3998. var testObject;
  3999. return smalltalk.withContext(function($ctx1) {
  4000. var $2,$1;
  4001. testObject=self._jsObject();
  4002. $2=_st(testObject)._value();
  4003. $ctx1.sendIdx["value"]=1;
  4004. $1=_st($2)._printString();
  4005. self._assert_equals_($1,"[object Object]");
  4006. $ctx1.sendIdx["assert:equals:"]=1;
  4007. _st(testObject)._at_put_("value","aValue");
  4008. self._assert_equals_(_st(testObject)._value(),"aValue");
  4009. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4010. args: [],
  4011. 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'",
  4012. messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"],
  4013. referencedClasses: []
  4014. }),
  4015. smalltalk.JSObjectProxyTest);
  4016. smalltalk.addMethod(
  4017. smalltalk.method({
  4018. selector: "testYourself",
  4019. category: 'tests',
  4020. fn: function (){
  4021. var self=this;
  4022. var object;
  4023. return smalltalk.withContext(function($ctx1) {
  4024. var $1,$2;
  4025. $1=self._jsObject();
  4026. _st($1)._d_("test");
  4027. $2=_st($1)._yourself();
  4028. object=$2;
  4029. self._assert_equals_(_st(object)._d(),"test");
  4030. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  4031. args: [],
  4032. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  4033. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  4034. referencedClasses: []
  4035. }),
  4036. smalltalk.JSObjectProxyTest);
  4037. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4038. smalltalk.addMethod(
  4039. smalltalk.method({
  4040. selector: "testCatchingException",
  4041. category: 'tests',
  4042. fn: function (){
  4043. var self=this;
  4044. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4045. return smalltalk.withContext(function($ctx1) {
  4046. _st((function(){
  4047. return smalltalk.withContext(function($ctx2) {
  4048. return self._throwException();
  4049. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  4050. return smalltalk.withContext(function($ctx2) {
  4051. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  4052. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  4053. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  4054. args: [],
  4055. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  4056. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  4057. referencedClasses: ["Error"]
  4058. }),
  4059. smalltalk.JavaScriptExceptionTest);
  4060. smalltalk.addMethod(
  4061. smalltalk.method({
  4062. selector: "testRaisingException",
  4063. category: 'tests',
  4064. fn: function (){
  4065. var self=this;
  4066. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  4067. return smalltalk.withContext(function($ctx1) {
  4068. self._should_raise_((function(){
  4069. return smalltalk.withContext(function($ctx2) {
  4070. return self._throwException();
  4071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  4072. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  4073. args: [],
  4074. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  4075. messageSends: ["should:raise:", "throwException"],
  4076. referencedClasses: ["JavaScriptException"]
  4077. }),
  4078. smalltalk.JavaScriptExceptionTest);
  4079. smalltalk.addMethod(
  4080. smalltalk.method({
  4081. selector: "throwException",
  4082. category: 'helpers',
  4083. fn: function (){
  4084. var self=this;
  4085. return smalltalk.withContext(function($ctx1) {
  4086. throw 'test';
  4087. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  4088. args: [],
  4089. source: "throwException\x0a\x09<throw 'test'>",
  4090. messageSends: [],
  4091. referencedClasses: []
  4092. }),
  4093. smalltalk.JavaScriptExceptionTest);
  4094. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4095. smalltalk.addMethod(
  4096. smalltalk.method({
  4097. selector: "testValue",
  4098. category: 'tests',
  4099. fn: function (){
  4100. var self=this;
  4101. var messageSend;
  4102. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4103. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4104. return smalltalk.withContext(function($ctx1) {
  4105. var $1,$2;
  4106. $1=_st($MessageSend())._new();
  4107. $ctx1.sendIdx["new"]=1;
  4108. _st($1)._receiver_(_st($Object())._new());
  4109. _st($1)._selector_("asString");
  4110. $2=_st($1)._yourself();
  4111. messageSend=$2;
  4112. self._assert_equals_(_st(messageSend)._value(),"an Object");
  4113. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4114. args: [],
  4115. 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'",
  4116. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  4117. referencedClasses: ["MessageSend", "Object"]
  4118. }),
  4119. smalltalk.MessageSendTest);
  4120. smalltalk.addMethod(
  4121. smalltalk.method({
  4122. selector: "testValueWithArguments",
  4123. category: 'tests',
  4124. fn: function (){
  4125. var self=this;
  4126. var messageSend;
  4127. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4128. return smalltalk.withContext(function($ctx1) {
  4129. var $1,$2;
  4130. $1=_st($MessageSend())._new();
  4131. _st($1)._receiver_((2));
  4132. _st($1)._selector_("+");
  4133. $2=_st($1)._yourself();
  4134. messageSend=$2;
  4135. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  4136. $ctx1.sendIdx["assert:equals:"]=1;
  4137. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  4138. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4139. args: [],
  4140. 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",
  4141. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  4142. referencedClasses: ["MessageSend"]
  4143. }),
  4144. smalltalk.MessageSendTest);
  4145. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  4146. smalltalk.addMethod(
  4147. smalltalk.method({
  4148. selector: "codeGeneratorClass",
  4149. category: 'accessing',
  4150. fn: function (){
  4151. var self=this;
  4152. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  4153. return smalltalk.withContext(function($ctx1) {
  4154. return $CodeGenerator();
  4155. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  4156. args: [],
  4157. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  4158. messageSends: [],
  4159. referencedClasses: ["CodeGenerator"]
  4160. }),
  4161. smalltalk.MethodInheritanceTest);
  4162. smalltalk.addMethod(
  4163. smalltalk.method({
  4164. selector: "compiler",
  4165. category: 'factory',
  4166. fn: function (){
  4167. var self=this;
  4168. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  4169. return smalltalk.withContext(function($ctx1) {
  4170. var $2,$3,$1;
  4171. $2=_st($Compiler())._new();
  4172. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  4173. $3=_st($2)._yourself();
  4174. $1=$3;
  4175. return $1;
  4176. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  4177. args: [],
  4178. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  4179. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  4180. referencedClasses: ["Compiler"]
  4181. }),
  4182. smalltalk.MethodInheritanceTest);
  4183. smalltalk.addMethod(
  4184. smalltalk.method({
  4185. selector: "deinstallBottom",
  4186. category: 'testing',
  4187. fn: function (){
  4188. var self=this;
  4189. return smalltalk.withContext(function($ctx1) {
  4190. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  4191. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  4192. args: [],
  4193. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  4194. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  4195. referencedClasses: []
  4196. }),
  4197. smalltalk.MethodInheritanceTest);
  4198. smalltalk.addMethod(
  4199. smalltalk.method({
  4200. selector: "deinstallMiddle",
  4201. category: 'testing',
  4202. fn: function (){
  4203. var self=this;
  4204. return smalltalk.withContext(function($ctx1) {
  4205. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  4206. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  4207. args: [],
  4208. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  4209. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  4210. referencedClasses: []
  4211. }),
  4212. smalltalk.MethodInheritanceTest);
  4213. smalltalk.addMethod(
  4214. smalltalk.method({
  4215. selector: "deinstallTop",
  4216. category: 'testing',
  4217. fn: function (){
  4218. var self=this;
  4219. return smalltalk.withContext(function($ctx1) {
  4220. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  4221. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  4222. args: [],
  4223. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  4224. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  4225. referencedClasses: []
  4226. }),
  4227. smalltalk.MethodInheritanceTest);
  4228. smalltalk.addMethod(
  4229. smalltalk.method({
  4230. selector: "installBottom:",
  4231. category: 'testing',
  4232. fn: function (aString){
  4233. var self=this;
  4234. return smalltalk.withContext(function($ctx1) {
  4235. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassBottom(),"tests");
  4236. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4237. args: ["aString"],
  4238. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom category: 'tests'",
  4239. messageSends: ["install:forClass:category:", "compiler", "targetClassBottom"],
  4240. referencedClasses: []
  4241. }),
  4242. smalltalk.MethodInheritanceTest);
  4243. smalltalk.addMethod(
  4244. smalltalk.method({
  4245. selector: "installMiddle:",
  4246. category: 'testing',
  4247. fn: function (aString){
  4248. var self=this;
  4249. return smalltalk.withContext(function($ctx1) {
  4250. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassMiddle(),"tests");
  4251. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4252. args: ["aString"],
  4253. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle category: 'tests'",
  4254. messageSends: ["install:forClass:category:", "compiler", "targetClassMiddle"],
  4255. referencedClasses: []
  4256. }),
  4257. smalltalk.MethodInheritanceTest);
  4258. smalltalk.addMethod(
  4259. smalltalk.method({
  4260. selector: "installTop:",
  4261. category: 'testing',
  4262. fn: function (aString){
  4263. var self=this;
  4264. return smalltalk.withContext(function($ctx1) {
  4265. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassTop(),"tests");
  4266. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4267. args: ["aString"],
  4268. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop category: 'tests'",
  4269. messageSends: ["install:forClass:category:", "compiler", "targetClassTop"],
  4270. referencedClasses: []
  4271. }),
  4272. smalltalk.MethodInheritanceTest);
  4273. smalltalk.addMethod(
  4274. smalltalk.method({
  4275. selector: "setUp",
  4276. category: 'initialization',
  4277. fn: function (){
  4278. var self=this;
  4279. return smalltalk.withContext(function($ctx1) {
  4280. self["@receiverTop"]=_st(self._targetClassTop())._new();
  4281. $ctx1.sendIdx["new"]=1;
  4282. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  4283. $ctx1.sendIdx["new"]=2;
  4284. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  4285. self["@method"]=nil;
  4286. self["@performBlock"]=(function(){
  4287. return smalltalk.withContext(function($ctx2) {
  4288. return self._error_("performBlock not initialized");
  4289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  4290. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  4291. args: [],
  4292. 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' ]",
  4293. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  4294. referencedClasses: []
  4295. }),
  4296. smalltalk.MethodInheritanceTest);
  4297. smalltalk.addMethod(
  4298. smalltalk.method({
  4299. selector: "shouldMNU",
  4300. category: 'testing',
  4301. fn: function (){
  4302. var self=this;
  4303. return smalltalk.withContext(function($ctx1) {
  4304. self._shouldMNUTop();
  4305. self._shouldMNUMiddle();
  4306. self._shouldMNUBottom();
  4307. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  4308. args: [],
  4309. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  4310. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  4311. referencedClasses: []
  4312. }),
  4313. smalltalk.MethodInheritanceTest);
  4314. smalltalk.addMethod(
  4315. smalltalk.method({
  4316. selector: "shouldMNUBottom",
  4317. category: 'testing',
  4318. fn: function (){
  4319. var self=this;
  4320. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4321. return smalltalk.withContext(function($ctx1) {
  4322. self._should_raise_((function(){
  4323. return smalltalk.withContext(function($ctx2) {
  4324. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4326. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  4327. args: [],
  4328. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  4329. messageSends: ["should:raise:", "value:"],
  4330. referencedClasses: ["MessageNotUnderstood"]
  4331. }),
  4332. smalltalk.MethodInheritanceTest);
  4333. smalltalk.addMethod(
  4334. smalltalk.method({
  4335. selector: "shouldMNUMiddle",
  4336. category: 'testing',
  4337. fn: function (){
  4338. var self=this;
  4339. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4340. return smalltalk.withContext(function($ctx1) {
  4341. self._should_raise_((function(){
  4342. return smalltalk.withContext(function($ctx2) {
  4343. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4345. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  4346. args: [],
  4347. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  4348. messageSends: ["should:raise:", "value:"],
  4349. referencedClasses: ["MessageNotUnderstood"]
  4350. }),
  4351. smalltalk.MethodInheritanceTest);
  4352. smalltalk.addMethod(
  4353. smalltalk.method({
  4354. selector: "shouldMNUTop",
  4355. category: 'testing',
  4356. fn: function (){
  4357. var self=this;
  4358. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4359. return smalltalk.withContext(function($ctx1) {
  4360. self._should_raise_((function(){
  4361. return smalltalk.withContext(function($ctx2) {
  4362. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  4363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4364. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  4365. args: [],
  4366. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  4367. messageSends: ["should:raise:", "value:"],
  4368. referencedClasses: ["MessageNotUnderstood"]
  4369. }),
  4370. smalltalk.MethodInheritanceTest);
  4371. smalltalk.addMethod(
  4372. smalltalk.method({
  4373. selector: "shouldReturn:",
  4374. category: 'testing',
  4375. fn: function (anObject){
  4376. var self=this;
  4377. var result;
  4378. return smalltalk.withContext(function($ctx1) {
  4379. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4380. $ctx1.sendIdx["value:"]=1;
  4381. self._assert_equals_(["top",anObject],["top",result]);
  4382. $ctx1.sendIdx["assert:equals:"]=1;
  4383. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4384. $ctx1.sendIdx["value:"]=2;
  4385. self._assert_equals_(["middle",anObject],["middle",result]);
  4386. $ctx1.sendIdx["assert:equals:"]=2;
  4387. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4388. self._assert_equals_(["bottom",anObject],["bottom",result]);
  4389. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  4390. args: ["anObject"],
  4391. 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 }",
  4392. messageSends: ["value:", "assert:equals:"],
  4393. referencedClasses: []
  4394. }),
  4395. smalltalk.MethodInheritanceTest);
  4396. smalltalk.addMethod(
  4397. smalltalk.method({
  4398. selector: "shouldReturn:and:and:",
  4399. category: 'testing',
  4400. fn: function (anObject,anObject2,anObject3){
  4401. var self=this;
  4402. var result;
  4403. return smalltalk.withContext(function($ctx1) {
  4404. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4405. $ctx1.sendIdx["value:"]=1;
  4406. self._assert_equals_(["top",anObject],["top",result]);
  4407. $ctx1.sendIdx["assert:equals:"]=1;
  4408. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4409. $ctx1.sendIdx["value:"]=2;
  4410. self._assert_equals_(["middle",anObject2],["middle",result]);
  4411. $ctx1.sendIdx["assert:equals:"]=2;
  4412. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4413. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  4414. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  4415. args: ["anObject", "anObject2", "anObject3"],
  4416. 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 }",
  4417. messageSends: ["value:", "assert:equals:"],
  4418. referencedClasses: []
  4419. }),
  4420. smalltalk.MethodInheritanceTest);
  4421. smalltalk.addMethod(
  4422. smalltalk.method({
  4423. selector: "targetClassBottom",
  4424. category: 'accessing',
  4425. fn: function (){
  4426. var self=this;
  4427. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  4428. return smalltalk.withContext(function($ctx1) {
  4429. return $JavaScriptException();
  4430. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  4431. args: [],
  4432. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  4433. messageSends: [],
  4434. referencedClasses: ["JavaScriptException"]
  4435. }),
  4436. smalltalk.MethodInheritanceTest);
  4437. smalltalk.addMethod(
  4438. smalltalk.method({
  4439. selector: "targetClassMiddle",
  4440. category: 'accessing',
  4441. fn: function (){
  4442. var self=this;
  4443. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4444. return smalltalk.withContext(function($ctx1) {
  4445. return $Error();
  4446. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  4447. args: [],
  4448. source: "targetClassMiddle\x0a\x09^ Error",
  4449. messageSends: [],
  4450. referencedClasses: ["Error"]
  4451. }),
  4452. smalltalk.MethodInheritanceTest);
  4453. smalltalk.addMethod(
  4454. smalltalk.method({
  4455. selector: "targetClassTop",
  4456. category: 'accessing',
  4457. fn: function (){
  4458. var self=this;
  4459. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4460. return smalltalk.withContext(function($ctx1) {
  4461. return $Object();
  4462. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  4463. args: [],
  4464. source: "targetClassTop\x0a\x09^ Object",
  4465. messageSends: [],
  4466. referencedClasses: ["Object"]
  4467. }),
  4468. smalltalk.MethodInheritanceTest);
  4469. smalltalk.addMethod(
  4470. smalltalk.method({
  4471. selector: "tearDown",
  4472. category: 'initialization',
  4473. fn: function (){
  4474. var self=this;
  4475. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4476. return smalltalk.withContext(function($ctx1) {
  4477. _st((function(){
  4478. return smalltalk.withContext(function($ctx2) {
  4479. return self._deinstallTop();
  4480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  4481. return smalltalk.withContext(function($ctx2) {
  4482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4483. $ctx1.sendIdx["on:do:"]=1;
  4484. _st((function(){
  4485. return smalltalk.withContext(function($ctx2) {
  4486. return self._deinstallMiddle();
  4487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  4488. return smalltalk.withContext(function($ctx2) {
  4489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4490. $ctx1.sendIdx["on:do:"]=2;
  4491. _st((function(){
  4492. return smalltalk.withContext(function($ctx2) {
  4493. return self._deinstallBottom();
  4494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  4495. return smalltalk.withContext(function($ctx2) {
  4496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  4497. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  4498. args: [],
  4499. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  4500. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  4501. referencedClasses: ["Error"]
  4502. }),
  4503. smalltalk.MethodInheritanceTest);
  4504. smalltalk.addMethod(
  4505. smalltalk.method({
  4506. selector: "testMNU11",
  4507. category: 'tests',
  4508. fn: function (){
  4509. var self=this;
  4510. return smalltalk.withContext(function($ctx1) {
  4511. self["@performBlock"]=(function(x){
  4512. return smalltalk.withContext(function($ctx2) {
  4513. return _st(x)._foo();
  4514. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4515. self._shouldMNU();
  4516. $ctx1.sendIdx["shouldMNU"]=1;
  4517. self._installTop_("foo ^ false");
  4518. $ctx1.sendIdx["installTop:"]=1;
  4519. self._installTop_("foo ^ true");
  4520. self._deinstallTop();
  4521. self._shouldMNU();
  4522. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  4523. args: [],
  4524. 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",
  4525. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  4526. referencedClasses: []
  4527. }),
  4528. smalltalk.MethodInheritanceTest);
  4529. smalltalk.addMethod(
  4530. smalltalk.method({
  4531. selector: "testMNU22",
  4532. category: 'tests',
  4533. fn: function (){
  4534. var self=this;
  4535. return smalltalk.withContext(function($ctx1) {
  4536. self["@performBlock"]=(function(x){
  4537. return smalltalk.withContext(function($ctx2) {
  4538. return _st(x)._foo();
  4539. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4540. self._shouldMNU();
  4541. $ctx1.sendIdx["shouldMNU"]=1;
  4542. self._installMiddle_("foo ^ false");
  4543. $ctx1.sendIdx["installMiddle:"]=1;
  4544. self._installMiddle_("foo ^ true");
  4545. self._deinstallMiddle();
  4546. self._shouldMNU();
  4547. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  4548. args: [],
  4549. 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",
  4550. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  4551. referencedClasses: []
  4552. }),
  4553. smalltalk.MethodInheritanceTest);
  4554. smalltalk.addMethod(
  4555. smalltalk.method({
  4556. selector: "testReturns1",
  4557. category: 'tests',
  4558. fn: function (){
  4559. var self=this;
  4560. return smalltalk.withContext(function($ctx1) {
  4561. self["@performBlock"]=(function(x){
  4562. return smalltalk.withContext(function($ctx2) {
  4563. return _st(x)._foo();
  4564. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4565. self._installTop_("foo ^ false");
  4566. $ctx1.sendIdx["installTop:"]=1;
  4567. self._shouldReturn_(false);
  4568. $ctx1.sendIdx["shouldReturn:"]=1;
  4569. self._installTop_("foo ^ true");
  4570. self._shouldReturn_(true);
  4571. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  4572. args: [],
  4573. 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",
  4574. messageSends: ["foo", "installTop:", "shouldReturn:"],
  4575. referencedClasses: []
  4576. }),
  4577. smalltalk.MethodInheritanceTest);
  4578. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4579. smalltalk.addMethod(
  4580. smalltalk.method({
  4581. selector: "testAbs",
  4582. category: 'tests',
  4583. fn: function (){
  4584. var self=this;
  4585. return smalltalk.withContext(function($ctx1) {
  4586. var $1;
  4587. $1=(4)._abs();
  4588. $ctx1.sendIdx["abs"]=1;
  4589. self._assert_equals_($1,(4));
  4590. $ctx1.sendIdx["assert:equals:"]=1;
  4591. self._assert_equals_((-4)._abs(),(4));
  4592. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  4593. args: [],
  4594. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  4595. messageSends: ["assert:equals:", "abs"],
  4596. referencedClasses: []
  4597. }),
  4598. smalltalk.NumberTest);
  4599. smalltalk.addMethod(
  4600. smalltalk.method({
  4601. selector: "testArithmetic",
  4602. category: 'tests',
  4603. fn: function (){
  4604. var self=this;
  4605. return smalltalk.withContext(function($ctx1) {
  4606. var $1,$2,$3,$5,$4;
  4607. $1=(1.5).__plus((1));
  4608. $ctx1.sendIdx["+"]=1;
  4609. self._assert_equals_($1,(2.5));
  4610. $ctx1.sendIdx["assert:equals:"]=1;
  4611. $2=(2).__minus((1));
  4612. $ctx1.sendIdx["-"]=1;
  4613. self._assert_equals_($2,(1));
  4614. $ctx1.sendIdx["assert:equals:"]=2;
  4615. self._assert_equals_((-2).__minus((1)),(-3));
  4616. $ctx1.sendIdx["assert:equals:"]=3;
  4617. self._assert_equals_((12).__slash((2)),(6));
  4618. $ctx1.sendIdx["assert:equals:"]=4;
  4619. $3=(3).__star((4));
  4620. $ctx1.sendIdx["*"]=1;
  4621. self._assert_equals_($3,(12));
  4622. $ctx1.sendIdx["assert:equals:"]=5;
  4623. self._assert_equals_((7).__slash_slash((2)),(3));
  4624. $ctx1.sendIdx["assert:equals:"]=6;
  4625. self._assert_equals_((7).__backslash_backslash((2)),(1));
  4626. $ctx1.sendIdx["assert:equals:"]=7;
  4627. $5=(1).__plus((2));
  4628. $ctx1.sendIdx["+"]=2;
  4629. $4=_st($5).__star((3));
  4630. $ctx1.sendIdx["*"]=2;
  4631. self._assert_equals_($4,(9));
  4632. $ctx1.sendIdx["assert:equals:"]=8;
  4633. self._assert_equals_((1).__plus((2).__star((3))),(7));
  4634. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  4635. args: [],
  4636. 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",
  4637. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  4638. referencedClasses: []
  4639. }),
  4640. smalltalk.NumberTest);
  4641. smalltalk.addMethod(
  4642. smalltalk.method({
  4643. selector: "testAsNumber",
  4644. category: 'tests',
  4645. fn: function (){
  4646. var self=this;
  4647. return smalltalk.withContext(function($ctx1) {
  4648. self._assert_equals_((3)._asNumber(),(3));
  4649. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  4650. args: [],
  4651. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  4652. messageSends: ["assert:equals:", "asNumber"],
  4653. referencedClasses: []
  4654. }),
  4655. smalltalk.NumberTest);
  4656. smalltalk.addMethod(
  4657. smalltalk.method({
  4658. selector: "testCeiling",
  4659. category: 'tests',
  4660. fn: function (){
  4661. var self=this;
  4662. return smalltalk.withContext(function($ctx1) {
  4663. var $1,$2;
  4664. $1=(1.2)._ceiling();
  4665. $ctx1.sendIdx["ceiling"]=1;
  4666. self._assert_equals_($1,(2));
  4667. $ctx1.sendIdx["assert:equals:"]=1;
  4668. $2=(-1.2)._ceiling();
  4669. $ctx1.sendIdx["ceiling"]=2;
  4670. self._assert_equals_($2,(-1));
  4671. $ctx1.sendIdx["assert:equals:"]=2;
  4672. self._assert_equals_((1)._ceiling(),(1));
  4673. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  4674. args: [],
  4675. 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.",
  4676. messageSends: ["assert:equals:", "ceiling"],
  4677. referencedClasses: []
  4678. }),
  4679. smalltalk.NumberTest);
  4680. smalltalk.addMethod(
  4681. smalltalk.method({
  4682. selector: "testComparison",
  4683. category: 'tests',
  4684. fn: function (){
  4685. var self=this;
  4686. return smalltalk.withContext(function($ctx1) {
  4687. var $1,$2,$3,$4;
  4688. $1=(3).__gt((2));
  4689. $ctx1.sendIdx[">"]=1;
  4690. self._assert_($1);
  4691. $ctx1.sendIdx["assert:"]=1;
  4692. $2=(2).__lt((3));
  4693. $ctx1.sendIdx["<"]=1;
  4694. self._assert_($2);
  4695. $ctx1.sendIdx["assert:"]=2;
  4696. self._deny_((3).__lt((2)));
  4697. $ctx1.sendIdx["deny:"]=1;
  4698. self._deny_((2).__gt((3)));
  4699. $3=(3).__gt_eq((3));
  4700. $ctx1.sendIdx[">="]=1;
  4701. self._assert_($3);
  4702. $ctx1.sendIdx["assert:"]=3;
  4703. self._assert_((3.1).__gt_eq((3)));
  4704. $ctx1.sendIdx["assert:"]=4;
  4705. $4=(3).__lt_eq((3));
  4706. $ctx1.sendIdx["<="]=1;
  4707. self._assert_($4);
  4708. $ctx1.sendIdx["assert:"]=5;
  4709. self._assert_((3).__lt_eq((3.1)));
  4710. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  4711. args: [],
  4712. 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",
  4713. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  4714. referencedClasses: []
  4715. }),
  4716. smalltalk.NumberTest);
  4717. smalltalk.addMethod(
  4718. smalltalk.method({
  4719. selector: "testCopying",
  4720. category: 'tests',
  4721. fn: function (){
  4722. var self=this;
  4723. return smalltalk.withContext(function($ctx1) {
  4724. var $1;
  4725. $1=_st((1)._copy()).__eq_eq((1));
  4726. $ctx1.sendIdx["=="]=1;
  4727. self._assert_($1);
  4728. $ctx1.sendIdx["assert:"]=1;
  4729. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  4730. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  4731. args: [],
  4732. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  4733. messageSends: ["assert:", "==", "copy", "deepCopy"],
  4734. referencedClasses: []
  4735. }),
  4736. smalltalk.NumberTest);
  4737. smalltalk.addMethod(
  4738. smalltalk.method({
  4739. selector: "testEquality",
  4740. category: 'tests',
  4741. fn: function (){
  4742. var self=this;
  4743. return smalltalk.withContext(function($ctx1) {
  4744. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  4745. $1=(1).__eq((1));
  4746. $ctx1.sendIdx["="]=1;
  4747. self._assert_($1);
  4748. $ctx1.sendIdx["assert:"]=1;
  4749. $2=(0).__eq((0));
  4750. $ctx1.sendIdx["="]=2;
  4751. self._assert_($2);
  4752. $ctx1.sendIdx["assert:"]=2;
  4753. $3=(1).__eq((0));
  4754. $ctx1.sendIdx["="]=3;
  4755. self._deny_($3);
  4756. $ctx1.sendIdx["deny:"]=1;
  4757. $5=(1)._yourself();
  4758. $ctx1.sendIdx["yourself"]=1;
  4759. $4=_st($5).__eq((1));
  4760. $ctx1.sendIdx["="]=4;
  4761. self._assert_($4);
  4762. $ctx1.sendIdx["assert:"]=3;
  4763. $7=(1)._yourself();
  4764. $ctx1.sendIdx["yourself"]=2;
  4765. $6=(1).__eq($7);
  4766. $ctx1.sendIdx["="]=5;
  4767. self._assert_($6);
  4768. $ctx1.sendIdx["assert:"]=4;
  4769. $9=(1)._yourself();
  4770. $ctx1.sendIdx["yourself"]=3;
  4771. $8=_st($9).__eq((1)._yourself());
  4772. $ctx1.sendIdx["="]=6;
  4773. self._assert_($8);
  4774. $10=(0).__eq(false);
  4775. $ctx1.sendIdx["="]=7;
  4776. self._deny_($10);
  4777. $ctx1.sendIdx["deny:"]=2;
  4778. $11=false.__eq((0));
  4779. $ctx1.sendIdx["="]=8;
  4780. self._deny_($11);
  4781. $ctx1.sendIdx["deny:"]=3;
  4782. $12="".__eq((0));
  4783. $ctx1.sendIdx["="]=9;
  4784. self._deny_($12);
  4785. $ctx1.sendIdx["deny:"]=4;
  4786. self._deny_((0).__eq(""));
  4787. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  4788. args: [],
  4789. 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 = ''",
  4790. messageSends: ["assert:", "=", "deny:", "yourself"],
  4791. referencedClasses: []
  4792. }),
  4793. smalltalk.NumberTest);
  4794. smalltalk.addMethod(
  4795. smalltalk.method({
  4796. selector: "testFloor",
  4797. category: 'tests',
  4798. fn: function (){
  4799. var self=this;
  4800. return smalltalk.withContext(function($ctx1) {
  4801. var $1,$2;
  4802. $1=(1.2)._floor();
  4803. $ctx1.sendIdx["floor"]=1;
  4804. self._assert_equals_($1,(1));
  4805. $ctx1.sendIdx["assert:equals:"]=1;
  4806. $2=(-1.2)._floor();
  4807. $ctx1.sendIdx["floor"]=2;
  4808. self._assert_equals_($2,(-2));
  4809. $ctx1.sendIdx["assert:equals:"]=2;
  4810. self._assert_equals_((1)._floor(),(1));
  4811. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  4812. args: [],
  4813. 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.",
  4814. messageSends: ["assert:equals:", "floor"],
  4815. referencedClasses: []
  4816. }),
  4817. smalltalk.NumberTest);
  4818. smalltalk.addMethod(
  4819. smalltalk.method({
  4820. selector: "testHexNumbers",
  4821. category: 'tests',
  4822. fn: function (){
  4823. var self=this;
  4824. return smalltalk.withContext(function($ctx1) {
  4825. var $1,$2,$3,$4,$5;
  4826. self._assert_equals_((9),(9));
  4827. $ctx1.sendIdx["assert:equals:"]=1;
  4828. $1=(10)._truncated();
  4829. $ctx1.sendIdx["truncated"]=1;
  4830. self._assert_equals_($1,(10));
  4831. $ctx1.sendIdx["assert:equals:"]=2;
  4832. $2=(11)._truncated();
  4833. $ctx1.sendIdx["truncated"]=2;
  4834. self._assert_equals_($2,(11));
  4835. $ctx1.sendIdx["assert:equals:"]=3;
  4836. $3=(12)._truncated();
  4837. $ctx1.sendIdx["truncated"]=3;
  4838. self._assert_equals_($3,(12));
  4839. $ctx1.sendIdx["assert:equals:"]=4;
  4840. $4=(13)._truncated();
  4841. $ctx1.sendIdx["truncated"]=4;
  4842. self._assert_equals_($4,(13));
  4843. $ctx1.sendIdx["assert:equals:"]=5;
  4844. $5=(14)._truncated();
  4845. $ctx1.sendIdx["truncated"]=5;
  4846. self._assert_equals_($5,(14));
  4847. $ctx1.sendIdx["assert:equals:"]=6;
  4848. self._assert_equals_((15)._truncated(),(15));
  4849. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  4850. args: [],
  4851. 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",
  4852. messageSends: ["assert:equals:", "truncated"],
  4853. referencedClasses: []
  4854. }),
  4855. smalltalk.NumberTest);
  4856. smalltalk.addMethod(
  4857. smalltalk.method({
  4858. selector: "testIdentity",
  4859. category: 'tests',
  4860. fn: function (){
  4861. var self=this;
  4862. return smalltalk.withContext(function($ctx1) {
  4863. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  4864. $1=(1).__eq_eq((1));
  4865. $ctx1.sendIdx["=="]=1;
  4866. self._assert_($1);
  4867. $ctx1.sendIdx["assert:"]=1;
  4868. $2=(0).__eq_eq((0));
  4869. $ctx1.sendIdx["=="]=2;
  4870. self._assert_($2);
  4871. $ctx1.sendIdx["assert:"]=2;
  4872. $3=(1).__eq_eq((0));
  4873. $ctx1.sendIdx["=="]=3;
  4874. self._deny_($3);
  4875. $ctx1.sendIdx["deny:"]=1;
  4876. $5=(1)._yourself();
  4877. $ctx1.sendIdx["yourself"]=1;
  4878. $4=_st($5).__eq_eq((1));
  4879. $ctx1.sendIdx["=="]=4;
  4880. self._assert_($4);
  4881. $ctx1.sendIdx["assert:"]=3;
  4882. $7=(1)._yourself();
  4883. $ctx1.sendIdx["yourself"]=2;
  4884. $6=(1).__eq_eq($7);
  4885. $ctx1.sendIdx["=="]=5;
  4886. self._assert_($6);
  4887. $ctx1.sendIdx["assert:"]=4;
  4888. $9=(1)._yourself();
  4889. $ctx1.sendIdx["yourself"]=3;
  4890. $8=_st($9).__eq_eq((1)._yourself());
  4891. $ctx1.sendIdx["=="]=6;
  4892. self._assert_($8);
  4893. self._deny_((1).__eq_eq((2)));
  4894. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  4895. args: [],
  4896. 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",
  4897. messageSends: ["assert:", "==", "deny:", "yourself"],
  4898. referencedClasses: []
  4899. }),
  4900. smalltalk.NumberTest);
  4901. smalltalk.addMethod(
  4902. smalltalk.method({
  4903. selector: "testInvalidHexNumbers",
  4904. category: 'tests',
  4905. fn: function (){
  4906. var self=this;
  4907. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4908. return smalltalk.withContext(function($ctx1) {
  4909. self._should_raise_((function(){
  4910. return smalltalk.withContext(function($ctx2) {
  4911. return (16)._rG();
  4912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4913. $ctx1.sendIdx["should:raise:"]=1;
  4914. self._should_raise_((function(){
  4915. return smalltalk.withContext(function($ctx2) {
  4916. return (16)._rg();
  4917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  4918. $ctx1.sendIdx["should:raise:"]=2;
  4919. self._should_raise_((function(){
  4920. return smalltalk.withContext(function($ctx2) {
  4921. return (16)._rH();
  4922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  4923. $ctx1.sendIdx["should:raise:"]=3;
  4924. self._should_raise_((function(){
  4925. return smalltalk.withContext(function($ctx2) {
  4926. return (16)._rh();
  4927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  4928. $ctx1.sendIdx["should:raise:"]=4;
  4929. self._should_raise_((function(){
  4930. return smalltalk.withContext(function($ctx2) {
  4931. return (16)._rI();
  4932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  4933. $ctx1.sendIdx["should:raise:"]=5;
  4934. self._should_raise_((function(){
  4935. return smalltalk.withContext(function($ctx2) {
  4936. return (16)._ri();
  4937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  4938. $ctx1.sendIdx["should:raise:"]=6;
  4939. self._should_raise_((function(){
  4940. return smalltalk.withContext(function($ctx2) {
  4941. return (16)._rJ();
  4942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  4943. $ctx1.sendIdx["should:raise:"]=7;
  4944. self._should_raise_((function(){
  4945. return smalltalk.withContext(function($ctx2) {
  4946. return (16)._rj();
  4947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  4948. $ctx1.sendIdx["should:raise:"]=8;
  4949. self._should_raise_((function(){
  4950. return smalltalk.withContext(function($ctx2) {
  4951. return (16)._rK();
  4952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  4953. $ctx1.sendIdx["should:raise:"]=9;
  4954. self._should_raise_((function(){
  4955. return smalltalk.withContext(function($ctx2) {
  4956. return (16)._rk();
  4957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  4958. $ctx1.sendIdx["should:raise:"]=10;
  4959. self._should_raise_((function(){
  4960. return smalltalk.withContext(function($ctx2) {
  4961. return (16)._rL();
  4962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  4963. $ctx1.sendIdx["should:raise:"]=11;
  4964. self._should_raise_((function(){
  4965. return smalltalk.withContext(function($ctx2) {
  4966. return (16)._rl();
  4967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  4968. $ctx1.sendIdx["should:raise:"]=12;
  4969. self._should_raise_((function(){
  4970. return smalltalk.withContext(function($ctx2) {
  4971. return (16)._rM();
  4972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  4973. $ctx1.sendIdx["should:raise:"]=13;
  4974. self._should_raise_((function(){
  4975. return smalltalk.withContext(function($ctx2) {
  4976. return (16)._rm();
  4977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  4978. $ctx1.sendIdx["should:raise:"]=14;
  4979. self._should_raise_((function(){
  4980. return smalltalk.withContext(function($ctx2) {
  4981. return (16)._rN();
  4982. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  4983. $ctx1.sendIdx["should:raise:"]=15;
  4984. self._should_raise_((function(){
  4985. return smalltalk.withContext(function($ctx2) {
  4986. return (16)._rn();
  4987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  4988. $ctx1.sendIdx["should:raise:"]=16;
  4989. self._should_raise_((function(){
  4990. return smalltalk.withContext(function($ctx2) {
  4991. return (16)._rO();
  4992. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  4993. $ctx1.sendIdx["should:raise:"]=17;
  4994. self._should_raise_((function(){
  4995. return smalltalk.withContext(function($ctx2) {
  4996. return (16)._ro();
  4997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  4998. $ctx1.sendIdx["should:raise:"]=18;
  4999. self._should_raise_((function(){
  5000. return smalltalk.withContext(function($ctx2) {
  5001. return (16)._rP();
  5002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  5003. $ctx1.sendIdx["should:raise:"]=19;
  5004. self._should_raise_((function(){
  5005. return smalltalk.withContext(function($ctx2) {
  5006. return (16)._rp();
  5007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  5008. $ctx1.sendIdx["should:raise:"]=20;
  5009. self._should_raise_((function(){
  5010. return smalltalk.withContext(function($ctx2) {
  5011. return (16)._rQ();
  5012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  5013. $ctx1.sendIdx["should:raise:"]=21;
  5014. self._should_raise_((function(){
  5015. return smalltalk.withContext(function($ctx2) {
  5016. return (16)._rq();
  5017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  5018. $ctx1.sendIdx["should:raise:"]=22;
  5019. self._should_raise_((function(){
  5020. return smalltalk.withContext(function($ctx2) {
  5021. return (16)._rR();
  5022. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  5023. $ctx1.sendIdx["should:raise:"]=23;
  5024. self._should_raise_((function(){
  5025. return smalltalk.withContext(function($ctx2) {
  5026. return (16)._rr();
  5027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  5028. $ctx1.sendIdx["should:raise:"]=24;
  5029. self._should_raise_((function(){
  5030. return smalltalk.withContext(function($ctx2) {
  5031. return (16)._rS();
  5032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  5033. $ctx1.sendIdx["should:raise:"]=25;
  5034. self._should_raise_((function(){
  5035. return smalltalk.withContext(function($ctx2) {
  5036. return (16)._rs();
  5037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  5038. $ctx1.sendIdx["should:raise:"]=26;
  5039. self._should_raise_((function(){
  5040. return smalltalk.withContext(function($ctx2) {
  5041. return (16)._rT();
  5042. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  5043. $ctx1.sendIdx["should:raise:"]=27;
  5044. self._should_raise_((function(){
  5045. return smalltalk.withContext(function($ctx2) {
  5046. return (16)._rt();
  5047. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  5048. $ctx1.sendIdx["should:raise:"]=28;
  5049. self._should_raise_((function(){
  5050. return smalltalk.withContext(function($ctx2) {
  5051. return (16)._rU();
  5052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  5053. $ctx1.sendIdx["should:raise:"]=29;
  5054. self._should_raise_((function(){
  5055. return smalltalk.withContext(function($ctx2) {
  5056. return (16)._ru();
  5057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  5058. $ctx1.sendIdx["should:raise:"]=30;
  5059. self._should_raise_((function(){
  5060. return smalltalk.withContext(function($ctx2) {
  5061. return (16)._rV();
  5062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  5063. $ctx1.sendIdx["should:raise:"]=31;
  5064. self._should_raise_((function(){
  5065. return smalltalk.withContext(function($ctx2) {
  5066. return (16)._rv();
  5067. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  5068. $ctx1.sendIdx["should:raise:"]=32;
  5069. self._should_raise_((function(){
  5070. return smalltalk.withContext(function($ctx2) {
  5071. return (16)._rW();
  5072. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  5073. $ctx1.sendIdx["should:raise:"]=33;
  5074. self._should_raise_((function(){
  5075. return smalltalk.withContext(function($ctx2) {
  5076. return (16)._rw();
  5077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  5078. $ctx1.sendIdx["should:raise:"]=34;
  5079. self._should_raise_((function(){
  5080. return smalltalk.withContext(function($ctx2) {
  5081. return (16)._rX();
  5082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  5083. $ctx1.sendIdx["should:raise:"]=35;
  5084. self._should_raise_((function(){
  5085. return smalltalk.withContext(function($ctx2) {
  5086. return (16)._rx();
  5087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  5088. $ctx1.sendIdx["should:raise:"]=36;
  5089. self._should_raise_((function(){
  5090. return smalltalk.withContext(function($ctx2) {
  5091. return (16)._rY();
  5092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  5093. $ctx1.sendIdx["should:raise:"]=37;
  5094. self._should_raise_((function(){
  5095. return smalltalk.withContext(function($ctx2) {
  5096. return (16)._ry();
  5097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  5098. $ctx1.sendIdx["should:raise:"]=38;
  5099. self._should_raise_((function(){
  5100. return smalltalk.withContext(function($ctx2) {
  5101. return (16)._rZ();
  5102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  5103. $ctx1.sendIdx["should:raise:"]=39;
  5104. self._should_raise_((function(){
  5105. return smalltalk.withContext(function($ctx2) {
  5106. return (16)._rz();
  5107. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  5108. $ctx1.sendIdx["should:raise:"]=40;
  5109. self._should_raise_((function(){
  5110. return smalltalk.withContext(function($ctx2) {
  5111. return (11259375)._Z();
  5112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  5113. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  5114. args: [],
  5115. 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.",
  5116. 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"],
  5117. referencedClasses: ["MessageNotUnderstood"]
  5118. }),
  5119. smalltalk.NumberTest);
  5120. smalltalk.addMethod(
  5121. smalltalk.method({
  5122. selector: "testLog",
  5123. category: 'tests',
  5124. fn: function (){
  5125. var self=this;
  5126. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  5127. return smalltalk.withContext(function($ctx1) {
  5128. self._assert_equals_((10000)._log(),(4));
  5129. $ctx1.sendIdx["assert:equals:"]=1;
  5130. self._assert_equals_((512)._log_((2)),(9));
  5131. $ctx1.sendIdx["assert:equals:"]=2;
  5132. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  5133. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  5134. args: [],
  5135. 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.",
  5136. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  5137. referencedClasses: ["Number"]
  5138. }),
  5139. smalltalk.NumberTest);
  5140. smalltalk.addMethod(
  5141. smalltalk.method({
  5142. selector: "testMinMax",
  5143. category: 'tests',
  5144. fn: function (){
  5145. var self=this;
  5146. return smalltalk.withContext(function($ctx1) {
  5147. self._assert_equals_((2)._max_((5)),(5));
  5148. $ctx1.sendIdx["assert:equals:"]=1;
  5149. self._assert_equals_((2)._min_((5)),(2));
  5150. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  5151. args: [],
  5152. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  5153. messageSends: ["assert:equals:", "max:", "min:"],
  5154. referencedClasses: []
  5155. }),
  5156. smalltalk.NumberTest);
  5157. smalltalk.addMethod(
  5158. smalltalk.method({
  5159. selector: "testNegated",
  5160. category: 'tests',
  5161. fn: function (){
  5162. var self=this;
  5163. return smalltalk.withContext(function($ctx1) {
  5164. var $1;
  5165. $1=(3)._negated();
  5166. $ctx1.sendIdx["negated"]=1;
  5167. self._assert_equals_($1,(-3));
  5168. $ctx1.sendIdx["assert:equals:"]=1;
  5169. self._assert_equals_((-3)._negated(),(3));
  5170. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  5171. args: [],
  5172. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  5173. messageSends: ["assert:equals:", "negated"],
  5174. referencedClasses: []
  5175. }),
  5176. smalltalk.NumberTest);
  5177. smalltalk.addMethod(
  5178. smalltalk.method({
  5179. selector: "testPrintShowingDecimalPlaces",
  5180. category: 'tests',
  5181. fn: function (){
  5182. var self=this;
  5183. return smalltalk.withContext(function($ctx1) {
  5184. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  5185. $1=(23)._printShowingDecimalPlaces_((2));
  5186. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  5187. self._assert_equals_($1,"23.00");
  5188. $ctx1.sendIdx["assert:equals:"]=1;
  5189. $2=(23.5698)._printShowingDecimalPlaces_((2));
  5190. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  5191. self._assert_equals_($2,"23.57");
  5192. $ctx1.sendIdx["assert:equals:"]=2;
  5193. $4=(234.567)._negated();
  5194. $ctx1.sendIdx["negated"]=1;
  5195. $3=_st($4)._printShowingDecimalPlaces_((5));
  5196. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  5197. self._assert_equals_($3,"-234.56700");
  5198. $ctx1.sendIdx["assert:equals:"]=3;
  5199. $5=(23.4567)._printShowingDecimalPlaces_((0));
  5200. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  5201. self._assert_equals_($5,"23");
  5202. $ctx1.sendIdx["assert:equals:"]=4;
  5203. $6=(23.5567)._printShowingDecimalPlaces_((0));
  5204. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  5205. self._assert_equals_($6,"24");
  5206. $ctx1.sendIdx["assert:equals:"]=5;
  5207. $8=(23.4567)._negated();
  5208. $ctx1.sendIdx["negated"]=2;
  5209. $7=_st($8)._printShowingDecimalPlaces_((0));
  5210. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  5211. self._assert_equals_($7,"-23");
  5212. $ctx1.sendIdx["assert:equals:"]=6;
  5213. $10=(23.5567)._negated();
  5214. $ctx1.sendIdx["negated"]=3;
  5215. $9=_st($10)._printShowingDecimalPlaces_((0));
  5216. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  5217. self._assert_equals_($9,"-24");
  5218. $ctx1.sendIdx["assert:equals:"]=7;
  5219. $11=(100000000)._printShowingDecimalPlaces_((1));
  5220. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  5221. self._assert_equals_($11,"100000000.0");
  5222. $ctx1.sendIdx["assert:equals:"]=8;
  5223. $12=(0.98)._printShowingDecimalPlaces_((5));
  5224. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  5225. self._assert_equals_($12,"0.98000");
  5226. $ctx1.sendIdx["assert:equals:"]=9;
  5227. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  5228. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  5229. self._assert_equals_($13,"-0.98");
  5230. $ctx1.sendIdx["assert:equals:"]=10;
  5231. $14=(2.567)._printShowingDecimalPlaces_((2));
  5232. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  5233. self._assert_equals_($14,"2.57");
  5234. $ctx1.sendIdx["assert:equals:"]=11;
  5235. $15=(-2.567)._printShowingDecimalPlaces_((2));
  5236. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  5237. self._assert_equals_($15,"-2.57");
  5238. $ctx1.sendIdx["assert:equals:"]=12;
  5239. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  5240. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  5241. args: [],
  5242. 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'.",
  5243. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  5244. referencedClasses: []
  5245. }),
  5246. smalltalk.NumberTest);
  5247. smalltalk.addMethod(
  5248. smalltalk.method({
  5249. selector: "testRaisedTo",
  5250. category: 'tests',
  5251. fn: function (){
  5252. var self=this;
  5253. return smalltalk.withContext(function($ctx1) {
  5254. var $1,$2,$3;
  5255. $1=(2)._raisedTo_((4));
  5256. $ctx1.sendIdx["raisedTo:"]=1;
  5257. self._assert_equals_($1,(16));
  5258. $ctx1.sendIdx["assert:equals:"]=1;
  5259. $2=(2)._raisedTo_((0));
  5260. $ctx1.sendIdx["raisedTo:"]=2;
  5261. self._assert_equals_($2,(1));
  5262. $ctx1.sendIdx["assert:equals:"]=2;
  5263. $3=(2)._raisedTo_((-3));
  5264. $ctx1.sendIdx["raisedTo:"]=3;
  5265. self._assert_equals_($3,(0.125));
  5266. $ctx1.sendIdx["assert:equals:"]=3;
  5267. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  5268. $ctx1.sendIdx["assert:equals:"]=4;
  5269. self._assert_equals_((2).__star_star((4)),(16));
  5270. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  5271. args: [],
  5272. 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.",
  5273. messageSends: ["assert:equals:", "raisedTo:", "**"],
  5274. referencedClasses: []
  5275. }),
  5276. smalltalk.NumberTest);
  5277. smalltalk.addMethod(
  5278. smalltalk.method({
  5279. selector: "testRounded",
  5280. category: 'tests',
  5281. fn: function (){
  5282. var self=this;
  5283. return smalltalk.withContext(function($ctx1) {
  5284. var $1,$2;
  5285. $1=(3)._rounded();
  5286. $ctx1.sendIdx["rounded"]=1;
  5287. self._assert_equals_($1,(3));
  5288. $ctx1.sendIdx["assert:equals:"]=1;
  5289. $2=(3.212)._rounded();
  5290. $ctx1.sendIdx["rounded"]=2;
  5291. self._assert_equals_($2,(3));
  5292. $ctx1.sendIdx["assert:equals:"]=2;
  5293. self._assert_equals_((3.51)._rounded(),(4));
  5294. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  5295. args: [],
  5296. 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",
  5297. messageSends: ["assert:equals:", "rounded"],
  5298. referencedClasses: []
  5299. }),
  5300. smalltalk.NumberTest);
  5301. smalltalk.addMethod(
  5302. smalltalk.method({
  5303. selector: "testSign",
  5304. category: 'tests',
  5305. fn: function (){
  5306. var self=this;
  5307. return smalltalk.withContext(function($ctx1) {
  5308. var $1,$2;
  5309. $1=(5)._sign();
  5310. $ctx1.sendIdx["sign"]=1;
  5311. self._assert_equals_($1,(1));
  5312. $ctx1.sendIdx["assert:equals:"]=1;
  5313. $2=(0)._sign();
  5314. $ctx1.sendIdx["sign"]=2;
  5315. self._assert_equals_($2,(0));
  5316. $ctx1.sendIdx["assert:equals:"]=2;
  5317. self._assert_equals_((-1.4)._sign(),(-1));
  5318. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  5319. args: [],
  5320. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  5321. messageSends: ["assert:equals:", "sign"],
  5322. referencedClasses: []
  5323. }),
  5324. smalltalk.NumberTest);
  5325. smalltalk.addMethod(
  5326. smalltalk.method({
  5327. selector: "testSqrt",
  5328. category: 'tests',
  5329. fn: function (){
  5330. var self=this;
  5331. return smalltalk.withContext(function($ctx1) {
  5332. var $1;
  5333. $1=(4)._sqrt();
  5334. $ctx1.sendIdx["sqrt"]=1;
  5335. self._assert_equals_($1,(2));
  5336. $ctx1.sendIdx["assert:equals:"]=1;
  5337. self._assert_equals_((16)._sqrt(),(4));
  5338. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  5339. args: [],
  5340. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  5341. messageSends: ["assert:equals:", "sqrt"],
  5342. referencedClasses: []
  5343. }),
  5344. smalltalk.NumberTest);
  5345. smalltalk.addMethod(
  5346. smalltalk.method({
  5347. selector: "testSquared",
  5348. category: 'tests',
  5349. fn: function (){
  5350. var self=this;
  5351. return smalltalk.withContext(function($ctx1) {
  5352. self._assert_equals_((4)._squared(),(16));
  5353. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  5354. args: [],
  5355. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  5356. messageSends: ["assert:equals:", "squared"],
  5357. referencedClasses: []
  5358. }),
  5359. smalltalk.NumberTest);
  5360. smalltalk.addMethod(
  5361. smalltalk.method({
  5362. selector: "testTimesRepeat",
  5363. category: 'tests',
  5364. fn: function (){
  5365. var self=this;
  5366. var i;
  5367. return smalltalk.withContext(function($ctx1) {
  5368. i=(0);
  5369. (0)._timesRepeat_((function(){
  5370. return smalltalk.withContext(function($ctx2) {
  5371. i=_st(i).__plus((1));
  5372. $ctx2.sendIdx["+"]=1;
  5373. return i;
  5374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5375. $ctx1.sendIdx["timesRepeat:"]=1;
  5376. self._assert_equals_(i,(0));
  5377. $ctx1.sendIdx["assert:equals:"]=1;
  5378. (5)._timesRepeat_((function(){
  5379. return smalltalk.withContext(function($ctx2) {
  5380. i=_st(i).__plus((1));
  5381. return i;
  5382. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5383. self._assert_equals_(i,(5));
  5384. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  5385. args: [],
  5386. 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",
  5387. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  5388. referencedClasses: []
  5389. }),
  5390. smalltalk.NumberTest);
  5391. smalltalk.addMethod(
  5392. smalltalk.method({
  5393. selector: "testTo",
  5394. category: 'tests',
  5395. fn: function (){
  5396. var self=this;
  5397. return smalltalk.withContext(function($ctx1) {
  5398. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  5399. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  5400. args: [],
  5401. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  5402. messageSends: ["assert:equals:", "to:"],
  5403. referencedClasses: []
  5404. }),
  5405. smalltalk.NumberTest);
  5406. smalltalk.addMethod(
  5407. smalltalk.method({
  5408. selector: "testToBy",
  5409. category: 'tests',
  5410. fn: function (){
  5411. var self=this;
  5412. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5413. return smalltalk.withContext(function($ctx1) {
  5414. var $1;
  5415. $1=(0)._to_by_((6),(2));
  5416. $ctx1.sendIdx["to:by:"]=1;
  5417. self._assert_equals_($1,[(0), (2), (4), (6)]);
  5418. self._should_raise_((function(){
  5419. return smalltalk.withContext(function($ctx2) {
  5420. return (1)._to_by_((4),(0));
  5421. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5422. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  5423. args: [],
  5424. 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",
  5425. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  5426. referencedClasses: ["Error"]
  5427. }),
  5428. smalltalk.NumberTest);
  5429. smalltalk.addMethod(
  5430. smalltalk.method({
  5431. selector: "testTrigonometry",
  5432. category: 'tests',
  5433. fn: function (){
  5434. var self=this;
  5435. return smalltalk.withContext(function($ctx1) {
  5436. self._assert_equals_((0)._cos(),(1));
  5437. $ctx1.sendIdx["assert:equals:"]=1;
  5438. self._assert_equals_((0)._sin(),(0));
  5439. $ctx1.sendIdx["assert:equals:"]=2;
  5440. self._assert_equals_((0)._tan(),(0));
  5441. $ctx1.sendIdx["assert:equals:"]=3;
  5442. self._assert_equals_((1)._arcCos(),(0));
  5443. $ctx1.sendIdx["assert:equals:"]=4;
  5444. self._assert_equals_((0)._arcSin(),(0));
  5445. $ctx1.sendIdx["assert:equals:"]=5;
  5446. self._assert_equals_((0)._arcTan(),(0));
  5447. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  5448. args: [],
  5449. 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.",
  5450. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  5451. referencedClasses: []
  5452. }),
  5453. smalltalk.NumberTest);
  5454. smalltalk.addMethod(
  5455. smalltalk.method({
  5456. selector: "testTruncated",
  5457. category: 'tests',
  5458. fn: function (){
  5459. var self=this;
  5460. return smalltalk.withContext(function($ctx1) {
  5461. var $1,$2;
  5462. $1=(3)._truncated();
  5463. $ctx1.sendIdx["truncated"]=1;
  5464. self._assert_equals_($1,(3));
  5465. $ctx1.sendIdx["assert:equals:"]=1;
  5466. $2=(3.212)._truncated();
  5467. $ctx1.sendIdx["truncated"]=2;
  5468. self._assert_equals_($2,(3));
  5469. $ctx1.sendIdx["assert:equals:"]=2;
  5470. self._assert_equals_((3.51)._truncated(),(3));
  5471. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  5472. args: [],
  5473. 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",
  5474. messageSends: ["assert:equals:", "truncated"],
  5475. referencedClasses: []
  5476. }),
  5477. smalltalk.NumberTest);
  5478. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  5479. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  5480. smalltalk.addMethod(
  5481. smalltalk.method({
  5482. selector: "foo",
  5483. category: 'not yet classified',
  5484. fn: function (){
  5485. var self=this;
  5486. return smalltalk.withContext(function($ctx1) {
  5487. var $1;
  5488. $1=self["@foo"];
  5489. return $1;
  5490. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  5491. args: [],
  5492. source: "foo\x0a\x09^ foo",
  5493. messageSends: [],
  5494. referencedClasses: []
  5495. }),
  5496. smalltalk.ObjectMock);
  5497. smalltalk.addMethod(
  5498. smalltalk.method({
  5499. selector: "foo:",
  5500. category: 'not yet classified',
  5501. fn: function (anObject){
  5502. var self=this;
  5503. return smalltalk.withContext(function($ctx1) {
  5504. self["@foo"]=anObject;
  5505. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  5506. args: ["anObject"],
  5507. source: "foo: anObject\x0a\x09foo := anObject",
  5508. messageSends: [],
  5509. referencedClasses: []
  5510. }),
  5511. smalltalk.ObjectMock);
  5512. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5513. smalltalk.addMethod(
  5514. smalltalk.method({
  5515. selector: "notDefined",
  5516. category: 'tests',
  5517. fn: function (){
  5518. var self=this;
  5519. return smalltalk.withContext(function($ctx1) {
  5520. return void 0;;
  5521. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  5522. args: [],
  5523. source: "notDefined\x0a\x09<return void 0;>",
  5524. messageSends: [],
  5525. referencedClasses: []
  5526. }),
  5527. smalltalk.ObjectTest);
  5528. smalltalk.addMethod(
  5529. smalltalk.method({
  5530. selector: "testBasicAccess",
  5531. category: 'tests',
  5532. fn: function (){
  5533. var self=this;
  5534. var o;
  5535. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5536. return smalltalk.withContext(function($ctx1) {
  5537. var $1;
  5538. o=_st($Object())._new();
  5539. _st(o)._basicAt_put_("a",(1));
  5540. $1=_st(o)._basicAt_("a");
  5541. $ctx1.sendIdx["basicAt:"]=1;
  5542. self._assert_equals_($1,(1));
  5543. $ctx1.sendIdx["assert:equals:"]=1;
  5544. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  5545. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  5546. args: [],
  5547. 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",
  5548. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  5549. referencedClasses: ["Object"]
  5550. }),
  5551. smalltalk.ObjectTest);
  5552. smalltalk.addMethod(
  5553. smalltalk.method({
  5554. selector: "testBasicPerform",
  5555. category: 'tests',
  5556. fn: function (){
  5557. var self=this;
  5558. var o;
  5559. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5560. return smalltalk.withContext(function($ctx1) {
  5561. o=_st($Object())._new();
  5562. _st(o)._basicAt_put_("func",(function(){
  5563. return smalltalk.withContext(function($ctx2) {
  5564. return "hello";
  5565. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5566. $ctx1.sendIdx["basicAt:put:"]=1;
  5567. _st(o)._basicAt_put_("func2",(function(a){
  5568. return smalltalk.withContext(function($ctx2) {
  5569. return _st(a).__plus((1));
  5570. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  5571. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  5572. $ctx1.sendIdx["assert:equals:"]=1;
  5573. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  5574. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  5575. args: [],
  5576. 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",
  5577. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  5578. referencedClasses: ["Object"]
  5579. }),
  5580. smalltalk.ObjectTest);
  5581. smalltalk.addMethod(
  5582. smalltalk.method({
  5583. selector: "testDNU",
  5584. category: 'tests',
  5585. fn: function (){
  5586. var self=this;
  5587. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5588. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5589. return smalltalk.withContext(function($ctx1) {
  5590. self._should_raise_((function(){
  5591. return smalltalk.withContext(function($ctx2) {
  5592. return _st(_st($Object())._new())._foo();
  5593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5594. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  5595. args: [],
  5596. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  5597. messageSends: ["should:raise:", "foo", "new"],
  5598. referencedClasses: ["Object", "MessageNotUnderstood"]
  5599. }),
  5600. smalltalk.ObjectTest);
  5601. smalltalk.addMethod(
  5602. smalltalk.method({
  5603. selector: "testEquality",
  5604. category: 'tests',
  5605. fn: function (){
  5606. var self=this;
  5607. var o;
  5608. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5609. return smalltalk.withContext(function($ctx1) {
  5610. var $1,$2,$4,$3;
  5611. o=_st($Object())._new();
  5612. $ctx1.sendIdx["new"]=1;
  5613. $1=_st(o).__eq(_st($Object())._new());
  5614. $ctx1.sendIdx["="]=1;
  5615. self._deny_($1);
  5616. $2=_st(o).__eq(o);
  5617. $ctx1.sendIdx["="]=2;
  5618. self._assert_($2);
  5619. $ctx1.sendIdx["assert:"]=1;
  5620. $4=_st(o)._yourself();
  5621. $ctx1.sendIdx["yourself"]=1;
  5622. $3=_st($4).__eq(o);
  5623. $ctx1.sendIdx["="]=3;
  5624. self._assert_($3);
  5625. $ctx1.sendIdx["assert:"]=2;
  5626. self._assert_(_st(o).__eq(_st(o)._yourself()));
  5627. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  5628. args: [],
  5629. 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)",
  5630. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  5631. referencedClasses: ["Object"]
  5632. }),
  5633. smalltalk.ObjectTest);
  5634. smalltalk.addMethod(
  5635. smalltalk.method({
  5636. selector: "testHalt",
  5637. category: 'tests',
  5638. fn: function (){
  5639. var self=this;
  5640. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5641. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5642. return smalltalk.withContext(function($ctx1) {
  5643. self._should_raise_((function(){
  5644. return smalltalk.withContext(function($ctx2) {
  5645. return _st(_st($Object())._new())._halt();
  5646. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5647. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  5648. args: [],
  5649. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  5650. messageSends: ["should:raise:", "halt", "new"],
  5651. referencedClasses: ["Object", "Error"]
  5652. }),
  5653. smalltalk.ObjectTest);
  5654. smalltalk.addMethod(
  5655. smalltalk.method({
  5656. selector: "testIdentity",
  5657. category: 'tests',
  5658. fn: function (){
  5659. var self=this;
  5660. var o;
  5661. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5662. return smalltalk.withContext(function($ctx1) {
  5663. var $1,$2,$4,$3;
  5664. o=_st($Object())._new();
  5665. $ctx1.sendIdx["new"]=1;
  5666. $1=_st(o).__eq_eq(_st($Object())._new());
  5667. $ctx1.sendIdx["=="]=1;
  5668. self._deny_($1);
  5669. $2=_st(o).__eq_eq(o);
  5670. $ctx1.sendIdx["=="]=2;
  5671. self._assert_($2);
  5672. $ctx1.sendIdx["assert:"]=1;
  5673. $4=_st(o)._yourself();
  5674. $ctx1.sendIdx["yourself"]=1;
  5675. $3=_st($4).__eq_eq(o);
  5676. $ctx1.sendIdx["=="]=3;
  5677. self._assert_($3);
  5678. $ctx1.sendIdx["assert:"]=2;
  5679. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  5680. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  5681. args: [],
  5682. 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",
  5683. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  5684. referencedClasses: ["Object"]
  5685. }),
  5686. smalltalk.ObjectTest);
  5687. smalltalk.addMethod(
  5688. smalltalk.method({
  5689. selector: "testIfNil",
  5690. category: 'tests',
  5691. fn: function (){
  5692. var self=this;
  5693. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5694. return smalltalk.withContext(function($ctx1) {
  5695. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  5696. $2=_st($Object())._new();
  5697. $ctx1.sendIdx["new"]=1;
  5698. $1=_st($2)._isNil();
  5699. self._deny_($1);
  5700. $ctx1.sendIdx["deny:"]=1;
  5701. $5=_st($Object())._new();
  5702. $ctx1.sendIdx["new"]=2;
  5703. if(($receiver = $5) == nil || $receiver == null){
  5704. $4=true;
  5705. } else {
  5706. $4=$5;
  5707. };
  5708. $3=_st($4).__eq(true);
  5709. self._deny_($3);
  5710. $7=_st($Object())._new();
  5711. $ctx1.sendIdx["new"]=3;
  5712. if(($receiver = $7) == nil || $receiver == null){
  5713. $6=$7;
  5714. } else {
  5715. $6=true;
  5716. };
  5717. self._assert_equals_($6,true);
  5718. $ctx1.sendIdx["assert:equals:"]=1;
  5719. $9=_st($Object())._new();
  5720. $ctx1.sendIdx["new"]=4;
  5721. if(($receiver = $9) == nil || $receiver == null){
  5722. $8=false;
  5723. } else {
  5724. $8=true;
  5725. };
  5726. self._assert_equals_($8,true);
  5727. $ctx1.sendIdx["assert:equals:"]=2;
  5728. $11=_st($Object())._new();
  5729. if(($receiver = $11) == nil || $receiver == null){
  5730. $10=false;
  5731. } else {
  5732. $10=true;
  5733. };
  5734. self._assert_equals_($10,true);
  5735. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  5736. args: [],
  5737. 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",
  5738. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  5739. referencedClasses: ["Object"]
  5740. }),
  5741. smalltalk.ObjectTest);
  5742. smalltalk.addMethod(
  5743. smalltalk.method({
  5744. selector: "testInstVars",
  5745. category: 'tests',
  5746. fn: function (){
  5747. var self=this;
  5748. var o;
  5749. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5750. return smalltalk.withContext(function($ctx1) {
  5751. var $1,$2;
  5752. o=_st($ObjectMock())._new();
  5753. $1=_st(o)._instVarAt_("foo");
  5754. $ctx1.sendIdx["instVarAt:"]=1;
  5755. self._assert_equals_($1,nil);
  5756. $ctx1.sendIdx["assert:equals:"]=1;
  5757. _st(o)._instVarAt_put_("foo",(1));
  5758. $2=_st(o)._instVarAt_("foo");
  5759. $ctx1.sendIdx["instVarAt:"]=2;
  5760. self._assert_equals_($2,(1));
  5761. $ctx1.sendIdx["assert:equals:"]=2;
  5762. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  5763. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  5764. args: [],
  5765. 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",
  5766. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  5767. referencedClasses: ["ObjectMock"]
  5768. }),
  5769. smalltalk.ObjectTest);
  5770. smalltalk.addMethod(
  5771. smalltalk.method({
  5772. selector: "testNilUndefined",
  5773. category: 'tests',
  5774. fn: function (){
  5775. var self=this;
  5776. return smalltalk.withContext(function($ctx1) {
  5777. self._assert_equals_(self._notDefined(),nil);
  5778. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  5779. args: [],
  5780. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  5781. messageSends: ["assert:equals:", "notDefined"],
  5782. referencedClasses: []
  5783. }),
  5784. smalltalk.ObjectTest);
  5785. smalltalk.addMethod(
  5786. smalltalk.method({
  5787. selector: "testYourself",
  5788. category: 'tests',
  5789. fn: function (){
  5790. var self=this;
  5791. var o;
  5792. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5793. return smalltalk.withContext(function($ctx1) {
  5794. o=_st($ObjectMock())._new();
  5795. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  5796. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  5797. args: [],
  5798. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  5799. messageSends: ["new", "assert:", "==", "yourself"],
  5800. referencedClasses: ["ObjectMock"]
  5801. }),
  5802. smalltalk.ObjectTest);
  5803. smalltalk.addMethod(
  5804. smalltalk.method({
  5805. selector: "testidentityHash",
  5806. category: 'tests',
  5807. fn: function (){
  5808. var self=this;
  5809. var o1,o2;
  5810. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5811. return smalltalk.withContext(function($ctx1) {
  5812. var $2,$3,$1,$5,$4;
  5813. o1=_st($Object())._new();
  5814. $ctx1.sendIdx["new"]=1;
  5815. o2=_st($Object())._new();
  5816. $2=_st(o1)._identityHash();
  5817. $ctx1.sendIdx["identityHash"]=1;
  5818. $3=_st(o1)._identityHash();
  5819. $ctx1.sendIdx["identityHash"]=2;
  5820. $1=_st($2).__eq_eq($3);
  5821. $ctx1.sendIdx["=="]=1;
  5822. self._assert_($1);
  5823. $5=_st(o1)._identityHash();
  5824. $ctx1.sendIdx["identityHash"]=3;
  5825. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  5826. self._deny_($4);
  5827. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  5828. args: [],
  5829. 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",
  5830. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  5831. referencedClasses: ["Object"]
  5832. }),
  5833. smalltalk.ObjectTest);
  5834. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5835. smalltalk.addMethod(
  5836. smalltalk.method({
  5837. selector: "testAccessing",
  5838. category: 'tests',
  5839. fn: function (){
  5840. var self=this;
  5841. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5842. return smalltalk.withContext(function($ctx1) {
  5843. var $2,$1,$3,$6,$5,$4;
  5844. $2=_st($Point())._x_y_((3),(4));
  5845. $ctx1.sendIdx["x:y:"]=1;
  5846. $1=_st($2)._x();
  5847. $ctx1.sendIdx["x"]=1;
  5848. self._assert_equals_($1,(3));
  5849. $ctx1.sendIdx["assert:equals:"]=1;
  5850. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  5851. $ctx1.sendIdx["y"]=1;
  5852. self._assert_equals_($3,(4));
  5853. $ctx1.sendIdx["assert:equals:"]=2;
  5854. $6=_st($Point())._new();
  5855. $ctx1.sendIdx["new"]=1;
  5856. $5=_st($6)._x_((3));
  5857. $4=_st($5)._x();
  5858. self._assert_equals_($4,(3));
  5859. $ctx1.sendIdx["assert:equals:"]=3;
  5860. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  5861. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  5862. args: [],
  5863. 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",
  5864. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  5865. referencedClasses: ["Point"]
  5866. }),
  5867. smalltalk.PointTest);
  5868. smalltalk.addMethod(
  5869. smalltalk.method({
  5870. selector: "testArithmetic",
  5871. category: 'tests',
  5872. fn: function (){
  5873. var self=this;
  5874. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5875. return smalltalk.withContext(function($ctx1) {
  5876. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  5877. $2=(3).__at((4));
  5878. $ctx1.sendIdx["@"]=1;
  5879. $3=(3).__at((4));
  5880. $ctx1.sendIdx["@"]=2;
  5881. $1=_st($2).__star($3);
  5882. $4=_st($Point())._x_y_((9),(16));
  5883. $ctx1.sendIdx["x:y:"]=1;
  5884. self._assert_equals_($1,$4);
  5885. $ctx1.sendIdx["assert:equals:"]=1;
  5886. $6=(3).__at((4));
  5887. $ctx1.sendIdx["@"]=3;
  5888. $7=(3).__at((4));
  5889. $ctx1.sendIdx["@"]=4;
  5890. $5=_st($6).__plus($7);
  5891. $8=_st($Point())._x_y_((6),(8));
  5892. $ctx1.sendIdx["x:y:"]=2;
  5893. self._assert_equals_($5,$8);
  5894. $ctx1.sendIdx["assert:equals:"]=2;
  5895. $10=(3).__at((4));
  5896. $ctx1.sendIdx["@"]=5;
  5897. $11=(3).__at((4));
  5898. $ctx1.sendIdx["@"]=6;
  5899. $9=_st($10).__minus($11);
  5900. $12=_st($Point())._x_y_((0),(0));
  5901. $ctx1.sendIdx["x:y:"]=3;
  5902. self._assert_equals_($9,$12);
  5903. $ctx1.sendIdx["assert:equals:"]=3;
  5904. $14=(6).__at((8));
  5905. $ctx1.sendIdx["@"]=7;
  5906. $13=_st($14).__slash((3).__at((4)));
  5907. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  5908. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  5909. args: [],
  5910. 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)",
  5911. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  5912. referencedClasses: ["Point"]
  5913. }),
  5914. smalltalk.PointTest);
  5915. smalltalk.addMethod(
  5916. smalltalk.method({
  5917. selector: "testAt",
  5918. category: 'tests',
  5919. fn: function (){
  5920. var self=this;
  5921. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5922. return smalltalk.withContext(function($ctx1) {
  5923. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  5924. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  5925. args: [],
  5926. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  5927. messageSends: ["assert:equals:", "@", "x:y:"],
  5928. referencedClasses: ["Point"]
  5929. }),
  5930. smalltalk.PointTest);
  5931. smalltalk.addMethod(
  5932. smalltalk.method({
  5933. selector: "testEgality",
  5934. category: 'tests',
  5935. fn: function (){
  5936. var self=this;
  5937. return smalltalk.withContext(function($ctx1) {
  5938. var $2,$3,$1,$5,$4;
  5939. $2=(3).__at((4));
  5940. $ctx1.sendIdx["@"]=1;
  5941. $3=(3).__at((4));
  5942. $ctx1.sendIdx["@"]=2;
  5943. $1=_st($2).__eq($3);
  5944. $ctx1.sendIdx["="]=1;
  5945. self._assert_($1);
  5946. $5=(3).__at((5));
  5947. $ctx1.sendIdx["@"]=3;
  5948. $4=_st($5).__eq((3).__at((6)));
  5949. self._deny_($4);
  5950. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  5951. args: [],
  5952. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  5953. messageSends: ["assert:", "=", "@", "deny:"],
  5954. referencedClasses: []
  5955. }),
  5956. smalltalk.PointTest);
  5957. smalltalk.addMethod(
  5958. smalltalk.method({
  5959. selector: "testNew",
  5960. category: 'tests',
  5961. fn: function (){
  5962. var self=this;
  5963. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5964. return smalltalk.withContext(function($ctx1) {
  5965. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  5966. $3=_st($Point())._new();
  5967. $ctx1.sendIdx["new"]=1;
  5968. $2=_st($3)._x_((3));
  5969. $ctx1.sendIdx["x:"]=1;
  5970. $1=_st($2)._y();
  5971. $ctx1.sendIdx["y"]=1;
  5972. self._assert_equals_($1,nil);
  5973. $ctx1.sendIdx["assert:equals:"]=1;
  5974. $7=_st($Point())._new();
  5975. $ctx1.sendIdx["new"]=2;
  5976. $6=_st($7)._x_((3));
  5977. $5=_st($6)._x();
  5978. $ctx1.sendIdx["x"]=1;
  5979. $4=_st($5).__eq((0));
  5980. $ctx1.sendIdx["="]=1;
  5981. self._deny_($4);
  5982. $ctx1.sendIdx["deny:"]=1;
  5983. $10=_st($Point())._new();
  5984. $ctx1.sendIdx["new"]=3;
  5985. $9=_st($10)._y_((4));
  5986. $ctx1.sendIdx["y:"]=1;
  5987. $8=_st($9)._x();
  5988. self._assert_equals_($8,nil);
  5989. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  5990. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  5991. args: [],
  5992. 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",
  5993. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  5994. referencedClasses: ["Point"]
  5995. }),
  5996. smalltalk.PointTest);
  5997. smalltalk.addMethod(
  5998. smalltalk.method({
  5999. selector: "testTranslateBy",
  6000. category: 'tests',
  6001. fn: function (){
  6002. var self=this;
  6003. return smalltalk.withContext(function($ctx1) {
  6004. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  6005. $2=(3).__at((3));
  6006. $ctx1.sendIdx["@"]=1;
  6007. $3=(0).__at((1));
  6008. $ctx1.sendIdx["@"]=2;
  6009. $1=_st($2)._translateBy_($3);
  6010. $ctx1.sendIdx["translateBy:"]=1;
  6011. $4=(3).__at((4));
  6012. $ctx1.sendIdx["@"]=3;
  6013. self._assert_equals_($1,$4);
  6014. $ctx1.sendIdx["assert:equals:"]=1;
  6015. $6=(3).__at((3));
  6016. $ctx1.sendIdx["@"]=4;
  6017. $8=(1)._negated();
  6018. $ctx1.sendIdx["negated"]=1;
  6019. $7=(0).__at($8);
  6020. $ctx1.sendIdx["@"]=5;
  6021. $5=_st($6)._translateBy_($7);
  6022. $ctx1.sendIdx["translateBy:"]=2;
  6023. $9=(3).__at((2));
  6024. $ctx1.sendIdx["@"]=6;
  6025. self._assert_equals_($5,$9);
  6026. $ctx1.sendIdx["assert:equals:"]=2;
  6027. $11=(3).__at((3));
  6028. $ctx1.sendIdx["@"]=7;
  6029. $12=(2).__at((3));
  6030. $ctx1.sendIdx["@"]=8;
  6031. $10=_st($11)._translateBy_($12);
  6032. $ctx1.sendIdx["translateBy:"]=3;
  6033. $13=(5).__at((6));
  6034. $ctx1.sendIdx["@"]=9;
  6035. self._assert_equals_($10,$13);
  6036. $ctx1.sendIdx["assert:equals:"]=3;
  6037. $15=(3).__at((3));
  6038. $ctx1.sendIdx["@"]=10;
  6039. $16=_st((3)._negated()).__at((0));
  6040. $ctx1.sendIdx["@"]=11;
  6041. $14=_st($15)._translateBy_($16);
  6042. self._assert_equals_($14,(0).__at((3)));
  6043. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  6044. args: [],
  6045. 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.",
  6046. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  6047. referencedClasses: []
  6048. }),
  6049. smalltalk.PointTest);
  6050. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6051. smalltalk.addMethod(
  6052. smalltalk.method({
  6053. selector: "testNextIfAbsent",
  6054. category: 'tests',
  6055. fn: function (){
  6056. var self=this;
  6057. var queue;
  6058. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6059. return smalltalk.withContext(function($ctx1) {
  6060. var $2,$1;
  6061. queue=_st($Queue())._new();
  6062. _st(queue)._nextPut_("index1");
  6063. $2=_st(queue)._nextIfAbsent_("empty");
  6064. $ctx1.sendIdx["nextIfAbsent:"]=1;
  6065. $1=_st($2).__eq("index1");
  6066. $ctx1.sendIdx["="]=1;
  6067. self._assert_($1);
  6068. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  6069. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  6070. args: [],
  6071. 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'",
  6072. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  6073. referencedClasses: ["Queue"]
  6074. }),
  6075. smalltalk.QueueTest);
  6076. smalltalk.addMethod(
  6077. smalltalk.method({
  6078. selector: "testQueueNext",
  6079. category: 'tests',
  6080. fn: function (){
  6081. var self=this;
  6082. var queue;
  6083. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6084. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6085. return smalltalk.withContext(function($ctx1) {
  6086. var $1,$2,$4,$3,$6,$5;
  6087. queue=_st($Queue())._new();
  6088. $1=queue;
  6089. _st($1)._nextPut_("index1");
  6090. $ctx1.sendIdx["nextPut:"]=1;
  6091. $2=_st($1)._nextPut_("index2");
  6092. $4=_st(queue)._next();
  6093. $ctx1.sendIdx["next"]=1;
  6094. $3=_st($4).__eq("index1");
  6095. $ctx1.sendIdx["="]=1;
  6096. self._assert_($3);
  6097. $6=_st(queue)._next();
  6098. $ctx1.sendIdx["next"]=2;
  6099. $5=_st($6).__eq("index");
  6100. self._deny_($5);
  6101. self._should_raise_((function(){
  6102. return smalltalk.withContext(function($ctx2) {
  6103. return _st(queue)._next();
  6104. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6105. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  6106. args: [],
  6107. 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",
  6108. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  6109. referencedClasses: ["Queue", "Error"]
  6110. }),
  6111. smalltalk.QueueTest);
  6112. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6113. smalltalk.addMethod(
  6114. smalltalk.method({
  6115. selector: "testAtRandomNumber",
  6116. category: 'tests',
  6117. fn: function (){
  6118. var self=this;
  6119. var val;
  6120. return smalltalk.withContext(function($ctx1) {
  6121. (100)._timesRepeat_((function(){
  6122. return smalltalk.withContext(function($ctx2) {
  6123. val=(10)._atRandom();
  6124. val;
  6125. self._assert_(_st(val).__gt((0)));
  6126. $ctx2.sendIdx["assert:"]=1;
  6127. return self._assert_(_st(val).__lt((11)));
  6128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6129. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  6130. args: [],
  6131. 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]",
  6132. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  6133. referencedClasses: []
  6134. }),
  6135. smalltalk.RandomTest);
  6136. smalltalk.addMethod(
  6137. smalltalk.method({
  6138. selector: "testAtRandomSequenceableCollection",
  6139. category: 'tests',
  6140. fn: function (){
  6141. var self=this;
  6142. var val;
  6143. return smalltalk.withContext(function($ctx1) {
  6144. var $3,$4,$2,$1;
  6145. (100)._timesRepeat_((function(){
  6146. return smalltalk.withContext(function($ctx2) {
  6147. val="abc"._atRandom();
  6148. val;
  6149. $3=_st(val).__eq("a");
  6150. $ctx2.sendIdx["="]=1;
  6151. $4=_st(val).__eq("b");
  6152. $ctx2.sendIdx["="]=2;
  6153. $2=_st($3).__or($4);
  6154. $1=_st($2).__or(_st(val).__eq("c"));
  6155. $ctx2.sendIdx["|"]=1;
  6156. return self._assert_($1);
  6157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6158. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  6159. args: [],
  6160. 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].",
  6161. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  6162. referencedClasses: []
  6163. }),
  6164. smalltalk.RandomTest);
  6165. smalltalk.addMethod(
  6166. smalltalk.method({
  6167. selector: "textNext",
  6168. category: 'tests',
  6169. fn: function (){
  6170. var self=this;
  6171. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  6172. return smalltalk.withContext(function($ctx1) {
  6173. var $1;
  6174. (10000)._timesRepeat_((function(){
  6175. var current,next;
  6176. return smalltalk.withContext(function($ctx2) {
  6177. next=_st(_st($Random())._new())._next();
  6178. next;
  6179. self._assert_(_st(next).__gt_eq((0)));
  6180. $ctx2.sendIdx["assert:"]=1;
  6181. self._assert_(_st(next).__lt((1)));
  6182. $1=_st(current).__eq(next);
  6183. $ctx2.sendIdx["="]=1;
  6184. self._deny_($1);
  6185. return _st(next).__eq(current);
  6186. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  6187. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  6188. args: [],
  6189. 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 ]",
  6190. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  6191. referencedClasses: ["Random"]
  6192. }),
  6193. smalltalk.RandomTest);
  6194. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6195. smalltalk.addMethod(
  6196. smalltalk.method({
  6197. selector: "testAddRemove",
  6198. category: 'tests',
  6199. fn: function (){
  6200. var self=this;
  6201. var set;
  6202. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6203. return smalltalk.withContext(function($ctx1) {
  6204. var $1,$2;
  6205. set=_st($Set())._new();
  6206. self._assert_(_st(set)._isEmpty());
  6207. $ctx1.sendIdx["assert:"]=1;
  6208. _st(set)._add_((3));
  6209. $ctx1.sendIdx["add:"]=1;
  6210. $1=_st(set)._includes_((3));
  6211. $ctx1.sendIdx["includes:"]=1;
  6212. self._assert_($1);
  6213. $ctx1.sendIdx["assert:"]=2;
  6214. _st(set)._add_((5));
  6215. $2=_st(set)._includes_((5));
  6216. $ctx1.sendIdx["includes:"]=2;
  6217. self._assert_($2);
  6218. _st(set)._remove_((3));
  6219. self._deny_(_st(set)._includes_((3)));
  6220. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  6221. args: [],
  6222. 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)",
  6223. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  6224. referencedClasses: ["Set"]
  6225. }),
  6226. smalltalk.SetTest);
  6227. smalltalk.addMethod(
  6228. smalltalk.method({
  6229. selector: "testAt",
  6230. category: 'tests',
  6231. fn: function (){
  6232. var self=this;
  6233. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6234. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6235. return smalltalk.withContext(function($ctx1) {
  6236. self._should_raise_((function(){
  6237. return smalltalk.withContext(function($ctx2) {
  6238. return _st(_st($Set())._new())._at_put_((1),(2));
  6239. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6240. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  6241. args: [],
  6242. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  6243. messageSends: ["should:raise:", "at:put:", "new"],
  6244. referencedClasses: ["Set", "Error"]
  6245. }),
  6246. smalltalk.SetTest);
  6247. smalltalk.addMethod(
  6248. smalltalk.method({
  6249. selector: "testCollect",
  6250. category: 'tests',
  6251. fn: function (){
  6252. var self=this;
  6253. return smalltalk.withContext(function($ctx1) {
  6254. var $2,$1;
  6255. $2=[(5), (6), (8)]._asSet();
  6256. $ctx1.sendIdx["asSet"]=1;
  6257. $1=_st($2)._collect_((function(x){
  6258. return smalltalk.withContext(function($ctx2) {
  6259. return _st(x).__backslash_backslash((3));
  6260. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  6261. self._assert_equals_($1,[(0), (2)]._asSet());
  6262. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  6263. args: [],
  6264. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  6265. messageSends: ["assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  6266. referencedClasses: []
  6267. }),
  6268. smalltalk.SetTest);
  6269. smalltalk.addMethod(
  6270. smalltalk.method({
  6271. selector: "testComparing",
  6272. category: 'tests',
  6273. fn: function (){
  6274. var self=this;
  6275. return smalltalk.withContext(function($ctx1) {
  6276. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  6277. $1=[(0), (2)]._asSet();
  6278. $ctx1.sendIdx["asSet"]=1;
  6279. $2=[(0), (2)]._asSet();
  6280. $ctx1.sendIdx["asSet"]=2;
  6281. self._assert_equals_($1,$2);
  6282. $ctx1.sendIdx["assert:equals:"]=1;
  6283. $3=[(2), (0)]._asSet();
  6284. $ctx1.sendIdx["asSet"]=3;
  6285. $4=[(0), (2)]._asSet();
  6286. $ctx1.sendIdx["asSet"]=4;
  6287. self._assert_equals_($3,$4);
  6288. $6=[(0), (2), (3)]._asSet();
  6289. $ctx1.sendIdx["asSet"]=5;
  6290. $7=[(0), (2)]._asSet();
  6291. $ctx1.sendIdx["asSet"]=6;
  6292. $5=_st($6).__eq($7);
  6293. $ctx1.sendIdx["="]=1;
  6294. self._deny_($5);
  6295. $ctx1.sendIdx["deny:"]=1;
  6296. $9=[(1), (2)]._asSet();
  6297. $ctx1.sendIdx["asSet"]=7;
  6298. $8=_st($9).__eq([(0), (2)]._asSet());
  6299. self._deny_($8);
  6300. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  6301. args: [],
  6302. 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",
  6303. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  6304. referencedClasses: []
  6305. }),
  6306. smalltalk.SetTest);
  6307. smalltalk.addMethod(
  6308. smalltalk.method({
  6309. selector: "testPrintString",
  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,$2,$3,$4,$5,$6,$7,$8,$9;
  6317. set=_st($Set())._new();
  6318. $1=_st(set)._printString();
  6319. $ctx1.sendIdx["printString"]=1;
  6320. self._assert_equals_($1,"a Set ()");
  6321. $ctx1.sendIdx["assert:equals:"]=1;
  6322. $2=set;
  6323. _st($2)._add_((1));
  6324. $ctx1.sendIdx["add:"]=1;
  6325. $3=_st($2)._add_((3));
  6326. $ctx1.sendIdx["add:"]=2;
  6327. $4=_st(set)._printString();
  6328. $ctx1.sendIdx["printString"]=2;
  6329. self._assert_equals_($4,"a Set (1 3)");
  6330. $ctx1.sendIdx["assert:equals:"]=2;
  6331. _st(set)._add_("foo");
  6332. $ctx1.sendIdx["add:"]=3;
  6333. $5=_st(set)._printString();
  6334. $ctx1.sendIdx["printString"]=3;
  6335. self._assert_equals_($5,"a Set (1 3 'foo')");
  6336. $ctx1.sendIdx["assert:equals:"]=3;
  6337. $6=set;
  6338. _st($6)._remove_((1));
  6339. $ctx1.sendIdx["remove:"]=1;
  6340. $7=_st($6)._remove_((3));
  6341. $8=_st(set)._printString();
  6342. $ctx1.sendIdx["printString"]=4;
  6343. self._assert_equals_($8,"a Set ('foo')");
  6344. $ctx1.sendIdx["assert:equals:"]=4;
  6345. _st(set)._add_((3));
  6346. $ctx1.sendIdx["add:"]=4;
  6347. $9=_st(set)._printString();
  6348. $ctx1.sendIdx["printString"]=5;
  6349. self._assert_equals_($9,"a Set ('foo' 3)");
  6350. $ctx1.sendIdx["assert:equals:"]=5;
  6351. _st(set)._add_((3));
  6352. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  6353. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  6354. args: [],
  6355. 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)'",
  6356. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  6357. referencedClasses: ["Set"]
  6358. }),
  6359. smalltalk.SetTest);
  6360. smalltalk.addMethod(
  6361. smalltalk.method({
  6362. selector: "testSize",
  6363. category: 'tests',
  6364. fn: function (){
  6365. var self=this;
  6366. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6367. return smalltalk.withContext(function($ctx1) {
  6368. var $1,$3,$2;
  6369. $1=_st(_st($Set())._new())._size();
  6370. $ctx1.sendIdx["size"]=1;
  6371. self._assert_equals_($1,(0));
  6372. $ctx1.sendIdx["assert:equals:"]=1;
  6373. $3=_st($Set())._withAll_([(1), (2), (3), (4)]);
  6374. $ctx1.sendIdx["withAll:"]=1;
  6375. $2=_st($3)._size();
  6376. $ctx1.sendIdx["size"]=2;
  6377. self._assert_equals_($2,(4));
  6378. $ctx1.sendIdx["assert:equals:"]=2;
  6379. self._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  6380. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  6381. args: [],
  6382. 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",
  6383. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  6384. referencedClasses: ["Set"]
  6385. }),
  6386. smalltalk.SetTest);
  6387. smalltalk.addMethod(
  6388. smalltalk.method({
  6389. selector: "testUnboxedObjects",
  6390. category: 'tests',
  6391. fn: function (){
  6392. var self=this;
  6393. return smalltalk.withContext(function($ctx1) {
  6394. var $4,$3,$2,$1;
  6395. $4="foo"._yourself();
  6396. $ctx1.sendIdx["yourself"]=1;
  6397. $3=[$4,"foo"._yourself()];
  6398. $2=_st($3)._asSet();
  6399. $1=_st($2)._asArray();
  6400. self._assert_equals_($1,["foo"]);
  6401. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  6402. args: [],
  6403. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  6404. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  6405. referencedClasses: []
  6406. }),
  6407. smalltalk.SetTest);
  6408. smalltalk.addMethod(
  6409. smalltalk.method({
  6410. selector: "testUnicity",
  6411. category: 'tests',
  6412. fn: function (){
  6413. var self=this;
  6414. var set;
  6415. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6416. return smalltalk.withContext(function($ctx1) {
  6417. var $1;
  6418. set=_st($Set())._new();
  6419. _st(set)._add_((21));
  6420. $ctx1.sendIdx["add:"]=1;
  6421. _st(set)._add_("hello");
  6422. $ctx1.sendIdx["add:"]=2;
  6423. _st(set)._add_((21));
  6424. $ctx1.sendIdx["add:"]=3;
  6425. $1=_st(set)._size();
  6426. $ctx1.sendIdx["size"]=1;
  6427. self._assert_equals_($1,(2));
  6428. $ctx1.sendIdx["assert:equals:"]=1;
  6429. _st(set)._add_("hello");
  6430. self._assert_equals_(_st(set)._size(),(2));
  6431. $ctx1.sendIdx["assert:equals:"]=2;
  6432. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  6433. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  6434. args: [],
  6435. 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')",
  6436. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  6437. referencedClasses: ["Set"]
  6438. }),
  6439. smalltalk.SetTest);
  6440. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6441. smalltalk.addMethod(
  6442. smalltalk.method({
  6443. selector: "collectionClass",
  6444. category: 'accessing',
  6445. fn: function (){
  6446. var self=this;
  6447. return smalltalk.withContext(function($ctx1) {
  6448. var $1;
  6449. $1=_st(self._class())._collectionClass();
  6450. return $1;
  6451. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  6452. args: [],
  6453. source: "collectionClass\x0a\x09^ self class collectionClass",
  6454. messageSends: ["collectionClass", "class"],
  6455. referencedClasses: []
  6456. }),
  6457. smalltalk.StreamTest);
  6458. smalltalk.addMethod(
  6459. smalltalk.method({
  6460. selector: "newCollection",
  6461. category: 'accessing',
  6462. fn: function (){
  6463. var self=this;
  6464. return smalltalk.withContext(function($ctx1) {
  6465. var $1;
  6466. $1=_st(self._collectionClass())._new();
  6467. return $1;
  6468. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  6469. args: [],
  6470. source: "newCollection\x0a\x09^ self collectionClass new",
  6471. messageSends: ["new", "collectionClass"],
  6472. referencedClasses: []
  6473. }),
  6474. smalltalk.StreamTest);
  6475. smalltalk.addMethod(
  6476. smalltalk.method({
  6477. selector: "newStream",
  6478. category: 'accessing',
  6479. fn: function (){
  6480. var self=this;
  6481. return smalltalk.withContext(function($ctx1) {
  6482. var $1;
  6483. $1=_st(_st(self._collectionClass())._new())._stream();
  6484. return $1;
  6485. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  6486. args: [],
  6487. source: "newStream\x0a\x09^ self collectionClass new stream",
  6488. messageSends: ["stream", "new", "collectionClass"],
  6489. referencedClasses: []
  6490. }),
  6491. smalltalk.StreamTest);
  6492. smalltalk.addMethod(
  6493. smalltalk.method({
  6494. selector: "testAtStartAtEnd",
  6495. category: 'tests',
  6496. fn: function (){
  6497. var self=this;
  6498. var stream;
  6499. return smalltalk.withContext(function($ctx1) {
  6500. var $1,$2,$3,$4;
  6501. stream=self._newStream();
  6502. $1=_st(stream)._atStart();
  6503. $ctx1.sendIdx["atStart"]=1;
  6504. self._assert_($1);
  6505. $ctx1.sendIdx["assert:"]=1;
  6506. $2=_st(stream)._atEnd();
  6507. $ctx1.sendIdx["atEnd"]=1;
  6508. self._assert_($2);
  6509. $ctx1.sendIdx["assert:"]=2;
  6510. _st(stream)._nextPutAll_(self._newCollection());
  6511. $3=_st(stream)._atEnd();
  6512. $ctx1.sendIdx["atEnd"]=2;
  6513. self._assert_($3);
  6514. $4=_st(stream)._atStart();
  6515. $ctx1.sendIdx["atStart"]=2;
  6516. self._deny_($4);
  6517. $ctx1.sendIdx["deny:"]=1;
  6518. _st(stream)._position_((1));
  6519. self._deny_(_st(stream)._atEnd());
  6520. $ctx1.sendIdx["deny:"]=2;
  6521. self._deny_(_st(stream)._atStart());
  6522. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  6523. args: [],
  6524. 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",
  6525. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  6526. referencedClasses: []
  6527. }),
  6528. smalltalk.StreamTest);
  6529. smalltalk.addMethod(
  6530. smalltalk.method({
  6531. selector: "testContents",
  6532. category: 'tests',
  6533. fn: function (){
  6534. var self=this;
  6535. var stream;
  6536. return smalltalk.withContext(function($ctx1) {
  6537. var $1,$2;
  6538. stream=self._newStream();
  6539. $1=stream;
  6540. $2=self._newCollection();
  6541. $ctx1.sendIdx["newCollection"]=1;
  6542. _st($1)._nextPutAll_($2);
  6543. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  6544. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  6545. args: [],
  6546. 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",
  6547. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  6548. referencedClasses: []
  6549. }),
  6550. smalltalk.StreamTest);
  6551. smalltalk.addMethod(
  6552. smalltalk.method({
  6553. selector: "testIsEmpty",
  6554. category: 'tests',
  6555. fn: function (){
  6556. var self=this;
  6557. var stream;
  6558. return smalltalk.withContext(function($ctx1) {
  6559. var $1;
  6560. stream=self._newStream();
  6561. $1=_st(stream)._isEmpty();
  6562. $ctx1.sendIdx["isEmpty"]=1;
  6563. self._assert_($1);
  6564. _st(stream)._nextPutAll_(self._newCollection());
  6565. self._deny_(_st(stream)._isEmpty());
  6566. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  6567. args: [],
  6568. 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",
  6569. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  6570. referencedClasses: []
  6571. }),
  6572. smalltalk.StreamTest);
  6573. smalltalk.addMethod(
  6574. smalltalk.method({
  6575. selector: "testPosition",
  6576. category: 'tests',
  6577. fn: function (){
  6578. var self=this;
  6579. var collection,stream;
  6580. return smalltalk.withContext(function($ctx1) {
  6581. var $1,$2,$3;
  6582. collection=self._newCollection();
  6583. stream=self._newStream();
  6584. _st(stream)._nextPutAll_(collection);
  6585. $1=_st(stream)._position();
  6586. $ctx1.sendIdx["position"]=1;
  6587. self._assert_equals_($1,_st(collection)._size());
  6588. $ctx1.sendIdx["assert:equals:"]=1;
  6589. _st(stream)._position_((0));
  6590. $2=_st(stream)._position();
  6591. $ctx1.sendIdx["position"]=2;
  6592. self._assert_equals_($2,(0));
  6593. $ctx1.sendIdx["assert:equals:"]=2;
  6594. _st(stream)._next();
  6595. $ctx1.sendIdx["next"]=1;
  6596. $3=_st(stream)._position();
  6597. $ctx1.sendIdx["position"]=3;
  6598. self._assert_equals_($3,(1));
  6599. $ctx1.sendIdx["assert:equals:"]=3;
  6600. _st(stream)._next();
  6601. self._assert_equals_(_st(stream)._position(),(2));
  6602. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  6603. args: [],
  6604. 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",
  6605. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  6606. referencedClasses: []
  6607. }),
  6608. smalltalk.StreamTest);
  6609. smalltalk.addMethod(
  6610. smalltalk.method({
  6611. selector: "testReading",
  6612. category: 'tests',
  6613. fn: function (){
  6614. var self=this;
  6615. var stream,collection;
  6616. return smalltalk.withContext(function($ctx1) {
  6617. var $1,$2,$3;
  6618. collection=self._newCollection();
  6619. stream=self._newStream();
  6620. $1=stream;
  6621. _st($1)._nextPutAll_(collection);
  6622. $2=_st($1)._position_((0));
  6623. _st(collection)._do_((function(each){
  6624. return smalltalk.withContext(function($ctx2) {
  6625. $3=_st(stream)._next();
  6626. $ctx2.sendIdx["next"]=1;
  6627. return self._assert_equals_($3,each);
  6628. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6629. self._assert_(_st(_st(stream)._next())._isNil());
  6630. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6631. args: [],
  6632. 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",
  6633. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  6634. referencedClasses: []
  6635. }),
  6636. smalltalk.StreamTest);
  6637. smalltalk.addMethod(
  6638. smalltalk.method({
  6639. selector: "testStreamContents",
  6640. category: 'tests',
  6641. fn: function (){
  6642. var self=this;
  6643. return smalltalk.withContext(function($ctx1) {
  6644. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  6645. args: [],
  6646. source: "testStreamContents",
  6647. messageSends: [],
  6648. referencedClasses: []
  6649. }),
  6650. smalltalk.StreamTest);
  6651. smalltalk.addMethod(
  6652. smalltalk.method({
  6653. selector: "testWrite",
  6654. category: 'tests',
  6655. fn: function (){
  6656. var self=this;
  6657. var stream,collection;
  6658. return smalltalk.withContext(function($ctx1) {
  6659. collection=self._newCollection();
  6660. stream=self._newStream();
  6661. _st(collection)._do_((function(each){
  6662. return smalltalk.withContext(function($ctx2) {
  6663. return _st(stream).__lt_lt(each);
  6664. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6665. self._assert_equals_(_st(stream)._contents(),collection);
  6666. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6667. args: [],
  6668. 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",
  6669. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  6670. referencedClasses: []
  6671. }),
  6672. smalltalk.StreamTest);
  6673. smalltalk.addMethod(
  6674. smalltalk.method({
  6675. selector: "testWriting",
  6676. category: 'tests',
  6677. fn: function (){
  6678. var self=this;
  6679. var stream,collection;
  6680. return smalltalk.withContext(function($ctx1) {
  6681. var $1;
  6682. collection=self._newCollection();
  6683. stream=self._newStream();
  6684. $ctx1.sendIdx["newStream"]=1;
  6685. _st(collection)._do_((function(each){
  6686. return smalltalk.withContext(function($ctx2) {
  6687. return _st(stream)._nextPut_(each);
  6688. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6689. $1=_st(stream)._contents();
  6690. $ctx1.sendIdx["contents"]=1;
  6691. self._assert_equals_($1,collection);
  6692. $ctx1.sendIdx["assert:equals:"]=1;
  6693. stream=self._newStream();
  6694. _st(stream)._nextPutAll_(collection);
  6695. self._assert_equals_(_st(stream)._contents(),collection);
  6696. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6697. args: [],
  6698. 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",
  6699. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  6700. referencedClasses: []
  6701. }),
  6702. smalltalk.StreamTest);
  6703. smalltalk.addMethod(
  6704. smalltalk.method({
  6705. selector: "collectionClass",
  6706. category: 'accessing',
  6707. fn: function (){
  6708. var self=this;
  6709. return smalltalk.withContext(function($ctx1) {
  6710. return nil;
  6711. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  6712. args: [],
  6713. source: "collectionClass\x0a\x09^ nil",
  6714. messageSends: [],
  6715. referencedClasses: []
  6716. }),
  6717. smalltalk.StreamTest.klass);
  6718. smalltalk.addMethod(
  6719. smalltalk.method({
  6720. selector: "isAbstract",
  6721. category: 'testing',
  6722. fn: function (){
  6723. var self=this;
  6724. return smalltalk.withContext(function($ctx1) {
  6725. var $1;
  6726. $1=_st(self._collectionClass())._isNil();
  6727. return $1;
  6728. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  6729. args: [],
  6730. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  6731. messageSends: ["isNil", "collectionClass"],
  6732. referencedClasses: []
  6733. }),
  6734. smalltalk.StreamTest.klass);
  6735. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6736. smalltalk.addMethod(
  6737. smalltalk.method({
  6738. selector: "newCollection",
  6739. category: 'accessing',
  6740. fn: function (){
  6741. var self=this;
  6742. return smalltalk.withContext(function($ctx1) {
  6743. var $1;
  6744. $1=[true,(1),(3).__at((4)),"foo"];
  6745. return $1;
  6746. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  6747. args: [],
  6748. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  6749. messageSends: ["@"],
  6750. referencedClasses: []
  6751. }),
  6752. smalltalk.ArrayStreamTest);
  6753. smalltalk.addMethod(
  6754. smalltalk.method({
  6755. selector: "collectionClass",
  6756. category: 'accessing',
  6757. fn: function (){
  6758. var self=this;
  6759. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  6760. return smalltalk.withContext(function($ctx1) {
  6761. return $Array();
  6762. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  6763. args: [],
  6764. source: "collectionClass\x0a\x09^ Array",
  6765. messageSends: [],
  6766. referencedClasses: ["Array"]
  6767. }),
  6768. smalltalk.ArrayStreamTest.klass);
  6769. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6770. smalltalk.addMethod(
  6771. smalltalk.method({
  6772. selector: "newCollection",
  6773. category: 'accessing',
  6774. fn: function (){
  6775. var self=this;
  6776. return smalltalk.withContext(function($ctx1) {
  6777. return "hello world";
  6778. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  6779. args: [],
  6780. source: "newCollection\x0a\x09^ 'hello world'",
  6781. messageSends: [],
  6782. referencedClasses: []
  6783. }),
  6784. smalltalk.StringStreamTest);
  6785. smalltalk.addMethod(
  6786. smalltalk.method({
  6787. selector: "collectionClass",
  6788. category: 'accessing',
  6789. fn: function (){
  6790. var self=this;
  6791. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  6792. return smalltalk.withContext(function($ctx1) {
  6793. return $String();
  6794. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  6795. args: [],
  6796. source: "collectionClass\x0a\x09^ String",
  6797. messageSends: [],
  6798. referencedClasses: ["String"]
  6799. }),
  6800. smalltalk.StringStreamTest.klass);
  6801. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6802. smalltalk.addMethod(
  6803. smalltalk.method({
  6804. selector: "testCopying",
  6805. category: 'tests',
  6806. fn: function (){
  6807. var self=this;
  6808. return smalltalk.withContext(function($ctx1) {
  6809. self._assert_equals_(nil._copy(),nil);
  6810. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  6811. args: [],
  6812. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  6813. messageSends: ["assert:equals:", "copy"],
  6814. referencedClasses: []
  6815. }),
  6816. smalltalk.UndefinedTest);
  6817. smalltalk.addMethod(
  6818. smalltalk.method({
  6819. selector: "testDeepCopy",
  6820. category: 'tests',
  6821. fn: function (){
  6822. var self=this;
  6823. return smalltalk.withContext(function($ctx1) {
  6824. self._assert_(_st(nil._deepCopy()).__eq(nil));
  6825. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  6826. args: [],
  6827. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  6828. messageSends: ["assert:", "=", "deepCopy"],
  6829. referencedClasses: []
  6830. }),
  6831. smalltalk.UndefinedTest);
  6832. smalltalk.addMethod(
  6833. smalltalk.method({
  6834. selector: "testIfNil",
  6835. category: 'tests',
  6836. fn: function (){
  6837. var self=this;
  6838. return smalltalk.withContext(function($ctx1) {
  6839. var $1,$3,$2,$4,$6,$5;
  6840. if(($receiver = nil) == nil || $receiver == null){
  6841. $1=true;
  6842. } else {
  6843. $1=nil;
  6844. };
  6845. self._assert_equals_($1,true);
  6846. $ctx1.sendIdx["assert:equals:"]=1;
  6847. if(($receiver = nil) == nil || $receiver == null){
  6848. $3=nil;
  6849. } else {
  6850. $3=true;
  6851. };
  6852. $2=_st($3).__eq(true);
  6853. $ctx1.sendIdx["="]=1;
  6854. self._deny_($2);
  6855. $ctx1.sendIdx["deny:"]=1;
  6856. if(($receiver = nil) == nil || $receiver == null){
  6857. $4=true;
  6858. } else {
  6859. $4=false;
  6860. };
  6861. self._assert_equals_($4,true);
  6862. if(($receiver = nil) == nil || $receiver == null){
  6863. $6=false;
  6864. } else {
  6865. $6=true;
  6866. };
  6867. $5=_st($6).__eq(true);
  6868. self._deny_($5);
  6869. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  6870. args: [],
  6871. 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",
  6872. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  6873. referencedClasses: []
  6874. }),
  6875. smalltalk.UndefinedTest);
  6876. smalltalk.addMethod(
  6877. smalltalk.method({
  6878. selector: "testIsNil",
  6879. category: 'tests',
  6880. fn: function (){
  6881. var self=this;
  6882. return smalltalk.withContext(function($ctx1) {
  6883. self._assert_(nil._isNil());
  6884. self._deny_(nil._notNil());
  6885. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  6886. args: [],
  6887. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  6888. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  6889. referencedClasses: []
  6890. }),
  6891. smalltalk.UndefinedTest);
  6892. });