Kernel-Tests.js 326 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899
  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: 'tests',
  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: "testOnDoFor",
  78. protocol: 'tests',
  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,$3,$4;
  86. counter=(0);
  87. announcer=_st($Announcer())._new();
  88. $ctx1.sendIdx["new"]=1;
  89. _st(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  90. return smalltalk.withContext(function($ctx2) {
  91. counter=_st(counter).__plus((1));
  92. return counter;
  93. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),self);
  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. $3=announcer;
  102. $4=_st($SystemAnnouncement())._new();
  103. $ctx1.sendIdx["new"]=3;
  104. _st($3)._announce_($4);
  105. $ctx1.sendIdx["announce:"]=2;
  106. self._assert_equals_(counter,(2));
  107. $ctx1.sendIdx["assert:equals:"]=2;
  108. _st(announcer)._unsubscribe_(self);
  109. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  110. self._assert_equals_(counter,(2));
  111. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  112. args: [],
  113. source: "testOnDoFor\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ] for: self.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.\x0a\x09\x0a\x09announcer unsubscribe: self.\x0a\x09\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  114. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"],
  115. referencedClasses: ["Announcer", "SystemAnnouncement"]
  116. }),
  117. globals.AnnouncerTest);
  118. smalltalk.addMethod(
  119. smalltalk.method({
  120. selector: "testOnDoOnce",
  121. protocol: 'tests',
  122. fn: function (){
  123. var self=this;
  124. var counter,announcer;
  125. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  126. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  127. return smalltalk.withContext(function($ctx1) {
  128. var $1,$2;
  129. counter=(0);
  130. announcer=_st($Announcer())._new();
  131. $ctx1.sendIdx["new"]=1;
  132. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  133. return smalltalk.withContext(function($ctx2) {
  134. counter=_st(counter).__plus((1));
  135. return counter;
  136. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  137. $1=announcer;
  138. $2=_st($SystemAnnouncement())._new();
  139. $ctx1.sendIdx["new"]=2;
  140. _st($1)._announce_($2);
  141. $ctx1.sendIdx["announce:"]=1;
  142. self._assert_equals_(counter,(1));
  143. $ctx1.sendIdx["assert:equals:"]=1;
  144. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  145. self._assert_equals_(counter,(1));
  146. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  147. args: [],
  148. 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.",
  149. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  150. referencedClasses: ["Announcer", "SystemAnnouncement"]
  151. }),
  152. globals.AnnouncerTest);
  153. smalltalk.addClass('BlockClosureTest', globals.TestCase, [], 'Kernel-Tests');
  154. smalltalk.addMethod(
  155. smalltalk.method({
  156. selector: "testCanClearInterval",
  157. protocol: 'tests',
  158. fn: function (){
  159. var self=this;
  160. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  161. return smalltalk.withContext(function($ctx1) {
  162. self._shouldnt_raise_((function(){
  163. return smalltalk.withContext(function($ctx2) {
  164. return _st(_st((function(){
  165. return smalltalk.withContext(function($ctx3) {
  166. return _st(_st($Error())._new())._signal();
  167. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  169. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},globals.BlockClosureTest)})},
  170. args: [],
  171. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  172. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  173. referencedClasses: ["Error"]
  174. }),
  175. globals.BlockClosureTest);
  176. smalltalk.addMethod(
  177. smalltalk.method({
  178. selector: "testCanClearTimeout",
  179. protocol: 'tests',
  180. fn: function (){
  181. var self=this;
  182. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  183. return smalltalk.withContext(function($ctx1) {
  184. self._shouldnt_raise_((function(){
  185. return smalltalk.withContext(function($ctx2) {
  186. return _st(_st((function(){
  187. return smalltalk.withContext(function($ctx3) {
  188. return _st(_st($Error())._new())._signal();
  189. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  191. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},globals.BlockClosureTest)})},
  192. args: [],
  193. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  194. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  195. referencedClasses: ["Error"]
  196. }),
  197. globals.BlockClosureTest);
  198. smalltalk.addMethod(
  199. smalltalk.method({
  200. selector: "testCompiledSource",
  201. protocol: 'tests',
  202. fn: function (){
  203. var self=this;
  204. return smalltalk.withContext(function($ctx1) {
  205. self._assert_(_st(_st((function(){
  206. return smalltalk.withContext(function($ctx2) {
  207. return (1).__plus((1));
  208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  209. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},globals.BlockClosureTest)})},
  210. args: [],
  211. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  212. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  213. referencedClasses: []
  214. }),
  215. globals.BlockClosureTest);
  216. smalltalk.addMethod(
  217. smalltalk.method({
  218. selector: "testCurrySelf",
  219. protocol: 'tests',
  220. fn: function (){
  221. var self=this;
  222. var curriedMethod,array;
  223. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  224. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  225. return smalltalk.withContext(function($ctx1) {
  226. curriedMethod=_st(_st((function(selfarg,x){
  227. return smalltalk.withContext(function($ctx2) {
  228. return _st(selfarg)._at_(x);
  229. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  230. array=[(3), (1), (4)];
  231. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  232. _st((function(){
  233. return smalltalk.withContext(function($ctx2) {
  234. return self._assert_equals_(_st(array)._foo_((2)),(1));
  235. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  236. return smalltalk.withContext(function($ctx2) {
  237. return _st($Array())._removeCompiledMethod_(curriedMethod);
  238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  239. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},globals.BlockClosureTest)})},
  240. args: [],
  241. 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 ]",
  242. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  243. referencedClasses: ["ClassBuilder", "Array"]
  244. }),
  245. globals.BlockClosureTest);
  246. smalltalk.addMethod(
  247. smalltalk.method({
  248. selector: "testEnsure",
  249. protocol: 'tests',
  250. fn: function (){
  251. var self=this;
  252. return smalltalk.withContext(function($ctx1) {
  253. self._assert_equals_(_st((function(){
  254. return (3);
  255. }))._ensure_((function(){
  256. return (4);
  257. })),(3));
  258. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},globals.BlockClosureTest)})},
  259. args: [],
  260. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  261. messageSends: ["assert:equals:", "ensure:"],
  262. referencedClasses: []
  263. }),
  264. globals.BlockClosureTest);
  265. smalltalk.addMethod(
  266. smalltalk.method({
  267. selector: "testEnsureRaises",
  268. protocol: 'tests',
  269. fn: function (){
  270. var self=this;
  271. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  272. return smalltalk.withContext(function($ctx1) {
  273. self._should_raise_((function(){
  274. return smalltalk.withContext(function($ctx2) {
  275. return _st((function(){
  276. return smalltalk.withContext(function($ctx3) {
  277. return _st(_st($Error())._new())._signal();
  278. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  279. return true;
  280. }));
  281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  282. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},globals.BlockClosureTest)})},
  283. args: [],
  284. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  285. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  286. referencedClasses: ["Error"]
  287. }),
  288. globals.BlockClosureTest);
  289. smalltalk.addMethod(
  290. smalltalk.method({
  291. selector: "testExceptionSemantics",
  292. protocol: 'tests',
  293. fn: function (){
  294. var self=this;
  295. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  296. return smalltalk.withContext(function($ctx1) {
  297. self._timeout_((100));
  298. _st(self._async_((function(){
  299. return smalltalk.withContext(function($ctx2) {
  300. return _st((function(){
  301. return smalltalk.withContext(function($ctx3) {
  302. self._assert_(true);
  303. _st($Error())._signal();
  304. self._deny_(true);
  305. return self._finished();
  306. $ctx3.sendIdx["finished"]=1;
  307. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  308. return smalltalk.withContext(function($ctx3) {
  309. return self._finished();
  310. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  312. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},globals.BlockClosureTest)})},
  313. args: [],
  314. 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",
  315. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  316. referencedClasses: ["Error"]
  317. }),
  318. globals.BlockClosureTest);
  319. smalltalk.addMethod(
  320. smalltalk.method({
  321. selector: "testNewWithValues",
  322. protocol: 'tests',
  323. fn: function (){
  324. var self=this;
  325. return smalltalk.withContext(function($ctx1) {
  326. function TestConstructor(arg1, arg2, arg3) {}
  327. TestConstructor.prototype.name = 'theTestPrototype';
  328. var wrappedConstructor = _st(TestConstructor);
  329. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  330. self._assert_(result instanceof TestConstructor);
  331. self._assert_equals_(result.name, 'theTestPrototype');
  332. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  333. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);;
  334. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},globals.BlockClosureTest)})},
  335. args: [],
  336. 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>",
  337. messageSends: [],
  338. referencedClasses: []
  339. }),
  340. globals.BlockClosureTest);
  341. smalltalk.addMethod(
  342. smalltalk.method({
  343. selector: "testNumArgs",
  344. protocol: 'tests',
  345. fn: function (){
  346. var self=this;
  347. return smalltalk.withContext(function($ctx1) {
  348. var $1;
  349. $1=_st((function(){
  350. }))._numArgs();
  351. $ctx1.sendIdx["numArgs"]=1;
  352. self._assert_equals_($1,(0));
  353. $ctx1.sendIdx["assert:equals:"]=1;
  354. self._assert_equals_(_st((function(a,b){
  355. }))._numArgs(),(2));
  356. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},globals.BlockClosureTest)})},
  357. args: [],
  358. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  359. messageSends: ["assert:equals:", "numArgs"],
  360. referencedClasses: []
  361. }),
  362. globals.BlockClosureTest);
  363. smalltalk.addMethod(
  364. smalltalk.method({
  365. selector: "testOnDo",
  366. protocol: 'tests',
  367. fn: function (){
  368. var self=this;
  369. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  370. return smalltalk.withContext(function($ctx1) {
  371. self._assert_(_st((function(){
  372. return smalltalk.withContext(function($ctx2) {
  373. return _st(_st($Error())._new())._signal();
  374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  375. return true;
  376. })));
  377. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},globals.BlockClosureTest)})},
  378. args: [],
  379. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  380. messageSends: ["assert:", "on:do:", "signal", "new"],
  381. referencedClasses: ["Error"]
  382. }),
  383. globals.BlockClosureTest);
  384. smalltalk.addMethod(
  385. smalltalk.method({
  386. selector: "testValue",
  387. protocol: 'tests',
  388. fn: function (){
  389. var self=this;
  390. return smalltalk.withContext(function($ctx1) {
  391. var $1;
  392. $1=_st((function(){
  393. return smalltalk.withContext(function($ctx2) {
  394. return (1).__plus((1));
  395. $ctx2.sendIdx["+"]=1;
  396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  397. $ctx1.sendIdx["value"]=1;
  398. self._assert_equals_($1,(2));
  399. $ctx1.sendIdx["assert:equals:"]=1;
  400. self._assert_equals_(_st((function(x){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(x).__plus((1));
  403. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  404. $ctx1.sendIdx["assert:equals:"]=2;
  405. self._assert_equals_(_st((function(x,y){
  406. return smalltalk.withContext(function($ctx2) {
  407. return _st(x).__star(y);
  408. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  409. $ctx1.sendIdx["assert:equals:"]=3;
  410. self._assert_equals_(_st((function(a,b,c){
  411. return (1);
  412. }))._value(),(1));
  413. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.BlockClosureTest)})},
  414. args: [],
  415. 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",
  416. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  417. referencedClasses: []
  418. }),
  419. globals.BlockClosureTest);
  420. smalltalk.addMethod(
  421. smalltalk.method({
  422. selector: "testValueWithPossibleArguments",
  423. protocol: 'tests',
  424. fn: function (){
  425. var self=this;
  426. return smalltalk.withContext(function($ctx1) {
  427. var $1,$2;
  428. $1=_st((function(){
  429. return (1);
  430. }))._valueWithPossibleArguments_([(3), (4)]);
  431. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  432. self._assert_equals_($1,(1));
  433. $ctx1.sendIdx["assert:equals:"]=1;
  434. $2=_st((function(a){
  435. return smalltalk.withContext(function($ctx2) {
  436. return _st(a).__plus((4));
  437. $ctx2.sendIdx["+"]=1;
  438. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  439. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  440. self._assert_equals_($2,(7));
  441. $ctx1.sendIdx["assert:equals:"]=2;
  442. self._assert_equals_(_st((function(a,b){
  443. return smalltalk.withContext(function($ctx2) {
  444. return _st(a).__plus(b);
  445. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  446. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},globals.BlockClosureTest)})},
  447. args: [],
  448. 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.",
  449. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  450. referencedClasses: []
  451. }),
  452. globals.BlockClosureTest);
  453. smalltalk.addMethod(
  454. smalltalk.method({
  455. selector: "testWhileFalse",
  456. protocol: 'tests',
  457. fn: function (){
  458. var self=this;
  459. var i;
  460. return smalltalk.withContext(function($ctx1) {
  461. i=(0);
  462. _st((function(){
  463. return smalltalk.withContext(function($ctx2) {
  464. return _st(i).__gt((5));
  465. $ctx2.sendIdx[">"]=1;
  466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  467. return smalltalk.withContext(function($ctx2) {
  468. i=_st(i).__plus((1));
  469. $ctx2.sendIdx["+"]=1;
  470. return i;
  471. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  472. self._assert_equals_(i,(6));
  473. $ctx1.sendIdx["assert:equals:"]=1;
  474. i=(0);
  475. _st((function(){
  476. return smalltalk.withContext(function($ctx2) {
  477. i=_st(i).__plus((1));
  478. i;
  479. return _st(i).__gt((5));
  480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  481. self._assert_equals_(i,(6));
  482. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},globals.BlockClosureTest)})},
  483. args: [],
  484. 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",
  485. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  486. referencedClasses: []
  487. }),
  488. globals.BlockClosureTest);
  489. smalltalk.addMethod(
  490. smalltalk.method({
  491. selector: "testWhileTrue",
  492. protocol: 'tests',
  493. fn: function (){
  494. var self=this;
  495. var i;
  496. return smalltalk.withContext(function($ctx1) {
  497. i=(0);
  498. _st((function(){
  499. return smalltalk.withContext(function($ctx2) {
  500. return _st(i).__lt((5));
  501. $ctx2.sendIdx["<"]=1;
  502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  503. return smalltalk.withContext(function($ctx2) {
  504. i=_st(i).__plus((1));
  505. $ctx2.sendIdx["+"]=1;
  506. return i;
  507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  508. self._assert_equals_(i,(5));
  509. $ctx1.sendIdx["assert:equals:"]=1;
  510. i=(0);
  511. _st((function(){
  512. return smalltalk.withContext(function($ctx2) {
  513. i=_st(i).__plus((1));
  514. i;
  515. return _st(i).__lt((5));
  516. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  517. self._assert_equals_(i,(5));
  518. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},globals.BlockClosureTest)})},
  519. args: [],
  520. 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",
  521. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  522. referencedClasses: []
  523. }),
  524. globals.BlockClosureTest);
  525. smalltalk.addClass('BooleanTest', globals.TestCase, [], 'Kernel-Tests');
  526. smalltalk.addMethod(
  527. smalltalk.method({
  528. selector: "testEquality",
  529. protocol: 'tests',
  530. fn: function (){
  531. var self=this;
  532. return smalltalk.withContext(function($ctx1) {
  533. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  534. $1=(0).__eq(false);
  535. $ctx1.sendIdx["="]=1;
  536. self._deny_($1);
  537. $ctx1.sendIdx["deny:"]=1;
  538. $2=false.__eq((0));
  539. $ctx1.sendIdx["="]=2;
  540. self._deny_($2);
  541. $ctx1.sendIdx["deny:"]=2;
  542. $3="".__eq(false);
  543. $ctx1.sendIdx["="]=3;
  544. self._deny_($3);
  545. $ctx1.sendIdx["deny:"]=3;
  546. $4=false.__eq("");
  547. $ctx1.sendIdx["="]=4;
  548. self._deny_($4);
  549. $ctx1.sendIdx["deny:"]=4;
  550. $5=true.__eq(true);
  551. $ctx1.sendIdx["="]=5;
  552. self._assert_($5);
  553. $ctx1.sendIdx["assert:"]=1;
  554. $6=false.__eq(true);
  555. $ctx1.sendIdx["="]=6;
  556. self._deny_($6);
  557. $ctx1.sendIdx["deny:"]=5;
  558. $7=true.__eq(false);
  559. $ctx1.sendIdx["="]=7;
  560. self._deny_($7);
  561. $8=false.__eq(false);
  562. $ctx1.sendIdx["="]=8;
  563. self._assert_($8);
  564. $ctx1.sendIdx["assert:"]=2;
  565. $10=true._yourself();
  566. $ctx1.sendIdx["yourself"]=1;
  567. $9=_st($10).__eq(true);
  568. $ctx1.sendIdx["="]=9;
  569. self._assert_($9);
  570. $ctx1.sendIdx["assert:"]=3;
  571. $12=true._yourself();
  572. $ctx1.sendIdx["yourself"]=2;
  573. $11=_st($12).__eq(true._yourself());
  574. self._assert_($11);
  575. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.BooleanTest)})},
  576. args: [],
  577. 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)",
  578. messageSends: ["deny:", "=", "assert:", "yourself"],
  579. referencedClasses: []
  580. }),
  581. globals.BooleanTest);
  582. smalltalk.addMethod(
  583. smalltalk.method({
  584. selector: "testIdentity",
  585. protocol: 'tests',
  586. fn: function (){
  587. var self=this;
  588. return smalltalk.withContext(function($ctx1) {
  589. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  590. $1=(0).__eq_eq(false);
  591. $ctx1.sendIdx["=="]=1;
  592. self._deny_($1);
  593. $ctx1.sendIdx["deny:"]=1;
  594. $2=false.__eq_eq((0));
  595. $ctx1.sendIdx["=="]=2;
  596. self._deny_($2);
  597. $ctx1.sendIdx["deny:"]=2;
  598. $3="".__eq_eq(false);
  599. $ctx1.sendIdx["=="]=3;
  600. self._deny_($3);
  601. $ctx1.sendIdx["deny:"]=3;
  602. $4=false.__eq_eq("");
  603. $ctx1.sendIdx["=="]=4;
  604. self._deny_($4);
  605. $ctx1.sendIdx["deny:"]=4;
  606. $5=true.__eq_eq(true);
  607. $ctx1.sendIdx["=="]=5;
  608. self._assert_($5);
  609. $ctx1.sendIdx["assert:"]=1;
  610. $6=false.__eq_eq(true);
  611. $ctx1.sendIdx["=="]=6;
  612. self._deny_($6);
  613. $ctx1.sendIdx["deny:"]=5;
  614. $7=true.__eq_eq(false);
  615. $ctx1.sendIdx["=="]=7;
  616. self._deny_($7);
  617. $8=false.__eq_eq(false);
  618. $ctx1.sendIdx["=="]=8;
  619. self._assert_($8);
  620. $ctx1.sendIdx["assert:"]=2;
  621. $10=true._yourself();
  622. $ctx1.sendIdx["yourself"]=1;
  623. $9=_st($10).__eq_eq(true);
  624. $ctx1.sendIdx["=="]=9;
  625. self._assert_($9);
  626. $ctx1.sendIdx["assert:"]=3;
  627. $12=true._yourself();
  628. $ctx1.sendIdx["yourself"]=2;
  629. $11=_st($12).__eq_eq(true._yourself());
  630. self._assert_($11);
  631. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.BooleanTest)})},
  632. args: [],
  633. 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",
  634. messageSends: ["deny:", "==", "assert:", "yourself"],
  635. referencedClasses: []
  636. }),
  637. globals.BooleanTest);
  638. smalltalk.addMethod(
  639. smalltalk.method({
  640. selector: "testIfTrueIfFalse",
  641. protocol: 'tests',
  642. fn: function (){
  643. var self=this;
  644. return smalltalk.withContext(function($ctx1) {
  645. var $1,$2,$3,$4,$5,$6,$7,$8;
  646. if(smalltalk.assert(true)){
  647. $1="alternative block";
  648. };
  649. self._assert_equals_($1,"alternative block");
  650. $ctx1.sendIdx["assert:equals:"]=1;
  651. if(! smalltalk.assert(true)){
  652. $2="alternative block";
  653. };
  654. self._assert_equals_($2,nil);
  655. $ctx1.sendIdx["assert:equals:"]=2;
  656. if(smalltalk.assert(false)){
  657. $3="alternative block";
  658. };
  659. self._assert_equals_($3,nil);
  660. $ctx1.sendIdx["assert:equals:"]=3;
  661. if(! smalltalk.assert(false)){
  662. $4="alternative block";
  663. };
  664. self._assert_equals_($4,"alternative block");
  665. $ctx1.sendIdx["assert:equals:"]=4;
  666. if(smalltalk.assert(false)){
  667. $5="alternative block";
  668. } else {
  669. $5="alternative block2";
  670. };
  671. self._assert_equals_($5,"alternative block2");
  672. $ctx1.sendIdx["assert:equals:"]=5;
  673. if(smalltalk.assert(false)){
  674. $6="alternative block2";
  675. } else {
  676. $6="alternative block";
  677. };
  678. self._assert_equals_($6,"alternative block");
  679. $ctx1.sendIdx["assert:equals:"]=6;
  680. if(smalltalk.assert(true)){
  681. $7="alternative block";
  682. } else {
  683. $7="alternative block2";
  684. };
  685. self._assert_equals_($7,"alternative block");
  686. $ctx1.sendIdx["assert:equals:"]=7;
  687. if(smalltalk.assert(true)){
  688. $8="alternative block2";
  689. } else {
  690. $8="alternative block";
  691. };
  692. self._assert_equals_($8,"alternative block2");
  693. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},globals.BooleanTest)})},
  694. args: [],
  695. 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'.",
  696. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  697. referencedClasses: []
  698. }),
  699. globals.BooleanTest);
  700. smalltalk.addMethod(
  701. smalltalk.method({
  702. selector: "testIfTrueIfFalseWithBoxing",
  703. protocol: 'tests',
  704. fn: function (){
  705. var self=this;
  706. return smalltalk.withContext(function($ctx1) {
  707. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  708. $2=true._yourself();
  709. $ctx1.sendIdx["yourself"]=1;
  710. if(smalltalk.assert($2)){
  711. $1="alternative block";
  712. };
  713. self._assert_equals_($1,"alternative block");
  714. $ctx1.sendIdx["assert:equals:"]=1;
  715. $4=true._yourself();
  716. $ctx1.sendIdx["yourself"]=2;
  717. if(! smalltalk.assert($4)){
  718. $3="alternative block";
  719. };
  720. self._assert_equals_($3,nil);
  721. $ctx1.sendIdx["assert:equals:"]=2;
  722. $6=false._yourself();
  723. $ctx1.sendIdx["yourself"]=3;
  724. if(smalltalk.assert($6)){
  725. $5="alternative block";
  726. };
  727. self._assert_equals_($5,nil);
  728. $ctx1.sendIdx["assert:equals:"]=3;
  729. $8=false._yourself();
  730. $ctx1.sendIdx["yourself"]=4;
  731. if(! smalltalk.assert($8)){
  732. $7="alternative block";
  733. };
  734. self._assert_equals_($7,"alternative block");
  735. $ctx1.sendIdx["assert:equals:"]=4;
  736. $10=false._yourself();
  737. $ctx1.sendIdx["yourself"]=5;
  738. if(smalltalk.assert($10)){
  739. $9="alternative block";
  740. } else {
  741. $9="alternative block2";
  742. };
  743. self._assert_equals_($9,"alternative block2");
  744. $ctx1.sendIdx["assert:equals:"]=5;
  745. $12=false._yourself();
  746. $ctx1.sendIdx["yourself"]=6;
  747. if(smalltalk.assert($12)){
  748. $11="alternative block2";
  749. } else {
  750. $11="alternative block";
  751. };
  752. self._assert_equals_($11,"alternative block");
  753. $ctx1.sendIdx["assert:equals:"]=6;
  754. $14=true._yourself();
  755. $ctx1.sendIdx["yourself"]=7;
  756. if(smalltalk.assert($14)){
  757. $13="alternative block";
  758. } else {
  759. $13="alternative block2";
  760. };
  761. self._assert_equals_($13,"alternative block");
  762. $ctx1.sendIdx["assert:equals:"]=7;
  763. $16=true._yourself();
  764. if(smalltalk.assert($16)){
  765. $15="alternative block2";
  766. } else {
  767. $15="alternative block";
  768. };
  769. self._assert_equals_($15,"alternative block2");
  770. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},globals.BooleanTest)})},
  771. args: [],
  772. 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'.",
  773. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  774. referencedClasses: []
  775. }),
  776. globals.BooleanTest);
  777. smalltalk.addMethod(
  778. smalltalk.method({
  779. selector: "testLogic",
  780. protocol: 'tests',
  781. fn: function (){
  782. var self=this;
  783. return smalltalk.withContext(function($ctx1) {
  784. 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;
  785. $1=true.__and(true);
  786. $ctx1.sendIdx["&"]=1;
  787. self._assert_($1);
  788. $ctx1.sendIdx["assert:"]=1;
  789. $2=true.__and(false);
  790. $ctx1.sendIdx["&"]=2;
  791. self._deny_($2);
  792. $ctx1.sendIdx["deny:"]=1;
  793. $3=false.__and(true);
  794. $ctx1.sendIdx["&"]=3;
  795. self._deny_($3);
  796. $ctx1.sendIdx["deny:"]=2;
  797. $5=false.__and(false);
  798. $ctx1.sendIdx["&"]=4;
  799. $4=self._deny_($5);
  800. $ctx1.sendIdx["deny:"]=3;
  801. $6=true.__or(true);
  802. $ctx1.sendIdx["|"]=1;
  803. self._assert_($6);
  804. $ctx1.sendIdx["assert:"]=2;
  805. $7=true.__or(false);
  806. $ctx1.sendIdx["|"]=2;
  807. self._assert_($7);
  808. $ctx1.sendIdx["assert:"]=3;
  809. $8=false.__or(true);
  810. $ctx1.sendIdx["|"]=3;
  811. self._assert_($8);
  812. $ctx1.sendIdx["assert:"]=4;
  813. $10=false.__or(false);
  814. $ctx1.sendIdx["|"]=4;
  815. $9=self._deny_($10);
  816. $ctx1.sendIdx["deny:"]=4;
  817. $12=(1).__gt((0));
  818. $ctx1.sendIdx[">"]=1;
  819. $11=true.__and($12);
  820. $ctx1.sendIdx["&"]=5;
  821. self._assert_($11);
  822. $ctx1.sendIdx["assert:"]=5;
  823. $14=(1).__gt((0));
  824. $ctx1.sendIdx[">"]=2;
  825. $13=_st($14).__and(false);
  826. $ctx1.sendIdx["&"]=6;
  827. self._deny_($13);
  828. $ctx1.sendIdx["deny:"]=5;
  829. $17=(1).__gt((0));
  830. $ctx1.sendIdx[">"]=3;
  831. $18=(1).__gt((2));
  832. $ctx1.sendIdx[">"]=4;
  833. $16=_st($17).__and($18);
  834. $15=self._deny_($16);
  835. $20=(1).__gt((0));
  836. $ctx1.sendIdx[">"]=5;
  837. $19=false.__or($20);
  838. $ctx1.sendIdx["|"]=5;
  839. self._assert_($19);
  840. $ctx1.sendIdx["assert:"]=6;
  841. $22=(1).__gt((0));
  842. $ctx1.sendIdx[">"]=6;
  843. $21=_st($22).__or(false);
  844. $ctx1.sendIdx["|"]=6;
  845. self._assert_($21);
  846. $ctx1.sendIdx["assert:"]=7;
  847. $25=(1).__gt((0));
  848. $ctx1.sendIdx[">"]=7;
  849. $24=_st($25).__or((1).__gt((2)));
  850. $23=self._assert_($24);
  851. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},globals.BooleanTest)})},
  852. args: [],
  853. 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))",
  854. messageSends: ["assert:", "&", "deny:", "|", ">"],
  855. referencedClasses: []
  856. }),
  857. globals.BooleanTest);
  858. smalltalk.addMethod(
  859. smalltalk.method({
  860. selector: "testLogicKeywords",
  861. protocol: 'tests',
  862. fn: function (){
  863. var self=this;
  864. return smalltalk.withContext(function($ctx1) {
  865. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  866. $1=true._and_((function(){
  867. return true;
  868. }));
  869. $ctx1.sendIdx["and:"]=1;
  870. self._assert_($1);
  871. $ctx1.sendIdx["assert:"]=1;
  872. $2=true._and_((function(){
  873. return false;
  874. }));
  875. $ctx1.sendIdx["and:"]=2;
  876. self._deny_($2);
  877. $ctx1.sendIdx["deny:"]=1;
  878. $3=false._and_((function(){
  879. return true;
  880. }));
  881. $ctx1.sendIdx["and:"]=3;
  882. self._deny_($3);
  883. $ctx1.sendIdx["deny:"]=2;
  884. $5=false._and_((function(){
  885. return false;
  886. }));
  887. $ctx1.sendIdx["and:"]=4;
  888. $4=self._deny_($5);
  889. $ctx1.sendIdx["deny:"]=3;
  890. $6=true._or_((function(){
  891. return true;
  892. }));
  893. $ctx1.sendIdx["or:"]=1;
  894. self._assert_($6);
  895. $ctx1.sendIdx["assert:"]=2;
  896. $7=true._or_((function(){
  897. return false;
  898. }));
  899. $ctx1.sendIdx["or:"]=2;
  900. self._assert_($7);
  901. $ctx1.sendIdx["assert:"]=3;
  902. $8=false._or_((function(){
  903. return true;
  904. }));
  905. $ctx1.sendIdx["or:"]=3;
  906. self._assert_($8);
  907. $ctx1.sendIdx["assert:"]=4;
  908. $10=false._or_((function(){
  909. return false;
  910. }));
  911. $ctx1.sendIdx["or:"]=4;
  912. $9=self._deny_($10);
  913. $ctx1.sendIdx["deny:"]=4;
  914. $11=true._and_((function(){
  915. return smalltalk.withContext(function($ctx2) {
  916. return (1).__gt((0));
  917. $ctx2.sendIdx[">"]=1;
  918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  919. $ctx1.sendIdx["and:"]=5;
  920. self._assert_($11);
  921. $ctx1.sendIdx["assert:"]=5;
  922. $13=(1).__gt((0));
  923. $ctx1.sendIdx[">"]=2;
  924. $12=_st($13)._and_((function(){
  925. return false;
  926. }));
  927. $ctx1.sendIdx["and:"]=6;
  928. self._deny_($12);
  929. $ctx1.sendIdx["deny:"]=5;
  930. $16=(1).__gt((0));
  931. $ctx1.sendIdx[">"]=3;
  932. $15=_st($16)._and_((function(){
  933. return smalltalk.withContext(function($ctx2) {
  934. return (1).__gt((2));
  935. $ctx2.sendIdx[">"]=4;
  936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  937. $14=self._deny_($15);
  938. $17=false._or_((function(){
  939. return smalltalk.withContext(function($ctx2) {
  940. return (1).__gt((0));
  941. $ctx2.sendIdx[">"]=5;
  942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  943. $ctx1.sendIdx["or:"]=5;
  944. self._assert_($17);
  945. $ctx1.sendIdx["assert:"]=6;
  946. $19=(1).__gt((0));
  947. $ctx1.sendIdx[">"]=6;
  948. $18=_st($19)._or_((function(){
  949. return false;
  950. }));
  951. $ctx1.sendIdx["or:"]=6;
  952. self._assert_($18);
  953. $ctx1.sendIdx["assert:"]=7;
  954. $22=(1).__gt((0));
  955. $ctx1.sendIdx[">"]=7;
  956. $21=_st($22)._or_((function(){
  957. return smalltalk.withContext(function($ctx2) {
  958. return (1).__gt((2));
  959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  960. $20=self._assert_($21);
  961. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},globals.BooleanTest)})},
  962. args: [],
  963. 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 ])",
  964. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  965. referencedClasses: []
  966. }),
  967. globals.BooleanTest);
  968. smalltalk.addMethod(
  969. smalltalk.method({
  970. selector: "testNonBooleanError",
  971. protocol: 'tests',
  972. fn: function (){
  973. var self=this;
  974. function $NonBooleanReceiver(){return globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  975. return smalltalk.withContext(function($ctx1) {
  976. self._should_raise_((function(){
  977. return smalltalk.withContext(function($ctx2) {
  978. if(smalltalk.assert("")){
  979. } else {
  980. };
  981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  982. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},globals.BooleanTest)})},
  983. args: [],
  984. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  985. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  986. referencedClasses: ["NonBooleanReceiver"]
  987. }),
  988. globals.BooleanTest);
  989. smalltalk.addClass('ClassBuilderTest', globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  990. smalltalk.addMethod(
  991. smalltalk.method({
  992. selector: "setUp",
  993. protocol: 'running',
  994. fn: function (){
  995. var self=this;
  996. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  997. return smalltalk.withContext(function($ctx1) {
  998. self["@builder"]=_st($ClassBuilder())._new();
  999. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ClassBuilderTest)})},
  1000. args: [],
  1001. source: "setUp\x0a\x09builder := ClassBuilder new",
  1002. messageSends: ["new"],
  1003. referencedClasses: ["ClassBuilder"]
  1004. }),
  1005. globals.ClassBuilderTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "tearDown",
  1009. protocol: 'running',
  1010. fn: function (){
  1011. var self=this;
  1012. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1013. return smalltalk.withContext(function($ctx1) {
  1014. var $1,$receiver;
  1015. $1=self["@theClass"];
  1016. if(($receiver = $1) == null || $receiver.isNil){
  1017. $1;
  1018. } else {
  1019. _st($Smalltalk())._removeClass_(self["@theClass"]);
  1020. self["@theClass"]=nil;
  1021. self["@theClass"];
  1022. };
  1023. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.ClassBuilderTest)})},
  1024. args: [],
  1025. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  1026. messageSends: ["ifNotNil:", "removeClass:"],
  1027. referencedClasses: ["Smalltalk"]
  1028. }),
  1029. globals.ClassBuilderTest);
  1030. smalltalk.addMethod(
  1031. smalltalk.method({
  1032. selector: "testClassCopy",
  1033. protocol: 'tests',
  1034. fn: function (){
  1035. var self=this;
  1036. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1037. return smalltalk.withContext(function($ctx1) {
  1038. var $2,$1,$4,$3,$6,$5,$8,$7;
  1039. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1040. $2=_st(self["@theClass"])._superclass();
  1041. $ctx1.sendIdx["superclass"]=1;
  1042. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1043. $ctx1.sendIdx["=="]=1;
  1044. self._assert_($1);
  1045. $ctx1.sendIdx["assert:"]=1;
  1046. $4=_st(self["@theClass"])._instanceVariableNames();
  1047. $ctx1.sendIdx["instanceVariableNames"]=1;
  1048. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1049. $ctx1.sendIdx["=="]=2;
  1050. self._assert_($3);
  1051. $ctx1.sendIdx["assert:"]=2;
  1052. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1053. $ctx1.sendIdx["assert:equals:"]=1;
  1054. $6=_st(self["@theClass"])._package();
  1055. $ctx1.sendIdx["package"]=1;
  1056. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1057. self._assert_($5);
  1058. $8=_st(self["@theClass"])._methodDictionary();
  1059. $ctx1.sendIdx["methodDictionary"]=1;
  1060. $7=_st($8)._keys();
  1061. $ctx1.sendIdx["keys"]=1;
  1062. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1063. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},globals.ClassBuilderTest)})},
  1064. args: [],
  1065. 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",
  1066. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1067. referencedClasses: ["ObjectMock"]
  1068. }),
  1069. globals.ClassBuilderTest);
  1070. smalltalk.addMethod(
  1071. smalltalk.method({
  1072. selector: "testClassMigration",
  1073. protocol: 'tests',
  1074. fn: function (){
  1075. var self=this;
  1076. var instance,oldClass;
  1077. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1078. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1079. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1080. return smalltalk.withContext(function($ctx1) {
  1081. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  1082. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1083. $2=_st($Smalltalk())._globals();
  1084. $ctx1.sendIdx["globals"]=1;
  1085. $1=_st($2)._at_("ObjectMock2");
  1086. $ctx1.sendIdx["at:"]=1;
  1087. instance=_st($1)._new();
  1088. $4=_st($Smalltalk())._globals();
  1089. $ctx1.sendIdx["globals"]=2;
  1090. $3=_st($4)._at_("ObjectMock2");
  1091. $ctx1.sendIdx["at:"]=2;
  1092. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1093. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1094. $ctx1.sendIdx["=="]=1;
  1095. self._deny_($5);
  1096. $ctx1.sendIdx["deny:"]=1;
  1097. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1098. $ctx1.sendIdx["=="]=2;
  1099. self._assert_($6);
  1100. $ctx1.sendIdx["assert:"]=1;
  1101. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1102. $ctx1.sendIdx["assert:"]=2;
  1103. $7=_st($ObjectMock2())._selectors();
  1104. $ctx1.sendIdx["selectors"]=1;
  1105. self._assert_equals_($7,_st(oldClass)._selectors());
  1106. $ctx1.sendIdx["assert:equals:"]=1;
  1107. $8=_st($ObjectMock2())._comment();
  1108. $ctx1.sendIdx["comment"]=1;
  1109. self._assert_equals_($8,_st(oldClass)._comment());
  1110. $ctx1.sendIdx["assert:equals:"]=2;
  1111. $9=_st(_st($ObjectMock2())._package())._name();
  1112. $ctx1.sendIdx["name"]=1;
  1113. self._assert_equals_($9,"Kernel-Tests");
  1114. $11=_st(instance)._class();
  1115. $ctx1.sendIdx["class"]=1;
  1116. $10=_st($11).__eq_eq($ObjectMock2());
  1117. self._deny_($10);
  1118. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  1119. _st($Smalltalk())._removeClass_($ObjectMock2());
  1120. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},globals.ClassBuilderTest)})},
  1121. args: [],
  1122. 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",
  1123. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1124. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1125. }),
  1126. globals.ClassBuilderTest);
  1127. smalltalk.addMethod(
  1128. smalltalk.method({
  1129. selector: "testClassMigrationWithClassInstanceVariables",
  1130. protocol: 'tests',
  1131. fn: function (){
  1132. var self=this;
  1133. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1134. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1135. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1136. return smalltalk.withContext(function($ctx1) {
  1137. var $1;
  1138. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1139. $1=_st($ObjectMock2())._class();
  1140. $ctx1.sendIdx["class"]=1;
  1141. _st($1)._instanceVariableNames_("foo bar");
  1142. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1143. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1144. _st($Smalltalk())._removeClass_($ObjectMock2());
  1145. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},globals.ClassBuilderTest)})},
  1146. args: [],
  1147. 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",
  1148. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1149. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1150. }),
  1151. globals.ClassBuilderTest);
  1152. smalltalk.addMethod(
  1153. smalltalk.method({
  1154. selector: "testClassMigrationWithSubclasses",
  1155. protocol: 'tests',
  1156. fn: function (){
  1157. var self=this;
  1158. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1159. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1160. function $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1161. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1162. function $ObjectMock4(){return globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1163. return smalltalk.withContext(function($ctx1) {
  1164. var $2,$1,$4,$3;
  1165. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1166. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1167. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1168. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1169. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1170. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1171. $2=_st($ObjectMock())._subclasses();
  1172. $ctx1.sendIdx["subclasses"]=1;
  1173. $1=_st($2)._includes_($ObjectMock2());
  1174. $ctx1.sendIdx["includes:"]=1;
  1175. self._assert_($1);
  1176. $ctx1.sendIdx["assert:"]=1;
  1177. $4=_st($ObjectMock2())._subclasses();
  1178. $ctx1.sendIdx["subclasses"]=2;
  1179. $3=_st($4)._includes_($ObjectMock3());
  1180. $ctx1.sendIdx["includes:"]=2;
  1181. self._assert_($3);
  1182. $ctx1.sendIdx["assert:"]=2;
  1183. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1184. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1185. return smalltalk.withContext(function($ctx2) {
  1186. return _st($Smalltalk())._removeClass_(each);
  1187. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1188. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},globals.ClassBuilderTest)})},
  1189. args: [],
  1190. 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 ]",
  1191. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1192. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1193. }),
  1194. globals.ClassBuilderTest);
  1195. smalltalk.addMethod(
  1196. smalltalk.method({
  1197. selector: "testInstanceVariableNames",
  1198. protocol: 'tests',
  1199. fn: function (){
  1200. var self=this;
  1201. return smalltalk.withContext(function($ctx1) {
  1202. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1203. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},globals.ClassBuilderTest)})},
  1204. args: [],
  1205. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1206. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1207. referencedClasses: []
  1208. }),
  1209. globals.ClassBuilderTest);
  1210. smalltalk.addClass('CollectionTest', globals.TestCase, [], 'Kernel-Tests');
  1211. smalltalk.addMethod(
  1212. smalltalk.method({
  1213. selector: "assertSameContents:as:",
  1214. protocol: 'convenience',
  1215. fn: function (aCollection,anotherCollection){
  1216. var self=this;
  1217. return smalltalk.withContext(function($ctx1) {
  1218. var $2,$1,$4,$3;
  1219. $2=_st(aCollection)._size();
  1220. $ctx1.sendIdx["size"]=1;
  1221. $1=_st($2).__eq(_st(anotherCollection)._size());
  1222. $ctx1.sendIdx["="]=1;
  1223. self._assert_($1);
  1224. $ctx1.sendIdx["assert:"]=1;
  1225. _st(aCollection)._do_((function(each){
  1226. return smalltalk.withContext(function($ctx2) {
  1227. $4=_st(aCollection)._occurrencesOf_(each);
  1228. $ctx2.sendIdx["occurrencesOf:"]=1;
  1229. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1230. return self._assert_($3);
  1231. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1232. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},globals.CollectionTest)})},
  1233. args: ["aCollection", "anotherCollection"],
  1234. 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)) ]",
  1235. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1236. referencedClasses: []
  1237. }),
  1238. globals.CollectionTest);
  1239. smalltalk.addMethod(
  1240. smalltalk.method({
  1241. selector: "collection",
  1242. protocol: 'fixture',
  1243. fn: function (){
  1244. var self=this;
  1245. return smalltalk.withContext(function($ctx1) {
  1246. self._subclassResponsibility();
  1247. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},globals.CollectionTest)})},
  1248. args: [],
  1249. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1250. messageSends: ["subclassResponsibility"],
  1251. referencedClasses: []
  1252. }),
  1253. globals.CollectionTest);
  1254. smalltalk.addMethod(
  1255. smalltalk.method({
  1256. selector: "collectionClass",
  1257. protocol: 'fixture',
  1258. fn: function (){
  1259. var self=this;
  1260. return smalltalk.withContext(function($ctx1) {
  1261. var $1;
  1262. $1=_st(self._class())._collectionClass();
  1263. return $1;
  1264. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.CollectionTest)})},
  1265. args: [],
  1266. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1267. messageSends: ["collectionClass", "class"],
  1268. referencedClasses: []
  1269. }),
  1270. globals.CollectionTest);
  1271. smalltalk.addMethod(
  1272. smalltalk.method({
  1273. selector: "collectionOfPrintStrings",
  1274. protocol: 'fixture',
  1275. fn: function (){
  1276. var self=this;
  1277. return smalltalk.withContext(function($ctx1) {
  1278. self._subclassResponsibility();
  1279. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.CollectionTest)})},
  1280. args: [],
  1281. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1282. messageSends: ["subclassResponsibility"],
  1283. referencedClasses: []
  1284. }),
  1285. globals.CollectionTest);
  1286. smalltalk.addMethod(
  1287. smalltalk.method({
  1288. selector: "collectionSize",
  1289. protocol: 'fixture',
  1290. fn: function (){
  1291. var self=this;
  1292. return smalltalk.withContext(function($ctx1) {
  1293. self._subclassResponsibility();
  1294. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},globals.CollectionTest)})},
  1295. args: [],
  1296. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1297. messageSends: ["subclassResponsibility"],
  1298. referencedClasses: []
  1299. }),
  1300. globals.CollectionTest);
  1301. smalltalk.addMethod(
  1302. smalltalk.method({
  1303. selector: "collectionWithDuplicates",
  1304. protocol: 'fixture',
  1305. fn: function (){
  1306. var self=this;
  1307. return smalltalk.withContext(function($ctx1) {
  1308. self._subclassResponsibility();
  1309. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.CollectionTest)})},
  1310. args: [],
  1311. 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",
  1312. messageSends: ["subclassResponsibility"],
  1313. referencedClasses: []
  1314. }),
  1315. globals.CollectionTest);
  1316. smalltalk.addMethod(
  1317. smalltalk.method({
  1318. selector: "collectionWithNewValue",
  1319. protocol: 'fixture',
  1320. fn: function (){
  1321. var self=this;
  1322. return smalltalk.withContext(function($ctx1) {
  1323. self._subclassResponsibility();
  1324. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.CollectionTest)})},
  1325. args: [],
  1326. 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",
  1327. messageSends: ["subclassResponsibility"],
  1328. referencedClasses: []
  1329. }),
  1330. globals.CollectionTest);
  1331. smalltalk.addMethod(
  1332. smalltalk.method({
  1333. selector: "isCollectionReadOnly",
  1334. protocol: 'testing',
  1335. fn: function (){
  1336. var self=this;
  1337. return false;
  1338. },
  1339. args: [],
  1340. source: "isCollectionReadOnly\x0a\x09^ false",
  1341. messageSends: [],
  1342. referencedClasses: []
  1343. }),
  1344. globals.CollectionTest);
  1345. smalltalk.addMethod(
  1346. smalltalk.method({
  1347. selector: "sampleNewValue",
  1348. protocol: 'fixture',
  1349. fn: function (){
  1350. var self=this;
  1351. return "N";
  1352. },
  1353. args: [],
  1354. 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'",
  1355. messageSends: [],
  1356. referencedClasses: []
  1357. }),
  1358. globals.CollectionTest);
  1359. smalltalk.addMethod(
  1360. smalltalk.method({
  1361. selector: "sampleNewValueAsCollection",
  1362. protocol: 'fixture',
  1363. fn: function (){
  1364. var self=this;
  1365. return smalltalk.withContext(function($ctx1) {
  1366. var $1;
  1367. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1368. return $1;
  1369. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)})},
  1370. args: [],
  1371. 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",
  1372. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1373. referencedClasses: []
  1374. }),
  1375. globals.CollectionTest);
  1376. smalltalk.addMethod(
  1377. smalltalk.method({
  1378. selector: "testAddAll",
  1379. protocol: 'tests',
  1380. fn: function (){
  1381. var self=this;
  1382. return smalltalk.withContext(function($ctx1) {
  1383. 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;
  1384. $2=self._collection();
  1385. $ctx1.sendIdx["collection"]=1;
  1386. $3=$2;
  1387. $5=self._collectionClass();
  1388. $ctx1.sendIdx["collectionClass"]=1;
  1389. $4=_st($5)._new();
  1390. $ctx1.sendIdx["new"]=1;
  1391. _st($3)._addAll_($4);
  1392. $ctx1.sendIdx["addAll:"]=1;
  1393. $6=_st($2)._yourself();
  1394. $ctx1.sendIdx["yourself"]=1;
  1395. $1=$6;
  1396. $7=self._collection();
  1397. $ctx1.sendIdx["collection"]=2;
  1398. self._assert_equals_($1,$7);
  1399. $ctx1.sendIdx["assert:equals:"]=1;
  1400. $10=self._collectionClass();
  1401. $ctx1.sendIdx["collectionClass"]=2;
  1402. $9=_st($10)._new();
  1403. $ctx1.sendIdx["new"]=2;
  1404. $11=$9;
  1405. $12=self._collection();
  1406. $ctx1.sendIdx["collection"]=3;
  1407. _st($11)._addAll_($12);
  1408. $ctx1.sendIdx["addAll:"]=2;
  1409. $13=_st($9)._yourself();
  1410. $ctx1.sendIdx["yourself"]=2;
  1411. $8=$13;
  1412. $14=self._collection();
  1413. $ctx1.sendIdx["collection"]=4;
  1414. self._assert_equals_($8,$14);
  1415. $ctx1.sendIdx["assert:equals:"]=2;
  1416. $17=self._collectionClass();
  1417. $ctx1.sendIdx["collectionClass"]=3;
  1418. $16=_st($17)._new();
  1419. $ctx1.sendIdx["new"]=3;
  1420. $18=$16;
  1421. $20=self._collectionClass();
  1422. $ctx1.sendIdx["collectionClass"]=4;
  1423. $19=_st($20)._new();
  1424. $ctx1.sendIdx["new"]=4;
  1425. _st($18)._addAll_($19);
  1426. $ctx1.sendIdx["addAll:"]=3;
  1427. $21=_st($16)._yourself();
  1428. $ctx1.sendIdx["yourself"]=3;
  1429. $15=$21;
  1430. self._assert_equals_($15,_st(self._collectionClass())._new());
  1431. $ctx1.sendIdx["assert:equals:"]=3;
  1432. $23=self._collection();
  1433. $ctx1.sendIdx["collection"]=5;
  1434. $24=$23;
  1435. $25=self._sampleNewValueAsCollection();
  1436. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1437. _st($24)._addAll_($25);
  1438. $ctx1.sendIdx["addAll:"]=4;
  1439. $26=_st($23)._yourself();
  1440. $ctx1.sendIdx["yourself"]=4;
  1441. $22=$26;
  1442. $27=self._collectionWithNewValue();
  1443. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1444. self._assert_equals_($22,$27);
  1445. $28=self._sampleNewValueAsCollection();
  1446. _st($28)._addAll_(self._collection());
  1447. $29=_st($28)._yourself();
  1448. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1449. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)})},
  1450. args: [],
  1451. 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",
  1452. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1453. referencedClasses: []
  1454. }),
  1455. globals.CollectionTest);
  1456. smalltalk.addMethod(
  1457. smalltalk.method({
  1458. selector: "testAllSatisfy",
  1459. protocol: 'tests',
  1460. fn: function (){
  1461. var self=this;
  1462. var collection,anyOne;
  1463. return smalltalk.withContext(function($ctx1) {
  1464. var $1;
  1465. collection=self._collection();
  1466. anyOne=_st(collection)._anyOne();
  1467. $1=_st(collection)._allSatisfy_((function(each){
  1468. return smalltalk.withContext(function($ctx2) {
  1469. return _st(collection)._includes_(each);
  1470. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1471. $ctx1.sendIdx["allSatisfy:"]=1;
  1472. self._assert_($1);
  1473. self._deny_(_st(collection)._allSatisfy_((function(each){
  1474. return smalltalk.withContext(function($ctx2) {
  1475. return _st(each).__tild_eq(anyOne);
  1476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1477. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)})},
  1478. args: [],
  1479. 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 ])",
  1480. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1481. referencedClasses: []
  1482. }),
  1483. globals.CollectionTest);
  1484. smalltalk.addMethod(
  1485. smalltalk.method({
  1486. selector: "testAnyOne",
  1487. protocol: 'tests',
  1488. fn: function (){
  1489. var self=this;
  1490. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1491. return smalltalk.withContext(function($ctx1) {
  1492. var $2,$1;
  1493. self._should_raise_((function(){
  1494. return smalltalk.withContext(function($ctx2) {
  1495. return _st(_st(self._collectionClass())._new())._anyOne();
  1496. $ctx2.sendIdx["anyOne"]=1;
  1497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1498. $2=self._collection();
  1499. $ctx1.sendIdx["collection"]=1;
  1500. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1501. self._assert_($1);
  1502. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)})},
  1503. args: [],
  1504. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1505. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1506. referencedClasses: ["Error"]
  1507. }),
  1508. globals.CollectionTest);
  1509. smalltalk.addMethod(
  1510. smalltalk.method({
  1511. selector: "testAnySatisfy",
  1512. protocol: 'tests',
  1513. fn: function (){
  1514. var self=this;
  1515. var anyOne;
  1516. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1517. return smalltalk.withContext(function($ctx1) {
  1518. var $1,$3,$2;
  1519. $1=self._collection();
  1520. $ctx1.sendIdx["collection"]=1;
  1521. anyOne=_st($1)._anyOne();
  1522. $3=self._collection();
  1523. $ctx1.sendIdx["collection"]=2;
  1524. $2=_st($3)._anySatisfy_((function(each){
  1525. return smalltalk.withContext(function($ctx2) {
  1526. return _st(each).__eq(anyOne);
  1527. $ctx2.sendIdx["="]=1;
  1528. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1529. $ctx1.sendIdx["anySatisfy:"]=1;
  1530. self._assert_($2);
  1531. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1532. return smalltalk.withContext(function($ctx2) {
  1533. return _st(each).__eq(_st($Object())._new());
  1534. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1535. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  1536. args: [],
  1537. 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 ])",
  1538. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1539. referencedClasses: ["Object"]
  1540. }),
  1541. globals.CollectionTest);
  1542. smalltalk.addMethod(
  1543. smalltalk.method({
  1544. selector: "testAsArray",
  1545. protocol: 'tests',
  1546. fn: function (){
  1547. var self=this;
  1548. return smalltalk.withContext(function($ctx1) {
  1549. var $1;
  1550. $1=self._collection();
  1551. $ctx1.sendIdx["collection"]=1;
  1552. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1553. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)})},
  1554. args: [],
  1555. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1556. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1557. referencedClasses: []
  1558. }),
  1559. globals.CollectionTest);
  1560. smalltalk.addMethod(
  1561. smalltalk.method({
  1562. selector: "testAsOrderedCollection",
  1563. protocol: 'tests',
  1564. fn: function (){
  1565. var self=this;
  1566. return smalltalk.withContext(function($ctx1) {
  1567. var $1;
  1568. $1=self._collection();
  1569. $ctx1.sendIdx["collection"]=1;
  1570. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1571. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)})},
  1572. args: [],
  1573. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1574. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1575. referencedClasses: []
  1576. }),
  1577. globals.CollectionTest);
  1578. smalltalk.addMethod(
  1579. smalltalk.method({
  1580. selector: "testAsSet",
  1581. protocol: 'tests',
  1582. fn: function (){
  1583. var self=this;
  1584. var c,set;
  1585. return smalltalk.withContext(function($ctx1) {
  1586. c=self._collectionWithDuplicates();
  1587. set=_st(c)._asSet();
  1588. self._assert_equals_(_st(set)._size(),(5));
  1589. _st(c)._do_((function(each){
  1590. return smalltalk.withContext(function($ctx2) {
  1591. return self._assert_(_st(set)._includes_(each));
  1592. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1593. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)})},
  1594. args: [],
  1595. 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) ]",
  1596. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1597. referencedClasses: []
  1598. }),
  1599. globals.CollectionTest);
  1600. smalltalk.addMethod(
  1601. smalltalk.method({
  1602. selector: "testCollect",
  1603. protocol: 'tests',
  1604. fn: function (){
  1605. var self=this;
  1606. return smalltalk.withContext(function($ctx1) {
  1607. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1608. $2=self._collection();
  1609. $ctx1.sendIdx["collection"]=1;
  1610. $1=_st($2)._collect_((function(each){
  1611. return each;
  1612. }));
  1613. $ctx1.sendIdx["collect:"]=1;
  1614. $3=self._collection();
  1615. $ctx1.sendIdx["collection"]=2;
  1616. self._assert_equals_($1,$3);
  1617. $ctx1.sendIdx["assert:equals:"]=1;
  1618. $5=self._collectionWithNewValue();
  1619. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1620. $4=_st($5)._collect_((function(each){
  1621. return each;
  1622. }));
  1623. $ctx1.sendIdx["collect:"]=2;
  1624. self._assert_equals_($4,self._collectionWithNewValue());
  1625. $ctx1.sendIdx["assert:equals:"]=2;
  1626. $8=self._collectionClass();
  1627. $ctx1.sendIdx["collectionClass"]=1;
  1628. $7=_st($8)._new();
  1629. $ctx1.sendIdx["new"]=1;
  1630. $6=_st($7)._collect_((function(each){
  1631. return smalltalk.withContext(function($ctx2) {
  1632. return _st(each)._printString();
  1633. $ctx2.sendIdx["printString"]=1;
  1634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1635. $ctx1.sendIdx["collect:"]=3;
  1636. self._assert_equals_($6,_st(self._collectionClass())._new());
  1637. $ctx1.sendIdx["assert:equals:"]=3;
  1638. $11=self._collection();
  1639. $ctx1.sendIdx["collection"]=3;
  1640. $10=_st($11)._collect_((function(){
  1641. return smalltalk.withContext(function($ctx2) {
  1642. return self._sampleNewValue();
  1643. $ctx2.sendIdx["sampleNewValue"]=1;
  1644. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1645. $ctx1.sendIdx["collect:"]=4;
  1646. $9=_st($10)._detect_((function(){
  1647. return true;
  1648. }));
  1649. self._assert_equals_($9,self._sampleNewValue());
  1650. $ctx1.sendIdx["assert:equals:"]=4;
  1651. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1652. return smalltalk.withContext(function($ctx2) {
  1653. return _st(each)._printString();
  1654. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1655. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)})},
  1656. args: [],
  1657. 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",
  1658. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1659. referencedClasses: []
  1660. }),
  1661. globals.CollectionTest);
  1662. smalltalk.addMethod(
  1663. smalltalk.method({
  1664. selector: "testComma",
  1665. protocol: 'tests',
  1666. fn: function (){
  1667. var self=this;
  1668. return smalltalk.withContext(function($ctx1) {
  1669. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1670. $2=self._collection();
  1671. $ctx1.sendIdx["collection"]=1;
  1672. $4=self._collectionClass();
  1673. $ctx1.sendIdx["collectionClass"]=1;
  1674. $3=_st($4)._new();
  1675. $ctx1.sendIdx["new"]=1;
  1676. $1=_st($2).__comma($3);
  1677. $ctx1.sendIdx[","]=1;
  1678. $5=self._collection();
  1679. $ctx1.sendIdx["collection"]=2;
  1680. self._assert_equals_($1,$5);
  1681. $ctx1.sendIdx["assert:equals:"]=1;
  1682. $8=self._collectionClass();
  1683. $ctx1.sendIdx["collectionClass"]=2;
  1684. $7=_st($8)._new();
  1685. $ctx1.sendIdx["new"]=2;
  1686. $9=self._collection();
  1687. $ctx1.sendIdx["collection"]=3;
  1688. $6=_st($7).__comma($9);
  1689. $ctx1.sendIdx[","]=2;
  1690. $10=self._collection();
  1691. $ctx1.sendIdx["collection"]=4;
  1692. self._assert_equals_($6,$10);
  1693. $ctx1.sendIdx["assert:equals:"]=2;
  1694. $13=self._collectionClass();
  1695. $ctx1.sendIdx["collectionClass"]=3;
  1696. $12=_st($13)._new();
  1697. $ctx1.sendIdx["new"]=3;
  1698. $15=self._collectionClass();
  1699. $ctx1.sendIdx["collectionClass"]=4;
  1700. $14=_st($15)._new();
  1701. $ctx1.sendIdx["new"]=4;
  1702. $11=_st($12).__comma($14);
  1703. $ctx1.sendIdx[","]=3;
  1704. self._assert_equals_($11,_st(self._collectionClass())._new());
  1705. $ctx1.sendIdx["assert:equals:"]=3;
  1706. $17=self._collection();
  1707. $ctx1.sendIdx["collection"]=5;
  1708. $18=self._sampleNewValueAsCollection();
  1709. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1710. $16=_st($17).__comma($18);
  1711. $ctx1.sendIdx[","]=4;
  1712. $19=self._collectionWithNewValue();
  1713. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1714. self._assert_equals_($16,$19);
  1715. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1716. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)})},
  1717. args: [],
  1718. 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",
  1719. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1720. referencedClasses: []
  1721. }),
  1722. globals.CollectionTest);
  1723. smalltalk.addMethod(
  1724. smalltalk.method({
  1725. selector: "testDetect",
  1726. protocol: 'tests',
  1727. fn: function (){
  1728. var self=this;
  1729. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1730. return smalltalk.withContext(function($ctx1) {
  1731. var $1,$2,$3,$4,$6,$5,$7;
  1732. self._shouldnt_raise_((function(){
  1733. return smalltalk.withContext(function($ctx2) {
  1734. $1=self._collection();
  1735. $ctx2.sendIdx["collection"]=1;
  1736. return _st($1)._detect_((function(){
  1737. return true;
  1738. }));
  1739. $ctx2.sendIdx["detect:"]=1;
  1740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1741. self._should_raise_((function(){
  1742. return smalltalk.withContext(function($ctx2) {
  1743. $2=self._collection();
  1744. $ctx2.sendIdx["collection"]=2;
  1745. return _st($2)._detect_((function(){
  1746. return false;
  1747. }));
  1748. $ctx2.sendIdx["detect:"]=2;
  1749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1750. $ctx1.sendIdx["should:raise:"]=1;
  1751. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1752. return true;
  1753. }));
  1754. $ctx1.sendIdx["detect:"]=3;
  1755. $4=self._sampleNewValue();
  1756. $ctx1.sendIdx["sampleNewValue"]=1;
  1757. self._assert_equals_($3,$4);
  1758. $ctx1.sendIdx["assert:equals:"]=1;
  1759. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1760. return smalltalk.withContext(function($ctx2) {
  1761. $6=self._sampleNewValue();
  1762. $ctx2.sendIdx["sampleNewValue"]=2;
  1763. return _st(each).__eq($6);
  1764. $ctx2.sendIdx["="]=1;
  1765. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1766. $ctx1.sendIdx["detect:"]=4;
  1767. $7=self._sampleNewValue();
  1768. $ctx1.sendIdx["sampleNewValue"]=3;
  1769. self._assert_equals_($5,$7);
  1770. self._should_raise_((function(){
  1771. return smalltalk.withContext(function($ctx2) {
  1772. return _st(self._collection())._detect_((function(each){
  1773. return smalltalk.withContext(function($ctx3) {
  1774. return _st(each).__eq(self._sampleNewValue());
  1775. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1777. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)})},
  1778. args: [],
  1779. 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",
  1780. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1781. referencedClasses: ["Error"]
  1782. }),
  1783. globals.CollectionTest);
  1784. smalltalk.addMethod(
  1785. smalltalk.method({
  1786. selector: "testDetectIfNone",
  1787. protocol: 'tests',
  1788. fn: function (){
  1789. var self=this;
  1790. var sentinel;
  1791. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1792. return smalltalk.withContext(function($ctx1) {
  1793. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1794. sentinel=_st($Object())._new();
  1795. $3=self._collection();
  1796. $ctx1.sendIdx["collection"]=1;
  1797. $2=_st($3)._detect_ifNone_((function(){
  1798. return true;
  1799. }),(function(){
  1800. return sentinel;
  1801. }));
  1802. $ctx1.sendIdx["detect:ifNone:"]=1;
  1803. $1=_st($2).__tild_eq(sentinel);
  1804. self._assert_($1);
  1805. $5=self._collection();
  1806. $ctx1.sendIdx["collection"]=2;
  1807. $4=_st($5)._detect_ifNone_((function(){
  1808. return false;
  1809. }),(function(){
  1810. return sentinel;
  1811. }));
  1812. $ctx1.sendIdx["detect:ifNone:"]=2;
  1813. self._assert_equals_($4,sentinel);
  1814. $ctx1.sendIdx["assert:equals:"]=1;
  1815. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1816. return true;
  1817. }),(function(){
  1818. return sentinel;
  1819. }));
  1820. $ctx1.sendIdx["detect:ifNone:"]=3;
  1821. $7=self._sampleNewValue();
  1822. $ctx1.sendIdx["sampleNewValue"]=1;
  1823. self._assert_equals_($6,$7);
  1824. $ctx1.sendIdx["assert:equals:"]=2;
  1825. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1826. return smalltalk.withContext(function($ctx2) {
  1827. $9=self._sampleNewValue();
  1828. $ctx2.sendIdx["sampleNewValue"]=2;
  1829. return _st(each).__eq($9);
  1830. $ctx2.sendIdx["="]=1;
  1831. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1832. return sentinel;
  1833. }));
  1834. $ctx1.sendIdx["detect:ifNone:"]=4;
  1835. $10=self._sampleNewValue();
  1836. $ctx1.sendIdx["sampleNewValue"]=3;
  1837. self._assert_equals_($8,$10);
  1838. $ctx1.sendIdx["assert:equals:"]=3;
  1839. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1840. return smalltalk.withContext(function($ctx2) {
  1841. return _st(each).__eq(self._sampleNewValue());
  1842. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1843. return sentinel;
  1844. })),sentinel);
  1845. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)})},
  1846. args: [],
  1847. 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",
  1848. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1849. referencedClasses: ["Object"]
  1850. }),
  1851. globals.CollectionTest);
  1852. smalltalk.addMethod(
  1853. smalltalk.method({
  1854. selector: "testDo",
  1855. protocol: 'tests',
  1856. fn: function (){
  1857. var self=this;
  1858. var newCollection;
  1859. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1860. return smalltalk.withContext(function($ctx1) {
  1861. var $1,$2;
  1862. newCollection=_st($OrderedCollection())._new();
  1863. $ctx1.sendIdx["new"]=1;
  1864. $1=self._collection();
  1865. $ctx1.sendIdx["collection"]=1;
  1866. _st($1)._do_((function(each){
  1867. return smalltalk.withContext(function($ctx2) {
  1868. return _st(newCollection)._add_(each);
  1869. $ctx2.sendIdx["add:"]=1;
  1870. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1871. $ctx1.sendIdx["do:"]=1;
  1872. self._assertSameContents_as_(self._collection(),newCollection);
  1873. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1874. newCollection=_st($OrderedCollection())._new();
  1875. $2=self._collectionWithDuplicates();
  1876. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1877. _st($2)._do_((function(each){
  1878. return smalltalk.withContext(function($ctx2) {
  1879. return _st(newCollection)._add_(each);
  1880. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1881. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1882. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)})},
  1883. args: [],
  1884. 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",
  1885. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1886. referencedClasses: ["OrderedCollection"]
  1887. }),
  1888. globals.CollectionTest);
  1889. smalltalk.addMethod(
  1890. smalltalk.method({
  1891. selector: "testIfEmptyFamily",
  1892. protocol: 'tests',
  1893. fn: function (){
  1894. var self=this;
  1895. return smalltalk.withContext(function($ctx1) {
  1896. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1897. $3=self._collectionClass();
  1898. $ctx1.sendIdx["collectionClass"]=1;
  1899. $2=_st($3)._new();
  1900. $ctx1.sendIdx["new"]=1;
  1901. $1=_st($2)._ifEmpty_((function(){
  1902. return (42);
  1903. }));
  1904. $ctx1.sendIdx["ifEmpty:"]=1;
  1905. self._assert_equals_($1,(42));
  1906. $ctx1.sendIdx["assert:equals:"]=1;
  1907. $5=self._collection();
  1908. $ctx1.sendIdx["collection"]=1;
  1909. $4=_st($5)._ifEmpty_((function(){
  1910. return (42);
  1911. }));
  1912. $6=self._collection();
  1913. $ctx1.sendIdx["collection"]=2;
  1914. self._assert_equals_($4,$6);
  1915. $ctx1.sendIdx["assert:equals:"]=2;
  1916. $9=self._collectionClass();
  1917. $ctx1.sendIdx["collectionClass"]=2;
  1918. $8=_st($9)._new();
  1919. $ctx1.sendIdx["new"]=2;
  1920. $7=_st($8)._ifNotEmpty_((function(){
  1921. return (42);
  1922. }));
  1923. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1924. $11=self._collectionClass();
  1925. $ctx1.sendIdx["collectionClass"]=3;
  1926. $10=_st($11)._new();
  1927. $ctx1.sendIdx["new"]=3;
  1928. self._assert_equals_($7,$10);
  1929. $ctx1.sendIdx["assert:equals:"]=3;
  1930. $13=self._collection();
  1931. $ctx1.sendIdx["collection"]=3;
  1932. $12=_st($13)._ifNotEmpty_((function(){
  1933. return (42);
  1934. }));
  1935. self._assert_equals_($12,(42));
  1936. $ctx1.sendIdx["assert:equals:"]=4;
  1937. $16=self._collectionClass();
  1938. $ctx1.sendIdx["collectionClass"]=4;
  1939. $15=_st($16)._new();
  1940. $ctx1.sendIdx["new"]=4;
  1941. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1942. return (42);
  1943. }),(function(){
  1944. return (999);
  1945. }));
  1946. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1947. self._assert_equals_($14,(42));
  1948. $ctx1.sendIdx["assert:equals:"]=5;
  1949. $18=self._collection();
  1950. $ctx1.sendIdx["collection"]=4;
  1951. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1952. return (42);
  1953. }),(function(){
  1954. return (999);
  1955. }));
  1956. self._assert_equals_($17,(999));
  1957. $ctx1.sendIdx["assert:equals:"]=6;
  1958. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1959. return (42);
  1960. }),(function(){
  1961. return (999);
  1962. }));
  1963. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1964. self._assert_equals_($19,(999));
  1965. $ctx1.sendIdx["assert:equals:"]=7;
  1966. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1967. return (42);
  1968. }),(function(){
  1969. return (999);
  1970. })),(42));
  1971. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)})},
  1972. args: [],
  1973. 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",
  1974. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1975. referencedClasses: []
  1976. }),
  1977. globals.CollectionTest);
  1978. smalltalk.addMethod(
  1979. smalltalk.method({
  1980. selector: "testIsEmpty",
  1981. protocol: 'tests',
  1982. fn: function (){
  1983. var self=this;
  1984. return smalltalk.withContext(function($ctx1) {
  1985. var $1;
  1986. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1987. $ctx1.sendIdx["isEmpty"]=1;
  1988. self._assert_($1);
  1989. self._deny_(_st(self._collection())._isEmpty());
  1990. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)})},
  1991. args: [],
  1992. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1993. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1994. referencedClasses: []
  1995. }),
  1996. globals.CollectionTest);
  1997. smalltalk.addMethod(
  1998. smalltalk.method({
  1999. selector: "testNoneSatisfy",
  2000. protocol: 'tests',
  2001. fn: function (){
  2002. var self=this;
  2003. var anyOne;
  2004. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2005. return smalltalk.withContext(function($ctx1) {
  2006. var $1,$3,$2;
  2007. $1=self._collection();
  2008. $ctx1.sendIdx["collection"]=1;
  2009. anyOne=_st($1)._anyOne();
  2010. $3=self._collection();
  2011. $ctx1.sendIdx["collection"]=2;
  2012. $2=_st($3)._noneSatisfy_((function(each){
  2013. return smalltalk.withContext(function($ctx2) {
  2014. return _st(each).__eq(anyOne);
  2015. $ctx2.sendIdx["="]=1;
  2016. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2017. $ctx1.sendIdx["noneSatisfy:"]=1;
  2018. self._deny_($2);
  2019. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2020. return smalltalk.withContext(function($ctx2) {
  2021. return _st(each).__eq(_st($Object())._new());
  2022. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2023. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  2024. args: [],
  2025. 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 ])",
  2026. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2027. referencedClasses: ["Object"]
  2028. }),
  2029. globals.CollectionTest);
  2030. smalltalk.addMethod(
  2031. smalltalk.method({
  2032. selector: "testRemoveAll",
  2033. protocol: 'tests',
  2034. fn: function (){
  2035. var self=this;
  2036. return smalltalk.withContext(function($ctx1) {
  2037. var $1,$2;
  2038. $1=self._collection();
  2039. _st($1)._removeAll();
  2040. $2=_st($1)._yourself();
  2041. self._assert_equals_($2,_st(self._collectionClass())._new());
  2042. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)})},
  2043. args: [],
  2044. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2045. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2046. referencedClasses: []
  2047. }),
  2048. globals.CollectionTest);
  2049. smalltalk.addMethod(
  2050. smalltalk.method({
  2051. selector: "testSelect",
  2052. protocol: 'tests',
  2053. fn: function (){
  2054. var self=this;
  2055. return smalltalk.withContext(function($ctx1) {
  2056. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2057. $2=self._collection();
  2058. $ctx1.sendIdx["collection"]=1;
  2059. $1=_st($2)._select_((function(){
  2060. return false;
  2061. }));
  2062. $ctx1.sendIdx["select:"]=1;
  2063. $4=self._collectionClass();
  2064. $ctx1.sendIdx["collectionClass"]=1;
  2065. $3=_st($4)._new();
  2066. $ctx1.sendIdx["new"]=1;
  2067. self._assert_equals_($1,$3);
  2068. $ctx1.sendIdx["assert:equals:"]=1;
  2069. $6=self._collection();
  2070. $ctx1.sendIdx["collection"]=2;
  2071. $5=_st($6)._select_((function(){
  2072. return true;
  2073. }));
  2074. $ctx1.sendIdx["select:"]=2;
  2075. $7=self._collection();
  2076. $ctx1.sendIdx["collection"]=3;
  2077. self._assert_equals_($5,$7);
  2078. $ctx1.sendIdx["assert:equals:"]=2;
  2079. $9=self._collectionWithNewValue();
  2080. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2081. $8=_st($9)._select_((function(each){
  2082. return smalltalk.withContext(function($ctx2) {
  2083. $10=self._sampleNewValue();
  2084. $ctx2.sendIdx["sampleNewValue"]=1;
  2085. return _st(each).__eq($10);
  2086. $ctx2.sendIdx["="]=1;
  2087. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2088. $ctx1.sendIdx["select:"]=3;
  2089. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2090. $ctx1.sendIdx["assert:equals:"]=3;
  2091. $12=self._collectionWithNewValue();
  2092. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2093. $11=_st($12)._select_((function(each){
  2094. return smalltalk.withContext(function($ctx2) {
  2095. $13=self._sampleNewValue();
  2096. $ctx2.sendIdx["sampleNewValue"]=2;
  2097. return _st(each).__tild_eq($13);
  2098. $ctx2.sendIdx["~="]=1;
  2099. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2100. $ctx1.sendIdx["select:"]=4;
  2101. $14=self._collection();
  2102. $ctx1.sendIdx["collection"]=4;
  2103. self._assert_equals_($11,$14);
  2104. $ctx1.sendIdx["assert:equals:"]=4;
  2105. $16=self._collection();
  2106. $ctx1.sendIdx["collection"]=5;
  2107. $15=_st($16)._select_((function(each){
  2108. return smalltalk.withContext(function($ctx2) {
  2109. $17=self._sampleNewValue();
  2110. $ctx2.sendIdx["sampleNewValue"]=3;
  2111. return _st(each).__eq($17);
  2112. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2113. $ctx1.sendIdx["select:"]=5;
  2114. self._assert_equals_($15,_st(self._collectionClass())._new());
  2115. $ctx1.sendIdx["assert:equals:"]=5;
  2116. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2117. return smalltalk.withContext(function($ctx2) {
  2118. return _st(each).__tild_eq(self._sampleNewValue());
  2119. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2120. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)})},
  2121. args: [],
  2122. 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",
  2123. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2124. referencedClasses: []
  2125. }),
  2126. globals.CollectionTest);
  2127. smalltalk.addMethod(
  2128. smalltalk.method({
  2129. selector: "testSize",
  2130. protocol: 'tests',
  2131. fn: function (){
  2132. var self=this;
  2133. return smalltalk.withContext(function($ctx1) {
  2134. var $1,$2;
  2135. $1=_st(_st(self._collectionClass())._new())._size();
  2136. $ctx1.sendIdx["size"]=1;
  2137. self._assert_equals_($1,(0));
  2138. $ctx1.sendIdx["assert:equals:"]=1;
  2139. $2=_st(self._sampleNewValueAsCollection())._size();
  2140. $ctx1.sendIdx["size"]=2;
  2141. self._assert_equals_($2,(1));
  2142. $ctx1.sendIdx["assert:equals:"]=2;
  2143. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2144. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)})},
  2145. args: [],
  2146. 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",
  2147. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2148. referencedClasses: []
  2149. }),
  2150. globals.CollectionTest);
  2151. smalltalk.addMethod(
  2152. smalltalk.method({
  2153. selector: "collectionClass",
  2154. protocol: 'fixture',
  2155. fn: function (){
  2156. var self=this;
  2157. return nil;
  2158. },
  2159. args: [],
  2160. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2161. messageSends: [],
  2162. referencedClasses: []
  2163. }),
  2164. globals.CollectionTest.klass);
  2165. smalltalk.addMethod(
  2166. smalltalk.method({
  2167. selector: "isAbstract",
  2168. protocol: 'testing',
  2169. fn: function (){
  2170. var self=this;
  2171. return smalltalk.withContext(function($ctx1) {
  2172. var $1;
  2173. $1=_st(self._collectionClass())._isNil();
  2174. return $1;
  2175. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)})},
  2176. args: [],
  2177. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2178. messageSends: ["isNil", "collectionClass"],
  2179. referencedClasses: []
  2180. }),
  2181. globals.CollectionTest.klass);
  2182. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  2183. smalltalk.addMethod(
  2184. smalltalk.method({
  2185. selector: "collectionWithNewValue",
  2186. protocol: 'fixture',
  2187. fn: function (){
  2188. var self=this;
  2189. return smalltalk.withContext(function($ctx1) {
  2190. self._subclassResponsibility();
  2191. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)})},
  2192. args: [],
  2193. 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",
  2194. messageSends: ["subclassResponsibility"],
  2195. referencedClasses: []
  2196. }),
  2197. globals.IndexableCollectionTest);
  2198. smalltalk.addMethod(
  2199. smalltalk.method({
  2200. selector: "sampleNewIndex",
  2201. protocol: 'fixture',
  2202. fn: function (){
  2203. var self=this;
  2204. return smalltalk.withContext(function($ctx1) {
  2205. self._subclassResponsibility();
  2206. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)})},
  2207. args: [],
  2208. 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",
  2209. messageSends: ["subclassResponsibility"],
  2210. referencedClasses: []
  2211. }),
  2212. globals.IndexableCollectionTest);
  2213. smalltalk.addMethod(
  2214. smalltalk.method({
  2215. selector: "sampleNonIndexesDo:",
  2216. protocol: 'fixture',
  2217. fn: function (aBlock){
  2218. var self=this;
  2219. return smalltalk.withContext(function($ctx1) {
  2220. self._subclassResponsibility();
  2221. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2222. args: ["aBlock"],
  2223. 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",
  2224. messageSends: ["subclassResponsibility"],
  2225. referencedClasses: []
  2226. }),
  2227. globals.IndexableCollectionTest);
  2228. smalltalk.addMethod(
  2229. smalltalk.method({
  2230. selector: "samplesDo:",
  2231. protocol: 'fixture',
  2232. fn: function (aBlock){
  2233. var self=this;
  2234. return smalltalk.withContext(function($ctx1) {
  2235. self._subclassResponsibility();
  2236. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2237. args: ["aBlock"],
  2238. 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",
  2239. messageSends: ["subclassResponsibility"],
  2240. referencedClasses: []
  2241. }),
  2242. globals.IndexableCollectionTest);
  2243. smalltalk.addMethod(
  2244. smalltalk.method({
  2245. selector: "testAt",
  2246. protocol: 'tests',
  2247. fn: function (){
  2248. var self=this;
  2249. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2250. return smalltalk.withContext(function($ctx1) {
  2251. var $1;
  2252. self._nonIndexesDo_((function(each){
  2253. return smalltalk.withContext(function($ctx2) {
  2254. return self._should_raise_((function(){
  2255. return smalltalk.withContext(function($ctx3) {
  2256. $1=self._collection();
  2257. $ctx3.sendIdx["collection"]=1;
  2258. return _st($1)._at_(each);
  2259. $ctx3.sendIdx["at:"]=1;
  2260. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2261. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2262. self._samplesDo_((function(index,value){
  2263. return smalltalk.withContext(function($ctx2) {
  2264. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2265. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2266. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)})},
  2267. args: [],
  2268. 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 ]",
  2269. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2270. referencedClasses: ["Error"]
  2271. }),
  2272. globals.IndexableCollectionTest);
  2273. smalltalk.addMethod(
  2274. smalltalk.method({
  2275. selector: "testAtIfAbsent",
  2276. protocol: 'tests',
  2277. fn: function (){
  2278. var self=this;
  2279. return smalltalk.withContext(function($ctx1) {
  2280. var $2,$1,$3;
  2281. self._nonIndexesDo_((function(each){
  2282. return smalltalk.withContext(function($ctx2) {
  2283. $2=self._collection();
  2284. $ctx2.sendIdx["collection"]=1;
  2285. $1=_st($2)._at_ifAbsent_(each,(function(){
  2286. return smalltalk.withContext(function($ctx3) {
  2287. return self._sampleNewValue();
  2288. $ctx3.sendIdx["sampleNewValue"]=1;
  2289. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2290. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2291. $3=self._sampleNewValue();
  2292. $ctx2.sendIdx["sampleNewValue"]=2;
  2293. return self._assert_equals_($1,$3);
  2294. $ctx2.sendIdx["assert:equals:"]=1;
  2295. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2296. self._samplesDo_((function(index,value){
  2297. return smalltalk.withContext(function($ctx2) {
  2298. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2299. return smalltalk.withContext(function($ctx3) {
  2300. return self._sampleNewValue();
  2301. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2302. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2303. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)})},
  2304. args: [],
  2305. 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 ].",
  2306. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2307. referencedClasses: []
  2308. }),
  2309. globals.IndexableCollectionTest);
  2310. smalltalk.addMethod(
  2311. smalltalk.method({
  2312. selector: "testAtIfAbsentPut",
  2313. protocol: 'tests',
  2314. fn: function (){
  2315. var self=this;
  2316. var newCollection;
  2317. return smalltalk.withContext(function($ctx1) {
  2318. var $1;
  2319. newCollection=self._collection();
  2320. $ctx1.sendIdx["collection"]=1;
  2321. self._samplesDo_((function(index,value){
  2322. return smalltalk.withContext(function($ctx2) {
  2323. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2324. return smalltalk.withContext(function($ctx3) {
  2325. return self._sampleNewValue();
  2326. $ctx3.sendIdx["sampleNewValue"]=1;
  2327. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2328. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2329. return self._assert_equals_($1,value);
  2330. $ctx2.sendIdx["assert:equals:"]=1;
  2331. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2332. self._assert_equals_(newCollection,self._collection());
  2333. $ctx1.sendIdx["assert:equals:"]=2;
  2334. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2335. return smalltalk.withContext(function($ctx2) {
  2336. return self._sampleNewValue();
  2337. $ctx2.sendIdx["sampleNewValue"]=2;
  2338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2339. $ctx1.sendIdx["assert:equals:"]=3;
  2340. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2341. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2342. args: [],
  2343. 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",
  2344. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2345. referencedClasses: []
  2346. }),
  2347. globals.IndexableCollectionTest);
  2348. smalltalk.addMethod(
  2349. smalltalk.method({
  2350. selector: "testAtIfPresent",
  2351. protocol: 'tests',
  2352. fn: function (){
  2353. var self=this;
  2354. var visited,sentinel;
  2355. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2356. return smalltalk.withContext(function($ctx1) {
  2357. var $2,$1,$4,$3;
  2358. sentinel=_st($Object())._new();
  2359. self._nonIndexesDo_((function(each){
  2360. return smalltalk.withContext(function($ctx2) {
  2361. visited=nil;
  2362. visited;
  2363. $2=self._collection();
  2364. $ctx2.sendIdx["collection"]=1;
  2365. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2366. visited=value1;
  2367. visited;
  2368. return sentinel;
  2369. }));
  2370. $ctx2.sendIdx["at:ifPresent:"]=1;
  2371. self._assert_equals_($1,nil);
  2372. $ctx2.sendIdx["assert:equals:"]=1;
  2373. return self._assert_(_st(visited)._isNil());
  2374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2375. self._samplesDo_((function(index,value){
  2376. return smalltalk.withContext(function($ctx2) {
  2377. visited=nil;
  2378. visited;
  2379. $4=self._collection();
  2380. $ctx2.sendIdx["collection"]=2;
  2381. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2382. visited=value2;
  2383. visited;
  2384. return sentinel;
  2385. }));
  2386. self._assert_equals_($3,sentinel);
  2387. $ctx2.sendIdx["assert:equals:"]=2;
  2388. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2389. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2390. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2391. args: [],
  2392. 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) ]",
  2393. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2394. referencedClasses: ["Object"]
  2395. }),
  2396. globals.IndexableCollectionTest);
  2397. smalltalk.addMethod(
  2398. smalltalk.method({
  2399. selector: "testAtIfPresentIfAbsent",
  2400. protocol: 'tests',
  2401. fn: function (){
  2402. var self=this;
  2403. var visited,sentinel;
  2404. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2405. return smalltalk.withContext(function($ctx1) {
  2406. var $2,$1,$3,$5,$4;
  2407. sentinel=_st($Object())._new();
  2408. self._nonIndexesDo_((function(each){
  2409. return smalltalk.withContext(function($ctx2) {
  2410. visited=nil;
  2411. visited;
  2412. $2=self._collection();
  2413. $ctx2.sendIdx["collection"]=1;
  2414. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2415. visited=value1;
  2416. visited;
  2417. return sentinel;
  2418. }),(function(){
  2419. return smalltalk.withContext(function($ctx3) {
  2420. return self._sampleNewValue();
  2421. $ctx3.sendIdx["sampleNewValue"]=1;
  2422. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2423. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2424. $3=self._sampleNewValue();
  2425. $ctx2.sendIdx["sampleNewValue"]=2;
  2426. self._assert_equals_($1,$3);
  2427. $ctx2.sendIdx["assert:equals:"]=1;
  2428. return self._assert_(_st(visited)._isNil());
  2429. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2430. self._samplesDo_((function(index,value){
  2431. return smalltalk.withContext(function($ctx2) {
  2432. visited=nil;
  2433. visited;
  2434. $5=self._collection();
  2435. $ctx2.sendIdx["collection"]=2;
  2436. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2437. visited=value2;
  2438. visited;
  2439. return sentinel;
  2440. }),(function(){
  2441. return smalltalk.withContext(function($ctx3) {
  2442. return self._sampleNewValue();
  2443. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2444. self._assert_equals_($4,sentinel);
  2445. $ctx2.sendIdx["assert:equals:"]=2;
  2446. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2447. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2448. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2449. args: [],
  2450. 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) ]",
  2451. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2452. referencedClasses: ["Object"]
  2453. }),
  2454. globals.IndexableCollectionTest);
  2455. smalltalk.addMethod(
  2456. smalltalk.method({
  2457. selector: "testAtPut",
  2458. protocol: 'tests',
  2459. fn: function (){
  2460. var self=this;
  2461. var newCollection;
  2462. return smalltalk.withContext(function($ctx1) {
  2463. newCollection=self._collection();
  2464. $ctx1.sendIdx["collection"]=1;
  2465. self._samplesDo_((function(index,value){
  2466. return smalltalk.withContext(function($ctx2) {
  2467. return _st(newCollection)._at_put_(index,value);
  2468. $ctx2.sendIdx["at:put:"]=1;
  2469. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2470. self._assert_equals_(newCollection,self._collection());
  2471. $ctx1.sendIdx["assert:equals:"]=1;
  2472. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2473. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2474. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2475. args: [],
  2476. 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",
  2477. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2478. referencedClasses: []
  2479. }),
  2480. globals.IndexableCollectionTest);
  2481. smalltalk.addMethod(
  2482. smalltalk.method({
  2483. selector: "testEquality",
  2484. protocol: 'tests',
  2485. fn: function (){
  2486. var self=this;
  2487. return smalltalk.withContext(function($ctx1) {
  2488. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2489. $2=self._collectionClass();
  2490. $ctx1.sendIdx["collectionClass"]=1;
  2491. $1=_st($2)._new();
  2492. $ctx1.sendIdx["new"]=1;
  2493. $4=self._collectionClass();
  2494. $ctx1.sendIdx["collectionClass"]=2;
  2495. $3=_st($4)._new();
  2496. $ctx1.sendIdx["new"]=2;
  2497. self._assert_equals_($1,$3);
  2498. $ctx1.sendIdx["assert:equals:"]=1;
  2499. $5=self._collection();
  2500. $ctx1.sendIdx["collection"]=1;
  2501. $6=self._collection();
  2502. $ctx1.sendIdx["collection"]=2;
  2503. self._assert_equals_($5,$6);
  2504. $ctx1.sendIdx["assert:equals:"]=2;
  2505. $7=self._collectionWithNewValue();
  2506. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2507. self._assert_equals_($7,self._collectionWithNewValue());
  2508. $10=self._collectionClass();
  2509. $ctx1.sendIdx["collectionClass"]=3;
  2510. $9=_st($10)._new();
  2511. $ctx1.sendIdx["new"]=3;
  2512. $11=self._collection();
  2513. $ctx1.sendIdx["collection"]=3;
  2514. $8=_st($9).__eq($11);
  2515. $ctx1.sendIdx["="]=1;
  2516. self._deny_($8);
  2517. $ctx1.sendIdx["deny:"]=1;
  2518. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2519. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)})},
  2520. args: [],
  2521. 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",
  2522. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2523. referencedClasses: []
  2524. }),
  2525. globals.IndexableCollectionTest);
  2526. smalltalk.addMethod(
  2527. smalltalk.method({
  2528. selector: "testIndexOf",
  2529. protocol: 'tests',
  2530. fn: function (){
  2531. var self=this;
  2532. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2533. return smalltalk.withContext(function($ctx1) {
  2534. var $1;
  2535. self._should_raise_((function(){
  2536. return smalltalk.withContext(function($ctx2) {
  2537. $1=self._collection();
  2538. $ctx2.sendIdx["collection"]=1;
  2539. return _st($1)._indexOf_(self._sampleNewValue());
  2540. $ctx2.sendIdx["indexOf:"]=1;
  2541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2542. self._samplesDo_((function(index,value){
  2543. return smalltalk.withContext(function($ctx2) {
  2544. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2545. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2546. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)})},
  2547. args: [],
  2548. 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 ]",
  2549. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2550. referencedClasses: ["Error"]
  2551. }),
  2552. globals.IndexableCollectionTest);
  2553. smalltalk.addMethod(
  2554. smalltalk.method({
  2555. selector: "testIndexOfWithNull",
  2556. protocol: 'tests',
  2557. fn: function (){
  2558. var self=this;
  2559. var jsNull;
  2560. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2561. return smalltalk.withContext(function($ctx1) {
  2562. var $1,$2;
  2563. jsNull=_st($JSON())._parse_("null");
  2564. self._samplesDo_((function(index,value){
  2565. return smalltalk.withContext(function($ctx2) {
  2566. $1=self._collection();
  2567. _st($1)._at_put_(index,jsNull);
  2568. $2=_st($1)._indexOf_(jsNull);
  2569. return self._assert_equals_($2,index);
  2570. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2571. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)})},
  2572. args: [],
  2573. 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 ]",
  2574. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2575. referencedClasses: ["JSON"]
  2576. }),
  2577. globals.IndexableCollectionTest);
  2578. smalltalk.addMethod(
  2579. smalltalk.method({
  2580. selector: "testWithIndexDo",
  2581. protocol: 'tests',
  2582. fn: function (){
  2583. var self=this;
  2584. var collection;
  2585. return smalltalk.withContext(function($ctx1) {
  2586. collection=self._collection();
  2587. $ctx1.sendIdx["collection"]=1;
  2588. _st(self._collection())._withIndexDo_((function(each,index){
  2589. return smalltalk.withContext(function($ctx2) {
  2590. return self._assert_equals_(_st(collection)._at_(index),each);
  2591. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2592. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)})},
  2593. args: [],
  2594. 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 ]",
  2595. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2596. referencedClasses: []
  2597. }),
  2598. globals.IndexableCollectionTest);
  2599. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  2600. smalltalk.addMethod(
  2601. smalltalk.method({
  2602. selector: "collectionKeys",
  2603. protocol: 'fixture',
  2604. fn: function (){
  2605. var self=this;
  2606. return smalltalk.withContext(function($ctx1) {
  2607. self._subclassResponsibility();
  2608. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)})},
  2609. args: [],
  2610. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2611. messageSends: ["subclassResponsibility"],
  2612. referencedClasses: []
  2613. }),
  2614. globals.AssociativeCollectionTest);
  2615. smalltalk.addMethod(
  2616. smalltalk.method({
  2617. selector: "collectionValues",
  2618. protocol: 'fixture',
  2619. fn: function (){
  2620. var self=this;
  2621. return smalltalk.withContext(function($ctx1) {
  2622. self._subclassResponsibility();
  2623. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)})},
  2624. args: [],
  2625. source: "collectionValues\x0a\x09self subclassResponsibility",
  2626. messageSends: ["subclassResponsibility"],
  2627. referencedClasses: []
  2628. }),
  2629. globals.AssociativeCollectionTest);
  2630. smalltalk.addMethod(
  2631. smalltalk.method({
  2632. selector: "nonIndexesDo:",
  2633. protocol: 'fixture',
  2634. fn: function (aBlock){
  2635. var self=this;
  2636. return smalltalk.withContext(function($ctx1) {
  2637. _st(aBlock)._value_((5));
  2638. $ctx1.sendIdx["value:"]=1;
  2639. _st(aBlock)._value_("z");
  2640. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2641. args: ["aBlock"],
  2642. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2643. messageSends: ["value:"],
  2644. referencedClasses: []
  2645. }),
  2646. globals.AssociativeCollectionTest);
  2647. smalltalk.addMethod(
  2648. smalltalk.method({
  2649. selector: "sampleNewIndex",
  2650. protocol: 'fixture',
  2651. fn: function (){
  2652. var self=this;
  2653. return "new";
  2654. },
  2655. args: [],
  2656. source: "sampleNewIndex\x0a\x09^ 'new'",
  2657. messageSends: [],
  2658. referencedClasses: []
  2659. }),
  2660. globals.AssociativeCollectionTest);
  2661. smalltalk.addMethod(
  2662. smalltalk.method({
  2663. selector: "samplesDo:",
  2664. protocol: 'fixture',
  2665. fn: function (aBlock){
  2666. var self=this;
  2667. return smalltalk.withContext(function($ctx1) {
  2668. _st(aBlock)._value_value_("a",(2));
  2669. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2670. args: ["aBlock"],
  2671. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2672. messageSends: ["value:value:"],
  2673. referencedClasses: []
  2674. }),
  2675. globals.AssociativeCollectionTest);
  2676. smalltalk.addMethod(
  2677. smalltalk.method({
  2678. selector: "testAddAll",
  2679. protocol: 'tests',
  2680. fn: function (){
  2681. var self=this;
  2682. return smalltalk.withContext(function($ctx1) {
  2683. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2684. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  2685. $ctx1.supercall = false;
  2686. $2=self._collection();
  2687. $ctx1.sendIdx["collection"]=1;
  2688. $3=$2;
  2689. $4=self._collection();
  2690. $ctx1.sendIdx["collection"]=2;
  2691. _st($3)._addAll_($4);
  2692. $ctx1.sendIdx["addAll:"]=1;
  2693. $5=_st($2)._yourself();
  2694. $ctx1.sendIdx["yourself"]=1;
  2695. $1=$5;
  2696. $6=self._collection();
  2697. $ctx1.sendIdx["collection"]=3;
  2698. self._assert_equals_($1,$6);
  2699. $ctx1.sendIdx["assert:equals:"]=1;
  2700. $8=self._collection();
  2701. $ctx1.sendIdx["collection"]=4;
  2702. $9=$8;
  2703. $10=self._collectionWithNewValue();
  2704. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2705. _st($9)._addAll_($10);
  2706. $ctx1.sendIdx["addAll:"]=2;
  2707. $11=_st($8)._yourself();
  2708. $ctx1.sendIdx["yourself"]=2;
  2709. $7=$11;
  2710. $12=self._collectionWithNewValue();
  2711. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2712. self._assert_equals_($7,$12);
  2713. $ctx1.sendIdx["assert:equals:"]=2;
  2714. $14=self._collectionWithNewValue();
  2715. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2716. _st($14)._addAll_(self._collection());
  2717. $15=_st($14)._yourself();
  2718. $13=$15;
  2719. self._assert_equals_($13,self._collectionWithNewValue());
  2720. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)})},
  2721. args: [],
  2722. 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",
  2723. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2724. referencedClasses: []
  2725. }),
  2726. globals.AssociativeCollectionTest);
  2727. smalltalk.addMethod(
  2728. smalltalk.method({
  2729. selector: "testAsDictionary",
  2730. protocol: 'tests',
  2731. fn: function (){
  2732. var self=this;
  2733. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2734. return smalltalk.withContext(function($ctx1) {
  2735. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2736. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)})},
  2737. args: [],
  2738. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2739. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2740. referencedClasses: ["Dictionary"]
  2741. }),
  2742. globals.AssociativeCollectionTest);
  2743. smalltalk.addMethod(
  2744. smalltalk.method({
  2745. selector: "testAsHashedCollection",
  2746. protocol: 'tests',
  2747. fn: function (){
  2748. var self=this;
  2749. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2750. return smalltalk.withContext(function($ctx1) {
  2751. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2752. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)})},
  2753. args: [],
  2754. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2755. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2756. referencedClasses: ["HashedCollection"]
  2757. }),
  2758. globals.AssociativeCollectionTest);
  2759. smalltalk.addMethod(
  2760. smalltalk.method({
  2761. selector: "testComma",
  2762. protocol: 'tests',
  2763. fn: function (){
  2764. var self=this;
  2765. return smalltalk.withContext(function($ctx1) {
  2766. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2767. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  2768. $ctx1.supercall = false;
  2769. $2=self._collection();
  2770. $ctx1.sendIdx["collection"]=1;
  2771. $3=self._collection();
  2772. $ctx1.sendIdx["collection"]=2;
  2773. $1=_st($2).__comma($3);
  2774. $ctx1.sendIdx[","]=1;
  2775. $4=self._collection();
  2776. $ctx1.sendIdx["collection"]=3;
  2777. self._assert_equals_($1,$4);
  2778. $ctx1.sendIdx["assert:equals:"]=1;
  2779. $6=self._collection();
  2780. $ctx1.sendIdx["collection"]=4;
  2781. $7=self._collectionWithNewValue();
  2782. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2783. $5=_st($6).__comma($7);
  2784. $ctx1.sendIdx[","]=2;
  2785. $8=self._collectionWithNewValue();
  2786. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2787. self._assert_equals_($5,$8);
  2788. $ctx1.sendIdx["assert:equals:"]=2;
  2789. $10=self._collectionWithNewValue();
  2790. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2791. $9=_st($10).__comma(self._collection());
  2792. self._assert_equals_($9,self._collectionWithNewValue());
  2793. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)})},
  2794. args: [],
  2795. 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",
  2796. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2797. referencedClasses: []
  2798. }),
  2799. globals.AssociativeCollectionTest);
  2800. smalltalk.addMethod(
  2801. smalltalk.method({
  2802. selector: "testFrom",
  2803. protocol: 'tests',
  2804. fn: function (){
  2805. var self=this;
  2806. var associations;
  2807. return smalltalk.withContext(function($ctx1) {
  2808. var $1;
  2809. $1="a".__minus_gt((1));
  2810. $ctx1.sendIdx["->"]=1;
  2811. associations=[$1,"b".__minus_gt((2))];
  2812. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2813. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)})},
  2814. args: [],
  2815. 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 }.",
  2816. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2817. referencedClasses: []
  2818. }),
  2819. globals.AssociativeCollectionTest);
  2820. smalltalk.addMethod(
  2821. smalltalk.method({
  2822. selector: "testKeys",
  2823. protocol: 'tests',
  2824. fn: function (){
  2825. var self=this;
  2826. return smalltalk.withContext(function($ctx1) {
  2827. var $2,$1,$3,$4;
  2828. $2=_st(_st(self._collectionClass())._new())._keys();
  2829. $ctx1.sendIdx["keys"]=1;
  2830. $1=_st($2)._isEmpty();
  2831. self._assert_($1);
  2832. $3=_st(self._collection())._keys();
  2833. $ctx1.sendIdx["keys"]=2;
  2834. $4=self._collectionKeys();
  2835. $ctx1.sendIdx["collectionKeys"]=1;
  2836. self._assertSameContents_as_($3,$4);
  2837. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2838. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2839. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)})},
  2840. args: [],
  2841. 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 }",
  2842. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2843. referencedClasses: []
  2844. }),
  2845. globals.AssociativeCollectionTest);
  2846. smalltalk.addMethod(
  2847. smalltalk.method({
  2848. selector: "testNewFromPairs",
  2849. protocol: 'tests',
  2850. fn: function (){
  2851. var self=this;
  2852. var flattenedAssociations;
  2853. return smalltalk.withContext(function($ctx1) {
  2854. flattenedAssociations=["a",(1),"b",(2)];
  2855. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2856. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)})},
  2857. args: [],
  2858. 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 }.",
  2859. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"],
  2860. referencedClasses: []
  2861. }),
  2862. globals.AssociativeCollectionTest);
  2863. smalltalk.addMethod(
  2864. smalltalk.method({
  2865. selector: "testPrintString",
  2866. protocol: 'tests',
  2867. fn: function (){
  2868. var self=this;
  2869. return smalltalk.withContext(function($ctx1) {
  2870. var $3,$2,$4,$1,$5;
  2871. $3=self._collectionClass();
  2872. $ctx1.sendIdx["collectionClass"]=1;
  2873. $2=_st($3)._new();
  2874. _st($2)._at_put_("firstname","James");
  2875. $ctx1.sendIdx["at:put:"]=1;
  2876. _st($2)._at_put_("lastname","Bond");
  2877. $4=_st($2)._printString();
  2878. $1=$4;
  2879. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2880. $ctx1.sendIdx[","]=1;
  2881. self._assert_equals_($1,$5);
  2882. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)})},
  2883. args: [],
  2884. 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'')'",
  2885. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2886. referencedClasses: []
  2887. }),
  2888. globals.AssociativeCollectionTest);
  2889. smalltalk.addMethod(
  2890. smalltalk.method({
  2891. selector: "testRemoveKey",
  2892. protocol: 'tests',
  2893. fn: function (){
  2894. var self=this;
  2895. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2896. return smalltalk.withContext(function($ctx1) {
  2897. var $1,$2,$3,$5,$6,$4,$7,$8;
  2898. self._nonIndexesDo_((function(each){
  2899. var collection;
  2900. return smalltalk.withContext(function($ctx2) {
  2901. collection=self._collection();
  2902. $ctx2.sendIdx["collection"]=1;
  2903. collection;
  2904. self._should_raise_((function(){
  2905. return smalltalk.withContext(function($ctx3) {
  2906. return _st(collection)._removeKey_(each);
  2907. $ctx3.sendIdx["removeKey:"]=1;
  2908. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2909. $1=collection;
  2910. $2=self._collection();
  2911. $ctx2.sendIdx["collection"]=2;
  2912. return self._assert_equals_($1,$2);
  2913. $ctx2.sendIdx["assert:equals:"]=1;
  2914. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2915. self._samplesDo_((function(index,value){
  2916. var collection;
  2917. return smalltalk.withContext(function($ctx2) {
  2918. collection=self._collection();
  2919. $ctx2.sendIdx["collection"]=3;
  2920. collection;
  2921. $3=_st(collection)._removeKey_(index);
  2922. $ctx2.sendIdx["removeKey:"]=2;
  2923. self._assert_equals_($3,value);
  2924. $ctx2.sendIdx["assert:equals:"]=2;
  2925. $5=collection;
  2926. $6=self._collection();
  2927. $ctx2.sendIdx["collection"]=4;
  2928. $4=_st($5).__eq($6);
  2929. return self._deny_($4);
  2930. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2931. $7=self._collectionWithNewValue();
  2932. _st($7)._removeKey_(self._sampleNewIndex());
  2933. $8=_st($7)._yourself();
  2934. self._assert_equals_($8,self._collection());
  2935. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)})},
  2936. args: [],
  2937. 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",
  2938. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  2939. referencedClasses: ["Error"]
  2940. }),
  2941. globals.AssociativeCollectionTest);
  2942. smalltalk.addMethod(
  2943. smalltalk.method({
  2944. selector: "testRemoveKeyIfAbsent",
  2945. protocol: 'tests',
  2946. fn: function (){
  2947. var self=this;
  2948. return smalltalk.withContext(function($ctx1) {
  2949. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  2950. self._nonIndexesDo_((function(each){
  2951. var collection;
  2952. return smalltalk.withContext(function($ctx2) {
  2953. collection=self._collection();
  2954. $ctx2.sendIdx["collection"]=1;
  2955. collection;
  2956. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  2957. return smalltalk.withContext(function($ctx3) {
  2958. return self._sampleNewValue();
  2959. $ctx3.sendIdx["sampleNewValue"]=1;
  2960. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2961. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  2962. $2=self._sampleNewValue();
  2963. $ctx2.sendIdx["sampleNewValue"]=2;
  2964. self._assert_equals_($1,$2);
  2965. $ctx2.sendIdx["assert:equals:"]=1;
  2966. $3=collection;
  2967. $4=self._collection();
  2968. $ctx2.sendIdx["collection"]=2;
  2969. return self._assert_equals_($3,$4);
  2970. $ctx2.sendIdx["assert:equals:"]=2;
  2971. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2972. self._samplesDo_((function(index,value){
  2973. var collection;
  2974. return smalltalk.withContext(function($ctx2) {
  2975. collection=self._collection();
  2976. $ctx2.sendIdx["collection"]=3;
  2977. collection;
  2978. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  2979. return smalltalk.withContext(function($ctx3) {
  2980. return self._sampleNewValue();
  2981. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  2982. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  2983. self._assert_equals_($5,value);
  2984. $ctx2.sendIdx["assert:equals:"]=3;
  2985. $7=collection;
  2986. $8=self._collection();
  2987. $ctx2.sendIdx["collection"]=4;
  2988. $6=_st($7).__eq($8);
  2989. return self._deny_($6);
  2990. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2991. $9=self._collectionWithNewValue();
  2992. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  2993. return smalltalk.withContext(function($ctx2) {
  2994. return self._assert_(false);
  2995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  2996. $10=_st($9)._yourself();
  2997. self._assert_equals_($10,self._collection());
  2998. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)})},
  2999. args: [],
  3000. 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",
  3001. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3002. referencedClasses: []
  3003. }),
  3004. globals.AssociativeCollectionTest);
  3005. smalltalk.addMethod(
  3006. smalltalk.method({
  3007. selector: "testValues",
  3008. protocol: 'tests',
  3009. fn: function (){
  3010. var self=this;
  3011. return smalltalk.withContext(function($ctx1) {
  3012. var $2,$1,$3,$4;
  3013. $2=_st(_st(self._collectionClass())._new())._values();
  3014. $ctx1.sendIdx["values"]=1;
  3015. $1=_st($2)._isEmpty();
  3016. self._assert_($1);
  3017. $3=_st(self._collection())._values();
  3018. $ctx1.sendIdx["values"]=2;
  3019. $4=self._collectionValues();
  3020. $ctx1.sendIdx["collectionValues"]=1;
  3021. self._assertSameContents_as_($3,$4);
  3022. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3023. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3024. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)})},
  3025. args: [],
  3026. 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 }",
  3027. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3028. referencedClasses: []
  3029. }),
  3030. globals.AssociativeCollectionTest);
  3031. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3032. smalltalk.addMethod(
  3033. smalltalk.method({
  3034. selector: "collection",
  3035. protocol: 'fixture',
  3036. fn: function (){
  3037. var self=this;
  3038. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3039. return smalltalk.withContext(function($ctx1) {
  3040. var $2,$3,$1;
  3041. $2=_st($Dictionary())._new();
  3042. _st($2)._at_put_((1),(1));
  3043. $ctx1.sendIdx["at:put:"]=1;
  3044. _st($2)._at_put_("a",(2));
  3045. $ctx1.sendIdx["at:put:"]=2;
  3046. _st($2)._at_put_(true,(3));
  3047. $ctx1.sendIdx["at:put:"]=3;
  3048. _st($2)._at_put_((1).__at((3)),(-4));
  3049. $3=_st($2)._yourself();
  3050. $1=$3;
  3051. return $1;
  3052. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)})},
  3053. args: [],
  3054. 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",
  3055. messageSends: ["at:put:", "new", "@", "yourself"],
  3056. referencedClasses: ["Dictionary"]
  3057. }),
  3058. globals.DictionaryTest);
  3059. smalltalk.addMethod(
  3060. smalltalk.method({
  3061. selector: "collectionKeys",
  3062. protocol: 'fixture',
  3063. fn: function (){
  3064. var self=this;
  3065. return smalltalk.withContext(function($ctx1) {
  3066. var $1;
  3067. $1=[(1),"a",true,(1).__at((3))];
  3068. return $1;
  3069. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)})},
  3070. args: [],
  3071. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3072. messageSends: ["@"],
  3073. referencedClasses: []
  3074. }),
  3075. globals.DictionaryTest);
  3076. smalltalk.addMethod(
  3077. smalltalk.method({
  3078. selector: "collectionOfPrintStrings",
  3079. protocol: 'fixture',
  3080. fn: function (){
  3081. var self=this;
  3082. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3083. return smalltalk.withContext(function($ctx1) {
  3084. var $2,$3,$1;
  3085. $2=_st($Dictionary())._new();
  3086. _st($2)._at_put_((1),"1");
  3087. $ctx1.sendIdx["at:put:"]=1;
  3088. _st($2)._at_put_("a","2");
  3089. $ctx1.sendIdx["at:put:"]=2;
  3090. _st($2)._at_put_(true,"3");
  3091. $ctx1.sendIdx["at:put:"]=3;
  3092. _st($2)._at_put_((1).__at((3)),"-4");
  3093. $3=_st($2)._yourself();
  3094. $1=$3;
  3095. return $1;
  3096. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)})},
  3097. args: [],
  3098. 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",
  3099. messageSends: ["at:put:", "new", "@", "yourself"],
  3100. referencedClasses: ["Dictionary"]
  3101. }),
  3102. globals.DictionaryTest);
  3103. smalltalk.addMethod(
  3104. smalltalk.method({
  3105. selector: "collectionSize",
  3106. protocol: 'fixture',
  3107. fn: function (){
  3108. var self=this;
  3109. return (4);
  3110. },
  3111. args: [],
  3112. source: "collectionSize\x0a\x09^ 4",
  3113. messageSends: [],
  3114. referencedClasses: []
  3115. }),
  3116. globals.DictionaryTest);
  3117. smalltalk.addMethod(
  3118. smalltalk.method({
  3119. selector: "collectionValues",
  3120. protocol: 'fixture',
  3121. fn: function (){
  3122. var self=this;
  3123. var $1;
  3124. $1=[(1),(2),(3),(-4)];
  3125. return $1;
  3126. },
  3127. args: [],
  3128. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3129. messageSends: [],
  3130. referencedClasses: []
  3131. }),
  3132. globals.DictionaryTest);
  3133. smalltalk.addMethod(
  3134. smalltalk.method({
  3135. selector: "collectionWithDuplicates",
  3136. protocol: 'fixture',
  3137. fn: function (){
  3138. var self=this;
  3139. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3140. return smalltalk.withContext(function($ctx1) {
  3141. var $2,$3,$1;
  3142. $2=_st($Dictionary())._new();
  3143. _st($2)._at_put_((1),(1));
  3144. $ctx1.sendIdx["at:put:"]=1;
  3145. _st($2)._at_put_("a",(2));
  3146. $ctx1.sendIdx["at:put:"]=2;
  3147. _st($2)._at_put_(true,(3));
  3148. $ctx1.sendIdx["at:put:"]=3;
  3149. _st($2)._at_put_((4),(-4));
  3150. $ctx1.sendIdx["at:put:"]=4;
  3151. _st($2)._at_put_("b",(1));
  3152. $ctx1.sendIdx["at:put:"]=5;
  3153. _st($2)._at_put_((3),(3));
  3154. $ctx1.sendIdx["at:put:"]=6;
  3155. _st($2)._at_put_(false,(12));
  3156. $3=_st($2)._yourself();
  3157. $1=$3;
  3158. return $1;
  3159. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)})},
  3160. args: [],
  3161. 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",
  3162. messageSends: ["at:put:", "new", "yourself"],
  3163. referencedClasses: ["Dictionary"]
  3164. }),
  3165. globals.DictionaryTest);
  3166. smalltalk.addMethod(
  3167. smalltalk.method({
  3168. selector: "collectionWithNewValue",
  3169. protocol: 'fixture',
  3170. fn: function (){
  3171. var self=this;
  3172. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3173. return smalltalk.withContext(function($ctx1) {
  3174. var $2,$3,$1;
  3175. $2=_st($Dictionary())._new();
  3176. _st($2)._at_put_((1),(1));
  3177. $ctx1.sendIdx["at:put:"]=1;
  3178. _st($2)._at_put_("a",(2));
  3179. $ctx1.sendIdx["at:put:"]=2;
  3180. _st($2)._at_put_(true,(3));
  3181. $ctx1.sendIdx["at:put:"]=3;
  3182. _st($2)._at_put_((1).__at((3)),(-4));
  3183. $ctx1.sendIdx["at:put:"]=4;
  3184. _st($2)._at_put_("new","N");
  3185. $3=_st($2)._yourself();
  3186. $1=$3;
  3187. return $1;
  3188. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)})},
  3189. args: [],
  3190. 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",
  3191. messageSends: ["at:put:", "new", "@", "yourself"],
  3192. referencedClasses: ["Dictionary"]
  3193. }),
  3194. globals.DictionaryTest);
  3195. smalltalk.addMethod(
  3196. smalltalk.method({
  3197. selector: "sampleNewValueAsCollection",
  3198. protocol: 'fixture',
  3199. fn: function (){
  3200. var self=this;
  3201. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3202. return smalltalk.withContext(function($ctx1) {
  3203. var $2,$3,$1;
  3204. $2=_st($Dictionary())._new();
  3205. _st($2)._at_put_("new","N");
  3206. $3=_st($2)._yourself();
  3207. $1=$3;
  3208. return $1;
  3209. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)})},
  3210. args: [],
  3211. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3212. messageSends: ["at:put:", "new", "yourself"],
  3213. referencedClasses: ["Dictionary"]
  3214. }),
  3215. globals.DictionaryTest);
  3216. smalltalk.addMethod(
  3217. smalltalk.method({
  3218. selector: "samplesDo:",
  3219. protocol: 'fixture',
  3220. fn: function (aBlock){
  3221. var self=this;
  3222. return smalltalk.withContext(function($ctx1) {
  3223. ($ctx1.supercall = true, globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  3224. $ctx1.supercall = false;
  3225. _st(aBlock)._value_value_(true,(3));
  3226. $ctx1.sendIdx["value:value:"]=1;
  3227. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3228. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)})},
  3229. args: ["aBlock"],
  3230. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3231. messageSends: ["samplesDo:", "value:value:", "@"],
  3232. referencedClasses: []
  3233. }),
  3234. globals.DictionaryTest);
  3235. smalltalk.addMethod(
  3236. smalltalk.method({
  3237. selector: "testAccessing",
  3238. protocol: 'tests',
  3239. fn: function (){
  3240. var self=this;
  3241. var d;
  3242. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3243. return smalltalk.withContext(function($ctx1) {
  3244. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3245. d=_st($Dictionary())._new();
  3246. _st(d)._at_put_("hello","world");
  3247. $ctx1.sendIdx["at:put:"]=1;
  3248. $1=_st(d)._at_("hello");
  3249. $ctx1.sendIdx["at:"]=1;
  3250. self._assert_equals_($1,"world");
  3251. $ctx1.sendIdx["assert:equals:"]=1;
  3252. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3253. return nil;
  3254. }));
  3255. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3256. self._assert_equals_($2,"world");
  3257. $ctx1.sendIdx["assert:equals:"]=2;
  3258. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3259. return nil;
  3260. }))).__eq("world"));
  3261. $ctx1.sendIdx["deny:"]=1;
  3262. $3=_st(d)._includesKey_("hello");
  3263. $ctx1.sendIdx["includesKey:"]=1;
  3264. self._assert_($3);
  3265. $ctx1.sendIdx["assert:"]=1;
  3266. $4=_st(d)._includesKey_("foo");
  3267. $ctx1.sendIdx["includesKey:"]=2;
  3268. self._deny_($4);
  3269. $ctx1.sendIdx["deny:"]=2;
  3270. _st(d)._at_put_((1),(2));
  3271. $ctx1.sendIdx["at:put:"]=2;
  3272. $5=_st(d)._at_((1));
  3273. $ctx1.sendIdx["at:"]=2;
  3274. self._assert_equals_($5,(2));
  3275. $ctx1.sendIdx["assert:equals:"]=3;
  3276. $6=d;
  3277. $7=(1).__at((3));
  3278. $ctx1.sendIdx["@"]=1;
  3279. _st($6)._at_put_($7,(3));
  3280. $9=d;
  3281. $10=(1).__at((3));
  3282. $ctx1.sendIdx["@"]=2;
  3283. $8=_st($9)._at_($10);
  3284. self._assert_equals_($8,(3));
  3285. $12=d;
  3286. $13=(1).__at((3));
  3287. $ctx1.sendIdx["@"]=3;
  3288. $11=_st($12)._includesKey_($13);
  3289. $ctx1.sendIdx["includesKey:"]=3;
  3290. self._assert_($11);
  3291. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3292. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)})},
  3293. args: [],
  3294. 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)",
  3295. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3296. referencedClasses: ["Dictionary"]
  3297. }),
  3298. globals.DictionaryTest);
  3299. smalltalk.addMethod(
  3300. smalltalk.method({
  3301. selector: "testDynamicDictionaries",
  3302. protocol: 'tests',
  3303. fn: function (){
  3304. var self=this;
  3305. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3306. return smalltalk.withContext(function($ctx1) {
  3307. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  3308. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)})},
  3309. args: [],
  3310. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3311. messageSends: ["assert:equals:", "asDictionary", "with:", "->"],
  3312. referencedClasses: ["Dictionary"]
  3313. }),
  3314. globals.DictionaryTest);
  3315. smalltalk.addMethod(
  3316. smalltalk.method({
  3317. selector: "collectionClass",
  3318. protocol: 'fixture',
  3319. fn: function (){
  3320. var self=this;
  3321. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3322. return $Dictionary();
  3323. },
  3324. args: [],
  3325. source: "collectionClass\x0a\x09^ Dictionary",
  3326. messageSends: [],
  3327. referencedClasses: ["Dictionary"]
  3328. }),
  3329. globals.DictionaryTest.klass);
  3330. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3331. smalltalk.addMethod(
  3332. smalltalk.method({
  3333. selector: "collection",
  3334. protocol: 'fixture',
  3335. fn: function (){
  3336. var self=this;
  3337. var $1;
  3338. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  3339. return $1;
  3340. },
  3341. args: [],
  3342. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3343. messageSends: [],
  3344. referencedClasses: []
  3345. }),
  3346. globals.HashedCollectionTest);
  3347. smalltalk.addMethod(
  3348. smalltalk.method({
  3349. selector: "collectionKeys",
  3350. protocol: 'fixture',
  3351. fn: function (){
  3352. var self=this;
  3353. var $1;
  3354. $1=["b","a","c","d"];
  3355. return $1;
  3356. },
  3357. args: [],
  3358. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3359. messageSends: [],
  3360. referencedClasses: []
  3361. }),
  3362. globals.HashedCollectionTest);
  3363. smalltalk.addMethod(
  3364. smalltalk.method({
  3365. selector: "collectionOfPrintStrings",
  3366. protocol: 'fixture',
  3367. fn: function (){
  3368. var self=this;
  3369. var $1;
  3370. $1=globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  3371. return $1;
  3372. },
  3373. args: [],
  3374. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3375. messageSends: [],
  3376. referencedClasses: []
  3377. }),
  3378. globals.HashedCollectionTest);
  3379. smalltalk.addMethod(
  3380. smalltalk.method({
  3381. selector: "collectionSize",
  3382. protocol: 'fixture',
  3383. fn: function (){
  3384. var self=this;
  3385. return (4);
  3386. },
  3387. args: [],
  3388. source: "collectionSize\x0a\x09^ 4",
  3389. messageSends: [],
  3390. referencedClasses: []
  3391. }),
  3392. globals.HashedCollectionTest);
  3393. smalltalk.addMethod(
  3394. smalltalk.method({
  3395. selector: "collectionValues",
  3396. protocol: 'fixture',
  3397. fn: function (){
  3398. var self=this;
  3399. var $1;
  3400. $1=[(1),(2),(3),(-4)];
  3401. return $1;
  3402. },
  3403. args: [],
  3404. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3405. messageSends: [],
  3406. referencedClasses: []
  3407. }),
  3408. globals.HashedCollectionTest);
  3409. smalltalk.addMethod(
  3410. smalltalk.method({
  3411. selector: "collectionWithDuplicates",
  3412. protocol: 'fixture',
  3413. fn: function (){
  3414. var self=this;
  3415. var $1;
  3416. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  3417. return $1;
  3418. },
  3419. args: [],
  3420. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3421. messageSends: [],
  3422. referencedClasses: []
  3423. }),
  3424. globals.HashedCollectionTest);
  3425. smalltalk.addMethod(
  3426. smalltalk.method({
  3427. selector: "collectionWithNewValue",
  3428. protocol: 'fixture',
  3429. fn: function (){
  3430. var self=this;
  3431. var $1;
  3432. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  3433. return $1;
  3434. },
  3435. args: [],
  3436. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3437. messageSends: [],
  3438. referencedClasses: []
  3439. }),
  3440. globals.HashedCollectionTest);
  3441. smalltalk.addMethod(
  3442. smalltalk.method({
  3443. selector: "sampleNewValueAsCollection",
  3444. protocol: 'fixture',
  3445. fn: function (){
  3446. var self=this;
  3447. var $1;
  3448. $1=globals.HashedCollection._newFromPairs_(["new","N"]);
  3449. return $1;
  3450. },
  3451. args: [],
  3452. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3453. messageSends: [],
  3454. referencedClasses: []
  3455. }),
  3456. globals.HashedCollectionTest);
  3457. smalltalk.addMethod(
  3458. smalltalk.method({
  3459. selector: "testDynamicDictionaries",
  3460. protocol: 'tests',
  3461. fn: function (){
  3462. var self=this;
  3463. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3464. return smalltalk.withContext(function($ctx1) {
  3465. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3466. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)})},
  3467. args: [],
  3468. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3469. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"],
  3470. referencedClasses: ["HashedCollection"]
  3471. }),
  3472. globals.HashedCollectionTest);
  3473. smalltalk.addMethod(
  3474. smalltalk.method({
  3475. selector: "collectionClass",
  3476. protocol: 'fixture',
  3477. fn: function (){
  3478. var self=this;
  3479. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3480. return $HashedCollection();
  3481. },
  3482. args: [],
  3483. source: "collectionClass\x0a\x09^ HashedCollection",
  3484. messageSends: [],
  3485. referencedClasses: ["HashedCollection"]
  3486. }),
  3487. globals.HashedCollectionTest.klass);
  3488. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  3489. smalltalk.addMethod(
  3490. smalltalk.method({
  3491. selector: "collectionFirst",
  3492. protocol: 'fixture',
  3493. fn: function (){
  3494. var self=this;
  3495. return smalltalk.withContext(function($ctx1) {
  3496. self._subclassResponsibility();
  3497. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)})},
  3498. args: [],
  3499. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3500. messageSends: ["subclassResponsibility"],
  3501. referencedClasses: []
  3502. }),
  3503. globals.SequenceableCollectionTest);
  3504. smalltalk.addMethod(
  3505. smalltalk.method({
  3506. selector: "collectionFirstTwo",
  3507. protocol: 'fixture',
  3508. fn: function (){
  3509. var self=this;
  3510. return smalltalk.withContext(function($ctx1) {
  3511. self._subclassResponsibility();
  3512. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)})},
  3513. args: [],
  3514. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3515. messageSends: ["subclassResponsibility"],
  3516. referencedClasses: []
  3517. }),
  3518. globals.SequenceableCollectionTest);
  3519. smalltalk.addMethod(
  3520. smalltalk.method({
  3521. selector: "collectionLast",
  3522. protocol: 'fixture',
  3523. fn: function (){
  3524. var self=this;
  3525. return smalltalk.withContext(function($ctx1) {
  3526. self._subclassResponsibility();
  3527. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)})},
  3528. args: [],
  3529. source: "collectionLast\x0a\x09self subclassResponsibility",
  3530. messageSends: ["subclassResponsibility"],
  3531. referencedClasses: []
  3532. }),
  3533. globals.SequenceableCollectionTest);
  3534. smalltalk.addMethod(
  3535. smalltalk.method({
  3536. selector: "collectionLastTwo",
  3537. protocol: 'fixture',
  3538. fn: function (){
  3539. var self=this;
  3540. return smalltalk.withContext(function($ctx1) {
  3541. self._subclassResponsibility();
  3542. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)})},
  3543. args: [],
  3544. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3545. messageSends: ["subclassResponsibility"],
  3546. referencedClasses: []
  3547. }),
  3548. globals.SequenceableCollectionTest);
  3549. smalltalk.addMethod(
  3550. smalltalk.method({
  3551. selector: "nonIndexesDo:",
  3552. protocol: 'fixture',
  3553. fn: function (aBlock){
  3554. var self=this;
  3555. return smalltalk.withContext(function($ctx1) {
  3556. _st(aBlock)._value_((0));
  3557. $ctx1.sendIdx["value:"]=1;
  3558. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3559. $ctx1.sendIdx["value:"]=2;
  3560. _st(aBlock)._value_("z");
  3561. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3562. args: ["aBlock"],
  3563. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3564. messageSends: ["value:", "+", "collectionSize"],
  3565. referencedClasses: []
  3566. }),
  3567. globals.SequenceableCollectionTest);
  3568. smalltalk.addMethod(
  3569. smalltalk.method({
  3570. selector: "samplesDo:",
  3571. protocol: 'fixture',
  3572. fn: function (aBlock){
  3573. var self=this;
  3574. return smalltalk.withContext(function($ctx1) {
  3575. _st(aBlock)._value_value_((1),self._collectionFirst());
  3576. $ctx1.sendIdx["value:value:"]=1;
  3577. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3578. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3579. args: ["aBlock"],
  3580. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3581. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3582. referencedClasses: []
  3583. }),
  3584. globals.SequenceableCollectionTest);
  3585. smalltalk.addMethod(
  3586. smalltalk.method({
  3587. selector: "testBeginsWith",
  3588. protocol: 'tests',
  3589. fn: function (){
  3590. var self=this;
  3591. return smalltalk.withContext(function($ctx1) {
  3592. var $2,$1,$4,$5,$3,$7,$6;
  3593. $2=self._collection();
  3594. $ctx1.sendIdx["collection"]=1;
  3595. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3596. $ctx1.sendIdx["beginsWith:"]=1;
  3597. self._assert_($1);
  3598. $ctx1.sendIdx["assert:"]=1;
  3599. $4=self._collection();
  3600. $ctx1.sendIdx["collection"]=2;
  3601. $5=self._collection();
  3602. $ctx1.sendIdx["collection"]=3;
  3603. $3=_st($4)._beginsWith_($5);
  3604. $ctx1.sendIdx["beginsWith:"]=2;
  3605. self._assert_($3);
  3606. $ctx1.sendIdx["assert:"]=2;
  3607. $7=self._collection();
  3608. $ctx1.sendIdx["collection"]=4;
  3609. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3610. $ctx1.sendIdx["beginsWith:"]=3;
  3611. self._assert_($6);
  3612. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3613. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)})},
  3614. args: [],
  3615. 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)",
  3616. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3617. referencedClasses: []
  3618. }),
  3619. globals.SequenceableCollectionTest);
  3620. smalltalk.addMethod(
  3621. smalltalk.method({
  3622. selector: "testEndsWith",
  3623. protocol: 'tests',
  3624. fn: function (){
  3625. var self=this;
  3626. return smalltalk.withContext(function($ctx1) {
  3627. var $2,$1,$4,$5,$3,$7,$6;
  3628. $2=self._collection();
  3629. $ctx1.sendIdx["collection"]=1;
  3630. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3631. $ctx1.sendIdx["endsWith:"]=1;
  3632. self._assert_($1);
  3633. $ctx1.sendIdx["assert:"]=1;
  3634. $4=self._collection();
  3635. $ctx1.sendIdx["collection"]=2;
  3636. $5=self._collection();
  3637. $ctx1.sendIdx["collection"]=3;
  3638. $3=_st($4)._endsWith_($5);
  3639. $ctx1.sendIdx["endsWith:"]=2;
  3640. self._assert_($3);
  3641. $ctx1.sendIdx["assert:"]=2;
  3642. $7=self._collection();
  3643. $ctx1.sendIdx["collection"]=4;
  3644. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3645. $ctx1.sendIdx["endsWith:"]=3;
  3646. self._assert_($6);
  3647. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3648. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)})},
  3649. args: [],
  3650. 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)",
  3651. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3652. referencedClasses: []
  3653. }),
  3654. globals.SequenceableCollectionTest);
  3655. smalltalk.addMethod(
  3656. smalltalk.method({
  3657. selector: "testFirst",
  3658. protocol: 'tests',
  3659. fn: function (){
  3660. var self=this;
  3661. return smalltalk.withContext(function($ctx1) {
  3662. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3663. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)})},
  3664. args: [],
  3665. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3666. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3667. referencedClasses: []
  3668. }),
  3669. globals.SequenceableCollectionTest);
  3670. smalltalk.addMethod(
  3671. smalltalk.method({
  3672. selector: "testFirstN",
  3673. protocol: 'tests',
  3674. fn: function (){
  3675. var self=this;
  3676. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3677. return smalltalk.withContext(function($ctx1) {
  3678. var $2,$1,$4,$3,$6,$5,$7;
  3679. $2=self._collection();
  3680. $ctx1.sendIdx["collection"]=1;
  3681. $1=_st($2)._first_((2));
  3682. $ctx1.sendIdx["first:"]=1;
  3683. self._assert_equals_($1,self._collectionFirstTwo());
  3684. $ctx1.sendIdx["assert:equals:"]=1;
  3685. $4=self._collection();
  3686. $ctx1.sendIdx["collection"]=2;
  3687. $3=_st($4)._first_((0));
  3688. $ctx1.sendIdx["first:"]=2;
  3689. self._assert_equals_($3,_st(self._collectionClass())._new());
  3690. $ctx1.sendIdx["assert:equals:"]=2;
  3691. $6=self._collection();
  3692. $ctx1.sendIdx["collection"]=3;
  3693. $5=_st($6)._first_(self._collectionSize());
  3694. $ctx1.sendIdx["first:"]=3;
  3695. $7=self._collection();
  3696. $ctx1.sendIdx["collection"]=4;
  3697. self._assert_equals_($5,$7);
  3698. self._should_raise_((function(){
  3699. return smalltalk.withContext(function($ctx2) {
  3700. return _st(self._collection())._first_((33));
  3701. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3702. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)})},
  3703. args: [],
  3704. 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",
  3705. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3706. referencedClasses: ["Error"]
  3707. }),
  3708. globals.SequenceableCollectionTest);
  3709. smalltalk.addMethod(
  3710. smalltalk.method({
  3711. selector: "testFourth",
  3712. protocol: 'tests',
  3713. fn: function (){
  3714. var self=this;
  3715. return smalltalk.withContext(function($ctx1) {
  3716. var $2,$1;
  3717. $2=self._collection();
  3718. $ctx1.sendIdx["collection"]=1;
  3719. $1=_st($2)._fourth();
  3720. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3721. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)})},
  3722. args: [],
  3723. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3724. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3725. referencedClasses: []
  3726. }),
  3727. globals.SequenceableCollectionTest);
  3728. smalltalk.addMethod(
  3729. smalltalk.method({
  3730. selector: "testIndexOfStartingAt",
  3731. protocol: 'tests',
  3732. fn: function (){
  3733. var self=this;
  3734. var jsNull;
  3735. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3736. return smalltalk.withContext(function($ctx1) {
  3737. var $2,$1,$4,$3;
  3738. jsNull=_st($JSON())._parse_("null");
  3739. self._samplesDo_((function(index,value){
  3740. return smalltalk.withContext(function($ctx2) {
  3741. $2=self._collection();
  3742. $ctx2.sendIdx["collection"]=1;
  3743. $1=_st($2)._indexOf_startingAt_(value,(1));
  3744. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3745. self._assert_equals_($1,index);
  3746. $ctx2.sendIdx["assert:equals:"]=1;
  3747. $4=self._collection();
  3748. $ctx2.sendIdx["collection"]=2;
  3749. $3=_st($4)._indexOf_startingAt_(value,index);
  3750. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3751. self._assert_equals_($3,index);
  3752. $ctx2.sendIdx["assert:equals:"]=2;
  3753. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3754. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3755. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3756. args: [],
  3757. 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 ]",
  3758. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3759. referencedClasses: ["JSON"]
  3760. }),
  3761. globals.SequenceableCollectionTest);
  3762. smalltalk.addMethod(
  3763. smalltalk.method({
  3764. selector: "testIndexOfStartingAtWithNull",
  3765. protocol: 'tests',
  3766. fn: function (){
  3767. var self=this;
  3768. var jsNull;
  3769. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3770. return smalltalk.withContext(function($ctx1) {
  3771. var $1,$2;
  3772. jsNull=_st($JSON())._parse_("null");
  3773. self._samplesDo_((function(index,value){
  3774. var collection;
  3775. return smalltalk.withContext(function($ctx2) {
  3776. collection=self._collection();
  3777. collection;
  3778. _st(collection)._at_put_(index,jsNull);
  3779. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3780. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3781. self._assert_equals_($1,index);
  3782. $ctx2.sendIdx["assert:equals:"]=1;
  3783. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3784. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3785. self._assert_equals_($2,index);
  3786. $ctx2.sendIdx["assert:equals:"]=2;
  3787. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3788. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3789. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3790. args: [],
  3791. 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 ]",
  3792. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3793. referencedClasses: ["JSON"]
  3794. }),
  3795. globals.SequenceableCollectionTest);
  3796. smalltalk.addMethod(
  3797. smalltalk.method({
  3798. selector: "testLast",
  3799. protocol: 'tests',
  3800. fn: function (){
  3801. var self=this;
  3802. return smalltalk.withContext(function($ctx1) {
  3803. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3804. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)})},
  3805. args: [],
  3806. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3807. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3808. referencedClasses: []
  3809. }),
  3810. globals.SequenceableCollectionTest);
  3811. smalltalk.addMethod(
  3812. smalltalk.method({
  3813. selector: "testLastN",
  3814. protocol: 'tests',
  3815. fn: function (){
  3816. var self=this;
  3817. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3818. return smalltalk.withContext(function($ctx1) {
  3819. var $2,$1,$4,$3,$6,$5,$7;
  3820. $2=self._collection();
  3821. $ctx1.sendIdx["collection"]=1;
  3822. $1=_st($2)._last_((2));
  3823. $ctx1.sendIdx["last:"]=1;
  3824. self._assert_equals_($1,self._collectionLastTwo());
  3825. $ctx1.sendIdx["assert:equals:"]=1;
  3826. $4=self._collection();
  3827. $ctx1.sendIdx["collection"]=2;
  3828. $3=_st($4)._last_((0));
  3829. $ctx1.sendIdx["last:"]=2;
  3830. self._assert_equals_($3,_st(self._collectionClass())._new());
  3831. $ctx1.sendIdx["assert:equals:"]=2;
  3832. $6=self._collection();
  3833. $ctx1.sendIdx["collection"]=3;
  3834. $5=_st($6)._last_(self._collectionSize());
  3835. $ctx1.sendIdx["last:"]=3;
  3836. $7=self._collection();
  3837. $ctx1.sendIdx["collection"]=4;
  3838. self._assert_equals_($5,$7);
  3839. self._should_raise_((function(){
  3840. return smalltalk.withContext(function($ctx2) {
  3841. return _st(self._collection())._last_((33));
  3842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3843. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)})},
  3844. args: [],
  3845. 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",
  3846. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3847. referencedClasses: ["Error"]
  3848. }),
  3849. globals.SequenceableCollectionTest);
  3850. smalltalk.addMethod(
  3851. smalltalk.method({
  3852. selector: "testSecond",
  3853. protocol: 'tests',
  3854. fn: function (){
  3855. var self=this;
  3856. return smalltalk.withContext(function($ctx1) {
  3857. var $2,$1;
  3858. $2=self._collection();
  3859. $ctx1.sendIdx["collection"]=1;
  3860. $1=_st($2)._second();
  3861. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3862. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)})},
  3863. args: [],
  3864. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3865. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3866. referencedClasses: []
  3867. }),
  3868. globals.SequenceableCollectionTest);
  3869. smalltalk.addMethod(
  3870. smalltalk.method({
  3871. selector: "testThird",
  3872. protocol: 'tests',
  3873. fn: function (){
  3874. var self=this;
  3875. return smalltalk.withContext(function($ctx1) {
  3876. var $2,$1;
  3877. $2=self._collection();
  3878. $ctx1.sendIdx["collection"]=1;
  3879. $1=_st($2)._third();
  3880. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3881. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)})},
  3882. args: [],
  3883. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3884. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3885. referencedClasses: []
  3886. }),
  3887. globals.SequenceableCollectionTest);
  3888. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  3889. smalltalk.addMethod(
  3890. smalltalk.method({
  3891. selector: "collection",
  3892. protocol: 'fixture',
  3893. fn: function (){
  3894. var self=this;
  3895. var $1;
  3896. $1=[(1), (2), (3), (-4)];
  3897. return $1;
  3898. },
  3899. args: [],
  3900. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3901. messageSends: [],
  3902. referencedClasses: []
  3903. }),
  3904. globals.ArrayTest);
  3905. smalltalk.addMethod(
  3906. smalltalk.method({
  3907. selector: "collectionFirst",
  3908. protocol: 'fixture',
  3909. fn: function (){
  3910. var self=this;
  3911. return (1);
  3912. },
  3913. args: [],
  3914. source: "collectionFirst\x0a\x09^ 1",
  3915. messageSends: [],
  3916. referencedClasses: []
  3917. }),
  3918. globals.ArrayTest);
  3919. smalltalk.addMethod(
  3920. smalltalk.method({
  3921. selector: "collectionFirstTwo",
  3922. protocol: 'fixture',
  3923. fn: function (){
  3924. var self=this;
  3925. var $1;
  3926. $1=[(1), (2)];
  3927. return $1;
  3928. },
  3929. args: [],
  3930. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3931. messageSends: [],
  3932. referencedClasses: []
  3933. }),
  3934. globals.ArrayTest);
  3935. smalltalk.addMethod(
  3936. smalltalk.method({
  3937. selector: "collectionLast",
  3938. protocol: 'fixture',
  3939. fn: function (){
  3940. var self=this;
  3941. return (-4);
  3942. },
  3943. args: [],
  3944. source: "collectionLast\x0a\x09^ -4",
  3945. messageSends: [],
  3946. referencedClasses: []
  3947. }),
  3948. globals.ArrayTest);
  3949. smalltalk.addMethod(
  3950. smalltalk.method({
  3951. selector: "collectionLastTwo",
  3952. protocol: 'fixture',
  3953. fn: function (){
  3954. var self=this;
  3955. var $1;
  3956. $1=[(3), (-4)];
  3957. return $1;
  3958. },
  3959. args: [],
  3960. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3961. messageSends: [],
  3962. referencedClasses: []
  3963. }),
  3964. globals.ArrayTest);
  3965. smalltalk.addMethod(
  3966. smalltalk.method({
  3967. selector: "collectionOfPrintStrings",
  3968. protocol: 'fixture',
  3969. fn: function (){
  3970. var self=this;
  3971. var $1;
  3972. $1=["1", "2", "3", "-4"];
  3973. return $1;
  3974. },
  3975. args: [],
  3976. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  3977. messageSends: [],
  3978. referencedClasses: []
  3979. }),
  3980. globals.ArrayTest);
  3981. smalltalk.addMethod(
  3982. smalltalk.method({
  3983. selector: "collectionSize",
  3984. protocol: 'fixture',
  3985. fn: function (){
  3986. var self=this;
  3987. return (4);
  3988. },
  3989. args: [],
  3990. source: "collectionSize\x0a\x09^ 4",
  3991. messageSends: [],
  3992. referencedClasses: []
  3993. }),
  3994. globals.ArrayTest);
  3995. smalltalk.addMethod(
  3996. smalltalk.method({
  3997. selector: "collectionWithDuplicates",
  3998. protocol: 'fixture',
  3999. fn: function (){
  4000. var self=this;
  4001. var $1;
  4002. $1=["a", "b", "c", (1), (2), (1), "a"];
  4003. return $1;
  4004. },
  4005. args: [],
  4006. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4007. messageSends: [],
  4008. referencedClasses: []
  4009. }),
  4010. globals.ArrayTest);
  4011. smalltalk.addMethod(
  4012. smalltalk.method({
  4013. selector: "collectionWithNewValue",
  4014. protocol: 'fixture',
  4015. fn: function (){
  4016. var self=this;
  4017. var $1;
  4018. $1=[(1), (2), (3), (-4), "N"];
  4019. return $1;
  4020. },
  4021. args: [],
  4022. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4023. messageSends: [],
  4024. referencedClasses: []
  4025. }),
  4026. globals.ArrayTest);
  4027. smalltalk.addMethod(
  4028. smalltalk.method({
  4029. selector: "sampleNewIndex",
  4030. protocol: 'fixture',
  4031. fn: function (){
  4032. var self=this;
  4033. return (5);
  4034. },
  4035. args: [],
  4036. source: "sampleNewIndex\x0a\x09^ 5",
  4037. messageSends: [],
  4038. referencedClasses: []
  4039. }),
  4040. globals.ArrayTest);
  4041. smalltalk.addMethod(
  4042. smalltalk.method({
  4043. selector: "samplesDo:",
  4044. protocol: 'fixture',
  4045. fn: function (aBlock){
  4046. var self=this;
  4047. return smalltalk.withContext(function($ctx1) {
  4048. ($ctx1.supercall = true, globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4049. $ctx1.supercall = false;
  4050. _st(aBlock)._value_value_((3),(3));
  4051. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)})},
  4052. args: ["aBlock"],
  4053. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4054. messageSends: ["samplesDo:", "value:value:"],
  4055. referencedClasses: []
  4056. }),
  4057. globals.ArrayTest);
  4058. smalltalk.addMethod(
  4059. smalltalk.method({
  4060. selector: "testAdd",
  4061. protocol: 'tests',
  4062. fn: function (){
  4063. var self=this;
  4064. var array;
  4065. return smalltalk.withContext(function($ctx1) {
  4066. array=self._collection();
  4067. _st(array)._add_((6));
  4068. self._assert_equals_(_st(array)._last(),(6));
  4069. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)})},
  4070. args: [],
  4071. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4072. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4073. referencedClasses: []
  4074. }),
  4075. globals.ArrayTest);
  4076. smalltalk.addMethod(
  4077. smalltalk.method({
  4078. selector: "testAddFirst",
  4079. protocol: 'tests',
  4080. fn: function (){
  4081. var self=this;
  4082. return smalltalk.withContext(function($ctx1) {
  4083. var $1,$2;
  4084. $1=self._collection();
  4085. _st($1)._addFirst_((0));
  4086. $2=_st($1)._yourself();
  4087. self._assert_equals_(_st($2)._first(),(0));
  4088. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)})},
  4089. args: [],
  4090. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4091. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4092. referencedClasses: []
  4093. }),
  4094. globals.ArrayTest);
  4095. smalltalk.addMethod(
  4096. smalltalk.method({
  4097. selector: "testPrintString",
  4098. protocol: 'tests',
  4099. fn: function (){
  4100. var self=this;
  4101. var array;
  4102. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4103. return smalltalk.withContext(function($ctx1) {
  4104. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4105. array=_st($Array())._new();
  4106. $1=_st(array)._printString();
  4107. $ctx1.sendIdx["printString"]=1;
  4108. self._assert_equals_($1,"an Array ()");
  4109. $ctx1.sendIdx["assert:equals:"]=1;
  4110. $2=array;
  4111. _st($2)._add_((1));
  4112. $ctx1.sendIdx["add:"]=1;
  4113. $3=_st($2)._add_((3));
  4114. $ctx1.sendIdx["add:"]=2;
  4115. $4=_st(array)._printString();
  4116. $ctx1.sendIdx["printString"]=2;
  4117. self._assert_equals_($4,"an Array (1 3)");
  4118. $ctx1.sendIdx["assert:equals:"]=2;
  4119. _st(array)._add_("foo");
  4120. $5=_st(array)._printString();
  4121. $ctx1.sendIdx["printString"]=3;
  4122. self._assert_equals_($5,"an Array (1 3 'foo')");
  4123. $ctx1.sendIdx["assert:equals:"]=3;
  4124. $6=array;
  4125. _st($6)._remove_((1));
  4126. $ctx1.sendIdx["remove:"]=1;
  4127. $7=_st($6)._remove_((3));
  4128. $8=_st(array)._printString();
  4129. $ctx1.sendIdx["printString"]=4;
  4130. self._assert_equals_($8,"an Array ('foo')");
  4131. $ctx1.sendIdx["assert:equals:"]=4;
  4132. _st(array)._addLast_((3));
  4133. $ctx1.sendIdx["addLast:"]=1;
  4134. $9=_st(array)._printString();
  4135. $ctx1.sendIdx["printString"]=5;
  4136. self._assert_equals_($9,"an Array ('foo' 3)");
  4137. $ctx1.sendIdx["assert:equals:"]=5;
  4138. _st(array)._addLast_((3));
  4139. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4140. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)})},
  4141. args: [],
  4142. 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)'.",
  4143. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4144. referencedClasses: ["Array"]
  4145. }),
  4146. globals.ArrayTest);
  4147. smalltalk.addMethod(
  4148. smalltalk.method({
  4149. selector: "testRemove",
  4150. protocol: 'tests',
  4151. fn: function (){
  4152. var self=this;
  4153. var array;
  4154. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4155. return smalltalk.withContext(function($ctx1) {
  4156. array=[(1), (2), (3), (4), (5)];
  4157. _st(array)._remove_((3));
  4158. $ctx1.sendIdx["remove:"]=1;
  4159. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4160. self._should_raise_((function(){
  4161. return smalltalk.withContext(function($ctx2) {
  4162. return _st(array)._remove_((3));
  4163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4164. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)})},
  4165. args: [],
  4166. 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",
  4167. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4168. referencedClasses: ["Error"]
  4169. }),
  4170. globals.ArrayTest);
  4171. smalltalk.addMethod(
  4172. smalltalk.method({
  4173. selector: "testRemoveFromTo",
  4174. protocol: 'tests',
  4175. fn: function (){
  4176. var self=this;
  4177. return smalltalk.withContext(function($ctx1) {
  4178. var $1,$2;
  4179. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4180. $ctx1.sendIdx["removeFrom:to:"]=1;
  4181. self._assert_equals_($1,[(4)]);
  4182. $ctx1.sendIdx["assert:equals:"]=1;
  4183. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4184. $ctx1.sendIdx["removeFrom:to:"]=2;
  4185. self._assert_equals_($2,[(1), (4)]);
  4186. $ctx1.sendIdx["assert:equals:"]=2;
  4187. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4188. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)})},
  4189. args: [],
  4190. 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)",
  4191. messageSends: ["assert:equals:", "removeFrom:to:"],
  4192. referencedClasses: []
  4193. }),
  4194. globals.ArrayTest);
  4195. smalltalk.addMethod(
  4196. smalltalk.method({
  4197. selector: "testRemoveIndex",
  4198. protocol: 'tests',
  4199. fn: function (){
  4200. var self=this;
  4201. return smalltalk.withContext(function($ctx1) {
  4202. var $1,$2;
  4203. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4204. $ctx1.sendIdx["removeIndex:"]=1;
  4205. self._assert_equals_($1,[(1), (3), (4)]);
  4206. $ctx1.sendIdx["assert:equals:"]=1;
  4207. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4208. $ctx1.sendIdx["removeIndex:"]=2;
  4209. self._assert_equals_($2,[(2), (3), (4)]);
  4210. $ctx1.sendIdx["assert:equals:"]=2;
  4211. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4212. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)})},
  4213. args: [],
  4214. 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: #()",
  4215. messageSends: ["assert:equals:", "removeIndex:"],
  4216. referencedClasses: []
  4217. }),
  4218. globals.ArrayTest);
  4219. smalltalk.addMethod(
  4220. smalltalk.method({
  4221. selector: "testRemoveLast",
  4222. protocol: 'tests',
  4223. fn: function (){
  4224. var self=this;
  4225. var array;
  4226. return smalltalk.withContext(function($ctx1) {
  4227. array=[(1), (2)];
  4228. _st(array)._removeLast();
  4229. self._assert_equals_(_st(array)._last(),(1));
  4230. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)})},
  4231. args: [],
  4232. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4233. messageSends: ["removeLast", "assert:equals:", "last"],
  4234. referencedClasses: []
  4235. }),
  4236. globals.ArrayTest);
  4237. smalltalk.addMethod(
  4238. smalltalk.method({
  4239. selector: "testReversed",
  4240. protocol: 'tests',
  4241. fn: function (){
  4242. var self=this;
  4243. var array;
  4244. return smalltalk.withContext(function($ctx1) {
  4245. array=[(5), (4), (3), (2), (1)];
  4246. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4247. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)})},
  4248. args: [],
  4249. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4250. messageSends: ["assert:equals:", "reversed"],
  4251. referencedClasses: []
  4252. }),
  4253. globals.ArrayTest);
  4254. smalltalk.addMethod(
  4255. smalltalk.method({
  4256. selector: "testSort",
  4257. protocol: 'tests',
  4258. fn: function (){
  4259. var self=this;
  4260. var array;
  4261. return smalltalk.withContext(function($ctx1) {
  4262. array=[(10), (1), (5)];
  4263. _st(array)._sort();
  4264. self._assert_equals_(array,[(1), (5), (10)]);
  4265. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)})},
  4266. args: [],
  4267. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  4268. messageSends: ["sort", "assert:equals:"],
  4269. referencedClasses: []
  4270. }),
  4271. globals.ArrayTest);
  4272. smalltalk.addMethod(
  4273. smalltalk.method({
  4274. selector: "collectionClass",
  4275. protocol: 'fixture',
  4276. fn: function (){
  4277. var self=this;
  4278. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4279. return $Array();
  4280. },
  4281. args: [],
  4282. source: "collectionClass\x0a\x09^ Array",
  4283. messageSends: [],
  4284. referencedClasses: ["Array"]
  4285. }),
  4286. globals.ArrayTest.klass);
  4287. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  4288. smalltalk.addMethod(
  4289. smalltalk.method({
  4290. selector: "collection",
  4291. protocol: 'fixture',
  4292. fn: function (){
  4293. var self=this;
  4294. return "helLo";
  4295. },
  4296. args: [],
  4297. source: "collection\x0a\x09^ 'helLo'",
  4298. messageSends: [],
  4299. referencedClasses: []
  4300. }),
  4301. globals.StringTest);
  4302. smalltalk.addMethod(
  4303. smalltalk.method({
  4304. selector: "collectionFirst",
  4305. protocol: 'fixture',
  4306. fn: function (){
  4307. var self=this;
  4308. return "h";
  4309. },
  4310. args: [],
  4311. source: "collectionFirst\x0a\x09^ 'h'",
  4312. messageSends: [],
  4313. referencedClasses: []
  4314. }),
  4315. globals.StringTest);
  4316. smalltalk.addMethod(
  4317. smalltalk.method({
  4318. selector: "collectionFirstTwo",
  4319. protocol: 'fixture',
  4320. fn: function (){
  4321. var self=this;
  4322. return "he";
  4323. },
  4324. args: [],
  4325. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4326. messageSends: [],
  4327. referencedClasses: []
  4328. }),
  4329. globals.StringTest);
  4330. smalltalk.addMethod(
  4331. smalltalk.method({
  4332. selector: "collectionLast",
  4333. protocol: 'fixture',
  4334. fn: function (){
  4335. var self=this;
  4336. return "o";
  4337. },
  4338. args: [],
  4339. source: "collectionLast\x0a\x09^ 'o'",
  4340. messageSends: [],
  4341. referencedClasses: []
  4342. }),
  4343. globals.StringTest);
  4344. smalltalk.addMethod(
  4345. smalltalk.method({
  4346. selector: "collectionLastTwo",
  4347. protocol: 'fixture',
  4348. fn: function (){
  4349. var self=this;
  4350. return "Lo";
  4351. },
  4352. args: [],
  4353. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4354. messageSends: [],
  4355. referencedClasses: []
  4356. }),
  4357. globals.StringTest);
  4358. smalltalk.addMethod(
  4359. smalltalk.method({
  4360. selector: "collectionOfPrintStrings",
  4361. protocol: 'fixture',
  4362. fn: function (){
  4363. var self=this;
  4364. return "'h''e''l''L''o'";
  4365. },
  4366. args: [],
  4367. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4368. messageSends: [],
  4369. referencedClasses: []
  4370. }),
  4371. globals.StringTest);
  4372. smalltalk.addMethod(
  4373. smalltalk.method({
  4374. selector: "collectionSize",
  4375. protocol: 'fixture',
  4376. fn: function (){
  4377. var self=this;
  4378. return (5);
  4379. },
  4380. args: [],
  4381. source: "collectionSize\x0a\x09^ 5",
  4382. messageSends: [],
  4383. referencedClasses: []
  4384. }),
  4385. globals.StringTest);
  4386. smalltalk.addMethod(
  4387. smalltalk.method({
  4388. selector: "collectionWithDuplicates",
  4389. protocol: 'fixture',
  4390. fn: function (){
  4391. var self=this;
  4392. return "abbaerte";
  4393. },
  4394. args: [],
  4395. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4396. messageSends: [],
  4397. referencedClasses: []
  4398. }),
  4399. globals.StringTest);
  4400. smalltalk.addMethod(
  4401. smalltalk.method({
  4402. selector: "collectionWithNewValue",
  4403. protocol: 'fixture',
  4404. fn: function (){
  4405. var self=this;
  4406. return "helLoN";
  4407. },
  4408. args: [],
  4409. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4410. messageSends: [],
  4411. referencedClasses: []
  4412. }),
  4413. globals.StringTest);
  4414. smalltalk.addMethod(
  4415. smalltalk.method({
  4416. selector: "sampleNewValueAsCollection",
  4417. protocol: 'fixture',
  4418. fn: function (){
  4419. var self=this;
  4420. return "N";
  4421. },
  4422. args: [],
  4423. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4424. messageSends: [],
  4425. referencedClasses: []
  4426. }),
  4427. globals.StringTest);
  4428. smalltalk.addMethod(
  4429. smalltalk.method({
  4430. selector: "samplesDo:",
  4431. protocol: 'fixture',
  4432. fn: function (aBlock){
  4433. var self=this;
  4434. return smalltalk.withContext(function($ctx1) {
  4435. ($ctx1.supercall = true, globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4436. $ctx1.supercall = false;
  4437. _st(aBlock)._value_value_((3),"l");
  4438. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)})},
  4439. args: ["aBlock"],
  4440. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4441. messageSends: ["samplesDo:", "value:value:"],
  4442. referencedClasses: []
  4443. }),
  4444. globals.StringTest);
  4445. smalltalk.addMethod(
  4446. smalltalk.method({
  4447. selector: "testAddAll",
  4448. protocol: 'tests',
  4449. fn: function (){
  4450. var self=this;
  4451. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4452. return smalltalk.withContext(function($ctx1) {
  4453. var $1;
  4454. self._should_raise_((function(){
  4455. return smalltalk.withContext(function($ctx2) {
  4456. $1=self._collection();
  4457. $ctx2.sendIdx["collection"]=1;
  4458. return _st($1)._addAll_(self._collection());
  4459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4460. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)})},
  4461. args: [],
  4462. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4463. messageSends: ["should:raise:", "addAll:", "collection"],
  4464. referencedClasses: ["Error"]
  4465. }),
  4466. globals.StringTest);
  4467. smalltalk.addMethod(
  4468. smalltalk.method({
  4469. selector: "testAddRemove",
  4470. protocol: 'tests',
  4471. fn: function (){
  4472. var self=this;
  4473. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4474. return smalltalk.withContext(function($ctx1) {
  4475. self._should_raise_((function(){
  4476. return smalltalk.withContext(function($ctx2) {
  4477. return "hello"._add_("a");
  4478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4479. $ctx1.sendIdx["should:raise:"]=1;
  4480. self._should_raise_((function(){
  4481. return smalltalk.withContext(function($ctx2) {
  4482. return "hello"._remove_("h");
  4483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4484. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)})},
  4485. args: [],
  4486. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4487. messageSends: ["should:raise:", "add:", "remove:"],
  4488. referencedClasses: ["Error"]
  4489. }),
  4490. globals.StringTest);
  4491. smalltalk.addMethod(
  4492. smalltalk.method({
  4493. selector: "testAsArray",
  4494. protocol: 'tests',
  4495. fn: function (){
  4496. var self=this;
  4497. return smalltalk.withContext(function($ctx1) {
  4498. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4499. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)})},
  4500. args: [],
  4501. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4502. messageSends: ["assert:equals:", "asArray"],
  4503. referencedClasses: []
  4504. }),
  4505. globals.StringTest);
  4506. smalltalk.addMethod(
  4507. smalltalk.method({
  4508. selector: "testAsLowerCase",
  4509. protocol: 'tests',
  4510. fn: function (){
  4511. var self=this;
  4512. return smalltalk.withContext(function($ctx1) {
  4513. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4514. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)})},
  4515. args: [],
  4516. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4517. messageSends: ["assert:equals:", "asLowercase"],
  4518. referencedClasses: []
  4519. }),
  4520. globals.StringTest);
  4521. smalltalk.addMethod(
  4522. smalltalk.method({
  4523. selector: "testAsNumber",
  4524. protocol: 'tests',
  4525. fn: function (){
  4526. var self=this;
  4527. return smalltalk.withContext(function($ctx1) {
  4528. var $1,$2;
  4529. $1="3"._asNumber();
  4530. $ctx1.sendIdx["asNumber"]=1;
  4531. self._assert_equals_($1,(3));
  4532. $ctx1.sendIdx["assert:equals:"]=1;
  4533. $2="-3"._asNumber();
  4534. $ctx1.sendIdx["asNumber"]=2;
  4535. self._assert_equals_($2,(-3));
  4536. $ctx1.sendIdx["assert:equals:"]=2;
  4537. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4538. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)})},
  4539. args: [],
  4540. 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.",
  4541. messageSends: ["assert:equals:", "asNumber"],
  4542. referencedClasses: []
  4543. }),
  4544. globals.StringTest);
  4545. smalltalk.addMethod(
  4546. smalltalk.method({
  4547. selector: "testAsUpperCase",
  4548. protocol: 'tests',
  4549. fn: function (){
  4550. var self=this;
  4551. return smalltalk.withContext(function($ctx1) {
  4552. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4553. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)})},
  4554. args: [],
  4555. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4556. messageSends: ["assert:equals:", "asUppercase"],
  4557. referencedClasses: []
  4558. }),
  4559. globals.StringTest);
  4560. smalltalk.addMethod(
  4561. smalltalk.method({
  4562. selector: "testAsciiValue",
  4563. protocol: 'tests',
  4564. fn: function (){
  4565. var self=this;
  4566. var characterA,characterU;
  4567. return smalltalk.withContext(function($ctx1) {
  4568. var $1;
  4569. characterA="A";
  4570. characterU="U";
  4571. $1=_st(characterA)._asciiValue();
  4572. $ctx1.sendIdx["asciiValue"]=1;
  4573. self._assert_equals_($1,(65));
  4574. $ctx1.sendIdx["assert:equals:"]=1;
  4575. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4576. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)})},
  4577. args: [],
  4578. 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",
  4579. messageSends: ["assert:equals:", "asciiValue"],
  4580. referencedClasses: []
  4581. }),
  4582. globals.StringTest);
  4583. smalltalk.addMethod(
  4584. smalltalk.method({
  4585. selector: "testAtIfAbsentPut",
  4586. protocol: 'tests',
  4587. fn: function (){
  4588. var self=this;
  4589. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4590. return smalltalk.withContext(function($ctx1) {
  4591. self._should_raise_((function(){
  4592. return smalltalk.withContext(function($ctx2) {
  4593. return "hello"._at_ifAbsentPut_((6),(function(){
  4594. return "a";
  4595. }));
  4596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4597. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)})},
  4598. args: [],
  4599. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4600. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4601. referencedClasses: ["Error"]
  4602. }),
  4603. globals.StringTest);
  4604. smalltalk.addMethod(
  4605. smalltalk.method({
  4606. selector: "testAtPut",
  4607. protocol: 'tests',
  4608. fn: function (){
  4609. var self=this;
  4610. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4611. return smalltalk.withContext(function($ctx1) {
  4612. self._should_raise_((function(){
  4613. return smalltalk.withContext(function($ctx2) {
  4614. return "hello"._at_put_((1),"a");
  4615. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4616. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)})},
  4617. args: [],
  4618. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4619. messageSends: ["should:raise:", "at:put:"],
  4620. referencedClasses: ["Error"]
  4621. }),
  4622. globals.StringTest);
  4623. smalltalk.addMethod(
  4624. smalltalk.method({
  4625. selector: "testCapitalized",
  4626. protocol: 'tests',
  4627. fn: function (){
  4628. var self=this;
  4629. return smalltalk.withContext(function($ctx1) {
  4630. var $1,$2,$3;
  4631. $1="test"._capitalized();
  4632. $ctx1.sendIdx["capitalized"]=1;
  4633. self._assert_equals_($1,"Test");
  4634. $ctx1.sendIdx["assert:equals:"]=1;
  4635. $2="Test"._capitalized();
  4636. $ctx1.sendIdx["capitalized"]=2;
  4637. self._assert_equals_($2,"Test");
  4638. $ctx1.sendIdx["assert:equals:"]=2;
  4639. self._assert_equals_(""._capitalized(),"");
  4640. $ctx1.sendIdx["assert:equals:"]=3;
  4641. $3="Test"._isCapitalized();
  4642. $ctx1.sendIdx["isCapitalized"]=1;
  4643. self._assert_equals_($3,true);
  4644. $ctx1.sendIdx["assert:equals:"]=4;
  4645. self._assert_equals_("test"._isCapitalized(),false);
  4646. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)})},
  4647. args: [],
  4648. 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.",
  4649. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4650. referencedClasses: []
  4651. }),
  4652. globals.StringTest);
  4653. smalltalk.addMethod(
  4654. smalltalk.method({
  4655. selector: "testCharCodeAt",
  4656. protocol: 'tests',
  4657. fn: function (){
  4658. var self=this;
  4659. return smalltalk.withContext(function($ctx1) {
  4660. var $1,$2,$3,$4,$5;
  4661. $1="jackie"._charCodeAt_((1));
  4662. $ctx1.sendIdx["charCodeAt:"]=1;
  4663. self._assert_equals_($1,(106));
  4664. $ctx1.sendIdx["assert:equals:"]=1;
  4665. $2="jackie"._charCodeAt_((2));
  4666. $ctx1.sendIdx["charCodeAt:"]=2;
  4667. self._assert_equals_($2,(97));
  4668. $ctx1.sendIdx["assert:equals:"]=2;
  4669. $3="jackie"._charCodeAt_((3));
  4670. $ctx1.sendIdx["charCodeAt:"]=3;
  4671. self._assert_equals_($3,(99));
  4672. $ctx1.sendIdx["assert:equals:"]=3;
  4673. $4="jackie"._charCodeAt_((4));
  4674. $ctx1.sendIdx["charCodeAt:"]=4;
  4675. self._assert_equals_($4,(107));
  4676. $ctx1.sendIdx["assert:equals:"]=4;
  4677. $5="jackie"._charCodeAt_((5));
  4678. $ctx1.sendIdx["charCodeAt:"]=5;
  4679. self._assert_equals_($5,(105));
  4680. $ctx1.sendIdx["assert:equals:"]=5;
  4681. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4682. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)})},
  4683. args: [],
  4684. 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",
  4685. messageSends: ["assert:equals:", "charCodeAt:"],
  4686. referencedClasses: []
  4687. }),
  4688. globals.StringTest);
  4689. smalltalk.addMethod(
  4690. smalltalk.method({
  4691. selector: "testCopyFromTo",
  4692. protocol: 'tests',
  4693. fn: function (){
  4694. var self=this;
  4695. return smalltalk.withContext(function($ctx1) {
  4696. var $1;
  4697. $1="jackie"._copyFrom_to_((1),(3));
  4698. $ctx1.sendIdx["copyFrom:to:"]=1;
  4699. self._assert_equals_($1,"jac");
  4700. $ctx1.sendIdx["assert:equals:"]=1;
  4701. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4702. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)})},
  4703. args: [],
  4704. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4705. messageSends: ["assert:equals:", "copyFrom:to:"],
  4706. referencedClasses: []
  4707. }),
  4708. globals.StringTest);
  4709. smalltalk.addMethod(
  4710. smalltalk.method({
  4711. selector: "testCopyWithoutAll",
  4712. protocol: 'tests',
  4713. fn: function (){
  4714. var self=this;
  4715. return smalltalk.withContext(function($ctx1) {
  4716. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4717. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)})},
  4718. args: [],
  4719. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4720. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4721. referencedClasses: []
  4722. }),
  4723. globals.StringTest);
  4724. smalltalk.addMethod(
  4725. smalltalk.method({
  4726. selector: "testEquality",
  4727. protocol: 'tests',
  4728. fn: function (){
  4729. var self=this;
  4730. return smalltalk.withContext(function($ctx1) {
  4731. var $1,$2,$3;
  4732. self._assert_equals_("hello","hello");
  4733. $ctx1.sendIdx["assert:equals:"]=1;
  4734. $1="hello".__eq("world");
  4735. $ctx1.sendIdx["="]=1;
  4736. self._deny_($1);
  4737. $ctx1.sendIdx["deny:"]=1;
  4738. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4739. })));
  4740. $ctx1.sendIdx["="]=2;
  4741. self._deny_($2);
  4742. $ctx1.sendIdx["deny:"]=2;
  4743. $3="hello"._yourself();
  4744. $ctx1.sendIdx["yourself"]=1;
  4745. self._assert_equals_("hello",$3);
  4746. $ctx1.sendIdx["assert:equals:"]=2;
  4747. self._assert_equals_("hello"._yourself(),"hello");
  4748. self._deny_("".__eq((0)));
  4749. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)})},
  4750. args: [],
  4751. 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",
  4752. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4753. referencedClasses: []
  4754. }),
  4755. globals.StringTest);
  4756. smalltalk.addMethod(
  4757. smalltalk.method({
  4758. selector: "testIdentity",
  4759. protocol: 'tests',
  4760. fn: function (){
  4761. var self=this;
  4762. return smalltalk.withContext(function($ctx1) {
  4763. var $1,$2,$4,$3,$5;
  4764. $1="hello".__eq_eq("hello");
  4765. $ctx1.sendIdx["=="]=1;
  4766. self._assert_($1);
  4767. $ctx1.sendIdx["assert:"]=1;
  4768. $2="hello".__eq_eq("world");
  4769. $ctx1.sendIdx["=="]=2;
  4770. self._deny_($2);
  4771. $ctx1.sendIdx["deny:"]=1;
  4772. $4="hello"._yourself();
  4773. $ctx1.sendIdx["yourself"]=1;
  4774. $3="hello".__eq_eq($4);
  4775. $ctx1.sendIdx["=="]=3;
  4776. self._assert_($3);
  4777. $ctx1.sendIdx["assert:"]=2;
  4778. $5=_st("hello"._yourself()).__eq_eq("hello");
  4779. $ctx1.sendIdx["=="]=4;
  4780. self._assert_($5);
  4781. self._deny_("".__eq_eq((0)));
  4782. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)})},
  4783. args: [],
  4784. 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",
  4785. messageSends: ["assert:", "==", "deny:", "yourself"],
  4786. referencedClasses: []
  4787. }),
  4788. globals.StringTest);
  4789. smalltalk.addMethod(
  4790. smalltalk.method({
  4791. selector: "testIdentityHash",
  4792. protocol: 'tests',
  4793. fn: function (){
  4794. var self=this;
  4795. return smalltalk.withContext(function($ctx1) {
  4796. var $1,$2,$4,$3;
  4797. $1="foo"._identityHash();
  4798. $ctx1.sendIdx["identityHash"]=1;
  4799. $2="foo"._identityHash();
  4800. $ctx1.sendIdx["identityHash"]=2;
  4801. self._assert_equals_($1,$2);
  4802. $4="foo"._identityHash();
  4803. $ctx1.sendIdx["identityHash"]=3;
  4804. $3=_st($4).__eq("bar"._identityHash());
  4805. self._deny_($3);
  4806. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)})},
  4807. args: [],
  4808. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4809. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4810. referencedClasses: []
  4811. }),
  4812. globals.StringTest);
  4813. smalltalk.addMethod(
  4814. smalltalk.method({
  4815. selector: "testIncludesSubString",
  4816. protocol: 'tests',
  4817. fn: function (){
  4818. var self=this;
  4819. return smalltalk.withContext(function($ctx1) {
  4820. var $1;
  4821. $1="amber"._includesSubString_("ber");
  4822. $ctx1.sendIdx["includesSubString:"]=1;
  4823. self._assert_($1);
  4824. self._deny_("amber"._includesSubString_("zork"));
  4825. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)})},
  4826. args: [],
  4827. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4828. messageSends: ["assert:", "includesSubString:", "deny:"],
  4829. referencedClasses: []
  4830. }),
  4831. globals.StringTest);
  4832. smalltalk.addMethod(
  4833. smalltalk.method({
  4834. selector: "testIndexOfStartingAtWithNull",
  4835. protocol: 'tests',
  4836. fn: function (){
  4837. var self=this;
  4838. return self},
  4839. args: [],
  4840. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4841. messageSends: [],
  4842. referencedClasses: []
  4843. }),
  4844. globals.StringTest);
  4845. smalltalk.addMethod(
  4846. smalltalk.method({
  4847. selector: "testIndexOfWithNull",
  4848. protocol: 'tests',
  4849. fn: function (){
  4850. var self=this;
  4851. return self},
  4852. args: [],
  4853. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4854. messageSends: [],
  4855. referencedClasses: []
  4856. }),
  4857. globals.StringTest);
  4858. smalltalk.addMethod(
  4859. smalltalk.method({
  4860. selector: "testIsVowel",
  4861. protocol: 'tests',
  4862. fn: function (){
  4863. var self=this;
  4864. var vowel,consonant;
  4865. return smalltalk.withContext(function($ctx1) {
  4866. var $1;
  4867. vowel="u";
  4868. consonant="z";
  4869. $1=_st(vowel)._isVowel();
  4870. $ctx1.sendIdx["isVowel"]=1;
  4871. self._assert_equals_($1,true);
  4872. $ctx1.sendIdx["assert:equals:"]=1;
  4873. self._assert_equals_(_st(consonant)._isVowel(),false);
  4874. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)})},
  4875. args: [],
  4876. 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",
  4877. messageSends: ["assert:equals:", "isVowel"],
  4878. referencedClasses: []
  4879. }),
  4880. globals.StringTest);
  4881. smalltalk.addMethod(
  4882. smalltalk.method({
  4883. selector: "testJoin",
  4884. protocol: 'tests',
  4885. fn: function (){
  4886. var self=this;
  4887. return smalltalk.withContext(function($ctx1) {
  4888. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4889. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)})},
  4890. args: [],
  4891. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4892. messageSends: ["assert:equals:", "join:"],
  4893. referencedClasses: []
  4894. }),
  4895. globals.StringTest);
  4896. smalltalk.addMethod(
  4897. smalltalk.method({
  4898. selector: "testRemoveAll",
  4899. protocol: 'tests',
  4900. fn: function (){
  4901. var self=this;
  4902. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4903. return smalltalk.withContext(function($ctx1) {
  4904. self._should_raise_((function(){
  4905. return smalltalk.withContext(function($ctx2) {
  4906. return _st(self._collection())._removeAll();
  4907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4908. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)})},
  4909. args: [],
  4910. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4911. messageSends: ["should:raise:", "removeAll", "collection"],
  4912. referencedClasses: ["Error"]
  4913. }),
  4914. globals.StringTest);
  4915. smalltalk.addMethod(
  4916. smalltalk.method({
  4917. selector: "testReversed",
  4918. protocol: 'tests',
  4919. fn: function (){
  4920. var self=this;
  4921. return smalltalk.withContext(function($ctx1) {
  4922. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4923. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)})},
  4924. args: [],
  4925. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4926. messageSends: ["assert:equals:", "reversed"],
  4927. referencedClasses: []
  4928. }),
  4929. globals.StringTest);
  4930. smalltalk.addMethod(
  4931. smalltalk.method({
  4932. selector: "testStreamContents",
  4933. protocol: 'tests',
  4934. fn: function (){
  4935. var self=this;
  4936. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  4937. return smalltalk.withContext(function($ctx1) {
  4938. var $1;
  4939. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4940. return smalltalk.withContext(function($ctx2) {
  4941. _st(aStream)._nextPutAll_("hello");
  4942. $ctx2.sendIdx["nextPutAll:"]=1;
  4943. _st(aStream)._space();
  4944. $1=_st(aStream)._nextPutAll_("world");
  4945. return $1;
  4946. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4947. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)})},
  4948. args: [],
  4949. 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'",
  4950. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4951. referencedClasses: ["String"]
  4952. }),
  4953. globals.StringTest);
  4954. smalltalk.addMethod(
  4955. smalltalk.method({
  4956. selector: "testSubStrings",
  4957. protocol: 'tests',
  4958. fn: function (){
  4959. var self=this;
  4960. return smalltalk.withContext(function($ctx1) {
  4961. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4962. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)})},
  4963. args: [],
  4964. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4965. messageSends: ["assert:equals:", "subStrings:"],
  4966. referencedClasses: []
  4967. }),
  4968. globals.StringTest);
  4969. smalltalk.addMethod(
  4970. smalltalk.method({
  4971. selector: "testTrim",
  4972. protocol: 'tests',
  4973. fn: function (){
  4974. var self=this;
  4975. return smalltalk.withContext(function($ctx1) {
  4976. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  4977. $ctx1.sendIdx["assert:equals:"]=1;
  4978. self._assert_equals_("jackie "._trimRight(),"jackie");
  4979. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)})},
  4980. args: [],
  4981. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  4982. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  4983. referencedClasses: []
  4984. }),
  4985. globals.StringTest);
  4986. smalltalk.addMethod(
  4987. smalltalk.method({
  4988. selector: "collectionClass",
  4989. protocol: 'fixture',
  4990. fn: function (){
  4991. var self=this;
  4992. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  4993. return $String();
  4994. },
  4995. args: [],
  4996. source: "collectionClass\x0a\x09^ String",
  4997. messageSends: [],
  4998. referencedClasses: ["String"]
  4999. }),
  5000. globals.StringTest.klass);
  5001. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  5002. smalltalk.addMethod(
  5003. smalltalk.method({
  5004. selector: "collection",
  5005. protocol: 'fixture',
  5006. fn: function (){
  5007. var self=this;
  5008. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5009. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5010. return smalltalk.withContext(function($ctx1) {
  5011. var $2,$3,$1;
  5012. $2=_st($Set())._new();
  5013. _st($2)._add_($Smalltalk());
  5014. $ctx1.sendIdx["add:"]=1;
  5015. _st($2)._add_(nil);
  5016. $ctx1.sendIdx["add:"]=2;
  5017. _st($2)._add_((3).__at((3)));
  5018. $ctx1.sendIdx["add:"]=3;
  5019. _st($2)._add_(false);
  5020. $3=_st($2)._yourself();
  5021. $1=$3;
  5022. return $1;
  5023. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)})},
  5024. args: [],
  5025. 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",
  5026. messageSends: ["add:", "new", "@", "yourself"],
  5027. referencedClasses: ["Set", "Smalltalk"]
  5028. }),
  5029. globals.SetTest);
  5030. smalltalk.addMethod(
  5031. smalltalk.method({
  5032. selector: "collectionOfPrintStrings",
  5033. protocol: 'fixture',
  5034. fn: function (){
  5035. var self=this;
  5036. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5037. return smalltalk.withContext(function($ctx1) {
  5038. var $2,$3,$1;
  5039. $2=_st($Set())._new();
  5040. _st($2)._add_("a SmalltalkImage");
  5041. $ctx1.sendIdx["add:"]=1;
  5042. _st($2)._add_("nil");
  5043. $ctx1.sendIdx["add:"]=2;
  5044. _st($2)._add_("3@3");
  5045. $ctx1.sendIdx["add:"]=3;
  5046. _st($2)._add_("false");
  5047. $3=_st($2)._yourself();
  5048. $1=$3;
  5049. return $1;
  5050. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)})},
  5051. args: [],
  5052. 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",
  5053. messageSends: ["add:", "new", "yourself"],
  5054. referencedClasses: ["Set"]
  5055. }),
  5056. globals.SetTest);
  5057. smalltalk.addMethod(
  5058. smalltalk.method({
  5059. selector: "collectionSize",
  5060. protocol: 'fixture',
  5061. fn: function (){
  5062. var self=this;
  5063. return (4);
  5064. },
  5065. args: [],
  5066. source: "collectionSize\x0a\x09^ 4",
  5067. messageSends: [],
  5068. referencedClasses: []
  5069. }),
  5070. globals.SetTest);
  5071. smalltalk.addMethod(
  5072. smalltalk.method({
  5073. selector: "collectionWithDuplicates",
  5074. protocol: 'fixture',
  5075. fn: function (){
  5076. var self=this;
  5077. return smalltalk.withContext(function($ctx1) {
  5078. var $2,$3,$1;
  5079. $2=self._collection();
  5080. _st($2)._add_((0));
  5081. $3=_st($2)._yourself();
  5082. $1=$3;
  5083. return $1;
  5084. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)})},
  5085. args: [],
  5086. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5087. messageSends: ["add:", "collection", "yourself"],
  5088. referencedClasses: []
  5089. }),
  5090. globals.SetTest);
  5091. smalltalk.addMethod(
  5092. smalltalk.method({
  5093. selector: "collectionWithNewValue",
  5094. protocol: 'fixture',
  5095. fn: function (){
  5096. var self=this;
  5097. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5098. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5099. return smalltalk.withContext(function($ctx1) {
  5100. var $2,$3,$1;
  5101. $2=_st($Set())._new();
  5102. _st($2)._add_($Smalltalk());
  5103. $ctx1.sendIdx["add:"]=1;
  5104. _st($2)._add_(nil);
  5105. $ctx1.sendIdx["add:"]=2;
  5106. _st($2)._add_((3).__at((3)));
  5107. $ctx1.sendIdx["add:"]=3;
  5108. _st($2)._add_("N");
  5109. $ctx1.sendIdx["add:"]=4;
  5110. _st($2)._add_(false);
  5111. $3=_st($2)._yourself();
  5112. $1=$3;
  5113. return $1;
  5114. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)})},
  5115. args: [],
  5116. 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",
  5117. messageSends: ["add:", "new", "@", "yourself"],
  5118. referencedClasses: ["Set", "Smalltalk"]
  5119. }),
  5120. globals.SetTest);
  5121. smalltalk.addMethod(
  5122. smalltalk.method({
  5123. selector: "testAddAll",
  5124. protocol: 'tests',
  5125. fn: function (){
  5126. var self=this;
  5127. return smalltalk.withContext(function($ctx1) {
  5128. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5129. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  5130. $ctx1.supercall = false;
  5131. $2=self._collection();
  5132. $ctx1.sendIdx["collection"]=1;
  5133. $3=$2;
  5134. $4=self._collection();
  5135. $ctx1.sendIdx["collection"]=2;
  5136. _st($3)._addAll_($4);
  5137. $ctx1.sendIdx["addAll:"]=1;
  5138. $5=_st($2)._yourself();
  5139. $ctx1.sendIdx["yourself"]=1;
  5140. $1=$5;
  5141. $6=self._collection();
  5142. $ctx1.sendIdx["collection"]=3;
  5143. self._assert_equals_($1,$6);
  5144. $ctx1.sendIdx["assert:equals:"]=1;
  5145. $8=self._collection();
  5146. $ctx1.sendIdx["collection"]=4;
  5147. $9=$8;
  5148. $10=self._collectionWithNewValue();
  5149. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5150. _st($9)._addAll_($10);
  5151. $ctx1.sendIdx["addAll:"]=2;
  5152. $11=_st($8)._yourself();
  5153. $ctx1.sendIdx["yourself"]=2;
  5154. $7=$11;
  5155. $12=self._collectionWithNewValue();
  5156. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5157. self._assert_equals_($7,$12);
  5158. $ctx1.sendIdx["assert:equals:"]=2;
  5159. $14=self._collectionWithNewValue();
  5160. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5161. _st($14)._addAll_(self._collection());
  5162. $15=_st($14)._yourself();
  5163. $13=$15;
  5164. self._assert_equals_($13,self._collectionWithNewValue());
  5165. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)})},
  5166. args: [],
  5167. 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",
  5168. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5169. referencedClasses: []
  5170. }),
  5171. globals.SetTest);
  5172. smalltalk.addMethod(
  5173. smalltalk.method({
  5174. selector: "testAddRemove",
  5175. protocol: 'tests',
  5176. fn: function (){
  5177. var self=this;
  5178. var set;
  5179. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5180. return smalltalk.withContext(function($ctx1) {
  5181. var $1,$2;
  5182. set=_st($Set())._new();
  5183. self._assert_(_st(set)._isEmpty());
  5184. $ctx1.sendIdx["assert:"]=1;
  5185. _st(set)._add_((3));
  5186. $ctx1.sendIdx["add:"]=1;
  5187. $1=_st(set)._includes_((3));
  5188. $ctx1.sendIdx["includes:"]=1;
  5189. self._assert_($1);
  5190. $ctx1.sendIdx["assert:"]=2;
  5191. _st(set)._add_((5));
  5192. $2=_st(set)._includes_((5));
  5193. $ctx1.sendIdx["includes:"]=2;
  5194. self._assert_($2);
  5195. _st(set)._remove_((3));
  5196. self._deny_(_st(set)._includes_((3)));
  5197. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)})},
  5198. args: [],
  5199. 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)",
  5200. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5201. referencedClasses: ["Set"]
  5202. }),
  5203. globals.SetTest);
  5204. smalltalk.addMethod(
  5205. smalltalk.method({
  5206. selector: "testAt",
  5207. protocol: 'tests',
  5208. fn: function (){
  5209. var self=this;
  5210. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5211. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5212. return smalltalk.withContext(function($ctx1) {
  5213. self._should_raise_((function(){
  5214. return smalltalk.withContext(function($ctx2) {
  5215. return _st(_st($Set())._new())._at_put_((1),(2));
  5216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5217. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)})},
  5218. args: [],
  5219. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5220. messageSends: ["should:raise:", "at:put:", "new"],
  5221. referencedClasses: ["Set", "Error"]
  5222. }),
  5223. globals.SetTest);
  5224. smalltalk.addMethod(
  5225. smalltalk.method({
  5226. selector: "testCollect",
  5227. protocol: 'tests',
  5228. fn: function (){
  5229. var self=this;
  5230. return smalltalk.withContext(function($ctx1) {
  5231. var $2,$1;
  5232. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []));
  5233. $ctx1.supercall = false;
  5234. $2=[(5), (6), (8)]._asSet();
  5235. $ctx1.sendIdx["asSet"]=1;
  5236. $1=_st($2)._collect_((function(x){
  5237. return smalltalk.withContext(function($ctx2) {
  5238. return _st(x).__backslash_backslash((3));
  5239. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5240. self._assert_equals_($1,[(0), (2)]._asSet());
  5241. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)})},
  5242. args: [],
  5243. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5244. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5245. referencedClasses: []
  5246. }),
  5247. globals.SetTest);
  5248. smalltalk.addMethod(
  5249. smalltalk.method({
  5250. selector: "testComma",
  5251. protocol: 'tests',
  5252. fn: function (){
  5253. var self=this;
  5254. return smalltalk.withContext(function($ctx1) {
  5255. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5256. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  5257. $ctx1.supercall = false;
  5258. $2=self._collection();
  5259. $ctx1.sendIdx["collection"]=1;
  5260. $3=self._collection();
  5261. $ctx1.sendIdx["collection"]=2;
  5262. $1=_st($2).__comma($3);
  5263. $ctx1.sendIdx[","]=1;
  5264. $4=self._collection();
  5265. $ctx1.sendIdx["collection"]=3;
  5266. self._assert_equals_($1,$4);
  5267. $ctx1.sendIdx["assert:equals:"]=1;
  5268. $6=self._collection();
  5269. $ctx1.sendIdx["collection"]=4;
  5270. $7=self._collectionWithNewValue();
  5271. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5272. $5=_st($6).__comma($7);
  5273. $ctx1.sendIdx[","]=2;
  5274. $8=self._collectionWithNewValue();
  5275. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5276. self._assert_equals_($5,$8);
  5277. $ctx1.sendIdx["assert:equals:"]=2;
  5278. $10=self._collectionWithNewValue();
  5279. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5280. $9=_st($10).__comma(self._collection());
  5281. self._assert_equals_($9,self._collectionWithNewValue());
  5282. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)})},
  5283. args: [],
  5284. 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",
  5285. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5286. referencedClasses: []
  5287. }),
  5288. globals.SetTest);
  5289. smalltalk.addMethod(
  5290. smalltalk.method({
  5291. selector: "testComparing",
  5292. protocol: 'tests',
  5293. fn: function (){
  5294. var self=this;
  5295. return smalltalk.withContext(function($ctx1) {
  5296. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5297. $1=[(0), (2)]._asSet();
  5298. $ctx1.sendIdx["asSet"]=1;
  5299. $2=[(0), (2)]._asSet();
  5300. $ctx1.sendIdx["asSet"]=2;
  5301. self._assert_equals_($1,$2);
  5302. $ctx1.sendIdx["assert:equals:"]=1;
  5303. $3=[(2), (0)]._asSet();
  5304. $ctx1.sendIdx["asSet"]=3;
  5305. $4=[(0), (2)]._asSet();
  5306. $ctx1.sendIdx["asSet"]=4;
  5307. self._assert_equals_($3,$4);
  5308. $6=[(0), (2), (3)]._asSet();
  5309. $ctx1.sendIdx["asSet"]=5;
  5310. $7=[(0), (2)]._asSet();
  5311. $ctx1.sendIdx["asSet"]=6;
  5312. $5=_st($6).__eq($7);
  5313. $ctx1.sendIdx["="]=1;
  5314. self._deny_($5);
  5315. $ctx1.sendIdx["deny:"]=1;
  5316. $9=[(1), (2)]._asSet();
  5317. $ctx1.sendIdx["asSet"]=7;
  5318. $8=_st($9).__eq([(0), (2)]._asSet());
  5319. self._deny_($8);
  5320. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)})},
  5321. args: [],
  5322. 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",
  5323. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5324. referencedClasses: []
  5325. }),
  5326. globals.SetTest);
  5327. smalltalk.addMethod(
  5328. smalltalk.method({
  5329. selector: "testPrintString",
  5330. protocol: 'tests',
  5331. fn: function (){
  5332. var self=this;
  5333. var set;
  5334. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5335. return smalltalk.withContext(function($ctx1) {
  5336. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5337. set=_st($Set())._new();
  5338. $1=_st(set)._printString();
  5339. $ctx1.sendIdx["printString"]=1;
  5340. self._assert_equals_($1,"a Set ()");
  5341. $ctx1.sendIdx["assert:equals:"]=1;
  5342. $2=set;
  5343. _st($2)._add_((1));
  5344. $ctx1.sendIdx["add:"]=1;
  5345. $3=_st($2)._add_((3));
  5346. $ctx1.sendIdx["add:"]=2;
  5347. $4=_st(set)._printString();
  5348. $ctx1.sendIdx["printString"]=2;
  5349. self._assert_equals_($4,"a Set (1 3)");
  5350. $ctx1.sendIdx["assert:equals:"]=2;
  5351. _st(set)._add_("foo");
  5352. $ctx1.sendIdx["add:"]=3;
  5353. $5=_st(set)._printString();
  5354. $ctx1.sendIdx["printString"]=3;
  5355. self._assert_equals_($5,"a Set (1 3 'foo')");
  5356. $ctx1.sendIdx["assert:equals:"]=3;
  5357. $6=set;
  5358. _st($6)._remove_((1));
  5359. $ctx1.sendIdx["remove:"]=1;
  5360. $7=_st($6)._remove_((3));
  5361. $8=_st(set)._printString();
  5362. $ctx1.sendIdx["printString"]=4;
  5363. self._assert_equals_($8,"a Set ('foo')");
  5364. $ctx1.sendIdx["assert:equals:"]=4;
  5365. _st(set)._add_((3));
  5366. $ctx1.sendIdx["add:"]=4;
  5367. $9=_st(set)._printString();
  5368. $ctx1.sendIdx["printString"]=5;
  5369. self._assert_equals_($9,"a Set (3 'foo')");
  5370. $ctx1.sendIdx["assert:equals:"]=5;
  5371. _st(set)._add_((3));
  5372. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5373. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)})},
  5374. args: [],
  5375. 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'')'",
  5376. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5377. referencedClasses: ["Set"]
  5378. }),
  5379. globals.SetTest);
  5380. smalltalk.addMethod(
  5381. smalltalk.method({
  5382. selector: "testUnboxedObjects",
  5383. protocol: 'tests',
  5384. fn: function (){
  5385. var self=this;
  5386. return smalltalk.withContext(function($ctx1) {
  5387. var $4,$3,$2,$1;
  5388. $4="foo"._yourself();
  5389. $ctx1.sendIdx["yourself"]=1;
  5390. $3=[$4,"foo"._yourself()];
  5391. $2=_st($3)._asSet();
  5392. $1=_st($2)._asArray();
  5393. self._assert_equals_($1,["foo"]);
  5394. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)})},
  5395. args: [],
  5396. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5397. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5398. referencedClasses: []
  5399. }),
  5400. globals.SetTest);
  5401. smalltalk.addMethod(
  5402. smalltalk.method({
  5403. selector: "testUnicity",
  5404. protocol: 'tests',
  5405. fn: function (){
  5406. var self=this;
  5407. var set;
  5408. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5409. return smalltalk.withContext(function($ctx1) {
  5410. var $1;
  5411. set=_st($Set())._new();
  5412. _st(set)._add_((21));
  5413. $ctx1.sendIdx["add:"]=1;
  5414. _st(set)._add_("hello");
  5415. $ctx1.sendIdx["add:"]=2;
  5416. _st(set)._add_((21));
  5417. $ctx1.sendIdx["add:"]=3;
  5418. $1=_st(set)._size();
  5419. $ctx1.sendIdx["size"]=1;
  5420. self._assert_equals_($1,(2));
  5421. $ctx1.sendIdx["assert:equals:"]=1;
  5422. _st(set)._add_("hello");
  5423. self._assert_equals_(_st(set)._size(),(2));
  5424. $ctx1.sendIdx["assert:equals:"]=2;
  5425. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5426. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)})},
  5427. args: [],
  5428. 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')",
  5429. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5430. referencedClasses: ["Set"]
  5431. }),
  5432. globals.SetTest);
  5433. smalltalk.addMethod(
  5434. smalltalk.method({
  5435. selector: "collectionClass",
  5436. protocol: 'fixture',
  5437. fn: function (){
  5438. var self=this;
  5439. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5440. return $Set();
  5441. },
  5442. args: [],
  5443. source: "collectionClass\x0a\x09^ Set",
  5444. messageSends: [],
  5445. referencedClasses: ["Set"]
  5446. }),
  5447. globals.SetTest.klass);
  5448. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  5449. smalltalk.addMethod(
  5450. smalltalk.method({
  5451. selector: "testShow",
  5452. protocol: 'tests',
  5453. fn: function (){
  5454. var self=this;
  5455. var originalTranscript;
  5456. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5457. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5458. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5459. return smalltalk.withContext(function($ctx1) {
  5460. originalTranscript=_st($Transcript())._current();
  5461. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5462. $ctx1.sendIdx["register:"]=1;
  5463. self._shouldnt_raise_((function(){
  5464. return smalltalk.withContext(function($ctx2) {
  5465. return _st($Transcript())._show_("Hello console!");
  5466. $ctx2.sendIdx["show:"]=1;
  5467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5468. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5469. self._shouldnt_raise_((function(){
  5470. return smalltalk.withContext(function($ctx2) {
  5471. return _st($Transcript())._show_(console);
  5472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5473. _st($Transcript())._register_(originalTranscript);
  5474. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)})},
  5475. args: [],
  5476. 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.",
  5477. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5478. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5479. }),
  5480. globals.ConsoleTranscriptTest);
  5481. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  5482. smalltalk.addMethod(
  5483. smalltalk.method({
  5484. selector: "jsObject",
  5485. protocol: 'accessing',
  5486. fn: function (){
  5487. var self=this;
  5488. return smalltalk.withContext(function($ctx1) {
  5489. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5490. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},globals.JSObjectProxyTest)})},
  5491. args: [],
  5492. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5493. messageSends: [],
  5494. referencedClasses: []
  5495. }),
  5496. globals.JSObjectProxyTest);
  5497. smalltalk.addMethod(
  5498. smalltalk.method({
  5499. selector: "testAtIfAbsent",
  5500. protocol: 'tests',
  5501. fn: function (){
  5502. var self=this;
  5503. var testObject;
  5504. return smalltalk.withContext(function($ctx1) {
  5505. var $1,$2,$3;
  5506. testObject=self._jsObject();
  5507. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5508. return "Property does not exist";
  5509. }));
  5510. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5511. self._assert_equals_($1,"Property does not exist");
  5512. $ctx1.sendIdx["assert:equals:"]=1;
  5513. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5514. return "Property does not exist";
  5515. }));
  5516. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5517. self._assert_equals_($2,nil);
  5518. $ctx1.sendIdx["assert:equals:"]=2;
  5519. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5520. return "Property does not exist";
  5521. }));
  5522. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5523. self._assert_equals_($3,(1));
  5524. $ctx1.sendIdx["assert:equals:"]=3;
  5525. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5526. return "Property does not exist";
  5527. })),nil);
  5528. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5529. args: [],
  5530. 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.",
  5531. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5532. referencedClasses: []
  5533. }),
  5534. globals.JSObjectProxyTest);
  5535. smalltalk.addMethod(
  5536. smalltalk.method({
  5537. selector: "testAtIfPresent",
  5538. protocol: 'tests',
  5539. fn: function (){
  5540. var self=this;
  5541. var testObject;
  5542. return smalltalk.withContext(function($ctx1) {
  5543. var $2,$1,$4,$3,$6,$5;
  5544. testObject=self._jsObject();
  5545. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5546. return smalltalk.withContext(function($ctx2) {
  5547. $2=_st(x)._asString();
  5548. $ctx2.sendIdx["asString"]=1;
  5549. return "hello ".__comma($2);
  5550. $ctx2.sendIdx[","]=1;
  5551. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5552. $ctx1.sendIdx["at:ifPresent:"]=1;
  5553. self._assert_equals_($1,nil);
  5554. $ctx1.sendIdx["assert:equals:"]=1;
  5555. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5556. return smalltalk.withContext(function($ctx2) {
  5557. $4=_st(x)._asString();
  5558. $ctx2.sendIdx["asString"]=2;
  5559. return "hello ".__comma($4);
  5560. $ctx2.sendIdx[","]=2;
  5561. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5562. $ctx1.sendIdx["at:ifPresent:"]=2;
  5563. self._assert_equals_($3,"hello nil");
  5564. $ctx1.sendIdx["assert:equals:"]=2;
  5565. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5566. return smalltalk.withContext(function($ctx2) {
  5567. $6=_st(x)._asString();
  5568. $ctx2.sendIdx["asString"]=3;
  5569. return "hello ".__comma($6);
  5570. $ctx2.sendIdx[","]=3;
  5571. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5572. $ctx1.sendIdx["at:ifPresent:"]=3;
  5573. self._assert_equals_($5,"hello 1");
  5574. $ctx1.sendIdx["assert:equals:"]=3;
  5575. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5576. return smalltalk.withContext(function($ctx2) {
  5577. return "hello ".__comma(_st(x)._asString());
  5578. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5579. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5580. args: [],
  5581. 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'.",
  5582. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5583. referencedClasses: []
  5584. }),
  5585. globals.JSObjectProxyTest);
  5586. smalltalk.addMethod(
  5587. smalltalk.method({
  5588. selector: "testAtIfPresentIfAbsent",
  5589. protocol: 'tests',
  5590. fn: function (){
  5591. var self=this;
  5592. var testObject;
  5593. return smalltalk.withContext(function($ctx1) {
  5594. var $2,$1,$4,$3,$6,$5;
  5595. testObject=self._jsObject();
  5596. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5597. return smalltalk.withContext(function($ctx2) {
  5598. $2=_st(x)._asString();
  5599. $ctx2.sendIdx["asString"]=1;
  5600. return "hello ".__comma($2);
  5601. $ctx2.sendIdx[","]=1;
  5602. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5603. return "not present";
  5604. }));
  5605. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5606. self._assert_equals_($1,"not present");
  5607. $ctx1.sendIdx["assert:equals:"]=1;
  5608. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5609. return smalltalk.withContext(function($ctx2) {
  5610. $4=_st(x)._asString();
  5611. $ctx2.sendIdx["asString"]=2;
  5612. return "hello ".__comma($4);
  5613. $ctx2.sendIdx[","]=2;
  5614. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5615. return "not present";
  5616. }));
  5617. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5618. self._assert_equals_($3,"hello nil");
  5619. $ctx1.sendIdx["assert:equals:"]=2;
  5620. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5621. return smalltalk.withContext(function($ctx2) {
  5622. $6=_st(x)._asString();
  5623. $ctx2.sendIdx["asString"]=3;
  5624. return "hello ".__comma($6);
  5625. $ctx2.sendIdx[","]=3;
  5626. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5627. return "not present";
  5628. }));
  5629. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5630. self._assert_equals_($5,"hello 1");
  5631. $ctx1.sendIdx["assert:equals:"]=3;
  5632. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5633. return smalltalk.withContext(function($ctx2) {
  5634. return "hello ".__comma(_st(x)._asString());
  5635. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5636. return "not present";
  5637. })),"hello nil");
  5638. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5639. args: [],
  5640. 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'.",
  5641. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5642. referencedClasses: []
  5643. }),
  5644. globals.JSObjectProxyTest);
  5645. smalltalk.addMethod(
  5646. smalltalk.method({
  5647. selector: "testAtPut",
  5648. protocol: 'tests',
  5649. fn: function (){
  5650. var self=this;
  5651. var testObject;
  5652. return smalltalk.withContext(function($ctx1) {
  5653. var $2,$1;
  5654. testObject=self._jsObject();
  5655. $2=_st(testObject)._at_("abc");
  5656. $ctx1.sendIdx["at:"]=1;
  5657. $1=_st($2).__tild_eq("xyz");
  5658. self._assert_($1);
  5659. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5660. $ctx1.sendIdx["assert:equals:"]=1;
  5661. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5662. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)})},
  5663. args: [],
  5664. 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'",
  5665. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5666. referencedClasses: []
  5667. }),
  5668. globals.JSObjectProxyTest);
  5669. smalltalk.addMethod(
  5670. smalltalk.method({
  5671. selector: "testComparison",
  5672. protocol: 'tests',
  5673. fn: function (){
  5674. var self=this;
  5675. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5676. return smalltalk.withContext(function($ctx1) {
  5677. var $1,$2;
  5678. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  5679. $1=_st(console).__eq(console);
  5680. $ctx1.sendIdx["="]=1;
  5681. self._assert_($1);
  5682. $2=_st(console).__eq(_st($Object())._new());
  5683. $ctx1.sendIdx["="]=2;
  5684. self._deny_($2);
  5685. $ctx1.sendIdx["deny:"]=1;
  5686. self._deny_(_st(console).__eq(self._jsObject()));
  5687. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)})},
  5688. args: [],
  5689. 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",
  5690. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"],
  5691. referencedClasses: ["Object"]
  5692. }),
  5693. globals.JSObjectProxyTest);
  5694. smalltalk.addMethod(
  5695. smalltalk.method({
  5696. selector: "testDNU",
  5697. protocol: 'tests',
  5698. fn: function (){
  5699. var self=this;
  5700. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5701. return smalltalk.withContext(function($ctx1) {
  5702. self._should_raise_((function(){
  5703. return smalltalk.withContext(function($ctx2) {
  5704. return _st(self._jsObject())._foo();
  5705. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5706. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)})},
  5707. args: [],
  5708. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5709. messageSends: ["should:raise:", "foo", "jsObject"],
  5710. referencedClasses: ["MessageNotUnderstood"]
  5711. }),
  5712. globals.JSObjectProxyTest);
  5713. smalltalk.addMethod(
  5714. smalltalk.method({
  5715. selector: "testMessageSend",
  5716. protocol: 'tests',
  5717. fn: function (){
  5718. var self=this;
  5719. return smalltalk.withContext(function($ctx1) {
  5720. var $2,$1,$4,$3;
  5721. $2=self._jsObject();
  5722. $ctx1.sendIdx["jsObject"]=1;
  5723. $1=_st($2)._a();
  5724. self._assert_equals_($1,(1));
  5725. $ctx1.sendIdx["assert:equals:"]=1;
  5726. $4=self._jsObject();
  5727. $ctx1.sendIdx["jsObject"]=2;
  5728. $3=_st($4)._b();
  5729. self._assert_equals_($3,(2));
  5730. $ctx1.sendIdx["assert:equals:"]=2;
  5731. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5732. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)})},
  5733. args: [],
  5734. 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",
  5735. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5736. referencedClasses: []
  5737. }),
  5738. globals.JSObjectProxyTest);
  5739. smalltalk.addMethod(
  5740. smalltalk.method({
  5741. selector: "testMethodWithArguments",
  5742. protocol: 'tests',
  5743. fn: function (){
  5744. var self=this;
  5745. return smalltalk.withContext(function($ctx1) {
  5746. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5747. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)})},
  5748. args: [],
  5749. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5750. messageSends: ["assert:equals:", "c:", "jsObject"],
  5751. referencedClasses: []
  5752. }),
  5753. globals.JSObjectProxyTest);
  5754. smalltalk.addMethod(
  5755. smalltalk.method({
  5756. selector: "testPrinting",
  5757. protocol: 'tests',
  5758. fn: function (){
  5759. var self=this;
  5760. return smalltalk.withContext(function($ctx1) {
  5761. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5762. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)})},
  5763. args: [],
  5764. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5765. messageSends: ["assert:equals:", "printString", "jsObject"],
  5766. referencedClasses: []
  5767. }),
  5768. globals.JSObjectProxyTest);
  5769. smalltalk.addMethod(
  5770. smalltalk.method({
  5771. selector: "testPropertyThatReturnsEmptyString",
  5772. protocol: 'tests',
  5773. fn: function (){
  5774. var self=this;
  5775. var object;
  5776. return smalltalk.withContext(function($ctx1) {
  5777. var $1;
  5778. object=self._jsObject();
  5779. $1=_st(object)._d();
  5780. $ctx1.sendIdx["d"]=1;
  5781. self._assert_equals_($1,"");
  5782. $ctx1.sendIdx["assert:equals:"]=1;
  5783. _st(object)._d_("hello");
  5784. self._assert_equals_(_st(object)._d(),"hello");
  5785. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)})},
  5786. args: [],
  5787. 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'",
  5788. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5789. referencedClasses: []
  5790. }),
  5791. globals.JSObjectProxyTest);
  5792. smalltalk.addMethod(
  5793. smalltalk.method({
  5794. selector: "testPropertyThatReturnsUndefined",
  5795. protocol: 'tests',
  5796. fn: function (){
  5797. var self=this;
  5798. var object;
  5799. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5800. return smalltalk.withContext(function($ctx1) {
  5801. object=self._jsObject();
  5802. self._shouldnt_raise_((function(){
  5803. return smalltalk.withContext(function($ctx2) {
  5804. return _st(object)._e();
  5805. $ctx2.sendIdx["e"]=1;
  5806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5807. self._assert_(_st(_st(object)._e())._isNil());
  5808. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)})},
  5809. args: [],
  5810. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5811. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5812. referencedClasses: ["MessageNotUnderstood"]
  5813. }),
  5814. globals.JSObjectProxyTest);
  5815. smalltalk.addMethod(
  5816. smalltalk.method({
  5817. selector: "testValue",
  5818. protocol: 'tests',
  5819. fn: function (){
  5820. var self=this;
  5821. var testObject;
  5822. return smalltalk.withContext(function($ctx1) {
  5823. testObject=self._jsObject();
  5824. _st(testObject)._at_put_("value","aValue");
  5825. self._assert_equals_(_st(testObject)._value(),"aValue");
  5826. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)})},
  5827. args: [],
  5828. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5829. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5830. referencedClasses: []
  5831. }),
  5832. globals.JSObjectProxyTest);
  5833. smalltalk.addMethod(
  5834. smalltalk.method({
  5835. selector: "testYourself",
  5836. protocol: 'tests',
  5837. fn: function (){
  5838. var self=this;
  5839. var object;
  5840. return smalltalk.withContext(function($ctx1) {
  5841. var $1,$2;
  5842. $1=self._jsObject();
  5843. _st($1)._d_("test");
  5844. $2=_st($1)._yourself();
  5845. object=$2;
  5846. self._assert_equals_(_st(object)._d(),"test");
  5847. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)})},
  5848. args: [],
  5849. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5850. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5851. referencedClasses: []
  5852. }),
  5853. globals.JSObjectProxyTest);
  5854. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  5855. smalltalk.addMethod(
  5856. smalltalk.method({
  5857. selector: "testCatchingException",
  5858. protocol: 'tests',
  5859. fn: function (){
  5860. var self=this;
  5861. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5862. return smalltalk.withContext(function($ctx1) {
  5863. _st((function(){
  5864. return smalltalk.withContext(function($ctx2) {
  5865. return self._throwException();
  5866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5867. return smalltalk.withContext(function($ctx2) {
  5868. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5869. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5870. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)})},
  5871. args: [],
  5872. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5873. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5874. referencedClasses: ["Error"]
  5875. }),
  5876. globals.JavaScriptExceptionTest);
  5877. smalltalk.addMethod(
  5878. smalltalk.method({
  5879. selector: "testRaisingException",
  5880. protocol: 'tests',
  5881. fn: function (){
  5882. var self=this;
  5883. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5884. return smalltalk.withContext(function($ctx1) {
  5885. self._should_raise_((function(){
  5886. return smalltalk.withContext(function($ctx2) {
  5887. return self._throwException();
  5888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5889. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)})},
  5890. args: [],
  5891. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5892. messageSends: ["should:raise:", "throwException"],
  5893. referencedClasses: ["JavaScriptException"]
  5894. }),
  5895. globals.JavaScriptExceptionTest);
  5896. smalltalk.addMethod(
  5897. smalltalk.method({
  5898. selector: "throwException",
  5899. protocol: 'helpers',
  5900. fn: function (){
  5901. var self=this;
  5902. return smalltalk.withContext(function($ctx1) {
  5903. throw 'test';
  5904. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},globals.JavaScriptExceptionTest)})},
  5905. args: [],
  5906. source: "throwException\x0a\x09<throw 'test'>",
  5907. messageSends: [],
  5908. referencedClasses: []
  5909. }),
  5910. globals.JavaScriptExceptionTest);
  5911. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  5912. smalltalk.addMethod(
  5913. smalltalk.method({
  5914. selector: "testValue",
  5915. protocol: 'tests',
  5916. fn: function (){
  5917. var self=this;
  5918. var messageSend;
  5919. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5920. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5921. return smalltalk.withContext(function($ctx1) {
  5922. var $1,$2;
  5923. $1=_st($MessageSend())._new();
  5924. $ctx1.sendIdx["new"]=1;
  5925. _st($1)._receiver_(_st($Object())._new());
  5926. _st($1)._selector_("asString");
  5927. $2=_st($1)._yourself();
  5928. messageSend=$2;
  5929. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5930. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)})},
  5931. args: [],
  5932. 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'",
  5933. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  5934. referencedClasses: ["MessageSend", "Object"]
  5935. }),
  5936. globals.MessageSendTest);
  5937. smalltalk.addMethod(
  5938. smalltalk.method({
  5939. selector: "testValueWithArguments",
  5940. protocol: 'tests',
  5941. fn: function (){
  5942. var self=this;
  5943. var messageSend;
  5944. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5945. return smalltalk.withContext(function($ctx1) {
  5946. var $1,$2;
  5947. $1=_st($MessageSend())._new();
  5948. _st($1)._receiver_((2));
  5949. _st($1)._selector_("+");
  5950. $2=_st($1)._yourself();
  5951. messageSend=$2;
  5952. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  5953. $ctx1.sendIdx["assert:equals:"]=1;
  5954. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  5955. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)})},
  5956. args: [],
  5957. 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",
  5958. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  5959. referencedClasses: ["MessageSend"]
  5960. }),
  5961. globals.MessageSendTest);
  5962. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  5963. smalltalk.addMethod(
  5964. smalltalk.method({
  5965. selector: "codeGeneratorClass",
  5966. protocol: 'accessing',
  5967. fn: function (){
  5968. var self=this;
  5969. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  5970. return $CodeGenerator();
  5971. },
  5972. args: [],
  5973. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  5974. messageSends: [],
  5975. referencedClasses: ["CodeGenerator"]
  5976. }),
  5977. globals.MethodInheritanceTest);
  5978. smalltalk.addMethod(
  5979. smalltalk.method({
  5980. selector: "compiler",
  5981. protocol: 'factory',
  5982. fn: function (){
  5983. var self=this;
  5984. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5985. return smalltalk.withContext(function($ctx1) {
  5986. var $2,$3,$1;
  5987. $2=_st($Compiler())._new();
  5988. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  5989. $3=_st($2)._yourself();
  5990. $1=$3;
  5991. return $1;
  5992. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)})},
  5993. args: [],
  5994. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  5995. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  5996. referencedClasses: ["Compiler"]
  5997. }),
  5998. globals.MethodInheritanceTest);
  5999. smalltalk.addMethod(
  6000. smalltalk.method({
  6001. selector: "deinstallBottom",
  6002. protocol: 'testing',
  6003. fn: function (){
  6004. var self=this;
  6005. return smalltalk.withContext(function($ctx1) {
  6006. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6007. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)})},
  6008. args: [],
  6009. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6010. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6011. referencedClasses: []
  6012. }),
  6013. globals.MethodInheritanceTest);
  6014. smalltalk.addMethod(
  6015. smalltalk.method({
  6016. selector: "deinstallMiddle",
  6017. protocol: 'testing',
  6018. fn: function (){
  6019. var self=this;
  6020. return smalltalk.withContext(function($ctx1) {
  6021. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6022. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)})},
  6023. args: [],
  6024. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6025. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6026. referencedClasses: []
  6027. }),
  6028. globals.MethodInheritanceTest);
  6029. smalltalk.addMethod(
  6030. smalltalk.method({
  6031. selector: "deinstallTop",
  6032. protocol: 'testing',
  6033. fn: function (){
  6034. var self=this;
  6035. return smalltalk.withContext(function($ctx1) {
  6036. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6037. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)})},
  6038. args: [],
  6039. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6040. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6041. referencedClasses: []
  6042. }),
  6043. globals.MethodInheritanceTest);
  6044. smalltalk.addMethod(
  6045. smalltalk.method({
  6046. selector: "installBottom:",
  6047. protocol: 'testing',
  6048. fn: function (aString){
  6049. var self=this;
  6050. return smalltalk.withContext(function($ctx1) {
  6051. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6052. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)})},
  6053. args: ["aString"],
  6054. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6055. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6056. referencedClasses: []
  6057. }),
  6058. globals.MethodInheritanceTest);
  6059. smalltalk.addMethod(
  6060. smalltalk.method({
  6061. selector: "installMiddle:",
  6062. protocol: 'testing',
  6063. fn: function (aString){
  6064. var self=this;
  6065. return smalltalk.withContext(function($ctx1) {
  6066. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6067. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)})},
  6068. args: ["aString"],
  6069. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6070. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6071. referencedClasses: []
  6072. }),
  6073. globals.MethodInheritanceTest);
  6074. smalltalk.addMethod(
  6075. smalltalk.method({
  6076. selector: "installTop:",
  6077. protocol: 'testing',
  6078. fn: function (aString){
  6079. var self=this;
  6080. return smalltalk.withContext(function($ctx1) {
  6081. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6082. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)})},
  6083. args: ["aString"],
  6084. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6085. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6086. referencedClasses: []
  6087. }),
  6088. globals.MethodInheritanceTest);
  6089. smalltalk.addMethod(
  6090. smalltalk.method({
  6091. selector: "setUp",
  6092. protocol: 'initialization',
  6093. fn: function (){
  6094. var self=this;
  6095. return smalltalk.withContext(function($ctx1) {
  6096. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6097. $ctx1.sendIdx["new"]=1;
  6098. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6099. $ctx1.sendIdx["new"]=2;
  6100. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6101. self["@method"]=nil;
  6102. self["@performBlock"]=(function(){
  6103. return smalltalk.withContext(function($ctx2) {
  6104. return self._error_("performBlock not initialized");
  6105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6106. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)})},
  6107. args: [],
  6108. 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' ]",
  6109. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6110. referencedClasses: []
  6111. }),
  6112. globals.MethodInheritanceTest);
  6113. smalltalk.addMethod(
  6114. smalltalk.method({
  6115. selector: "shouldMNU",
  6116. protocol: 'testing',
  6117. fn: function (){
  6118. var self=this;
  6119. return smalltalk.withContext(function($ctx1) {
  6120. self._shouldMNUTop();
  6121. self._shouldMNUMiddle();
  6122. self._shouldMNUBottom();
  6123. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)})},
  6124. args: [],
  6125. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6126. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6127. referencedClasses: []
  6128. }),
  6129. globals.MethodInheritanceTest);
  6130. smalltalk.addMethod(
  6131. smalltalk.method({
  6132. selector: "shouldMNUBottom",
  6133. protocol: 'testing',
  6134. fn: function (){
  6135. var self=this;
  6136. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6137. return smalltalk.withContext(function($ctx1) {
  6138. self._should_raise_((function(){
  6139. return smalltalk.withContext(function($ctx2) {
  6140. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6141. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6142. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)})},
  6143. args: [],
  6144. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6145. messageSends: ["should:raise:", "value:"],
  6146. referencedClasses: ["MessageNotUnderstood"]
  6147. }),
  6148. globals.MethodInheritanceTest);
  6149. smalltalk.addMethod(
  6150. smalltalk.method({
  6151. selector: "shouldMNUMiddle",
  6152. protocol: 'testing',
  6153. fn: function (){
  6154. var self=this;
  6155. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6156. return smalltalk.withContext(function($ctx1) {
  6157. self._should_raise_((function(){
  6158. return smalltalk.withContext(function($ctx2) {
  6159. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6161. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)})},
  6162. args: [],
  6163. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6164. messageSends: ["should:raise:", "value:"],
  6165. referencedClasses: ["MessageNotUnderstood"]
  6166. }),
  6167. globals.MethodInheritanceTest);
  6168. smalltalk.addMethod(
  6169. smalltalk.method({
  6170. selector: "shouldMNUTop",
  6171. protocol: 'testing',
  6172. fn: function (){
  6173. var self=this;
  6174. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6175. return smalltalk.withContext(function($ctx1) {
  6176. self._should_raise_((function(){
  6177. return smalltalk.withContext(function($ctx2) {
  6178. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6179. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6180. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)})},
  6181. args: [],
  6182. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6183. messageSends: ["should:raise:", "value:"],
  6184. referencedClasses: ["MessageNotUnderstood"]
  6185. }),
  6186. globals.MethodInheritanceTest);
  6187. smalltalk.addMethod(
  6188. smalltalk.method({
  6189. selector: "shouldReturn:",
  6190. protocol: 'testing',
  6191. fn: function (anObject){
  6192. var self=this;
  6193. var result;
  6194. return smalltalk.withContext(function($ctx1) {
  6195. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6196. $ctx1.sendIdx["value:"]=1;
  6197. self._assert_equals_(["top",anObject],["top",result]);
  6198. $ctx1.sendIdx["assert:equals:"]=1;
  6199. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6200. $ctx1.sendIdx["value:"]=2;
  6201. self._assert_equals_(["middle",anObject],["middle",result]);
  6202. $ctx1.sendIdx["assert:equals:"]=2;
  6203. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6204. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6205. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)})},
  6206. args: ["anObject"],
  6207. 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 }",
  6208. messageSends: ["value:", "assert:equals:"],
  6209. referencedClasses: []
  6210. }),
  6211. globals.MethodInheritanceTest);
  6212. smalltalk.addMethod(
  6213. smalltalk.method({
  6214. selector: "shouldReturn:and:and:",
  6215. protocol: 'testing',
  6216. fn: function (anObject,anObject2,anObject3){
  6217. var self=this;
  6218. var result;
  6219. return smalltalk.withContext(function($ctx1) {
  6220. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6221. $ctx1.sendIdx["value:"]=1;
  6222. self._assert_equals_(["top",anObject],["top",result]);
  6223. $ctx1.sendIdx["assert:equals:"]=1;
  6224. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6225. $ctx1.sendIdx["value:"]=2;
  6226. self._assert_equals_(["middle",anObject2],["middle",result]);
  6227. $ctx1.sendIdx["assert:equals:"]=2;
  6228. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6229. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6230. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)})},
  6231. args: ["anObject", "anObject2", "anObject3"],
  6232. 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 }",
  6233. messageSends: ["value:", "assert:equals:"],
  6234. referencedClasses: []
  6235. }),
  6236. globals.MethodInheritanceTest);
  6237. smalltalk.addMethod(
  6238. smalltalk.method({
  6239. selector: "targetClassBottom",
  6240. protocol: 'accessing',
  6241. fn: function (){
  6242. var self=this;
  6243. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6244. return $JavaScriptException();
  6245. },
  6246. args: [],
  6247. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6248. messageSends: [],
  6249. referencedClasses: ["JavaScriptException"]
  6250. }),
  6251. globals.MethodInheritanceTest);
  6252. smalltalk.addMethod(
  6253. smalltalk.method({
  6254. selector: "targetClassMiddle",
  6255. protocol: 'accessing',
  6256. fn: function (){
  6257. var self=this;
  6258. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6259. return $Error();
  6260. },
  6261. args: [],
  6262. source: "targetClassMiddle\x0a\x09^ Error",
  6263. messageSends: [],
  6264. referencedClasses: ["Error"]
  6265. }),
  6266. globals.MethodInheritanceTest);
  6267. smalltalk.addMethod(
  6268. smalltalk.method({
  6269. selector: "targetClassTop",
  6270. protocol: 'accessing',
  6271. fn: function (){
  6272. var self=this;
  6273. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6274. return $Object();
  6275. },
  6276. args: [],
  6277. source: "targetClassTop\x0a\x09^ Object",
  6278. messageSends: [],
  6279. referencedClasses: ["Object"]
  6280. }),
  6281. globals.MethodInheritanceTest);
  6282. smalltalk.addMethod(
  6283. smalltalk.method({
  6284. selector: "tearDown",
  6285. protocol: 'initialization',
  6286. fn: function (){
  6287. var self=this;
  6288. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6289. return smalltalk.withContext(function($ctx1) {
  6290. _st((function(){
  6291. return smalltalk.withContext(function($ctx2) {
  6292. return self._deinstallTop();
  6293. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6294. }));
  6295. $ctx1.sendIdx["on:do:"]=1;
  6296. _st((function(){
  6297. return smalltalk.withContext(function($ctx2) {
  6298. return self._deinstallMiddle();
  6299. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6300. }));
  6301. $ctx1.sendIdx["on:do:"]=2;
  6302. _st((function(){
  6303. return smalltalk.withContext(function($ctx2) {
  6304. return self._deinstallBottom();
  6305. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6306. }));
  6307. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)})},
  6308. args: [],
  6309. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6310. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6311. referencedClasses: ["Error"]
  6312. }),
  6313. globals.MethodInheritanceTest);
  6314. smalltalk.addMethod(
  6315. smalltalk.method({
  6316. selector: "testMNU11",
  6317. protocol: 'tests',
  6318. fn: function (){
  6319. var self=this;
  6320. return smalltalk.withContext(function($ctx1) {
  6321. self["@performBlock"]=(function(x){
  6322. return smalltalk.withContext(function($ctx2) {
  6323. return _st(x)._foo();
  6324. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6325. self._shouldMNU();
  6326. $ctx1.sendIdx["shouldMNU"]=1;
  6327. self._installTop_("foo ^ false");
  6328. $ctx1.sendIdx["installTop:"]=1;
  6329. self._installTop_("foo ^ true");
  6330. self._deinstallTop();
  6331. self._shouldMNU();
  6332. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)})},
  6333. args: [],
  6334. 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",
  6335. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6336. referencedClasses: []
  6337. }),
  6338. globals.MethodInheritanceTest);
  6339. smalltalk.addMethod(
  6340. smalltalk.method({
  6341. selector: "testMNU22",
  6342. protocol: 'tests',
  6343. fn: function (){
  6344. var self=this;
  6345. return smalltalk.withContext(function($ctx1) {
  6346. self["@performBlock"]=(function(x){
  6347. return smalltalk.withContext(function($ctx2) {
  6348. return _st(x)._foo();
  6349. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6350. self._shouldMNU();
  6351. $ctx1.sendIdx["shouldMNU"]=1;
  6352. self._installMiddle_("foo ^ false");
  6353. $ctx1.sendIdx["installMiddle:"]=1;
  6354. self._installMiddle_("foo ^ true");
  6355. self._deinstallMiddle();
  6356. self._shouldMNU();
  6357. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)})},
  6358. args: [],
  6359. 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",
  6360. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6361. referencedClasses: []
  6362. }),
  6363. globals.MethodInheritanceTest);
  6364. smalltalk.addMethod(
  6365. smalltalk.method({
  6366. selector: "testReturns1",
  6367. protocol: 'tests',
  6368. fn: function (){
  6369. var self=this;
  6370. return smalltalk.withContext(function($ctx1) {
  6371. self["@performBlock"]=(function(x){
  6372. return smalltalk.withContext(function($ctx2) {
  6373. return _st(x)._foo();
  6374. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6375. self._installTop_("foo ^ false");
  6376. $ctx1.sendIdx["installTop:"]=1;
  6377. self._shouldReturn_(false);
  6378. $ctx1.sendIdx["shouldReturn:"]=1;
  6379. self._installTop_("foo ^ true");
  6380. self._shouldReturn_(true);
  6381. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)})},
  6382. args: [],
  6383. 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",
  6384. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6385. referencedClasses: []
  6386. }),
  6387. globals.MethodInheritanceTest);
  6388. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  6389. smalltalk.addMethod(
  6390. smalltalk.method({
  6391. selector: "testAbs",
  6392. protocol: 'tests',
  6393. fn: function (){
  6394. var self=this;
  6395. return smalltalk.withContext(function($ctx1) {
  6396. var $1;
  6397. $1=(4)._abs();
  6398. $ctx1.sendIdx["abs"]=1;
  6399. self._assert_equals_($1,(4));
  6400. $ctx1.sendIdx["assert:equals:"]=1;
  6401. self._assert_equals_((-4)._abs(),(4));
  6402. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)})},
  6403. args: [],
  6404. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6405. messageSends: ["assert:equals:", "abs"],
  6406. referencedClasses: []
  6407. }),
  6408. globals.NumberTest);
  6409. smalltalk.addMethod(
  6410. smalltalk.method({
  6411. selector: "testArithmetic",
  6412. protocol: 'tests',
  6413. fn: function (){
  6414. var self=this;
  6415. return smalltalk.withContext(function($ctx1) {
  6416. var $1,$2,$3,$5,$4;
  6417. $1=(1.5).__plus((1));
  6418. $ctx1.sendIdx["+"]=1;
  6419. self._assert_equals_($1,(2.5));
  6420. $ctx1.sendIdx["assert:equals:"]=1;
  6421. $2=(2).__minus((1));
  6422. $ctx1.sendIdx["-"]=1;
  6423. self._assert_equals_($2,(1));
  6424. $ctx1.sendIdx["assert:equals:"]=2;
  6425. self._assert_equals_((-2).__minus((1)),(-3));
  6426. $ctx1.sendIdx["assert:equals:"]=3;
  6427. self._assert_equals_((12).__slash((2)),(6));
  6428. $ctx1.sendIdx["assert:equals:"]=4;
  6429. $3=(3).__star((4));
  6430. $ctx1.sendIdx["*"]=1;
  6431. self._assert_equals_($3,(12));
  6432. $ctx1.sendIdx["assert:equals:"]=5;
  6433. self._assert_equals_((7).__slash_slash((2)),(3));
  6434. $ctx1.sendIdx["assert:equals:"]=6;
  6435. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6436. $ctx1.sendIdx["assert:equals:"]=7;
  6437. $5=(1).__plus((2));
  6438. $ctx1.sendIdx["+"]=2;
  6439. $4=_st($5).__star((3));
  6440. $ctx1.sendIdx["*"]=2;
  6441. self._assert_equals_($4,(9));
  6442. $ctx1.sendIdx["assert:equals:"]=8;
  6443. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6444. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)})},
  6445. args: [],
  6446. 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",
  6447. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6448. referencedClasses: []
  6449. }),
  6450. globals.NumberTest);
  6451. smalltalk.addMethod(
  6452. smalltalk.method({
  6453. selector: "testAsNumber",
  6454. protocol: 'tests',
  6455. fn: function (){
  6456. var self=this;
  6457. return smalltalk.withContext(function($ctx1) {
  6458. self._assert_equals_((3)._asNumber(),(3));
  6459. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)})},
  6460. args: [],
  6461. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6462. messageSends: ["assert:equals:", "asNumber"],
  6463. referencedClasses: []
  6464. }),
  6465. globals.NumberTest);
  6466. smalltalk.addMethod(
  6467. smalltalk.method({
  6468. selector: "testCeiling",
  6469. protocol: 'tests',
  6470. fn: function (){
  6471. var self=this;
  6472. return smalltalk.withContext(function($ctx1) {
  6473. var $1,$2;
  6474. $1=(1.2)._ceiling();
  6475. $ctx1.sendIdx["ceiling"]=1;
  6476. self._assert_equals_($1,(2));
  6477. $ctx1.sendIdx["assert:equals:"]=1;
  6478. $2=(-1.2)._ceiling();
  6479. $ctx1.sendIdx["ceiling"]=2;
  6480. self._assert_equals_($2,(-1));
  6481. $ctx1.sendIdx["assert:equals:"]=2;
  6482. self._assert_equals_((1)._ceiling(),(1));
  6483. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)})},
  6484. args: [],
  6485. 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.",
  6486. messageSends: ["assert:equals:", "ceiling"],
  6487. referencedClasses: []
  6488. }),
  6489. globals.NumberTest);
  6490. smalltalk.addMethod(
  6491. smalltalk.method({
  6492. selector: "testComparison",
  6493. protocol: 'tests',
  6494. fn: function (){
  6495. var self=this;
  6496. return smalltalk.withContext(function($ctx1) {
  6497. var $1,$2,$3,$4;
  6498. $1=(3).__gt((2));
  6499. $ctx1.sendIdx[">"]=1;
  6500. self._assert_($1);
  6501. $ctx1.sendIdx["assert:"]=1;
  6502. $2=(2).__lt((3));
  6503. $ctx1.sendIdx["<"]=1;
  6504. self._assert_($2);
  6505. $ctx1.sendIdx["assert:"]=2;
  6506. self._deny_((3).__lt((2)));
  6507. $ctx1.sendIdx["deny:"]=1;
  6508. self._deny_((2).__gt((3)));
  6509. $3=(3).__gt_eq((3));
  6510. $ctx1.sendIdx[">="]=1;
  6511. self._assert_($3);
  6512. $ctx1.sendIdx["assert:"]=3;
  6513. self._assert_((3.1).__gt_eq((3)));
  6514. $ctx1.sendIdx["assert:"]=4;
  6515. $4=(3).__lt_eq((3));
  6516. $ctx1.sendIdx["<="]=1;
  6517. self._assert_($4);
  6518. $ctx1.sendIdx["assert:"]=5;
  6519. self._assert_((3).__lt_eq((3.1)));
  6520. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)})},
  6521. args: [],
  6522. 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",
  6523. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6524. referencedClasses: []
  6525. }),
  6526. globals.NumberTest);
  6527. smalltalk.addMethod(
  6528. smalltalk.method({
  6529. selector: "testCopying",
  6530. protocol: 'tests',
  6531. fn: function (){
  6532. var self=this;
  6533. return smalltalk.withContext(function($ctx1) {
  6534. var $1;
  6535. $1=_st((1)._copy()).__eq_eq((1));
  6536. $ctx1.sendIdx["=="]=1;
  6537. self._assert_($1);
  6538. $ctx1.sendIdx["assert:"]=1;
  6539. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6540. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)})},
  6541. args: [],
  6542. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6543. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6544. referencedClasses: []
  6545. }),
  6546. globals.NumberTest);
  6547. smalltalk.addMethod(
  6548. smalltalk.method({
  6549. selector: "testEquality",
  6550. protocol: 'tests',
  6551. fn: function (){
  6552. var self=this;
  6553. return smalltalk.withContext(function($ctx1) {
  6554. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6555. $1=(1).__eq((1));
  6556. $ctx1.sendIdx["="]=1;
  6557. self._assert_($1);
  6558. $ctx1.sendIdx["assert:"]=1;
  6559. $2=(0).__eq((0));
  6560. $ctx1.sendIdx["="]=2;
  6561. self._assert_($2);
  6562. $ctx1.sendIdx["assert:"]=2;
  6563. $3=(1).__eq((0));
  6564. $ctx1.sendIdx["="]=3;
  6565. self._deny_($3);
  6566. $ctx1.sendIdx["deny:"]=1;
  6567. $5=(1)._yourself();
  6568. $ctx1.sendIdx["yourself"]=1;
  6569. $4=_st($5).__eq((1));
  6570. $ctx1.sendIdx["="]=4;
  6571. self._assert_($4);
  6572. $ctx1.sendIdx["assert:"]=3;
  6573. $7=(1)._yourself();
  6574. $ctx1.sendIdx["yourself"]=2;
  6575. $6=(1).__eq($7);
  6576. $ctx1.sendIdx["="]=5;
  6577. self._assert_($6);
  6578. $ctx1.sendIdx["assert:"]=4;
  6579. $9=(1)._yourself();
  6580. $ctx1.sendIdx["yourself"]=3;
  6581. $8=_st($9).__eq((1)._yourself());
  6582. $ctx1.sendIdx["="]=6;
  6583. self._assert_($8);
  6584. $10=(0).__eq(false);
  6585. $ctx1.sendIdx["="]=7;
  6586. self._deny_($10);
  6587. $ctx1.sendIdx["deny:"]=2;
  6588. $11=false.__eq((0));
  6589. $ctx1.sendIdx["="]=8;
  6590. self._deny_($11);
  6591. $ctx1.sendIdx["deny:"]=3;
  6592. $12="".__eq((0));
  6593. $ctx1.sendIdx["="]=9;
  6594. self._deny_($12);
  6595. $ctx1.sendIdx["deny:"]=4;
  6596. self._deny_((0).__eq(""));
  6597. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)})},
  6598. args: [],
  6599. 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 = ''",
  6600. messageSends: ["assert:", "=", "deny:", "yourself"],
  6601. referencedClasses: []
  6602. }),
  6603. globals.NumberTest);
  6604. smalltalk.addMethod(
  6605. smalltalk.method({
  6606. selector: "testFloor",
  6607. protocol: 'tests',
  6608. fn: function (){
  6609. var self=this;
  6610. return smalltalk.withContext(function($ctx1) {
  6611. var $1,$2;
  6612. $1=(1.2)._floor();
  6613. $ctx1.sendIdx["floor"]=1;
  6614. self._assert_equals_($1,(1));
  6615. $ctx1.sendIdx["assert:equals:"]=1;
  6616. $2=(-1.2)._floor();
  6617. $ctx1.sendIdx["floor"]=2;
  6618. self._assert_equals_($2,(-2));
  6619. $ctx1.sendIdx["assert:equals:"]=2;
  6620. self._assert_equals_((1)._floor(),(1));
  6621. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)})},
  6622. args: [],
  6623. 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.",
  6624. messageSends: ["assert:equals:", "floor"],
  6625. referencedClasses: []
  6626. }),
  6627. globals.NumberTest);
  6628. smalltalk.addMethod(
  6629. smalltalk.method({
  6630. selector: "testHexNumbers",
  6631. protocol: 'tests',
  6632. fn: function (){
  6633. var self=this;
  6634. return smalltalk.withContext(function($ctx1) {
  6635. var $1,$2,$3,$4,$5;
  6636. self._assert_equals_((9),(9));
  6637. $ctx1.sendIdx["assert:equals:"]=1;
  6638. $1=(10)._truncated();
  6639. $ctx1.sendIdx["truncated"]=1;
  6640. self._assert_equals_($1,(10));
  6641. $ctx1.sendIdx["assert:equals:"]=2;
  6642. $2=(11)._truncated();
  6643. $ctx1.sendIdx["truncated"]=2;
  6644. self._assert_equals_($2,(11));
  6645. $ctx1.sendIdx["assert:equals:"]=3;
  6646. $3=(12)._truncated();
  6647. $ctx1.sendIdx["truncated"]=3;
  6648. self._assert_equals_($3,(12));
  6649. $ctx1.sendIdx["assert:equals:"]=4;
  6650. $4=(13)._truncated();
  6651. $ctx1.sendIdx["truncated"]=4;
  6652. self._assert_equals_($4,(13));
  6653. $ctx1.sendIdx["assert:equals:"]=5;
  6654. $5=(14)._truncated();
  6655. $ctx1.sendIdx["truncated"]=5;
  6656. self._assert_equals_($5,(14));
  6657. $ctx1.sendIdx["assert:equals:"]=6;
  6658. self._assert_equals_((15)._truncated(),(15));
  6659. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)})},
  6660. args: [],
  6661. 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",
  6662. messageSends: ["assert:equals:", "truncated"],
  6663. referencedClasses: []
  6664. }),
  6665. globals.NumberTest);
  6666. smalltalk.addMethod(
  6667. smalltalk.method({
  6668. selector: "testIdentity",
  6669. protocol: 'tests',
  6670. fn: function (){
  6671. var self=this;
  6672. return smalltalk.withContext(function($ctx1) {
  6673. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6674. $1=(1).__eq_eq((1));
  6675. $ctx1.sendIdx["=="]=1;
  6676. self._assert_($1);
  6677. $ctx1.sendIdx["assert:"]=1;
  6678. $2=(0).__eq_eq((0));
  6679. $ctx1.sendIdx["=="]=2;
  6680. self._assert_($2);
  6681. $ctx1.sendIdx["assert:"]=2;
  6682. $3=(1).__eq_eq((0));
  6683. $ctx1.sendIdx["=="]=3;
  6684. self._deny_($3);
  6685. $ctx1.sendIdx["deny:"]=1;
  6686. $5=(1)._yourself();
  6687. $ctx1.sendIdx["yourself"]=1;
  6688. $4=_st($5).__eq_eq((1));
  6689. $ctx1.sendIdx["=="]=4;
  6690. self._assert_($4);
  6691. $ctx1.sendIdx["assert:"]=3;
  6692. $7=(1)._yourself();
  6693. $ctx1.sendIdx["yourself"]=2;
  6694. $6=(1).__eq_eq($7);
  6695. $ctx1.sendIdx["=="]=5;
  6696. self._assert_($6);
  6697. $ctx1.sendIdx["assert:"]=4;
  6698. $9=(1)._yourself();
  6699. $ctx1.sendIdx["yourself"]=3;
  6700. $8=_st($9).__eq_eq((1)._yourself());
  6701. $ctx1.sendIdx["=="]=6;
  6702. self._assert_($8);
  6703. self._deny_((1).__eq_eq((2)));
  6704. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)})},
  6705. args: [],
  6706. 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",
  6707. messageSends: ["assert:", "==", "deny:", "yourself"],
  6708. referencedClasses: []
  6709. }),
  6710. globals.NumberTest);
  6711. smalltalk.addMethod(
  6712. smalltalk.method({
  6713. selector: "testInvalidHexNumbers",
  6714. protocol: 'tests',
  6715. fn: function (){
  6716. var self=this;
  6717. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6718. return smalltalk.withContext(function($ctx1) {
  6719. self._should_raise_((function(){
  6720. return smalltalk.withContext(function($ctx2) {
  6721. return (16)._rG();
  6722. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6723. $ctx1.sendIdx["should:raise:"]=1;
  6724. self._should_raise_((function(){
  6725. return smalltalk.withContext(function($ctx2) {
  6726. return (16)._rg();
  6727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6728. $ctx1.sendIdx["should:raise:"]=2;
  6729. self._should_raise_((function(){
  6730. return smalltalk.withContext(function($ctx2) {
  6731. return (16)._rH();
  6732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6733. $ctx1.sendIdx["should:raise:"]=3;
  6734. self._should_raise_((function(){
  6735. return smalltalk.withContext(function($ctx2) {
  6736. return (16)._rh();
  6737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6738. $ctx1.sendIdx["should:raise:"]=4;
  6739. self._should_raise_((function(){
  6740. return smalltalk.withContext(function($ctx2) {
  6741. return (16)._rI();
  6742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6743. $ctx1.sendIdx["should:raise:"]=5;
  6744. self._should_raise_((function(){
  6745. return smalltalk.withContext(function($ctx2) {
  6746. return (16)._ri();
  6747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6748. $ctx1.sendIdx["should:raise:"]=6;
  6749. self._should_raise_((function(){
  6750. return smalltalk.withContext(function($ctx2) {
  6751. return (16)._rJ();
  6752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6753. $ctx1.sendIdx["should:raise:"]=7;
  6754. self._should_raise_((function(){
  6755. return smalltalk.withContext(function($ctx2) {
  6756. return (16)._rj();
  6757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6758. $ctx1.sendIdx["should:raise:"]=8;
  6759. self._should_raise_((function(){
  6760. return smalltalk.withContext(function($ctx2) {
  6761. return (16)._rK();
  6762. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6763. $ctx1.sendIdx["should:raise:"]=9;
  6764. self._should_raise_((function(){
  6765. return smalltalk.withContext(function($ctx2) {
  6766. return (16)._rk();
  6767. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6768. $ctx1.sendIdx["should:raise:"]=10;
  6769. self._should_raise_((function(){
  6770. return smalltalk.withContext(function($ctx2) {
  6771. return (16)._rL();
  6772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6773. $ctx1.sendIdx["should:raise:"]=11;
  6774. self._should_raise_((function(){
  6775. return smalltalk.withContext(function($ctx2) {
  6776. return (16)._rl();
  6777. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6778. $ctx1.sendIdx["should:raise:"]=12;
  6779. self._should_raise_((function(){
  6780. return smalltalk.withContext(function($ctx2) {
  6781. return (16)._rM();
  6782. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6783. $ctx1.sendIdx["should:raise:"]=13;
  6784. self._should_raise_((function(){
  6785. return smalltalk.withContext(function($ctx2) {
  6786. return (16)._rm();
  6787. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6788. $ctx1.sendIdx["should:raise:"]=14;
  6789. self._should_raise_((function(){
  6790. return smalltalk.withContext(function($ctx2) {
  6791. return (16)._rN();
  6792. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6793. $ctx1.sendIdx["should:raise:"]=15;
  6794. self._should_raise_((function(){
  6795. return smalltalk.withContext(function($ctx2) {
  6796. return (16)._rn();
  6797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6798. $ctx1.sendIdx["should:raise:"]=16;
  6799. self._should_raise_((function(){
  6800. return smalltalk.withContext(function($ctx2) {
  6801. return (16)._rO();
  6802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6803. $ctx1.sendIdx["should:raise:"]=17;
  6804. self._should_raise_((function(){
  6805. return smalltalk.withContext(function($ctx2) {
  6806. return (16)._ro();
  6807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6808. $ctx1.sendIdx["should:raise:"]=18;
  6809. self._should_raise_((function(){
  6810. return smalltalk.withContext(function($ctx2) {
  6811. return (16)._rP();
  6812. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6813. $ctx1.sendIdx["should:raise:"]=19;
  6814. self._should_raise_((function(){
  6815. return smalltalk.withContext(function($ctx2) {
  6816. return (16)._rp();
  6817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6818. $ctx1.sendIdx["should:raise:"]=20;
  6819. self._should_raise_((function(){
  6820. return smalltalk.withContext(function($ctx2) {
  6821. return (16)._rQ();
  6822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6823. $ctx1.sendIdx["should:raise:"]=21;
  6824. self._should_raise_((function(){
  6825. return smalltalk.withContext(function($ctx2) {
  6826. return (16)._rq();
  6827. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6828. $ctx1.sendIdx["should:raise:"]=22;
  6829. self._should_raise_((function(){
  6830. return smalltalk.withContext(function($ctx2) {
  6831. return (16)._rR();
  6832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6833. $ctx1.sendIdx["should:raise:"]=23;
  6834. self._should_raise_((function(){
  6835. return smalltalk.withContext(function($ctx2) {
  6836. return (16)._rr();
  6837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6838. $ctx1.sendIdx["should:raise:"]=24;
  6839. self._should_raise_((function(){
  6840. return smalltalk.withContext(function($ctx2) {
  6841. return (16)._rS();
  6842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6843. $ctx1.sendIdx["should:raise:"]=25;
  6844. self._should_raise_((function(){
  6845. return smalltalk.withContext(function($ctx2) {
  6846. return (16)._rs();
  6847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6848. $ctx1.sendIdx["should:raise:"]=26;
  6849. self._should_raise_((function(){
  6850. return smalltalk.withContext(function($ctx2) {
  6851. return (16)._rT();
  6852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6853. $ctx1.sendIdx["should:raise:"]=27;
  6854. self._should_raise_((function(){
  6855. return smalltalk.withContext(function($ctx2) {
  6856. return (16)._rt();
  6857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6858. $ctx1.sendIdx["should:raise:"]=28;
  6859. self._should_raise_((function(){
  6860. return smalltalk.withContext(function($ctx2) {
  6861. return (16)._rU();
  6862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6863. $ctx1.sendIdx["should:raise:"]=29;
  6864. self._should_raise_((function(){
  6865. return smalltalk.withContext(function($ctx2) {
  6866. return (16)._ru();
  6867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6868. $ctx1.sendIdx["should:raise:"]=30;
  6869. self._should_raise_((function(){
  6870. return smalltalk.withContext(function($ctx2) {
  6871. return (16)._rV();
  6872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6873. $ctx1.sendIdx["should:raise:"]=31;
  6874. self._should_raise_((function(){
  6875. return smalltalk.withContext(function($ctx2) {
  6876. return (16)._rv();
  6877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6878. $ctx1.sendIdx["should:raise:"]=32;
  6879. self._should_raise_((function(){
  6880. return smalltalk.withContext(function($ctx2) {
  6881. return (16)._rW();
  6882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6883. $ctx1.sendIdx["should:raise:"]=33;
  6884. self._should_raise_((function(){
  6885. return smalltalk.withContext(function($ctx2) {
  6886. return (16)._rw();
  6887. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6888. $ctx1.sendIdx["should:raise:"]=34;
  6889. self._should_raise_((function(){
  6890. return smalltalk.withContext(function($ctx2) {
  6891. return (16)._rX();
  6892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6893. $ctx1.sendIdx["should:raise:"]=35;
  6894. self._should_raise_((function(){
  6895. return smalltalk.withContext(function($ctx2) {
  6896. return (16)._rx();
  6897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6898. $ctx1.sendIdx["should:raise:"]=36;
  6899. self._should_raise_((function(){
  6900. return smalltalk.withContext(function($ctx2) {
  6901. return (16)._rY();
  6902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6903. $ctx1.sendIdx["should:raise:"]=37;
  6904. self._should_raise_((function(){
  6905. return smalltalk.withContext(function($ctx2) {
  6906. return (16)._ry();
  6907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6908. $ctx1.sendIdx["should:raise:"]=38;
  6909. self._should_raise_((function(){
  6910. return smalltalk.withContext(function($ctx2) {
  6911. return (16)._rZ();
  6912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6913. $ctx1.sendIdx["should:raise:"]=39;
  6914. self._should_raise_((function(){
  6915. return smalltalk.withContext(function($ctx2) {
  6916. return (16)._rz();
  6917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6918. $ctx1.sendIdx["should:raise:"]=40;
  6919. self._should_raise_((function(){
  6920. return smalltalk.withContext(function($ctx2) {
  6921. return (11259375)._Z();
  6922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6923. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)})},
  6924. args: [],
  6925. 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.",
  6926. 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"],
  6927. referencedClasses: ["MessageNotUnderstood"]
  6928. }),
  6929. globals.NumberTest);
  6930. smalltalk.addMethod(
  6931. smalltalk.method({
  6932. selector: "testLog",
  6933. protocol: 'tests',
  6934. fn: function (){
  6935. var self=this;
  6936. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  6937. return smalltalk.withContext(function($ctx1) {
  6938. self._assert_equals_((10000)._log(),(4));
  6939. $ctx1.sendIdx["assert:equals:"]=1;
  6940. self._assert_equals_((512)._log_((2)),(9));
  6941. $ctx1.sendIdx["assert:equals:"]=2;
  6942. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  6943. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)})},
  6944. args: [],
  6945. 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.",
  6946. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  6947. referencedClasses: ["Number"]
  6948. }),
  6949. globals.NumberTest);
  6950. smalltalk.addMethod(
  6951. smalltalk.method({
  6952. selector: "testMinMax",
  6953. protocol: 'tests',
  6954. fn: function (){
  6955. var self=this;
  6956. return smalltalk.withContext(function($ctx1) {
  6957. self._assert_equals_((2)._max_((5)),(5));
  6958. $ctx1.sendIdx["assert:equals:"]=1;
  6959. self._assert_equals_((2)._min_((5)),(2));
  6960. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)})},
  6961. args: [],
  6962. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  6963. messageSends: ["assert:equals:", "max:", "min:"],
  6964. referencedClasses: []
  6965. }),
  6966. globals.NumberTest);
  6967. smalltalk.addMethod(
  6968. smalltalk.method({
  6969. selector: "testNegated",
  6970. protocol: 'tests',
  6971. fn: function (){
  6972. var self=this;
  6973. return smalltalk.withContext(function($ctx1) {
  6974. var $1;
  6975. $1=(3)._negated();
  6976. $ctx1.sendIdx["negated"]=1;
  6977. self._assert_equals_($1,(-3));
  6978. $ctx1.sendIdx["assert:equals:"]=1;
  6979. self._assert_equals_((-3)._negated(),(3));
  6980. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)})},
  6981. args: [],
  6982. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  6983. messageSends: ["assert:equals:", "negated"],
  6984. referencedClasses: []
  6985. }),
  6986. globals.NumberTest);
  6987. smalltalk.addMethod(
  6988. smalltalk.method({
  6989. selector: "testPrintShowingDecimalPlaces",
  6990. protocol: 'tests',
  6991. fn: function (){
  6992. var self=this;
  6993. return smalltalk.withContext(function($ctx1) {
  6994. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  6995. $1=(23)._printShowingDecimalPlaces_((2));
  6996. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  6997. self._assert_equals_($1,"23.00");
  6998. $ctx1.sendIdx["assert:equals:"]=1;
  6999. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7000. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7001. self._assert_equals_($2,"23.57");
  7002. $ctx1.sendIdx["assert:equals:"]=2;
  7003. $4=(234.567)._negated();
  7004. $ctx1.sendIdx["negated"]=1;
  7005. $3=_st($4)._printShowingDecimalPlaces_((5));
  7006. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7007. self._assert_equals_($3,"-234.56700");
  7008. $ctx1.sendIdx["assert:equals:"]=3;
  7009. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7010. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7011. self._assert_equals_($5,"23");
  7012. $ctx1.sendIdx["assert:equals:"]=4;
  7013. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7014. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7015. self._assert_equals_($6,"24");
  7016. $ctx1.sendIdx["assert:equals:"]=5;
  7017. $8=(23.4567)._negated();
  7018. $ctx1.sendIdx["negated"]=2;
  7019. $7=_st($8)._printShowingDecimalPlaces_((0));
  7020. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7021. self._assert_equals_($7,"-23");
  7022. $ctx1.sendIdx["assert:equals:"]=6;
  7023. $10=(23.5567)._negated();
  7024. $ctx1.sendIdx["negated"]=3;
  7025. $9=_st($10)._printShowingDecimalPlaces_((0));
  7026. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7027. self._assert_equals_($9,"-24");
  7028. $ctx1.sendIdx["assert:equals:"]=7;
  7029. $11=(100000000)._printShowingDecimalPlaces_((1));
  7030. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7031. self._assert_equals_($11,"100000000.0");
  7032. $ctx1.sendIdx["assert:equals:"]=8;
  7033. $12=(0.98)._printShowingDecimalPlaces_((5));
  7034. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7035. self._assert_equals_($12,"0.98000");
  7036. $ctx1.sendIdx["assert:equals:"]=9;
  7037. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7038. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7039. self._assert_equals_($13,"-0.98");
  7040. $ctx1.sendIdx["assert:equals:"]=10;
  7041. $14=(2.567)._printShowingDecimalPlaces_((2));
  7042. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7043. self._assert_equals_($14,"2.57");
  7044. $ctx1.sendIdx["assert:equals:"]=11;
  7045. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7046. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7047. self._assert_equals_($15,"-2.57");
  7048. $ctx1.sendIdx["assert:equals:"]=12;
  7049. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7050. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)})},
  7051. args: [],
  7052. 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'.",
  7053. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7054. referencedClasses: []
  7055. }),
  7056. globals.NumberTest);
  7057. smalltalk.addMethod(
  7058. smalltalk.method({
  7059. selector: "testRaisedTo",
  7060. protocol: 'tests',
  7061. fn: function (){
  7062. var self=this;
  7063. return smalltalk.withContext(function($ctx1) {
  7064. var $1,$2,$3;
  7065. $1=(2)._raisedTo_((4));
  7066. $ctx1.sendIdx["raisedTo:"]=1;
  7067. self._assert_equals_($1,(16));
  7068. $ctx1.sendIdx["assert:equals:"]=1;
  7069. $2=(2)._raisedTo_((0));
  7070. $ctx1.sendIdx["raisedTo:"]=2;
  7071. self._assert_equals_($2,(1));
  7072. $ctx1.sendIdx["assert:equals:"]=2;
  7073. $3=(2)._raisedTo_((-3));
  7074. $ctx1.sendIdx["raisedTo:"]=3;
  7075. self._assert_equals_($3,(0.125));
  7076. $ctx1.sendIdx["assert:equals:"]=3;
  7077. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7078. $ctx1.sendIdx["assert:equals:"]=4;
  7079. self._assert_equals_((2).__star_star((4)),(16));
  7080. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)})},
  7081. args: [],
  7082. 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.",
  7083. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7084. referencedClasses: []
  7085. }),
  7086. globals.NumberTest);
  7087. smalltalk.addMethod(
  7088. smalltalk.method({
  7089. selector: "testRounded",
  7090. protocol: 'tests',
  7091. fn: function (){
  7092. var self=this;
  7093. return smalltalk.withContext(function($ctx1) {
  7094. var $1,$2;
  7095. $1=(3)._rounded();
  7096. $ctx1.sendIdx["rounded"]=1;
  7097. self._assert_equals_($1,(3));
  7098. $ctx1.sendIdx["assert:equals:"]=1;
  7099. $2=(3.212)._rounded();
  7100. $ctx1.sendIdx["rounded"]=2;
  7101. self._assert_equals_($2,(3));
  7102. $ctx1.sendIdx["assert:equals:"]=2;
  7103. self._assert_equals_((3.51)._rounded(),(4));
  7104. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)})},
  7105. args: [],
  7106. 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",
  7107. messageSends: ["assert:equals:", "rounded"],
  7108. referencedClasses: []
  7109. }),
  7110. globals.NumberTest);
  7111. smalltalk.addMethod(
  7112. smalltalk.method({
  7113. selector: "testSign",
  7114. protocol: 'tests',
  7115. fn: function (){
  7116. var self=this;
  7117. return smalltalk.withContext(function($ctx1) {
  7118. var $1,$2;
  7119. $1=(5)._sign();
  7120. $ctx1.sendIdx["sign"]=1;
  7121. self._assert_equals_($1,(1));
  7122. $ctx1.sendIdx["assert:equals:"]=1;
  7123. $2=(0)._sign();
  7124. $ctx1.sendIdx["sign"]=2;
  7125. self._assert_equals_($2,(0));
  7126. $ctx1.sendIdx["assert:equals:"]=2;
  7127. self._assert_equals_((-1.4)._sign(),(-1));
  7128. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)})},
  7129. args: [],
  7130. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7131. messageSends: ["assert:equals:", "sign"],
  7132. referencedClasses: []
  7133. }),
  7134. globals.NumberTest);
  7135. smalltalk.addMethod(
  7136. smalltalk.method({
  7137. selector: "testSqrt",
  7138. protocol: 'tests',
  7139. fn: function (){
  7140. var self=this;
  7141. return smalltalk.withContext(function($ctx1) {
  7142. var $1;
  7143. $1=(4)._sqrt();
  7144. $ctx1.sendIdx["sqrt"]=1;
  7145. self._assert_equals_($1,(2));
  7146. $ctx1.sendIdx["assert:equals:"]=1;
  7147. self._assert_equals_((16)._sqrt(),(4));
  7148. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)})},
  7149. args: [],
  7150. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7151. messageSends: ["assert:equals:", "sqrt"],
  7152. referencedClasses: []
  7153. }),
  7154. globals.NumberTest);
  7155. smalltalk.addMethod(
  7156. smalltalk.method({
  7157. selector: "testSquared",
  7158. protocol: 'tests',
  7159. fn: function (){
  7160. var self=this;
  7161. return smalltalk.withContext(function($ctx1) {
  7162. self._assert_equals_((4)._squared(),(16));
  7163. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)})},
  7164. args: [],
  7165. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7166. messageSends: ["assert:equals:", "squared"],
  7167. referencedClasses: []
  7168. }),
  7169. globals.NumberTest);
  7170. smalltalk.addMethod(
  7171. smalltalk.method({
  7172. selector: "testTimesRepeat",
  7173. protocol: 'tests',
  7174. fn: function (){
  7175. var self=this;
  7176. var i;
  7177. return smalltalk.withContext(function($ctx1) {
  7178. i=(0);
  7179. (0)._timesRepeat_((function(){
  7180. return smalltalk.withContext(function($ctx2) {
  7181. i=_st(i).__plus((1));
  7182. $ctx2.sendIdx["+"]=1;
  7183. return i;
  7184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7185. $ctx1.sendIdx["timesRepeat:"]=1;
  7186. self._assert_equals_(i,(0));
  7187. $ctx1.sendIdx["assert:equals:"]=1;
  7188. (5)._timesRepeat_((function(){
  7189. return smalltalk.withContext(function($ctx2) {
  7190. i=_st(i).__plus((1));
  7191. return i;
  7192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7193. self._assert_equals_(i,(5));
  7194. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)})},
  7195. args: [],
  7196. 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",
  7197. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7198. referencedClasses: []
  7199. }),
  7200. globals.NumberTest);
  7201. smalltalk.addMethod(
  7202. smalltalk.method({
  7203. selector: "testTo",
  7204. protocol: 'tests',
  7205. fn: function (){
  7206. var self=this;
  7207. return smalltalk.withContext(function($ctx1) {
  7208. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7209. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)})},
  7210. args: [],
  7211. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7212. messageSends: ["assert:equals:", "to:"],
  7213. referencedClasses: []
  7214. }),
  7215. globals.NumberTest);
  7216. smalltalk.addMethod(
  7217. smalltalk.method({
  7218. selector: "testToBy",
  7219. protocol: 'tests',
  7220. fn: function (){
  7221. var self=this;
  7222. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7223. return smalltalk.withContext(function($ctx1) {
  7224. var $1;
  7225. $1=(0)._to_by_((6),(2));
  7226. $ctx1.sendIdx["to:by:"]=1;
  7227. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7228. self._should_raise_((function(){
  7229. return smalltalk.withContext(function($ctx2) {
  7230. return (1)._to_by_((4),(0));
  7231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7232. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)})},
  7233. args: [],
  7234. 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",
  7235. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7236. referencedClasses: ["Error"]
  7237. }),
  7238. globals.NumberTest);
  7239. smalltalk.addMethod(
  7240. smalltalk.method({
  7241. selector: "testTrigonometry",
  7242. protocol: 'tests',
  7243. fn: function (){
  7244. var self=this;
  7245. return smalltalk.withContext(function($ctx1) {
  7246. self._assert_equals_((0)._cos(),(1));
  7247. $ctx1.sendIdx["assert:equals:"]=1;
  7248. self._assert_equals_((0)._sin(),(0));
  7249. $ctx1.sendIdx["assert:equals:"]=2;
  7250. self._assert_equals_((0)._tan(),(0));
  7251. $ctx1.sendIdx["assert:equals:"]=3;
  7252. self._assert_equals_((1)._arcCos(),(0));
  7253. $ctx1.sendIdx["assert:equals:"]=4;
  7254. self._assert_equals_((0)._arcSin(),(0));
  7255. $ctx1.sendIdx["assert:equals:"]=5;
  7256. self._assert_equals_((0)._arcTan(),(0));
  7257. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)})},
  7258. args: [],
  7259. 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.",
  7260. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7261. referencedClasses: []
  7262. }),
  7263. globals.NumberTest);
  7264. smalltalk.addMethod(
  7265. smalltalk.method({
  7266. selector: "testTruncated",
  7267. protocol: 'tests',
  7268. fn: function (){
  7269. var self=this;
  7270. return smalltalk.withContext(function($ctx1) {
  7271. var $1,$2;
  7272. $1=(3)._truncated();
  7273. $ctx1.sendIdx["truncated"]=1;
  7274. self._assert_equals_($1,(3));
  7275. $ctx1.sendIdx["assert:equals:"]=1;
  7276. $2=(3.212)._truncated();
  7277. $ctx1.sendIdx["truncated"]=2;
  7278. self._assert_equals_($2,(3));
  7279. $ctx1.sendIdx["assert:equals:"]=2;
  7280. self._assert_equals_((3.51)._truncated(),(3));
  7281. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)})},
  7282. args: [],
  7283. 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",
  7284. messageSends: ["assert:equals:", "truncated"],
  7285. referencedClasses: []
  7286. }),
  7287. globals.NumberTest);
  7288. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  7289. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7290. smalltalk.addMethod(
  7291. smalltalk.method({
  7292. selector: "foo",
  7293. protocol: 'not yet classified',
  7294. fn: function (){
  7295. var self=this;
  7296. var $1;
  7297. $1=self["@foo"];
  7298. return $1;
  7299. },
  7300. args: [],
  7301. source: "foo\x0a\x09^ foo",
  7302. messageSends: [],
  7303. referencedClasses: []
  7304. }),
  7305. globals.ObjectMock);
  7306. smalltalk.addMethod(
  7307. smalltalk.method({
  7308. selector: "foo:",
  7309. protocol: 'not yet classified',
  7310. fn: function (anObject){
  7311. var self=this;
  7312. self["@foo"]=anObject;
  7313. return self},
  7314. args: ["anObject"],
  7315. source: "foo: anObject\x0a\x09foo := anObject",
  7316. messageSends: [],
  7317. referencedClasses: []
  7318. }),
  7319. globals.ObjectMock);
  7320. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  7321. smalltalk.addMethod(
  7322. smalltalk.method({
  7323. selector: "notDefined",
  7324. protocol: 'tests',
  7325. fn: function (){
  7326. var self=this;
  7327. return smalltalk.withContext(function($ctx1) {
  7328. return void 0;;
  7329. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},globals.ObjectTest)})},
  7330. args: [],
  7331. source: "notDefined\x0a\x09<return void 0;>",
  7332. messageSends: [],
  7333. referencedClasses: []
  7334. }),
  7335. globals.ObjectTest);
  7336. smalltalk.addMethod(
  7337. smalltalk.method({
  7338. selector: "testBasicAccess",
  7339. protocol: 'tests',
  7340. fn: function (){
  7341. var self=this;
  7342. var o;
  7343. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7344. return smalltalk.withContext(function($ctx1) {
  7345. var $1;
  7346. o=_st($Object())._new();
  7347. _st(o)._basicAt_put_("a",(1));
  7348. $1=_st(o)._basicAt_("a");
  7349. $ctx1.sendIdx["basicAt:"]=1;
  7350. self._assert_equals_($1,(1));
  7351. $ctx1.sendIdx["assert:equals:"]=1;
  7352. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7353. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)})},
  7354. args: [],
  7355. 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",
  7356. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7357. referencedClasses: ["Object"]
  7358. }),
  7359. globals.ObjectTest);
  7360. smalltalk.addMethod(
  7361. smalltalk.method({
  7362. selector: "testBasicPerform",
  7363. protocol: 'tests',
  7364. fn: function (){
  7365. var self=this;
  7366. var o;
  7367. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7368. return smalltalk.withContext(function($ctx1) {
  7369. o=_st($Object())._new();
  7370. _st(o)._basicAt_put_("func",(function(){
  7371. return "hello";
  7372. }));
  7373. $ctx1.sendIdx["basicAt:put:"]=1;
  7374. _st(o)._basicAt_put_("func2",(function(a){
  7375. return smalltalk.withContext(function($ctx2) {
  7376. return _st(a).__plus((1));
  7377. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7378. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7379. $ctx1.sendIdx["assert:equals:"]=1;
  7380. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7381. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)})},
  7382. args: [],
  7383. 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",
  7384. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7385. referencedClasses: ["Object"]
  7386. }),
  7387. globals.ObjectTest);
  7388. smalltalk.addMethod(
  7389. smalltalk.method({
  7390. selector: "testDNU",
  7391. protocol: 'tests',
  7392. fn: function (){
  7393. var self=this;
  7394. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7395. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7396. return smalltalk.withContext(function($ctx1) {
  7397. self._should_raise_((function(){
  7398. return smalltalk.withContext(function($ctx2) {
  7399. return _st(_st($Object())._new())._foo();
  7400. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7401. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)})},
  7402. args: [],
  7403. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7404. messageSends: ["should:raise:", "foo", "new"],
  7405. referencedClasses: ["Object", "MessageNotUnderstood"]
  7406. }),
  7407. globals.ObjectTest);
  7408. smalltalk.addMethod(
  7409. smalltalk.method({
  7410. selector: "testEquality",
  7411. protocol: 'tests',
  7412. fn: function (){
  7413. var self=this;
  7414. var o;
  7415. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7416. return smalltalk.withContext(function($ctx1) {
  7417. var $1,$2,$4,$3;
  7418. o=_st($Object())._new();
  7419. $ctx1.sendIdx["new"]=1;
  7420. $1=_st(o).__eq(_st($Object())._new());
  7421. $ctx1.sendIdx["="]=1;
  7422. self._deny_($1);
  7423. $2=_st(o).__eq(o);
  7424. $ctx1.sendIdx["="]=2;
  7425. self._assert_($2);
  7426. $ctx1.sendIdx["assert:"]=1;
  7427. $4=_st(o)._yourself();
  7428. $ctx1.sendIdx["yourself"]=1;
  7429. $3=_st($4).__eq(o);
  7430. $ctx1.sendIdx["="]=3;
  7431. self._assert_($3);
  7432. $ctx1.sendIdx["assert:"]=2;
  7433. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7434. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)})},
  7435. args: [],
  7436. 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)",
  7437. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7438. referencedClasses: ["Object"]
  7439. }),
  7440. globals.ObjectTest);
  7441. smalltalk.addMethod(
  7442. smalltalk.method({
  7443. selector: "testHalt",
  7444. protocol: 'tests',
  7445. fn: function (){
  7446. var self=this;
  7447. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7448. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7449. return smalltalk.withContext(function($ctx1) {
  7450. self._should_raise_((function(){
  7451. return smalltalk.withContext(function($ctx2) {
  7452. return _st(_st($Object())._new())._halt();
  7453. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7454. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)})},
  7455. args: [],
  7456. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7457. messageSends: ["should:raise:", "halt", "new"],
  7458. referencedClasses: ["Object", "Error"]
  7459. }),
  7460. globals.ObjectTest);
  7461. smalltalk.addMethod(
  7462. smalltalk.method({
  7463. selector: "testIdentity",
  7464. protocol: 'tests',
  7465. fn: function (){
  7466. var self=this;
  7467. var o;
  7468. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7469. return smalltalk.withContext(function($ctx1) {
  7470. var $1,$2,$4,$3;
  7471. o=_st($Object())._new();
  7472. $ctx1.sendIdx["new"]=1;
  7473. $1=_st(o).__eq_eq(_st($Object())._new());
  7474. $ctx1.sendIdx["=="]=1;
  7475. self._deny_($1);
  7476. $2=_st(o).__eq_eq(o);
  7477. $ctx1.sendIdx["=="]=2;
  7478. self._assert_($2);
  7479. $ctx1.sendIdx["assert:"]=1;
  7480. $4=_st(o)._yourself();
  7481. $ctx1.sendIdx["yourself"]=1;
  7482. $3=_st($4).__eq_eq(o);
  7483. $ctx1.sendIdx["=="]=3;
  7484. self._assert_($3);
  7485. $ctx1.sendIdx["assert:"]=2;
  7486. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7487. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)})},
  7488. args: [],
  7489. 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",
  7490. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7491. referencedClasses: ["Object"]
  7492. }),
  7493. globals.ObjectTest);
  7494. smalltalk.addMethod(
  7495. smalltalk.method({
  7496. selector: "testIfNil",
  7497. protocol: 'tests',
  7498. fn: function (){
  7499. var self=this;
  7500. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7501. return smalltalk.withContext(function($ctx1) {
  7502. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  7503. $2=_st($Object())._new();
  7504. $ctx1.sendIdx["new"]=1;
  7505. $1=_st($2)._isNil();
  7506. self._deny_($1);
  7507. $ctx1.sendIdx["deny:"]=1;
  7508. $5=_st($Object())._new();
  7509. $ctx1.sendIdx["new"]=2;
  7510. if(($receiver = $5) == null || $receiver.isNil){
  7511. $4=true;
  7512. } else {
  7513. $4=$5;
  7514. };
  7515. $3=_st($4).__eq(true);
  7516. self._deny_($3);
  7517. $7=_st($Object())._new();
  7518. $ctx1.sendIdx["new"]=3;
  7519. if(($receiver = $7) == null || $receiver.isNil){
  7520. $6=$7;
  7521. } else {
  7522. $6=true;
  7523. };
  7524. self._assert_equals_($6,true);
  7525. $ctx1.sendIdx["assert:equals:"]=1;
  7526. $9=_st($Object())._new();
  7527. $ctx1.sendIdx["new"]=4;
  7528. if(($receiver = $9) == null || $receiver.isNil){
  7529. $8=false;
  7530. } else {
  7531. $8=true;
  7532. };
  7533. self._assert_equals_($8,true);
  7534. $ctx1.sendIdx["assert:equals:"]=2;
  7535. $11=_st($Object())._new();
  7536. if(($receiver = $11) == null || $receiver.isNil){
  7537. $10=false;
  7538. } else {
  7539. $10=true;
  7540. };
  7541. self._assert_equals_($10,true);
  7542. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)})},
  7543. args: [],
  7544. 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",
  7545. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7546. referencedClasses: ["Object"]
  7547. }),
  7548. globals.ObjectTest);
  7549. smalltalk.addMethod(
  7550. smalltalk.method({
  7551. selector: "testInstVars",
  7552. protocol: 'tests',
  7553. fn: function (){
  7554. var self=this;
  7555. var o;
  7556. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7557. return smalltalk.withContext(function($ctx1) {
  7558. var $1,$2;
  7559. o=_st($ObjectMock())._new();
  7560. $1=_st(o)._instVarAt_("foo");
  7561. $ctx1.sendIdx["instVarAt:"]=1;
  7562. self._assert_equals_($1,nil);
  7563. $ctx1.sendIdx["assert:equals:"]=1;
  7564. _st(o)._instVarAt_put_("foo",(1));
  7565. $2=_st(o)._instVarAt_("foo");
  7566. $ctx1.sendIdx["instVarAt:"]=2;
  7567. self._assert_equals_($2,(1));
  7568. $ctx1.sendIdx["assert:equals:"]=2;
  7569. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7570. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)})},
  7571. args: [],
  7572. 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",
  7573. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7574. referencedClasses: ["ObjectMock"]
  7575. }),
  7576. globals.ObjectTest);
  7577. smalltalk.addMethod(
  7578. smalltalk.method({
  7579. selector: "testNilUndefined",
  7580. protocol: 'tests',
  7581. fn: function (){
  7582. var self=this;
  7583. return smalltalk.withContext(function($ctx1) {
  7584. self._assert_equals_(self._notDefined(),nil);
  7585. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)})},
  7586. args: [],
  7587. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7588. messageSends: ["assert:equals:", "notDefined"],
  7589. referencedClasses: []
  7590. }),
  7591. globals.ObjectTest);
  7592. smalltalk.addMethod(
  7593. smalltalk.method({
  7594. selector: "testYourself",
  7595. protocol: 'tests',
  7596. fn: function (){
  7597. var self=this;
  7598. var o;
  7599. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7600. return smalltalk.withContext(function($ctx1) {
  7601. o=_st($ObjectMock())._new();
  7602. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7603. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)})},
  7604. args: [],
  7605. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7606. messageSends: ["new", "assert:", "==", "yourself"],
  7607. referencedClasses: ["ObjectMock"]
  7608. }),
  7609. globals.ObjectTest);
  7610. smalltalk.addMethod(
  7611. smalltalk.method({
  7612. selector: "testidentityHash",
  7613. protocol: 'tests',
  7614. fn: function (){
  7615. var self=this;
  7616. var o1,o2;
  7617. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7618. return smalltalk.withContext(function($ctx1) {
  7619. var $2,$3,$1,$5,$4;
  7620. o1=_st($Object())._new();
  7621. $ctx1.sendIdx["new"]=1;
  7622. o2=_st($Object())._new();
  7623. $2=_st(o1)._identityHash();
  7624. $ctx1.sendIdx["identityHash"]=1;
  7625. $3=_st(o1)._identityHash();
  7626. $ctx1.sendIdx["identityHash"]=2;
  7627. $1=_st($2).__eq_eq($3);
  7628. $ctx1.sendIdx["=="]=1;
  7629. self._assert_($1);
  7630. $5=_st(o1)._identityHash();
  7631. $ctx1.sendIdx["identityHash"]=3;
  7632. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7633. self._deny_($4);
  7634. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)})},
  7635. args: [],
  7636. 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",
  7637. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7638. referencedClasses: ["Object"]
  7639. }),
  7640. globals.ObjectTest);
  7641. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  7642. smalltalk.addMethod(
  7643. smalltalk.method({
  7644. selector: "testAccessing",
  7645. protocol: 'tests',
  7646. fn: function (){
  7647. var self=this;
  7648. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7649. return smalltalk.withContext(function($ctx1) {
  7650. var $2,$1,$3,$6,$5,$4;
  7651. $2=_st($Point())._x_y_((3),(4));
  7652. $ctx1.sendIdx["x:y:"]=1;
  7653. $1=_st($2)._x();
  7654. $ctx1.sendIdx["x"]=1;
  7655. self._assert_equals_($1,(3));
  7656. $ctx1.sendIdx["assert:equals:"]=1;
  7657. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7658. $ctx1.sendIdx["y"]=1;
  7659. self._assert_equals_($3,(4));
  7660. $ctx1.sendIdx["assert:equals:"]=2;
  7661. $6=_st($Point())._new();
  7662. $ctx1.sendIdx["new"]=1;
  7663. $5=_st($6)._x_((3));
  7664. $4=_st($5)._x();
  7665. self._assert_equals_($4,(3));
  7666. $ctx1.sendIdx["assert:equals:"]=3;
  7667. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7668. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)})},
  7669. args: [],
  7670. 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",
  7671. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7672. referencedClasses: ["Point"]
  7673. }),
  7674. globals.PointTest);
  7675. smalltalk.addMethod(
  7676. smalltalk.method({
  7677. selector: "testArithmetic",
  7678. protocol: 'tests',
  7679. fn: function (){
  7680. var self=this;
  7681. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7682. return smalltalk.withContext(function($ctx1) {
  7683. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7684. $2=(3).__at((4));
  7685. $ctx1.sendIdx["@"]=1;
  7686. $3=(3).__at((4));
  7687. $ctx1.sendIdx["@"]=2;
  7688. $1=_st($2).__star($3);
  7689. $4=_st($Point())._x_y_((9),(16));
  7690. $ctx1.sendIdx["x:y:"]=1;
  7691. self._assert_equals_($1,$4);
  7692. $ctx1.sendIdx["assert:equals:"]=1;
  7693. $6=(3).__at((4));
  7694. $ctx1.sendIdx["@"]=3;
  7695. $7=(3).__at((4));
  7696. $ctx1.sendIdx["@"]=4;
  7697. $5=_st($6).__plus($7);
  7698. $8=_st($Point())._x_y_((6),(8));
  7699. $ctx1.sendIdx["x:y:"]=2;
  7700. self._assert_equals_($5,$8);
  7701. $ctx1.sendIdx["assert:equals:"]=2;
  7702. $10=(3).__at((4));
  7703. $ctx1.sendIdx["@"]=5;
  7704. $11=(3).__at((4));
  7705. $ctx1.sendIdx["@"]=6;
  7706. $9=_st($10).__minus($11);
  7707. $12=_st($Point())._x_y_((0),(0));
  7708. $ctx1.sendIdx["x:y:"]=3;
  7709. self._assert_equals_($9,$12);
  7710. $ctx1.sendIdx["assert:equals:"]=3;
  7711. $14=(6).__at((8));
  7712. $ctx1.sendIdx["@"]=7;
  7713. $13=_st($14).__slash((3).__at((4)));
  7714. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7715. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)})},
  7716. args: [],
  7717. 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)",
  7718. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7719. referencedClasses: ["Point"]
  7720. }),
  7721. globals.PointTest);
  7722. smalltalk.addMethod(
  7723. smalltalk.method({
  7724. selector: "testAt",
  7725. protocol: 'tests',
  7726. fn: function (){
  7727. var self=this;
  7728. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7729. return smalltalk.withContext(function($ctx1) {
  7730. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7731. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)})},
  7732. args: [],
  7733. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7734. messageSends: ["assert:equals:", "@", "x:y:"],
  7735. referencedClasses: ["Point"]
  7736. }),
  7737. globals.PointTest);
  7738. smalltalk.addMethod(
  7739. smalltalk.method({
  7740. selector: "testComparison",
  7741. protocol: 'tests',
  7742. fn: function (){
  7743. var self=this;
  7744. return smalltalk.withContext(function($ctx1) {
  7745. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  7746. $2=(3).__at((4));
  7747. $ctx1.sendIdx["@"]=1;
  7748. $3=(4).__at((5));
  7749. $ctx1.sendIdx["@"]=2;
  7750. $1=_st($2).__lt($3);
  7751. $ctx1.sendIdx["<"]=1;
  7752. self._assert_($1);
  7753. $ctx1.sendIdx["assert:"]=1;
  7754. $5=(3).__at((4));
  7755. $ctx1.sendIdx["@"]=3;
  7756. $6=(4).__at((4));
  7757. $ctx1.sendIdx["@"]=4;
  7758. $4=_st($5).__lt($6);
  7759. self._deny_($4);
  7760. $ctx1.sendIdx["deny:"]=1;
  7761. $8=(4).__at((5));
  7762. $ctx1.sendIdx["@"]=5;
  7763. $9=(4).__at((5));
  7764. $ctx1.sendIdx["@"]=6;
  7765. $7=_st($8).__lt_eq($9);
  7766. $ctx1.sendIdx["<="]=1;
  7767. self._assert_($7);
  7768. $ctx1.sendIdx["assert:"]=2;
  7769. $11=(4).__at((5));
  7770. $ctx1.sendIdx["@"]=7;
  7771. $12=(3).__at((5));
  7772. $ctx1.sendIdx["@"]=8;
  7773. $10=_st($11).__lt_eq($12);
  7774. self._deny_($10);
  7775. $ctx1.sendIdx["deny:"]=2;
  7776. $14=(5).__at((6));
  7777. $ctx1.sendIdx["@"]=9;
  7778. $15=(4).__at((5));
  7779. $ctx1.sendIdx["@"]=10;
  7780. $13=_st($14).__gt($15);
  7781. $ctx1.sendIdx[">"]=1;
  7782. self._assert_($13);
  7783. $ctx1.sendIdx["assert:"]=3;
  7784. $17=(5).__at((6));
  7785. $ctx1.sendIdx["@"]=11;
  7786. $18=(6).__at((6));
  7787. $ctx1.sendIdx["@"]=12;
  7788. $16=_st($17).__gt($18);
  7789. self._deny_($16);
  7790. $ctx1.sendIdx["deny:"]=3;
  7791. $20=(4).__at((5));
  7792. $ctx1.sendIdx["@"]=13;
  7793. $21=(4).__at((5));
  7794. $ctx1.sendIdx["@"]=14;
  7795. $19=_st($20).__gt_eq($21);
  7796. $ctx1.sendIdx[">="]=1;
  7797. self._assert_($19);
  7798. $23=(4).__at((5));
  7799. $ctx1.sendIdx["@"]=15;
  7800. $22=_st($23).__gt_eq((5).__at((5)));
  7801. self._deny_($22);
  7802. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.PointTest)})},
  7803. args: [],
  7804. source: "testComparison\x0a\x09self assert: 3@4 < (4@5).\x0a\x09self deny: 3@4 < (4@4).\x0a\x09\x0a\x09self assert: 4@5 <= (4@5).\x0a\x09self deny: 4@5 <= (3@5).\x0a\x09\x0a\x09self assert: 5@6 > (4@5).\x0a\x09self deny: 5@6 > (6@6).\x0a\x09\x0a\x09self assert: 4@5 >= (4@5).\x0a\x09self deny: 4@5 >= (5@5)",
  7805. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="],
  7806. referencedClasses: []
  7807. }),
  7808. globals.PointTest);
  7809. smalltalk.addMethod(
  7810. smalltalk.method({
  7811. selector: "testEgality",
  7812. protocol: 'tests',
  7813. fn: function (){
  7814. var self=this;
  7815. return smalltalk.withContext(function($ctx1) {
  7816. var $2,$3,$1,$5,$4;
  7817. $2=(3).__at((4));
  7818. $ctx1.sendIdx["@"]=1;
  7819. $3=(3).__at((4));
  7820. $ctx1.sendIdx["@"]=2;
  7821. $1=_st($2).__eq($3);
  7822. $ctx1.sendIdx["="]=1;
  7823. self._assert_($1);
  7824. $5=(3).__at((5));
  7825. $ctx1.sendIdx["@"]=3;
  7826. $4=_st($5).__eq((3).__at((6)));
  7827. self._deny_($4);
  7828. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)})},
  7829. args: [],
  7830. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7831. messageSends: ["assert:", "=", "@", "deny:"],
  7832. referencedClasses: []
  7833. }),
  7834. globals.PointTest);
  7835. smalltalk.addMethod(
  7836. smalltalk.method({
  7837. selector: "testNew",
  7838. protocol: 'tests',
  7839. fn: function (){
  7840. var self=this;
  7841. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7842. return smalltalk.withContext(function($ctx1) {
  7843. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7844. $3=_st($Point())._new();
  7845. $ctx1.sendIdx["new"]=1;
  7846. $2=_st($3)._x_((3));
  7847. $ctx1.sendIdx["x:"]=1;
  7848. $1=_st($2)._y();
  7849. $ctx1.sendIdx["y"]=1;
  7850. self._assert_equals_($1,nil);
  7851. $ctx1.sendIdx["assert:equals:"]=1;
  7852. $7=_st($Point())._new();
  7853. $ctx1.sendIdx["new"]=2;
  7854. $6=_st($7)._x_((3));
  7855. $5=_st($6)._x();
  7856. $ctx1.sendIdx["x"]=1;
  7857. $4=_st($5).__eq((0));
  7858. $ctx1.sendIdx["="]=1;
  7859. self._deny_($4);
  7860. $ctx1.sendIdx["deny:"]=1;
  7861. $10=_st($Point())._new();
  7862. $ctx1.sendIdx["new"]=3;
  7863. $9=_st($10)._y_((4));
  7864. $ctx1.sendIdx["y:"]=1;
  7865. $8=_st($9)._x();
  7866. self._assert_equals_($8,nil);
  7867. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7868. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)})},
  7869. args: [],
  7870. 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",
  7871. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7872. referencedClasses: ["Point"]
  7873. }),
  7874. globals.PointTest);
  7875. smalltalk.addMethod(
  7876. smalltalk.method({
  7877. selector: "testTranslateBy",
  7878. protocol: 'tests',
  7879. fn: function (){
  7880. var self=this;
  7881. return smalltalk.withContext(function($ctx1) {
  7882. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7883. $2=(3).__at((3));
  7884. $ctx1.sendIdx["@"]=1;
  7885. $3=(0).__at((1));
  7886. $ctx1.sendIdx["@"]=2;
  7887. $1=_st($2)._translateBy_($3);
  7888. $ctx1.sendIdx["translateBy:"]=1;
  7889. $4=(3).__at((4));
  7890. $ctx1.sendIdx["@"]=3;
  7891. self._assert_equals_($1,$4);
  7892. $ctx1.sendIdx["assert:equals:"]=1;
  7893. $6=(3).__at((3));
  7894. $ctx1.sendIdx["@"]=4;
  7895. $8=(1)._negated();
  7896. $ctx1.sendIdx["negated"]=1;
  7897. $7=(0).__at($8);
  7898. $ctx1.sendIdx["@"]=5;
  7899. $5=_st($6)._translateBy_($7);
  7900. $ctx1.sendIdx["translateBy:"]=2;
  7901. $9=(3).__at((2));
  7902. $ctx1.sendIdx["@"]=6;
  7903. self._assert_equals_($5,$9);
  7904. $ctx1.sendIdx["assert:equals:"]=2;
  7905. $11=(3).__at((3));
  7906. $ctx1.sendIdx["@"]=7;
  7907. $12=(2).__at((3));
  7908. $ctx1.sendIdx["@"]=8;
  7909. $10=_st($11)._translateBy_($12);
  7910. $ctx1.sendIdx["translateBy:"]=3;
  7911. $13=(5).__at((6));
  7912. $ctx1.sendIdx["@"]=9;
  7913. self._assert_equals_($10,$13);
  7914. $ctx1.sendIdx["assert:equals:"]=3;
  7915. $15=(3).__at((3));
  7916. $ctx1.sendIdx["@"]=10;
  7917. $16=_st((3)._negated()).__at((0));
  7918. $ctx1.sendIdx["@"]=11;
  7919. $14=_st($15)._translateBy_($16);
  7920. self._assert_equals_($14,(0).__at((3)));
  7921. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)})},
  7922. args: [],
  7923. 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.",
  7924. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7925. referencedClasses: []
  7926. }),
  7927. globals.PointTest);
  7928. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  7929. smalltalk.addMethod(
  7930. smalltalk.method({
  7931. selector: "testNextIfAbsent",
  7932. protocol: 'tests',
  7933. fn: function (){
  7934. var self=this;
  7935. var queue;
  7936. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7937. return smalltalk.withContext(function($ctx1) {
  7938. var $2,$1;
  7939. queue=_st($Queue())._new();
  7940. _st(queue)._nextPut_("index1");
  7941. $2=_st(queue)._nextIfAbsent_("empty");
  7942. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7943. $1=_st($2).__eq("index1");
  7944. $ctx1.sendIdx["="]=1;
  7945. self._assert_($1);
  7946. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7947. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)})},
  7948. args: [],
  7949. 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'",
  7950. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7951. referencedClasses: ["Queue"]
  7952. }),
  7953. globals.QueueTest);
  7954. smalltalk.addMethod(
  7955. smalltalk.method({
  7956. selector: "testQueueNext",
  7957. protocol: 'tests',
  7958. fn: function (){
  7959. var self=this;
  7960. var queue;
  7961. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7962. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7963. return smalltalk.withContext(function($ctx1) {
  7964. var $1,$2,$4,$3,$6,$5;
  7965. queue=_st($Queue())._new();
  7966. $1=queue;
  7967. _st($1)._nextPut_("index1");
  7968. $ctx1.sendIdx["nextPut:"]=1;
  7969. $2=_st($1)._nextPut_("index2");
  7970. $4=_st(queue)._next();
  7971. $ctx1.sendIdx["next"]=1;
  7972. $3=_st($4).__eq("index1");
  7973. $ctx1.sendIdx["="]=1;
  7974. self._assert_($3);
  7975. $6=_st(queue)._next();
  7976. $ctx1.sendIdx["next"]=2;
  7977. $5=_st($6).__eq("index");
  7978. self._deny_($5);
  7979. self._should_raise_((function(){
  7980. return smalltalk.withContext(function($ctx2) {
  7981. return _st(queue)._next();
  7982. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7983. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)})},
  7984. args: [],
  7985. 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",
  7986. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  7987. referencedClasses: ["Queue", "Error"]
  7988. }),
  7989. globals.QueueTest);
  7990. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  7991. smalltalk.addMethod(
  7992. smalltalk.method({
  7993. selector: "testAtRandomNumber",
  7994. protocol: 'tests',
  7995. fn: function (){
  7996. var self=this;
  7997. var val;
  7998. return smalltalk.withContext(function($ctx1) {
  7999. (100)._timesRepeat_((function(){
  8000. return smalltalk.withContext(function($ctx2) {
  8001. val=(10)._atRandom();
  8002. val;
  8003. self._assert_(_st(val).__gt((0)));
  8004. $ctx2.sendIdx["assert:"]=1;
  8005. return self._assert_(_st(val).__lt((11)));
  8006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8007. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)})},
  8008. args: [],
  8009. 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]",
  8010. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  8011. referencedClasses: []
  8012. }),
  8013. globals.RandomTest);
  8014. smalltalk.addMethod(
  8015. smalltalk.method({
  8016. selector: "testAtRandomSequenceableCollection",
  8017. protocol: 'tests',
  8018. fn: function (){
  8019. var self=this;
  8020. var val;
  8021. return smalltalk.withContext(function($ctx1) {
  8022. var $3,$4,$2,$1;
  8023. (100)._timesRepeat_((function(){
  8024. return smalltalk.withContext(function($ctx2) {
  8025. val="abc"._atRandom();
  8026. val;
  8027. $3=_st(val).__eq("a");
  8028. $ctx2.sendIdx["="]=1;
  8029. $4=_st(val).__eq("b");
  8030. $ctx2.sendIdx["="]=2;
  8031. $2=_st($3).__or($4);
  8032. $1=_st($2).__or(_st(val).__eq("c"));
  8033. $ctx2.sendIdx["|"]=1;
  8034. return self._assert_($1);
  8035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8036. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)})},
  8037. args: [],
  8038. 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].",
  8039. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  8040. referencedClasses: []
  8041. }),
  8042. globals.RandomTest);
  8043. smalltalk.addMethod(
  8044. smalltalk.method({
  8045. selector: "textNext",
  8046. protocol: 'tests',
  8047. fn: function (){
  8048. var self=this;
  8049. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  8050. return smalltalk.withContext(function($ctx1) {
  8051. var $1;
  8052. (10000)._timesRepeat_((function(){
  8053. var current,next;
  8054. return smalltalk.withContext(function($ctx2) {
  8055. next=_st(_st($Random())._new())._next();
  8056. next;
  8057. self._assert_(_st(next).__gt_eq((0)));
  8058. $ctx2.sendIdx["assert:"]=1;
  8059. self._assert_(_st(next).__lt((1)));
  8060. $1=_st(current).__eq(next);
  8061. $ctx2.sendIdx["="]=1;
  8062. self._deny_($1);
  8063. return _st(next).__eq(current);
  8064. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8065. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)})},
  8066. args: [],
  8067. 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 ]",
  8068. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8069. referencedClasses: ["Random"]
  8070. }),
  8071. globals.RandomTest);
  8072. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  8073. smalltalk.addMethod(
  8074. smalltalk.method({
  8075. selector: "collectionClass",
  8076. protocol: 'accessing',
  8077. fn: function (){
  8078. var self=this;
  8079. return smalltalk.withContext(function($ctx1) {
  8080. var $1;
  8081. $1=_st(self._class())._collectionClass();
  8082. return $1;
  8083. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)})},
  8084. args: [],
  8085. source: "collectionClass\x0a\x09^ self class collectionClass",
  8086. messageSends: ["collectionClass", "class"],
  8087. referencedClasses: []
  8088. }),
  8089. globals.StreamTest);
  8090. smalltalk.addMethod(
  8091. smalltalk.method({
  8092. selector: "newCollection",
  8093. protocol: 'accessing',
  8094. fn: function (){
  8095. var self=this;
  8096. return smalltalk.withContext(function($ctx1) {
  8097. var $1;
  8098. $1=_st(self._collectionClass())._new();
  8099. return $1;
  8100. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)})},
  8101. args: [],
  8102. source: "newCollection\x0a\x09^ self collectionClass new",
  8103. messageSends: ["new", "collectionClass"],
  8104. referencedClasses: []
  8105. }),
  8106. globals.StreamTest);
  8107. smalltalk.addMethod(
  8108. smalltalk.method({
  8109. selector: "newStream",
  8110. protocol: 'accessing',
  8111. fn: function (){
  8112. var self=this;
  8113. return smalltalk.withContext(function($ctx1) {
  8114. var $1;
  8115. $1=_st(_st(self._collectionClass())._new())._stream();
  8116. return $1;
  8117. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)})},
  8118. args: [],
  8119. source: "newStream\x0a\x09^ self collectionClass new stream",
  8120. messageSends: ["stream", "new", "collectionClass"],
  8121. referencedClasses: []
  8122. }),
  8123. globals.StreamTest);
  8124. smalltalk.addMethod(
  8125. smalltalk.method({
  8126. selector: "testAtStartAtEnd",
  8127. protocol: 'tests',
  8128. fn: function (){
  8129. var self=this;
  8130. var stream;
  8131. return smalltalk.withContext(function($ctx1) {
  8132. var $1,$2,$3,$4;
  8133. stream=self._newStream();
  8134. $1=_st(stream)._atStart();
  8135. $ctx1.sendIdx["atStart"]=1;
  8136. self._assert_($1);
  8137. $ctx1.sendIdx["assert:"]=1;
  8138. $2=_st(stream)._atEnd();
  8139. $ctx1.sendIdx["atEnd"]=1;
  8140. self._assert_($2);
  8141. $ctx1.sendIdx["assert:"]=2;
  8142. _st(stream)._nextPutAll_(self._newCollection());
  8143. $3=_st(stream)._atEnd();
  8144. $ctx1.sendIdx["atEnd"]=2;
  8145. self._assert_($3);
  8146. $4=_st(stream)._atStart();
  8147. $ctx1.sendIdx["atStart"]=2;
  8148. self._deny_($4);
  8149. $ctx1.sendIdx["deny:"]=1;
  8150. _st(stream)._position_((1));
  8151. self._deny_(_st(stream)._atEnd());
  8152. $ctx1.sendIdx["deny:"]=2;
  8153. self._deny_(_st(stream)._atStart());
  8154. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)})},
  8155. args: [],
  8156. 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",
  8157. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8158. referencedClasses: []
  8159. }),
  8160. globals.StreamTest);
  8161. smalltalk.addMethod(
  8162. smalltalk.method({
  8163. selector: "testContents",
  8164. protocol: 'tests',
  8165. fn: function (){
  8166. var self=this;
  8167. var stream;
  8168. return smalltalk.withContext(function($ctx1) {
  8169. var $1,$2;
  8170. stream=self._newStream();
  8171. $1=stream;
  8172. $2=self._newCollection();
  8173. $ctx1.sendIdx["newCollection"]=1;
  8174. _st($1)._nextPutAll_($2);
  8175. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8176. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)})},
  8177. args: [],
  8178. 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",
  8179. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8180. referencedClasses: []
  8181. }),
  8182. globals.StreamTest);
  8183. smalltalk.addMethod(
  8184. smalltalk.method({
  8185. selector: "testIsEmpty",
  8186. protocol: 'tests',
  8187. fn: function (){
  8188. var self=this;
  8189. var stream;
  8190. return smalltalk.withContext(function($ctx1) {
  8191. var $1;
  8192. stream=self._newStream();
  8193. $1=_st(stream)._isEmpty();
  8194. $ctx1.sendIdx["isEmpty"]=1;
  8195. self._assert_($1);
  8196. _st(stream)._nextPutAll_(self._newCollection());
  8197. self._deny_(_st(stream)._isEmpty());
  8198. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)})},
  8199. args: [],
  8200. 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",
  8201. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8202. referencedClasses: []
  8203. }),
  8204. globals.StreamTest);
  8205. smalltalk.addMethod(
  8206. smalltalk.method({
  8207. selector: "testPosition",
  8208. protocol: 'tests',
  8209. fn: function (){
  8210. var self=this;
  8211. var collection,stream;
  8212. return smalltalk.withContext(function($ctx1) {
  8213. var $1,$2,$3;
  8214. collection=self._newCollection();
  8215. stream=self._newStream();
  8216. _st(stream)._nextPutAll_(collection);
  8217. $1=_st(stream)._position();
  8218. $ctx1.sendIdx["position"]=1;
  8219. self._assert_equals_($1,_st(collection)._size());
  8220. $ctx1.sendIdx["assert:equals:"]=1;
  8221. _st(stream)._position_((0));
  8222. $2=_st(stream)._position();
  8223. $ctx1.sendIdx["position"]=2;
  8224. self._assert_equals_($2,(0));
  8225. $ctx1.sendIdx["assert:equals:"]=2;
  8226. _st(stream)._next();
  8227. $ctx1.sendIdx["next"]=1;
  8228. $3=_st(stream)._position();
  8229. $ctx1.sendIdx["position"]=3;
  8230. self._assert_equals_($3,(1));
  8231. $ctx1.sendIdx["assert:equals:"]=3;
  8232. _st(stream)._next();
  8233. self._assert_equals_(_st(stream)._position(),(2));
  8234. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)})},
  8235. args: [],
  8236. 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",
  8237. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8238. referencedClasses: []
  8239. }),
  8240. globals.StreamTest);
  8241. smalltalk.addMethod(
  8242. smalltalk.method({
  8243. selector: "testReading",
  8244. protocol: 'tests',
  8245. fn: function (){
  8246. var self=this;
  8247. var stream,collection;
  8248. return smalltalk.withContext(function($ctx1) {
  8249. var $1,$2,$3;
  8250. collection=self._newCollection();
  8251. stream=self._newStream();
  8252. $1=stream;
  8253. _st($1)._nextPutAll_(collection);
  8254. $2=_st($1)._position_((0));
  8255. _st(collection)._do_((function(each){
  8256. return smalltalk.withContext(function($ctx2) {
  8257. $3=_st(stream)._next();
  8258. $ctx2.sendIdx["next"]=1;
  8259. return self._assert_equals_($3,each);
  8260. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8261. self._assert_(_st(_st(stream)._next())._isNil());
  8262. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)})},
  8263. args: [],
  8264. 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",
  8265. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8266. referencedClasses: []
  8267. }),
  8268. globals.StreamTest);
  8269. smalltalk.addMethod(
  8270. smalltalk.method({
  8271. selector: "testStreamContents",
  8272. protocol: 'tests',
  8273. fn: function (){
  8274. var self=this;
  8275. return self},
  8276. args: [],
  8277. source: "testStreamContents",
  8278. messageSends: [],
  8279. referencedClasses: []
  8280. }),
  8281. globals.StreamTest);
  8282. smalltalk.addMethod(
  8283. smalltalk.method({
  8284. selector: "testWrite",
  8285. protocol: 'tests',
  8286. fn: function (){
  8287. var self=this;
  8288. var stream,collection;
  8289. return smalltalk.withContext(function($ctx1) {
  8290. collection=self._newCollection();
  8291. stream=self._newStream();
  8292. _st(collection)._do_((function(each){
  8293. return smalltalk.withContext(function($ctx2) {
  8294. return _st(stream).__lt_lt(each);
  8295. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8296. self._assert_equals_(_st(stream)._contents(),collection);
  8297. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)})},
  8298. args: [],
  8299. 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",
  8300. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8301. referencedClasses: []
  8302. }),
  8303. globals.StreamTest);
  8304. smalltalk.addMethod(
  8305. smalltalk.method({
  8306. selector: "testWriting",
  8307. protocol: 'tests',
  8308. fn: function (){
  8309. var self=this;
  8310. var stream,collection;
  8311. return smalltalk.withContext(function($ctx1) {
  8312. var $1;
  8313. collection=self._newCollection();
  8314. stream=self._newStream();
  8315. $ctx1.sendIdx["newStream"]=1;
  8316. _st(collection)._do_((function(each){
  8317. return smalltalk.withContext(function($ctx2) {
  8318. return _st(stream)._nextPut_(each);
  8319. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8320. $1=_st(stream)._contents();
  8321. $ctx1.sendIdx["contents"]=1;
  8322. self._assert_equals_($1,collection);
  8323. $ctx1.sendIdx["assert:equals:"]=1;
  8324. stream=self._newStream();
  8325. _st(stream)._nextPutAll_(collection);
  8326. self._assert_equals_(_st(stream)._contents(),collection);
  8327. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)})},
  8328. args: [],
  8329. 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",
  8330. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8331. referencedClasses: []
  8332. }),
  8333. globals.StreamTest);
  8334. smalltalk.addMethod(
  8335. smalltalk.method({
  8336. selector: "collectionClass",
  8337. protocol: 'accessing',
  8338. fn: function (){
  8339. var self=this;
  8340. return nil;
  8341. },
  8342. args: [],
  8343. source: "collectionClass\x0a\x09^ nil",
  8344. messageSends: [],
  8345. referencedClasses: []
  8346. }),
  8347. globals.StreamTest.klass);
  8348. smalltalk.addMethod(
  8349. smalltalk.method({
  8350. selector: "isAbstract",
  8351. protocol: 'testing',
  8352. fn: function (){
  8353. var self=this;
  8354. return smalltalk.withContext(function($ctx1) {
  8355. var $1;
  8356. $1=_st(self._collectionClass())._isNil();
  8357. return $1;
  8358. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)})},
  8359. args: [],
  8360. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8361. messageSends: ["isNil", "collectionClass"],
  8362. referencedClasses: []
  8363. }),
  8364. globals.StreamTest.klass);
  8365. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8366. smalltalk.addMethod(
  8367. smalltalk.method({
  8368. selector: "newCollection",
  8369. protocol: 'accessing',
  8370. fn: function (){
  8371. var self=this;
  8372. return smalltalk.withContext(function($ctx1) {
  8373. var $1;
  8374. $1=[true,(1),(3).__at((4)),"foo"];
  8375. return $1;
  8376. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)})},
  8377. args: [],
  8378. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8379. messageSends: ["@"],
  8380. referencedClasses: []
  8381. }),
  8382. globals.ArrayStreamTest);
  8383. smalltalk.addMethod(
  8384. smalltalk.method({
  8385. selector: "collectionClass",
  8386. protocol: 'accessing',
  8387. fn: function (){
  8388. var self=this;
  8389. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8390. return $Array();
  8391. },
  8392. args: [],
  8393. source: "collectionClass\x0a\x09^ Array",
  8394. messageSends: [],
  8395. referencedClasses: ["Array"]
  8396. }),
  8397. globals.ArrayStreamTest.klass);
  8398. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8399. smalltalk.addMethod(
  8400. smalltalk.method({
  8401. selector: "newCollection",
  8402. protocol: 'accessing',
  8403. fn: function (){
  8404. var self=this;
  8405. return "hello world";
  8406. },
  8407. args: [],
  8408. source: "newCollection\x0a\x09^ 'hello world'",
  8409. messageSends: [],
  8410. referencedClasses: []
  8411. }),
  8412. globals.StringStreamTest);
  8413. smalltalk.addMethod(
  8414. smalltalk.method({
  8415. selector: "collectionClass",
  8416. protocol: 'accessing',
  8417. fn: function (){
  8418. var self=this;
  8419. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8420. return $String();
  8421. },
  8422. args: [],
  8423. source: "collectionClass\x0a\x09^ String",
  8424. messageSends: [],
  8425. referencedClasses: ["String"]
  8426. }),
  8427. globals.StringStreamTest.klass);
  8428. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  8429. smalltalk.addMethod(
  8430. smalltalk.method({
  8431. selector: "testCopying",
  8432. protocol: 'tests',
  8433. fn: function (){
  8434. var self=this;
  8435. return smalltalk.withContext(function($ctx1) {
  8436. self._assert_equals_(nil._copy(),nil);
  8437. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)})},
  8438. args: [],
  8439. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8440. messageSends: ["assert:equals:", "copy"],
  8441. referencedClasses: []
  8442. }),
  8443. globals.UndefinedTest);
  8444. smalltalk.addMethod(
  8445. smalltalk.method({
  8446. selector: "testDeepCopy",
  8447. protocol: 'tests',
  8448. fn: function (){
  8449. var self=this;
  8450. return smalltalk.withContext(function($ctx1) {
  8451. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8452. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)})},
  8453. args: [],
  8454. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8455. messageSends: ["assert:", "=", "deepCopy"],
  8456. referencedClasses: []
  8457. }),
  8458. globals.UndefinedTest);
  8459. smalltalk.addMethod(
  8460. smalltalk.method({
  8461. selector: "testIfNil",
  8462. protocol: 'tests',
  8463. fn: function (){
  8464. var self=this;
  8465. return smalltalk.withContext(function($ctx1) {
  8466. var $1,$3,$2,$4,$6,$5,$receiver;
  8467. if(($receiver = nil) == null || $receiver.isNil){
  8468. $1=true;
  8469. } else {
  8470. $1=nil;
  8471. };
  8472. self._assert_equals_($1,true);
  8473. $ctx1.sendIdx["assert:equals:"]=1;
  8474. if(($receiver = nil) == null || $receiver.isNil){
  8475. $3=nil;
  8476. } else {
  8477. $3=true;
  8478. };
  8479. $2=_st($3).__eq(true);
  8480. $ctx1.sendIdx["="]=1;
  8481. self._deny_($2);
  8482. $ctx1.sendIdx["deny:"]=1;
  8483. if(($receiver = nil) == null || $receiver.isNil){
  8484. $4=true;
  8485. } else {
  8486. $4=false;
  8487. };
  8488. self._assert_equals_($4,true);
  8489. if(($receiver = nil) == null || $receiver.isNil){
  8490. $6=false;
  8491. } else {
  8492. $6=true;
  8493. };
  8494. $5=_st($6).__eq(true);
  8495. self._deny_($5);
  8496. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)})},
  8497. args: [],
  8498. 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",
  8499. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8500. referencedClasses: []
  8501. }),
  8502. globals.UndefinedTest);
  8503. smalltalk.addMethod(
  8504. smalltalk.method({
  8505. selector: "testIsNil",
  8506. protocol: 'tests',
  8507. fn: function (){
  8508. var self=this;
  8509. return smalltalk.withContext(function($ctx1) {
  8510. self._assert_(nil._isNil());
  8511. self._deny_(nil._notNil());
  8512. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)})},
  8513. args: [],
  8514. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8515. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8516. referencedClasses: []
  8517. }),
  8518. globals.UndefinedTest);
  8519. });