Kernel-Tests.js 279 KB

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