Kernel-Tests.js 328 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944
  1. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){
  2. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  3. smalltalk.addPackage('Kernel-Tests');
  4. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5. smalltalk.addClass('AnnouncementSubscriptionTest', globals.TestCase, [], 'Kernel-Tests');
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "testAddExtensionMethod",
  9. protocol: 'tests',
  10. fn: function (){
  11. var self=this;
  12. var method;
  13. return smalltalk.withContext(function($ctx1) {
  14. var $1,$4,$3,$2;
  15. $1=self._class();
  16. $ctx1.sendIdx["class"]=1;
  17. method=_st($1)._compile_protocol_("doNothing","**not-a-package");
  18. $4=self._class();
  19. $ctx1.sendIdx["class"]=2;
  20. $3=_st($4)._package();
  21. $2=_st($3)._isDirty();
  22. self._deny_($2);
  23. _st(self._class())._removeCompiledMethod_(method);
  24. return self}, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method},globals.AnnouncementSubscriptionTest)})},
  25. args: [],
  26. source: "testAddExtensionMethod\x0a\x09| method |\x0a\x09method := self class compile: 'doNothing' protocol: '**not-a-package'.\x0a\x09self deny: self class package isDirty.\x0a\x09self class removeCompiledMethod: method.",
  27. messageSends: ["compile:protocol:", "class", "deny:", "isDirty", "package", "removeCompiledMethod:"],
  28. referencedClasses: []
  29. }),
  30. globals.AnnouncementSubscriptionTest);
  31. smalltalk.addMethod(
  32. smalltalk.method({
  33. selector: "testHandlesAnnouncement",
  34. protocol: 'tests',
  35. fn: function (){
  36. var self=this;
  37. var subscription,announcementClass1,announcementClass2,classBuilder;
  38. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  39. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  40. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  41. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  42. return smalltalk.withContext(function($ctx1) {
  43. var $1,$2;
  44. classBuilder=_st($ClassBuilder())._new();
  45. $ctx1.sendIdx["new"]=1;
  46. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  47. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  48. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  49. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  50. self._assert_equals_($1,true);
  51. $ctx1.sendIdx["assert:equals:"]=1;
  52. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  53. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  54. self._assert_equals_($2,true);
  55. $ctx1.sendIdx["assert:equals:"]=2;
  56. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  57. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  58. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},globals.AnnouncementSubscriptionTest)})},
  59. args: [],
  60. 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.",
  61. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  62. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  63. }),
  64. globals.AnnouncementSubscriptionTest);
  65. smalltalk.addClass('AnnouncerTest', globals.TestCase, [], 'Kernel-Tests');
  66. smalltalk.addMethod(
  67. smalltalk.method({
  68. selector: "testOnDo",
  69. protocol: 'tests',
  70. fn: function (){
  71. var self=this;
  72. var counter,announcer;
  73. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  74. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  75. return smalltalk.withContext(function($ctx1) {
  76. var $1,$2;
  77. counter=(0);
  78. announcer=_st($Announcer())._new();
  79. $ctx1.sendIdx["new"]=1;
  80. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  81. return smalltalk.withContext(function($ctx2) {
  82. counter=_st(counter).__plus((1));
  83. return counter;
  84. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  85. $1=announcer;
  86. $2=_st($SystemAnnouncement())._new();
  87. $ctx1.sendIdx["new"]=2;
  88. _st($1)._announce_($2);
  89. $ctx1.sendIdx["announce:"]=1;
  90. self._assert_equals_(counter,(1));
  91. $ctx1.sendIdx["assert:equals:"]=1;
  92. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  93. self._assert_equals_(counter,(2));
  94. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  95. args: [],
  96. 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.",
  97. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  98. referencedClasses: ["Announcer", "SystemAnnouncement"]
  99. }),
  100. globals.AnnouncerTest);
  101. smalltalk.addMethod(
  102. smalltalk.method({
  103. selector: "testOnDoFor",
  104. protocol: 'tests',
  105. fn: function (){
  106. var self=this;
  107. var counter,announcer;
  108. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  109. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  110. return smalltalk.withContext(function($ctx1) {
  111. var $1,$2,$3,$4;
  112. counter=(0);
  113. announcer=_st($Announcer())._new();
  114. $ctx1.sendIdx["new"]=1;
  115. _st(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  116. return smalltalk.withContext(function($ctx2) {
  117. counter=_st(counter).__plus((1));
  118. return counter;
  119. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),self);
  120. $1=announcer;
  121. $2=_st($SystemAnnouncement())._new();
  122. $ctx1.sendIdx["new"]=2;
  123. _st($1)._announce_($2);
  124. $ctx1.sendIdx["announce:"]=1;
  125. self._assert_equals_(counter,(1));
  126. $ctx1.sendIdx["assert:equals:"]=1;
  127. $3=announcer;
  128. $4=_st($SystemAnnouncement())._new();
  129. $ctx1.sendIdx["new"]=3;
  130. _st($3)._announce_($4);
  131. $ctx1.sendIdx["announce:"]=2;
  132. self._assert_equals_(counter,(2));
  133. $ctx1.sendIdx["assert:equals:"]=2;
  134. _st(announcer)._unsubscribe_(self);
  135. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  136. self._assert_equals_(counter,(2));
  137. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  138. args: [],
  139. source: "testOnDoFor\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ] for: self.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.\x0a\x09\x0a\x09announcer unsubscribe: self.\x0a\x09\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  140. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"],
  141. referencedClasses: ["Announcer", "SystemAnnouncement"]
  142. }),
  143. globals.AnnouncerTest);
  144. smalltalk.addMethod(
  145. smalltalk.method({
  146. selector: "testOnDoOnce",
  147. protocol: 'tests',
  148. fn: function (){
  149. var self=this;
  150. var counter,announcer;
  151. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  152. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  153. return smalltalk.withContext(function($ctx1) {
  154. var $1,$2;
  155. counter=(0);
  156. announcer=_st($Announcer())._new();
  157. $ctx1.sendIdx["new"]=1;
  158. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  159. return smalltalk.withContext(function($ctx2) {
  160. counter=_st(counter).__plus((1));
  161. return counter;
  162. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  163. $1=announcer;
  164. $2=_st($SystemAnnouncement())._new();
  165. $ctx1.sendIdx["new"]=2;
  166. _st($1)._announce_($2);
  167. $ctx1.sendIdx["announce:"]=1;
  168. self._assert_equals_(counter,(1));
  169. $ctx1.sendIdx["assert:equals:"]=1;
  170. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  171. self._assert_equals_(counter,(1));
  172. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  173. args: [],
  174. 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.",
  175. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  176. referencedClasses: ["Announcer", "SystemAnnouncement"]
  177. }),
  178. globals.AnnouncerTest);
  179. smalltalk.addClass('BlockClosureTest', globals.TestCase, [], 'Kernel-Tests');
  180. smalltalk.addMethod(
  181. smalltalk.method({
  182. selector: "testCanClearInterval",
  183. protocol: 'tests',
  184. fn: function (){
  185. var self=this;
  186. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  187. return smalltalk.withContext(function($ctx1) {
  188. self._shouldnt_raise_((function(){
  189. return smalltalk.withContext(function($ctx2) {
  190. return _st(_st((function(){
  191. return smalltalk.withContext(function($ctx3) {
  192. return _st(_st($Error())._new())._signal();
  193. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  195. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},globals.BlockClosureTest)})},
  196. args: [],
  197. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  198. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  199. referencedClasses: ["Error"]
  200. }),
  201. globals.BlockClosureTest);
  202. smalltalk.addMethod(
  203. smalltalk.method({
  204. selector: "testCanClearTimeout",
  205. protocol: 'tests',
  206. fn: function (){
  207. var self=this;
  208. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  209. return smalltalk.withContext(function($ctx1) {
  210. self._shouldnt_raise_((function(){
  211. return smalltalk.withContext(function($ctx2) {
  212. return _st(_st((function(){
  213. return smalltalk.withContext(function($ctx3) {
  214. return _st(_st($Error())._new())._signal();
  215. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  217. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},globals.BlockClosureTest)})},
  218. args: [],
  219. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  220. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  221. referencedClasses: ["Error"]
  222. }),
  223. globals.BlockClosureTest);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "testCompiledSource",
  227. protocol: 'tests',
  228. fn: function (){
  229. var self=this;
  230. return smalltalk.withContext(function($ctx1) {
  231. self._assert_(_st(_st((function(){
  232. return smalltalk.withContext(function($ctx2) {
  233. return (1).__plus((1));
  234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  235. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},globals.BlockClosureTest)})},
  236. args: [],
  237. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  238. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  239. referencedClasses: []
  240. }),
  241. globals.BlockClosureTest);
  242. smalltalk.addMethod(
  243. smalltalk.method({
  244. selector: "testCurrySelf",
  245. protocol: 'tests',
  246. fn: function (){
  247. var self=this;
  248. var curriedMethod,array;
  249. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  250. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  251. return smalltalk.withContext(function($ctx1) {
  252. curriedMethod=_st(_st((function(selfarg,x){
  253. return smalltalk.withContext(function($ctx2) {
  254. return _st(selfarg)._at_(x);
  255. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  256. array=[(3), (1), (4)];
  257. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  258. _st((function(){
  259. return smalltalk.withContext(function($ctx2) {
  260. return self._assert_equals_(_st(array)._foo_((2)),(1));
  261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  262. return smalltalk.withContext(function($ctx2) {
  263. return _st($Array())._removeCompiledMethod_(curriedMethod);
  264. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  265. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},globals.BlockClosureTest)})},
  266. args: [],
  267. 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 ]",
  268. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  269. referencedClasses: ["ClassBuilder", "Array"]
  270. }),
  271. globals.BlockClosureTest);
  272. smalltalk.addMethod(
  273. smalltalk.method({
  274. selector: "testEnsure",
  275. protocol: 'tests',
  276. fn: function (){
  277. var self=this;
  278. return smalltalk.withContext(function($ctx1) {
  279. self._assert_equals_(_st((function(){
  280. return (3);
  281. }))._ensure_((function(){
  282. return (4);
  283. })),(3));
  284. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},globals.BlockClosureTest)})},
  285. args: [],
  286. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  287. messageSends: ["assert:equals:", "ensure:"],
  288. referencedClasses: []
  289. }),
  290. globals.BlockClosureTest);
  291. smalltalk.addMethod(
  292. smalltalk.method({
  293. selector: "testEnsureRaises",
  294. protocol: 'tests',
  295. fn: function (){
  296. var self=this;
  297. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  298. return smalltalk.withContext(function($ctx1) {
  299. self._should_raise_((function(){
  300. return smalltalk.withContext(function($ctx2) {
  301. return _st((function(){
  302. return smalltalk.withContext(function($ctx3) {
  303. return _st(_st($Error())._new())._signal();
  304. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  305. return true;
  306. }));
  307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  308. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},globals.BlockClosureTest)})},
  309. args: [],
  310. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  311. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  312. referencedClasses: ["Error"]
  313. }),
  314. globals.BlockClosureTest);
  315. smalltalk.addMethod(
  316. smalltalk.method({
  317. selector: "testExceptionSemantics",
  318. protocol: 'tests',
  319. fn: function (){
  320. var self=this;
  321. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  322. return smalltalk.withContext(function($ctx1) {
  323. self._timeout_((100));
  324. _st(self._async_((function(){
  325. return smalltalk.withContext(function($ctx2) {
  326. return _st((function(){
  327. return smalltalk.withContext(function($ctx3) {
  328. self._assert_(true);
  329. _st($Error())._signal();
  330. self._deny_(true);
  331. return self._finished();
  332. $ctx3.sendIdx["finished"]=1;
  333. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  334. return smalltalk.withContext(function($ctx3) {
  335. return self._finished();
  336. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  338. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},globals.BlockClosureTest)})},
  339. args: [],
  340. 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",
  341. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  342. referencedClasses: ["Error"]
  343. }),
  344. globals.BlockClosureTest);
  345. smalltalk.addMethod(
  346. smalltalk.method({
  347. selector: "testNewWithValues",
  348. protocol: 'tests',
  349. fn: function (){
  350. var self=this;
  351. return smalltalk.withContext(function($ctx1) {
  352. function TestConstructor(arg1, arg2, arg3) {}
  353. TestConstructor.prototype.name = 'theTestPrototype';
  354. var wrappedConstructor = _st(TestConstructor);
  355. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  356. self._assert_(result instanceof TestConstructor);
  357. self._assert_equals_(result.name, 'theTestPrototype');
  358. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  359. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);;
  360. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},globals.BlockClosureTest)})},
  361. args: [],
  362. source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\x0a\x0a\x09var wrappedConstructor = _st(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._assert_equals_(result.name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);\x0a>",
  363. messageSends: [],
  364. referencedClasses: []
  365. }),
  366. globals.BlockClosureTest);
  367. smalltalk.addMethod(
  368. smalltalk.method({
  369. selector: "testNumArgs",
  370. protocol: 'tests',
  371. fn: function (){
  372. var self=this;
  373. return smalltalk.withContext(function($ctx1) {
  374. var $1;
  375. $1=_st((function(){
  376. }))._numArgs();
  377. $ctx1.sendIdx["numArgs"]=1;
  378. self._assert_equals_($1,(0));
  379. $ctx1.sendIdx["assert:equals:"]=1;
  380. self._assert_equals_(_st((function(a,b){
  381. }))._numArgs(),(2));
  382. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},globals.BlockClosureTest)})},
  383. args: [],
  384. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  385. messageSends: ["assert:equals:", "numArgs"],
  386. referencedClasses: []
  387. }),
  388. globals.BlockClosureTest);
  389. smalltalk.addMethod(
  390. smalltalk.method({
  391. selector: "testOnDo",
  392. protocol: 'tests',
  393. fn: function (){
  394. var self=this;
  395. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  396. return smalltalk.withContext(function($ctx1) {
  397. self._assert_(_st((function(){
  398. return smalltalk.withContext(function($ctx2) {
  399. return _st(_st($Error())._new())._signal();
  400. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  401. return true;
  402. })));
  403. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},globals.BlockClosureTest)})},
  404. args: [],
  405. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  406. messageSends: ["assert:", "on:do:", "signal", "new"],
  407. referencedClasses: ["Error"]
  408. }),
  409. globals.BlockClosureTest);
  410. smalltalk.addMethod(
  411. smalltalk.method({
  412. selector: "testValue",
  413. protocol: 'tests',
  414. fn: function (){
  415. var self=this;
  416. return smalltalk.withContext(function($ctx1) {
  417. var $1;
  418. $1=_st((function(){
  419. return smalltalk.withContext(function($ctx2) {
  420. return (1).__plus((1));
  421. $ctx2.sendIdx["+"]=1;
  422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  423. $ctx1.sendIdx["value"]=1;
  424. self._assert_equals_($1,(2));
  425. $ctx1.sendIdx["assert:equals:"]=1;
  426. self._assert_equals_(_st((function(x){
  427. return smalltalk.withContext(function($ctx2) {
  428. return _st(x).__plus((1));
  429. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  430. $ctx1.sendIdx["assert:equals:"]=2;
  431. self._assert_equals_(_st((function(x,y){
  432. return smalltalk.withContext(function($ctx2) {
  433. return _st(x).__star(y);
  434. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  435. $ctx1.sendIdx["assert:equals:"]=3;
  436. self._assert_equals_(_st((function(a,b,c){
  437. return (1);
  438. }))._value(),(1));
  439. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.BlockClosureTest)})},
  440. args: [],
  441. 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",
  442. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  443. referencedClasses: []
  444. }),
  445. globals.BlockClosureTest);
  446. smalltalk.addMethod(
  447. smalltalk.method({
  448. selector: "testValueWithPossibleArguments",
  449. protocol: 'tests',
  450. fn: function (){
  451. var self=this;
  452. return smalltalk.withContext(function($ctx1) {
  453. var $1,$2;
  454. $1=_st((function(){
  455. return (1);
  456. }))._valueWithPossibleArguments_([(3), (4)]);
  457. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  458. self._assert_equals_($1,(1));
  459. $ctx1.sendIdx["assert:equals:"]=1;
  460. $2=_st((function(a){
  461. return smalltalk.withContext(function($ctx2) {
  462. return _st(a).__plus((4));
  463. $ctx2.sendIdx["+"]=1;
  464. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  465. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  466. self._assert_equals_($2,(7));
  467. $ctx1.sendIdx["assert:equals:"]=2;
  468. self._assert_equals_(_st((function(a,b){
  469. return smalltalk.withContext(function($ctx2) {
  470. return _st(a).__plus(b);
  471. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  472. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},globals.BlockClosureTest)})},
  473. args: [],
  474. 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.",
  475. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  476. referencedClasses: []
  477. }),
  478. globals.BlockClosureTest);
  479. smalltalk.addMethod(
  480. smalltalk.method({
  481. selector: "testWhileFalse",
  482. protocol: 'tests',
  483. fn: function (){
  484. var self=this;
  485. var i;
  486. return smalltalk.withContext(function($ctx1) {
  487. i=(0);
  488. _st((function(){
  489. return smalltalk.withContext(function($ctx2) {
  490. return _st(i).__gt((5));
  491. $ctx2.sendIdx[">"]=1;
  492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  493. return smalltalk.withContext(function($ctx2) {
  494. i=_st(i).__plus((1));
  495. $ctx2.sendIdx["+"]=1;
  496. return i;
  497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  498. self._assert_equals_(i,(6));
  499. $ctx1.sendIdx["assert:equals:"]=1;
  500. i=(0);
  501. _st((function(){
  502. return smalltalk.withContext(function($ctx2) {
  503. i=_st(i).__plus((1));
  504. i;
  505. return _st(i).__gt((5));
  506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  507. self._assert_equals_(i,(6));
  508. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},globals.BlockClosureTest)})},
  509. args: [],
  510. 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",
  511. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  512. referencedClasses: []
  513. }),
  514. globals.BlockClosureTest);
  515. smalltalk.addMethod(
  516. smalltalk.method({
  517. selector: "testWhileTrue",
  518. protocol: 'tests',
  519. fn: function (){
  520. var self=this;
  521. var i;
  522. return smalltalk.withContext(function($ctx1) {
  523. i=(0);
  524. _st((function(){
  525. return smalltalk.withContext(function($ctx2) {
  526. return _st(i).__lt((5));
  527. $ctx2.sendIdx["<"]=1;
  528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  529. return smalltalk.withContext(function($ctx2) {
  530. i=_st(i).__plus((1));
  531. $ctx2.sendIdx["+"]=1;
  532. return i;
  533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  534. self._assert_equals_(i,(5));
  535. $ctx1.sendIdx["assert:equals:"]=1;
  536. i=(0);
  537. _st((function(){
  538. return smalltalk.withContext(function($ctx2) {
  539. i=_st(i).__plus((1));
  540. i;
  541. return _st(i).__lt((5));
  542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  543. self._assert_equals_(i,(5));
  544. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},globals.BlockClosureTest)})},
  545. args: [],
  546. 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",
  547. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  548. referencedClasses: []
  549. }),
  550. globals.BlockClosureTest);
  551. smalltalk.addClass('BooleanTest', globals.TestCase, [], 'Kernel-Tests');
  552. smalltalk.addMethod(
  553. smalltalk.method({
  554. selector: "testEquality",
  555. protocol: 'tests',
  556. fn: function (){
  557. var self=this;
  558. return smalltalk.withContext(function($ctx1) {
  559. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  560. $1=(0).__eq(false);
  561. $ctx1.sendIdx["="]=1;
  562. self._deny_($1);
  563. $ctx1.sendIdx["deny:"]=1;
  564. $2=false.__eq((0));
  565. $ctx1.sendIdx["="]=2;
  566. self._deny_($2);
  567. $ctx1.sendIdx["deny:"]=2;
  568. $3="".__eq(false);
  569. $ctx1.sendIdx["="]=3;
  570. self._deny_($3);
  571. $ctx1.sendIdx["deny:"]=3;
  572. $4=false.__eq("");
  573. $ctx1.sendIdx["="]=4;
  574. self._deny_($4);
  575. $ctx1.sendIdx["deny:"]=4;
  576. $5=true.__eq(true);
  577. $ctx1.sendIdx["="]=5;
  578. self._assert_($5);
  579. $ctx1.sendIdx["assert:"]=1;
  580. $6=false.__eq(true);
  581. $ctx1.sendIdx["="]=6;
  582. self._deny_($6);
  583. $ctx1.sendIdx["deny:"]=5;
  584. $7=true.__eq(false);
  585. $ctx1.sendIdx["="]=7;
  586. self._deny_($7);
  587. $8=false.__eq(false);
  588. $ctx1.sendIdx["="]=8;
  589. self._assert_($8);
  590. $ctx1.sendIdx["assert:"]=2;
  591. $10=true._yourself();
  592. $ctx1.sendIdx["yourself"]=1;
  593. $9=_st($10).__eq(true);
  594. $ctx1.sendIdx["="]=9;
  595. self._assert_($9);
  596. $ctx1.sendIdx["assert:"]=3;
  597. $12=true._yourself();
  598. $ctx1.sendIdx["yourself"]=2;
  599. $11=_st($12).__eq(true._yourself());
  600. self._assert_($11);
  601. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.BooleanTest)})},
  602. args: [],
  603. 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)",
  604. messageSends: ["deny:", "=", "assert:", "yourself"],
  605. referencedClasses: []
  606. }),
  607. globals.BooleanTest);
  608. smalltalk.addMethod(
  609. smalltalk.method({
  610. selector: "testIdentity",
  611. protocol: 'tests',
  612. fn: function (){
  613. var self=this;
  614. return smalltalk.withContext(function($ctx1) {
  615. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  616. $1=(0).__eq_eq(false);
  617. $ctx1.sendIdx["=="]=1;
  618. self._deny_($1);
  619. $ctx1.sendIdx["deny:"]=1;
  620. $2=false.__eq_eq((0));
  621. $ctx1.sendIdx["=="]=2;
  622. self._deny_($2);
  623. $ctx1.sendIdx["deny:"]=2;
  624. $3="".__eq_eq(false);
  625. $ctx1.sendIdx["=="]=3;
  626. self._deny_($3);
  627. $ctx1.sendIdx["deny:"]=3;
  628. $4=false.__eq_eq("");
  629. $ctx1.sendIdx["=="]=4;
  630. self._deny_($4);
  631. $ctx1.sendIdx["deny:"]=4;
  632. $5=true.__eq_eq(true);
  633. $ctx1.sendIdx["=="]=5;
  634. self._assert_($5);
  635. $ctx1.sendIdx["assert:"]=1;
  636. $6=false.__eq_eq(true);
  637. $ctx1.sendIdx["=="]=6;
  638. self._deny_($6);
  639. $ctx1.sendIdx["deny:"]=5;
  640. $7=true.__eq_eq(false);
  641. $ctx1.sendIdx["=="]=7;
  642. self._deny_($7);
  643. $8=false.__eq_eq(false);
  644. $ctx1.sendIdx["=="]=8;
  645. self._assert_($8);
  646. $ctx1.sendIdx["assert:"]=2;
  647. $10=true._yourself();
  648. $ctx1.sendIdx["yourself"]=1;
  649. $9=_st($10).__eq_eq(true);
  650. $ctx1.sendIdx["=="]=9;
  651. self._assert_($9);
  652. $ctx1.sendIdx["assert:"]=3;
  653. $12=true._yourself();
  654. $ctx1.sendIdx["yourself"]=2;
  655. $11=_st($12).__eq_eq(true._yourself());
  656. self._assert_($11);
  657. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.BooleanTest)})},
  658. args: [],
  659. 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",
  660. messageSends: ["deny:", "==", "assert:", "yourself"],
  661. referencedClasses: []
  662. }),
  663. globals.BooleanTest);
  664. smalltalk.addMethod(
  665. smalltalk.method({
  666. selector: "testIfTrueIfFalse",
  667. protocol: 'tests',
  668. fn: function (){
  669. var self=this;
  670. return smalltalk.withContext(function($ctx1) {
  671. var $1,$2,$3,$4,$5,$6,$7,$8;
  672. if(smalltalk.assert(true)){
  673. $1="alternative block";
  674. };
  675. self._assert_equals_($1,"alternative block");
  676. $ctx1.sendIdx["assert:equals:"]=1;
  677. if(! smalltalk.assert(true)){
  678. $2="alternative block";
  679. };
  680. self._assert_equals_($2,nil);
  681. $ctx1.sendIdx["assert:equals:"]=2;
  682. if(smalltalk.assert(false)){
  683. $3="alternative block";
  684. };
  685. self._assert_equals_($3,nil);
  686. $ctx1.sendIdx["assert:equals:"]=3;
  687. if(! smalltalk.assert(false)){
  688. $4="alternative block";
  689. };
  690. self._assert_equals_($4,"alternative block");
  691. $ctx1.sendIdx["assert:equals:"]=4;
  692. if(smalltalk.assert(false)){
  693. $5="alternative block";
  694. } else {
  695. $5="alternative block2";
  696. };
  697. self._assert_equals_($5,"alternative block2");
  698. $ctx1.sendIdx["assert:equals:"]=5;
  699. if(smalltalk.assert(false)){
  700. $6="alternative block2";
  701. } else {
  702. $6="alternative block";
  703. };
  704. self._assert_equals_($6,"alternative block");
  705. $ctx1.sendIdx["assert:equals:"]=6;
  706. if(smalltalk.assert(true)){
  707. $7="alternative block";
  708. } else {
  709. $7="alternative block2";
  710. };
  711. self._assert_equals_($7,"alternative block");
  712. $ctx1.sendIdx["assert:equals:"]=7;
  713. if(smalltalk.assert(true)){
  714. $8="alternative block2";
  715. } else {
  716. $8="alternative block";
  717. };
  718. self._assert_equals_($8,"alternative block2");
  719. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},globals.BooleanTest)})},
  720. args: [],
  721. 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'.",
  722. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  723. referencedClasses: []
  724. }),
  725. globals.BooleanTest);
  726. smalltalk.addMethod(
  727. smalltalk.method({
  728. selector: "testIfTrueIfFalseWithBoxing",
  729. protocol: 'tests',
  730. fn: function (){
  731. var self=this;
  732. return smalltalk.withContext(function($ctx1) {
  733. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  734. $2=true._yourself();
  735. $ctx1.sendIdx["yourself"]=1;
  736. if(smalltalk.assert($2)){
  737. $1="alternative block";
  738. };
  739. self._assert_equals_($1,"alternative block");
  740. $ctx1.sendIdx["assert:equals:"]=1;
  741. $4=true._yourself();
  742. $ctx1.sendIdx["yourself"]=2;
  743. if(! smalltalk.assert($4)){
  744. $3="alternative block";
  745. };
  746. self._assert_equals_($3,nil);
  747. $ctx1.sendIdx["assert:equals:"]=2;
  748. $6=false._yourself();
  749. $ctx1.sendIdx["yourself"]=3;
  750. if(smalltalk.assert($6)){
  751. $5="alternative block";
  752. };
  753. self._assert_equals_($5,nil);
  754. $ctx1.sendIdx["assert:equals:"]=3;
  755. $8=false._yourself();
  756. $ctx1.sendIdx["yourself"]=4;
  757. if(! smalltalk.assert($8)){
  758. $7="alternative block";
  759. };
  760. self._assert_equals_($7,"alternative block");
  761. $ctx1.sendIdx["assert:equals:"]=4;
  762. $10=false._yourself();
  763. $ctx1.sendIdx["yourself"]=5;
  764. if(smalltalk.assert($10)){
  765. $9="alternative block";
  766. } else {
  767. $9="alternative block2";
  768. };
  769. self._assert_equals_($9,"alternative block2");
  770. $ctx1.sendIdx["assert:equals:"]=5;
  771. $12=false._yourself();
  772. $ctx1.sendIdx["yourself"]=6;
  773. if(smalltalk.assert($12)){
  774. $11="alternative block2";
  775. } else {
  776. $11="alternative block";
  777. };
  778. self._assert_equals_($11,"alternative block");
  779. $ctx1.sendIdx["assert:equals:"]=6;
  780. $14=true._yourself();
  781. $ctx1.sendIdx["yourself"]=7;
  782. if(smalltalk.assert($14)){
  783. $13="alternative block";
  784. } else {
  785. $13="alternative block2";
  786. };
  787. self._assert_equals_($13,"alternative block");
  788. $ctx1.sendIdx["assert:equals:"]=7;
  789. $16=true._yourself();
  790. if(smalltalk.assert($16)){
  791. $15="alternative block2";
  792. } else {
  793. $15="alternative block";
  794. };
  795. self._assert_equals_($15,"alternative block2");
  796. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},globals.BooleanTest)})},
  797. args: [],
  798. 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'.",
  799. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  800. referencedClasses: []
  801. }),
  802. globals.BooleanTest);
  803. smalltalk.addMethod(
  804. smalltalk.method({
  805. selector: "testLogic",
  806. protocol: 'tests',
  807. fn: function (){
  808. var self=this;
  809. return smalltalk.withContext(function($ctx1) {
  810. 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;
  811. $1=true.__and(true);
  812. $ctx1.sendIdx["&"]=1;
  813. self._assert_($1);
  814. $ctx1.sendIdx["assert:"]=1;
  815. $2=true.__and(false);
  816. $ctx1.sendIdx["&"]=2;
  817. self._deny_($2);
  818. $ctx1.sendIdx["deny:"]=1;
  819. $3=false.__and(true);
  820. $ctx1.sendIdx["&"]=3;
  821. self._deny_($3);
  822. $ctx1.sendIdx["deny:"]=2;
  823. $5=false.__and(false);
  824. $ctx1.sendIdx["&"]=4;
  825. $4=self._deny_($5);
  826. $ctx1.sendIdx["deny:"]=3;
  827. $6=true.__or(true);
  828. $ctx1.sendIdx["|"]=1;
  829. self._assert_($6);
  830. $ctx1.sendIdx["assert:"]=2;
  831. $7=true.__or(false);
  832. $ctx1.sendIdx["|"]=2;
  833. self._assert_($7);
  834. $ctx1.sendIdx["assert:"]=3;
  835. $8=false.__or(true);
  836. $ctx1.sendIdx["|"]=3;
  837. self._assert_($8);
  838. $ctx1.sendIdx["assert:"]=4;
  839. $10=false.__or(false);
  840. $ctx1.sendIdx["|"]=4;
  841. $9=self._deny_($10);
  842. $ctx1.sendIdx["deny:"]=4;
  843. $12=(1).__gt((0));
  844. $ctx1.sendIdx[">"]=1;
  845. $11=true.__and($12);
  846. $ctx1.sendIdx["&"]=5;
  847. self._assert_($11);
  848. $ctx1.sendIdx["assert:"]=5;
  849. $14=(1).__gt((0));
  850. $ctx1.sendIdx[">"]=2;
  851. $13=_st($14).__and(false);
  852. $ctx1.sendIdx["&"]=6;
  853. self._deny_($13);
  854. $ctx1.sendIdx["deny:"]=5;
  855. $17=(1).__gt((0));
  856. $ctx1.sendIdx[">"]=3;
  857. $18=(1).__gt((2));
  858. $ctx1.sendIdx[">"]=4;
  859. $16=_st($17).__and($18);
  860. $15=self._deny_($16);
  861. $20=(1).__gt((0));
  862. $ctx1.sendIdx[">"]=5;
  863. $19=false.__or($20);
  864. $ctx1.sendIdx["|"]=5;
  865. self._assert_($19);
  866. $ctx1.sendIdx["assert:"]=6;
  867. $22=(1).__gt((0));
  868. $ctx1.sendIdx[">"]=6;
  869. $21=_st($22).__or(false);
  870. $ctx1.sendIdx["|"]=6;
  871. self._assert_($21);
  872. $ctx1.sendIdx["assert:"]=7;
  873. $25=(1).__gt((0));
  874. $ctx1.sendIdx[">"]=7;
  875. $24=_st($25).__or((1).__gt((2)));
  876. $23=self._assert_($24);
  877. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},globals.BooleanTest)})},
  878. args: [],
  879. 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))",
  880. messageSends: ["assert:", "&", "deny:", "|", ">"],
  881. referencedClasses: []
  882. }),
  883. globals.BooleanTest);
  884. smalltalk.addMethod(
  885. smalltalk.method({
  886. selector: "testLogicKeywords",
  887. protocol: 'tests',
  888. fn: function (){
  889. var self=this;
  890. return smalltalk.withContext(function($ctx1) {
  891. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  892. $1=true._and_((function(){
  893. return true;
  894. }));
  895. $ctx1.sendIdx["and:"]=1;
  896. self._assert_($1);
  897. $ctx1.sendIdx["assert:"]=1;
  898. $2=true._and_((function(){
  899. return false;
  900. }));
  901. $ctx1.sendIdx["and:"]=2;
  902. self._deny_($2);
  903. $ctx1.sendIdx["deny:"]=1;
  904. $3=false._and_((function(){
  905. return true;
  906. }));
  907. $ctx1.sendIdx["and:"]=3;
  908. self._deny_($3);
  909. $ctx1.sendIdx["deny:"]=2;
  910. $5=false._and_((function(){
  911. return false;
  912. }));
  913. $ctx1.sendIdx["and:"]=4;
  914. $4=self._deny_($5);
  915. $ctx1.sendIdx["deny:"]=3;
  916. $6=true._or_((function(){
  917. return true;
  918. }));
  919. $ctx1.sendIdx["or:"]=1;
  920. self._assert_($6);
  921. $ctx1.sendIdx["assert:"]=2;
  922. $7=true._or_((function(){
  923. return false;
  924. }));
  925. $ctx1.sendIdx["or:"]=2;
  926. self._assert_($7);
  927. $ctx1.sendIdx["assert:"]=3;
  928. $8=false._or_((function(){
  929. return true;
  930. }));
  931. $ctx1.sendIdx["or:"]=3;
  932. self._assert_($8);
  933. $ctx1.sendIdx["assert:"]=4;
  934. $10=false._or_((function(){
  935. return false;
  936. }));
  937. $ctx1.sendIdx["or:"]=4;
  938. $9=self._deny_($10);
  939. $ctx1.sendIdx["deny:"]=4;
  940. $11=true._and_((function(){
  941. return smalltalk.withContext(function($ctx2) {
  942. return (1).__gt((0));
  943. $ctx2.sendIdx[">"]=1;
  944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  945. $ctx1.sendIdx["and:"]=5;
  946. self._assert_($11);
  947. $ctx1.sendIdx["assert:"]=5;
  948. $13=(1).__gt((0));
  949. $ctx1.sendIdx[">"]=2;
  950. $12=_st($13)._and_((function(){
  951. return false;
  952. }));
  953. $ctx1.sendIdx["and:"]=6;
  954. self._deny_($12);
  955. $ctx1.sendIdx["deny:"]=5;
  956. $16=(1).__gt((0));
  957. $ctx1.sendIdx[">"]=3;
  958. $15=_st($16)._and_((function(){
  959. return smalltalk.withContext(function($ctx2) {
  960. return (1).__gt((2));
  961. $ctx2.sendIdx[">"]=4;
  962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  963. $14=self._deny_($15);
  964. $17=false._or_((function(){
  965. return smalltalk.withContext(function($ctx2) {
  966. return (1).__gt((0));
  967. $ctx2.sendIdx[">"]=5;
  968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  969. $ctx1.sendIdx["or:"]=5;
  970. self._assert_($17);
  971. $ctx1.sendIdx["assert:"]=6;
  972. $19=(1).__gt((0));
  973. $ctx1.sendIdx[">"]=6;
  974. $18=_st($19)._or_((function(){
  975. return false;
  976. }));
  977. $ctx1.sendIdx["or:"]=6;
  978. self._assert_($18);
  979. $ctx1.sendIdx["assert:"]=7;
  980. $22=(1).__gt((0));
  981. $ctx1.sendIdx[">"]=7;
  982. $21=_st($22)._or_((function(){
  983. return smalltalk.withContext(function($ctx2) {
  984. return (1).__gt((2));
  985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  986. $20=self._assert_($21);
  987. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},globals.BooleanTest)})},
  988. args: [],
  989. 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 ])",
  990. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  991. referencedClasses: []
  992. }),
  993. globals.BooleanTest);
  994. smalltalk.addMethod(
  995. smalltalk.method({
  996. selector: "testNonBooleanError",
  997. protocol: 'tests',
  998. fn: function (){
  999. var self=this;
  1000. function $NonBooleanReceiver(){return globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  1001. return smalltalk.withContext(function($ctx1) {
  1002. self._should_raise_((function(){
  1003. return smalltalk.withContext(function($ctx2) {
  1004. if(smalltalk.assert("")){
  1005. } else {
  1006. };
  1007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  1008. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},globals.BooleanTest)})},
  1009. args: [],
  1010. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  1011. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  1012. referencedClasses: ["NonBooleanReceiver"]
  1013. }),
  1014. globals.BooleanTest);
  1015. smalltalk.addClass('ClassBuilderTest', globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  1016. smalltalk.addMethod(
  1017. smalltalk.method({
  1018. selector: "setUp",
  1019. protocol: 'running',
  1020. fn: function (){
  1021. var self=this;
  1022. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  1023. return smalltalk.withContext(function($ctx1) {
  1024. self["@builder"]=_st($ClassBuilder())._new();
  1025. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ClassBuilderTest)})},
  1026. args: [],
  1027. source: "setUp\x0a\x09builder := ClassBuilder new",
  1028. messageSends: ["new"],
  1029. referencedClasses: ["ClassBuilder"]
  1030. }),
  1031. globals.ClassBuilderTest);
  1032. smalltalk.addMethod(
  1033. smalltalk.method({
  1034. selector: "tearDown",
  1035. protocol: 'running',
  1036. fn: function (){
  1037. var self=this;
  1038. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1039. return smalltalk.withContext(function($ctx1) {
  1040. var $1,$receiver;
  1041. $1=self["@theClass"];
  1042. if(($receiver = $1) == null || $receiver.isNil){
  1043. $1;
  1044. } else {
  1045. _st($Smalltalk())._removeClass_(self["@theClass"]);
  1046. self["@theClass"]=nil;
  1047. self["@theClass"];
  1048. };
  1049. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.ClassBuilderTest)})},
  1050. args: [],
  1051. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  1052. messageSends: ["ifNotNil:", "removeClass:"],
  1053. referencedClasses: ["Smalltalk"]
  1054. }),
  1055. globals.ClassBuilderTest);
  1056. smalltalk.addMethod(
  1057. smalltalk.method({
  1058. selector: "testClassCopy",
  1059. protocol: 'tests',
  1060. fn: function (){
  1061. var self=this;
  1062. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1063. return smalltalk.withContext(function($ctx1) {
  1064. var $2,$1,$4,$3,$6,$5,$8,$7;
  1065. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1066. $2=_st(self["@theClass"])._superclass();
  1067. $ctx1.sendIdx["superclass"]=1;
  1068. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1069. $ctx1.sendIdx["=="]=1;
  1070. self._assert_($1);
  1071. $ctx1.sendIdx["assert:"]=1;
  1072. $4=_st(self["@theClass"])._instanceVariableNames();
  1073. $ctx1.sendIdx["instanceVariableNames"]=1;
  1074. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1075. $ctx1.sendIdx["=="]=2;
  1076. self._assert_($3);
  1077. $ctx1.sendIdx["assert:"]=2;
  1078. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1079. $ctx1.sendIdx["assert:equals:"]=1;
  1080. $6=_st(self["@theClass"])._package();
  1081. $ctx1.sendIdx["package"]=1;
  1082. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1083. self._assert_($5);
  1084. $8=_st(self["@theClass"])._methodDictionary();
  1085. $ctx1.sendIdx["methodDictionary"]=1;
  1086. $7=_st($8)._keys();
  1087. $ctx1.sendIdx["keys"]=1;
  1088. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1089. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},globals.ClassBuilderTest)})},
  1090. args: [],
  1091. 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",
  1092. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1093. referencedClasses: ["ObjectMock"]
  1094. }),
  1095. globals.ClassBuilderTest);
  1096. smalltalk.addMethod(
  1097. smalltalk.method({
  1098. selector: "testClassMigration",
  1099. protocol: 'tests',
  1100. fn: function (){
  1101. var self=this;
  1102. var instance,oldClass;
  1103. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1104. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1105. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1106. return smalltalk.withContext(function($ctx1) {
  1107. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  1108. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1109. $2=_st($Smalltalk())._globals();
  1110. $ctx1.sendIdx["globals"]=1;
  1111. $1=_st($2)._at_("ObjectMock2");
  1112. $ctx1.sendIdx["at:"]=1;
  1113. instance=_st($1)._new();
  1114. $4=_st($Smalltalk())._globals();
  1115. $ctx1.sendIdx["globals"]=2;
  1116. $3=_st($4)._at_("ObjectMock2");
  1117. $ctx1.sendIdx["at:"]=2;
  1118. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1119. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1120. $ctx1.sendIdx["=="]=1;
  1121. self._deny_($5);
  1122. $ctx1.sendIdx["deny:"]=1;
  1123. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1124. $ctx1.sendIdx["=="]=2;
  1125. self._assert_($6);
  1126. $ctx1.sendIdx["assert:"]=1;
  1127. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1128. $ctx1.sendIdx["assert:"]=2;
  1129. $7=_st($ObjectMock2())._selectors();
  1130. $ctx1.sendIdx["selectors"]=1;
  1131. self._assert_equals_($7,_st(oldClass)._selectors());
  1132. $ctx1.sendIdx["assert:equals:"]=1;
  1133. $8=_st($ObjectMock2())._comment();
  1134. $ctx1.sendIdx["comment"]=1;
  1135. self._assert_equals_($8,_st(oldClass)._comment());
  1136. $ctx1.sendIdx["assert:equals:"]=2;
  1137. $9=_st(_st($ObjectMock2())._package())._name();
  1138. $ctx1.sendIdx["name"]=1;
  1139. self._assert_equals_($9,"Kernel-Tests");
  1140. $11=_st(instance)._class();
  1141. $ctx1.sendIdx["class"]=1;
  1142. $10=_st($11).__eq_eq($ObjectMock2());
  1143. self._deny_($10);
  1144. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  1145. _st($Smalltalk())._removeClass_($ObjectMock2());
  1146. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},globals.ClassBuilderTest)})},
  1147. args: [],
  1148. 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",
  1149. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1150. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1151. }),
  1152. globals.ClassBuilderTest);
  1153. smalltalk.addMethod(
  1154. smalltalk.method({
  1155. selector: "testClassMigrationWithClassInstanceVariables",
  1156. protocol: 'tests',
  1157. fn: function (){
  1158. var self=this;
  1159. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1160. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1161. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1162. return smalltalk.withContext(function($ctx1) {
  1163. var $1;
  1164. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1165. $1=_st($ObjectMock2())._class();
  1166. $ctx1.sendIdx["class"]=1;
  1167. _st($1)._instanceVariableNames_("foo bar");
  1168. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1169. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1170. _st($Smalltalk())._removeClass_($ObjectMock2());
  1171. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},globals.ClassBuilderTest)})},
  1172. args: [],
  1173. 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",
  1174. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1175. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1176. }),
  1177. globals.ClassBuilderTest);
  1178. smalltalk.addMethod(
  1179. smalltalk.method({
  1180. selector: "testClassMigrationWithSubclasses",
  1181. protocol: 'tests',
  1182. fn: function (){
  1183. var self=this;
  1184. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1185. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1186. function $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1187. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1188. function $ObjectMock4(){return globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1189. return smalltalk.withContext(function($ctx1) {
  1190. var $2,$1,$4,$3;
  1191. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1192. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1193. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1194. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1195. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1196. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1197. $2=_st($ObjectMock())._subclasses();
  1198. $ctx1.sendIdx["subclasses"]=1;
  1199. $1=_st($2)._includes_($ObjectMock2());
  1200. $ctx1.sendIdx["includes:"]=1;
  1201. self._assert_($1);
  1202. $ctx1.sendIdx["assert:"]=1;
  1203. $4=_st($ObjectMock2())._subclasses();
  1204. $ctx1.sendIdx["subclasses"]=2;
  1205. $3=_st($4)._includes_($ObjectMock3());
  1206. $ctx1.sendIdx["includes:"]=2;
  1207. self._assert_($3);
  1208. $ctx1.sendIdx["assert:"]=2;
  1209. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1210. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1211. return smalltalk.withContext(function($ctx2) {
  1212. return _st($Smalltalk())._removeClass_(each);
  1213. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1214. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},globals.ClassBuilderTest)})},
  1215. args: [],
  1216. 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 ]",
  1217. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1218. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1219. }),
  1220. globals.ClassBuilderTest);
  1221. smalltalk.addMethod(
  1222. smalltalk.method({
  1223. selector: "testInstanceVariableNames",
  1224. protocol: 'tests',
  1225. fn: function (){
  1226. var self=this;
  1227. return smalltalk.withContext(function($ctx1) {
  1228. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1229. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},globals.ClassBuilderTest)})},
  1230. args: [],
  1231. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1232. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1233. referencedClasses: []
  1234. }),
  1235. globals.ClassBuilderTest);
  1236. smalltalk.addClass('CollectionTest', globals.TestCase, [], 'Kernel-Tests');
  1237. smalltalk.addMethod(
  1238. smalltalk.method({
  1239. selector: "assertSameContents:as:",
  1240. protocol: 'convenience',
  1241. fn: function (aCollection,anotherCollection){
  1242. var self=this;
  1243. return smalltalk.withContext(function($ctx1) {
  1244. var $2,$1,$4,$3;
  1245. $2=_st(aCollection)._size();
  1246. $ctx1.sendIdx["size"]=1;
  1247. $1=_st($2).__eq(_st(anotherCollection)._size());
  1248. $ctx1.sendIdx["="]=1;
  1249. self._assert_($1);
  1250. $ctx1.sendIdx["assert:"]=1;
  1251. _st(aCollection)._do_((function(each){
  1252. return smalltalk.withContext(function($ctx2) {
  1253. $4=_st(aCollection)._occurrencesOf_(each);
  1254. $ctx2.sendIdx["occurrencesOf:"]=1;
  1255. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1256. return self._assert_($3);
  1257. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1258. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},globals.CollectionTest)})},
  1259. args: ["aCollection", "anotherCollection"],
  1260. 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)) ]",
  1261. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1262. referencedClasses: []
  1263. }),
  1264. globals.CollectionTest);
  1265. smalltalk.addMethod(
  1266. smalltalk.method({
  1267. selector: "collection",
  1268. protocol: 'fixture',
  1269. fn: function (){
  1270. var self=this;
  1271. return smalltalk.withContext(function($ctx1) {
  1272. self._subclassResponsibility();
  1273. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},globals.CollectionTest)})},
  1274. args: [],
  1275. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1276. messageSends: ["subclassResponsibility"],
  1277. referencedClasses: []
  1278. }),
  1279. globals.CollectionTest);
  1280. smalltalk.addMethod(
  1281. smalltalk.method({
  1282. selector: "collectionClass",
  1283. protocol: 'fixture',
  1284. fn: function (){
  1285. var self=this;
  1286. return smalltalk.withContext(function($ctx1) {
  1287. var $1;
  1288. $1=_st(self._class())._collectionClass();
  1289. return $1;
  1290. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.CollectionTest)})},
  1291. args: [],
  1292. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1293. messageSends: ["collectionClass", "class"],
  1294. referencedClasses: []
  1295. }),
  1296. globals.CollectionTest);
  1297. smalltalk.addMethod(
  1298. smalltalk.method({
  1299. selector: "collectionOfPrintStrings",
  1300. protocol: 'fixture',
  1301. fn: function (){
  1302. var self=this;
  1303. return smalltalk.withContext(function($ctx1) {
  1304. self._subclassResponsibility();
  1305. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.CollectionTest)})},
  1306. args: [],
  1307. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1308. messageSends: ["subclassResponsibility"],
  1309. referencedClasses: []
  1310. }),
  1311. globals.CollectionTest);
  1312. smalltalk.addMethod(
  1313. smalltalk.method({
  1314. selector: "collectionSize",
  1315. protocol: 'fixture',
  1316. fn: function (){
  1317. var self=this;
  1318. return smalltalk.withContext(function($ctx1) {
  1319. self._subclassResponsibility();
  1320. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},globals.CollectionTest)})},
  1321. args: [],
  1322. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1323. messageSends: ["subclassResponsibility"],
  1324. referencedClasses: []
  1325. }),
  1326. globals.CollectionTest);
  1327. smalltalk.addMethod(
  1328. smalltalk.method({
  1329. selector: "collectionWithDuplicates",
  1330. protocol: 'fixture',
  1331. fn: function (){
  1332. var self=this;
  1333. return smalltalk.withContext(function($ctx1) {
  1334. self._subclassResponsibility();
  1335. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.CollectionTest)})},
  1336. args: [],
  1337. 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",
  1338. messageSends: ["subclassResponsibility"],
  1339. referencedClasses: []
  1340. }),
  1341. globals.CollectionTest);
  1342. smalltalk.addMethod(
  1343. smalltalk.method({
  1344. selector: "collectionWithNewValue",
  1345. protocol: 'fixture',
  1346. fn: function (){
  1347. var self=this;
  1348. return smalltalk.withContext(function($ctx1) {
  1349. self._subclassResponsibility();
  1350. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.CollectionTest)})},
  1351. args: [],
  1352. 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",
  1353. messageSends: ["subclassResponsibility"],
  1354. referencedClasses: []
  1355. }),
  1356. globals.CollectionTest);
  1357. smalltalk.addMethod(
  1358. smalltalk.method({
  1359. selector: "isCollectionReadOnly",
  1360. protocol: 'testing',
  1361. fn: function (){
  1362. var self=this;
  1363. return false;
  1364. },
  1365. args: [],
  1366. source: "isCollectionReadOnly\x0a\x09^ false",
  1367. messageSends: [],
  1368. referencedClasses: []
  1369. }),
  1370. globals.CollectionTest);
  1371. smalltalk.addMethod(
  1372. smalltalk.method({
  1373. selector: "sampleNewValue",
  1374. protocol: 'fixture',
  1375. fn: function (){
  1376. var self=this;
  1377. return "N";
  1378. },
  1379. args: [],
  1380. 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'",
  1381. messageSends: [],
  1382. referencedClasses: []
  1383. }),
  1384. globals.CollectionTest);
  1385. smalltalk.addMethod(
  1386. smalltalk.method({
  1387. selector: "sampleNewValueAsCollection",
  1388. protocol: 'fixture',
  1389. fn: function (){
  1390. var self=this;
  1391. return smalltalk.withContext(function($ctx1) {
  1392. var $1;
  1393. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1394. return $1;
  1395. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)})},
  1396. args: [],
  1397. 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",
  1398. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1399. referencedClasses: []
  1400. }),
  1401. globals.CollectionTest);
  1402. smalltalk.addMethod(
  1403. smalltalk.method({
  1404. selector: "testAddAll",
  1405. protocol: 'tests',
  1406. fn: function (){
  1407. var self=this;
  1408. return smalltalk.withContext(function($ctx1) {
  1409. 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;
  1410. $2=self._collection();
  1411. $ctx1.sendIdx["collection"]=1;
  1412. $3=$2;
  1413. $5=self._collectionClass();
  1414. $ctx1.sendIdx["collectionClass"]=1;
  1415. $4=_st($5)._new();
  1416. $ctx1.sendIdx["new"]=1;
  1417. _st($3)._addAll_($4);
  1418. $ctx1.sendIdx["addAll:"]=1;
  1419. $6=_st($2)._yourself();
  1420. $ctx1.sendIdx["yourself"]=1;
  1421. $1=$6;
  1422. $7=self._collection();
  1423. $ctx1.sendIdx["collection"]=2;
  1424. self._assert_equals_($1,$7);
  1425. $ctx1.sendIdx["assert:equals:"]=1;
  1426. $10=self._collectionClass();
  1427. $ctx1.sendIdx["collectionClass"]=2;
  1428. $9=_st($10)._new();
  1429. $ctx1.sendIdx["new"]=2;
  1430. $11=$9;
  1431. $12=self._collection();
  1432. $ctx1.sendIdx["collection"]=3;
  1433. _st($11)._addAll_($12);
  1434. $ctx1.sendIdx["addAll:"]=2;
  1435. $13=_st($9)._yourself();
  1436. $ctx1.sendIdx["yourself"]=2;
  1437. $8=$13;
  1438. $14=self._collection();
  1439. $ctx1.sendIdx["collection"]=4;
  1440. self._assert_equals_($8,$14);
  1441. $ctx1.sendIdx["assert:equals:"]=2;
  1442. $17=self._collectionClass();
  1443. $ctx1.sendIdx["collectionClass"]=3;
  1444. $16=_st($17)._new();
  1445. $ctx1.sendIdx["new"]=3;
  1446. $18=$16;
  1447. $20=self._collectionClass();
  1448. $ctx1.sendIdx["collectionClass"]=4;
  1449. $19=_st($20)._new();
  1450. $ctx1.sendIdx["new"]=4;
  1451. _st($18)._addAll_($19);
  1452. $ctx1.sendIdx["addAll:"]=3;
  1453. $21=_st($16)._yourself();
  1454. $ctx1.sendIdx["yourself"]=3;
  1455. $15=$21;
  1456. self._assert_equals_($15,_st(self._collectionClass())._new());
  1457. $ctx1.sendIdx["assert:equals:"]=3;
  1458. $23=self._collection();
  1459. $ctx1.sendIdx["collection"]=5;
  1460. $24=$23;
  1461. $25=self._sampleNewValueAsCollection();
  1462. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1463. _st($24)._addAll_($25);
  1464. $ctx1.sendIdx["addAll:"]=4;
  1465. $26=_st($23)._yourself();
  1466. $ctx1.sendIdx["yourself"]=4;
  1467. $22=$26;
  1468. $27=self._collectionWithNewValue();
  1469. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1470. self._assert_equals_($22,$27);
  1471. $28=self._sampleNewValueAsCollection();
  1472. _st($28)._addAll_(self._collection());
  1473. $29=_st($28)._yourself();
  1474. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1475. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)})},
  1476. args: [],
  1477. 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",
  1478. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1479. referencedClasses: []
  1480. }),
  1481. globals.CollectionTest);
  1482. smalltalk.addMethod(
  1483. smalltalk.method({
  1484. selector: "testAllSatisfy",
  1485. protocol: 'tests',
  1486. fn: function (){
  1487. var self=this;
  1488. var collection,anyOne;
  1489. return smalltalk.withContext(function($ctx1) {
  1490. var $1;
  1491. collection=self._collection();
  1492. anyOne=_st(collection)._anyOne();
  1493. $1=_st(collection)._allSatisfy_((function(each){
  1494. return smalltalk.withContext(function($ctx2) {
  1495. return _st(collection)._includes_(each);
  1496. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1497. $ctx1.sendIdx["allSatisfy:"]=1;
  1498. self._assert_($1);
  1499. self._deny_(_st(collection)._allSatisfy_((function(each){
  1500. return smalltalk.withContext(function($ctx2) {
  1501. return _st(each).__tild_eq(anyOne);
  1502. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1503. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)})},
  1504. args: [],
  1505. 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 ])",
  1506. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1507. referencedClasses: []
  1508. }),
  1509. globals.CollectionTest);
  1510. smalltalk.addMethod(
  1511. smalltalk.method({
  1512. selector: "testAnyOne",
  1513. protocol: 'tests',
  1514. fn: function (){
  1515. var self=this;
  1516. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1517. return smalltalk.withContext(function($ctx1) {
  1518. var $2,$1;
  1519. self._should_raise_((function(){
  1520. return smalltalk.withContext(function($ctx2) {
  1521. return _st(_st(self._collectionClass())._new())._anyOne();
  1522. $ctx2.sendIdx["anyOne"]=1;
  1523. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1524. $2=self._collection();
  1525. $ctx1.sendIdx["collection"]=1;
  1526. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1527. self._assert_($1);
  1528. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)})},
  1529. args: [],
  1530. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1531. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1532. referencedClasses: ["Error"]
  1533. }),
  1534. globals.CollectionTest);
  1535. smalltalk.addMethod(
  1536. smalltalk.method({
  1537. selector: "testAnySatisfy",
  1538. protocol: 'tests',
  1539. fn: function (){
  1540. var self=this;
  1541. var anyOne;
  1542. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1543. return smalltalk.withContext(function($ctx1) {
  1544. var $1,$3,$2;
  1545. $1=self._collection();
  1546. $ctx1.sendIdx["collection"]=1;
  1547. anyOne=_st($1)._anyOne();
  1548. $3=self._collection();
  1549. $ctx1.sendIdx["collection"]=2;
  1550. $2=_st($3)._anySatisfy_((function(each){
  1551. return smalltalk.withContext(function($ctx2) {
  1552. return _st(each).__eq(anyOne);
  1553. $ctx2.sendIdx["="]=1;
  1554. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1555. $ctx1.sendIdx["anySatisfy:"]=1;
  1556. self._assert_($2);
  1557. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1558. return smalltalk.withContext(function($ctx2) {
  1559. return _st(each).__eq(_st($Object())._new());
  1560. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1561. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  1562. args: [],
  1563. 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 ])",
  1564. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1565. referencedClasses: ["Object"]
  1566. }),
  1567. globals.CollectionTest);
  1568. smalltalk.addMethod(
  1569. smalltalk.method({
  1570. selector: "testAsArray",
  1571. protocol: 'tests',
  1572. fn: function (){
  1573. var self=this;
  1574. return smalltalk.withContext(function($ctx1) {
  1575. var $1;
  1576. $1=self._collection();
  1577. $ctx1.sendIdx["collection"]=1;
  1578. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1579. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)})},
  1580. args: [],
  1581. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1582. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1583. referencedClasses: []
  1584. }),
  1585. globals.CollectionTest);
  1586. smalltalk.addMethod(
  1587. smalltalk.method({
  1588. selector: "testAsOrderedCollection",
  1589. protocol: 'tests',
  1590. fn: function (){
  1591. var self=this;
  1592. return smalltalk.withContext(function($ctx1) {
  1593. var $1;
  1594. $1=self._collection();
  1595. $ctx1.sendIdx["collection"]=1;
  1596. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1597. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)})},
  1598. args: [],
  1599. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1600. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1601. referencedClasses: []
  1602. }),
  1603. globals.CollectionTest);
  1604. smalltalk.addMethod(
  1605. smalltalk.method({
  1606. selector: "testAsSet",
  1607. protocol: 'tests',
  1608. fn: function (){
  1609. var self=this;
  1610. var c,set;
  1611. return smalltalk.withContext(function($ctx1) {
  1612. c=self._collectionWithDuplicates();
  1613. set=_st(c)._asSet();
  1614. self._assert_equals_(_st(set)._size(),(5));
  1615. _st(c)._do_((function(each){
  1616. return smalltalk.withContext(function($ctx2) {
  1617. return self._assert_(_st(set)._includes_(each));
  1618. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1619. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)})},
  1620. args: [],
  1621. 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) ]",
  1622. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1623. referencedClasses: []
  1624. }),
  1625. globals.CollectionTest);
  1626. smalltalk.addMethod(
  1627. smalltalk.method({
  1628. selector: "testCollect",
  1629. protocol: 'tests',
  1630. fn: function (){
  1631. var self=this;
  1632. return smalltalk.withContext(function($ctx1) {
  1633. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1634. $2=self._collection();
  1635. $ctx1.sendIdx["collection"]=1;
  1636. $1=_st($2)._collect_((function(each){
  1637. return each;
  1638. }));
  1639. $ctx1.sendIdx["collect:"]=1;
  1640. $3=self._collection();
  1641. $ctx1.sendIdx["collection"]=2;
  1642. self._assert_equals_($1,$3);
  1643. $ctx1.sendIdx["assert:equals:"]=1;
  1644. $5=self._collectionWithNewValue();
  1645. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1646. $4=_st($5)._collect_((function(each){
  1647. return each;
  1648. }));
  1649. $ctx1.sendIdx["collect:"]=2;
  1650. self._assert_equals_($4,self._collectionWithNewValue());
  1651. $ctx1.sendIdx["assert:equals:"]=2;
  1652. $8=self._collectionClass();
  1653. $ctx1.sendIdx["collectionClass"]=1;
  1654. $7=_st($8)._new();
  1655. $ctx1.sendIdx["new"]=1;
  1656. $6=_st($7)._collect_((function(each){
  1657. return smalltalk.withContext(function($ctx2) {
  1658. return _st(each)._printString();
  1659. $ctx2.sendIdx["printString"]=1;
  1660. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1661. $ctx1.sendIdx["collect:"]=3;
  1662. self._assert_equals_($6,_st(self._collectionClass())._new());
  1663. $ctx1.sendIdx["assert:equals:"]=3;
  1664. $11=self._collection();
  1665. $ctx1.sendIdx["collection"]=3;
  1666. $10=_st($11)._collect_((function(){
  1667. return smalltalk.withContext(function($ctx2) {
  1668. return self._sampleNewValue();
  1669. $ctx2.sendIdx["sampleNewValue"]=1;
  1670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1671. $ctx1.sendIdx["collect:"]=4;
  1672. $9=_st($10)._detect_((function(){
  1673. return true;
  1674. }));
  1675. self._assert_equals_($9,self._sampleNewValue());
  1676. $ctx1.sendIdx["assert:equals:"]=4;
  1677. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1678. return smalltalk.withContext(function($ctx2) {
  1679. return _st(each)._printString();
  1680. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1681. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)})},
  1682. args: [],
  1683. 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",
  1684. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1685. referencedClasses: []
  1686. }),
  1687. globals.CollectionTest);
  1688. smalltalk.addMethod(
  1689. smalltalk.method({
  1690. selector: "testComma",
  1691. protocol: 'tests',
  1692. fn: function (){
  1693. var self=this;
  1694. return smalltalk.withContext(function($ctx1) {
  1695. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1696. $2=self._collection();
  1697. $ctx1.sendIdx["collection"]=1;
  1698. $4=self._collectionClass();
  1699. $ctx1.sendIdx["collectionClass"]=1;
  1700. $3=_st($4)._new();
  1701. $ctx1.sendIdx["new"]=1;
  1702. $1=_st($2).__comma($3);
  1703. $ctx1.sendIdx[","]=1;
  1704. $5=self._collection();
  1705. $ctx1.sendIdx["collection"]=2;
  1706. self._assert_equals_($1,$5);
  1707. $ctx1.sendIdx["assert:equals:"]=1;
  1708. $8=self._collectionClass();
  1709. $ctx1.sendIdx["collectionClass"]=2;
  1710. $7=_st($8)._new();
  1711. $ctx1.sendIdx["new"]=2;
  1712. $9=self._collection();
  1713. $ctx1.sendIdx["collection"]=3;
  1714. $6=_st($7).__comma($9);
  1715. $ctx1.sendIdx[","]=2;
  1716. $10=self._collection();
  1717. $ctx1.sendIdx["collection"]=4;
  1718. self._assert_equals_($6,$10);
  1719. $ctx1.sendIdx["assert:equals:"]=2;
  1720. $13=self._collectionClass();
  1721. $ctx1.sendIdx["collectionClass"]=3;
  1722. $12=_st($13)._new();
  1723. $ctx1.sendIdx["new"]=3;
  1724. $15=self._collectionClass();
  1725. $ctx1.sendIdx["collectionClass"]=4;
  1726. $14=_st($15)._new();
  1727. $ctx1.sendIdx["new"]=4;
  1728. $11=_st($12).__comma($14);
  1729. $ctx1.sendIdx[","]=3;
  1730. self._assert_equals_($11,_st(self._collectionClass())._new());
  1731. $ctx1.sendIdx["assert:equals:"]=3;
  1732. $17=self._collection();
  1733. $ctx1.sendIdx["collection"]=5;
  1734. $18=self._sampleNewValueAsCollection();
  1735. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1736. $16=_st($17).__comma($18);
  1737. $ctx1.sendIdx[","]=4;
  1738. $19=self._collectionWithNewValue();
  1739. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1740. self._assert_equals_($16,$19);
  1741. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1742. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)})},
  1743. args: [],
  1744. 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",
  1745. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1746. referencedClasses: []
  1747. }),
  1748. globals.CollectionTest);
  1749. smalltalk.addMethod(
  1750. smalltalk.method({
  1751. selector: "testDetect",
  1752. protocol: 'tests',
  1753. fn: function (){
  1754. var self=this;
  1755. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1756. return smalltalk.withContext(function($ctx1) {
  1757. var $1,$2,$3,$4,$6,$5,$7;
  1758. self._shouldnt_raise_((function(){
  1759. return smalltalk.withContext(function($ctx2) {
  1760. $1=self._collection();
  1761. $ctx2.sendIdx["collection"]=1;
  1762. return _st($1)._detect_((function(){
  1763. return true;
  1764. }));
  1765. $ctx2.sendIdx["detect:"]=1;
  1766. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1767. self._should_raise_((function(){
  1768. return smalltalk.withContext(function($ctx2) {
  1769. $2=self._collection();
  1770. $ctx2.sendIdx["collection"]=2;
  1771. return _st($2)._detect_((function(){
  1772. return false;
  1773. }));
  1774. $ctx2.sendIdx["detect:"]=2;
  1775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1776. $ctx1.sendIdx["should:raise:"]=1;
  1777. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1778. return true;
  1779. }));
  1780. $ctx1.sendIdx["detect:"]=3;
  1781. $4=self._sampleNewValue();
  1782. $ctx1.sendIdx["sampleNewValue"]=1;
  1783. self._assert_equals_($3,$4);
  1784. $ctx1.sendIdx["assert:equals:"]=1;
  1785. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1786. return smalltalk.withContext(function($ctx2) {
  1787. $6=self._sampleNewValue();
  1788. $ctx2.sendIdx["sampleNewValue"]=2;
  1789. return _st(each).__eq($6);
  1790. $ctx2.sendIdx["="]=1;
  1791. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1792. $ctx1.sendIdx["detect:"]=4;
  1793. $7=self._sampleNewValue();
  1794. $ctx1.sendIdx["sampleNewValue"]=3;
  1795. self._assert_equals_($5,$7);
  1796. self._should_raise_((function(){
  1797. return smalltalk.withContext(function($ctx2) {
  1798. return _st(self._collection())._detect_((function(each){
  1799. return smalltalk.withContext(function($ctx3) {
  1800. return _st(each).__eq(self._sampleNewValue());
  1801. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1803. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)})},
  1804. args: [],
  1805. 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",
  1806. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1807. referencedClasses: ["Error"]
  1808. }),
  1809. globals.CollectionTest);
  1810. smalltalk.addMethod(
  1811. smalltalk.method({
  1812. selector: "testDetectIfNone",
  1813. protocol: 'tests',
  1814. fn: function (){
  1815. var self=this;
  1816. var sentinel;
  1817. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1818. return smalltalk.withContext(function($ctx1) {
  1819. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1820. sentinel=_st($Object())._new();
  1821. $3=self._collection();
  1822. $ctx1.sendIdx["collection"]=1;
  1823. $2=_st($3)._detect_ifNone_((function(){
  1824. return true;
  1825. }),(function(){
  1826. return sentinel;
  1827. }));
  1828. $ctx1.sendIdx["detect:ifNone:"]=1;
  1829. $1=_st($2).__tild_eq(sentinel);
  1830. self._assert_($1);
  1831. $5=self._collection();
  1832. $ctx1.sendIdx["collection"]=2;
  1833. $4=_st($5)._detect_ifNone_((function(){
  1834. return false;
  1835. }),(function(){
  1836. return sentinel;
  1837. }));
  1838. $ctx1.sendIdx["detect:ifNone:"]=2;
  1839. self._assert_equals_($4,sentinel);
  1840. $ctx1.sendIdx["assert:equals:"]=1;
  1841. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1842. return true;
  1843. }),(function(){
  1844. return sentinel;
  1845. }));
  1846. $ctx1.sendIdx["detect:ifNone:"]=3;
  1847. $7=self._sampleNewValue();
  1848. $ctx1.sendIdx["sampleNewValue"]=1;
  1849. self._assert_equals_($6,$7);
  1850. $ctx1.sendIdx["assert:equals:"]=2;
  1851. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1852. return smalltalk.withContext(function($ctx2) {
  1853. $9=self._sampleNewValue();
  1854. $ctx2.sendIdx["sampleNewValue"]=2;
  1855. return _st(each).__eq($9);
  1856. $ctx2.sendIdx["="]=1;
  1857. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1858. return sentinel;
  1859. }));
  1860. $ctx1.sendIdx["detect:ifNone:"]=4;
  1861. $10=self._sampleNewValue();
  1862. $ctx1.sendIdx["sampleNewValue"]=3;
  1863. self._assert_equals_($8,$10);
  1864. $ctx1.sendIdx["assert:equals:"]=3;
  1865. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1866. return smalltalk.withContext(function($ctx2) {
  1867. return _st(each).__eq(self._sampleNewValue());
  1868. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1869. return sentinel;
  1870. })),sentinel);
  1871. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)})},
  1872. args: [],
  1873. 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",
  1874. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1875. referencedClasses: ["Object"]
  1876. }),
  1877. globals.CollectionTest);
  1878. smalltalk.addMethod(
  1879. smalltalk.method({
  1880. selector: "testDo",
  1881. protocol: 'tests',
  1882. fn: function (){
  1883. var self=this;
  1884. var newCollection;
  1885. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1886. return smalltalk.withContext(function($ctx1) {
  1887. var $1,$2;
  1888. newCollection=_st($OrderedCollection())._new();
  1889. $ctx1.sendIdx["new"]=1;
  1890. $1=self._collection();
  1891. $ctx1.sendIdx["collection"]=1;
  1892. _st($1)._do_((function(each){
  1893. return smalltalk.withContext(function($ctx2) {
  1894. return _st(newCollection)._add_(each);
  1895. $ctx2.sendIdx["add:"]=1;
  1896. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1897. $ctx1.sendIdx["do:"]=1;
  1898. self._assertSameContents_as_(self._collection(),newCollection);
  1899. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1900. newCollection=_st($OrderedCollection())._new();
  1901. $2=self._collectionWithDuplicates();
  1902. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1903. _st($2)._do_((function(each){
  1904. return smalltalk.withContext(function($ctx2) {
  1905. return _st(newCollection)._add_(each);
  1906. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1907. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1908. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)})},
  1909. args: [],
  1910. 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",
  1911. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1912. referencedClasses: ["OrderedCollection"]
  1913. }),
  1914. globals.CollectionTest);
  1915. smalltalk.addMethod(
  1916. smalltalk.method({
  1917. selector: "testIfEmptyFamily",
  1918. protocol: 'tests',
  1919. fn: function (){
  1920. var self=this;
  1921. return smalltalk.withContext(function($ctx1) {
  1922. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1923. $3=self._collectionClass();
  1924. $ctx1.sendIdx["collectionClass"]=1;
  1925. $2=_st($3)._new();
  1926. $ctx1.sendIdx["new"]=1;
  1927. $1=_st($2)._ifEmpty_((function(){
  1928. return (42);
  1929. }));
  1930. $ctx1.sendIdx["ifEmpty:"]=1;
  1931. self._assert_equals_($1,(42));
  1932. $ctx1.sendIdx["assert:equals:"]=1;
  1933. $5=self._collection();
  1934. $ctx1.sendIdx["collection"]=1;
  1935. $4=_st($5)._ifEmpty_((function(){
  1936. return (42);
  1937. }));
  1938. $6=self._collection();
  1939. $ctx1.sendIdx["collection"]=2;
  1940. self._assert_equals_($4,$6);
  1941. $ctx1.sendIdx["assert:equals:"]=2;
  1942. $9=self._collectionClass();
  1943. $ctx1.sendIdx["collectionClass"]=2;
  1944. $8=_st($9)._new();
  1945. $ctx1.sendIdx["new"]=2;
  1946. $7=_st($8)._ifNotEmpty_((function(){
  1947. return (42);
  1948. }));
  1949. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1950. $11=self._collectionClass();
  1951. $ctx1.sendIdx["collectionClass"]=3;
  1952. $10=_st($11)._new();
  1953. $ctx1.sendIdx["new"]=3;
  1954. self._assert_equals_($7,$10);
  1955. $ctx1.sendIdx["assert:equals:"]=3;
  1956. $13=self._collection();
  1957. $ctx1.sendIdx["collection"]=3;
  1958. $12=_st($13)._ifNotEmpty_((function(){
  1959. return (42);
  1960. }));
  1961. self._assert_equals_($12,(42));
  1962. $ctx1.sendIdx["assert:equals:"]=4;
  1963. $16=self._collectionClass();
  1964. $ctx1.sendIdx["collectionClass"]=4;
  1965. $15=_st($16)._new();
  1966. $ctx1.sendIdx["new"]=4;
  1967. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1968. return (42);
  1969. }),(function(){
  1970. return (999);
  1971. }));
  1972. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1973. self._assert_equals_($14,(42));
  1974. $ctx1.sendIdx["assert:equals:"]=5;
  1975. $18=self._collection();
  1976. $ctx1.sendIdx["collection"]=4;
  1977. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1978. return (42);
  1979. }),(function(){
  1980. return (999);
  1981. }));
  1982. self._assert_equals_($17,(999));
  1983. $ctx1.sendIdx["assert:equals:"]=6;
  1984. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1985. return (42);
  1986. }),(function(){
  1987. return (999);
  1988. }));
  1989. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1990. self._assert_equals_($19,(999));
  1991. $ctx1.sendIdx["assert:equals:"]=7;
  1992. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1993. return (42);
  1994. }),(function(){
  1995. return (999);
  1996. })),(42));
  1997. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)})},
  1998. args: [],
  1999. 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",
  2000. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  2001. referencedClasses: []
  2002. }),
  2003. globals.CollectionTest);
  2004. smalltalk.addMethod(
  2005. smalltalk.method({
  2006. selector: "testIsEmpty",
  2007. protocol: 'tests',
  2008. fn: function (){
  2009. var self=this;
  2010. return smalltalk.withContext(function($ctx1) {
  2011. var $1;
  2012. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  2013. $ctx1.sendIdx["isEmpty"]=1;
  2014. self._assert_($1);
  2015. self._deny_(_st(self._collection())._isEmpty());
  2016. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)})},
  2017. args: [],
  2018. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  2019. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  2020. referencedClasses: []
  2021. }),
  2022. globals.CollectionTest);
  2023. smalltalk.addMethod(
  2024. smalltalk.method({
  2025. selector: "testNoneSatisfy",
  2026. protocol: 'tests',
  2027. fn: function (){
  2028. var self=this;
  2029. var anyOne;
  2030. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2031. return smalltalk.withContext(function($ctx1) {
  2032. var $1,$3,$2;
  2033. $1=self._collection();
  2034. $ctx1.sendIdx["collection"]=1;
  2035. anyOne=_st($1)._anyOne();
  2036. $3=self._collection();
  2037. $ctx1.sendIdx["collection"]=2;
  2038. $2=_st($3)._noneSatisfy_((function(each){
  2039. return smalltalk.withContext(function($ctx2) {
  2040. return _st(each).__eq(anyOne);
  2041. $ctx2.sendIdx["="]=1;
  2042. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2043. $ctx1.sendIdx["noneSatisfy:"]=1;
  2044. self._deny_($2);
  2045. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2046. return smalltalk.withContext(function($ctx2) {
  2047. return _st(each).__eq(_st($Object())._new());
  2048. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2049. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  2050. args: [],
  2051. 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 ])",
  2052. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2053. referencedClasses: ["Object"]
  2054. }),
  2055. globals.CollectionTest);
  2056. smalltalk.addMethod(
  2057. smalltalk.method({
  2058. selector: "testRemoveAll",
  2059. protocol: 'tests',
  2060. fn: function (){
  2061. var self=this;
  2062. return smalltalk.withContext(function($ctx1) {
  2063. var $1,$2;
  2064. $1=self._collection();
  2065. _st($1)._removeAll();
  2066. $2=_st($1)._yourself();
  2067. self._assert_equals_($2,_st(self._collectionClass())._new());
  2068. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)})},
  2069. args: [],
  2070. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2071. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2072. referencedClasses: []
  2073. }),
  2074. globals.CollectionTest);
  2075. smalltalk.addMethod(
  2076. smalltalk.method({
  2077. selector: "testSelect",
  2078. protocol: 'tests',
  2079. fn: function (){
  2080. var self=this;
  2081. return smalltalk.withContext(function($ctx1) {
  2082. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2083. $2=self._collection();
  2084. $ctx1.sendIdx["collection"]=1;
  2085. $1=_st($2)._select_((function(){
  2086. return false;
  2087. }));
  2088. $ctx1.sendIdx["select:"]=1;
  2089. $4=self._collectionClass();
  2090. $ctx1.sendIdx["collectionClass"]=1;
  2091. $3=_st($4)._new();
  2092. $ctx1.sendIdx["new"]=1;
  2093. self._assert_equals_($1,$3);
  2094. $ctx1.sendIdx["assert:equals:"]=1;
  2095. $6=self._collection();
  2096. $ctx1.sendIdx["collection"]=2;
  2097. $5=_st($6)._select_((function(){
  2098. return true;
  2099. }));
  2100. $ctx1.sendIdx["select:"]=2;
  2101. $7=self._collection();
  2102. $ctx1.sendIdx["collection"]=3;
  2103. self._assert_equals_($5,$7);
  2104. $ctx1.sendIdx["assert:equals:"]=2;
  2105. $9=self._collectionWithNewValue();
  2106. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2107. $8=_st($9)._select_((function(each){
  2108. return smalltalk.withContext(function($ctx2) {
  2109. $10=self._sampleNewValue();
  2110. $ctx2.sendIdx["sampleNewValue"]=1;
  2111. return _st(each).__eq($10);
  2112. $ctx2.sendIdx["="]=1;
  2113. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2114. $ctx1.sendIdx["select:"]=3;
  2115. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2116. $ctx1.sendIdx["assert:equals:"]=3;
  2117. $12=self._collectionWithNewValue();
  2118. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2119. $11=_st($12)._select_((function(each){
  2120. return smalltalk.withContext(function($ctx2) {
  2121. $13=self._sampleNewValue();
  2122. $ctx2.sendIdx["sampleNewValue"]=2;
  2123. return _st(each).__tild_eq($13);
  2124. $ctx2.sendIdx["~="]=1;
  2125. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2126. $ctx1.sendIdx["select:"]=4;
  2127. $14=self._collection();
  2128. $ctx1.sendIdx["collection"]=4;
  2129. self._assert_equals_($11,$14);
  2130. $ctx1.sendIdx["assert:equals:"]=4;
  2131. $16=self._collection();
  2132. $ctx1.sendIdx["collection"]=5;
  2133. $15=_st($16)._select_((function(each){
  2134. return smalltalk.withContext(function($ctx2) {
  2135. $17=self._sampleNewValue();
  2136. $ctx2.sendIdx["sampleNewValue"]=3;
  2137. return _st(each).__eq($17);
  2138. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2139. $ctx1.sendIdx["select:"]=5;
  2140. self._assert_equals_($15,_st(self._collectionClass())._new());
  2141. $ctx1.sendIdx["assert:equals:"]=5;
  2142. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2143. return smalltalk.withContext(function($ctx2) {
  2144. return _st(each).__tild_eq(self._sampleNewValue());
  2145. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2146. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)})},
  2147. args: [],
  2148. 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",
  2149. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2150. referencedClasses: []
  2151. }),
  2152. globals.CollectionTest);
  2153. smalltalk.addMethod(
  2154. smalltalk.method({
  2155. selector: "testSize",
  2156. protocol: 'tests',
  2157. fn: function (){
  2158. var self=this;
  2159. return smalltalk.withContext(function($ctx1) {
  2160. var $1,$2;
  2161. $1=_st(_st(self._collectionClass())._new())._size();
  2162. $ctx1.sendIdx["size"]=1;
  2163. self._assert_equals_($1,(0));
  2164. $ctx1.sendIdx["assert:equals:"]=1;
  2165. $2=_st(self._sampleNewValueAsCollection())._size();
  2166. $ctx1.sendIdx["size"]=2;
  2167. self._assert_equals_($2,(1));
  2168. $ctx1.sendIdx["assert:equals:"]=2;
  2169. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2170. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)})},
  2171. args: [],
  2172. 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",
  2173. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2174. referencedClasses: []
  2175. }),
  2176. globals.CollectionTest);
  2177. smalltalk.addMethod(
  2178. smalltalk.method({
  2179. selector: "collectionClass",
  2180. protocol: 'fixture',
  2181. fn: function (){
  2182. var self=this;
  2183. return nil;
  2184. },
  2185. args: [],
  2186. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2187. messageSends: [],
  2188. referencedClasses: []
  2189. }),
  2190. globals.CollectionTest.klass);
  2191. smalltalk.addMethod(
  2192. smalltalk.method({
  2193. selector: "isAbstract",
  2194. protocol: 'testing',
  2195. fn: function (){
  2196. var self=this;
  2197. return smalltalk.withContext(function($ctx1) {
  2198. var $1;
  2199. $1=_st(self._collectionClass())._isNil();
  2200. return $1;
  2201. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)})},
  2202. args: [],
  2203. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2204. messageSends: ["isNil", "collectionClass"],
  2205. referencedClasses: []
  2206. }),
  2207. globals.CollectionTest.klass);
  2208. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  2209. smalltalk.addMethod(
  2210. smalltalk.method({
  2211. selector: "collectionWithNewValue",
  2212. protocol: 'fixture',
  2213. fn: function (){
  2214. var self=this;
  2215. return smalltalk.withContext(function($ctx1) {
  2216. self._subclassResponsibility();
  2217. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)})},
  2218. args: [],
  2219. 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",
  2220. messageSends: ["subclassResponsibility"],
  2221. referencedClasses: []
  2222. }),
  2223. globals.IndexableCollectionTest);
  2224. smalltalk.addMethod(
  2225. smalltalk.method({
  2226. selector: "sampleNewIndex",
  2227. protocol: 'fixture',
  2228. fn: function (){
  2229. var self=this;
  2230. return smalltalk.withContext(function($ctx1) {
  2231. self._subclassResponsibility();
  2232. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)})},
  2233. args: [],
  2234. 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",
  2235. messageSends: ["subclassResponsibility"],
  2236. referencedClasses: []
  2237. }),
  2238. globals.IndexableCollectionTest);
  2239. smalltalk.addMethod(
  2240. smalltalk.method({
  2241. selector: "sampleNonIndexesDo:",
  2242. protocol: 'fixture',
  2243. fn: function (aBlock){
  2244. var self=this;
  2245. return smalltalk.withContext(function($ctx1) {
  2246. self._subclassResponsibility();
  2247. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2248. args: ["aBlock"],
  2249. 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",
  2250. messageSends: ["subclassResponsibility"],
  2251. referencedClasses: []
  2252. }),
  2253. globals.IndexableCollectionTest);
  2254. smalltalk.addMethod(
  2255. smalltalk.method({
  2256. selector: "samplesDo:",
  2257. protocol: 'fixture',
  2258. fn: function (aBlock){
  2259. var self=this;
  2260. return smalltalk.withContext(function($ctx1) {
  2261. self._subclassResponsibility();
  2262. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2263. args: ["aBlock"],
  2264. 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",
  2265. messageSends: ["subclassResponsibility"],
  2266. referencedClasses: []
  2267. }),
  2268. globals.IndexableCollectionTest);
  2269. smalltalk.addMethod(
  2270. smalltalk.method({
  2271. selector: "testAt",
  2272. protocol: 'tests',
  2273. fn: function (){
  2274. var self=this;
  2275. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2276. return smalltalk.withContext(function($ctx1) {
  2277. var $1;
  2278. self._nonIndexesDo_((function(each){
  2279. return smalltalk.withContext(function($ctx2) {
  2280. return self._should_raise_((function(){
  2281. return smalltalk.withContext(function($ctx3) {
  2282. $1=self._collection();
  2283. $ctx3.sendIdx["collection"]=1;
  2284. return _st($1)._at_(each);
  2285. $ctx3.sendIdx["at:"]=1;
  2286. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2287. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2288. self._samplesDo_((function(index,value){
  2289. return smalltalk.withContext(function($ctx2) {
  2290. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2291. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2292. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)})},
  2293. args: [],
  2294. 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 ]",
  2295. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2296. referencedClasses: ["Error"]
  2297. }),
  2298. globals.IndexableCollectionTest);
  2299. smalltalk.addMethod(
  2300. smalltalk.method({
  2301. selector: "testAtIfAbsent",
  2302. protocol: 'tests',
  2303. fn: function (){
  2304. var self=this;
  2305. return smalltalk.withContext(function($ctx1) {
  2306. var $2,$1,$3;
  2307. self._nonIndexesDo_((function(each){
  2308. return smalltalk.withContext(function($ctx2) {
  2309. $2=self._collection();
  2310. $ctx2.sendIdx["collection"]=1;
  2311. $1=_st($2)._at_ifAbsent_(each,(function(){
  2312. return smalltalk.withContext(function($ctx3) {
  2313. return self._sampleNewValue();
  2314. $ctx3.sendIdx["sampleNewValue"]=1;
  2315. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2316. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2317. $3=self._sampleNewValue();
  2318. $ctx2.sendIdx["sampleNewValue"]=2;
  2319. return self._assert_equals_($1,$3);
  2320. $ctx2.sendIdx["assert:equals:"]=1;
  2321. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2322. self._samplesDo_((function(index,value){
  2323. return smalltalk.withContext(function($ctx2) {
  2324. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2325. return smalltalk.withContext(function($ctx3) {
  2326. return self._sampleNewValue();
  2327. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2328. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2329. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)})},
  2330. args: [],
  2331. 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 ].",
  2332. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2333. referencedClasses: []
  2334. }),
  2335. globals.IndexableCollectionTest);
  2336. smalltalk.addMethod(
  2337. smalltalk.method({
  2338. selector: "testAtIfAbsentPut",
  2339. protocol: 'tests',
  2340. fn: function (){
  2341. var self=this;
  2342. var newCollection;
  2343. return smalltalk.withContext(function($ctx1) {
  2344. var $1;
  2345. newCollection=self._collection();
  2346. $ctx1.sendIdx["collection"]=1;
  2347. self._samplesDo_((function(index,value){
  2348. return smalltalk.withContext(function($ctx2) {
  2349. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2350. return smalltalk.withContext(function($ctx3) {
  2351. return self._sampleNewValue();
  2352. $ctx3.sendIdx["sampleNewValue"]=1;
  2353. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2354. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2355. return self._assert_equals_($1,value);
  2356. $ctx2.sendIdx["assert:equals:"]=1;
  2357. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2358. self._assert_equals_(newCollection,self._collection());
  2359. $ctx1.sendIdx["assert:equals:"]=2;
  2360. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2361. return smalltalk.withContext(function($ctx2) {
  2362. return self._sampleNewValue();
  2363. $ctx2.sendIdx["sampleNewValue"]=2;
  2364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2365. $ctx1.sendIdx["assert:equals:"]=3;
  2366. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2367. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2368. args: [],
  2369. 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",
  2370. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2371. referencedClasses: []
  2372. }),
  2373. globals.IndexableCollectionTest);
  2374. smalltalk.addMethod(
  2375. smalltalk.method({
  2376. selector: "testAtIfPresent",
  2377. protocol: 'tests',
  2378. fn: function (){
  2379. var self=this;
  2380. var visited,sentinel;
  2381. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2382. return smalltalk.withContext(function($ctx1) {
  2383. var $2,$1,$4,$3;
  2384. sentinel=_st($Object())._new();
  2385. self._nonIndexesDo_((function(each){
  2386. return smalltalk.withContext(function($ctx2) {
  2387. visited=nil;
  2388. visited;
  2389. $2=self._collection();
  2390. $ctx2.sendIdx["collection"]=1;
  2391. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2392. visited=value1;
  2393. visited;
  2394. return sentinel;
  2395. }));
  2396. $ctx2.sendIdx["at:ifPresent:"]=1;
  2397. self._assert_equals_($1,nil);
  2398. $ctx2.sendIdx["assert:equals:"]=1;
  2399. return self._assert_(_st(visited)._isNil());
  2400. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2401. self._samplesDo_((function(index,value){
  2402. return smalltalk.withContext(function($ctx2) {
  2403. visited=nil;
  2404. visited;
  2405. $4=self._collection();
  2406. $ctx2.sendIdx["collection"]=2;
  2407. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2408. visited=value2;
  2409. visited;
  2410. return sentinel;
  2411. }));
  2412. self._assert_equals_($3,sentinel);
  2413. $ctx2.sendIdx["assert:equals:"]=2;
  2414. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2415. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2416. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2417. args: [],
  2418. 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) ]",
  2419. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2420. referencedClasses: ["Object"]
  2421. }),
  2422. globals.IndexableCollectionTest);
  2423. smalltalk.addMethod(
  2424. smalltalk.method({
  2425. selector: "testAtIfPresentIfAbsent",
  2426. protocol: 'tests',
  2427. fn: function (){
  2428. var self=this;
  2429. var visited,sentinel;
  2430. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2431. return smalltalk.withContext(function($ctx1) {
  2432. var $2,$1,$3,$5,$4;
  2433. sentinel=_st($Object())._new();
  2434. self._nonIndexesDo_((function(each){
  2435. return smalltalk.withContext(function($ctx2) {
  2436. visited=nil;
  2437. visited;
  2438. $2=self._collection();
  2439. $ctx2.sendIdx["collection"]=1;
  2440. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2441. visited=value1;
  2442. visited;
  2443. return sentinel;
  2444. }),(function(){
  2445. return smalltalk.withContext(function($ctx3) {
  2446. return self._sampleNewValue();
  2447. $ctx3.sendIdx["sampleNewValue"]=1;
  2448. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2449. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2450. $3=self._sampleNewValue();
  2451. $ctx2.sendIdx["sampleNewValue"]=2;
  2452. self._assert_equals_($1,$3);
  2453. $ctx2.sendIdx["assert:equals:"]=1;
  2454. return self._assert_(_st(visited)._isNil());
  2455. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2456. self._samplesDo_((function(index,value){
  2457. return smalltalk.withContext(function($ctx2) {
  2458. visited=nil;
  2459. visited;
  2460. $5=self._collection();
  2461. $ctx2.sendIdx["collection"]=2;
  2462. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2463. visited=value2;
  2464. visited;
  2465. return sentinel;
  2466. }),(function(){
  2467. return smalltalk.withContext(function($ctx3) {
  2468. return self._sampleNewValue();
  2469. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2470. self._assert_equals_($4,sentinel);
  2471. $ctx2.sendIdx["assert:equals:"]=2;
  2472. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2473. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2474. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2475. args: [],
  2476. 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) ]",
  2477. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2478. referencedClasses: ["Object"]
  2479. }),
  2480. globals.IndexableCollectionTest);
  2481. smalltalk.addMethod(
  2482. smalltalk.method({
  2483. selector: "testAtPut",
  2484. protocol: 'tests',
  2485. fn: function (){
  2486. var self=this;
  2487. var newCollection;
  2488. return smalltalk.withContext(function($ctx1) {
  2489. newCollection=self._collection();
  2490. $ctx1.sendIdx["collection"]=1;
  2491. self._samplesDo_((function(index,value){
  2492. return smalltalk.withContext(function($ctx2) {
  2493. return _st(newCollection)._at_put_(index,value);
  2494. $ctx2.sendIdx["at:put:"]=1;
  2495. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2496. self._assert_equals_(newCollection,self._collection());
  2497. $ctx1.sendIdx["assert:equals:"]=1;
  2498. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2499. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2500. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2501. args: [],
  2502. 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",
  2503. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2504. referencedClasses: []
  2505. }),
  2506. globals.IndexableCollectionTest);
  2507. smalltalk.addMethod(
  2508. smalltalk.method({
  2509. selector: "testEquality",
  2510. protocol: 'tests',
  2511. fn: function (){
  2512. var self=this;
  2513. return smalltalk.withContext(function($ctx1) {
  2514. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2515. $2=self._collectionClass();
  2516. $ctx1.sendIdx["collectionClass"]=1;
  2517. $1=_st($2)._new();
  2518. $ctx1.sendIdx["new"]=1;
  2519. $4=self._collectionClass();
  2520. $ctx1.sendIdx["collectionClass"]=2;
  2521. $3=_st($4)._new();
  2522. $ctx1.sendIdx["new"]=2;
  2523. self._assert_equals_($1,$3);
  2524. $ctx1.sendIdx["assert:equals:"]=1;
  2525. $5=self._collection();
  2526. $ctx1.sendIdx["collection"]=1;
  2527. $6=self._collection();
  2528. $ctx1.sendIdx["collection"]=2;
  2529. self._assert_equals_($5,$6);
  2530. $ctx1.sendIdx["assert:equals:"]=2;
  2531. $7=self._collectionWithNewValue();
  2532. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2533. self._assert_equals_($7,self._collectionWithNewValue());
  2534. $10=self._collectionClass();
  2535. $ctx1.sendIdx["collectionClass"]=3;
  2536. $9=_st($10)._new();
  2537. $ctx1.sendIdx["new"]=3;
  2538. $11=self._collection();
  2539. $ctx1.sendIdx["collection"]=3;
  2540. $8=_st($9).__eq($11);
  2541. $ctx1.sendIdx["="]=1;
  2542. self._deny_($8);
  2543. $ctx1.sendIdx["deny:"]=1;
  2544. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2545. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)})},
  2546. args: [],
  2547. 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",
  2548. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2549. referencedClasses: []
  2550. }),
  2551. globals.IndexableCollectionTest);
  2552. smalltalk.addMethod(
  2553. smalltalk.method({
  2554. selector: "testIndexOf",
  2555. protocol: 'tests',
  2556. fn: function (){
  2557. var self=this;
  2558. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2559. return smalltalk.withContext(function($ctx1) {
  2560. var $1;
  2561. self._should_raise_((function(){
  2562. return smalltalk.withContext(function($ctx2) {
  2563. $1=self._collection();
  2564. $ctx2.sendIdx["collection"]=1;
  2565. return _st($1)._indexOf_(self._sampleNewValue());
  2566. $ctx2.sendIdx["indexOf:"]=1;
  2567. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2568. self._samplesDo_((function(index,value){
  2569. return smalltalk.withContext(function($ctx2) {
  2570. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2571. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2572. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)})},
  2573. args: [],
  2574. 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 ]",
  2575. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2576. referencedClasses: ["Error"]
  2577. }),
  2578. globals.IndexableCollectionTest);
  2579. smalltalk.addMethod(
  2580. smalltalk.method({
  2581. selector: "testIndexOfWithNull",
  2582. protocol: 'tests',
  2583. fn: function (){
  2584. var self=this;
  2585. var jsNull;
  2586. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2587. return smalltalk.withContext(function($ctx1) {
  2588. var $1,$2;
  2589. jsNull=_st($JSON())._parse_("null");
  2590. self._samplesDo_((function(index,value){
  2591. return smalltalk.withContext(function($ctx2) {
  2592. $1=self._collection();
  2593. _st($1)._at_put_(index,jsNull);
  2594. $2=_st($1)._indexOf_(jsNull);
  2595. return self._assert_equals_($2,index);
  2596. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2597. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)})},
  2598. args: [],
  2599. 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 ]",
  2600. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2601. referencedClasses: ["JSON"]
  2602. }),
  2603. globals.IndexableCollectionTest);
  2604. smalltalk.addMethod(
  2605. smalltalk.method({
  2606. selector: "testWithIndexDo",
  2607. protocol: 'tests',
  2608. fn: function (){
  2609. var self=this;
  2610. var collection;
  2611. return smalltalk.withContext(function($ctx1) {
  2612. collection=self._collection();
  2613. $ctx1.sendIdx["collection"]=1;
  2614. _st(self._collection())._withIndexDo_((function(each,index){
  2615. return smalltalk.withContext(function($ctx2) {
  2616. return self._assert_equals_(_st(collection)._at_(index),each);
  2617. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2618. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)})},
  2619. args: [],
  2620. 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 ]",
  2621. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2622. referencedClasses: []
  2623. }),
  2624. globals.IndexableCollectionTest);
  2625. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  2626. smalltalk.addMethod(
  2627. smalltalk.method({
  2628. selector: "collectionKeys",
  2629. protocol: 'fixture',
  2630. fn: function (){
  2631. var self=this;
  2632. return smalltalk.withContext(function($ctx1) {
  2633. self._subclassResponsibility();
  2634. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)})},
  2635. args: [],
  2636. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2637. messageSends: ["subclassResponsibility"],
  2638. referencedClasses: []
  2639. }),
  2640. globals.AssociativeCollectionTest);
  2641. smalltalk.addMethod(
  2642. smalltalk.method({
  2643. selector: "collectionValues",
  2644. protocol: 'fixture',
  2645. fn: function (){
  2646. var self=this;
  2647. return smalltalk.withContext(function($ctx1) {
  2648. self._subclassResponsibility();
  2649. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)})},
  2650. args: [],
  2651. source: "collectionValues\x0a\x09self subclassResponsibility",
  2652. messageSends: ["subclassResponsibility"],
  2653. referencedClasses: []
  2654. }),
  2655. globals.AssociativeCollectionTest);
  2656. smalltalk.addMethod(
  2657. smalltalk.method({
  2658. selector: "nonIndexesDo:",
  2659. protocol: 'fixture',
  2660. fn: function (aBlock){
  2661. var self=this;
  2662. return smalltalk.withContext(function($ctx1) {
  2663. _st(aBlock)._value_((5));
  2664. $ctx1.sendIdx["value:"]=1;
  2665. _st(aBlock)._value_("z");
  2666. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2667. args: ["aBlock"],
  2668. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2669. messageSends: ["value:"],
  2670. referencedClasses: []
  2671. }),
  2672. globals.AssociativeCollectionTest);
  2673. smalltalk.addMethod(
  2674. smalltalk.method({
  2675. selector: "sampleNewIndex",
  2676. protocol: 'fixture',
  2677. fn: function (){
  2678. var self=this;
  2679. return "new";
  2680. },
  2681. args: [],
  2682. source: "sampleNewIndex\x0a\x09^ 'new'",
  2683. messageSends: [],
  2684. referencedClasses: []
  2685. }),
  2686. globals.AssociativeCollectionTest);
  2687. smalltalk.addMethod(
  2688. smalltalk.method({
  2689. selector: "samplesDo:",
  2690. protocol: 'fixture',
  2691. fn: function (aBlock){
  2692. var self=this;
  2693. return smalltalk.withContext(function($ctx1) {
  2694. _st(aBlock)._value_value_("a",(2));
  2695. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2696. args: ["aBlock"],
  2697. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2698. messageSends: ["value:value:"],
  2699. referencedClasses: []
  2700. }),
  2701. globals.AssociativeCollectionTest);
  2702. smalltalk.addMethod(
  2703. smalltalk.method({
  2704. selector: "testAddAll",
  2705. protocol: 'tests',
  2706. fn: function (){
  2707. var self=this;
  2708. return smalltalk.withContext(function($ctx1) {
  2709. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2710. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  2711. $ctx1.supercall = false;
  2712. $2=self._collection();
  2713. $ctx1.sendIdx["collection"]=1;
  2714. $3=$2;
  2715. $4=self._collection();
  2716. $ctx1.sendIdx["collection"]=2;
  2717. _st($3)._addAll_($4);
  2718. $ctx1.sendIdx["addAll:"]=1;
  2719. $5=_st($2)._yourself();
  2720. $ctx1.sendIdx["yourself"]=1;
  2721. $1=$5;
  2722. $6=self._collection();
  2723. $ctx1.sendIdx["collection"]=3;
  2724. self._assert_equals_($1,$6);
  2725. $ctx1.sendIdx["assert:equals:"]=1;
  2726. $8=self._collection();
  2727. $ctx1.sendIdx["collection"]=4;
  2728. $9=$8;
  2729. $10=self._collectionWithNewValue();
  2730. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2731. _st($9)._addAll_($10);
  2732. $ctx1.sendIdx["addAll:"]=2;
  2733. $11=_st($8)._yourself();
  2734. $ctx1.sendIdx["yourself"]=2;
  2735. $7=$11;
  2736. $12=self._collectionWithNewValue();
  2737. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2738. self._assert_equals_($7,$12);
  2739. $ctx1.sendIdx["assert:equals:"]=2;
  2740. $14=self._collectionWithNewValue();
  2741. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2742. _st($14)._addAll_(self._collection());
  2743. $15=_st($14)._yourself();
  2744. $13=$15;
  2745. self._assert_equals_($13,self._collectionWithNewValue());
  2746. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)})},
  2747. args: [],
  2748. 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",
  2749. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2750. referencedClasses: []
  2751. }),
  2752. globals.AssociativeCollectionTest);
  2753. smalltalk.addMethod(
  2754. smalltalk.method({
  2755. selector: "testAsDictionary",
  2756. protocol: 'tests',
  2757. fn: function (){
  2758. var self=this;
  2759. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2760. return smalltalk.withContext(function($ctx1) {
  2761. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2762. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)})},
  2763. args: [],
  2764. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2765. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2766. referencedClasses: ["Dictionary"]
  2767. }),
  2768. globals.AssociativeCollectionTest);
  2769. smalltalk.addMethod(
  2770. smalltalk.method({
  2771. selector: "testAsHashedCollection",
  2772. protocol: 'tests',
  2773. fn: function (){
  2774. var self=this;
  2775. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2776. return smalltalk.withContext(function($ctx1) {
  2777. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2778. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)})},
  2779. args: [],
  2780. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2781. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2782. referencedClasses: ["HashedCollection"]
  2783. }),
  2784. globals.AssociativeCollectionTest);
  2785. smalltalk.addMethod(
  2786. smalltalk.method({
  2787. selector: "testComma",
  2788. protocol: 'tests',
  2789. fn: function (){
  2790. var self=this;
  2791. return smalltalk.withContext(function($ctx1) {
  2792. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2793. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  2794. $ctx1.supercall = false;
  2795. $2=self._collection();
  2796. $ctx1.sendIdx["collection"]=1;
  2797. $3=self._collection();
  2798. $ctx1.sendIdx["collection"]=2;
  2799. $1=_st($2).__comma($3);
  2800. $ctx1.sendIdx[","]=1;
  2801. $4=self._collection();
  2802. $ctx1.sendIdx["collection"]=3;
  2803. self._assert_equals_($1,$4);
  2804. $ctx1.sendIdx["assert:equals:"]=1;
  2805. $6=self._collection();
  2806. $ctx1.sendIdx["collection"]=4;
  2807. $7=self._collectionWithNewValue();
  2808. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2809. $5=_st($6).__comma($7);
  2810. $ctx1.sendIdx[","]=2;
  2811. $8=self._collectionWithNewValue();
  2812. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2813. self._assert_equals_($5,$8);
  2814. $ctx1.sendIdx["assert:equals:"]=2;
  2815. $10=self._collectionWithNewValue();
  2816. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2817. $9=_st($10).__comma(self._collection());
  2818. self._assert_equals_($9,self._collectionWithNewValue());
  2819. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)})},
  2820. args: [],
  2821. 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",
  2822. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2823. referencedClasses: []
  2824. }),
  2825. globals.AssociativeCollectionTest);
  2826. smalltalk.addMethod(
  2827. smalltalk.method({
  2828. selector: "testFrom",
  2829. protocol: 'tests',
  2830. fn: function (){
  2831. var self=this;
  2832. var associations;
  2833. return smalltalk.withContext(function($ctx1) {
  2834. var $1;
  2835. $1="a".__minus_gt((1));
  2836. $ctx1.sendIdx["->"]=1;
  2837. associations=[$1,"b".__minus_gt((2))];
  2838. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2839. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)})},
  2840. args: [],
  2841. 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 }.",
  2842. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2843. referencedClasses: []
  2844. }),
  2845. globals.AssociativeCollectionTest);
  2846. smalltalk.addMethod(
  2847. smalltalk.method({
  2848. selector: "testKeys",
  2849. protocol: 'tests',
  2850. fn: function (){
  2851. var self=this;
  2852. return smalltalk.withContext(function($ctx1) {
  2853. var $2,$1,$3,$4;
  2854. $2=_st(_st(self._collectionClass())._new())._keys();
  2855. $ctx1.sendIdx["keys"]=1;
  2856. $1=_st($2)._isEmpty();
  2857. self._assert_($1);
  2858. $3=_st(self._collection())._keys();
  2859. $ctx1.sendIdx["keys"]=2;
  2860. $4=self._collectionKeys();
  2861. $ctx1.sendIdx["collectionKeys"]=1;
  2862. self._assertSameContents_as_($3,$4);
  2863. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2864. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2865. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)})},
  2866. args: [],
  2867. 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 }",
  2868. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2869. referencedClasses: []
  2870. }),
  2871. globals.AssociativeCollectionTest);
  2872. smalltalk.addMethod(
  2873. smalltalk.method({
  2874. selector: "testNewFromPairs",
  2875. protocol: 'tests',
  2876. fn: function (){
  2877. var self=this;
  2878. var flattenedAssociations;
  2879. return smalltalk.withContext(function($ctx1) {
  2880. flattenedAssociations=["a",(1),"b",(2)];
  2881. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2882. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)})},
  2883. args: [],
  2884. 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 }.",
  2885. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"],
  2886. referencedClasses: []
  2887. }),
  2888. globals.AssociativeCollectionTest);
  2889. smalltalk.addMethod(
  2890. smalltalk.method({
  2891. selector: "testPrintString",
  2892. protocol: 'tests',
  2893. fn: function (){
  2894. var self=this;
  2895. return smalltalk.withContext(function($ctx1) {
  2896. var $3,$2,$4,$1,$5;
  2897. $3=self._collectionClass();
  2898. $ctx1.sendIdx["collectionClass"]=1;
  2899. $2=_st($3)._new();
  2900. _st($2)._at_put_("firstname","James");
  2901. $ctx1.sendIdx["at:put:"]=1;
  2902. _st($2)._at_put_("lastname","Bond");
  2903. $4=_st($2)._printString();
  2904. $1=$4;
  2905. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2906. $ctx1.sendIdx[","]=1;
  2907. self._assert_equals_($1,$5);
  2908. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)})},
  2909. args: [],
  2910. 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'')'",
  2911. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2912. referencedClasses: []
  2913. }),
  2914. globals.AssociativeCollectionTest);
  2915. smalltalk.addMethod(
  2916. smalltalk.method({
  2917. selector: "testRemoveKey",
  2918. protocol: 'tests',
  2919. fn: function (){
  2920. var self=this;
  2921. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2922. return smalltalk.withContext(function($ctx1) {
  2923. var $1,$2,$3,$5,$6,$4,$7,$8;
  2924. self._nonIndexesDo_((function(each){
  2925. var collection;
  2926. return smalltalk.withContext(function($ctx2) {
  2927. collection=self._collection();
  2928. $ctx2.sendIdx["collection"]=1;
  2929. collection;
  2930. self._should_raise_((function(){
  2931. return smalltalk.withContext(function($ctx3) {
  2932. return _st(collection)._removeKey_(each);
  2933. $ctx3.sendIdx["removeKey:"]=1;
  2934. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2935. $1=collection;
  2936. $2=self._collection();
  2937. $ctx2.sendIdx["collection"]=2;
  2938. return self._assert_equals_($1,$2);
  2939. $ctx2.sendIdx["assert:equals:"]=1;
  2940. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2941. self._samplesDo_((function(index,value){
  2942. var collection;
  2943. return smalltalk.withContext(function($ctx2) {
  2944. collection=self._collection();
  2945. $ctx2.sendIdx["collection"]=3;
  2946. collection;
  2947. $3=_st(collection)._removeKey_(index);
  2948. $ctx2.sendIdx["removeKey:"]=2;
  2949. self._assert_equals_($3,value);
  2950. $ctx2.sendIdx["assert:equals:"]=2;
  2951. $5=collection;
  2952. $6=self._collection();
  2953. $ctx2.sendIdx["collection"]=4;
  2954. $4=_st($5).__eq($6);
  2955. return self._deny_($4);
  2956. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2957. $7=self._collectionWithNewValue();
  2958. _st($7)._removeKey_(self._sampleNewIndex());
  2959. $8=_st($7)._yourself();
  2960. self._assert_equals_($8,self._collection());
  2961. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)})},
  2962. args: [],
  2963. 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",
  2964. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  2965. referencedClasses: ["Error"]
  2966. }),
  2967. globals.AssociativeCollectionTest);
  2968. smalltalk.addMethod(
  2969. smalltalk.method({
  2970. selector: "testRemoveKeyIfAbsent",
  2971. protocol: 'tests',
  2972. fn: function (){
  2973. var self=this;
  2974. return smalltalk.withContext(function($ctx1) {
  2975. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  2976. self._nonIndexesDo_((function(each){
  2977. var collection;
  2978. return smalltalk.withContext(function($ctx2) {
  2979. collection=self._collection();
  2980. $ctx2.sendIdx["collection"]=1;
  2981. collection;
  2982. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  2983. return smalltalk.withContext(function($ctx3) {
  2984. return self._sampleNewValue();
  2985. $ctx3.sendIdx["sampleNewValue"]=1;
  2986. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2987. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  2988. $2=self._sampleNewValue();
  2989. $ctx2.sendIdx["sampleNewValue"]=2;
  2990. self._assert_equals_($1,$2);
  2991. $ctx2.sendIdx["assert:equals:"]=1;
  2992. $3=collection;
  2993. $4=self._collection();
  2994. $ctx2.sendIdx["collection"]=2;
  2995. return self._assert_equals_($3,$4);
  2996. $ctx2.sendIdx["assert:equals:"]=2;
  2997. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2998. self._samplesDo_((function(index,value){
  2999. var collection;
  3000. return smalltalk.withContext(function($ctx2) {
  3001. collection=self._collection();
  3002. $ctx2.sendIdx["collection"]=3;
  3003. collection;
  3004. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  3005. return smalltalk.withContext(function($ctx3) {
  3006. return self._sampleNewValue();
  3007. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  3008. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  3009. self._assert_equals_($5,value);
  3010. $ctx2.sendIdx["assert:equals:"]=3;
  3011. $7=collection;
  3012. $8=self._collection();
  3013. $ctx2.sendIdx["collection"]=4;
  3014. $6=_st($7).__eq($8);
  3015. return self._deny_($6);
  3016. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3017. $9=self._collectionWithNewValue();
  3018. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  3019. return smalltalk.withContext(function($ctx2) {
  3020. return self._assert_(false);
  3021. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  3022. $10=_st($9)._yourself();
  3023. self._assert_equals_($10,self._collection());
  3024. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)})},
  3025. args: [],
  3026. 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",
  3027. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3028. referencedClasses: []
  3029. }),
  3030. globals.AssociativeCollectionTest);
  3031. smalltalk.addMethod(
  3032. smalltalk.method({
  3033. selector: "testValues",
  3034. protocol: 'tests',
  3035. fn: function (){
  3036. var self=this;
  3037. return smalltalk.withContext(function($ctx1) {
  3038. var $2,$1,$3,$4;
  3039. $2=_st(_st(self._collectionClass())._new())._values();
  3040. $ctx1.sendIdx["values"]=1;
  3041. $1=_st($2)._isEmpty();
  3042. self._assert_($1);
  3043. $3=_st(self._collection())._values();
  3044. $ctx1.sendIdx["values"]=2;
  3045. $4=self._collectionValues();
  3046. $ctx1.sendIdx["collectionValues"]=1;
  3047. self._assertSameContents_as_($3,$4);
  3048. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3049. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3050. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)})},
  3051. args: [],
  3052. 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 }",
  3053. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3054. referencedClasses: []
  3055. }),
  3056. globals.AssociativeCollectionTest);
  3057. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3058. smalltalk.addMethod(
  3059. smalltalk.method({
  3060. selector: "collection",
  3061. protocol: 'fixture',
  3062. fn: function (){
  3063. var self=this;
  3064. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3065. return smalltalk.withContext(function($ctx1) {
  3066. var $2,$3,$1;
  3067. $2=_st($Dictionary())._new();
  3068. _st($2)._at_put_((1),(1));
  3069. $ctx1.sendIdx["at:put:"]=1;
  3070. _st($2)._at_put_("a",(2));
  3071. $ctx1.sendIdx["at:put:"]=2;
  3072. _st($2)._at_put_(true,(3));
  3073. $ctx1.sendIdx["at:put:"]=3;
  3074. _st($2)._at_put_((1).__at((3)),(-4));
  3075. $3=_st($2)._yourself();
  3076. $1=$3;
  3077. return $1;
  3078. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)})},
  3079. args: [],
  3080. 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",
  3081. messageSends: ["at:put:", "new", "@", "yourself"],
  3082. referencedClasses: ["Dictionary"]
  3083. }),
  3084. globals.DictionaryTest);
  3085. smalltalk.addMethod(
  3086. smalltalk.method({
  3087. selector: "collectionKeys",
  3088. protocol: 'fixture',
  3089. fn: function (){
  3090. var self=this;
  3091. return smalltalk.withContext(function($ctx1) {
  3092. var $1;
  3093. $1=[(1),"a",true,(1).__at((3))];
  3094. return $1;
  3095. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)})},
  3096. args: [],
  3097. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3098. messageSends: ["@"],
  3099. referencedClasses: []
  3100. }),
  3101. globals.DictionaryTest);
  3102. smalltalk.addMethod(
  3103. smalltalk.method({
  3104. selector: "collectionOfPrintStrings",
  3105. protocol: 'fixture',
  3106. fn: function (){
  3107. var self=this;
  3108. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3109. return smalltalk.withContext(function($ctx1) {
  3110. var $2,$3,$1;
  3111. $2=_st($Dictionary())._new();
  3112. _st($2)._at_put_((1),"1");
  3113. $ctx1.sendIdx["at:put:"]=1;
  3114. _st($2)._at_put_("a","2");
  3115. $ctx1.sendIdx["at:put:"]=2;
  3116. _st($2)._at_put_(true,"3");
  3117. $ctx1.sendIdx["at:put:"]=3;
  3118. _st($2)._at_put_((1).__at((3)),"-4");
  3119. $3=_st($2)._yourself();
  3120. $1=$3;
  3121. return $1;
  3122. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)})},
  3123. args: [],
  3124. 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",
  3125. messageSends: ["at:put:", "new", "@", "yourself"],
  3126. referencedClasses: ["Dictionary"]
  3127. }),
  3128. globals.DictionaryTest);
  3129. smalltalk.addMethod(
  3130. smalltalk.method({
  3131. selector: "collectionSize",
  3132. protocol: 'fixture',
  3133. fn: function (){
  3134. var self=this;
  3135. return (4);
  3136. },
  3137. args: [],
  3138. source: "collectionSize\x0a\x09^ 4",
  3139. messageSends: [],
  3140. referencedClasses: []
  3141. }),
  3142. globals.DictionaryTest);
  3143. smalltalk.addMethod(
  3144. smalltalk.method({
  3145. selector: "collectionValues",
  3146. protocol: 'fixture',
  3147. fn: function (){
  3148. var self=this;
  3149. var $1;
  3150. $1=[(1),(2),(3),(-4)];
  3151. return $1;
  3152. },
  3153. args: [],
  3154. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3155. messageSends: [],
  3156. referencedClasses: []
  3157. }),
  3158. globals.DictionaryTest);
  3159. smalltalk.addMethod(
  3160. smalltalk.method({
  3161. selector: "collectionWithDuplicates",
  3162. protocol: 'fixture',
  3163. fn: function (){
  3164. var self=this;
  3165. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3166. return smalltalk.withContext(function($ctx1) {
  3167. var $2,$3,$1;
  3168. $2=_st($Dictionary())._new();
  3169. _st($2)._at_put_((1),(1));
  3170. $ctx1.sendIdx["at:put:"]=1;
  3171. _st($2)._at_put_("a",(2));
  3172. $ctx1.sendIdx["at:put:"]=2;
  3173. _st($2)._at_put_(true,(3));
  3174. $ctx1.sendIdx["at:put:"]=3;
  3175. _st($2)._at_put_((4),(-4));
  3176. $ctx1.sendIdx["at:put:"]=4;
  3177. _st($2)._at_put_("b",(1));
  3178. $ctx1.sendIdx["at:put:"]=5;
  3179. _st($2)._at_put_((3),(3));
  3180. $ctx1.sendIdx["at:put:"]=6;
  3181. _st($2)._at_put_(false,(12));
  3182. $3=_st($2)._yourself();
  3183. $1=$3;
  3184. return $1;
  3185. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)})},
  3186. args: [],
  3187. 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",
  3188. messageSends: ["at:put:", "new", "yourself"],
  3189. referencedClasses: ["Dictionary"]
  3190. }),
  3191. globals.DictionaryTest);
  3192. smalltalk.addMethod(
  3193. smalltalk.method({
  3194. selector: "collectionWithNewValue",
  3195. protocol: 'fixture',
  3196. fn: function (){
  3197. var self=this;
  3198. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3199. return smalltalk.withContext(function($ctx1) {
  3200. var $2,$3,$1;
  3201. $2=_st($Dictionary())._new();
  3202. _st($2)._at_put_((1),(1));
  3203. $ctx1.sendIdx["at:put:"]=1;
  3204. _st($2)._at_put_("a",(2));
  3205. $ctx1.sendIdx["at:put:"]=2;
  3206. _st($2)._at_put_(true,(3));
  3207. $ctx1.sendIdx["at:put:"]=3;
  3208. _st($2)._at_put_((1).__at((3)),(-4));
  3209. $ctx1.sendIdx["at:put:"]=4;
  3210. _st($2)._at_put_("new","N");
  3211. $3=_st($2)._yourself();
  3212. $1=$3;
  3213. return $1;
  3214. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)})},
  3215. args: [],
  3216. 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",
  3217. messageSends: ["at:put:", "new", "@", "yourself"],
  3218. referencedClasses: ["Dictionary"]
  3219. }),
  3220. globals.DictionaryTest);
  3221. smalltalk.addMethod(
  3222. smalltalk.method({
  3223. selector: "sampleNewValueAsCollection",
  3224. protocol: 'fixture',
  3225. fn: function (){
  3226. var self=this;
  3227. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3228. return smalltalk.withContext(function($ctx1) {
  3229. var $2,$3,$1;
  3230. $2=_st($Dictionary())._new();
  3231. _st($2)._at_put_("new","N");
  3232. $3=_st($2)._yourself();
  3233. $1=$3;
  3234. return $1;
  3235. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)})},
  3236. args: [],
  3237. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3238. messageSends: ["at:put:", "new", "yourself"],
  3239. referencedClasses: ["Dictionary"]
  3240. }),
  3241. globals.DictionaryTest);
  3242. smalltalk.addMethod(
  3243. smalltalk.method({
  3244. selector: "samplesDo:",
  3245. protocol: 'fixture',
  3246. fn: function (aBlock){
  3247. var self=this;
  3248. return smalltalk.withContext(function($ctx1) {
  3249. ($ctx1.supercall = true, globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  3250. $ctx1.supercall = false;
  3251. _st(aBlock)._value_value_(true,(3));
  3252. $ctx1.sendIdx["value:value:"]=1;
  3253. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3254. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)})},
  3255. args: ["aBlock"],
  3256. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3257. messageSends: ["samplesDo:", "value:value:", "@"],
  3258. referencedClasses: []
  3259. }),
  3260. globals.DictionaryTest);
  3261. smalltalk.addMethod(
  3262. smalltalk.method({
  3263. selector: "testAccessing",
  3264. protocol: 'tests',
  3265. fn: function (){
  3266. var self=this;
  3267. var d;
  3268. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3269. return smalltalk.withContext(function($ctx1) {
  3270. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3271. d=_st($Dictionary())._new();
  3272. _st(d)._at_put_("hello","world");
  3273. $ctx1.sendIdx["at:put:"]=1;
  3274. $1=_st(d)._at_("hello");
  3275. $ctx1.sendIdx["at:"]=1;
  3276. self._assert_equals_($1,"world");
  3277. $ctx1.sendIdx["assert:equals:"]=1;
  3278. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3279. return nil;
  3280. }));
  3281. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3282. self._assert_equals_($2,"world");
  3283. $ctx1.sendIdx["assert:equals:"]=2;
  3284. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3285. return nil;
  3286. }))).__eq("world"));
  3287. $ctx1.sendIdx["deny:"]=1;
  3288. $3=_st(d)._includesKey_("hello");
  3289. $ctx1.sendIdx["includesKey:"]=1;
  3290. self._assert_($3);
  3291. $ctx1.sendIdx["assert:"]=1;
  3292. $4=_st(d)._includesKey_("foo");
  3293. $ctx1.sendIdx["includesKey:"]=2;
  3294. self._deny_($4);
  3295. $ctx1.sendIdx["deny:"]=2;
  3296. _st(d)._at_put_((1),(2));
  3297. $ctx1.sendIdx["at:put:"]=2;
  3298. $5=_st(d)._at_((1));
  3299. $ctx1.sendIdx["at:"]=2;
  3300. self._assert_equals_($5,(2));
  3301. $ctx1.sendIdx["assert:equals:"]=3;
  3302. $6=d;
  3303. $7=(1).__at((3));
  3304. $ctx1.sendIdx["@"]=1;
  3305. _st($6)._at_put_($7,(3));
  3306. $9=d;
  3307. $10=(1).__at((3));
  3308. $ctx1.sendIdx["@"]=2;
  3309. $8=_st($9)._at_($10);
  3310. self._assert_equals_($8,(3));
  3311. $12=d;
  3312. $13=(1).__at((3));
  3313. $ctx1.sendIdx["@"]=3;
  3314. $11=_st($12)._includesKey_($13);
  3315. $ctx1.sendIdx["includesKey:"]=3;
  3316. self._assert_($11);
  3317. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3318. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)})},
  3319. args: [],
  3320. 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)",
  3321. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3322. referencedClasses: ["Dictionary"]
  3323. }),
  3324. globals.DictionaryTest);
  3325. smalltalk.addMethod(
  3326. smalltalk.method({
  3327. selector: "testDynamicDictionaries",
  3328. protocol: 'tests',
  3329. fn: function (){
  3330. var self=this;
  3331. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3332. return smalltalk.withContext(function($ctx1) {
  3333. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  3334. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)})},
  3335. args: [],
  3336. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3337. messageSends: ["assert:equals:", "asDictionary", "with:", "->"],
  3338. referencedClasses: ["Dictionary"]
  3339. }),
  3340. globals.DictionaryTest);
  3341. smalltalk.addMethod(
  3342. smalltalk.method({
  3343. selector: "collectionClass",
  3344. protocol: 'fixture',
  3345. fn: function (){
  3346. var self=this;
  3347. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3348. return $Dictionary();
  3349. },
  3350. args: [],
  3351. source: "collectionClass\x0a\x09^ Dictionary",
  3352. messageSends: [],
  3353. referencedClasses: ["Dictionary"]
  3354. }),
  3355. globals.DictionaryTest.klass);
  3356. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3357. smalltalk.addMethod(
  3358. smalltalk.method({
  3359. selector: "collection",
  3360. protocol: 'fixture',
  3361. fn: function (){
  3362. var self=this;
  3363. var $1;
  3364. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  3365. return $1;
  3366. },
  3367. args: [],
  3368. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3369. messageSends: [],
  3370. referencedClasses: []
  3371. }),
  3372. globals.HashedCollectionTest);
  3373. smalltalk.addMethod(
  3374. smalltalk.method({
  3375. selector: "collectionKeys",
  3376. protocol: 'fixture',
  3377. fn: function (){
  3378. var self=this;
  3379. var $1;
  3380. $1=["b","a","c","d"];
  3381. return $1;
  3382. },
  3383. args: [],
  3384. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3385. messageSends: [],
  3386. referencedClasses: []
  3387. }),
  3388. globals.HashedCollectionTest);
  3389. smalltalk.addMethod(
  3390. smalltalk.method({
  3391. selector: "collectionOfPrintStrings",
  3392. protocol: 'fixture',
  3393. fn: function (){
  3394. var self=this;
  3395. var $1;
  3396. $1=globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  3397. return $1;
  3398. },
  3399. args: [],
  3400. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3401. messageSends: [],
  3402. referencedClasses: []
  3403. }),
  3404. globals.HashedCollectionTest);
  3405. smalltalk.addMethod(
  3406. smalltalk.method({
  3407. selector: "collectionSize",
  3408. protocol: 'fixture',
  3409. fn: function (){
  3410. var self=this;
  3411. return (4);
  3412. },
  3413. args: [],
  3414. source: "collectionSize\x0a\x09^ 4",
  3415. messageSends: [],
  3416. referencedClasses: []
  3417. }),
  3418. globals.HashedCollectionTest);
  3419. smalltalk.addMethod(
  3420. smalltalk.method({
  3421. selector: "collectionValues",
  3422. protocol: 'fixture',
  3423. fn: function (){
  3424. var self=this;
  3425. var $1;
  3426. $1=[(1),(2),(3),(-4)];
  3427. return $1;
  3428. },
  3429. args: [],
  3430. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3431. messageSends: [],
  3432. referencedClasses: []
  3433. }),
  3434. globals.HashedCollectionTest);
  3435. smalltalk.addMethod(
  3436. smalltalk.method({
  3437. selector: "collectionWithDuplicates",
  3438. protocol: 'fixture',
  3439. fn: function (){
  3440. var self=this;
  3441. var $1;
  3442. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  3443. return $1;
  3444. },
  3445. args: [],
  3446. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3447. messageSends: [],
  3448. referencedClasses: []
  3449. }),
  3450. globals.HashedCollectionTest);
  3451. smalltalk.addMethod(
  3452. smalltalk.method({
  3453. selector: "collectionWithNewValue",
  3454. protocol: 'fixture',
  3455. fn: function (){
  3456. var self=this;
  3457. var $1;
  3458. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  3459. return $1;
  3460. },
  3461. args: [],
  3462. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3463. messageSends: [],
  3464. referencedClasses: []
  3465. }),
  3466. globals.HashedCollectionTest);
  3467. smalltalk.addMethod(
  3468. smalltalk.method({
  3469. selector: "sampleNewValueAsCollection",
  3470. protocol: 'fixture',
  3471. fn: function (){
  3472. var self=this;
  3473. var $1;
  3474. $1=globals.HashedCollection._newFromPairs_(["new","N"]);
  3475. return $1;
  3476. },
  3477. args: [],
  3478. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3479. messageSends: [],
  3480. referencedClasses: []
  3481. }),
  3482. globals.HashedCollectionTest);
  3483. smalltalk.addMethod(
  3484. smalltalk.method({
  3485. selector: "testDynamicDictionaries",
  3486. protocol: 'tests',
  3487. fn: function (){
  3488. var self=this;
  3489. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3490. return smalltalk.withContext(function($ctx1) {
  3491. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3492. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)})},
  3493. args: [],
  3494. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3495. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"],
  3496. referencedClasses: ["HashedCollection"]
  3497. }),
  3498. globals.HashedCollectionTest);
  3499. smalltalk.addMethod(
  3500. smalltalk.method({
  3501. selector: "collectionClass",
  3502. protocol: 'fixture',
  3503. fn: function (){
  3504. var self=this;
  3505. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3506. return $HashedCollection();
  3507. },
  3508. args: [],
  3509. source: "collectionClass\x0a\x09^ HashedCollection",
  3510. messageSends: [],
  3511. referencedClasses: ["HashedCollection"]
  3512. }),
  3513. globals.HashedCollectionTest.klass);
  3514. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  3515. smalltalk.addMethod(
  3516. smalltalk.method({
  3517. selector: "collectionFirst",
  3518. protocol: 'fixture',
  3519. fn: function (){
  3520. var self=this;
  3521. return smalltalk.withContext(function($ctx1) {
  3522. self._subclassResponsibility();
  3523. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)})},
  3524. args: [],
  3525. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3526. messageSends: ["subclassResponsibility"],
  3527. referencedClasses: []
  3528. }),
  3529. globals.SequenceableCollectionTest);
  3530. smalltalk.addMethod(
  3531. smalltalk.method({
  3532. selector: "collectionFirstTwo",
  3533. protocol: 'fixture',
  3534. fn: function (){
  3535. var self=this;
  3536. return smalltalk.withContext(function($ctx1) {
  3537. self._subclassResponsibility();
  3538. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)})},
  3539. args: [],
  3540. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3541. messageSends: ["subclassResponsibility"],
  3542. referencedClasses: []
  3543. }),
  3544. globals.SequenceableCollectionTest);
  3545. smalltalk.addMethod(
  3546. smalltalk.method({
  3547. selector: "collectionLast",
  3548. protocol: 'fixture',
  3549. fn: function (){
  3550. var self=this;
  3551. return smalltalk.withContext(function($ctx1) {
  3552. self._subclassResponsibility();
  3553. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)})},
  3554. args: [],
  3555. source: "collectionLast\x0a\x09self subclassResponsibility",
  3556. messageSends: ["subclassResponsibility"],
  3557. referencedClasses: []
  3558. }),
  3559. globals.SequenceableCollectionTest);
  3560. smalltalk.addMethod(
  3561. smalltalk.method({
  3562. selector: "collectionLastTwo",
  3563. protocol: 'fixture',
  3564. fn: function (){
  3565. var self=this;
  3566. return smalltalk.withContext(function($ctx1) {
  3567. self._subclassResponsibility();
  3568. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)})},
  3569. args: [],
  3570. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3571. messageSends: ["subclassResponsibility"],
  3572. referencedClasses: []
  3573. }),
  3574. globals.SequenceableCollectionTest);
  3575. smalltalk.addMethod(
  3576. smalltalk.method({
  3577. selector: "nonIndexesDo:",
  3578. protocol: 'fixture',
  3579. fn: function (aBlock){
  3580. var self=this;
  3581. return smalltalk.withContext(function($ctx1) {
  3582. _st(aBlock)._value_((0));
  3583. $ctx1.sendIdx["value:"]=1;
  3584. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3585. $ctx1.sendIdx["value:"]=2;
  3586. _st(aBlock)._value_("z");
  3587. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3588. args: ["aBlock"],
  3589. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3590. messageSends: ["value:", "+", "collectionSize"],
  3591. referencedClasses: []
  3592. }),
  3593. globals.SequenceableCollectionTest);
  3594. smalltalk.addMethod(
  3595. smalltalk.method({
  3596. selector: "samplesDo:",
  3597. protocol: 'fixture',
  3598. fn: function (aBlock){
  3599. var self=this;
  3600. return smalltalk.withContext(function($ctx1) {
  3601. _st(aBlock)._value_value_((1),self._collectionFirst());
  3602. $ctx1.sendIdx["value:value:"]=1;
  3603. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3604. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3605. args: ["aBlock"],
  3606. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3607. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3608. referencedClasses: []
  3609. }),
  3610. globals.SequenceableCollectionTest);
  3611. smalltalk.addMethod(
  3612. smalltalk.method({
  3613. selector: "testBeginsWith",
  3614. protocol: 'tests',
  3615. fn: function (){
  3616. var self=this;
  3617. return smalltalk.withContext(function($ctx1) {
  3618. var $2,$1,$4,$5,$3,$7,$6;
  3619. $2=self._collection();
  3620. $ctx1.sendIdx["collection"]=1;
  3621. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3622. $ctx1.sendIdx["beginsWith:"]=1;
  3623. self._assert_($1);
  3624. $ctx1.sendIdx["assert:"]=1;
  3625. $4=self._collection();
  3626. $ctx1.sendIdx["collection"]=2;
  3627. $5=self._collection();
  3628. $ctx1.sendIdx["collection"]=3;
  3629. $3=_st($4)._beginsWith_($5);
  3630. $ctx1.sendIdx["beginsWith:"]=2;
  3631. self._assert_($3);
  3632. $ctx1.sendIdx["assert:"]=2;
  3633. $7=self._collection();
  3634. $ctx1.sendIdx["collection"]=4;
  3635. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3636. $ctx1.sendIdx["beginsWith:"]=3;
  3637. self._assert_($6);
  3638. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3639. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)})},
  3640. args: [],
  3641. 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)",
  3642. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3643. referencedClasses: []
  3644. }),
  3645. globals.SequenceableCollectionTest);
  3646. smalltalk.addMethod(
  3647. smalltalk.method({
  3648. selector: "testEndsWith",
  3649. protocol: 'tests',
  3650. fn: function (){
  3651. var self=this;
  3652. return smalltalk.withContext(function($ctx1) {
  3653. var $2,$1,$4,$5,$3,$7,$6;
  3654. $2=self._collection();
  3655. $ctx1.sendIdx["collection"]=1;
  3656. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3657. $ctx1.sendIdx["endsWith:"]=1;
  3658. self._assert_($1);
  3659. $ctx1.sendIdx["assert:"]=1;
  3660. $4=self._collection();
  3661. $ctx1.sendIdx["collection"]=2;
  3662. $5=self._collection();
  3663. $ctx1.sendIdx["collection"]=3;
  3664. $3=_st($4)._endsWith_($5);
  3665. $ctx1.sendIdx["endsWith:"]=2;
  3666. self._assert_($3);
  3667. $ctx1.sendIdx["assert:"]=2;
  3668. $7=self._collection();
  3669. $ctx1.sendIdx["collection"]=4;
  3670. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3671. $ctx1.sendIdx["endsWith:"]=3;
  3672. self._assert_($6);
  3673. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3674. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)})},
  3675. args: [],
  3676. 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)",
  3677. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3678. referencedClasses: []
  3679. }),
  3680. globals.SequenceableCollectionTest);
  3681. smalltalk.addMethod(
  3682. smalltalk.method({
  3683. selector: "testFirst",
  3684. protocol: 'tests',
  3685. fn: function (){
  3686. var self=this;
  3687. return smalltalk.withContext(function($ctx1) {
  3688. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3689. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)})},
  3690. args: [],
  3691. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3692. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3693. referencedClasses: []
  3694. }),
  3695. globals.SequenceableCollectionTest);
  3696. smalltalk.addMethod(
  3697. smalltalk.method({
  3698. selector: "testFirstN",
  3699. protocol: 'tests',
  3700. fn: function (){
  3701. var self=this;
  3702. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3703. return smalltalk.withContext(function($ctx1) {
  3704. var $2,$1,$4,$3,$6,$5,$7;
  3705. $2=self._collection();
  3706. $ctx1.sendIdx["collection"]=1;
  3707. $1=_st($2)._first_((2));
  3708. $ctx1.sendIdx["first:"]=1;
  3709. self._assert_equals_($1,self._collectionFirstTwo());
  3710. $ctx1.sendIdx["assert:equals:"]=1;
  3711. $4=self._collection();
  3712. $ctx1.sendIdx["collection"]=2;
  3713. $3=_st($4)._first_((0));
  3714. $ctx1.sendIdx["first:"]=2;
  3715. self._assert_equals_($3,_st(self._collectionClass())._new());
  3716. $ctx1.sendIdx["assert:equals:"]=2;
  3717. $6=self._collection();
  3718. $ctx1.sendIdx["collection"]=3;
  3719. $5=_st($6)._first_(self._collectionSize());
  3720. $ctx1.sendIdx["first:"]=3;
  3721. $7=self._collection();
  3722. $ctx1.sendIdx["collection"]=4;
  3723. self._assert_equals_($5,$7);
  3724. self._should_raise_((function(){
  3725. return smalltalk.withContext(function($ctx2) {
  3726. return _st(self._collection())._first_((33));
  3727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3728. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)})},
  3729. args: [],
  3730. 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",
  3731. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3732. referencedClasses: ["Error"]
  3733. }),
  3734. globals.SequenceableCollectionTest);
  3735. smalltalk.addMethod(
  3736. smalltalk.method({
  3737. selector: "testFourth",
  3738. protocol: 'tests',
  3739. fn: function (){
  3740. var self=this;
  3741. return smalltalk.withContext(function($ctx1) {
  3742. var $2,$1;
  3743. $2=self._collection();
  3744. $ctx1.sendIdx["collection"]=1;
  3745. $1=_st($2)._fourth();
  3746. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3747. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)})},
  3748. args: [],
  3749. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3750. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3751. referencedClasses: []
  3752. }),
  3753. globals.SequenceableCollectionTest);
  3754. smalltalk.addMethod(
  3755. smalltalk.method({
  3756. selector: "testIndexOfStartingAt",
  3757. protocol: 'tests',
  3758. fn: function (){
  3759. var self=this;
  3760. var jsNull;
  3761. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3762. return smalltalk.withContext(function($ctx1) {
  3763. var $2,$1,$4,$3;
  3764. jsNull=_st($JSON())._parse_("null");
  3765. self._samplesDo_((function(index,value){
  3766. return smalltalk.withContext(function($ctx2) {
  3767. $2=self._collection();
  3768. $ctx2.sendIdx["collection"]=1;
  3769. $1=_st($2)._indexOf_startingAt_(value,(1));
  3770. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3771. self._assert_equals_($1,index);
  3772. $ctx2.sendIdx["assert:equals:"]=1;
  3773. $4=self._collection();
  3774. $ctx2.sendIdx["collection"]=2;
  3775. $3=_st($4)._indexOf_startingAt_(value,index);
  3776. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3777. self._assert_equals_($3,index);
  3778. $ctx2.sendIdx["assert:equals:"]=2;
  3779. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3780. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3781. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3782. args: [],
  3783. 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 ]",
  3784. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3785. referencedClasses: ["JSON"]
  3786. }),
  3787. globals.SequenceableCollectionTest);
  3788. smalltalk.addMethod(
  3789. smalltalk.method({
  3790. selector: "testIndexOfStartingAtWithNull",
  3791. protocol: 'tests',
  3792. fn: function (){
  3793. var self=this;
  3794. var jsNull;
  3795. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3796. return smalltalk.withContext(function($ctx1) {
  3797. var $1,$2;
  3798. jsNull=_st($JSON())._parse_("null");
  3799. self._samplesDo_((function(index,value){
  3800. var collection;
  3801. return smalltalk.withContext(function($ctx2) {
  3802. collection=self._collection();
  3803. collection;
  3804. _st(collection)._at_put_(index,jsNull);
  3805. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3806. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3807. self._assert_equals_($1,index);
  3808. $ctx2.sendIdx["assert:equals:"]=1;
  3809. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3810. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3811. self._assert_equals_($2,index);
  3812. $ctx2.sendIdx["assert:equals:"]=2;
  3813. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3814. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3815. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3816. args: [],
  3817. 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 ]",
  3818. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3819. referencedClasses: ["JSON"]
  3820. }),
  3821. globals.SequenceableCollectionTest);
  3822. smalltalk.addMethod(
  3823. smalltalk.method({
  3824. selector: "testLast",
  3825. protocol: 'tests',
  3826. fn: function (){
  3827. var self=this;
  3828. return smalltalk.withContext(function($ctx1) {
  3829. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3830. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)})},
  3831. args: [],
  3832. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3833. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3834. referencedClasses: []
  3835. }),
  3836. globals.SequenceableCollectionTest);
  3837. smalltalk.addMethod(
  3838. smalltalk.method({
  3839. selector: "testLastN",
  3840. protocol: 'tests',
  3841. fn: function (){
  3842. var self=this;
  3843. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3844. return smalltalk.withContext(function($ctx1) {
  3845. var $2,$1,$4,$3,$6,$5,$7;
  3846. $2=self._collection();
  3847. $ctx1.sendIdx["collection"]=1;
  3848. $1=_st($2)._last_((2));
  3849. $ctx1.sendIdx["last:"]=1;
  3850. self._assert_equals_($1,self._collectionLastTwo());
  3851. $ctx1.sendIdx["assert:equals:"]=1;
  3852. $4=self._collection();
  3853. $ctx1.sendIdx["collection"]=2;
  3854. $3=_st($4)._last_((0));
  3855. $ctx1.sendIdx["last:"]=2;
  3856. self._assert_equals_($3,_st(self._collectionClass())._new());
  3857. $ctx1.sendIdx["assert:equals:"]=2;
  3858. $6=self._collection();
  3859. $ctx1.sendIdx["collection"]=3;
  3860. $5=_st($6)._last_(self._collectionSize());
  3861. $ctx1.sendIdx["last:"]=3;
  3862. $7=self._collection();
  3863. $ctx1.sendIdx["collection"]=4;
  3864. self._assert_equals_($5,$7);
  3865. self._should_raise_((function(){
  3866. return smalltalk.withContext(function($ctx2) {
  3867. return _st(self._collection())._last_((33));
  3868. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3869. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)})},
  3870. args: [],
  3871. 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",
  3872. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3873. referencedClasses: ["Error"]
  3874. }),
  3875. globals.SequenceableCollectionTest);
  3876. smalltalk.addMethod(
  3877. smalltalk.method({
  3878. selector: "testSecond",
  3879. protocol: 'tests',
  3880. fn: function (){
  3881. var self=this;
  3882. return smalltalk.withContext(function($ctx1) {
  3883. var $2,$1;
  3884. $2=self._collection();
  3885. $ctx1.sendIdx["collection"]=1;
  3886. $1=_st($2)._second();
  3887. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3888. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)})},
  3889. args: [],
  3890. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3891. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3892. referencedClasses: []
  3893. }),
  3894. globals.SequenceableCollectionTest);
  3895. smalltalk.addMethod(
  3896. smalltalk.method({
  3897. selector: "testThird",
  3898. protocol: 'tests',
  3899. fn: function (){
  3900. var self=this;
  3901. return smalltalk.withContext(function($ctx1) {
  3902. var $2,$1;
  3903. $2=self._collection();
  3904. $ctx1.sendIdx["collection"]=1;
  3905. $1=_st($2)._third();
  3906. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3907. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)})},
  3908. args: [],
  3909. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3910. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3911. referencedClasses: []
  3912. }),
  3913. globals.SequenceableCollectionTest);
  3914. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  3915. smalltalk.addMethod(
  3916. smalltalk.method({
  3917. selector: "collection",
  3918. protocol: 'fixture',
  3919. fn: function (){
  3920. var self=this;
  3921. var $1;
  3922. $1=[(1), (2), (3), (-4)];
  3923. return $1;
  3924. },
  3925. args: [],
  3926. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3927. messageSends: [],
  3928. referencedClasses: []
  3929. }),
  3930. globals.ArrayTest);
  3931. smalltalk.addMethod(
  3932. smalltalk.method({
  3933. selector: "collectionFirst",
  3934. protocol: 'fixture',
  3935. fn: function (){
  3936. var self=this;
  3937. return (1);
  3938. },
  3939. args: [],
  3940. source: "collectionFirst\x0a\x09^ 1",
  3941. messageSends: [],
  3942. referencedClasses: []
  3943. }),
  3944. globals.ArrayTest);
  3945. smalltalk.addMethod(
  3946. smalltalk.method({
  3947. selector: "collectionFirstTwo",
  3948. protocol: 'fixture',
  3949. fn: function (){
  3950. var self=this;
  3951. var $1;
  3952. $1=[(1), (2)];
  3953. return $1;
  3954. },
  3955. args: [],
  3956. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3957. messageSends: [],
  3958. referencedClasses: []
  3959. }),
  3960. globals.ArrayTest);
  3961. smalltalk.addMethod(
  3962. smalltalk.method({
  3963. selector: "collectionLast",
  3964. protocol: 'fixture',
  3965. fn: function (){
  3966. var self=this;
  3967. return (-4);
  3968. },
  3969. args: [],
  3970. source: "collectionLast\x0a\x09^ -4",
  3971. messageSends: [],
  3972. referencedClasses: []
  3973. }),
  3974. globals.ArrayTest);
  3975. smalltalk.addMethod(
  3976. smalltalk.method({
  3977. selector: "collectionLastTwo",
  3978. protocol: 'fixture',
  3979. fn: function (){
  3980. var self=this;
  3981. var $1;
  3982. $1=[(3), (-4)];
  3983. return $1;
  3984. },
  3985. args: [],
  3986. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3987. messageSends: [],
  3988. referencedClasses: []
  3989. }),
  3990. globals.ArrayTest);
  3991. smalltalk.addMethod(
  3992. smalltalk.method({
  3993. selector: "collectionOfPrintStrings",
  3994. protocol: 'fixture',
  3995. fn: function (){
  3996. var self=this;
  3997. var $1;
  3998. $1=["1", "2", "3", "-4"];
  3999. return $1;
  4000. },
  4001. args: [],
  4002. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  4003. messageSends: [],
  4004. referencedClasses: []
  4005. }),
  4006. globals.ArrayTest);
  4007. smalltalk.addMethod(
  4008. smalltalk.method({
  4009. selector: "collectionSize",
  4010. protocol: 'fixture',
  4011. fn: function (){
  4012. var self=this;
  4013. return (4);
  4014. },
  4015. args: [],
  4016. source: "collectionSize\x0a\x09^ 4",
  4017. messageSends: [],
  4018. referencedClasses: []
  4019. }),
  4020. globals.ArrayTest);
  4021. smalltalk.addMethod(
  4022. smalltalk.method({
  4023. selector: "collectionWithDuplicates",
  4024. protocol: 'fixture',
  4025. fn: function (){
  4026. var self=this;
  4027. var $1;
  4028. $1=["a", "b", "c", (1), (2), (1), "a"];
  4029. return $1;
  4030. },
  4031. args: [],
  4032. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4033. messageSends: [],
  4034. referencedClasses: []
  4035. }),
  4036. globals.ArrayTest);
  4037. smalltalk.addMethod(
  4038. smalltalk.method({
  4039. selector: "collectionWithNewValue",
  4040. protocol: 'fixture',
  4041. fn: function (){
  4042. var self=this;
  4043. var $1;
  4044. $1=[(1), (2), (3), (-4), "N"];
  4045. return $1;
  4046. },
  4047. args: [],
  4048. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4049. messageSends: [],
  4050. referencedClasses: []
  4051. }),
  4052. globals.ArrayTest);
  4053. smalltalk.addMethod(
  4054. smalltalk.method({
  4055. selector: "sampleNewIndex",
  4056. protocol: 'fixture',
  4057. fn: function (){
  4058. var self=this;
  4059. return (5);
  4060. },
  4061. args: [],
  4062. source: "sampleNewIndex\x0a\x09^ 5",
  4063. messageSends: [],
  4064. referencedClasses: []
  4065. }),
  4066. globals.ArrayTest);
  4067. smalltalk.addMethod(
  4068. smalltalk.method({
  4069. selector: "samplesDo:",
  4070. protocol: 'fixture',
  4071. fn: function (aBlock){
  4072. var self=this;
  4073. return smalltalk.withContext(function($ctx1) {
  4074. ($ctx1.supercall = true, globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4075. $ctx1.supercall = false;
  4076. _st(aBlock)._value_value_((3),(3));
  4077. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)})},
  4078. args: ["aBlock"],
  4079. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4080. messageSends: ["samplesDo:", "value:value:"],
  4081. referencedClasses: []
  4082. }),
  4083. globals.ArrayTest);
  4084. smalltalk.addMethod(
  4085. smalltalk.method({
  4086. selector: "testAdd",
  4087. protocol: 'tests',
  4088. fn: function (){
  4089. var self=this;
  4090. var array;
  4091. return smalltalk.withContext(function($ctx1) {
  4092. array=self._collection();
  4093. _st(array)._add_((6));
  4094. self._assert_equals_(_st(array)._last(),(6));
  4095. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)})},
  4096. args: [],
  4097. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4098. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4099. referencedClasses: []
  4100. }),
  4101. globals.ArrayTest);
  4102. smalltalk.addMethod(
  4103. smalltalk.method({
  4104. selector: "testAddFirst",
  4105. protocol: 'tests',
  4106. fn: function (){
  4107. var self=this;
  4108. return smalltalk.withContext(function($ctx1) {
  4109. var $1,$2;
  4110. $1=self._collection();
  4111. _st($1)._addFirst_((0));
  4112. $2=_st($1)._yourself();
  4113. self._assert_equals_(_st($2)._first(),(0));
  4114. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)})},
  4115. args: [],
  4116. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4117. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4118. referencedClasses: []
  4119. }),
  4120. globals.ArrayTest);
  4121. smalltalk.addMethod(
  4122. smalltalk.method({
  4123. selector: "testPrintString",
  4124. protocol: 'tests',
  4125. fn: function (){
  4126. var self=this;
  4127. var array;
  4128. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4129. return smalltalk.withContext(function($ctx1) {
  4130. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4131. array=_st($Array())._new();
  4132. $1=_st(array)._printString();
  4133. $ctx1.sendIdx["printString"]=1;
  4134. self._assert_equals_($1,"an Array ()");
  4135. $ctx1.sendIdx["assert:equals:"]=1;
  4136. $2=array;
  4137. _st($2)._add_((1));
  4138. $ctx1.sendIdx["add:"]=1;
  4139. $3=_st($2)._add_((3));
  4140. $ctx1.sendIdx["add:"]=2;
  4141. $4=_st(array)._printString();
  4142. $ctx1.sendIdx["printString"]=2;
  4143. self._assert_equals_($4,"an Array (1 3)");
  4144. $ctx1.sendIdx["assert:equals:"]=2;
  4145. _st(array)._add_("foo");
  4146. $5=_st(array)._printString();
  4147. $ctx1.sendIdx["printString"]=3;
  4148. self._assert_equals_($5,"an Array (1 3 'foo')");
  4149. $ctx1.sendIdx["assert:equals:"]=3;
  4150. $6=array;
  4151. _st($6)._remove_((1));
  4152. $ctx1.sendIdx["remove:"]=1;
  4153. $7=_st($6)._remove_((3));
  4154. $8=_st(array)._printString();
  4155. $ctx1.sendIdx["printString"]=4;
  4156. self._assert_equals_($8,"an Array ('foo')");
  4157. $ctx1.sendIdx["assert:equals:"]=4;
  4158. _st(array)._addLast_((3));
  4159. $ctx1.sendIdx["addLast:"]=1;
  4160. $9=_st(array)._printString();
  4161. $ctx1.sendIdx["printString"]=5;
  4162. self._assert_equals_($9,"an Array ('foo' 3)");
  4163. $ctx1.sendIdx["assert:equals:"]=5;
  4164. _st(array)._addLast_((3));
  4165. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4166. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)})},
  4167. args: [],
  4168. 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)'.",
  4169. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4170. referencedClasses: ["Array"]
  4171. }),
  4172. globals.ArrayTest);
  4173. smalltalk.addMethod(
  4174. smalltalk.method({
  4175. selector: "testRemove",
  4176. protocol: 'tests',
  4177. fn: function (){
  4178. var self=this;
  4179. var array;
  4180. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4181. return smalltalk.withContext(function($ctx1) {
  4182. array=[(1), (2), (3), (4), (5)];
  4183. _st(array)._remove_((3));
  4184. $ctx1.sendIdx["remove:"]=1;
  4185. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4186. self._should_raise_((function(){
  4187. return smalltalk.withContext(function($ctx2) {
  4188. return _st(array)._remove_((3));
  4189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4190. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)})},
  4191. args: [],
  4192. 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",
  4193. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4194. referencedClasses: ["Error"]
  4195. }),
  4196. globals.ArrayTest);
  4197. smalltalk.addMethod(
  4198. smalltalk.method({
  4199. selector: "testRemoveFromTo",
  4200. protocol: 'tests',
  4201. fn: function (){
  4202. var self=this;
  4203. return smalltalk.withContext(function($ctx1) {
  4204. var $1,$2;
  4205. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4206. $ctx1.sendIdx["removeFrom:to:"]=1;
  4207. self._assert_equals_($1,[(4)]);
  4208. $ctx1.sendIdx["assert:equals:"]=1;
  4209. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4210. $ctx1.sendIdx["removeFrom:to:"]=2;
  4211. self._assert_equals_($2,[(1), (4)]);
  4212. $ctx1.sendIdx["assert:equals:"]=2;
  4213. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4214. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)})},
  4215. args: [],
  4216. 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)",
  4217. messageSends: ["assert:equals:", "removeFrom:to:"],
  4218. referencedClasses: []
  4219. }),
  4220. globals.ArrayTest);
  4221. smalltalk.addMethod(
  4222. smalltalk.method({
  4223. selector: "testRemoveIndex",
  4224. protocol: 'tests',
  4225. fn: function (){
  4226. var self=this;
  4227. return smalltalk.withContext(function($ctx1) {
  4228. var $1,$2;
  4229. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4230. $ctx1.sendIdx["removeIndex:"]=1;
  4231. self._assert_equals_($1,[(1), (3), (4)]);
  4232. $ctx1.sendIdx["assert:equals:"]=1;
  4233. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4234. $ctx1.sendIdx["removeIndex:"]=2;
  4235. self._assert_equals_($2,[(2), (3), (4)]);
  4236. $ctx1.sendIdx["assert:equals:"]=2;
  4237. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4238. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)})},
  4239. args: [],
  4240. 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: #()",
  4241. messageSends: ["assert:equals:", "removeIndex:"],
  4242. referencedClasses: []
  4243. }),
  4244. globals.ArrayTest);
  4245. smalltalk.addMethod(
  4246. smalltalk.method({
  4247. selector: "testRemoveLast",
  4248. protocol: 'tests',
  4249. fn: function (){
  4250. var self=this;
  4251. var array;
  4252. return smalltalk.withContext(function($ctx1) {
  4253. array=[(1), (2)];
  4254. _st(array)._removeLast();
  4255. self._assert_equals_(_st(array)._last(),(1));
  4256. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)})},
  4257. args: [],
  4258. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4259. messageSends: ["removeLast", "assert:equals:", "last"],
  4260. referencedClasses: []
  4261. }),
  4262. globals.ArrayTest);
  4263. smalltalk.addMethod(
  4264. smalltalk.method({
  4265. selector: "testReversed",
  4266. protocol: 'tests',
  4267. fn: function (){
  4268. var self=this;
  4269. var array;
  4270. return smalltalk.withContext(function($ctx1) {
  4271. array=[(5), (4), (3), (2), (1)];
  4272. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4273. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)})},
  4274. args: [],
  4275. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4276. messageSends: ["assert:equals:", "reversed"],
  4277. referencedClasses: []
  4278. }),
  4279. globals.ArrayTest);
  4280. smalltalk.addMethod(
  4281. smalltalk.method({
  4282. selector: "testSort",
  4283. protocol: 'tests',
  4284. fn: function (){
  4285. var self=this;
  4286. var array;
  4287. return smalltalk.withContext(function($ctx1) {
  4288. array=[(10), (1), (5)];
  4289. _st(array)._sort();
  4290. self._assert_equals_(array,[(1), (5), (10)]);
  4291. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)})},
  4292. args: [],
  4293. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  4294. messageSends: ["sort", "assert:equals:"],
  4295. referencedClasses: []
  4296. }),
  4297. globals.ArrayTest);
  4298. smalltalk.addMethod(
  4299. smalltalk.method({
  4300. selector: "collectionClass",
  4301. protocol: 'fixture',
  4302. fn: function (){
  4303. var self=this;
  4304. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4305. return $Array();
  4306. },
  4307. args: [],
  4308. source: "collectionClass\x0a\x09^ Array",
  4309. messageSends: [],
  4310. referencedClasses: ["Array"]
  4311. }),
  4312. globals.ArrayTest.klass);
  4313. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  4314. smalltalk.addMethod(
  4315. smalltalk.method({
  4316. selector: "collection",
  4317. protocol: 'fixture',
  4318. fn: function (){
  4319. var self=this;
  4320. return "helLo";
  4321. },
  4322. args: [],
  4323. source: "collection\x0a\x09^ 'helLo'",
  4324. messageSends: [],
  4325. referencedClasses: []
  4326. }),
  4327. globals.StringTest);
  4328. smalltalk.addMethod(
  4329. smalltalk.method({
  4330. selector: "collectionFirst",
  4331. protocol: 'fixture',
  4332. fn: function (){
  4333. var self=this;
  4334. return "h";
  4335. },
  4336. args: [],
  4337. source: "collectionFirst\x0a\x09^ 'h'",
  4338. messageSends: [],
  4339. referencedClasses: []
  4340. }),
  4341. globals.StringTest);
  4342. smalltalk.addMethod(
  4343. smalltalk.method({
  4344. selector: "collectionFirstTwo",
  4345. protocol: 'fixture',
  4346. fn: function (){
  4347. var self=this;
  4348. return "he";
  4349. },
  4350. args: [],
  4351. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4352. messageSends: [],
  4353. referencedClasses: []
  4354. }),
  4355. globals.StringTest);
  4356. smalltalk.addMethod(
  4357. smalltalk.method({
  4358. selector: "collectionLast",
  4359. protocol: 'fixture',
  4360. fn: function (){
  4361. var self=this;
  4362. return "o";
  4363. },
  4364. args: [],
  4365. source: "collectionLast\x0a\x09^ 'o'",
  4366. messageSends: [],
  4367. referencedClasses: []
  4368. }),
  4369. globals.StringTest);
  4370. smalltalk.addMethod(
  4371. smalltalk.method({
  4372. selector: "collectionLastTwo",
  4373. protocol: 'fixture',
  4374. fn: function (){
  4375. var self=this;
  4376. return "Lo";
  4377. },
  4378. args: [],
  4379. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4380. messageSends: [],
  4381. referencedClasses: []
  4382. }),
  4383. globals.StringTest);
  4384. smalltalk.addMethod(
  4385. smalltalk.method({
  4386. selector: "collectionOfPrintStrings",
  4387. protocol: 'fixture',
  4388. fn: function (){
  4389. var self=this;
  4390. return "'h''e''l''L''o'";
  4391. },
  4392. args: [],
  4393. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4394. messageSends: [],
  4395. referencedClasses: []
  4396. }),
  4397. globals.StringTest);
  4398. smalltalk.addMethod(
  4399. smalltalk.method({
  4400. selector: "collectionSize",
  4401. protocol: 'fixture',
  4402. fn: function (){
  4403. var self=this;
  4404. return (5);
  4405. },
  4406. args: [],
  4407. source: "collectionSize\x0a\x09^ 5",
  4408. messageSends: [],
  4409. referencedClasses: []
  4410. }),
  4411. globals.StringTest);
  4412. smalltalk.addMethod(
  4413. smalltalk.method({
  4414. selector: "collectionWithDuplicates",
  4415. protocol: 'fixture',
  4416. fn: function (){
  4417. var self=this;
  4418. return "abbaerte";
  4419. },
  4420. args: [],
  4421. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4422. messageSends: [],
  4423. referencedClasses: []
  4424. }),
  4425. globals.StringTest);
  4426. smalltalk.addMethod(
  4427. smalltalk.method({
  4428. selector: "collectionWithNewValue",
  4429. protocol: 'fixture',
  4430. fn: function (){
  4431. var self=this;
  4432. return "helLoN";
  4433. },
  4434. args: [],
  4435. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4436. messageSends: [],
  4437. referencedClasses: []
  4438. }),
  4439. globals.StringTest);
  4440. smalltalk.addMethod(
  4441. smalltalk.method({
  4442. selector: "sampleNewValueAsCollection",
  4443. protocol: 'fixture',
  4444. fn: function (){
  4445. var self=this;
  4446. return "N";
  4447. },
  4448. args: [],
  4449. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4450. messageSends: [],
  4451. referencedClasses: []
  4452. }),
  4453. globals.StringTest);
  4454. smalltalk.addMethod(
  4455. smalltalk.method({
  4456. selector: "samplesDo:",
  4457. protocol: 'fixture',
  4458. fn: function (aBlock){
  4459. var self=this;
  4460. return smalltalk.withContext(function($ctx1) {
  4461. ($ctx1.supercall = true, globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4462. $ctx1.supercall = false;
  4463. _st(aBlock)._value_value_((3),"l");
  4464. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)})},
  4465. args: ["aBlock"],
  4466. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4467. messageSends: ["samplesDo:", "value:value:"],
  4468. referencedClasses: []
  4469. }),
  4470. globals.StringTest);
  4471. smalltalk.addMethod(
  4472. smalltalk.method({
  4473. selector: "testAddAll",
  4474. protocol: 'tests',
  4475. fn: function (){
  4476. var self=this;
  4477. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4478. return smalltalk.withContext(function($ctx1) {
  4479. var $1;
  4480. self._should_raise_((function(){
  4481. return smalltalk.withContext(function($ctx2) {
  4482. $1=self._collection();
  4483. $ctx2.sendIdx["collection"]=1;
  4484. return _st($1)._addAll_(self._collection());
  4485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4486. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)})},
  4487. args: [],
  4488. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4489. messageSends: ["should:raise:", "addAll:", "collection"],
  4490. referencedClasses: ["Error"]
  4491. }),
  4492. globals.StringTest);
  4493. smalltalk.addMethod(
  4494. smalltalk.method({
  4495. selector: "testAddRemove",
  4496. protocol: 'tests',
  4497. fn: function (){
  4498. var self=this;
  4499. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4500. return smalltalk.withContext(function($ctx1) {
  4501. self._should_raise_((function(){
  4502. return smalltalk.withContext(function($ctx2) {
  4503. return "hello"._add_("a");
  4504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4505. $ctx1.sendIdx["should:raise:"]=1;
  4506. self._should_raise_((function(){
  4507. return smalltalk.withContext(function($ctx2) {
  4508. return "hello"._remove_("h");
  4509. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4510. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)})},
  4511. args: [],
  4512. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4513. messageSends: ["should:raise:", "add:", "remove:"],
  4514. referencedClasses: ["Error"]
  4515. }),
  4516. globals.StringTest);
  4517. smalltalk.addMethod(
  4518. smalltalk.method({
  4519. selector: "testAsArray",
  4520. protocol: 'tests',
  4521. fn: function (){
  4522. var self=this;
  4523. return smalltalk.withContext(function($ctx1) {
  4524. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4525. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)})},
  4526. args: [],
  4527. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4528. messageSends: ["assert:equals:", "asArray"],
  4529. referencedClasses: []
  4530. }),
  4531. globals.StringTest);
  4532. smalltalk.addMethod(
  4533. smalltalk.method({
  4534. selector: "testAsLowerCase",
  4535. protocol: 'tests',
  4536. fn: function (){
  4537. var self=this;
  4538. return smalltalk.withContext(function($ctx1) {
  4539. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4540. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)})},
  4541. args: [],
  4542. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4543. messageSends: ["assert:equals:", "asLowercase"],
  4544. referencedClasses: []
  4545. }),
  4546. globals.StringTest);
  4547. smalltalk.addMethod(
  4548. smalltalk.method({
  4549. selector: "testAsNumber",
  4550. protocol: 'tests',
  4551. fn: function (){
  4552. var self=this;
  4553. return smalltalk.withContext(function($ctx1) {
  4554. var $1,$2;
  4555. $1="3"._asNumber();
  4556. $ctx1.sendIdx["asNumber"]=1;
  4557. self._assert_equals_($1,(3));
  4558. $ctx1.sendIdx["assert:equals:"]=1;
  4559. $2="-3"._asNumber();
  4560. $ctx1.sendIdx["asNumber"]=2;
  4561. self._assert_equals_($2,(-3));
  4562. $ctx1.sendIdx["assert:equals:"]=2;
  4563. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4564. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)})},
  4565. args: [],
  4566. 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.",
  4567. messageSends: ["assert:equals:", "asNumber"],
  4568. referencedClasses: []
  4569. }),
  4570. globals.StringTest);
  4571. smalltalk.addMethod(
  4572. smalltalk.method({
  4573. selector: "testAsUpperCase",
  4574. protocol: 'tests',
  4575. fn: function (){
  4576. var self=this;
  4577. return smalltalk.withContext(function($ctx1) {
  4578. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4579. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)})},
  4580. args: [],
  4581. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4582. messageSends: ["assert:equals:", "asUppercase"],
  4583. referencedClasses: []
  4584. }),
  4585. globals.StringTest);
  4586. smalltalk.addMethod(
  4587. smalltalk.method({
  4588. selector: "testAsciiValue",
  4589. protocol: 'tests',
  4590. fn: function (){
  4591. var self=this;
  4592. var characterA,characterU;
  4593. return smalltalk.withContext(function($ctx1) {
  4594. var $1;
  4595. characterA="A";
  4596. characterU="U";
  4597. $1=_st(characterA)._asciiValue();
  4598. $ctx1.sendIdx["asciiValue"]=1;
  4599. self._assert_equals_($1,(65));
  4600. $ctx1.sendIdx["assert:equals:"]=1;
  4601. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4602. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)})},
  4603. args: [],
  4604. 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",
  4605. messageSends: ["assert:equals:", "asciiValue"],
  4606. referencedClasses: []
  4607. }),
  4608. globals.StringTest);
  4609. smalltalk.addMethod(
  4610. smalltalk.method({
  4611. selector: "testAtIfAbsentPut",
  4612. protocol: 'tests',
  4613. fn: function (){
  4614. var self=this;
  4615. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4616. return smalltalk.withContext(function($ctx1) {
  4617. self._should_raise_((function(){
  4618. return smalltalk.withContext(function($ctx2) {
  4619. return "hello"._at_ifAbsentPut_((6),(function(){
  4620. return "a";
  4621. }));
  4622. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4623. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)})},
  4624. args: [],
  4625. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4626. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4627. referencedClasses: ["Error"]
  4628. }),
  4629. globals.StringTest);
  4630. smalltalk.addMethod(
  4631. smalltalk.method({
  4632. selector: "testAtPut",
  4633. protocol: 'tests',
  4634. fn: function (){
  4635. var self=this;
  4636. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4637. return smalltalk.withContext(function($ctx1) {
  4638. self._should_raise_((function(){
  4639. return smalltalk.withContext(function($ctx2) {
  4640. return "hello"._at_put_((1),"a");
  4641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4642. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)})},
  4643. args: [],
  4644. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4645. messageSends: ["should:raise:", "at:put:"],
  4646. referencedClasses: ["Error"]
  4647. }),
  4648. globals.StringTest);
  4649. smalltalk.addMethod(
  4650. smalltalk.method({
  4651. selector: "testCapitalized",
  4652. protocol: 'tests',
  4653. fn: function (){
  4654. var self=this;
  4655. return smalltalk.withContext(function($ctx1) {
  4656. var $1,$2,$3;
  4657. $1="test"._capitalized();
  4658. $ctx1.sendIdx["capitalized"]=1;
  4659. self._assert_equals_($1,"Test");
  4660. $ctx1.sendIdx["assert:equals:"]=1;
  4661. $2="Test"._capitalized();
  4662. $ctx1.sendIdx["capitalized"]=2;
  4663. self._assert_equals_($2,"Test");
  4664. $ctx1.sendIdx["assert:equals:"]=2;
  4665. self._assert_equals_(""._capitalized(),"");
  4666. $ctx1.sendIdx["assert:equals:"]=3;
  4667. $3="Test"._isCapitalized();
  4668. $ctx1.sendIdx["isCapitalized"]=1;
  4669. self._assert_equals_($3,true);
  4670. $ctx1.sendIdx["assert:equals:"]=4;
  4671. self._assert_equals_("test"._isCapitalized(),false);
  4672. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)})},
  4673. args: [],
  4674. 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.",
  4675. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4676. referencedClasses: []
  4677. }),
  4678. globals.StringTest);
  4679. smalltalk.addMethod(
  4680. smalltalk.method({
  4681. selector: "testCharCodeAt",
  4682. protocol: 'tests',
  4683. fn: function (){
  4684. var self=this;
  4685. return smalltalk.withContext(function($ctx1) {
  4686. var $1,$2,$3,$4,$5;
  4687. $1="jackie"._charCodeAt_((1));
  4688. $ctx1.sendIdx["charCodeAt:"]=1;
  4689. self._assert_equals_($1,(106));
  4690. $ctx1.sendIdx["assert:equals:"]=1;
  4691. $2="jackie"._charCodeAt_((2));
  4692. $ctx1.sendIdx["charCodeAt:"]=2;
  4693. self._assert_equals_($2,(97));
  4694. $ctx1.sendIdx["assert:equals:"]=2;
  4695. $3="jackie"._charCodeAt_((3));
  4696. $ctx1.sendIdx["charCodeAt:"]=3;
  4697. self._assert_equals_($3,(99));
  4698. $ctx1.sendIdx["assert:equals:"]=3;
  4699. $4="jackie"._charCodeAt_((4));
  4700. $ctx1.sendIdx["charCodeAt:"]=4;
  4701. self._assert_equals_($4,(107));
  4702. $ctx1.sendIdx["assert:equals:"]=4;
  4703. $5="jackie"._charCodeAt_((5));
  4704. $ctx1.sendIdx["charCodeAt:"]=5;
  4705. self._assert_equals_($5,(105));
  4706. $ctx1.sendIdx["assert:equals:"]=5;
  4707. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4708. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)})},
  4709. args: [],
  4710. 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",
  4711. messageSends: ["assert:equals:", "charCodeAt:"],
  4712. referencedClasses: []
  4713. }),
  4714. globals.StringTest);
  4715. smalltalk.addMethod(
  4716. smalltalk.method({
  4717. selector: "testCopyFromTo",
  4718. protocol: 'tests',
  4719. fn: function (){
  4720. var self=this;
  4721. return smalltalk.withContext(function($ctx1) {
  4722. var $1;
  4723. $1="jackie"._copyFrom_to_((1),(3));
  4724. $ctx1.sendIdx["copyFrom:to:"]=1;
  4725. self._assert_equals_($1,"jac");
  4726. $ctx1.sendIdx["assert:equals:"]=1;
  4727. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4728. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)})},
  4729. args: [],
  4730. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4731. messageSends: ["assert:equals:", "copyFrom:to:"],
  4732. referencedClasses: []
  4733. }),
  4734. globals.StringTest);
  4735. smalltalk.addMethod(
  4736. smalltalk.method({
  4737. selector: "testCopyWithoutAll",
  4738. protocol: 'tests',
  4739. fn: function (){
  4740. var self=this;
  4741. return smalltalk.withContext(function($ctx1) {
  4742. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4743. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)})},
  4744. args: [],
  4745. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4746. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4747. referencedClasses: []
  4748. }),
  4749. globals.StringTest);
  4750. smalltalk.addMethod(
  4751. smalltalk.method({
  4752. selector: "testEquality",
  4753. protocol: 'tests',
  4754. fn: function (){
  4755. var self=this;
  4756. return smalltalk.withContext(function($ctx1) {
  4757. var $1,$2,$3;
  4758. self._assert_equals_("hello","hello");
  4759. $ctx1.sendIdx["assert:equals:"]=1;
  4760. $1="hello".__eq("world");
  4761. $ctx1.sendIdx["="]=1;
  4762. self._deny_($1);
  4763. $ctx1.sendIdx["deny:"]=1;
  4764. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4765. })));
  4766. $ctx1.sendIdx["="]=2;
  4767. self._deny_($2);
  4768. $ctx1.sendIdx["deny:"]=2;
  4769. $3="hello"._yourself();
  4770. $ctx1.sendIdx["yourself"]=1;
  4771. self._assert_equals_("hello",$3);
  4772. $ctx1.sendIdx["assert:equals:"]=2;
  4773. self._assert_equals_("hello"._yourself(),"hello");
  4774. self._deny_("".__eq((0)));
  4775. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)})},
  4776. args: [],
  4777. 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",
  4778. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4779. referencedClasses: []
  4780. }),
  4781. globals.StringTest);
  4782. smalltalk.addMethod(
  4783. smalltalk.method({
  4784. selector: "testIdentity",
  4785. protocol: 'tests',
  4786. fn: function (){
  4787. var self=this;
  4788. return smalltalk.withContext(function($ctx1) {
  4789. var $1,$2,$4,$3,$5;
  4790. $1="hello".__eq_eq("hello");
  4791. $ctx1.sendIdx["=="]=1;
  4792. self._assert_($1);
  4793. $ctx1.sendIdx["assert:"]=1;
  4794. $2="hello".__eq_eq("world");
  4795. $ctx1.sendIdx["=="]=2;
  4796. self._deny_($2);
  4797. $ctx1.sendIdx["deny:"]=1;
  4798. $4="hello"._yourself();
  4799. $ctx1.sendIdx["yourself"]=1;
  4800. $3="hello".__eq_eq($4);
  4801. $ctx1.sendIdx["=="]=3;
  4802. self._assert_($3);
  4803. $ctx1.sendIdx["assert:"]=2;
  4804. $5=_st("hello"._yourself()).__eq_eq("hello");
  4805. $ctx1.sendIdx["=="]=4;
  4806. self._assert_($5);
  4807. self._deny_("".__eq_eq((0)));
  4808. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)})},
  4809. args: [],
  4810. 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",
  4811. messageSends: ["assert:", "==", "deny:", "yourself"],
  4812. referencedClasses: []
  4813. }),
  4814. globals.StringTest);
  4815. smalltalk.addMethod(
  4816. smalltalk.method({
  4817. selector: "testIdentityHash",
  4818. protocol: 'tests',
  4819. fn: function (){
  4820. var self=this;
  4821. return smalltalk.withContext(function($ctx1) {
  4822. var $1,$2,$4,$3;
  4823. $1="foo"._identityHash();
  4824. $ctx1.sendIdx["identityHash"]=1;
  4825. $2="foo"._identityHash();
  4826. $ctx1.sendIdx["identityHash"]=2;
  4827. self._assert_equals_($1,$2);
  4828. $4="foo"._identityHash();
  4829. $ctx1.sendIdx["identityHash"]=3;
  4830. $3=_st($4).__eq("bar"._identityHash());
  4831. self._deny_($3);
  4832. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)})},
  4833. args: [],
  4834. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4835. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4836. referencedClasses: []
  4837. }),
  4838. globals.StringTest);
  4839. smalltalk.addMethod(
  4840. smalltalk.method({
  4841. selector: "testIncludesSubString",
  4842. protocol: 'tests',
  4843. fn: function (){
  4844. var self=this;
  4845. return smalltalk.withContext(function($ctx1) {
  4846. var $1;
  4847. $1="amber"._includesSubString_("ber");
  4848. $ctx1.sendIdx["includesSubString:"]=1;
  4849. self._assert_($1);
  4850. self._deny_("amber"._includesSubString_("zork"));
  4851. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)})},
  4852. args: [],
  4853. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4854. messageSends: ["assert:", "includesSubString:", "deny:"],
  4855. referencedClasses: []
  4856. }),
  4857. globals.StringTest);
  4858. smalltalk.addMethod(
  4859. smalltalk.method({
  4860. selector: "testIndexOfStartingAtWithNull",
  4861. protocol: 'tests',
  4862. fn: function (){
  4863. var self=this;
  4864. return self},
  4865. args: [],
  4866. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4867. messageSends: [],
  4868. referencedClasses: []
  4869. }),
  4870. globals.StringTest);
  4871. smalltalk.addMethod(
  4872. smalltalk.method({
  4873. selector: "testIndexOfWithNull",
  4874. protocol: 'tests',
  4875. fn: function (){
  4876. var self=this;
  4877. return self},
  4878. args: [],
  4879. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4880. messageSends: [],
  4881. referencedClasses: []
  4882. }),
  4883. globals.StringTest);
  4884. smalltalk.addMethod(
  4885. smalltalk.method({
  4886. selector: "testIsVowel",
  4887. protocol: 'tests',
  4888. fn: function (){
  4889. var self=this;
  4890. var vowel,consonant;
  4891. return smalltalk.withContext(function($ctx1) {
  4892. var $1;
  4893. vowel="u";
  4894. consonant="z";
  4895. $1=_st(vowel)._isVowel();
  4896. $ctx1.sendIdx["isVowel"]=1;
  4897. self._assert_equals_($1,true);
  4898. $ctx1.sendIdx["assert:equals:"]=1;
  4899. self._assert_equals_(_st(consonant)._isVowel(),false);
  4900. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)})},
  4901. args: [],
  4902. 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",
  4903. messageSends: ["assert:equals:", "isVowel"],
  4904. referencedClasses: []
  4905. }),
  4906. globals.StringTest);
  4907. smalltalk.addMethod(
  4908. smalltalk.method({
  4909. selector: "testJoin",
  4910. protocol: 'tests',
  4911. fn: function (){
  4912. var self=this;
  4913. return smalltalk.withContext(function($ctx1) {
  4914. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4915. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)})},
  4916. args: [],
  4917. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4918. messageSends: ["assert:equals:", "join:"],
  4919. referencedClasses: []
  4920. }),
  4921. globals.StringTest);
  4922. smalltalk.addMethod(
  4923. smalltalk.method({
  4924. selector: "testRemoveAll",
  4925. protocol: 'tests',
  4926. fn: function (){
  4927. var self=this;
  4928. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4929. return smalltalk.withContext(function($ctx1) {
  4930. self._should_raise_((function(){
  4931. return smalltalk.withContext(function($ctx2) {
  4932. return _st(self._collection())._removeAll();
  4933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4934. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)})},
  4935. args: [],
  4936. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4937. messageSends: ["should:raise:", "removeAll", "collection"],
  4938. referencedClasses: ["Error"]
  4939. }),
  4940. globals.StringTest);
  4941. smalltalk.addMethod(
  4942. smalltalk.method({
  4943. selector: "testReversed",
  4944. protocol: 'tests',
  4945. fn: function (){
  4946. var self=this;
  4947. return smalltalk.withContext(function($ctx1) {
  4948. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4949. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)})},
  4950. args: [],
  4951. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4952. messageSends: ["assert:equals:", "reversed"],
  4953. referencedClasses: []
  4954. }),
  4955. globals.StringTest);
  4956. smalltalk.addMethod(
  4957. smalltalk.method({
  4958. selector: "testStreamContents",
  4959. protocol: 'tests',
  4960. fn: function (){
  4961. var self=this;
  4962. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  4963. return smalltalk.withContext(function($ctx1) {
  4964. var $1;
  4965. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4966. return smalltalk.withContext(function($ctx2) {
  4967. _st(aStream)._nextPutAll_("hello");
  4968. $ctx2.sendIdx["nextPutAll:"]=1;
  4969. _st(aStream)._space();
  4970. $1=_st(aStream)._nextPutAll_("world");
  4971. return $1;
  4972. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4973. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)})},
  4974. args: [],
  4975. 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'",
  4976. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4977. referencedClasses: ["String"]
  4978. }),
  4979. globals.StringTest);
  4980. smalltalk.addMethod(
  4981. smalltalk.method({
  4982. selector: "testSubStrings",
  4983. protocol: 'tests',
  4984. fn: function (){
  4985. var self=this;
  4986. return smalltalk.withContext(function($ctx1) {
  4987. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4988. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)})},
  4989. args: [],
  4990. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4991. messageSends: ["assert:equals:", "subStrings:"],
  4992. referencedClasses: []
  4993. }),
  4994. globals.StringTest);
  4995. smalltalk.addMethod(
  4996. smalltalk.method({
  4997. selector: "testTrim",
  4998. protocol: 'tests',
  4999. fn: function (){
  5000. var self=this;
  5001. return smalltalk.withContext(function($ctx1) {
  5002. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  5003. $ctx1.sendIdx["assert:equals:"]=1;
  5004. self._assert_equals_("jackie "._trimRight(),"jackie");
  5005. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)})},
  5006. args: [],
  5007. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  5008. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  5009. referencedClasses: []
  5010. }),
  5011. globals.StringTest);
  5012. smalltalk.addMethod(
  5013. smalltalk.method({
  5014. selector: "testValue",
  5015. protocol: 'tests',
  5016. fn: function (){
  5017. var self=this;
  5018. return smalltalk.withContext(function($ctx1) {
  5019. self._assert_equals_("asString"._value_((1)),"1");
  5020. $ctx1.sendIdx["assert:equals:"]=1;
  5021. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  5022. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.StringTest)})},
  5023. args: [],
  5024. source: "testValue\x0a\x0a\x09self assert: (#asString value: 1) equals: '1'.\x0a\x0a\x09\x22Which (since String and BlockClosure are now polymorphic) enables the nice idiom...\x22\x0a\x09self assert: (#(1 2 3) collect: #asString) equals: #('1' '2' '3')",
  5025. messageSends: ["assert:equals:", "value:", "collect:"],
  5026. referencedClasses: []
  5027. }),
  5028. globals.StringTest);
  5029. smalltalk.addMethod(
  5030. smalltalk.method({
  5031. selector: "collectionClass",
  5032. protocol: 'fixture',
  5033. fn: function (){
  5034. var self=this;
  5035. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5036. return $String();
  5037. },
  5038. args: [],
  5039. source: "collectionClass\x0a\x09^ String",
  5040. messageSends: [],
  5041. referencedClasses: ["String"]
  5042. }),
  5043. globals.StringTest.klass);
  5044. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  5045. smalltalk.addMethod(
  5046. smalltalk.method({
  5047. selector: "collection",
  5048. protocol: 'fixture',
  5049. fn: function (){
  5050. var self=this;
  5051. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5052. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5053. return smalltalk.withContext(function($ctx1) {
  5054. var $2,$3,$1;
  5055. $2=_st($Set())._new();
  5056. _st($2)._add_($Smalltalk());
  5057. $ctx1.sendIdx["add:"]=1;
  5058. _st($2)._add_(nil);
  5059. $ctx1.sendIdx["add:"]=2;
  5060. _st($2)._add_((3).__at((3)));
  5061. $ctx1.sendIdx["add:"]=3;
  5062. _st($2)._add_(false);
  5063. $3=_st($2)._yourself();
  5064. $1=$3;
  5065. return $1;
  5066. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)})},
  5067. args: [],
  5068. 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",
  5069. messageSends: ["add:", "new", "@", "yourself"],
  5070. referencedClasses: ["Set", "Smalltalk"]
  5071. }),
  5072. globals.SetTest);
  5073. smalltalk.addMethod(
  5074. smalltalk.method({
  5075. selector: "collectionOfPrintStrings",
  5076. protocol: 'fixture',
  5077. fn: function (){
  5078. var self=this;
  5079. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5080. return smalltalk.withContext(function($ctx1) {
  5081. var $2,$3,$1;
  5082. $2=_st($Set())._new();
  5083. _st($2)._add_("a SmalltalkImage");
  5084. $ctx1.sendIdx["add:"]=1;
  5085. _st($2)._add_("nil");
  5086. $ctx1.sendIdx["add:"]=2;
  5087. _st($2)._add_("3@3");
  5088. $ctx1.sendIdx["add:"]=3;
  5089. _st($2)._add_("false");
  5090. $3=_st($2)._yourself();
  5091. $1=$3;
  5092. return $1;
  5093. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)})},
  5094. args: [],
  5095. 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",
  5096. messageSends: ["add:", "new", "yourself"],
  5097. referencedClasses: ["Set"]
  5098. }),
  5099. globals.SetTest);
  5100. smalltalk.addMethod(
  5101. smalltalk.method({
  5102. selector: "collectionSize",
  5103. protocol: 'fixture',
  5104. fn: function (){
  5105. var self=this;
  5106. return (4);
  5107. },
  5108. args: [],
  5109. source: "collectionSize\x0a\x09^ 4",
  5110. messageSends: [],
  5111. referencedClasses: []
  5112. }),
  5113. globals.SetTest);
  5114. smalltalk.addMethod(
  5115. smalltalk.method({
  5116. selector: "collectionWithDuplicates",
  5117. protocol: 'fixture',
  5118. fn: function (){
  5119. var self=this;
  5120. return smalltalk.withContext(function($ctx1) {
  5121. var $2,$3,$1;
  5122. $2=self._collection();
  5123. _st($2)._add_((0));
  5124. $3=_st($2)._yourself();
  5125. $1=$3;
  5126. return $1;
  5127. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)})},
  5128. args: [],
  5129. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5130. messageSends: ["add:", "collection", "yourself"],
  5131. referencedClasses: []
  5132. }),
  5133. globals.SetTest);
  5134. smalltalk.addMethod(
  5135. smalltalk.method({
  5136. selector: "collectionWithNewValue",
  5137. protocol: 'fixture',
  5138. fn: function (){
  5139. var self=this;
  5140. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5141. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5142. return smalltalk.withContext(function($ctx1) {
  5143. var $2,$3,$1;
  5144. $2=_st($Set())._new();
  5145. _st($2)._add_($Smalltalk());
  5146. $ctx1.sendIdx["add:"]=1;
  5147. _st($2)._add_(nil);
  5148. $ctx1.sendIdx["add:"]=2;
  5149. _st($2)._add_((3).__at((3)));
  5150. $ctx1.sendIdx["add:"]=3;
  5151. _st($2)._add_("N");
  5152. $ctx1.sendIdx["add:"]=4;
  5153. _st($2)._add_(false);
  5154. $3=_st($2)._yourself();
  5155. $1=$3;
  5156. return $1;
  5157. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)})},
  5158. args: [],
  5159. 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",
  5160. messageSends: ["add:", "new", "@", "yourself"],
  5161. referencedClasses: ["Set", "Smalltalk"]
  5162. }),
  5163. globals.SetTest);
  5164. smalltalk.addMethod(
  5165. smalltalk.method({
  5166. selector: "testAddAll",
  5167. protocol: 'tests',
  5168. fn: function (){
  5169. var self=this;
  5170. return smalltalk.withContext(function($ctx1) {
  5171. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5172. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  5173. $ctx1.supercall = false;
  5174. $2=self._collection();
  5175. $ctx1.sendIdx["collection"]=1;
  5176. $3=$2;
  5177. $4=self._collection();
  5178. $ctx1.sendIdx["collection"]=2;
  5179. _st($3)._addAll_($4);
  5180. $ctx1.sendIdx["addAll:"]=1;
  5181. $5=_st($2)._yourself();
  5182. $ctx1.sendIdx["yourself"]=1;
  5183. $1=$5;
  5184. $6=self._collection();
  5185. $ctx1.sendIdx["collection"]=3;
  5186. self._assert_equals_($1,$6);
  5187. $ctx1.sendIdx["assert:equals:"]=1;
  5188. $8=self._collection();
  5189. $ctx1.sendIdx["collection"]=4;
  5190. $9=$8;
  5191. $10=self._collectionWithNewValue();
  5192. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5193. _st($9)._addAll_($10);
  5194. $ctx1.sendIdx["addAll:"]=2;
  5195. $11=_st($8)._yourself();
  5196. $ctx1.sendIdx["yourself"]=2;
  5197. $7=$11;
  5198. $12=self._collectionWithNewValue();
  5199. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5200. self._assert_equals_($7,$12);
  5201. $ctx1.sendIdx["assert:equals:"]=2;
  5202. $14=self._collectionWithNewValue();
  5203. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5204. _st($14)._addAll_(self._collection());
  5205. $15=_st($14)._yourself();
  5206. $13=$15;
  5207. self._assert_equals_($13,self._collectionWithNewValue());
  5208. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)})},
  5209. args: [],
  5210. 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",
  5211. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5212. referencedClasses: []
  5213. }),
  5214. globals.SetTest);
  5215. smalltalk.addMethod(
  5216. smalltalk.method({
  5217. selector: "testAddRemove",
  5218. protocol: 'tests',
  5219. fn: function (){
  5220. var self=this;
  5221. var set;
  5222. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5223. return smalltalk.withContext(function($ctx1) {
  5224. var $1,$2;
  5225. set=_st($Set())._new();
  5226. self._assert_(_st(set)._isEmpty());
  5227. $ctx1.sendIdx["assert:"]=1;
  5228. _st(set)._add_((3));
  5229. $ctx1.sendIdx["add:"]=1;
  5230. $1=_st(set)._includes_((3));
  5231. $ctx1.sendIdx["includes:"]=1;
  5232. self._assert_($1);
  5233. $ctx1.sendIdx["assert:"]=2;
  5234. _st(set)._add_((5));
  5235. $2=_st(set)._includes_((5));
  5236. $ctx1.sendIdx["includes:"]=2;
  5237. self._assert_($2);
  5238. _st(set)._remove_((3));
  5239. self._deny_(_st(set)._includes_((3)));
  5240. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)})},
  5241. args: [],
  5242. 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)",
  5243. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5244. referencedClasses: ["Set"]
  5245. }),
  5246. globals.SetTest);
  5247. smalltalk.addMethod(
  5248. smalltalk.method({
  5249. selector: "testAt",
  5250. protocol: 'tests',
  5251. fn: function (){
  5252. var self=this;
  5253. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5254. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5255. return smalltalk.withContext(function($ctx1) {
  5256. self._should_raise_((function(){
  5257. return smalltalk.withContext(function($ctx2) {
  5258. return _st(_st($Set())._new())._at_put_((1),(2));
  5259. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5260. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)})},
  5261. args: [],
  5262. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5263. messageSends: ["should:raise:", "at:put:", "new"],
  5264. referencedClasses: ["Set", "Error"]
  5265. }),
  5266. globals.SetTest);
  5267. smalltalk.addMethod(
  5268. smalltalk.method({
  5269. selector: "testCollect",
  5270. protocol: 'tests',
  5271. fn: function (){
  5272. var self=this;
  5273. return smalltalk.withContext(function($ctx1) {
  5274. var $2,$1;
  5275. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []));
  5276. $ctx1.supercall = false;
  5277. $2=[(5), (6), (8)]._asSet();
  5278. $ctx1.sendIdx["asSet"]=1;
  5279. $1=_st($2)._collect_((function(x){
  5280. return smalltalk.withContext(function($ctx2) {
  5281. return _st(x).__backslash_backslash((3));
  5282. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5283. self._assert_equals_($1,[(0), (2)]._asSet());
  5284. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)})},
  5285. args: [],
  5286. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5287. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5288. referencedClasses: []
  5289. }),
  5290. globals.SetTest);
  5291. smalltalk.addMethod(
  5292. smalltalk.method({
  5293. selector: "testComma",
  5294. protocol: 'tests',
  5295. fn: function (){
  5296. var self=this;
  5297. return smalltalk.withContext(function($ctx1) {
  5298. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5299. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  5300. $ctx1.supercall = false;
  5301. $2=self._collection();
  5302. $ctx1.sendIdx["collection"]=1;
  5303. $3=self._collection();
  5304. $ctx1.sendIdx["collection"]=2;
  5305. $1=_st($2).__comma($3);
  5306. $ctx1.sendIdx[","]=1;
  5307. $4=self._collection();
  5308. $ctx1.sendIdx["collection"]=3;
  5309. self._assert_equals_($1,$4);
  5310. $ctx1.sendIdx["assert:equals:"]=1;
  5311. $6=self._collection();
  5312. $ctx1.sendIdx["collection"]=4;
  5313. $7=self._collectionWithNewValue();
  5314. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5315. $5=_st($6).__comma($7);
  5316. $ctx1.sendIdx[","]=2;
  5317. $8=self._collectionWithNewValue();
  5318. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5319. self._assert_equals_($5,$8);
  5320. $ctx1.sendIdx["assert:equals:"]=2;
  5321. $10=self._collectionWithNewValue();
  5322. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5323. $9=_st($10).__comma(self._collection());
  5324. self._assert_equals_($9,self._collectionWithNewValue());
  5325. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)})},
  5326. args: [],
  5327. 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",
  5328. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5329. referencedClasses: []
  5330. }),
  5331. globals.SetTest);
  5332. smalltalk.addMethod(
  5333. smalltalk.method({
  5334. selector: "testComparing",
  5335. protocol: 'tests',
  5336. fn: function (){
  5337. var self=this;
  5338. return smalltalk.withContext(function($ctx1) {
  5339. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5340. $1=[(0), (2)]._asSet();
  5341. $ctx1.sendIdx["asSet"]=1;
  5342. $2=[(0), (2)]._asSet();
  5343. $ctx1.sendIdx["asSet"]=2;
  5344. self._assert_equals_($1,$2);
  5345. $ctx1.sendIdx["assert:equals:"]=1;
  5346. $3=[(2), (0)]._asSet();
  5347. $ctx1.sendIdx["asSet"]=3;
  5348. $4=[(0), (2)]._asSet();
  5349. $ctx1.sendIdx["asSet"]=4;
  5350. self._assert_equals_($3,$4);
  5351. $6=[(0), (2), (3)]._asSet();
  5352. $ctx1.sendIdx["asSet"]=5;
  5353. $7=[(0), (2)]._asSet();
  5354. $ctx1.sendIdx["asSet"]=6;
  5355. $5=_st($6).__eq($7);
  5356. $ctx1.sendIdx["="]=1;
  5357. self._deny_($5);
  5358. $ctx1.sendIdx["deny:"]=1;
  5359. $9=[(1), (2)]._asSet();
  5360. $ctx1.sendIdx["asSet"]=7;
  5361. $8=_st($9).__eq([(0), (2)]._asSet());
  5362. self._deny_($8);
  5363. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)})},
  5364. args: [],
  5365. 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",
  5366. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5367. referencedClasses: []
  5368. }),
  5369. globals.SetTest);
  5370. smalltalk.addMethod(
  5371. smalltalk.method({
  5372. selector: "testPrintString",
  5373. protocol: 'tests',
  5374. fn: function (){
  5375. var self=this;
  5376. var set;
  5377. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5378. return smalltalk.withContext(function($ctx1) {
  5379. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5380. set=_st($Set())._new();
  5381. $1=_st(set)._printString();
  5382. $ctx1.sendIdx["printString"]=1;
  5383. self._assert_equals_($1,"a Set ()");
  5384. $ctx1.sendIdx["assert:equals:"]=1;
  5385. $2=set;
  5386. _st($2)._add_((1));
  5387. $ctx1.sendIdx["add:"]=1;
  5388. $3=_st($2)._add_((3));
  5389. $ctx1.sendIdx["add:"]=2;
  5390. $4=_st(set)._printString();
  5391. $ctx1.sendIdx["printString"]=2;
  5392. self._assert_equals_($4,"a Set (1 3)");
  5393. $ctx1.sendIdx["assert:equals:"]=2;
  5394. _st(set)._add_("foo");
  5395. $ctx1.sendIdx["add:"]=3;
  5396. $5=_st(set)._printString();
  5397. $ctx1.sendIdx["printString"]=3;
  5398. self._assert_equals_($5,"a Set (1 3 'foo')");
  5399. $ctx1.sendIdx["assert:equals:"]=3;
  5400. $6=set;
  5401. _st($6)._remove_((1));
  5402. $ctx1.sendIdx["remove:"]=1;
  5403. $7=_st($6)._remove_((3));
  5404. $8=_st(set)._printString();
  5405. $ctx1.sendIdx["printString"]=4;
  5406. self._assert_equals_($8,"a Set ('foo')");
  5407. $ctx1.sendIdx["assert:equals:"]=4;
  5408. _st(set)._add_((3));
  5409. $ctx1.sendIdx["add:"]=4;
  5410. $9=_st(set)._printString();
  5411. $ctx1.sendIdx["printString"]=5;
  5412. self._assert_equals_($9,"a Set (3 'foo')");
  5413. $ctx1.sendIdx["assert:equals:"]=5;
  5414. _st(set)._add_((3));
  5415. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5416. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)})},
  5417. args: [],
  5418. 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'')'",
  5419. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5420. referencedClasses: ["Set"]
  5421. }),
  5422. globals.SetTest);
  5423. smalltalk.addMethod(
  5424. smalltalk.method({
  5425. selector: "testUnboxedObjects",
  5426. protocol: 'tests',
  5427. fn: function (){
  5428. var self=this;
  5429. return smalltalk.withContext(function($ctx1) {
  5430. var $4,$3,$2,$1;
  5431. $4="foo"._yourself();
  5432. $ctx1.sendIdx["yourself"]=1;
  5433. $3=[$4,"foo"._yourself()];
  5434. $2=_st($3)._asSet();
  5435. $1=_st($2)._asArray();
  5436. self._assert_equals_($1,["foo"]);
  5437. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)})},
  5438. args: [],
  5439. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5440. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5441. referencedClasses: []
  5442. }),
  5443. globals.SetTest);
  5444. smalltalk.addMethod(
  5445. smalltalk.method({
  5446. selector: "testUnicity",
  5447. protocol: 'tests',
  5448. fn: function (){
  5449. var self=this;
  5450. var set;
  5451. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5452. return smalltalk.withContext(function($ctx1) {
  5453. var $1;
  5454. set=_st($Set())._new();
  5455. _st(set)._add_((21));
  5456. $ctx1.sendIdx["add:"]=1;
  5457. _st(set)._add_("hello");
  5458. $ctx1.sendIdx["add:"]=2;
  5459. _st(set)._add_((21));
  5460. $ctx1.sendIdx["add:"]=3;
  5461. $1=_st(set)._size();
  5462. $ctx1.sendIdx["size"]=1;
  5463. self._assert_equals_($1,(2));
  5464. $ctx1.sendIdx["assert:equals:"]=1;
  5465. _st(set)._add_("hello");
  5466. self._assert_equals_(_st(set)._size(),(2));
  5467. $ctx1.sendIdx["assert:equals:"]=2;
  5468. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5469. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)})},
  5470. args: [],
  5471. 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')",
  5472. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5473. referencedClasses: ["Set"]
  5474. }),
  5475. globals.SetTest);
  5476. smalltalk.addMethod(
  5477. smalltalk.method({
  5478. selector: "collectionClass",
  5479. protocol: 'fixture',
  5480. fn: function (){
  5481. var self=this;
  5482. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5483. return $Set();
  5484. },
  5485. args: [],
  5486. source: "collectionClass\x0a\x09^ Set",
  5487. messageSends: [],
  5488. referencedClasses: ["Set"]
  5489. }),
  5490. globals.SetTest.klass);
  5491. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  5492. smalltalk.addMethod(
  5493. smalltalk.method({
  5494. selector: "testShow",
  5495. protocol: 'tests',
  5496. fn: function (){
  5497. var self=this;
  5498. var originalTranscript;
  5499. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5500. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5501. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5502. return smalltalk.withContext(function($ctx1) {
  5503. originalTranscript=_st($Transcript())._current();
  5504. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5505. $ctx1.sendIdx["register:"]=1;
  5506. self._shouldnt_raise_((function(){
  5507. return smalltalk.withContext(function($ctx2) {
  5508. return _st($Transcript())._show_("Hello console!");
  5509. $ctx2.sendIdx["show:"]=1;
  5510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5511. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5512. self._shouldnt_raise_((function(){
  5513. return smalltalk.withContext(function($ctx2) {
  5514. return _st($Transcript())._show_(console);
  5515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5516. _st($Transcript())._register_(originalTranscript);
  5517. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)})},
  5518. args: [],
  5519. 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.",
  5520. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5521. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5522. }),
  5523. globals.ConsoleTranscriptTest);
  5524. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  5525. smalltalk.addMethod(
  5526. smalltalk.method({
  5527. selector: "jsObject",
  5528. protocol: 'accessing',
  5529. fn: function (){
  5530. var self=this;
  5531. return smalltalk.withContext(function($ctx1) {
  5532. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5533. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},globals.JSObjectProxyTest)})},
  5534. args: [],
  5535. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5536. messageSends: [],
  5537. referencedClasses: []
  5538. }),
  5539. globals.JSObjectProxyTest);
  5540. smalltalk.addMethod(
  5541. smalltalk.method({
  5542. selector: "testAtIfAbsent",
  5543. protocol: 'tests',
  5544. fn: function (){
  5545. var self=this;
  5546. var testObject;
  5547. return smalltalk.withContext(function($ctx1) {
  5548. var $1,$2,$3;
  5549. testObject=self._jsObject();
  5550. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5551. return "Property does not exist";
  5552. }));
  5553. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5554. self._assert_equals_($1,"Property does not exist");
  5555. $ctx1.sendIdx["assert:equals:"]=1;
  5556. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5557. return "Property does not exist";
  5558. }));
  5559. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5560. self._assert_equals_($2,nil);
  5561. $ctx1.sendIdx["assert:equals:"]=2;
  5562. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5563. return "Property does not exist";
  5564. }));
  5565. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5566. self._assert_equals_($3,(1));
  5567. $ctx1.sendIdx["assert:equals:"]=3;
  5568. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5569. return "Property does not exist";
  5570. })),nil);
  5571. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5572. args: [],
  5573. 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.",
  5574. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5575. referencedClasses: []
  5576. }),
  5577. globals.JSObjectProxyTest);
  5578. smalltalk.addMethod(
  5579. smalltalk.method({
  5580. selector: "testAtIfPresent",
  5581. protocol: 'tests',
  5582. fn: function (){
  5583. var self=this;
  5584. var testObject;
  5585. return smalltalk.withContext(function($ctx1) {
  5586. var $2,$1,$4,$3,$6,$5;
  5587. testObject=self._jsObject();
  5588. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5589. return smalltalk.withContext(function($ctx2) {
  5590. $2=_st(x)._asString();
  5591. $ctx2.sendIdx["asString"]=1;
  5592. return "hello ".__comma($2);
  5593. $ctx2.sendIdx[","]=1;
  5594. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5595. $ctx1.sendIdx["at:ifPresent:"]=1;
  5596. self._assert_equals_($1,nil);
  5597. $ctx1.sendIdx["assert:equals:"]=1;
  5598. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5599. return smalltalk.withContext(function($ctx2) {
  5600. $4=_st(x)._asString();
  5601. $ctx2.sendIdx["asString"]=2;
  5602. return "hello ".__comma($4);
  5603. $ctx2.sendIdx[","]=2;
  5604. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5605. $ctx1.sendIdx["at:ifPresent:"]=2;
  5606. self._assert_equals_($3,"hello nil");
  5607. $ctx1.sendIdx["assert:equals:"]=2;
  5608. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5609. return smalltalk.withContext(function($ctx2) {
  5610. $6=_st(x)._asString();
  5611. $ctx2.sendIdx["asString"]=3;
  5612. return "hello ".__comma($6);
  5613. $ctx2.sendIdx[","]=3;
  5614. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5615. $ctx1.sendIdx["at:ifPresent:"]=3;
  5616. self._assert_equals_($5,"hello 1");
  5617. $ctx1.sendIdx["assert:equals:"]=3;
  5618. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5619. return smalltalk.withContext(function($ctx2) {
  5620. return "hello ".__comma(_st(x)._asString());
  5621. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5622. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5623. args: [],
  5624. 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'.",
  5625. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5626. referencedClasses: []
  5627. }),
  5628. globals.JSObjectProxyTest);
  5629. smalltalk.addMethod(
  5630. smalltalk.method({
  5631. selector: "testAtIfPresentIfAbsent",
  5632. protocol: 'tests',
  5633. fn: function (){
  5634. var self=this;
  5635. var testObject;
  5636. return smalltalk.withContext(function($ctx1) {
  5637. var $2,$1,$4,$3,$6,$5;
  5638. testObject=self._jsObject();
  5639. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5640. return smalltalk.withContext(function($ctx2) {
  5641. $2=_st(x)._asString();
  5642. $ctx2.sendIdx["asString"]=1;
  5643. return "hello ".__comma($2);
  5644. $ctx2.sendIdx[","]=1;
  5645. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5646. return "not present";
  5647. }));
  5648. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5649. self._assert_equals_($1,"not present");
  5650. $ctx1.sendIdx["assert:equals:"]=1;
  5651. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5652. return smalltalk.withContext(function($ctx2) {
  5653. $4=_st(x)._asString();
  5654. $ctx2.sendIdx["asString"]=2;
  5655. return "hello ".__comma($4);
  5656. $ctx2.sendIdx[","]=2;
  5657. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5658. return "not present";
  5659. }));
  5660. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5661. self._assert_equals_($3,"hello nil");
  5662. $ctx1.sendIdx["assert:equals:"]=2;
  5663. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5664. return smalltalk.withContext(function($ctx2) {
  5665. $6=_st(x)._asString();
  5666. $ctx2.sendIdx["asString"]=3;
  5667. return "hello ".__comma($6);
  5668. $ctx2.sendIdx[","]=3;
  5669. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5670. return "not present";
  5671. }));
  5672. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5673. self._assert_equals_($5,"hello 1");
  5674. $ctx1.sendIdx["assert:equals:"]=3;
  5675. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5676. return smalltalk.withContext(function($ctx2) {
  5677. return "hello ".__comma(_st(x)._asString());
  5678. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5679. return "not present";
  5680. })),"hello nil");
  5681. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5682. args: [],
  5683. 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'.",
  5684. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5685. referencedClasses: []
  5686. }),
  5687. globals.JSObjectProxyTest);
  5688. smalltalk.addMethod(
  5689. smalltalk.method({
  5690. selector: "testAtPut",
  5691. protocol: 'tests',
  5692. fn: function (){
  5693. var self=this;
  5694. var testObject;
  5695. return smalltalk.withContext(function($ctx1) {
  5696. var $2,$1;
  5697. testObject=self._jsObject();
  5698. $2=_st(testObject)._at_("abc");
  5699. $ctx1.sendIdx["at:"]=1;
  5700. $1=_st($2).__tild_eq("xyz");
  5701. self._assert_($1);
  5702. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5703. $ctx1.sendIdx["assert:equals:"]=1;
  5704. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5705. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)})},
  5706. args: [],
  5707. 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'",
  5708. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5709. referencedClasses: []
  5710. }),
  5711. globals.JSObjectProxyTest);
  5712. smalltalk.addMethod(
  5713. smalltalk.method({
  5714. selector: "testComparison",
  5715. protocol: 'tests',
  5716. fn: function (){
  5717. var self=this;
  5718. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5719. return smalltalk.withContext(function($ctx1) {
  5720. var $1,$2;
  5721. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  5722. $1=_st(console).__eq(console);
  5723. $ctx1.sendIdx["="]=1;
  5724. self._assert_($1);
  5725. $2=_st(console).__eq(_st($Object())._new());
  5726. $ctx1.sendIdx["="]=2;
  5727. self._deny_($2);
  5728. $ctx1.sendIdx["deny:"]=1;
  5729. self._deny_(_st(console).__eq(self._jsObject()));
  5730. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)})},
  5731. args: [],
  5732. 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",
  5733. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"],
  5734. referencedClasses: ["Object"]
  5735. }),
  5736. globals.JSObjectProxyTest);
  5737. smalltalk.addMethod(
  5738. smalltalk.method({
  5739. selector: "testDNU",
  5740. protocol: 'tests',
  5741. fn: function (){
  5742. var self=this;
  5743. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5744. return smalltalk.withContext(function($ctx1) {
  5745. self._should_raise_((function(){
  5746. return smalltalk.withContext(function($ctx2) {
  5747. return _st(self._jsObject())._foo();
  5748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5749. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)})},
  5750. args: [],
  5751. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5752. messageSends: ["should:raise:", "foo", "jsObject"],
  5753. referencedClasses: ["MessageNotUnderstood"]
  5754. }),
  5755. globals.JSObjectProxyTest);
  5756. smalltalk.addMethod(
  5757. smalltalk.method({
  5758. selector: "testMessageSend",
  5759. protocol: 'tests',
  5760. fn: function (){
  5761. var self=this;
  5762. return smalltalk.withContext(function($ctx1) {
  5763. var $2,$1,$4,$3;
  5764. $2=self._jsObject();
  5765. $ctx1.sendIdx["jsObject"]=1;
  5766. $1=_st($2)._a();
  5767. self._assert_equals_($1,(1));
  5768. $ctx1.sendIdx["assert:equals:"]=1;
  5769. $4=self._jsObject();
  5770. $ctx1.sendIdx["jsObject"]=2;
  5771. $3=_st($4)._b();
  5772. self._assert_equals_($3,(2));
  5773. $ctx1.sendIdx["assert:equals:"]=2;
  5774. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5775. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)})},
  5776. args: [],
  5777. 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",
  5778. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5779. referencedClasses: []
  5780. }),
  5781. globals.JSObjectProxyTest);
  5782. smalltalk.addMethod(
  5783. smalltalk.method({
  5784. selector: "testMethodWithArguments",
  5785. protocol: 'tests',
  5786. fn: function (){
  5787. var self=this;
  5788. return smalltalk.withContext(function($ctx1) {
  5789. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5790. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)})},
  5791. args: [],
  5792. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5793. messageSends: ["assert:equals:", "c:", "jsObject"],
  5794. referencedClasses: []
  5795. }),
  5796. globals.JSObjectProxyTest);
  5797. smalltalk.addMethod(
  5798. smalltalk.method({
  5799. selector: "testPrinting",
  5800. protocol: 'tests',
  5801. fn: function (){
  5802. var self=this;
  5803. return smalltalk.withContext(function($ctx1) {
  5804. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5805. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)})},
  5806. args: [],
  5807. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5808. messageSends: ["assert:equals:", "printString", "jsObject"],
  5809. referencedClasses: []
  5810. }),
  5811. globals.JSObjectProxyTest);
  5812. smalltalk.addMethod(
  5813. smalltalk.method({
  5814. selector: "testPropertyThatReturnsEmptyString",
  5815. protocol: 'tests',
  5816. fn: function (){
  5817. var self=this;
  5818. var object;
  5819. return smalltalk.withContext(function($ctx1) {
  5820. var $1;
  5821. object=self._jsObject();
  5822. $1=_st(object)._d();
  5823. $ctx1.sendIdx["d"]=1;
  5824. self._assert_equals_($1,"");
  5825. $ctx1.sendIdx["assert:equals:"]=1;
  5826. _st(object)._d_("hello");
  5827. self._assert_equals_(_st(object)._d(),"hello");
  5828. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)})},
  5829. args: [],
  5830. 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'",
  5831. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5832. referencedClasses: []
  5833. }),
  5834. globals.JSObjectProxyTest);
  5835. smalltalk.addMethod(
  5836. smalltalk.method({
  5837. selector: "testPropertyThatReturnsUndefined",
  5838. protocol: 'tests',
  5839. fn: function (){
  5840. var self=this;
  5841. var object;
  5842. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5843. return smalltalk.withContext(function($ctx1) {
  5844. object=self._jsObject();
  5845. self._shouldnt_raise_((function(){
  5846. return smalltalk.withContext(function($ctx2) {
  5847. return _st(object)._e();
  5848. $ctx2.sendIdx["e"]=1;
  5849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5850. self._assert_(_st(_st(object)._e())._isNil());
  5851. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)})},
  5852. args: [],
  5853. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5854. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5855. referencedClasses: ["MessageNotUnderstood"]
  5856. }),
  5857. globals.JSObjectProxyTest);
  5858. smalltalk.addMethod(
  5859. smalltalk.method({
  5860. selector: "testValue",
  5861. protocol: 'tests',
  5862. fn: function (){
  5863. var self=this;
  5864. var testObject;
  5865. return smalltalk.withContext(function($ctx1) {
  5866. testObject=self._jsObject();
  5867. _st(testObject)._at_put_("value","aValue");
  5868. self._assert_equals_(_st(testObject)._value(),"aValue");
  5869. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)})},
  5870. args: [],
  5871. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5872. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5873. referencedClasses: []
  5874. }),
  5875. globals.JSObjectProxyTest);
  5876. smalltalk.addMethod(
  5877. smalltalk.method({
  5878. selector: "testYourself",
  5879. protocol: 'tests',
  5880. fn: function (){
  5881. var self=this;
  5882. var object;
  5883. return smalltalk.withContext(function($ctx1) {
  5884. var $1,$2;
  5885. $1=self._jsObject();
  5886. _st($1)._d_("test");
  5887. $2=_st($1)._yourself();
  5888. object=$2;
  5889. self._assert_equals_(_st(object)._d(),"test");
  5890. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)})},
  5891. args: [],
  5892. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5893. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5894. referencedClasses: []
  5895. }),
  5896. globals.JSObjectProxyTest);
  5897. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  5898. smalltalk.addMethod(
  5899. smalltalk.method({
  5900. selector: "testCatchingException",
  5901. protocol: 'tests',
  5902. fn: function (){
  5903. var self=this;
  5904. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5905. return smalltalk.withContext(function($ctx1) {
  5906. _st((function(){
  5907. return smalltalk.withContext(function($ctx2) {
  5908. return self._throwException();
  5909. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5910. return smalltalk.withContext(function($ctx2) {
  5911. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5912. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5913. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)})},
  5914. args: [],
  5915. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5916. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5917. referencedClasses: ["Error"]
  5918. }),
  5919. globals.JavaScriptExceptionTest);
  5920. smalltalk.addMethod(
  5921. smalltalk.method({
  5922. selector: "testRaisingException",
  5923. protocol: 'tests',
  5924. fn: function (){
  5925. var self=this;
  5926. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5927. return smalltalk.withContext(function($ctx1) {
  5928. self._should_raise_((function(){
  5929. return smalltalk.withContext(function($ctx2) {
  5930. return self._throwException();
  5931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5932. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)})},
  5933. args: [],
  5934. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5935. messageSends: ["should:raise:", "throwException"],
  5936. referencedClasses: ["JavaScriptException"]
  5937. }),
  5938. globals.JavaScriptExceptionTest);
  5939. smalltalk.addMethod(
  5940. smalltalk.method({
  5941. selector: "throwException",
  5942. protocol: 'helpers',
  5943. fn: function (){
  5944. var self=this;
  5945. return smalltalk.withContext(function($ctx1) {
  5946. throw 'test';
  5947. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},globals.JavaScriptExceptionTest)})},
  5948. args: [],
  5949. source: "throwException\x0a\x09<throw 'test'>",
  5950. messageSends: [],
  5951. referencedClasses: []
  5952. }),
  5953. globals.JavaScriptExceptionTest);
  5954. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  5955. smalltalk.addMethod(
  5956. smalltalk.method({
  5957. selector: "testValue",
  5958. protocol: 'tests',
  5959. fn: function (){
  5960. var self=this;
  5961. var messageSend;
  5962. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5963. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5964. return smalltalk.withContext(function($ctx1) {
  5965. var $1,$2;
  5966. $1=_st($MessageSend())._new();
  5967. $ctx1.sendIdx["new"]=1;
  5968. _st($1)._receiver_(_st($Object())._new());
  5969. _st($1)._selector_("asString");
  5970. $2=_st($1)._yourself();
  5971. messageSend=$2;
  5972. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5973. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)})},
  5974. args: [],
  5975. 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'",
  5976. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  5977. referencedClasses: ["MessageSend", "Object"]
  5978. }),
  5979. globals.MessageSendTest);
  5980. smalltalk.addMethod(
  5981. smalltalk.method({
  5982. selector: "testValueWithArguments",
  5983. protocol: 'tests',
  5984. fn: function (){
  5985. var self=this;
  5986. var messageSend;
  5987. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5988. return smalltalk.withContext(function($ctx1) {
  5989. var $1,$2;
  5990. $1=_st($MessageSend())._new();
  5991. _st($1)._receiver_((2));
  5992. _st($1)._selector_("+");
  5993. $2=_st($1)._yourself();
  5994. messageSend=$2;
  5995. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  5996. $ctx1.sendIdx["assert:equals:"]=1;
  5997. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  5998. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)})},
  5999. args: [],
  6000. 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",
  6001. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  6002. referencedClasses: ["MessageSend"]
  6003. }),
  6004. globals.MessageSendTest);
  6005. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  6006. smalltalk.addMethod(
  6007. smalltalk.method({
  6008. selector: "codeGeneratorClass",
  6009. protocol: 'accessing',
  6010. fn: function (){
  6011. var self=this;
  6012. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  6013. return $CodeGenerator();
  6014. },
  6015. args: [],
  6016. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  6017. messageSends: [],
  6018. referencedClasses: ["CodeGenerator"]
  6019. }),
  6020. globals.MethodInheritanceTest);
  6021. smalltalk.addMethod(
  6022. smalltalk.method({
  6023. selector: "compiler",
  6024. protocol: 'factory',
  6025. fn: function (){
  6026. var self=this;
  6027. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6028. return smalltalk.withContext(function($ctx1) {
  6029. var $2,$3,$1;
  6030. $2=_st($Compiler())._new();
  6031. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  6032. $3=_st($2)._yourself();
  6033. $1=$3;
  6034. return $1;
  6035. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)})},
  6036. args: [],
  6037. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  6038. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  6039. referencedClasses: ["Compiler"]
  6040. }),
  6041. globals.MethodInheritanceTest);
  6042. smalltalk.addMethod(
  6043. smalltalk.method({
  6044. selector: "deinstallBottom",
  6045. protocol: 'testing',
  6046. fn: function (){
  6047. var self=this;
  6048. return smalltalk.withContext(function($ctx1) {
  6049. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6050. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)})},
  6051. args: [],
  6052. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6053. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6054. referencedClasses: []
  6055. }),
  6056. globals.MethodInheritanceTest);
  6057. smalltalk.addMethod(
  6058. smalltalk.method({
  6059. selector: "deinstallMiddle",
  6060. protocol: 'testing',
  6061. fn: function (){
  6062. var self=this;
  6063. return smalltalk.withContext(function($ctx1) {
  6064. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6065. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)})},
  6066. args: [],
  6067. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6068. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6069. referencedClasses: []
  6070. }),
  6071. globals.MethodInheritanceTest);
  6072. smalltalk.addMethod(
  6073. smalltalk.method({
  6074. selector: "deinstallTop",
  6075. protocol: 'testing',
  6076. fn: function (){
  6077. var self=this;
  6078. return smalltalk.withContext(function($ctx1) {
  6079. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6080. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)})},
  6081. args: [],
  6082. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6083. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6084. referencedClasses: []
  6085. }),
  6086. globals.MethodInheritanceTest);
  6087. smalltalk.addMethod(
  6088. smalltalk.method({
  6089. selector: "installBottom:",
  6090. protocol: 'testing',
  6091. fn: function (aString){
  6092. var self=this;
  6093. return smalltalk.withContext(function($ctx1) {
  6094. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6095. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)})},
  6096. args: ["aString"],
  6097. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6098. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6099. referencedClasses: []
  6100. }),
  6101. globals.MethodInheritanceTest);
  6102. smalltalk.addMethod(
  6103. smalltalk.method({
  6104. selector: "installMiddle:",
  6105. protocol: 'testing',
  6106. fn: function (aString){
  6107. var self=this;
  6108. return smalltalk.withContext(function($ctx1) {
  6109. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6110. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)})},
  6111. args: ["aString"],
  6112. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6113. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6114. referencedClasses: []
  6115. }),
  6116. globals.MethodInheritanceTest);
  6117. smalltalk.addMethod(
  6118. smalltalk.method({
  6119. selector: "installTop:",
  6120. protocol: 'testing',
  6121. fn: function (aString){
  6122. var self=this;
  6123. return smalltalk.withContext(function($ctx1) {
  6124. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6125. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)})},
  6126. args: ["aString"],
  6127. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6128. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6129. referencedClasses: []
  6130. }),
  6131. globals.MethodInheritanceTest);
  6132. smalltalk.addMethod(
  6133. smalltalk.method({
  6134. selector: "setUp",
  6135. protocol: 'initialization',
  6136. fn: function (){
  6137. var self=this;
  6138. return smalltalk.withContext(function($ctx1) {
  6139. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6140. $ctx1.sendIdx["new"]=1;
  6141. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6142. $ctx1.sendIdx["new"]=2;
  6143. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6144. self["@method"]=nil;
  6145. self["@performBlock"]=(function(){
  6146. return smalltalk.withContext(function($ctx2) {
  6147. return self._error_("performBlock not initialized");
  6148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6149. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)})},
  6150. args: [],
  6151. 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' ]",
  6152. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6153. referencedClasses: []
  6154. }),
  6155. globals.MethodInheritanceTest);
  6156. smalltalk.addMethod(
  6157. smalltalk.method({
  6158. selector: "shouldMNU",
  6159. protocol: 'testing',
  6160. fn: function (){
  6161. var self=this;
  6162. return smalltalk.withContext(function($ctx1) {
  6163. self._shouldMNUTop();
  6164. self._shouldMNUMiddle();
  6165. self._shouldMNUBottom();
  6166. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)})},
  6167. args: [],
  6168. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6169. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6170. referencedClasses: []
  6171. }),
  6172. globals.MethodInheritanceTest);
  6173. smalltalk.addMethod(
  6174. smalltalk.method({
  6175. selector: "shouldMNUBottom",
  6176. protocol: 'testing',
  6177. fn: function (){
  6178. var self=this;
  6179. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6180. return smalltalk.withContext(function($ctx1) {
  6181. self._should_raise_((function(){
  6182. return smalltalk.withContext(function($ctx2) {
  6183. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6185. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)})},
  6186. args: [],
  6187. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6188. messageSends: ["should:raise:", "value:"],
  6189. referencedClasses: ["MessageNotUnderstood"]
  6190. }),
  6191. globals.MethodInheritanceTest);
  6192. smalltalk.addMethod(
  6193. smalltalk.method({
  6194. selector: "shouldMNUMiddle",
  6195. protocol: 'testing',
  6196. fn: function (){
  6197. var self=this;
  6198. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6199. return smalltalk.withContext(function($ctx1) {
  6200. self._should_raise_((function(){
  6201. return smalltalk.withContext(function($ctx2) {
  6202. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6204. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)})},
  6205. args: [],
  6206. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6207. messageSends: ["should:raise:", "value:"],
  6208. referencedClasses: ["MessageNotUnderstood"]
  6209. }),
  6210. globals.MethodInheritanceTest);
  6211. smalltalk.addMethod(
  6212. smalltalk.method({
  6213. selector: "shouldMNUTop",
  6214. protocol: 'testing',
  6215. fn: function (){
  6216. var self=this;
  6217. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6218. return smalltalk.withContext(function($ctx1) {
  6219. self._should_raise_((function(){
  6220. return smalltalk.withContext(function($ctx2) {
  6221. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6223. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)})},
  6224. args: [],
  6225. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6226. messageSends: ["should:raise:", "value:"],
  6227. referencedClasses: ["MessageNotUnderstood"]
  6228. }),
  6229. globals.MethodInheritanceTest);
  6230. smalltalk.addMethod(
  6231. smalltalk.method({
  6232. selector: "shouldReturn:",
  6233. protocol: 'testing',
  6234. fn: function (anObject){
  6235. var self=this;
  6236. var result;
  6237. return smalltalk.withContext(function($ctx1) {
  6238. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6239. $ctx1.sendIdx["value:"]=1;
  6240. self._assert_equals_(["top",anObject],["top",result]);
  6241. $ctx1.sendIdx["assert:equals:"]=1;
  6242. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6243. $ctx1.sendIdx["value:"]=2;
  6244. self._assert_equals_(["middle",anObject],["middle",result]);
  6245. $ctx1.sendIdx["assert:equals:"]=2;
  6246. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6247. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6248. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)})},
  6249. args: ["anObject"],
  6250. 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 }",
  6251. messageSends: ["value:", "assert:equals:"],
  6252. referencedClasses: []
  6253. }),
  6254. globals.MethodInheritanceTest);
  6255. smalltalk.addMethod(
  6256. smalltalk.method({
  6257. selector: "shouldReturn:and:and:",
  6258. protocol: 'testing',
  6259. fn: function (anObject,anObject2,anObject3){
  6260. var self=this;
  6261. var result;
  6262. return smalltalk.withContext(function($ctx1) {
  6263. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6264. $ctx1.sendIdx["value:"]=1;
  6265. self._assert_equals_(["top",anObject],["top",result]);
  6266. $ctx1.sendIdx["assert:equals:"]=1;
  6267. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6268. $ctx1.sendIdx["value:"]=2;
  6269. self._assert_equals_(["middle",anObject2],["middle",result]);
  6270. $ctx1.sendIdx["assert:equals:"]=2;
  6271. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6272. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6273. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)})},
  6274. args: ["anObject", "anObject2", "anObject3"],
  6275. 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 }",
  6276. messageSends: ["value:", "assert:equals:"],
  6277. referencedClasses: []
  6278. }),
  6279. globals.MethodInheritanceTest);
  6280. smalltalk.addMethod(
  6281. smalltalk.method({
  6282. selector: "targetClassBottom",
  6283. protocol: 'accessing',
  6284. fn: function (){
  6285. var self=this;
  6286. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6287. return $JavaScriptException();
  6288. },
  6289. args: [],
  6290. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6291. messageSends: [],
  6292. referencedClasses: ["JavaScriptException"]
  6293. }),
  6294. globals.MethodInheritanceTest);
  6295. smalltalk.addMethod(
  6296. smalltalk.method({
  6297. selector: "targetClassMiddle",
  6298. protocol: 'accessing',
  6299. fn: function (){
  6300. var self=this;
  6301. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6302. return $Error();
  6303. },
  6304. args: [],
  6305. source: "targetClassMiddle\x0a\x09^ Error",
  6306. messageSends: [],
  6307. referencedClasses: ["Error"]
  6308. }),
  6309. globals.MethodInheritanceTest);
  6310. smalltalk.addMethod(
  6311. smalltalk.method({
  6312. selector: "targetClassTop",
  6313. protocol: 'accessing',
  6314. fn: function (){
  6315. var self=this;
  6316. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6317. return $Object();
  6318. },
  6319. args: [],
  6320. source: "targetClassTop\x0a\x09^ Object",
  6321. messageSends: [],
  6322. referencedClasses: ["Object"]
  6323. }),
  6324. globals.MethodInheritanceTest);
  6325. smalltalk.addMethod(
  6326. smalltalk.method({
  6327. selector: "tearDown",
  6328. protocol: 'initialization',
  6329. fn: function (){
  6330. var self=this;
  6331. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6332. return smalltalk.withContext(function($ctx1) {
  6333. _st((function(){
  6334. return smalltalk.withContext(function($ctx2) {
  6335. return self._deinstallTop();
  6336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6337. }));
  6338. $ctx1.sendIdx["on:do:"]=1;
  6339. _st((function(){
  6340. return smalltalk.withContext(function($ctx2) {
  6341. return self._deinstallMiddle();
  6342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6343. }));
  6344. $ctx1.sendIdx["on:do:"]=2;
  6345. _st((function(){
  6346. return smalltalk.withContext(function($ctx2) {
  6347. return self._deinstallBottom();
  6348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6349. }));
  6350. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)})},
  6351. args: [],
  6352. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6353. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6354. referencedClasses: ["Error"]
  6355. }),
  6356. globals.MethodInheritanceTest);
  6357. smalltalk.addMethod(
  6358. smalltalk.method({
  6359. selector: "testMNU11",
  6360. protocol: 'tests',
  6361. fn: function (){
  6362. var self=this;
  6363. return smalltalk.withContext(function($ctx1) {
  6364. self["@performBlock"]=(function(x){
  6365. return smalltalk.withContext(function($ctx2) {
  6366. return _st(x)._foo();
  6367. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6368. self._shouldMNU();
  6369. $ctx1.sendIdx["shouldMNU"]=1;
  6370. self._installTop_("foo ^ false");
  6371. $ctx1.sendIdx["installTop:"]=1;
  6372. self._installTop_("foo ^ true");
  6373. self._deinstallTop();
  6374. self._shouldMNU();
  6375. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)})},
  6376. args: [],
  6377. 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",
  6378. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6379. referencedClasses: []
  6380. }),
  6381. globals.MethodInheritanceTest);
  6382. smalltalk.addMethod(
  6383. smalltalk.method({
  6384. selector: "testMNU22",
  6385. protocol: 'tests',
  6386. fn: function (){
  6387. var self=this;
  6388. return smalltalk.withContext(function($ctx1) {
  6389. self["@performBlock"]=(function(x){
  6390. return smalltalk.withContext(function($ctx2) {
  6391. return _st(x)._foo();
  6392. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6393. self._shouldMNU();
  6394. $ctx1.sendIdx["shouldMNU"]=1;
  6395. self._installMiddle_("foo ^ false");
  6396. $ctx1.sendIdx["installMiddle:"]=1;
  6397. self._installMiddle_("foo ^ true");
  6398. self._deinstallMiddle();
  6399. self._shouldMNU();
  6400. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)})},
  6401. args: [],
  6402. 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",
  6403. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6404. referencedClasses: []
  6405. }),
  6406. globals.MethodInheritanceTest);
  6407. smalltalk.addMethod(
  6408. smalltalk.method({
  6409. selector: "testReturns1",
  6410. protocol: 'tests',
  6411. fn: function (){
  6412. var self=this;
  6413. return smalltalk.withContext(function($ctx1) {
  6414. self["@performBlock"]=(function(x){
  6415. return smalltalk.withContext(function($ctx2) {
  6416. return _st(x)._foo();
  6417. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6418. self._installTop_("foo ^ false");
  6419. $ctx1.sendIdx["installTop:"]=1;
  6420. self._shouldReturn_(false);
  6421. $ctx1.sendIdx["shouldReturn:"]=1;
  6422. self._installTop_("foo ^ true");
  6423. self._shouldReturn_(true);
  6424. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)})},
  6425. args: [],
  6426. 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",
  6427. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6428. referencedClasses: []
  6429. }),
  6430. globals.MethodInheritanceTest);
  6431. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  6432. smalltalk.addMethod(
  6433. smalltalk.method({
  6434. selector: "testAbs",
  6435. protocol: 'tests',
  6436. fn: function (){
  6437. var self=this;
  6438. return smalltalk.withContext(function($ctx1) {
  6439. var $1;
  6440. $1=(4)._abs();
  6441. $ctx1.sendIdx["abs"]=1;
  6442. self._assert_equals_($1,(4));
  6443. $ctx1.sendIdx["assert:equals:"]=1;
  6444. self._assert_equals_((-4)._abs(),(4));
  6445. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)})},
  6446. args: [],
  6447. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6448. messageSends: ["assert:equals:", "abs"],
  6449. referencedClasses: []
  6450. }),
  6451. globals.NumberTest);
  6452. smalltalk.addMethod(
  6453. smalltalk.method({
  6454. selector: "testArithmetic",
  6455. protocol: 'tests',
  6456. fn: function (){
  6457. var self=this;
  6458. return smalltalk.withContext(function($ctx1) {
  6459. var $1,$2,$3,$5,$4;
  6460. $1=(1.5).__plus((1));
  6461. $ctx1.sendIdx["+"]=1;
  6462. self._assert_equals_($1,(2.5));
  6463. $ctx1.sendIdx["assert:equals:"]=1;
  6464. $2=(2).__minus((1));
  6465. $ctx1.sendIdx["-"]=1;
  6466. self._assert_equals_($2,(1));
  6467. $ctx1.sendIdx["assert:equals:"]=2;
  6468. self._assert_equals_((-2).__minus((1)),(-3));
  6469. $ctx1.sendIdx["assert:equals:"]=3;
  6470. self._assert_equals_((12).__slash((2)),(6));
  6471. $ctx1.sendIdx["assert:equals:"]=4;
  6472. $3=(3).__star((4));
  6473. $ctx1.sendIdx["*"]=1;
  6474. self._assert_equals_($3,(12));
  6475. $ctx1.sendIdx["assert:equals:"]=5;
  6476. self._assert_equals_((7).__slash_slash((2)),(3));
  6477. $ctx1.sendIdx["assert:equals:"]=6;
  6478. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6479. $ctx1.sendIdx["assert:equals:"]=7;
  6480. $5=(1).__plus((2));
  6481. $ctx1.sendIdx["+"]=2;
  6482. $4=_st($5).__star((3));
  6483. $ctx1.sendIdx["*"]=2;
  6484. self._assert_equals_($4,(9));
  6485. $ctx1.sendIdx["assert:equals:"]=8;
  6486. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6487. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)})},
  6488. args: [],
  6489. 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",
  6490. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6491. referencedClasses: []
  6492. }),
  6493. globals.NumberTest);
  6494. smalltalk.addMethod(
  6495. smalltalk.method({
  6496. selector: "testAsNumber",
  6497. protocol: 'tests',
  6498. fn: function (){
  6499. var self=this;
  6500. return smalltalk.withContext(function($ctx1) {
  6501. self._assert_equals_((3)._asNumber(),(3));
  6502. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)})},
  6503. args: [],
  6504. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6505. messageSends: ["assert:equals:", "asNumber"],
  6506. referencedClasses: []
  6507. }),
  6508. globals.NumberTest);
  6509. smalltalk.addMethod(
  6510. smalltalk.method({
  6511. selector: "testCeiling",
  6512. protocol: 'tests',
  6513. fn: function (){
  6514. var self=this;
  6515. return smalltalk.withContext(function($ctx1) {
  6516. var $1,$2;
  6517. $1=(1.2)._ceiling();
  6518. $ctx1.sendIdx["ceiling"]=1;
  6519. self._assert_equals_($1,(2));
  6520. $ctx1.sendIdx["assert:equals:"]=1;
  6521. $2=(-1.2)._ceiling();
  6522. $ctx1.sendIdx["ceiling"]=2;
  6523. self._assert_equals_($2,(-1));
  6524. $ctx1.sendIdx["assert:equals:"]=2;
  6525. self._assert_equals_((1)._ceiling(),(1));
  6526. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)})},
  6527. args: [],
  6528. 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.",
  6529. messageSends: ["assert:equals:", "ceiling"],
  6530. referencedClasses: []
  6531. }),
  6532. globals.NumberTest);
  6533. smalltalk.addMethod(
  6534. smalltalk.method({
  6535. selector: "testComparison",
  6536. protocol: 'tests',
  6537. fn: function (){
  6538. var self=this;
  6539. return smalltalk.withContext(function($ctx1) {
  6540. var $1,$2,$3,$4;
  6541. $1=(3).__gt((2));
  6542. $ctx1.sendIdx[">"]=1;
  6543. self._assert_($1);
  6544. $ctx1.sendIdx["assert:"]=1;
  6545. $2=(2).__lt((3));
  6546. $ctx1.sendIdx["<"]=1;
  6547. self._assert_($2);
  6548. $ctx1.sendIdx["assert:"]=2;
  6549. self._deny_((3).__lt((2)));
  6550. $ctx1.sendIdx["deny:"]=1;
  6551. self._deny_((2).__gt((3)));
  6552. $3=(3).__gt_eq((3));
  6553. $ctx1.sendIdx[">="]=1;
  6554. self._assert_($3);
  6555. $ctx1.sendIdx["assert:"]=3;
  6556. self._assert_((3.1).__gt_eq((3)));
  6557. $ctx1.sendIdx["assert:"]=4;
  6558. $4=(3).__lt_eq((3));
  6559. $ctx1.sendIdx["<="]=1;
  6560. self._assert_($4);
  6561. $ctx1.sendIdx["assert:"]=5;
  6562. self._assert_((3).__lt_eq((3.1)));
  6563. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)})},
  6564. args: [],
  6565. 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",
  6566. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6567. referencedClasses: []
  6568. }),
  6569. globals.NumberTest);
  6570. smalltalk.addMethod(
  6571. smalltalk.method({
  6572. selector: "testCopying",
  6573. protocol: 'tests',
  6574. fn: function (){
  6575. var self=this;
  6576. return smalltalk.withContext(function($ctx1) {
  6577. var $1;
  6578. $1=_st((1)._copy()).__eq_eq((1));
  6579. $ctx1.sendIdx["=="]=1;
  6580. self._assert_($1);
  6581. $ctx1.sendIdx["assert:"]=1;
  6582. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6583. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)})},
  6584. args: [],
  6585. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6586. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6587. referencedClasses: []
  6588. }),
  6589. globals.NumberTest);
  6590. smalltalk.addMethod(
  6591. smalltalk.method({
  6592. selector: "testEquality",
  6593. protocol: 'tests',
  6594. fn: function (){
  6595. var self=this;
  6596. return smalltalk.withContext(function($ctx1) {
  6597. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6598. $1=(1).__eq((1));
  6599. $ctx1.sendIdx["="]=1;
  6600. self._assert_($1);
  6601. $ctx1.sendIdx["assert:"]=1;
  6602. $2=(0).__eq((0));
  6603. $ctx1.sendIdx["="]=2;
  6604. self._assert_($2);
  6605. $ctx1.sendIdx["assert:"]=2;
  6606. $3=(1).__eq((0));
  6607. $ctx1.sendIdx["="]=3;
  6608. self._deny_($3);
  6609. $ctx1.sendIdx["deny:"]=1;
  6610. $5=(1)._yourself();
  6611. $ctx1.sendIdx["yourself"]=1;
  6612. $4=_st($5).__eq((1));
  6613. $ctx1.sendIdx["="]=4;
  6614. self._assert_($4);
  6615. $ctx1.sendIdx["assert:"]=3;
  6616. $7=(1)._yourself();
  6617. $ctx1.sendIdx["yourself"]=2;
  6618. $6=(1).__eq($7);
  6619. $ctx1.sendIdx["="]=5;
  6620. self._assert_($6);
  6621. $ctx1.sendIdx["assert:"]=4;
  6622. $9=(1)._yourself();
  6623. $ctx1.sendIdx["yourself"]=3;
  6624. $8=_st($9).__eq((1)._yourself());
  6625. $ctx1.sendIdx["="]=6;
  6626. self._assert_($8);
  6627. $10=(0).__eq(false);
  6628. $ctx1.sendIdx["="]=7;
  6629. self._deny_($10);
  6630. $ctx1.sendIdx["deny:"]=2;
  6631. $11=false.__eq((0));
  6632. $ctx1.sendIdx["="]=8;
  6633. self._deny_($11);
  6634. $ctx1.sendIdx["deny:"]=3;
  6635. $12="".__eq((0));
  6636. $ctx1.sendIdx["="]=9;
  6637. self._deny_($12);
  6638. $ctx1.sendIdx["deny:"]=4;
  6639. self._deny_((0).__eq(""));
  6640. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)})},
  6641. args: [],
  6642. 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 = ''",
  6643. messageSends: ["assert:", "=", "deny:", "yourself"],
  6644. referencedClasses: []
  6645. }),
  6646. globals.NumberTest);
  6647. smalltalk.addMethod(
  6648. smalltalk.method({
  6649. selector: "testFloor",
  6650. protocol: 'tests',
  6651. fn: function (){
  6652. var self=this;
  6653. return smalltalk.withContext(function($ctx1) {
  6654. var $1,$2;
  6655. $1=(1.2)._floor();
  6656. $ctx1.sendIdx["floor"]=1;
  6657. self._assert_equals_($1,(1));
  6658. $ctx1.sendIdx["assert:equals:"]=1;
  6659. $2=(-1.2)._floor();
  6660. $ctx1.sendIdx["floor"]=2;
  6661. self._assert_equals_($2,(-2));
  6662. $ctx1.sendIdx["assert:equals:"]=2;
  6663. self._assert_equals_((1)._floor(),(1));
  6664. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)})},
  6665. args: [],
  6666. 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.",
  6667. messageSends: ["assert:equals:", "floor"],
  6668. referencedClasses: []
  6669. }),
  6670. globals.NumberTest);
  6671. smalltalk.addMethod(
  6672. smalltalk.method({
  6673. selector: "testHexNumbers",
  6674. protocol: 'tests',
  6675. fn: function (){
  6676. var self=this;
  6677. return smalltalk.withContext(function($ctx1) {
  6678. var $1,$2,$3,$4,$5;
  6679. self._assert_equals_((9),(9));
  6680. $ctx1.sendIdx["assert:equals:"]=1;
  6681. $1=(10)._truncated();
  6682. $ctx1.sendIdx["truncated"]=1;
  6683. self._assert_equals_($1,(10));
  6684. $ctx1.sendIdx["assert:equals:"]=2;
  6685. $2=(11)._truncated();
  6686. $ctx1.sendIdx["truncated"]=2;
  6687. self._assert_equals_($2,(11));
  6688. $ctx1.sendIdx["assert:equals:"]=3;
  6689. $3=(12)._truncated();
  6690. $ctx1.sendIdx["truncated"]=3;
  6691. self._assert_equals_($3,(12));
  6692. $ctx1.sendIdx["assert:equals:"]=4;
  6693. $4=(13)._truncated();
  6694. $ctx1.sendIdx["truncated"]=4;
  6695. self._assert_equals_($4,(13));
  6696. $ctx1.sendIdx["assert:equals:"]=5;
  6697. $5=(14)._truncated();
  6698. $ctx1.sendIdx["truncated"]=5;
  6699. self._assert_equals_($5,(14));
  6700. $ctx1.sendIdx["assert:equals:"]=6;
  6701. self._assert_equals_((15)._truncated(),(15));
  6702. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)})},
  6703. args: [],
  6704. 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",
  6705. messageSends: ["assert:equals:", "truncated"],
  6706. referencedClasses: []
  6707. }),
  6708. globals.NumberTest);
  6709. smalltalk.addMethod(
  6710. smalltalk.method({
  6711. selector: "testIdentity",
  6712. protocol: 'tests',
  6713. fn: function (){
  6714. var self=this;
  6715. return smalltalk.withContext(function($ctx1) {
  6716. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6717. $1=(1).__eq_eq((1));
  6718. $ctx1.sendIdx["=="]=1;
  6719. self._assert_($1);
  6720. $ctx1.sendIdx["assert:"]=1;
  6721. $2=(0).__eq_eq((0));
  6722. $ctx1.sendIdx["=="]=2;
  6723. self._assert_($2);
  6724. $ctx1.sendIdx["assert:"]=2;
  6725. $3=(1).__eq_eq((0));
  6726. $ctx1.sendIdx["=="]=3;
  6727. self._deny_($3);
  6728. $ctx1.sendIdx["deny:"]=1;
  6729. $5=(1)._yourself();
  6730. $ctx1.sendIdx["yourself"]=1;
  6731. $4=_st($5).__eq_eq((1));
  6732. $ctx1.sendIdx["=="]=4;
  6733. self._assert_($4);
  6734. $ctx1.sendIdx["assert:"]=3;
  6735. $7=(1)._yourself();
  6736. $ctx1.sendIdx["yourself"]=2;
  6737. $6=(1).__eq_eq($7);
  6738. $ctx1.sendIdx["=="]=5;
  6739. self._assert_($6);
  6740. $ctx1.sendIdx["assert:"]=4;
  6741. $9=(1)._yourself();
  6742. $ctx1.sendIdx["yourself"]=3;
  6743. $8=_st($9).__eq_eq((1)._yourself());
  6744. $ctx1.sendIdx["=="]=6;
  6745. self._assert_($8);
  6746. self._deny_((1).__eq_eq((2)));
  6747. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)})},
  6748. args: [],
  6749. 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",
  6750. messageSends: ["assert:", "==", "deny:", "yourself"],
  6751. referencedClasses: []
  6752. }),
  6753. globals.NumberTest);
  6754. smalltalk.addMethod(
  6755. smalltalk.method({
  6756. selector: "testInvalidHexNumbers",
  6757. protocol: 'tests',
  6758. fn: function (){
  6759. var self=this;
  6760. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6761. return smalltalk.withContext(function($ctx1) {
  6762. self._should_raise_((function(){
  6763. return smalltalk.withContext(function($ctx2) {
  6764. return (16)._rG();
  6765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6766. $ctx1.sendIdx["should:raise:"]=1;
  6767. self._should_raise_((function(){
  6768. return smalltalk.withContext(function($ctx2) {
  6769. return (16)._rg();
  6770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6771. $ctx1.sendIdx["should:raise:"]=2;
  6772. self._should_raise_((function(){
  6773. return smalltalk.withContext(function($ctx2) {
  6774. return (16)._rH();
  6775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6776. $ctx1.sendIdx["should:raise:"]=3;
  6777. self._should_raise_((function(){
  6778. return smalltalk.withContext(function($ctx2) {
  6779. return (16)._rh();
  6780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6781. $ctx1.sendIdx["should:raise:"]=4;
  6782. self._should_raise_((function(){
  6783. return smalltalk.withContext(function($ctx2) {
  6784. return (16)._rI();
  6785. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6786. $ctx1.sendIdx["should:raise:"]=5;
  6787. self._should_raise_((function(){
  6788. return smalltalk.withContext(function($ctx2) {
  6789. return (16)._ri();
  6790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6791. $ctx1.sendIdx["should:raise:"]=6;
  6792. self._should_raise_((function(){
  6793. return smalltalk.withContext(function($ctx2) {
  6794. return (16)._rJ();
  6795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6796. $ctx1.sendIdx["should:raise:"]=7;
  6797. self._should_raise_((function(){
  6798. return smalltalk.withContext(function($ctx2) {
  6799. return (16)._rj();
  6800. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6801. $ctx1.sendIdx["should:raise:"]=8;
  6802. self._should_raise_((function(){
  6803. return smalltalk.withContext(function($ctx2) {
  6804. return (16)._rK();
  6805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6806. $ctx1.sendIdx["should:raise:"]=9;
  6807. self._should_raise_((function(){
  6808. return smalltalk.withContext(function($ctx2) {
  6809. return (16)._rk();
  6810. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6811. $ctx1.sendIdx["should:raise:"]=10;
  6812. self._should_raise_((function(){
  6813. return smalltalk.withContext(function($ctx2) {
  6814. return (16)._rL();
  6815. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6816. $ctx1.sendIdx["should:raise:"]=11;
  6817. self._should_raise_((function(){
  6818. return smalltalk.withContext(function($ctx2) {
  6819. return (16)._rl();
  6820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6821. $ctx1.sendIdx["should:raise:"]=12;
  6822. self._should_raise_((function(){
  6823. return smalltalk.withContext(function($ctx2) {
  6824. return (16)._rM();
  6825. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6826. $ctx1.sendIdx["should:raise:"]=13;
  6827. self._should_raise_((function(){
  6828. return smalltalk.withContext(function($ctx2) {
  6829. return (16)._rm();
  6830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6831. $ctx1.sendIdx["should:raise:"]=14;
  6832. self._should_raise_((function(){
  6833. return smalltalk.withContext(function($ctx2) {
  6834. return (16)._rN();
  6835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6836. $ctx1.sendIdx["should:raise:"]=15;
  6837. self._should_raise_((function(){
  6838. return smalltalk.withContext(function($ctx2) {
  6839. return (16)._rn();
  6840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6841. $ctx1.sendIdx["should:raise:"]=16;
  6842. self._should_raise_((function(){
  6843. return smalltalk.withContext(function($ctx2) {
  6844. return (16)._rO();
  6845. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6846. $ctx1.sendIdx["should:raise:"]=17;
  6847. self._should_raise_((function(){
  6848. return smalltalk.withContext(function($ctx2) {
  6849. return (16)._ro();
  6850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6851. $ctx1.sendIdx["should:raise:"]=18;
  6852. self._should_raise_((function(){
  6853. return smalltalk.withContext(function($ctx2) {
  6854. return (16)._rP();
  6855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6856. $ctx1.sendIdx["should:raise:"]=19;
  6857. self._should_raise_((function(){
  6858. return smalltalk.withContext(function($ctx2) {
  6859. return (16)._rp();
  6860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6861. $ctx1.sendIdx["should:raise:"]=20;
  6862. self._should_raise_((function(){
  6863. return smalltalk.withContext(function($ctx2) {
  6864. return (16)._rQ();
  6865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6866. $ctx1.sendIdx["should:raise:"]=21;
  6867. self._should_raise_((function(){
  6868. return smalltalk.withContext(function($ctx2) {
  6869. return (16)._rq();
  6870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6871. $ctx1.sendIdx["should:raise:"]=22;
  6872. self._should_raise_((function(){
  6873. return smalltalk.withContext(function($ctx2) {
  6874. return (16)._rR();
  6875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6876. $ctx1.sendIdx["should:raise:"]=23;
  6877. self._should_raise_((function(){
  6878. return smalltalk.withContext(function($ctx2) {
  6879. return (16)._rr();
  6880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6881. $ctx1.sendIdx["should:raise:"]=24;
  6882. self._should_raise_((function(){
  6883. return smalltalk.withContext(function($ctx2) {
  6884. return (16)._rS();
  6885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6886. $ctx1.sendIdx["should:raise:"]=25;
  6887. self._should_raise_((function(){
  6888. return smalltalk.withContext(function($ctx2) {
  6889. return (16)._rs();
  6890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6891. $ctx1.sendIdx["should:raise:"]=26;
  6892. self._should_raise_((function(){
  6893. return smalltalk.withContext(function($ctx2) {
  6894. return (16)._rT();
  6895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6896. $ctx1.sendIdx["should:raise:"]=27;
  6897. self._should_raise_((function(){
  6898. return smalltalk.withContext(function($ctx2) {
  6899. return (16)._rt();
  6900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6901. $ctx1.sendIdx["should:raise:"]=28;
  6902. self._should_raise_((function(){
  6903. return smalltalk.withContext(function($ctx2) {
  6904. return (16)._rU();
  6905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6906. $ctx1.sendIdx["should:raise:"]=29;
  6907. self._should_raise_((function(){
  6908. return smalltalk.withContext(function($ctx2) {
  6909. return (16)._ru();
  6910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6911. $ctx1.sendIdx["should:raise:"]=30;
  6912. self._should_raise_((function(){
  6913. return smalltalk.withContext(function($ctx2) {
  6914. return (16)._rV();
  6915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6916. $ctx1.sendIdx["should:raise:"]=31;
  6917. self._should_raise_((function(){
  6918. return smalltalk.withContext(function($ctx2) {
  6919. return (16)._rv();
  6920. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6921. $ctx1.sendIdx["should:raise:"]=32;
  6922. self._should_raise_((function(){
  6923. return smalltalk.withContext(function($ctx2) {
  6924. return (16)._rW();
  6925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6926. $ctx1.sendIdx["should:raise:"]=33;
  6927. self._should_raise_((function(){
  6928. return smalltalk.withContext(function($ctx2) {
  6929. return (16)._rw();
  6930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6931. $ctx1.sendIdx["should:raise:"]=34;
  6932. self._should_raise_((function(){
  6933. return smalltalk.withContext(function($ctx2) {
  6934. return (16)._rX();
  6935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6936. $ctx1.sendIdx["should:raise:"]=35;
  6937. self._should_raise_((function(){
  6938. return smalltalk.withContext(function($ctx2) {
  6939. return (16)._rx();
  6940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6941. $ctx1.sendIdx["should:raise:"]=36;
  6942. self._should_raise_((function(){
  6943. return smalltalk.withContext(function($ctx2) {
  6944. return (16)._rY();
  6945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6946. $ctx1.sendIdx["should:raise:"]=37;
  6947. self._should_raise_((function(){
  6948. return smalltalk.withContext(function($ctx2) {
  6949. return (16)._ry();
  6950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6951. $ctx1.sendIdx["should:raise:"]=38;
  6952. self._should_raise_((function(){
  6953. return smalltalk.withContext(function($ctx2) {
  6954. return (16)._rZ();
  6955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6956. $ctx1.sendIdx["should:raise:"]=39;
  6957. self._should_raise_((function(){
  6958. return smalltalk.withContext(function($ctx2) {
  6959. return (16)._rz();
  6960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6961. $ctx1.sendIdx["should:raise:"]=40;
  6962. self._should_raise_((function(){
  6963. return smalltalk.withContext(function($ctx2) {
  6964. return (11259375)._Z();
  6965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6966. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)})},
  6967. args: [],
  6968. 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.",
  6969. 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"],
  6970. referencedClasses: ["MessageNotUnderstood"]
  6971. }),
  6972. globals.NumberTest);
  6973. smalltalk.addMethod(
  6974. smalltalk.method({
  6975. selector: "testLog",
  6976. protocol: 'tests',
  6977. fn: function (){
  6978. var self=this;
  6979. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  6980. return smalltalk.withContext(function($ctx1) {
  6981. self._assert_equals_((10000)._log(),(4));
  6982. $ctx1.sendIdx["assert:equals:"]=1;
  6983. self._assert_equals_((512)._log_((2)),(9));
  6984. $ctx1.sendIdx["assert:equals:"]=2;
  6985. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  6986. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)})},
  6987. args: [],
  6988. 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.",
  6989. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  6990. referencedClasses: ["Number"]
  6991. }),
  6992. globals.NumberTest);
  6993. smalltalk.addMethod(
  6994. smalltalk.method({
  6995. selector: "testMinMax",
  6996. protocol: 'tests',
  6997. fn: function (){
  6998. var self=this;
  6999. return smalltalk.withContext(function($ctx1) {
  7000. self._assert_equals_((2)._max_((5)),(5));
  7001. $ctx1.sendIdx["assert:equals:"]=1;
  7002. self._assert_equals_((2)._min_((5)),(2));
  7003. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)})},
  7004. args: [],
  7005. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  7006. messageSends: ["assert:equals:", "max:", "min:"],
  7007. referencedClasses: []
  7008. }),
  7009. globals.NumberTest);
  7010. smalltalk.addMethod(
  7011. smalltalk.method({
  7012. selector: "testNegated",
  7013. protocol: 'tests',
  7014. fn: function (){
  7015. var self=this;
  7016. return smalltalk.withContext(function($ctx1) {
  7017. var $1;
  7018. $1=(3)._negated();
  7019. $ctx1.sendIdx["negated"]=1;
  7020. self._assert_equals_($1,(-3));
  7021. $ctx1.sendIdx["assert:equals:"]=1;
  7022. self._assert_equals_((-3)._negated(),(3));
  7023. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)})},
  7024. args: [],
  7025. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  7026. messageSends: ["assert:equals:", "negated"],
  7027. referencedClasses: []
  7028. }),
  7029. globals.NumberTest);
  7030. smalltalk.addMethod(
  7031. smalltalk.method({
  7032. selector: "testPrintShowingDecimalPlaces",
  7033. protocol: 'tests',
  7034. fn: function (){
  7035. var self=this;
  7036. return smalltalk.withContext(function($ctx1) {
  7037. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  7038. $1=(23)._printShowingDecimalPlaces_((2));
  7039. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  7040. self._assert_equals_($1,"23.00");
  7041. $ctx1.sendIdx["assert:equals:"]=1;
  7042. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7043. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7044. self._assert_equals_($2,"23.57");
  7045. $ctx1.sendIdx["assert:equals:"]=2;
  7046. $4=(234.567)._negated();
  7047. $ctx1.sendIdx["negated"]=1;
  7048. $3=_st($4)._printShowingDecimalPlaces_((5));
  7049. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7050. self._assert_equals_($3,"-234.56700");
  7051. $ctx1.sendIdx["assert:equals:"]=3;
  7052. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7053. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7054. self._assert_equals_($5,"23");
  7055. $ctx1.sendIdx["assert:equals:"]=4;
  7056. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7057. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7058. self._assert_equals_($6,"24");
  7059. $ctx1.sendIdx["assert:equals:"]=5;
  7060. $8=(23.4567)._negated();
  7061. $ctx1.sendIdx["negated"]=2;
  7062. $7=_st($8)._printShowingDecimalPlaces_((0));
  7063. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7064. self._assert_equals_($7,"-23");
  7065. $ctx1.sendIdx["assert:equals:"]=6;
  7066. $10=(23.5567)._negated();
  7067. $ctx1.sendIdx["negated"]=3;
  7068. $9=_st($10)._printShowingDecimalPlaces_((0));
  7069. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7070. self._assert_equals_($9,"-24");
  7071. $ctx1.sendIdx["assert:equals:"]=7;
  7072. $11=(100000000)._printShowingDecimalPlaces_((1));
  7073. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7074. self._assert_equals_($11,"100000000.0");
  7075. $ctx1.sendIdx["assert:equals:"]=8;
  7076. $12=(0.98)._printShowingDecimalPlaces_((5));
  7077. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7078. self._assert_equals_($12,"0.98000");
  7079. $ctx1.sendIdx["assert:equals:"]=9;
  7080. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7081. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7082. self._assert_equals_($13,"-0.98");
  7083. $ctx1.sendIdx["assert:equals:"]=10;
  7084. $14=(2.567)._printShowingDecimalPlaces_((2));
  7085. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7086. self._assert_equals_($14,"2.57");
  7087. $ctx1.sendIdx["assert:equals:"]=11;
  7088. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7089. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7090. self._assert_equals_($15,"-2.57");
  7091. $ctx1.sendIdx["assert:equals:"]=12;
  7092. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7093. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)})},
  7094. args: [],
  7095. 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'.",
  7096. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7097. referencedClasses: []
  7098. }),
  7099. globals.NumberTest);
  7100. smalltalk.addMethod(
  7101. smalltalk.method({
  7102. selector: "testRaisedTo",
  7103. protocol: 'tests',
  7104. fn: function (){
  7105. var self=this;
  7106. return smalltalk.withContext(function($ctx1) {
  7107. var $1,$2,$3;
  7108. $1=(2)._raisedTo_((4));
  7109. $ctx1.sendIdx["raisedTo:"]=1;
  7110. self._assert_equals_($1,(16));
  7111. $ctx1.sendIdx["assert:equals:"]=1;
  7112. $2=(2)._raisedTo_((0));
  7113. $ctx1.sendIdx["raisedTo:"]=2;
  7114. self._assert_equals_($2,(1));
  7115. $ctx1.sendIdx["assert:equals:"]=2;
  7116. $3=(2)._raisedTo_((-3));
  7117. $ctx1.sendIdx["raisedTo:"]=3;
  7118. self._assert_equals_($3,(0.125));
  7119. $ctx1.sendIdx["assert:equals:"]=3;
  7120. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7121. $ctx1.sendIdx["assert:equals:"]=4;
  7122. self._assert_equals_((2).__star_star((4)),(16));
  7123. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)})},
  7124. args: [],
  7125. 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.",
  7126. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7127. referencedClasses: []
  7128. }),
  7129. globals.NumberTest);
  7130. smalltalk.addMethod(
  7131. smalltalk.method({
  7132. selector: "testRounded",
  7133. protocol: 'tests',
  7134. fn: function (){
  7135. var self=this;
  7136. return smalltalk.withContext(function($ctx1) {
  7137. var $1,$2;
  7138. $1=(3)._rounded();
  7139. $ctx1.sendIdx["rounded"]=1;
  7140. self._assert_equals_($1,(3));
  7141. $ctx1.sendIdx["assert:equals:"]=1;
  7142. $2=(3.212)._rounded();
  7143. $ctx1.sendIdx["rounded"]=2;
  7144. self._assert_equals_($2,(3));
  7145. $ctx1.sendIdx["assert:equals:"]=2;
  7146. self._assert_equals_((3.51)._rounded(),(4));
  7147. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)})},
  7148. args: [],
  7149. 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",
  7150. messageSends: ["assert:equals:", "rounded"],
  7151. referencedClasses: []
  7152. }),
  7153. globals.NumberTest);
  7154. smalltalk.addMethod(
  7155. smalltalk.method({
  7156. selector: "testSign",
  7157. protocol: 'tests',
  7158. fn: function (){
  7159. var self=this;
  7160. return smalltalk.withContext(function($ctx1) {
  7161. var $1,$2;
  7162. $1=(5)._sign();
  7163. $ctx1.sendIdx["sign"]=1;
  7164. self._assert_equals_($1,(1));
  7165. $ctx1.sendIdx["assert:equals:"]=1;
  7166. $2=(0)._sign();
  7167. $ctx1.sendIdx["sign"]=2;
  7168. self._assert_equals_($2,(0));
  7169. $ctx1.sendIdx["assert:equals:"]=2;
  7170. self._assert_equals_((-1.4)._sign(),(-1));
  7171. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)})},
  7172. args: [],
  7173. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7174. messageSends: ["assert:equals:", "sign"],
  7175. referencedClasses: []
  7176. }),
  7177. globals.NumberTest);
  7178. smalltalk.addMethod(
  7179. smalltalk.method({
  7180. selector: "testSqrt",
  7181. protocol: 'tests',
  7182. fn: function (){
  7183. var self=this;
  7184. return smalltalk.withContext(function($ctx1) {
  7185. var $1;
  7186. $1=(4)._sqrt();
  7187. $ctx1.sendIdx["sqrt"]=1;
  7188. self._assert_equals_($1,(2));
  7189. $ctx1.sendIdx["assert:equals:"]=1;
  7190. self._assert_equals_((16)._sqrt(),(4));
  7191. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)})},
  7192. args: [],
  7193. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7194. messageSends: ["assert:equals:", "sqrt"],
  7195. referencedClasses: []
  7196. }),
  7197. globals.NumberTest);
  7198. smalltalk.addMethod(
  7199. smalltalk.method({
  7200. selector: "testSquared",
  7201. protocol: 'tests',
  7202. fn: function (){
  7203. var self=this;
  7204. return smalltalk.withContext(function($ctx1) {
  7205. self._assert_equals_((4)._squared(),(16));
  7206. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)})},
  7207. args: [],
  7208. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7209. messageSends: ["assert:equals:", "squared"],
  7210. referencedClasses: []
  7211. }),
  7212. globals.NumberTest);
  7213. smalltalk.addMethod(
  7214. smalltalk.method({
  7215. selector: "testTimesRepeat",
  7216. protocol: 'tests',
  7217. fn: function (){
  7218. var self=this;
  7219. var i;
  7220. return smalltalk.withContext(function($ctx1) {
  7221. i=(0);
  7222. (0)._timesRepeat_((function(){
  7223. return smalltalk.withContext(function($ctx2) {
  7224. i=_st(i).__plus((1));
  7225. $ctx2.sendIdx["+"]=1;
  7226. return i;
  7227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7228. $ctx1.sendIdx["timesRepeat:"]=1;
  7229. self._assert_equals_(i,(0));
  7230. $ctx1.sendIdx["assert:equals:"]=1;
  7231. (5)._timesRepeat_((function(){
  7232. return smalltalk.withContext(function($ctx2) {
  7233. i=_st(i).__plus((1));
  7234. return i;
  7235. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7236. self._assert_equals_(i,(5));
  7237. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)})},
  7238. args: [],
  7239. 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",
  7240. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7241. referencedClasses: []
  7242. }),
  7243. globals.NumberTest);
  7244. smalltalk.addMethod(
  7245. smalltalk.method({
  7246. selector: "testTo",
  7247. protocol: 'tests',
  7248. fn: function (){
  7249. var self=this;
  7250. return smalltalk.withContext(function($ctx1) {
  7251. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7252. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)})},
  7253. args: [],
  7254. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7255. messageSends: ["assert:equals:", "to:"],
  7256. referencedClasses: []
  7257. }),
  7258. globals.NumberTest);
  7259. smalltalk.addMethod(
  7260. smalltalk.method({
  7261. selector: "testToBy",
  7262. protocol: 'tests',
  7263. fn: function (){
  7264. var self=this;
  7265. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7266. return smalltalk.withContext(function($ctx1) {
  7267. var $1;
  7268. $1=(0)._to_by_((6),(2));
  7269. $ctx1.sendIdx["to:by:"]=1;
  7270. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7271. self._should_raise_((function(){
  7272. return smalltalk.withContext(function($ctx2) {
  7273. return (1)._to_by_((4),(0));
  7274. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7275. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)})},
  7276. args: [],
  7277. 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",
  7278. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7279. referencedClasses: ["Error"]
  7280. }),
  7281. globals.NumberTest);
  7282. smalltalk.addMethod(
  7283. smalltalk.method({
  7284. selector: "testTrigonometry",
  7285. protocol: 'tests',
  7286. fn: function (){
  7287. var self=this;
  7288. return smalltalk.withContext(function($ctx1) {
  7289. self._assert_equals_((0)._cos(),(1));
  7290. $ctx1.sendIdx["assert:equals:"]=1;
  7291. self._assert_equals_((0)._sin(),(0));
  7292. $ctx1.sendIdx["assert:equals:"]=2;
  7293. self._assert_equals_((0)._tan(),(0));
  7294. $ctx1.sendIdx["assert:equals:"]=3;
  7295. self._assert_equals_((1)._arcCos(),(0));
  7296. $ctx1.sendIdx["assert:equals:"]=4;
  7297. self._assert_equals_((0)._arcSin(),(0));
  7298. $ctx1.sendIdx["assert:equals:"]=5;
  7299. self._assert_equals_((0)._arcTan(),(0));
  7300. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)})},
  7301. args: [],
  7302. 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.",
  7303. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7304. referencedClasses: []
  7305. }),
  7306. globals.NumberTest);
  7307. smalltalk.addMethod(
  7308. smalltalk.method({
  7309. selector: "testTruncated",
  7310. protocol: 'tests',
  7311. fn: function (){
  7312. var self=this;
  7313. return smalltalk.withContext(function($ctx1) {
  7314. var $1,$2;
  7315. $1=(3)._truncated();
  7316. $ctx1.sendIdx["truncated"]=1;
  7317. self._assert_equals_($1,(3));
  7318. $ctx1.sendIdx["assert:equals:"]=1;
  7319. $2=(3.212)._truncated();
  7320. $ctx1.sendIdx["truncated"]=2;
  7321. self._assert_equals_($2,(3));
  7322. $ctx1.sendIdx["assert:equals:"]=2;
  7323. self._assert_equals_((3.51)._truncated(),(3));
  7324. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)})},
  7325. args: [],
  7326. 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",
  7327. messageSends: ["assert:equals:", "truncated"],
  7328. referencedClasses: []
  7329. }),
  7330. globals.NumberTest);
  7331. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  7332. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7333. smalltalk.addMethod(
  7334. smalltalk.method({
  7335. selector: "foo",
  7336. protocol: 'not yet classified',
  7337. fn: function (){
  7338. var self=this;
  7339. var $1;
  7340. $1=self["@foo"];
  7341. return $1;
  7342. },
  7343. args: [],
  7344. source: "foo\x0a\x09^ foo",
  7345. messageSends: [],
  7346. referencedClasses: []
  7347. }),
  7348. globals.ObjectMock);
  7349. smalltalk.addMethod(
  7350. smalltalk.method({
  7351. selector: "foo:",
  7352. protocol: 'not yet classified',
  7353. fn: function (anObject){
  7354. var self=this;
  7355. self["@foo"]=anObject;
  7356. return self},
  7357. args: ["anObject"],
  7358. source: "foo: anObject\x0a\x09foo := anObject",
  7359. messageSends: [],
  7360. referencedClasses: []
  7361. }),
  7362. globals.ObjectMock);
  7363. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  7364. smalltalk.addMethod(
  7365. smalltalk.method({
  7366. selector: "notDefined",
  7367. protocol: 'tests',
  7368. fn: function (){
  7369. var self=this;
  7370. return smalltalk.withContext(function($ctx1) {
  7371. return void 0;;
  7372. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},globals.ObjectTest)})},
  7373. args: [],
  7374. source: "notDefined\x0a\x09<return void 0;>",
  7375. messageSends: [],
  7376. referencedClasses: []
  7377. }),
  7378. globals.ObjectTest);
  7379. smalltalk.addMethod(
  7380. smalltalk.method({
  7381. selector: "testBasicAccess",
  7382. protocol: 'tests',
  7383. fn: function (){
  7384. var self=this;
  7385. var o;
  7386. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7387. return smalltalk.withContext(function($ctx1) {
  7388. var $1;
  7389. o=_st($Object())._new();
  7390. _st(o)._basicAt_put_("a",(1));
  7391. $1=_st(o)._basicAt_("a");
  7392. $ctx1.sendIdx["basicAt:"]=1;
  7393. self._assert_equals_($1,(1));
  7394. $ctx1.sendIdx["assert:equals:"]=1;
  7395. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7396. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)})},
  7397. args: [],
  7398. 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",
  7399. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7400. referencedClasses: ["Object"]
  7401. }),
  7402. globals.ObjectTest);
  7403. smalltalk.addMethod(
  7404. smalltalk.method({
  7405. selector: "testBasicPerform",
  7406. protocol: 'tests',
  7407. fn: function (){
  7408. var self=this;
  7409. var o;
  7410. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7411. return smalltalk.withContext(function($ctx1) {
  7412. o=_st($Object())._new();
  7413. _st(o)._basicAt_put_("func",(function(){
  7414. return "hello";
  7415. }));
  7416. $ctx1.sendIdx["basicAt:put:"]=1;
  7417. _st(o)._basicAt_put_("func2",(function(a){
  7418. return smalltalk.withContext(function($ctx2) {
  7419. return _st(a).__plus((1));
  7420. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7421. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7422. $ctx1.sendIdx["assert:equals:"]=1;
  7423. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7424. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)})},
  7425. args: [],
  7426. 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",
  7427. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7428. referencedClasses: ["Object"]
  7429. }),
  7430. globals.ObjectTest);
  7431. smalltalk.addMethod(
  7432. smalltalk.method({
  7433. selector: "testDNU",
  7434. protocol: 'tests',
  7435. fn: function (){
  7436. var self=this;
  7437. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7438. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7439. return smalltalk.withContext(function($ctx1) {
  7440. self._should_raise_((function(){
  7441. return smalltalk.withContext(function($ctx2) {
  7442. return _st(_st($Object())._new())._foo();
  7443. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7444. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)})},
  7445. args: [],
  7446. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7447. messageSends: ["should:raise:", "foo", "new"],
  7448. referencedClasses: ["Object", "MessageNotUnderstood"]
  7449. }),
  7450. globals.ObjectTest);
  7451. smalltalk.addMethod(
  7452. smalltalk.method({
  7453. selector: "testEquality",
  7454. protocol: 'tests',
  7455. fn: function (){
  7456. var self=this;
  7457. var o;
  7458. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7459. return smalltalk.withContext(function($ctx1) {
  7460. var $1,$2,$4,$3;
  7461. o=_st($Object())._new();
  7462. $ctx1.sendIdx["new"]=1;
  7463. $1=_st(o).__eq(_st($Object())._new());
  7464. $ctx1.sendIdx["="]=1;
  7465. self._deny_($1);
  7466. $2=_st(o).__eq(o);
  7467. $ctx1.sendIdx["="]=2;
  7468. self._assert_($2);
  7469. $ctx1.sendIdx["assert:"]=1;
  7470. $4=_st(o)._yourself();
  7471. $ctx1.sendIdx["yourself"]=1;
  7472. $3=_st($4).__eq(o);
  7473. $ctx1.sendIdx["="]=3;
  7474. self._assert_($3);
  7475. $ctx1.sendIdx["assert:"]=2;
  7476. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7477. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)})},
  7478. args: [],
  7479. 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)",
  7480. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7481. referencedClasses: ["Object"]
  7482. }),
  7483. globals.ObjectTest);
  7484. smalltalk.addMethod(
  7485. smalltalk.method({
  7486. selector: "testHalt",
  7487. protocol: 'tests',
  7488. fn: function (){
  7489. var self=this;
  7490. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7491. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7492. return smalltalk.withContext(function($ctx1) {
  7493. self._should_raise_((function(){
  7494. return smalltalk.withContext(function($ctx2) {
  7495. return _st(_st($Object())._new())._halt();
  7496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7497. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)})},
  7498. args: [],
  7499. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7500. messageSends: ["should:raise:", "halt", "new"],
  7501. referencedClasses: ["Object", "Error"]
  7502. }),
  7503. globals.ObjectTest);
  7504. smalltalk.addMethod(
  7505. smalltalk.method({
  7506. selector: "testIdentity",
  7507. protocol: 'tests',
  7508. fn: function (){
  7509. var self=this;
  7510. var o;
  7511. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7512. return smalltalk.withContext(function($ctx1) {
  7513. var $1,$2,$4,$3;
  7514. o=_st($Object())._new();
  7515. $ctx1.sendIdx["new"]=1;
  7516. $1=_st(o).__eq_eq(_st($Object())._new());
  7517. $ctx1.sendIdx["=="]=1;
  7518. self._deny_($1);
  7519. $2=_st(o).__eq_eq(o);
  7520. $ctx1.sendIdx["=="]=2;
  7521. self._assert_($2);
  7522. $ctx1.sendIdx["assert:"]=1;
  7523. $4=_st(o)._yourself();
  7524. $ctx1.sendIdx["yourself"]=1;
  7525. $3=_st($4).__eq_eq(o);
  7526. $ctx1.sendIdx["=="]=3;
  7527. self._assert_($3);
  7528. $ctx1.sendIdx["assert:"]=2;
  7529. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7530. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)})},
  7531. args: [],
  7532. 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",
  7533. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7534. referencedClasses: ["Object"]
  7535. }),
  7536. globals.ObjectTest);
  7537. smalltalk.addMethod(
  7538. smalltalk.method({
  7539. selector: "testIfNil",
  7540. protocol: 'tests',
  7541. fn: function (){
  7542. var self=this;
  7543. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7544. return smalltalk.withContext(function($ctx1) {
  7545. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  7546. $2=_st($Object())._new();
  7547. $ctx1.sendIdx["new"]=1;
  7548. $1=_st($2)._isNil();
  7549. self._deny_($1);
  7550. $ctx1.sendIdx["deny:"]=1;
  7551. $5=_st($Object())._new();
  7552. $ctx1.sendIdx["new"]=2;
  7553. if(($receiver = $5) == null || $receiver.isNil){
  7554. $4=true;
  7555. } else {
  7556. $4=$5;
  7557. };
  7558. $3=_st($4).__eq(true);
  7559. self._deny_($3);
  7560. $7=_st($Object())._new();
  7561. $ctx1.sendIdx["new"]=3;
  7562. if(($receiver = $7) == null || $receiver.isNil){
  7563. $6=$7;
  7564. } else {
  7565. $6=true;
  7566. };
  7567. self._assert_equals_($6,true);
  7568. $ctx1.sendIdx["assert:equals:"]=1;
  7569. $9=_st($Object())._new();
  7570. $ctx1.sendIdx["new"]=4;
  7571. if(($receiver = $9) == null || $receiver.isNil){
  7572. $8=false;
  7573. } else {
  7574. $8=true;
  7575. };
  7576. self._assert_equals_($8,true);
  7577. $ctx1.sendIdx["assert:equals:"]=2;
  7578. $11=_st($Object())._new();
  7579. if(($receiver = $11) == null || $receiver.isNil){
  7580. $10=false;
  7581. } else {
  7582. $10=true;
  7583. };
  7584. self._assert_equals_($10,true);
  7585. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)})},
  7586. args: [],
  7587. 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",
  7588. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7589. referencedClasses: ["Object"]
  7590. }),
  7591. globals.ObjectTest);
  7592. smalltalk.addMethod(
  7593. smalltalk.method({
  7594. selector: "testInstVars",
  7595. protocol: 'tests',
  7596. fn: function (){
  7597. var self=this;
  7598. var o;
  7599. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7600. return smalltalk.withContext(function($ctx1) {
  7601. var $1,$2;
  7602. o=_st($ObjectMock())._new();
  7603. $1=_st(o)._instVarAt_("foo");
  7604. $ctx1.sendIdx["instVarAt:"]=1;
  7605. self._assert_equals_($1,nil);
  7606. $ctx1.sendIdx["assert:equals:"]=1;
  7607. _st(o)._instVarAt_put_("foo",(1));
  7608. $2=_st(o)._instVarAt_("foo");
  7609. $ctx1.sendIdx["instVarAt:"]=2;
  7610. self._assert_equals_($2,(1));
  7611. $ctx1.sendIdx["assert:equals:"]=2;
  7612. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7613. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)})},
  7614. args: [],
  7615. 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",
  7616. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7617. referencedClasses: ["ObjectMock"]
  7618. }),
  7619. globals.ObjectTest);
  7620. smalltalk.addMethod(
  7621. smalltalk.method({
  7622. selector: "testNilUndefined",
  7623. protocol: 'tests',
  7624. fn: function (){
  7625. var self=this;
  7626. return smalltalk.withContext(function($ctx1) {
  7627. self._assert_equals_(self._notDefined(),nil);
  7628. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)})},
  7629. args: [],
  7630. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7631. messageSends: ["assert:equals:", "notDefined"],
  7632. referencedClasses: []
  7633. }),
  7634. globals.ObjectTest);
  7635. smalltalk.addMethod(
  7636. smalltalk.method({
  7637. selector: "testYourself",
  7638. protocol: 'tests',
  7639. fn: function (){
  7640. var self=this;
  7641. var o;
  7642. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7643. return smalltalk.withContext(function($ctx1) {
  7644. o=_st($ObjectMock())._new();
  7645. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7646. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)})},
  7647. args: [],
  7648. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7649. messageSends: ["new", "assert:", "==", "yourself"],
  7650. referencedClasses: ["ObjectMock"]
  7651. }),
  7652. globals.ObjectTest);
  7653. smalltalk.addMethod(
  7654. smalltalk.method({
  7655. selector: "testidentityHash",
  7656. protocol: 'tests',
  7657. fn: function (){
  7658. var self=this;
  7659. var o1,o2;
  7660. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7661. return smalltalk.withContext(function($ctx1) {
  7662. var $2,$3,$1,$5,$4;
  7663. o1=_st($Object())._new();
  7664. $ctx1.sendIdx["new"]=1;
  7665. o2=_st($Object())._new();
  7666. $2=_st(o1)._identityHash();
  7667. $ctx1.sendIdx["identityHash"]=1;
  7668. $3=_st(o1)._identityHash();
  7669. $ctx1.sendIdx["identityHash"]=2;
  7670. $1=_st($2).__eq_eq($3);
  7671. $ctx1.sendIdx["=="]=1;
  7672. self._assert_($1);
  7673. $5=_st(o1)._identityHash();
  7674. $ctx1.sendIdx["identityHash"]=3;
  7675. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7676. self._deny_($4);
  7677. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)})},
  7678. args: [],
  7679. 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",
  7680. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7681. referencedClasses: ["Object"]
  7682. }),
  7683. globals.ObjectTest);
  7684. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  7685. smalltalk.addMethod(
  7686. smalltalk.method({
  7687. selector: "testAccessing",
  7688. protocol: 'tests',
  7689. fn: function (){
  7690. var self=this;
  7691. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7692. return smalltalk.withContext(function($ctx1) {
  7693. var $2,$1,$3,$6,$5,$4;
  7694. $2=_st($Point())._x_y_((3),(4));
  7695. $ctx1.sendIdx["x:y:"]=1;
  7696. $1=_st($2)._x();
  7697. $ctx1.sendIdx["x"]=1;
  7698. self._assert_equals_($1,(3));
  7699. $ctx1.sendIdx["assert:equals:"]=1;
  7700. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7701. $ctx1.sendIdx["y"]=1;
  7702. self._assert_equals_($3,(4));
  7703. $ctx1.sendIdx["assert:equals:"]=2;
  7704. $6=_st($Point())._new();
  7705. $ctx1.sendIdx["new"]=1;
  7706. $5=_st($6)._x_((3));
  7707. $4=_st($5)._x();
  7708. self._assert_equals_($4,(3));
  7709. $ctx1.sendIdx["assert:equals:"]=3;
  7710. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7711. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)})},
  7712. args: [],
  7713. 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",
  7714. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7715. referencedClasses: ["Point"]
  7716. }),
  7717. globals.PointTest);
  7718. smalltalk.addMethod(
  7719. smalltalk.method({
  7720. selector: "testArithmetic",
  7721. protocol: 'tests',
  7722. fn: function (){
  7723. var self=this;
  7724. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7725. return smalltalk.withContext(function($ctx1) {
  7726. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7727. $2=(3).__at((4));
  7728. $ctx1.sendIdx["@"]=1;
  7729. $3=(3).__at((4));
  7730. $ctx1.sendIdx["@"]=2;
  7731. $1=_st($2).__star($3);
  7732. $4=_st($Point())._x_y_((9),(16));
  7733. $ctx1.sendIdx["x:y:"]=1;
  7734. self._assert_equals_($1,$4);
  7735. $ctx1.sendIdx["assert:equals:"]=1;
  7736. $6=(3).__at((4));
  7737. $ctx1.sendIdx["@"]=3;
  7738. $7=(3).__at((4));
  7739. $ctx1.sendIdx["@"]=4;
  7740. $5=_st($6).__plus($7);
  7741. $8=_st($Point())._x_y_((6),(8));
  7742. $ctx1.sendIdx["x:y:"]=2;
  7743. self._assert_equals_($5,$8);
  7744. $ctx1.sendIdx["assert:equals:"]=2;
  7745. $10=(3).__at((4));
  7746. $ctx1.sendIdx["@"]=5;
  7747. $11=(3).__at((4));
  7748. $ctx1.sendIdx["@"]=6;
  7749. $9=_st($10).__minus($11);
  7750. $12=_st($Point())._x_y_((0),(0));
  7751. $ctx1.sendIdx["x:y:"]=3;
  7752. self._assert_equals_($9,$12);
  7753. $ctx1.sendIdx["assert:equals:"]=3;
  7754. $14=(6).__at((8));
  7755. $ctx1.sendIdx["@"]=7;
  7756. $13=_st($14).__slash((3).__at((4)));
  7757. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7758. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)})},
  7759. args: [],
  7760. 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)",
  7761. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7762. referencedClasses: ["Point"]
  7763. }),
  7764. globals.PointTest);
  7765. smalltalk.addMethod(
  7766. smalltalk.method({
  7767. selector: "testAt",
  7768. protocol: 'tests',
  7769. fn: function (){
  7770. var self=this;
  7771. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7772. return smalltalk.withContext(function($ctx1) {
  7773. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7774. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)})},
  7775. args: [],
  7776. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7777. messageSends: ["assert:equals:", "@", "x:y:"],
  7778. referencedClasses: ["Point"]
  7779. }),
  7780. globals.PointTest);
  7781. smalltalk.addMethod(
  7782. smalltalk.method({
  7783. selector: "testComparison",
  7784. protocol: 'tests',
  7785. fn: function (){
  7786. var self=this;
  7787. return smalltalk.withContext(function($ctx1) {
  7788. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  7789. $2=(3).__at((4));
  7790. $ctx1.sendIdx["@"]=1;
  7791. $3=(4).__at((5));
  7792. $ctx1.sendIdx["@"]=2;
  7793. $1=_st($2).__lt($3);
  7794. $ctx1.sendIdx["<"]=1;
  7795. self._assert_($1);
  7796. $ctx1.sendIdx["assert:"]=1;
  7797. $5=(3).__at((4));
  7798. $ctx1.sendIdx["@"]=3;
  7799. $6=(4).__at((4));
  7800. $ctx1.sendIdx["@"]=4;
  7801. $4=_st($5).__lt($6);
  7802. self._deny_($4);
  7803. $ctx1.sendIdx["deny:"]=1;
  7804. $8=(4).__at((5));
  7805. $ctx1.sendIdx["@"]=5;
  7806. $9=(4).__at((5));
  7807. $ctx1.sendIdx["@"]=6;
  7808. $7=_st($8).__lt_eq($9);
  7809. $ctx1.sendIdx["<="]=1;
  7810. self._assert_($7);
  7811. $ctx1.sendIdx["assert:"]=2;
  7812. $11=(4).__at((5));
  7813. $ctx1.sendIdx["@"]=7;
  7814. $12=(3).__at((5));
  7815. $ctx1.sendIdx["@"]=8;
  7816. $10=_st($11).__lt_eq($12);
  7817. self._deny_($10);
  7818. $ctx1.sendIdx["deny:"]=2;
  7819. $14=(5).__at((6));
  7820. $ctx1.sendIdx["@"]=9;
  7821. $15=(4).__at((5));
  7822. $ctx1.sendIdx["@"]=10;
  7823. $13=_st($14).__gt($15);
  7824. $ctx1.sendIdx[">"]=1;
  7825. self._assert_($13);
  7826. $ctx1.sendIdx["assert:"]=3;
  7827. $17=(5).__at((6));
  7828. $ctx1.sendIdx["@"]=11;
  7829. $18=(6).__at((6));
  7830. $ctx1.sendIdx["@"]=12;
  7831. $16=_st($17).__gt($18);
  7832. self._deny_($16);
  7833. $ctx1.sendIdx["deny:"]=3;
  7834. $20=(4).__at((5));
  7835. $ctx1.sendIdx["@"]=13;
  7836. $21=(4).__at((5));
  7837. $ctx1.sendIdx["@"]=14;
  7838. $19=_st($20).__gt_eq($21);
  7839. $ctx1.sendIdx[">="]=1;
  7840. self._assert_($19);
  7841. $23=(4).__at((5));
  7842. $ctx1.sendIdx["@"]=15;
  7843. $22=_st($23).__gt_eq((5).__at((5)));
  7844. self._deny_($22);
  7845. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.PointTest)})},
  7846. args: [],
  7847. source: "testComparison\x0a\x09self assert: 3@4 < (4@5).\x0a\x09self deny: 3@4 < (4@4).\x0a\x09\x0a\x09self assert: 4@5 <= (4@5).\x0a\x09self deny: 4@5 <= (3@5).\x0a\x09\x0a\x09self assert: 5@6 > (4@5).\x0a\x09self deny: 5@6 > (6@6).\x0a\x09\x0a\x09self assert: 4@5 >= (4@5).\x0a\x09self deny: 4@5 >= (5@5)",
  7848. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="],
  7849. referencedClasses: []
  7850. }),
  7851. globals.PointTest);
  7852. smalltalk.addMethod(
  7853. smalltalk.method({
  7854. selector: "testEgality",
  7855. protocol: 'tests',
  7856. fn: function (){
  7857. var self=this;
  7858. return smalltalk.withContext(function($ctx1) {
  7859. var $2,$3,$1,$5,$4;
  7860. $2=(3).__at((4));
  7861. $ctx1.sendIdx["@"]=1;
  7862. $3=(3).__at((4));
  7863. $ctx1.sendIdx["@"]=2;
  7864. $1=_st($2).__eq($3);
  7865. $ctx1.sendIdx["="]=1;
  7866. self._assert_($1);
  7867. $5=(3).__at((5));
  7868. $ctx1.sendIdx["@"]=3;
  7869. $4=_st($5).__eq((3).__at((6)));
  7870. self._deny_($4);
  7871. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)})},
  7872. args: [],
  7873. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7874. messageSends: ["assert:", "=", "@", "deny:"],
  7875. referencedClasses: []
  7876. }),
  7877. globals.PointTest);
  7878. smalltalk.addMethod(
  7879. smalltalk.method({
  7880. selector: "testNew",
  7881. protocol: 'tests',
  7882. fn: function (){
  7883. var self=this;
  7884. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7885. return smalltalk.withContext(function($ctx1) {
  7886. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7887. $3=_st($Point())._new();
  7888. $ctx1.sendIdx["new"]=1;
  7889. $2=_st($3)._x_((3));
  7890. $ctx1.sendIdx["x:"]=1;
  7891. $1=_st($2)._y();
  7892. $ctx1.sendIdx["y"]=1;
  7893. self._assert_equals_($1,nil);
  7894. $ctx1.sendIdx["assert:equals:"]=1;
  7895. $7=_st($Point())._new();
  7896. $ctx1.sendIdx["new"]=2;
  7897. $6=_st($7)._x_((3));
  7898. $5=_st($6)._x();
  7899. $ctx1.sendIdx["x"]=1;
  7900. $4=_st($5).__eq((0));
  7901. $ctx1.sendIdx["="]=1;
  7902. self._deny_($4);
  7903. $ctx1.sendIdx["deny:"]=1;
  7904. $10=_st($Point())._new();
  7905. $ctx1.sendIdx["new"]=3;
  7906. $9=_st($10)._y_((4));
  7907. $ctx1.sendIdx["y:"]=1;
  7908. $8=_st($9)._x();
  7909. self._assert_equals_($8,nil);
  7910. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7911. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)})},
  7912. args: [],
  7913. 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",
  7914. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7915. referencedClasses: ["Point"]
  7916. }),
  7917. globals.PointTest);
  7918. smalltalk.addMethod(
  7919. smalltalk.method({
  7920. selector: "testTranslateBy",
  7921. protocol: 'tests',
  7922. fn: function (){
  7923. var self=this;
  7924. return smalltalk.withContext(function($ctx1) {
  7925. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7926. $2=(3).__at((3));
  7927. $ctx1.sendIdx["@"]=1;
  7928. $3=(0).__at((1));
  7929. $ctx1.sendIdx["@"]=2;
  7930. $1=_st($2)._translateBy_($3);
  7931. $ctx1.sendIdx["translateBy:"]=1;
  7932. $4=(3).__at((4));
  7933. $ctx1.sendIdx["@"]=3;
  7934. self._assert_equals_($1,$4);
  7935. $ctx1.sendIdx["assert:equals:"]=1;
  7936. $6=(3).__at((3));
  7937. $ctx1.sendIdx["@"]=4;
  7938. $8=(1)._negated();
  7939. $ctx1.sendIdx["negated"]=1;
  7940. $7=(0).__at($8);
  7941. $ctx1.sendIdx["@"]=5;
  7942. $5=_st($6)._translateBy_($7);
  7943. $ctx1.sendIdx["translateBy:"]=2;
  7944. $9=(3).__at((2));
  7945. $ctx1.sendIdx["@"]=6;
  7946. self._assert_equals_($5,$9);
  7947. $ctx1.sendIdx["assert:equals:"]=2;
  7948. $11=(3).__at((3));
  7949. $ctx1.sendIdx["@"]=7;
  7950. $12=(2).__at((3));
  7951. $ctx1.sendIdx["@"]=8;
  7952. $10=_st($11)._translateBy_($12);
  7953. $ctx1.sendIdx["translateBy:"]=3;
  7954. $13=(5).__at((6));
  7955. $ctx1.sendIdx["@"]=9;
  7956. self._assert_equals_($10,$13);
  7957. $ctx1.sendIdx["assert:equals:"]=3;
  7958. $15=(3).__at((3));
  7959. $ctx1.sendIdx["@"]=10;
  7960. $16=_st((3)._negated()).__at((0));
  7961. $ctx1.sendIdx["@"]=11;
  7962. $14=_st($15)._translateBy_($16);
  7963. self._assert_equals_($14,(0).__at((3)));
  7964. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)})},
  7965. args: [],
  7966. 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.",
  7967. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7968. referencedClasses: []
  7969. }),
  7970. globals.PointTest);
  7971. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  7972. smalltalk.addMethod(
  7973. smalltalk.method({
  7974. selector: "testNextIfAbsent",
  7975. protocol: 'tests',
  7976. fn: function (){
  7977. var self=this;
  7978. var queue;
  7979. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7980. return smalltalk.withContext(function($ctx1) {
  7981. var $2,$1;
  7982. queue=_st($Queue())._new();
  7983. _st(queue)._nextPut_("index1");
  7984. $2=_st(queue)._nextIfAbsent_("empty");
  7985. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7986. $1=_st($2).__eq("index1");
  7987. $ctx1.sendIdx["="]=1;
  7988. self._assert_($1);
  7989. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7990. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)})},
  7991. args: [],
  7992. 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'",
  7993. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7994. referencedClasses: ["Queue"]
  7995. }),
  7996. globals.QueueTest);
  7997. smalltalk.addMethod(
  7998. smalltalk.method({
  7999. selector: "testQueueNext",
  8000. protocol: 'tests',
  8001. fn: function (){
  8002. var self=this;
  8003. var queue;
  8004. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8005. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  8006. return smalltalk.withContext(function($ctx1) {
  8007. var $1,$2,$4,$3,$6,$5;
  8008. queue=_st($Queue())._new();
  8009. $1=queue;
  8010. _st($1)._nextPut_("index1");
  8011. $ctx1.sendIdx["nextPut:"]=1;
  8012. $2=_st($1)._nextPut_("index2");
  8013. $4=_st(queue)._next();
  8014. $ctx1.sendIdx["next"]=1;
  8015. $3=_st($4).__eq("index1");
  8016. $ctx1.sendIdx["="]=1;
  8017. self._assert_($3);
  8018. $6=_st(queue)._next();
  8019. $ctx1.sendIdx["next"]=2;
  8020. $5=_st($6).__eq("index");
  8021. self._deny_($5);
  8022. self._should_raise_((function(){
  8023. return smalltalk.withContext(function($ctx2) {
  8024. return _st(queue)._next();
  8025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  8026. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)})},
  8027. args: [],
  8028. 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",
  8029. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  8030. referencedClasses: ["Queue", "Error"]
  8031. }),
  8032. globals.QueueTest);
  8033. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  8034. smalltalk.addMethod(
  8035. smalltalk.method({
  8036. selector: "testAtRandomNumber",
  8037. protocol: 'tests',
  8038. fn: function (){
  8039. var self=this;
  8040. var val;
  8041. return smalltalk.withContext(function($ctx1) {
  8042. (100)._timesRepeat_((function(){
  8043. return smalltalk.withContext(function($ctx2) {
  8044. val=(10)._atRandom();
  8045. val;
  8046. self._assert_(_st(val).__gt((0)));
  8047. $ctx2.sendIdx["assert:"]=1;
  8048. return self._assert_(_st(val).__lt((11)));
  8049. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8050. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)})},
  8051. args: [],
  8052. 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]",
  8053. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  8054. referencedClasses: []
  8055. }),
  8056. globals.RandomTest);
  8057. smalltalk.addMethod(
  8058. smalltalk.method({
  8059. selector: "testAtRandomSequenceableCollection",
  8060. protocol: 'tests',
  8061. fn: function (){
  8062. var self=this;
  8063. var val;
  8064. return smalltalk.withContext(function($ctx1) {
  8065. var $3,$4,$2,$1;
  8066. (100)._timesRepeat_((function(){
  8067. return smalltalk.withContext(function($ctx2) {
  8068. val="abc"._atRandom();
  8069. val;
  8070. $3=_st(val).__eq("a");
  8071. $ctx2.sendIdx["="]=1;
  8072. $4=_st(val).__eq("b");
  8073. $ctx2.sendIdx["="]=2;
  8074. $2=_st($3).__or($4);
  8075. $1=_st($2).__or(_st(val).__eq("c"));
  8076. $ctx2.sendIdx["|"]=1;
  8077. return self._assert_($1);
  8078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8079. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)})},
  8080. args: [],
  8081. 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].",
  8082. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  8083. referencedClasses: []
  8084. }),
  8085. globals.RandomTest);
  8086. smalltalk.addMethod(
  8087. smalltalk.method({
  8088. selector: "textNext",
  8089. protocol: 'tests',
  8090. fn: function (){
  8091. var self=this;
  8092. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  8093. return smalltalk.withContext(function($ctx1) {
  8094. var $1;
  8095. (10000)._timesRepeat_((function(){
  8096. var current,next;
  8097. return smalltalk.withContext(function($ctx2) {
  8098. next=_st(_st($Random())._new())._next();
  8099. next;
  8100. self._assert_(_st(next).__gt_eq((0)));
  8101. $ctx2.sendIdx["assert:"]=1;
  8102. self._assert_(_st(next).__lt((1)));
  8103. $1=_st(current).__eq(next);
  8104. $ctx2.sendIdx["="]=1;
  8105. self._deny_($1);
  8106. return _st(next).__eq(current);
  8107. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8108. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)})},
  8109. args: [],
  8110. 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 ]",
  8111. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8112. referencedClasses: ["Random"]
  8113. }),
  8114. globals.RandomTest);
  8115. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  8116. smalltalk.addMethod(
  8117. smalltalk.method({
  8118. selector: "collectionClass",
  8119. protocol: 'accessing',
  8120. fn: function (){
  8121. var self=this;
  8122. return smalltalk.withContext(function($ctx1) {
  8123. var $1;
  8124. $1=_st(self._class())._collectionClass();
  8125. return $1;
  8126. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)})},
  8127. args: [],
  8128. source: "collectionClass\x0a\x09^ self class collectionClass",
  8129. messageSends: ["collectionClass", "class"],
  8130. referencedClasses: []
  8131. }),
  8132. globals.StreamTest);
  8133. smalltalk.addMethod(
  8134. smalltalk.method({
  8135. selector: "newCollection",
  8136. protocol: 'accessing',
  8137. fn: function (){
  8138. var self=this;
  8139. return smalltalk.withContext(function($ctx1) {
  8140. var $1;
  8141. $1=_st(self._collectionClass())._new();
  8142. return $1;
  8143. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)})},
  8144. args: [],
  8145. source: "newCollection\x0a\x09^ self collectionClass new",
  8146. messageSends: ["new", "collectionClass"],
  8147. referencedClasses: []
  8148. }),
  8149. globals.StreamTest);
  8150. smalltalk.addMethod(
  8151. smalltalk.method({
  8152. selector: "newStream",
  8153. protocol: 'accessing',
  8154. fn: function (){
  8155. var self=this;
  8156. return smalltalk.withContext(function($ctx1) {
  8157. var $1;
  8158. $1=_st(_st(self._collectionClass())._new())._stream();
  8159. return $1;
  8160. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)})},
  8161. args: [],
  8162. source: "newStream\x0a\x09^ self collectionClass new stream",
  8163. messageSends: ["stream", "new", "collectionClass"],
  8164. referencedClasses: []
  8165. }),
  8166. globals.StreamTest);
  8167. smalltalk.addMethod(
  8168. smalltalk.method({
  8169. selector: "testAtStartAtEnd",
  8170. protocol: 'tests',
  8171. fn: function (){
  8172. var self=this;
  8173. var stream;
  8174. return smalltalk.withContext(function($ctx1) {
  8175. var $1,$2,$3,$4;
  8176. stream=self._newStream();
  8177. $1=_st(stream)._atStart();
  8178. $ctx1.sendIdx["atStart"]=1;
  8179. self._assert_($1);
  8180. $ctx1.sendIdx["assert:"]=1;
  8181. $2=_st(stream)._atEnd();
  8182. $ctx1.sendIdx["atEnd"]=1;
  8183. self._assert_($2);
  8184. $ctx1.sendIdx["assert:"]=2;
  8185. _st(stream)._nextPutAll_(self._newCollection());
  8186. $3=_st(stream)._atEnd();
  8187. $ctx1.sendIdx["atEnd"]=2;
  8188. self._assert_($3);
  8189. $4=_st(stream)._atStart();
  8190. $ctx1.sendIdx["atStart"]=2;
  8191. self._deny_($4);
  8192. $ctx1.sendIdx["deny:"]=1;
  8193. _st(stream)._position_((1));
  8194. self._deny_(_st(stream)._atEnd());
  8195. $ctx1.sendIdx["deny:"]=2;
  8196. self._deny_(_st(stream)._atStart());
  8197. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)})},
  8198. args: [],
  8199. 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",
  8200. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8201. referencedClasses: []
  8202. }),
  8203. globals.StreamTest);
  8204. smalltalk.addMethod(
  8205. smalltalk.method({
  8206. selector: "testContents",
  8207. protocol: 'tests',
  8208. fn: function (){
  8209. var self=this;
  8210. var stream;
  8211. return smalltalk.withContext(function($ctx1) {
  8212. var $1,$2;
  8213. stream=self._newStream();
  8214. $1=stream;
  8215. $2=self._newCollection();
  8216. $ctx1.sendIdx["newCollection"]=1;
  8217. _st($1)._nextPutAll_($2);
  8218. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8219. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)})},
  8220. args: [],
  8221. 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",
  8222. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8223. referencedClasses: []
  8224. }),
  8225. globals.StreamTest);
  8226. smalltalk.addMethod(
  8227. smalltalk.method({
  8228. selector: "testIsEmpty",
  8229. protocol: 'tests',
  8230. fn: function (){
  8231. var self=this;
  8232. var stream;
  8233. return smalltalk.withContext(function($ctx1) {
  8234. var $1;
  8235. stream=self._newStream();
  8236. $1=_st(stream)._isEmpty();
  8237. $ctx1.sendIdx["isEmpty"]=1;
  8238. self._assert_($1);
  8239. _st(stream)._nextPutAll_(self._newCollection());
  8240. self._deny_(_st(stream)._isEmpty());
  8241. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)})},
  8242. args: [],
  8243. 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",
  8244. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8245. referencedClasses: []
  8246. }),
  8247. globals.StreamTest);
  8248. smalltalk.addMethod(
  8249. smalltalk.method({
  8250. selector: "testPosition",
  8251. protocol: 'tests',
  8252. fn: function (){
  8253. var self=this;
  8254. var collection,stream;
  8255. return smalltalk.withContext(function($ctx1) {
  8256. var $1,$2,$3;
  8257. collection=self._newCollection();
  8258. stream=self._newStream();
  8259. _st(stream)._nextPutAll_(collection);
  8260. $1=_st(stream)._position();
  8261. $ctx1.sendIdx["position"]=1;
  8262. self._assert_equals_($1,_st(collection)._size());
  8263. $ctx1.sendIdx["assert:equals:"]=1;
  8264. _st(stream)._position_((0));
  8265. $2=_st(stream)._position();
  8266. $ctx1.sendIdx["position"]=2;
  8267. self._assert_equals_($2,(0));
  8268. $ctx1.sendIdx["assert:equals:"]=2;
  8269. _st(stream)._next();
  8270. $ctx1.sendIdx["next"]=1;
  8271. $3=_st(stream)._position();
  8272. $ctx1.sendIdx["position"]=3;
  8273. self._assert_equals_($3,(1));
  8274. $ctx1.sendIdx["assert:equals:"]=3;
  8275. _st(stream)._next();
  8276. self._assert_equals_(_st(stream)._position(),(2));
  8277. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)})},
  8278. args: [],
  8279. 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",
  8280. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8281. referencedClasses: []
  8282. }),
  8283. globals.StreamTest);
  8284. smalltalk.addMethod(
  8285. smalltalk.method({
  8286. selector: "testReading",
  8287. protocol: 'tests',
  8288. fn: function (){
  8289. var self=this;
  8290. var stream,collection;
  8291. return smalltalk.withContext(function($ctx1) {
  8292. var $1,$2,$3;
  8293. collection=self._newCollection();
  8294. stream=self._newStream();
  8295. $1=stream;
  8296. _st($1)._nextPutAll_(collection);
  8297. $2=_st($1)._position_((0));
  8298. _st(collection)._do_((function(each){
  8299. return smalltalk.withContext(function($ctx2) {
  8300. $3=_st(stream)._next();
  8301. $ctx2.sendIdx["next"]=1;
  8302. return self._assert_equals_($3,each);
  8303. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8304. self._assert_(_st(_st(stream)._next())._isNil());
  8305. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)})},
  8306. args: [],
  8307. 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",
  8308. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8309. referencedClasses: []
  8310. }),
  8311. globals.StreamTest);
  8312. smalltalk.addMethod(
  8313. smalltalk.method({
  8314. selector: "testStreamContents",
  8315. protocol: 'tests',
  8316. fn: function (){
  8317. var self=this;
  8318. return self},
  8319. args: [],
  8320. source: "testStreamContents",
  8321. messageSends: [],
  8322. referencedClasses: []
  8323. }),
  8324. globals.StreamTest);
  8325. smalltalk.addMethod(
  8326. smalltalk.method({
  8327. selector: "testWrite",
  8328. protocol: 'tests',
  8329. fn: function (){
  8330. var self=this;
  8331. var stream,collection;
  8332. return smalltalk.withContext(function($ctx1) {
  8333. collection=self._newCollection();
  8334. stream=self._newStream();
  8335. _st(collection)._do_((function(each){
  8336. return smalltalk.withContext(function($ctx2) {
  8337. return _st(stream).__lt_lt(each);
  8338. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8339. self._assert_equals_(_st(stream)._contents(),collection);
  8340. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)})},
  8341. args: [],
  8342. 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",
  8343. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8344. referencedClasses: []
  8345. }),
  8346. globals.StreamTest);
  8347. smalltalk.addMethod(
  8348. smalltalk.method({
  8349. selector: "testWriting",
  8350. protocol: 'tests',
  8351. fn: function (){
  8352. var self=this;
  8353. var stream,collection;
  8354. return smalltalk.withContext(function($ctx1) {
  8355. var $1;
  8356. collection=self._newCollection();
  8357. stream=self._newStream();
  8358. $ctx1.sendIdx["newStream"]=1;
  8359. _st(collection)._do_((function(each){
  8360. return smalltalk.withContext(function($ctx2) {
  8361. return _st(stream)._nextPut_(each);
  8362. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8363. $1=_st(stream)._contents();
  8364. $ctx1.sendIdx["contents"]=1;
  8365. self._assert_equals_($1,collection);
  8366. $ctx1.sendIdx["assert:equals:"]=1;
  8367. stream=self._newStream();
  8368. _st(stream)._nextPutAll_(collection);
  8369. self._assert_equals_(_st(stream)._contents(),collection);
  8370. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)})},
  8371. args: [],
  8372. 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",
  8373. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8374. referencedClasses: []
  8375. }),
  8376. globals.StreamTest);
  8377. smalltalk.addMethod(
  8378. smalltalk.method({
  8379. selector: "collectionClass",
  8380. protocol: 'accessing',
  8381. fn: function (){
  8382. var self=this;
  8383. return nil;
  8384. },
  8385. args: [],
  8386. source: "collectionClass\x0a\x09^ nil",
  8387. messageSends: [],
  8388. referencedClasses: []
  8389. }),
  8390. globals.StreamTest.klass);
  8391. smalltalk.addMethod(
  8392. smalltalk.method({
  8393. selector: "isAbstract",
  8394. protocol: 'testing',
  8395. fn: function (){
  8396. var self=this;
  8397. return smalltalk.withContext(function($ctx1) {
  8398. var $1;
  8399. $1=_st(self._collectionClass())._isNil();
  8400. return $1;
  8401. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)})},
  8402. args: [],
  8403. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8404. messageSends: ["isNil", "collectionClass"],
  8405. referencedClasses: []
  8406. }),
  8407. globals.StreamTest.klass);
  8408. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8409. smalltalk.addMethod(
  8410. smalltalk.method({
  8411. selector: "newCollection",
  8412. protocol: 'accessing',
  8413. fn: function (){
  8414. var self=this;
  8415. return smalltalk.withContext(function($ctx1) {
  8416. var $1;
  8417. $1=[true,(1),(3).__at((4)),"foo"];
  8418. return $1;
  8419. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)})},
  8420. args: [],
  8421. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8422. messageSends: ["@"],
  8423. referencedClasses: []
  8424. }),
  8425. globals.ArrayStreamTest);
  8426. smalltalk.addMethod(
  8427. smalltalk.method({
  8428. selector: "collectionClass",
  8429. protocol: 'accessing',
  8430. fn: function (){
  8431. var self=this;
  8432. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8433. return $Array();
  8434. },
  8435. args: [],
  8436. source: "collectionClass\x0a\x09^ Array",
  8437. messageSends: [],
  8438. referencedClasses: ["Array"]
  8439. }),
  8440. globals.ArrayStreamTest.klass);
  8441. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8442. smalltalk.addMethod(
  8443. smalltalk.method({
  8444. selector: "newCollection",
  8445. protocol: 'accessing',
  8446. fn: function (){
  8447. var self=this;
  8448. return "hello world";
  8449. },
  8450. args: [],
  8451. source: "newCollection\x0a\x09^ 'hello world'",
  8452. messageSends: [],
  8453. referencedClasses: []
  8454. }),
  8455. globals.StringStreamTest);
  8456. smalltalk.addMethod(
  8457. smalltalk.method({
  8458. selector: "collectionClass",
  8459. protocol: 'accessing',
  8460. fn: function (){
  8461. var self=this;
  8462. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8463. return $String();
  8464. },
  8465. args: [],
  8466. source: "collectionClass\x0a\x09^ String",
  8467. messageSends: [],
  8468. referencedClasses: ["String"]
  8469. }),
  8470. globals.StringStreamTest.klass);
  8471. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  8472. smalltalk.addMethod(
  8473. smalltalk.method({
  8474. selector: "testCopying",
  8475. protocol: 'tests',
  8476. fn: function (){
  8477. var self=this;
  8478. return smalltalk.withContext(function($ctx1) {
  8479. self._assert_equals_(nil._copy(),nil);
  8480. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)})},
  8481. args: [],
  8482. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8483. messageSends: ["assert:equals:", "copy"],
  8484. referencedClasses: []
  8485. }),
  8486. globals.UndefinedTest);
  8487. smalltalk.addMethod(
  8488. smalltalk.method({
  8489. selector: "testDeepCopy",
  8490. protocol: 'tests',
  8491. fn: function (){
  8492. var self=this;
  8493. return smalltalk.withContext(function($ctx1) {
  8494. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8495. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)})},
  8496. args: [],
  8497. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8498. messageSends: ["assert:", "=", "deepCopy"],
  8499. referencedClasses: []
  8500. }),
  8501. globals.UndefinedTest);
  8502. smalltalk.addMethod(
  8503. smalltalk.method({
  8504. selector: "testIfNil",
  8505. protocol: 'tests',
  8506. fn: function (){
  8507. var self=this;
  8508. return smalltalk.withContext(function($ctx1) {
  8509. var $1,$3,$2,$4,$6,$5,$receiver;
  8510. if(($receiver = nil) == null || $receiver.isNil){
  8511. $1=true;
  8512. } else {
  8513. $1=nil;
  8514. };
  8515. self._assert_equals_($1,true);
  8516. $ctx1.sendIdx["assert:equals:"]=1;
  8517. if(($receiver = nil) == null || $receiver.isNil){
  8518. $3=nil;
  8519. } else {
  8520. $3=true;
  8521. };
  8522. $2=_st($3).__eq(true);
  8523. $ctx1.sendIdx["="]=1;
  8524. self._deny_($2);
  8525. $ctx1.sendIdx["deny:"]=1;
  8526. if(($receiver = nil) == null || $receiver.isNil){
  8527. $4=true;
  8528. } else {
  8529. $4=false;
  8530. };
  8531. self._assert_equals_($4,true);
  8532. if(($receiver = nil) == null || $receiver.isNil){
  8533. $6=false;
  8534. } else {
  8535. $6=true;
  8536. };
  8537. $5=_st($6).__eq(true);
  8538. self._deny_($5);
  8539. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)})},
  8540. args: [],
  8541. 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",
  8542. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8543. referencedClasses: []
  8544. }),
  8545. globals.UndefinedTest);
  8546. smalltalk.addMethod(
  8547. smalltalk.method({
  8548. selector: "testIsNil",
  8549. protocol: 'tests',
  8550. fn: function (){
  8551. var self=this;
  8552. return smalltalk.withContext(function($ctx1) {
  8553. self._assert_(nil._isNil());
  8554. self._deny_(nil._notNil());
  8555. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)})},
  8556. args: [],
  8557. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8558. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8559. referencedClasses: []
  8560. }),
  8561. globals.UndefinedTest);
  8562. });