1
0

Kernel-Tests.js 330 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', globals.TestCase, [], 'Kernel-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "testHandlesAnnouncement",
  8. protocol: 'tests',
  9. fn: function (){
  10. var self=this;
  11. var subscription,announcementClass1,announcementClass2,classBuilder;
  12. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  16. return smalltalk.withContext(function($ctx1) {
  17. var $1,$2;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  22. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  23. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  24. self._assert_equals_($1,true);
  25. $ctx1.sendIdx["assert:equals:"]=1;
  26. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  27. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  28. self._assert_equals_($2,true);
  29. $ctx1.sendIdx["assert:equals:"]=2;
  30. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  31. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  32. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},globals.AnnouncementSubscriptionTest)})},
  33. args: [],
  34. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  35. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  36. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  37. }),
  38. globals.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', globals.TestCase, [], 'Kernel-Tests');
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "testOnDo",
  43. protocol: 'not yet classified',
  44. fn: function (){
  45. var self=this;
  46. var counter,announcer;
  47. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  49. return smalltalk.withContext(function($ctx1) {
  50. var $1,$2;
  51. counter=(0);
  52. announcer=_st($Announcer())._new();
  53. $ctx1.sendIdx["new"]=1;
  54. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  55. return smalltalk.withContext(function($ctx2) {
  56. counter=_st(counter).__plus((1));
  57. return counter;
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  59. $1=announcer;
  60. $2=_st($SystemAnnouncement())._new();
  61. $ctx1.sendIdx["new"]=2;
  62. _st($1)._announce_($2);
  63. $ctx1.sendIdx["announce:"]=1;
  64. self._assert_equals_(counter,(1));
  65. $ctx1.sendIdx["assert:equals:"]=1;
  66. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  67. self._assert_equals_(counter,(2));
  68. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  69. args: [],
  70. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  71. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  72. referencedClasses: ["Announcer", "SystemAnnouncement"]
  73. }),
  74. globals.AnnouncerTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testOnDoOnce",
  78. protocol: 'not yet classified',
  79. fn: function (){
  80. var self=this;
  81. var counter,announcer;
  82. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  84. return smalltalk.withContext(function($ctx1) {
  85. var $1,$2;
  86. counter=(0);
  87. announcer=_st($Announcer())._new();
  88. $ctx1.sendIdx["new"]=1;
  89. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  90. return smalltalk.withContext(function($ctx2) {
  91. counter=_st(counter).__plus((1));
  92. return counter;
  93. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  94. $1=announcer;
  95. $2=_st($SystemAnnouncement())._new();
  96. $ctx1.sendIdx["new"]=2;
  97. _st($1)._announce_($2);
  98. $ctx1.sendIdx["announce:"]=1;
  99. self._assert_equals_(counter,(1));
  100. $ctx1.sendIdx["assert:equals:"]=1;
  101. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  102. self._assert_equals_(counter,(1));
  103. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  104. args: [],
  105. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  106. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  107. referencedClasses: ["Announcer", "SystemAnnouncement"]
  108. }),
  109. globals.AnnouncerTest);
  110. smalltalk.addClass('BlockClosureTest', globals.TestCase, [], 'Kernel-Tests');
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testCanClearInterval",
  114. protocol: 'tests',
  115. fn: function (){
  116. var self=this;
  117. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  118. return smalltalk.withContext(function($ctx1) {
  119. self._shouldnt_raise_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. return _st(_st((function(){
  122. return smalltalk.withContext(function($ctx3) {
  123. return _st(_st($Error())._new())._signal();
  124. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  126. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},globals.BlockClosureTest)})},
  127. args: [],
  128. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  129. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  130. referencedClasses: ["Error"]
  131. }),
  132. globals.BlockClosureTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testCanClearTimeout",
  136. protocol: 'tests',
  137. fn: function (){
  138. var self=this;
  139. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  140. return smalltalk.withContext(function($ctx1) {
  141. self._shouldnt_raise_((function(){
  142. return smalltalk.withContext(function($ctx2) {
  143. return _st(_st((function(){
  144. return smalltalk.withContext(function($ctx3) {
  145. return _st(_st($Error())._new())._signal();
  146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  148. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},globals.BlockClosureTest)})},
  149. args: [],
  150. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  151. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  152. referencedClasses: ["Error"]
  153. }),
  154. globals.BlockClosureTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testCompiledSource",
  158. protocol: 'tests',
  159. fn: function (){
  160. var self=this;
  161. return smalltalk.withContext(function($ctx1) {
  162. self._assert_(_st(_st((function(){
  163. return smalltalk.withContext(function($ctx2) {
  164. return (1).__plus((1));
  165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  166. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},globals.BlockClosureTest)})},
  167. args: [],
  168. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  169. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  170. referencedClasses: []
  171. }),
  172. globals.BlockClosureTest);
  173. smalltalk.addMethod(
  174. smalltalk.method({
  175. selector: "testCurrySelf",
  176. protocol: 'tests',
  177. fn: function (){
  178. var self=this;
  179. var curriedMethod,array;
  180. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  181. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  182. return smalltalk.withContext(function($ctx1) {
  183. curriedMethod=_st(_st((function(selfarg,x){
  184. return smalltalk.withContext(function($ctx2) {
  185. return _st(selfarg)._at_(x);
  186. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  187. array=[(3), (1), (4)];
  188. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  189. _st((function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return self._assert_equals_(_st(array)._foo_((2)),(1));
  192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  193. return smalltalk.withContext(function($ctx2) {
  194. return _st($Array())._removeCompiledMethod_(curriedMethod);
  195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  196. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},globals.BlockClosureTest)})},
  197. args: [],
  198. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  199. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  200. referencedClasses: ["ClassBuilder", "Array"]
  201. }),
  202. globals.BlockClosureTest);
  203. smalltalk.addMethod(
  204. smalltalk.method({
  205. selector: "testEnsure",
  206. protocol: 'tests',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. self._assert_equals_(_st((function(){
  211. return smalltalk.withContext(function($ctx2) {
  212. return (3);
  213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  214. return smalltalk.withContext(function($ctx2) {
  215. return (4);
  216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  217. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},globals.BlockClosureTest)})},
  218. args: [],
  219. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  220. messageSends: ["assert:equals:", "ensure:"],
  221. referencedClasses: []
  222. }),
  223. globals.BlockClosureTest);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "testEnsureRaises",
  227. protocol: 'tests',
  228. fn: function (){
  229. var self=this;
  230. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  231. return smalltalk.withContext(function($ctx1) {
  232. self._should_raise_((function(){
  233. return smalltalk.withContext(function($ctx2) {
  234. return _st((function(){
  235. return smalltalk.withContext(function($ctx3) {
  236. return _st(_st($Error())._new())._signal();
  237. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  238. return smalltalk.withContext(function($ctx3) {
  239. return true;
  240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  242. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},globals.BlockClosureTest)})},
  243. args: [],
  244. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  245. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  246. referencedClasses: ["Error"]
  247. }),
  248. globals.BlockClosureTest);
  249. smalltalk.addMethod(
  250. smalltalk.method({
  251. selector: "testExceptionSemantics",
  252. protocol: 'tests',
  253. fn: function (){
  254. var self=this;
  255. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  256. return smalltalk.withContext(function($ctx1) {
  257. self._timeout_((100));
  258. _st(self._async_((function(){
  259. return smalltalk.withContext(function($ctx2) {
  260. return _st((function(){
  261. return smalltalk.withContext(function($ctx3) {
  262. self._assert_(true);
  263. _st($Error())._signal();
  264. self._deny_(true);
  265. return self._finished();
  266. $ctx3.sendIdx["finished"]=1;
  267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  268. return smalltalk.withContext(function($ctx3) {
  269. return self._finished();
  270. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  272. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},globals.BlockClosureTest)})},
  273. args: [],
  274. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  275. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  276. referencedClasses: ["Error"]
  277. }),
  278. globals.BlockClosureTest);
  279. smalltalk.addMethod(
  280. smalltalk.method({
  281. selector: "testNewWithValues",
  282. protocol: 'tests',
  283. fn: function (){
  284. var self=this;
  285. function theTestPrototype() {this.name = "theTestPrototype";}
  286. function theTestConstructor(arg1, arg2, arg3) {}
  287. theTestConstructor.prototype = new theTestPrototype;
  288. var theWrappedConstructor = _st(theTestConstructor);
  289. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);
  290. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  291. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  292. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  293. self._should_raise_(_st(constructionShouldFail), globals.Error);;
  294. return self},
  295. args: [],
  296. source: "testNewWithValues\x0a<\x0a\x09function theTestPrototype() {this.name = \x22theTestPrototype\x22;}\x0a\x09function theTestConstructor(arg1, arg2, arg3) {}\x0a\x09theTestConstructor.prototype = new theTestPrototype;\x0a\x0a\x09var theWrappedConstructor = _st(theTestConstructor);\x0a\x09var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}\x0a\x09self._should_raise_(_st(constructionShouldFail), globals.Error);\x0a>",
  297. messageSends: [],
  298. referencedClasses: []
  299. }),
  300. globals.BlockClosureTest);
  301. smalltalk.addMethod(
  302. smalltalk.method({
  303. selector: "testNumArgs",
  304. protocol: 'tests',
  305. fn: function (){
  306. var self=this;
  307. return smalltalk.withContext(function($ctx1) {
  308. var $1;
  309. $1=_st((function(){
  310. return smalltalk.withContext(function($ctx2) {
  311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  312. $ctx1.sendIdx["numArgs"]=1;
  313. self._assert_equals_($1,(0));
  314. $ctx1.sendIdx["assert:equals:"]=1;
  315. self._assert_equals_(_st((function(a,b){
  316. return smalltalk.withContext(function($ctx2) {
  317. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs(),(2));
  318. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},globals.BlockClosureTest)})},
  319. args: [],
  320. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  321. messageSends: ["assert:equals:", "numArgs"],
  322. referencedClasses: []
  323. }),
  324. globals.BlockClosureTest);
  325. smalltalk.addMethod(
  326. smalltalk.method({
  327. selector: "testOnDo",
  328. protocol: 'tests',
  329. fn: function (){
  330. var self=this;
  331. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  332. return smalltalk.withContext(function($ctx1) {
  333. self._assert_(_st((function(){
  334. return smalltalk.withContext(function($ctx2) {
  335. return _st(_st($Error())._new())._signal();
  336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  337. return smalltalk.withContext(function($ctx2) {
  338. return true;
  339. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  340. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},globals.BlockClosureTest)})},
  341. args: [],
  342. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  343. messageSends: ["assert:", "on:do:", "signal", "new"],
  344. referencedClasses: ["Error"]
  345. }),
  346. globals.BlockClosureTest);
  347. smalltalk.addMethod(
  348. smalltalk.method({
  349. selector: "testValue",
  350. protocol: 'tests',
  351. fn: function (){
  352. var self=this;
  353. return smalltalk.withContext(function($ctx1) {
  354. var $1;
  355. $1=_st((function(){
  356. return smalltalk.withContext(function($ctx2) {
  357. return (1).__plus((1));
  358. $ctx2.sendIdx["+"]=1;
  359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  360. $ctx1.sendIdx["value"]=1;
  361. self._assert_equals_($1,(2));
  362. $ctx1.sendIdx["assert:equals:"]=1;
  363. self._assert_equals_(_st((function(x){
  364. return smalltalk.withContext(function($ctx2) {
  365. return _st(x).__plus((1));
  366. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  367. $ctx1.sendIdx["assert:equals:"]=2;
  368. self._assert_equals_(_st((function(x,y){
  369. return smalltalk.withContext(function($ctx2) {
  370. return _st(x).__star(y);
  371. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  372. $ctx1.sendIdx["assert:equals:"]=3;
  373. self._assert_equals_(_st((function(a,b,c){
  374. return smalltalk.withContext(function($ctx2) {
  375. return (1);
  376. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value(),(1));
  377. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.BlockClosureTest)})},
  378. args: [],
  379. 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",
  380. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  381. referencedClasses: []
  382. }),
  383. globals.BlockClosureTest);
  384. smalltalk.addMethod(
  385. smalltalk.method({
  386. selector: "testValueWithPossibleArguments",
  387. protocol: 'tests',
  388. fn: function (){
  389. var self=this;
  390. return smalltalk.withContext(function($ctx1) {
  391. var $1,$2;
  392. $1=_st((function(){
  393. return smalltalk.withContext(function($ctx2) {
  394. return (1);
  395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  396. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  397. self._assert_equals_($1,(1));
  398. $ctx1.sendIdx["assert:equals:"]=1;
  399. $2=_st((function(a){
  400. return smalltalk.withContext(function($ctx2) {
  401. return _st(a).__plus((4));
  402. $ctx2.sendIdx["+"]=1;
  403. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  404. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  405. self._assert_equals_($2,(7));
  406. $ctx1.sendIdx["assert:equals:"]=2;
  407. self._assert_equals_(_st((function(a,b){
  408. return smalltalk.withContext(function($ctx2) {
  409. return _st(a).__plus(b);
  410. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  411. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},globals.BlockClosureTest)})},
  412. args: [],
  413. 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.",
  414. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  415. referencedClasses: []
  416. }),
  417. globals.BlockClosureTest);
  418. smalltalk.addMethod(
  419. smalltalk.method({
  420. selector: "testWhileFalse",
  421. protocol: 'tests',
  422. fn: function (){
  423. var self=this;
  424. var i;
  425. return smalltalk.withContext(function($ctx1) {
  426. i=(0);
  427. _st((function(){
  428. return smalltalk.withContext(function($ctx2) {
  429. return _st(i).__gt((5));
  430. $ctx2.sendIdx[">"]=1;
  431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  432. return smalltalk.withContext(function($ctx2) {
  433. i=_st(i).__plus((1));
  434. $ctx2.sendIdx["+"]=1;
  435. return i;
  436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  437. self._assert_equals_(i,(6));
  438. $ctx1.sendIdx["assert:equals:"]=1;
  439. i=(0);
  440. _st((function(){
  441. return smalltalk.withContext(function($ctx2) {
  442. i=_st(i).__plus((1));
  443. i;
  444. return _st(i).__gt((5));
  445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  446. self._assert_equals_(i,(6));
  447. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},globals.BlockClosureTest)})},
  448. args: [],
  449. 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",
  450. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  451. referencedClasses: []
  452. }),
  453. globals.BlockClosureTest);
  454. smalltalk.addMethod(
  455. smalltalk.method({
  456. selector: "testWhileTrue",
  457. protocol: 'tests',
  458. fn: function (){
  459. var self=this;
  460. var i;
  461. return smalltalk.withContext(function($ctx1) {
  462. i=(0);
  463. _st((function(){
  464. return smalltalk.withContext(function($ctx2) {
  465. return _st(i).__lt((5));
  466. $ctx2.sendIdx["<"]=1;
  467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  468. return smalltalk.withContext(function($ctx2) {
  469. i=_st(i).__plus((1));
  470. $ctx2.sendIdx["+"]=1;
  471. return i;
  472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  473. self._assert_equals_(i,(5));
  474. $ctx1.sendIdx["assert:equals:"]=1;
  475. i=(0);
  476. _st((function(){
  477. return smalltalk.withContext(function($ctx2) {
  478. i=_st(i).__plus((1));
  479. i;
  480. return _st(i).__lt((5));
  481. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  482. self._assert_equals_(i,(5));
  483. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},globals.BlockClosureTest)})},
  484. args: [],
  485. 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",
  486. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  487. referencedClasses: []
  488. }),
  489. globals.BlockClosureTest);
  490. smalltalk.addClass('BooleanTest', globals.TestCase, [], 'Kernel-Tests');
  491. smalltalk.addMethod(
  492. smalltalk.method({
  493. selector: "testEquality",
  494. protocol: 'tests',
  495. fn: function (){
  496. var self=this;
  497. return smalltalk.withContext(function($ctx1) {
  498. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  499. $1=(0).__eq(false);
  500. $ctx1.sendIdx["="]=1;
  501. self._deny_($1);
  502. $ctx1.sendIdx["deny:"]=1;
  503. $2=false.__eq((0));
  504. $ctx1.sendIdx["="]=2;
  505. self._deny_($2);
  506. $ctx1.sendIdx["deny:"]=2;
  507. $3="".__eq(false);
  508. $ctx1.sendIdx["="]=3;
  509. self._deny_($3);
  510. $ctx1.sendIdx["deny:"]=3;
  511. $4=false.__eq("");
  512. $ctx1.sendIdx["="]=4;
  513. self._deny_($4);
  514. $ctx1.sendIdx["deny:"]=4;
  515. $5=true.__eq(true);
  516. $ctx1.sendIdx["="]=5;
  517. self._assert_($5);
  518. $ctx1.sendIdx["assert:"]=1;
  519. $6=false.__eq(true);
  520. $ctx1.sendIdx["="]=6;
  521. self._deny_($6);
  522. $ctx1.sendIdx["deny:"]=5;
  523. $7=true.__eq(false);
  524. $ctx1.sendIdx["="]=7;
  525. self._deny_($7);
  526. $8=false.__eq(false);
  527. $ctx1.sendIdx["="]=8;
  528. self._assert_($8);
  529. $ctx1.sendIdx["assert:"]=2;
  530. $10=true._yourself();
  531. $ctx1.sendIdx["yourself"]=1;
  532. $9=_st($10).__eq(true);
  533. $ctx1.sendIdx["="]=9;
  534. self._assert_($9);
  535. $ctx1.sendIdx["assert:"]=3;
  536. $12=true._yourself();
  537. $ctx1.sendIdx["yourself"]=2;
  538. $11=_st($12).__eq(true._yourself());
  539. self._assert_($11);
  540. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.BooleanTest)})},
  541. args: [],
  542. 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)",
  543. messageSends: ["deny:", "=", "assert:", "yourself"],
  544. referencedClasses: []
  545. }),
  546. globals.BooleanTest);
  547. smalltalk.addMethod(
  548. smalltalk.method({
  549. selector: "testIdentity",
  550. protocol: 'tests',
  551. fn: function (){
  552. var self=this;
  553. return smalltalk.withContext(function($ctx1) {
  554. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  555. $1=(0).__eq_eq(false);
  556. $ctx1.sendIdx["=="]=1;
  557. self._deny_($1);
  558. $ctx1.sendIdx["deny:"]=1;
  559. $2=false.__eq_eq((0));
  560. $ctx1.sendIdx["=="]=2;
  561. self._deny_($2);
  562. $ctx1.sendIdx["deny:"]=2;
  563. $3="".__eq_eq(false);
  564. $ctx1.sendIdx["=="]=3;
  565. self._deny_($3);
  566. $ctx1.sendIdx["deny:"]=3;
  567. $4=false.__eq_eq("");
  568. $ctx1.sendIdx["=="]=4;
  569. self._deny_($4);
  570. $ctx1.sendIdx["deny:"]=4;
  571. $5=true.__eq_eq(true);
  572. $ctx1.sendIdx["=="]=5;
  573. self._assert_($5);
  574. $ctx1.sendIdx["assert:"]=1;
  575. $6=false.__eq_eq(true);
  576. $ctx1.sendIdx["=="]=6;
  577. self._deny_($6);
  578. $ctx1.sendIdx["deny:"]=5;
  579. $7=true.__eq_eq(false);
  580. $ctx1.sendIdx["=="]=7;
  581. self._deny_($7);
  582. $8=false.__eq_eq(false);
  583. $ctx1.sendIdx["=="]=8;
  584. self._assert_($8);
  585. $ctx1.sendIdx["assert:"]=2;
  586. $10=true._yourself();
  587. $ctx1.sendIdx["yourself"]=1;
  588. $9=_st($10).__eq_eq(true);
  589. $ctx1.sendIdx["=="]=9;
  590. self._assert_($9);
  591. $ctx1.sendIdx["assert:"]=3;
  592. $12=true._yourself();
  593. $ctx1.sendIdx["yourself"]=2;
  594. $11=_st($12).__eq_eq(true._yourself());
  595. self._assert_($11);
  596. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.BooleanTest)})},
  597. args: [],
  598. 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",
  599. messageSends: ["deny:", "==", "assert:", "yourself"],
  600. referencedClasses: []
  601. }),
  602. globals.BooleanTest);
  603. smalltalk.addMethod(
  604. smalltalk.method({
  605. selector: "testIfTrueIfFalse",
  606. protocol: 'tests',
  607. fn: function (){
  608. var self=this;
  609. return smalltalk.withContext(function($ctx1) {
  610. var $1,$2,$3,$4,$5,$6,$7,$8;
  611. if(smalltalk.assert(true)){
  612. $1="alternative block";
  613. };
  614. self._assert_equals_($1,"alternative block");
  615. $ctx1.sendIdx["assert:equals:"]=1;
  616. if(! smalltalk.assert(true)){
  617. $2="alternative block";
  618. };
  619. self._assert_equals_($2,nil);
  620. $ctx1.sendIdx["assert:equals:"]=2;
  621. if(smalltalk.assert(false)){
  622. $3="alternative block";
  623. };
  624. self._assert_equals_($3,nil);
  625. $ctx1.sendIdx["assert:equals:"]=3;
  626. if(! smalltalk.assert(false)){
  627. $4="alternative block";
  628. };
  629. self._assert_equals_($4,"alternative block");
  630. $ctx1.sendIdx["assert:equals:"]=4;
  631. if(smalltalk.assert(false)){
  632. $5="alternative block";
  633. } else {
  634. $5="alternative block2";
  635. };
  636. self._assert_equals_($5,"alternative block2");
  637. $ctx1.sendIdx["assert:equals:"]=5;
  638. if(smalltalk.assert(false)){
  639. $6="alternative block2";
  640. } else {
  641. $6="alternative block";
  642. };
  643. self._assert_equals_($6,"alternative block");
  644. $ctx1.sendIdx["assert:equals:"]=6;
  645. if(smalltalk.assert(true)){
  646. $7="alternative block";
  647. } else {
  648. $7="alternative block2";
  649. };
  650. self._assert_equals_($7,"alternative block");
  651. $ctx1.sendIdx["assert:equals:"]=7;
  652. if(smalltalk.assert(true)){
  653. $8="alternative block2";
  654. } else {
  655. $8="alternative block";
  656. };
  657. self._assert_equals_($8,"alternative block2");
  658. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},globals.BooleanTest)})},
  659. args: [],
  660. 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'.",
  661. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  662. referencedClasses: []
  663. }),
  664. globals.BooleanTest);
  665. smalltalk.addMethod(
  666. smalltalk.method({
  667. selector: "testIfTrueIfFalseWithBoxing",
  668. protocol: 'tests',
  669. fn: function (){
  670. var self=this;
  671. return smalltalk.withContext(function($ctx1) {
  672. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  673. $2=true._yourself();
  674. $ctx1.sendIdx["yourself"]=1;
  675. if(smalltalk.assert($2)){
  676. $1="alternative block";
  677. };
  678. self._assert_equals_($1,"alternative block");
  679. $ctx1.sendIdx["assert:equals:"]=1;
  680. $4=true._yourself();
  681. $ctx1.sendIdx["yourself"]=2;
  682. if(! smalltalk.assert($4)){
  683. $3="alternative block";
  684. };
  685. self._assert_equals_($3,nil);
  686. $ctx1.sendIdx["assert:equals:"]=2;
  687. $6=false._yourself();
  688. $ctx1.sendIdx["yourself"]=3;
  689. if(smalltalk.assert($6)){
  690. $5="alternative block";
  691. };
  692. self._assert_equals_($5,nil);
  693. $ctx1.sendIdx["assert:equals:"]=3;
  694. $8=false._yourself();
  695. $ctx1.sendIdx["yourself"]=4;
  696. if(! smalltalk.assert($8)){
  697. $7="alternative block";
  698. };
  699. self._assert_equals_($7,"alternative block");
  700. $ctx1.sendIdx["assert:equals:"]=4;
  701. $10=false._yourself();
  702. $ctx1.sendIdx["yourself"]=5;
  703. if(smalltalk.assert($10)){
  704. $9="alternative block";
  705. } else {
  706. $9="alternative block2";
  707. };
  708. self._assert_equals_($9,"alternative block2");
  709. $ctx1.sendIdx["assert:equals:"]=5;
  710. $12=false._yourself();
  711. $ctx1.sendIdx["yourself"]=6;
  712. if(smalltalk.assert($12)){
  713. $11="alternative block2";
  714. } else {
  715. $11="alternative block";
  716. };
  717. self._assert_equals_($11,"alternative block");
  718. $ctx1.sendIdx["assert:equals:"]=6;
  719. $14=true._yourself();
  720. $ctx1.sendIdx["yourself"]=7;
  721. if(smalltalk.assert($14)){
  722. $13="alternative block";
  723. } else {
  724. $13="alternative block2";
  725. };
  726. self._assert_equals_($13,"alternative block");
  727. $ctx1.sendIdx["assert:equals:"]=7;
  728. $16=true._yourself();
  729. if(smalltalk.assert($16)){
  730. $15="alternative block2";
  731. } else {
  732. $15="alternative block";
  733. };
  734. self._assert_equals_($15,"alternative block2");
  735. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},globals.BooleanTest)})},
  736. args: [],
  737. 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'.",
  738. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  739. referencedClasses: []
  740. }),
  741. globals.BooleanTest);
  742. smalltalk.addMethod(
  743. smalltalk.method({
  744. selector: "testLogic",
  745. protocol: 'tests',
  746. fn: function (){
  747. var self=this;
  748. return smalltalk.withContext(function($ctx1) {
  749. 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;
  750. $1=true.__and(true);
  751. $ctx1.sendIdx["&"]=1;
  752. self._assert_($1);
  753. $ctx1.sendIdx["assert:"]=1;
  754. $2=true.__and(false);
  755. $ctx1.sendIdx["&"]=2;
  756. self._deny_($2);
  757. $ctx1.sendIdx["deny:"]=1;
  758. $3=false.__and(true);
  759. $ctx1.sendIdx["&"]=3;
  760. self._deny_($3);
  761. $ctx1.sendIdx["deny:"]=2;
  762. $5=false.__and(false);
  763. $ctx1.sendIdx["&"]=4;
  764. $4=self._deny_($5);
  765. $ctx1.sendIdx["deny:"]=3;
  766. $6=true.__or(true);
  767. $ctx1.sendIdx["|"]=1;
  768. self._assert_($6);
  769. $ctx1.sendIdx["assert:"]=2;
  770. $7=true.__or(false);
  771. $ctx1.sendIdx["|"]=2;
  772. self._assert_($7);
  773. $ctx1.sendIdx["assert:"]=3;
  774. $8=false.__or(true);
  775. $ctx1.sendIdx["|"]=3;
  776. self._assert_($8);
  777. $ctx1.sendIdx["assert:"]=4;
  778. $10=false.__or(false);
  779. $ctx1.sendIdx["|"]=4;
  780. $9=self._deny_($10);
  781. $ctx1.sendIdx["deny:"]=4;
  782. $12=(1).__gt((0));
  783. $ctx1.sendIdx[">"]=1;
  784. $11=true.__and($12);
  785. $ctx1.sendIdx["&"]=5;
  786. self._assert_($11);
  787. $ctx1.sendIdx["assert:"]=5;
  788. $14=(1).__gt((0));
  789. $ctx1.sendIdx[">"]=2;
  790. $13=_st($14).__and(false);
  791. $ctx1.sendIdx["&"]=6;
  792. self._deny_($13);
  793. $ctx1.sendIdx["deny:"]=5;
  794. $17=(1).__gt((0));
  795. $ctx1.sendIdx[">"]=3;
  796. $18=(1).__gt((2));
  797. $ctx1.sendIdx[">"]=4;
  798. $16=_st($17).__and($18);
  799. $15=self._deny_($16);
  800. $20=(1).__gt((0));
  801. $ctx1.sendIdx[">"]=5;
  802. $19=false.__or($20);
  803. $ctx1.sendIdx["|"]=5;
  804. self._assert_($19);
  805. $ctx1.sendIdx["assert:"]=6;
  806. $22=(1).__gt((0));
  807. $ctx1.sendIdx[">"]=6;
  808. $21=_st($22).__or(false);
  809. $ctx1.sendIdx["|"]=6;
  810. self._assert_($21);
  811. $ctx1.sendIdx["assert:"]=7;
  812. $25=(1).__gt((0));
  813. $ctx1.sendIdx[">"]=7;
  814. $24=_st($25).__or((1).__gt((2)));
  815. $23=self._assert_($24);
  816. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},globals.BooleanTest)})},
  817. args: [],
  818. 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))",
  819. messageSends: ["assert:", "&", "deny:", "|", ">"],
  820. referencedClasses: []
  821. }),
  822. globals.BooleanTest);
  823. smalltalk.addMethod(
  824. smalltalk.method({
  825. selector: "testLogicKeywords",
  826. protocol: 'tests',
  827. fn: function (){
  828. var self=this;
  829. return smalltalk.withContext(function($ctx1) {
  830. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  831. $1=true._and_((function(){
  832. return smalltalk.withContext(function($ctx2) {
  833. return true;
  834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  835. $ctx1.sendIdx["and:"]=1;
  836. self._assert_($1);
  837. $ctx1.sendIdx["assert:"]=1;
  838. $2=true._and_((function(){
  839. return smalltalk.withContext(function($ctx2) {
  840. return false;
  841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  842. $ctx1.sendIdx["and:"]=2;
  843. self._deny_($2);
  844. $ctx1.sendIdx["deny:"]=1;
  845. $3=false._and_((function(){
  846. return smalltalk.withContext(function($ctx2) {
  847. return true;
  848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  849. $ctx1.sendIdx["and:"]=3;
  850. self._deny_($3);
  851. $ctx1.sendIdx["deny:"]=2;
  852. $5=false._and_((function(){
  853. return smalltalk.withContext(function($ctx2) {
  854. return false;
  855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  856. $ctx1.sendIdx["and:"]=4;
  857. $4=self._deny_($5);
  858. $ctx1.sendIdx["deny:"]=3;
  859. $6=true._or_((function(){
  860. return smalltalk.withContext(function($ctx2) {
  861. return true;
  862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  863. $ctx1.sendIdx["or:"]=1;
  864. self._assert_($6);
  865. $ctx1.sendIdx["assert:"]=2;
  866. $7=true._or_((function(){
  867. return smalltalk.withContext(function($ctx2) {
  868. return false;
  869. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  870. $ctx1.sendIdx["or:"]=2;
  871. self._assert_($7);
  872. $ctx1.sendIdx["assert:"]=3;
  873. $8=false._or_((function(){
  874. return smalltalk.withContext(function($ctx2) {
  875. return true;
  876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  877. $ctx1.sendIdx["or:"]=3;
  878. self._assert_($8);
  879. $ctx1.sendIdx["assert:"]=4;
  880. $10=false._or_((function(){
  881. return smalltalk.withContext(function($ctx2) {
  882. return false;
  883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  884. $ctx1.sendIdx["or:"]=4;
  885. $9=self._deny_($10);
  886. $ctx1.sendIdx["deny:"]=4;
  887. $11=true._and_((function(){
  888. return smalltalk.withContext(function($ctx2) {
  889. return (1).__gt((0));
  890. $ctx2.sendIdx[">"]=1;
  891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  892. $ctx1.sendIdx["and:"]=5;
  893. self._assert_($11);
  894. $ctx1.sendIdx["assert:"]=5;
  895. $13=(1).__gt((0));
  896. $ctx1.sendIdx[">"]=2;
  897. $12=_st($13)._and_((function(){
  898. return smalltalk.withContext(function($ctx2) {
  899. return false;
  900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  901. $ctx1.sendIdx["and:"]=6;
  902. self._deny_($12);
  903. $ctx1.sendIdx["deny:"]=5;
  904. $16=(1).__gt((0));
  905. $ctx1.sendIdx[">"]=3;
  906. $15=_st($16)._and_((function(){
  907. return smalltalk.withContext(function($ctx2) {
  908. return (1).__gt((2));
  909. $ctx2.sendIdx[">"]=4;
  910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  911. $14=self._deny_($15);
  912. $17=false._or_((function(){
  913. return smalltalk.withContext(function($ctx2) {
  914. return (1).__gt((0));
  915. $ctx2.sendIdx[">"]=5;
  916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  917. $ctx1.sendIdx["or:"]=5;
  918. self._assert_($17);
  919. $ctx1.sendIdx["assert:"]=6;
  920. $19=(1).__gt((0));
  921. $ctx1.sendIdx[">"]=6;
  922. $18=_st($19)._or_((function(){
  923. return smalltalk.withContext(function($ctx2) {
  924. return false;
  925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  926. $ctx1.sendIdx["or:"]=6;
  927. self._assert_($18);
  928. $ctx1.sendIdx["assert:"]=7;
  929. $22=(1).__gt((0));
  930. $ctx1.sendIdx[">"]=7;
  931. $21=_st($22)._or_((function(){
  932. return smalltalk.withContext(function($ctx2) {
  933. return (1).__gt((2));
  934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  935. $20=self._assert_($21);
  936. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},globals.BooleanTest)})},
  937. args: [],
  938. 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 ])",
  939. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  940. referencedClasses: []
  941. }),
  942. globals.BooleanTest);
  943. smalltalk.addMethod(
  944. smalltalk.method({
  945. selector: "testNonBooleanError",
  946. protocol: 'tests',
  947. fn: function (){
  948. var self=this;
  949. function $NonBooleanReceiver(){return globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  950. return smalltalk.withContext(function($ctx1) {
  951. self._should_raise_((function(){
  952. return smalltalk.withContext(function($ctx2) {
  953. if(smalltalk.assert("")){
  954. } else {
  955. };
  956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  957. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},globals.BooleanTest)})},
  958. args: [],
  959. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  960. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  961. referencedClasses: ["NonBooleanReceiver"]
  962. }),
  963. globals.BooleanTest);
  964. smalltalk.addClass('ClassBuilderTest', globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  965. smalltalk.addMethod(
  966. smalltalk.method({
  967. selector: "setUp",
  968. protocol: 'running',
  969. fn: function (){
  970. var self=this;
  971. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  972. return smalltalk.withContext(function($ctx1) {
  973. self["@builder"]=_st($ClassBuilder())._new();
  974. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ClassBuilderTest)})},
  975. args: [],
  976. source: "setUp\x0a\x09builder := ClassBuilder new",
  977. messageSends: ["new"],
  978. referencedClasses: ["ClassBuilder"]
  979. }),
  980. globals.ClassBuilderTest);
  981. smalltalk.addMethod(
  982. smalltalk.method({
  983. selector: "tearDown",
  984. protocol: 'running',
  985. fn: function (){
  986. var self=this;
  987. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  988. return smalltalk.withContext(function($ctx1) {
  989. var $1;
  990. $1=self["@theClass"];
  991. if(($receiver = $1) == nil || $receiver == null){
  992. $1;
  993. } else {
  994. _st($Smalltalk())._removeClass_(self["@theClass"]);
  995. self["@theClass"]=nil;
  996. self["@theClass"];
  997. };
  998. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.ClassBuilderTest)})},
  999. args: [],
  1000. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  1001. messageSends: ["ifNotNil:", "removeClass:"],
  1002. referencedClasses: ["Smalltalk"]
  1003. }),
  1004. globals.ClassBuilderTest);
  1005. smalltalk.addMethod(
  1006. smalltalk.method({
  1007. selector: "testClassCopy",
  1008. protocol: 'tests',
  1009. fn: function (){
  1010. var self=this;
  1011. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1012. return smalltalk.withContext(function($ctx1) {
  1013. var $2,$1,$4,$3,$6,$5,$8,$7;
  1014. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1015. $2=_st(self["@theClass"])._superclass();
  1016. $ctx1.sendIdx["superclass"]=1;
  1017. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1018. $ctx1.sendIdx["=="]=1;
  1019. self._assert_($1);
  1020. $ctx1.sendIdx["assert:"]=1;
  1021. $4=_st(self["@theClass"])._instanceVariableNames();
  1022. $ctx1.sendIdx["instanceVariableNames"]=1;
  1023. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1024. $ctx1.sendIdx["=="]=2;
  1025. self._assert_($3);
  1026. $ctx1.sendIdx["assert:"]=2;
  1027. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1028. $ctx1.sendIdx["assert:equals:"]=1;
  1029. $6=_st(self["@theClass"])._package();
  1030. $ctx1.sendIdx["package"]=1;
  1031. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1032. self._assert_($5);
  1033. $8=_st(self["@theClass"])._methodDictionary();
  1034. $ctx1.sendIdx["methodDictionary"]=1;
  1035. $7=_st($8)._keys();
  1036. $ctx1.sendIdx["keys"]=1;
  1037. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1038. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},globals.ClassBuilderTest)})},
  1039. args: [],
  1040. 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",
  1041. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1042. referencedClasses: ["ObjectMock"]
  1043. }),
  1044. globals.ClassBuilderTest);
  1045. smalltalk.addMethod(
  1046. smalltalk.method({
  1047. selector: "testClassMigration",
  1048. protocol: 'tests',
  1049. fn: function (){
  1050. var self=this;
  1051. var instance,oldClass;
  1052. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1053. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1054. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1055. return smalltalk.withContext(function($ctx1) {
  1056. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  1057. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1058. $2=_st($Smalltalk())._globals();
  1059. $ctx1.sendIdx["globals"]=1;
  1060. $1=_st($2)._at_("ObjectMock2");
  1061. $ctx1.sendIdx["at:"]=1;
  1062. instance=_st($1)._new();
  1063. $4=_st($Smalltalk())._globals();
  1064. $ctx1.sendIdx["globals"]=2;
  1065. $3=_st($4)._at_("ObjectMock2");
  1066. $ctx1.sendIdx["at:"]=2;
  1067. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1068. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1069. $ctx1.sendIdx["=="]=1;
  1070. self._deny_($5);
  1071. $ctx1.sendIdx["deny:"]=1;
  1072. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1073. $ctx1.sendIdx["=="]=2;
  1074. self._assert_($6);
  1075. $ctx1.sendIdx["assert:"]=1;
  1076. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1077. $ctx1.sendIdx["assert:"]=2;
  1078. $7=_st($ObjectMock2())._selectors();
  1079. $ctx1.sendIdx["selectors"]=1;
  1080. self._assert_equals_($7,_st(oldClass)._selectors());
  1081. $ctx1.sendIdx["assert:equals:"]=1;
  1082. $8=_st($ObjectMock2())._comment();
  1083. $ctx1.sendIdx["comment"]=1;
  1084. self._assert_equals_($8,_st(oldClass)._comment());
  1085. $ctx1.sendIdx["assert:equals:"]=2;
  1086. $9=_st(_st($ObjectMock2())._package())._name();
  1087. $ctx1.sendIdx["name"]=1;
  1088. self._assert_equals_($9,"Kernel-Tests");
  1089. $11=_st(instance)._class();
  1090. $ctx1.sendIdx["class"]=1;
  1091. $10=_st($11).__eq_eq($ObjectMock2());
  1092. self._deny_($10);
  1093. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  1094. _st($Smalltalk())._removeClass_($ObjectMock2());
  1095. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},globals.ClassBuilderTest)})},
  1096. args: [],
  1097. 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",
  1098. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1099. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1100. }),
  1101. globals.ClassBuilderTest);
  1102. smalltalk.addMethod(
  1103. smalltalk.method({
  1104. selector: "testClassMigrationWithClassInstanceVariables",
  1105. protocol: 'tests',
  1106. fn: function (){
  1107. var self=this;
  1108. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1109. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1110. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1111. return smalltalk.withContext(function($ctx1) {
  1112. var $1;
  1113. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1114. $1=_st($ObjectMock2())._class();
  1115. $ctx1.sendIdx["class"]=1;
  1116. _st($1)._instanceVariableNames_("foo bar");
  1117. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1118. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1119. _st($Smalltalk())._removeClass_($ObjectMock2());
  1120. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},globals.ClassBuilderTest)})},
  1121. args: [],
  1122. 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",
  1123. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1124. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1125. }),
  1126. globals.ClassBuilderTest);
  1127. smalltalk.addMethod(
  1128. smalltalk.method({
  1129. selector: "testClassMigrationWithSubclasses",
  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 $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1136. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1137. function $ObjectMock4(){return globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1138. return smalltalk.withContext(function($ctx1) {
  1139. var $2,$1,$4,$3;
  1140. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1141. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1142. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1143. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1144. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1145. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1146. $2=_st($ObjectMock())._subclasses();
  1147. $ctx1.sendIdx["subclasses"]=1;
  1148. $1=_st($2)._includes_($ObjectMock2());
  1149. $ctx1.sendIdx["includes:"]=1;
  1150. self._assert_($1);
  1151. $ctx1.sendIdx["assert:"]=1;
  1152. $4=_st($ObjectMock2())._subclasses();
  1153. $ctx1.sendIdx["subclasses"]=2;
  1154. $3=_st($4)._includes_($ObjectMock3());
  1155. $ctx1.sendIdx["includes:"]=2;
  1156. self._assert_($3);
  1157. $ctx1.sendIdx["assert:"]=2;
  1158. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1159. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1160. return smalltalk.withContext(function($ctx2) {
  1161. return _st($Smalltalk())._removeClass_(each);
  1162. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1163. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},globals.ClassBuilderTest)})},
  1164. args: [],
  1165. 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 ]",
  1166. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1167. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1168. }),
  1169. globals.ClassBuilderTest);
  1170. smalltalk.addMethod(
  1171. smalltalk.method({
  1172. selector: "testInstanceVariableNames",
  1173. protocol: 'tests',
  1174. fn: function (){
  1175. var self=this;
  1176. return smalltalk.withContext(function($ctx1) {
  1177. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1178. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},globals.ClassBuilderTest)})},
  1179. args: [],
  1180. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1181. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1182. referencedClasses: []
  1183. }),
  1184. globals.ClassBuilderTest);
  1185. smalltalk.addClass('CollectionTest', globals.TestCase, [], 'Kernel-Tests');
  1186. smalltalk.addMethod(
  1187. smalltalk.method({
  1188. selector: "assertSameContents:as:",
  1189. protocol: 'convenience',
  1190. fn: function (aCollection,anotherCollection){
  1191. var self=this;
  1192. return smalltalk.withContext(function($ctx1) {
  1193. var $2,$1,$4,$3;
  1194. $2=_st(aCollection)._size();
  1195. $ctx1.sendIdx["size"]=1;
  1196. $1=_st($2).__eq(_st(anotherCollection)._size());
  1197. $ctx1.sendIdx["="]=1;
  1198. self._assert_($1);
  1199. $ctx1.sendIdx["assert:"]=1;
  1200. _st(aCollection)._do_((function(each){
  1201. return smalltalk.withContext(function($ctx2) {
  1202. $4=_st(aCollection)._occurrencesOf_(each);
  1203. $ctx2.sendIdx["occurrencesOf:"]=1;
  1204. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1205. return self._assert_($3);
  1206. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1207. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},globals.CollectionTest)})},
  1208. args: ["aCollection", "anotherCollection"],
  1209. 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)) ]",
  1210. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1211. referencedClasses: []
  1212. }),
  1213. globals.CollectionTest);
  1214. smalltalk.addMethod(
  1215. smalltalk.method({
  1216. selector: "collection",
  1217. protocol: 'fixture',
  1218. fn: function (){
  1219. var self=this;
  1220. return smalltalk.withContext(function($ctx1) {
  1221. self._subclassResponsibility();
  1222. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},globals.CollectionTest)})},
  1223. args: [],
  1224. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1225. messageSends: ["subclassResponsibility"],
  1226. referencedClasses: []
  1227. }),
  1228. globals.CollectionTest);
  1229. smalltalk.addMethod(
  1230. smalltalk.method({
  1231. selector: "collectionClass",
  1232. protocol: 'fixture',
  1233. fn: function (){
  1234. var self=this;
  1235. return smalltalk.withContext(function($ctx1) {
  1236. var $1;
  1237. $1=_st(self._class())._collectionClass();
  1238. return $1;
  1239. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.CollectionTest)})},
  1240. args: [],
  1241. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1242. messageSends: ["collectionClass", "class"],
  1243. referencedClasses: []
  1244. }),
  1245. globals.CollectionTest);
  1246. smalltalk.addMethod(
  1247. smalltalk.method({
  1248. selector: "collectionOfPrintStrings",
  1249. protocol: 'fixture',
  1250. fn: function (){
  1251. var self=this;
  1252. return smalltalk.withContext(function($ctx1) {
  1253. self._subclassResponsibility();
  1254. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.CollectionTest)})},
  1255. args: [],
  1256. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1257. messageSends: ["subclassResponsibility"],
  1258. referencedClasses: []
  1259. }),
  1260. globals.CollectionTest);
  1261. smalltalk.addMethod(
  1262. smalltalk.method({
  1263. selector: "collectionSize",
  1264. protocol: 'fixture',
  1265. fn: function (){
  1266. var self=this;
  1267. return smalltalk.withContext(function($ctx1) {
  1268. self._subclassResponsibility();
  1269. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},globals.CollectionTest)})},
  1270. args: [],
  1271. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1272. messageSends: ["subclassResponsibility"],
  1273. referencedClasses: []
  1274. }),
  1275. globals.CollectionTest);
  1276. smalltalk.addMethod(
  1277. smalltalk.method({
  1278. selector: "collectionWithDuplicates",
  1279. protocol: 'fixture',
  1280. fn: function (){
  1281. var self=this;
  1282. return smalltalk.withContext(function($ctx1) {
  1283. self._subclassResponsibility();
  1284. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.CollectionTest)})},
  1285. args: [],
  1286. 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",
  1287. messageSends: ["subclassResponsibility"],
  1288. referencedClasses: []
  1289. }),
  1290. globals.CollectionTest);
  1291. smalltalk.addMethod(
  1292. smalltalk.method({
  1293. selector: "collectionWithNewValue",
  1294. protocol: 'fixture',
  1295. fn: function (){
  1296. var self=this;
  1297. return smalltalk.withContext(function($ctx1) {
  1298. self._subclassResponsibility();
  1299. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.CollectionTest)})},
  1300. args: [],
  1301. 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",
  1302. messageSends: ["subclassResponsibility"],
  1303. referencedClasses: []
  1304. }),
  1305. globals.CollectionTest);
  1306. smalltalk.addMethod(
  1307. smalltalk.method({
  1308. selector: "isCollectionReadOnly",
  1309. protocol: 'testing',
  1310. fn: function (){
  1311. var self=this;
  1312. return false;
  1313. },
  1314. args: [],
  1315. source: "isCollectionReadOnly\x0a\x09^ false",
  1316. messageSends: [],
  1317. referencedClasses: []
  1318. }),
  1319. globals.CollectionTest);
  1320. smalltalk.addMethod(
  1321. smalltalk.method({
  1322. selector: "sampleNewValue",
  1323. protocol: 'fixture',
  1324. fn: function (){
  1325. var self=this;
  1326. return "N";
  1327. },
  1328. args: [],
  1329. 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'",
  1330. messageSends: [],
  1331. referencedClasses: []
  1332. }),
  1333. globals.CollectionTest);
  1334. smalltalk.addMethod(
  1335. smalltalk.method({
  1336. selector: "sampleNewValueAsCollection",
  1337. protocol: 'fixture',
  1338. fn: function (){
  1339. var self=this;
  1340. return smalltalk.withContext(function($ctx1) {
  1341. var $1;
  1342. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1343. return $1;
  1344. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)})},
  1345. args: [],
  1346. 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",
  1347. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1348. referencedClasses: []
  1349. }),
  1350. globals.CollectionTest);
  1351. smalltalk.addMethod(
  1352. smalltalk.method({
  1353. selector: "testAddAll",
  1354. protocol: 'tests',
  1355. fn: function (){
  1356. var self=this;
  1357. return smalltalk.withContext(function($ctx1) {
  1358. 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;
  1359. $2=self._collection();
  1360. $ctx1.sendIdx["collection"]=1;
  1361. $3=$2;
  1362. $5=self._collectionClass();
  1363. $ctx1.sendIdx["collectionClass"]=1;
  1364. $4=_st($5)._new();
  1365. $ctx1.sendIdx["new"]=1;
  1366. _st($3)._addAll_($4);
  1367. $ctx1.sendIdx["addAll:"]=1;
  1368. $6=_st($2)._yourself();
  1369. $ctx1.sendIdx["yourself"]=1;
  1370. $1=$6;
  1371. $7=self._collection();
  1372. $ctx1.sendIdx["collection"]=2;
  1373. self._assert_equals_($1,$7);
  1374. $ctx1.sendIdx["assert:equals:"]=1;
  1375. $10=self._collectionClass();
  1376. $ctx1.sendIdx["collectionClass"]=2;
  1377. $9=_st($10)._new();
  1378. $ctx1.sendIdx["new"]=2;
  1379. $11=$9;
  1380. $12=self._collection();
  1381. $ctx1.sendIdx["collection"]=3;
  1382. _st($11)._addAll_($12);
  1383. $ctx1.sendIdx["addAll:"]=2;
  1384. $13=_st($9)._yourself();
  1385. $ctx1.sendIdx["yourself"]=2;
  1386. $8=$13;
  1387. $14=self._collection();
  1388. $ctx1.sendIdx["collection"]=4;
  1389. self._assert_equals_($8,$14);
  1390. $ctx1.sendIdx["assert:equals:"]=2;
  1391. $17=self._collectionClass();
  1392. $ctx1.sendIdx["collectionClass"]=3;
  1393. $16=_st($17)._new();
  1394. $ctx1.sendIdx["new"]=3;
  1395. $18=$16;
  1396. $20=self._collectionClass();
  1397. $ctx1.sendIdx["collectionClass"]=4;
  1398. $19=_st($20)._new();
  1399. $ctx1.sendIdx["new"]=4;
  1400. _st($18)._addAll_($19);
  1401. $ctx1.sendIdx["addAll:"]=3;
  1402. $21=_st($16)._yourself();
  1403. $ctx1.sendIdx["yourself"]=3;
  1404. $15=$21;
  1405. self._assert_equals_($15,_st(self._collectionClass())._new());
  1406. $ctx1.sendIdx["assert:equals:"]=3;
  1407. $23=self._collection();
  1408. $ctx1.sendIdx["collection"]=5;
  1409. $24=$23;
  1410. $25=self._sampleNewValueAsCollection();
  1411. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1412. _st($24)._addAll_($25);
  1413. $ctx1.sendIdx["addAll:"]=4;
  1414. $26=_st($23)._yourself();
  1415. $ctx1.sendIdx["yourself"]=4;
  1416. $22=$26;
  1417. $27=self._collectionWithNewValue();
  1418. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1419. self._assert_equals_($22,$27);
  1420. $28=self._sampleNewValueAsCollection();
  1421. _st($28)._addAll_(self._collection());
  1422. $29=_st($28)._yourself();
  1423. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1424. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)})},
  1425. args: [],
  1426. 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",
  1427. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1428. referencedClasses: []
  1429. }),
  1430. globals.CollectionTest);
  1431. smalltalk.addMethod(
  1432. smalltalk.method({
  1433. selector: "testAllSatisfy",
  1434. protocol: 'tests',
  1435. fn: function (){
  1436. var self=this;
  1437. var collection,anyOne;
  1438. return smalltalk.withContext(function($ctx1) {
  1439. var $1;
  1440. collection=self._collection();
  1441. anyOne=_st(collection)._anyOne();
  1442. $1=_st(collection)._allSatisfy_((function(each){
  1443. return smalltalk.withContext(function($ctx2) {
  1444. return _st(collection)._includes_(each);
  1445. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1446. $ctx1.sendIdx["allSatisfy:"]=1;
  1447. self._assert_($1);
  1448. self._deny_(_st(collection)._allSatisfy_((function(each){
  1449. return smalltalk.withContext(function($ctx2) {
  1450. return _st(each).__tild_eq(anyOne);
  1451. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1452. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)})},
  1453. args: [],
  1454. 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 ])",
  1455. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1456. referencedClasses: []
  1457. }),
  1458. globals.CollectionTest);
  1459. smalltalk.addMethod(
  1460. smalltalk.method({
  1461. selector: "testAnyOne",
  1462. protocol: 'tests',
  1463. fn: function (){
  1464. var self=this;
  1465. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1466. return smalltalk.withContext(function($ctx1) {
  1467. var $2,$1;
  1468. self._should_raise_((function(){
  1469. return smalltalk.withContext(function($ctx2) {
  1470. return _st(_st(self._collectionClass())._new())._anyOne();
  1471. $ctx2.sendIdx["anyOne"]=1;
  1472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1473. $2=self._collection();
  1474. $ctx1.sendIdx["collection"]=1;
  1475. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1476. self._assert_($1);
  1477. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)})},
  1478. args: [],
  1479. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1480. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1481. referencedClasses: ["Error"]
  1482. }),
  1483. globals.CollectionTest);
  1484. smalltalk.addMethod(
  1485. smalltalk.method({
  1486. selector: "testAnySatisfy",
  1487. protocol: 'tests',
  1488. fn: function (){
  1489. var self=this;
  1490. var anyOne;
  1491. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1492. return smalltalk.withContext(function($ctx1) {
  1493. var $1,$3,$2;
  1494. $1=self._collection();
  1495. $ctx1.sendIdx["collection"]=1;
  1496. anyOne=_st($1)._anyOne();
  1497. $3=self._collection();
  1498. $ctx1.sendIdx["collection"]=2;
  1499. $2=_st($3)._anySatisfy_((function(each){
  1500. return smalltalk.withContext(function($ctx2) {
  1501. return _st(each).__eq(anyOne);
  1502. $ctx2.sendIdx["="]=1;
  1503. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1504. $ctx1.sendIdx["anySatisfy:"]=1;
  1505. self._assert_($2);
  1506. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1507. return smalltalk.withContext(function($ctx2) {
  1508. return _st(each).__eq(_st($Object())._new());
  1509. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1510. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  1511. args: [],
  1512. 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 ])",
  1513. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1514. referencedClasses: ["Object"]
  1515. }),
  1516. globals.CollectionTest);
  1517. smalltalk.addMethod(
  1518. smalltalk.method({
  1519. selector: "testAsArray",
  1520. protocol: 'tests',
  1521. fn: function (){
  1522. var self=this;
  1523. return smalltalk.withContext(function($ctx1) {
  1524. var $1;
  1525. $1=self._collection();
  1526. $ctx1.sendIdx["collection"]=1;
  1527. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1528. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)})},
  1529. args: [],
  1530. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1531. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1532. referencedClasses: []
  1533. }),
  1534. globals.CollectionTest);
  1535. smalltalk.addMethod(
  1536. smalltalk.method({
  1537. selector: "testAsOrderedCollection",
  1538. protocol: 'tests',
  1539. fn: function (){
  1540. var self=this;
  1541. return smalltalk.withContext(function($ctx1) {
  1542. var $1;
  1543. $1=self._collection();
  1544. $ctx1.sendIdx["collection"]=1;
  1545. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1546. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)})},
  1547. args: [],
  1548. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1549. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1550. referencedClasses: []
  1551. }),
  1552. globals.CollectionTest);
  1553. smalltalk.addMethod(
  1554. smalltalk.method({
  1555. selector: "testAsSet",
  1556. protocol: 'tests',
  1557. fn: function (){
  1558. var self=this;
  1559. var c,set;
  1560. return smalltalk.withContext(function($ctx1) {
  1561. c=self._collectionWithDuplicates();
  1562. set=_st(c)._asSet();
  1563. self._assert_equals_(_st(set)._size(),(5));
  1564. _st(c)._do_((function(each){
  1565. return smalltalk.withContext(function($ctx2) {
  1566. return self._assert_(_st(set)._includes_(each));
  1567. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1568. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)})},
  1569. args: [],
  1570. 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) ]",
  1571. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1572. referencedClasses: []
  1573. }),
  1574. globals.CollectionTest);
  1575. smalltalk.addMethod(
  1576. smalltalk.method({
  1577. selector: "testCollect",
  1578. protocol: 'tests',
  1579. fn: function (){
  1580. var self=this;
  1581. return smalltalk.withContext(function($ctx1) {
  1582. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1583. $2=self._collection();
  1584. $ctx1.sendIdx["collection"]=1;
  1585. $1=_st($2)._collect_((function(each){
  1586. return smalltalk.withContext(function($ctx2) {
  1587. return each;
  1588. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1589. $ctx1.sendIdx["collect:"]=1;
  1590. $3=self._collection();
  1591. $ctx1.sendIdx["collection"]=2;
  1592. self._assert_equals_($1,$3);
  1593. $ctx1.sendIdx["assert:equals:"]=1;
  1594. $5=self._collectionWithNewValue();
  1595. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1596. $4=_st($5)._collect_((function(each){
  1597. return smalltalk.withContext(function($ctx2) {
  1598. return each;
  1599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1600. $ctx1.sendIdx["collect:"]=2;
  1601. self._assert_equals_($4,self._collectionWithNewValue());
  1602. $ctx1.sendIdx["assert:equals:"]=2;
  1603. $8=self._collectionClass();
  1604. $ctx1.sendIdx["collectionClass"]=1;
  1605. $7=_st($8)._new();
  1606. $ctx1.sendIdx["new"]=1;
  1607. $6=_st($7)._collect_((function(each){
  1608. return smalltalk.withContext(function($ctx2) {
  1609. return _st(each)._printString();
  1610. $ctx2.sendIdx["printString"]=1;
  1611. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1612. $ctx1.sendIdx["collect:"]=3;
  1613. self._assert_equals_($6,_st(self._collectionClass())._new());
  1614. $ctx1.sendIdx["assert:equals:"]=3;
  1615. $11=self._collection();
  1616. $ctx1.sendIdx["collection"]=3;
  1617. $10=_st($11)._collect_((function(){
  1618. return smalltalk.withContext(function($ctx2) {
  1619. return self._sampleNewValue();
  1620. $ctx2.sendIdx["sampleNewValue"]=1;
  1621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1622. $ctx1.sendIdx["collect:"]=4;
  1623. $9=_st($10)._detect_((function(){
  1624. return smalltalk.withContext(function($ctx2) {
  1625. return true;
  1626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1627. self._assert_equals_($9,self._sampleNewValue());
  1628. $ctx1.sendIdx["assert:equals:"]=4;
  1629. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1630. return smalltalk.withContext(function($ctx2) {
  1631. return _st(each)._printString();
  1632. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1633. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)})},
  1634. args: [],
  1635. 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",
  1636. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1637. referencedClasses: []
  1638. }),
  1639. globals.CollectionTest);
  1640. smalltalk.addMethod(
  1641. smalltalk.method({
  1642. selector: "testComma",
  1643. protocol: 'tests',
  1644. fn: function (){
  1645. var self=this;
  1646. return smalltalk.withContext(function($ctx1) {
  1647. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1648. $2=self._collection();
  1649. $ctx1.sendIdx["collection"]=1;
  1650. $4=self._collectionClass();
  1651. $ctx1.sendIdx["collectionClass"]=1;
  1652. $3=_st($4)._new();
  1653. $ctx1.sendIdx["new"]=1;
  1654. $1=_st($2).__comma($3);
  1655. $ctx1.sendIdx[","]=1;
  1656. $5=self._collection();
  1657. $ctx1.sendIdx["collection"]=2;
  1658. self._assert_equals_($1,$5);
  1659. $ctx1.sendIdx["assert:equals:"]=1;
  1660. $8=self._collectionClass();
  1661. $ctx1.sendIdx["collectionClass"]=2;
  1662. $7=_st($8)._new();
  1663. $ctx1.sendIdx["new"]=2;
  1664. $9=self._collection();
  1665. $ctx1.sendIdx["collection"]=3;
  1666. $6=_st($7).__comma($9);
  1667. $ctx1.sendIdx[","]=2;
  1668. $10=self._collection();
  1669. $ctx1.sendIdx["collection"]=4;
  1670. self._assert_equals_($6,$10);
  1671. $ctx1.sendIdx["assert:equals:"]=2;
  1672. $13=self._collectionClass();
  1673. $ctx1.sendIdx["collectionClass"]=3;
  1674. $12=_st($13)._new();
  1675. $ctx1.sendIdx["new"]=3;
  1676. $15=self._collectionClass();
  1677. $ctx1.sendIdx["collectionClass"]=4;
  1678. $14=_st($15)._new();
  1679. $ctx1.sendIdx["new"]=4;
  1680. $11=_st($12).__comma($14);
  1681. $ctx1.sendIdx[","]=3;
  1682. self._assert_equals_($11,_st(self._collectionClass())._new());
  1683. $ctx1.sendIdx["assert:equals:"]=3;
  1684. $17=self._collection();
  1685. $ctx1.sendIdx["collection"]=5;
  1686. $18=self._sampleNewValueAsCollection();
  1687. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1688. $16=_st($17).__comma($18);
  1689. $ctx1.sendIdx[","]=4;
  1690. $19=self._collectionWithNewValue();
  1691. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1692. self._assert_equals_($16,$19);
  1693. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1694. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)})},
  1695. args: [],
  1696. 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",
  1697. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1698. referencedClasses: []
  1699. }),
  1700. globals.CollectionTest);
  1701. smalltalk.addMethod(
  1702. smalltalk.method({
  1703. selector: "testDetect",
  1704. protocol: 'tests',
  1705. fn: function (){
  1706. var self=this;
  1707. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1708. return smalltalk.withContext(function($ctx1) {
  1709. var $1,$2,$3,$4,$6,$5,$7;
  1710. self._shouldnt_raise_((function(){
  1711. return smalltalk.withContext(function($ctx2) {
  1712. $1=self._collection();
  1713. $ctx2.sendIdx["collection"]=1;
  1714. return _st($1)._detect_((function(){
  1715. return smalltalk.withContext(function($ctx3) {
  1716. return true;
  1717. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1718. $ctx2.sendIdx["detect:"]=1;
  1719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1720. self._should_raise_((function(){
  1721. return smalltalk.withContext(function($ctx2) {
  1722. $2=self._collection();
  1723. $ctx2.sendIdx["collection"]=2;
  1724. return _st($2)._detect_((function(){
  1725. return smalltalk.withContext(function($ctx3) {
  1726. return false;
  1727. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  1728. $ctx2.sendIdx["detect:"]=2;
  1729. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1730. $ctx1.sendIdx["should:raise:"]=1;
  1731. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1732. return smalltalk.withContext(function($ctx2) {
  1733. return true;
  1734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1735. $ctx1.sendIdx["detect:"]=3;
  1736. $4=self._sampleNewValue();
  1737. $ctx1.sendIdx["sampleNewValue"]=1;
  1738. self._assert_equals_($3,$4);
  1739. $ctx1.sendIdx["assert:equals:"]=1;
  1740. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1741. return smalltalk.withContext(function($ctx2) {
  1742. $6=self._sampleNewValue();
  1743. $ctx2.sendIdx["sampleNewValue"]=2;
  1744. return _st(each).__eq($6);
  1745. $ctx2.sendIdx["="]=1;
  1746. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1747. $ctx1.sendIdx["detect:"]=4;
  1748. $7=self._sampleNewValue();
  1749. $ctx1.sendIdx["sampleNewValue"]=3;
  1750. self._assert_equals_($5,$7);
  1751. self._should_raise_((function(){
  1752. return smalltalk.withContext(function($ctx2) {
  1753. return _st(self._collection())._detect_((function(each){
  1754. return smalltalk.withContext(function($ctx3) {
  1755. return _st(each).__eq(self._sampleNewValue());
  1756. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1758. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)})},
  1759. args: [],
  1760. 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",
  1761. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1762. referencedClasses: ["Error"]
  1763. }),
  1764. globals.CollectionTest);
  1765. smalltalk.addMethod(
  1766. smalltalk.method({
  1767. selector: "testDetectIfNone",
  1768. protocol: 'tests',
  1769. fn: function (){
  1770. var self=this;
  1771. var sentinel;
  1772. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1773. return smalltalk.withContext(function($ctx1) {
  1774. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1775. sentinel=_st($Object())._new();
  1776. $3=self._collection();
  1777. $ctx1.sendIdx["collection"]=1;
  1778. $2=_st($3)._detect_ifNone_((function(){
  1779. return smalltalk.withContext(function($ctx2) {
  1780. return true;
  1781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  1782. return smalltalk.withContext(function($ctx2) {
  1783. return sentinel;
  1784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1785. $ctx1.sendIdx["detect:ifNone:"]=1;
  1786. $1=_st($2).__tild_eq(sentinel);
  1787. self._assert_($1);
  1788. $5=self._collection();
  1789. $ctx1.sendIdx["collection"]=2;
  1790. $4=_st($5)._detect_ifNone_((function(){
  1791. return smalltalk.withContext(function($ctx2) {
  1792. return false;
  1793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),(function(){
  1794. return smalltalk.withContext(function($ctx2) {
  1795. return sentinel;
  1796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1797. $ctx1.sendIdx["detect:ifNone:"]=2;
  1798. self._assert_equals_($4,sentinel);
  1799. $ctx1.sendIdx["assert:equals:"]=1;
  1800. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1801. return smalltalk.withContext(function($ctx2) {
  1802. return true;
  1803. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. return sentinel;
  1806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1807. $ctx1.sendIdx["detect:ifNone:"]=3;
  1808. $7=self._sampleNewValue();
  1809. $ctx1.sendIdx["sampleNewValue"]=1;
  1810. self._assert_equals_($6,$7);
  1811. $ctx1.sendIdx["assert:equals:"]=2;
  1812. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1813. return smalltalk.withContext(function($ctx2) {
  1814. $9=self._sampleNewValue();
  1815. $ctx2.sendIdx["sampleNewValue"]=2;
  1816. return _st(each).__eq($9);
  1817. $ctx2.sendIdx["="]=1;
  1818. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1819. return smalltalk.withContext(function($ctx2) {
  1820. return sentinel;
  1821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1822. $ctx1.sendIdx["detect:ifNone:"]=4;
  1823. $10=self._sampleNewValue();
  1824. $ctx1.sendIdx["sampleNewValue"]=3;
  1825. self._assert_equals_($8,$10);
  1826. $ctx1.sendIdx["assert:equals:"]=3;
  1827. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1828. return smalltalk.withContext(function($ctx2) {
  1829. return _st(each).__eq(self._sampleNewValue());
  1830. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1831. return smalltalk.withContext(function($ctx2) {
  1832. return sentinel;
  1833. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})})),sentinel);
  1834. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)})},
  1835. args: [],
  1836. 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",
  1837. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1838. referencedClasses: ["Object"]
  1839. }),
  1840. globals.CollectionTest);
  1841. smalltalk.addMethod(
  1842. smalltalk.method({
  1843. selector: "testDo",
  1844. protocol: 'tests',
  1845. fn: function (){
  1846. var self=this;
  1847. var newCollection;
  1848. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1849. return smalltalk.withContext(function($ctx1) {
  1850. var $1,$2;
  1851. newCollection=_st($OrderedCollection())._new();
  1852. $ctx1.sendIdx["new"]=1;
  1853. $1=self._collection();
  1854. $ctx1.sendIdx["collection"]=1;
  1855. _st($1)._do_((function(each){
  1856. return smalltalk.withContext(function($ctx2) {
  1857. return _st(newCollection)._add_(each);
  1858. $ctx2.sendIdx["add:"]=1;
  1859. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1860. $ctx1.sendIdx["do:"]=1;
  1861. self._assertSameContents_as_(self._collection(),newCollection);
  1862. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1863. newCollection=_st($OrderedCollection())._new();
  1864. $2=self._collectionWithDuplicates();
  1865. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1866. _st($2)._do_((function(each){
  1867. return smalltalk.withContext(function($ctx2) {
  1868. return _st(newCollection)._add_(each);
  1869. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1870. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1871. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)})},
  1872. args: [],
  1873. 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",
  1874. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1875. referencedClasses: ["OrderedCollection"]
  1876. }),
  1877. globals.CollectionTest);
  1878. smalltalk.addMethod(
  1879. smalltalk.method({
  1880. selector: "testIfEmptyFamily",
  1881. protocol: 'tests',
  1882. fn: function (){
  1883. var self=this;
  1884. return smalltalk.withContext(function($ctx1) {
  1885. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1886. $3=self._collectionClass();
  1887. $ctx1.sendIdx["collectionClass"]=1;
  1888. $2=_st($3)._new();
  1889. $ctx1.sendIdx["new"]=1;
  1890. $1=_st($2)._ifEmpty_((function(){
  1891. return smalltalk.withContext(function($ctx2) {
  1892. return (42);
  1893. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1894. $ctx1.sendIdx["ifEmpty:"]=1;
  1895. self._assert_equals_($1,(42));
  1896. $ctx1.sendIdx["assert:equals:"]=1;
  1897. $5=self._collection();
  1898. $ctx1.sendIdx["collection"]=1;
  1899. $4=_st($5)._ifEmpty_((function(){
  1900. return smalltalk.withContext(function($ctx2) {
  1901. return (42);
  1902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1903. $6=self._collection();
  1904. $ctx1.sendIdx["collection"]=2;
  1905. self._assert_equals_($4,$6);
  1906. $ctx1.sendIdx["assert:equals:"]=2;
  1907. $9=self._collectionClass();
  1908. $ctx1.sendIdx["collectionClass"]=2;
  1909. $8=_st($9)._new();
  1910. $ctx1.sendIdx["new"]=2;
  1911. $7=_st($8)._ifNotEmpty_((function(){
  1912. return smalltalk.withContext(function($ctx2) {
  1913. return (42);
  1914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1915. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1916. $11=self._collectionClass();
  1917. $ctx1.sendIdx["collectionClass"]=3;
  1918. $10=_st($11)._new();
  1919. $ctx1.sendIdx["new"]=3;
  1920. self._assert_equals_($7,$10);
  1921. $ctx1.sendIdx["assert:equals:"]=3;
  1922. $13=self._collection();
  1923. $ctx1.sendIdx["collection"]=3;
  1924. $12=_st($13)._ifNotEmpty_((function(){
  1925. return smalltalk.withContext(function($ctx2) {
  1926. return (42);
  1927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1928. self._assert_equals_($12,(42));
  1929. $ctx1.sendIdx["assert:equals:"]=4;
  1930. $16=self._collectionClass();
  1931. $ctx1.sendIdx["collectionClass"]=4;
  1932. $15=_st($16)._new();
  1933. $ctx1.sendIdx["new"]=4;
  1934. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1935. return smalltalk.withContext(function($ctx2) {
  1936. return (42);
  1937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1938. return smalltalk.withContext(function($ctx2) {
  1939. return (999);
  1940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1941. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1942. self._assert_equals_($14,(42));
  1943. $ctx1.sendIdx["assert:equals:"]=5;
  1944. $18=self._collection();
  1945. $ctx1.sendIdx["collection"]=4;
  1946. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1947. return smalltalk.withContext(function($ctx2) {
  1948. return (42);
  1949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1950. return smalltalk.withContext(function($ctx2) {
  1951. return (999);
  1952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1953. self._assert_equals_($17,(999));
  1954. $ctx1.sendIdx["assert:equals:"]=6;
  1955. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1956. return smalltalk.withContext(function($ctx2) {
  1957. return (42);
  1958. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1959. return smalltalk.withContext(function($ctx2) {
  1960. return (999);
  1961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1962. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1963. self._assert_equals_($19,(999));
  1964. $ctx1.sendIdx["assert:equals:"]=7;
  1965. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1966. return smalltalk.withContext(function($ctx2) {
  1967. return (42);
  1968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1969. return smalltalk.withContext(function($ctx2) {
  1970. return (999);
  1971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1972. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)})},
  1973. args: [],
  1974. 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",
  1975. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1976. referencedClasses: []
  1977. }),
  1978. globals.CollectionTest);
  1979. smalltalk.addMethod(
  1980. smalltalk.method({
  1981. selector: "testIsEmpty",
  1982. protocol: 'tests',
  1983. fn: function (){
  1984. var self=this;
  1985. return smalltalk.withContext(function($ctx1) {
  1986. var $1;
  1987. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1988. $ctx1.sendIdx["isEmpty"]=1;
  1989. self._assert_($1);
  1990. self._deny_(_st(self._collection())._isEmpty());
  1991. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)})},
  1992. args: [],
  1993. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1994. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1995. referencedClasses: []
  1996. }),
  1997. globals.CollectionTest);
  1998. smalltalk.addMethod(
  1999. smalltalk.method({
  2000. selector: "testNoneSatisfy",
  2001. protocol: 'tests',
  2002. fn: function (){
  2003. var self=this;
  2004. var anyOne;
  2005. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2006. return smalltalk.withContext(function($ctx1) {
  2007. var $1,$3,$2;
  2008. $1=self._collection();
  2009. $ctx1.sendIdx["collection"]=1;
  2010. anyOne=_st($1)._anyOne();
  2011. $3=self._collection();
  2012. $ctx1.sendIdx["collection"]=2;
  2013. $2=_st($3)._noneSatisfy_((function(each){
  2014. return smalltalk.withContext(function($ctx2) {
  2015. return _st(each).__eq(anyOne);
  2016. $ctx2.sendIdx["="]=1;
  2017. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2018. $ctx1.sendIdx["noneSatisfy:"]=1;
  2019. self._deny_($2);
  2020. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2021. return smalltalk.withContext(function($ctx2) {
  2022. return _st(each).__eq(_st($Object())._new());
  2023. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2024. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  2025. args: [],
  2026. 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 ])",
  2027. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2028. referencedClasses: ["Object"]
  2029. }),
  2030. globals.CollectionTest);
  2031. smalltalk.addMethod(
  2032. smalltalk.method({
  2033. selector: "testRemoveAll",
  2034. protocol: 'tests',
  2035. fn: function (){
  2036. var self=this;
  2037. return smalltalk.withContext(function($ctx1) {
  2038. var $1,$2;
  2039. $1=self._collection();
  2040. _st($1)._removeAll();
  2041. $2=_st($1)._yourself();
  2042. self._assert_equals_($2,_st(self._collectionClass())._new());
  2043. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)})},
  2044. args: [],
  2045. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2046. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2047. referencedClasses: []
  2048. }),
  2049. globals.CollectionTest);
  2050. smalltalk.addMethod(
  2051. smalltalk.method({
  2052. selector: "testSelect",
  2053. protocol: 'tests',
  2054. fn: function (){
  2055. var self=this;
  2056. return smalltalk.withContext(function($ctx1) {
  2057. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2058. $2=self._collection();
  2059. $ctx1.sendIdx["collection"]=1;
  2060. $1=_st($2)._select_((function(){
  2061. return smalltalk.withContext(function($ctx2) {
  2062. return false;
  2063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2064. $ctx1.sendIdx["select:"]=1;
  2065. $4=self._collectionClass();
  2066. $ctx1.sendIdx["collectionClass"]=1;
  2067. $3=_st($4)._new();
  2068. $ctx1.sendIdx["new"]=1;
  2069. self._assert_equals_($1,$3);
  2070. $ctx1.sendIdx["assert:equals:"]=1;
  2071. $6=self._collection();
  2072. $ctx1.sendIdx["collection"]=2;
  2073. $5=_st($6)._select_((function(){
  2074. return smalltalk.withContext(function($ctx2) {
  2075. return true;
  2076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2077. $ctx1.sendIdx["select:"]=2;
  2078. $7=self._collection();
  2079. $ctx1.sendIdx["collection"]=3;
  2080. self._assert_equals_($5,$7);
  2081. $ctx1.sendIdx["assert:equals:"]=2;
  2082. $9=self._collectionWithNewValue();
  2083. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2084. $8=_st($9)._select_((function(each){
  2085. return smalltalk.withContext(function($ctx2) {
  2086. $10=self._sampleNewValue();
  2087. $ctx2.sendIdx["sampleNewValue"]=1;
  2088. return _st(each).__eq($10);
  2089. $ctx2.sendIdx["="]=1;
  2090. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2091. $ctx1.sendIdx["select:"]=3;
  2092. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2093. $ctx1.sendIdx["assert:equals:"]=3;
  2094. $12=self._collectionWithNewValue();
  2095. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2096. $11=_st($12)._select_((function(each){
  2097. return smalltalk.withContext(function($ctx2) {
  2098. $13=self._sampleNewValue();
  2099. $ctx2.sendIdx["sampleNewValue"]=2;
  2100. return _st(each).__tild_eq($13);
  2101. $ctx2.sendIdx["~="]=1;
  2102. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2103. $ctx1.sendIdx["select:"]=4;
  2104. $14=self._collection();
  2105. $ctx1.sendIdx["collection"]=4;
  2106. self._assert_equals_($11,$14);
  2107. $ctx1.sendIdx["assert:equals:"]=4;
  2108. $16=self._collection();
  2109. $ctx1.sendIdx["collection"]=5;
  2110. $15=_st($16)._select_((function(each){
  2111. return smalltalk.withContext(function($ctx2) {
  2112. $17=self._sampleNewValue();
  2113. $ctx2.sendIdx["sampleNewValue"]=3;
  2114. return _st(each).__eq($17);
  2115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2116. $ctx1.sendIdx["select:"]=5;
  2117. self._assert_equals_($15,_st(self._collectionClass())._new());
  2118. $ctx1.sendIdx["assert:equals:"]=5;
  2119. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2120. return smalltalk.withContext(function($ctx2) {
  2121. return _st(each).__tild_eq(self._sampleNewValue());
  2122. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2123. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)})},
  2124. args: [],
  2125. 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",
  2126. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2127. referencedClasses: []
  2128. }),
  2129. globals.CollectionTest);
  2130. smalltalk.addMethod(
  2131. smalltalk.method({
  2132. selector: "testSize",
  2133. protocol: 'tests',
  2134. fn: function (){
  2135. var self=this;
  2136. return smalltalk.withContext(function($ctx1) {
  2137. var $1,$2;
  2138. $1=_st(_st(self._collectionClass())._new())._size();
  2139. $ctx1.sendIdx["size"]=1;
  2140. self._assert_equals_($1,(0));
  2141. $ctx1.sendIdx["assert:equals:"]=1;
  2142. $2=_st(self._sampleNewValueAsCollection())._size();
  2143. $ctx1.sendIdx["size"]=2;
  2144. self._assert_equals_($2,(1));
  2145. $ctx1.sendIdx["assert:equals:"]=2;
  2146. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2147. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)})},
  2148. args: [],
  2149. 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",
  2150. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2151. referencedClasses: []
  2152. }),
  2153. globals.CollectionTest);
  2154. smalltalk.addMethod(
  2155. smalltalk.method({
  2156. selector: "collectionClass",
  2157. protocol: 'fixture',
  2158. fn: function (){
  2159. var self=this;
  2160. return nil;
  2161. },
  2162. args: [],
  2163. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2164. messageSends: [],
  2165. referencedClasses: []
  2166. }),
  2167. globals.CollectionTest.klass);
  2168. smalltalk.addMethod(
  2169. smalltalk.method({
  2170. selector: "isAbstract",
  2171. protocol: 'testing',
  2172. fn: function (){
  2173. var self=this;
  2174. return smalltalk.withContext(function($ctx1) {
  2175. var $1;
  2176. $1=_st(self._collectionClass())._isNil();
  2177. return $1;
  2178. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)})},
  2179. args: [],
  2180. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2181. messageSends: ["isNil", "collectionClass"],
  2182. referencedClasses: []
  2183. }),
  2184. globals.CollectionTest.klass);
  2185. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  2186. smalltalk.addMethod(
  2187. smalltalk.method({
  2188. selector: "collectionWithNewValue",
  2189. protocol: 'fixture',
  2190. fn: function (){
  2191. var self=this;
  2192. return smalltalk.withContext(function($ctx1) {
  2193. self._subclassResponsibility();
  2194. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)})},
  2195. args: [],
  2196. 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",
  2197. messageSends: ["subclassResponsibility"],
  2198. referencedClasses: []
  2199. }),
  2200. globals.IndexableCollectionTest);
  2201. smalltalk.addMethod(
  2202. smalltalk.method({
  2203. selector: "sampleNewIndex",
  2204. protocol: 'fixture',
  2205. fn: function (){
  2206. var self=this;
  2207. return smalltalk.withContext(function($ctx1) {
  2208. self._subclassResponsibility();
  2209. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)})},
  2210. args: [],
  2211. 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",
  2212. messageSends: ["subclassResponsibility"],
  2213. referencedClasses: []
  2214. }),
  2215. globals.IndexableCollectionTest);
  2216. smalltalk.addMethod(
  2217. smalltalk.method({
  2218. selector: "sampleNonIndexesDo:",
  2219. protocol: 'fixture',
  2220. fn: function (aBlock){
  2221. var self=this;
  2222. return smalltalk.withContext(function($ctx1) {
  2223. self._subclassResponsibility();
  2224. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2225. args: ["aBlock"],
  2226. 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",
  2227. messageSends: ["subclassResponsibility"],
  2228. referencedClasses: []
  2229. }),
  2230. globals.IndexableCollectionTest);
  2231. smalltalk.addMethod(
  2232. smalltalk.method({
  2233. selector: "samplesDo:",
  2234. protocol: 'fixture',
  2235. fn: function (aBlock){
  2236. var self=this;
  2237. return smalltalk.withContext(function($ctx1) {
  2238. self._subclassResponsibility();
  2239. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2240. args: ["aBlock"],
  2241. 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",
  2242. messageSends: ["subclassResponsibility"],
  2243. referencedClasses: []
  2244. }),
  2245. globals.IndexableCollectionTest);
  2246. smalltalk.addMethod(
  2247. smalltalk.method({
  2248. selector: "testAt",
  2249. protocol: 'tests',
  2250. fn: function (){
  2251. var self=this;
  2252. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2253. return smalltalk.withContext(function($ctx1) {
  2254. var $1;
  2255. self._nonIndexesDo_((function(each){
  2256. return smalltalk.withContext(function($ctx2) {
  2257. return self._should_raise_((function(){
  2258. return smalltalk.withContext(function($ctx3) {
  2259. $1=self._collection();
  2260. $ctx3.sendIdx["collection"]=1;
  2261. return _st($1)._at_(each);
  2262. $ctx3.sendIdx["at:"]=1;
  2263. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2264. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2265. self._samplesDo_((function(index,value){
  2266. return smalltalk.withContext(function($ctx2) {
  2267. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2268. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2269. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)})},
  2270. args: [],
  2271. 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 ]",
  2272. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2273. referencedClasses: ["Error"]
  2274. }),
  2275. globals.IndexableCollectionTest);
  2276. smalltalk.addMethod(
  2277. smalltalk.method({
  2278. selector: "testAtIfAbsent",
  2279. protocol: 'tests',
  2280. fn: function (){
  2281. var self=this;
  2282. return smalltalk.withContext(function($ctx1) {
  2283. var $2,$1,$3;
  2284. self._nonIndexesDo_((function(each){
  2285. return smalltalk.withContext(function($ctx2) {
  2286. $2=self._collection();
  2287. $ctx2.sendIdx["collection"]=1;
  2288. $1=_st($2)._at_ifAbsent_(each,(function(){
  2289. return smalltalk.withContext(function($ctx3) {
  2290. return self._sampleNewValue();
  2291. $ctx3.sendIdx["sampleNewValue"]=1;
  2292. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2293. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2294. $3=self._sampleNewValue();
  2295. $ctx2.sendIdx["sampleNewValue"]=2;
  2296. return self._assert_equals_($1,$3);
  2297. $ctx2.sendIdx["assert:equals:"]=1;
  2298. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2299. self._samplesDo_((function(index,value){
  2300. return smalltalk.withContext(function($ctx2) {
  2301. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2302. return smalltalk.withContext(function($ctx3) {
  2303. return self._sampleNewValue();
  2304. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2305. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2306. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)})},
  2307. args: [],
  2308. 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 ].",
  2309. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2310. referencedClasses: []
  2311. }),
  2312. globals.IndexableCollectionTest);
  2313. smalltalk.addMethod(
  2314. smalltalk.method({
  2315. selector: "testAtIfAbsentPut",
  2316. protocol: 'tests',
  2317. fn: function (){
  2318. var self=this;
  2319. var newCollection;
  2320. return smalltalk.withContext(function($ctx1) {
  2321. var $1;
  2322. newCollection=self._collection();
  2323. $ctx1.sendIdx["collection"]=1;
  2324. self._samplesDo_((function(index,value){
  2325. return smalltalk.withContext(function($ctx2) {
  2326. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2327. return smalltalk.withContext(function($ctx3) {
  2328. return self._sampleNewValue();
  2329. $ctx3.sendIdx["sampleNewValue"]=1;
  2330. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2331. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2332. return self._assert_equals_($1,value);
  2333. $ctx2.sendIdx["assert:equals:"]=1;
  2334. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2335. self._assert_equals_(newCollection,self._collection());
  2336. $ctx1.sendIdx["assert:equals:"]=2;
  2337. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2338. return smalltalk.withContext(function($ctx2) {
  2339. return self._sampleNewValue();
  2340. $ctx2.sendIdx["sampleNewValue"]=2;
  2341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2342. $ctx1.sendIdx["assert:equals:"]=3;
  2343. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2344. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2345. args: [],
  2346. 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",
  2347. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2348. referencedClasses: []
  2349. }),
  2350. globals.IndexableCollectionTest);
  2351. smalltalk.addMethod(
  2352. smalltalk.method({
  2353. selector: "testAtIfPresent",
  2354. protocol: 'tests',
  2355. fn: function (){
  2356. var self=this;
  2357. var visited,sentinel;
  2358. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2359. return smalltalk.withContext(function($ctx1) {
  2360. var $2,$1,$4,$3;
  2361. sentinel=_st($Object())._new();
  2362. self._nonIndexesDo_((function(each){
  2363. return smalltalk.withContext(function($ctx2) {
  2364. visited=nil;
  2365. visited;
  2366. $2=self._collection();
  2367. $ctx2.sendIdx["collection"]=1;
  2368. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2369. return smalltalk.withContext(function($ctx3) {
  2370. visited=value1;
  2371. visited;
  2372. return sentinel;
  2373. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}));
  2374. $ctx2.sendIdx["at:ifPresent:"]=1;
  2375. self._assert_equals_($1,nil);
  2376. $ctx2.sendIdx["assert:equals:"]=1;
  2377. return self._assert_(_st(visited)._isNil());
  2378. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2379. self._samplesDo_((function(index,value){
  2380. return smalltalk.withContext(function($ctx2) {
  2381. visited=nil;
  2382. visited;
  2383. $4=self._collection();
  2384. $ctx2.sendIdx["collection"]=2;
  2385. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2386. return smalltalk.withContext(function($ctx3) {
  2387. visited=value2;
  2388. visited;
  2389. return sentinel;
  2390. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,4)})}));
  2391. self._assert_equals_($3,sentinel);
  2392. $ctx2.sendIdx["assert:equals:"]=2;
  2393. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2394. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2395. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2396. args: [],
  2397. 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) ]",
  2398. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2399. referencedClasses: ["Object"]
  2400. }),
  2401. globals.IndexableCollectionTest);
  2402. smalltalk.addMethod(
  2403. smalltalk.method({
  2404. selector: "testAtIfPresentIfAbsent",
  2405. protocol: 'tests',
  2406. fn: function (){
  2407. var self=this;
  2408. var visited,sentinel;
  2409. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2410. return smalltalk.withContext(function($ctx1) {
  2411. var $2,$1,$3,$5,$4;
  2412. sentinel=_st($Object())._new();
  2413. self._nonIndexesDo_((function(each){
  2414. return smalltalk.withContext(function($ctx2) {
  2415. visited=nil;
  2416. visited;
  2417. $2=self._collection();
  2418. $ctx2.sendIdx["collection"]=1;
  2419. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2420. return smalltalk.withContext(function($ctx3) {
  2421. visited=value1;
  2422. visited;
  2423. return sentinel;
  2424. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}),(function(){
  2425. return smalltalk.withContext(function($ctx3) {
  2426. return self._sampleNewValue();
  2427. $ctx3.sendIdx["sampleNewValue"]=1;
  2428. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2429. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2430. $3=self._sampleNewValue();
  2431. $ctx2.sendIdx["sampleNewValue"]=2;
  2432. self._assert_equals_($1,$3);
  2433. $ctx2.sendIdx["assert:equals:"]=1;
  2434. return self._assert_(_st(visited)._isNil());
  2435. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2436. self._samplesDo_((function(index,value){
  2437. return smalltalk.withContext(function($ctx2) {
  2438. visited=nil;
  2439. visited;
  2440. $5=self._collection();
  2441. $ctx2.sendIdx["collection"]=2;
  2442. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2443. return smalltalk.withContext(function($ctx3) {
  2444. visited=value2;
  2445. visited;
  2446. return sentinel;
  2447. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,5)})}),(function(){
  2448. return smalltalk.withContext(function($ctx3) {
  2449. return self._sampleNewValue();
  2450. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2451. self._assert_equals_($4,sentinel);
  2452. $ctx2.sendIdx["assert:equals:"]=2;
  2453. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2454. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2455. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2456. args: [],
  2457. 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) ]",
  2458. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2459. referencedClasses: ["Object"]
  2460. }),
  2461. globals.IndexableCollectionTest);
  2462. smalltalk.addMethod(
  2463. smalltalk.method({
  2464. selector: "testAtPut",
  2465. protocol: 'tests',
  2466. fn: function (){
  2467. var self=this;
  2468. var newCollection;
  2469. return smalltalk.withContext(function($ctx1) {
  2470. newCollection=self._collection();
  2471. $ctx1.sendIdx["collection"]=1;
  2472. self._samplesDo_((function(index,value){
  2473. return smalltalk.withContext(function($ctx2) {
  2474. return _st(newCollection)._at_put_(index,value);
  2475. $ctx2.sendIdx["at:put:"]=1;
  2476. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2477. self._assert_equals_(newCollection,self._collection());
  2478. $ctx1.sendIdx["assert:equals:"]=1;
  2479. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2480. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2481. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2482. args: [],
  2483. 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",
  2484. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2485. referencedClasses: []
  2486. }),
  2487. globals.IndexableCollectionTest);
  2488. smalltalk.addMethod(
  2489. smalltalk.method({
  2490. selector: "testEquality",
  2491. protocol: 'tests',
  2492. fn: function (){
  2493. var self=this;
  2494. return smalltalk.withContext(function($ctx1) {
  2495. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2496. $2=self._collectionClass();
  2497. $ctx1.sendIdx["collectionClass"]=1;
  2498. $1=_st($2)._new();
  2499. $ctx1.sendIdx["new"]=1;
  2500. $4=self._collectionClass();
  2501. $ctx1.sendIdx["collectionClass"]=2;
  2502. $3=_st($4)._new();
  2503. $ctx1.sendIdx["new"]=2;
  2504. self._assert_equals_($1,$3);
  2505. $ctx1.sendIdx["assert:equals:"]=1;
  2506. $5=self._collection();
  2507. $ctx1.sendIdx["collection"]=1;
  2508. $6=self._collection();
  2509. $ctx1.sendIdx["collection"]=2;
  2510. self._assert_equals_($5,$6);
  2511. $ctx1.sendIdx["assert:equals:"]=2;
  2512. $7=self._collectionWithNewValue();
  2513. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2514. self._assert_equals_($7,self._collectionWithNewValue());
  2515. $10=self._collectionClass();
  2516. $ctx1.sendIdx["collectionClass"]=3;
  2517. $9=_st($10)._new();
  2518. $ctx1.sendIdx["new"]=3;
  2519. $11=self._collection();
  2520. $ctx1.sendIdx["collection"]=3;
  2521. $8=_st($9).__eq($11);
  2522. $ctx1.sendIdx["="]=1;
  2523. self._deny_($8);
  2524. $ctx1.sendIdx["deny:"]=1;
  2525. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2526. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)})},
  2527. args: [],
  2528. 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",
  2529. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2530. referencedClasses: []
  2531. }),
  2532. globals.IndexableCollectionTest);
  2533. smalltalk.addMethod(
  2534. smalltalk.method({
  2535. selector: "testIndexOf",
  2536. protocol: 'tests',
  2537. fn: function (){
  2538. var self=this;
  2539. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2540. return smalltalk.withContext(function($ctx1) {
  2541. var $1;
  2542. self._should_raise_((function(){
  2543. return smalltalk.withContext(function($ctx2) {
  2544. $1=self._collection();
  2545. $ctx2.sendIdx["collection"]=1;
  2546. return _st($1)._indexOf_(self._sampleNewValue());
  2547. $ctx2.sendIdx["indexOf:"]=1;
  2548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2549. self._samplesDo_((function(index,value){
  2550. return smalltalk.withContext(function($ctx2) {
  2551. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2552. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2553. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)})},
  2554. args: [],
  2555. 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 ]",
  2556. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2557. referencedClasses: ["Error"]
  2558. }),
  2559. globals.IndexableCollectionTest);
  2560. smalltalk.addMethod(
  2561. smalltalk.method({
  2562. selector: "testIndexOfWithNull",
  2563. protocol: 'tests',
  2564. fn: function (){
  2565. var self=this;
  2566. var jsNull;
  2567. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2568. return smalltalk.withContext(function($ctx1) {
  2569. var $1,$2;
  2570. jsNull=_st($JSON())._parse_("null");
  2571. self._samplesDo_((function(index,value){
  2572. return smalltalk.withContext(function($ctx2) {
  2573. $1=self._collection();
  2574. _st($1)._at_put_(index,jsNull);
  2575. $2=_st($1)._indexOf_(jsNull);
  2576. return self._assert_equals_($2,index);
  2577. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2578. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)})},
  2579. args: [],
  2580. 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 ]",
  2581. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2582. referencedClasses: ["JSON"]
  2583. }),
  2584. globals.IndexableCollectionTest);
  2585. smalltalk.addMethod(
  2586. smalltalk.method({
  2587. selector: "testWithIndexDo",
  2588. protocol: 'tests',
  2589. fn: function (){
  2590. var self=this;
  2591. var collection;
  2592. return smalltalk.withContext(function($ctx1) {
  2593. collection=self._collection();
  2594. $ctx1.sendIdx["collection"]=1;
  2595. _st(self._collection())._withIndexDo_((function(each,index){
  2596. return smalltalk.withContext(function($ctx2) {
  2597. return self._assert_equals_(_st(collection)._at_(index),each);
  2598. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2599. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)})},
  2600. args: [],
  2601. 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 ]",
  2602. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2603. referencedClasses: []
  2604. }),
  2605. globals.IndexableCollectionTest);
  2606. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  2607. smalltalk.addMethod(
  2608. smalltalk.method({
  2609. selector: "collectionKeys",
  2610. protocol: 'fixture',
  2611. fn: function (){
  2612. var self=this;
  2613. return smalltalk.withContext(function($ctx1) {
  2614. self._subclassResponsibility();
  2615. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)})},
  2616. args: [],
  2617. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2618. messageSends: ["subclassResponsibility"],
  2619. referencedClasses: []
  2620. }),
  2621. globals.AssociativeCollectionTest);
  2622. smalltalk.addMethod(
  2623. smalltalk.method({
  2624. selector: "collectionValues",
  2625. protocol: 'fixture',
  2626. fn: function (){
  2627. var self=this;
  2628. return smalltalk.withContext(function($ctx1) {
  2629. self._subclassResponsibility();
  2630. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)})},
  2631. args: [],
  2632. source: "collectionValues\x0a\x09self subclassResponsibility",
  2633. messageSends: ["subclassResponsibility"],
  2634. referencedClasses: []
  2635. }),
  2636. globals.AssociativeCollectionTest);
  2637. smalltalk.addMethod(
  2638. smalltalk.method({
  2639. selector: "nonIndexesDo:",
  2640. protocol: 'fixture',
  2641. fn: function (aBlock){
  2642. var self=this;
  2643. return smalltalk.withContext(function($ctx1) {
  2644. _st(aBlock)._value_((5));
  2645. $ctx1.sendIdx["value:"]=1;
  2646. _st(aBlock)._value_("z");
  2647. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2648. args: ["aBlock"],
  2649. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2650. messageSends: ["value:"],
  2651. referencedClasses: []
  2652. }),
  2653. globals.AssociativeCollectionTest);
  2654. smalltalk.addMethod(
  2655. smalltalk.method({
  2656. selector: "sampleNewIndex",
  2657. protocol: 'fixture',
  2658. fn: function (){
  2659. var self=this;
  2660. return "new";
  2661. },
  2662. args: [],
  2663. source: "sampleNewIndex\x0a\x09^ 'new'",
  2664. messageSends: [],
  2665. referencedClasses: []
  2666. }),
  2667. globals.AssociativeCollectionTest);
  2668. smalltalk.addMethod(
  2669. smalltalk.method({
  2670. selector: "samplesDo:",
  2671. protocol: 'fixture',
  2672. fn: function (aBlock){
  2673. var self=this;
  2674. return smalltalk.withContext(function($ctx1) {
  2675. _st(aBlock)._value_value_("a",(2));
  2676. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2677. args: ["aBlock"],
  2678. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2679. messageSends: ["value:value:"],
  2680. referencedClasses: []
  2681. }),
  2682. globals.AssociativeCollectionTest);
  2683. smalltalk.addMethod(
  2684. smalltalk.method({
  2685. selector: "testAddAll",
  2686. protocol: 'tests',
  2687. fn: function (){
  2688. var self=this;
  2689. return smalltalk.withContext(function($ctx1) {
  2690. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2691. globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2692. $2=self._collection();
  2693. $ctx1.sendIdx["collection"]=1;
  2694. $3=$2;
  2695. $4=self._collection();
  2696. $ctx1.sendIdx["collection"]=2;
  2697. _st($3)._addAll_($4);
  2698. $ctx1.sendIdx["addAll:"]=1;
  2699. $5=_st($2)._yourself();
  2700. $ctx1.sendIdx["yourself"]=1;
  2701. $1=$5;
  2702. $6=self._collection();
  2703. $ctx1.sendIdx["collection"]=3;
  2704. self._assert_equals_($1,$6);
  2705. $ctx1.sendIdx["assert:equals:"]=1;
  2706. $8=self._collection();
  2707. $ctx1.sendIdx["collection"]=4;
  2708. $9=$8;
  2709. $10=self._collectionWithNewValue();
  2710. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2711. _st($9)._addAll_($10);
  2712. $ctx1.sendIdx["addAll:"]=2;
  2713. $11=_st($8)._yourself();
  2714. $ctx1.sendIdx["yourself"]=2;
  2715. $7=$11;
  2716. $12=self._collectionWithNewValue();
  2717. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2718. self._assert_equals_($7,$12);
  2719. $ctx1.sendIdx["assert:equals:"]=2;
  2720. $14=self._collectionWithNewValue();
  2721. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2722. _st($14)._addAll_(self._collection());
  2723. $15=_st($14)._yourself();
  2724. $13=$15;
  2725. self._assert_equals_($13,self._collectionWithNewValue());
  2726. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)})},
  2727. args: [],
  2728. 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",
  2729. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2730. referencedClasses: []
  2731. }),
  2732. globals.AssociativeCollectionTest);
  2733. smalltalk.addMethod(
  2734. smalltalk.method({
  2735. selector: "testAsDictionary",
  2736. protocol: 'tests',
  2737. fn: function (){
  2738. var self=this;
  2739. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2740. return smalltalk.withContext(function($ctx1) {
  2741. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2742. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)})},
  2743. args: [],
  2744. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2745. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2746. referencedClasses: ["Dictionary"]
  2747. }),
  2748. globals.AssociativeCollectionTest);
  2749. smalltalk.addMethod(
  2750. smalltalk.method({
  2751. selector: "testAsHashedCollection",
  2752. protocol: 'tests',
  2753. fn: function (){
  2754. var self=this;
  2755. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2756. return smalltalk.withContext(function($ctx1) {
  2757. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2758. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)})},
  2759. args: [],
  2760. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2761. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2762. referencedClasses: ["HashedCollection"]
  2763. }),
  2764. globals.AssociativeCollectionTest);
  2765. smalltalk.addMethod(
  2766. smalltalk.method({
  2767. selector: "testComma",
  2768. protocol: 'tests',
  2769. fn: function (){
  2770. var self=this;
  2771. return smalltalk.withContext(function($ctx1) {
  2772. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2773. globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  2774. $2=self._collection();
  2775. $ctx1.sendIdx["collection"]=1;
  2776. $3=self._collection();
  2777. $ctx1.sendIdx["collection"]=2;
  2778. $1=_st($2).__comma($3);
  2779. $ctx1.sendIdx[","]=1;
  2780. $4=self._collection();
  2781. $ctx1.sendIdx["collection"]=3;
  2782. self._assert_equals_($1,$4);
  2783. $ctx1.sendIdx["assert:equals:"]=1;
  2784. $6=self._collection();
  2785. $ctx1.sendIdx["collection"]=4;
  2786. $7=self._collectionWithNewValue();
  2787. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2788. $5=_st($6).__comma($7);
  2789. $ctx1.sendIdx[","]=2;
  2790. $8=self._collectionWithNewValue();
  2791. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2792. self._assert_equals_($5,$8);
  2793. $ctx1.sendIdx["assert:equals:"]=2;
  2794. $10=self._collectionWithNewValue();
  2795. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2796. $9=_st($10).__comma(self._collection());
  2797. self._assert_equals_($9,self._collectionWithNewValue());
  2798. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)})},
  2799. args: [],
  2800. 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",
  2801. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2802. referencedClasses: []
  2803. }),
  2804. globals.AssociativeCollectionTest);
  2805. smalltalk.addMethod(
  2806. smalltalk.method({
  2807. selector: "testFrom",
  2808. protocol: 'tests',
  2809. fn: function (){
  2810. var self=this;
  2811. var associations;
  2812. return smalltalk.withContext(function($ctx1) {
  2813. var $1,$2,$3,$5,$4;
  2814. $1="a".__minus_gt((1));
  2815. $ctx1.sendIdx["->"]=1;
  2816. $2="b".__minus_gt((2));
  2817. $ctx1.sendIdx["->"]=2;
  2818. associations=[$1,$2];
  2819. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2820. $5="a".__minus_gt((1));
  2821. $ctx1.sendIdx["->"]=3;
  2822. $4=globals.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2823. self._assertSameContents_as_($3,$4);
  2824. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)})},
  2825. args: [],
  2826. 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 }.",
  2827. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2828. referencedClasses: []
  2829. }),
  2830. globals.AssociativeCollectionTest);
  2831. smalltalk.addMethod(
  2832. smalltalk.method({
  2833. selector: "testKeys",
  2834. protocol: 'tests',
  2835. fn: function (){
  2836. var self=this;
  2837. return smalltalk.withContext(function($ctx1) {
  2838. var $2,$1,$3,$4;
  2839. $2=_st(_st(self._collectionClass())._new())._keys();
  2840. $ctx1.sendIdx["keys"]=1;
  2841. $1=_st($2)._isEmpty();
  2842. self._assert_($1);
  2843. $3=_st(self._collection())._keys();
  2844. $ctx1.sendIdx["keys"]=2;
  2845. $4=self._collectionKeys();
  2846. $ctx1.sendIdx["collectionKeys"]=1;
  2847. self._assertSameContents_as_($3,$4);
  2848. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2849. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2850. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)})},
  2851. args: [],
  2852. 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 }",
  2853. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2854. referencedClasses: []
  2855. }),
  2856. globals.AssociativeCollectionTest);
  2857. smalltalk.addMethod(
  2858. smalltalk.method({
  2859. selector: "testNewFromPairs",
  2860. protocol: 'tests',
  2861. fn: function (){
  2862. var self=this;
  2863. var flattenedAssociations;
  2864. return smalltalk.withContext(function($ctx1) {
  2865. var $1,$3,$2;
  2866. flattenedAssociations=["a",(1),"b",(2)];
  2867. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2868. $3="a".__minus_gt((1));
  2869. $ctx1.sendIdx["->"]=1;
  2870. $2=globals.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2871. self._assertSameContents_as_($1,$2);
  2872. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)})},
  2873. args: [],
  2874. 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 }.",
  2875. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2876. referencedClasses: []
  2877. }),
  2878. globals.AssociativeCollectionTest);
  2879. smalltalk.addMethod(
  2880. smalltalk.method({
  2881. selector: "testPrintString",
  2882. protocol: 'tests',
  2883. fn: function (){
  2884. var self=this;
  2885. return smalltalk.withContext(function($ctx1) {
  2886. var $3,$2,$4,$1,$5;
  2887. $3=self._collectionClass();
  2888. $ctx1.sendIdx["collectionClass"]=1;
  2889. $2=_st($3)._new();
  2890. _st($2)._at_put_("firstname","James");
  2891. $ctx1.sendIdx["at:put:"]=1;
  2892. _st($2)._at_put_("lastname","Bond");
  2893. $4=_st($2)._printString();
  2894. $1=$4;
  2895. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2896. $ctx1.sendIdx[","]=1;
  2897. self._assert_equals_($1,$5);
  2898. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)})},
  2899. args: [],
  2900. 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'')'",
  2901. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2902. referencedClasses: []
  2903. }),
  2904. globals.AssociativeCollectionTest);
  2905. smalltalk.addMethod(
  2906. smalltalk.method({
  2907. selector: "testRemoveKey",
  2908. protocol: 'tests',
  2909. fn: function (){
  2910. var self=this;
  2911. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2912. return smalltalk.withContext(function($ctx1) {
  2913. var $1,$2,$3,$5,$6,$4,$7,$8;
  2914. self._nonIndexesDo_((function(each){
  2915. var collection;
  2916. return smalltalk.withContext(function($ctx2) {
  2917. collection=self._collection();
  2918. $ctx2.sendIdx["collection"]=1;
  2919. collection;
  2920. self._should_raise_((function(){
  2921. return smalltalk.withContext(function($ctx3) {
  2922. return _st(collection)._removeKey_(each);
  2923. $ctx3.sendIdx["removeKey:"]=1;
  2924. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2925. $1=collection;
  2926. $2=self._collection();
  2927. $ctx2.sendIdx["collection"]=2;
  2928. return self._assert_equals_($1,$2);
  2929. $ctx2.sendIdx["assert:equals:"]=1;
  2930. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2931. self._samplesDo_((function(index,value){
  2932. var collection;
  2933. return smalltalk.withContext(function($ctx2) {
  2934. collection=self._collection();
  2935. $ctx2.sendIdx["collection"]=3;
  2936. collection;
  2937. $3=_st(collection)._removeKey_(index);
  2938. $ctx2.sendIdx["removeKey:"]=2;
  2939. self._assert_equals_($3,value);
  2940. $ctx2.sendIdx["assert:equals:"]=2;
  2941. $5=collection;
  2942. $6=self._collection();
  2943. $ctx2.sendIdx["collection"]=4;
  2944. $4=_st($5).__eq($6);
  2945. return self._deny_($4);
  2946. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2947. $7=self._collectionWithNewValue();
  2948. _st($7)._removeKey_(self._sampleNewIndex());
  2949. $8=_st($7)._yourself();
  2950. self._assert_equals_($8,self._collection());
  2951. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)})},
  2952. args: [],
  2953. 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",
  2954. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  2955. referencedClasses: ["Error"]
  2956. }),
  2957. globals.AssociativeCollectionTest);
  2958. smalltalk.addMethod(
  2959. smalltalk.method({
  2960. selector: "testRemoveKeyIfAbsent",
  2961. protocol: 'tests',
  2962. fn: function (){
  2963. var self=this;
  2964. return smalltalk.withContext(function($ctx1) {
  2965. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  2966. self._nonIndexesDo_((function(each){
  2967. var collection;
  2968. return smalltalk.withContext(function($ctx2) {
  2969. collection=self._collection();
  2970. $ctx2.sendIdx["collection"]=1;
  2971. collection;
  2972. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  2973. return smalltalk.withContext(function($ctx3) {
  2974. return self._sampleNewValue();
  2975. $ctx3.sendIdx["sampleNewValue"]=1;
  2976. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2977. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  2978. $2=self._sampleNewValue();
  2979. $ctx2.sendIdx["sampleNewValue"]=2;
  2980. self._assert_equals_($1,$2);
  2981. $ctx2.sendIdx["assert:equals:"]=1;
  2982. $3=collection;
  2983. $4=self._collection();
  2984. $ctx2.sendIdx["collection"]=2;
  2985. return self._assert_equals_($3,$4);
  2986. $ctx2.sendIdx["assert:equals:"]=2;
  2987. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2988. self._samplesDo_((function(index,value){
  2989. var collection;
  2990. return smalltalk.withContext(function($ctx2) {
  2991. collection=self._collection();
  2992. $ctx2.sendIdx["collection"]=3;
  2993. collection;
  2994. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  2995. return smalltalk.withContext(function($ctx3) {
  2996. return self._sampleNewValue();
  2997. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  2998. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  2999. self._assert_equals_($5,value);
  3000. $ctx2.sendIdx["assert:equals:"]=3;
  3001. $7=collection;
  3002. $8=self._collection();
  3003. $ctx2.sendIdx["collection"]=4;
  3004. $6=_st($7).__eq($8);
  3005. return self._deny_($6);
  3006. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3007. $9=self._collectionWithNewValue();
  3008. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  3009. return smalltalk.withContext(function($ctx2) {
  3010. return self._assert_(false);
  3011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  3012. $10=_st($9)._yourself();
  3013. self._assert_equals_($10,self._collection());
  3014. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)})},
  3015. args: [],
  3016. 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",
  3017. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3018. referencedClasses: []
  3019. }),
  3020. globals.AssociativeCollectionTest);
  3021. smalltalk.addMethod(
  3022. smalltalk.method({
  3023. selector: "testValues",
  3024. protocol: 'tests',
  3025. fn: function (){
  3026. var self=this;
  3027. return smalltalk.withContext(function($ctx1) {
  3028. var $2,$1,$3,$4;
  3029. $2=_st(_st(self._collectionClass())._new())._values();
  3030. $ctx1.sendIdx["values"]=1;
  3031. $1=_st($2)._isEmpty();
  3032. self._assert_($1);
  3033. $3=_st(self._collection())._values();
  3034. $ctx1.sendIdx["values"]=2;
  3035. $4=self._collectionValues();
  3036. $ctx1.sendIdx["collectionValues"]=1;
  3037. self._assertSameContents_as_($3,$4);
  3038. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3039. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3040. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)})},
  3041. args: [],
  3042. 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 }",
  3043. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3044. referencedClasses: []
  3045. }),
  3046. globals.AssociativeCollectionTest);
  3047. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3048. smalltalk.addMethod(
  3049. smalltalk.method({
  3050. selector: "collection",
  3051. protocol: 'fixture',
  3052. fn: function (){
  3053. var self=this;
  3054. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3055. return smalltalk.withContext(function($ctx1) {
  3056. var $2,$3,$1;
  3057. $2=_st($Dictionary())._new();
  3058. _st($2)._at_put_((1),(1));
  3059. $ctx1.sendIdx["at:put:"]=1;
  3060. _st($2)._at_put_("a",(2));
  3061. $ctx1.sendIdx["at:put:"]=2;
  3062. _st($2)._at_put_(true,(3));
  3063. $ctx1.sendIdx["at:put:"]=3;
  3064. _st($2)._at_put_((1).__at((3)),(-4));
  3065. $3=_st($2)._yourself();
  3066. $1=$3;
  3067. return $1;
  3068. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)})},
  3069. args: [],
  3070. 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",
  3071. messageSends: ["at:put:", "new", "@", "yourself"],
  3072. referencedClasses: ["Dictionary"]
  3073. }),
  3074. globals.DictionaryTest);
  3075. smalltalk.addMethod(
  3076. smalltalk.method({
  3077. selector: "collectionKeys",
  3078. protocol: 'fixture',
  3079. fn: function (){
  3080. var self=this;
  3081. return smalltalk.withContext(function($ctx1) {
  3082. var $1;
  3083. $1=[(1),"a",true,(1).__at((3))];
  3084. return $1;
  3085. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)})},
  3086. args: [],
  3087. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3088. messageSends: ["@"],
  3089. referencedClasses: []
  3090. }),
  3091. globals.DictionaryTest);
  3092. smalltalk.addMethod(
  3093. smalltalk.method({
  3094. selector: "collectionOfPrintStrings",
  3095. protocol: 'fixture',
  3096. fn: function (){
  3097. var self=this;
  3098. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3099. return smalltalk.withContext(function($ctx1) {
  3100. var $2,$3,$1;
  3101. $2=_st($Dictionary())._new();
  3102. _st($2)._at_put_((1),"1");
  3103. $ctx1.sendIdx["at:put:"]=1;
  3104. _st($2)._at_put_("a","2");
  3105. $ctx1.sendIdx["at:put:"]=2;
  3106. _st($2)._at_put_(true,"3");
  3107. $ctx1.sendIdx["at:put:"]=3;
  3108. _st($2)._at_put_((1).__at((3)),"-4");
  3109. $3=_st($2)._yourself();
  3110. $1=$3;
  3111. return $1;
  3112. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)})},
  3113. args: [],
  3114. 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",
  3115. messageSends: ["at:put:", "new", "@", "yourself"],
  3116. referencedClasses: ["Dictionary"]
  3117. }),
  3118. globals.DictionaryTest);
  3119. smalltalk.addMethod(
  3120. smalltalk.method({
  3121. selector: "collectionSize",
  3122. protocol: 'fixture',
  3123. fn: function (){
  3124. var self=this;
  3125. return (4);
  3126. },
  3127. args: [],
  3128. source: "collectionSize\x0a\x09^ 4",
  3129. messageSends: [],
  3130. referencedClasses: []
  3131. }),
  3132. globals.DictionaryTest);
  3133. smalltalk.addMethod(
  3134. smalltalk.method({
  3135. selector: "collectionValues",
  3136. protocol: 'fixture',
  3137. fn: function (){
  3138. var self=this;
  3139. var $1;
  3140. $1=[(1),(2),(3),(-4)];
  3141. return $1;
  3142. },
  3143. args: [],
  3144. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3145. messageSends: [],
  3146. referencedClasses: []
  3147. }),
  3148. globals.DictionaryTest);
  3149. smalltalk.addMethod(
  3150. smalltalk.method({
  3151. selector: "collectionWithDuplicates",
  3152. protocol: 'fixture',
  3153. fn: function (){
  3154. var self=this;
  3155. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3156. return smalltalk.withContext(function($ctx1) {
  3157. var $2,$3,$1;
  3158. $2=_st($Dictionary())._new();
  3159. _st($2)._at_put_((1),(1));
  3160. $ctx1.sendIdx["at:put:"]=1;
  3161. _st($2)._at_put_("a",(2));
  3162. $ctx1.sendIdx["at:put:"]=2;
  3163. _st($2)._at_put_(true,(3));
  3164. $ctx1.sendIdx["at:put:"]=3;
  3165. _st($2)._at_put_((4),(-4));
  3166. $ctx1.sendIdx["at:put:"]=4;
  3167. _st($2)._at_put_("b",(1));
  3168. $ctx1.sendIdx["at:put:"]=5;
  3169. _st($2)._at_put_((3),(3));
  3170. $ctx1.sendIdx["at:put:"]=6;
  3171. _st($2)._at_put_(false,(12));
  3172. $3=_st($2)._yourself();
  3173. $1=$3;
  3174. return $1;
  3175. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)})},
  3176. args: [],
  3177. 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",
  3178. messageSends: ["at:put:", "new", "yourself"],
  3179. referencedClasses: ["Dictionary"]
  3180. }),
  3181. globals.DictionaryTest);
  3182. smalltalk.addMethod(
  3183. smalltalk.method({
  3184. selector: "collectionWithNewValue",
  3185. protocol: 'fixture',
  3186. fn: function (){
  3187. var self=this;
  3188. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3189. return smalltalk.withContext(function($ctx1) {
  3190. var $2,$3,$1;
  3191. $2=_st($Dictionary())._new();
  3192. _st($2)._at_put_((1),(1));
  3193. $ctx1.sendIdx["at:put:"]=1;
  3194. _st($2)._at_put_("a",(2));
  3195. $ctx1.sendIdx["at:put:"]=2;
  3196. _st($2)._at_put_(true,(3));
  3197. $ctx1.sendIdx["at:put:"]=3;
  3198. _st($2)._at_put_((1).__at((3)),(-4));
  3199. $ctx1.sendIdx["at:put:"]=4;
  3200. _st($2)._at_put_("new","N");
  3201. $3=_st($2)._yourself();
  3202. $1=$3;
  3203. return $1;
  3204. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)})},
  3205. args: [],
  3206. 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",
  3207. messageSends: ["at:put:", "new", "@", "yourself"],
  3208. referencedClasses: ["Dictionary"]
  3209. }),
  3210. globals.DictionaryTest);
  3211. smalltalk.addMethod(
  3212. smalltalk.method({
  3213. selector: "sampleNewValueAsCollection",
  3214. protocol: 'fixture',
  3215. fn: function (){
  3216. var self=this;
  3217. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3218. return smalltalk.withContext(function($ctx1) {
  3219. var $2,$3,$1;
  3220. $2=_st($Dictionary())._new();
  3221. _st($2)._at_put_("new","N");
  3222. $3=_st($2)._yourself();
  3223. $1=$3;
  3224. return $1;
  3225. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)})},
  3226. args: [],
  3227. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3228. messageSends: ["at:put:", "new", "yourself"],
  3229. referencedClasses: ["Dictionary"]
  3230. }),
  3231. globals.DictionaryTest);
  3232. smalltalk.addMethod(
  3233. smalltalk.method({
  3234. selector: "samplesDo:",
  3235. protocol: 'fixture',
  3236. fn: function (aBlock){
  3237. var self=this;
  3238. return smalltalk.withContext(function($ctx1) {
  3239. globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3240. _st(aBlock)._value_value_(true,(3));
  3241. $ctx1.sendIdx["value:value:"]=1;
  3242. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3243. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)})},
  3244. args: ["aBlock"],
  3245. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3246. messageSends: ["samplesDo:", "value:value:", "@"],
  3247. referencedClasses: []
  3248. }),
  3249. globals.DictionaryTest);
  3250. smalltalk.addMethod(
  3251. smalltalk.method({
  3252. selector: "testAccessing",
  3253. protocol: 'tests',
  3254. fn: function (){
  3255. var self=this;
  3256. var d;
  3257. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3258. return smalltalk.withContext(function($ctx1) {
  3259. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3260. d=_st($Dictionary())._new();
  3261. _st(d)._at_put_("hello","world");
  3262. $ctx1.sendIdx["at:put:"]=1;
  3263. $1=_st(d)._at_("hello");
  3264. $ctx1.sendIdx["at:"]=1;
  3265. self._assert_equals_($1,"world");
  3266. $ctx1.sendIdx["assert:equals:"]=1;
  3267. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3268. return smalltalk.withContext(function($ctx2) {
  3269. return nil;
  3270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3271. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3272. self._assert_equals_($2,"world");
  3273. $ctx1.sendIdx["assert:equals:"]=2;
  3274. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3275. return smalltalk.withContext(function($ctx2) {
  3276. return nil;
  3277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  3278. $ctx1.sendIdx["deny:"]=1;
  3279. $3=_st(d)._includesKey_("hello");
  3280. $ctx1.sendIdx["includesKey:"]=1;
  3281. self._assert_($3);
  3282. $ctx1.sendIdx["assert:"]=1;
  3283. $4=_st(d)._includesKey_("foo");
  3284. $ctx1.sendIdx["includesKey:"]=2;
  3285. self._deny_($4);
  3286. $ctx1.sendIdx["deny:"]=2;
  3287. _st(d)._at_put_((1),(2));
  3288. $ctx1.sendIdx["at:put:"]=2;
  3289. $5=_st(d)._at_((1));
  3290. $ctx1.sendIdx["at:"]=2;
  3291. self._assert_equals_($5,(2));
  3292. $ctx1.sendIdx["assert:equals:"]=3;
  3293. $6=d;
  3294. $7=(1).__at((3));
  3295. $ctx1.sendIdx["@"]=1;
  3296. _st($6)._at_put_($7,(3));
  3297. $9=d;
  3298. $10=(1).__at((3));
  3299. $ctx1.sendIdx["@"]=2;
  3300. $8=_st($9)._at_($10);
  3301. self._assert_equals_($8,(3));
  3302. $12=d;
  3303. $13=(1).__at((3));
  3304. $ctx1.sendIdx["@"]=3;
  3305. $11=_st($12)._includesKey_($13);
  3306. $ctx1.sendIdx["includesKey:"]=3;
  3307. self._assert_($11);
  3308. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3309. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)})},
  3310. args: [],
  3311. 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)",
  3312. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3313. referencedClasses: ["Dictionary"]
  3314. }),
  3315. globals.DictionaryTest);
  3316. smalltalk.addMethod(
  3317. smalltalk.method({
  3318. selector: "testDynamicDictionaries",
  3319. protocol: 'tests',
  3320. fn: function (){
  3321. var self=this;
  3322. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3323. return smalltalk.withContext(function($ctx1) {
  3324. var $3,$2,$1;
  3325. $3="hello".__minus_gt((1));
  3326. $ctx1.sendIdx["->"]=1;
  3327. $2=globals.HashedCollection._from_([$3]);
  3328. $1=_st($2)._asDictionary();
  3329. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  3330. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)})},
  3331. args: [],
  3332. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3333. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  3334. referencedClasses: ["Dictionary"]
  3335. }),
  3336. globals.DictionaryTest);
  3337. smalltalk.addMethod(
  3338. smalltalk.method({
  3339. selector: "collectionClass",
  3340. protocol: 'fixture',
  3341. fn: function (){
  3342. var self=this;
  3343. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3344. return $Dictionary();
  3345. },
  3346. args: [],
  3347. source: "collectionClass\x0a\x09^ Dictionary",
  3348. messageSends: [],
  3349. referencedClasses: ["Dictionary"]
  3350. }),
  3351. globals.DictionaryTest.klass);
  3352. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3353. smalltalk.addMethod(
  3354. smalltalk.method({
  3355. selector: "collection",
  3356. protocol: 'fixture',
  3357. fn: function (){
  3358. var self=this;
  3359. return smalltalk.withContext(function($ctx1) {
  3360. var $2,$3,$4,$1;
  3361. $2="b".__minus_gt((1));
  3362. $ctx1.sendIdx["->"]=1;
  3363. $3="a".__minus_gt((2));
  3364. $ctx1.sendIdx["->"]=2;
  3365. $4="c".__minus_gt((3));
  3366. $ctx1.sendIdx["->"]=3;
  3367. $1=globals.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  3368. return $1;
  3369. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.HashedCollectionTest)})},
  3370. args: [],
  3371. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3372. messageSends: ["->"],
  3373. referencedClasses: []
  3374. }),
  3375. globals.HashedCollectionTest);
  3376. smalltalk.addMethod(
  3377. smalltalk.method({
  3378. selector: "collectionKeys",
  3379. protocol: 'fixture',
  3380. fn: function (){
  3381. var self=this;
  3382. var $1;
  3383. $1=["b","a","c","d"];
  3384. return $1;
  3385. },
  3386. args: [],
  3387. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3388. messageSends: [],
  3389. referencedClasses: []
  3390. }),
  3391. globals.HashedCollectionTest);
  3392. smalltalk.addMethod(
  3393. smalltalk.method({
  3394. selector: "collectionOfPrintStrings",
  3395. protocol: 'fixture',
  3396. fn: function (){
  3397. var self=this;
  3398. return smalltalk.withContext(function($ctx1) {
  3399. var $2,$3,$4,$1;
  3400. $2="b".__minus_gt("1");
  3401. $ctx1.sendIdx["->"]=1;
  3402. $3="a".__minus_gt("2");
  3403. $ctx1.sendIdx["->"]=2;
  3404. $4="c".__minus_gt("3");
  3405. $ctx1.sendIdx["->"]=3;
  3406. $1=globals.HashedCollection._from_([$2,$3,$4,"d".__minus_gt("-4")]);
  3407. return $1;
  3408. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.HashedCollectionTest)})},
  3409. args: [],
  3410. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3411. messageSends: ["->"],
  3412. referencedClasses: []
  3413. }),
  3414. globals.HashedCollectionTest);
  3415. smalltalk.addMethod(
  3416. smalltalk.method({
  3417. selector: "collectionSize",
  3418. protocol: 'fixture',
  3419. fn: function (){
  3420. var self=this;
  3421. return (4);
  3422. },
  3423. args: [],
  3424. source: "collectionSize\x0a\x09^ 4",
  3425. messageSends: [],
  3426. referencedClasses: []
  3427. }),
  3428. globals.HashedCollectionTest);
  3429. smalltalk.addMethod(
  3430. smalltalk.method({
  3431. selector: "collectionValues",
  3432. protocol: 'fixture',
  3433. fn: function (){
  3434. var self=this;
  3435. var $1;
  3436. $1=[(1),(2),(3),(-4)];
  3437. return $1;
  3438. },
  3439. args: [],
  3440. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3441. messageSends: [],
  3442. referencedClasses: []
  3443. }),
  3444. globals.HashedCollectionTest);
  3445. smalltalk.addMethod(
  3446. smalltalk.method({
  3447. selector: "collectionWithDuplicates",
  3448. protocol: 'fixture',
  3449. fn: function (){
  3450. var self=this;
  3451. return smalltalk.withContext(function($ctx1) {
  3452. var $2,$3,$4,$5,$6,$7,$1;
  3453. $2="b".__minus_gt((1));
  3454. $ctx1.sendIdx["->"]=1;
  3455. $3="a".__minus_gt((2));
  3456. $ctx1.sendIdx["->"]=2;
  3457. $4="c".__minus_gt((3));
  3458. $ctx1.sendIdx["->"]=3;
  3459. $5="d".__minus_gt((-4));
  3460. $ctx1.sendIdx["->"]=4;
  3461. $6="e".__minus_gt((1));
  3462. $ctx1.sendIdx["->"]=5;
  3463. $7="f".__minus_gt((2));
  3464. $ctx1.sendIdx["->"]=6;
  3465. $1=globals.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  3466. return $1;
  3467. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.HashedCollectionTest)})},
  3468. args: [],
  3469. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3470. messageSends: ["->"],
  3471. referencedClasses: []
  3472. }),
  3473. globals.HashedCollectionTest);
  3474. smalltalk.addMethod(
  3475. smalltalk.method({
  3476. selector: "collectionWithNewValue",
  3477. protocol: 'fixture',
  3478. fn: function (){
  3479. var self=this;
  3480. return smalltalk.withContext(function($ctx1) {
  3481. var $2,$3,$4,$5,$1;
  3482. $2="b".__minus_gt((1));
  3483. $ctx1.sendIdx["->"]=1;
  3484. $3="a".__minus_gt((2));
  3485. $ctx1.sendIdx["->"]=2;
  3486. $4="c".__minus_gt((3));
  3487. $ctx1.sendIdx["->"]=3;
  3488. $5="d".__minus_gt((-4));
  3489. $ctx1.sendIdx["->"]=4;
  3490. $1=globals.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  3491. return $1;
  3492. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.HashedCollectionTest)})},
  3493. args: [],
  3494. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3495. messageSends: ["->"],
  3496. referencedClasses: []
  3497. }),
  3498. globals.HashedCollectionTest);
  3499. smalltalk.addMethod(
  3500. smalltalk.method({
  3501. selector: "sampleNewValueAsCollection",
  3502. protocol: 'fixture',
  3503. fn: function (){
  3504. var self=this;
  3505. return smalltalk.withContext(function($ctx1) {
  3506. var $1;
  3507. $1=globals.HashedCollection._from_(["new".__minus_gt("N")]);
  3508. return $1;
  3509. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.HashedCollectionTest)})},
  3510. args: [],
  3511. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3512. messageSends: ["->"],
  3513. referencedClasses: []
  3514. }),
  3515. globals.HashedCollectionTest);
  3516. smalltalk.addMethod(
  3517. smalltalk.method({
  3518. selector: "testDynamicDictionaries",
  3519. protocol: 'tests',
  3520. fn: function (){
  3521. var self=this;
  3522. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3523. return smalltalk.withContext(function($ctx1) {
  3524. var $3,$2,$1;
  3525. $3="hello".__minus_gt((1));
  3526. $ctx1.sendIdx["->"]=1;
  3527. $2=globals.HashedCollection._from_([$3]);
  3528. $1=_st($2)._asHashedCollection();
  3529. self._assert_equals_($1,_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3530. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)})},
  3531. args: [],
  3532. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3533. messageSends: ["assert:equals:", "asHashedCollection", "->", "with:"],
  3534. referencedClasses: ["HashedCollection"]
  3535. }),
  3536. globals.HashedCollectionTest);
  3537. smalltalk.addMethod(
  3538. smalltalk.method({
  3539. selector: "collectionClass",
  3540. protocol: 'fixture',
  3541. fn: function (){
  3542. var self=this;
  3543. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3544. return $HashedCollection();
  3545. },
  3546. args: [],
  3547. source: "collectionClass\x0a\x09^ HashedCollection",
  3548. messageSends: [],
  3549. referencedClasses: ["HashedCollection"]
  3550. }),
  3551. globals.HashedCollectionTest.klass);
  3552. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  3553. smalltalk.addMethod(
  3554. smalltalk.method({
  3555. selector: "collectionFirst",
  3556. protocol: 'fixture',
  3557. fn: function (){
  3558. var self=this;
  3559. return smalltalk.withContext(function($ctx1) {
  3560. self._subclassResponsibility();
  3561. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)})},
  3562. args: [],
  3563. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3564. messageSends: ["subclassResponsibility"],
  3565. referencedClasses: []
  3566. }),
  3567. globals.SequenceableCollectionTest);
  3568. smalltalk.addMethod(
  3569. smalltalk.method({
  3570. selector: "collectionFirstTwo",
  3571. protocol: 'fixture',
  3572. fn: function (){
  3573. var self=this;
  3574. return smalltalk.withContext(function($ctx1) {
  3575. self._subclassResponsibility();
  3576. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)})},
  3577. args: [],
  3578. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3579. messageSends: ["subclassResponsibility"],
  3580. referencedClasses: []
  3581. }),
  3582. globals.SequenceableCollectionTest);
  3583. smalltalk.addMethod(
  3584. smalltalk.method({
  3585. selector: "collectionLast",
  3586. protocol: 'fixture',
  3587. fn: function (){
  3588. var self=this;
  3589. return smalltalk.withContext(function($ctx1) {
  3590. self._subclassResponsibility();
  3591. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)})},
  3592. args: [],
  3593. source: "collectionLast\x0a\x09self subclassResponsibility",
  3594. messageSends: ["subclassResponsibility"],
  3595. referencedClasses: []
  3596. }),
  3597. globals.SequenceableCollectionTest);
  3598. smalltalk.addMethod(
  3599. smalltalk.method({
  3600. selector: "collectionLastTwo",
  3601. protocol: 'fixture',
  3602. fn: function (){
  3603. var self=this;
  3604. return smalltalk.withContext(function($ctx1) {
  3605. self._subclassResponsibility();
  3606. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)})},
  3607. args: [],
  3608. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3609. messageSends: ["subclassResponsibility"],
  3610. referencedClasses: []
  3611. }),
  3612. globals.SequenceableCollectionTest);
  3613. smalltalk.addMethod(
  3614. smalltalk.method({
  3615. selector: "nonIndexesDo:",
  3616. protocol: 'fixture',
  3617. fn: function (aBlock){
  3618. var self=this;
  3619. return smalltalk.withContext(function($ctx1) {
  3620. _st(aBlock)._value_((0));
  3621. $ctx1.sendIdx["value:"]=1;
  3622. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3623. $ctx1.sendIdx["value:"]=2;
  3624. _st(aBlock)._value_("z");
  3625. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3626. args: ["aBlock"],
  3627. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3628. messageSends: ["value:", "+", "collectionSize"],
  3629. referencedClasses: []
  3630. }),
  3631. globals.SequenceableCollectionTest);
  3632. smalltalk.addMethod(
  3633. smalltalk.method({
  3634. selector: "samplesDo:",
  3635. protocol: 'fixture',
  3636. fn: function (aBlock){
  3637. var self=this;
  3638. return smalltalk.withContext(function($ctx1) {
  3639. _st(aBlock)._value_value_((1),self._collectionFirst());
  3640. $ctx1.sendIdx["value:value:"]=1;
  3641. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3642. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3643. args: ["aBlock"],
  3644. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3645. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3646. referencedClasses: []
  3647. }),
  3648. globals.SequenceableCollectionTest);
  3649. smalltalk.addMethod(
  3650. smalltalk.method({
  3651. selector: "testBeginsWith",
  3652. protocol: 'tests',
  3653. fn: function (){
  3654. var self=this;
  3655. return smalltalk.withContext(function($ctx1) {
  3656. var $2,$1,$4,$5,$3,$7,$6;
  3657. $2=self._collection();
  3658. $ctx1.sendIdx["collection"]=1;
  3659. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3660. $ctx1.sendIdx["beginsWith:"]=1;
  3661. self._assert_($1);
  3662. $ctx1.sendIdx["assert:"]=1;
  3663. $4=self._collection();
  3664. $ctx1.sendIdx["collection"]=2;
  3665. $5=self._collection();
  3666. $ctx1.sendIdx["collection"]=3;
  3667. $3=_st($4)._beginsWith_($5);
  3668. $ctx1.sendIdx["beginsWith:"]=2;
  3669. self._assert_($3);
  3670. $ctx1.sendIdx["assert:"]=2;
  3671. $7=self._collection();
  3672. $ctx1.sendIdx["collection"]=4;
  3673. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3674. $ctx1.sendIdx["beginsWith:"]=3;
  3675. self._assert_($6);
  3676. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3677. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)})},
  3678. args: [],
  3679. 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)",
  3680. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3681. referencedClasses: []
  3682. }),
  3683. globals.SequenceableCollectionTest);
  3684. smalltalk.addMethod(
  3685. smalltalk.method({
  3686. selector: "testEndsWith",
  3687. protocol: 'tests',
  3688. fn: function (){
  3689. var self=this;
  3690. return smalltalk.withContext(function($ctx1) {
  3691. var $2,$1,$4,$5,$3,$7,$6;
  3692. $2=self._collection();
  3693. $ctx1.sendIdx["collection"]=1;
  3694. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3695. $ctx1.sendIdx["endsWith:"]=1;
  3696. self._assert_($1);
  3697. $ctx1.sendIdx["assert:"]=1;
  3698. $4=self._collection();
  3699. $ctx1.sendIdx["collection"]=2;
  3700. $5=self._collection();
  3701. $ctx1.sendIdx["collection"]=3;
  3702. $3=_st($4)._endsWith_($5);
  3703. $ctx1.sendIdx["endsWith:"]=2;
  3704. self._assert_($3);
  3705. $ctx1.sendIdx["assert:"]=2;
  3706. $7=self._collection();
  3707. $ctx1.sendIdx["collection"]=4;
  3708. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3709. $ctx1.sendIdx["endsWith:"]=3;
  3710. self._assert_($6);
  3711. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3712. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)})},
  3713. args: [],
  3714. 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)",
  3715. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3716. referencedClasses: []
  3717. }),
  3718. globals.SequenceableCollectionTest);
  3719. smalltalk.addMethod(
  3720. smalltalk.method({
  3721. selector: "testFirst",
  3722. protocol: 'tests',
  3723. fn: function (){
  3724. var self=this;
  3725. return smalltalk.withContext(function($ctx1) {
  3726. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3727. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)})},
  3728. args: [],
  3729. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3730. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3731. referencedClasses: []
  3732. }),
  3733. globals.SequenceableCollectionTest);
  3734. smalltalk.addMethod(
  3735. smalltalk.method({
  3736. selector: "testFirstN",
  3737. protocol: 'tests',
  3738. fn: function (){
  3739. var self=this;
  3740. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3741. return smalltalk.withContext(function($ctx1) {
  3742. var $2,$1,$4,$3,$6,$5,$7;
  3743. $2=self._collection();
  3744. $ctx1.sendIdx["collection"]=1;
  3745. $1=_st($2)._first_((2));
  3746. $ctx1.sendIdx["first:"]=1;
  3747. self._assert_equals_($1,self._collectionFirstTwo());
  3748. $ctx1.sendIdx["assert:equals:"]=1;
  3749. $4=self._collection();
  3750. $ctx1.sendIdx["collection"]=2;
  3751. $3=_st($4)._first_((0));
  3752. $ctx1.sendIdx["first:"]=2;
  3753. self._assert_equals_($3,_st(self._collectionClass())._new());
  3754. $ctx1.sendIdx["assert:equals:"]=2;
  3755. $6=self._collection();
  3756. $ctx1.sendIdx["collection"]=3;
  3757. $5=_st($6)._first_(self._collectionSize());
  3758. $ctx1.sendIdx["first:"]=3;
  3759. $7=self._collection();
  3760. $ctx1.sendIdx["collection"]=4;
  3761. self._assert_equals_($5,$7);
  3762. self._should_raise_((function(){
  3763. return smalltalk.withContext(function($ctx2) {
  3764. return _st(self._collection())._first_((33));
  3765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3766. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)})},
  3767. args: [],
  3768. 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",
  3769. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3770. referencedClasses: ["Error"]
  3771. }),
  3772. globals.SequenceableCollectionTest);
  3773. smalltalk.addMethod(
  3774. smalltalk.method({
  3775. selector: "testFourth",
  3776. protocol: 'tests',
  3777. fn: function (){
  3778. var self=this;
  3779. return smalltalk.withContext(function($ctx1) {
  3780. var $2,$1;
  3781. $2=self._collection();
  3782. $ctx1.sendIdx["collection"]=1;
  3783. $1=_st($2)._fourth();
  3784. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3785. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)})},
  3786. args: [],
  3787. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3788. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3789. referencedClasses: []
  3790. }),
  3791. globals.SequenceableCollectionTest);
  3792. smalltalk.addMethod(
  3793. smalltalk.method({
  3794. selector: "testIndexOfStartingAt",
  3795. protocol: 'tests',
  3796. fn: function (){
  3797. var self=this;
  3798. var jsNull;
  3799. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3800. return smalltalk.withContext(function($ctx1) {
  3801. var $2,$1,$4,$3;
  3802. jsNull=_st($JSON())._parse_("null");
  3803. self._samplesDo_((function(index,value){
  3804. return smalltalk.withContext(function($ctx2) {
  3805. $2=self._collection();
  3806. $ctx2.sendIdx["collection"]=1;
  3807. $1=_st($2)._indexOf_startingAt_(value,(1));
  3808. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3809. self._assert_equals_($1,index);
  3810. $ctx2.sendIdx["assert:equals:"]=1;
  3811. $4=self._collection();
  3812. $ctx2.sendIdx["collection"]=2;
  3813. $3=_st($4)._indexOf_startingAt_(value,index);
  3814. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3815. self._assert_equals_($3,index);
  3816. $ctx2.sendIdx["assert:equals:"]=2;
  3817. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3818. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3819. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3820. args: [],
  3821. 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 ]",
  3822. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3823. referencedClasses: ["JSON"]
  3824. }),
  3825. globals.SequenceableCollectionTest);
  3826. smalltalk.addMethod(
  3827. smalltalk.method({
  3828. selector: "testIndexOfStartingAtWithNull",
  3829. protocol: 'tests',
  3830. fn: function (){
  3831. var self=this;
  3832. var jsNull;
  3833. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3834. return smalltalk.withContext(function($ctx1) {
  3835. var $1,$2;
  3836. jsNull=_st($JSON())._parse_("null");
  3837. self._samplesDo_((function(index,value){
  3838. var collection;
  3839. return smalltalk.withContext(function($ctx2) {
  3840. collection=self._collection();
  3841. collection;
  3842. _st(collection)._at_put_(index,jsNull);
  3843. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3844. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3845. self._assert_equals_($1,index);
  3846. $ctx2.sendIdx["assert:equals:"]=1;
  3847. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3848. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3849. self._assert_equals_($2,index);
  3850. $ctx2.sendIdx["assert:equals:"]=2;
  3851. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3852. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3853. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3854. args: [],
  3855. 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 ]",
  3856. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3857. referencedClasses: ["JSON"]
  3858. }),
  3859. globals.SequenceableCollectionTest);
  3860. smalltalk.addMethod(
  3861. smalltalk.method({
  3862. selector: "testLast",
  3863. protocol: 'tests',
  3864. fn: function (){
  3865. var self=this;
  3866. return smalltalk.withContext(function($ctx1) {
  3867. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3868. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)})},
  3869. args: [],
  3870. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3871. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3872. referencedClasses: []
  3873. }),
  3874. globals.SequenceableCollectionTest);
  3875. smalltalk.addMethod(
  3876. smalltalk.method({
  3877. selector: "testLastN",
  3878. protocol: 'tests',
  3879. fn: function (){
  3880. var self=this;
  3881. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3882. return smalltalk.withContext(function($ctx1) {
  3883. var $2,$1,$4,$3,$6,$5,$7;
  3884. $2=self._collection();
  3885. $ctx1.sendIdx["collection"]=1;
  3886. $1=_st($2)._last_((2));
  3887. $ctx1.sendIdx["last:"]=1;
  3888. self._assert_equals_($1,self._collectionLastTwo());
  3889. $ctx1.sendIdx["assert:equals:"]=1;
  3890. $4=self._collection();
  3891. $ctx1.sendIdx["collection"]=2;
  3892. $3=_st($4)._last_((0));
  3893. $ctx1.sendIdx["last:"]=2;
  3894. self._assert_equals_($3,_st(self._collectionClass())._new());
  3895. $ctx1.sendIdx["assert:equals:"]=2;
  3896. $6=self._collection();
  3897. $ctx1.sendIdx["collection"]=3;
  3898. $5=_st($6)._last_(self._collectionSize());
  3899. $ctx1.sendIdx["last:"]=3;
  3900. $7=self._collection();
  3901. $ctx1.sendIdx["collection"]=4;
  3902. self._assert_equals_($5,$7);
  3903. self._should_raise_((function(){
  3904. return smalltalk.withContext(function($ctx2) {
  3905. return _st(self._collection())._last_((33));
  3906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3907. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)})},
  3908. args: [],
  3909. 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",
  3910. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3911. referencedClasses: ["Error"]
  3912. }),
  3913. globals.SequenceableCollectionTest);
  3914. smalltalk.addMethod(
  3915. smalltalk.method({
  3916. selector: "testSecond",
  3917. protocol: 'tests',
  3918. fn: function (){
  3919. var self=this;
  3920. return smalltalk.withContext(function($ctx1) {
  3921. var $2,$1;
  3922. $2=self._collection();
  3923. $ctx1.sendIdx["collection"]=1;
  3924. $1=_st($2)._second();
  3925. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3926. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)})},
  3927. args: [],
  3928. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3929. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3930. referencedClasses: []
  3931. }),
  3932. globals.SequenceableCollectionTest);
  3933. smalltalk.addMethod(
  3934. smalltalk.method({
  3935. selector: "testThird",
  3936. protocol: 'tests',
  3937. fn: function (){
  3938. var self=this;
  3939. return smalltalk.withContext(function($ctx1) {
  3940. var $2,$1;
  3941. $2=self._collection();
  3942. $ctx1.sendIdx["collection"]=1;
  3943. $1=_st($2)._third();
  3944. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3945. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)})},
  3946. args: [],
  3947. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3948. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3949. referencedClasses: []
  3950. }),
  3951. globals.SequenceableCollectionTest);
  3952. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  3953. smalltalk.addMethod(
  3954. smalltalk.method({
  3955. selector: "collection",
  3956. protocol: 'fixture',
  3957. fn: function (){
  3958. var self=this;
  3959. var $1;
  3960. $1=[(1), (2), (3), (-4)];
  3961. return $1;
  3962. },
  3963. args: [],
  3964. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3965. messageSends: [],
  3966. referencedClasses: []
  3967. }),
  3968. globals.ArrayTest);
  3969. smalltalk.addMethod(
  3970. smalltalk.method({
  3971. selector: "collectionFirst",
  3972. protocol: 'fixture',
  3973. fn: function (){
  3974. var self=this;
  3975. return (1);
  3976. },
  3977. args: [],
  3978. source: "collectionFirst\x0a\x09^ 1",
  3979. messageSends: [],
  3980. referencedClasses: []
  3981. }),
  3982. globals.ArrayTest);
  3983. smalltalk.addMethod(
  3984. smalltalk.method({
  3985. selector: "collectionFirstTwo",
  3986. protocol: 'fixture',
  3987. fn: function (){
  3988. var self=this;
  3989. var $1;
  3990. $1=[(1), (2)];
  3991. return $1;
  3992. },
  3993. args: [],
  3994. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3995. messageSends: [],
  3996. referencedClasses: []
  3997. }),
  3998. globals.ArrayTest);
  3999. smalltalk.addMethod(
  4000. smalltalk.method({
  4001. selector: "collectionLast",
  4002. protocol: 'fixture',
  4003. fn: function (){
  4004. var self=this;
  4005. return (-4);
  4006. },
  4007. args: [],
  4008. source: "collectionLast\x0a\x09^ -4",
  4009. messageSends: [],
  4010. referencedClasses: []
  4011. }),
  4012. globals.ArrayTest);
  4013. smalltalk.addMethod(
  4014. smalltalk.method({
  4015. selector: "collectionLastTwo",
  4016. protocol: 'fixture',
  4017. fn: function (){
  4018. var self=this;
  4019. var $1;
  4020. $1=[(3), (-4)];
  4021. return $1;
  4022. },
  4023. args: [],
  4024. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  4025. messageSends: [],
  4026. referencedClasses: []
  4027. }),
  4028. globals.ArrayTest);
  4029. smalltalk.addMethod(
  4030. smalltalk.method({
  4031. selector: "collectionOfPrintStrings",
  4032. protocol: 'fixture',
  4033. fn: function (){
  4034. var self=this;
  4035. var $1;
  4036. $1=["1", "2", "3", "-4"];
  4037. return $1;
  4038. },
  4039. args: [],
  4040. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  4041. messageSends: [],
  4042. referencedClasses: []
  4043. }),
  4044. globals.ArrayTest);
  4045. smalltalk.addMethod(
  4046. smalltalk.method({
  4047. selector: "collectionSize",
  4048. protocol: 'fixture',
  4049. fn: function (){
  4050. var self=this;
  4051. return (4);
  4052. },
  4053. args: [],
  4054. source: "collectionSize\x0a\x09^ 4",
  4055. messageSends: [],
  4056. referencedClasses: []
  4057. }),
  4058. globals.ArrayTest);
  4059. smalltalk.addMethod(
  4060. smalltalk.method({
  4061. selector: "collectionWithDuplicates",
  4062. protocol: 'fixture',
  4063. fn: function (){
  4064. var self=this;
  4065. var $1;
  4066. $1=["a", "b", "c", (1), (2), (1), "a"];
  4067. return $1;
  4068. },
  4069. args: [],
  4070. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4071. messageSends: [],
  4072. referencedClasses: []
  4073. }),
  4074. globals.ArrayTest);
  4075. smalltalk.addMethod(
  4076. smalltalk.method({
  4077. selector: "collectionWithNewValue",
  4078. protocol: 'fixture',
  4079. fn: function (){
  4080. var self=this;
  4081. var $1;
  4082. $1=[(1), (2), (3), (-4), "N"];
  4083. return $1;
  4084. },
  4085. args: [],
  4086. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4087. messageSends: [],
  4088. referencedClasses: []
  4089. }),
  4090. globals.ArrayTest);
  4091. smalltalk.addMethod(
  4092. smalltalk.method({
  4093. selector: "sampleNewIndex",
  4094. protocol: 'fixture',
  4095. fn: function (){
  4096. var self=this;
  4097. return (5);
  4098. },
  4099. args: [],
  4100. source: "sampleNewIndex\x0a\x09^ 5",
  4101. messageSends: [],
  4102. referencedClasses: []
  4103. }),
  4104. globals.ArrayTest);
  4105. smalltalk.addMethod(
  4106. smalltalk.method({
  4107. selector: "samplesDo:",
  4108. protocol: 'fixture',
  4109. fn: function (aBlock){
  4110. var self=this;
  4111. return smalltalk.withContext(function($ctx1) {
  4112. globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4113. _st(aBlock)._value_value_((3),(3));
  4114. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)})},
  4115. args: ["aBlock"],
  4116. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4117. messageSends: ["samplesDo:", "value:value:"],
  4118. referencedClasses: []
  4119. }),
  4120. globals.ArrayTest);
  4121. smalltalk.addMethod(
  4122. smalltalk.method({
  4123. selector: "testAdd",
  4124. protocol: 'tests',
  4125. fn: function (){
  4126. var self=this;
  4127. var array;
  4128. return smalltalk.withContext(function($ctx1) {
  4129. array=self._collection();
  4130. _st(array)._add_((6));
  4131. self._assert_equals_(_st(array)._last(),(6));
  4132. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)})},
  4133. args: [],
  4134. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4135. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4136. referencedClasses: []
  4137. }),
  4138. globals.ArrayTest);
  4139. smalltalk.addMethod(
  4140. smalltalk.method({
  4141. selector: "testAddFirst",
  4142. protocol: 'tests',
  4143. fn: function (){
  4144. var self=this;
  4145. return smalltalk.withContext(function($ctx1) {
  4146. var $1,$2;
  4147. $1=self._collection();
  4148. _st($1)._addFirst_((0));
  4149. $2=_st($1)._yourself();
  4150. self._assert_equals_(_st($2)._first(),(0));
  4151. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)})},
  4152. args: [],
  4153. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4154. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4155. referencedClasses: []
  4156. }),
  4157. globals.ArrayTest);
  4158. smalltalk.addMethod(
  4159. smalltalk.method({
  4160. selector: "testPrintString",
  4161. protocol: 'tests',
  4162. fn: function (){
  4163. var self=this;
  4164. var array;
  4165. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4166. return smalltalk.withContext(function($ctx1) {
  4167. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4168. array=_st($Array())._new();
  4169. $1=_st(array)._printString();
  4170. $ctx1.sendIdx["printString"]=1;
  4171. self._assert_equals_($1,"an Array ()");
  4172. $ctx1.sendIdx["assert:equals:"]=1;
  4173. $2=array;
  4174. _st($2)._add_((1));
  4175. $ctx1.sendIdx["add:"]=1;
  4176. $3=_st($2)._add_((3));
  4177. $ctx1.sendIdx["add:"]=2;
  4178. $4=_st(array)._printString();
  4179. $ctx1.sendIdx["printString"]=2;
  4180. self._assert_equals_($4,"an Array (1 3)");
  4181. $ctx1.sendIdx["assert:equals:"]=2;
  4182. _st(array)._add_("foo");
  4183. $5=_st(array)._printString();
  4184. $ctx1.sendIdx["printString"]=3;
  4185. self._assert_equals_($5,"an Array (1 3 'foo')");
  4186. $ctx1.sendIdx["assert:equals:"]=3;
  4187. $6=array;
  4188. _st($6)._remove_((1));
  4189. $ctx1.sendIdx["remove:"]=1;
  4190. $7=_st($6)._remove_((3));
  4191. $8=_st(array)._printString();
  4192. $ctx1.sendIdx["printString"]=4;
  4193. self._assert_equals_($8,"an Array ('foo')");
  4194. $ctx1.sendIdx["assert:equals:"]=4;
  4195. _st(array)._addLast_((3));
  4196. $ctx1.sendIdx["addLast:"]=1;
  4197. $9=_st(array)._printString();
  4198. $ctx1.sendIdx["printString"]=5;
  4199. self._assert_equals_($9,"an Array ('foo' 3)");
  4200. $ctx1.sendIdx["assert:equals:"]=5;
  4201. _st(array)._addLast_((3));
  4202. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4203. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)})},
  4204. args: [],
  4205. 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)'.",
  4206. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4207. referencedClasses: ["Array"]
  4208. }),
  4209. globals.ArrayTest);
  4210. smalltalk.addMethod(
  4211. smalltalk.method({
  4212. selector: "testRemove",
  4213. protocol: 'tests',
  4214. fn: function (){
  4215. var self=this;
  4216. var array;
  4217. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4218. return smalltalk.withContext(function($ctx1) {
  4219. array=[(1), (2), (3), (4), (5)];
  4220. _st(array)._remove_((3));
  4221. $ctx1.sendIdx["remove:"]=1;
  4222. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4223. self._should_raise_((function(){
  4224. return smalltalk.withContext(function($ctx2) {
  4225. return _st(array)._remove_((3));
  4226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4227. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)})},
  4228. args: [],
  4229. 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",
  4230. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4231. referencedClasses: ["Error"]
  4232. }),
  4233. globals.ArrayTest);
  4234. smalltalk.addMethod(
  4235. smalltalk.method({
  4236. selector: "testRemoveFromTo",
  4237. protocol: 'tests',
  4238. fn: function (){
  4239. var self=this;
  4240. return smalltalk.withContext(function($ctx1) {
  4241. var $1,$2;
  4242. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4243. $ctx1.sendIdx["removeFrom:to:"]=1;
  4244. self._assert_equals_($1,[(4)]);
  4245. $ctx1.sendIdx["assert:equals:"]=1;
  4246. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4247. $ctx1.sendIdx["removeFrom:to:"]=2;
  4248. self._assert_equals_($2,[(1), (4)]);
  4249. $ctx1.sendIdx["assert:equals:"]=2;
  4250. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4251. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)})},
  4252. args: [],
  4253. 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)",
  4254. messageSends: ["assert:equals:", "removeFrom:to:"],
  4255. referencedClasses: []
  4256. }),
  4257. globals.ArrayTest);
  4258. smalltalk.addMethod(
  4259. smalltalk.method({
  4260. selector: "testRemoveIndex",
  4261. protocol: 'tests',
  4262. fn: function (){
  4263. var self=this;
  4264. return smalltalk.withContext(function($ctx1) {
  4265. var $1,$2;
  4266. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4267. $ctx1.sendIdx["removeIndex:"]=1;
  4268. self._assert_equals_($1,[(1), (3), (4)]);
  4269. $ctx1.sendIdx["assert:equals:"]=1;
  4270. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4271. $ctx1.sendIdx["removeIndex:"]=2;
  4272. self._assert_equals_($2,[(2), (3), (4)]);
  4273. $ctx1.sendIdx["assert:equals:"]=2;
  4274. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4275. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)})},
  4276. args: [],
  4277. 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: #()",
  4278. messageSends: ["assert:equals:", "removeIndex:"],
  4279. referencedClasses: []
  4280. }),
  4281. globals.ArrayTest);
  4282. smalltalk.addMethod(
  4283. smalltalk.method({
  4284. selector: "testRemoveLast",
  4285. protocol: 'tests',
  4286. fn: function (){
  4287. var self=this;
  4288. var array;
  4289. return smalltalk.withContext(function($ctx1) {
  4290. array=[(1), (2)];
  4291. _st(array)._removeLast();
  4292. self._assert_equals_(_st(array)._last(),(1));
  4293. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)})},
  4294. args: [],
  4295. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4296. messageSends: ["removeLast", "assert:equals:", "last"],
  4297. referencedClasses: []
  4298. }),
  4299. globals.ArrayTest);
  4300. smalltalk.addMethod(
  4301. smalltalk.method({
  4302. selector: "testReversed",
  4303. protocol: 'tests',
  4304. fn: function (){
  4305. var self=this;
  4306. var array;
  4307. return smalltalk.withContext(function($ctx1) {
  4308. array=[(5), (4), (3), (2), (1)];
  4309. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4310. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)})},
  4311. args: [],
  4312. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4313. messageSends: ["assert:equals:", "reversed"],
  4314. referencedClasses: []
  4315. }),
  4316. globals.ArrayTest);
  4317. smalltalk.addMethod(
  4318. smalltalk.method({
  4319. selector: "testSort",
  4320. protocol: 'tests',
  4321. fn: function (){
  4322. var self=this;
  4323. var array;
  4324. return smalltalk.withContext(function($ctx1) {
  4325. array=[(3), (1), (4), (5), (2)];
  4326. _st(array)._sort();
  4327. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  4328. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)})},
  4329. args: [],
  4330. source: "testSort\x0a\x09| array |\x0a\x09array := #(3 1 4 5 2). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 2 3 4 5)",
  4331. messageSends: ["sort", "assert:equals:"],
  4332. referencedClasses: []
  4333. }),
  4334. globals.ArrayTest);
  4335. smalltalk.addMethod(
  4336. smalltalk.method({
  4337. selector: "collectionClass",
  4338. protocol: 'fixture',
  4339. fn: function (){
  4340. var self=this;
  4341. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4342. return $Array();
  4343. },
  4344. args: [],
  4345. source: "collectionClass\x0a\x09^ Array",
  4346. messageSends: [],
  4347. referencedClasses: ["Array"]
  4348. }),
  4349. globals.ArrayTest.klass);
  4350. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  4351. smalltalk.addMethod(
  4352. smalltalk.method({
  4353. selector: "collection",
  4354. protocol: 'fixture',
  4355. fn: function (){
  4356. var self=this;
  4357. return "helLo";
  4358. },
  4359. args: [],
  4360. source: "collection\x0a\x09^ 'helLo'",
  4361. messageSends: [],
  4362. referencedClasses: []
  4363. }),
  4364. globals.StringTest);
  4365. smalltalk.addMethod(
  4366. smalltalk.method({
  4367. selector: "collectionFirst",
  4368. protocol: 'fixture',
  4369. fn: function (){
  4370. var self=this;
  4371. return "h";
  4372. },
  4373. args: [],
  4374. source: "collectionFirst\x0a\x09^ 'h'",
  4375. messageSends: [],
  4376. referencedClasses: []
  4377. }),
  4378. globals.StringTest);
  4379. smalltalk.addMethod(
  4380. smalltalk.method({
  4381. selector: "collectionFirstTwo",
  4382. protocol: 'fixture',
  4383. fn: function (){
  4384. var self=this;
  4385. return "he";
  4386. },
  4387. args: [],
  4388. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4389. messageSends: [],
  4390. referencedClasses: []
  4391. }),
  4392. globals.StringTest);
  4393. smalltalk.addMethod(
  4394. smalltalk.method({
  4395. selector: "collectionLast",
  4396. protocol: 'fixture',
  4397. fn: function (){
  4398. var self=this;
  4399. return "o";
  4400. },
  4401. args: [],
  4402. source: "collectionLast\x0a\x09^ 'o'",
  4403. messageSends: [],
  4404. referencedClasses: []
  4405. }),
  4406. globals.StringTest);
  4407. smalltalk.addMethod(
  4408. smalltalk.method({
  4409. selector: "collectionLastTwo",
  4410. protocol: 'fixture',
  4411. fn: function (){
  4412. var self=this;
  4413. return "Lo";
  4414. },
  4415. args: [],
  4416. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4417. messageSends: [],
  4418. referencedClasses: []
  4419. }),
  4420. globals.StringTest);
  4421. smalltalk.addMethod(
  4422. smalltalk.method({
  4423. selector: "collectionOfPrintStrings",
  4424. protocol: 'fixture',
  4425. fn: function (){
  4426. var self=this;
  4427. return "'h''e''l''L''o'";
  4428. },
  4429. args: [],
  4430. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4431. messageSends: [],
  4432. referencedClasses: []
  4433. }),
  4434. globals.StringTest);
  4435. smalltalk.addMethod(
  4436. smalltalk.method({
  4437. selector: "collectionSize",
  4438. protocol: 'fixture',
  4439. fn: function (){
  4440. var self=this;
  4441. return (5);
  4442. },
  4443. args: [],
  4444. source: "collectionSize\x0a\x09^ 5",
  4445. messageSends: [],
  4446. referencedClasses: []
  4447. }),
  4448. globals.StringTest);
  4449. smalltalk.addMethod(
  4450. smalltalk.method({
  4451. selector: "collectionWithDuplicates",
  4452. protocol: 'fixture',
  4453. fn: function (){
  4454. var self=this;
  4455. return "abbaerte";
  4456. },
  4457. args: [],
  4458. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4459. messageSends: [],
  4460. referencedClasses: []
  4461. }),
  4462. globals.StringTest);
  4463. smalltalk.addMethod(
  4464. smalltalk.method({
  4465. selector: "collectionWithNewValue",
  4466. protocol: 'fixture',
  4467. fn: function (){
  4468. var self=this;
  4469. return "helLoN";
  4470. },
  4471. args: [],
  4472. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4473. messageSends: [],
  4474. referencedClasses: []
  4475. }),
  4476. globals.StringTest);
  4477. smalltalk.addMethod(
  4478. smalltalk.method({
  4479. selector: "sampleNewValueAsCollection",
  4480. protocol: 'fixture',
  4481. fn: function (){
  4482. var self=this;
  4483. return "N";
  4484. },
  4485. args: [],
  4486. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4487. messageSends: [],
  4488. referencedClasses: []
  4489. }),
  4490. globals.StringTest);
  4491. smalltalk.addMethod(
  4492. smalltalk.method({
  4493. selector: "samplesDo:",
  4494. protocol: 'fixture',
  4495. fn: function (aBlock){
  4496. var self=this;
  4497. return smalltalk.withContext(function($ctx1) {
  4498. globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4499. _st(aBlock)._value_value_((3),"l");
  4500. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)})},
  4501. args: ["aBlock"],
  4502. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4503. messageSends: ["samplesDo:", "value:value:"],
  4504. referencedClasses: []
  4505. }),
  4506. globals.StringTest);
  4507. smalltalk.addMethod(
  4508. smalltalk.method({
  4509. selector: "testAddAll",
  4510. protocol: 'tests',
  4511. fn: function (){
  4512. var self=this;
  4513. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4514. return smalltalk.withContext(function($ctx1) {
  4515. var $1;
  4516. self._should_raise_((function(){
  4517. return smalltalk.withContext(function($ctx2) {
  4518. $1=self._collection();
  4519. $ctx2.sendIdx["collection"]=1;
  4520. return _st($1)._addAll_(self._collection());
  4521. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4522. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)})},
  4523. args: [],
  4524. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4525. messageSends: ["should:raise:", "addAll:", "collection"],
  4526. referencedClasses: ["Error"]
  4527. }),
  4528. globals.StringTest);
  4529. smalltalk.addMethod(
  4530. smalltalk.method({
  4531. selector: "testAddRemove",
  4532. protocol: 'tests',
  4533. fn: function (){
  4534. var self=this;
  4535. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4536. return smalltalk.withContext(function($ctx1) {
  4537. self._should_raise_((function(){
  4538. return smalltalk.withContext(function($ctx2) {
  4539. return "hello"._add_("a");
  4540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4541. $ctx1.sendIdx["should:raise:"]=1;
  4542. self._should_raise_((function(){
  4543. return smalltalk.withContext(function($ctx2) {
  4544. return "hello"._remove_("h");
  4545. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4546. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)})},
  4547. args: [],
  4548. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4549. messageSends: ["should:raise:", "add:", "remove:"],
  4550. referencedClasses: ["Error"]
  4551. }),
  4552. globals.StringTest);
  4553. smalltalk.addMethod(
  4554. smalltalk.method({
  4555. selector: "testAsArray",
  4556. protocol: 'tests',
  4557. fn: function (){
  4558. var self=this;
  4559. return smalltalk.withContext(function($ctx1) {
  4560. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4561. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)})},
  4562. args: [],
  4563. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4564. messageSends: ["assert:equals:", "asArray"],
  4565. referencedClasses: []
  4566. }),
  4567. globals.StringTest);
  4568. smalltalk.addMethod(
  4569. smalltalk.method({
  4570. selector: "testAsLowerCase",
  4571. protocol: 'tests',
  4572. fn: function (){
  4573. var self=this;
  4574. return smalltalk.withContext(function($ctx1) {
  4575. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4576. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)})},
  4577. args: [],
  4578. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4579. messageSends: ["assert:equals:", "asLowercase"],
  4580. referencedClasses: []
  4581. }),
  4582. globals.StringTest);
  4583. smalltalk.addMethod(
  4584. smalltalk.method({
  4585. selector: "testAsNumber",
  4586. protocol: 'tests',
  4587. fn: function (){
  4588. var self=this;
  4589. return smalltalk.withContext(function($ctx1) {
  4590. var $1,$2;
  4591. $1="3"._asNumber();
  4592. $ctx1.sendIdx["asNumber"]=1;
  4593. self._assert_equals_($1,(3));
  4594. $ctx1.sendIdx["assert:equals:"]=1;
  4595. $2="-3"._asNumber();
  4596. $ctx1.sendIdx["asNumber"]=2;
  4597. self._assert_equals_($2,(-3));
  4598. $ctx1.sendIdx["assert:equals:"]=2;
  4599. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4600. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)})},
  4601. args: [],
  4602. 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.",
  4603. messageSends: ["assert:equals:", "asNumber"],
  4604. referencedClasses: []
  4605. }),
  4606. globals.StringTest);
  4607. smalltalk.addMethod(
  4608. smalltalk.method({
  4609. selector: "testAsUpperCase",
  4610. protocol: 'tests',
  4611. fn: function (){
  4612. var self=this;
  4613. return smalltalk.withContext(function($ctx1) {
  4614. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4615. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)})},
  4616. args: [],
  4617. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4618. messageSends: ["assert:equals:", "asUppercase"],
  4619. referencedClasses: []
  4620. }),
  4621. globals.StringTest);
  4622. smalltalk.addMethod(
  4623. smalltalk.method({
  4624. selector: "testAsciiValue",
  4625. protocol: 'tests',
  4626. fn: function (){
  4627. var self=this;
  4628. var characterA,characterU;
  4629. return smalltalk.withContext(function($ctx1) {
  4630. var $1;
  4631. characterA="A";
  4632. characterU="U";
  4633. $1=_st(characterA)._asciiValue();
  4634. $ctx1.sendIdx["asciiValue"]=1;
  4635. self._assert_equals_($1,(65));
  4636. $ctx1.sendIdx["assert:equals:"]=1;
  4637. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4638. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)})},
  4639. args: [],
  4640. 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",
  4641. messageSends: ["assert:equals:", "asciiValue"],
  4642. referencedClasses: []
  4643. }),
  4644. globals.StringTest);
  4645. smalltalk.addMethod(
  4646. smalltalk.method({
  4647. selector: "testAtIfAbsentPut",
  4648. protocol: 'tests',
  4649. fn: function (){
  4650. var self=this;
  4651. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4652. return smalltalk.withContext(function($ctx1) {
  4653. self._should_raise_((function(){
  4654. return smalltalk.withContext(function($ctx2) {
  4655. return "hello"._at_ifAbsentPut_((6),(function(){
  4656. return smalltalk.withContext(function($ctx3) {
  4657. return "a";
  4658. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  4659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4660. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)})},
  4661. args: [],
  4662. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4663. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4664. referencedClasses: ["Error"]
  4665. }),
  4666. globals.StringTest);
  4667. smalltalk.addMethod(
  4668. smalltalk.method({
  4669. selector: "testAtPut",
  4670. protocol: 'tests',
  4671. fn: function (){
  4672. var self=this;
  4673. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4674. return smalltalk.withContext(function($ctx1) {
  4675. self._should_raise_((function(){
  4676. return smalltalk.withContext(function($ctx2) {
  4677. return "hello"._at_put_((1),"a");
  4678. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4679. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)})},
  4680. args: [],
  4681. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4682. messageSends: ["should:raise:", "at:put:"],
  4683. referencedClasses: ["Error"]
  4684. }),
  4685. globals.StringTest);
  4686. smalltalk.addMethod(
  4687. smalltalk.method({
  4688. selector: "testCapitalized",
  4689. protocol: 'tests',
  4690. fn: function (){
  4691. var self=this;
  4692. return smalltalk.withContext(function($ctx1) {
  4693. var $1,$2,$3;
  4694. $1="test"._capitalized();
  4695. $ctx1.sendIdx["capitalized"]=1;
  4696. self._assert_equals_($1,"Test");
  4697. $ctx1.sendIdx["assert:equals:"]=1;
  4698. $2="Test"._capitalized();
  4699. $ctx1.sendIdx["capitalized"]=2;
  4700. self._assert_equals_($2,"Test");
  4701. $ctx1.sendIdx["assert:equals:"]=2;
  4702. self._assert_equals_(""._capitalized(),"");
  4703. $ctx1.sendIdx["assert:equals:"]=3;
  4704. $3="Test"._isCapitalized();
  4705. $ctx1.sendIdx["isCapitalized"]=1;
  4706. self._assert_equals_($3,true);
  4707. $ctx1.sendIdx["assert:equals:"]=4;
  4708. self._assert_equals_("test"._isCapitalized(),false);
  4709. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)})},
  4710. args: [],
  4711. 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.",
  4712. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4713. referencedClasses: []
  4714. }),
  4715. globals.StringTest);
  4716. smalltalk.addMethod(
  4717. smalltalk.method({
  4718. selector: "testCharCodeAt",
  4719. protocol: 'tests',
  4720. fn: function (){
  4721. var self=this;
  4722. return smalltalk.withContext(function($ctx1) {
  4723. var $1,$2,$3,$4,$5;
  4724. $1="jackie"._charCodeAt_((1));
  4725. $ctx1.sendIdx["charCodeAt:"]=1;
  4726. self._assert_equals_($1,(106));
  4727. $ctx1.sendIdx["assert:equals:"]=1;
  4728. $2="jackie"._charCodeAt_((2));
  4729. $ctx1.sendIdx["charCodeAt:"]=2;
  4730. self._assert_equals_($2,(97));
  4731. $ctx1.sendIdx["assert:equals:"]=2;
  4732. $3="jackie"._charCodeAt_((3));
  4733. $ctx1.sendIdx["charCodeAt:"]=3;
  4734. self._assert_equals_($3,(99));
  4735. $ctx1.sendIdx["assert:equals:"]=3;
  4736. $4="jackie"._charCodeAt_((4));
  4737. $ctx1.sendIdx["charCodeAt:"]=4;
  4738. self._assert_equals_($4,(107));
  4739. $ctx1.sendIdx["assert:equals:"]=4;
  4740. $5="jackie"._charCodeAt_((5));
  4741. $ctx1.sendIdx["charCodeAt:"]=5;
  4742. self._assert_equals_($5,(105));
  4743. $ctx1.sendIdx["assert:equals:"]=5;
  4744. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4745. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)})},
  4746. args: [],
  4747. 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",
  4748. messageSends: ["assert:equals:", "charCodeAt:"],
  4749. referencedClasses: []
  4750. }),
  4751. globals.StringTest);
  4752. smalltalk.addMethod(
  4753. smalltalk.method({
  4754. selector: "testCopyFromTo",
  4755. protocol: 'tests',
  4756. fn: function (){
  4757. var self=this;
  4758. return smalltalk.withContext(function($ctx1) {
  4759. var $1;
  4760. $1="jackie"._copyFrom_to_((1),(3));
  4761. $ctx1.sendIdx["copyFrom:to:"]=1;
  4762. self._assert_equals_($1,"jac");
  4763. $ctx1.sendIdx["assert:equals:"]=1;
  4764. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4765. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)})},
  4766. args: [],
  4767. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4768. messageSends: ["assert:equals:", "copyFrom:to:"],
  4769. referencedClasses: []
  4770. }),
  4771. globals.StringTest);
  4772. smalltalk.addMethod(
  4773. smalltalk.method({
  4774. selector: "testCopyWithoutAll",
  4775. protocol: 'tests',
  4776. fn: function (){
  4777. var self=this;
  4778. return smalltalk.withContext(function($ctx1) {
  4779. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4780. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)})},
  4781. args: [],
  4782. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4783. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4784. referencedClasses: []
  4785. }),
  4786. globals.StringTest);
  4787. smalltalk.addMethod(
  4788. smalltalk.method({
  4789. selector: "testEquality",
  4790. protocol: 'tests',
  4791. fn: function (){
  4792. var self=this;
  4793. return smalltalk.withContext(function($ctx1) {
  4794. var $1,$2,$3;
  4795. self._assert_equals_("hello","hello");
  4796. $ctx1.sendIdx["assert:equals:"]=1;
  4797. $1="hello".__eq("world");
  4798. $ctx1.sendIdx["="]=1;
  4799. self._deny_($1);
  4800. $ctx1.sendIdx["deny:"]=1;
  4801. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4802. return smalltalk.withContext(function($ctx2) {
  4803. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  4804. $ctx1.sendIdx["="]=2;
  4805. self._deny_($2);
  4806. $ctx1.sendIdx["deny:"]=2;
  4807. $3="hello"._yourself();
  4808. $ctx1.sendIdx["yourself"]=1;
  4809. self._assert_equals_("hello",$3);
  4810. $ctx1.sendIdx["assert:equals:"]=2;
  4811. self._assert_equals_("hello"._yourself(),"hello");
  4812. self._deny_("".__eq((0)));
  4813. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)})},
  4814. args: [],
  4815. 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",
  4816. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4817. referencedClasses: []
  4818. }),
  4819. globals.StringTest);
  4820. smalltalk.addMethod(
  4821. smalltalk.method({
  4822. selector: "testIdentity",
  4823. protocol: 'tests',
  4824. fn: function (){
  4825. var self=this;
  4826. return smalltalk.withContext(function($ctx1) {
  4827. var $1,$2,$4,$3,$5;
  4828. $1="hello".__eq_eq("hello");
  4829. $ctx1.sendIdx["=="]=1;
  4830. self._assert_($1);
  4831. $ctx1.sendIdx["assert:"]=1;
  4832. $2="hello".__eq_eq("world");
  4833. $ctx1.sendIdx["=="]=2;
  4834. self._deny_($2);
  4835. $ctx1.sendIdx["deny:"]=1;
  4836. $4="hello"._yourself();
  4837. $ctx1.sendIdx["yourself"]=1;
  4838. $3="hello".__eq_eq($4);
  4839. $ctx1.sendIdx["=="]=3;
  4840. self._assert_($3);
  4841. $ctx1.sendIdx["assert:"]=2;
  4842. $5=_st("hello"._yourself()).__eq_eq("hello");
  4843. $ctx1.sendIdx["=="]=4;
  4844. self._assert_($5);
  4845. self._deny_("".__eq_eq((0)));
  4846. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)})},
  4847. args: [],
  4848. 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",
  4849. messageSends: ["assert:", "==", "deny:", "yourself"],
  4850. referencedClasses: []
  4851. }),
  4852. globals.StringTest);
  4853. smalltalk.addMethod(
  4854. smalltalk.method({
  4855. selector: "testIdentityHash",
  4856. protocol: 'tests',
  4857. fn: function (){
  4858. var self=this;
  4859. return smalltalk.withContext(function($ctx1) {
  4860. var $1,$2,$4,$3;
  4861. $1="foo"._identityHash();
  4862. $ctx1.sendIdx["identityHash"]=1;
  4863. $2="foo"._identityHash();
  4864. $ctx1.sendIdx["identityHash"]=2;
  4865. self._assert_equals_($1,$2);
  4866. $4="foo"._identityHash();
  4867. $ctx1.sendIdx["identityHash"]=3;
  4868. $3=_st($4).__eq("bar"._identityHash());
  4869. self._deny_($3);
  4870. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)})},
  4871. args: [],
  4872. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4873. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4874. referencedClasses: []
  4875. }),
  4876. globals.StringTest);
  4877. smalltalk.addMethod(
  4878. smalltalk.method({
  4879. selector: "testIncludesSubString",
  4880. protocol: 'tests',
  4881. fn: function (){
  4882. var self=this;
  4883. return smalltalk.withContext(function($ctx1) {
  4884. var $1;
  4885. $1="amber"._includesSubString_("ber");
  4886. $ctx1.sendIdx["includesSubString:"]=1;
  4887. self._assert_($1);
  4888. self._deny_("amber"._includesSubString_("zork"));
  4889. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)})},
  4890. args: [],
  4891. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4892. messageSends: ["assert:", "includesSubString:", "deny:"],
  4893. referencedClasses: []
  4894. }),
  4895. globals.StringTest);
  4896. smalltalk.addMethod(
  4897. smalltalk.method({
  4898. selector: "testIndexOfStartingAtWithNull",
  4899. protocol: 'tests',
  4900. fn: function (){
  4901. var self=this;
  4902. return self},
  4903. args: [],
  4904. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4905. messageSends: [],
  4906. referencedClasses: []
  4907. }),
  4908. globals.StringTest);
  4909. smalltalk.addMethod(
  4910. smalltalk.method({
  4911. selector: "testIndexOfWithNull",
  4912. protocol: 'tests',
  4913. fn: function (){
  4914. var self=this;
  4915. return self},
  4916. args: [],
  4917. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4918. messageSends: [],
  4919. referencedClasses: []
  4920. }),
  4921. globals.StringTest);
  4922. smalltalk.addMethod(
  4923. smalltalk.method({
  4924. selector: "testIsVowel",
  4925. protocol: 'tests',
  4926. fn: function (){
  4927. var self=this;
  4928. var vowel,consonant;
  4929. return smalltalk.withContext(function($ctx1) {
  4930. var $1;
  4931. vowel="u";
  4932. consonant="z";
  4933. $1=_st(vowel)._isVowel();
  4934. $ctx1.sendIdx["isVowel"]=1;
  4935. self._assert_equals_($1,true);
  4936. $ctx1.sendIdx["assert:equals:"]=1;
  4937. self._assert_equals_(_st(consonant)._isVowel(),false);
  4938. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)})},
  4939. args: [],
  4940. 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",
  4941. messageSends: ["assert:equals:", "isVowel"],
  4942. referencedClasses: []
  4943. }),
  4944. globals.StringTest);
  4945. smalltalk.addMethod(
  4946. smalltalk.method({
  4947. selector: "testJoin",
  4948. protocol: 'tests',
  4949. fn: function (){
  4950. var self=this;
  4951. return smalltalk.withContext(function($ctx1) {
  4952. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4953. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)})},
  4954. args: [],
  4955. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4956. messageSends: ["assert:equals:", "join:"],
  4957. referencedClasses: []
  4958. }),
  4959. globals.StringTest);
  4960. smalltalk.addMethod(
  4961. smalltalk.method({
  4962. selector: "testRemoveAll",
  4963. protocol: 'tests',
  4964. fn: function (){
  4965. var self=this;
  4966. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4967. return smalltalk.withContext(function($ctx1) {
  4968. self._should_raise_((function(){
  4969. return smalltalk.withContext(function($ctx2) {
  4970. return _st(self._collection())._removeAll();
  4971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4972. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)})},
  4973. args: [],
  4974. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4975. messageSends: ["should:raise:", "removeAll", "collection"],
  4976. referencedClasses: ["Error"]
  4977. }),
  4978. globals.StringTest);
  4979. smalltalk.addMethod(
  4980. smalltalk.method({
  4981. selector: "testReversed",
  4982. protocol: 'tests',
  4983. fn: function (){
  4984. var self=this;
  4985. return smalltalk.withContext(function($ctx1) {
  4986. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4987. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)})},
  4988. args: [],
  4989. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4990. messageSends: ["assert:equals:", "reversed"],
  4991. referencedClasses: []
  4992. }),
  4993. globals.StringTest);
  4994. smalltalk.addMethod(
  4995. smalltalk.method({
  4996. selector: "testStreamContents",
  4997. protocol: 'tests',
  4998. fn: function (){
  4999. var self=this;
  5000. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5001. return smalltalk.withContext(function($ctx1) {
  5002. var $1;
  5003. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  5004. return smalltalk.withContext(function($ctx2) {
  5005. _st(aStream)._nextPutAll_("hello");
  5006. $ctx2.sendIdx["nextPutAll:"]=1;
  5007. _st(aStream)._space();
  5008. $1=_st(aStream)._nextPutAll_("world");
  5009. return $1;
  5010. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  5011. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)})},
  5012. args: [],
  5013. 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'",
  5014. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  5015. referencedClasses: ["String"]
  5016. }),
  5017. globals.StringTest);
  5018. smalltalk.addMethod(
  5019. smalltalk.method({
  5020. selector: "testSubStrings",
  5021. protocol: 'tests',
  5022. fn: function (){
  5023. var self=this;
  5024. return smalltalk.withContext(function($ctx1) {
  5025. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  5026. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)})},
  5027. args: [],
  5028. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  5029. messageSends: ["assert:equals:", "subStrings:"],
  5030. referencedClasses: []
  5031. }),
  5032. globals.StringTest);
  5033. smalltalk.addMethod(
  5034. smalltalk.method({
  5035. selector: "testTrim",
  5036. protocol: 'tests',
  5037. fn: function (){
  5038. var self=this;
  5039. return smalltalk.withContext(function($ctx1) {
  5040. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  5041. $ctx1.sendIdx["assert:equals:"]=1;
  5042. self._assert_equals_("jackie "._trimRight(),"jackie");
  5043. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)})},
  5044. args: [],
  5045. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  5046. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  5047. referencedClasses: []
  5048. }),
  5049. globals.StringTest);
  5050. smalltalk.addMethod(
  5051. smalltalk.method({
  5052. selector: "collectionClass",
  5053. protocol: 'fixture',
  5054. fn: function (){
  5055. var self=this;
  5056. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5057. return $String();
  5058. },
  5059. args: [],
  5060. source: "collectionClass\x0a\x09^ String",
  5061. messageSends: [],
  5062. referencedClasses: ["String"]
  5063. }),
  5064. globals.StringTest.klass);
  5065. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  5066. smalltalk.addMethod(
  5067. smalltalk.method({
  5068. selector: "collection",
  5069. protocol: 'fixture',
  5070. fn: function (){
  5071. var self=this;
  5072. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5073. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5074. return smalltalk.withContext(function($ctx1) {
  5075. var $2,$3,$1;
  5076. $2=_st($Set())._new();
  5077. _st($2)._add_($Smalltalk());
  5078. $ctx1.sendIdx["add:"]=1;
  5079. _st($2)._add_(nil);
  5080. $ctx1.sendIdx["add:"]=2;
  5081. _st($2)._add_((3).__at((3)));
  5082. $ctx1.sendIdx["add:"]=3;
  5083. _st($2)._add_(false);
  5084. $3=_st($2)._yourself();
  5085. $1=$3;
  5086. return $1;
  5087. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)})},
  5088. args: [],
  5089. 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",
  5090. messageSends: ["add:", "new", "@", "yourself"],
  5091. referencedClasses: ["Set", "Smalltalk"]
  5092. }),
  5093. globals.SetTest);
  5094. smalltalk.addMethod(
  5095. smalltalk.method({
  5096. selector: "collectionOfPrintStrings",
  5097. protocol: 'fixture',
  5098. fn: function (){
  5099. var self=this;
  5100. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5101. return smalltalk.withContext(function($ctx1) {
  5102. var $2,$3,$1;
  5103. $2=_st($Set())._new();
  5104. _st($2)._add_("a SmalltalkImage");
  5105. $ctx1.sendIdx["add:"]=1;
  5106. _st($2)._add_("nil");
  5107. $ctx1.sendIdx["add:"]=2;
  5108. _st($2)._add_("3@3");
  5109. $ctx1.sendIdx["add:"]=3;
  5110. _st($2)._add_("false");
  5111. $3=_st($2)._yourself();
  5112. $1=$3;
  5113. return $1;
  5114. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)})},
  5115. args: [],
  5116. 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",
  5117. messageSends: ["add:", "new", "yourself"],
  5118. referencedClasses: ["Set"]
  5119. }),
  5120. globals.SetTest);
  5121. smalltalk.addMethod(
  5122. smalltalk.method({
  5123. selector: "collectionSize",
  5124. protocol: 'fixture',
  5125. fn: function (){
  5126. var self=this;
  5127. return (4);
  5128. },
  5129. args: [],
  5130. source: "collectionSize\x0a\x09^ 4",
  5131. messageSends: [],
  5132. referencedClasses: []
  5133. }),
  5134. globals.SetTest);
  5135. smalltalk.addMethod(
  5136. smalltalk.method({
  5137. selector: "collectionWithDuplicates",
  5138. protocol: 'fixture',
  5139. fn: function (){
  5140. var self=this;
  5141. return smalltalk.withContext(function($ctx1) {
  5142. var $2,$3,$1;
  5143. $2=self._collection();
  5144. _st($2)._add_((0));
  5145. $3=_st($2)._yourself();
  5146. $1=$3;
  5147. return $1;
  5148. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)})},
  5149. args: [],
  5150. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5151. messageSends: ["add:", "collection", "yourself"],
  5152. referencedClasses: []
  5153. }),
  5154. globals.SetTest);
  5155. smalltalk.addMethod(
  5156. smalltalk.method({
  5157. selector: "collectionWithNewValue",
  5158. protocol: 'fixture',
  5159. fn: function (){
  5160. var self=this;
  5161. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5162. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5163. return smalltalk.withContext(function($ctx1) {
  5164. var $2,$3,$1;
  5165. $2=_st($Set())._new();
  5166. _st($2)._add_($Smalltalk());
  5167. $ctx1.sendIdx["add:"]=1;
  5168. _st($2)._add_(nil);
  5169. $ctx1.sendIdx["add:"]=2;
  5170. _st($2)._add_((3).__at((3)));
  5171. $ctx1.sendIdx["add:"]=3;
  5172. _st($2)._add_("N");
  5173. $ctx1.sendIdx["add:"]=4;
  5174. _st($2)._add_(false);
  5175. $3=_st($2)._yourself();
  5176. $1=$3;
  5177. return $1;
  5178. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)})},
  5179. args: [],
  5180. 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",
  5181. messageSends: ["add:", "new", "@", "yourself"],
  5182. referencedClasses: ["Set", "Smalltalk"]
  5183. }),
  5184. globals.SetTest);
  5185. smalltalk.addMethod(
  5186. smalltalk.method({
  5187. selector: "testAddAll",
  5188. protocol: 'tests',
  5189. fn: function (){
  5190. var self=this;
  5191. return smalltalk.withContext(function($ctx1) {
  5192. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5193. globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  5194. $2=self._collection();
  5195. $ctx1.sendIdx["collection"]=1;
  5196. $3=$2;
  5197. $4=self._collection();
  5198. $ctx1.sendIdx["collection"]=2;
  5199. _st($3)._addAll_($4);
  5200. $ctx1.sendIdx["addAll:"]=1;
  5201. $5=_st($2)._yourself();
  5202. $ctx1.sendIdx["yourself"]=1;
  5203. $1=$5;
  5204. $6=self._collection();
  5205. $ctx1.sendIdx["collection"]=3;
  5206. self._assert_equals_($1,$6);
  5207. $ctx1.sendIdx["assert:equals:"]=1;
  5208. $8=self._collection();
  5209. $ctx1.sendIdx["collection"]=4;
  5210. $9=$8;
  5211. $10=self._collectionWithNewValue();
  5212. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5213. _st($9)._addAll_($10);
  5214. $ctx1.sendIdx["addAll:"]=2;
  5215. $11=_st($8)._yourself();
  5216. $ctx1.sendIdx["yourself"]=2;
  5217. $7=$11;
  5218. $12=self._collectionWithNewValue();
  5219. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5220. self._assert_equals_($7,$12);
  5221. $ctx1.sendIdx["assert:equals:"]=2;
  5222. $14=self._collectionWithNewValue();
  5223. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5224. _st($14)._addAll_(self._collection());
  5225. $15=_st($14)._yourself();
  5226. $13=$15;
  5227. self._assert_equals_($13,self._collectionWithNewValue());
  5228. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)})},
  5229. args: [],
  5230. 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",
  5231. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5232. referencedClasses: []
  5233. }),
  5234. globals.SetTest);
  5235. smalltalk.addMethod(
  5236. smalltalk.method({
  5237. selector: "testAddRemove",
  5238. protocol: 'tests',
  5239. fn: function (){
  5240. var self=this;
  5241. var set;
  5242. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5243. return smalltalk.withContext(function($ctx1) {
  5244. var $1,$2;
  5245. set=_st($Set())._new();
  5246. self._assert_(_st(set)._isEmpty());
  5247. $ctx1.sendIdx["assert:"]=1;
  5248. _st(set)._add_((3));
  5249. $ctx1.sendIdx["add:"]=1;
  5250. $1=_st(set)._includes_((3));
  5251. $ctx1.sendIdx["includes:"]=1;
  5252. self._assert_($1);
  5253. $ctx1.sendIdx["assert:"]=2;
  5254. _st(set)._add_((5));
  5255. $2=_st(set)._includes_((5));
  5256. $ctx1.sendIdx["includes:"]=2;
  5257. self._assert_($2);
  5258. _st(set)._remove_((3));
  5259. self._deny_(_st(set)._includes_((3)));
  5260. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)})},
  5261. args: [],
  5262. 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)",
  5263. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5264. referencedClasses: ["Set"]
  5265. }),
  5266. globals.SetTest);
  5267. smalltalk.addMethod(
  5268. smalltalk.method({
  5269. selector: "testAt",
  5270. protocol: 'tests',
  5271. fn: function (){
  5272. var self=this;
  5273. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5274. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5275. return smalltalk.withContext(function($ctx1) {
  5276. self._should_raise_((function(){
  5277. return smalltalk.withContext(function($ctx2) {
  5278. return _st(_st($Set())._new())._at_put_((1),(2));
  5279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5280. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)})},
  5281. args: [],
  5282. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5283. messageSends: ["should:raise:", "at:put:", "new"],
  5284. referencedClasses: ["Set", "Error"]
  5285. }),
  5286. globals.SetTest);
  5287. smalltalk.addMethod(
  5288. smalltalk.method({
  5289. selector: "testCollect",
  5290. protocol: 'tests',
  5291. fn: function (){
  5292. var self=this;
  5293. return smalltalk.withContext(function($ctx1) {
  5294. var $2,$1;
  5295. globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  5296. $2=[(5), (6), (8)]._asSet();
  5297. $ctx1.sendIdx["asSet"]=1;
  5298. $1=_st($2)._collect_((function(x){
  5299. return smalltalk.withContext(function($ctx2) {
  5300. return _st(x).__backslash_backslash((3));
  5301. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5302. self._assert_equals_($1,[(0), (2)]._asSet());
  5303. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)})},
  5304. args: [],
  5305. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5306. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5307. referencedClasses: []
  5308. }),
  5309. globals.SetTest);
  5310. smalltalk.addMethod(
  5311. smalltalk.method({
  5312. selector: "testComma",
  5313. protocol: 'tests',
  5314. fn: function (){
  5315. var self=this;
  5316. return smalltalk.withContext(function($ctx1) {
  5317. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5318. globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  5319. $2=self._collection();
  5320. $ctx1.sendIdx["collection"]=1;
  5321. $3=self._collection();
  5322. $ctx1.sendIdx["collection"]=2;
  5323. $1=_st($2).__comma($3);
  5324. $ctx1.sendIdx[","]=1;
  5325. $4=self._collection();
  5326. $ctx1.sendIdx["collection"]=3;
  5327. self._assert_equals_($1,$4);
  5328. $ctx1.sendIdx["assert:equals:"]=1;
  5329. $6=self._collection();
  5330. $ctx1.sendIdx["collection"]=4;
  5331. $7=self._collectionWithNewValue();
  5332. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5333. $5=_st($6).__comma($7);
  5334. $ctx1.sendIdx[","]=2;
  5335. $8=self._collectionWithNewValue();
  5336. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5337. self._assert_equals_($5,$8);
  5338. $ctx1.sendIdx["assert:equals:"]=2;
  5339. $10=self._collectionWithNewValue();
  5340. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5341. $9=_st($10).__comma(self._collection());
  5342. self._assert_equals_($9,self._collectionWithNewValue());
  5343. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)})},
  5344. args: [],
  5345. 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",
  5346. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5347. referencedClasses: []
  5348. }),
  5349. globals.SetTest);
  5350. smalltalk.addMethod(
  5351. smalltalk.method({
  5352. selector: "testComparing",
  5353. protocol: 'tests',
  5354. fn: function (){
  5355. var self=this;
  5356. return smalltalk.withContext(function($ctx1) {
  5357. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5358. $1=[(0), (2)]._asSet();
  5359. $ctx1.sendIdx["asSet"]=1;
  5360. $2=[(0), (2)]._asSet();
  5361. $ctx1.sendIdx["asSet"]=2;
  5362. self._assert_equals_($1,$2);
  5363. $ctx1.sendIdx["assert:equals:"]=1;
  5364. $3=[(2), (0)]._asSet();
  5365. $ctx1.sendIdx["asSet"]=3;
  5366. $4=[(0), (2)]._asSet();
  5367. $ctx1.sendIdx["asSet"]=4;
  5368. self._assert_equals_($3,$4);
  5369. $6=[(0), (2), (3)]._asSet();
  5370. $ctx1.sendIdx["asSet"]=5;
  5371. $7=[(0), (2)]._asSet();
  5372. $ctx1.sendIdx["asSet"]=6;
  5373. $5=_st($6).__eq($7);
  5374. $ctx1.sendIdx["="]=1;
  5375. self._deny_($5);
  5376. $ctx1.sendIdx["deny:"]=1;
  5377. $9=[(1), (2)]._asSet();
  5378. $ctx1.sendIdx["asSet"]=7;
  5379. $8=_st($9).__eq([(0), (2)]._asSet());
  5380. self._deny_($8);
  5381. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)})},
  5382. args: [],
  5383. 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",
  5384. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5385. referencedClasses: []
  5386. }),
  5387. globals.SetTest);
  5388. smalltalk.addMethod(
  5389. smalltalk.method({
  5390. selector: "testPrintString",
  5391. protocol: 'tests',
  5392. fn: function (){
  5393. var self=this;
  5394. var set;
  5395. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5396. return smalltalk.withContext(function($ctx1) {
  5397. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5398. set=_st($Set())._new();
  5399. $1=_st(set)._printString();
  5400. $ctx1.sendIdx["printString"]=1;
  5401. self._assert_equals_($1,"a Set ()");
  5402. $ctx1.sendIdx["assert:equals:"]=1;
  5403. $2=set;
  5404. _st($2)._add_((1));
  5405. $ctx1.sendIdx["add:"]=1;
  5406. $3=_st($2)._add_((3));
  5407. $ctx1.sendIdx["add:"]=2;
  5408. $4=_st(set)._printString();
  5409. $ctx1.sendIdx["printString"]=2;
  5410. self._assert_equals_($4,"a Set (1 3)");
  5411. $ctx1.sendIdx["assert:equals:"]=2;
  5412. _st(set)._add_("foo");
  5413. $ctx1.sendIdx["add:"]=3;
  5414. $5=_st(set)._printString();
  5415. $ctx1.sendIdx["printString"]=3;
  5416. self._assert_equals_($5,"a Set (1 3 'foo')");
  5417. $ctx1.sendIdx["assert:equals:"]=3;
  5418. $6=set;
  5419. _st($6)._remove_((1));
  5420. $ctx1.sendIdx["remove:"]=1;
  5421. $7=_st($6)._remove_((3));
  5422. $8=_st(set)._printString();
  5423. $ctx1.sendIdx["printString"]=4;
  5424. self._assert_equals_($8,"a Set ('foo')");
  5425. $ctx1.sendIdx["assert:equals:"]=4;
  5426. _st(set)._add_((3));
  5427. $ctx1.sendIdx["add:"]=4;
  5428. $9=_st(set)._printString();
  5429. $ctx1.sendIdx["printString"]=5;
  5430. self._assert_equals_($9,"a Set (3 'foo')");
  5431. $ctx1.sendIdx["assert:equals:"]=5;
  5432. _st(set)._add_((3));
  5433. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5434. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)})},
  5435. args: [],
  5436. 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'')'",
  5437. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5438. referencedClasses: ["Set"]
  5439. }),
  5440. globals.SetTest);
  5441. smalltalk.addMethod(
  5442. smalltalk.method({
  5443. selector: "testUnboxedObjects",
  5444. protocol: 'tests',
  5445. fn: function (){
  5446. var self=this;
  5447. return smalltalk.withContext(function($ctx1) {
  5448. var $4,$3,$2,$1;
  5449. $4="foo"._yourself();
  5450. $ctx1.sendIdx["yourself"]=1;
  5451. $3=[$4,"foo"._yourself()];
  5452. $2=_st($3)._asSet();
  5453. $1=_st($2)._asArray();
  5454. self._assert_equals_($1,["foo"]);
  5455. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)})},
  5456. args: [],
  5457. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5458. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5459. referencedClasses: []
  5460. }),
  5461. globals.SetTest);
  5462. smalltalk.addMethod(
  5463. smalltalk.method({
  5464. selector: "testUnicity",
  5465. protocol: 'tests',
  5466. fn: function (){
  5467. var self=this;
  5468. var set;
  5469. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5470. return smalltalk.withContext(function($ctx1) {
  5471. var $1;
  5472. set=_st($Set())._new();
  5473. _st(set)._add_((21));
  5474. $ctx1.sendIdx["add:"]=1;
  5475. _st(set)._add_("hello");
  5476. $ctx1.sendIdx["add:"]=2;
  5477. _st(set)._add_((21));
  5478. $ctx1.sendIdx["add:"]=3;
  5479. $1=_st(set)._size();
  5480. $ctx1.sendIdx["size"]=1;
  5481. self._assert_equals_($1,(2));
  5482. $ctx1.sendIdx["assert:equals:"]=1;
  5483. _st(set)._add_("hello");
  5484. self._assert_equals_(_st(set)._size(),(2));
  5485. $ctx1.sendIdx["assert:equals:"]=2;
  5486. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5487. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)})},
  5488. args: [],
  5489. 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')",
  5490. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5491. referencedClasses: ["Set"]
  5492. }),
  5493. globals.SetTest);
  5494. smalltalk.addMethod(
  5495. smalltalk.method({
  5496. selector: "collectionClass",
  5497. protocol: 'fixture',
  5498. fn: function (){
  5499. var self=this;
  5500. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5501. return $Set();
  5502. },
  5503. args: [],
  5504. source: "collectionClass\x0a\x09^ Set",
  5505. messageSends: [],
  5506. referencedClasses: ["Set"]
  5507. }),
  5508. globals.SetTest.klass);
  5509. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  5510. smalltalk.addMethod(
  5511. smalltalk.method({
  5512. selector: "testShow",
  5513. protocol: 'tests',
  5514. fn: function (){
  5515. var self=this;
  5516. var originalTranscript;
  5517. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5518. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5519. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5520. return smalltalk.withContext(function($ctx1) {
  5521. originalTranscript=_st($Transcript())._current();
  5522. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5523. $ctx1.sendIdx["register:"]=1;
  5524. self._shouldnt_raise_((function(){
  5525. return smalltalk.withContext(function($ctx2) {
  5526. return _st($Transcript())._show_("Hello console!");
  5527. $ctx2.sendIdx["show:"]=1;
  5528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5529. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5530. self._shouldnt_raise_((function(){
  5531. return smalltalk.withContext(function($ctx2) {
  5532. return _st($Transcript())._show_(console);
  5533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5534. _st($Transcript())._register_(originalTranscript);
  5535. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)})},
  5536. args: [],
  5537. 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.",
  5538. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5539. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5540. }),
  5541. globals.ConsoleTranscriptTest);
  5542. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  5543. smalltalk.addMethod(
  5544. smalltalk.method({
  5545. selector: "jsObject",
  5546. protocol: 'accessing',
  5547. fn: function (){
  5548. var self=this;
  5549. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5550. return self},
  5551. args: [],
  5552. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5553. messageSends: [],
  5554. referencedClasses: []
  5555. }),
  5556. globals.JSObjectProxyTest);
  5557. smalltalk.addMethod(
  5558. smalltalk.method({
  5559. selector: "testAtIfAbsent",
  5560. protocol: 'tests',
  5561. fn: function (){
  5562. var self=this;
  5563. var testObject;
  5564. return smalltalk.withContext(function($ctx1) {
  5565. var $1,$2,$3;
  5566. testObject=self._jsObject();
  5567. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5568. return smalltalk.withContext(function($ctx2) {
  5569. return "Property does not exist";
  5570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5571. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5572. self._assert_equals_($1,"Property does not exist");
  5573. $ctx1.sendIdx["assert:equals:"]=1;
  5574. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5575. return smalltalk.withContext(function($ctx2) {
  5576. return "Property does not exist";
  5577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5578. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5579. self._assert_equals_($2,nil);
  5580. $ctx1.sendIdx["assert:equals:"]=2;
  5581. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5582. return smalltalk.withContext(function($ctx2) {
  5583. return "Property does not exist";
  5584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  5585. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5586. self._assert_equals_($3,(1));
  5587. $ctx1.sendIdx["assert:equals:"]=3;
  5588. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5589. return smalltalk.withContext(function($ctx2) {
  5590. return "Property does not exist";
  5591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  5592. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5593. args: [],
  5594. 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.",
  5595. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5596. referencedClasses: []
  5597. }),
  5598. globals.JSObjectProxyTest);
  5599. smalltalk.addMethod(
  5600. smalltalk.method({
  5601. selector: "testAtIfPresent",
  5602. protocol: 'tests',
  5603. fn: function (){
  5604. var self=this;
  5605. var testObject;
  5606. return smalltalk.withContext(function($ctx1) {
  5607. var $2,$1,$4,$3,$6,$5;
  5608. testObject=self._jsObject();
  5609. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5610. return smalltalk.withContext(function($ctx2) {
  5611. $2=_st(x)._asString();
  5612. $ctx2.sendIdx["asString"]=1;
  5613. return "hello ".__comma($2);
  5614. $ctx2.sendIdx[","]=1;
  5615. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5616. $ctx1.sendIdx["at:ifPresent:"]=1;
  5617. self._assert_equals_($1,nil);
  5618. $ctx1.sendIdx["assert:equals:"]=1;
  5619. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5620. return smalltalk.withContext(function($ctx2) {
  5621. $4=_st(x)._asString();
  5622. $ctx2.sendIdx["asString"]=2;
  5623. return "hello ".__comma($4);
  5624. $ctx2.sendIdx[","]=2;
  5625. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5626. $ctx1.sendIdx["at:ifPresent:"]=2;
  5627. self._assert_equals_($3,"hello nil");
  5628. $ctx1.sendIdx["assert:equals:"]=2;
  5629. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5630. return smalltalk.withContext(function($ctx2) {
  5631. $6=_st(x)._asString();
  5632. $ctx2.sendIdx["asString"]=3;
  5633. return "hello ".__comma($6);
  5634. $ctx2.sendIdx[","]=3;
  5635. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5636. $ctx1.sendIdx["at:ifPresent:"]=3;
  5637. self._assert_equals_($5,"hello 1");
  5638. $ctx1.sendIdx["assert:equals:"]=3;
  5639. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5640. return smalltalk.withContext(function($ctx2) {
  5641. return "hello ".__comma(_st(x)._asString());
  5642. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5643. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5644. args: [],
  5645. 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'.",
  5646. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5647. referencedClasses: []
  5648. }),
  5649. globals.JSObjectProxyTest);
  5650. smalltalk.addMethod(
  5651. smalltalk.method({
  5652. selector: "testAtIfPresentIfAbsent",
  5653. protocol: 'tests',
  5654. fn: function (){
  5655. var self=this;
  5656. var testObject;
  5657. return smalltalk.withContext(function($ctx1) {
  5658. var $2,$1,$4,$3,$6,$5;
  5659. testObject=self._jsObject();
  5660. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5661. return smalltalk.withContext(function($ctx2) {
  5662. $2=_st(x)._asString();
  5663. $ctx2.sendIdx["asString"]=1;
  5664. return "hello ".__comma($2);
  5665. $ctx2.sendIdx[","]=1;
  5666. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5667. return smalltalk.withContext(function($ctx2) {
  5668. return "not present";
  5669. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5670. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5671. self._assert_equals_($1,"not present");
  5672. $ctx1.sendIdx["assert:equals:"]=1;
  5673. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5674. return smalltalk.withContext(function($ctx2) {
  5675. $4=_st(x)._asString();
  5676. $ctx2.sendIdx["asString"]=2;
  5677. return "hello ".__comma($4);
  5678. $ctx2.sendIdx[","]=2;
  5679. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5680. return smalltalk.withContext(function($ctx2) {
  5681. return "not present";
  5682. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5683. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5684. self._assert_equals_($3,"hello nil");
  5685. $ctx1.sendIdx["assert:equals:"]=2;
  5686. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5687. return smalltalk.withContext(function($ctx2) {
  5688. $6=_st(x)._asString();
  5689. $ctx2.sendIdx["asString"]=3;
  5690. return "hello ".__comma($6);
  5691. $ctx2.sendIdx[","]=3;
  5692. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5693. return smalltalk.withContext(function($ctx2) {
  5694. return "not present";
  5695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5696. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5697. self._assert_equals_($5,"hello 1");
  5698. $ctx1.sendIdx["assert:equals:"]=3;
  5699. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5700. return smalltalk.withContext(function($ctx2) {
  5701. return "hello ".__comma(_st(x)._asString());
  5702. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5703. return smalltalk.withContext(function($ctx2) {
  5704. return "not present";
  5705. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  5706. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5707. args: [],
  5708. 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'.",
  5709. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5710. referencedClasses: []
  5711. }),
  5712. globals.JSObjectProxyTest);
  5713. smalltalk.addMethod(
  5714. smalltalk.method({
  5715. selector: "testAtPut",
  5716. protocol: 'tests',
  5717. fn: function (){
  5718. var self=this;
  5719. var testObject;
  5720. return smalltalk.withContext(function($ctx1) {
  5721. var $2,$1;
  5722. testObject=self._jsObject();
  5723. $2=_st(testObject)._at_("abc");
  5724. $ctx1.sendIdx["at:"]=1;
  5725. $1=_st($2).__tild_eq("xyz");
  5726. self._assert_($1);
  5727. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5728. $ctx1.sendIdx["assert:equals:"]=1;
  5729. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5730. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)})},
  5731. args: [],
  5732. 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'",
  5733. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5734. referencedClasses: []
  5735. }),
  5736. globals.JSObjectProxyTest);
  5737. smalltalk.addMethod(
  5738. smalltalk.method({
  5739. selector: "testComparison",
  5740. protocol: 'tests',
  5741. fn: function (){
  5742. var self=this;
  5743. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5744. return smalltalk.withContext(function($ctx1) {
  5745. var $1,$2;
  5746. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  5747. $1=_st(console).__eq(console);
  5748. $ctx1.sendIdx["="]=1;
  5749. self._assert_($1);
  5750. $2=_st(console).__eq(_st($Object())._new());
  5751. $ctx1.sendIdx["="]=2;
  5752. self._deny_($2);
  5753. $ctx1.sendIdx["deny:"]=1;
  5754. self._deny_(_st(console).__eq(self._jsObject()));
  5755. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)})},
  5756. args: [],
  5757. 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",
  5758. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"],
  5759. referencedClasses: ["Object"]
  5760. }),
  5761. globals.JSObjectProxyTest);
  5762. smalltalk.addMethod(
  5763. smalltalk.method({
  5764. selector: "testDNU",
  5765. protocol: 'tests',
  5766. fn: function (){
  5767. var self=this;
  5768. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5769. return smalltalk.withContext(function($ctx1) {
  5770. self._should_raise_((function(){
  5771. return smalltalk.withContext(function($ctx2) {
  5772. return _st(self._jsObject())._foo();
  5773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5774. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)})},
  5775. args: [],
  5776. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5777. messageSends: ["should:raise:", "foo", "jsObject"],
  5778. referencedClasses: ["MessageNotUnderstood"]
  5779. }),
  5780. globals.JSObjectProxyTest);
  5781. smalltalk.addMethod(
  5782. smalltalk.method({
  5783. selector: "testMessageSend",
  5784. protocol: 'tests',
  5785. fn: function (){
  5786. var self=this;
  5787. return smalltalk.withContext(function($ctx1) {
  5788. var $2,$1,$4,$3;
  5789. $2=self._jsObject();
  5790. $ctx1.sendIdx["jsObject"]=1;
  5791. $1=_st($2)._a();
  5792. self._assert_equals_($1,(1));
  5793. $ctx1.sendIdx["assert:equals:"]=1;
  5794. $4=self._jsObject();
  5795. $ctx1.sendIdx["jsObject"]=2;
  5796. $3=_st($4)._b();
  5797. self._assert_equals_($3,(2));
  5798. $ctx1.sendIdx["assert:equals:"]=2;
  5799. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5800. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)})},
  5801. args: [],
  5802. 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",
  5803. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5804. referencedClasses: []
  5805. }),
  5806. globals.JSObjectProxyTest);
  5807. smalltalk.addMethod(
  5808. smalltalk.method({
  5809. selector: "testMethodWithArguments",
  5810. protocol: 'tests',
  5811. fn: function (){
  5812. var self=this;
  5813. return smalltalk.withContext(function($ctx1) {
  5814. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5815. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)})},
  5816. args: [],
  5817. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5818. messageSends: ["assert:equals:", "c:", "jsObject"],
  5819. referencedClasses: []
  5820. }),
  5821. globals.JSObjectProxyTest);
  5822. smalltalk.addMethod(
  5823. smalltalk.method({
  5824. selector: "testPrinting",
  5825. protocol: 'tests',
  5826. fn: function (){
  5827. var self=this;
  5828. return smalltalk.withContext(function($ctx1) {
  5829. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5830. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)})},
  5831. args: [],
  5832. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5833. messageSends: ["assert:equals:", "printString", "jsObject"],
  5834. referencedClasses: []
  5835. }),
  5836. globals.JSObjectProxyTest);
  5837. smalltalk.addMethod(
  5838. smalltalk.method({
  5839. selector: "testPropertyThatReturnsEmptyString",
  5840. protocol: 'tests',
  5841. fn: function (){
  5842. var self=this;
  5843. var object;
  5844. return smalltalk.withContext(function($ctx1) {
  5845. var $1;
  5846. object=self._jsObject();
  5847. $1=_st(object)._d();
  5848. $ctx1.sendIdx["d"]=1;
  5849. self._assert_equals_($1,"");
  5850. $ctx1.sendIdx["assert:equals:"]=1;
  5851. _st(object)._d_("hello");
  5852. self._assert_equals_(_st(object)._d(),"hello");
  5853. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)})},
  5854. args: [],
  5855. 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'",
  5856. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5857. referencedClasses: []
  5858. }),
  5859. globals.JSObjectProxyTest);
  5860. smalltalk.addMethod(
  5861. smalltalk.method({
  5862. selector: "testPropertyThatReturnsUndefined",
  5863. protocol: 'tests',
  5864. fn: function (){
  5865. var self=this;
  5866. var object;
  5867. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5868. return smalltalk.withContext(function($ctx1) {
  5869. object=self._jsObject();
  5870. self._shouldnt_raise_((function(){
  5871. return smalltalk.withContext(function($ctx2) {
  5872. return _st(object)._e();
  5873. $ctx2.sendIdx["e"]=1;
  5874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5875. self._assert_(_st(_st(object)._e())._isNil());
  5876. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)})},
  5877. args: [],
  5878. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5879. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5880. referencedClasses: ["MessageNotUnderstood"]
  5881. }),
  5882. globals.JSObjectProxyTest);
  5883. smalltalk.addMethod(
  5884. smalltalk.method({
  5885. selector: "testValue",
  5886. protocol: 'tests',
  5887. fn: function (){
  5888. var self=this;
  5889. var testObject;
  5890. return smalltalk.withContext(function($ctx1) {
  5891. testObject=self._jsObject();
  5892. _st(testObject)._at_put_("value","aValue");
  5893. self._assert_equals_(_st(testObject)._value(),"aValue");
  5894. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)})},
  5895. args: [],
  5896. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5897. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5898. referencedClasses: []
  5899. }),
  5900. globals.JSObjectProxyTest);
  5901. smalltalk.addMethod(
  5902. smalltalk.method({
  5903. selector: "testYourself",
  5904. protocol: 'tests',
  5905. fn: function (){
  5906. var self=this;
  5907. var object;
  5908. return smalltalk.withContext(function($ctx1) {
  5909. var $1,$2;
  5910. $1=self._jsObject();
  5911. _st($1)._d_("test");
  5912. $2=_st($1)._yourself();
  5913. object=$2;
  5914. self._assert_equals_(_st(object)._d(),"test");
  5915. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)})},
  5916. args: [],
  5917. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5918. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5919. referencedClasses: []
  5920. }),
  5921. globals.JSObjectProxyTest);
  5922. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  5923. smalltalk.addMethod(
  5924. smalltalk.method({
  5925. selector: "testCatchingException",
  5926. protocol: 'tests',
  5927. fn: function (){
  5928. var self=this;
  5929. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5930. return smalltalk.withContext(function($ctx1) {
  5931. _st((function(){
  5932. return smalltalk.withContext(function($ctx2) {
  5933. return self._throwException();
  5934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5935. return smalltalk.withContext(function($ctx2) {
  5936. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5937. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5938. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)})},
  5939. args: [],
  5940. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5941. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5942. referencedClasses: ["Error"]
  5943. }),
  5944. globals.JavaScriptExceptionTest);
  5945. smalltalk.addMethod(
  5946. smalltalk.method({
  5947. selector: "testRaisingException",
  5948. protocol: 'tests',
  5949. fn: function (){
  5950. var self=this;
  5951. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5952. return smalltalk.withContext(function($ctx1) {
  5953. self._should_raise_((function(){
  5954. return smalltalk.withContext(function($ctx2) {
  5955. return self._throwException();
  5956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5957. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)})},
  5958. args: [],
  5959. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5960. messageSends: ["should:raise:", "throwException"],
  5961. referencedClasses: ["JavaScriptException"]
  5962. }),
  5963. globals.JavaScriptExceptionTest);
  5964. smalltalk.addMethod(
  5965. smalltalk.method({
  5966. selector: "throwException",
  5967. protocol: 'helpers',
  5968. fn: function (){
  5969. var self=this;
  5970. throw 'test';
  5971. return self},
  5972. args: [],
  5973. source: "throwException\x0a\x09<throw 'test'>",
  5974. messageSends: [],
  5975. referencedClasses: []
  5976. }),
  5977. globals.JavaScriptExceptionTest);
  5978. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  5979. smalltalk.addMethod(
  5980. smalltalk.method({
  5981. selector: "testValue",
  5982. protocol: 'tests',
  5983. fn: function (){
  5984. var self=this;
  5985. var messageSend;
  5986. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5987. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5988. return smalltalk.withContext(function($ctx1) {
  5989. var $1,$2;
  5990. $1=_st($MessageSend())._new();
  5991. $ctx1.sendIdx["new"]=1;
  5992. _st($1)._receiver_(_st($Object())._new());
  5993. _st($1)._selector_("asString");
  5994. $2=_st($1)._yourself();
  5995. messageSend=$2;
  5996. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5997. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)})},
  5998. args: [],
  5999. 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'",
  6000. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  6001. referencedClasses: ["MessageSend", "Object"]
  6002. }),
  6003. globals.MessageSendTest);
  6004. smalltalk.addMethod(
  6005. smalltalk.method({
  6006. selector: "testValueWithArguments",
  6007. protocol: 'tests',
  6008. fn: function (){
  6009. var self=this;
  6010. var messageSend;
  6011. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6012. return smalltalk.withContext(function($ctx1) {
  6013. var $1,$2;
  6014. $1=_st($MessageSend())._new();
  6015. _st($1)._receiver_((2));
  6016. _st($1)._selector_("+");
  6017. $2=_st($1)._yourself();
  6018. messageSend=$2;
  6019. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  6020. $ctx1.sendIdx["assert:equals:"]=1;
  6021. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  6022. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)})},
  6023. args: [],
  6024. 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",
  6025. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  6026. referencedClasses: ["MessageSend"]
  6027. }),
  6028. globals.MessageSendTest);
  6029. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  6030. smalltalk.addMethod(
  6031. smalltalk.method({
  6032. selector: "codeGeneratorClass",
  6033. protocol: 'accessing',
  6034. fn: function (){
  6035. var self=this;
  6036. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  6037. return $CodeGenerator();
  6038. },
  6039. args: [],
  6040. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  6041. messageSends: [],
  6042. referencedClasses: ["CodeGenerator"]
  6043. }),
  6044. globals.MethodInheritanceTest);
  6045. smalltalk.addMethod(
  6046. smalltalk.method({
  6047. selector: "compiler",
  6048. protocol: 'factory',
  6049. fn: function (){
  6050. var self=this;
  6051. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6052. return smalltalk.withContext(function($ctx1) {
  6053. var $2,$3,$1;
  6054. $2=_st($Compiler())._new();
  6055. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  6056. $3=_st($2)._yourself();
  6057. $1=$3;
  6058. return $1;
  6059. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)})},
  6060. args: [],
  6061. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  6062. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  6063. referencedClasses: ["Compiler"]
  6064. }),
  6065. globals.MethodInheritanceTest);
  6066. smalltalk.addMethod(
  6067. smalltalk.method({
  6068. selector: "deinstallBottom",
  6069. protocol: 'testing',
  6070. fn: function (){
  6071. var self=this;
  6072. return smalltalk.withContext(function($ctx1) {
  6073. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6074. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)})},
  6075. args: [],
  6076. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6077. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6078. referencedClasses: []
  6079. }),
  6080. globals.MethodInheritanceTest);
  6081. smalltalk.addMethod(
  6082. smalltalk.method({
  6083. selector: "deinstallMiddle",
  6084. protocol: 'testing',
  6085. fn: function (){
  6086. var self=this;
  6087. return smalltalk.withContext(function($ctx1) {
  6088. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6089. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)})},
  6090. args: [],
  6091. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6092. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6093. referencedClasses: []
  6094. }),
  6095. globals.MethodInheritanceTest);
  6096. smalltalk.addMethod(
  6097. smalltalk.method({
  6098. selector: "deinstallTop",
  6099. protocol: 'testing',
  6100. fn: function (){
  6101. var self=this;
  6102. return smalltalk.withContext(function($ctx1) {
  6103. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6104. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)})},
  6105. args: [],
  6106. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6107. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6108. referencedClasses: []
  6109. }),
  6110. globals.MethodInheritanceTest);
  6111. smalltalk.addMethod(
  6112. smalltalk.method({
  6113. selector: "installBottom:",
  6114. protocol: 'testing',
  6115. fn: function (aString){
  6116. var self=this;
  6117. return smalltalk.withContext(function($ctx1) {
  6118. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6119. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)})},
  6120. args: ["aString"],
  6121. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6122. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6123. referencedClasses: []
  6124. }),
  6125. globals.MethodInheritanceTest);
  6126. smalltalk.addMethod(
  6127. smalltalk.method({
  6128. selector: "installMiddle:",
  6129. protocol: 'testing',
  6130. fn: function (aString){
  6131. var self=this;
  6132. return smalltalk.withContext(function($ctx1) {
  6133. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6134. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)})},
  6135. args: ["aString"],
  6136. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6137. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6138. referencedClasses: []
  6139. }),
  6140. globals.MethodInheritanceTest);
  6141. smalltalk.addMethod(
  6142. smalltalk.method({
  6143. selector: "installTop:",
  6144. protocol: 'testing',
  6145. fn: function (aString){
  6146. var self=this;
  6147. return smalltalk.withContext(function($ctx1) {
  6148. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6149. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)})},
  6150. args: ["aString"],
  6151. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6152. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6153. referencedClasses: []
  6154. }),
  6155. globals.MethodInheritanceTest);
  6156. smalltalk.addMethod(
  6157. smalltalk.method({
  6158. selector: "setUp",
  6159. protocol: 'initialization',
  6160. fn: function (){
  6161. var self=this;
  6162. return smalltalk.withContext(function($ctx1) {
  6163. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6164. $ctx1.sendIdx["new"]=1;
  6165. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6166. $ctx1.sendIdx["new"]=2;
  6167. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6168. self["@method"]=nil;
  6169. self["@performBlock"]=(function(){
  6170. return smalltalk.withContext(function($ctx2) {
  6171. return self._error_("performBlock not initialized");
  6172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6173. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)})},
  6174. args: [],
  6175. 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' ]",
  6176. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6177. referencedClasses: []
  6178. }),
  6179. globals.MethodInheritanceTest);
  6180. smalltalk.addMethod(
  6181. smalltalk.method({
  6182. selector: "shouldMNU",
  6183. protocol: 'testing',
  6184. fn: function (){
  6185. var self=this;
  6186. return smalltalk.withContext(function($ctx1) {
  6187. self._shouldMNUTop();
  6188. self._shouldMNUMiddle();
  6189. self._shouldMNUBottom();
  6190. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)})},
  6191. args: [],
  6192. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6193. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6194. referencedClasses: []
  6195. }),
  6196. globals.MethodInheritanceTest);
  6197. smalltalk.addMethod(
  6198. smalltalk.method({
  6199. selector: "shouldMNUBottom",
  6200. protocol: 'testing',
  6201. fn: function (){
  6202. var self=this;
  6203. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6204. return smalltalk.withContext(function($ctx1) {
  6205. self._should_raise_((function(){
  6206. return smalltalk.withContext(function($ctx2) {
  6207. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6209. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)})},
  6210. args: [],
  6211. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6212. messageSends: ["should:raise:", "value:"],
  6213. referencedClasses: ["MessageNotUnderstood"]
  6214. }),
  6215. globals.MethodInheritanceTest);
  6216. smalltalk.addMethod(
  6217. smalltalk.method({
  6218. selector: "shouldMNUMiddle",
  6219. protocol: 'testing',
  6220. fn: function (){
  6221. var self=this;
  6222. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6223. return smalltalk.withContext(function($ctx1) {
  6224. self._should_raise_((function(){
  6225. return smalltalk.withContext(function($ctx2) {
  6226. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6228. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)})},
  6229. args: [],
  6230. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6231. messageSends: ["should:raise:", "value:"],
  6232. referencedClasses: ["MessageNotUnderstood"]
  6233. }),
  6234. globals.MethodInheritanceTest);
  6235. smalltalk.addMethod(
  6236. smalltalk.method({
  6237. selector: "shouldMNUTop",
  6238. protocol: 'testing',
  6239. fn: function (){
  6240. var self=this;
  6241. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6242. return smalltalk.withContext(function($ctx1) {
  6243. self._should_raise_((function(){
  6244. return smalltalk.withContext(function($ctx2) {
  6245. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6247. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)})},
  6248. args: [],
  6249. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6250. messageSends: ["should:raise:", "value:"],
  6251. referencedClasses: ["MessageNotUnderstood"]
  6252. }),
  6253. globals.MethodInheritanceTest);
  6254. smalltalk.addMethod(
  6255. smalltalk.method({
  6256. selector: "shouldReturn:",
  6257. protocol: 'testing',
  6258. fn: function (anObject){
  6259. var self=this;
  6260. var result;
  6261. return smalltalk.withContext(function($ctx1) {
  6262. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6263. $ctx1.sendIdx["value:"]=1;
  6264. self._assert_equals_(["top",anObject],["top",result]);
  6265. $ctx1.sendIdx["assert:equals:"]=1;
  6266. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6267. $ctx1.sendIdx["value:"]=2;
  6268. self._assert_equals_(["middle",anObject],["middle",result]);
  6269. $ctx1.sendIdx["assert:equals:"]=2;
  6270. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6271. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6272. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)})},
  6273. args: ["anObject"],
  6274. 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 }",
  6275. messageSends: ["value:", "assert:equals:"],
  6276. referencedClasses: []
  6277. }),
  6278. globals.MethodInheritanceTest);
  6279. smalltalk.addMethod(
  6280. smalltalk.method({
  6281. selector: "shouldReturn:and:and:",
  6282. protocol: 'testing',
  6283. fn: function (anObject,anObject2,anObject3){
  6284. var self=this;
  6285. var result;
  6286. return smalltalk.withContext(function($ctx1) {
  6287. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6288. $ctx1.sendIdx["value:"]=1;
  6289. self._assert_equals_(["top",anObject],["top",result]);
  6290. $ctx1.sendIdx["assert:equals:"]=1;
  6291. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6292. $ctx1.sendIdx["value:"]=2;
  6293. self._assert_equals_(["middle",anObject2],["middle",result]);
  6294. $ctx1.sendIdx["assert:equals:"]=2;
  6295. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6296. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6297. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)})},
  6298. args: ["anObject", "anObject2", "anObject3"],
  6299. 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 }",
  6300. messageSends: ["value:", "assert:equals:"],
  6301. referencedClasses: []
  6302. }),
  6303. globals.MethodInheritanceTest);
  6304. smalltalk.addMethod(
  6305. smalltalk.method({
  6306. selector: "targetClassBottom",
  6307. protocol: 'accessing',
  6308. fn: function (){
  6309. var self=this;
  6310. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6311. return $JavaScriptException();
  6312. },
  6313. args: [],
  6314. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6315. messageSends: [],
  6316. referencedClasses: ["JavaScriptException"]
  6317. }),
  6318. globals.MethodInheritanceTest);
  6319. smalltalk.addMethod(
  6320. smalltalk.method({
  6321. selector: "targetClassMiddle",
  6322. protocol: 'accessing',
  6323. fn: function (){
  6324. var self=this;
  6325. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6326. return $Error();
  6327. },
  6328. args: [],
  6329. source: "targetClassMiddle\x0a\x09^ Error",
  6330. messageSends: [],
  6331. referencedClasses: ["Error"]
  6332. }),
  6333. globals.MethodInheritanceTest);
  6334. smalltalk.addMethod(
  6335. smalltalk.method({
  6336. selector: "targetClassTop",
  6337. protocol: 'accessing',
  6338. fn: function (){
  6339. var self=this;
  6340. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6341. return $Object();
  6342. },
  6343. args: [],
  6344. source: "targetClassTop\x0a\x09^ Object",
  6345. messageSends: [],
  6346. referencedClasses: ["Object"]
  6347. }),
  6348. globals.MethodInheritanceTest);
  6349. smalltalk.addMethod(
  6350. smalltalk.method({
  6351. selector: "tearDown",
  6352. protocol: 'initialization',
  6353. fn: function (){
  6354. var self=this;
  6355. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6356. return smalltalk.withContext(function($ctx1) {
  6357. _st((function(){
  6358. return smalltalk.withContext(function($ctx2) {
  6359. return self._deinstallTop();
  6360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6361. return smalltalk.withContext(function($ctx2) {
  6362. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6363. $ctx1.sendIdx["on:do:"]=1;
  6364. _st((function(){
  6365. return smalltalk.withContext(function($ctx2) {
  6366. return self._deinstallMiddle();
  6367. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6368. return smalltalk.withContext(function($ctx2) {
  6369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  6370. $ctx1.sendIdx["on:do:"]=2;
  6371. _st((function(){
  6372. return smalltalk.withContext(function($ctx2) {
  6373. return self._deinstallBottom();
  6374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6375. return smalltalk.withContext(function($ctx2) {
  6376. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  6377. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)})},
  6378. args: [],
  6379. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6380. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6381. referencedClasses: ["Error"]
  6382. }),
  6383. globals.MethodInheritanceTest);
  6384. smalltalk.addMethod(
  6385. smalltalk.method({
  6386. selector: "testMNU11",
  6387. protocol: 'tests',
  6388. fn: function (){
  6389. var self=this;
  6390. return smalltalk.withContext(function($ctx1) {
  6391. self["@performBlock"]=(function(x){
  6392. return smalltalk.withContext(function($ctx2) {
  6393. return _st(x)._foo();
  6394. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6395. self._shouldMNU();
  6396. $ctx1.sendIdx["shouldMNU"]=1;
  6397. self._installTop_("foo ^ false");
  6398. $ctx1.sendIdx["installTop:"]=1;
  6399. self._installTop_("foo ^ true");
  6400. self._deinstallTop();
  6401. self._shouldMNU();
  6402. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)})},
  6403. args: [],
  6404. 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",
  6405. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6406. referencedClasses: []
  6407. }),
  6408. globals.MethodInheritanceTest);
  6409. smalltalk.addMethod(
  6410. smalltalk.method({
  6411. selector: "testMNU22",
  6412. protocol: 'tests',
  6413. fn: function (){
  6414. var self=this;
  6415. return smalltalk.withContext(function($ctx1) {
  6416. self["@performBlock"]=(function(x){
  6417. return smalltalk.withContext(function($ctx2) {
  6418. return _st(x)._foo();
  6419. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6420. self._shouldMNU();
  6421. $ctx1.sendIdx["shouldMNU"]=1;
  6422. self._installMiddle_("foo ^ false");
  6423. $ctx1.sendIdx["installMiddle:"]=1;
  6424. self._installMiddle_("foo ^ true");
  6425. self._deinstallMiddle();
  6426. self._shouldMNU();
  6427. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)})},
  6428. args: [],
  6429. 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",
  6430. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6431. referencedClasses: []
  6432. }),
  6433. globals.MethodInheritanceTest);
  6434. smalltalk.addMethod(
  6435. smalltalk.method({
  6436. selector: "testReturns1",
  6437. protocol: 'tests',
  6438. fn: function (){
  6439. var self=this;
  6440. return smalltalk.withContext(function($ctx1) {
  6441. self["@performBlock"]=(function(x){
  6442. return smalltalk.withContext(function($ctx2) {
  6443. return _st(x)._foo();
  6444. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6445. self._installTop_("foo ^ false");
  6446. $ctx1.sendIdx["installTop:"]=1;
  6447. self._shouldReturn_(false);
  6448. $ctx1.sendIdx["shouldReturn:"]=1;
  6449. self._installTop_("foo ^ true");
  6450. self._shouldReturn_(true);
  6451. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)})},
  6452. args: [],
  6453. 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",
  6454. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6455. referencedClasses: []
  6456. }),
  6457. globals.MethodInheritanceTest);
  6458. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  6459. smalltalk.addMethod(
  6460. smalltalk.method({
  6461. selector: "testAbs",
  6462. protocol: 'tests',
  6463. fn: function (){
  6464. var self=this;
  6465. return smalltalk.withContext(function($ctx1) {
  6466. var $1;
  6467. $1=(4)._abs();
  6468. $ctx1.sendIdx["abs"]=1;
  6469. self._assert_equals_($1,(4));
  6470. $ctx1.sendIdx["assert:equals:"]=1;
  6471. self._assert_equals_((-4)._abs(),(4));
  6472. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)})},
  6473. args: [],
  6474. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6475. messageSends: ["assert:equals:", "abs"],
  6476. referencedClasses: []
  6477. }),
  6478. globals.NumberTest);
  6479. smalltalk.addMethod(
  6480. smalltalk.method({
  6481. selector: "testArithmetic",
  6482. protocol: 'tests',
  6483. fn: function (){
  6484. var self=this;
  6485. return smalltalk.withContext(function($ctx1) {
  6486. var $1,$2,$3,$5,$4;
  6487. $1=(1.5).__plus((1));
  6488. $ctx1.sendIdx["+"]=1;
  6489. self._assert_equals_($1,(2.5));
  6490. $ctx1.sendIdx["assert:equals:"]=1;
  6491. $2=(2).__minus((1));
  6492. $ctx1.sendIdx["-"]=1;
  6493. self._assert_equals_($2,(1));
  6494. $ctx1.sendIdx["assert:equals:"]=2;
  6495. self._assert_equals_((-2).__minus((1)),(-3));
  6496. $ctx1.sendIdx["assert:equals:"]=3;
  6497. self._assert_equals_((12).__slash((2)),(6));
  6498. $ctx1.sendIdx["assert:equals:"]=4;
  6499. $3=(3).__star((4));
  6500. $ctx1.sendIdx["*"]=1;
  6501. self._assert_equals_($3,(12));
  6502. $ctx1.sendIdx["assert:equals:"]=5;
  6503. self._assert_equals_((7).__slash_slash((2)),(3));
  6504. $ctx1.sendIdx["assert:equals:"]=6;
  6505. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6506. $ctx1.sendIdx["assert:equals:"]=7;
  6507. $5=(1).__plus((2));
  6508. $ctx1.sendIdx["+"]=2;
  6509. $4=_st($5).__star((3));
  6510. $ctx1.sendIdx["*"]=2;
  6511. self._assert_equals_($4,(9));
  6512. $ctx1.sendIdx["assert:equals:"]=8;
  6513. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6514. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)})},
  6515. args: [],
  6516. 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",
  6517. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6518. referencedClasses: []
  6519. }),
  6520. globals.NumberTest);
  6521. smalltalk.addMethod(
  6522. smalltalk.method({
  6523. selector: "testAsNumber",
  6524. protocol: 'tests',
  6525. fn: function (){
  6526. var self=this;
  6527. return smalltalk.withContext(function($ctx1) {
  6528. self._assert_equals_((3)._asNumber(),(3));
  6529. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)})},
  6530. args: [],
  6531. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6532. messageSends: ["assert:equals:", "asNumber"],
  6533. referencedClasses: []
  6534. }),
  6535. globals.NumberTest);
  6536. smalltalk.addMethod(
  6537. smalltalk.method({
  6538. selector: "testCeiling",
  6539. protocol: 'tests',
  6540. fn: function (){
  6541. var self=this;
  6542. return smalltalk.withContext(function($ctx1) {
  6543. var $1,$2;
  6544. $1=(1.2)._ceiling();
  6545. $ctx1.sendIdx["ceiling"]=1;
  6546. self._assert_equals_($1,(2));
  6547. $ctx1.sendIdx["assert:equals:"]=1;
  6548. $2=(-1.2)._ceiling();
  6549. $ctx1.sendIdx["ceiling"]=2;
  6550. self._assert_equals_($2,(-1));
  6551. $ctx1.sendIdx["assert:equals:"]=2;
  6552. self._assert_equals_((1)._ceiling(),(1));
  6553. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)})},
  6554. args: [],
  6555. 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.",
  6556. messageSends: ["assert:equals:", "ceiling"],
  6557. referencedClasses: []
  6558. }),
  6559. globals.NumberTest);
  6560. smalltalk.addMethod(
  6561. smalltalk.method({
  6562. selector: "testComparison",
  6563. protocol: 'tests',
  6564. fn: function (){
  6565. var self=this;
  6566. return smalltalk.withContext(function($ctx1) {
  6567. var $1,$2,$3,$4;
  6568. $1=(3).__gt((2));
  6569. $ctx1.sendIdx[">"]=1;
  6570. self._assert_($1);
  6571. $ctx1.sendIdx["assert:"]=1;
  6572. $2=(2).__lt((3));
  6573. $ctx1.sendIdx["<"]=1;
  6574. self._assert_($2);
  6575. $ctx1.sendIdx["assert:"]=2;
  6576. self._deny_((3).__lt((2)));
  6577. $ctx1.sendIdx["deny:"]=1;
  6578. self._deny_((2).__gt((3)));
  6579. $3=(3).__gt_eq((3));
  6580. $ctx1.sendIdx[">="]=1;
  6581. self._assert_($3);
  6582. $ctx1.sendIdx["assert:"]=3;
  6583. self._assert_((3.1).__gt_eq((3)));
  6584. $ctx1.sendIdx["assert:"]=4;
  6585. $4=(3).__lt_eq((3));
  6586. $ctx1.sendIdx["<="]=1;
  6587. self._assert_($4);
  6588. $ctx1.sendIdx["assert:"]=5;
  6589. self._assert_((3).__lt_eq((3.1)));
  6590. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)})},
  6591. args: [],
  6592. 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",
  6593. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6594. referencedClasses: []
  6595. }),
  6596. globals.NumberTest);
  6597. smalltalk.addMethod(
  6598. smalltalk.method({
  6599. selector: "testCopying",
  6600. protocol: 'tests',
  6601. fn: function (){
  6602. var self=this;
  6603. return smalltalk.withContext(function($ctx1) {
  6604. var $1;
  6605. $1=_st((1)._copy()).__eq_eq((1));
  6606. $ctx1.sendIdx["=="]=1;
  6607. self._assert_($1);
  6608. $ctx1.sendIdx["assert:"]=1;
  6609. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6610. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)})},
  6611. args: [],
  6612. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6613. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6614. referencedClasses: []
  6615. }),
  6616. globals.NumberTest);
  6617. smalltalk.addMethod(
  6618. smalltalk.method({
  6619. selector: "testEquality",
  6620. protocol: 'tests',
  6621. fn: function (){
  6622. var self=this;
  6623. return smalltalk.withContext(function($ctx1) {
  6624. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6625. $1=(1).__eq((1));
  6626. $ctx1.sendIdx["="]=1;
  6627. self._assert_($1);
  6628. $ctx1.sendIdx["assert:"]=1;
  6629. $2=(0).__eq((0));
  6630. $ctx1.sendIdx["="]=2;
  6631. self._assert_($2);
  6632. $ctx1.sendIdx["assert:"]=2;
  6633. $3=(1).__eq((0));
  6634. $ctx1.sendIdx["="]=3;
  6635. self._deny_($3);
  6636. $ctx1.sendIdx["deny:"]=1;
  6637. $5=(1)._yourself();
  6638. $ctx1.sendIdx["yourself"]=1;
  6639. $4=_st($5).__eq((1));
  6640. $ctx1.sendIdx["="]=4;
  6641. self._assert_($4);
  6642. $ctx1.sendIdx["assert:"]=3;
  6643. $7=(1)._yourself();
  6644. $ctx1.sendIdx["yourself"]=2;
  6645. $6=(1).__eq($7);
  6646. $ctx1.sendIdx["="]=5;
  6647. self._assert_($6);
  6648. $ctx1.sendIdx["assert:"]=4;
  6649. $9=(1)._yourself();
  6650. $ctx1.sendIdx["yourself"]=3;
  6651. $8=_st($9).__eq((1)._yourself());
  6652. $ctx1.sendIdx["="]=6;
  6653. self._assert_($8);
  6654. $10=(0).__eq(false);
  6655. $ctx1.sendIdx["="]=7;
  6656. self._deny_($10);
  6657. $ctx1.sendIdx["deny:"]=2;
  6658. $11=false.__eq((0));
  6659. $ctx1.sendIdx["="]=8;
  6660. self._deny_($11);
  6661. $ctx1.sendIdx["deny:"]=3;
  6662. $12="".__eq((0));
  6663. $ctx1.sendIdx["="]=9;
  6664. self._deny_($12);
  6665. $ctx1.sendIdx["deny:"]=4;
  6666. self._deny_((0).__eq(""));
  6667. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)})},
  6668. args: [],
  6669. 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 = ''",
  6670. messageSends: ["assert:", "=", "deny:", "yourself"],
  6671. referencedClasses: []
  6672. }),
  6673. globals.NumberTest);
  6674. smalltalk.addMethod(
  6675. smalltalk.method({
  6676. selector: "testFloor",
  6677. protocol: 'tests',
  6678. fn: function (){
  6679. var self=this;
  6680. return smalltalk.withContext(function($ctx1) {
  6681. var $1,$2;
  6682. $1=(1.2)._floor();
  6683. $ctx1.sendIdx["floor"]=1;
  6684. self._assert_equals_($1,(1));
  6685. $ctx1.sendIdx["assert:equals:"]=1;
  6686. $2=(-1.2)._floor();
  6687. $ctx1.sendIdx["floor"]=2;
  6688. self._assert_equals_($2,(-2));
  6689. $ctx1.sendIdx["assert:equals:"]=2;
  6690. self._assert_equals_((1)._floor(),(1));
  6691. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)})},
  6692. args: [],
  6693. 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.",
  6694. messageSends: ["assert:equals:", "floor"],
  6695. referencedClasses: []
  6696. }),
  6697. globals.NumberTest);
  6698. smalltalk.addMethod(
  6699. smalltalk.method({
  6700. selector: "testHexNumbers",
  6701. protocol: 'tests',
  6702. fn: function (){
  6703. var self=this;
  6704. return smalltalk.withContext(function($ctx1) {
  6705. var $1,$2,$3,$4,$5;
  6706. self._assert_equals_((9),(9));
  6707. $ctx1.sendIdx["assert:equals:"]=1;
  6708. $1=(10)._truncated();
  6709. $ctx1.sendIdx["truncated"]=1;
  6710. self._assert_equals_($1,(10));
  6711. $ctx1.sendIdx["assert:equals:"]=2;
  6712. $2=(11)._truncated();
  6713. $ctx1.sendIdx["truncated"]=2;
  6714. self._assert_equals_($2,(11));
  6715. $ctx1.sendIdx["assert:equals:"]=3;
  6716. $3=(12)._truncated();
  6717. $ctx1.sendIdx["truncated"]=3;
  6718. self._assert_equals_($3,(12));
  6719. $ctx1.sendIdx["assert:equals:"]=4;
  6720. $4=(13)._truncated();
  6721. $ctx1.sendIdx["truncated"]=4;
  6722. self._assert_equals_($4,(13));
  6723. $ctx1.sendIdx["assert:equals:"]=5;
  6724. $5=(14)._truncated();
  6725. $ctx1.sendIdx["truncated"]=5;
  6726. self._assert_equals_($5,(14));
  6727. $ctx1.sendIdx["assert:equals:"]=6;
  6728. self._assert_equals_((15)._truncated(),(15));
  6729. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)})},
  6730. args: [],
  6731. 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",
  6732. messageSends: ["assert:equals:", "truncated"],
  6733. referencedClasses: []
  6734. }),
  6735. globals.NumberTest);
  6736. smalltalk.addMethod(
  6737. smalltalk.method({
  6738. selector: "testIdentity",
  6739. protocol: 'tests',
  6740. fn: function (){
  6741. var self=this;
  6742. return smalltalk.withContext(function($ctx1) {
  6743. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6744. $1=(1).__eq_eq((1));
  6745. $ctx1.sendIdx["=="]=1;
  6746. self._assert_($1);
  6747. $ctx1.sendIdx["assert:"]=1;
  6748. $2=(0).__eq_eq((0));
  6749. $ctx1.sendIdx["=="]=2;
  6750. self._assert_($2);
  6751. $ctx1.sendIdx["assert:"]=2;
  6752. $3=(1).__eq_eq((0));
  6753. $ctx1.sendIdx["=="]=3;
  6754. self._deny_($3);
  6755. $ctx1.sendIdx["deny:"]=1;
  6756. $5=(1)._yourself();
  6757. $ctx1.sendIdx["yourself"]=1;
  6758. $4=_st($5).__eq_eq((1));
  6759. $ctx1.sendIdx["=="]=4;
  6760. self._assert_($4);
  6761. $ctx1.sendIdx["assert:"]=3;
  6762. $7=(1)._yourself();
  6763. $ctx1.sendIdx["yourself"]=2;
  6764. $6=(1).__eq_eq($7);
  6765. $ctx1.sendIdx["=="]=5;
  6766. self._assert_($6);
  6767. $ctx1.sendIdx["assert:"]=4;
  6768. $9=(1)._yourself();
  6769. $ctx1.sendIdx["yourself"]=3;
  6770. $8=_st($9).__eq_eq((1)._yourself());
  6771. $ctx1.sendIdx["=="]=6;
  6772. self._assert_($8);
  6773. self._deny_((1).__eq_eq((2)));
  6774. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)})},
  6775. args: [],
  6776. 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",
  6777. messageSends: ["assert:", "==", "deny:", "yourself"],
  6778. referencedClasses: []
  6779. }),
  6780. globals.NumberTest);
  6781. smalltalk.addMethod(
  6782. smalltalk.method({
  6783. selector: "testInvalidHexNumbers",
  6784. protocol: 'tests',
  6785. fn: function (){
  6786. var self=this;
  6787. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6788. return smalltalk.withContext(function($ctx1) {
  6789. self._should_raise_((function(){
  6790. return smalltalk.withContext(function($ctx2) {
  6791. return (16)._rG();
  6792. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6793. $ctx1.sendIdx["should:raise:"]=1;
  6794. self._should_raise_((function(){
  6795. return smalltalk.withContext(function($ctx2) {
  6796. return (16)._rg();
  6797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6798. $ctx1.sendIdx["should:raise:"]=2;
  6799. self._should_raise_((function(){
  6800. return smalltalk.withContext(function($ctx2) {
  6801. return (16)._rH();
  6802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6803. $ctx1.sendIdx["should:raise:"]=3;
  6804. self._should_raise_((function(){
  6805. return smalltalk.withContext(function($ctx2) {
  6806. return (16)._rh();
  6807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6808. $ctx1.sendIdx["should:raise:"]=4;
  6809. self._should_raise_((function(){
  6810. return smalltalk.withContext(function($ctx2) {
  6811. return (16)._rI();
  6812. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6813. $ctx1.sendIdx["should:raise:"]=5;
  6814. self._should_raise_((function(){
  6815. return smalltalk.withContext(function($ctx2) {
  6816. return (16)._ri();
  6817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6818. $ctx1.sendIdx["should:raise:"]=6;
  6819. self._should_raise_((function(){
  6820. return smalltalk.withContext(function($ctx2) {
  6821. return (16)._rJ();
  6822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6823. $ctx1.sendIdx["should:raise:"]=7;
  6824. self._should_raise_((function(){
  6825. return smalltalk.withContext(function($ctx2) {
  6826. return (16)._rj();
  6827. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6828. $ctx1.sendIdx["should:raise:"]=8;
  6829. self._should_raise_((function(){
  6830. return smalltalk.withContext(function($ctx2) {
  6831. return (16)._rK();
  6832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6833. $ctx1.sendIdx["should:raise:"]=9;
  6834. self._should_raise_((function(){
  6835. return smalltalk.withContext(function($ctx2) {
  6836. return (16)._rk();
  6837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6838. $ctx1.sendIdx["should:raise:"]=10;
  6839. self._should_raise_((function(){
  6840. return smalltalk.withContext(function($ctx2) {
  6841. return (16)._rL();
  6842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6843. $ctx1.sendIdx["should:raise:"]=11;
  6844. self._should_raise_((function(){
  6845. return smalltalk.withContext(function($ctx2) {
  6846. return (16)._rl();
  6847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6848. $ctx1.sendIdx["should:raise:"]=12;
  6849. self._should_raise_((function(){
  6850. return smalltalk.withContext(function($ctx2) {
  6851. return (16)._rM();
  6852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6853. $ctx1.sendIdx["should:raise:"]=13;
  6854. self._should_raise_((function(){
  6855. return smalltalk.withContext(function($ctx2) {
  6856. return (16)._rm();
  6857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6858. $ctx1.sendIdx["should:raise:"]=14;
  6859. self._should_raise_((function(){
  6860. return smalltalk.withContext(function($ctx2) {
  6861. return (16)._rN();
  6862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6863. $ctx1.sendIdx["should:raise:"]=15;
  6864. self._should_raise_((function(){
  6865. return smalltalk.withContext(function($ctx2) {
  6866. return (16)._rn();
  6867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6868. $ctx1.sendIdx["should:raise:"]=16;
  6869. self._should_raise_((function(){
  6870. return smalltalk.withContext(function($ctx2) {
  6871. return (16)._rO();
  6872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6873. $ctx1.sendIdx["should:raise:"]=17;
  6874. self._should_raise_((function(){
  6875. return smalltalk.withContext(function($ctx2) {
  6876. return (16)._ro();
  6877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6878. $ctx1.sendIdx["should:raise:"]=18;
  6879. self._should_raise_((function(){
  6880. return smalltalk.withContext(function($ctx2) {
  6881. return (16)._rP();
  6882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6883. $ctx1.sendIdx["should:raise:"]=19;
  6884. self._should_raise_((function(){
  6885. return smalltalk.withContext(function($ctx2) {
  6886. return (16)._rp();
  6887. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6888. $ctx1.sendIdx["should:raise:"]=20;
  6889. self._should_raise_((function(){
  6890. return smalltalk.withContext(function($ctx2) {
  6891. return (16)._rQ();
  6892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6893. $ctx1.sendIdx["should:raise:"]=21;
  6894. self._should_raise_((function(){
  6895. return smalltalk.withContext(function($ctx2) {
  6896. return (16)._rq();
  6897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6898. $ctx1.sendIdx["should:raise:"]=22;
  6899. self._should_raise_((function(){
  6900. return smalltalk.withContext(function($ctx2) {
  6901. return (16)._rR();
  6902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6903. $ctx1.sendIdx["should:raise:"]=23;
  6904. self._should_raise_((function(){
  6905. return smalltalk.withContext(function($ctx2) {
  6906. return (16)._rr();
  6907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6908. $ctx1.sendIdx["should:raise:"]=24;
  6909. self._should_raise_((function(){
  6910. return smalltalk.withContext(function($ctx2) {
  6911. return (16)._rS();
  6912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6913. $ctx1.sendIdx["should:raise:"]=25;
  6914. self._should_raise_((function(){
  6915. return smalltalk.withContext(function($ctx2) {
  6916. return (16)._rs();
  6917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6918. $ctx1.sendIdx["should:raise:"]=26;
  6919. self._should_raise_((function(){
  6920. return smalltalk.withContext(function($ctx2) {
  6921. return (16)._rT();
  6922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6923. $ctx1.sendIdx["should:raise:"]=27;
  6924. self._should_raise_((function(){
  6925. return smalltalk.withContext(function($ctx2) {
  6926. return (16)._rt();
  6927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6928. $ctx1.sendIdx["should:raise:"]=28;
  6929. self._should_raise_((function(){
  6930. return smalltalk.withContext(function($ctx2) {
  6931. return (16)._rU();
  6932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6933. $ctx1.sendIdx["should:raise:"]=29;
  6934. self._should_raise_((function(){
  6935. return smalltalk.withContext(function($ctx2) {
  6936. return (16)._ru();
  6937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6938. $ctx1.sendIdx["should:raise:"]=30;
  6939. self._should_raise_((function(){
  6940. return smalltalk.withContext(function($ctx2) {
  6941. return (16)._rV();
  6942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6943. $ctx1.sendIdx["should:raise:"]=31;
  6944. self._should_raise_((function(){
  6945. return smalltalk.withContext(function($ctx2) {
  6946. return (16)._rv();
  6947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6948. $ctx1.sendIdx["should:raise:"]=32;
  6949. self._should_raise_((function(){
  6950. return smalltalk.withContext(function($ctx2) {
  6951. return (16)._rW();
  6952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6953. $ctx1.sendIdx["should:raise:"]=33;
  6954. self._should_raise_((function(){
  6955. return smalltalk.withContext(function($ctx2) {
  6956. return (16)._rw();
  6957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6958. $ctx1.sendIdx["should:raise:"]=34;
  6959. self._should_raise_((function(){
  6960. return smalltalk.withContext(function($ctx2) {
  6961. return (16)._rX();
  6962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6963. $ctx1.sendIdx["should:raise:"]=35;
  6964. self._should_raise_((function(){
  6965. return smalltalk.withContext(function($ctx2) {
  6966. return (16)._rx();
  6967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6968. $ctx1.sendIdx["should:raise:"]=36;
  6969. self._should_raise_((function(){
  6970. return smalltalk.withContext(function($ctx2) {
  6971. return (16)._rY();
  6972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6973. $ctx1.sendIdx["should:raise:"]=37;
  6974. self._should_raise_((function(){
  6975. return smalltalk.withContext(function($ctx2) {
  6976. return (16)._ry();
  6977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6978. $ctx1.sendIdx["should:raise:"]=38;
  6979. self._should_raise_((function(){
  6980. return smalltalk.withContext(function($ctx2) {
  6981. return (16)._rZ();
  6982. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6983. $ctx1.sendIdx["should:raise:"]=39;
  6984. self._should_raise_((function(){
  6985. return smalltalk.withContext(function($ctx2) {
  6986. return (16)._rz();
  6987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6988. $ctx1.sendIdx["should:raise:"]=40;
  6989. self._should_raise_((function(){
  6990. return smalltalk.withContext(function($ctx2) {
  6991. return (11259375)._Z();
  6992. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6993. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)})},
  6994. args: [],
  6995. 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.",
  6996. 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"],
  6997. referencedClasses: ["MessageNotUnderstood"]
  6998. }),
  6999. globals.NumberTest);
  7000. smalltalk.addMethod(
  7001. smalltalk.method({
  7002. selector: "testLog",
  7003. protocol: 'tests',
  7004. fn: function (){
  7005. var self=this;
  7006. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  7007. return smalltalk.withContext(function($ctx1) {
  7008. self._assert_equals_((10000)._log(),(4));
  7009. $ctx1.sendIdx["assert:equals:"]=1;
  7010. self._assert_equals_((512)._log_((2)),(9));
  7011. $ctx1.sendIdx["assert:equals:"]=2;
  7012. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  7013. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)})},
  7014. args: [],
  7015. 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.",
  7016. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  7017. referencedClasses: ["Number"]
  7018. }),
  7019. globals.NumberTest);
  7020. smalltalk.addMethod(
  7021. smalltalk.method({
  7022. selector: "testMinMax",
  7023. protocol: 'tests',
  7024. fn: function (){
  7025. var self=this;
  7026. return smalltalk.withContext(function($ctx1) {
  7027. self._assert_equals_((2)._max_((5)),(5));
  7028. $ctx1.sendIdx["assert:equals:"]=1;
  7029. self._assert_equals_((2)._min_((5)),(2));
  7030. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)})},
  7031. args: [],
  7032. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  7033. messageSends: ["assert:equals:", "max:", "min:"],
  7034. referencedClasses: []
  7035. }),
  7036. globals.NumberTest);
  7037. smalltalk.addMethod(
  7038. smalltalk.method({
  7039. selector: "testNegated",
  7040. protocol: 'tests',
  7041. fn: function (){
  7042. var self=this;
  7043. return smalltalk.withContext(function($ctx1) {
  7044. var $1;
  7045. $1=(3)._negated();
  7046. $ctx1.sendIdx["negated"]=1;
  7047. self._assert_equals_($1,(-3));
  7048. $ctx1.sendIdx["assert:equals:"]=1;
  7049. self._assert_equals_((-3)._negated(),(3));
  7050. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)})},
  7051. args: [],
  7052. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  7053. messageSends: ["assert:equals:", "negated"],
  7054. referencedClasses: []
  7055. }),
  7056. globals.NumberTest);
  7057. smalltalk.addMethod(
  7058. smalltalk.method({
  7059. selector: "testPrintShowingDecimalPlaces",
  7060. protocol: 'tests',
  7061. fn: function (){
  7062. var self=this;
  7063. return smalltalk.withContext(function($ctx1) {
  7064. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  7065. $1=(23)._printShowingDecimalPlaces_((2));
  7066. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  7067. self._assert_equals_($1,"23.00");
  7068. $ctx1.sendIdx["assert:equals:"]=1;
  7069. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7070. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7071. self._assert_equals_($2,"23.57");
  7072. $ctx1.sendIdx["assert:equals:"]=2;
  7073. $4=(234.567)._negated();
  7074. $ctx1.sendIdx["negated"]=1;
  7075. $3=_st($4)._printShowingDecimalPlaces_((5));
  7076. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7077. self._assert_equals_($3,"-234.56700");
  7078. $ctx1.sendIdx["assert:equals:"]=3;
  7079. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7080. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7081. self._assert_equals_($5,"23");
  7082. $ctx1.sendIdx["assert:equals:"]=4;
  7083. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7084. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7085. self._assert_equals_($6,"24");
  7086. $ctx1.sendIdx["assert:equals:"]=5;
  7087. $8=(23.4567)._negated();
  7088. $ctx1.sendIdx["negated"]=2;
  7089. $7=_st($8)._printShowingDecimalPlaces_((0));
  7090. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7091. self._assert_equals_($7,"-23");
  7092. $ctx1.sendIdx["assert:equals:"]=6;
  7093. $10=(23.5567)._negated();
  7094. $ctx1.sendIdx["negated"]=3;
  7095. $9=_st($10)._printShowingDecimalPlaces_((0));
  7096. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7097. self._assert_equals_($9,"-24");
  7098. $ctx1.sendIdx["assert:equals:"]=7;
  7099. $11=(100000000)._printShowingDecimalPlaces_((1));
  7100. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7101. self._assert_equals_($11,"100000000.0");
  7102. $ctx1.sendIdx["assert:equals:"]=8;
  7103. $12=(0.98)._printShowingDecimalPlaces_((5));
  7104. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7105. self._assert_equals_($12,"0.98000");
  7106. $ctx1.sendIdx["assert:equals:"]=9;
  7107. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7108. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7109. self._assert_equals_($13,"-0.98");
  7110. $ctx1.sendIdx["assert:equals:"]=10;
  7111. $14=(2.567)._printShowingDecimalPlaces_((2));
  7112. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7113. self._assert_equals_($14,"2.57");
  7114. $ctx1.sendIdx["assert:equals:"]=11;
  7115. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7116. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7117. self._assert_equals_($15,"-2.57");
  7118. $ctx1.sendIdx["assert:equals:"]=12;
  7119. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7120. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)})},
  7121. args: [],
  7122. 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'.",
  7123. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7124. referencedClasses: []
  7125. }),
  7126. globals.NumberTest);
  7127. smalltalk.addMethod(
  7128. smalltalk.method({
  7129. selector: "testRaisedTo",
  7130. protocol: 'tests',
  7131. fn: function (){
  7132. var self=this;
  7133. return smalltalk.withContext(function($ctx1) {
  7134. var $1,$2,$3;
  7135. $1=(2)._raisedTo_((4));
  7136. $ctx1.sendIdx["raisedTo:"]=1;
  7137. self._assert_equals_($1,(16));
  7138. $ctx1.sendIdx["assert:equals:"]=1;
  7139. $2=(2)._raisedTo_((0));
  7140. $ctx1.sendIdx["raisedTo:"]=2;
  7141. self._assert_equals_($2,(1));
  7142. $ctx1.sendIdx["assert:equals:"]=2;
  7143. $3=(2)._raisedTo_((-3));
  7144. $ctx1.sendIdx["raisedTo:"]=3;
  7145. self._assert_equals_($3,(0.125));
  7146. $ctx1.sendIdx["assert:equals:"]=3;
  7147. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7148. $ctx1.sendIdx["assert:equals:"]=4;
  7149. self._assert_equals_((2).__star_star((4)),(16));
  7150. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)})},
  7151. args: [],
  7152. 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.",
  7153. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7154. referencedClasses: []
  7155. }),
  7156. globals.NumberTest);
  7157. smalltalk.addMethod(
  7158. smalltalk.method({
  7159. selector: "testRounded",
  7160. protocol: 'tests',
  7161. fn: function (){
  7162. var self=this;
  7163. return smalltalk.withContext(function($ctx1) {
  7164. var $1,$2;
  7165. $1=(3)._rounded();
  7166. $ctx1.sendIdx["rounded"]=1;
  7167. self._assert_equals_($1,(3));
  7168. $ctx1.sendIdx["assert:equals:"]=1;
  7169. $2=(3.212)._rounded();
  7170. $ctx1.sendIdx["rounded"]=2;
  7171. self._assert_equals_($2,(3));
  7172. $ctx1.sendIdx["assert:equals:"]=2;
  7173. self._assert_equals_((3.51)._rounded(),(4));
  7174. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)})},
  7175. args: [],
  7176. 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",
  7177. messageSends: ["assert:equals:", "rounded"],
  7178. referencedClasses: []
  7179. }),
  7180. globals.NumberTest);
  7181. smalltalk.addMethod(
  7182. smalltalk.method({
  7183. selector: "testSign",
  7184. protocol: 'tests',
  7185. fn: function (){
  7186. var self=this;
  7187. return smalltalk.withContext(function($ctx1) {
  7188. var $1,$2;
  7189. $1=(5)._sign();
  7190. $ctx1.sendIdx["sign"]=1;
  7191. self._assert_equals_($1,(1));
  7192. $ctx1.sendIdx["assert:equals:"]=1;
  7193. $2=(0)._sign();
  7194. $ctx1.sendIdx["sign"]=2;
  7195. self._assert_equals_($2,(0));
  7196. $ctx1.sendIdx["assert:equals:"]=2;
  7197. self._assert_equals_((-1.4)._sign(),(-1));
  7198. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)})},
  7199. args: [],
  7200. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7201. messageSends: ["assert:equals:", "sign"],
  7202. referencedClasses: []
  7203. }),
  7204. globals.NumberTest);
  7205. smalltalk.addMethod(
  7206. smalltalk.method({
  7207. selector: "testSqrt",
  7208. protocol: 'tests',
  7209. fn: function (){
  7210. var self=this;
  7211. return smalltalk.withContext(function($ctx1) {
  7212. var $1;
  7213. $1=(4)._sqrt();
  7214. $ctx1.sendIdx["sqrt"]=1;
  7215. self._assert_equals_($1,(2));
  7216. $ctx1.sendIdx["assert:equals:"]=1;
  7217. self._assert_equals_((16)._sqrt(),(4));
  7218. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)})},
  7219. args: [],
  7220. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7221. messageSends: ["assert:equals:", "sqrt"],
  7222. referencedClasses: []
  7223. }),
  7224. globals.NumberTest);
  7225. smalltalk.addMethod(
  7226. smalltalk.method({
  7227. selector: "testSquared",
  7228. protocol: 'tests',
  7229. fn: function (){
  7230. var self=this;
  7231. return smalltalk.withContext(function($ctx1) {
  7232. self._assert_equals_((4)._squared(),(16));
  7233. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)})},
  7234. args: [],
  7235. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7236. messageSends: ["assert:equals:", "squared"],
  7237. referencedClasses: []
  7238. }),
  7239. globals.NumberTest);
  7240. smalltalk.addMethod(
  7241. smalltalk.method({
  7242. selector: "testTimesRepeat",
  7243. protocol: 'tests',
  7244. fn: function (){
  7245. var self=this;
  7246. var i;
  7247. return smalltalk.withContext(function($ctx1) {
  7248. i=(0);
  7249. (0)._timesRepeat_((function(){
  7250. return smalltalk.withContext(function($ctx2) {
  7251. i=_st(i).__plus((1));
  7252. $ctx2.sendIdx["+"]=1;
  7253. return i;
  7254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7255. $ctx1.sendIdx["timesRepeat:"]=1;
  7256. self._assert_equals_(i,(0));
  7257. $ctx1.sendIdx["assert:equals:"]=1;
  7258. (5)._timesRepeat_((function(){
  7259. return smalltalk.withContext(function($ctx2) {
  7260. i=_st(i).__plus((1));
  7261. return i;
  7262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7263. self._assert_equals_(i,(5));
  7264. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)})},
  7265. args: [],
  7266. 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",
  7267. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7268. referencedClasses: []
  7269. }),
  7270. globals.NumberTest);
  7271. smalltalk.addMethod(
  7272. smalltalk.method({
  7273. selector: "testTo",
  7274. protocol: 'tests',
  7275. fn: function (){
  7276. var self=this;
  7277. return smalltalk.withContext(function($ctx1) {
  7278. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7279. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)})},
  7280. args: [],
  7281. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7282. messageSends: ["assert:equals:", "to:"],
  7283. referencedClasses: []
  7284. }),
  7285. globals.NumberTest);
  7286. smalltalk.addMethod(
  7287. smalltalk.method({
  7288. selector: "testToBy",
  7289. protocol: 'tests',
  7290. fn: function (){
  7291. var self=this;
  7292. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7293. return smalltalk.withContext(function($ctx1) {
  7294. var $1;
  7295. $1=(0)._to_by_((6),(2));
  7296. $ctx1.sendIdx["to:by:"]=1;
  7297. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7298. self._should_raise_((function(){
  7299. return smalltalk.withContext(function($ctx2) {
  7300. return (1)._to_by_((4),(0));
  7301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7302. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)})},
  7303. args: [],
  7304. 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",
  7305. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7306. referencedClasses: ["Error"]
  7307. }),
  7308. globals.NumberTest);
  7309. smalltalk.addMethod(
  7310. smalltalk.method({
  7311. selector: "testTrigonometry",
  7312. protocol: 'tests',
  7313. fn: function (){
  7314. var self=this;
  7315. return smalltalk.withContext(function($ctx1) {
  7316. self._assert_equals_((0)._cos(),(1));
  7317. $ctx1.sendIdx["assert:equals:"]=1;
  7318. self._assert_equals_((0)._sin(),(0));
  7319. $ctx1.sendIdx["assert:equals:"]=2;
  7320. self._assert_equals_((0)._tan(),(0));
  7321. $ctx1.sendIdx["assert:equals:"]=3;
  7322. self._assert_equals_((1)._arcCos(),(0));
  7323. $ctx1.sendIdx["assert:equals:"]=4;
  7324. self._assert_equals_((0)._arcSin(),(0));
  7325. $ctx1.sendIdx["assert:equals:"]=5;
  7326. self._assert_equals_((0)._arcTan(),(0));
  7327. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)})},
  7328. args: [],
  7329. 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.",
  7330. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7331. referencedClasses: []
  7332. }),
  7333. globals.NumberTest);
  7334. smalltalk.addMethod(
  7335. smalltalk.method({
  7336. selector: "testTruncated",
  7337. protocol: 'tests',
  7338. fn: function (){
  7339. var self=this;
  7340. return smalltalk.withContext(function($ctx1) {
  7341. var $1,$2;
  7342. $1=(3)._truncated();
  7343. $ctx1.sendIdx["truncated"]=1;
  7344. self._assert_equals_($1,(3));
  7345. $ctx1.sendIdx["assert:equals:"]=1;
  7346. $2=(3.212)._truncated();
  7347. $ctx1.sendIdx["truncated"]=2;
  7348. self._assert_equals_($2,(3));
  7349. $ctx1.sendIdx["assert:equals:"]=2;
  7350. self._assert_equals_((3.51)._truncated(),(3));
  7351. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)})},
  7352. args: [],
  7353. 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",
  7354. messageSends: ["assert:equals:", "truncated"],
  7355. referencedClasses: []
  7356. }),
  7357. globals.NumberTest);
  7358. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  7359. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7360. smalltalk.addMethod(
  7361. smalltalk.method({
  7362. selector: "foo",
  7363. protocol: 'not yet classified',
  7364. fn: function (){
  7365. var self=this;
  7366. var $1;
  7367. $1=self["@foo"];
  7368. return $1;
  7369. },
  7370. args: [],
  7371. source: "foo\x0a\x09^ foo",
  7372. messageSends: [],
  7373. referencedClasses: []
  7374. }),
  7375. globals.ObjectMock);
  7376. smalltalk.addMethod(
  7377. smalltalk.method({
  7378. selector: "foo:",
  7379. protocol: 'not yet classified',
  7380. fn: function (anObject){
  7381. var self=this;
  7382. self["@foo"]=anObject;
  7383. return self},
  7384. args: ["anObject"],
  7385. source: "foo: anObject\x0a\x09foo := anObject",
  7386. messageSends: [],
  7387. referencedClasses: []
  7388. }),
  7389. globals.ObjectMock);
  7390. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  7391. smalltalk.addMethod(
  7392. smalltalk.method({
  7393. selector: "notDefined",
  7394. protocol: 'tests',
  7395. fn: function (){
  7396. var self=this;
  7397. return void 0;;
  7398. return self},
  7399. args: [],
  7400. source: "notDefined\x0a\x09<return void 0;>",
  7401. messageSends: [],
  7402. referencedClasses: []
  7403. }),
  7404. globals.ObjectTest);
  7405. smalltalk.addMethod(
  7406. smalltalk.method({
  7407. selector: "testBasicAccess",
  7408. protocol: 'tests',
  7409. fn: function (){
  7410. var self=this;
  7411. var o;
  7412. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7413. return smalltalk.withContext(function($ctx1) {
  7414. var $1;
  7415. o=_st($Object())._new();
  7416. _st(o)._basicAt_put_("a",(1));
  7417. $1=_st(o)._basicAt_("a");
  7418. $ctx1.sendIdx["basicAt:"]=1;
  7419. self._assert_equals_($1,(1));
  7420. $ctx1.sendIdx["assert:equals:"]=1;
  7421. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7422. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)})},
  7423. args: [],
  7424. 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",
  7425. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7426. referencedClasses: ["Object"]
  7427. }),
  7428. globals.ObjectTest);
  7429. smalltalk.addMethod(
  7430. smalltalk.method({
  7431. selector: "testBasicPerform",
  7432. protocol: 'tests',
  7433. fn: function (){
  7434. var self=this;
  7435. var o;
  7436. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7437. return smalltalk.withContext(function($ctx1) {
  7438. o=_st($Object())._new();
  7439. _st(o)._basicAt_put_("func",(function(){
  7440. return smalltalk.withContext(function($ctx2) {
  7441. return "hello";
  7442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7443. $ctx1.sendIdx["basicAt:put:"]=1;
  7444. _st(o)._basicAt_put_("func2",(function(a){
  7445. return smalltalk.withContext(function($ctx2) {
  7446. return _st(a).__plus((1));
  7447. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7448. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7449. $ctx1.sendIdx["assert:equals:"]=1;
  7450. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7451. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)})},
  7452. args: [],
  7453. 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",
  7454. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7455. referencedClasses: ["Object"]
  7456. }),
  7457. globals.ObjectTest);
  7458. smalltalk.addMethod(
  7459. smalltalk.method({
  7460. selector: "testDNU",
  7461. protocol: 'tests',
  7462. fn: function (){
  7463. var self=this;
  7464. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7465. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7466. return smalltalk.withContext(function($ctx1) {
  7467. self._should_raise_((function(){
  7468. return smalltalk.withContext(function($ctx2) {
  7469. return _st(_st($Object())._new())._foo();
  7470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7471. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)})},
  7472. args: [],
  7473. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7474. messageSends: ["should:raise:", "foo", "new"],
  7475. referencedClasses: ["Object", "MessageNotUnderstood"]
  7476. }),
  7477. globals.ObjectTest);
  7478. smalltalk.addMethod(
  7479. smalltalk.method({
  7480. selector: "testEquality",
  7481. protocol: 'tests',
  7482. fn: function (){
  7483. var self=this;
  7484. var o;
  7485. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7486. return smalltalk.withContext(function($ctx1) {
  7487. var $1,$2,$4,$3;
  7488. o=_st($Object())._new();
  7489. $ctx1.sendIdx["new"]=1;
  7490. $1=_st(o).__eq(_st($Object())._new());
  7491. $ctx1.sendIdx["="]=1;
  7492. self._deny_($1);
  7493. $2=_st(o).__eq(o);
  7494. $ctx1.sendIdx["="]=2;
  7495. self._assert_($2);
  7496. $ctx1.sendIdx["assert:"]=1;
  7497. $4=_st(o)._yourself();
  7498. $ctx1.sendIdx["yourself"]=1;
  7499. $3=_st($4).__eq(o);
  7500. $ctx1.sendIdx["="]=3;
  7501. self._assert_($3);
  7502. $ctx1.sendIdx["assert:"]=2;
  7503. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7504. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)})},
  7505. args: [],
  7506. 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)",
  7507. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7508. referencedClasses: ["Object"]
  7509. }),
  7510. globals.ObjectTest);
  7511. smalltalk.addMethod(
  7512. smalltalk.method({
  7513. selector: "testHalt",
  7514. protocol: 'tests',
  7515. fn: function (){
  7516. var self=this;
  7517. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7518. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7519. return smalltalk.withContext(function($ctx1) {
  7520. self._should_raise_((function(){
  7521. return smalltalk.withContext(function($ctx2) {
  7522. return _st(_st($Object())._new())._halt();
  7523. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7524. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)})},
  7525. args: [],
  7526. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7527. messageSends: ["should:raise:", "halt", "new"],
  7528. referencedClasses: ["Object", "Error"]
  7529. }),
  7530. globals.ObjectTest);
  7531. smalltalk.addMethod(
  7532. smalltalk.method({
  7533. selector: "testIdentity",
  7534. protocol: 'tests',
  7535. fn: function (){
  7536. var self=this;
  7537. var o;
  7538. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7539. return smalltalk.withContext(function($ctx1) {
  7540. var $1,$2,$4,$3;
  7541. o=_st($Object())._new();
  7542. $ctx1.sendIdx["new"]=1;
  7543. $1=_st(o).__eq_eq(_st($Object())._new());
  7544. $ctx1.sendIdx["=="]=1;
  7545. self._deny_($1);
  7546. $2=_st(o).__eq_eq(o);
  7547. $ctx1.sendIdx["=="]=2;
  7548. self._assert_($2);
  7549. $ctx1.sendIdx["assert:"]=1;
  7550. $4=_st(o)._yourself();
  7551. $ctx1.sendIdx["yourself"]=1;
  7552. $3=_st($4).__eq_eq(o);
  7553. $ctx1.sendIdx["=="]=3;
  7554. self._assert_($3);
  7555. $ctx1.sendIdx["assert:"]=2;
  7556. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7557. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)})},
  7558. args: [],
  7559. 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",
  7560. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7561. referencedClasses: ["Object"]
  7562. }),
  7563. globals.ObjectTest);
  7564. smalltalk.addMethod(
  7565. smalltalk.method({
  7566. selector: "testIfNil",
  7567. protocol: 'tests',
  7568. fn: function (){
  7569. var self=this;
  7570. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7571. return smalltalk.withContext(function($ctx1) {
  7572. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  7573. $2=_st($Object())._new();
  7574. $ctx1.sendIdx["new"]=1;
  7575. $1=_st($2)._isNil();
  7576. self._deny_($1);
  7577. $ctx1.sendIdx["deny:"]=1;
  7578. $5=_st($Object())._new();
  7579. $ctx1.sendIdx["new"]=2;
  7580. if(($receiver = $5) == nil || $receiver == null){
  7581. $4=true;
  7582. } else {
  7583. $4=$5;
  7584. };
  7585. $3=_st($4).__eq(true);
  7586. self._deny_($3);
  7587. $7=_st($Object())._new();
  7588. $ctx1.sendIdx["new"]=3;
  7589. if(($receiver = $7) == nil || $receiver == null){
  7590. $6=$7;
  7591. } else {
  7592. $6=true;
  7593. };
  7594. self._assert_equals_($6,true);
  7595. $ctx1.sendIdx["assert:equals:"]=1;
  7596. $9=_st($Object())._new();
  7597. $ctx1.sendIdx["new"]=4;
  7598. if(($receiver = $9) == nil || $receiver == null){
  7599. $8=false;
  7600. } else {
  7601. $8=true;
  7602. };
  7603. self._assert_equals_($8,true);
  7604. $ctx1.sendIdx["assert:equals:"]=2;
  7605. $11=_st($Object())._new();
  7606. if(($receiver = $11) == nil || $receiver == null){
  7607. $10=false;
  7608. } else {
  7609. $10=true;
  7610. };
  7611. self._assert_equals_($10,true);
  7612. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)})},
  7613. args: [],
  7614. 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",
  7615. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7616. referencedClasses: ["Object"]
  7617. }),
  7618. globals.ObjectTest);
  7619. smalltalk.addMethod(
  7620. smalltalk.method({
  7621. selector: "testInstVars",
  7622. protocol: 'tests',
  7623. fn: function (){
  7624. var self=this;
  7625. var o;
  7626. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7627. return smalltalk.withContext(function($ctx1) {
  7628. var $1,$2;
  7629. o=_st($ObjectMock())._new();
  7630. $1=_st(o)._instVarAt_("foo");
  7631. $ctx1.sendIdx["instVarAt:"]=1;
  7632. self._assert_equals_($1,nil);
  7633. $ctx1.sendIdx["assert:equals:"]=1;
  7634. _st(o)._instVarAt_put_("foo",(1));
  7635. $2=_st(o)._instVarAt_("foo");
  7636. $ctx1.sendIdx["instVarAt:"]=2;
  7637. self._assert_equals_($2,(1));
  7638. $ctx1.sendIdx["assert:equals:"]=2;
  7639. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7640. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)})},
  7641. args: [],
  7642. 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",
  7643. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7644. referencedClasses: ["ObjectMock"]
  7645. }),
  7646. globals.ObjectTest);
  7647. smalltalk.addMethod(
  7648. smalltalk.method({
  7649. selector: "testNilUndefined",
  7650. protocol: 'tests',
  7651. fn: function (){
  7652. var self=this;
  7653. return smalltalk.withContext(function($ctx1) {
  7654. self._assert_equals_(self._notDefined(),nil);
  7655. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)})},
  7656. args: [],
  7657. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7658. messageSends: ["assert:equals:", "notDefined"],
  7659. referencedClasses: []
  7660. }),
  7661. globals.ObjectTest);
  7662. smalltalk.addMethod(
  7663. smalltalk.method({
  7664. selector: "testYourself",
  7665. protocol: 'tests',
  7666. fn: function (){
  7667. var self=this;
  7668. var o;
  7669. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7670. return smalltalk.withContext(function($ctx1) {
  7671. o=_st($ObjectMock())._new();
  7672. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7673. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)})},
  7674. args: [],
  7675. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7676. messageSends: ["new", "assert:", "==", "yourself"],
  7677. referencedClasses: ["ObjectMock"]
  7678. }),
  7679. globals.ObjectTest);
  7680. smalltalk.addMethod(
  7681. smalltalk.method({
  7682. selector: "testidentityHash",
  7683. protocol: 'tests',
  7684. fn: function (){
  7685. var self=this;
  7686. var o1,o2;
  7687. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7688. return smalltalk.withContext(function($ctx1) {
  7689. var $2,$3,$1,$5,$4;
  7690. o1=_st($Object())._new();
  7691. $ctx1.sendIdx["new"]=1;
  7692. o2=_st($Object())._new();
  7693. $2=_st(o1)._identityHash();
  7694. $ctx1.sendIdx["identityHash"]=1;
  7695. $3=_st(o1)._identityHash();
  7696. $ctx1.sendIdx["identityHash"]=2;
  7697. $1=_st($2).__eq_eq($3);
  7698. $ctx1.sendIdx["=="]=1;
  7699. self._assert_($1);
  7700. $5=_st(o1)._identityHash();
  7701. $ctx1.sendIdx["identityHash"]=3;
  7702. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7703. self._deny_($4);
  7704. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)})},
  7705. args: [],
  7706. 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",
  7707. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7708. referencedClasses: ["Object"]
  7709. }),
  7710. globals.ObjectTest);
  7711. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  7712. smalltalk.addMethod(
  7713. smalltalk.method({
  7714. selector: "testAccessing",
  7715. protocol: 'tests',
  7716. fn: function (){
  7717. var self=this;
  7718. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7719. return smalltalk.withContext(function($ctx1) {
  7720. var $2,$1,$3,$6,$5,$4;
  7721. $2=_st($Point())._x_y_((3),(4));
  7722. $ctx1.sendIdx["x:y:"]=1;
  7723. $1=_st($2)._x();
  7724. $ctx1.sendIdx["x"]=1;
  7725. self._assert_equals_($1,(3));
  7726. $ctx1.sendIdx["assert:equals:"]=1;
  7727. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7728. $ctx1.sendIdx["y"]=1;
  7729. self._assert_equals_($3,(4));
  7730. $ctx1.sendIdx["assert:equals:"]=2;
  7731. $6=_st($Point())._new();
  7732. $ctx1.sendIdx["new"]=1;
  7733. $5=_st($6)._x_((3));
  7734. $4=_st($5)._x();
  7735. self._assert_equals_($4,(3));
  7736. $ctx1.sendIdx["assert:equals:"]=3;
  7737. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7738. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)})},
  7739. args: [],
  7740. 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",
  7741. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7742. referencedClasses: ["Point"]
  7743. }),
  7744. globals.PointTest);
  7745. smalltalk.addMethod(
  7746. smalltalk.method({
  7747. selector: "testArithmetic",
  7748. protocol: 'tests',
  7749. fn: function (){
  7750. var self=this;
  7751. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7752. return smalltalk.withContext(function($ctx1) {
  7753. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7754. $2=(3).__at((4));
  7755. $ctx1.sendIdx["@"]=1;
  7756. $3=(3).__at((4));
  7757. $ctx1.sendIdx["@"]=2;
  7758. $1=_st($2).__star($3);
  7759. $4=_st($Point())._x_y_((9),(16));
  7760. $ctx1.sendIdx["x:y:"]=1;
  7761. self._assert_equals_($1,$4);
  7762. $ctx1.sendIdx["assert:equals:"]=1;
  7763. $6=(3).__at((4));
  7764. $ctx1.sendIdx["@"]=3;
  7765. $7=(3).__at((4));
  7766. $ctx1.sendIdx["@"]=4;
  7767. $5=_st($6).__plus($7);
  7768. $8=_st($Point())._x_y_((6),(8));
  7769. $ctx1.sendIdx["x:y:"]=2;
  7770. self._assert_equals_($5,$8);
  7771. $ctx1.sendIdx["assert:equals:"]=2;
  7772. $10=(3).__at((4));
  7773. $ctx1.sendIdx["@"]=5;
  7774. $11=(3).__at((4));
  7775. $ctx1.sendIdx["@"]=6;
  7776. $9=_st($10).__minus($11);
  7777. $12=_st($Point())._x_y_((0),(0));
  7778. $ctx1.sendIdx["x:y:"]=3;
  7779. self._assert_equals_($9,$12);
  7780. $ctx1.sendIdx["assert:equals:"]=3;
  7781. $14=(6).__at((8));
  7782. $ctx1.sendIdx["@"]=7;
  7783. $13=_st($14).__slash((3).__at((4)));
  7784. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7785. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)})},
  7786. args: [],
  7787. 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)",
  7788. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7789. referencedClasses: ["Point"]
  7790. }),
  7791. globals.PointTest);
  7792. smalltalk.addMethod(
  7793. smalltalk.method({
  7794. selector: "testAt",
  7795. protocol: 'tests',
  7796. fn: function (){
  7797. var self=this;
  7798. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7799. return smalltalk.withContext(function($ctx1) {
  7800. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7801. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)})},
  7802. args: [],
  7803. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7804. messageSends: ["assert:equals:", "@", "x:y:"],
  7805. referencedClasses: ["Point"]
  7806. }),
  7807. globals.PointTest);
  7808. smalltalk.addMethod(
  7809. smalltalk.method({
  7810. selector: "testEgality",
  7811. protocol: 'tests',
  7812. fn: function (){
  7813. var self=this;
  7814. return smalltalk.withContext(function($ctx1) {
  7815. var $2,$3,$1,$5,$4;
  7816. $2=(3).__at((4));
  7817. $ctx1.sendIdx["@"]=1;
  7818. $3=(3).__at((4));
  7819. $ctx1.sendIdx["@"]=2;
  7820. $1=_st($2).__eq($3);
  7821. $ctx1.sendIdx["="]=1;
  7822. self._assert_($1);
  7823. $5=(3).__at((5));
  7824. $ctx1.sendIdx["@"]=3;
  7825. $4=_st($5).__eq((3).__at((6)));
  7826. self._deny_($4);
  7827. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)})},
  7828. args: [],
  7829. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7830. messageSends: ["assert:", "=", "@", "deny:"],
  7831. referencedClasses: []
  7832. }),
  7833. globals.PointTest);
  7834. smalltalk.addMethod(
  7835. smalltalk.method({
  7836. selector: "testNew",
  7837. protocol: 'tests',
  7838. fn: function (){
  7839. var self=this;
  7840. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7841. return smalltalk.withContext(function($ctx1) {
  7842. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7843. $3=_st($Point())._new();
  7844. $ctx1.sendIdx["new"]=1;
  7845. $2=_st($3)._x_((3));
  7846. $ctx1.sendIdx["x:"]=1;
  7847. $1=_st($2)._y();
  7848. $ctx1.sendIdx["y"]=1;
  7849. self._assert_equals_($1,nil);
  7850. $ctx1.sendIdx["assert:equals:"]=1;
  7851. $7=_st($Point())._new();
  7852. $ctx1.sendIdx["new"]=2;
  7853. $6=_st($7)._x_((3));
  7854. $5=_st($6)._x();
  7855. $ctx1.sendIdx["x"]=1;
  7856. $4=_st($5).__eq((0));
  7857. $ctx1.sendIdx["="]=1;
  7858. self._deny_($4);
  7859. $ctx1.sendIdx["deny:"]=1;
  7860. $10=_st($Point())._new();
  7861. $ctx1.sendIdx["new"]=3;
  7862. $9=_st($10)._y_((4));
  7863. $ctx1.sendIdx["y:"]=1;
  7864. $8=_st($9)._x();
  7865. self._assert_equals_($8,nil);
  7866. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7867. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)})},
  7868. args: [],
  7869. 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",
  7870. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7871. referencedClasses: ["Point"]
  7872. }),
  7873. globals.PointTest);
  7874. smalltalk.addMethod(
  7875. smalltalk.method({
  7876. selector: "testTranslateBy",
  7877. protocol: 'tests',
  7878. fn: function (){
  7879. var self=this;
  7880. return smalltalk.withContext(function($ctx1) {
  7881. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7882. $2=(3).__at((3));
  7883. $ctx1.sendIdx["@"]=1;
  7884. $3=(0).__at((1));
  7885. $ctx1.sendIdx["@"]=2;
  7886. $1=_st($2)._translateBy_($3);
  7887. $ctx1.sendIdx["translateBy:"]=1;
  7888. $4=(3).__at((4));
  7889. $ctx1.sendIdx["@"]=3;
  7890. self._assert_equals_($1,$4);
  7891. $ctx1.sendIdx["assert:equals:"]=1;
  7892. $6=(3).__at((3));
  7893. $ctx1.sendIdx["@"]=4;
  7894. $8=(1)._negated();
  7895. $ctx1.sendIdx["negated"]=1;
  7896. $7=(0).__at($8);
  7897. $ctx1.sendIdx["@"]=5;
  7898. $5=_st($6)._translateBy_($7);
  7899. $ctx1.sendIdx["translateBy:"]=2;
  7900. $9=(3).__at((2));
  7901. $ctx1.sendIdx["@"]=6;
  7902. self._assert_equals_($5,$9);
  7903. $ctx1.sendIdx["assert:equals:"]=2;
  7904. $11=(3).__at((3));
  7905. $ctx1.sendIdx["@"]=7;
  7906. $12=(2).__at((3));
  7907. $ctx1.sendIdx["@"]=8;
  7908. $10=_st($11)._translateBy_($12);
  7909. $ctx1.sendIdx["translateBy:"]=3;
  7910. $13=(5).__at((6));
  7911. $ctx1.sendIdx["@"]=9;
  7912. self._assert_equals_($10,$13);
  7913. $ctx1.sendIdx["assert:equals:"]=3;
  7914. $15=(3).__at((3));
  7915. $ctx1.sendIdx["@"]=10;
  7916. $16=_st((3)._negated()).__at((0));
  7917. $ctx1.sendIdx["@"]=11;
  7918. $14=_st($15)._translateBy_($16);
  7919. self._assert_equals_($14,(0).__at((3)));
  7920. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)})},
  7921. args: [],
  7922. 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.",
  7923. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7924. referencedClasses: []
  7925. }),
  7926. globals.PointTest);
  7927. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  7928. smalltalk.addMethod(
  7929. smalltalk.method({
  7930. selector: "testNextIfAbsent",
  7931. protocol: 'tests',
  7932. fn: function (){
  7933. var self=this;
  7934. var queue;
  7935. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7936. return smalltalk.withContext(function($ctx1) {
  7937. var $2,$1;
  7938. queue=_st($Queue())._new();
  7939. _st(queue)._nextPut_("index1");
  7940. $2=_st(queue)._nextIfAbsent_("empty");
  7941. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7942. $1=_st($2).__eq("index1");
  7943. $ctx1.sendIdx["="]=1;
  7944. self._assert_($1);
  7945. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7946. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)})},
  7947. args: [],
  7948. 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'",
  7949. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7950. referencedClasses: ["Queue"]
  7951. }),
  7952. globals.QueueTest);
  7953. smalltalk.addMethod(
  7954. smalltalk.method({
  7955. selector: "testQueueNext",
  7956. protocol: 'tests',
  7957. fn: function (){
  7958. var self=this;
  7959. var queue;
  7960. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7961. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7962. return smalltalk.withContext(function($ctx1) {
  7963. var $1,$2,$4,$3,$6,$5;
  7964. queue=_st($Queue())._new();
  7965. $1=queue;
  7966. _st($1)._nextPut_("index1");
  7967. $ctx1.sendIdx["nextPut:"]=1;
  7968. $2=_st($1)._nextPut_("index2");
  7969. $4=_st(queue)._next();
  7970. $ctx1.sendIdx["next"]=1;
  7971. $3=_st($4).__eq("index1");
  7972. $ctx1.sendIdx["="]=1;
  7973. self._assert_($3);
  7974. $6=_st(queue)._next();
  7975. $ctx1.sendIdx["next"]=2;
  7976. $5=_st($6).__eq("index");
  7977. self._deny_($5);
  7978. self._should_raise_((function(){
  7979. return smalltalk.withContext(function($ctx2) {
  7980. return _st(queue)._next();
  7981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7982. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)})},
  7983. args: [],
  7984. 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",
  7985. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  7986. referencedClasses: ["Queue", "Error"]
  7987. }),
  7988. globals.QueueTest);
  7989. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  7990. smalltalk.addMethod(
  7991. smalltalk.method({
  7992. selector: "testAtRandomNumber",
  7993. protocol: 'tests',
  7994. fn: function (){
  7995. var self=this;
  7996. var val;
  7997. return smalltalk.withContext(function($ctx1) {
  7998. (100)._timesRepeat_((function(){
  7999. return smalltalk.withContext(function($ctx2) {
  8000. val=(10)._atRandom();
  8001. val;
  8002. self._assert_(_st(val).__gt((0)));
  8003. $ctx2.sendIdx["assert:"]=1;
  8004. return self._assert_(_st(val).__lt((11)));
  8005. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8006. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)})},
  8007. args: [],
  8008. 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]",
  8009. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  8010. referencedClasses: []
  8011. }),
  8012. globals.RandomTest);
  8013. smalltalk.addMethod(
  8014. smalltalk.method({
  8015. selector: "testAtRandomSequenceableCollection",
  8016. protocol: 'tests',
  8017. fn: function (){
  8018. var self=this;
  8019. var val;
  8020. return smalltalk.withContext(function($ctx1) {
  8021. var $3,$4,$2,$1;
  8022. (100)._timesRepeat_((function(){
  8023. return smalltalk.withContext(function($ctx2) {
  8024. val="abc"._atRandom();
  8025. val;
  8026. $3=_st(val).__eq("a");
  8027. $ctx2.sendIdx["="]=1;
  8028. $4=_st(val).__eq("b");
  8029. $ctx2.sendIdx["="]=2;
  8030. $2=_st($3).__or($4);
  8031. $1=_st($2).__or(_st(val).__eq("c"));
  8032. $ctx2.sendIdx["|"]=1;
  8033. return self._assert_($1);
  8034. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8035. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)})},
  8036. args: [],
  8037. 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].",
  8038. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  8039. referencedClasses: []
  8040. }),
  8041. globals.RandomTest);
  8042. smalltalk.addMethod(
  8043. smalltalk.method({
  8044. selector: "textNext",
  8045. protocol: 'tests',
  8046. fn: function (){
  8047. var self=this;
  8048. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  8049. return smalltalk.withContext(function($ctx1) {
  8050. var $1;
  8051. (10000)._timesRepeat_((function(){
  8052. var current,next;
  8053. return smalltalk.withContext(function($ctx2) {
  8054. next=_st(_st($Random())._new())._next();
  8055. next;
  8056. self._assert_(_st(next).__gt_eq((0)));
  8057. $ctx2.sendIdx["assert:"]=1;
  8058. self._assert_(_st(next).__lt((1)));
  8059. $1=_st(current).__eq(next);
  8060. $ctx2.sendIdx["="]=1;
  8061. self._deny_($1);
  8062. return _st(next).__eq(current);
  8063. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8064. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)})},
  8065. args: [],
  8066. 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 ]",
  8067. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8068. referencedClasses: ["Random"]
  8069. }),
  8070. globals.RandomTest);
  8071. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  8072. smalltalk.addMethod(
  8073. smalltalk.method({
  8074. selector: "collectionClass",
  8075. protocol: 'accessing',
  8076. fn: function (){
  8077. var self=this;
  8078. return smalltalk.withContext(function($ctx1) {
  8079. var $1;
  8080. $1=_st(self._class())._collectionClass();
  8081. return $1;
  8082. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)})},
  8083. args: [],
  8084. source: "collectionClass\x0a\x09^ self class collectionClass",
  8085. messageSends: ["collectionClass", "class"],
  8086. referencedClasses: []
  8087. }),
  8088. globals.StreamTest);
  8089. smalltalk.addMethod(
  8090. smalltalk.method({
  8091. selector: "newCollection",
  8092. protocol: 'accessing',
  8093. fn: function (){
  8094. var self=this;
  8095. return smalltalk.withContext(function($ctx1) {
  8096. var $1;
  8097. $1=_st(self._collectionClass())._new();
  8098. return $1;
  8099. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)})},
  8100. args: [],
  8101. source: "newCollection\x0a\x09^ self collectionClass new",
  8102. messageSends: ["new", "collectionClass"],
  8103. referencedClasses: []
  8104. }),
  8105. globals.StreamTest);
  8106. smalltalk.addMethod(
  8107. smalltalk.method({
  8108. selector: "newStream",
  8109. protocol: 'accessing',
  8110. fn: function (){
  8111. var self=this;
  8112. return smalltalk.withContext(function($ctx1) {
  8113. var $1;
  8114. $1=_st(_st(self._collectionClass())._new())._stream();
  8115. return $1;
  8116. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)})},
  8117. args: [],
  8118. source: "newStream\x0a\x09^ self collectionClass new stream",
  8119. messageSends: ["stream", "new", "collectionClass"],
  8120. referencedClasses: []
  8121. }),
  8122. globals.StreamTest);
  8123. smalltalk.addMethod(
  8124. smalltalk.method({
  8125. selector: "testAtStartAtEnd",
  8126. protocol: 'tests',
  8127. fn: function (){
  8128. var self=this;
  8129. var stream;
  8130. return smalltalk.withContext(function($ctx1) {
  8131. var $1,$2,$3,$4;
  8132. stream=self._newStream();
  8133. $1=_st(stream)._atStart();
  8134. $ctx1.sendIdx["atStart"]=1;
  8135. self._assert_($1);
  8136. $ctx1.sendIdx["assert:"]=1;
  8137. $2=_st(stream)._atEnd();
  8138. $ctx1.sendIdx["atEnd"]=1;
  8139. self._assert_($2);
  8140. $ctx1.sendIdx["assert:"]=2;
  8141. _st(stream)._nextPutAll_(self._newCollection());
  8142. $3=_st(stream)._atEnd();
  8143. $ctx1.sendIdx["atEnd"]=2;
  8144. self._assert_($3);
  8145. $4=_st(stream)._atStart();
  8146. $ctx1.sendIdx["atStart"]=2;
  8147. self._deny_($4);
  8148. $ctx1.sendIdx["deny:"]=1;
  8149. _st(stream)._position_((1));
  8150. self._deny_(_st(stream)._atEnd());
  8151. $ctx1.sendIdx["deny:"]=2;
  8152. self._deny_(_st(stream)._atStart());
  8153. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)})},
  8154. args: [],
  8155. 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",
  8156. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8157. referencedClasses: []
  8158. }),
  8159. globals.StreamTest);
  8160. smalltalk.addMethod(
  8161. smalltalk.method({
  8162. selector: "testContents",
  8163. protocol: 'tests',
  8164. fn: function (){
  8165. var self=this;
  8166. var stream;
  8167. return smalltalk.withContext(function($ctx1) {
  8168. var $1,$2;
  8169. stream=self._newStream();
  8170. $1=stream;
  8171. $2=self._newCollection();
  8172. $ctx1.sendIdx["newCollection"]=1;
  8173. _st($1)._nextPutAll_($2);
  8174. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8175. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)})},
  8176. args: [],
  8177. 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",
  8178. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8179. referencedClasses: []
  8180. }),
  8181. globals.StreamTest);
  8182. smalltalk.addMethod(
  8183. smalltalk.method({
  8184. selector: "testIsEmpty",
  8185. protocol: 'tests',
  8186. fn: function (){
  8187. var self=this;
  8188. var stream;
  8189. return smalltalk.withContext(function($ctx1) {
  8190. var $1;
  8191. stream=self._newStream();
  8192. $1=_st(stream)._isEmpty();
  8193. $ctx1.sendIdx["isEmpty"]=1;
  8194. self._assert_($1);
  8195. _st(stream)._nextPutAll_(self._newCollection());
  8196. self._deny_(_st(stream)._isEmpty());
  8197. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)})},
  8198. args: [],
  8199. 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",
  8200. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8201. referencedClasses: []
  8202. }),
  8203. globals.StreamTest);
  8204. smalltalk.addMethod(
  8205. smalltalk.method({
  8206. selector: "testPosition",
  8207. protocol: 'tests',
  8208. fn: function (){
  8209. var self=this;
  8210. var collection,stream;
  8211. return smalltalk.withContext(function($ctx1) {
  8212. var $1,$2,$3;
  8213. collection=self._newCollection();
  8214. stream=self._newStream();
  8215. _st(stream)._nextPutAll_(collection);
  8216. $1=_st(stream)._position();
  8217. $ctx1.sendIdx["position"]=1;
  8218. self._assert_equals_($1,_st(collection)._size());
  8219. $ctx1.sendIdx["assert:equals:"]=1;
  8220. _st(stream)._position_((0));
  8221. $2=_st(stream)._position();
  8222. $ctx1.sendIdx["position"]=2;
  8223. self._assert_equals_($2,(0));
  8224. $ctx1.sendIdx["assert:equals:"]=2;
  8225. _st(stream)._next();
  8226. $ctx1.sendIdx["next"]=1;
  8227. $3=_st(stream)._position();
  8228. $ctx1.sendIdx["position"]=3;
  8229. self._assert_equals_($3,(1));
  8230. $ctx1.sendIdx["assert:equals:"]=3;
  8231. _st(stream)._next();
  8232. self._assert_equals_(_st(stream)._position(),(2));
  8233. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)})},
  8234. args: [],
  8235. 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",
  8236. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8237. referencedClasses: []
  8238. }),
  8239. globals.StreamTest);
  8240. smalltalk.addMethod(
  8241. smalltalk.method({
  8242. selector: "testReading",
  8243. protocol: 'tests',
  8244. fn: function (){
  8245. var self=this;
  8246. var stream,collection;
  8247. return smalltalk.withContext(function($ctx1) {
  8248. var $1,$2,$3;
  8249. collection=self._newCollection();
  8250. stream=self._newStream();
  8251. $1=stream;
  8252. _st($1)._nextPutAll_(collection);
  8253. $2=_st($1)._position_((0));
  8254. _st(collection)._do_((function(each){
  8255. return smalltalk.withContext(function($ctx2) {
  8256. $3=_st(stream)._next();
  8257. $ctx2.sendIdx["next"]=1;
  8258. return self._assert_equals_($3,each);
  8259. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8260. self._assert_(_st(_st(stream)._next())._isNil());
  8261. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)})},
  8262. args: [],
  8263. 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",
  8264. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8265. referencedClasses: []
  8266. }),
  8267. globals.StreamTest);
  8268. smalltalk.addMethod(
  8269. smalltalk.method({
  8270. selector: "testStreamContents",
  8271. protocol: 'tests',
  8272. fn: function (){
  8273. var self=this;
  8274. return self},
  8275. args: [],
  8276. source: "testStreamContents",
  8277. messageSends: [],
  8278. referencedClasses: []
  8279. }),
  8280. globals.StreamTest);
  8281. smalltalk.addMethod(
  8282. smalltalk.method({
  8283. selector: "testWrite",
  8284. protocol: 'tests',
  8285. fn: function (){
  8286. var self=this;
  8287. var stream,collection;
  8288. return smalltalk.withContext(function($ctx1) {
  8289. collection=self._newCollection();
  8290. stream=self._newStream();
  8291. _st(collection)._do_((function(each){
  8292. return smalltalk.withContext(function($ctx2) {
  8293. return _st(stream).__lt_lt(each);
  8294. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8295. self._assert_equals_(_st(stream)._contents(),collection);
  8296. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)})},
  8297. args: [],
  8298. 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",
  8299. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8300. referencedClasses: []
  8301. }),
  8302. globals.StreamTest);
  8303. smalltalk.addMethod(
  8304. smalltalk.method({
  8305. selector: "testWriting",
  8306. protocol: 'tests',
  8307. fn: function (){
  8308. var self=this;
  8309. var stream,collection;
  8310. return smalltalk.withContext(function($ctx1) {
  8311. var $1;
  8312. collection=self._newCollection();
  8313. stream=self._newStream();
  8314. $ctx1.sendIdx["newStream"]=1;
  8315. _st(collection)._do_((function(each){
  8316. return smalltalk.withContext(function($ctx2) {
  8317. return _st(stream)._nextPut_(each);
  8318. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8319. $1=_st(stream)._contents();
  8320. $ctx1.sendIdx["contents"]=1;
  8321. self._assert_equals_($1,collection);
  8322. $ctx1.sendIdx["assert:equals:"]=1;
  8323. stream=self._newStream();
  8324. _st(stream)._nextPutAll_(collection);
  8325. self._assert_equals_(_st(stream)._contents(),collection);
  8326. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)})},
  8327. args: [],
  8328. 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",
  8329. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8330. referencedClasses: []
  8331. }),
  8332. globals.StreamTest);
  8333. smalltalk.addMethod(
  8334. smalltalk.method({
  8335. selector: "collectionClass",
  8336. protocol: 'accessing',
  8337. fn: function (){
  8338. var self=this;
  8339. return nil;
  8340. },
  8341. args: [],
  8342. source: "collectionClass\x0a\x09^ nil",
  8343. messageSends: [],
  8344. referencedClasses: []
  8345. }),
  8346. globals.StreamTest.klass);
  8347. smalltalk.addMethod(
  8348. smalltalk.method({
  8349. selector: "isAbstract",
  8350. protocol: 'testing',
  8351. fn: function (){
  8352. var self=this;
  8353. return smalltalk.withContext(function($ctx1) {
  8354. var $1;
  8355. $1=_st(self._collectionClass())._isNil();
  8356. return $1;
  8357. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)})},
  8358. args: [],
  8359. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8360. messageSends: ["isNil", "collectionClass"],
  8361. referencedClasses: []
  8362. }),
  8363. globals.StreamTest.klass);
  8364. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8365. smalltalk.addMethod(
  8366. smalltalk.method({
  8367. selector: "newCollection",
  8368. protocol: 'accessing',
  8369. fn: function (){
  8370. var self=this;
  8371. return smalltalk.withContext(function($ctx1) {
  8372. var $1;
  8373. $1=[true,(1),(3).__at((4)),"foo"];
  8374. return $1;
  8375. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)})},
  8376. args: [],
  8377. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8378. messageSends: ["@"],
  8379. referencedClasses: []
  8380. }),
  8381. globals.ArrayStreamTest);
  8382. smalltalk.addMethod(
  8383. smalltalk.method({
  8384. selector: "collectionClass",
  8385. protocol: 'accessing',
  8386. fn: function (){
  8387. var self=this;
  8388. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8389. return $Array();
  8390. },
  8391. args: [],
  8392. source: "collectionClass\x0a\x09^ Array",
  8393. messageSends: [],
  8394. referencedClasses: ["Array"]
  8395. }),
  8396. globals.ArrayStreamTest.klass);
  8397. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8398. smalltalk.addMethod(
  8399. smalltalk.method({
  8400. selector: "newCollection",
  8401. protocol: 'accessing',
  8402. fn: function (){
  8403. var self=this;
  8404. return "hello world";
  8405. },
  8406. args: [],
  8407. source: "newCollection\x0a\x09^ 'hello world'",
  8408. messageSends: [],
  8409. referencedClasses: []
  8410. }),
  8411. globals.StringStreamTest);
  8412. smalltalk.addMethod(
  8413. smalltalk.method({
  8414. selector: "collectionClass",
  8415. protocol: 'accessing',
  8416. fn: function (){
  8417. var self=this;
  8418. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8419. return $String();
  8420. },
  8421. args: [],
  8422. source: "collectionClass\x0a\x09^ String",
  8423. messageSends: [],
  8424. referencedClasses: ["String"]
  8425. }),
  8426. globals.StringStreamTest.klass);
  8427. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  8428. smalltalk.addMethod(
  8429. smalltalk.method({
  8430. selector: "testCopying",
  8431. protocol: 'tests',
  8432. fn: function (){
  8433. var self=this;
  8434. return smalltalk.withContext(function($ctx1) {
  8435. self._assert_equals_(nil._copy(),nil);
  8436. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)})},
  8437. args: [],
  8438. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8439. messageSends: ["assert:equals:", "copy"],
  8440. referencedClasses: []
  8441. }),
  8442. globals.UndefinedTest);
  8443. smalltalk.addMethod(
  8444. smalltalk.method({
  8445. selector: "testDeepCopy",
  8446. protocol: 'tests',
  8447. fn: function (){
  8448. var self=this;
  8449. return smalltalk.withContext(function($ctx1) {
  8450. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8451. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)})},
  8452. args: [],
  8453. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8454. messageSends: ["assert:", "=", "deepCopy"],
  8455. referencedClasses: []
  8456. }),
  8457. globals.UndefinedTest);
  8458. smalltalk.addMethod(
  8459. smalltalk.method({
  8460. selector: "testIfNil",
  8461. protocol: 'tests',
  8462. fn: function (){
  8463. var self=this;
  8464. return smalltalk.withContext(function($ctx1) {
  8465. var $1,$3,$2,$4,$6,$5;
  8466. if(($receiver = nil) == nil || $receiver == null){
  8467. $1=true;
  8468. } else {
  8469. $1=nil;
  8470. };
  8471. self._assert_equals_($1,true);
  8472. $ctx1.sendIdx["assert:equals:"]=1;
  8473. if(($receiver = nil) == nil || $receiver == null){
  8474. $3=nil;
  8475. } else {
  8476. $3=true;
  8477. };
  8478. $2=_st($3).__eq(true);
  8479. $ctx1.sendIdx["="]=1;
  8480. self._deny_($2);
  8481. $ctx1.sendIdx["deny:"]=1;
  8482. if(($receiver = nil) == nil || $receiver == null){
  8483. $4=true;
  8484. } else {
  8485. $4=false;
  8486. };
  8487. self._assert_equals_($4,true);
  8488. if(($receiver = nil) == nil || $receiver == null){
  8489. $6=false;
  8490. } else {
  8491. $6=true;
  8492. };
  8493. $5=_st($6).__eq(true);
  8494. self._deny_($5);
  8495. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)})},
  8496. args: [],
  8497. 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",
  8498. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8499. referencedClasses: []
  8500. }),
  8501. globals.UndefinedTest);
  8502. smalltalk.addMethod(
  8503. smalltalk.method({
  8504. selector: "testIsNil",
  8505. protocol: 'tests',
  8506. fn: function (){
  8507. var self=this;
  8508. return smalltalk.withContext(function($ctx1) {
  8509. self._assert_(nil._isNil());
  8510. self._deny_(nil._notNil());
  8511. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)})},
  8512. args: [],
  8513. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8514. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8515. referencedClasses: []
  8516. }),
  8517. globals.UndefinedTest);
  8518. });