1
0

Kernel-Tests.js 324 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', globals.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 globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return globals.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},globals.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. globals.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', globals.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 globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return globals.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},globals.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. globals.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 globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return globals.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},globals.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. globals.AnnouncerTest);
  110. smalltalk.addClass('BlockClosureTest', globals.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 globals.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",{},globals.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. globals.BlockClosureTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testCanClearTimeout",
  136. protocol: 'tests',
  137. fn: function (){
  138. var self=this;
  139. function $Error(){return globals.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",{},globals.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. globals.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",{},globals.BlockClosureTest)})},
  167. args: [],
  168. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  169. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  170. referencedClasses: []
  171. }),
  172. globals.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 globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  181. function $Array(){return globals.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},globals.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. globals.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 (3);
  212. }))._ensure_((function(){
  213. return (4);
  214. })),(3));
  215. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},globals.BlockClosureTest)})},
  216. args: [],
  217. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  218. messageSends: ["assert:equals:", "ensure:"],
  219. referencedClasses: []
  220. }),
  221. globals.BlockClosureTest);
  222. smalltalk.addMethod(
  223. smalltalk.method({
  224. selector: "testEnsureRaises",
  225. protocol: 'tests',
  226. fn: function (){
  227. var self=this;
  228. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  229. return smalltalk.withContext(function($ctx1) {
  230. self._should_raise_((function(){
  231. return smalltalk.withContext(function($ctx2) {
  232. return _st((function(){
  233. return smalltalk.withContext(function($ctx3) {
  234. return _st(_st($Error())._new())._signal();
  235. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  236. return true;
  237. }));
  238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  239. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},globals.BlockClosureTest)})},
  240. args: [],
  241. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  242. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  243. referencedClasses: ["Error"]
  244. }),
  245. globals.BlockClosureTest);
  246. smalltalk.addMethod(
  247. smalltalk.method({
  248. selector: "testExceptionSemantics",
  249. protocol: 'tests',
  250. fn: function (){
  251. var self=this;
  252. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  253. return smalltalk.withContext(function($ctx1) {
  254. self._timeout_((100));
  255. _st(self._async_((function(){
  256. return smalltalk.withContext(function($ctx2) {
  257. return _st((function(){
  258. return smalltalk.withContext(function($ctx3) {
  259. self._assert_(true);
  260. _st($Error())._signal();
  261. self._deny_(true);
  262. return self._finished();
  263. $ctx3.sendIdx["finished"]=1;
  264. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  265. return smalltalk.withContext(function($ctx3) {
  266. return self._finished();
  267. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  269. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},globals.BlockClosureTest)})},
  270. args: [],
  271. 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",
  272. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  273. referencedClasses: ["Error"]
  274. }),
  275. globals.BlockClosureTest);
  276. smalltalk.addMethod(
  277. smalltalk.method({
  278. selector: "testNewWithValues",
  279. protocol: 'tests',
  280. fn: function (){
  281. var self=this;
  282. return smalltalk.withContext(function($ctx1) {
  283. function TestConstructor(arg1, arg2, arg3) {}
  284. TestConstructor.prototype.name = 'theTestPrototype';
  285. var wrappedConstructor = _st(TestConstructor);
  286. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  287. self._assert_(result instanceof TestConstructor);
  288. self._assert_equals_(result.name, 'theTestPrototype');
  289. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  290. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);;
  291. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},globals.BlockClosureTest)})},
  292. args: [],
  293. source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\x0a\x0a\x09var wrappedConstructor = _st(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._assert_equals_(result.name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);\x0a>",
  294. messageSends: [],
  295. referencedClasses: []
  296. }),
  297. globals.BlockClosureTest);
  298. smalltalk.addMethod(
  299. smalltalk.method({
  300. selector: "testNumArgs",
  301. protocol: 'tests',
  302. fn: function (){
  303. var self=this;
  304. return smalltalk.withContext(function($ctx1) {
  305. var $1;
  306. $1=_st((function(){
  307. }))._numArgs();
  308. $ctx1.sendIdx["numArgs"]=1;
  309. self._assert_equals_($1,(0));
  310. $ctx1.sendIdx["assert:equals:"]=1;
  311. self._assert_equals_(_st((function(a,b){
  312. }))._numArgs(),(2));
  313. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},globals.BlockClosureTest)})},
  314. args: [],
  315. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  316. messageSends: ["assert:equals:", "numArgs"],
  317. referencedClasses: []
  318. }),
  319. globals.BlockClosureTest);
  320. smalltalk.addMethod(
  321. smalltalk.method({
  322. selector: "testOnDo",
  323. protocol: 'tests',
  324. fn: function (){
  325. var self=this;
  326. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  327. return smalltalk.withContext(function($ctx1) {
  328. self._assert_(_st((function(){
  329. return smalltalk.withContext(function($ctx2) {
  330. return _st(_st($Error())._new())._signal();
  331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  332. return true;
  333. })));
  334. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},globals.BlockClosureTest)})},
  335. args: [],
  336. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  337. messageSends: ["assert:", "on:do:", "signal", "new"],
  338. referencedClasses: ["Error"]
  339. }),
  340. globals.BlockClosureTest);
  341. smalltalk.addMethod(
  342. smalltalk.method({
  343. selector: "testValue",
  344. protocol: 'tests',
  345. fn: function (){
  346. var self=this;
  347. return smalltalk.withContext(function($ctx1) {
  348. var $1;
  349. $1=_st((function(){
  350. return smalltalk.withContext(function($ctx2) {
  351. return (1).__plus((1));
  352. $ctx2.sendIdx["+"]=1;
  353. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  354. $ctx1.sendIdx["value"]=1;
  355. self._assert_equals_($1,(2));
  356. $ctx1.sendIdx["assert:equals:"]=1;
  357. self._assert_equals_(_st((function(x){
  358. return smalltalk.withContext(function($ctx2) {
  359. return _st(x).__plus((1));
  360. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  361. $ctx1.sendIdx["assert:equals:"]=2;
  362. self._assert_equals_(_st((function(x,y){
  363. return smalltalk.withContext(function($ctx2) {
  364. return _st(x).__star(y);
  365. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  366. $ctx1.sendIdx["assert:equals:"]=3;
  367. self._assert_equals_(_st((function(a,b,c){
  368. return (1);
  369. }))._value(),(1));
  370. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.BlockClosureTest)})},
  371. args: [],
  372. 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",
  373. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  374. referencedClasses: []
  375. }),
  376. globals.BlockClosureTest);
  377. smalltalk.addMethod(
  378. smalltalk.method({
  379. selector: "testValueWithPossibleArguments",
  380. protocol: 'tests',
  381. fn: function (){
  382. var self=this;
  383. return smalltalk.withContext(function($ctx1) {
  384. var $1,$2;
  385. $1=_st((function(){
  386. return (1);
  387. }))._valueWithPossibleArguments_([(3), (4)]);
  388. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  389. self._assert_equals_($1,(1));
  390. $ctx1.sendIdx["assert:equals:"]=1;
  391. $2=_st((function(a){
  392. return smalltalk.withContext(function($ctx2) {
  393. return _st(a).__plus((4));
  394. $ctx2.sendIdx["+"]=1;
  395. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  396. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  397. self._assert_equals_($2,(7));
  398. $ctx1.sendIdx["assert:equals:"]=2;
  399. self._assert_equals_(_st((function(a,b){
  400. return smalltalk.withContext(function($ctx2) {
  401. return _st(a).__plus(b);
  402. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  403. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},globals.BlockClosureTest)})},
  404. args: [],
  405. 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.",
  406. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  407. referencedClasses: []
  408. }),
  409. globals.BlockClosureTest);
  410. smalltalk.addMethod(
  411. smalltalk.method({
  412. selector: "testWhileFalse",
  413. protocol: 'tests',
  414. fn: function (){
  415. var self=this;
  416. var i;
  417. return smalltalk.withContext(function($ctx1) {
  418. i=(0);
  419. _st((function(){
  420. return smalltalk.withContext(function($ctx2) {
  421. return _st(i).__gt((5));
  422. $ctx2.sendIdx[">"]=1;
  423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  424. return smalltalk.withContext(function($ctx2) {
  425. i=_st(i).__plus((1));
  426. $ctx2.sendIdx["+"]=1;
  427. return i;
  428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  429. self._assert_equals_(i,(6));
  430. $ctx1.sendIdx["assert:equals:"]=1;
  431. i=(0);
  432. _st((function(){
  433. return smalltalk.withContext(function($ctx2) {
  434. i=_st(i).__plus((1));
  435. i;
  436. return _st(i).__gt((5));
  437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  438. self._assert_equals_(i,(6));
  439. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},globals.BlockClosureTest)})},
  440. args: [],
  441. 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",
  442. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  443. referencedClasses: []
  444. }),
  445. globals.BlockClosureTest);
  446. smalltalk.addMethod(
  447. smalltalk.method({
  448. selector: "testWhileTrue",
  449. protocol: 'tests',
  450. fn: function (){
  451. var self=this;
  452. var i;
  453. return smalltalk.withContext(function($ctx1) {
  454. i=(0);
  455. _st((function(){
  456. return smalltalk.withContext(function($ctx2) {
  457. return _st(i).__lt((5));
  458. $ctx2.sendIdx["<"]=1;
  459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  460. return smalltalk.withContext(function($ctx2) {
  461. i=_st(i).__plus((1));
  462. $ctx2.sendIdx["+"]=1;
  463. return i;
  464. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  465. self._assert_equals_(i,(5));
  466. $ctx1.sendIdx["assert:equals:"]=1;
  467. i=(0);
  468. _st((function(){
  469. return smalltalk.withContext(function($ctx2) {
  470. i=_st(i).__plus((1));
  471. i;
  472. return _st(i).__lt((5));
  473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  474. self._assert_equals_(i,(5));
  475. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},globals.BlockClosureTest)})},
  476. args: [],
  477. 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",
  478. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  479. referencedClasses: []
  480. }),
  481. globals.BlockClosureTest);
  482. smalltalk.addClass('BooleanTest', globals.TestCase, [], 'Kernel-Tests');
  483. smalltalk.addMethod(
  484. smalltalk.method({
  485. selector: "testEquality",
  486. protocol: 'tests',
  487. fn: function (){
  488. var self=this;
  489. return smalltalk.withContext(function($ctx1) {
  490. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  491. $1=(0).__eq(false);
  492. $ctx1.sendIdx["="]=1;
  493. self._deny_($1);
  494. $ctx1.sendIdx["deny:"]=1;
  495. $2=false.__eq((0));
  496. $ctx1.sendIdx["="]=2;
  497. self._deny_($2);
  498. $ctx1.sendIdx["deny:"]=2;
  499. $3="".__eq(false);
  500. $ctx1.sendIdx["="]=3;
  501. self._deny_($3);
  502. $ctx1.sendIdx["deny:"]=3;
  503. $4=false.__eq("");
  504. $ctx1.sendIdx["="]=4;
  505. self._deny_($4);
  506. $ctx1.sendIdx["deny:"]=4;
  507. $5=true.__eq(true);
  508. $ctx1.sendIdx["="]=5;
  509. self._assert_($5);
  510. $ctx1.sendIdx["assert:"]=1;
  511. $6=false.__eq(true);
  512. $ctx1.sendIdx["="]=6;
  513. self._deny_($6);
  514. $ctx1.sendIdx["deny:"]=5;
  515. $7=true.__eq(false);
  516. $ctx1.sendIdx["="]=7;
  517. self._deny_($7);
  518. $8=false.__eq(false);
  519. $ctx1.sendIdx["="]=8;
  520. self._assert_($8);
  521. $ctx1.sendIdx["assert:"]=2;
  522. $10=true._yourself();
  523. $ctx1.sendIdx["yourself"]=1;
  524. $9=_st($10).__eq(true);
  525. $ctx1.sendIdx["="]=9;
  526. self._assert_($9);
  527. $ctx1.sendIdx["assert:"]=3;
  528. $12=true._yourself();
  529. $ctx1.sendIdx["yourself"]=2;
  530. $11=_st($12).__eq(true._yourself());
  531. self._assert_($11);
  532. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.BooleanTest)})},
  533. args: [],
  534. 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)",
  535. messageSends: ["deny:", "=", "assert:", "yourself"],
  536. referencedClasses: []
  537. }),
  538. globals.BooleanTest);
  539. smalltalk.addMethod(
  540. smalltalk.method({
  541. selector: "testIdentity",
  542. protocol: 'tests',
  543. fn: function (){
  544. var self=this;
  545. return smalltalk.withContext(function($ctx1) {
  546. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  547. $1=(0).__eq_eq(false);
  548. $ctx1.sendIdx["=="]=1;
  549. self._deny_($1);
  550. $ctx1.sendIdx["deny:"]=1;
  551. $2=false.__eq_eq((0));
  552. $ctx1.sendIdx["=="]=2;
  553. self._deny_($2);
  554. $ctx1.sendIdx["deny:"]=2;
  555. $3="".__eq_eq(false);
  556. $ctx1.sendIdx["=="]=3;
  557. self._deny_($3);
  558. $ctx1.sendIdx["deny:"]=3;
  559. $4=false.__eq_eq("");
  560. $ctx1.sendIdx["=="]=4;
  561. self._deny_($4);
  562. $ctx1.sendIdx["deny:"]=4;
  563. $5=true.__eq_eq(true);
  564. $ctx1.sendIdx["=="]=5;
  565. self._assert_($5);
  566. $ctx1.sendIdx["assert:"]=1;
  567. $6=false.__eq_eq(true);
  568. $ctx1.sendIdx["=="]=6;
  569. self._deny_($6);
  570. $ctx1.sendIdx["deny:"]=5;
  571. $7=true.__eq_eq(false);
  572. $ctx1.sendIdx["=="]=7;
  573. self._deny_($7);
  574. $8=false.__eq_eq(false);
  575. $ctx1.sendIdx["=="]=8;
  576. self._assert_($8);
  577. $ctx1.sendIdx["assert:"]=2;
  578. $10=true._yourself();
  579. $ctx1.sendIdx["yourself"]=1;
  580. $9=_st($10).__eq_eq(true);
  581. $ctx1.sendIdx["=="]=9;
  582. self._assert_($9);
  583. $ctx1.sendIdx["assert:"]=3;
  584. $12=true._yourself();
  585. $ctx1.sendIdx["yourself"]=2;
  586. $11=_st($12).__eq_eq(true._yourself());
  587. self._assert_($11);
  588. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.BooleanTest)})},
  589. args: [],
  590. 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",
  591. messageSends: ["deny:", "==", "assert:", "yourself"],
  592. referencedClasses: []
  593. }),
  594. globals.BooleanTest);
  595. smalltalk.addMethod(
  596. smalltalk.method({
  597. selector: "testIfTrueIfFalse",
  598. protocol: 'tests',
  599. fn: function (){
  600. var self=this;
  601. return smalltalk.withContext(function($ctx1) {
  602. var $1,$2,$3,$4,$5,$6,$7,$8;
  603. if(smalltalk.assert(true)){
  604. $1="alternative block";
  605. };
  606. self._assert_equals_($1,"alternative block");
  607. $ctx1.sendIdx["assert:equals:"]=1;
  608. if(! smalltalk.assert(true)){
  609. $2="alternative block";
  610. };
  611. self._assert_equals_($2,nil);
  612. $ctx1.sendIdx["assert:equals:"]=2;
  613. if(smalltalk.assert(false)){
  614. $3="alternative block";
  615. };
  616. self._assert_equals_($3,nil);
  617. $ctx1.sendIdx["assert:equals:"]=3;
  618. if(! smalltalk.assert(false)){
  619. $4="alternative block";
  620. };
  621. self._assert_equals_($4,"alternative block");
  622. $ctx1.sendIdx["assert:equals:"]=4;
  623. if(smalltalk.assert(false)){
  624. $5="alternative block";
  625. } else {
  626. $5="alternative block2";
  627. };
  628. self._assert_equals_($5,"alternative block2");
  629. $ctx1.sendIdx["assert:equals:"]=5;
  630. if(smalltalk.assert(false)){
  631. $6="alternative block2";
  632. } else {
  633. $6="alternative block";
  634. };
  635. self._assert_equals_($6,"alternative block");
  636. $ctx1.sendIdx["assert:equals:"]=6;
  637. if(smalltalk.assert(true)){
  638. $7="alternative block";
  639. } else {
  640. $7="alternative block2";
  641. };
  642. self._assert_equals_($7,"alternative block");
  643. $ctx1.sendIdx["assert:equals:"]=7;
  644. if(smalltalk.assert(true)){
  645. $8="alternative block2";
  646. } else {
  647. $8="alternative block";
  648. };
  649. self._assert_equals_($8,"alternative block2");
  650. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},globals.BooleanTest)})},
  651. args: [],
  652. 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'.",
  653. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  654. referencedClasses: []
  655. }),
  656. globals.BooleanTest);
  657. smalltalk.addMethod(
  658. smalltalk.method({
  659. selector: "testIfTrueIfFalseWithBoxing",
  660. protocol: 'tests',
  661. fn: function (){
  662. var self=this;
  663. return smalltalk.withContext(function($ctx1) {
  664. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  665. $2=true._yourself();
  666. $ctx1.sendIdx["yourself"]=1;
  667. if(smalltalk.assert($2)){
  668. $1="alternative block";
  669. };
  670. self._assert_equals_($1,"alternative block");
  671. $ctx1.sendIdx["assert:equals:"]=1;
  672. $4=true._yourself();
  673. $ctx1.sendIdx["yourself"]=2;
  674. if(! smalltalk.assert($4)){
  675. $3="alternative block";
  676. };
  677. self._assert_equals_($3,nil);
  678. $ctx1.sendIdx["assert:equals:"]=2;
  679. $6=false._yourself();
  680. $ctx1.sendIdx["yourself"]=3;
  681. if(smalltalk.assert($6)){
  682. $5="alternative block";
  683. };
  684. self._assert_equals_($5,nil);
  685. $ctx1.sendIdx["assert:equals:"]=3;
  686. $8=false._yourself();
  687. $ctx1.sendIdx["yourself"]=4;
  688. if(! smalltalk.assert($8)){
  689. $7="alternative block";
  690. };
  691. self._assert_equals_($7,"alternative block");
  692. $ctx1.sendIdx["assert:equals:"]=4;
  693. $10=false._yourself();
  694. $ctx1.sendIdx["yourself"]=5;
  695. if(smalltalk.assert($10)){
  696. $9="alternative block";
  697. } else {
  698. $9="alternative block2";
  699. };
  700. self._assert_equals_($9,"alternative block2");
  701. $ctx1.sendIdx["assert:equals:"]=5;
  702. $12=false._yourself();
  703. $ctx1.sendIdx["yourself"]=6;
  704. if(smalltalk.assert($12)){
  705. $11="alternative block2";
  706. } else {
  707. $11="alternative block";
  708. };
  709. self._assert_equals_($11,"alternative block");
  710. $ctx1.sendIdx["assert:equals:"]=6;
  711. $14=true._yourself();
  712. $ctx1.sendIdx["yourself"]=7;
  713. if(smalltalk.assert($14)){
  714. $13="alternative block";
  715. } else {
  716. $13="alternative block2";
  717. };
  718. self._assert_equals_($13,"alternative block");
  719. $ctx1.sendIdx["assert:equals:"]=7;
  720. $16=true._yourself();
  721. if(smalltalk.assert($16)){
  722. $15="alternative block2";
  723. } else {
  724. $15="alternative block";
  725. };
  726. self._assert_equals_($15,"alternative block2");
  727. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},globals.BooleanTest)})},
  728. args: [],
  729. 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'.",
  730. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  731. referencedClasses: []
  732. }),
  733. globals.BooleanTest);
  734. smalltalk.addMethod(
  735. smalltalk.method({
  736. selector: "testLogic",
  737. protocol: 'tests',
  738. fn: function (){
  739. var self=this;
  740. return smalltalk.withContext(function($ctx1) {
  741. 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;
  742. $1=true.__and(true);
  743. $ctx1.sendIdx["&"]=1;
  744. self._assert_($1);
  745. $ctx1.sendIdx["assert:"]=1;
  746. $2=true.__and(false);
  747. $ctx1.sendIdx["&"]=2;
  748. self._deny_($2);
  749. $ctx1.sendIdx["deny:"]=1;
  750. $3=false.__and(true);
  751. $ctx1.sendIdx["&"]=3;
  752. self._deny_($3);
  753. $ctx1.sendIdx["deny:"]=2;
  754. $5=false.__and(false);
  755. $ctx1.sendIdx["&"]=4;
  756. $4=self._deny_($5);
  757. $ctx1.sendIdx["deny:"]=3;
  758. $6=true.__or(true);
  759. $ctx1.sendIdx["|"]=1;
  760. self._assert_($6);
  761. $ctx1.sendIdx["assert:"]=2;
  762. $7=true.__or(false);
  763. $ctx1.sendIdx["|"]=2;
  764. self._assert_($7);
  765. $ctx1.sendIdx["assert:"]=3;
  766. $8=false.__or(true);
  767. $ctx1.sendIdx["|"]=3;
  768. self._assert_($8);
  769. $ctx1.sendIdx["assert:"]=4;
  770. $10=false.__or(false);
  771. $ctx1.sendIdx["|"]=4;
  772. $9=self._deny_($10);
  773. $ctx1.sendIdx["deny:"]=4;
  774. $12=(1).__gt((0));
  775. $ctx1.sendIdx[">"]=1;
  776. $11=true.__and($12);
  777. $ctx1.sendIdx["&"]=5;
  778. self._assert_($11);
  779. $ctx1.sendIdx["assert:"]=5;
  780. $14=(1).__gt((0));
  781. $ctx1.sendIdx[">"]=2;
  782. $13=_st($14).__and(false);
  783. $ctx1.sendIdx["&"]=6;
  784. self._deny_($13);
  785. $ctx1.sendIdx["deny:"]=5;
  786. $17=(1).__gt((0));
  787. $ctx1.sendIdx[">"]=3;
  788. $18=(1).__gt((2));
  789. $ctx1.sendIdx[">"]=4;
  790. $16=_st($17).__and($18);
  791. $15=self._deny_($16);
  792. $20=(1).__gt((0));
  793. $ctx1.sendIdx[">"]=5;
  794. $19=false.__or($20);
  795. $ctx1.sendIdx["|"]=5;
  796. self._assert_($19);
  797. $ctx1.sendIdx["assert:"]=6;
  798. $22=(1).__gt((0));
  799. $ctx1.sendIdx[">"]=6;
  800. $21=_st($22).__or(false);
  801. $ctx1.sendIdx["|"]=6;
  802. self._assert_($21);
  803. $ctx1.sendIdx["assert:"]=7;
  804. $25=(1).__gt((0));
  805. $ctx1.sendIdx[">"]=7;
  806. $24=_st($25).__or((1).__gt((2)));
  807. $23=self._assert_($24);
  808. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},globals.BooleanTest)})},
  809. args: [],
  810. 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))",
  811. messageSends: ["assert:", "&", "deny:", "|", ">"],
  812. referencedClasses: []
  813. }),
  814. globals.BooleanTest);
  815. smalltalk.addMethod(
  816. smalltalk.method({
  817. selector: "testLogicKeywords",
  818. protocol: 'tests',
  819. fn: function (){
  820. var self=this;
  821. return smalltalk.withContext(function($ctx1) {
  822. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  823. $1=true._and_((function(){
  824. return true;
  825. }));
  826. $ctx1.sendIdx["and:"]=1;
  827. self._assert_($1);
  828. $ctx1.sendIdx["assert:"]=1;
  829. $2=true._and_((function(){
  830. return false;
  831. }));
  832. $ctx1.sendIdx["and:"]=2;
  833. self._deny_($2);
  834. $ctx1.sendIdx["deny:"]=1;
  835. $3=false._and_((function(){
  836. return true;
  837. }));
  838. $ctx1.sendIdx["and:"]=3;
  839. self._deny_($3);
  840. $ctx1.sendIdx["deny:"]=2;
  841. $5=false._and_((function(){
  842. return false;
  843. }));
  844. $ctx1.sendIdx["and:"]=4;
  845. $4=self._deny_($5);
  846. $ctx1.sendIdx["deny:"]=3;
  847. $6=true._or_((function(){
  848. return true;
  849. }));
  850. $ctx1.sendIdx["or:"]=1;
  851. self._assert_($6);
  852. $ctx1.sendIdx["assert:"]=2;
  853. $7=true._or_((function(){
  854. return false;
  855. }));
  856. $ctx1.sendIdx["or:"]=2;
  857. self._assert_($7);
  858. $ctx1.sendIdx["assert:"]=3;
  859. $8=false._or_((function(){
  860. return true;
  861. }));
  862. $ctx1.sendIdx["or:"]=3;
  863. self._assert_($8);
  864. $ctx1.sendIdx["assert:"]=4;
  865. $10=false._or_((function(){
  866. return false;
  867. }));
  868. $ctx1.sendIdx["or:"]=4;
  869. $9=self._deny_($10);
  870. $ctx1.sendIdx["deny:"]=4;
  871. $11=true._and_((function(){
  872. return smalltalk.withContext(function($ctx2) {
  873. return (1).__gt((0));
  874. $ctx2.sendIdx[">"]=1;
  875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  876. $ctx1.sendIdx["and:"]=5;
  877. self._assert_($11);
  878. $ctx1.sendIdx["assert:"]=5;
  879. $13=(1).__gt((0));
  880. $ctx1.sendIdx[">"]=2;
  881. $12=_st($13)._and_((function(){
  882. return false;
  883. }));
  884. $ctx1.sendIdx["and:"]=6;
  885. self._deny_($12);
  886. $ctx1.sendIdx["deny:"]=5;
  887. $16=(1).__gt((0));
  888. $ctx1.sendIdx[">"]=3;
  889. $15=_st($16)._and_((function(){
  890. return smalltalk.withContext(function($ctx2) {
  891. return (1).__gt((2));
  892. $ctx2.sendIdx[">"]=4;
  893. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  894. $14=self._deny_($15);
  895. $17=false._or_((function(){
  896. return smalltalk.withContext(function($ctx2) {
  897. return (1).__gt((0));
  898. $ctx2.sendIdx[">"]=5;
  899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  900. $ctx1.sendIdx["or:"]=5;
  901. self._assert_($17);
  902. $ctx1.sendIdx["assert:"]=6;
  903. $19=(1).__gt((0));
  904. $ctx1.sendIdx[">"]=6;
  905. $18=_st($19)._or_((function(){
  906. return false;
  907. }));
  908. $ctx1.sendIdx["or:"]=6;
  909. self._assert_($18);
  910. $ctx1.sendIdx["assert:"]=7;
  911. $22=(1).__gt((0));
  912. $ctx1.sendIdx[">"]=7;
  913. $21=_st($22)._or_((function(){
  914. return smalltalk.withContext(function($ctx2) {
  915. return (1).__gt((2));
  916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  917. $20=self._assert_($21);
  918. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},globals.BooleanTest)})},
  919. args: [],
  920. 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 ])",
  921. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  922. referencedClasses: []
  923. }),
  924. globals.BooleanTest);
  925. smalltalk.addMethod(
  926. smalltalk.method({
  927. selector: "testNonBooleanError",
  928. protocol: 'tests',
  929. fn: function (){
  930. var self=this;
  931. function $NonBooleanReceiver(){return globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  932. return smalltalk.withContext(function($ctx1) {
  933. self._should_raise_((function(){
  934. return smalltalk.withContext(function($ctx2) {
  935. if(smalltalk.assert("")){
  936. } else {
  937. };
  938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  939. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},globals.BooleanTest)})},
  940. args: [],
  941. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  942. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  943. referencedClasses: ["NonBooleanReceiver"]
  944. }),
  945. globals.BooleanTest);
  946. smalltalk.addClass('ClassBuilderTest', globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  947. smalltalk.addMethod(
  948. smalltalk.method({
  949. selector: "setUp",
  950. protocol: 'running',
  951. fn: function (){
  952. var self=this;
  953. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  954. return smalltalk.withContext(function($ctx1) {
  955. self["@builder"]=_st($ClassBuilder())._new();
  956. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ClassBuilderTest)})},
  957. args: [],
  958. source: "setUp\x0a\x09builder := ClassBuilder new",
  959. messageSends: ["new"],
  960. referencedClasses: ["ClassBuilder"]
  961. }),
  962. globals.ClassBuilderTest);
  963. smalltalk.addMethod(
  964. smalltalk.method({
  965. selector: "tearDown",
  966. protocol: 'running',
  967. fn: function (){
  968. var self=this;
  969. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  970. return smalltalk.withContext(function($ctx1) {
  971. var $1;
  972. $1=self["@theClass"];
  973. if(($receiver = $1) == nil || $receiver == null){
  974. $1;
  975. } else {
  976. _st($Smalltalk())._removeClass_(self["@theClass"]);
  977. self["@theClass"]=nil;
  978. self["@theClass"];
  979. };
  980. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.ClassBuilderTest)})},
  981. args: [],
  982. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  983. messageSends: ["ifNotNil:", "removeClass:"],
  984. referencedClasses: ["Smalltalk"]
  985. }),
  986. globals.ClassBuilderTest);
  987. smalltalk.addMethod(
  988. smalltalk.method({
  989. selector: "testClassCopy",
  990. protocol: 'tests',
  991. fn: function (){
  992. var self=this;
  993. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  994. return smalltalk.withContext(function($ctx1) {
  995. var $2,$1,$4,$3,$6,$5,$8,$7;
  996. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  997. $2=_st(self["@theClass"])._superclass();
  998. $ctx1.sendIdx["superclass"]=1;
  999. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1000. $ctx1.sendIdx["=="]=1;
  1001. self._assert_($1);
  1002. $ctx1.sendIdx["assert:"]=1;
  1003. $4=_st(self["@theClass"])._instanceVariableNames();
  1004. $ctx1.sendIdx["instanceVariableNames"]=1;
  1005. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1006. $ctx1.sendIdx["=="]=2;
  1007. self._assert_($3);
  1008. $ctx1.sendIdx["assert:"]=2;
  1009. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1010. $ctx1.sendIdx["assert:equals:"]=1;
  1011. $6=_st(self["@theClass"])._package();
  1012. $ctx1.sendIdx["package"]=1;
  1013. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1014. self._assert_($5);
  1015. $8=_st(self["@theClass"])._methodDictionary();
  1016. $ctx1.sendIdx["methodDictionary"]=1;
  1017. $7=_st($8)._keys();
  1018. $ctx1.sendIdx["keys"]=1;
  1019. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1020. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},globals.ClassBuilderTest)})},
  1021. args: [],
  1022. 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",
  1023. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1024. referencedClasses: ["ObjectMock"]
  1025. }),
  1026. globals.ClassBuilderTest);
  1027. smalltalk.addMethod(
  1028. smalltalk.method({
  1029. selector: "testClassMigration",
  1030. protocol: 'tests',
  1031. fn: function (){
  1032. var self=this;
  1033. var instance,oldClass;
  1034. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1035. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1036. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1037. return smalltalk.withContext(function($ctx1) {
  1038. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  1039. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1040. $2=_st($Smalltalk())._globals();
  1041. $ctx1.sendIdx["globals"]=1;
  1042. $1=_st($2)._at_("ObjectMock2");
  1043. $ctx1.sendIdx["at:"]=1;
  1044. instance=_st($1)._new();
  1045. $4=_st($Smalltalk())._globals();
  1046. $ctx1.sendIdx["globals"]=2;
  1047. $3=_st($4)._at_("ObjectMock2");
  1048. $ctx1.sendIdx["at:"]=2;
  1049. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1050. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1051. $ctx1.sendIdx["=="]=1;
  1052. self._deny_($5);
  1053. $ctx1.sendIdx["deny:"]=1;
  1054. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1055. $ctx1.sendIdx["=="]=2;
  1056. self._assert_($6);
  1057. $ctx1.sendIdx["assert:"]=1;
  1058. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1059. $ctx1.sendIdx["assert:"]=2;
  1060. $7=_st($ObjectMock2())._selectors();
  1061. $ctx1.sendIdx["selectors"]=1;
  1062. self._assert_equals_($7,_st(oldClass)._selectors());
  1063. $ctx1.sendIdx["assert:equals:"]=1;
  1064. $8=_st($ObjectMock2())._comment();
  1065. $ctx1.sendIdx["comment"]=1;
  1066. self._assert_equals_($8,_st(oldClass)._comment());
  1067. $ctx1.sendIdx["assert:equals:"]=2;
  1068. $9=_st(_st($ObjectMock2())._package())._name();
  1069. $ctx1.sendIdx["name"]=1;
  1070. self._assert_equals_($9,"Kernel-Tests");
  1071. $11=_st(instance)._class();
  1072. $ctx1.sendIdx["class"]=1;
  1073. $10=_st($11).__eq_eq($ObjectMock2());
  1074. self._deny_($10);
  1075. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  1076. _st($Smalltalk())._removeClass_($ObjectMock2());
  1077. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},globals.ClassBuilderTest)})},
  1078. args: [],
  1079. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals 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 globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  1080. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1081. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1082. }),
  1083. globals.ClassBuilderTest);
  1084. smalltalk.addMethod(
  1085. smalltalk.method({
  1086. selector: "testClassMigrationWithClassInstanceVariables",
  1087. protocol: 'tests',
  1088. fn: function (){
  1089. var self=this;
  1090. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1091. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1092. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1093. return smalltalk.withContext(function($ctx1) {
  1094. var $1;
  1095. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1096. $1=_st($ObjectMock2())._class();
  1097. $ctx1.sendIdx["class"]=1;
  1098. _st($1)._instanceVariableNames_("foo bar");
  1099. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1100. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1101. _st($Smalltalk())._removeClass_($ObjectMock2());
  1102. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},globals.ClassBuilderTest)})},
  1103. args: [],
  1104. 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 globals 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 removeClass: ObjectMock2",
  1105. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1106. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1107. }),
  1108. globals.ClassBuilderTest);
  1109. smalltalk.addMethod(
  1110. smalltalk.method({
  1111. selector: "testClassMigrationWithSubclasses",
  1112. protocol: 'tests',
  1113. fn: function (){
  1114. var self=this;
  1115. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1116. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1117. function $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1118. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1119. function $ObjectMock4(){return globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1120. return smalltalk.withContext(function($ctx1) {
  1121. var $2,$1,$4,$3;
  1122. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1123. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1124. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1125. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1126. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1127. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1128. $2=_st($ObjectMock())._subclasses();
  1129. $ctx1.sendIdx["subclasses"]=1;
  1130. $1=_st($2)._includes_($ObjectMock2());
  1131. $ctx1.sendIdx["includes:"]=1;
  1132. self._assert_($1);
  1133. $ctx1.sendIdx["assert:"]=1;
  1134. $4=_st($ObjectMock2())._subclasses();
  1135. $ctx1.sendIdx["subclasses"]=2;
  1136. $3=_st($4)._includes_($ObjectMock3());
  1137. $ctx1.sendIdx["includes:"]=2;
  1138. self._assert_($3);
  1139. $ctx1.sendIdx["assert:"]=2;
  1140. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1141. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1142. return smalltalk.withContext(function($ctx2) {
  1143. return _st($Smalltalk())._removeClass_(each);
  1144. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1145. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},globals.ClassBuilderTest)})},
  1146. args: [],
  1147. 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 globals 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 removeClass: each ]",
  1148. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1149. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1150. }),
  1151. globals.ClassBuilderTest);
  1152. smalltalk.addMethod(
  1153. smalltalk.method({
  1154. selector: "testInstanceVariableNames",
  1155. protocol: 'tests',
  1156. fn: function (){
  1157. var self=this;
  1158. return smalltalk.withContext(function($ctx1) {
  1159. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1160. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},globals.ClassBuilderTest)})},
  1161. args: [],
  1162. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1163. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1164. referencedClasses: []
  1165. }),
  1166. globals.ClassBuilderTest);
  1167. smalltalk.addClass('CollectionTest', globals.TestCase, [], 'Kernel-Tests');
  1168. smalltalk.addMethod(
  1169. smalltalk.method({
  1170. selector: "assertSameContents:as:",
  1171. protocol: 'convenience',
  1172. fn: function (aCollection,anotherCollection){
  1173. var self=this;
  1174. return smalltalk.withContext(function($ctx1) {
  1175. var $2,$1,$4,$3;
  1176. $2=_st(aCollection)._size();
  1177. $ctx1.sendIdx["size"]=1;
  1178. $1=_st($2).__eq(_st(anotherCollection)._size());
  1179. $ctx1.sendIdx["="]=1;
  1180. self._assert_($1);
  1181. $ctx1.sendIdx["assert:"]=1;
  1182. _st(aCollection)._do_((function(each){
  1183. return smalltalk.withContext(function($ctx2) {
  1184. $4=_st(aCollection)._occurrencesOf_(each);
  1185. $ctx2.sendIdx["occurrencesOf:"]=1;
  1186. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1187. return self._assert_($3);
  1188. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1189. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},globals.CollectionTest)})},
  1190. args: ["aCollection", "anotherCollection"],
  1191. 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)) ]",
  1192. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1193. referencedClasses: []
  1194. }),
  1195. globals.CollectionTest);
  1196. smalltalk.addMethod(
  1197. smalltalk.method({
  1198. selector: "collection",
  1199. protocol: 'fixture',
  1200. fn: function (){
  1201. var self=this;
  1202. return smalltalk.withContext(function($ctx1) {
  1203. self._subclassResponsibility();
  1204. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},globals.CollectionTest)})},
  1205. args: [],
  1206. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1207. messageSends: ["subclassResponsibility"],
  1208. referencedClasses: []
  1209. }),
  1210. globals.CollectionTest);
  1211. smalltalk.addMethod(
  1212. smalltalk.method({
  1213. selector: "collectionClass",
  1214. protocol: 'fixture',
  1215. fn: function (){
  1216. var self=this;
  1217. return smalltalk.withContext(function($ctx1) {
  1218. var $1;
  1219. $1=_st(self._class())._collectionClass();
  1220. return $1;
  1221. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.CollectionTest)})},
  1222. args: [],
  1223. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1224. messageSends: ["collectionClass", "class"],
  1225. referencedClasses: []
  1226. }),
  1227. globals.CollectionTest);
  1228. smalltalk.addMethod(
  1229. smalltalk.method({
  1230. selector: "collectionOfPrintStrings",
  1231. protocol: 'fixture',
  1232. fn: function (){
  1233. var self=this;
  1234. return smalltalk.withContext(function($ctx1) {
  1235. self._subclassResponsibility();
  1236. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.CollectionTest)})},
  1237. args: [],
  1238. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1239. messageSends: ["subclassResponsibility"],
  1240. referencedClasses: []
  1241. }),
  1242. globals.CollectionTest);
  1243. smalltalk.addMethod(
  1244. smalltalk.method({
  1245. selector: "collectionSize",
  1246. protocol: 'fixture',
  1247. fn: function (){
  1248. var self=this;
  1249. return smalltalk.withContext(function($ctx1) {
  1250. self._subclassResponsibility();
  1251. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},globals.CollectionTest)})},
  1252. args: [],
  1253. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1254. messageSends: ["subclassResponsibility"],
  1255. referencedClasses: []
  1256. }),
  1257. globals.CollectionTest);
  1258. smalltalk.addMethod(
  1259. smalltalk.method({
  1260. selector: "collectionWithDuplicates",
  1261. protocol: 'fixture',
  1262. fn: function (){
  1263. var self=this;
  1264. return smalltalk.withContext(function($ctx1) {
  1265. self._subclassResponsibility();
  1266. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.CollectionTest)})},
  1267. args: [],
  1268. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  1269. messageSends: ["subclassResponsibility"],
  1270. referencedClasses: []
  1271. }),
  1272. globals.CollectionTest);
  1273. smalltalk.addMethod(
  1274. smalltalk.method({
  1275. selector: "collectionWithNewValue",
  1276. protocol: 'fixture',
  1277. fn: function (){
  1278. var self=this;
  1279. return smalltalk.withContext(function($ctx1) {
  1280. self._subclassResponsibility();
  1281. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.CollectionTest)})},
  1282. args: [],
  1283. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility",
  1284. messageSends: ["subclassResponsibility"],
  1285. referencedClasses: []
  1286. }),
  1287. globals.CollectionTest);
  1288. smalltalk.addMethod(
  1289. smalltalk.method({
  1290. selector: "isCollectionReadOnly",
  1291. protocol: 'testing',
  1292. fn: function (){
  1293. var self=this;
  1294. return false;
  1295. },
  1296. args: [],
  1297. source: "isCollectionReadOnly\x0a\x09^ false",
  1298. messageSends: [],
  1299. referencedClasses: []
  1300. }),
  1301. globals.CollectionTest);
  1302. smalltalk.addMethod(
  1303. smalltalk.method({
  1304. selector: "sampleNewValue",
  1305. protocol: 'fixture',
  1306. fn: function (){
  1307. var self=this;
  1308. return "N";
  1309. },
  1310. args: [],
  1311. source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'",
  1312. messageSends: [],
  1313. referencedClasses: []
  1314. }),
  1315. globals.CollectionTest);
  1316. smalltalk.addMethod(
  1317. smalltalk.method({
  1318. selector: "sampleNewValueAsCollection",
  1319. protocol: 'fixture',
  1320. fn: function (){
  1321. var self=this;
  1322. return smalltalk.withContext(function($ctx1) {
  1323. var $1;
  1324. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1325. return $1;
  1326. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)})},
  1327. args: [],
  1328. source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  1329. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1330. referencedClasses: []
  1331. }),
  1332. globals.CollectionTest);
  1333. smalltalk.addMethod(
  1334. smalltalk.method({
  1335. selector: "testAddAll",
  1336. protocol: 'tests',
  1337. fn: function (){
  1338. var self=this;
  1339. return smalltalk.withContext(function($ctx1) {
  1340. var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29;
  1341. $2=self._collection();
  1342. $ctx1.sendIdx["collection"]=1;
  1343. $3=$2;
  1344. $5=self._collectionClass();
  1345. $ctx1.sendIdx["collectionClass"]=1;
  1346. $4=_st($5)._new();
  1347. $ctx1.sendIdx["new"]=1;
  1348. _st($3)._addAll_($4);
  1349. $ctx1.sendIdx["addAll:"]=1;
  1350. $6=_st($2)._yourself();
  1351. $ctx1.sendIdx["yourself"]=1;
  1352. $1=$6;
  1353. $7=self._collection();
  1354. $ctx1.sendIdx["collection"]=2;
  1355. self._assert_equals_($1,$7);
  1356. $ctx1.sendIdx["assert:equals:"]=1;
  1357. $10=self._collectionClass();
  1358. $ctx1.sendIdx["collectionClass"]=2;
  1359. $9=_st($10)._new();
  1360. $ctx1.sendIdx["new"]=2;
  1361. $11=$9;
  1362. $12=self._collection();
  1363. $ctx1.sendIdx["collection"]=3;
  1364. _st($11)._addAll_($12);
  1365. $ctx1.sendIdx["addAll:"]=2;
  1366. $13=_st($9)._yourself();
  1367. $ctx1.sendIdx["yourself"]=2;
  1368. $8=$13;
  1369. $14=self._collection();
  1370. $ctx1.sendIdx["collection"]=4;
  1371. self._assert_equals_($8,$14);
  1372. $ctx1.sendIdx["assert:equals:"]=2;
  1373. $17=self._collectionClass();
  1374. $ctx1.sendIdx["collectionClass"]=3;
  1375. $16=_st($17)._new();
  1376. $ctx1.sendIdx["new"]=3;
  1377. $18=$16;
  1378. $20=self._collectionClass();
  1379. $ctx1.sendIdx["collectionClass"]=4;
  1380. $19=_st($20)._new();
  1381. $ctx1.sendIdx["new"]=4;
  1382. _st($18)._addAll_($19);
  1383. $ctx1.sendIdx["addAll:"]=3;
  1384. $21=_st($16)._yourself();
  1385. $ctx1.sendIdx["yourself"]=3;
  1386. $15=$21;
  1387. self._assert_equals_($15,_st(self._collectionClass())._new());
  1388. $ctx1.sendIdx["assert:equals:"]=3;
  1389. $23=self._collection();
  1390. $ctx1.sendIdx["collection"]=5;
  1391. $24=$23;
  1392. $25=self._sampleNewValueAsCollection();
  1393. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1394. _st($24)._addAll_($25);
  1395. $ctx1.sendIdx["addAll:"]=4;
  1396. $26=_st($23)._yourself();
  1397. $ctx1.sendIdx["yourself"]=4;
  1398. $22=$26;
  1399. $27=self._collectionWithNewValue();
  1400. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1401. self._assert_equals_($22,$27);
  1402. $28=self._sampleNewValueAsCollection();
  1403. _st($28)._addAll_(self._collection());
  1404. $29=_st($28)._yourself();
  1405. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1406. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)})},
  1407. args: [],
  1408. source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue",
  1409. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1410. referencedClasses: []
  1411. }),
  1412. globals.CollectionTest);
  1413. smalltalk.addMethod(
  1414. smalltalk.method({
  1415. selector: "testAllSatisfy",
  1416. protocol: 'tests',
  1417. fn: function (){
  1418. var self=this;
  1419. var collection,anyOne;
  1420. return smalltalk.withContext(function($ctx1) {
  1421. var $1;
  1422. collection=self._collection();
  1423. anyOne=_st(collection)._anyOne();
  1424. $1=_st(collection)._allSatisfy_((function(each){
  1425. return smalltalk.withContext(function($ctx2) {
  1426. return _st(collection)._includes_(each);
  1427. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1428. $ctx1.sendIdx["allSatisfy:"]=1;
  1429. self._assert_($1);
  1430. self._deny_(_st(collection)._allSatisfy_((function(each){
  1431. return smalltalk.withContext(function($ctx2) {
  1432. return _st(each).__tild_eq(anyOne);
  1433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1434. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)})},
  1435. args: [],
  1436. 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 ])",
  1437. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1438. referencedClasses: []
  1439. }),
  1440. globals.CollectionTest);
  1441. smalltalk.addMethod(
  1442. smalltalk.method({
  1443. selector: "testAnyOne",
  1444. protocol: 'tests',
  1445. fn: function (){
  1446. var self=this;
  1447. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1448. return smalltalk.withContext(function($ctx1) {
  1449. var $2,$1;
  1450. self._should_raise_((function(){
  1451. return smalltalk.withContext(function($ctx2) {
  1452. return _st(_st(self._collectionClass())._new())._anyOne();
  1453. $ctx2.sendIdx["anyOne"]=1;
  1454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1455. $2=self._collection();
  1456. $ctx1.sendIdx["collection"]=1;
  1457. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1458. self._assert_($1);
  1459. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)})},
  1460. args: [],
  1461. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1462. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1463. referencedClasses: ["Error"]
  1464. }),
  1465. globals.CollectionTest);
  1466. smalltalk.addMethod(
  1467. smalltalk.method({
  1468. selector: "testAnySatisfy",
  1469. protocol: 'tests',
  1470. fn: function (){
  1471. var self=this;
  1472. var anyOne;
  1473. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1474. return smalltalk.withContext(function($ctx1) {
  1475. var $1,$3,$2;
  1476. $1=self._collection();
  1477. $ctx1.sendIdx["collection"]=1;
  1478. anyOne=_st($1)._anyOne();
  1479. $3=self._collection();
  1480. $ctx1.sendIdx["collection"]=2;
  1481. $2=_st($3)._anySatisfy_((function(each){
  1482. return smalltalk.withContext(function($ctx2) {
  1483. return _st(each).__eq(anyOne);
  1484. $ctx2.sendIdx["="]=1;
  1485. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1486. $ctx1.sendIdx["anySatisfy:"]=1;
  1487. self._assert_($2);
  1488. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1489. return smalltalk.withContext(function($ctx2) {
  1490. return _st(each).__eq(_st($Object())._new());
  1491. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1492. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  1493. args: [],
  1494. 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 ])",
  1495. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1496. referencedClasses: ["Object"]
  1497. }),
  1498. globals.CollectionTest);
  1499. smalltalk.addMethod(
  1500. smalltalk.method({
  1501. selector: "testAsArray",
  1502. protocol: 'tests',
  1503. fn: function (){
  1504. var self=this;
  1505. return smalltalk.withContext(function($ctx1) {
  1506. var $1;
  1507. $1=self._collection();
  1508. $ctx1.sendIdx["collection"]=1;
  1509. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1510. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)})},
  1511. args: [],
  1512. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1513. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1514. referencedClasses: []
  1515. }),
  1516. globals.CollectionTest);
  1517. smalltalk.addMethod(
  1518. smalltalk.method({
  1519. selector: "testAsOrderedCollection",
  1520. protocol: 'tests',
  1521. fn: function (){
  1522. var self=this;
  1523. return smalltalk.withContext(function($ctx1) {
  1524. var $1;
  1525. $1=self._collection();
  1526. $ctx1.sendIdx["collection"]=1;
  1527. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1528. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)})},
  1529. args: [],
  1530. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1531. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1532. referencedClasses: []
  1533. }),
  1534. globals.CollectionTest);
  1535. smalltalk.addMethod(
  1536. smalltalk.method({
  1537. selector: "testAsSet",
  1538. protocol: 'tests',
  1539. fn: function (){
  1540. var self=this;
  1541. var c,set;
  1542. return smalltalk.withContext(function($ctx1) {
  1543. c=self._collectionWithDuplicates();
  1544. set=_st(c)._asSet();
  1545. self._assert_equals_(_st(set)._size(),(5));
  1546. _st(c)._do_((function(each){
  1547. return smalltalk.withContext(function($ctx2) {
  1548. return self._assert_(_st(set)._includes_(each));
  1549. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1550. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)})},
  1551. args: [],
  1552. 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) ]",
  1553. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1554. referencedClasses: []
  1555. }),
  1556. globals.CollectionTest);
  1557. smalltalk.addMethod(
  1558. smalltalk.method({
  1559. selector: "testCollect",
  1560. protocol: 'tests',
  1561. fn: function (){
  1562. var self=this;
  1563. return smalltalk.withContext(function($ctx1) {
  1564. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1565. $2=self._collection();
  1566. $ctx1.sendIdx["collection"]=1;
  1567. $1=_st($2)._collect_((function(each){
  1568. return each;
  1569. }));
  1570. $ctx1.sendIdx["collect:"]=1;
  1571. $3=self._collection();
  1572. $ctx1.sendIdx["collection"]=2;
  1573. self._assert_equals_($1,$3);
  1574. $ctx1.sendIdx["assert:equals:"]=1;
  1575. $5=self._collectionWithNewValue();
  1576. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1577. $4=_st($5)._collect_((function(each){
  1578. return each;
  1579. }));
  1580. $ctx1.sendIdx["collect:"]=2;
  1581. self._assert_equals_($4,self._collectionWithNewValue());
  1582. $ctx1.sendIdx["assert:equals:"]=2;
  1583. $8=self._collectionClass();
  1584. $ctx1.sendIdx["collectionClass"]=1;
  1585. $7=_st($8)._new();
  1586. $ctx1.sendIdx["new"]=1;
  1587. $6=_st($7)._collect_((function(each){
  1588. return smalltalk.withContext(function($ctx2) {
  1589. return _st(each)._printString();
  1590. $ctx2.sendIdx["printString"]=1;
  1591. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1592. $ctx1.sendIdx["collect:"]=3;
  1593. self._assert_equals_($6,_st(self._collectionClass())._new());
  1594. $ctx1.sendIdx["assert:equals:"]=3;
  1595. $11=self._collection();
  1596. $ctx1.sendIdx["collection"]=3;
  1597. $10=_st($11)._collect_((function(){
  1598. return smalltalk.withContext(function($ctx2) {
  1599. return self._sampleNewValue();
  1600. $ctx2.sendIdx["sampleNewValue"]=1;
  1601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1602. $ctx1.sendIdx["collect:"]=4;
  1603. $9=_st($10)._detect_((function(){
  1604. return true;
  1605. }));
  1606. self._assert_equals_($9,self._sampleNewValue());
  1607. $ctx1.sendIdx["assert:equals:"]=4;
  1608. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1609. return smalltalk.withContext(function($ctx2) {
  1610. return _st(each)._printString();
  1611. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1612. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)})},
  1613. args: [],
  1614. source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings",
  1615. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1616. referencedClasses: []
  1617. }),
  1618. globals.CollectionTest);
  1619. smalltalk.addMethod(
  1620. smalltalk.method({
  1621. selector: "testComma",
  1622. protocol: 'tests',
  1623. fn: function (){
  1624. var self=this;
  1625. return smalltalk.withContext(function($ctx1) {
  1626. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1627. $2=self._collection();
  1628. $ctx1.sendIdx["collection"]=1;
  1629. $4=self._collectionClass();
  1630. $ctx1.sendIdx["collectionClass"]=1;
  1631. $3=_st($4)._new();
  1632. $ctx1.sendIdx["new"]=1;
  1633. $1=_st($2).__comma($3);
  1634. $ctx1.sendIdx[","]=1;
  1635. $5=self._collection();
  1636. $ctx1.sendIdx["collection"]=2;
  1637. self._assert_equals_($1,$5);
  1638. $ctx1.sendIdx["assert:equals:"]=1;
  1639. $8=self._collectionClass();
  1640. $ctx1.sendIdx["collectionClass"]=2;
  1641. $7=_st($8)._new();
  1642. $ctx1.sendIdx["new"]=2;
  1643. $9=self._collection();
  1644. $ctx1.sendIdx["collection"]=3;
  1645. $6=_st($7).__comma($9);
  1646. $ctx1.sendIdx[","]=2;
  1647. $10=self._collection();
  1648. $ctx1.sendIdx["collection"]=4;
  1649. self._assert_equals_($6,$10);
  1650. $ctx1.sendIdx["assert:equals:"]=2;
  1651. $13=self._collectionClass();
  1652. $ctx1.sendIdx["collectionClass"]=3;
  1653. $12=_st($13)._new();
  1654. $ctx1.sendIdx["new"]=3;
  1655. $15=self._collectionClass();
  1656. $ctx1.sendIdx["collectionClass"]=4;
  1657. $14=_st($15)._new();
  1658. $ctx1.sendIdx["new"]=4;
  1659. $11=_st($12).__comma($14);
  1660. $ctx1.sendIdx[","]=3;
  1661. self._assert_equals_($11,_st(self._collectionClass())._new());
  1662. $ctx1.sendIdx["assert:equals:"]=3;
  1663. $17=self._collection();
  1664. $ctx1.sendIdx["collection"]=5;
  1665. $18=self._sampleNewValueAsCollection();
  1666. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1667. $16=_st($17).__comma($18);
  1668. $ctx1.sendIdx[","]=4;
  1669. $19=self._collectionWithNewValue();
  1670. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1671. self._assert_equals_($16,$19);
  1672. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1673. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)})},
  1674. args: [],
  1675. source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue",
  1676. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1677. referencedClasses: []
  1678. }),
  1679. globals.CollectionTest);
  1680. smalltalk.addMethod(
  1681. smalltalk.method({
  1682. selector: "testDetect",
  1683. protocol: 'tests',
  1684. fn: function (){
  1685. var self=this;
  1686. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1687. return smalltalk.withContext(function($ctx1) {
  1688. var $1,$2,$3,$4,$6,$5,$7;
  1689. self._shouldnt_raise_((function(){
  1690. return smalltalk.withContext(function($ctx2) {
  1691. $1=self._collection();
  1692. $ctx2.sendIdx["collection"]=1;
  1693. return _st($1)._detect_((function(){
  1694. return true;
  1695. }));
  1696. $ctx2.sendIdx["detect:"]=1;
  1697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1698. self._should_raise_((function(){
  1699. return smalltalk.withContext(function($ctx2) {
  1700. $2=self._collection();
  1701. $ctx2.sendIdx["collection"]=2;
  1702. return _st($2)._detect_((function(){
  1703. return false;
  1704. }));
  1705. $ctx2.sendIdx["detect:"]=2;
  1706. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1707. $ctx1.sendIdx["should:raise:"]=1;
  1708. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1709. return true;
  1710. }));
  1711. $ctx1.sendIdx["detect:"]=3;
  1712. $4=self._sampleNewValue();
  1713. $ctx1.sendIdx["sampleNewValue"]=1;
  1714. self._assert_equals_($3,$4);
  1715. $ctx1.sendIdx["assert:equals:"]=1;
  1716. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1717. return smalltalk.withContext(function($ctx2) {
  1718. $6=self._sampleNewValue();
  1719. $ctx2.sendIdx["sampleNewValue"]=2;
  1720. return _st(each).__eq($6);
  1721. $ctx2.sendIdx["="]=1;
  1722. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1723. $ctx1.sendIdx["detect:"]=4;
  1724. $7=self._sampleNewValue();
  1725. $ctx1.sendIdx["sampleNewValue"]=3;
  1726. self._assert_equals_($5,$7);
  1727. self._should_raise_((function(){
  1728. return smalltalk.withContext(function($ctx2) {
  1729. return _st(self._collection())._detect_((function(each){
  1730. return smalltalk.withContext(function($ctx3) {
  1731. return _st(each).__eq(self._sampleNewValue());
  1732. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1734. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)})},
  1735. args: [],
  1736. source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error",
  1737. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1738. referencedClasses: ["Error"]
  1739. }),
  1740. globals.CollectionTest);
  1741. smalltalk.addMethod(
  1742. smalltalk.method({
  1743. selector: "testDetectIfNone",
  1744. protocol: 'tests',
  1745. fn: function (){
  1746. var self=this;
  1747. var sentinel;
  1748. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1749. return smalltalk.withContext(function($ctx1) {
  1750. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1751. sentinel=_st($Object())._new();
  1752. $3=self._collection();
  1753. $ctx1.sendIdx["collection"]=1;
  1754. $2=_st($3)._detect_ifNone_((function(){
  1755. return true;
  1756. }),(function(){
  1757. return sentinel;
  1758. }));
  1759. $ctx1.sendIdx["detect:ifNone:"]=1;
  1760. $1=_st($2).__tild_eq(sentinel);
  1761. self._assert_($1);
  1762. $5=self._collection();
  1763. $ctx1.sendIdx["collection"]=2;
  1764. $4=_st($5)._detect_ifNone_((function(){
  1765. return false;
  1766. }),(function(){
  1767. return sentinel;
  1768. }));
  1769. $ctx1.sendIdx["detect:ifNone:"]=2;
  1770. self._assert_equals_($4,sentinel);
  1771. $ctx1.sendIdx["assert:equals:"]=1;
  1772. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1773. return true;
  1774. }),(function(){
  1775. return sentinel;
  1776. }));
  1777. $ctx1.sendIdx["detect:ifNone:"]=3;
  1778. $7=self._sampleNewValue();
  1779. $ctx1.sendIdx["sampleNewValue"]=1;
  1780. self._assert_equals_($6,$7);
  1781. $ctx1.sendIdx["assert:equals:"]=2;
  1782. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1783. return smalltalk.withContext(function($ctx2) {
  1784. $9=self._sampleNewValue();
  1785. $ctx2.sendIdx["sampleNewValue"]=2;
  1786. return _st(each).__eq($9);
  1787. $ctx2.sendIdx["="]=1;
  1788. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1789. return sentinel;
  1790. }));
  1791. $ctx1.sendIdx["detect:ifNone:"]=4;
  1792. $10=self._sampleNewValue();
  1793. $ctx1.sendIdx["sampleNewValue"]=3;
  1794. self._assert_equals_($8,$10);
  1795. $ctx1.sendIdx["assert:equals:"]=3;
  1796. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1797. return smalltalk.withContext(function($ctx2) {
  1798. return _st(each).__eq(self._sampleNewValue());
  1799. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1800. return sentinel;
  1801. })),sentinel);
  1802. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)})},
  1803. args: [],
  1804. source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel",
  1805. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1806. referencedClasses: ["Object"]
  1807. }),
  1808. globals.CollectionTest);
  1809. smalltalk.addMethod(
  1810. smalltalk.method({
  1811. selector: "testDo",
  1812. protocol: 'tests',
  1813. fn: function (){
  1814. var self=this;
  1815. var newCollection;
  1816. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1817. return smalltalk.withContext(function($ctx1) {
  1818. var $1,$2;
  1819. newCollection=_st($OrderedCollection())._new();
  1820. $ctx1.sendIdx["new"]=1;
  1821. $1=self._collection();
  1822. $ctx1.sendIdx["collection"]=1;
  1823. _st($1)._do_((function(each){
  1824. return smalltalk.withContext(function($ctx2) {
  1825. return _st(newCollection)._add_(each);
  1826. $ctx2.sendIdx["add:"]=1;
  1827. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1828. $ctx1.sendIdx["do:"]=1;
  1829. self._assertSameContents_as_(self._collection(),newCollection);
  1830. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1831. newCollection=_st($OrderedCollection())._new();
  1832. $2=self._collectionWithDuplicates();
  1833. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1834. _st($2)._do_((function(each){
  1835. return smalltalk.withContext(function($ctx2) {
  1836. return _st(newCollection)._add_(each);
  1837. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1838. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1839. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)})},
  1840. args: [],
  1841. 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.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection",
  1842. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1843. referencedClasses: ["OrderedCollection"]
  1844. }),
  1845. globals.CollectionTest);
  1846. smalltalk.addMethod(
  1847. smalltalk.method({
  1848. selector: "testIfEmptyFamily",
  1849. protocol: 'tests',
  1850. fn: function (){
  1851. var self=this;
  1852. return smalltalk.withContext(function($ctx1) {
  1853. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1854. $3=self._collectionClass();
  1855. $ctx1.sendIdx["collectionClass"]=1;
  1856. $2=_st($3)._new();
  1857. $ctx1.sendIdx["new"]=1;
  1858. $1=_st($2)._ifEmpty_((function(){
  1859. return (42);
  1860. }));
  1861. $ctx1.sendIdx["ifEmpty:"]=1;
  1862. self._assert_equals_($1,(42));
  1863. $ctx1.sendIdx["assert:equals:"]=1;
  1864. $5=self._collection();
  1865. $ctx1.sendIdx["collection"]=1;
  1866. $4=_st($5)._ifEmpty_((function(){
  1867. return (42);
  1868. }));
  1869. $6=self._collection();
  1870. $ctx1.sendIdx["collection"]=2;
  1871. self._assert_equals_($4,$6);
  1872. $ctx1.sendIdx["assert:equals:"]=2;
  1873. $9=self._collectionClass();
  1874. $ctx1.sendIdx["collectionClass"]=2;
  1875. $8=_st($9)._new();
  1876. $ctx1.sendIdx["new"]=2;
  1877. $7=_st($8)._ifNotEmpty_((function(){
  1878. return (42);
  1879. }));
  1880. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1881. $11=self._collectionClass();
  1882. $ctx1.sendIdx["collectionClass"]=3;
  1883. $10=_st($11)._new();
  1884. $ctx1.sendIdx["new"]=3;
  1885. self._assert_equals_($7,$10);
  1886. $ctx1.sendIdx["assert:equals:"]=3;
  1887. $13=self._collection();
  1888. $ctx1.sendIdx["collection"]=3;
  1889. $12=_st($13)._ifNotEmpty_((function(){
  1890. return (42);
  1891. }));
  1892. self._assert_equals_($12,(42));
  1893. $ctx1.sendIdx["assert:equals:"]=4;
  1894. $16=self._collectionClass();
  1895. $ctx1.sendIdx["collectionClass"]=4;
  1896. $15=_st($16)._new();
  1897. $ctx1.sendIdx["new"]=4;
  1898. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1899. return (42);
  1900. }),(function(){
  1901. return (999);
  1902. }));
  1903. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1904. self._assert_equals_($14,(42));
  1905. $ctx1.sendIdx["assert:equals:"]=5;
  1906. $18=self._collection();
  1907. $ctx1.sendIdx["collection"]=4;
  1908. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1909. return (42);
  1910. }),(function(){
  1911. return (999);
  1912. }));
  1913. self._assert_equals_($17,(999));
  1914. $ctx1.sendIdx["assert:equals:"]=6;
  1915. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1916. return (42);
  1917. }),(function(){
  1918. return (999);
  1919. }));
  1920. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1921. self._assert_equals_($19,(999));
  1922. $ctx1.sendIdx["assert:equals:"]=7;
  1923. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1924. return (42);
  1925. }),(function(){
  1926. return (999);
  1927. })),(42));
  1928. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)})},
  1929. args: [],
  1930. 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",
  1931. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1932. referencedClasses: []
  1933. }),
  1934. globals.CollectionTest);
  1935. smalltalk.addMethod(
  1936. smalltalk.method({
  1937. selector: "testIsEmpty",
  1938. protocol: 'tests',
  1939. fn: function (){
  1940. var self=this;
  1941. return smalltalk.withContext(function($ctx1) {
  1942. var $1;
  1943. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1944. $ctx1.sendIdx["isEmpty"]=1;
  1945. self._assert_($1);
  1946. self._deny_(_st(self._collection())._isEmpty());
  1947. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)})},
  1948. args: [],
  1949. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1950. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1951. referencedClasses: []
  1952. }),
  1953. globals.CollectionTest);
  1954. smalltalk.addMethod(
  1955. smalltalk.method({
  1956. selector: "testNoneSatisfy",
  1957. protocol: 'tests',
  1958. fn: function (){
  1959. var self=this;
  1960. var anyOne;
  1961. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1962. return smalltalk.withContext(function($ctx1) {
  1963. var $1,$3,$2;
  1964. $1=self._collection();
  1965. $ctx1.sendIdx["collection"]=1;
  1966. anyOne=_st($1)._anyOne();
  1967. $3=self._collection();
  1968. $ctx1.sendIdx["collection"]=2;
  1969. $2=_st($3)._noneSatisfy_((function(each){
  1970. return smalltalk.withContext(function($ctx2) {
  1971. return _st(each).__eq(anyOne);
  1972. $ctx2.sendIdx["="]=1;
  1973. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1974. $ctx1.sendIdx["noneSatisfy:"]=1;
  1975. self._deny_($2);
  1976. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  1977. return smalltalk.withContext(function($ctx2) {
  1978. return _st(each).__eq(_st($Object())._new());
  1979. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1980. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  1981. args: [],
  1982. 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 ])",
  1983. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  1984. referencedClasses: ["Object"]
  1985. }),
  1986. globals.CollectionTest);
  1987. smalltalk.addMethod(
  1988. smalltalk.method({
  1989. selector: "testRemoveAll",
  1990. protocol: 'tests',
  1991. fn: function (){
  1992. var self=this;
  1993. return smalltalk.withContext(function($ctx1) {
  1994. var $1,$2;
  1995. $1=self._collection();
  1996. _st($1)._removeAll();
  1997. $2=_st($1)._yourself();
  1998. self._assert_equals_($2,_st(self._collectionClass())._new());
  1999. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)})},
  2000. args: [],
  2001. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2002. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2003. referencedClasses: []
  2004. }),
  2005. globals.CollectionTest);
  2006. smalltalk.addMethod(
  2007. smalltalk.method({
  2008. selector: "testSelect",
  2009. protocol: 'tests',
  2010. fn: function (){
  2011. var self=this;
  2012. return smalltalk.withContext(function($ctx1) {
  2013. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2014. $2=self._collection();
  2015. $ctx1.sendIdx["collection"]=1;
  2016. $1=_st($2)._select_((function(){
  2017. return false;
  2018. }));
  2019. $ctx1.sendIdx["select:"]=1;
  2020. $4=self._collectionClass();
  2021. $ctx1.sendIdx["collectionClass"]=1;
  2022. $3=_st($4)._new();
  2023. $ctx1.sendIdx["new"]=1;
  2024. self._assert_equals_($1,$3);
  2025. $ctx1.sendIdx["assert:equals:"]=1;
  2026. $6=self._collection();
  2027. $ctx1.sendIdx["collection"]=2;
  2028. $5=_st($6)._select_((function(){
  2029. return true;
  2030. }));
  2031. $ctx1.sendIdx["select:"]=2;
  2032. $7=self._collection();
  2033. $ctx1.sendIdx["collection"]=3;
  2034. self._assert_equals_($5,$7);
  2035. $ctx1.sendIdx["assert:equals:"]=2;
  2036. $9=self._collectionWithNewValue();
  2037. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2038. $8=_st($9)._select_((function(each){
  2039. return smalltalk.withContext(function($ctx2) {
  2040. $10=self._sampleNewValue();
  2041. $ctx2.sendIdx["sampleNewValue"]=1;
  2042. return _st(each).__eq($10);
  2043. $ctx2.sendIdx["="]=1;
  2044. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2045. $ctx1.sendIdx["select:"]=3;
  2046. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2047. $ctx1.sendIdx["assert:equals:"]=3;
  2048. $12=self._collectionWithNewValue();
  2049. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2050. $11=_st($12)._select_((function(each){
  2051. return smalltalk.withContext(function($ctx2) {
  2052. $13=self._sampleNewValue();
  2053. $ctx2.sendIdx["sampleNewValue"]=2;
  2054. return _st(each).__tild_eq($13);
  2055. $ctx2.sendIdx["~="]=1;
  2056. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2057. $ctx1.sendIdx["select:"]=4;
  2058. $14=self._collection();
  2059. $ctx1.sendIdx["collection"]=4;
  2060. self._assert_equals_($11,$14);
  2061. $ctx1.sendIdx["assert:equals:"]=4;
  2062. $16=self._collection();
  2063. $ctx1.sendIdx["collection"]=5;
  2064. $15=_st($16)._select_((function(each){
  2065. return smalltalk.withContext(function($ctx2) {
  2066. $17=self._sampleNewValue();
  2067. $ctx2.sendIdx["sampleNewValue"]=3;
  2068. return _st(each).__eq($17);
  2069. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2070. $ctx1.sendIdx["select:"]=5;
  2071. self._assert_equals_($15,_st(self._collectionClass())._new());
  2072. $ctx1.sendIdx["assert:equals:"]=5;
  2073. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2074. return smalltalk.withContext(function($ctx2) {
  2075. return _st(each).__tild_eq(self._sampleNewValue());
  2076. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2077. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)})},
  2078. args: [],
  2079. source: "testSelect\x0a\x09self assert: (self collection select: [ false ]) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each = self sampleNewValue ]) equals: self sampleNewValueAsCollection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection",
  2080. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2081. referencedClasses: []
  2082. }),
  2083. globals.CollectionTest);
  2084. smalltalk.addMethod(
  2085. smalltalk.method({
  2086. selector: "testSize",
  2087. protocol: 'tests',
  2088. fn: function (){
  2089. var self=this;
  2090. return smalltalk.withContext(function($ctx1) {
  2091. var $1,$2;
  2092. $1=_st(_st(self._collectionClass())._new())._size();
  2093. $ctx1.sendIdx["size"]=1;
  2094. self._assert_equals_($1,(0));
  2095. $ctx1.sendIdx["assert:equals:"]=1;
  2096. $2=_st(self._sampleNewValueAsCollection())._size();
  2097. $ctx1.sendIdx["size"]=2;
  2098. self._assert_equals_($2,(1));
  2099. $ctx1.sendIdx["assert:equals:"]=2;
  2100. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2101. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)})},
  2102. args: [],
  2103. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self sampleNewValueAsCollection size equals: 1.\x0a\x09self assert: self collection size equals: self collectionSize",
  2104. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2105. referencedClasses: []
  2106. }),
  2107. globals.CollectionTest);
  2108. smalltalk.addMethod(
  2109. smalltalk.method({
  2110. selector: "collectionClass",
  2111. protocol: 'fixture',
  2112. fn: function (){
  2113. var self=this;
  2114. return nil;
  2115. },
  2116. args: [],
  2117. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2118. messageSends: [],
  2119. referencedClasses: []
  2120. }),
  2121. globals.CollectionTest.klass);
  2122. smalltalk.addMethod(
  2123. smalltalk.method({
  2124. selector: "isAbstract",
  2125. protocol: 'testing',
  2126. fn: function (){
  2127. var self=this;
  2128. return smalltalk.withContext(function($ctx1) {
  2129. var $1;
  2130. $1=_st(self._collectionClass())._isNil();
  2131. return $1;
  2132. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)})},
  2133. args: [],
  2134. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2135. messageSends: ["isNil", "collectionClass"],
  2136. referencedClasses: []
  2137. }),
  2138. globals.CollectionTest.klass);
  2139. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  2140. smalltalk.addMethod(
  2141. smalltalk.method({
  2142. selector: "collectionWithNewValue",
  2143. protocol: 'fixture',
  2144. fn: function (){
  2145. var self=this;
  2146. return smalltalk.withContext(function($ctx1) {
  2147. self._subclassResponsibility();
  2148. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)})},
  2149. args: [],
  2150. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2151. messageSends: ["subclassResponsibility"],
  2152. referencedClasses: []
  2153. }),
  2154. globals.IndexableCollectionTest);
  2155. smalltalk.addMethod(
  2156. smalltalk.method({
  2157. selector: "sampleNewIndex",
  2158. protocol: 'fixture',
  2159. fn: function (){
  2160. var self=this;
  2161. return smalltalk.withContext(function($ctx1) {
  2162. self._subclassResponsibility();
  2163. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)})},
  2164. args: [],
  2165. source: "sampleNewIndex\x0a\x09\x22Answers a value that can be used as index in at:put: or at:ifAbsentPut:\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2166. messageSends: ["subclassResponsibility"],
  2167. referencedClasses: []
  2168. }),
  2169. globals.IndexableCollectionTest);
  2170. smalltalk.addMethod(
  2171. smalltalk.method({
  2172. selector: "sampleNonIndexesDo:",
  2173. protocol: 'fixture',
  2174. fn: function (aBlock){
  2175. var self=this;
  2176. return smalltalk.withContext(function($ctx1) {
  2177. self._subclassResponsibility();
  2178. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2179. args: ["aBlock"],
  2180. source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2181. messageSends: ["subclassResponsibility"],
  2182. referencedClasses: []
  2183. }),
  2184. globals.IndexableCollectionTest);
  2185. smalltalk.addMethod(
  2186. smalltalk.method({
  2187. selector: "samplesDo:",
  2188. protocol: 'fixture',
  2189. fn: function (aBlock){
  2190. var self=this;
  2191. return smalltalk.withContext(function($ctx1) {
  2192. self._subclassResponsibility();
  2193. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2194. args: ["aBlock"],
  2195. source: "samplesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing known index and value stored\x0a\x09under that index as the parameters\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2196. messageSends: ["subclassResponsibility"],
  2197. referencedClasses: []
  2198. }),
  2199. globals.IndexableCollectionTest);
  2200. smalltalk.addMethod(
  2201. smalltalk.method({
  2202. selector: "testAt",
  2203. protocol: 'tests',
  2204. fn: function (){
  2205. var self=this;
  2206. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2207. return smalltalk.withContext(function($ctx1) {
  2208. var $1;
  2209. self._nonIndexesDo_((function(each){
  2210. return smalltalk.withContext(function($ctx2) {
  2211. return self._should_raise_((function(){
  2212. return smalltalk.withContext(function($ctx3) {
  2213. $1=self._collection();
  2214. $ctx3.sendIdx["collection"]=1;
  2215. return _st($1)._at_(each);
  2216. $ctx3.sendIdx["at:"]=1;
  2217. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2218. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2219. self._samplesDo_((function(index,value){
  2220. return smalltalk.withContext(function($ctx2) {
  2221. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2222. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2223. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)})},
  2224. args: [],
  2225. source: "testAt\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self should: [ self collection at: each ] raise: Error ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index) equals: value ]",
  2226. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2227. referencedClasses: ["Error"]
  2228. }),
  2229. globals.IndexableCollectionTest);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: "testAtIfAbsent",
  2233. protocol: 'tests',
  2234. fn: function (){
  2235. var self=this;
  2236. return smalltalk.withContext(function($ctx1) {
  2237. var $2,$1,$3;
  2238. self._nonIndexesDo_((function(each){
  2239. return smalltalk.withContext(function($ctx2) {
  2240. $2=self._collection();
  2241. $ctx2.sendIdx["collection"]=1;
  2242. $1=_st($2)._at_ifAbsent_(each,(function(){
  2243. return smalltalk.withContext(function($ctx3) {
  2244. return self._sampleNewValue();
  2245. $ctx3.sendIdx["sampleNewValue"]=1;
  2246. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2247. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2248. $3=self._sampleNewValue();
  2249. $ctx2.sendIdx["sampleNewValue"]=2;
  2250. return self._assert_equals_($1,$3);
  2251. $ctx2.sendIdx["assert:equals:"]=1;
  2252. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2253. self._samplesDo_((function(index,value){
  2254. return smalltalk.withContext(function($ctx2) {
  2255. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2256. return smalltalk.withContext(function($ctx3) {
  2257. return self._sampleNewValue();
  2258. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2259. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2260. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)})},
  2261. args: [],
  2262. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNewValue ]) equals: value ].",
  2263. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2264. referencedClasses: []
  2265. }),
  2266. globals.IndexableCollectionTest);
  2267. smalltalk.addMethod(
  2268. smalltalk.method({
  2269. selector: "testAtIfAbsentPut",
  2270. protocol: 'tests',
  2271. fn: function (){
  2272. var self=this;
  2273. var newCollection;
  2274. return smalltalk.withContext(function($ctx1) {
  2275. var $1;
  2276. newCollection=self._collection();
  2277. $ctx1.sendIdx["collection"]=1;
  2278. self._samplesDo_((function(index,value){
  2279. return smalltalk.withContext(function($ctx2) {
  2280. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2281. return smalltalk.withContext(function($ctx3) {
  2282. return self._sampleNewValue();
  2283. $ctx3.sendIdx["sampleNewValue"]=1;
  2284. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2285. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2286. return self._assert_equals_($1,value);
  2287. $ctx2.sendIdx["assert:equals:"]=1;
  2288. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2289. self._assert_equals_(newCollection,self._collection());
  2290. $ctx1.sendIdx["assert:equals:"]=2;
  2291. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2292. return smalltalk.withContext(function($ctx2) {
  2293. return self._sampleNewValue();
  2294. $ctx2.sendIdx["sampleNewValue"]=2;
  2295. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2296. $ctx1.sendIdx["assert:equals:"]=3;
  2297. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2298. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2299. args: [],
  2300. source: "testAtIfAbsentPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (newCollection at: index ifAbsentPut: [ self sampleNewValue ]) equals: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09self assert: (newCollection at: self sampleNewIndex ifAbsentPut: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  2301. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2302. referencedClasses: []
  2303. }),
  2304. globals.IndexableCollectionTest);
  2305. smalltalk.addMethod(
  2306. smalltalk.method({
  2307. selector: "testAtIfPresent",
  2308. protocol: 'tests',
  2309. fn: function (){
  2310. var self=this;
  2311. var visited,sentinel;
  2312. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2313. return smalltalk.withContext(function($ctx1) {
  2314. var $2,$1,$4,$3;
  2315. sentinel=_st($Object())._new();
  2316. self._nonIndexesDo_((function(each){
  2317. return smalltalk.withContext(function($ctx2) {
  2318. visited=nil;
  2319. visited;
  2320. $2=self._collection();
  2321. $ctx2.sendIdx["collection"]=1;
  2322. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2323. visited=value1;
  2324. visited;
  2325. return sentinel;
  2326. }));
  2327. $ctx2.sendIdx["at:ifPresent:"]=1;
  2328. self._assert_equals_($1,nil);
  2329. $ctx2.sendIdx["assert:equals:"]=1;
  2330. return self._assert_(_st(visited)._isNil());
  2331. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2332. self._samplesDo_((function(index,value){
  2333. return smalltalk.withContext(function($ctx2) {
  2334. visited=nil;
  2335. visited;
  2336. $4=self._collection();
  2337. $ctx2.sendIdx["collection"]=2;
  2338. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2339. visited=value2;
  2340. visited;
  2341. return sentinel;
  2342. }));
  2343. self._assert_equals_($3,sentinel);
  2344. $ctx2.sendIdx["assert:equals:"]=2;
  2345. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2346. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2347. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2348. args: [],
  2349. source: "testAtIfPresent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ]) equals: nil.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2350. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2351. referencedClasses: ["Object"]
  2352. }),
  2353. globals.IndexableCollectionTest);
  2354. smalltalk.addMethod(
  2355. smalltalk.method({
  2356. selector: "testAtIfPresentIfAbsent",
  2357. protocol: 'tests',
  2358. fn: function (){
  2359. var self=this;
  2360. var visited,sentinel;
  2361. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2362. return smalltalk.withContext(function($ctx1) {
  2363. var $2,$1,$3,$5,$4;
  2364. sentinel=_st($Object())._new();
  2365. self._nonIndexesDo_((function(each){
  2366. return smalltalk.withContext(function($ctx2) {
  2367. visited=nil;
  2368. visited;
  2369. $2=self._collection();
  2370. $ctx2.sendIdx["collection"]=1;
  2371. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2372. visited=value1;
  2373. visited;
  2374. return sentinel;
  2375. }),(function(){
  2376. return smalltalk.withContext(function($ctx3) {
  2377. return self._sampleNewValue();
  2378. $ctx3.sendIdx["sampleNewValue"]=1;
  2379. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2380. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2381. $3=self._sampleNewValue();
  2382. $ctx2.sendIdx["sampleNewValue"]=2;
  2383. self._assert_equals_($1,$3);
  2384. $ctx2.sendIdx["assert:equals:"]=1;
  2385. return self._assert_(_st(visited)._isNil());
  2386. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2387. self._samplesDo_((function(index,value){
  2388. return smalltalk.withContext(function($ctx2) {
  2389. visited=nil;
  2390. visited;
  2391. $5=self._collection();
  2392. $ctx2.sendIdx["collection"]=2;
  2393. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2394. visited=value2;
  2395. visited;
  2396. return sentinel;
  2397. }),(function(){
  2398. return smalltalk.withContext(function($ctx3) {
  2399. return self._sampleNewValue();
  2400. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2401. self._assert_equals_($4,sentinel);
  2402. $ctx2.sendIdx["assert:equals:"]=2;
  2403. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2404. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2405. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2406. args: [],
  2407. source: "testAtIfPresentIfAbsent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ] ifAbsent: [ self sampleNewValue ] ) equals: self sampleNewValue.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ] ifAbsent: [ self sampleNewValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2408. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2409. referencedClasses: ["Object"]
  2410. }),
  2411. globals.IndexableCollectionTest);
  2412. smalltalk.addMethod(
  2413. smalltalk.method({
  2414. selector: "testAtPut",
  2415. protocol: 'tests',
  2416. fn: function (){
  2417. var self=this;
  2418. var newCollection;
  2419. return smalltalk.withContext(function($ctx1) {
  2420. newCollection=self._collection();
  2421. $ctx1.sendIdx["collection"]=1;
  2422. self._samplesDo_((function(index,value){
  2423. return smalltalk.withContext(function($ctx2) {
  2424. return _st(newCollection)._at_put_(index,value);
  2425. $ctx2.sendIdx["at:put:"]=1;
  2426. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2427. self._assert_equals_(newCollection,self._collection());
  2428. $ctx1.sendIdx["assert:equals:"]=1;
  2429. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2430. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2431. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2432. args: [],
  2433. source: "testAtPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09newCollection at: index put: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09newCollection at: self sampleNewIndex put: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  2434. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2435. referencedClasses: []
  2436. }),
  2437. globals.IndexableCollectionTest);
  2438. smalltalk.addMethod(
  2439. smalltalk.method({
  2440. selector: "testEquality",
  2441. protocol: 'tests',
  2442. fn: function (){
  2443. var self=this;
  2444. return smalltalk.withContext(function($ctx1) {
  2445. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2446. $2=self._collectionClass();
  2447. $ctx1.sendIdx["collectionClass"]=1;
  2448. $1=_st($2)._new();
  2449. $ctx1.sendIdx["new"]=1;
  2450. $4=self._collectionClass();
  2451. $ctx1.sendIdx["collectionClass"]=2;
  2452. $3=_st($4)._new();
  2453. $ctx1.sendIdx["new"]=2;
  2454. self._assert_equals_($1,$3);
  2455. $ctx1.sendIdx["assert:equals:"]=1;
  2456. $5=self._collection();
  2457. $ctx1.sendIdx["collection"]=1;
  2458. $6=self._collection();
  2459. $ctx1.sendIdx["collection"]=2;
  2460. self._assert_equals_($5,$6);
  2461. $ctx1.sendIdx["assert:equals:"]=2;
  2462. $7=self._collectionWithNewValue();
  2463. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2464. self._assert_equals_($7,self._collectionWithNewValue());
  2465. $10=self._collectionClass();
  2466. $ctx1.sendIdx["collectionClass"]=3;
  2467. $9=_st($10)._new();
  2468. $ctx1.sendIdx["new"]=3;
  2469. $11=self._collection();
  2470. $ctx1.sendIdx["collection"]=3;
  2471. $8=_st($9).__eq($11);
  2472. $ctx1.sendIdx["="]=1;
  2473. self._deny_($8);
  2474. $ctx1.sendIdx["deny:"]=1;
  2475. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2476. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)})},
  2477. args: [],
  2478. source: "testEquality\x0a\x09self assert: self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection equals: self collection.\x0a\x09self assert: self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new = self collection.\x0a\x09self deny: self collection = self collectionClass new",
  2479. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2480. referencedClasses: []
  2481. }),
  2482. globals.IndexableCollectionTest);
  2483. smalltalk.addMethod(
  2484. smalltalk.method({
  2485. selector: "testIndexOf",
  2486. protocol: 'tests',
  2487. fn: function (){
  2488. var self=this;
  2489. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2490. return smalltalk.withContext(function($ctx1) {
  2491. var $1;
  2492. self._should_raise_((function(){
  2493. return smalltalk.withContext(function($ctx2) {
  2494. $1=self._collection();
  2495. $ctx2.sendIdx["collection"]=1;
  2496. return _st($1)._indexOf_(self._sampleNewValue());
  2497. $ctx2.sendIdx["indexOf:"]=1;
  2498. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2499. self._samplesDo_((function(index,value){
  2500. return smalltalk.withContext(function($ctx2) {
  2501. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2502. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2503. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)})},
  2504. args: [],
  2505. source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNewValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]",
  2506. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2507. referencedClasses: ["Error"]
  2508. }),
  2509. globals.IndexableCollectionTest);
  2510. smalltalk.addMethod(
  2511. smalltalk.method({
  2512. selector: "testIndexOfWithNull",
  2513. protocol: 'tests',
  2514. fn: function (){
  2515. var self=this;
  2516. var jsNull;
  2517. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2518. return smalltalk.withContext(function($ctx1) {
  2519. var $1,$2;
  2520. jsNull=_st($JSON())._parse_("null");
  2521. self._samplesDo_((function(index,value){
  2522. return smalltalk.withContext(function($ctx2) {
  2523. $1=self._collection();
  2524. _st($1)._at_put_(index,jsNull);
  2525. $2=_st($1)._indexOf_(jsNull);
  2526. return self._assert_equals_($2,index);
  2527. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2528. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)})},
  2529. args: [],
  2530. source: "testIndexOfWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index put: jsNull; indexOf: jsNull) equals: index ]",
  2531. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2532. referencedClasses: ["JSON"]
  2533. }),
  2534. globals.IndexableCollectionTest);
  2535. smalltalk.addMethod(
  2536. smalltalk.method({
  2537. selector: "testWithIndexDo",
  2538. protocol: 'tests',
  2539. fn: function (){
  2540. var self=this;
  2541. var collection;
  2542. return smalltalk.withContext(function($ctx1) {
  2543. collection=self._collection();
  2544. $ctx1.sendIdx["collection"]=1;
  2545. _st(self._collection())._withIndexDo_((function(each,index){
  2546. return smalltalk.withContext(function($ctx2) {
  2547. return self._assert_equals_(_st(collection)._at_(index),each);
  2548. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2549. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)})},
  2550. args: [],
  2551. 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 ]",
  2552. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2553. referencedClasses: []
  2554. }),
  2555. globals.IndexableCollectionTest);
  2556. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  2557. smalltalk.addMethod(
  2558. smalltalk.method({
  2559. selector: "collectionKeys",
  2560. protocol: 'fixture',
  2561. fn: function (){
  2562. var self=this;
  2563. return smalltalk.withContext(function($ctx1) {
  2564. self._subclassResponsibility();
  2565. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)})},
  2566. args: [],
  2567. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2568. messageSends: ["subclassResponsibility"],
  2569. referencedClasses: []
  2570. }),
  2571. globals.AssociativeCollectionTest);
  2572. smalltalk.addMethod(
  2573. smalltalk.method({
  2574. selector: "collectionValues",
  2575. protocol: 'fixture',
  2576. fn: function (){
  2577. var self=this;
  2578. return smalltalk.withContext(function($ctx1) {
  2579. self._subclassResponsibility();
  2580. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)})},
  2581. args: [],
  2582. source: "collectionValues\x0a\x09self subclassResponsibility",
  2583. messageSends: ["subclassResponsibility"],
  2584. referencedClasses: []
  2585. }),
  2586. globals.AssociativeCollectionTest);
  2587. smalltalk.addMethod(
  2588. smalltalk.method({
  2589. selector: "nonIndexesDo:",
  2590. protocol: 'fixture',
  2591. fn: function (aBlock){
  2592. var self=this;
  2593. return smalltalk.withContext(function($ctx1) {
  2594. _st(aBlock)._value_((5));
  2595. $ctx1.sendIdx["value:"]=1;
  2596. _st(aBlock)._value_("z");
  2597. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2598. args: ["aBlock"],
  2599. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2600. messageSends: ["value:"],
  2601. referencedClasses: []
  2602. }),
  2603. globals.AssociativeCollectionTest);
  2604. smalltalk.addMethod(
  2605. smalltalk.method({
  2606. selector: "sampleNewIndex",
  2607. protocol: 'fixture',
  2608. fn: function (){
  2609. var self=this;
  2610. return "new";
  2611. },
  2612. args: [],
  2613. source: "sampleNewIndex\x0a\x09^ 'new'",
  2614. messageSends: [],
  2615. referencedClasses: []
  2616. }),
  2617. globals.AssociativeCollectionTest);
  2618. smalltalk.addMethod(
  2619. smalltalk.method({
  2620. selector: "samplesDo:",
  2621. protocol: 'fixture',
  2622. fn: function (aBlock){
  2623. var self=this;
  2624. return smalltalk.withContext(function($ctx1) {
  2625. _st(aBlock)._value_value_("a",(2));
  2626. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2627. args: ["aBlock"],
  2628. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2629. messageSends: ["value:value:"],
  2630. referencedClasses: []
  2631. }),
  2632. globals.AssociativeCollectionTest);
  2633. smalltalk.addMethod(
  2634. smalltalk.method({
  2635. selector: "testAddAll",
  2636. protocol: 'tests',
  2637. fn: function (){
  2638. var self=this;
  2639. return smalltalk.withContext(function($ctx1) {
  2640. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2641. globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2642. $2=self._collection();
  2643. $ctx1.sendIdx["collection"]=1;
  2644. $3=$2;
  2645. $4=self._collection();
  2646. $ctx1.sendIdx["collection"]=2;
  2647. _st($3)._addAll_($4);
  2648. $ctx1.sendIdx["addAll:"]=1;
  2649. $5=_st($2)._yourself();
  2650. $ctx1.sendIdx["yourself"]=1;
  2651. $1=$5;
  2652. $6=self._collection();
  2653. $ctx1.sendIdx["collection"]=3;
  2654. self._assert_equals_($1,$6);
  2655. $ctx1.sendIdx["assert:equals:"]=1;
  2656. $8=self._collection();
  2657. $ctx1.sendIdx["collection"]=4;
  2658. $9=$8;
  2659. $10=self._collectionWithNewValue();
  2660. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2661. _st($9)._addAll_($10);
  2662. $ctx1.sendIdx["addAll:"]=2;
  2663. $11=_st($8)._yourself();
  2664. $ctx1.sendIdx["yourself"]=2;
  2665. $7=$11;
  2666. $12=self._collectionWithNewValue();
  2667. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2668. self._assert_equals_($7,$12);
  2669. $ctx1.sendIdx["assert:equals:"]=2;
  2670. $14=self._collectionWithNewValue();
  2671. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2672. _st($14)._addAll_(self._collection());
  2673. $15=_st($14)._yourself();
  2674. $13=$15;
  2675. self._assert_equals_($13,self._collectionWithNewValue());
  2676. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)})},
  2677. args: [],
  2678. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  2679. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2680. referencedClasses: []
  2681. }),
  2682. globals.AssociativeCollectionTest);
  2683. smalltalk.addMethod(
  2684. smalltalk.method({
  2685. selector: "testAsDictionary",
  2686. protocol: 'tests',
  2687. fn: function (){
  2688. var self=this;
  2689. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2690. return smalltalk.withContext(function($ctx1) {
  2691. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2692. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)})},
  2693. args: [],
  2694. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2695. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2696. referencedClasses: ["Dictionary"]
  2697. }),
  2698. globals.AssociativeCollectionTest);
  2699. smalltalk.addMethod(
  2700. smalltalk.method({
  2701. selector: "testAsHashedCollection",
  2702. protocol: 'tests',
  2703. fn: function (){
  2704. var self=this;
  2705. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2706. return smalltalk.withContext(function($ctx1) {
  2707. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2708. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)})},
  2709. args: [],
  2710. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2711. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2712. referencedClasses: ["HashedCollection"]
  2713. }),
  2714. globals.AssociativeCollectionTest);
  2715. smalltalk.addMethod(
  2716. smalltalk.method({
  2717. selector: "testComma",
  2718. protocol: 'tests',
  2719. fn: function (){
  2720. var self=this;
  2721. return smalltalk.withContext(function($ctx1) {
  2722. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2723. globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  2724. $2=self._collection();
  2725. $ctx1.sendIdx["collection"]=1;
  2726. $3=self._collection();
  2727. $ctx1.sendIdx["collection"]=2;
  2728. $1=_st($2).__comma($3);
  2729. $ctx1.sendIdx[","]=1;
  2730. $4=self._collection();
  2731. $ctx1.sendIdx["collection"]=3;
  2732. self._assert_equals_($1,$4);
  2733. $ctx1.sendIdx["assert:equals:"]=1;
  2734. $6=self._collection();
  2735. $ctx1.sendIdx["collection"]=4;
  2736. $7=self._collectionWithNewValue();
  2737. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2738. $5=_st($6).__comma($7);
  2739. $ctx1.sendIdx[","]=2;
  2740. $8=self._collectionWithNewValue();
  2741. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2742. self._assert_equals_($5,$8);
  2743. $ctx1.sendIdx["assert:equals:"]=2;
  2744. $10=self._collectionWithNewValue();
  2745. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2746. $9=_st($10).__comma(self._collection());
  2747. self._assert_equals_($9,self._collectionWithNewValue());
  2748. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)})},
  2749. args: [],
  2750. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  2751. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2752. referencedClasses: []
  2753. }),
  2754. globals.AssociativeCollectionTest);
  2755. smalltalk.addMethod(
  2756. smalltalk.method({
  2757. selector: "testFrom",
  2758. protocol: 'tests',
  2759. fn: function (){
  2760. var self=this;
  2761. var associations;
  2762. return smalltalk.withContext(function($ctx1) {
  2763. var $1,$2,$3,$5,$4;
  2764. $1="a".__minus_gt((1));
  2765. $ctx1.sendIdx["->"]=1;
  2766. $2="b".__minus_gt((2));
  2767. $ctx1.sendIdx["->"]=2;
  2768. associations=[$1,$2];
  2769. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2770. $5="a".__minus_gt((1));
  2771. $ctx1.sendIdx["->"]=3;
  2772. $4=globals.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2773. self._assertSameContents_as_($3,$4);
  2774. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)})},
  2775. args: [],
  2776. 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 }.",
  2777. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2778. referencedClasses: []
  2779. }),
  2780. globals.AssociativeCollectionTest);
  2781. smalltalk.addMethod(
  2782. smalltalk.method({
  2783. selector: "testKeys",
  2784. protocol: 'tests',
  2785. fn: function (){
  2786. var self=this;
  2787. return smalltalk.withContext(function($ctx1) {
  2788. var $2,$1,$3,$4;
  2789. $2=_st(_st(self._collectionClass())._new())._keys();
  2790. $ctx1.sendIdx["keys"]=1;
  2791. $1=_st($2)._isEmpty();
  2792. self._assert_($1);
  2793. $3=_st(self._collection())._keys();
  2794. $ctx1.sendIdx["keys"]=2;
  2795. $4=self._collectionKeys();
  2796. $ctx1.sendIdx["collectionKeys"]=1;
  2797. self._assertSameContents_as_($3,$4);
  2798. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2799. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2800. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)})},
  2801. args: [],
  2802. source: "testKeys\x0a\x09self assert:self collectionClass new keys isEmpty.\x0a\x09self assertSameContents:self collection keys as: self collectionKeys.\x0a\x09self assertSameContents:self collectionWithNewValue keys as: self collectionKeys, { self sampleNewIndex }",
  2803. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2804. referencedClasses: []
  2805. }),
  2806. globals.AssociativeCollectionTest);
  2807. smalltalk.addMethod(
  2808. smalltalk.method({
  2809. selector: "testNewFromPairs",
  2810. protocol: 'tests',
  2811. fn: function (){
  2812. var self=this;
  2813. var flattenedAssociations;
  2814. return smalltalk.withContext(function($ctx1) {
  2815. var $1,$3,$2;
  2816. flattenedAssociations=["a",(1),"b",(2)];
  2817. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2818. $3="a".__minus_gt((1));
  2819. $ctx1.sendIdx["->"]=1;
  2820. $2=globals.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2821. self._assertSameContents_as_($1,$2);
  2822. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)})},
  2823. args: [],
  2824. 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 }.",
  2825. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2826. referencedClasses: []
  2827. }),
  2828. globals.AssociativeCollectionTest);
  2829. smalltalk.addMethod(
  2830. smalltalk.method({
  2831. selector: "testPrintString",
  2832. protocol: 'tests',
  2833. fn: function (){
  2834. var self=this;
  2835. return smalltalk.withContext(function($ctx1) {
  2836. var $3,$2,$4,$1,$5;
  2837. $3=self._collectionClass();
  2838. $ctx1.sendIdx["collectionClass"]=1;
  2839. $2=_st($3)._new();
  2840. _st($2)._at_put_("firstname","James");
  2841. $ctx1.sendIdx["at:put:"]=1;
  2842. _st($2)._at_put_("lastname","Bond");
  2843. $4=_st($2)._printString();
  2844. $1=$4;
  2845. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2846. $ctx1.sendIdx[","]=1;
  2847. self._assert_equals_($1,$5);
  2848. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)})},
  2849. args: [],
  2850. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (self collectionClass 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 ', self collectionClass name, ' (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  2851. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2852. referencedClasses: []
  2853. }),
  2854. globals.AssociativeCollectionTest);
  2855. smalltalk.addMethod(
  2856. smalltalk.method({
  2857. selector: "testRemoveKey",
  2858. protocol: 'tests',
  2859. fn: function (){
  2860. var self=this;
  2861. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2862. return smalltalk.withContext(function($ctx1) {
  2863. var $1,$2,$3,$5,$6,$4,$7,$8;
  2864. self._nonIndexesDo_((function(each){
  2865. var collection;
  2866. return smalltalk.withContext(function($ctx2) {
  2867. collection=self._collection();
  2868. $ctx2.sendIdx["collection"]=1;
  2869. collection;
  2870. self._should_raise_((function(){
  2871. return smalltalk.withContext(function($ctx3) {
  2872. return _st(collection)._removeKey_(each);
  2873. $ctx3.sendIdx["removeKey:"]=1;
  2874. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2875. $1=collection;
  2876. $2=self._collection();
  2877. $ctx2.sendIdx["collection"]=2;
  2878. return self._assert_equals_($1,$2);
  2879. $ctx2.sendIdx["assert:equals:"]=1;
  2880. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2881. self._samplesDo_((function(index,value){
  2882. var collection;
  2883. return smalltalk.withContext(function($ctx2) {
  2884. collection=self._collection();
  2885. $ctx2.sendIdx["collection"]=3;
  2886. collection;
  2887. $3=_st(collection)._removeKey_(index);
  2888. $ctx2.sendIdx["removeKey:"]=2;
  2889. self._assert_equals_($3,value);
  2890. $ctx2.sendIdx["assert:equals:"]=2;
  2891. $5=collection;
  2892. $6=self._collection();
  2893. $ctx2.sendIdx["collection"]=4;
  2894. $4=_st($5).__eq($6);
  2895. return self._deny_($4);
  2896. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2897. $7=self._collectionWithNewValue();
  2898. _st($7)._removeKey_(self._sampleNewIndex());
  2899. $8=_st($7)._yourself();
  2900. self._assert_equals_($8,self._collection());
  2901. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)})},
  2902. args: [],
  2903. source: "testRemoveKey\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self should: [ collection removeKey: each ] raise: Error.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex; yourself)\x0a\x09\x09equals: self collection",
  2904. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  2905. referencedClasses: ["Error"]
  2906. }),
  2907. globals.AssociativeCollectionTest);
  2908. smalltalk.addMethod(
  2909. smalltalk.method({
  2910. selector: "testRemoveKeyIfAbsent",
  2911. protocol: 'tests',
  2912. fn: function (){
  2913. var self=this;
  2914. return smalltalk.withContext(function($ctx1) {
  2915. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  2916. self._nonIndexesDo_((function(each){
  2917. var collection;
  2918. return smalltalk.withContext(function($ctx2) {
  2919. collection=self._collection();
  2920. $ctx2.sendIdx["collection"]=1;
  2921. collection;
  2922. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  2923. return smalltalk.withContext(function($ctx3) {
  2924. return self._sampleNewValue();
  2925. $ctx3.sendIdx["sampleNewValue"]=1;
  2926. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2927. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  2928. $2=self._sampleNewValue();
  2929. $ctx2.sendIdx["sampleNewValue"]=2;
  2930. self._assert_equals_($1,$2);
  2931. $ctx2.sendIdx["assert:equals:"]=1;
  2932. $3=collection;
  2933. $4=self._collection();
  2934. $ctx2.sendIdx["collection"]=2;
  2935. return self._assert_equals_($3,$4);
  2936. $ctx2.sendIdx["assert:equals:"]=2;
  2937. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2938. self._samplesDo_((function(index,value){
  2939. var collection;
  2940. return smalltalk.withContext(function($ctx2) {
  2941. collection=self._collection();
  2942. $ctx2.sendIdx["collection"]=3;
  2943. collection;
  2944. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  2945. return smalltalk.withContext(function($ctx3) {
  2946. return self._sampleNewValue();
  2947. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  2948. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  2949. self._assert_equals_($5,value);
  2950. $ctx2.sendIdx["assert:equals:"]=3;
  2951. $7=collection;
  2952. $8=self._collection();
  2953. $ctx2.sendIdx["collection"]=4;
  2954. $6=_st($7).__eq($8);
  2955. return self._deny_($6);
  2956. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2957. $9=self._collectionWithNewValue();
  2958. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  2959. return smalltalk.withContext(function($ctx2) {
  2960. return self._assert_(false);
  2961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  2962. $10=_st($9)._yourself();
  2963. self._assert_equals_($10,self._collection());
  2964. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)})},
  2965. args: [],
  2966. source: "testRemoveKeyIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index ifAbsent: [ self sampleNewValue ]) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex ifAbsent: [ self assert: false ]; yourself)\x0a\x09\x09equals: self collection",
  2967. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  2968. referencedClasses: []
  2969. }),
  2970. globals.AssociativeCollectionTest);
  2971. smalltalk.addMethod(
  2972. smalltalk.method({
  2973. selector: "testValues",
  2974. protocol: 'tests',
  2975. fn: function (){
  2976. var self=this;
  2977. return smalltalk.withContext(function($ctx1) {
  2978. var $2,$1,$3,$4;
  2979. $2=_st(_st(self._collectionClass())._new())._values();
  2980. $ctx1.sendIdx["values"]=1;
  2981. $1=_st($2)._isEmpty();
  2982. self._assert_($1);
  2983. $3=_st(self._collection())._values();
  2984. $ctx1.sendIdx["values"]=2;
  2985. $4=self._collectionValues();
  2986. $ctx1.sendIdx["collectionValues"]=1;
  2987. self._assertSameContents_as_($3,$4);
  2988. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2989. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  2990. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)})},
  2991. args: [],
  2992. source: "testValues\x0a\x09self assert:self collectionClass new values isEmpty.\x0a\x09self assertSameContents:self collection values as: self collectionValues.\x0a\x09self assertSameContents:self collectionWithNewValue values as: self collectionValues, { self sampleNewValue }",
  2993. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  2994. referencedClasses: []
  2995. }),
  2996. globals.AssociativeCollectionTest);
  2997. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  2998. smalltalk.addMethod(
  2999. smalltalk.method({
  3000. selector: "collection",
  3001. protocol: 'fixture',
  3002. fn: function (){
  3003. var self=this;
  3004. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3005. return smalltalk.withContext(function($ctx1) {
  3006. var $2,$3,$1;
  3007. $2=_st($Dictionary())._new();
  3008. _st($2)._at_put_((1),(1));
  3009. $ctx1.sendIdx["at:put:"]=1;
  3010. _st($2)._at_put_("a",(2));
  3011. $ctx1.sendIdx["at:put:"]=2;
  3012. _st($2)._at_put_(true,(3));
  3013. $ctx1.sendIdx["at:put:"]=3;
  3014. _st($2)._at_put_((1).__at((3)),(-4));
  3015. $3=_st($2)._yourself();
  3016. $1=$3;
  3017. return $1;
  3018. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)})},
  3019. args: [],
  3020. 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: 1@3 put: -4;\x0a\x09\x09yourself",
  3021. messageSends: ["at:put:", "new", "@", "yourself"],
  3022. referencedClasses: ["Dictionary"]
  3023. }),
  3024. globals.DictionaryTest);
  3025. smalltalk.addMethod(
  3026. smalltalk.method({
  3027. selector: "collectionKeys",
  3028. protocol: 'fixture',
  3029. fn: function (){
  3030. var self=this;
  3031. return smalltalk.withContext(function($ctx1) {
  3032. var $1;
  3033. $1=[(1),"a",true,(1).__at((3))];
  3034. return $1;
  3035. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)})},
  3036. args: [],
  3037. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3038. messageSends: ["@"],
  3039. referencedClasses: []
  3040. }),
  3041. globals.DictionaryTest);
  3042. smalltalk.addMethod(
  3043. smalltalk.method({
  3044. selector: "collectionOfPrintStrings",
  3045. protocol: 'fixture',
  3046. fn: function (){
  3047. var self=this;
  3048. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3049. return smalltalk.withContext(function($ctx1) {
  3050. var $2,$3,$1;
  3051. $2=_st($Dictionary())._new();
  3052. _st($2)._at_put_((1),"1");
  3053. $ctx1.sendIdx["at:put:"]=1;
  3054. _st($2)._at_put_("a","2");
  3055. $ctx1.sendIdx["at:put:"]=2;
  3056. _st($2)._at_put_(true,"3");
  3057. $ctx1.sendIdx["at:put:"]=3;
  3058. _st($2)._at_put_((1).__at((3)),"-4");
  3059. $3=_st($2)._yourself();
  3060. $1=$3;
  3061. return $1;
  3062. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)})},
  3063. args: [],
  3064. source: "collectionOfPrintStrings\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: 1@3 put: '-4';\x0a\x09\x09yourself",
  3065. messageSends: ["at:put:", "new", "@", "yourself"],
  3066. referencedClasses: ["Dictionary"]
  3067. }),
  3068. globals.DictionaryTest);
  3069. smalltalk.addMethod(
  3070. smalltalk.method({
  3071. selector: "collectionSize",
  3072. protocol: 'fixture',
  3073. fn: function (){
  3074. var self=this;
  3075. return (4);
  3076. },
  3077. args: [],
  3078. source: "collectionSize\x0a\x09^ 4",
  3079. messageSends: [],
  3080. referencedClasses: []
  3081. }),
  3082. globals.DictionaryTest);
  3083. smalltalk.addMethod(
  3084. smalltalk.method({
  3085. selector: "collectionValues",
  3086. protocol: 'fixture',
  3087. fn: function (){
  3088. var self=this;
  3089. var $1;
  3090. $1=[(1),(2),(3),(-4)];
  3091. return $1;
  3092. },
  3093. args: [],
  3094. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3095. messageSends: [],
  3096. referencedClasses: []
  3097. }),
  3098. globals.DictionaryTest);
  3099. smalltalk.addMethod(
  3100. smalltalk.method({
  3101. selector: "collectionWithDuplicates",
  3102. protocol: 'fixture',
  3103. fn: function (){
  3104. var self=this;
  3105. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3106. return smalltalk.withContext(function($ctx1) {
  3107. var $2,$3,$1;
  3108. $2=_st($Dictionary())._new();
  3109. _st($2)._at_put_((1),(1));
  3110. $ctx1.sendIdx["at:put:"]=1;
  3111. _st($2)._at_put_("a",(2));
  3112. $ctx1.sendIdx["at:put:"]=2;
  3113. _st($2)._at_put_(true,(3));
  3114. $ctx1.sendIdx["at:put:"]=3;
  3115. _st($2)._at_put_((4),(-4));
  3116. $ctx1.sendIdx["at:put:"]=4;
  3117. _st($2)._at_put_("b",(1));
  3118. $ctx1.sendIdx["at:put:"]=5;
  3119. _st($2)._at_put_((3),(3));
  3120. $ctx1.sendIdx["at:put:"]=6;
  3121. _st($2)._at_put_(false,(12));
  3122. $3=_st($2)._yourself();
  3123. $1=$3;
  3124. return $1;
  3125. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)})},
  3126. args: [],
  3127. 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",
  3128. messageSends: ["at:put:", "new", "yourself"],
  3129. referencedClasses: ["Dictionary"]
  3130. }),
  3131. globals.DictionaryTest);
  3132. smalltalk.addMethod(
  3133. smalltalk.method({
  3134. selector: "collectionWithNewValue",
  3135. protocol: 'fixture',
  3136. fn: function (){
  3137. var self=this;
  3138. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3139. return smalltalk.withContext(function($ctx1) {
  3140. var $2,$3,$1;
  3141. $2=_st($Dictionary())._new();
  3142. _st($2)._at_put_((1),(1));
  3143. $ctx1.sendIdx["at:put:"]=1;
  3144. _st($2)._at_put_("a",(2));
  3145. $ctx1.sendIdx["at:put:"]=2;
  3146. _st($2)._at_put_(true,(3));
  3147. $ctx1.sendIdx["at:put:"]=3;
  3148. _st($2)._at_put_((1).__at((3)),(-4));
  3149. $ctx1.sendIdx["at:put:"]=4;
  3150. _st($2)._at_put_("new","N");
  3151. $3=_st($2)._yourself();
  3152. $1=$3;
  3153. return $1;
  3154. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)})},
  3155. args: [],
  3156. source: "collectionWithNewValue\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: 1@3 put: -4;\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3157. messageSends: ["at:put:", "new", "@", "yourself"],
  3158. referencedClasses: ["Dictionary"]
  3159. }),
  3160. globals.DictionaryTest);
  3161. smalltalk.addMethod(
  3162. smalltalk.method({
  3163. selector: "sampleNewValueAsCollection",
  3164. protocol: 'fixture',
  3165. fn: function (){
  3166. var self=this;
  3167. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3168. return smalltalk.withContext(function($ctx1) {
  3169. var $2,$3,$1;
  3170. $2=_st($Dictionary())._new();
  3171. _st($2)._at_put_("new","N");
  3172. $3=_st($2)._yourself();
  3173. $1=$3;
  3174. return $1;
  3175. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)})},
  3176. args: [],
  3177. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3178. messageSends: ["at:put:", "new", "yourself"],
  3179. referencedClasses: ["Dictionary"]
  3180. }),
  3181. globals.DictionaryTest);
  3182. smalltalk.addMethod(
  3183. smalltalk.method({
  3184. selector: "samplesDo:",
  3185. protocol: 'fixture',
  3186. fn: function (aBlock){
  3187. var self=this;
  3188. return smalltalk.withContext(function($ctx1) {
  3189. globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3190. _st(aBlock)._value_value_(true,(3));
  3191. $ctx1.sendIdx["value:value:"]=1;
  3192. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3193. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)})},
  3194. args: ["aBlock"],
  3195. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3196. messageSends: ["samplesDo:", "value:value:", "@"],
  3197. referencedClasses: []
  3198. }),
  3199. globals.DictionaryTest);
  3200. smalltalk.addMethod(
  3201. smalltalk.method({
  3202. selector: "testAccessing",
  3203. protocol: 'tests',
  3204. fn: function (){
  3205. var self=this;
  3206. var d;
  3207. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3208. return smalltalk.withContext(function($ctx1) {
  3209. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3210. d=_st($Dictionary())._new();
  3211. _st(d)._at_put_("hello","world");
  3212. $ctx1.sendIdx["at:put:"]=1;
  3213. $1=_st(d)._at_("hello");
  3214. $ctx1.sendIdx["at:"]=1;
  3215. self._assert_equals_($1,"world");
  3216. $ctx1.sendIdx["assert:equals:"]=1;
  3217. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3218. return nil;
  3219. }));
  3220. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3221. self._assert_equals_($2,"world");
  3222. $ctx1.sendIdx["assert:equals:"]=2;
  3223. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3224. return nil;
  3225. }))).__eq("world"));
  3226. $ctx1.sendIdx["deny:"]=1;
  3227. $3=_st(d)._includesKey_("hello");
  3228. $ctx1.sendIdx["includesKey:"]=1;
  3229. self._assert_($3);
  3230. $ctx1.sendIdx["assert:"]=1;
  3231. $4=_st(d)._includesKey_("foo");
  3232. $ctx1.sendIdx["includesKey:"]=2;
  3233. self._deny_($4);
  3234. $ctx1.sendIdx["deny:"]=2;
  3235. _st(d)._at_put_((1),(2));
  3236. $ctx1.sendIdx["at:put:"]=2;
  3237. $5=_st(d)._at_((1));
  3238. $ctx1.sendIdx["at:"]=2;
  3239. self._assert_equals_($5,(2));
  3240. $ctx1.sendIdx["assert:equals:"]=3;
  3241. $6=d;
  3242. $7=(1).__at((3));
  3243. $ctx1.sendIdx["@"]=1;
  3244. _st($6)._at_put_($7,(3));
  3245. $9=d;
  3246. $10=(1).__at((3));
  3247. $ctx1.sendIdx["@"]=2;
  3248. $8=_st($9)._at_($10);
  3249. self._assert_equals_($8,(3));
  3250. $12=d;
  3251. $13=(1).__at((3));
  3252. $ctx1.sendIdx["@"]=3;
  3253. $11=_st($12)._includesKey_($13);
  3254. $ctx1.sendIdx["includesKey:"]=3;
  3255. self._assert_($11);
  3256. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3257. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)})},
  3258. args: [],
  3259. 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)",
  3260. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3261. referencedClasses: ["Dictionary"]
  3262. }),
  3263. globals.DictionaryTest);
  3264. smalltalk.addMethod(
  3265. smalltalk.method({
  3266. selector: "testDynamicDictionaries",
  3267. protocol: 'tests',
  3268. fn: function (){
  3269. var self=this;
  3270. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3271. return smalltalk.withContext(function($ctx1) {
  3272. var $3,$2,$1;
  3273. $3="hello".__minus_gt((1));
  3274. $ctx1.sendIdx["->"]=1;
  3275. $2=globals.HashedCollection._from_([$3]);
  3276. $1=_st($2)._asDictionary();
  3277. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  3278. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)})},
  3279. args: [],
  3280. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3281. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  3282. referencedClasses: ["Dictionary"]
  3283. }),
  3284. globals.DictionaryTest);
  3285. smalltalk.addMethod(
  3286. smalltalk.method({
  3287. selector: "collectionClass",
  3288. protocol: 'fixture',
  3289. fn: function (){
  3290. var self=this;
  3291. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3292. return $Dictionary();
  3293. },
  3294. args: [],
  3295. source: "collectionClass\x0a\x09^ Dictionary",
  3296. messageSends: [],
  3297. referencedClasses: ["Dictionary"]
  3298. }),
  3299. globals.DictionaryTest.klass);
  3300. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3301. smalltalk.addMethod(
  3302. smalltalk.method({
  3303. selector: "collection",
  3304. protocol: 'fixture',
  3305. fn: function (){
  3306. var self=this;
  3307. return smalltalk.withContext(function($ctx1) {
  3308. var $2,$3,$4,$1;
  3309. $2="b".__minus_gt((1));
  3310. $ctx1.sendIdx["->"]=1;
  3311. $3="a".__minus_gt((2));
  3312. $ctx1.sendIdx["->"]=2;
  3313. $4="c".__minus_gt((3));
  3314. $ctx1.sendIdx["->"]=3;
  3315. $1=globals.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  3316. return $1;
  3317. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.HashedCollectionTest)})},
  3318. args: [],
  3319. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3320. messageSends: ["->"],
  3321. referencedClasses: []
  3322. }),
  3323. globals.HashedCollectionTest);
  3324. smalltalk.addMethod(
  3325. smalltalk.method({
  3326. selector: "collectionKeys",
  3327. protocol: 'fixture',
  3328. fn: function (){
  3329. var self=this;
  3330. var $1;
  3331. $1=["b","a","c","d"];
  3332. return $1;
  3333. },
  3334. args: [],
  3335. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3336. messageSends: [],
  3337. referencedClasses: []
  3338. }),
  3339. globals.HashedCollectionTest);
  3340. smalltalk.addMethod(
  3341. smalltalk.method({
  3342. selector: "collectionOfPrintStrings",
  3343. protocol: 'fixture',
  3344. fn: function (){
  3345. var self=this;
  3346. return smalltalk.withContext(function($ctx1) {
  3347. var $2,$3,$4,$1;
  3348. $2="b".__minus_gt("1");
  3349. $ctx1.sendIdx["->"]=1;
  3350. $3="a".__minus_gt("2");
  3351. $ctx1.sendIdx["->"]=2;
  3352. $4="c".__minus_gt("3");
  3353. $ctx1.sendIdx["->"]=3;
  3354. $1=globals.HashedCollection._from_([$2,$3,$4,"d".__minus_gt("-4")]);
  3355. return $1;
  3356. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.HashedCollectionTest)})},
  3357. args: [],
  3358. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3359. messageSends: ["->"],
  3360. referencedClasses: []
  3361. }),
  3362. globals.HashedCollectionTest);
  3363. smalltalk.addMethod(
  3364. smalltalk.method({
  3365. selector: "collectionSize",
  3366. protocol: 'fixture',
  3367. fn: function (){
  3368. var self=this;
  3369. return (4);
  3370. },
  3371. args: [],
  3372. source: "collectionSize\x0a\x09^ 4",
  3373. messageSends: [],
  3374. referencedClasses: []
  3375. }),
  3376. globals.HashedCollectionTest);
  3377. smalltalk.addMethod(
  3378. smalltalk.method({
  3379. selector: "collectionValues",
  3380. protocol: 'fixture',
  3381. fn: function (){
  3382. var self=this;
  3383. var $1;
  3384. $1=[(1),(2),(3),(-4)];
  3385. return $1;
  3386. },
  3387. args: [],
  3388. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3389. messageSends: [],
  3390. referencedClasses: []
  3391. }),
  3392. globals.HashedCollectionTest);
  3393. smalltalk.addMethod(
  3394. smalltalk.method({
  3395. selector: "collectionWithDuplicates",
  3396. protocol: 'fixture',
  3397. fn: function (){
  3398. var self=this;
  3399. return smalltalk.withContext(function($ctx1) {
  3400. var $2,$3,$4,$5,$6,$7,$1;
  3401. $2="b".__minus_gt((1));
  3402. $ctx1.sendIdx["->"]=1;
  3403. $3="a".__minus_gt((2));
  3404. $ctx1.sendIdx["->"]=2;
  3405. $4="c".__minus_gt((3));
  3406. $ctx1.sendIdx["->"]=3;
  3407. $5="d".__minus_gt((-4));
  3408. $ctx1.sendIdx["->"]=4;
  3409. $6="e".__minus_gt((1));
  3410. $ctx1.sendIdx["->"]=5;
  3411. $7="f".__minus_gt((2));
  3412. $ctx1.sendIdx["->"]=6;
  3413. $1=globals.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  3414. return $1;
  3415. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.HashedCollectionTest)})},
  3416. args: [],
  3417. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3418. messageSends: ["->"],
  3419. referencedClasses: []
  3420. }),
  3421. globals.HashedCollectionTest);
  3422. smalltalk.addMethod(
  3423. smalltalk.method({
  3424. selector: "collectionWithNewValue",
  3425. protocol: 'fixture',
  3426. fn: function (){
  3427. var self=this;
  3428. return smalltalk.withContext(function($ctx1) {
  3429. var $2,$3,$4,$5,$1;
  3430. $2="b".__minus_gt((1));
  3431. $ctx1.sendIdx["->"]=1;
  3432. $3="a".__minus_gt((2));
  3433. $ctx1.sendIdx["->"]=2;
  3434. $4="c".__minus_gt((3));
  3435. $ctx1.sendIdx["->"]=3;
  3436. $5="d".__minus_gt((-4));
  3437. $ctx1.sendIdx["->"]=4;
  3438. $1=globals.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  3439. return $1;
  3440. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.HashedCollectionTest)})},
  3441. args: [],
  3442. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3443. messageSends: ["->"],
  3444. referencedClasses: []
  3445. }),
  3446. globals.HashedCollectionTest);
  3447. smalltalk.addMethod(
  3448. smalltalk.method({
  3449. selector: "sampleNewValueAsCollection",
  3450. protocol: 'fixture',
  3451. fn: function (){
  3452. var self=this;
  3453. return smalltalk.withContext(function($ctx1) {
  3454. var $1;
  3455. $1=globals.HashedCollection._from_(["new".__minus_gt("N")]);
  3456. return $1;
  3457. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.HashedCollectionTest)})},
  3458. args: [],
  3459. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3460. messageSends: ["->"],
  3461. referencedClasses: []
  3462. }),
  3463. globals.HashedCollectionTest);
  3464. smalltalk.addMethod(
  3465. smalltalk.method({
  3466. selector: "testDynamicDictionaries",
  3467. protocol: 'tests',
  3468. fn: function (){
  3469. var self=this;
  3470. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3471. return smalltalk.withContext(function($ctx1) {
  3472. var $3,$2,$1;
  3473. $3="hello".__minus_gt((1));
  3474. $ctx1.sendIdx["->"]=1;
  3475. $2=globals.HashedCollection._from_([$3]);
  3476. $1=_st($2)._asHashedCollection();
  3477. self._assert_equals_($1,_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3478. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)})},
  3479. args: [],
  3480. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3481. messageSends: ["assert:equals:", "asHashedCollection", "->", "with:"],
  3482. referencedClasses: ["HashedCollection"]
  3483. }),
  3484. globals.HashedCollectionTest);
  3485. smalltalk.addMethod(
  3486. smalltalk.method({
  3487. selector: "collectionClass",
  3488. protocol: 'fixture',
  3489. fn: function (){
  3490. var self=this;
  3491. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3492. return $HashedCollection();
  3493. },
  3494. args: [],
  3495. source: "collectionClass\x0a\x09^ HashedCollection",
  3496. messageSends: [],
  3497. referencedClasses: ["HashedCollection"]
  3498. }),
  3499. globals.HashedCollectionTest.klass);
  3500. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  3501. smalltalk.addMethod(
  3502. smalltalk.method({
  3503. selector: "collectionFirst",
  3504. protocol: 'fixture',
  3505. fn: function (){
  3506. var self=this;
  3507. return smalltalk.withContext(function($ctx1) {
  3508. self._subclassResponsibility();
  3509. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)})},
  3510. args: [],
  3511. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3512. messageSends: ["subclassResponsibility"],
  3513. referencedClasses: []
  3514. }),
  3515. globals.SequenceableCollectionTest);
  3516. smalltalk.addMethod(
  3517. smalltalk.method({
  3518. selector: "collectionFirstTwo",
  3519. protocol: 'fixture',
  3520. fn: function (){
  3521. var self=this;
  3522. return smalltalk.withContext(function($ctx1) {
  3523. self._subclassResponsibility();
  3524. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)})},
  3525. args: [],
  3526. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3527. messageSends: ["subclassResponsibility"],
  3528. referencedClasses: []
  3529. }),
  3530. globals.SequenceableCollectionTest);
  3531. smalltalk.addMethod(
  3532. smalltalk.method({
  3533. selector: "collectionLast",
  3534. protocol: 'fixture',
  3535. fn: function (){
  3536. var self=this;
  3537. return smalltalk.withContext(function($ctx1) {
  3538. self._subclassResponsibility();
  3539. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)})},
  3540. args: [],
  3541. source: "collectionLast\x0a\x09self subclassResponsibility",
  3542. messageSends: ["subclassResponsibility"],
  3543. referencedClasses: []
  3544. }),
  3545. globals.SequenceableCollectionTest);
  3546. smalltalk.addMethod(
  3547. smalltalk.method({
  3548. selector: "collectionLastTwo",
  3549. protocol: 'fixture',
  3550. fn: function (){
  3551. var self=this;
  3552. return smalltalk.withContext(function($ctx1) {
  3553. self._subclassResponsibility();
  3554. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)})},
  3555. args: [],
  3556. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3557. messageSends: ["subclassResponsibility"],
  3558. referencedClasses: []
  3559. }),
  3560. globals.SequenceableCollectionTest);
  3561. smalltalk.addMethod(
  3562. smalltalk.method({
  3563. selector: "nonIndexesDo:",
  3564. protocol: 'fixture',
  3565. fn: function (aBlock){
  3566. var self=this;
  3567. return smalltalk.withContext(function($ctx1) {
  3568. _st(aBlock)._value_((0));
  3569. $ctx1.sendIdx["value:"]=1;
  3570. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3571. $ctx1.sendIdx["value:"]=2;
  3572. _st(aBlock)._value_("z");
  3573. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3574. args: ["aBlock"],
  3575. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3576. messageSends: ["value:", "+", "collectionSize"],
  3577. referencedClasses: []
  3578. }),
  3579. globals.SequenceableCollectionTest);
  3580. smalltalk.addMethod(
  3581. smalltalk.method({
  3582. selector: "samplesDo:",
  3583. protocol: 'fixture',
  3584. fn: function (aBlock){
  3585. var self=this;
  3586. return smalltalk.withContext(function($ctx1) {
  3587. _st(aBlock)._value_value_((1),self._collectionFirst());
  3588. $ctx1.sendIdx["value:value:"]=1;
  3589. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3590. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3591. args: ["aBlock"],
  3592. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3593. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3594. referencedClasses: []
  3595. }),
  3596. globals.SequenceableCollectionTest);
  3597. smalltalk.addMethod(
  3598. smalltalk.method({
  3599. selector: "testBeginsWith",
  3600. protocol: 'tests',
  3601. fn: function (){
  3602. var self=this;
  3603. return smalltalk.withContext(function($ctx1) {
  3604. var $2,$1,$4,$5,$3,$7,$6;
  3605. $2=self._collection();
  3606. $ctx1.sendIdx["collection"]=1;
  3607. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3608. $ctx1.sendIdx["beginsWith:"]=1;
  3609. self._assert_($1);
  3610. $ctx1.sendIdx["assert:"]=1;
  3611. $4=self._collection();
  3612. $ctx1.sendIdx["collection"]=2;
  3613. $5=self._collection();
  3614. $ctx1.sendIdx["collection"]=3;
  3615. $3=_st($4)._beginsWith_($5);
  3616. $ctx1.sendIdx["beginsWith:"]=2;
  3617. self._assert_($3);
  3618. $ctx1.sendIdx["assert:"]=2;
  3619. $7=self._collection();
  3620. $ctx1.sendIdx["collection"]=4;
  3621. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3622. $ctx1.sendIdx["beginsWith:"]=3;
  3623. self._assert_($6);
  3624. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3625. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)})},
  3626. args: [],
  3627. source: "testBeginsWith\x0a\x09self assert: (self collection beginsWith: self collectionClass new).\x0a\x09self assert: (self collection beginsWith: self collection).\x0a\x09self assert: (self collection beginsWith: self collectionFirstTwo).\x0a\x09self deny: (self collection beginsWith: self collectionLastTwo)",
  3628. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3629. referencedClasses: []
  3630. }),
  3631. globals.SequenceableCollectionTest);
  3632. smalltalk.addMethod(
  3633. smalltalk.method({
  3634. selector: "testEndsWith",
  3635. protocol: 'tests',
  3636. fn: function (){
  3637. var self=this;
  3638. return smalltalk.withContext(function($ctx1) {
  3639. var $2,$1,$4,$5,$3,$7,$6;
  3640. $2=self._collection();
  3641. $ctx1.sendIdx["collection"]=1;
  3642. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3643. $ctx1.sendIdx["endsWith:"]=1;
  3644. self._assert_($1);
  3645. $ctx1.sendIdx["assert:"]=1;
  3646. $4=self._collection();
  3647. $ctx1.sendIdx["collection"]=2;
  3648. $5=self._collection();
  3649. $ctx1.sendIdx["collection"]=3;
  3650. $3=_st($4)._endsWith_($5);
  3651. $ctx1.sendIdx["endsWith:"]=2;
  3652. self._assert_($3);
  3653. $ctx1.sendIdx["assert:"]=2;
  3654. $7=self._collection();
  3655. $ctx1.sendIdx["collection"]=4;
  3656. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3657. $ctx1.sendIdx["endsWith:"]=3;
  3658. self._assert_($6);
  3659. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3660. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)})},
  3661. args: [],
  3662. source: "testEndsWith\x0a\x09self assert: (self collection endsWith: self collectionClass new).\x0a\x09self assert: (self collection endsWith: self collection).\x0a\x09self assert: (self collection endsWith: self collectionLastTwo).\x0a\x09self deny: (self collection endsWith: self collectionFirstTwo)",
  3663. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3664. referencedClasses: []
  3665. }),
  3666. globals.SequenceableCollectionTest);
  3667. smalltalk.addMethod(
  3668. smalltalk.method({
  3669. selector: "testFirst",
  3670. protocol: 'tests',
  3671. fn: function (){
  3672. var self=this;
  3673. return smalltalk.withContext(function($ctx1) {
  3674. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3675. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)})},
  3676. args: [],
  3677. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3678. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3679. referencedClasses: []
  3680. }),
  3681. globals.SequenceableCollectionTest);
  3682. smalltalk.addMethod(
  3683. smalltalk.method({
  3684. selector: "testFirstN",
  3685. protocol: 'tests',
  3686. fn: function (){
  3687. var self=this;
  3688. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3689. return smalltalk.withContext(function($ctx1) {
  3690. var $2,$1,$4,$3,$6,$5,$7;
  3691. $2=self._collection();
  3692. $ctx1.sendIdx["collection"]=1;
  3693. $1=_st($2)._first_((2));
  3694. $ctx1.sendIdx["first:"]=1;
  3695. self._assert_equals_($1,self._collectionFirstTwo());
  3696. $ctx1.sendIdx["assert:equals:"]=1;
  3697. $4=self._collection();
  3698. $ctx1.sendIdx["collection"]=2;
  3699. $3=_st($4)._first_((0));
  3700. $ctx1.sendIdx["first:"]=2;
  3701. self._assert_equals_($3,_st(self._collectionClass())._new());
  3702. $ctx1.sendIdx["assert:equals:"]=2;
  3703. $6=self._collection();
  3704. $ctx1.sendIdx["collection"]=3;
  3705. $5=_st($6)._first_(self._collectionSize());
  3706. $ctx1.sendIdx["first:"]=3;
  3707. $7=self._collection();
  3708. $ctx1.sendIdx["collection"]=4;
  3709. self._assert_equals_($5,$7);
  3710. self._should_raise_((function(){
  3711. return smalltalk.withContext(function($ctx2) {
  3712. return _st(self._collection())._first_((33));
  3713. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3714. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)})},
  3715. args: [],
  3716. source: "testFirstN\x0a\x09self \x0a\x09\x09assert: (self collection first: 2)\x0a\x09\x09equals: self collectionFirstTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  3717. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3718. referencedClasses: ["Error"]
  3719. }),
  3720. globals.SequenceableCollectionTest);
  3721. smalltalk.addMethod(
  3722. smalltalk.method({
  3723. selector: "testFourth",
  3724. protocol: 'tests',
  3725. fn: function (){
  3726. var self=this;
  3727. return smalltalk.withContext(function($ctx1) {
  3728. var $2,$1;
  3729. $2=self._collection();
  3730. $ctx1.sendIdx["collection"]=1;
  3731. $1=_st($2)._fourth();
  3732. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3733. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)})},
  3734. args: [],
  3735. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3736. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3737. referencedClasses: []
  3738. }),
  3739. globals.SequenceableCollectionTest);
  3740. smalltalk.addMethod(
  3741. smalltalk.method({
  3742. selector: "testIndexOfStartingAt",
  3743. protocol: 'tests',
  3744. fn: function (){
  3745. var self=this;
  3746. var jsNull;
  3747. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3748. return smalltalk.withContext(function($ctx1) {
  3749. var $2,$1,$4,$3;
  3750. jsNull=_st($JSON())._parse_("null");
  3751. self._samplesDo_((function(index,value){
  3752. return smalltalk.withContext(function($ctx2) {
  3753. $2=self._collection();
  3754. $ctx2.sendIdx["collection"]=1;
  3755. $1=_st($2)._indexOf_startingAt_(value,(1));
  3756. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3757. self._assert_equals_($1,index);
  3758. $ctx2.sendIdx["assert:equals:"]=1;
  3759. $4=self._collection();
  3760. $ctx2.sendIdx["collection"]=2;
  3761. $3=_st($4)._indexOf_startingAt_(value,index);
  3762. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3763. self._assert_equals_($3,index);
  3764. $ctx2.sendIdx["assert:equals:"]=2;
  3765. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3766. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3767. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3768. args: [],
  3769. source: "testIndexOfStartingAt\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value startingAt: 1) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index+1) equals: 0 ]",
  3770. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3771. referencedClasses: ["JSON"]
  3772. }),
  3773. globals.SequenceableCollectionTest);
  3774. smalltalk.addMethod(
  3775. smalltalk.method({
  3776. selector: "testIndexOfStartingAtWithNull",
  3777. protocol: 'tests',
  3778. fn: function (){
  3779. var self=this;
  3780. var jsNull;
  3781. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3782. return smalltalk.withContext(function($ctx1) {
  3783. var $1,$2;
  3784. jsNull=_st($JSON())._parse_("null");
  3785. self._samplesDo_((function(index,value){
  3786. var collection;
  3787. return smalltalk.withContext(function($ctx2) {
  3788. collection=self._collection();
  3789. collection;
  3790. _st(collection)._at_put_(index,jsNull);
  3791. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3792. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3793. self._assert_equals_($1,index);
  3794. $ctx2.sendIdx["assert:equals:"]=1;
  3795. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3796. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3797. self._assert_equals_($2,index);
  3798. $ctx2.sendIdx["assert:equals:"]=2;
  3799. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3800. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3801. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3802. args: [],
  3803. source: "testIndexOfStartingAtWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value | | collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09collection at: index put: jsNull.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: 1) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index+1) equals: 0 ]",
  3804. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3805. referencedClasses: ["JSON"]
  3806. }),
  3807. globals.SequenceableCollectionTest);
  3808. smalltalk.addMethod(
  3809. smalltalk.method({
  3810. selector: "testLast",
  3811. protocol: 'tests',
  3812. fn: function (){
  3813. var self=this;
  3814. return smalltalk.withContext(function($ctx1) {
  3815. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3816. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)})},
  3817. args: [],
  3818. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3819. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3820. referencedClasses: []
  3821. }),
  3822. globals.SequenceableCollectionTest);
  3823. smalltalk.addMethod(
  3824. smalltalk.method({
  3825. selector: "testLastN",
  3826. protocol: 'tests',
  3827. fn: function (){
  3828. var self=this;
  3829. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3830. return smalltalk.withContext(function($ctx1) {
  3831. var $2,$1,$4,$3,$6,$5,$7;
  3832. $2=self._collection();
  3833. $ctx1.sendIdx["collection"]=1;
  3834. $1=_st($2)._last_((2));
  3835. $ctx1.sendIdx["last:"]=1;
  3836. self._assert_equals_($1,self._collectionLastTwo());
  3837. $ctx1.sendIdx["assert:equals:"]=1;
  3838. $4=self._collection();
  3839. $ctx1.sendIdx["collection"]=2;
  3840. $3=_st($4)._last_((0));
  3841. $ctx1.sendIdx["last:"]=2;
  3842. self._assert_equals_($3,_st(self._collectionClass())._new());
  3843. $ctx1.sendIdx["assert:equals:"]=2;
  3844. $6=self._collection();
  3845. $ctx1.sendIdx["collection"]=3;
  3846. $5=_st($6)._last_(self._collectionSize());
  3847. $ctx1.sendIdx["last:"]=3;
  3848. $7=self._collection();
  3849. $ctx1.sendIdx["collection"]=4;
  3850. self._assert_equals_($5,$7);
  3851. self._should_raise_((function(){
  3852. return smalltalk.withContext(function($ctx2) {
  3853. return _st(self._collection())._last_((33));
  3854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3855. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)})},
  3856. args: [],
  3857. source: "testLastN\x0a\x09self \x0a\x09\x09assert: (self collection last: 2) \x0a\x09\x09equals: self collectionLastTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection last: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x0a\x09self\x0a\x09\x09assert: (self collection last: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  3858. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3859. referencedClasses: ["Error"]
  3860. }),
  3861. globals.SequenceableCollectionTest);
  3862. smalltalk.addMethod(
  3863. smalltalk.method({
  3864. selector: "testSecond",
  3865. protocol: 'tests',
  3866. fn: function (){
  3867. var self=this;
  3868. return smalltalk.withContext(function($ctx1) {
  3869. var $2,$1;
  3870. $2=self._collection();
  3871. $ctx1.sendIdx["collection"]=1;
  3872. $1=_st($2)._second();
  3873. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3874. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)})},
  3875. args: [],
  3876. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3877. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3878. referencedClasses: []
  3879. }),
  3880. globals.SequenceableCollectionTest);
  3881. smalltalk.addMethod(
  3882. smalltalk.method({
  3883. selector: "testThird",
  3884. protocol: 'tests',
  3885. fn: function (){
  3886. var self=this;
  3887. return smalltalk.withContext(function($ctx1) {
  3888. var $2,$1;
  3889. $2=self._collection();
  3890. $ctx1.sendIdx["collection"]=1;
  3891. $1=_st($2)._third();
  3892. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3893. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)})},
  3894. args: [],
  3895. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3896. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3897. referencedClasses: []
  3898. }),
  3899. globals.SequenceableCollectionTest);
  3900. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  3901. smalltalk.addMethod(
  3902. smalltalk.method({
  3903. selector: "collection",
  3904. protocol: 'fixture',
  3905. fn: function (){
  3906. var self=this;
  3907. var $1;
  3908. $1=[(1), (2), (3), (-4)];
  3909. return $1;
  3910. },
  3911. args: [],
  3912. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3913. messageSends: [],
  3914. referencedClasses: []
  3915. }),
  3916. globals.ArrayTest);
  3917. smalltalk.addMethod(
  3918. smalltalk.method({
  3919. selector: "collectionFirst",
  3920. protocol: 'fixture',
  3921. fn: function (){
  3922. var self=this;
  3923. return (1);
  3924. },
  3925. args: [],
  3926. source: "collectionFirst\x0a\x09^ 1",
  3927. messageSends: [],
  3928. referencedClasses: []
  3929. }),
  3930. globals.ArrayTest);
  3931. smalltalk.addMethod(
  3932. smalltalk.method({
  3933. selector: "collectionFirstTwo",
  3934. protocol: 'fixture',
  3935. fn: function (){
  3936. var self=this;
  3937. var $1;
  3938. $1=[(1), (2)];
  3939. return $1;
  3940. },
  3941. args: [],
  3942. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3943. messageSends: [],
  3944. referencedClasses: []
  3945. }),
  3946. globals.ArrayTest);
  3947. smalltalk.addMethod(
  3948. smalltalk.method({
  3949. selector: "collectionLast",
  3950. protocol: 'fixture',
  3951. fn: function (){
  3952. var self=this;
  3953. return (-4);
  3954. },
  3955. args: [],
  3956. source: "collectionLast\x0a\x09^ -4",
  3957. messageSends: [],
  3958. referencedClasses: []
  3959. }),
  3960. globals.ArrayTest);
  3961. smalltalk.addMethod(
  3962. smalltalk.method({
  3963. selector: "collectionLastTwo",
  3964. protocol: 'fixture',
  3965. fn: function (){
  3966. var self=this;
  3967. var $1;
  3968. $1=[(3), (-4)];
  3969. return $1;
  3970. },
  3971. args: [],
  3972. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3973. messageSends: [],
  3974. referencedClasses: []
  3975. }),
  3976. globals.ArrayTest);
  3977. smalltalk.addMethod(
  3978. smalltalk.method({
  3979. selector: "collectionOfPrintStrings",
  3980. protocol: 'fixture',
  3981. fn: function (){
  3982. var self=this;
  3983. var $1;
  3984. $1=["1", "2", "3", "-4"];
  3985. return $1;
  3986. },
  3987. args: [],
  3988. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  3989. messageSends: [],
  3990. referencedClasses: []
  3991. }),
  3992. globals.ArrayTest);
  3993. smalltalk.addMethod(
  3994. smalltalk.method({
  3995. selector: "collectionSize",
  3996. protocol: 'fixture',
  3997. fn: function (){
  3998. var self=this;
  3999. return (4);
  4000. },
  4001. args: [],
  4002. source: "collectionSize\x0a\x09^ 4",
  4003. messageSends: [],
  4004. referencedClasses: []
  4005. }),
  4006. globals.ArrayTest);
  4007. smalltalk.addMethod(
  4008. smalltalk.method({
  4009. selector: "collectionWithDuplicates",
  4010. protocol: 'fixture',
  4011. fn: function (){
  4012. var self=this;
  4013. var $1;
  4014. $1=["a", "b", "c", (1), (2), (1), "a"];
  4015. return $1;
  4016. },
  4017. args: [],
  4018. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4019. messageSends: [],
  4020. referencedClasses: []
  4021. }),
  4022. globals.ArrayTest);
  4023. smalltalk.addMethod(
  4024. smalltalk.method({
  4025. selector: "collectionWithNewValue",
  4026. protocol: 'fixture',
  4027. fn: function (){
  4028. var self=this;
  4029. var $1;
  4030. $1=[(1), (2), (3), (-4), "N"];
  4031. return $1;
  4032. },
  4033. args: [],
  4034. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4035. messageSends: [],
  4036. referencedClasses: []
  4037. }),
  4038. globals.ArrayTest);
  4039. smalltalk.addMethod(
  4040. smalltalk.method({
  4041. selector: "sampleNewIndex",
  4042. protocol: 'fixture',
  4043. fn: function (){
  4044. var self=this;
  4045. return (5);
  4046. },
  4047. args: [],
  4048. source: "sampleNewIndex\x0a\x09^ 5",
  4049. messageSends: [],
  4050. referencedClasses: []
  4051. }),
  4052. globals.ArrayTest);
  4053. smalltalk.addMethod(
  4054. smalltalk.method({
  4055. selector: "samplesDo:",
  4056. protocol: 'fixture',
  4057. fn: function (aBlock){
  4058. var self=this;
  4059. return smalltalk.withContext(function($ctx1) {
  4060. globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4061. _st(aBlock)._value_value_((3),(3));
  4062. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)})},
  4063. args: ["aBlock"],
  4064. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4065. messageSends: ["samplesDo:", "value:value:"],
  4066. referencedClasses: []
  4067. }),
  4068. globals.ArrayTest);
  4069. smalltalk.addMethod(
  4070. smalltalk.method({
  4071. selector: "testAdd",
  4072. protocol: 'tests',
  4073. fn: function (){
  4074. var self=this;
  4075. var array;
  4076. return smalltalk.withContext(function($ctx1) {
  4077. array=self._collection();
  4078. _st(array)._add_((6));
  4079. self._assert_equals_(_st(array)._last(),(6));
  4080. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)})},
  4081. args: [],
  4082. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4083. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4084. referencedClasses: []
  4085. }),
  4086. globals.ArrayTest);
  4087. smalltalk.addMethod(
  4088. smalltalk.method({
  4089. selector: "testAddFirst",
  4090. protocol: 'tests',
  4091. fn: function (){
  4092. var self=this;
  4093. return smalltalk.withContext(function($ctx1) {
  4094. var $1,$2;
  4095. $1=self._collection();
  4096. _st($1)._addFirst_((0));
  4097. $2=_st($1)._yourself();
  4098. self._assert_equals_(_st($2)._first(),(0));
  4099. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)})},
  4100. args: [],
  4101. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4102. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4103. referencedClasses: []
  4104. }),
  4105. globals.ArrayTest);
  4106. smalltalk.addMethod(
  4107. smalltalk.method({
  4108. selector: "testPrintString",
  4109. protocol: 'tests',
  4110. fn: function (){
  4111. var self=this;
  4112. var array;
  4113. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4114. return smalltalk.withContext(function($ctx1) {
  4115. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4116. array=_st($Array())._new();
  4117. $1=_st(array)._printString();
  4118. $ctx1.sendIdx["printString"]=1;
  4119. self._assert_equals_($1,"an Array ()");
  4120. $ctx1.sendIdx["assert:equals:"]=1;
  4121. $2=array;
  4122. _st($2)._add_((1));
  4123. $ctx1.sendIdx["add:"]=1;
  4124. $3=_st($2)._add_((3));
  4125. $ctx1.sendIdx["add:"]=2;
  4126. $4=_st(array)._printString();
  4127. $ctx1.sendIdx["printString"]=2;
  4128. self._assert_equals_($4,"an Array (1 3)");
  4129. $ctx1.sendIdx["assert:equals:"]=2;
  4130. _st(array)._add_("foo");
  4131. $5=_st(array)._printString();
  4132. $ctx1.sendIdx["printString"]=3;
  4133. self._assert_equals_($5,"an Array (1 3 'foo')");
  4134. $ctx1.sendIdx["assert:equals:"]=3;
  4135. $6=array;
  4136. _st($6)._remove_((1));
  4137. $ctx1.sendIdx["remove:"]=1;
  4138. $7=_st($6)._remove_((3));
  4139. $8=_st(array)._printString();
  4140. $ctx1.sendIdx["printString"]=4;
  4141. self._assert_equals_($8,"an Array ('foo')");
  4142. $ctx1.sendIdx["assert:equals:"]=4;
  4143. _st(array)._addLast_((3));
  4144. $ctx1.sendIdx["addLast:"]=1;
  4145. $9=_st(array)._printString();
  4146. $ctx1.sendIdx["printString"]=5;
  4147. self._assert_equals_($9,"an Array ('foo' 3)");
  4148. $ctx1.sendIdx["assert:equals:"]=5;
  4149. _st(array)._addLast_((3));
  4150. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4151. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)})},
  4152. args: [],
  4153. 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)'.",
  4154. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4155. referencedClasses: ["Array"]
  4156. }),
  4157. globals.ArrayTest);
  4158. smalltalk.addMethod(
  4159. smalltalk.method({
  4160. selector: "testRemove",
  4161. protocol: 'tests',
  4162. fn: function (){
  4163. var self=this;
  4164. var array;
  4165. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4166. return smalltalk.withContext(function($ctx1) {
  4167. array=[(1), (2), (3), (4), (5)];
  4168. _st(array)._remove_((3));
  4169. $ctx1.sendIdx["remove:"]=1;
  4170. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4171. self._should_raise_((function(){
  4172. return smalltalk.withContext(function($ctx2) {
  4173. return _st(array)._remove_((3));
  4174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4175. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)})},
  4176. args: [],
  4177. 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",
  4178. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4179. referencedClasses: ["Error"]
  4180. }),
  4181. globals.ArrayTest);
  4182. smalltalk.addMethod(
  4183. smalltalk.method({
  4184. selector: "testRemoveFromTo",
  4185. protocol: 'tests',
  4186. fn: function (){
  4187. var self=this;
  4188. return smalltalk.withContext(function($ctx1) {
  4189. var $1,$2;
  4190. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4191. $ctx1.sendIdx["removeFrom:to:"]=1;
  4192. self._assert_equals_($1,[(4)]);
  4193. $ctx1.sendIdx["assert:equals:"]=1;
  4194. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4195. $ctx1.sendIdx["removeFrom:to:"]=2;
  4196. self._assert_equals_($2,[(1), (4)]);
  4197. $ctx1.sendIdx["assert:equals:"]=2;
  4198. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4199. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)})},
  4200. args: [],
  4201. 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)",
  4202. messageSends: ["assert:equals:", "removeFrom:to:"],
  4203. referencedClasses: []
  4204. }),
  4205. globals.ArrayTest);
  4206. smalltalk.addMethod(
  4207. smalltalk.method({
  4208. selector: "testRemoveIndex",
  4209. protocol: 'tests',
  4210. fn: function (){
  4211. var self=this;
  4212. return smalltalk.withContext(function($ctx1) {
  4213. var $1,$2;
  4214. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4215. $ctx1.sendIdx["removeIndex:"]=1;
  4216. self._assert_equals_($1,[(1), (3), (4)]);
  4217. $ctx1.sendIdx["assert:equals:"]=1;
  4218. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4219. $ctx1.sendIdx["removeIndex:"]=2;
  4220. self._assert_equals_($2,[(2), (3), (4)]);
  4221. $ctx1.sendIdx["assert:equals:"]=2;
  4222. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4223. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)})},
  4224. args: [],
  4225. 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: #()",
  4226. messageSends: ["assert:equals:", "removeIndex:"],
  4227. referencedClasses: []
  4228. }),
  4229. globals.ArrayTest);
  4230. smalltalk.addMethod(
  4231. smalltalk.method({
  4232. selector: "testRemoveLast",
  4233. protocol: 'tests',
  4234. fn: function (){
  4235. var self=this;
  4236. var array;
  4237. return smalltalk.withContext(function($ctx1) {
  4238. array=[(1), (2)];
  4239. _st(array)._removeLast();
  4240. self._assert_equals_(_st(array)._last(),(1));
  4241. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)})},
  4242. args: [],
  4243. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4244. messageSends: ["removeLast", "assert:equals:", "last"],
  4245. referencedClasses: []
  4246. }),
  4247. globals.ArrayTest);
  4248. smalltalk.addMethod(
  4249. smalltalk.method({
  4250. selector: "testReversed",
  4251. protocol: 'tests',
  4252. fn: function (){
  4253. var self=this;
  4254. var array;
  4255. return smalltalk.withContext(function($ctx1) {
  4256. array=[(5), (4), (3), (2), (1)];
  4257. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4258. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)})},
  4259. args: [],
  4260. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4261. messageSends: ["assert:equals:", "reversed"],
  4262. referencedClasses: []
  4263. }),
  4264. globals.ArrayTest);
  4265. smalltalk.addMethod(
  4266. smalltalk.method({
  4267. selector: "testSort",
  4268. protocol: 'tests',
  4269. fn: function (){
  4270. var self=this;
  4271. var array;
  4272. return smalltalk.withContext(function($ctx1) {
  4273. array=[(10), (1), (5)];
  4274. _st(array)._sort();
  4275. self._assert_equals_(array,[(1), (5), (10)]);
  4276. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)})},
  4277. args: [],
  4278. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  4279. messageSends: ["sort", "assert:equals:"],
  4280. referencedClasses: []
  4281. }),
  4282. globals.ArrayTest);
  4283. smalltalk.addMethod(
  4284. smalltalk.method({
  4285. selector: "collectionClass",
  4286. protocol: 'fixture',
  4287. fn: function (){
  4288. var self=this;
  4289. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4290. return $Array();
  4291. },
  4292. args: [],
  4293. source: "collectionClass\x0a\x09^ Array",
  4294. messageSends: [],
  4295. referencedClasses: ["Array"]
  4296. }),
  4297. globals.ArrayTest.klass);
  4298. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  4299. smalltalk.addMethod(
  4300. smalltalk.method({
  4301. selector: "collection",
  4302. protocol: 'fixture',
  4303. fn: function (){
  4304. var self=this;
  4305. return "helLo";
  4306. },
  4307. args: [],
  4308. source: "collection\x0a\x09^ 'helLo'",
  4309. messageSends: [],
  4310. referencedClasses: []
  4311. }),
  4312. globals.StringTest);
  4313. smalltalk.addMethod(
  4314. smalltalk.method({
  4315. selector: "collectionFirst",
  4316. protocol: 'fixture',
  4317. fn: function (){
  4318. var self=this;
  4319. return "h";
  4320. },
  4321. args: [],
  4322. source: "collectionFirst\x0a\x09^ 'h'",
  4323. messageSends: [],
  4324. referencedClasses: []
  4325. }),
  4326. globals.StringTest);
  4327. smalltalk.addMethod(
  4328. smalltalk.method({
  4329. selector: "collectionFirstTwo",
  4330. protocol: 'fixture',
  4331. fn: function (){
  4332. var self=this;
  4333. return "he";
  4334. },
  4335. args: [],
  4336. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4337. messageSends: [],
  4338. referencedClasses: []
  4339. }),
  4340. globals.StringTest);
  4341. smalltalk.addMethod(
  4342. smalltalk.method({
  4343. selector: "collectionLast",
  4344. protocol: 'fixture',
  4345. fn: function (){
  4346. var self=this;
  4347. return "o";
  4348. },
  4349. args: [],
  4350. source: "collectionLast\x0a\x09^ 'o'",
  4351. messageSends: [],
  4352. referencedClasses: []
  4353. }),
  4354. globals.StringTest);
  4355. smalltalk.addMethod(
  4356. smalltalk.method({
  4357. selector: "collectionLastTwo",
  4358. protocol: 'fixture',
  4359. fn: function (){
  4360. var self=this;
  4361. return "Lo";
  4362. },
  4363. args: [],
  4364. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4365. messageSends: [],
  4366. referencedClasses: []
  4367. }),
  4368. globals.StringTest);
  4369. smalltalk.addMethod(
  4370. smalltalk.method({
  4371. selector: "collectionOfPrintStrings",
  4372. protocol: 'fixture',
  4373. fn: function (){
  4374. var self=this;
  4375. return "'h''e''l''L''o'";
  4376. },
  4377. args: [],
  4378. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4379. messageSends: [],
  4380. referencedClasses: []
  4381. }),
  4382. globals.StringTest);
  4383. smalltalk.addMethod(
  4384. smalltalk.method({
  4385. selector: "collectionSize",
  4386. protocol: 'fixture',
  4387. fn: function (){
  4388. var self=this;
  4389. return (5);
  4390. },
  4391. args: [],
  4392. source: "collectionSize\x0a\x09^ 5",
  4393. messageSends: [],
  4394. referencedClasses: []
  4395. }),
  4396. globals.StringTest);
  4397. smalltalk.addMethod(
  4398. smalltalk.method({
  4399. selector: "collectionWithDuplicates",
  4400. protocol: 'fixture',
  4401. fn: function (){
  4402. var self=this;
  4403. return "abbaerte";
  4404. },
  4405. args: [],
  4406. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4407. messageSends: [],
  4408. referencedClasses: []
  4409. }),
  4410. globals.StringTest);
  4411. smalltalk.addMethod(
  4412. smalltalk.method({
  4413. selector: "collectionWithNewValue",
  4414. protocol: 'fixture',
  4415. fn: function (){
  4416. var self=this;
  4417. return "helLoN";
  4418. },
  4419. args: [],
  4420. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4421. messageSends: [],
  4422. referencedClasses: []
  4423. }),
  4424. globals.StringTest);
  4425. smalltalk.addMethod(
  4426. smalltalk.method({
  4427. selector: "sampleNewValueAsCollection",
  4428. protocol: 'fixture',
  4429. fn: function (){
  4430. var self=this;
  4431. return "N";
  4432. },
  4433. args: [],
  4434. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4435. messageSends: [],
  4436. referencedClasses: []
  4437. }),
  4438. globals.StringTest);
  4439. smalltalk.addMethod(
  4440. smalltalk.method({
  4441. selector: "samplesDo:",
  4442. protocol: 'fixture',
  4443. fn: function (aBlock){
  4444. var self=this;
  4445. return smalltalk.withContext(function($ctx1) {
  4446. globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4447. _st(aBlock)._value_value_((3),"l");
  4448. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)})},
  4449. args: ["aBlock"],
  4450. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4451. messageSends: ["samplesDo:", "value:value:"],
  4452. referencedClasses: []
  4453. }),
  4454. globals.StringTest);
  4455. smalltalk.addMethod(
  4456. smalltalk.method({
  4457. selector: "testAddAll",
  4458. protocol: 'tests',
  4459. fn: function (){
  4460. var self=this;
  4461. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4462. return smalltalk.withContext(function($ctx1) {
  4463. var $1;
  4464. self._should_raise_((function(){
  4465. return smalltalk.withContext(function($ctx2) {
  4466. $1=self._collection();
  4467. $ctx2.sendIdx["collection"]=1;
  4468. return _st($1)._addAll_(self._collection());
  4469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4470. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)})},
  4471. args: [],
  4472. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4473. messageSends: ["should:raise:", "addAll:", "collection"],
  4474. referencedClasses: ["Error"]
  4475. }),
  4476. globals.StringTest);
  4477. smalltalk.addMethod(
  4478. smalltalk.method({
  4479. selector: "testAddRemove",
  4480. protocol: 'tests',
  4481. fn: function (){
  4482. var self=this;
  4483. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4484. return smalltalk.withContext(function($ctx1) {
  4485. self._should_raise_((function(){
  4486. return smalltalk.withContext(function($ctx2) {
  4487. return "hello"._add_("a");
  4488. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4489. $ctx1.sendIdx["should:raise:"]=1;
  4490. self._should_raise_((function(){
  4491. return smalltalk.withContext(function($ctx2) {
  4492. return "hello"._remove_("h");
  4493. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4494. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)})},
  4495. args: [],
  4496. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4497. messageSends: ["should:raise:", "add:", "remove:"],
  4498. referencedClasses: ["Error"]
  4499. }),
  4500. globals.StringTest);
  4501. smalltalk.addMethod(
  4502. smalltalk.method({
  4503. selector: "testAsArray",
  4504. protocol: 'tests',
  4505. fn: function (){
  4506. var self=this;
  4507. return smalltalk.withContext(function($ctx1) {
  4508. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4509. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)})},
  4510. args: [],
  4511. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4512. messageSends: ["assert:equals:", "asArray"],
  4513. referencedClasses: []
  4514. }),
  4515. globals.StringTest);
  4516. smalltalk.addMethod(
  4517. smalltalk.method({
  4518. selector: "testAsLowerCase",
  4519. protocol: 'tests',
  4520. fn: function (){
  4521. var self=this;
  4522. return smalltalk.withContext(function($ctx1) {
  4523. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4524. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)})},
  4525. args: [],
  4526. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4527. messageSends: ["assert:equals:", "asLowercase"],
  4528. referencedClasses: []
  4529. }),
  4530. globals.StringTest);
  4531. smalltalk.addMethod(
  4532. smalltalk.method({
  4533. selector: "testAsNumber",
  4534. protocol: 'tests',
  4535. fn: function (){
  4536. var self=this;
  4537. return smalltalk.withContext(function($ctx1) {
  4538. var $1,$2;
  4539. $1="3"._asNumber();
  4540. $ctx1.sendIdx["asNumber"]=1;
  4541. self._assert_equals_($1,(3));
  4542. $ctx1.sendIdx["assert:equals:"]=1;
  4543. $2="-3"._asNumber();
  4544. $ctx1.sendIdx["asNumber"]=2;
  4545. self._assert_equals_($2,(-3));
  4546. $ctx1.sendIdx["assert:equals:"]=2;
  4547. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4548. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)})},
  4549. args: [],
  4550. 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.",
  4551. messageSends: ["assert:equals:", "asNumber"],
  4552. referencedClasses: []
  4553. }),
  4554. globals.StringTest);
  4555. smalltalk.addMethod(
  4556. smalltalk.method({
  4557. selector: "testAsUpperCase",
  4558. protocol: 'tests',
  4559. fn: function (){
  4560. var self=this;
  4561. return smalltalk.withContext(function($ctx1) {
  4562. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4563. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)})},
  4564. args: [],
  4565. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4566. messageSends: ["assert:equals:", "asUppercase"],
  4567. referencedClasses: []
  4568. }),
  4569. globals.StringTest);
  4570. smalltalk.addMethod(
  4571. smalltalk.method({
  4572. selector: "testAsciiValue",
  4573. protocol: 'tests',
  4574. fn: function (){
  4575. var self=this;
  4576. var characterA,characterU;
  4577. return smalltalk.withContext(function($ctx1) {
  4578. var $1;
  4579. characterA="A";
  4580. characterU="U";
  4581. $1=_st(characterA)._asciiValue();
  4582. $ctx1.sendIdx["asciiValue"]=1;
  4583. self._assert_equals_($1,(65));
  4584. $ctx1.sendIdx["assert:equals:"]=1;
  4585. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4586. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)})},
  4587. args: [],
  4588. 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",
  4589. messageSends: ["assert:equals:", "asciiValue"],
  4590. referencedClasses: []
  4591. }),
  4592. globals.StringTest);
  4593. smalltalk.addMethod(
  4594. smalltalk.method({
  4595. selector: "testAtIfAbsentPut",
  4596. protocol: 'tests',
  4597. fn: function (){
  4598. var self=this;
  4599. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4600. return smalltalk.withContext(function($ctx1) {
  4601. self._should_raise_((function(){
  4602. return smalltalk.withContext(function($ctx2) {
  4603. return "hello"._at_ifAbsentPut_((6),(function(){
  4604. return "a";
  4605. }));
  4606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4607. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)})},
  4608. args: [],
  4609. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4610. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4611. referencedClasses: ["Error"]
  4612. }),
  4613. globals.StringTest);
  4614. smalltalk.addMethod(
  4615. smalltalk.method({
  4616. selector: "testAtPut",
  4617. protocol: 'tests',
  4618. fn: function (){
  4619. var self=this;
  4620. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4621. return smalltalk.withContext(function($ctx1) {
  4622. self._should_raise_((function(){
  4623. return smalltalk.withContext(function($ctx2) {
  4624. return "hello"._at_put_((1),"a");
  4625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4626. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)})},
  4627. args: [],
  4628. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4629. messageSends: ["should:raise:", "at:put:"],
  4630. referencedClasses: ["Error"]
  4631. }),
  4632. globals.StringTest);
  4633. smalltalk.addMethod(
  4634. smalltalk.method({
  4635. selector: "testCapitalized",
  4636. protocol: 'tests',
  4637. fn: function (){
  4638. var self=this;
  4639. return smalltalk.withContext(function($ctx1) {
  4640. var $1,$2,$3;
  4641. $1="test"._capitalized();
  4642. $ctx1.sendIdx["capitalized"]=1;
  4643. self._assert_equals_($1,"Test");
  4644. $ctx1.sendIdx["assert:equals:"]=1;
  4645. $2="Test"._capitalized();
  4646. $ctx1.sendIdx["capitalized"]=2;
  4647. self._assert_equals_($2,"Test");
  4648. $ctx1.sendIdx["assert:equals:"]=2;
  4649. self._assert_equals_(""._capitalized(),"");
  4650. $ctx1.sendIdx["assert:equals:"]=3;
  4651. $3="Test"._isCapitalized();
  4652. $ctx1.sendIdx["isCapitalized"]=1;
  4653. self._assert_equals_($3,true);
  4654. $ctx1.sendIdx["assert:equals:"]=4;
  4655. self._assert_equals_("test"._isCapitalized(),false);
  4656. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)})},
  4657. args: [],
  4658. 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.",
  4659. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4660. referencedClasses: []
  4661. }),
  4662. globals.StringTest);
  4663. smalltalk.addMethod(
  4664. smalltalk.method({
  4665. selector: "testCharCodeAt",
  4666. protocol: 'tests',
  4667. fn: function (){
  4668. var self=this;
  4669. return smalltalk.withContext(function($ctx1) {
  4670. var $1,$2,$3,$4,$5;
  4671. $1="jackie"._charCodeAt_((1));
  4672. $ctx1.sendIdx["charCodeAt:"]=1;
  4673. self._assert_equals_($1,(106));
  4674. $ctx1.sendIdx["assert:equals:"]=1;
  4675. $2="jackie"._charCodeAt_((2));
  4676. $ctx1.sendIdx["charCodeAt:"]=2;
  4677. self._assert_equals_($2,(97));
  4678. $ctx1.sendIdx["assert:equals:"]=2;
  4679. $3="jackie"._charCodeAt_((3));
  4680. $ctx1.sendIdx["charCodeAt:"]=3;
  4681. self._assert_equals_($3,(99));
  4682. $ctx1.sendIdx["assert:equals:"]=3;
  4683. $4="jackie"._charCodeAt_((4));
  4684. $ctx1.sendIdx["charCodeAt:"]=4;
  4685. self._assert_equals_($4,(107));
  4686. $ctx1.sendIdx["assert:equals:"]=4;
  4687. $5="jackie"._charCodeAt_((5));
  4688. $ctx1.sendIdx["charCodeAt:"]=5;
  4689. self._assert_equals_($5,(105));
  4690. $ctx1.sendIdx["assert:equals:"]=5;
  4691. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4692. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)})},
  4693. args: [],
  4694. 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",
  4695. messageSends: ["assert:equals:", "charCodeAt:"],
  4696. referencedClasses: []
  4697. }),
  4698. globals.StringTest);
  4699. smalltalk.addMethod(
  4700. smalltalk.method({
  4701. selector: "testCopyFromTo",
  4702. protocol: 'tests',
  4703. fn: function (){
  4704. var self=this;
  4705. return smalltalk.withContext(function($ctx1) {
  4706. var $1;
  4707. $1="jackie"._copyFrom_to_((1),(3));
  4708. $ctx1.sendIdx["copyFrom:to:"]=1;
  4709. self._assert_equals_($1,"jac");
  4710. $ctx1.sendIdx["assert:equals:"]=1;
  4711. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4712. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)})},
  4713. args: [],
  4714. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4715. messageSends: ["assert:equals:", "copyFrom:to:"],
  4716. referencedClasses: []
  4717. }),
  4718. globals.StringTest);
  4719. smalltalk.addMethod(
  4720. smalltalk.method({
  4721. selector: "testCopyWithoutAll",
  4722. protocol: 'tests',
  4723. fn: function (){
  4724. var self=this;
  4725. return smalltalk.withContext(function($ctx1) {
  4726. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4727. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)})},
  4728. args: [],
  4729. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4730. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4731. referencedClasses: []
  4732. }),
  4733. globals.StringTest);
  4734. smalltalk.addMethod(
  4735. smalltalk.method({
  4736. selector: "testEquality",
  4737. protocol: 'tests',
  4738. fn: function (){
  4739. var self=this;
  4740. return smalltalk.withContext(function($ctx1) {
  4741. var $1,$2,$3;
  4742. self._assert_equals_("hello","hello");
  4743. $ctx1.sendIdx["assert:equals:"]=1;
  4744. $1="hello".__eq("world");
  4745. $ctx1.sendIdx["="]=1;
  4746. self._deny_($1);
  4747. $ctx1.sendIdx["deny:"]=1;
  4748. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4749. })));
  4750. $ctx1.sendIdx["="]=2;
  4751. self._deny_($2);
  4752. $ctx1.sendIdx["deny:"]=2;
  4753. $3="hello"._yourself();
  4754. $ctx1.sendIdx["yourself"]=1;
  4755. self._assert_equals_("hello",$3);
  4756. $ctx1.sendIdx["assert:equals:"]=2;
  4757. self._assert_equals_("hello"._yourself(),"hello");
  4758. self._deny_("".__eq((0)));
  4759. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)})},
  4760. args: [],
  4761. 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",
  4762. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4763. referencedClasses: []
  4764. }),
  4765. globals.StringTest);
  4766. smalltalk.addMethod(
  4767. smalltalk.method({
  4768. selector: "testIdentity",
  4769. protocol: 'tests',
  4770. fn: function (){
  4771. var self=this;
  4772. return smalltalk.withContext(function($ctx1) {
  4773. var $1,$2,$4,$3,$5;
  4774. $1="hello".__eq_eq("hello");
  4775. $ctx1.sendIdx["=="]=1;
  4776. self._assert_($1);
  4777. $ctx1.sendIdx["assert:"]=1;
  4778. $2="hello".__eq_eq("world");
  4779. $ctx1.sendIdx["=="]=2;
  4780. self._deny_($2);
  4781. $ctx1.sendIdx["deny:"]=1;
  4782. $4="hello"._yourself();
  4783. $ctx1.sendIdx["yourself"]=1;
  4784. $3="hello".__eq_eq($4);
  4785. $ctx1.sendIdx["=="]=3;
  4786. self._assert_($3);
  4787. $ctx1.sendIdx["assert:"]=2;
  4788. $5=_st("hello"._yourself()).__eq_eq("hello");
  4789. $ctx1.sendIdx["=="]=4;
  4790. self._assert_($5);
  4791. self._deny_("".__eq_eq((0)));
  4792. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)})},
  4793. args: [],
  4794. 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",
  4795. messageSends: ["assert:", "==", "deny:", "yourself"],
  4796. referencedClasses: []
  4797. }),
  4798. globals.StringTest);
  4799. smalltalk.addMethod(
  4800. smalltalk.method({
  4801. selector: "testIdentityHash",
  4802. protocol: 'tests',
  4803. fn: function (){
  4804. var self=this;
  4805. return smalltalk.withContext(function($ctx1) {
  4806. var $1,$2,$4,$3;
  4807. $1="foo"._identityHash();
  4808. $ctx1.sendIdx["identityHash"]=1;
  4809. $2="foo"._identityHash();
  4810. $ctx1.sendIdx["identityHash"]=2;
  4811. self._assert_equals_($1,$2);
  4812. $4="foo"._identityHash();
  4813. $ctx1.sendIdx["identityHash"]=3;
  4814. $3=_st($4).__eq("bar"._identityHash());
  4815. self._deny_($3);
  4816. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)})},
  4817. args: [],
  4818. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4819. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4820. referencedClasses: []
  4821. }),
  4822. globals.StringTest);
  4823. smalltalk.addMethod(
  4824. smalltalk.method({
  4825. selector: "testIncludesSubString",
  4826. protocol: 'tests',
  4827. fn: function (){
  4828. var self=this;
  4829. return smalltalk.withContext(function($ctx1) {
  4830. var $1;
  4831. $1="amber"._includesSubString_("ber");
  4832. $ctx1.sendIdx["includesSubString:"]=1;
  4833. self._assert_($1);
  4834. self._deny_("amber"._includesSubString_("zork"));
  4835. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)})},
  4836. args: [],
  4837. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4838. messageSends: ["assert:", "includesSubString:", "deny:"],
  4839. referencedClasses: []
  4840. }),
  4841. globals.StringTest);
  4842. smalltalk.addMethod(
  4843. smalltalk.method({
  4844. selector: "testIndexOfStartingAtWithNull",
  4845. protocol: 'tests',
  4846. fn: function (){
  4847. var self=this;
  4848. return self},
  4849. args: [],
  4850. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4851. messageSends: [],
  4852. referencedClasses: []
  4853. }),
  4854. globals.StringTest);
  4855. smalltalk.addMethod(
  4856. smalltalk.method({
  4857. selector: "testIndexOfWithNull",
  4858. protocol: 'tests',
  4859. fn: function (){
  4860. var self=this;
  4861. return self},
  4862. args: [],
  4863. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4864. messageSends: [],
  4865. referencedClasses: []
  4866. }),
  4867. globals.StringTest);
  4868. smalltalk.addMethod(
  4869. smalltalk.method({
  4870. selector: "testIsVowel",
  4871. protocol: 'tests',
  4872. fn: function (){
  4873. var self=this;
  4874. var vowel,consonant;
  4875. return smalltalk.withContext(function($ctx1) {
  4876. var $1;
  4877. vowel="u";
  4878. consonant="z";
  4879. $1=_st(vowel)._isVowel();
  4880. $ctx1.sendIdx["isVowel"]=1;
  4881. self._assert_equals_($1,true);
  4882. $ctx1.sendIdx["assert:equals:"]=1;
  4883. self._assert_equals_(_st(consonant)._isVowel(),false);
  4884. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)})},
  4885. args: [],
  4886. 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",
  4887. messageSends: ["assert:equals:", "isVowel"],
  4888. referencedClasses: []
  4889. }),
  4890. globals.StringTest);
  4891. smalltalk.addMethod(
  4892. smalltalk.method({
  4893. selector: "testJoin",
  4894. protocol: 'tests',
  4895. fn: function (){
  4896. var self=this;
  4897. return smalltalk.withContext(function($ctx1) {
  4898. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4899. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)})},
  4900. args: [],
  4901. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4902. messageSends: ["assert:equals:", "join:"],
  4903. referencedClasses: []
  4904. }),
  4905. globals.StringTest);
  4906. smalltalk.addMethod(
  4907. smalltalk.method({
  4908. selector: "testRemoveAll",
  4909. protocol: 'tests',
  4910. fn: function (){
  4911. var self=this;
  4912. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4913. return smalltalk.withContext(function($ctx1) {
  4914. self._should_raise_((function(){
  4915. return smalltalk.withContext(function($ctx2) {
  4916. return _st(self._collection())._removeAll();
  4917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4918. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)})},
  4919. args: [],
  4920. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4921. messageSends: ["should:raise:", "removeAll", "collection"],
  4922. referencedClasses: ["Error"]
  4923. }),
  4924. globals.StringTest);
  4925. smalltalk.addMethod(
  4926. smalltalk.method({
  4927. selector: "testReversed",
  4928. protocol: 'tests',
  4929. fn: function (){
  4930. var self=this;
  4931. return smalltalk.withContext(function($ctx1) {
  4932. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4933. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)})},
  4934. args: [],
  4935. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4936. messageSends: ["assert:equals:", "reversed"],
  4937. referencedClasses: []
  4938. }),
  4939. globals.StringTest);
  4940. smalltalk.addMethod(
  4941. smalltalk.method({
  4942. selector: "testStreamContents",
  4943. protocol: 'tests',
  4944. fn: function (){
  4945. var self=this;
  4946. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  4947. return smalltalk.withContext(function($ctx1) {
  4948. var $1;
  4949. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4950. return smalltalk.withContext(function($ctx2) {
  4951. _st(aStream)._nextPutAll_("hello");
  4952. $ctx2.sendIdx["nextPutAll:"]=1;
  4953. _st(aStream)._space();
  4954. $1=_st(aStream)._nextPutAll_("world");
  4955. return $1;
  4956. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4957. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)})},
  4958. args: [],
  4959. 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'",
  4960. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4961. referencedClasses: ["String"]
  4962. }),
  4963. globals.StringTest);
  4964. smalltalk.addMethod(
  4965. smalltalk.method({
  4966. selector: "testSubStrings",
  4967. protocol: 'tests',
  4968. fn: function (){
  4969. var self=this;
  4970. return smalltalk.withContext(function($ctx1) {
  4971. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4972. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)})},
  4973. args: [],
  4974. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4975. messageSends: ["assert:equals:", "subStrings:"],
  4976. referencedClasses: []
  4977. }),
  4978. globals.StringTest);
  4979. smalltalk.addMethod(
  4980. smalltalk.method({
  4981. selector: "testTrim",
  4982. protocol: 'tests',
  4983. fn: function (){
  4984. var self=this;
  4985. return smalltalk.withContext(function($ctx1) {
  4986. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  4987. $ctx1.sendIdx["assert:equals:"]=1;
  4988. self._assert_equals_("jackie "._trimRight(),"jackie");
  4989. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)})},
  4990. args: [],
  4991. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  4992. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  4993. referencedClasses: []
  4994. }),
  4995. globals.StringTest);
  4996. smalltalk.addMethod(
  4997. smalltalk.method({
  4998. selector: "collectionClass",
  4999. protocol: 'fixture',
  5000. fn: function (){
  5001. var self=this;
  5002. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5003. return $String();
  5004. },
  5005. args: [],
  5006. source: "collectionClass\x0a\x09^ String",
  5007. messageSends: [],
  5008. referencedClasses: ["String"]
  5009. }),
  5010. globals.StringTest.klass);
  5011. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  5012. smalltalk.addMethod(
  5013. smalltalk.method({
  5014. selector: "collection",
  5015. protocol: 'fixture',
  5016. fn: function (){
  5017. var self=this;
  5018. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5019. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5020. return smalltalk.withContext(function($ctx1) {
  5021. var $2,$3,$1;
  5022. $2=_st($Set())._new();
  5023. _st($2)._add_($Smalltalk());
  5024. $ctx1.sendIdx["add:"]=1;
  5025. _st($2)._add_(nil);
  5026. $ctx1.sendIdx["add:"]=2;
  5027. _st($2)._add_((3).__at((3)));
  5028. $ctx1.sendIdx["add:"]=3;
  5029. _st($2)._add_(false);
  5030. $3=_st($2)._yourself();
  5031. $1=$3;
  5032. return $1;
  5033. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)})},
  5034. args: [],
  5035. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5036. messageSends: ["add:", "new", "@", "yourself"],
  5037. referencedClasses: ["Set", "Smalltalk"]
  5038. }),
  5039. globals.SetTest);
  5040. smalltalk.addMethod(
  5041. smalltalk.method({
  5042. selector: "collectionOfPrintStrings",
  5043. protocol: 'fixture',
  5044. fn: function (){
  5045. var self=this;
  5046. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5047. return smalltalk.withContext(function($ctx1) {
  5048. var $2,$3,$1;
  5049. $2=_st($Set())._new();
  5050. _st($2)._add_("a SmalltalkImage");
  5051. $ctx1.sendIdx["add:"]=1;
  5052. _st($2)._add_("nil");
  5053. $ctx1.sendIdx["add:"]=2;
  5054. _st($2)._add_("3@3");
  5055. $ctx1.sendIdx["add:"]=3;
  5056. _st($2)._add_("false");
  5057. $3=_st($2)._yourself();
  5058. $1=$3;
  5059. return $1;
  5060. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)})},
  5061. args: [],
  5062. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself",
  5063. messageSends: ["add:", "new", "yourself"],
  5064. referencedClasses: ["Set"]
  5065. }),
  5066. globals.SetTest);
  5067. smalltalk.addMethod(
  5068. smalltalk.method({
  5069. selector: "collectionSize",
  5070. protocol: 'fixture',
  5071. fn: function (){
  5072. var self=this;
  5073. return (4);
  5074. },
  5075. args: [],
  5076. source: "collectionSize\x0a\x09^ 4",
  5077. messageSends: [],
  5078. referencedClasses: []
  5079. }),
  5080. globals.SetTest);
  5081. smalltalk.addMethod(
  5082. smalltalk.method({
  5083. selector: "collectionWithDuplicates",
  5084. protocol: 'fixture',
  5085. fn: function (){
  5086. var self=this;
  5087. return smalltalk.withContext(function($ctx1) {
  5088. var $2,$3,$1;
  5089. $2=self._collection();
  5090. _st($2)._add_((0));
  5091. $3=_st($2)._yourself();
  5092. $1=$3;
  5093. return $1;
  5094. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)})},
  5095. args: [],
  5096. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5097. messageSends: ["add:", "collection", "yourself"],
  5098. referencedClasses: []
  5099. }),
  5100. globals.SetTest);
  5101. smalltalk.addMethod(
  5102. smalltalk.method({
  5103. selector: "collectionWithNewValue",
  5104. protocol: 'fixture',
  5105. fn: function (){
  5106. var self=this;
  5107. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5108. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5109. return smalltalk.withContext(function($ctx1) {
  5110. var $2,$3,$1;
  5111. $2=_st($Set())._new();
  5112. _st($2)._add_($Smalltalk());
  5113. $ctx1.sendIdx["add:"]=1;
  5114. _st($2)._add_(nil);
  5115. $ctx1.sendIdx["add:"]=2;
  5116. _st($2)._add_((3).__at((3)));
  5117. $ctx1.sendIdx["add:"]=3;
  5118. _st($2)._add_("N");
  5119. $ctx1.sendIdx["add:"]=4;
  5120. _st($2)._add_(false);
  5121. $3=_st($2)._yourself();
  5122. $1=$3;
  5123. return $1;
  5124. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)})},
  5125. args: [],
  5126. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5127. messageSends: ["add:", "new", "@", "yourself"],
  5128. referencedClasses: ["Set", "Smalltalk"]
  5129. }),
  5130. globals.SetTest);
  5131. smalltalk.addMethod(
  5132. smalltalk.method({
  5133. selector: "testAddAll",
  5134. protocol: 'tests',
  5135. fn: function (){
  5136. var self=this;
  5137. return smalltalk.withContext(function($ctx1) {
  5138. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5139. globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  5140. $2=self._collection();
  5141. $ctx1.sendIdx["collection"]=1;
  5142. $3=$2;
  5143. $4=self._collection();
  5144. $ctx1.sendIdx["collection"]=2;
  5145. _st($3)._addAll_($4);
  5146. $ctx1.sendIdx["addAll:"]=1;
  5147. $5=_st($2)._yourself();
  5148. $ctx1.sendIdx["yourself"]=1;
  5149. $1=$5;
  5150. $6=self._collection();
  5151. $ctx1.sendIdx["collection"]=3;
  5152. self._assert_equals_($1,$6);
  5153. $ctx1.sendIdx["assert:equals:"]=1;
  5154. $8=self._collection();
  5155. $ctx1.sendIdx["collection"]=4;
  5156. $9=$8;
  5157. $10=self._collectionWithNewValue();
  5158. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5159. _st($9)._addAll_($10);
  5160. $ctx1.sendIdx["addAll:"]=2;
  5161. $11=_st($8)._yourself();
  5162. $ctx1.sendIdx["yourself"]=2;
  5163. $7=$11;
  5164. $12=self._collectionWithNewValue();
  5165. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5166. self._assert_equals_($7,$12);
  5167. $ctx1.sendIdx["assert:equals:"]=2;
  5168. $14=self._collectionWithNewValue();
  5169. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5170. _st($14)._addAll_(self._collection());
  5171. $15=_st($14)._yourself();
  5172. $13=$15;
  5173. self._assert_equals_($13,self._collectionWithNewValue());
  5174. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)})},
  5175. args: [],
  5176. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  5177. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5178. referencedClasses: []
  5179. }),
  5180. globals.SetTest);
  5181. smalltalk.addMethod(
  5182. smalltalk.method({
  5183. selector: "testAddRemove",
  5184. protocol: 'tests',
  5185. fn: function (){
  5186. var self=this;
  5187. var set;
  5188. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5189. return smalltalk.withContext(function($ctx1) {
  5190. var $1,$2;
  5191. set=_st($Set())._new();
  5192. self._assert_(_st(set)._isEmpty());
  5193. $ctx1.sendIdx["assert:"]=1;
  5194. _st(set)._add_((3));
  5195. $ctx1.sendIdx["add:"]=1;
  5196. $1=_st(set)._includes_((3));
  5197. $ctx1.sendIdx["includes:"]=1;
  5198. self._assert_($1);
  5199. $ctx1.sendIdx["assert:"]=2;
  5200. _st(set)._add_((5));
  5201. $2=_st(set)._includes_((5));
  5202. $ctx1.sendIdx["includes:"]=2;
  5203. self._assert_($2);
  5204. _st(set)._remove_((3));
  5205. self._deny_(_st(set)._includes_((3)));
  5206. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)})},
  5207. args: [],
  5208. 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)",
  5209. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5210. referencedClasses: ["Set"]
  5211. }),
  5212. globals.SetTest);
  5213. smalltalk.addMethod(
  5214. smalltalk.method({
  5215. selector: "testAt",
  5216. protocol: 'tests',
  5217. fn: function (){
  5218. var self=this;
  5219. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5220. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5221. return smalltalk.withContext(function($ctx1) {
  5222. self._should_raise_((function(){
  5223. return smalltalk.withContext(function($ctx2) {
  5224. return _st(_st($Set())._new())._at_put_((1),(2));
  5225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5226. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)})},
  5227. args: [],
  5228. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5229. messageSends: ["should:raise:", "at:put:", "new"],
  5230. referencedClasses: ["Set", "Error"]
  5231. }),
  5232. globals.SetTest);
  5233. smalltalk.addMethod(
  5234. smalltalk.method({
  5235. selector: "testCollect",
  5236. protocol: 'tests',
  5237. fn: function (){
  5238. var self=this;
  5239. return smalltalk.withContext(function($ctx1) {
  5240. var $2,$1;
  5241. globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  5242. $2=[(5), (6), (8)]._asSet();
  5243. $ctx1.sendIdx["asSet"]=1;
  5244. $1=_st($2)._collect_((function(x){
  5245. return smalltalk.withContext(function($ctx2) {
  5246. return _st(x).__backslash_backslash((3));
  5247. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5248. self._assert_equals_($1,[(0), (2)]._asSet());
  5249. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)})},
  5250. args: [],
  5251. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5252. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5253. referencedClasses: []
  5254. }),
  5255. globals.SetTest);
  5256. smalltalk.addMethod(
  5257. smalltalk.method({
  5258. selector: "testComma",
  5259. protocol: 'tests',
  5260. fn: function (){
  5261. var self=this;
  5262. return smalltalk.withContext(function($ctx1) {
  5263. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5264. globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  5265. $2=self._collection();
  5266. $ctx1.sendIdx["collection"]=1;
  5267. $3=self._collection();
  5268. $ctx1.sendIdx["collection"]=2;
  5269. $1=_st($2).__comma($3);
  5270. $ctx1.sendIdx[","]=1;
  5271. $4=self._collection();
  5272. $ctx1.sendIdx["collection"]=3;
  5273. self._assert_equals_($1,$4);
  5274. $ctx1.sendIdx["assert:equals:"]=1;
  5275. $6=self._collection();
  5276. $ctx1.sendIdx["collection"]=4;
  5277. $7=self._collectionWithNewValue();
  5278. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5279. $5=_st($6).__comma($7);
  5280. $ctx1.sendIdx[","]=2;
  5281. $8=self._collectionWithNewValue();
  5282. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5283. self._assert_equals_($5,$8);
  5284. $ctx1.sendIdx["assert:equals:"]=2;
  5285. $10=self._collectionWithNewValue();
  5286. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5287. $9=_st($10).__comma(self._collection());
  5288. self._assert_equals_($9,self._collectionWithNewValue());
  5289. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)})},
  5290. args: [],
  5291. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  5292. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5293. referencedClasses: []
  5294. }),
  5295. globals.SetTest);
  5296. smalltalk.addMethod(
  5297. smalltalk.method({
  5298. selector: "testComparing",
  5299. protocol: 'tests',
  5300. fn: function (){
  5301. var self=this;
  5302. return smalltalk.withContext(function($ctx1) {
  5303. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5304. $1=[(0), (2)]._asSet();
  5305. $ctx1.sendIdx["asSet"]=1;
  5306. $2=[(0), (2)]._asSet();
  5307. $ctx1.sendIdx["asSet"]=2;
  5308. self._assert_equals_($1,$2);
  5309. $ctx1.sendIdx["assert:equals:"]=1;
  5310. $3=[(2), (0)]._asSet();
  5311. $ctx1.sendIdx["asSet"]=3;
  5312. $4=[(0), (2)]._asSet();
  5313. $ctx1.sendIdx["asSet"]=4;
  5314. self._assert_equals_($3,$4);
  5315. $6=[(0), (2), (3)]._asSet();
  5316. $ctx1.sendIdx["asSet"]=5;
  5317. $7=[(0), (2)]._asSet();
  5318. $ctx1.sendIdx["asSet"]=6;
  5319. $5=_st($6).__eq($7);
  5320. $ctx1.sendIdx["="]=1;
  5321. self._deny_($5);
  5322. $ctx1.sendIdx["deny:"]=1;
  5323. $9=[(1), (2)]._asSet();
  5324. $ctx1.sendIdx["asSet"]=7;
  5325. $8=_st($9).__eq([(0), (2)]._asSet());
  5326. self._deny_($8);
  5327. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)})},
  5328. args: [],
  5329. 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",
  5330. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5331. referencedClasses: []
  5332. }),
  5333. globals.SetTest);
  5334. smalltalk.addMethod(
  5335. smalltalk.method({
  5336. selector: "testPrintString",
  5337. protocol: 'tests',
  5338. fn: function (){
  5339. var self=this;
  5340. var set;
  5341. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5342. return smalltalk.withContext(function($ctx1) {
  5343. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5344. set=_st($Set())._new();
  5345. $1=_st(set)._printString();
  5346. $ctx1.sendIdx["printString"]=1;
  5347. self._assert_equals_($1,"a Set ()");
  5348. $ctx1.sendIdx["assert:equals:"]=1;
  5349. $2=set;
  5350. _st($2)._add_((1));
  5351. $ctx1.sendIdx["add:"]=1;
  5352. $3=_st($2)._add_((3));
  5353. $ctx1.sendIdx["add:"]=2;
  5354. $4=_st(set)._printString();
  5355. $ctx1.sendIdx["printString"]=2;
  5356. self._assert_equals_($4,"a Set (1 3)");
  5357. $ctx1.sendIdx["assert:equals:"]=2;
  5358. _st(set)._add_("foo");
  5359. $ctx1.sendIdx["add:"]=3;
  5360. $5=_st(set)._printString();
  5361. $ctx1.sendIdx["printString"]=3;
  5362. self._assert_equals_($5,"a Set (1 3 'foo')");
  5363. $ctx1.sendIdx["assert:equals:"]=3;
  5364. $6=set;
  5365. _st($6)._remove_((1));
  5366. $ctx1.sendIdx["remove:"]=1;
  5367. $7=_st($6)._remove_((3));
  5368. $8=_st(set)._printString();
  5369. $ctx1.sendIdx["printString"]=4;
  5370. self._assert_equals_($8,"a Set ('foo')");
  5371. $ctx1.sendIdx["assert:equals:"]=4;
  5372. _st(set)._add_((3));
  5373. $ctx1.sendIdx["add:"]=4;
  5374. $9=_st(set)._printString();
  5375. $ctx1.sendIdx["printString"]=5;
  5376. self._assert_equals_($9,"a Set (3 'foo')");
  5377. $ctx1.sendIdx["assert:equals:"]=5;
  5378. _st(set)._add_((3));
  5379. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5380. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)})},
  5381. args: [],
  5382. 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 (3 ''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'",
  5383. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5384. referencedClasses: ["Set"]
  5385. }),
  5386. globals.SetTest);
  5387. smalltalk.addMethod(
  5388. smalltalk.method({
  5389. selector: "testUnboxedObjects",
  5390. protocol: 'tests',
  5391. fn: function (){
  5392. var self=this;
  5393. return smalltalk.withContext(function($ctx1) {
  5394. var $4,$3,$2,$1;
  5395. $4="foo"._yourself();
  5396. $ctx1.sendIdx["yourself"]=1;
  5397. $3=[$4,"foo"._yourself()];
  5398. $2=_st($3)._asSet();
  5399. $1=_st($2)._asArray();
  5400. self._assert_equals_($1,["foo"]);
  5401. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)})},
  5402. args: [],
  5403. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5404. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5405. referencedClasses: []
  5406. }),
  5407. globals.SetTest);
  5408. smalltalk.addMethod(
  5409. smalltalk.method({
  5410. selector: "testUnicity",
  5411. protocol: 'tests',
  5412. fn: function (){
  5413. var self=this;
  5414. var set;
  5415. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5416. return smalltalk.withContext(function($ctx1) {
  5417. var $1;
  5418. set=_st($Set())._new();
  5419. _st(set)._add_((21));
  5420. $ctx1.sendIdx["add:"]=1;
  5421. _st(set)._add_("hello");
  5422. $ctx1.sendIdx["add:"]=2;
  5423. _st(set)._add_((21));
  5424. $ctx1.sendIdx["add:"]=3;
  5425. $1=_st(set)._size();
  5426. $ctx1.sendIdx["size"]=1;
  5427. self._assert_equals_($1,(2));
  5428. $ctx1.sendIdx["assert:equals:"]=1;
  5429. _st(set)._add_("hello");
  5430. self._assert_equals_(_st(set)._size(),(2));
  5431. $ctx1.sendIdx["assert:equals:"]=2;
  5432. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5433. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)})},
  5434. args: [],
  5435. 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')",
  5436. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5437. referencedClasses: ["Set"]
  5438. }),
  5439. globals.SetTest);
  5440. smalltalk.addMethod(
  5441. smalltalk.method({
  5442. selector: "collectionClass",
  5443. protocol: 'fixture',
  5444. fn: function (){
  5445. var self=this;
  5446. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5447. return $Set();
  5448. },
  5449. args: [],
  5450. source: "collectionClass\x0a\x09^ Set",
  5451. messageSends: [],
  5452. referencedClasses: ["Set"]
  5453. }),
  5454. globals.SetTest.klass);
  5455. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  5456. smalltalk.addMethod(
  5457. smalltalk.method({
  5458. selector: "testShow",
  5459. protocol: 'tests',
  5460. fn: function (){
  5461. var self=this;
  5462. var originalTranscript;
  5463. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5464. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5465. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5466. return smalltalk.withContext(function($ctx1) {
  5467. originalTranscript=_st($Transcript())._current();
  5468. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5469. $ctx1.sendIdx["register:"]=1;
  5470. self._shouldnt_raise_((function(){
  5471. return smalltalk.withContext(function($ctx2) {
  5472. return _st($Transcript())._show_("Hello console!");
  5473. $ctx2.sendIdx["show:"]=1;
  5474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5475. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5476. self._shouldnt_raise_((function(){
  5477. return smalltalk.withContext(function($ctx2) {
  5478. return _st($Transcript())._show_(console);
  5479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5480. _st($Transcript())._register_(originalTranscript);
  5481. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)})},
  5482. args: [],
  5483. 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.",
  5484. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5485. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5486. }),
  5487. globals.ConsoleTranscriptTest);
  5488. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  5489. smalltalk.addMethod(
  5490. smalltalk.method({
  5491. selector: "jsObject",
  5492. protocol: 'accessing',
  5493. fn: function (){
  5494. var self=this;
  5495. return smalltalk.withContext(function($ctx1) {
  5496. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5497. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},globals.JSObjectProxyTest)})},
  5498. args: [],
  5499. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5500. messageSends: [],
  5501. referencedClasses: []
  5502. }),
  5503. globals.JSObjectProxyTest);
  5504. smalltalk.addMethod(
  5505. smalltalk.method({
  5506. selector: "testAtIfAbsent",
  5507. protocol: 'tests',
  5508. fn: function (){
  5509. var self=this;
  5510. var testObject;
  5511. return smalltalk.withContext(function($ctx1) {
  5512. var $1,$2,$3;
  5513. testObject=self._jsObject();
  5514. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5515. return "Property does not exist";
  5516. }));
  5517. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5518. self._assert_equals_($1,"Property does not exist");
  5519. $ctx1.sendIdx["assert:equals:"]=1;
  5520. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5521. return "Property does not exist";
  5522. }));
  5523. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5524. self._assert_equals_($2,nil);
  5525. $ctx1.sendIdx["assert:equals:"]=2;
  5526. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5527. return "Property does not exist";
  5528. }));
  5529. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5530. self._assert_equals_($3,(1));
  5531. $ctx1.sendIdx["assert:equals:"]=3;
  5532. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5533. return "Property does not exist";
  5534. })),nil);
  5535. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5536. args: [],
  5537. 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.",
  5538. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5539. referencedClasses: []
  5540. }),
  5541. globals.JSObjectProxyTest);
  5542. smalltalk.addMethod(
  5543. smalltalk.method({
  5544. selector: "testAtIfPresent",
  5545. protocol: 'tests',
  5546. fn: function (){
  5547. var self=this;
  5548. var testObject;
  5549. return smalltalk.withContext(function($ctx1) {
  5550. var $2,$1,$4,$3,$6,$5;
  5551. testObject=self._jsObject();
  5552. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5553. return smalltalk.withContext(function($ctx2) {
  5554. $2=_st(x)._asString();
  5555. $ctx2.sendIdx["asString"]=1;
  5556. return "hello ".__comma($2);
  5557. $ctx2.sendIdx[","]=1;
  5558. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5559. $ctx1.sendIdx["at:ifPresent:"]=1;
  5560. self._assert_equals_($1,nil);
  5561. $ctx1.sendIdx["assert:equals:"]=1;
  5562. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5563. return smalltalk.withContext(function($ctx2) {
  5564. $4=_st(x)._asString();
  5565. $ctx2.sendIdx["asString"]=2;
  5566. return "hello ".__comma($4);
  5567. $ctx2.sendIdx[","]=2;
  5568. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5569. $ctx1.sendIdx["at:ifPresent:"]=2;
  5570. self._assert_equals_($3,"hello nil");
  5571. $ctx1.sendIdx["assert:equals:"]=2;
  5572. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5573. return smalltalk.withContext(function($ctx2) {
  5574. $6=_st(x)._asString();
  5575. $ctx2.sendIdx["asString"]=3;
  5576. return "hello ".__comma($6);
  5577. $ctx2.sendIdx[","]=3;
  5578. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5579. $ctx1.sendIdx["at:ifPresent:"]=3;
  5580. self._assert_equals_($5,"hello 1");
  5581. $ctx1.sendIdx["assert:equals:"]=3;
  5582. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5583. return smalltalk.withContext(function($ctx2) {
  5584. return "hello ".__comma(_st(x)._asString());
  5585. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5586. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5587. args: [],
  5588. 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'.",
  5589. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5590. referencedClasses: []
  5591. }),
  5592. globals.JSObjectProxyTest);
  5593. smalltalk.addMethod(
  5594. smalltalk.method({
  5595. selector: "testAtIfPresentIfAbsent",
  5596. protocol: 'tests',
  5597. fn: function (){
  5598. var self=this;
  5599. var testObject;
  5600. return smalltalk.withContext(function($ctx1) {
  5601. var $2,$1,$4,$3,$6,$5;
  5602. testObject=self._jsObject();
  5603. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5604. return smalltalk.withContext(function($ctx2) {
  5605. $2=_st(x)._asString();
  5606. $ctx2.sendIdx["asString"]=1;
  5607. return "hello ".__comma($2);
  5608. $ctx2.sendIdx[","]=1;
  5609. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5610. return "not present";
  5611. }));
  5612. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5613. self._assert_equals_($1,"not present");
  5614. $ctx1.sendIdx["assert:equals:"]=1;
  5615. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5616. return smalltalk.withContext(function($ctx2) {
  5617. $4=_st(x)._asString();
  5618. $ctx2.sendIdx["asString"]=2;
  5619. return "hello ".__comma($4);
  5620. $ctx2.sendIdx[","]=2;
  5621. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5622. return "not present";
  5623. }));
  5624. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5625. self._assert_equals_($3,"hello nil");
  5626. $ctx1.sendIdx["assert:equals:"]=2;
  5627. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5628. return smalltalk.withContext(function($ctx2) {
  5629. $6=_st(x)._asString();
  5630. $ctx2.sendIdx["asString"]=3;
  5631. return "hello ".__comma($6);
  5632. $ctx2.sendIdx[","]=3;
  5633. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5634. return "not present";
  5635. }));
  5636. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5637. self._assert_equals_($5,"hello 1");
  5638. $ctx1.sendIdx["assert:equals:"]=3;
  5639. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5640. return smalltalk.withContext(function($ctx2) {
  5641. return "hello ".__comma(_st(x)._asString());
  5642. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5643. return "not present";
  5644. })),"hello nil");
  5645. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5646. args: [],
  5647. 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'.",
  5648. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5649. referencedClasses: []
  5650. }),
  5651. globals.JSObjectProxyTest);
  5652. smalltalk.addMethod(
  5653. smalltalk.method({
  5654. selector: "testAtPut",
  5655. protocol: 'tests',
  5656. fn: function (){
  5657. var self=this;
  5658. var testObject;
  5659. return smalltalk.withContext(function($ctx1) {
  5660. var $2,$1;
  5661. testObject=self._jsObject();
  5662. $2=_st(testObject)._at_("abc");
  5663. $ctx1.sendIdx["at:"]=1;
  5664. $1=_st($2).__tild_eq("xyz");
  5665. self._assert_($1);
  5666. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5667. $ctx1.sendIdx["assert:equals:"]=1;
  5668. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5669. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)})},
  5670. args: [],
  5671. 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'",
  5672. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5673. referencedClasses: []
  5674. }),
  5675. globals.JSObjectProxyTest);
  5676. smalltalk.addMethod(
  5677. smalltalk.method({
  5678. selector: "testComparison",
  5679. protocol: 'tests',
  5680. fn: function (){
  5681. var self=this;
  5682. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5683. return smalltalk.withContext(function($ctx1) {
  5684. var $1,$2;
  5685. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  5686. $1=_st(console).__eq(console);
  5687. $ctx1.sendIdx["="]=1;
  5688. self._assert_($1);
  5689. $2=_st(console).__eq(_st($Object())._new());
  5690. $ctx1.sendIdx["="]=2;
  5691. self._deny_($2);
  5692. $ctx1.sendIdx["deny:"]=1;
  5693. self._deny_(_st(console).__eq(self._jsObject()));
  5694. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)})},
  5695. args: [],
  5696. source: "testComparison\x0a\x09self assert: ({ console. 2 } indexOf: console) equals: 1.\x0a\x09self assert: console = console.\x0a\x09self deny: console = Object new.\x0a\x09self deny: console = self jsObject",
  5697. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"],
  5698. referencedClasses: ["Object"]
  5699. }),
  5700. globals.JSObjectProxyTest);
  5701. smalltalk.addMethod(
  5702. smalltalk.method({
  5703. selector: "testDNU",
  5704. protocol: 'tests',
  5705. fn: function (){
  5706. var self=this;
  5707. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5708. return smalltalk.withContext(function($ctx1) {
  5709. self._should_raise_((function(){
  5710. return smalltalk.withContext(function($ctx2) {
  5711. return _st(self._jsObject())._foo();
  5712. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5713. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)})},
  5714. args: [],
  5715. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5716. messageSends: ["should:raise:", "foo", "jsObject"],
  5717. referencedClasses: ["MessageNotUnderstood"]
  5718. }),
  5719. globals.JSObjectProxyTest);
  5720. smalltalk.addMethod(
  5721. smalltalk.method({
  5722. selector: "testMessageSend",
  5723. protocol: 'tests',
  5724. fn: function (){
  5725. var self=this;
  5726. return smalltalk.withContext(function($ctx1) {
  5727. var $2,$1,$4,$3;
  5728. $2=self._jsObject();
  5729. $ctx1.sendIdx["jsObject"]=1;
  5730. $1=_st($2)._a();
  5731. self._assert_equals_($1,(1));
  5732. $ctx1.sendIdx["assert:equals:"]=1;
  5733. $4=self._jsObject();
  5734. $ctx1.sendIdx["jsObject"]=2;
  5735. $3=_st($4)._b();
  5736. self._assert_equals_($3,(2));
  5737. $ctx1.sendIdx["assert:equals:"]=2;
  5738. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5739. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)})},
  5740. args: [],
  5741. 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",
  5742. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5743. referencedClasses: []
  5744. }),
  5745. globals.JSObjectProxyTest);
  5746. smalltalk.addMethod(
  5747. smalltalk.method({
  5748. selector: "testMethodWithArguments",
  5749. protocol: 'tests',
  5750. fn: function (){
  5751. var self=this;
  5752. return smalltalk.withContext(function($ctx1) {
  5753. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5754. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)})},
  5755. args: [],
  5756. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5757. messageSends: ["assert:equals:", "c:", "jsObject"],
  5758. referencedClasses: []
  5759. }),
  5760. globals.JSObjectProxyTest);
  5761. smalltalk.addMethod(
  5762. smalltalk.method({
  5763. selector: "testPrinting",
  5764. protocol: 'tests',
  5765. fn: function (){
  5766. var self=this;
  5767. return smalltalk.withContext(function($ctx1) {
  5768. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5769. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)})},
  5770. args: [],
  5771. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5772. messageSends: ["assert:equals:", "printString", "jsObject"],
  5773. referencedClasses: []
  5774. }),
  5775. globals.JSObjectProxyTest);
  5776. smalltalk.addMethod(
  5777. smalltalk.method({
  5778. selector: "testPropertyThatReturnsEmptyString",
  5779. protocol: 'tests',
  5780. fn: function (){
  5781. var self=this;
  5782. var object;
  5783. return smalltalk.withContext(function($ctx1) {
  5784. var $1;
  5785. object=self._jsObject();
  5786. $1=_st(object)._d();
  5787. $ctx1.sendIdx["d"]=1;
  5788. self._assert_equals_($1,"");
  5789. $ctx1.sendIdx["assert:equals:"]=1;
  5790. _st(object)._d_("hello");
  5791. self._assert_equals_(_st(object)._d(),"hello");
  5792. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)})},
  5793. args: [],
  5794. 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'",
  5795. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5796. referencedClasses: []
  5797. }),
  5798. globals.JSObjectProxyTest);
  5799. smalltalk.addMethod(
  5800. smalltalk.method({
  5801. selector: "testPropertyThatReturnsUndefined",
  5802. protocol: 'tests',
  5803. fn: function (){
  5804. var self=this;
  5805. var object;
  5806. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5807. return smalltalk.withContext(function($ctx1) {
  5808. object=self._jsObject();
  5809. self._shouldnt_raise_((function(){
  5810. return smalltalk.withContext(function($ctx2) {
  5811. return _st(object)._e();
  5812. $ctx2.sendIdx["e"]=1;
  5813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5814. self._assert_(_st(_st(object)._e())._isNil());
  5815. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)})},
  5816. args: [],
  5817. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5818. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5819. referencedClasses: ["MessageNotUnderstood"]
  5820. }),
  5821. globals.JSObjectProxyTest);
  5822. smalltalk.addMethod(
  5823. smalltalk.method({
  5824. selector: "testValue",
  5825. protocol: 'tests',
  5826. fn: function (){
  5827. var self=this;
  5828. var testObject;
  5829. return smalltalk.withContext(function($ctx1) {
  5830. testObject=self._jsObject();
  5831. _st(testObject)._at_put_("value","aValue");
  5832. self._assert_equals_(_st(testObject)._value(),"aValue");
  5833. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)})},
  5834. args: [],
  5835. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5836. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5837. referencedClasses: []
  5838. }),
  5839. globals.JSObjectProxyTest);
  5840. smalltalk.addMethod(
  5841. smalltalk.method({
  5842. selector: "testYourself",
  5843. protocol: 'tests',
  5844. fn: function (){
  5845. var self=this;
  5846. var object;
  5847. return smalltalk.withContext(function($ctx1) {
  5848. var $1,$2;
  5849. $1=self._jsObject();
  5850. _st($1)._d_("test");
  5851. $2=_st($1)._yourself();
  5852. object=$2;
  5853. self._assert_equals_(_st(object)._d(),"test");
  5854. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)})},
  5855. args: [],
  5856. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5857. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5858. referencedClasses: []
  5859. }),
  5860. globals.JSObjectProxyTest);
  5861. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  5862. smalltalk.addMethod(
  5863. smalltalk.method({
  5864. selector: "testCatchingException",
  5865. protocol: 'tests',
  5866. fn: function (){
  5867. var self=this;
  5868. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5869. return smalltalk.withContext(function($ctx1) {
  5870. _st((function(){
  5871. return smalltalk.withContext(function($ctx2) {
  5872. return self._throwException();
  5873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5874. return smalltalk.withContext(function($ctx2) {
  5875. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5876. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5877. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)})},
  5878. args: [],
  5879. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5880. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5881. referencedClasses: ["Error"]
  5882. }),
  5883. globals.JavaScriptExceptionTest);
  5884. smalltalk.addMethod(
  5885. smalltalk.method({
  5886. selector: "testRaisingException",
  5887. protocol: 'tests',
  5888. fn: function (){
  5889. var self=this;
  5890. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5891. return smalltalk.withContext(function($ctx1) {
  5892. self._should_raise_((function(){
  5893. return smalltalk.withContext(function($ctx2) {
  5894. return self._throwException();
  5895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5896. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)})},
  5897. args: [],
  5898. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5899. messageSends: ["should:raise:", "throwException"],
  5900. referencedClasses: ["JavaScriptException"]
  5901. }),
  5902. globals.JavaScriptExceptionTest);
  5903. smalltalk.addMethod(
  5904. smalltalk.method({
  5905. selector: "throwException",
  5906. protocol: 'helpers',
  5907. fn: function (){
  5908. var self=this;
  5909. return smalltalk.withContext(function($ctx1) {
  5910. throw 'test';
  5911. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},globals.JavaScriptExceptionTest)})},
  5912. args: [],
  5913. source: "throwException\x0a\x09<throw 'test'>",
  5914. messageSends: [],
  5915. referencedClasses: []
  5916. }),
  5917. globals.JavaScriptExceptionTest);
  5918. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  5919. smalltalk.addMethod(
  5920. smalltalk.method({
  5921. selector: "testValue",
  5922. protocol: 'tests',
  5923. fn: function (){
  5924. var self=this;
  5925. var messageSend;
  5926. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5927. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5928. return smalltalk.withContext(function($ctx1) {
  5929. var $1,$2;
  5930. $1=_st($MessageSend())._new();
  5931. $ctx1.sendIdx["new"]=1;
  5932. _st($1)._receiver_(_st($Object())._new());
  5933. _st($1)._selector_("asString");
  5934. $2=_st($1)._yourself();
  5935. messageSend=$2;
  5936. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5937. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)})},
  5938. args: [],
  5939. 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'",
  5940. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  5941. referencedClasses: ["MessageSend", "Object"]
  5942. }),
  5943. globals.MessageSendTest);
  5944. smalltalk.addMethod(
  5945. smalltalk.method({
  5946. selector: "testValueWithArguments",
  5947. protocol: 'tests',
  5948. fn: function (){
  5949. var self=this;
  5950. var messageSend;
  5951. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5952. return smalltalk.withContext(function($ctx1) {
  5953. var $1,$2;
  5954. $1=_st($MessageSend())._new();
  5955. _st($1)._receiver_((2));
  5956. _st($1)._selector_("+");
  5957. $2=_st($1)._yourself();
  5958. messageSend=$2;
  5959. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  5960. $ctx1.sendIdx["assert:equals:"]=1;
  5961. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  5962. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)})},
  5963. args: [],
  5964. 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",
  5965. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  5966. referencedClasses: ["MessageSend"]
  5967. }),
  5968. globals.MessageSendTest);
  5969. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  5970. smalltalk.addMethod(
  5971. smalltalk.method({
  5972. selector: "codeGeneratorClass",
  5973. protocol: 'accessing',
  5974. fn: function (){
  5975. var self=this;
  5976. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  5977. return $CodeGenerator();
  5978. },
  5979. args: [],
  5980. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  5981. messageSends: [],
  5982. referencedClasses: ["CodeGenerator"]
  5983. }),
  5984. globals.MethodInheritanceTest);
  5985. smalltalk.addMethod(
  5986. smalltalk.method({
  5987. selector: "compiler",
  5988. protocol: 'factory',
  5989. fn: function (){
  5990. var self=this;
  5991. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5992. return smalltalk.withContext(function($ctx1) {
  5993. var $2,$3,$1;
  5994. $2=_st($Compiler())._new();
  5995. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  5996. $3=_st($2)._yourself();
  5997. $1=$3;
  5998. return $1;
  5999. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)})},
  6000. args: [],
  6001. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  6002. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  6003. referencedClasses: ["Compiler"]
  6004. }),
  6005. globals.MethodInheritanceTest);
  6006. smalltalk.addMethod(
  6007. smalltalk.method({
  6008. selector: "deinstallBottom",
  6009. protocol: 'testing',
  6010. fn: function (){
  6011. var self=this;
  6012. return smalltalk.withContext(function($ctx1) {
  6013. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6014. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)})},
  6015. args: [],
  6016. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6017. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6018. referencedClasses: []
  6019. }),
  6020. globals.MethodInheritanceTest);
  6021. smalltalk.addMethod(
  6022. smalltalk.method({
  6023. selector: "deinstallMiddle",
  6024. protocol: 'testing',
  6025. fn: function (){
  6026. var self=this;
  6027. return smalltalk.withContext(function($ctx1) {
  6028. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6029. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)})},
  6030. args: [],
  6031. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6032. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6033. referencedClasses: []
  6034. }),
  6035. globals.MethodInheritanceTest);
  6036. smalltalk.addMethod(
  6037. smalltalk.method({
  6038. selector: "deinstallTop",
  6039. protocol: 'testing',
  6040. fn: function (){
  6041. var self=this;
  6042. return smalltalk.withContext(function($ctx1) {
  6043. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6044. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)})},
  6045. args: [],
  6046. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6047. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6048. referencedClasses: []
  6049. }),
  6050. globals.MethodInheritanceTest);
  6051. smalltalk.addMethod(
  6052. smalltalk.method({
  6053. selector: "installBottom:",
  6054. protocol: 'testing',
  6055. fn: function (aString){
  6056. var self=this;
  6057. return smalltalk.withContext(function($ctx1) {
  6058. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6059. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)})},
  6060. args: ["aString"],
  6061. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6062. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6063. referencedClasses: []
  6064. }),
  6065. globals.MethodInheritanceTest);
  6066. smalltalk.addMethod(
  6067. smalltalk.method({
  6068. selector: "installMiddle:",
  6069. protocol: 'testing',
  6070. fn: function (aString){
  6071. var self=this;
  6072. return smalltalk.withContext(function($ctx1) {
  6073. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6074. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)})},
  6075. args: ["aString"],
  6076. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6077. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6078. referencedClasses: []
  6079. }),
  6080. globals.MethodInheritanceTest);
  6081. smalltalk.addMethod(
  6082. smalltalk.method({
  6083. selector: "installTop:",
  6084. protocol: 'testing',
  6085. fn: function (aString){
  6086. var self=this;
  6087. return smalltalk.withContext(function($ctx1) {
  6088. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6089. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)})},
  6090. args: ["aString"],
  6091. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6092. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6093. referencedClasses: []
  6094. }),
  6095. globals.MethodInheritanceTest);
  6096. smalltalk.addMethod(
  6097. smalltalk.method({
  6098. selector: "setUp",
  6099. protocol: 'initialization',
  6100. fn: function (){
  6101. var self=this;
  6102. return smalltalk.withContext(function($ctx1) {
  6103. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6104. $ctx1.sendIdx["new"]=1;
  6105. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6106. $ctx1.sendIdx["new"]=2;
  6107. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6108. self["@method"]=nil;
  6109. self["@performBlock"]=(function(){
  6110. return smalltalk.withContext(function($ctx2) {
  6111. return self._error_("performBlock not initialized");
  6112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6113. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)})},
  6114. args: [],
  6115. 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' ]",
  6116. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6117. referencedClasses: []
  6118. }),
  6119. globals.MethodInheritanceTest);
  6120. smalltalk.addMethod(
  6121. smalltalk.method({
  6122. selector: "shouldMNU",
  6123. protocol: 'testing',
  6124. fn: function (){
  6125. var self=this;
  6126. return smalltalk.withContext(function($ctx1) {
  6127. self._shouldMNUTop();
  6128. self._shouldMNUMiddle();
  6129. self._shouldMNUBottom();
  6130. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)})},
  6131. args: [],
  6132. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6133. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6134. referencedClasses: []
  6135. }),
  6136. globals.MethodInheritanceTest);
  6137. smalltalk.addMethod(
  6138. smalltalk.method({
  6139. selector: "shouldMNUBottom",
  6140. protocol: 'testing',
  6141. fn: function (){
  6142. var self=this;
  6143. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6144. return smalltalk.withContext(function($ctx1) {
  6145. self._should_raise_((function(){
  6146. return smalltalk.withContext(function($ctx2) {
  6147. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6149. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)})},
  6150. args: [],
  6151. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6152. messageSends: ["should:raise:", "value:"],
  6153. referencedClasses: ["MessageNotUnderstood"]
  6154. }),
  6155. globals.MethodInheritanceTest);
  6156. smalltalk.addMethod(
  6157. smalltalk.method({
  6158. selector: "shouldMNUMiddle",
  6159. protocol: 'testing',
  6160. fn: function (){
  6161. var self=this;
  6162. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6163. return smalltalk.withContext(function($ctx1) {
  6164. self._should_raise_((function(){
  6165. return smalltalk.withContext(function($ctx2) {
  6166. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6168. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)})},
  6169. args: [],
  6170. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6171. messageSends: ["should:raise:", "value:"],
  6172. referencedClasses: ["MessageNotUnderstood"]
  6173. }),
  6174. globals.MethodInheritanceTest);
  6175. smalltalk.addMethod(
  6176. smalltalk.method({
  6177. selector: "shouldMNUTop",
  6178. protocol: 'testing',
  6179. fn: function (){
  6180. var self=this;
  6181. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6182. return smalltalk.withContext(function($ctx1) {
  6183. self._should_raise_((function(){
  6184. return smalltalk.withContext(function($ctx2) {
  6185. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6187. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)})},
  6188. args: [],
  6189. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6190. messageSends: ["should:raise:", "value:"],
  6191. referencedClasses: ["MessageNotUnderstood"]
  6192. }),
  6193. globals.MethodInheritanceTest);
  6194. smalltalk.addMethod(
  6195. smalltalk.method({
  6196. selector: "shouldReturn:",
  6197. protocol: 'testing',
  6198. fn: function (anObject){
  6199. var self=this;
  6200. var result;
  6201. return smalltalk.withContext(function($ctx1) {
  6202. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6203. $ctx1.sendIdx["value:"]=1;
  6204. self._assert_equals_(["top",anObject],["top",result]);
  6205. $ctx1.sendIdx["assert:equals:"]=1;
  6206. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6207. $ctx1.sendIdx["value:"]=2;
  6208. self._assert_equals_(["middle",anObject],["middle",result]);
  6209. $ctx1.sendIdx["assert:equals:"]=2;
  6210. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6211. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6212. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)})},
  6213. args: ["anObject"],
  6214. 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 }",
  6215. messageSends: ["value:", "assert:equals:"],
  6216. referencedClasses: []
  6217. }),
  6218. globals.MethodInheritanceTest);
  6219. smalltalk.addMethod(
  6220. smalltalk.method({
  6221. selector: "shouldReturn:and:and:",
  6222. protocol: 'testing',
  6223. fn: function (anObject,anObject2,anObject3){
  6224. var self=this;
  6225. var result;
  6226. return smalltalk.withContext(function($ctx1) {
  6227. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6228. $ctx1.sendIdx["value:"]=1;
  6229. self._assert_equals_(["top",anObject],["top",result]);
  6230. $ctx1.sendIdx["assert:equals:"]=1;
  6231. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6232. $ctx1.sendIdx["value:"]=2;
  6233. self._assert_equals_(["middle",anObject2],["middle",result]);
  6234. $ctx1.sendIdx["assert:equals:"]=2;
  6235. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6236. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6237. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)})},
  6238. args: ["anObject", "anObject2", "anObject3"],
  6239. 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 }",
  6240. messageSends: ["value:", "assert:equals:"],
  6241. referencedClasses: []
  6242. }),
  6243. globals.MethodInheritanceTest);
  6244. smalltalk.addMethod(
  6245. smalltalk.method({
  6246. selector: "targetClassBottom",
  6247. protocol: 'accessing',
  6248. fn: function (){
  6249. var self=this;
  6250. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6251. return $JavaScriptException();
  6252. },
  6253. args: [],
  6254. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6255. messageSends: [],
  6256. referencedClasses: ["JavaScriptException"]
  6257. }),
  6258. globals.MethodInheritanceTest);
  6259. smalltalk.addMethod(
  6260. smalltalk.method({
  6261. selector: "targetClassMiddle",
  6262. protocol: 'accessing',
  6263. fn: function (){
  6264. var self=this;
  6265. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6266. return $Error();
  6267. },
  6268. args: [],
  6269. source: "targetClassMiddle\x0a\x09^ Error",
  6270. messageSends: [],
  6271. referencedClasses: ["Error"]
  6272. }),
  6273. globals.MethodInheritanceTest);
  6274. smalltalk.addMethod(
  6275. smalltalk.method({
  6276. selector: "targetClassTop",
  6277. protocol: 'accessing',
  6278. fn: function (){
  6279. var self=this;
  6280. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6281. return $Object();
  6282. },
  6283. args: [],
  6284. source: "targetClassTop\x0a\x09^ Object",
  6285. messageSends: [],
  6286. referencedClasses: ["Object"]
  6287. }),
  6288. globals.MethodInheritanceTest);
  6289. smalltalk.addMethod(
  6290. smalltalk.method({
  6291. selector: "tearDown",
  6292. protocol: 'initialization',
  6293. fn: function (){
  6294. var self=this;
  6295. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6296. return smalltalk.withContext(function($ctx1) {
  6297. _st((function(){
  6298. return smalltalk.withContext(function($ctx2) {
  6299. return self._deinstallTop();
  6300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6301. }));
  6302. $ctx1.sendIdx["on:do:"]=1;
  6303. _st((function(){
  6304. return smalltalk.withContext(function($ctx2) {
  6305. return self._deinstallMiddle();
  6306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6307. }));
  6308. $ctx1.sendIdx["on:do:"]=2;
  6309. _st((function(){
  6310. return smalltalk.withContext(function($ctx2) {
  6311. return self._deinstallBottom();
  6312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6313. }));
  6314. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)})},
  6315. args: [],
  6316. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6317. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6318. referencedClasses: ["Error"]
  6319. }),
  6320. globals.MethodInheritanceTest);
  6321. smalltalk.addMethod(
  6322. smalltalk.method({
  6323. selector: "testMNU11",
  6324. protocol: 'tests',
  6325. fn: function (){
  6326. var self=this;
  6327. return smalltalk.withContext(function($ctx1) {
  6328. self["@performBlock"]=(function(x){
  6329. return smalltalk.withContext(function($ctx2) {
  6330. return _st(x)._foo();
  6331. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6332. self._shouldMNU();
  6333. $ctx1.sendIdx["shouldMNU"]=1;
  6334. self._installTop_("foo ^ false");
  6335. $ctx1.sendIdx["installTop:"]=1;
  6336. self._installTop_("foo ^ true");
  6337. self._deinstallTop();
  6338. self._shouldMNU();
  6339. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)})},
  6340. args: [],
  6341. 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",
  6342. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6343. referencedClasses: []
  6344. }),
  6345. globals.MethodInheritanceTest);
  6346. smalltalk.addMethod(
  6347. smalltalk.method({
  6348. selector: "testMNU22",
  6349. protocol: 'tests',
  6350. fn: function (){
  6351. var self=this;
  6352. return smalltalk.withContext(function($ctx1) {
  6353. self["@performBlock"]=(function(x){
  6354. return smalltalk.withContext(function($ctx2) {
  6355. return _st(x)._foo();
  6356. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6357. self._shouldMNU();
  6358. $ctx1.sendIdx["shouldMNU"]=1;
  6359. self._installMiddle_("foo ^ false");
  6360. $ctx1.sendIdx["installMiddle:"]=1;
  6361. self._installMiddle_("foo ^ true");
  6362. self._deinstallMiddle();
  6363. self._shouldMNU();
  6364. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)})},
  6365. args: [],
  6366. 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",
  6367. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6368. referencedClasses: []
  6369. }),
  6370. globals.MethodInheritanceTest);
  6371. smalltalk.addMethod(
  6372. smalltalk.method({
  6373. selector: "testReturns1",
  6374. protocol: 'tests',
  6375. fn: function (){
  6376. var self=this;
  6377. return smalltalk.withContext(function($ctx1) {
  6378. self["@performBlock"]=(function(x){
  6379. return smalltalk.withContext(function($ctx2) {
  6380. return _st(x)._foo();
  6381. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6382. self._installTop_("foo ^ false");
  6383. $ctx1.sendIdx["installTop:"]=1;
  6384. self._shouldReturn_(false);
  6385. $ctx1.sendIdx["shouldReturn:"]=1;
  6386. self._installTop_("foo ^ true");
  6387. self._shouldReturn_(true);
  6388. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)})},
  6389. args: [],
  6390. 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",
  6391. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6392. referencedClasses: []
  6393. }),
  6394. globals.MethodInheritanceTest);
  6395. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  6396. smalltalk.addMethod(
  6397. smalltalk.method({
  6398. selector: "testAbs",
  6399. protocol: 'tests',
  6400. fn: function (){
  6401. var self=this;
  6402. return smalltalk.withContext(function($ctx1) {
  6403. var $1;
  6404. $1=(4)._abs();
  6405. $ctx1.sendIdx["abs"]=1;
  6406. self._assert_equals_($1,(4));
  6407. $ctx1.sendIdx["assert:equals:"]=1;
  6408. self._assert_equals_((-4)._abs(),(4));
  6409. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)})},
  6410. args: [],
  6411. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6412. messageSends: ["assert:equals:", "abs"],
  6413. referencedClasses: []
  6414. }),
  6415. globals.NumberTest);
  6416. smalltalk.addMethod(
  6417. smalltalk.method({
  6418. selector: "testArithmetic",
  6419. protocol: 'tests',
  6420. fn: function (){
  6421. var self=this;
  6422. return smalltalk.withContext(function($ctx1) {
  6423. var $1,$2,$3,$5,$4;
  6424. $1=(1.5).__plus((1));
  6425. $ctx1.sendIdx["+"]=1;
  6426. self._assert_equals_($1,(2.5));
  6427. $ctx1.sendIdx["assert:equals:"]=1;
  6428. $2=(2).__minus((1));
  6429. $ctx1.sendIdx["-"]=1;
  6430. self._assert_equals_($2,(1));
  6431. $ctx1.sendIdx["assert:equals:"]=2;
  6432. self._assert_equals_((-2).__minus((1)),(-3));
  6433. $ctx1.sendIdx["assert:equals:"]=3;
  6434. self._assert_equals_((12).__slash((2)),(6));
  6435. $ctx1.sendIdx["assert:equals:"]=4;
  6436. $3=(3).__star((4));
  6437. $ctx1.sendIdx["*"]=1;
  6438. self._assert_equals_($3,(12));
  6439. $ctx1.sendIdx["assert:equals:"]=5;
  6440. self._assert_equals_((7).__slash_slash((2)),(3));
  6441. $ctx1.sendIdx["assert:equals:"]=6;
  6442. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6443. $ctx1.sendIdx["assert:equals:"]=7;
  6444. $5=(1).__plus((2));
  6445. $ctx1.sendIdx["+"]=2;
  6446. $4=_st($5).__star((3));
  6447. $ctx1.sendIdx["*"]=2;
  6448. self._assert_equals_($4,(9));
  6449. $ctx1.sendIdx["assert:equals:"]=8;
  6450. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6451. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)})},
  6452. args: [],
  6453. 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",
  6454. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6455. referencedClasses: []
  6456. }),
  6457. globals.NumberTest);
  6458. smalltalk.addMethod(
  6459. smalltalk.method({
  6460. selector: "testAsNumber",
  6461. protocol: 'tests',
  6462. fn: function (){
  6463. var self=this;
  6464. return smalltalk.withContext(function($ctx1) {
  6465. self._assert_equals_((3)._asNumber(),(3));
  6466. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)})},
  6467. args: [],
  6468. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6469. messageSends: ["assert:equals:", "asNumber"],
  6470. referencedClasses: []
  6471. }),
  6472. globals.NumberTest);
  6473. smalltalk.addMethod(
  6474. smalltalk.method({
  6475. selector: "testCeiling",
  6476. protocol: 'tests',
  6477. fn: function (){
  6478. var self=this;
  6479. return smalltalk.withContext(function($ctx1) {
  6480. var $1,$2;
  6481. $1=(1.2)._ceiling();
  6482. $ctx1.sendIdx["ceiling"]=1;
  6483. self._assert_equals_($1,(2));
  6484. $ctx1.sendIdx["assert:equals:"]=1;
  6485. $2=(-1.2)._ceiling();
  6486. $ctx1.sendIdx["ceiling"]=2;
  6487. self._assert_equals_($2,(-1));
  6488. $ctx1.sendIdx["assert:equals:"]=2;
  6489. self._assert_equals_((1)._ceiling(),(1));
  6490. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)})},
  6491. args: [],
  6492. 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.",
  6493. messageSends: ["assert:equals:", "ceiling"],
  6494. referencedClasses: []
  6495. }),
  6496. globals.NumberTest);
  6497. smalltalk.addMethod(
  6498. smalltalk.method({
  6499. selector: "testComparison",
  6500. protocol: 'tests',
  6501. fn: function (){
  6502. var self=this;
  6503. return smalltalk.withContext(function($ctx1) {
  6504. var $1,$2,$3,$4;
  6505. $1=(3).__gt((2));
  6506. $ctx1.sendIdx[">"]=1;
  6507. self._assert_($1);
  6508. $ctx1.sendIdx["assert:"]=1;
  6509. $2=(2).__lt((3));
  6510. $ctx1.sendIdx["<"]=1;
  6511. self._assert_($2);
  6512. $ctx1.sendIdx["assert:"]=2;
  6513. self._deny_((3).__lt((2)));
  6514. $ctx1.sendIdx["deny:"]=1;
  6515. self._deny_((2).__gt((3)));
  6516. $3=(3).__gt_eq((3));
  6517. $ctx1.sendIdx[">="]=1;
  6518. self._assert_($3);
  6519. $ctx1.sendIdx["assert:"]=3;
  6520. self._assert_((3.1).__gt_eq((3)));
  6521. $ctx1.sendIdx["assert:"]=4;
  6522. $4=(3).__lt_eq((3));
  6523. $ctx1.sendIdx["<="]=1;
  6524. self._assert_($4);
  6525. $ctx1.sendIdx["assert:"]=5;
  6526. self._assert_((3).__lt_eq((3.1)));
  6527. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)})},
  6528. args: [],
  6529. 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",
  6530. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6531. referencedClasses: []
  6532. }),
  6533. globals.NumberTest);
  6534. smalltalk.addMethod(
  6535. smalltalk.method({
  6536. selector: "testCopying",
  6537. protocol: 'tests',
  6538. fn: function (){
  6539. var self=this;
  6540. return smalltalk.withContext(function($ctx1) {
  6541. var $1;
  6542. $1=_st((1)._copy()).__eq_eq((1));
  6543. $ctx1.sendIdx["=="]=1;
  6544. self._assert_($1);
  6545. $ctx1.sendIdx["assert:"]=1;
  6546. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6547. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)})},
  6548. args: [],
  6549. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6550. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6551. referencedClasses: []
  6552. }),
  6553. globals.NumberTest);
  6554. smalltalk.addMethod(
  6555. smalltalk.method({
  6556. selector: "testEquality",
  6557. protocol: 'tests',
  6558. fn: function (){
  6559. var self=this;
  6560. return smalltalk.withContext(function($ctx1) {
  6561. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6562. $1=(1).__eq((1));
  6563. $ctx1.sendIdx["="]=1;
  6564. self._assert_($1);
  6565. $ctx1.sendIdx["assert:"]=1;
  6566. $2=(0).__eq((0));
  6567. $ctx1.sendIdx["="]=2;
  6568. self._assert_($2);
  6569. $ctx1.sendIdx["assert:"]=2;
  6570. $3=(1).__eq((0));
  6571. $ctx1.sendIdx["="]=3;
  6572. self._deny_($3);
  6573. $ctx1.sendIdx["deny:"]=1;
  6574. $5=(1)._yourself();
  6575. $ctx1.sendIdx["yourself"]=1;
  6576. $4=_st($5).__eq((1));
  6577. $ctx1.sendIdx["="]=4;
  6578. self._assert_($4);
  6579. $ctx1.sendIdx["assert:"]=3;
  6580. $7=(1)._yourself();
  6581. $ctx1.sendIdx["yourself"]=2;
  6582. $6=(1).__eq($7);
  6583. $ctx1.sendIdx["="]=5;
  6584. self._assert_($6);
  6585. $ctx1.sendIdx["assert:"]=4;
  6586. $9=(1)._yourself();
  6587. $ctx1.sendIdx["yourself"]=3;
  6588. $8=_st($9).__eq((1)._yourself());
  6589. $ctx1.sendIdx["="]=6;
  6590. self._assert_($8);
  6591. $10=(0).__eq(false);
  6592. $ctx1.sendIdx["="]=7;
  6593. self._deny_($10);
  6594. $ctx1.sendIdx["deny:"]=2;
  6595. $11=false.__eq((0));
  6596. $ctx1.sendIdx["="]=8;
  6597. self._deny_($11);
  6598. $ctx1.sendIdx["deny:"]=3;
  6599. $12="".__eq((0));
  6600. $ctx1.sendIdx["="]=9;
  6601. self._deny_($12);
  6602. $ctx1.sendIdx["deny:"]=4;
  6603. self._deny_((0).__eq(""));
  6604. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)})},
  6605. args: [],
  6606. 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 = ''",
  6607. messageSends: ["assert:", "=", "deny:", "yourself"],
  6608. referencedClasses: []
  6609. }),
  6610. globals.NumberTest);
  6611. smalltalk.addMethod(
  6612. smalltalk.method({
  6613. selector: "testFloor",
  6614. protocol: 'tests',
  6615. fn: function (){
  6616. var self=this;
  6617. return smalltalk.withContext(function($ctx1) {
  6618. var $1,$2;
  6619. $1=(1.2)._floor();
  6620. $ctx1.sendIdx["floor"]=1;
  6621. self._assert_equals_($1,(1));
  6622. $ctx1.sendIdx["assert:equals:"]=1;
  6623. $2=(-1.2)._floor();
  6624. $ctx1.sendIdx["floor"]=2;
  6625. self._assert_equals_($2,(-2));
  6626. $ctx1.sendIdx["assert:equals:"]=2;
  6627. self._assert_equals_((1)._floor(),(1));
  6628. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)})},
  6629. args: [],
  6630. 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.",
  6631. messageSends: ["assert:equals:", "floor"],
  6632. referencedClasses: []
  6633. }),
  6634. globals.NumberTest);
  6635. smalltalk.addMethod(
  6636. smalltalk.method({
  6637. selector: "testHexNumbers",
  6638. protocol: 'tests',
  6639. fn: function (){
  6640. var self=this;
  6641. return smalltalk.withContext(function($ctx1) {
  6642. var $1,$2,$3,$4,$5;
  6643. self._assert_equals_((9),(9));
  6644. $ctx1.sendIdx["assert:equals:"]=1;
  6645. $1=(10)._truncated();
  6646. $ctx1.sendIdx["truncated"]=1;
  6647. self._assert_equals_($1,(10));
  6648. $ctx1.sendIdx["assert:equals:"]=2;
  6649. $2=(11)._truncated();
  6650. $ctx1.sendIdx["truncated"]=2;
  6651. self._assert_equals_($2,(11));
  6652. $ctx1.sendIdx["assert:equals:"]=3;
  6653. $3=(12)._truncated();
  6654. $ctx1.sendIdx["truncated"]=3;
  6655. self._assert_equals_($3,(12));
  6656. $ctx1.sendIdx["assert:equals:"]=4;
  6657. $4=(13)._truncated();
  6658. $ctx1.sendIdx["truncated"]=4;
  6659. self._assert_equals_($4,(13));
  6660. $ctx1.sendIdx["assert:equals:"]=5;
  6661. $5=(14)._truncated();
  6662. $ctx1.sendIdx["truncated"]=5;
  6663. self._assert_equals_($5,(14));
  6664. $ctx1.sendIdx["assert:equals:"]=6;
  6665. self._assert_equals_((15)._truncated(),(15));
  6666. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)})},
  6667. args: [],
  6668. 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",
  6669. messageSends: ["assert:equals:", "truncated"],
  6670. referencedClasses: []
  6671. }),
  6672. globals.NumberTest);
  6673. smalltalk.addMethod(
  6674. smalltalk.method({
  6675. selector: "testIdentity",
  6676. protocol: 'tests',
  6677. fn: function (){
  6678. var self=this;
  6679. return smalltalk.withContext(function($ctx1) {
  6680. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6681. $1=(1).__eq_eq((1));
  6682. $ctx1.sendIdx["=="]=1;
  6683. self._assert_($1);
  6684. $ctx1.sendIdx["assert:"]=1;
  6685. $2=(0).__eq_eq((0));
  6686. $ctx1.sendIdx["=="]=2;
  6687. self._assert_($2);
  6688. $ctx1.sendIdx["assert:"]=2;
  6689. $3=(1).__eq_eq((0));
  6690. $ctx1.sendIdx["=="]=3;
  6691. self._deny_($3);
  6692. $ctx1.sendIdx["deny:"]=1;
  6693. $5=(1)._yourself();
  6694. $ctx1.sendIdx["yourself"]=1;
  6695. $4=_st($5).__eq_eq((1));
  6696. $ctx1.sendIdx["=="]=4;
  6697. self._assert_($4);
  6698. $ctx1.sendIdx["assert:"]=3;
  6699. $7=(1)._yourself();
  6700. $ctx1.sendIdx["yourself"]=2;
  6701. $6=(1).__eq_eq($7);
  6702. $ctx1.sendIdx["=="]=5;
  6703. self._assert_($6);
  6704. $ctx1.sendIdx["assert:"]=4;
  6705. $9=(1)._yourself();
  6706. $ctx1.sendIdx["yourself"]=3;
  6707. $8=_st($9).__eq_eq((1)._yourself());
  6708. $ctx1.sendIdx["=="]=6;
  6709. self._assert_($8);
  6710. self._deny_((1).__eq_eq((2)));
  6711. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)})},
  6712. args: [],
  6713. 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",
  6714. messageSends: ["assert:", "==", "deny:", "yourself"],
  6715. referencedClasses: []
  6716. }),
  6717. globals.NumberTest);
  6718. smalltalk.addMethod(
  6719. smalltalk.method({
  6720. selector: "testInvalidHexNumbers",
  6721. protocol: 'tests',
  6722. fn: function (){
  6723. var self=this;
  6724. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6725. return smalltalk.withContext(function($ctx1) {
  6726. self._should_raise_((function(){
  6727. return smalltalk.withContext(function($ctx2) {
  6728. return (16)._rG();
  6729. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6730. $ctx1.sendIdx["should:raise:"]=1;
  6731. self._should_raise_((function(){
  6732. return smalltalk.withContext(function($ctx2) {
  6733. return (16)._rg();
  6734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6735. $ctx1.sendIdx["should:raise:"]=2;
  6736. self._should_raise_((function(){
  6737. return smalltalk.withContext(function($ctx2) {
  6738. return (16)._rH();
  6739. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6740. $ctx1.sendIdx["should:raise:"]=3;
  6741. self._should_raise_((function(){
  6742. return smalltalk.withContext(function($ctx2) {
  6743. return (16)._rh();
  6744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6745. $ctx1.sendIdx["should:raise:"]=4;
  6746. self._should_raise_((function(){
  6747. return smalltalk.withContext(function($ctx2) {
  6748. return (16)._rI();
  6749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6750. $ctx1.sendIdx["should:raise:"]=5;
  6751. self._should_raise_((function(){
  6752. return smalltalk.withContext(function($ctx2) {
  6753. return (16)._ri();
  6754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6755. $ctx1.sendIdx["should:raise:"]=6;
  6756. self._should_raise_((function(){
  6757. return smalltalk.withContext(function($ctx2) {
  6758. return (16)._rJ();
  6759. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6760. $ctx1.sendIdx["should:raise:"]=7;
  6761. self._should_raise_((function(){
  6762. return smalltalk.withContext(function($ctx2) {
  6763. return (16)._rj();
  6764. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6765. $ctx1.sendIdx["should:raise:"]=8;
  6766. self._should_raise_((function(){
  6767. return smalltalk.withContext(function($ctx2) {
  6768. return (16)._rK();
  6769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6770. $ctx1.sendIdx["should:raise:"]=9;
  6771. self._should_raise_((function(){
  6772. return smalltalk.withContext(function($ctx2) {
  6773. return (16)._rk();
  6774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6775. $ctx1.sendIdx["should:raise:"]=10;
  6776. self._should_raise_((function(){
  6777. return smalltalk.withContext(function($ctx2) {
  6778. return (16)._rL();
  6779. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6780. $ctx1.sendIdx["should:raise:"]=11;
  6781. self._should_raise_((function(){
  6782. return smalltalk.withContext(function($ctx2) {
  6783. return (16)._rl();
  6784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6785. $ctx1.sendIdx["should:raise:"]=12;
  6786. self._should_raise_((function(){
  6787. return smalltalk.withContext(function($ctx2) {
  6788. return (16)._rM();
  6789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6790. $ctx1.sendIdx["should:raise:"]=13;
  6791. self._should_raise_((function(){
  6792. return smalltalk.withContext(function($ctx2) {
  6793. return (16)._rm();
  6794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6795. $ctx1.sendIdx["should:raise:"]=14;
  6796. self._should_raise_((function(){
  6797. return smalltalk.withContext(function($ctx2) {
  6798. return (16)._rN();
  6799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6800. $ctx1.sendIdx["should:raise:"]=15;
  6801. self._should_raise_((function(){
  6802. return smalltalk.withContext(function($ctx2) {
  6803. return (16)._rn();
  6804. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6805. $ctx1.sendIdx["should:raise:"]=16;
  6806. self._should_raise_((function(){
  6807. return smalltalk.withContext(function($ctx2) {
  6808. return (16)._rO();
  6809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6810. $ctx1.sendIdx["should:raise:"]=17;
  6811. self._should_raise_((function(){
  6812. return smalltalk.withContext(function($ctx2) {
  6813. return (16)._ro();
  6814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6815. $ctx1.sendIdx["should:raise:"]=18;
  6816. self._should_raise_((function(){
  6817. return smalltalk.withContext(function($ctx2) {
  6818. return (16)._rP();
  6819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6820. $ctx1.sendIdx["should:raise:"]=19;
  6821. self._should_raise_((function(){
  6822. return smalltalk.withContext(function($ctx2) {
  6823. return (16)._rp();
  6824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6825. $ctx1.sendIdx["should:raise:"]=20;
  6826. self._should_raise_((function(){
  6827. return smalltalk.withContext(function($ctx2) {
  6828. return (16)._rQ();
  6829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6830. $ctx1.sendIdx["should:raise:"]=21;
  6831. self._should_raise_((function(){
  6832. return smalltalk.withContext(function($ctx2) {
  6833. return (16)._rq();
  6834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6835. $ctx1.sendIdx["should:raise:"]=22;
  6836. self._should_raise_((function(){
  6837. return smalltalk.withContext(function($ctx2) {
  6838. return (16)._rR();
  6839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6840. $ctx1.sendIdx["should:raise:"]=23;
  6841. self._should_raise_((function(){
  6842. return smalltalk.withContext(function($ctx2) {
  6843. return (16)._rr();
  6844. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6845. $ctx1.sendIdx["should:raise:"]=24;
  6846. self._should_raise_((function(){
  6847. return smalltalk.withContext(function($ctx2) {
  6848. return (16)._rS();
  6849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6850. $ctx1.sendIdx["should:raise:"]=25;
  6851. self._should_raise_((function(){
  6852. return smalltalk.withContext(function($ctx2) {
  6853. return (16)._rs();
  6854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6855. $ctx1.sendIdx["should:raise:"]=26;
  6856. self._should_raise_((function(){
  6857. return smalltalk.withContext(function($ctx2) {
  6858. return (16)._rT();
  6859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6860. $ctx1.sendIdx["should:raise:"]=27;
  6861. self._should_raise_((function(){
  6862. return smalltalk.withContext(function($ctx2) {
  6863. return (16)._rt();
  6864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6865. $ctx1.sendIdx["should:raise:"]=28;
  6866. self._should_raise_((function(){
  6867. return smalltalk.withContext(function($ctx2) {
  6868. return (16)._rU();
  6869. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6870. $ctx1.sendIdx["should:raise:"]=29;
  6871. self._should_raise_((function(){
  6872. return smalltalk.withContext(function($ctx2) {
  6873. return (16)._ru();
  6874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6875. $ctx1.sendIdx["should:raise:"]=30;
  6876. self._should_raise_((function(){
  6877. return smalltalk.withContext(function($ctx2) {
  6878. return (16)._rV();
  6879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6880. $ctx1.sendIdx["should:raise:"]=31;
  6881. self._should_raise_((function(){
  6882. return smalltalk.withContext(function($ctx2) {
  6883. return (16)._rv();
  6884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6885. $ctx1.sendIdx["should:raise:"]=32;
  6886. self._should_raise_((function(){
  6887. return smalltalk.withContext(function($ctx2) {
  6888. return (16)._rW();
  6889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6890. $ctx1.sendIdx["should:raise:"]=33;
  6891. self._should_raise_((function(){
  6892. return smalltalk.withContext(function($ctx2) {
  6893. return (16)._rw();
  6894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6895. $ctx1.sendIdx["should:raise:"]=34;
  6896. self._should_raise_((function(){
  6897. return smalltalk.withContext(function($ctx2) {
  6898. return (16)._rX();
  6899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6900. $ctx1.sendIdx["should:raise:"]=35;
  6901. self._should_raise_((function(){
  6902. return smalltalk.withContext(function($ctx2) {
  6903. return (16)._rx();
  6904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6905. $ctx1.sendIdx["should:raise:"]=36;
  6906. self._should_raise_((function(){
  6907. return smalltalk.withContext(function($ctx2) {
  6908. return (16)._rY();
  6909. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6910. $ctx1.sendIdx["should:raise:"]=37;
  6911. self._should_raise_((function(){
  6912. return smalltalk.withContext(function($ctx2) {
  6913. return (16)._ry();
  6914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6915. $ctx1.sendIdx["should:raise:"]=38;
  6916. self._should_raise_((function(){
  6917. return smalltalk.withContext(function($ctx2) {
  6918. return (16)._rZ();
  6919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6920. $ctx1.sendIdx["should:raise:"]=39;
  6921. self._should_raise_((function(){
  6922. return smalltalk.withContext(function($ctx2) {
  6923. return (16)._rz();
  6924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6925. $ctx1.sendIdx["should:raise:"]=40;
  6926. self._should_raise_((function(){
  6927. return smalltalk.withContext(function($ctx2) {
  6928. return (11259375)._Z();
  6929. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6930. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)})},
  6931. args: [],
  6932. 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.",
  6933. 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"],
  6934. referencedClasses: ["MessageNotUnderstood"]
  6935. }),
  6936. globals.NumberTest);
  6937. smalltalk.addMethod(
  6938. smalltalk.method({
  6939. selector: "testLog",
  6940. protocol: 'tests',
  6941. fn: function (){
  6942. var self=this;
  6943. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  6944. return smalltalk.withContext(function($ctx1) {
  6945. self._assert_equals_((10000)._log(),(4));
  6946. $ctx1.sendIdx["assert:equals:"]=1;
  6947. self._assert_equals_((512)._log_((2)),(9));
  6948. $ctx1.sendIdx["assert:equals:"]=2;
  6949. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  6950. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)})},
  6951. args: [],
  6952. 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.",
  6953. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  6954. referencedClasses: ["Number"]
  6955. }),
  6956. globals.NumberTest);
  6957. smalltalk.addMethod(
  6958. smalltalk.method({
  6959. selector: "testMinMax",
  6960. protocol: 'tests',
  6961. fn: function (){
  6962. var self=this;
  6963. return smalltalk.withContext(function($ctx1) {
  6964. self._assert_equals_((2)._max_((5)),(5));
  6965. $ctx1.sendIdx["assert:equals:"]=1;
  6966. self._assert_equals_((2)._min_((5)),(2));
  6967. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)})},
  6968. args: [],
  6969. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  6970. messageSends: ["assert:equals:", "max:", "min:"],
  6971. referencedClasses: []
  6972. }),
  6973. globals.NumberTest);
  6974. smalltalk.addMethod(
  6975. smalltalk.method({
  6976. selector: "testNegated",
  6977. protocol: 'tests',
  6978. fn: function (){
  6979. var self=this;
  6980. return smalltalk.withContext(function($ctx1) {
  6981. var $1;
  6982. $1=(3)._negated();
  6983. $ctx1.sendIdx["negated"]=1;
  6984. self._assert_equals_($1,(-3));
  6985. $ctx1.sendIdx["assert:equals:"]=1;
  6986. self._assert_equals_((-3)._negated(),(3));
  6987. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)})},
  6988. args: [],
  6989. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  6990. messageSends: ["assert:equals:", "negated"],
  6991. referencedClasses: []
  6992. }),
  6993. globals.NumberTest);
  6994. smalltalk.addMethod(
  6995. smalltalk.method({
  6996. selector: "testPrintShowingDecimalPlaces",
  6997. protocol: 'tests',
  6998. fn: function (){
  6999. var self=this;
  7000. return smalltalk.withContext(function($ctx1) {
  7001. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  7002. $1=(23)._printShowingDecimalPlaces_((2));
  7003. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  7004. self._assert_equals_($1,"23.00");
  7005. $ctx1.sendIdx["assert:equals:"]=1;
  7006. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7007. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7008. self._assert_equals_($2,"23.57");
  7009. $ctx1.sendIdx["assert:equals:"]=2;
  7010. $4=(234.567)._negated();
  7011. $ctx1.sendIdx["negated"]=1;
  7012. $3=_st($4)._printShowingDecimalPlaces_((5));
  7013. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7014. self._assert_equals_($3,"-234.56700");
  7015. $ctx1.sendIdx["assert:equals:"]=3;
  7016. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7017. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7018. self._assert_equals_($5,"23");
  7019. $ctx1.sendIdx["assert:equals:"]=4;
  7020. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7021. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7022. self._assert_equals_($6,"24");
  7023. $ctx1.sendIdx["assert:equals:"]=5;
  7024. $8=(23.4567)._negated();
  7025. $ctx1.sendIdx["negated"]=2;
  7026. $7=_st($8)._printShowingDecimalPlaces_((0));
  7027. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7028. self._assert_equals_($7,"-23");
  7029. $ctx1.sendIdx["assert:equals:"]=6;
  7030. $10=(23.5567)._negated();
  7031. $ctx1.sendIdx["negated"]=3;
  7032. $9=_st($10)._printShowingDecimalPlaces_((0));
  7033. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7034. self._assert_equals_($9,"-24");
  7035. $ctx1.sendIdx["assert:equals:"]=7;
  7036. $11=(100000000)._printShowingDecimalPlaces_((1));
  7037. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7038. self._assert_equals_($11,"100000000.0");
  7039. $ctx1.sendIdx["assert:equals:"]=8;
  7040. $12=(0.98)._printShowingDecimalPlaces_((5));
  7041. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7042. self._assert_equals_($12,"0.98000");
  7043. $ctx1.sendIdx["assert:equals:"]=9;
  7044. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7045. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7046. self._assert_equals_($13,"-0.98");
  7047. $ctx1.sendIdx["assert:equals:"]=10;
  7048. $14=(2.567)._printShowingDecimalPlaces_((2));
  7049. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7050. self._assert_equals_($14,"2.57");
  7051. $ctx1.sendIdx["assert:equals:"]=11;
  7052. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7053. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7054. self._assert_equals_($15,"-2.57");
  7055. $ctx1.sendIdx["assert:equals:"]=12;
  7056. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7057. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)})},
  7058. args: [],
  7059. 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'.",
  7060. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7061. referencedClasses: []
  7062. }),
  7063. globals.NumberTest);
  7064. smalltalk.addMethod(
  7065. smalltalk.method({
  7066. selector: "testRaisedTo",
  7067. protocol: 'tests',
  7068. fn: function (){
  7069. var self=this;
  7070. return smalltalk.withContext(function($ctx1) {
  7071. var $1,$2,$3;
  7072. $1=(2)._raisedTo_((4));
  7073. $ctx1.sendIdx["raisedTo:"]=1;
  7074. self._assert_equals_($1,(16));
  7075. $ctx1.sendIdx["assert:equals:"]=1;
  7076. $2=(2)._raisedTo_((0));
  7077. $ctx1.sendIdx["raisedTo:"]=2;
  7078. self._assert_equals_($2,(1));
  7079. $ctx1.sendIdx["assert:equals:"]=2;
  7080. $3=(2)._raisedTo_((-3));
  7081. $ctx1.sendIdx["raisedTo:"]=3;
  7082. self._assert_equals_($3,(0.125));
  7083. $ctx1.sendIdx["assert:equals:"]=3;
  7084. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7085. $ctx1.sendIdx["assert:equals:"]=4;
  7086. self._assert_equals_((2).__star_star((4)),(16));
  7087. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)})},
  7088. args: [],
  7089. 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.",
  7090. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7091. referencedClasses: []
  7092. }),
  7093. globals.NumberTest);
  7094. smalltalk.addMethod(
  7095. smalltalk.method({
  7096. selector: "testRounded",
  7097. protocol: 'tests',
  7098. fn: function (){
  7099. var self=this;
  7100. return smalltalk.withContext(function($ctx1) {
  7101. var $1,$2;
  7102. $1=(3)._rounded();
  7103. $ctx1.sendIdx["rounded"]=1;
  7104. self._assert_equals_($1,(3));
  7105. $ctx1.sendIdx["assert:equals:"]=1;
  7106. $2=(3.212)._rounded();
  7107. $ctx1.sendIdx["rounded"]=2;
  7108. self._assert_equals_($2,(3));
  7109. $ctx1.sendIdx["assert:equals:"]=2;
  7110. self._assert_equals_((3.51)._rounded(),(4));
  7111. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)})},
  7112. args: [],
  7113. 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",
  7114. messageSends: ["assert:equals:", "rounded"],
  7115. referencedClasses: []
  7116. }),
  7117. globals.NumberTest);
  7118. smalltalk.addMethod(
  7119. smalltalk.method({
  7120. selector: "testSign",
  7121. protocol: 'tests',
  7122. fn: function (){
  7123. var self=this;
  7124. return smalltalk.withContext(function($ctx1) {
  7125. var $1,$2;
  7126. $1=(5)._sign();
  7127. $ctx1.sendIdx["sign"]=1;
  7128. self._assert_equals_($1,(1));
  7129. $ctx1.sendIdx["assert:equals:"]=1;
  7130. $2=(0)._sign();
  7131. $ctx1.sendIdx["sign"]=2;
  7132. self._assert_equals_($2,(0));
  7133. $ctx1.sendIdx["assert:equals:"]=2;
  7134. self._assert_equals_((-1.4)._sign(),(-1));
  7135. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)})},
  7136. args: [],
  7137. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7138. messageSends: ["assert:equals:", "sign"],
  7139. referencedClasses: []
  7140. }),
  7141. globals.NumberTest);
  7142. smalltalk.addMethod(
  7143. smalltalk.method({
  7144. selector: "testSqrt",
  7145. protocol: 'tests',
  7146. fn: function (){
  7147. var self=this;
  7148. return smalltalk.withContext(function($ctx1) {
  7149. var $1;
  7150. $1=(4)._sqrt();
  7151. $ctx1.sendIdx["sqrt"]=1;
  7152. self._assert_equals_($1,(2));
  7153. $ctx1.sendIdx["assert:equals:"]=1;
  7154. self._assert_equals_((16)._sqrt(),(4));
  7155. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)})},
  7156. args: [],
  7157. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7158. messageSends: ["assert:equals:", "sqrt"],
  7159. referencedClasses: []
  7160. }),
  7161. globals.NumberTest);
  7162. smalltalk.addMethod(
  7163. smalltalk.method({
  7164. selector: "testSquared",
  7165. protocol: 'tests',
  7166. fn: function (){
  7167. var self=this;
  7168. return smalltalk.withContext(function($ctx1) {
  7169. self._assert_equals_((4)._squared(),(16));
  7170. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)})},
  7171. args: [],
  7172. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7173. messageSends: ["assert:equals:", "squared"],
  7174. referencedClasses: []
  7175. }),
  7176. globals.NumberTest);
  7177. smalltalk.addMethod(
  7178. smalltalk.method({
  7179. selector: "testTimesRepeat",
  7180. protocol: 'tests',
  7181. fn: function (){
  7182. var self=this;
  7183. var i;
  7184. return smalltalk.withContext(function($ctx1) {
  7185. i=(0);
  7186. (0)._timesRepeat_((function(){
  7187. return smalltalk.withContext(function($ctx2) {
  7188. i=_st(i).__plus((1));
  7189. $ctx2.sendIdx["+"]=1;
  7190. return i;
  7191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7192. $ctx1.sendIdx["timesRepeat:"]=1;
  7193. self._assert_equals_(i,(0));
  7194. $ctx1.sendIdx["assert:equals:"]=1;
  7195. (5)._timesRepeat_((function(){
  7196. return smalltalk.withContext(function($ctx2) {
  7197. i=_st(i).__plus((1));
  7198. return i;
  7199. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7200. self._assert_equals_(i,(5));
  7201. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)})},
  7202. args: [],
  7203. 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",
  7204. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7205. referencedClasses: []
  7206. }),
  7207. globals.NumberTest);
  7208. smalltalk.addMethod(
  7209. smalltalk.method({
  7210. selector: "testTo",
  7211. protocol: 'tests',
  7212. fn: function (){
  7213. var self=this;
  7214. return smalltalk.withContext(function($ctx1) {
  7215. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7216. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)})},
  7217. args: [],
  7218. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7219. messageSends: ["assert:equals:", "to:"],
  7220. referencedClasses: []
  7221. }),
  7222. globals.NumberTest);
  7223. smalltalk.addMethod(
  7224. smalltalk.method({
  7225. selector: "testToBy",
  7226. protocol: 'tests',
  7227. fn: function (){
  7228. var self=this;
  7229. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7230. return smalltalk.withContext(function($ctx1) {
  7231. var $1;
  7232. $1=(0)._to_by_((6),(2));
  7233. $ctx1.sendIdx["to:by:"]=1;
  7234. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7235. self._should_raise_((function(){
  7236. return smalltalk.withContext(function($ctx2) {
  7237. return (1)._to_by_((4),(0));
  7238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7239. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)})},
  7240. args: [],
  7241. 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",
  7242. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7243. referencedClasses: ["Error"]
  7244. }),
  7245. globals.NumberTest);
  7246. smalltalk.addMethod(
  7247. smalltalk.method({
  7248. selector: "testTrigonometry",
  7249. protocol: 'tests',
  7250. fn: function (){
  7251. var self=this;
  7252. return smalltalk.withContext(function($ctx1) {
  7253. self._assert_equals_((0)._cos(),(1));
  7254. $ctx1.sendIdx["assert:equals:"]=1;
  7255. self._assert_equals_((0)._sin(),(0));
  7256. $ctx1.sendIdx["assert:equals:"]=2;
  7257. self._assert_equals_((0)._tan(),(0));
  7258. $ctx1.sendIdx["assert:equals:"]=3;
  7259. self._assert_equals_((1)._arcCos(),(0));
  7260. $ctx1.sendIdx["assert:equals:"]=4;
  7261. self._assert_equals_((0)._arcSin(),(0));
  7262. $ctx1.sendIdx["assert:equals:"]=5;
  7263. self._assert_equals_((0)._arcTan(),(0));
  7264. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)})},
  7265. args: [],
  7266. 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.",
  7267. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7268. referencedClasses: []
  7269. }),
  7270. globals.NumberTest);
  7271. smalltalk.addMethod(
  7272. smalltalk.method({
  7273. selector: "testTruncated",
  7274. protocol: 'tests',
  7275. fn: function (){
  7276. var self=this;
  7277. return smalltalk.withContext(function($ctx1) {
  7278. var $1,$2;
  7279. $1=(3)._truncated();
  7280. $ctx1.sendIdx["truncated"]=1;
  7281. self._assert_equals_($1,(3));
  7282. $ctx1.sendIdx["assert:equals:"]=1;
  7283. $2=(3.212)._truncated();
  7284. $ctx1.sendIdx["truncated"]=2;
  7285. self._assert_equals_($2,(3));
  7286. $ctx1.sendIdx["assert:equals:"]=2;
  7287. self._assert_equals_((3.51)._truncated(),(3));
  7288. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)})},
  7289. args: [],
  7290. 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",
  7291. messageSends: ["assert:equals:", "truncated"],
  7292. referencedClasses: []
  7293. }),
  7294. globals.NumberTest);
  7295. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  7296. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7297. smalltalk.addMethod(
  7298. smalltalk.method({
  7299. selector: "foo",
  7300. protocol: 'not yet classified',
  7301. fn: function (){
  7302. var self=this;
  7303. var $1;
  7304. $1=self["@foo"];
  7305. return $1;
  7306. },
  7307. args: [],
  7308. source: "foo\x0a\x09^ foo",
  7309. messageSends: [],
  7310. referencedClasses: []
  7311. }),
  7312. globals.ObjectMock);
  7313. smalltalk.addMethod(
  7314. smalltalk.method({
  7315. selector: "foo:",
  7316. protocol: 'not yet classified',
  7317. fn: function (anObject){
  7318. var self=this;
  7319. self["@foo"]=anObject;
  7320. return self},
  7321. args: ["anObject"],
  7322. source: "foo: anObject\x0a\x09foo := anObject",
  7323. messageSends: [],
  7324. referencedClasses: []
  7325. }),
  7326. globals.ObjectMock);
  7327. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  7328. smalltalk.addMethod(
  7329. smalltalk.method({
  7330. selector: "notDefined",
  7331. protocol: 'tests',
  7332. fn: function (){
  7333. var self=this;
  7334. return smalltalk.withContext(function($ctx1) {
  7335. return void 0;;
  7336. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},globals.ObjectTest)})},
  7337. args: [],
  7338. source: "notDefined\x0a\x09<return void 0;>",
  7339. messageSends: [],
  7340. referencedClasses: []
  7341. }),
  7342. globals.ObjectTest);
  7343. smalltalk.addMethod(
  7344. smalltalk.method({
  7345. selector: "testBasicAccess",
  7346. protocol: 'tests',
  7347. fn: function (){
  7348. var self=this;
  7349. var o;
  7350. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7351. return smalltalk.withContext(function($ctx1) {
  7352. var $1;
  7353. o=_st($Object())._new();
  7354. _st(o)._basicAt_put_("a",(1));
  7355. $1=_st(o)._basicAt_("a");
  7356. $ctx1.sendIdx["basicAt:"]=1;
  7357. self._assert_equals_($1,(1));
  7358. $ctx1.sendIdx["assert:equals:"]=1;
  7359. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7360. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)})},
  7361. args: [],
  7362. 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",
  7363. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7364. referencedClasses: ["Object"]
  7365. }),
  7366. globals.ObjectTest);
  7367. smalltalk.addMethod(
  7368. smalltalk.method({
  7369. selector: "testBasicPerform",
  7370. protocol: 'tests',
  7371. fn: function (){
  7372. var self=this;
  7373. var o;
  7374. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7375. return smalltalk.withContext(function($ctx1) {
  7376. o=_st($Object())._new();
  7377. _st(o)._basicAt_put_("func",(function(){
  7378. return "hello";
  7379. }));
  7380. $ctx1.sendIdx["basicAt:put:"]=1;
  7381. _st(o)._basicAt_put_("func2",(function(a){
  7382. return smalltalk.withContext(function($ctx2) {
  7383. return _st(a).__plus((1));
  7384. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7385. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7386. $ctx1.sendIdx["assert:equals:"]=1;
  7387. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7388. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)})},
  7389. args: [],
  7390. 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",
  7391. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7392. referencedClasses: ["Object"]
  7393. }),
  7394. globals.ObjectTest);
  7395. smalltalk.addMethod(
  7396. smalltalk.method({
  7397. selector: "testDNU",
  7398. protocol: 'tests',
  7399. fn: function (){
  7400. var self=this;
  7401. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7402. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7403. return smalltalk.withContext(function($ctx1) {
  7404. self._should_raise_((function(){
  7405. return smalltalk.withContext(function($ctx2) {
  7406. return _st(_st($Object())._new())._foo();
  7407. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7408. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)})},
  7409. args: [],
  7410. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7411. messageSends: ["should:raise:", "foo", "new"],
  7412. referencedClasses: ["Object", "MessageNotUnderstood"]
  7413. }),
  7414. globals.ObjectTest);
  7415. smalltalk.addMethod(
  7416. smalltalk.method({
  7417. selector: "testEquality",
  7418. protocol: 'tests',
  7419. fn: function (){
  7420. var self=this;
  7421. var o;
  7422. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7423. return smalltalk.withContext(function($ctx1) {
  7424. var $1,$2,$4,$3;
  7425. o=_st($Object())._new();
  7426. $ctx1.sendIdx["new"]=1;
  7427. $1=_st(o).__eq(_st($Object())._new());
  7428. $ctx1.sendIdx["="]=1;
  7429. self._deny_($1);
  7430. $2=_st(o).__eq(o);
  7431. $ctx1.sendIdx["="]=2;
  7432. self._assert_($2);
  7433. $ctx1.sendIdx["assert:"]=1;
  7434. $4=_st(o)._yourself();
  7435. $ctx1.sendIdx["yourself"]=1;
  7436. $3=_st($4).__eq(o);
  7437. $ctx1.sendIdx["="]=3;
  7438. self._assert_($3);
  7439. $ctx1.sendIdx["assert:"]=2;
  7440. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7441. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)})},
  7442. args: [],
  7443. 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)",
  7444. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7445. referencedClasses: ["Object"]
  7446. }),
  7447. globals.ObjectTest);
  7448. smalltalk.addMethod(
  7449. smalltalk.method({
  7450. selector: "testHalt",
  7451. protocol: 'tests',
  7452. fn: function (){
  7453. var self=this;
  7454. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7455. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7456. return smalltalk.withContext(function($ctx1) {
  7457. self._should_raise_((function(){
  7458. return smalltalk.withContext(function($ctx2) {
  7459. return _st(_st($Object())._new())._halt();
  7460. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7461. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)})},
  7462. args: [],
  7463. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7464. messageSends: ["should:raise:", "halt", "new"],
  7465. referencedClasses: ["Object", "Error"]
  7466. }),
  7467. globals.ObjectTest);
  7468. smalltalk.addMethod(
  7469. smalltalk.method({
  7470. selector: "testIdentity",
  7471. protocol: 'tests',
  7472. fn: function (){
  7473. var self=this;
  7474. var o;
  7475. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7476. return smalltalk.withContext(function($ctx1) {
  7477. var $1,$2,$4,$3;
  7478. o=_st($Object())._new();
  7479. $ctx1.sendIdx["new"]=1;
  7480. $1=_st(o).__eq_eq(_st($Object())._new());
  7481. $ctx1.sendIdx["=="]=1;
  7482. self._deny_($1);
  7483. $2=_st(o).__eq_eq(o);
  7484. $ctx1.sendIdx["=="]=2;
  7485. self._assert_($2);
  7486. $ctx1.sendIdx["assert:"]=1;
  7487. $4=_st(o)._yourself();
  7488. $ctx1.sendIdx["yourself"]=1;
  7489. $3=_st($4).__eq_eq(o);
  7490. $ctx1.sendIdx["=="]=3;
  7491. self._assert_($3);
  7492. $ctx1.sendIdx["assert:"]=2;
  7493. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7494. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)})},
  7495. args: [],
  7496. 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",
  7497. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7498. referencedClasses: ["Object"]
  7499. }),
  7500. globals.ObjectTest);
  7501. smalltalk.addMethod(
  7502. smalltalk.method({
  7503. selector: "testIfNil",
  7504. protocol: 'tests',
  7505. fn: function (){
  7506. var self=this;
  7507. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7508. return smalltalk.withContext(function($ctx1) {
  7509. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  7510. $2=_st($Object())._new();
  7511. $ctx1.sendIdx["new"]=1;
  7512. $1=_st($2)._isNil();
  7513. self._deny_($1);
  7514. $ctx1.sendIdx["deny:"]=1;
  7515. $5=_st($Object())._new();
  7516. $ctx1.sendIdx["new"]=2;
  7517. if(($receiver = $5) == nil || $receiver == null){
  7518. $4=true;
  7519. } else {
  7520. $4=$5;
  7521. };
  7522. $3=_st($4).__eq(true);
  7523. self._deny_($3);
  7524. $7=_st($Object())._new();
  7525. $ctx1.sendIdx["new"]=3;
  7526. if(($receiver = $7) == nil || $receiver == null){
  7527. $6=$7;
  7528. } else {
  7529. $6=true;
  7530. };
  7531. self._assert_equals_($6,true);
  7532. $ctx1.sendIdx["assert:equals:"]=1;
  7533. $9=_st($Object())._new();
  7534. $ctx1.sendIdx["new"]=4;
  7535. if(($receiver = $9) == nil || $receiver == null){
  7536. $8=false;
  7537. } else {
  7538. $8=true;
  7539. };
  7540. self._assert_equals_($8,true);
  7541. $ctx1.sendIdx["assert:equals:"]=2;
  7542. $11=_st($Object())._new();
  7543. if(($receiver = $11) == nil || $receiver == null){
  7544. $10=false;
  7545. } else {
  7546. $10=true;
  7547. };
  7548. self._assert_equals_($10,true);
  7549. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)})},
  7550. args: [],
  7551. 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",
  7552. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7553. referencedClasses: ["Object"]
  7554. }),
  7555. globals.ObjectTest);
  7556. smalltalk.addMethod(
  7557. smalltalk.method({
  7558. selector: "testInstVars",
  7559. protocol: 'tests',
  7560. fn: function (){
  7561. var self=this;
  7562. var o;
  7563. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7564. return smalltalk.withContext(function($ctx1) {
  7565. var $1,$2;
  7566. o=_st($ObjectMock())._new();
  7567. $1=_st(o)._instVarAt_("foo");
  7568. $ctx1.sendIdx["instVarAt:"]=1;
  7569. self._assert_equals_($1,nil);
  7570. $ctx1.sendIdx["assert:equals:"]=1;
  7571. _st(o)._instVarAt_put_("foo",(1));
  7572. $2=_st(o)._instVarAt_("foo");
  7573. $ctx1.sendIdx["instVarAt:"]=2;
  7574. self._assert_equals_($2,(1));
  7575. $ctx1.sendIdx["assert:equals:"]=2;
  7576. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7577. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)})},
  7578. args: [],
  7579. 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",
  7580. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7581. referencedClasses: ["ObjectMock"]
  7582. }),
  7583. globals.ObjectTest);
  7584. smalltalk.addMethod(
  7585. smalltalk.method({
  7586. selector: "testNilUndefined",
  7587. protocol: 'tests',
  7588. fn: function (){
  7589. var self=this;
  7590. return smalltalk.withContext(function($ctx1) {
  7591. self._assert_equals_(self._notDefined(),nil);
  7592. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)})},
  7593. args: [],
  7594. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7595. messageSends: ["assert:equals:", "notDefined"],
  7596. referencedClasses: []
  7597. }),
  7598. globals.ObjectTest);
  7599. smalltalk.addMethod(
  7600. smalltalk.method({
  7601. selector: "testYourself",
  7602. protocol: 'tests',
  7603. fn: function (){
  7604. var self=this;
  7605. var o;
  7606. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7607. return smalltalk.withContext(function($ctx1) {
  7608. o=_st($ObjectMock())._new();
  7609. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7610. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)})},
  7611. args: [],
  7612. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7613. messageSends: ["new", "assert:", "==", "yourself"],
  7614. referencedClasses: ["ObjectMock"]
  7615. }),
  7616. globals.ObjectTest);
  7617. smalltalk.addMethod(
  7618. smalltalk.method({
  7619. selector: "testidentityHash",
  7620. protocol: 'tests',
  7621. fn: function (){
  7622. var self=this;
  7623. var o1,o2;
  7624. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7625. return smalltalk.withContext(function($ctx1) {
  7626. var $2,$3,$1,$5,$4;
  7627. o1=_st($Object())._new();
  7628. $ctx1.sendIdx["new"]=1;
  7629. o2=_st($Object())._new();
  7630. $2=_st(o1)._identityHash();
  7631. $ctx1.sendIdx["identityHash"]=1;
  7632. $3=_st(o1)._identityHash();
  7633. $ctx1.sendIdx["identityHash"]=2;
  7634. $1=_st($2).__eq_eq($3);
  7635. $ctx1.sendIdx["=="]=1;
  7636. self._assert_($1);
  7637. $5=_st(o1)._identityHash();
  7638. $ctx1.sendIdx["identityHash"]=3;
  7639. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7640. self._deny_($4);
  7641. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)})},
  7642. args: [],
  7643. 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",
  7644. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7645. referencedClasses: ["Object"]
  7646. }),
  7647. globals.ObjectTest);
  7648. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  7649. smalltalk.addMethod(
  7650. smalltalk.method({
  7651. selector: "testAccessing",
  7652. protocol: 'tests',
  7653. fn: function (){
  7654. var self=this;
  7655. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7656. return smalltalk.withContext(function($ctx1) {
  7657. var $2,$1,$3,$6,$5,$4;
  7658. $2=_st($Point())._x_y_((3),(4));
  7659. $ctx1.sendIdx["x:y:"]=1;
  7660. $1=_st($2)._x();
  7661. $ctx1.sendIdx["x"]=1;
  7662. self._assert_equals_($1,(3));
  7663. $ctx1.sendIdx["assert:equals:"]=1;
  7664. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7665. $ctx1.sendIdx["y"]=1;
  7666. self._assert_equals_($3,(4));
  7667. $ctx1.sendIdx["assert:equals:"]=2;
  7668. $6=_st($Point())._new();
  7669. $ctx1.sendIdx["new"]=1;
  7670. $5=_st($6)._x_((3));
  7671. $4=_st($5)._x();
  7672. self._assert_equals_($4,(3));
  7673. $ctx1.sendIdx["assert:equals:"]=3;
  7674. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7675. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)})},
  7676. args: [],
  7677. 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",
  7678. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7679. referencedClasses: ["Point"]
  7680. }),
  7681. globals.PointTest);
  7682. smalltalk.addMethod(
  7683. smalltalk.method({
  7684. selector: "testArithmetic",
  7685. protocol: 'tests',
  7686. fn: function (){
  7687. var self=this;
  7688. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7689. return smalltalk.withContext(function($ctx1) {
  7690. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7691. $2=(3).__at((4));
  7692. $ctx1.sendIdx["@"]=1;
  7693. $3=(3).__at((4));
  7694. $ctx1.sendIdx["@"]=2;
  7695. $1=_st($2).__star($3);
  7696. $4=_st($Point())._x_y_((9),(16));
  7697. $ctx1.sendIdx["x:y:"]=1;
  7698. self._assert_equals_($1,$4);
  7699. $ctx1.sendIdx["assert:equals:"]=1;
  7700. $6=(3).__at((4));
  7701. $ctx1.sendIdx["@"]=3;
  7702. $7=(3).__at((4));
  7703. $ctx1.sendIdx["@"]=4;
  7704. $5=_st($6).__plus($7);
  7705. $8=_st($Point())._x_y_((6),(8));
  7706. $ctx1.sendIdx["x:y:"]=2;
  7707. self._assert_equals_($5,$8);
  7708. $ctx1.sendIdx["assert:equals:"]=2;
  7709. $10=(3).__at((4));
  7710. $ctx1.sendIdx["@"]=5;
  7711. $11=(3).__at((4));
  7712. $ctx1.sendIdx["@"]=6;
  7713. $9=_st($10).__minus($11);
  7714. $12=_st($Point())._x_y_((0),(0));
  7715. $ctx1.sendIdx["x:y:"]=3;
  7716. self._assert_equals_($9,$12);
  7717. $ctx1.sendIdx["assert:equals:"]=3;
  7718. $14=(6).__at((8));
  7719. $ctx1.sendIdx["@"]=7;
  7720. $13=_st($14).__slash((3).__at((4)));
  7721. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7722. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)})},
  7723. args: [],
  7724. 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)",
  7725. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7726. referencedClasses: ["Point"]
  7727. }),
  7728. globals.PointTest);
  7729. smalltalk.addMethod(
  7730. smalltalk.method({
  7731. selector: "testAt",
  7732. protocol: 'tests',
  7733. fn: function (){
  7734. var self=this;
  7735. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7736. return smalltalk.withContext(function($ctx1) {
  7737. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7738. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)})},
  7739. args: [],
  7740. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7741. messageSends: ["assert:equals:", "@", "x:y:"],
  7742. referencedClasses: ["Point"]
  7743. }),
  7744. globals.PointTest);
  7745. smalltalk.addMethod(
  7746. smalltalk.method({
  7747. selector: "testEgality",
  7748. protocol: 'tests',
  7749. fn: function (){
  7750. var self=this;
  7751. return smalltalk.withContext(function($ctx1) {
  7752. var $2,$3,$1,$5,$4;
  7753. $2=(3).__at((4));
  7754. $ctx1.sendIdx["@"]=1;
  7755. $3=(3).__at((4));
  7756. $ctx1.sendIdx["@"]=2;
  7757. $1=_st($2).__eq($3);
  7758. $ctx1.sendIdx["="]=1;
  7759. self._assert_($1);
  7760. $5=(3).__at((5));
  7761. $ctx1.sendIdx["@"]=3;
  7762. $4=_st($5).__eq((3).__at((6)));
  7763. self._deny_($4);
  7764. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)})},
  7765. args: [],
  7766. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7767. messageSends: ["assert:", "=", "@", "deny:"],
  7768. referencedClasses: []
  7769. }),
  7770. globals.PointTest);
  7771. smalltalk.addMethod(
  7772. smalltalk.method({
  7773. selector: "testNew",
  7774. protocol: 'tests',
  7775. fn: function (){
  7776. var self=this;
  7777. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7778. return smalltalk.withContext(function($ctx1) {
  7779. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7780. $3=_st($Point())._new();
  7781. $ctx1.sendIdx["new"]=1;
  7782. $2=_st($3)._x_((3));
  7783. $ctx1.sendIdx["x:"]=1;
  7784. $1=_st($2)._y();
  7785. $ctx1.sendIdx["y"]=1;
  7786. self._assert_equals_($1,nil);
  7787. $ctx1.sendIdx["assert:equals:"]=1;
  7788. $7=_st($Point())._new();
  7789. $ctx1.sendIdx["new"]=2;
  7790. $6=_st($7)._x_((3));
  7791. $5=_st($6)._x();
  7792. $ctx1.sendIdx["x"]=1;
  7793. $4=_st($5).__eq((0));
  7794. $ctx1.sendIdx["="]=1;
  7795. self._deny_($4);
  7796. $ctx1.sendIdx["deny:"]=1;
  7797. $10=_st($Point())._new();
  7798. $ctx1.sendIdx["new"]=3;
  7799. $9=_st($10)._y_((4));
  7800. $ctx1.sendIdx["y:"]=1;
  7801. $8=_st($9)._x();
  7802. self._assert_equals_($8,nil);
  7803. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7804. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)})},
  7805. args: [],
  7806. 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",
  7807. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7808. referencedClasses: ["Point"]
  7809. }),
  7810. globals.PointTest);
  7811. smalltalk.addMethod(
  7812. smalltalk.method({
  7813. selector: "testTranslateBy",
  7814. protocol: 'tests',
  7815. fn: function (){
  7816. var self=this;
  7817. return smalltalk.withContext(function($ctx1) {
  7818. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7819. $2=(3).__at((3));
  7820. $ctx1.sendIdx["@"]=1;
  7821. $3=(0).__at((1));
  7822. $ctx1.sendIdx["@"]=2;
  7823. $1=_st($2)._translateBy_($3);
  7824. $ctx1.sendIdx["translateBy:"]=1;
  7825. $4=(3).__at((4));
  7826. $ctx1.sendIdx["@"]=3;
  7827. self._assert_equals_($1,$4);
  7828. $ctx1.sendIdx["assert:equals:"]=1;
  7829. $6=(3).__at((3));
  7830. $ctx1.sendIdx["@"]=4;
  7831. $8=(1)._negated();
  7832. $ctx1.sendIdx["negated"]=1;
  7833. $7=(0).__at($8);
  7834. $ctx1.sendIdx["@"]=5;
  7835. $5=_st($6)._translateBy_($7);
  7836. $ctx1.sendIdx["translateBy:"]=2;
  7837. $9=(3).__at((2));
  7838. $ctx1.sendIdx["@"]=6;
  7839. self._assert_equals_($5,$9);
  7840. $ctx1.sendIdx["assert:equals:"]=2;
  7841. $11=(3).__at((3));
  7842. $ctx1.sendIdx["@"]=7;
  7843. $12=(2).__at((3));
  7844. $ctx1.sendIdx["@"]=8;
  7845. $10=_st($11)._translateBy_($12);
  7846. $ctx1.sendIdx["translateBy:"]=3;
  7847. $13=(5).__at((6));
  7848. $ctx1.sendIdx["@"]=9;
  7849. self._assert_equals_($10,$13);
  7850. $ctx1.sendIdx["assert:equals:"]=3;
  7851. $15=(3).__at((3));
  7852. $ctx1.sendIdx["@"]=10;
  7853. $16=_st((3)._negated()).__at((0));
  7854. $ctx1.sendIdx["@"]=11;
  7855. $14=_st($15)._translateBy_($16);
  7856. self._assert_equals_($14,(0).__at((3)));
  7857. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)})},
  7858. args: [],
  7859. 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.",
  7860. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7861. referencedClasses: []
  7862. }),
  7863. globals.PointTest);
  7864. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  7865. smalltalk.addMethod(
  7866. smalltalk.method({
  7867. selector: "testNextIfAbsent",
  7868. protocol: 'tests',
  7869. fn: function (){
  7870. var self=this;
  7871. var queue;
  7872. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7873. return smalltalk.withContext(function($ctx1) {
  7874. var $2,$1;
  7875. queue=_st($Queue())._new();
  7876. _st(queue)._nextPut_("index1");
  7877. $2=_st(queue)._nextIfAbsent_("empty");
  7878. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7879. $1=_st($2).__eq("index1");
  7880. $ctx1.sendIdx["="]=1;
  7881. self._assert_($1);
  7882. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7883. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)})},
  7884. args: [],
  7885. 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'",
  7886. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7887. referencedClasses: ["Queue"]
  7888. }),
  7889. globals.QueueTest);
  7890. smalltalk.addMethod(
  7891. smalltalk.method({
  7892. selector: "testQueueNext",
  7893. protocol: 'tests',
  7894. fn: function (){
  7895. var self=this;
  7896. var queue;
  7897. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7898. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7899. return smalltalk.withContext(function($ctx1) {
  7900. var $1,$2,$4,$3,$6,$5;
  7901. queue=_st($Queue())._new();
  7902. $1=queue;
  7903. _st($1)._nextPut_("index1");
  7904. $ctx1.sendIdx["nextPut:"]=1;
  7905. $2=_st($1)._nextPut_("index2");
  7906. $4=_st(queue)._next();
  7907. $ctx1.sendIdx["next"]=1;
  7908. $3=_st($4).__eq("index1");
  7909. $ctx1.sendIdx["="]=1;
  7910. self._assert_($3);
  7911. $6=_st(queue)._next();
  7912. $ctx1.sendIdx["next"]=2;
  7913. $5=_st($6).__eq("index");
  7914. self._deny_($5);
  7915. self._should_raise_((function(){
  7916. return smalltalk.withContext(function($ctx2) {
  7917. return _st(queue)._next();
  7918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7919. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)})},
  7920. args: [],
  7921. 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",
  7922. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  7923. referencedClasses: ["Queue", "Error"]
  7924. }),
  7925. globals.QueueTest);
  7926. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  7927. smalltalk.addMethod(
  7928. smalltalk.method({
  7929. selector: "testAtRandomNumber",
  7930. protocol: 'tests',
  7931. fn: function (){
  7932. var self=this;
  7933. var val;
  7934. return smalltalk.withContext(function($ctx1) {
  7935. (100)._timesRepeat_((function(){
  7936. return smalltalk.withContext(function($ctx2) {
  7937. val=(10)._atRandom();
  7938. val;
  7939. self._assert_(_st(val).__gt((0)));
  7940. $ctx2.sendIdx["assert:"]=1;
  7941. return self._assert_(_st(val).__lt((11)));
  7942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7943. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)})},
  7944. args: [],
  7945. 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]",
  7946. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  7947. referencedClasses: []
  7948. }),
  7949. globals.RandomTest);
  7950. smalltalk.addMethod(
  7951. smalltalk.method({
  7952. selector: "testAtRandomSequenceableCollection",
  7953. protocol: 'tests',
  7954. fn: function (){
  7955. var self=this;
  7956. var val;
  7957. return smalltalk.withContext(function($ctx1) {
  7958. var $3,$4,$2,$1;
  7959. (100)._timesRepeat_((function(){
  7960. return smalltalk.withContext(function($ctx2) {
  7961. val="abc"._atRandom();
  7962. val;
  7963. $3=_st(val).__eq("a");
  7964. $ctx2.sendIdx["="]=1;
  7965. $4=_st(val).__eq("b");
  7966. $ctx2.sendIdx["="]=2;
  7967. $2=_st($3).__or($4);
  7968. $1=_st($2).__or(_st(val).__eq("c"));
  7969. $ctx2.sendIdx["|"]=1;
  7970. return self._assert_($1);
  7971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7972. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)})},
  7973. args: [],
  7974. 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].",
  7975. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  7976. referencedClasses: []
  7977. }),
  7978. globals.RandomTest);
  7979. smalltalk.addMethod(
  7980. smalltalk.method({
  7981. selector: "textNext",
  7982. protocol: 'tests',
  7983. fn: function (){
  7984. var self=this;
  7985. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  7986. return smalltalk.withContext(function($ctx1) {
  7987. var $1;
  7988. (10000)._timesRepeat_((function(){
  7989. var current,next;
  7990. return smalltalk.withContext(function($ctx2) {
  7991. next=_st(_st($Random())._new())._next();
  7992. next;
  7993. self._assert_(_st(next).__gt_eq((0)));
  7994. $ctx2.sendIdx["assert:"]=1;
  7995. self._assert_(_st(next).__lt((1)));
  7996. $1=_st(current).__eq(next);
  7997. $ctx2.sendIdx["="]=1;
  7998. self._deny_($1);
  7999. return _st(next).__eq(current);
  8000. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8001. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)})},
  8002. args: [],
  8003. 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 ]",
  8004. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8005. referencedClasses: ["Random"]
  8006. }),
  8007. globals.RandomTest);
  8008. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  8009. smalltalk.addMethod(
  8010. smalltalk.method({
  8011. selector: "collectionClass",
  8012. protocol: 'accessing',
  8013. fn: function (){
  8014. var self=this;
  8015. return smalltalk.withContext(function($ctx1) {
  8016. var $1;
  8017. $1=_st(self._class())._collectionClass();
  8018. return $1;
  8019. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)})},
  8020. args: [],
  8021. source: "collectionClass\x0a\x09^ self class collectionClass",
  8022. messageSends: ["collectionClass", "class"],
  8023. referencedClasses: []
  8024. }),
  8025. globals.StreamTest);
  8026. smalltalk.addMethod(
  8027. smalltalk.method({
  8028. selector: "newCollection",
  8029. protocol: 'accessing',
  8030. fn: function (){
  8031. var self=this;
  8032. return smalltalk.withContext(function($ctx1) {
  8033. var $1;
  8034. $1=_st(self._collectionClass())._new();
  8035. return $1;
  8036. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)})},
  8037. args: [],
  8038. source: "newCollection\x0a\x09^ self collectionClass new",
  8039. messageSends: ["new", "collectionClass"],
  8040. referencedClasses: []
  8041. }),
  8042. globals.StreamTest);
  8043. smalltalk.addMethod(
  8044. smalltalk.method({
  8045. selector: "newStream",
  8046. protocol: 'accessing',
  8047. fn: function (){
  8048. var self=this;
  8049. return smalltalk.withContext(function($ctx1) {
  8050. var $1;
  8051. $1=_st(_st(self._collectionClass())._new())._stream();
  8052. return $1;
  8053. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)})},
  8054. args: [],
  8055. source: "newStream\x0a\x09^ self collectionClass new stream",
  8056. messageSends: ["stream", "new", "collectionClass"],
  8057. referencedClasses: []
  8058. }),
  8059. globals.StreamTest);
  8060. smalltalk.addMethod(
  8061. smalltalk.method({
  8062. selector: "testAtStartAtEnd",
  8063. protocol: 'tests',
  8064. fn: function (){
  8065. var self=this;
  8066. var stream;
  8067. return smalltalk.withContext(function($ctx1) {
  8068. var $1,$2,$3,$4;
  8069. stream=self._newStream();
  8070. $1=_st(stream)._atStart();
  8071. $ctx1.sendIdx["atStart"]=1;
  8072. self._assert_($1);
  8073. $ctx1.sendIdx["assert:"]=1;
  8074. $2=_st(stream)._atEnd();
  8075. $ctx1.sendIdx["atEnd"]=1;
  8076. self._assert_($2);
  8077. $ctx1.sendIdx["assert:"]=2;
  8078. _st(stream)._nextPutAll_(self._newCollection());
  8079. $3=_st(stream)._atEnd();
  8080. $ctx1.sendIdx["atEnd"]=2;
  8081. self._assert_($3);
  8082. $4=_st(stream)._atStart();
  8083. $ctx1.sendIdx["atStart"]=2;
  8084. self._deny_($4);
  8085. $ctx1.sendIdx["deny:"]=1;
  8086. _st(stream)._position_((1));
  8087. self._deny_(_st(stream)._atEnd());
  8088. $ctx1.sendIdx["deny:"]=2;
  8089. self._deny_(_st(stream)._atStart());
  8090. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)})},
  8091. args: [],
  8092. 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",
  8093. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8094. referencedClasses: []
  8095. }),
  8096. globals.StreamTest);
  8097. smalltalk.addMethod(
  8098. smalltalk.method({
  8099. selector: "testContents",
  8100. protocol: 'tests',
  8101. fn: function (){
  8102. var self=this;
  8103. var stream;
  8104. return smalltalk.withContext(function($ctx1) {
  8105. var $1,$2;
  8106. stream=self._newStream();
  8107. $1=stream;
  8108. $2=self._newCollection();
  8109. $ctx1.sendIdx["newCollection"]=1;
  8110. _st($1)._nextPutAll_($2);
  8111. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8112. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)})},
  8113. args: [],
  8114. 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",
  8115. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8116. referencedClasses: []
  8117. }),
  8118. globals.StreamTest);
  8119. smalltalk.addMethod(
  8120. smalltalk.method({
  8121. selector: "testIsEmpty",
  8122. protocol: 'tests',
  8123. fn: function (){
  8124. var self=this;
  8125. var stream;
  8126. return smalltalk.withContext(function($ctx1) {
  8127. var $1;
  8128. stream=self._newStream();
  8129. $1=_st(stream)._isEmpty();
  8130. $ctx1.sendIdx["isEmpty"]=1;
  8131. self._assert_($1);
  8132. _st(stream)._nextPutAll_(self._newCollection());
  8133. self._deny_(_st(stream)._isEmpty());
  8134. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)})},
  8135. args: [],
  8136. 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",
  8137. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8138. referencedClasses: []
  8139. }),
  8140. globals.StreamTest);
  8141. smalltalk.addMethod(
  8142. smalltalk.method({
  8143. selector: "testPosition",
  8144. protocol: 'tests',
  8145. fn: function (){
  8146. var self=this;
  8147. var collection,stream;
  8148. return smalltalk.withContext(function($ctx1) {
  8149. var $1,$2,$3;
  8150. collection=self._newCollection();
  8151. stream=self._newStream();
  8152. _st(stream)._nextPutAll_(collection);
  8153. $1=_st(stream)._position();
  8154. $ctx1.sendIdx["position"]=1;
  8155. self._assert_equals_($1,_st(collection)._size());
  8156. $ctx1.sendIdx["assert:equals:"]=1;
  8157. _st(stream)._position_((0));
  8158. $2=_st(stream)._position();
  8159. $ctx1.sendIdx["position"]=2;
  8160. self._assert_equals_($2,(0));
  8161. $ctx1.sendIdx["assert:equals:"]=2;
  8162. _st(stream)._next();
  8163. $ctx1.sendIdx["next"]=1;
  8164. $3=_st(stream)._position();
  8165. $ctx1.sendIdx["position"]=3;
  8166. self._assert_equals_($3,(1));
  8167. $ctx1.sendIdx["assert:equals:"]=3;
  8168. _st(stream)._next();
  8169. self._assert_equals_(_st(stream)._position(),(2));
  8170. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)})},
  8171. args: [],
  8172. 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",
  8173. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8174. referencedClasses: []
  8175. }),
  8176. globals.StreamTest);
  8177. smalltalk.addMethod(
  8178. smalltalk.method({
  8179. selector: "testReading",
  8180. protocol: 'tests',
  8181. fn: function (){
  8182. var self=this;
  8183. var stream,collection;
  8184. return smalltalk.withContext(function($ctx1) {
  8185. var $1,$2,$3;
  8186. collection=self._newCollection();
  8187. stream=self._newStream();
  8188. $1=stream;
  8189. _st($1)._nextPutAll_(collection);
  8190. $2=_st($1)._position_((0));
  8191. _st(collection)._do_((function(each){
  8192. return smalltalk.withContext(function($ctx2) {
  8193. $3=_st(stream)._next();
  8194. $ctx2.sendIdx["next"]=1;
  8195. return self._assert_equals_($3,each);
  8196. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8197. self._assert_(_st(_st(stream)._next())._isNil());
  8198. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)})},
  8199. args: [],
  8200. 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",
  8201. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8202. referencedClasses: []
  8203. }),
  8204. globals.StreamTest);
  8205. smalltalk.addMethod(
  8206. smalltalk.method({
  8207. selector: "testStreamContents",
  8208. protocol: 'tests',
  8209. fn: function (){
  8210. var self=this;
  8211. return self},
  8212. args: [],
  8213. source: "testStreamContents",
  8214. messageSends: [],
  8215. referencedClasses: []
  8216. }),
  8217. globals.StreamTest);
  8218. smalltalk.addMethod(
  8219. smalltalk.method({
  8220. selector: "testWrite",
  8221. protocol: 'tests',
  8222. fn: function (){
  8223. var self=this;
  8224. var stream,collection;
  8225. return smalltalk.withContext(function($ctx1) {
  8226. collection=self._newCollection();
  8227. stream=self._newStream();
  8228. _st(collection)._do_((function(each){
  8229. return smalltalk.withContext(function($ctx2) {
  8230. return _st(stream).__lt_lt(each);
  8231. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8232. self._assert_equals_(_st(stream)._contents(),collection);
  8233. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)})},
  8234. args: [],
  8235. 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",
  8236. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8237. referencedClasses: []
  8238. }),
  8239. globals.StreamTest);
  8240. smalltalk.addMethod(
  8241. smalltalk.method({
  8242. selector: "testWriting",
  8243. protocol: 'tests',
  8244. fn: function (){
  8245. var self=this;
  8246. var stream,collection;
  8247. return smalltalk.withContext(function($ctx1) {
  8248. var $1;
  8249. collection=self._newCollection();
  8250. stream=self._newStream();
  8251. $ctx1.sendIdx["newStream"]=1;
  8252. _st(collection)._do_((function(each){
  8253. return smalltalk.withContext(function($ctx2) {
  8254. return _st(stream)._nextPut_(each);
  8255. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8256. $1=_st(stream)._contents();
  8257. $ctx1.sendIdx["contents"]=1;
  8258. self._assert_equals_($1,collection);
  8259. $ctx1.sendIdx["assert:equals:"]=1;
  8260. stream=self._newStream();
  8261. _st(stream)._nextPutAll_(collection);
  8262. self._assert_equals_(_st(stream)._contents(),collection);
  8263. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)})},
  8264. args: [],
  8265. 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",
  8266. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8267. referencedClasses: []
  8268. }),
  8269. globals.StreamTest);
  8270. smalltalk.addMethod(
  8271. smalltalk.method({
  8272. selector: "collectionClass",
  8273. protocol: 'accessing',
  8274. fn: function (){
  8275. var self=this;
  8276. return nil;
  8277. },
  8278. args: [],
  8279. source: "collectionClass\x0a\x09^ nil",
  8280. messageSends: [],
  8281. referencedClasses: []
  8282. }),
  8283. globals.StreamTest.klass);
  8284. smalltalk.addMethod(
  8285. smalltalk.method({
  8286. selector: "isAbstract",
  8287. protocol: 'testing',
  8288. fn: function (){
  8289. var self=this;
  8290. return smalltalk.withContext(function($ctx1) {
  8291. var $1;
  8292. $1=_st(self._collectionClass())._isNil();
  8293. return $1;
  8294. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)})},
  8295. args: [],
  8296. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8297. messageSends: ["isNil", "collectionClass"],
  8298. referencedClasses: []
  8299. }),
  8300. globals.StreamTest.klass);
  8301. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8302. smalltalk.addMethod(
  8303. smalltalk.method({
  8304. selector: "newCollection",
  8305. protocol: 'accessing',
  8306. fn: function (){
  8307. var self=this;
  8308. return smalltalk.withContext(function($ctx1) {
  8309. var $1;
  8310. $1=[true,(1),(3).__at((4)),"foo"];
  8311. return $1;
  8312. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)})},
  8313. args: [],
  8314. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8315. messageSends: ["@"],
  8316. referencedClasses: []
  8317. }),
  8318. globals.ArrayStreamTest);
  8319. smalltalk.addMethod(
  8320. smalltalk.method({
  8321. selector: "collectionClass",
  8322. protocol: 'accessing',
  8323. fn: function (){
  8324. var self=this;
  8325. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8326. return $Array();
  8327. },
  8328. args: [],
  8329. source: "collectionClass\x0a\x09^ Array",
  8330. messageSends: [],
  8331. referencedClasses: ["Array"]
  8332. }),
  8333. globals.ArrayStreamTest.klass);
  8334. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8335. smalltalk.addMethod(
  8336. smalltalk.method({
  8337. selector: "newCollection",
  8338. protocol: 'accessing',
  8339. fn: function (){
  8340. var self=this;
  8341. return "hello world";
  8342. },
  8343. args: [],
  8344. source: "newCollection\x0a\x09^ 'hello world'",
  8345. messageSends: [],
  8346. referencedClasses: []
  8347. }),
  8348. globals.StringStreamTest);
  8349. smalltalk.addMethod(
  8350. smalltalk.method({
  8351. selector: "collectionClass",
  8352. protocol: 'accessing',
  8353. fn: function (){
  8354. var self=this;
  8355. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8356. return $String();
  8357. },
  8358. args: [],
  8359. source: "collectionClass\x0a\x09^ String",
  8360. messageSends: [],
  8361. referencedClasses: ["String"]
  8362. }),
  8363. globals.StringStreamTest.klass);
  8364. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  8365. smalltalk.addMethod(
  8366. smalltalk.method({
  8367. selector: "testCopying",
  8368. protocol: 'tests',
  8369. fn: function (){
  8370. var self=this;
  8371. return smalltalk.withContext(function($ctx1) {
  8372. self._assert_equals_(nil._copy(),nil);
  8373. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)})},
  8374. args: [],
  8375. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8376. messageSends: ["assert:equals:", "copy"],
  8377. referencedClasses: []
  8378. }),
  8379. globals.UndefinedTest);
  8380. smalltalk.addMethod(
  8381. smalltalk.method({
  8382. selector: "testDeepCopy",
  8383. protocol: 'tests',
  8384. fn: function (){
  8385. var self=this;
  8386. return smalltalk.withContext(function($ctx1) {
  8387. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8388. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)})},
  8389. args: [],
  8390. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8391. messageSends: ["assert:", "=", "deepCopy"],
  8392. referencedClasses: []
  8393. }),
  8394. globals.UndefinedTest);
  8395. smalltalk.addMethod(
  8396. smalltalk.method({
  8397. selector: "testIfNil",
  8398. protocol: 'tests',
  8399. fn: function (){
  8400. var self=this;
  8401. return smalltalk.withContext(function($ctx1) {
  8402. var $1,$3,$2,$4,$6,$5;
  8403. if(($receiver = nil) == nil || $receiver == null){
  8404. $1=true;
  8405. } else {
  8406. $1=nil;
  8407. };
  8408. self._assert_equals_($1,true);
  8409. $ctx1.sendIdx["assert:equals:"]=1;
  8410. if(($receiver = nil) == nil || $receiver == null){
  8411. $3=nil;
  8412. } else {
  8413. $3=true;
  8414. };
  8415. $2=_st($3).__eq(true);
  8416. $ctx1.sendIdx["="]=1;
  8417. self._deny_($2);
  8418. $ctx1.sendIdx["deny:"]=1;
  8419. if(($receiver = nil) == nil || $receiver == null){
  8420. $4=true;
  8421. } else {
  8422. $4=false;
  8423. };
  8424. self._assert_equals_($4,true);
  8425. if(($receiver = nil) == nil || $receiver == null){
  8426. $6=false;
  8427. } else {
  8428. $6=true;
  8429. };
  8430. $5=_st($6).__eq(true);
  8431. self._deny_($5);
  8432. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)})},
  8433. args: [],
  8434. 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",
  8435. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8436. referencedClasses: []
  8437. }),
  8438. globals.UndefinedTest);
  8439. smalltalk.addMethod(
  8440. smalltalk.method({
  8441. selector: "testIsNil",
  8442. protocol: 'tests',
  8443. fn: function (){
  8444. var self=this;
  8445. return smalltalk.withContext(function($ctx1) {
  8446. self._assert_(nil._isNil());
  8447. self._deny_(nil._notNil());
  8448. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)})},
  8449. args: [],
  8450. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8451. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8452. referencedClasses: []
  8453. }),
  8454. globals.UndefinedTest);
  8455. });