Kernel-Tests.js 320 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "testHandlesAnnouncement",
  8. protocol: 'tests',
  9. fn: function (){
  10. var self=this;
  11. var subscription,announcementClass1,announcementClass2,classBuilder;
  12. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  16. return smalltalk.withContext(function($ctx1) {
  17. var $1,$2;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  22. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  23. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  24. self._assert_equals_($1,true);
  25. $ctx1.sendIdx["assert:equals:"]=1;
  26. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  27. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  28. self._assert_equals_($2,true);
  29. $ctx1.sendIdx["assert:equals:"]=2;
  30. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  31. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  32. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},smalltalk.AnnouncementSubscriptionTest)})},
  33. args: [],
  34. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  35. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  36. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  37. }),
  38. smalltalk.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', smalltalk.TestCase, [], 'Kernel-Tests');
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "testOnDo",
  43. protocol: 'not yet classified',
  44. fn: function (){
  45. var self=this;
  46. var counter,announcer;
  47. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  49. return smalltalk.withContext(function($ctx1) {
  50. var $1,$2;
  51. counter=(0);
  52. announcer=_st($Announcer())._new();
  53. $ctx1.sendIdx["new"]=1;
  54. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  55. return smalltalk.withContext(function($ctx2) {
  56. counter=_st(counter).__plus((1));
  57. return counter;
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  59. $1=announcer;
  60. $2=_st($SystemAnnouncement())._new();
  61. $ctx1.sendIdx["new"]=2;
  62. _st($1)._announce_($2);
  63. $ctx1.sendIdx["announce:"]=1;
  64. self._assert_equals_(counter,(1));
  65. $ctx1.sendIdx["assert:equals:"]=1;
  66. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  67. self._assert_equals_(counter,(2));
  68. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  69. args: [],
  70. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  71. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  72. referencedClasses: ["Announcer", "SystemAnnouncement"]
  73. }),
  74. smalltalk.AnnouncerTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testOnDoOnce",
  78. protocol: 'not yet classified',
  79. fn: function (){
  80. var self=this;
  81. var counter,announcer;
  82. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  84. return smalltalk.withContext(function($ctx1) {
  85. var $1,$2;
  86. counter=(0);
  87. announcer=_st($Announcer())._new();
  88. $ctx1.sendIdx["new"]=1;
  89. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  90. return smalltalk.withContext(function($ctx2) {
  91. counter=_st(counter).__plus((1));
  92. return counter;
  93. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  94. $1=announcer;
  95. $2=_st($SystemAnnouncement())._new();
  96. $ctx1.sendIdx["new"]=2;
  97. _st($1)._announce_($2);
  98. $ctx1.sendIdx["announce:"]=1;
  99. self._assert_equals_(counter,(1));
  100. $ctx1.sendIdx["assert:equals:"]=1;
  101. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  102. self._assert_equals_(counter,(1));
  103. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  104. args: [],
  105. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  106. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  107. referencedClasses: ["Announcer", "SystemAnnouncement"]
  108. }),
  109. smalltalk.AnnouncerTest);
  110. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testCanClearInterval",
  114. protocol: 'tests',
  115. fn: function (){
  116. var self=this;
  117. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  118. return smalltalk.withContext(function($ctx1) {
  119. self._shouldnt_raise_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. return _st(_st((function(){
  122. return smalltalk.withContext(function($ctx3) {
  123. return _st(_st($Error())._new())._signal();
  124. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  126. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  127. args: [],
  128. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  129. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  130. referencedClasses: ["Error"]
  131. }),
  132. smalltalk.BlockClosureTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testCanClearTimeout",
  136. protocol: 'tests',
  137. fn: function (){
  138. var self=this;
  139. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  140. return smalltalk.withContext(function($ctx1) {
  141. self._shouldnt_raise_((function(){
  142. return smalltalk.withContext(function($ctx2) {
  143. return _st(_st((function(){
  144. return smalltalk.withContext(function($ctx3) {
  145. return _st(_st($Error())._new())._signal();
  146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  148. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  149. args: [],
  150. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  151. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  152. referencedClasses: ["Error"]
  153. }),
  154. smalltalk.BlockClosureTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testCompiledSource",
  158. protocol: 'tests',
  159. fn: function (){
  160. var self=this;
  161. return smalltalk.withContext(function($ctx1) {
  162. self._assert_(_st(_st((function(){
  163. return smalltalk.withContext(function($ctx2) {
  164. return (1).__plus((1));
  165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  166. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  167. args: [],
  168. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  169. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  170. referencedClasses: []
  171. }),
  172. smalltalk.BlockClosureTest);
  173. smalltalk.addMethod(
  174. smalltalk.method({
  175. selector: "testCurrySelf",
  176. protocol: 'tests',
  177. fn: function (){
  178. var self=this;
  179. var curriedMethod,array;
  180. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  181. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  182. return smalltalk.withContext(function($ctx1) {
  183. curriedMethod=_st(_st((function(selfarg,x){
  184. return smalltalk.withContext(function($ctx2) {
  185. return _st(selfarg)._at_(x);
  186. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  187. array=[(3), (1), (4)];
  188. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  189. _st((function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return self._assert_equals_(_st(array)._foo_((2)),(1));
  192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  193. return smalltalk.withContext(function($ctx2) {
  194. return _st($Array())._removeCompiledMethod_(curriedMethod);
  195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  196. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  197. args: [],
  198. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  199. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  200. referencedClasses: ["ClassBuilder", "Array"]
  201. }),
  202. smalltalk.BlockClosureTest);
  203. smalltalk.addMethod(
  204. smalltalk.method({
  205. selector: "testEnsure",
  206. protocol: 'tests',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. self._assert_equals_(_st((function(){
  211. return smalltalk.withContext(function($ctx2) {
  212. return (3);
  213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  214. return smalltalk.withContext(function($ctx2) {
  215. return (4);
  216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  217. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  218. args: [],
  219. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  220. messageSends: ["assert:equals:", "ensure:"],
  221. referencedClasses: []
  222. }),
  223. smalltalk.BlockClosureTest);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "testEnsureRaises",
  227. protocol: 'tests',
  228. fn: function (){
  229. var self=this;
  230. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  231. return smalltalk.withContext(function($ctx1) {
  232. self._should_raise_((function(){
  233. return smalltalk.withContext(function($ctx2) {
  234. return _st((function(){
  235. return smalltalk.withContext(function($ctx3) {
  236. return _st(_st($Error())._new())._signal();
  237. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  238. return smalltalk.withContext(function($ctx3) {
  239. return true;
  240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  242. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  243. args: [],
  244. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  245. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  246. referencedClasses: ["Error"]
  247. }),
  248. smalltalk.BlockClosureTest);
  249. smalltalk.addMethod(
  250. smalltalk.method({
  251. selector: "testExceptionSemantics",
  252. protocol: 'tests',
  253. fn: function (){
  254. var self=this;
  255. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  256. return smalltalk.withContext(function($ctx1) {
  257. self._timeout_((100));
  258. _st(self._async_((function(){
  259. return smalltalk.withContext(function($ctx2) {
  260. return _st((function(){
  261. return smalltalk.withContext(function($ctx3) {
  262. self._assert_(true);
  263. _st($Error())._signal();
  264. self._deny_(true);
  265. return self._finished();
  266. $ctx3.sendIdx["finished"]=1;
  267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  268. return smalltalk.withContext(function($ctx3) {
  269. return self._finished();
  270. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  272. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  273. args: [],
  274. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  275. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  276. referencedClasses: ["Error"]
  277. }),
  278. smalltalk.BlockClosureTest);
  279. smalltalk.addMethod(
  280. smalltalk.method({
  281. selector: "testNewWithValues",
  282. protocol: 'tests',
  283. fn: function (){
  284. var self=this;
  285. return smalltalk.withContext(function($ctx1) {
  286. function theTestPrototype() {this.name = "theTestPrototype";}
  287. function theTestConstructor(arg1, arg2, arg3) {}
  288. theTestConstructor.prototype = new theTestPrototype;
  289. var theWrappedConstructor = _st(theTestConstructor);
  290. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);
  291. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  292. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  293. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  294. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  295. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  296. args: [],
  297. source: "testNewWithValues\x0a<\x0a\x09function theTestPrototype() {this.name = \x22theTestPrototype\x22;}\x0a\x09function theTestConstructor(arg1, arg2, arg3) {}\x0a\x09theTestConstructor.prototype = new theTestPrototype;\x0a\x0a\x09var theWrappedConstructor = _st(theTestConstructor);\x0a\x09var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}\x0a\x09self._should_raise_(_st(constructionShouldFail), smalltalk.Error);\x0a>",
  298. messageSends: [],
  299. referencedClasses: []
  300. }),
  301. smalltalk.BlockClosureTest);
  302. smalltalk.addMethod(
  303. smalltalk.method({
  304. selector: "testNumArgs",
  305. protocol: 'tests',
  306. fn: function (){
  307. var self=this;
  308. return smalltalk.withContext(function($ctx1) {
  309. var $1;
  310. $1=_st((function(){
  311. return smalltalk.withContext(function($ctx2) {
  312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  313. $ctx1.sendIdx["numArgs"]=1;
  314. self._assert_equals_($1,(0));
  315. $ctx1.sendIdx["assert:equals:"]=1;
  316. self._assert_equals_(_st((function(a,b){
  317. return smalltalk.withContext(function($ctx2) {
  318. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs(),(2));
  319. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  320. args: [],
  321. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  322. messageSends: ["assert:equals:", "numArgs"],
  323. referencedClasses: []
  324. }),
  325. smalltalk.BlockClosureTest);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "testOnDo",
  329. protocol: 'tests',
  330. fn: function (){
  331. var self=this;
  332. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  333. return smalltalk.withContext(function($ctx1) {
  334. self._assert_(_st((function(){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st(_st($Error())._new())._signal();
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  338. return smalltalk.withContext(function($ctx2) {
  339. return true;
  340. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  341. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  342. args: [],
  343. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  344. messageSends: ["assert:", "on:do:", "signal", "new"],
  345. referencedClasses: ["Error"]
  346. }),
  347. smalltalk.BlockClosureTest);
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "testValue",
  351. protocol: 'tests',
  352. fn: function (){
  353. var self=this;
  354. return smalltalk.withContext(function($ctx1) {
  355. var $1;
  356. $1=_st((function(){
  357. return smalltalk.withContext(function($ctx2) {
  358. return (1).__plus((1));
  359. $ctx2.sendIdx["+"]=1;
  360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  361. $ctx1.sendIdx["value"]=1;
  362. self._assert_equals_($1,(2));
  363. $ctx1.sendIdx["assert:equals:"]=1;
  364. self._assert_equals_(_st((function(x){
  365. return smalltalk.withContext(function($ctx2) {
  366. return _st(x).__plus((1));
  367. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  368. $ctx1.sendIdx["assert:equals:"]=2;
  369. self._assert_equals_(_st((function(x,y){
  370. return smalltalk.withContext(function($ctx2) {
  371. return _st(x).__star(y);
  372. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  373. $ctx1.sendIdx["assert:equals:"]=3;
  374. self._assert_equals_(_st((function(a,b,c){
  375. return smalltalk.withContext(function($ctx2) {
  376. return (1);
  377. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value(),(1));
  378. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  379. args: [],
  380. source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1",
  381. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  382. referencedClasses: []
  383. }),
  384. smalltalk.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testValueWithPossibleArguments",
  388. protocol: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1,$2;
  393. $1=_st((function(){
  394. return smalltalk.withContext(function($ctx2) {
  395. return (1);
  396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  397. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  398. self._assert_equals_($1,(1));
  399. $ctx1.sendIdx["assert:equals:"]=1;
  400. $2=_st((function(a){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(a).__plus((4));
  403. $ctx2.sendIdx["+"]=1;
  404. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  405. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  406. self._assert_equals_($2,(7));
  407. $ctx1.sendIdx["assert:equals:"]=2;
  408. self._assert_equals_(_st((function(a,b){
  409. return smalltalk.withContext(function($ctx2) {
  410. return _st(a).__plus(b);
  411. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  412. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  413. args: [],
  414. source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  415. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  416. referencedClasses: []
  417. }),
  418. smalltalk.BlockClosureTest);
  419. smalltalk.addMethod(
  420. smalltalk.method({
  421. selector: "testWhileFalse",
  422. protocol: 'tests',
  423. fn: function (){
  424. var self=this;
  425. var i;
  426. return smalltalk.withContext(function($ctx1) {
  427. i=(0);
  428. _st((function(){
  429. return smalltalk.withContext(function($ctx2) {
  430. return _st(i).__gt((5));
  431. $ctx2.sendIdx[">"]=1;
  432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  433. return smalltalk.withContext(function($ctx2) {
  434. i=_st(i).__plus((1));
  435. $ctx2.sendIdx["+"]=1;
  436. return i;
  437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  438. self._assert_equals_(i,(6));
  439. $ctx1.sendIdx["assert:equals:"]=1;
  440. i=(0);
  441. _st((function(){
  442. return smalltalk.withContext(function($ctx2) {
  443. i=_st(i).__plus((1));
  444. i;
  445. return _st(i).__gt((5));
  446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  447. self._assert_equals_(i,(6));
  448. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  449. args: [],
  450. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6",
  451. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  452. referencedClasses: []
  453. }),
  454. smalltalk.BlockClosureTest);
  455. smalltalk.addMethod(
  456. smalltalk.method({
  457. selector: "testWhileTrue",
  458. protocol: 'tests',
  459. fn: function (){
  460. var self=this;
  461. var i;
  462. return smalltalk.withContext(function($ctx1) {
  463. i=(0);
  464. _st((function(){
  465. return smalltalk.withContext(function($ctx2) {
  466. return _st(i).__lt((5));
  467. $ctx2.sendIdx["<"]=1;
  468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  469. return smalltalk.withContext(function($ctx2) {
  470. i=_st(i).__plus((1));
  471. $ctx2.sendIdx["+"]=1;
  472. return i;
  473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  474. self._assert_equals_(i,(5));
  475. $ctx1.sendIdx["assert:equals:"]=1;
  476. i=(0);
  477. _st((function(){
  478. return smalltalk.withContext(function($ctx2) {
  479. i=_st(i).__plus((1));
  480. i;
  481. return _st(i).__lt((5));
  482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  483. self._assert_equals_(i,(5));
  484. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  485. args: [],
  486. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5",
  487. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  488. referencedClasses: []
  489. }),
  490. smalltalk.BlockClosureTest);
  491. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "testEquality",
  495. protocol: 'tests',
  496. fn: function (){
  497. var self=this;
  498. return smalltalk.withContext(function($ctx1) {
  499. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  500. $1=(0).__eq(false);
  501. $ctx1.sendIdx["="]=1;
  502. self._deny_($1);
  503. $ctx1.sendIdx["deny:"]=1;
  504. $2=false.__eq((0));
  505. $ctx1.sendIdx["="]=2;
  506. self._deny_($2);
  507. $ctx1.sendIdx["deny:"]=2;
  508. $3="".__eq(false);
  509. $ctx1.sendIdx["="]=3;
  510. self._deny_($3);
  511. $ctx1.sendIdx["deny:"]=3;
  512. $4=false.__eq("");
  513. $ctx1.sendIdx["="]=4;
  514. self._deny_($4);
  515. $ctx1.sendIdx["deny:"]=4;
  516. $5=true.__eq(true);
  517. $ctx1.sendIdx["="]=5;
  518. self._assert_($5);
  519. $ctx1.sendIdx["assert:"]=1;
  520. $6=false.__eq(true);
  521. $ctx1.sendIdx["="]=6;
  522. self._deny_($6);
  523. $ctx1.sendIdx["deny:"]=5;
  524. $7=true.__eq(false);
  525. $ctx1.sendIdx["="]=7;
  526. self._deny_($7);
  527. $8=false.__eq(false);
  528. $ctx1.sendIdx["="]=8;
  529. self._assert_($8);
  530. $ctx1.sendIdx["assert:"]=2;
  531. $10=true._yourself();
  532. $ctx1.sendIdx["yourself"]=1;
  533. $9=_st($10).__eq(true);
  534. $ctx1.sendIdx["="]=9;
  535. self._assert_($9);
  536. $ctx1.sendIdx["assert:"]=3;
  537. $12=true._yourself();
  538. $ctx1.sendIdx["yourself"]=2;
  539. $11=_st($12).__eq(true._yourself());
  540. self._assert_($11);
  541. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  542. args: [],
  543. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)",
  544. messageSends: ["deny:", "=", "assert:", "yourself"],
  545. referencedClasses: []
  546. }),
  547. smalltalk.BooleanTest);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "testIdentity",
  551. protocol: 'tests',
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) {
  555. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  556. $1=(0).__eq_eq(false);
  557. $ctx1.sendIdx["=="]=1;
  558. self._deny_($1);
  559. $ctx1.sendIdx["deny:"]=1;
  560. $2=false.__eq_eq((0));
  561. $ctx1.sendIdx["=="]=2;
  562. self._deny_($2);
  563. $ctx1.sendIdx["deny:"]=2;
  564. $3="".__eq_eq(false);
  565. $ctx1.sendIdx["=="]=3;
  566. self._deny_($3);
  567. $ctx1.sendIdx["deny:"]=3;
  568. $4=false.__eq_eq("");
  569. $ctx1.sendIdx["=="]=4;
  570. self._deny_($4);
  571. $ctx1.sendIdx["deny:"]=4;
  572. $5=true.__eq_eq(true);
  573. $ctx1.sendIdx["=="]=5;
  574. self._assert_($5);
  575. $ctx1.sendIdx["assert:"]=1;
  576. $6=false.__eq_eq(true);
  577. $ctx1.sendIdx["=="]=6;
  578. self._deny_($6);
  579. $ctx1.sendIdx["deny:"]=5;
  580. $7=true.__eq_eq(false);
  581. $ctx1.sendIdx["=="]=7;
  582. self._deny_($7);
  583. $8=false.__eq_eq(false);
  584. $ctx1.sendIdx["=="]=8;
  585. self._assert_($8);
  586. $ctx1.sendIdx["assert:"]=2;
  587. $10=true._yourself();
  588. $ctx1.sendIdx["yourself"]=1;
  589. $9=_st($10).__eq_eq(true);
  590. $ctx1.sendIdx["=="]=9;
  591. self._assert_($9);
  592. $ctx1.sendIdx["assert:"]=3;
  593. $12=true._yourself();
  594. $ctx1.sendIdx["yourself"]=2;
  595. $11=_st($12).__eq_eq(true._yourself());
  596. self._assert_($11);
  597. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  598. args: [],
  599. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  600. messageSends: ["deny:", "==", "assert:", "yourself"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.BooleanTest);
  604. smalltalk.addMethod(
  605. smalltalk.method({
  606. selector: "testIfTrueIfFalse",
  607. protocol: 'tests',
  608. fn: function (){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) {
  611. var $1,$2,$3,$4,$5,$6,$7,$8;
  612. if(smalltalk.assert(true)){
  613. $1="alternative block";
  614. };
  615. self._assert_equals_($1,"alternative block");
  616. $ctx1.sendIdx["assert:equals:"]=1;
  617. if(! smalltalk.assert(true)){
  618. $2="alternative block";
  619. };
  620. self._assert_equals_($2,nil);
  621. $ctx1.sendIdx["assert:equals:"]=2;
  622. if(smalltalk.assert(false)){
  623. $3="alternative block";
  624. };
  625. self._assert_equals_($3,nil);
  626. $ctx1.sendIdx["assert:equals:"]=3;
  627. if(! smalltalk.assert(false)){
  628. $4="alternative block";
  629. };
  630. self._assert_equals_($4,"alternative block");
  631. $ctx1.sendIdx["assert:equals:"]=4;
  632. if(smalltalk.assert(false)){
  633. $5="alternative block";
  634. } else {
  635. $5="alternative block2";
  636. };
  637. self._assert_equals_($5,"alternative block2");
  638. $ctx1.sendIdx["assert:equals:"]=5;
  639. if(smalltalk.assert(false)){
  640. $6="alternative block2";
  641. } else {
  642. $6="alternative block";
  643. };
  644. self._assert_equals_($6,"alternative block");
  645. $ctx1.sendIdx["assert:equals:"]=6;
  646. if(smalltalk.assert(true)){
  647. $7="alternative block";
  648. } else {
  649. $7="alternative block2";
  650. };
  651. self._assert_equals_($7,"alternative block");
  652. $ctx1.sendIdx["assert:equals:"]=7;
  653. if(smalltalk.assert(true)){
  654. $8="alternative block2";
  655. } else {
  656. $8="alternative block";
  657. };
  658. self._assert_equals_($8,"alternative block2");
  659. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  660. args: [],
  661. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  662. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  663. referencedClasses: []
  664. }),
  665. smalltalk.BooleanTest);
  666. smalltalk.addMethod(
  667. smalltalk.method({
  668. selector: "testIfTrueIfFalseWithBoxing",
  669. protocol: 'tests',
  670. fn: function (){
  671. var self=this;
  672. return smalltalk.withContext(function($ctx1) {
  673. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  674. $2=true._yourself();
  675. $ctx1.sendIdx["yourself"]=1;
  676. if(smalltalk.assert($2)){
  677. $1="alternative block";
  678. };
  679. self._assert_equals_($1,"alternative block");
  680. $ctx1.sendIdx["assert:equals:"]=1;
  681. $4=true._yourself();
  682. $ctx1.sendIdx["yourself"]=2;
  683. if(! smalltalk.assert($4)){
  684. $3="alternative block";
  685. };
  686. self._assert_equals_($3,nil);
  687. $ctx1.sendIdx["assert:equals:"]=2;
  688. $6=false._yourself();
  689. $ctx1.sendIdx["yourself"]=3;
  690. if(smalltalk.assert($6)){
  691. $5="alternative block";
  692. };
  693. self._assert_equals_($5,nil);
  694. $ctx1.sendIdx["assert:equals:"]=3;
  695. $8=false._yourself();
  696. $ctx1.sendIdx["yourself"]=4;
  697. if(! smalltalk.assert($8)){
  698. $7="alternative block";
  699. };
  700. self._assert_equals_($7,"alternative block");
  701. $ctx1.sendIdx["assert:equals:"]=4;
  702. $10=false._yourself();
  703. $ctx1.sendIdx["yourself"]=5;
  704. if(smalltalk.assert($10)){
  705. $9="alternative block";
  706. } else {
  707. $9="alternative block2";
  708. };
  709. self._assert_equals_($9,"alternative block2");
  710. $ctx1.sendIdx["assert:equals:"]=5;
  711. $12=false._yourself();
  712. $ctx1.sendIdx["yourself"]=6;
  713. if(smalltalk.assert($12)){
  714. $11="alternative block2";
  715. } else {
  716. $11="alternative block";
  717. };
  718. self._assert_equals_($11,"alternative block");
  719. $ctx1.sendIdx["assert:equals:"]=6;
  720. $14=true._yourself();
  721. $ctx1.sendIdx["yourself"]=7;
  722. if(smalltalk.assert($14)){
  723. $13="alternative block";
  724. } else {
  725. $13="alternative block2";
  726. };
  727. self._assert_equals_($13,"alternative block");
  728. $ctx1.sendIdx["assert:equals:"]=7;
  729. $16=true._yourself();
  730. if(smalltalk.assert($16)){
  731. $15="alternative block2";
  732. } else {
  733. $15="alternative block";
  734. };
  735. self._assert_equals_($15,"alternative block2");
  736. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  737. args: [],
  738. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  739. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  740. referencedClasses: []
  741. }),
  742. smalltalk.BooleanTest);
  743. smalltalk.addMethod(
  744. smalltalk.method({
  745. selector: "testLogic",
  746. protocol: 'tests',
  747. fn: function (){
  748. var self=this;
  749. return smalltalk.withContext(function($ctx1) {
  750. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  751. $1=true.__and(true);
  752. $ctx1.sendIdx["&"]=1;
  753. self._assert_($1);
  754. $ctx1.sendIdx["assert:"]=1;
  755. $2=true.__and(false);
  756. $ctx1.sendIdx["&"]=2;
  757. self._deny_($2);
  758. $ctx1.sendIdx["deny:"]=1;
  759. $3=false.__and(true);
  760. $ctx1.sendIdx["&"]=3;
  761. self._deny_($3);
  762. $ctx1.sendIdx["deny:"]=2;
  763. $5=false.__and(false);
  764. $ctx1.sendIdx["&"]=4;
  765. $4=self._deny_($5);
  766. $ctx1.sendIdx["deny:"]=3;
  767. $6=true.__or(true);
  768. $ctx1.sendIdx["|"]=1;
  769. self._assert_($6);
  770. $ctx1.sendIdx["assert:"]=2;
  771. $7=true.__or(false);
  772. $ctx1.sendIdx["|"]=2;
  773. self._assert_($7);
  774. $ctx1.sendIdx["assert:"]=3;
  775. $8=false.__or(true);
  776. $ctx1.sendIdx["|"]=3;
  777. self._assert_($8);
  778. $ctx1.sendIdx["assert:"]=4;
  779. $10=false.__or(false);
  780. $ctx1.sendIdx["|"]=4;
  781. $9=self._deny_($10);
  782. $ctx1.sendIdx["deny:"]=4;
  783. $12=(1).__gt((0));
  784. $ctx1.sendIdx[">"]=1;
  785. $11=true.__and($12);
  786. $ctx1.sendIdx["&"]=5;
  787. self._assert_($11);
  788. $ctx1.sendIdx["assert:"]=5;
  789. $14=(1).__gt((0));
  790. $ctx1.sendIdx[">"]=2;
  791. $13=_st($14).__and(false);
  792. $ctx1.sendIdx["&"]=6;
  793. self._deny_($13);
  794. $ctx1.sendIdx["deny:"]=5;
  795. $17=(1).__gt((0));
  796. $ctx1.sendIdx[">"]=3;
  797. $18=(1).__gt((2));
  798. $ctx1.sendIdx[">"]=4;
  799. $16=_st($17).__and($18);
  800. $15=self._deny_($16);
  801. $20=(1).__gt((0));
  802. $ctx1.sendIdx[">"]=5;
  803. $19=false.__or($20);
  804. $ctx1.sendIdx["|"]=5;
  805. self._assert_($19);
  806. $ctx1.sendIdx["assert:"]=6;
  807. $22=(1).__gt((0));
  808. $ctx1.sendIdx[">"]=6;
  809. $21=_st($22).__or(false);
  810. $ctx1.sendIdx["|"]=6;
  811. self._assert_($21);
  812. $ctx1.sendIdx["assert:"]=7;
  813. $25=(1).__gt((0));
  814. $ctx1.sendIdx[">"]=7;
  815. $24=_st($25).__or((1).__gt((2)));
  816. $23=self._assert_($24);
  817. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  818. args: [],
  819. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  820. messageSends: ["assert:", "&", "deny:", "|", ">"],
  821. referencedClasses: []
  822. }),
  823. smalltalk.BooleanTest);
  824. smalltalk.addMethod(
  825. smalltalk.method({
  826. selector: "testLogicKeywords",
  827. protocol: 'tests',
  828. fn: function (){
  829. var self=this;
  830. return smalltalk.withContext(function($ctx1) {
  831. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  832. $1=true._and_((function(){
  833. return smalltalk.withContext(function($ctx2) {
  834. return true;
  835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  836. $ctx1.sendIdx["and:"]=1;
  837. self._assert_($1);
  838. $ctx1.sendIdx["assert:"]=1;
  839. $2=true._and_((function(){
  840. return smalltalk.withContext(function($ctx2) {
  841. return false;
  842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  843. $ctx1.sendIdx["and:"]=2;
  844. self._deny_($2);
  845. $ctx1.sendIdx["deny:"]=1;
  846. $3=false._and_((function(){
  847. return smalltalk.withContext(function($ctx2) {
  848. return true;
  849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  850. $ctx1.sendIdx["and:"]=3;
  851. self._deny_($3);
  852. $ctx1.sendIdx["deny:"]=2;
  853. $5=false._and_((function(){
  854. return smalltalk.withContext(function($ctx2) {
  855. return false;
  856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  857. $ctx1.sendIdx["and:"]=4;
  858. $4=self._deny_($5);
  859. $ctx1.sendIdx["deny:"]=3;
  860. $6=true._or_((function(){
  861. return smalltalk.withContext(function($ctx2) {
  862. return true;
  863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  864. $ctx1.sendIdx["or:"]=1;
  865. self._assert_($6);
  866. $ctx1.sendIdx["assert:"]=2;
  867. $7=true._or_((function(){
  868. return smalltalk.withContext(function($ctx2) {
  869. return false;
  870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  871. $ctx1.sendIdx["or:"]=2;
  872. self._assert_($7);
  873. $ctx1.sendIdx["assert:"]=3;
  874. $8=false._or_((function(){
  875. return smalltalk.withContext(function($ctx2) {
  876. return true;
  877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  878. $ctx1.sendIdx["or:"]=3;
  879. self._assert_($8);
  880. $ctx1.sendIdx["assert:"]=4;
  881. $10=false._or_((function(){
  882. return smalltalk.withContext(function($ctx2) {
  883. return false;
  884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  885. $ctx1.sendIdx["or:"]=4;
  886. $9=self._deny_($10);
  887. $ctx1.sendIdx["deny:"]=4;
  888. $11=true._and_((function(){
  889. return smalltalk.withContext(function($ctx2) {
  890. return (1).__gt((0));
  891. $ctx2.sendIdx[">"]=1;
  892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  893. $ctx1.sendIdx["and:"]=5;
  894. self._assert_($11);
  895. $ctx1.sendIdx["assert:"]=5;
  896. $13=(1).__gt((0));
  897. $ctx1.sendIdx[">"]=2;
  898. $12=_st($13)._and_((function(){
  899. return smalltalk.withContext(function($ctx2) {
  900. return false;
  901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  902. $ctx1.sendIdx["and:"]=6;
  903. self._deny_($12);
  904. $ctx1.sendIdx["deny:"]=5;
  905. $16=(1).__gt((0));
  906. $ctx1.sendIdx[">"]=3;
  907. $15=_st($16)._and_((function(){
  908. return smalltalk.withContext(function($ctx2) {
  909. return (1).__gt((2));
  910. $ctx2.sendIdx[">"]=4;
  911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  912. $14=self._deny_($15);
  913. $17=false._or_((function(){
  914. return smalltalk.withContext(function($ctx2) {
  915. return (1).__gt((0));
  916. $ctx2.sendIdx[">"]=5;
  917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  918. $ctx1.sendIdx["or:"]=5;
  919. self._assert_($17);
  920. $ctx1.sendIdx["assert:"]=6;
  921. $19=(1).__gt((0));
  922. $ctx1.sendIdx[">"]=6;
  923. $18=_st($19)._or_((function(){
  924. return smalltalk.withContext(function($ctx2) {
  925. return false;
  926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  927. $ctx1.sendIdx["or:"]=6;
  928. self._assert_($18);
  929. $ctx1.sendIdx["assert:"]=7;
  930. $22=(1).__gt((0));
  931. $ctx1.sendIdx[">"]=7;
  932. $21=_st($22)._or_((function(){
  933. return smalltalk.withContext(function($ctx2) {
  934. return (1).__gt((2));
  935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  936. $20=self._assert_($21);
  937. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  938. args: [],
  939. source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  940. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  941. referencedClasses: []
  942. }),
  943. smalltalk.BooleanTest);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "testNonBooleanError",
  947. protocol: 'tests',
  948. fn: function (){
  949. var self=this;
  950. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  951. return smalltalk.withContext(function($ctx1) {
  952. self._should_raise_((function(){
  953. return smalltalk.withContext(function($ctx2) {
  954. if(smalltalk.assert("")){
  955. } else {
  956. };
  957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  958. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  959. args: [],
  960. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  961. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  962. referencedClasses: ["NonBooleanReceiver"]
  963. }),
  964. smalltalk.BooleanTest);
  965. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "setUp",
  969. protocol: 'running',
  970. fn: function (){
  971. var self=this;
  972. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  973. return smalltalk.withContext(function($ctx1) {
  974. self["@builder"]=_st($ClassBuilder())._new();
  975. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  976. args: [],
  977. source: "setUp\x0a\x09builder := ClassBuilder new",
  978. messageSends: ["new"],
  979. referencedClasses: ["ClassBuilder"]
  980. }),
  981. smalltalk.ClassBuilderTest);
  982. smalltalk.addMethod(
  983. smalltalk.method({
  984. selector: "tearDown",
  985. protocol: 'running',
  986. fn: function (){
  987. var self=this;
  988. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  989. return smalltalk.withContext(function($ctx1) {
  990. var $1;
  991. $1=self["@theClass"];
  992. if(($receiver = $1) == nil || $receiver == null){
  993. $1;
  994. } else {
  995. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  996. self["@theClass"]=nil;
  997. self["@theClass"];
  998. };
  999. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  1000. args: [],
  1001. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk current removeClass: theClass. theClass := nil ]",
  1002. messageSends: ["ifNotNil:", "removeClass:", "current"],
  1003. referencedClasses: ["Smalltalk"]
  1004. }),
  1005. smalltalk.ClassBuilderTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "testClassCopy",
  1009. protocol: 'tests',
  1010. fn: function (){
  1011. var self=this;
  1012. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1013. return smalltalk.withContext(function($ctx1) {
  1014. var $2,$1,$4,$3,$6,$5,$8,$7;
  1015. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1016. $2=_st(self["@theClass"])._superclass();
  1017. $ctx1.sendIdx["superclass"]=1;
  1018. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1019. $ctx1.sendIdx["=="]=1;
  1020. self._assert_($1);
  1021. $ctx1.sendIdx["assert:"]=1;
  1022. $4=_st(self["@theClass"])._instanceVariableNames();
  1023. $ctx1.sendIdx["instanceVariableNames"]=1;
  1024. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1025. $ctx1.sendIdx["=="]=2;
  1026. self._assert_($3);
  1027. $ctx1.sendIdx["assert:"]=2;
  1028. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1029. $ctx1.sendIdx["assert:equals:"]=1;
  1030. $6=_st(self["@theClass"])._package();
  1031. $ctx1.sendIdx["package"]=1;
  1032. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1033. self._assert_($5);
  1034. $8=_st(self["@theClass"])._methodDictionary();
  1035. $ctx1.sendIdx["methodDictionary"]=1;
  1036. $7=_st($8)._keys();
  1037. $ctx1.sendIdx["keys"]=1;
  1038. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1039. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  1040. args: [],
  1041. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  1042. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1043. referencedClasses: ["ObjectMock"]
  1044. }),
  1045. smalltalk.ClassBuilderTest);
  1046. smalltalk.addMethod(
  1047. smalltalk.method({
  1048. selector: "testClassMigration",
  1049. protocol: 'tests',
  1050. fn: function (){
  1051. var self=this;
  1052. var instance,oldClass;
  1053. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1054. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1055. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1056. return smalltalk.withContext(function($ctx1) {
  1057. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10,$14,$13,$12;
  1058. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1059. $2=_st($Smalltalk())._current();
  1060. $ctx1.sendIdx["current"]=1;
  1061. $1=_st($2)._at_("ObjectMock2");
  1062. $ctx1.sendIdx["at:"]=1;
  1063. instance=_st($1)._new();
  1064. $4=_st($Smalltalk())._current();
  1065. $ctx1.sendIdx["current"]=2;
  1066. $3=_st($4)._at_("ObjectMock2");
  1067. $ctx1.sendIdx["at:"]=2;
  1068. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1069. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1070. $ctx1.sendIdx["=="]=1;
  1071. self._deny_($5);
  1072. $ctx1.sendIdx["deny:"]=1;
  1073. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1074. $ctx1.sendIdx["=="]=2;
  1075. self._assert_($6);
  1076. $ctx1.sendIdx["assert:"]=1;
  1077. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1078. $ctx1.sendIdx["assert:"]=2;
  1079. $7=_st($ObjectMock2())._selectors();
  1080. $ctx1.sendIdx["selectors"]=1;
  1081. self._assert_equals_($7,_st(oldClass)._selectors());
  1082. $ctx1.sendIdx["assert:equals:"]=1;
  1083. $8=_st($ObjectMock2())._comment();
  1084. $ctx1.sendIdx["comment"]=1;
  1085. self._assert_equals_($8,_st(oldClass)._comment());
  1086. $ctx1.sendIdx["assert:equals:"]=2;
  1087. $9=_st(_st($ObjectMock2())._package())._name();
  1088. $ctx1.sendIdx["name"]=1;
  1089. self._assert_equals_($9,"Kernel-Tests");
  1090. $11=_st(instance)._class();
  1091. $ctx1.sendIdx["class"]=1;
  1092. $10=_st($11).__eq_eq($ObjectMock2());
  1093. self._deny_($10);
  1094. $14=_st($Smalltalk())._current();
  1095. $ctx1.sendIdx["current"]=3;
  1096. $13=_st($14)._at_(_st(_st(instance)._class())._name());
  1097. $12=_st($13)._isNil();
  1098. self._assert_($12);
  1099. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1100. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  1101. args: [],
  1102. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk current at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk current at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1103. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1104. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1105. }),
  1106. smalltalk.ClassBuilderTest);
  1107. smalltalk.addMethod(
  1108. smalltalk.method({
  1109. selector: "testClassMigrationWithClassInstanceVariables",
  1110. protocol: 'tests',
  1111. fn: function (){
  1112. var self=this;
  1113. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1114. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1115. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1116. return smalltalk.withContext(function($ctx1) {
  1117. var $1,$3,$2;
  1118. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1119. $1=_st($ObjectMock2())._class();
  1120. $ctx1.sendIdx["class"]=1;
  1121. _st($1)._instanceVariableNames_("foo bar");
  1122. $3=_st($Smalltalk())._current();
  1123. $ctx1.sendIdx["current"]=1;
  1124. $2=_st($3)._at_("ObjectMock2");
  1125. _st($ObjectMock())._subclass_instanceVariableNames_package_($2,"","Kernel-Tests");
  1126. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1127. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1128. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  1129. args: [],
  1130. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1131. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1132. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1133. }),
  1134. smalltalk.ClassBuilderTest);
  1135. smalltalk.addMethod(
  1136. smalltalk.method({
  1137. selector: "testClassMigrationWithSubclasses",
  1138. protocol: 'tests',
  1139. fn: function (){
  1140. var self=this;
  1141. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1142. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1143. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1144. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1145. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1146. return smalltalk.withContext(function($ctx1) {
  1147. var $2,$1,$4,$3,$6,$5;
  1148. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1149. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1150. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1151. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1152. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1153. $2=_st($Smalltalk())._current();
  1154. $ctx1.sendIdx["current"]=1;
  1155. $1=_st($2)._at_("ObjectMock2");
  1156. _st($ObjectMock())._subclass_instanceVariableNames_package_($1,"","Kernel-Tests");
  1157. $4=_st($ObjectMock())._subclasses();
  1158. $ctx1.sendIdx["subclasses"]=1;
  1159. $3=_st($4)._includes_($ObjectMock2());
  1160. $ctx1.sendIdx["includes:"]=1;
  1161. self._assert_($3);
  1162. $ctx1.sendIdx["assert:"]=1;
  1163. $6=_st($ObjectMock2())._subclasses();
  1164. $ctx1.sendIdx["subclasses"]=2;
  1165. $5=_st($6)._includes_($ObjectMock3());
  1166. $ctx1.sendIdx["includes:"]=2;
  1167. self._assert_($5);
  1168. $ctx1.sendIdx["assert:"]=2;
  1169. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1170. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1171. return smalltalk.withContext(function($ctx2) {
  1172. return _st(_st($Smalltalk())._current())._removeClass_(each);
  1173. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1174. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  1175. args: [],
  1176. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]",
  1177. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1178. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1179. }),
  1180. smalltalk.ClassBuilderTest);
  1181. smalltalk.addMethod(
  1182. smalltalk.method({
  1183. selector: "testInstanceVariableNames",
  1184. protocol: 'tests',
  1185. fn: function (){
  1186. var self=this;
  1187. return smalltalk.withContext(function($ctx1) {
  1188. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  1190. args: [],
  1191. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1192. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1193. referencedClasses: []
  1194. }),
  1195. smalltalk.ClassBuilderTest);
  1196. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1197. smalltalk.addMethod(
  1198. smalltalk.method({
  1199. selector: "assertSameContents:as:",
  1200. protocol: 'convenience',
  1201. fn: function (aCollection,anotherCollection){
  1202. var self=this;
  1203. return smalltalk.withContext(function($ctx1) {
  1204. var $2,$1,$4,$3;
  1205. $2=_st(aCollection)._size();
  1206. $ctx1.sendIdx["size"]=1;
  1207. $1=_st($2).__eq(_st(anotherCollection)._size());
  1208. $ctx1.sendIdx["="]=1;
  1209. self._assert_($1);
  1210. $ctx1.sendIdx["assert:"]=1;
  1211. _st(aCollection)._do_((function(each){
  1212. return smalltalk.withContext(function($ctx2) {
  1213. $4=_st(aCollection)._occurrencesOf_(each);
  1214. $ctx2.sendIdx["occurrencesOf:"]=1;
  1215. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1216. return self._assert_($3);
  1217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1218. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  1219. args: ["aCollection", "anotherCollection"],
  1220. source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]",
  1221. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1222. referencedClasses: []
  1223. }),
  1224. smalltalk.CollectionTest);
  1225. smalltalk.addMethod(
  1226. smalltalk.method({
  1227. selector: "collection",
  1228. protocol: 'fixture',
  1229. fn: function (){
  1230. var self=this;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. self._subclassResponsibility();
  1233. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  1234. args: [],
  1235. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1236. messageSends: ["subclassResponsibility"],
  1237. referencedClasses: []
  1238. }),
  1239. smalltalk.CollectionTest);
  1240. smalltalk.addMethod(
  1241. smalltalk.method({
  1242. selector: "collectionClass",
  1243. protocol: 'fixture',
  1244. fn: function (){
  1245. var self=this;
  1246. return smalltalk.withContext(function($ctx1) {
  1247. var $1;
  1248. $1=_st(self._class())._collectionClass();
  1249. return $1;
  1250. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  1251. args: [],
  1252. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1253. messageSends: ["collectionClass", "class"],
  1254. referencedClasses: []
  1255. }),
  1256. smalltalk.CollectionTest);
  1257. smalltalk.addMethod(
  1258. smalltalk.method({
  1259. selector: "collectionOfPrintStrings",
  1260. protocol: 'fixture',
  1261. fn: function (){
  1262. var self=this;
  1263. return smalltalk.withContext(function($ctx1) {
  1264. self._subclassResponsibility();
  1265. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.CollectionTest)})},
  1266. args: [],
  1267. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1268. messageSends: ["subclassResponsibility"],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.CollectionTest);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "collectionSize",
  1275. protocol: 'fixture',
  1276. fn: function (){
  1277. var self=this;
  1278. return smalltalk.withContext(function($ctx1) {
  1279. self._subclassResponsibility();
  1280. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.CollectionTest)})},
  1281. args: [],
  1282. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1283. messageSends: ["subclassResponsibility"],
  1284. referencedClasses: []
  1285. }),
  1286. smalltalk.CollectionTest);
  1287. smalltalk.addMethod(
  1288. smalltalk.method({
  1289. selector: "collectionWithDuplicates",
  1290. protocol: 'fixture',
  1291. fn: function (){
  1292. var self=this;
  1293. return smalltalk.withContext(function($ctx1) {
  1294. self._subclassResponsibility();
  1295. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1296. args: [],
  1297. 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",
  1298. messageSends: ["subclassResponsibility"],
  1299. referencedClasses: []
  1300. }),
  1301. smalltalk.CollectionTest);
  1302. smalltalk.addMethod(
  1303. smalltalk.method({
  1304. selector: "collectionWithNewValue",
  1305. protocol: 'fixture',
  1306. fn: function (){
  1307. var self=this;
  1308. return smalltalk.withContext(function($ctx1) {
  1309. self._subclassResponsibility();
  1310. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.CollectionTest)})},
  1311. args: [],
  1312. 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",
  1313. messageSends: ["subclassResponsibility"],
  1314. referencedClasses: []
  1315. }),
  1316. smalltalk.CollectionTest);
  1317. smalltalk.addMethod(
  1318. smalltalk.method({
  1319. selector: "isCollectionReadOnly",
  1320. protocol: 'testing',
  1321. fn: function (){
  1322. var self=this;
  1323. return smalltalk.withContext(function($ctx1) {
  1324. return false;
  1325. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1326. args: [],
  1327. source: "isCollectionReadOnly\x0a\x09^ false",
  1328. messageSends: [],
  1329. referencedClasses: []
  1330. }),
  1331. smalltalk.CollectionTest);
  1332. smalltalk.addMethod(
  1333. smalltalk.method({
  1334. selector: "sampleNewValue",
  1335. protocol: 'fixture',
  1336. fn: function (){
  1337. var self=this;
  1338. return smalltalk.withContext(function($ctx1) {
  1339. return "N";
  1340. }, function($ctx1) {$ctx1.fill(self,"sampleNewValue",{},smalltalk.CollectionTest)})},
  1341. args: [],
  1342. 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'",
  1343. messageSends: [],
  1344. referencedClasses: []
  1345. }),
  1346. smalltalk.CollectionTest);
  1347. smalltalk.addMethod(
  1348. smalltalk.method({
  1349. selector: "sampleNewValueAsCollection",
  1350. protocol: 'fixture',
  1351. fn: function (){
  1352. var self=this;
  1353. return smalltalk.withContext(function($ctx1) {
  1354. var $1;
  1355. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1356. return $1;
  1357. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.CollectionTest)})},
  1358. args: [],
  1359. 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",
  1360. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1361. referencedClasses: []
  1362. }),
  1363. smalltalk.CollectionTest);
  1364. smalltalk.addMethod(
  1365. smalltalk.method({
  1366. selector: "testAddAll",
  1367. protocol: 'tests',
  1368. fn: function (){
  1369. var self=this;
  1370. return smalltalk.withContext(function($ctx1) {
  1371. 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;
  1372. $2=self._collection();
  1373. $ctx1.sendIdx["collection"]=1;
  1374. $3=$2;
  1375. $5=self._collectionClass();
  1376. $ctx1.sendIdx["collectionClass"]=1;
  1377. $4=_st($5)._new();
  1378. $ctx1.sendIdx["new"]=1;
  1379. _st($3)._addAll_($4);
  1380. $ctx1.sendIdx["addAll:"]=1;
  1381. $6=_st($2)._yourself();
  1382. $ctx1.sendIdx["yourself"]=1;
  1383. $1=$6;
  1384. $7=self._collection();
  1385. $ctx1.sendIdx["collection"]=2;
  1386. self._assert_equals_($1,$7);
  1387. $ctx1.sendIdx["assert:equals:"]=1;
  1388. $10=self._collectionClass();
  1389. $ctx1.sendIdx["collectionClass"]=2;
  1390. $9=_st($10)._new();
  1391. $ctx1.sendIdx["new"]=2;
  1392. $11=$9;
  1393. $12=self._collection();
  1394. $ctx1.sendIdx["collection"]=3;
  1395. _st($11)._addAll_($12);
  1396. $ctx1.sendIdx["addAll:"]=2;
  1397. $13=_st($9)._yourself();
  1398. $ctx1.sendIdx["yourself"]=2;
  1399. $8=$13;
  1400. $14=self._collection();
  1401. $ctx1.sendIdx["collection"]=4;
  1402. self._assert_equals_($8,$14);
  1403. $ctx1.sendIdx["assert:equals:"]=2;
  1404. $17=self._collectionClass();
  1405. $ctx1.sendIdx["collectionClass"]=3;
  1406. $16=_st($17)._new();
  1407. $ctx1.sendIdx["new"]=3;
  1408. $18=$16;
  1409. $20=self._collectionClass();
  1410. $ctx1.sendIdx["collectionClass"]=4;
  1411. $19=_st($20)._new();
  1412. $ctx1.sendIdx["new"]=4;
  1413. _st($18)._addAll_($19);
  1414. $ctx1.sendIdx["addAll:"]=3;
  1415. $21=_st($16)._yourself();
  1416. $ctx1.sendIdx["yourself"]=3;
  1417. $15=$21;
  1418. self._assert_equals_($15,_st(self._collectionClass())._new());
  1419. $ctx1.sendIdx["assert:equals:"]=3;
  1420. $23=self._collection();
  1421. $ctx1.sendIdx["collection"]=5;
  1422. $24=$23;
  1423. $25=self._sampleNewValueAsCollection();
  1424. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1425. _st($24)._addAll_($25);
  1426. $ctx1.sendIdx["addAll:"]=4;
  1427. $26=_st($23)._yourself();
  1428. $ctx1.sendIdx["yourself"]=4;
  1429. $22=$26;
  1430. $27=self._collectionWithNewValue();
  1431. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1432. self._assert_equals_($22,$27);
  1433. $28=self._sampleNewValueAsCollection();
  1434. _st($28)._addAll_(self._collection());
  1435. $29=_st($28)._yourself();
  1436. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1437. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.CollectionTest)})},
  1438. args: [],
  1439. 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",
  1440. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1441. referencedClasses: []
  1442. }),
  1443. smalltalk.CollectionTest);
  1444. smalltalk.addMethod(
  1445. smalltalk.method({
  1446. selector: "testAllSatisfy",
  1447. protocol: 'tests',
  1448. fn: function (){
  1449. var self=this;
  1450. var collection,anyOne;
  1451. return smalltalk.withContext(function($ctx1) {
  1452. var $1;
  1453. collection=self._collection();
  1454. anyOne=_st(collection)._anyOne();
  1455. $1=_st(collection)._allSatisfy_((function(each){
  1456. return smalltalk.withContext(function($ctx2) {
  1457. return _st(collection)._includes_(each);
  1458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1459. $ctx1.sendIdx["allSatisfy:"]=1;
  1460. self._assert_($1);
  1461. self._deny_(_st(collection)._allSatisfy_((function(each){
  1462. return smalltalk.withContext(function($ctx2) {
  1463. return _st(each).__tild_eq(anyOne);
  1464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1465. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1466. args: [],
  1467. 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 ])",
  1468. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1469. referencedClasses: []
  1470. }),
  1471. smalltalk.CollectionTest);
  1472. smalltalk.addMethod(
  1473. smalltalk.method({
  1474. selector: "testAnyOne",
  1475. protocol: 'tests',
  1476. fn: function (){
  1477. var self=this;
  1478. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1479. return smalltalk.withContext(function($ctx1) {
  1480. var $2,$1;
  1481. self._should_raise_((function(){
  1482. return smalltalk.withContext(function($ctx2) {
  1483. return _st(_st(self._collectionClass())._new())._anyOne();
  1484. $ctx2.sendIdx["anyOne"]=1;
  1485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1486. $2=self._collection();
  1487. $ctx1.sendIdx["collection"]=1;
  1488. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1489. self._assert_($1);
  1490. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1491. args: [],
  1492. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1493. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1494. referencedClasses: ["Error"]
  1495. }),
  1496. smalltalk.CollectionTest);
  1497. smalltalk.addMethod(
  1498. smalltalk.method({
  1499. selector: "testAnySatisfy",
  1500. protocol: 'tests',
  1501. fn: function (){
  1502. var self=this;
  1503. var anyOne;
  1504. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1505. return smalltalk.withContext(function($ctx1) {
  1506. var $1,$3,$2;
  1507. $1=self._collection();
  1508. $ctx1.sendIdx["collection"]=1;
  1509. anyOne=_st($1)._anyOne();
  1510. $3=self._collection();
  1511. $ctx1.sendIdx["collection"]=2;
  1512. $2=_st($3)._anySatisfy_((function(each){
  1513. return smalltalk.withContext(function($ctx2) {
  1514. return _st(each).__eq(anyOne);
  1515. $ctx2.sendIdx["="]=1;
  1516. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1517. $ctx1.sendIdx["anySatisfy:"]=1;
  1518. self._assert_($2);
  1519. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1520. return smalltalk.withContext(function($ctx2) {
  1521. return _st(each).__eq(_st($Object())._new());
  1522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1523. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1524. args: [],
  1525. 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 ])",
  1526. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1527. referencedClasses: ["Object"]
  1528. }),
  1529. smalltalk.CollectionTest);
  1530. smalltalk.addMethod(
  1531. smalltalk.method({
  1532. selector: "testAsArray",
  1533. protocol: 'tests',
  1534. fn: function (){
  1535. var self=this;
  1536. return smalltalk.withContext(function($ctx1) {
  1537. var $1;
  1538. $1=self._collection();
  1539. $ctx1.sendIdx["collection"]=1;
  1540. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1541. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1542. args: [],
  1543. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1544. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1545. referencedClasses: []
  1546. }),
  1547. smalltalk.CollectionTest);
  1548. smalltalk.addMethod(
  1549. smalltalk.method({
  1550. selector: "testAsOrderedCollection",
  1551. protocol: 'tests',
  1552. fn: function (){
  1553. var self=this;
  1554. return smalltalk.withContext(function($ctx1) {
  1555. var $1;
  1556. $1=self._collection();
  1557. $ctx1.sendIdx["collection"]=1;
  1558. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1559. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1560. args: [],
  1561. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1562. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1563. referencedClasses: []
  1564. }),
  1565. smalltalk.CollectionTest);
  1566. smalltalk.addMethod(
  1567. smalltalk.method({
  1568. selector: "testAsSet",
  1569. protocol: 'tests',
  1570. fn: function (){
  1571. var self=this;
  1572. var c,set;
  1573. return smalltalk.withContext(function($ctx1) {
  1574. c=self._collectionWithDuplicates();
  1575. set=_st(c)._asSet();
  1576. self._assert_equals_(_st(set)._size(),(5));
  1577. _st(c)._do_((function(each){
  1578. return smalltalk.withContext(function($ctx2) {
  1579. return self._assert_(_st(set)._includes_(each));
  1580. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1581. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1582. args: [],
  1583. 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) ]",
  1584. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1585. referencedClasses: []
  1586. }),
  1587. smalltalk.CollectionTest);
  1588. smalltalk.addMethod(
  1589. smalltalk.method({
  1590. selector: "testCollect",
  1591. protocol: 'tests',
  1592. fn: function (){
  1593. var self=this;
  1594. return smalltalk.withContext(function($ctx1) {
  1595. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1596. $2=self._collection();
  1597. $ctx1.sendIdx["collection"]=1;
  1598. $1=_st($2)._collect_((function(each){
  1599. return smalltalk.withContext(function($ctx2) {
  1600. return each;
  1601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1602. $ctx1.sendIdx["collect:"]=1;
  1603. $3=self._collection();
  1604. $ctx1.sendIdx["collection"]=2;
  1605. self._assert_equals_($1,$3);
  1606. $ctx1.sendIdx["assert:equals:"]=1;
  1607. $5=self._collectionWithNewValue();
  1608. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1609. $4=_st($5)._collect_((function(each){
  1610. return smalltalk.withContext(function($ctx2) {
  1611. return each;
  1612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1613. $ctx1.sendIdx["collect:"]=2;
  1614. self._assert_equals_($4,self._collectionWithNewValue());
  1615. $ctx1.sendIdx["assert:equals:"]=2;
  1616. $8=self._collectionClass();
  1617. $ctx1.sendIdx["collectionClass"]=1;
  1618. $7=_st($8)._new();
  1619. $ctx1.sendIdx["new"]=1;
  1620. $6=_st($7)._collect_((function(each){
  1621. return smalltalk.withContext(function($ctx2) {
  1622. return _st(each)._printString();
  1623. $ctx2.sendIdx["printString"]=1;
  1624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1625. $ctx1.sendIdx["collect:"]=3;
  1626. self._assert_equals_($6,_st(self._collectionClass())._new());
  1627. $ctx1.sendIdx["assert:equals:"]=3;
  1628. $11=self._collection();
  1629. $ctx1.sendIdx["collection"]=3;
  1630. $10=_st($11)._collect_((function(){
  1631. return smalltalk.withContext(function($ctx2) {
  1632. return self._sampleNewValue();
  1633. $ctx2.sendIdx["sampleNewValue"]=1;
  1634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1635. $ctx1.sendIdx["collect:"]=4;
  1636. $9=_st($10)._detect_((function(){
  1637. return smalltalk.withContext(function($ctx2) {
  1638. return true;
  1639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1640. self._assert_equals_($9,self._sampleNewValue());
  1641. $ctx1.sendIdx["assert:equals:"]=4;
  1642. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1643. return smalltalk.withContext(function($ctx2) {
  1644. return _st(each)._printString();
  1645. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1646. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.CollectionTest)})},
  1647. args: [],
  1648. 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",
  1649. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1650. referencedClasses: []
  1651. }),
  1652. smalltalk.CollectionTest);
  1653. smalltalk.addMethod(
  1654. smalltalk.method({
  1655. selector: "testComma",
  1656. protocol: 'tests',
  1657. fn: function (){
  1658. var self=this;
  1659. return smalltalk.withContext(function($ctx1) {
  1660. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1661. $2=self._collection();
  1662. $ctx1.sendIdx["collection"]=1;
  1663. $4=self._collectionClass();
  1664. $ctx1.sendIdx["collectionClass"]=1;
  1665. $3=_st($4)._new();
  1666. $ctx1.sendIdx["new"]=1;
  1667. $1=_st($2).__comma($3);
  1668. $ctx1.sendIdx[","]=1;
  1669. $5=self._collection();
  1670. $ctx1.sendIdx["collection"]=2;
  1671. self._assert_equals_($1,$5);
  1672. $ctx1.sendIdx["assert:equals:"]=1;
  1673. $8=self._collectionClass();
  1674. $ctx1.sendIdx["collectionClass"]=2;
  1675. $7=_st($8)._new();
  1676. $ctx1.sendIdx["new"]=2;
  1677. $9=self._collection();
  1678. $ctx1.sendIdx["collection"]=3;
  1679. $6=_st($7).__comma($9);
  1680. $ctx1.sendIdx[","]=2;
  1681. $10=self._collection();
  1682. $ctx1.sendIdx["collection"]=4;
  1683. self._assert_equals_($6,$10);
  1684. $ctx1.sendIdx["assert:equals:"]=2;
  1685. $13=self._collectionClass();
  1686. $ctx1.sendIdx["collectionClass"]=3;
  1687. $12=_st($13)._new();
  1688. $ctx1.sendIdx["new"]=3;
  1689. $15=self._collectionClass();
  1690. $ctx1.sendIdx["collectionClass"]=4;
  1691. $14=_st($15)._new();
  1692. $ctx1.sendIdx["new"]=4;
  1693. $11=_st($12).__comma($14);
  1694. $ctx1.sendIdx[","]=3;
  1695. self._assert_equals_($11,_st(self._collectionClass())._new());
  1696. $ctx1.sendIdx["assert:equals:"]=3;
  1697. $17=self._collection();
  1698. $ctx1.sendIdx["collection"]=5;
  1699. $18=self._sampleNewValueAsCollection();
  1700. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1701. $16=_st($17).__comma($18);
  1702. $ctx1.sendIdx[","]=4;
  1703. $19=self._collectionWithNewValue();
  1704. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1705. self._assert_equals_($16,$19);
  1706. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1707. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.CollectionTest)})},
  1708. args: [],
  1709. 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",
  1710. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1711. referencedClasses: []
  1712. }),
  1713. smalltalk.CollectionTest);
  1714. smalltalk.addMethod(
  1715. smalltalk.method({
  1716. selector: "testDetect",
  1717. protocol: 'tests',
  1718. fn: function (){
  1719. var self=this;
  1720. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1721. return smalltalk.withContext(function($ctx1) {
  1722. var $1,$2,$3,$4,$6,$5,$7;
  1723. self._shouldnt_raise_((function(){
  1724. return smalltalk.withContext(function($ctx2) {
  1725. $1=self._collection();
  1726. $ctx2.sendIdx["collection"]=1;
  1727. return _st($1)._detect_((function(){
  1728. return smalltalk.withContext(function($ctx3) {
  1729. return true;
  1730. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1731. $ctx2.sendIdx["detect:"]=1;
  1732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1733. self._should_raise_((function(){
  1734. return smalltalk.withContext(function($ctx2) {
  1735. $2=self._collection();
  1736. $ctx2.sendIdx["collection"]=2;
  1737. return _st($2)._detect_((function(){
  1738. return smalltalk.withContext(function($ctx3) {
  1739. return false;
  1740. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  1741. $ctx2.sendIdx["detect:"]=2;
  1742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1743. $ctx1.sendIdx["should:raise:"]=1;
  1744. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1745. return smalltalk.withContext(function($ctx2) {
  1746. return true;
  1747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1748. $ctx1.sendIdx["detect:"]=3;
  1749. $4=self._sampleNewValue();
  1750. $ctx1.sendIdx["sampleNewValue"]=1;
  1751. self._assert_equals_($3,$4);
  1752. $ctx1.sendIdx["assert:equals:"]=1;
  1753. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1754. return smalltalk.withContext(function($ctx2) {
  1755. $6=self._sampleNewValue();
  1756. $ctx2.sendIdx["sampleNewValue"]=2;
  1757. return _st(each).__eq($6);
  1758. $ctx2.sendIdx["="]=1;
  1759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1760. $ctx1.sendIdx["detect:"]=4;
  1761. $7=self._sampleNewValue();
  1762. $ctx1.sendIdx["sampleNewValue"]=3;
  1763. self._assert_equals_($5,$7);
  1764. self._should_raise_((function(){
  1765. return smalltalk.withContext(function($ctx2) {
  1766. return _st(self._collection())._detect_((function(each){
  1767. return smalltalk.withContext(function($ctx3) {
  1768. return _st(each).__eq(self._sampleNewValue());
  1769. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1771. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1772. args: [],
  1773. 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",
  1774. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1775. referencedClasses: ["Error"]
  1776. }),
  1777. smalltalk.CollectionTest);
  1778. smalltalk.addMethod(
  1779. smalltalk.method({
  1780. selector: "testDetectIfNone",
  1781. protocol: 'tests',
  1782. fn: function (){
  1783. var self=this;
  1784. var sentinel;
  1785. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1786. return smalltalk.withContext(function($ctx1) {
  1787. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1788. sentinel=_st($Object())._new();
  1789. $3=self._collection();
  1790. $ctx1.sendIdx["collection"]=1;
  1791. $2=_st($3)._detect_ifNone_((function(){
  1792. return smalltalk.withContext(function($ctx2) {
  1793. return true;
  1794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  1795. return smalltalk.withContext(function($ctx2) {
  1796. return sentinel;
  1797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1798. $ctx1.sendIdx["detect:ifNone:"]=1;
  1799. $1=_st($2).__tild_eq(sentinel);
  1800. self._assert_($1);
  1801. $5=self._collection();
  1802. $ctx1.sendIdx["collection"]=2;
  1803. $4=_st($5)._detect_ifNone_((function(){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. return false;
  1806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),(function(){
  1807. return smalltalk.withContext(function($ctx2) {
  1808. return sentinel;
  1809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1810. $ctx1.sendIdx["detect:ifNone:"]=2;
  1811. self._assert_equals_($4,sentinel);
  1812. $ctx1.sendIdx["assert:equals:"]=1;
  1813. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1814. return smalltalk.withContext(function($ctx2) {
  1815. return true;
  1816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1817. return smalltalk.withContext(function($ctx2) {
  1818. return sentinel;
  1819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1820. $ctx1.sendIdx["detect:ifNone:"]=3;
  1821. $7=self._sampleNewValue();
  1822. $ctx1.sendIdx["sampleNewValue"]=1;
  1823. self._assert_equals_($6,$7);
  1824. $ctx1.sendIdx["assert:equals:"]=2;
  1825. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1826. return smalltalk.withContext(function($ctx2) {
  1827. $9=self._sampleNewValue();
  1828. $ctx2.sendIdx["sampleNewValue"]=2;
  1829. return _st(each).__eq($9);
  1830. $ctx2.sendIdx["="]=1;
  1831. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1832. return smalltalk.withContext(function($ctx2) {
  1833. return sentinel;
  1834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1835. $ctx1.sendIdx["detect:ifNone:"]=4;
  1836. $10=self._sampleNewValue();
  1837. $ctx1.sendIdx["sampleNewValue"]=3;
  1838. self._assert_equals_($8,$10);
  1839. $ctx1.sendIdx["assert:equals:"]=3;
  1840. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1841. return smalltalk.withContext(function($ctx2) {
  1842. return _st(each).__eq(self._sampleNewValue());
  1843. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1844. return smalltalk.withContext(function($ctx2) {
  1845. return sentinel;
  1846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})})),sentinel);
  1847. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},smalltalk.CollectionTest)})},
  1848. args: [],
  1849. 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",
  1850. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1851. referencedClasses: ["Object"]
  1852. }),
  1853. smalltalk.CollectionTest);
  1854. smalltalk.addMethod(
  1855. smalltalk.method({
  1856. selector: "testDo",
  1857. protocol: 'tests',
  1858. fn: function (){
  1859. var self=this;
  1860. var newCollection;
  1861. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1862. return smalltalk.withContext(function($ctx1) {
  1863. var $1,$2;
  1864. newCollection=_st($OrderedCollection())._new();
  1865. $ctx1.sendIdx["new"]=1;
  1866. $1=self._collection();
  1867. $ctx1.sendIdx["collection"]=1;
  1868. _st($1)._do_((function(each){
  1869. return smalltalk.withContext(function($ctx2) {
  1870. return _st(newCollection)._add_(each);
  1871. $ctx2.sendIdx["add:"]=1;
  1872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1873. $ctx1.sendIdx["do:"]=1;
  1874. self._assertSameContents_as_(self._collection(),newCollection);
  1875. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1876. newCollection=_st($OrderedCollection())._new();
  1877. $2=self._collectionWithDuplicates();
  1878. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1879. _st($2)._do_((function(each){
  1880. return smalltalk.withContext(function($ctx2) {
  1881. return _st(newCollection)._add_(each);
  1882. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1883. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1884. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1885. args: [],
  1886. 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",
  1887. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1888. referencedClasses: ["OrderedCollection"]
  1889. }),
  1890. smalltalk.CollectionTest);
  1891. smalltalk.addMethod(
  1892. smalltalk.method({
  1893. selector: "testIfEmptyFamily",
  1894. protocol: 'tests',
  1895. fn: function (){
  1896. var self=this;
  1897. return smalltalk.withContext(function($ctx1) {
  1898. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1899. $3=self._collectionClass();
  1900. $ctx1.sendIdx["collectionClass"]=1;
  1901. $2=_st($3)._new();
  1902. $ctx1.sendIdx["new"]=1;
  1903. $1=_st($2)._ifEmpty_((function(){
  1904. return smalltalk.withContext(function($ctx2) {
  1905. return (42);
  1906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1907. $ctx1.sendIdx["ifEmpty:"]=1;
  1908. self._assert_equals_($1,(42));
  1909. $ctx1.sendIdx["assert:equals:"]=1;
  1910. $5=self._collection();
  1911. $ctx1.sendIdx["collection"]=1;
  1912. $4=_st($5)._ifEmpty_((function(){
  1913. return smalltalk.withContext(function($ctx2) {
  1914. return (42);
  1915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1916. $6=self._collection();
  1917. $ctx1.sendIdx["collection"]=2;
  1918. self._assert_equals_($4,$6);
  1919. $ctx1.sendIdx["assert:equals:"]=2;
  1920. $9=self._collectionClass();
  1921. $ctx1.sendIdx["collectionClass"]=2;
  1922. $8=_st($9)._new();
  1923. $ctx1.sendIdx["new"]=2;
  1924. $7=_st($8)._ifNotEmpty_((function(){
  1925. return smalltalk.withContext(function($ctx2) {
  1926. return (42);
  1927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1928. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1929. $11=self._collectionClass();
  1930. $ctx1.sendIdx["collectionClass"]=3;
  1931. $10=_st($11)._new();
  1932. $ctx1.sendIdx["new"]=3;
  1933. self._assert_equals_($7,$10);
  1934. $ctx1.sendIdx["assert:equals:"]=3;
  1935. $13=self._collection();
  1936. $ctx1.sendIdx["collection"]=3;
  1937. $12=_st($13)._ifNotEmpty_((function(){
  1938. return smalltalk.withContext(function($ctx2) {
  1939. return (42);
  1940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1941. self._assert_equals_($12,(42));
  1942. $ctx1.sendIdx["assert:equals:"]=4;
  1943. $16=self._collectionClass();
  1944. $ctx1.sendIdx["collectionClass"]=4;
  1945. $15=_st($16)._new();
  1946. $ctx1.sendIdx["new"]=4;
  1947. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1948. return smalltalk.withContext(function($ctx2) {
  1949. return (42);
  1950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1951. return smalltalk.withContext(function($ctx2) {
  1952. return (999);
  1953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1954. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1955. self._assert_equals_($14,(42));
  1956. $ctx1.sendIdx["assert:equals:"]=5;
  1957. $18=self._collection();
  1958. $ctx1.sendIdx["collection"]=4;
  1959. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1960. return smalltalk.withContext(function($ctx2) {
  1961. return (42);
  1962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1963. return smalltalk.withContext(function($ctx2) {
  1964. return (999);
  1965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1966. self._assert_equals_($17,(999));
  1967. $ctx1.sendIdx["assert:equals:"]=6;
  1968. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1969. return smalltalk.withContext(function($ctx2) {
  1970. return (42);
  1971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1972. return smalltalk.withContext(function($ctx2) {
  1973. return (999);
  1974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1975. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1976. self._assert_equals_($19,(999));
  1977. $ctx1.sendIdx["assert:equals:"]=7;
  1978. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1979. return smalltalk.withContext(function($ctx2) {
  1980. return (42);
  1981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1982. return smalltalk.withContext(function($ctx2) {
  1983. return (999);
  1984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1985. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1986. args: [],
  1987. 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",
  1988. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1989. referencedClasses: []
  1990. }),
  1991. smalltalk.CollectionTest);
  1992. smalltalk.addMethod(
  1993. smalltalk.method({
  1994. selector: "testIsEmpty",
  1995. protocol: 'tests',
  1996. fn: function (){
  1997. var self=this;
  1998. return smalltalk.withContext(function($ctx1) {
  1999. var $1;
  2000. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  2001. $ctx1.sendIdx["isEmpty"]=1;
  2002. self._assert_($1);
  2003. self._deny_(_st(self._collection())._isEmpty());
  2004. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  2005. args: [],
  2006. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  2007. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  2008. referencedClasses: []
  2009. }),
  2010. smalltalk.CollectionTest);
  2011. smalltalk.addMethod(
  2012. smalltalk.method({
  2013. selector: "testNoneSatisfy",
  2014. protocol: 'tests',
  2015. fn: function (){
  2016. var self=this;
  2017. var anyOne;
  2018. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2019. return smalltalk.withContext(function($ctx1) {
  2020. var $1,$3,$2;
  2021. $1=self._collection();
  2022. $ctx1.sendIdx["collection"]=1;
  2023. anyOne=_st($1)._anyOne();
  2024. $3=self._collection();
  2025. $ctx1.sendIdx["collection"]=2;
  2026. $2=_st($3)._noneSatisfy_((function(each){
  2027. return smalltalk.withContext(function($ctx2) {
  2028. return _st(each).__eq(anyOne);
  2029. $ctx2.sendIdx["="]=1;
  2030. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2031. $ctx1.sendIdx["noneSatisfy:"]=1;
  2032. self._deny_($2);
  2033. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2034. return smalltalk.withContext(function($ctx2) {
  2035. return _st(each).__eq(_st($Object())._new());
  2036. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2037. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  2038. args: [],
  2039. 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 ])",
  2040. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2041. referencedClasses: ["Object"]
  2042. }),
  2043. smalltalk.CollectionTest);
  2044. smalltalk.addMethod(
  2045. smalltalk.method({
  2046. selector: "testRemoveAll",
  2047. protocol: 'tests',
  2048. fn: function (){
  2049. var self=this;
  2050. return smalltalk.withContext(function($ctx1) {
  2051. var $1,$2;
  2052. $1=self._collection();
  2053. _st($1)._removeAll();
  2054. $2=_st($1)._yourself();
  2055. self._assert_equals_($2,_st(self._collectionClass())._new());
  2056. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  2057. args: [],
  2058. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2059. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2060. referencedClasses: []
  2061. }),
  2062. smalltalk.CollectionTest);
  2063. smalltalk.addMethod(
  2064. smalltalk.method({
  2065. selector: "testSelect",
  2066. protocol: 'tests',
  2067. fn: function (){
  2068. var self=this;
  2069. return smalltalk.withContext(function($ctx1) {
  2070. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2071. $2=self._collection();
  2072. $ctx1.sendIdx["collection"]=1;
  2073. $1=_st($2)._select_((function(){
  2074. return smalltalk.withContext(function($ctx2) {
  2075. return false;
  2076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2077. $ctx1.sendIdx["select:"]=1;
  2078. $4=self._collectionClass();
  2079. $ctx1.sendIdx["collectionClass"]=1;
  2080. $3=_st($4)._new();
  2081. $ctx1.sendIdx["new"]=1;
  2082. self._assert_equals_($1,$3);
  2083. $ctx1.sendIdx["assert:equals:"]=1;
  2084. $6=self._collection();
  2085. $ctx1.sendIdx["collection"]=2;
  2086. $5=_st($6)._select_((function(){
  2087. return smalltalk.withContext(function($ctx2) {
  2088. return true;
  2089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2090. $ctx1.sendIdx["select:"]=2;
  2091. $7=self._collection();
  2092. $ctx1.sendIdx["collection"]=3;
  2093. self._assert_equals_($5,$7);
  2094. $ctx1.sendIdx["assert:equals:"]=2;
  2095. $9=self._collectionWithNewValue();
  2096. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2097. $8=_st($9)._select_((function(each){
  2098. return smalltalk.withContext(function($ctx2) {
  2099. $10=self._sampleNewValue();
  2100. $ctx2.sendIdx["sampleNewValue"]=1;
  2101. return _st(each).__eq($10);
  2102. $ctx2.sendIdx["="]=1;
  2103. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2104. $ctx1.sendIdx["select:"]=3;
  2105. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2106. $ctx1.sendIdx["assert:equals:"]=3;
  2107. $12=self._collectionWithNewValue();
  2108. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2109. $11=_st($12)._select_((function(each){
  2110. return smalltalk.withContext(function($ctx2) {
  2111. $13=self._sampleNewValue();
  2112. $ctx2.sendIdx["sampleNewValue"]=2;
  2113. return _st(each).__tild_eq($13);
  2114. $ctx2.sendIdx["~="]=1;
  2115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2116. $ctx1.sendIdx["select:"]=4;
  2117. $14=self._collection();
  2118. $ctx1.sendIdx["collection"]=4;
  2119. self._assert_equals_($11,$14);
  2120. $ctx1.sendIdx["assert:equals:"]=4;
  2121. $16=self._collection();
  2122. $ctx1.sendIdx["collection"]=5;
  2123. $15=_st($16)._select_((function(each){
  2124. return smalltalk.withContext(function($ctx2) {
  2125. $17=self._sampleNewValue();
  2126. $ctx2.sendIdx["sampleNewValue"]=3;
  2127. return _st(each).__eq($17);
  2128. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2129. $ctx1.sendIdx["select:"]=5;
  2130. self._assert_equals_($15,_st(self._collectionClass())._new());
  2131. $ctx1.sendIdx["assert:equals:"]=5;
  2132. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2133. return smalltalk.withContext(function($ctx2) {
  2134. return _st(each).__tild_eq(self._sampleNewValue());
  2135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2136. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},smalltalk.CollectionTest)})},
  2137. args: [],
  2138. 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",
  2139. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2140. referencedClasses: []
  2141. }),
  2142. smalltalk.CollectionTest);
  2143. smalltalk.addMethod(
  2144. smalltalk.method({
  2145. selector: "testSize",
  2146. protocol: 'tests',
  2147. fn: function (){
  2148. var self=this;
  2149. return smalltalk.withContext(function($ctx1) {
  2150. var $1,$2;
  2151. $1=_st(_st(self._collectionClass())._new())._size();
  2152. $ctx1.sendIdx["size"]=1;
  2153. self._assert_equals_($1,(0));
  2154. $ctx1.sendIdx["assert:equals:"]=1;
  2155. $2=_st(self._sampleNewValueAsCollection())._size();
  2156. $ctx1.sendIdx["size"]=2;
  2157. self._assert_equals_($2,(1));
  2158. $ctx1.sendIdx["assert:equals:"]=2;
  2159. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2160. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  2161. args: [],
  2162. 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",
  2163. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2164. referencedClasses: []
  2165. }),
  2166. smalltalk.CollectionTest);
  2167. smalltalk.addMethod(
  2168. smalltalk.method({
  2169. selector: "collectionClass",
  2170. protocol: 'fixture',
  2171. fn: function (){
  2172. var self=this;
  2173. return smalltalk.withContext(function($ctx1) {
  2174. return nil;
  2175. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  2176. args: [],
  2177. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2178. messageSends: [],
  2179. referencedClasses: []
  2180. }),
  2181. smalltalk.CollectionTest.klass);
  2182. smalltalk.addMethod(
  2183. smalltalk.method({
  2184. selector: "isAbstract",
  2185. protocol: 'testing',
  2186. fn: function (){
  2187. var self=this;
  2188. return smalltalk.withContext(function($ctx1) {
  2189. var $1;
  2190. $1=_st(self._collectionClass())._isNil();
  2191. return $1;
  2192. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  2193. args: [],
  2194. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2195. messageSends: ["isNil", "collectionClass"],
  2196. referencedClasses: []
  2197. }),
  2198. smalltalk.CollectionTest.klass);
  2199. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  2200. smalltalk.addMethod(
  2201. smalltalk.method({
  2202. selector: "collectionWithNewValue",
  2203. protocol: 'fixture',
  2204. fn: function (){
  2205. var self=this;
  2206. return smalltalk.withContext(function($ctx1) {
  2207. self._subclassResponsibility();
  2208. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.IndexableCollectionTest)})},
  2209. args: [],
  2210. 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",
  2211. messageSends: ["subclassResponsibility"],
  2212. referencedClasses: []
  2213. }),
  2214. smalltalk.IndexableCollectionTest);
  2215. smalltalk.addMethod(
  2216. smalltalk.method({
  2217. selector: "sampleNewIndex",
  2218. protocol: 'fixture',
  2219. fn: function (){
  2220. var self=this;
  2221. return smalltalk.withContext(function($ctx1) {
  2222. self._subclassResponsibility();
  2223. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.IndexableCollectionTest)})},
  2224. args: [],
  2225. 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",
  2226. messageSends: ["subclassResponsibility"],
  2227. referencedClasses: []
  2228. }),
  2229. smalltalk.IndexableCollectionTest);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: "sampleNonIndexesDo:",
  2233. protocol: 'fixture',
  2234. fn: function (aBlock){
  2235. var self=this;
  2236. return smalltalk.withContext(function($ctx1) {
  2237. self._subclassResponsibility();
  2238. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2239. args: ["aBlock"],
  2240. 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",
  2241. messageSends: ["subclassResponsibility"],
  2242. referencedClasses: []
  2243. }),
  2244. smalltalk.IndexableCollectionTest);
  2245. smalltalk.addMethod(
  2246. smalltalk.method({
  2247. selector: "samplesDo:",
  2248. protocol: 'fixture',
  2249. fn: function (aBlock){
  2250. var self=this;
  2251. return smalltalk.withContext(function($ctx1) {
  2252. self._subclassResponsibility();
  2253. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2254. args: ["aBlock"],
  2255. 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",
  2256. messageSends: ["subclassResponsibility"],
  2257. referencedClasses: []
  2258. }),
  2259. smalltalk.IndexableCollectionTest);
  2260. smalltalk.addMethod(
  2261. smalltalk.method({
  2262. selector: "testAt",
  2263. protocol: 'tests',
  2264. fn: function (){
  2265. var self=this;
  2266. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2267. return smalltalk.withContext(function($ctx1) {
  2268. var $1;
  2269. self._nonIndexesDo_((function(each){
  2270. return smalltalk.withContext(function($ctx2) {
  2271. return self._should_raise_((function(){
  2272. return smalltalk.withContext(function($ctx3) {
  2273. $1=self._collection();
  2274. $ctx3.sendIdx["collection"]=1;
  2275. return _st($1)._at_(each);
  2276. $ctx3.sendIdx["at:"]=1;
  2277. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2279. self._samplesDo_((function(index,value){
  2280. return smalltalk.withContext(function($ctx2) {
  2281. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2282. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2283. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  2284. args: [],
  2285. 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 ]",
  2286. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2287. referencedClasses: ["Error"]
  2288. }),
  2289. smalltalk.IndexableCollectionTest);
  2290. smalltalk.addMethod(
  2291. smalltalk.method({
  2292. selector: "testAtIfAbsent",
  2293. protocol: 'tests',
  2294. fn: function (){
  2295. var self=this;
  2296. return smalltalk.withContext(function($ctx1) {
  2297. var $2,$1,$3;
  2298. self._nonIndexesDo_((function(each){
  2299. return smalltalk.withContext(function($ctx2) {
  2300. $2=self._collection();
  2301. $ctx2.sendIdx["collection"]=1;
  2302. $1=_st($2)._at_ifAbsent_(each,(function(){
  2303. return smalltalk.withContext(function($ctx3) {
  2304. return self._sampleNewValue();
  2305. $ctx3.sendIdx["sampleNewValue"]=1;
  2306. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2307. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2308. $3=self._sampleNewValue();
  2309. $ctx2.sendIdx["sampleNewValue"]=2;
  2310. return self._assert_equals_($1,$3);
  2311. $ctx2.sendIdx["assert:equals:"]=1;
  2312. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2313. self._samplesDo_((function(index,value){
  2314. return smalltalk.withContext(function($ctx2) {
  2315. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2316. return smalltalk.withContext(function($ctx3) {
  2317. return self._sampleNewValue();
  2318. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2319. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2320. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  2321. args: [],
  2322. 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 ].",
  2323. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2324. referencedClasses: []
  2325. }),
  2326. smalltalk.IndexableCollectionTest);
  2327. smalltalk.addMethod(
  2328. smalltalk.method({
  2329. selector: "testAtIfPresent",
  2330. protocol: 'tests',
  2331. fn: function (){
  2332. var self=this;
  2333. var visited,sentinel;
  2334. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2335. return smalltalk.withContext(function($ctx1) {
  2336. var $2,$1,$4,$3;
  2337. sentinel=_st($Object())._new();
  2338. self._nonIndexesDo_((function(each){
  2339. return smalltalk.withContext(function($ctx2) {
  2340. visited=nil;
  2341. visited;
  2342. $2=self._collection();
  2343. $ctx2.sendIdx["collection"]=1;
  2344. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2345. return smalltalk.withContext(function($ctx3) {
  2346. visited=value1;
  2347. visited;
  2348. return sentinel;
  2349. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}));
  2350. $ctx2.sendIdx["at:ifPresent:"]=1;
  2351. self._assert_equals_($1,nil);
  2352. $ctx2.sendIdx["assert:equals:"]=1;
  2353. return self._assert_(_st(visited)._isNil());
  2354. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2355. self._samplesDo_((function(index,value){
  2356. return smalltalk.withContext(function($ctx2) {
  2357. visited=nil;
  2358. visited;
  2359. $4=self._collection();
  2360. $ctx2.sendIdx["collection"]=2;
  2361. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2362. return smalltalk.withContext(function($ctx3) {
  2363. visited=value2;
  2364. visited;
  2365. return sentinel;
  2366. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,4)})}));
  2367. self._assert_equals_($3,sentinel);
  2368. $ctx2.sendIdx["assert:equals:"]=2;
  2369. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2370. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2371. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2372. args: [],
  2373. 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) ]",
  2374. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2375. referencedClasses: ["Object"]
  2376. }),
  2377. smalltalk.IndexableCollectionTest);
  2378. smalltalk.addMethod(
  2379. smalltalk.method({
  2380. selector: "testAtIfPresentIfAbsent",
  2381. protocol: 'tests',
  2382. fn: function (){
  2383. var self=this;
  2384. var visited,sentinel;
  2385. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2386. return smalltalk.withContext(function($ctx1) {
  2387. var $2,$1,$3,$5,$4;
  2388. sentinel=_st($Object())._new();
  2389. self._nonIndexesDo_((function(each){
  2390. return smalltalk.withContext(function($ctx2) {
  2391. visited=nil;
  2392. visited;
  2393. $2=self._collection();
  2394. $ctx2.sendIdx["collection"]=1;
  2395. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2396. return smalltalk.withContext(function($ctx3) {
  2397. visited=value1;
  2398. visited;
  2399. return sentinel;
  2400. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}),(function(){
  2401. return smalltalk.withContext(function($ctx3) {
  2402. return self._sampleNewValue();
  2403. $ctx3.sendIdx["sampleNewValue"]=1;
  2404. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2405. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2406. $3=self._sampleNewValue();
  2407. $ctx2.sendIdx["sampleNewValue"]=2;
  2408. self._assert_equals_($1,$3);
  2409. $ctx2.sendIdx["assert:equals:"]=1;
  2410. return self._assert_(_st(visited)._isNil());
  2411. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2412. self._samplesDo_((function(index,value){
  2413. return smalltalk.withContext(function($ctx2) {
  2414. visited=nil;
  2415. visited;
  2416. $5=self._collection();
  2417. $ctx2.sendIdx["collection"]=2;
  2418. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2419. return smalltalk.withContext(function($ctx3) {
  2420. visited=value2;
  2421. visited;
  2422. return sentinel;
  2423. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,5)})}),(function(){
  2424. return smalltalk.withContext(function($ctx3) {
  2425. return self._sampleNewValue();
  2426. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2427. self._assert_equals_($4,sentinel);
  2428. $ctx2.sendIdx["assert:equals:"]=2;
  2429. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2430. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2431. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2432. args: [],
  2433. 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) ]",
  2434. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2435. referencedClasses: ["Object"]
  2436. }),
  2437. smalltalk.IndexableCollectionTest);
  2438. smalltalk.addMethod(
  2439. smalltalk.method({
  2440. selector: "testAtPut",
  2441. protocol: 'tests',
  2442. fn: function (){
  2443. var self=this;
  2444. var newCollection;
  2445. return smalltalk.withContext(function($ctx1) {
  2446. newCollection=self._collection();
  2447. $ctx1.sendIdx["collection"]=1;
  2448. self._samplesDo_((function(index,value){
  2449. return smalltalk.withContext(function($ctx2) {
  2450. return _st(newCollection)._at_put_(index,value);
  2451. $ctx2.sendIdx["at:put:"]=1;
  2452. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2453. self._assert_equals_(newCollection,self._collection());
  2454. $ctx1.sendIdx["assert:equals:"]=1;
  2455. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2456. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2457. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2458. args: [],
  2459. 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",
  2460. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2461. referencedClasses: []
  2462. }),
  2463. smalltalk.IndexableCollectionTest);
  2464. smalltalk.addMethod(
  2465. smalltalk.method({
  2466. selector: "testIndexOf",
  2467. protocol: 'tests',
  2468. fn: function (){
  2469. var self=this;
  2470. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2471. return smalltalk.withContext(function($ctx1) {
  2472. var $1;
  2473. self._should_raise_((function(){
  2474. return smalltalk.withContext(function($ctx2) {
  2475. $1=self._collection();
  2476. $ctx2.sendIdx["collection"]=1;
  2477. return _st($1)._indexOf_(self._sampleNewValue());
  2478. $ctx2.sendIdx["indexOf:"]=1;
  2479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2480. self._samplesDo_((function(index,value){
  2481. return smalltalk.withContext(function($ctx2) {
  2482. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2483. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2484. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  2485. args: [],
  2486. 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 ]",
  2487. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2488. referencedClasses: ["Error"]
  2489. }),
  2490. smalltalk.IndexableCollectionTest);
  2491. smalltalk.addMethod(
  2492. smalltalk.method({
  2493. selector: "testWithIndexDo",
  2494. protocol: 'tests',
  2495. fn: function (){
  2496. var self=this;
  2497. var collection;
  2498. return smalltalk.withContext(function($ctx1) {
  2499. collection=self._collection();
  2500. $ctx1.sendIdx["collection"]=1;
  2501. _st(self._collection())._withIndexDo_((function(each,index){
  2502. return smalltalk.withContext(function($ctx2) {
  2503. return self._assert_equals_(_st(collection)._at_(index),each);
  2504. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2505. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  2506. args: [],
  2507. 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 ]",
  2508. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2509. referencedClasses: []
  2510. }),
  2511. smalltalk.IndexableCollectionTest);
  2512. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2513. smalltalk.addMethod(
  2514. smalltalk.method({
  2515. selector: "collection",
  2516. protocol: 'fixture',
  2517. fn: function (){
  2518. var self=this;
  2519. return smalltalk.withContext(function($ctx1) {
  2520. var $2,$3,$4,$1;
  2521. $2="b".__minus_gt((1));
  2522. $ctx1.sendIdx["->"]=1;
  2523. $3="a".__minus_gt((2));
  2524. $ctx1.sendIdx["->"]=2;
  2525. $4="c".__minus_gt((3));
  2526. $ctx1.sendIdx["->"]=3;
  2527. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  2528. return $1;
  2529. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  2530. args: [],
  2531. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  2532. messageSends: ["->"],
  2533. referencedClasses: []
  2534. }),
  2535. smalltalk.HashedCollectionTest);
  2536. smalltalk.addMethod(
  2537. smalltalk.method({
  2538. selector: "collectionOfPrintStrings",
  2539. protocol: 'fixture',
  2540. fn: function (){
  2541. var self=this;
  2542. return smalltalk.withContext(function($ctx1) {
  2543. var $2,$3,$4,$1;
  2544. $2="b".__minus_gt("1");
  2545. $ctx1.sendIdx["->"]=1;
  2546. $3="a".__minus_gt("2");
  2547. $ctx1.sendIdx["->"]=2;
  2548. $4="c".__minus_gt("3");
  2549. $ctx1.sendIdx["->"]=3;
  2550. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt("-4")]);
  2551. return $1;
  2552. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.HashedCollectionTest)})},
  2553. args: [],
  2554. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  2555. messageSends: ["->"],
  2556. referencedClasses: []
  2557. }),
  2558. smalltalk.HashedCollectionTest);
  2559. smalltalk.addMethod(
  2560. smalltalk.method({
  2561. selector: "collectionSize",
  2562. protocol: 'fixture',
  2563. fn: function (){
  2564. var self=this;
  2565. return smalltalk.withContext(function($ctx1) {
  2566. return (4);
  2567. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.HashedCollectionTest)})},
  2568. args: [],
  2569. source: "collectionSize\x0a\x09^ 4",
  2570. messageSends: [],
  2571. referencedClasses: []
  2572. }),
  2573. smalltalk.HashedCollectionTest);
  2574. smalltalk.addMethod(
  2575. smalltalk.method({
  2576. selector: "collectionWithDuplicates",
  2577. protocol: 'fixture',
  2578. fn: function (){
  2579. var self=this;
  2580. return smalltalk.withContext(function($ctx1) {
  2581. var $2,$3,$4,$5,$6,$7,$1;
  2582. $2="b".__minus_gt((1));
  2583. $ctx1.sendIdx["->"]=1;
  2584. $3="a".__minus_gt((2));
  2585. $ctx1.sendIdx["->"]=2;
  2586. $4="c".__minus_gt((3));
  2587. $ctx1.sendIdx["->"]=3;
  2588. $5="d".__minus_gt((-4));
  2589. $ctx1.sendIdx["->"]=4;
  2590. $6="e".__minus_gt((1));
  2591. $ctx1.sendIdx["->"]=5;
  2592. $7="f".__minus_gt((2));
  2593. $ctx1.sendIdx["->"]=6;
  2594. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  2595. return $1;
  2596. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  2597. args: [],
  2598. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  2599. messageSends: ["->"],
  2600. referencedClasses: []
  2601. }),
  2602. smalltalk.HashedCollectionTest);
  2603. smalltalk.addMethod(
  2604. smalltalk.method({
  2605. selector: "collectionWithNewValue",
  2606. protocol: 'fixture',
  2607. fn: function (){
  2608. var self=this;
  2609. return smalltalk.withContext(function($ctx1) {
  2610. var $2,$3,$4,$5,$1;
  2611. $2="b".__minus_gt((1));
  2612. $ctx1.sendIdx["->"]=1;
  2613. $3="a".__minus_gt((2));
  2614. $ctx1.sendIdx["->"]=2;
  2615. $4="c".__minus_gt((3));
  2616. $ctx1.sendIdx["->"]=3;
  2617. $5="d".__minus_gt((-4));
  2618. $ctx1.sendIdx["->"]=4;
  2619. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  2620. return $1;
  2621. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.HashedCollectionTest)})},
  2622. args: [],
  2623. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  2624. messageSends: ["->"],
  2625. referencedClasses: []
  2626. }),
  2627. smalltalk.HashedCollectionTest);
  2628. smalltalk.addMethod(
  2629. smalltalk.method({
  2630. selector: "nonIndexesDo:",
  2631. protocol: 'fixture',
  2632. fn: function (aBlock){
  2633. var self=this;
  2634. return smalltalk.withContext(function($ctx1) {
  2635. _st(aBlock)._value_((5));
  2636. $ctx1.sendIdx["value:"]=1;
  2637. _st(aBlock)._value_("z");
  2638. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2639. args: ["aBlock"],
  2640. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2641. messageSends: ["value:"],
  2642. referencedClasses: []
  2643. }),
  2644. smalltalk.HashedCollectionTest);
  2645. smalltalk.addMethod(
  2646. smalltalk.method({
  2647. selector: "sampleNewIndex",
  2648. protocol: 'fixture',
  2649. fn: function (){
  2650. var self=this;
  2651. return smalltalk.withContext(function($ctx1) {
  2652. return "new";
  2653. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.HashedCollectionTest)})},
  2654. args: [],
  2655. source: "sampleNewIndex\x0a\x09^ 'new'",
  2656. messageSends: [],
  2657. referencedClasses: []
  2658. }),
  2659. smalltalk.HashedCollectionTest);
  2660. smalltalk.addMethod(
  2661. smalltalk.method({
  2662. selector: "sampleNewValueAsCollection",
  2663. protocol: 'fixture',
  2664. fn: function (){
  2665. var self=this;
  2666. return smalltalk.withContext(function($ctx1) {
  2667. var $1;
  2668. $1=smalltalk.HashedCollection._from_(["new".__minus_gt("N")]);
  2669. return $1;
  2670. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.HashedCollectionTest)})},
  2671. args: [],
  2672. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  2673. messageSends: ["->"],
  2674. referencedClasses: []
  2675. }),
  2676. smalltalk.HashedCollectionTest);
  2677. smalltalk.addMethod(
  2678. smalltalk.method({
  2679. selector: "samplesDo:",
  2680. protocol: 'fixture',
  2681. fn: function (aBlock){
  2682. var self=this;
  2683. return smalltalk.withContext(function($ctx1) {
  2684. _st(aBlock)._value_value_("a",(2));
  2685. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2686. args: ["aBlock"],
  2687. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2688. messageSends: ["value:value:"],
  2689. referencedClasses: []
  2690. }),
  2691. smalltalk.HashedCollectionTest);
  2692. smalltalk.addMethod(
  2693. smalltalk.method({
  2694. selector: "testAddAll",
  2695. protocol: 'tests',
  2696. fn: function (){
  2697. var self=this;
  2698. return smalltalk.withContext(function($ctx1) {
  2699. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2700. smalltalk.HashedCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2701. $2=self._collection();
  2702. $ctx1.sendIdx["collection"]=1;
  2703. $3=$2;
  2704. $4=self._collection();
  2705. $ctx1.sendIdx["collection"]=2;
  2706. _st($3)._addAll_($4);
  2707. $ctx1.sendIdx["addAll:"]=1;
  2708. $5=_st($2)._yourself();
  2709. $ctx1.sendIdx["yourself"]=1;
  2710. $1=$5;
  2711. $6=self._collection();
  2712. $ctx1.sendIdx["collection"]=3;
  2713. self._assert_equals_($1,$6);
  2714. $ctx1.sendIdx["assert:equals:"]=1;
  2715. $8=self._collection();
  2716. $ctx1.sendIdx["collection"]=4;
  2717. $9=$8;
  2718. $10=self._collectionWithNewValue();
  2719. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2720. _st($9)._addAll_($10);
  2721. $ctx1.sendIdx["addAll:"]=2;
  2722. $11=_st($8)._yourself();
  2723. $ctx1.sendIdx["yourself"]=2;
  2724. $7=$11;
  2725. $12=self._collectionWithNewValue();
  2726. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2727. self._assert_equals_($7,$12);
  2728. $ctx1.sendIdx["assert:equals:"]=2;
  2729. $14=self._collectionWithNewValue();
  2730. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2731. _st($14)._addAll_(self._collection());
  2732. $15=_st($14)._yourself();
  2733. $13=$15;
  2734. self._assert_equals_($13,self._collectionWithNewValue());
  2735. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.HashedCollectionTest)})},
  2736. args: [],
  2737. 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",
  2738. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2739. referencedClasses: []
  2740. }),
  2741. smalltalk.HashedCollectionTest);
  2742. smalltalk.addMethod(
  2743. smalltalk.method({
  2744. selector: "testAsDictionary",
  2745. protocol: 'tests',
  2746. fn: function (){
  2747. var self=this;
  2748. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2749. return smalltalk.withContext(function($ctx1) {
  2750. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2751. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  2752. args: [],
  2753. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2754. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2755. referencedClasses: ["Dictionary"]
  2756. }),
  2757. smalltalk.HashedCollectionTest);
  2758. smalltalk.addMethod(
  2759. smalltalk.method({
  2760. selector: "testComma",
  2761. protocol: 'tests',
  2762. fn: function (){
  2763. var self=this;
  2764. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2765. return smalltalk.withContext(function($ctx1) {
  2766. var $1;
  2767. self._should_raise_((function(){
  2768. return smalltalk.withContext(function($ctx2) {
  2769. $1=self._collection();
  2770. $ctx2.sendIdx["collection"]=1;
  2771. return _st($1).__comma(self._collection());
  2772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2773. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.HashedCollectionTest)})},
  2774. args: [],
  2775. source: "testComma\x0a\x09self should: [ self collection, self collection ] raise: Error",
  2776. messageSends: ["should:raise:", ",", "collection"],
  2777. referencedClasses: ["Error"]
  2778. }),
  2779. smalltalk.HashedCollectionTest);
  2780. smalltalk.addMethod(
  2781. smalltalk.method({
  2782. selector: "testFrom",
  2783. protocol: 'tests',
  2784. fn: function (){
  2785. var self=this;
  2786. var associations;
  2787. return smalltalk.withContext(function($ctx1) {
  2788. var $1,$2,$3,$5,$4;
  2789. $1="a".__minus_gt((1));
  2790. $ctx1.sendIdx["->"]=1;
  2791. $2="b".__minus_gt((2));
  2792. $ctx1.sendIdx["->"]=2;
  2793. associations=[$1,$2];
  2794. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2795. $5="a".__minus_gt((1));
  2796. $ctx1.sendIdx["->"]=3;
  2797. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2798. self._assertSameContents_as_($3,$4);
  2799. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  2800. args: [],
  2801. 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 }.",
  2802. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2803. referencedClasses: []
  2804. }),
  2805. smalltalk.HashedCollectionTest);
  2806. smalltalk.addMethod(
  2807. smalltalk.method({
  2808. selector: "testNewFromPairs",
  2809. protocol: 'tests',
  2810. fn: function (){
  2811. var self=this;
  2812. var flattenedAssociations;
  2813. return smalltalk.withContext(function($ctx1) {
  2814. var $1,$3,$2;
  2815. flattenedAssociations=["a",(1),"b",(2)];
  2816. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2817. $3="a".__minus_gt((1));
  2818. $ctx1.sendIdx["->"]=1;
  2819. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2820. self._assertSameContents_as_($1,$2);
  2821. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  2822. args: [],
  2823. 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 }.",
  2824. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2825. referencedClasses: []
  2826. }),
  2827. smalltalk.HashedCollectionTest);
  2828. smalltalk.addMethod(
  2829. smalltalk.method({
  2830. selector: "collectionClass",
  2831. protocol: 'fixture',
  2832. fn: function (){
  2833. var self=this;
  2834. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2835. return smalltalk.withContext(function($ctx1) {
  2836. return $HashedCollection();
  2837. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  2838. args: [],
  2839. source: "collectionClass\x0a\x09^ HashedCollection",
  2840. messageSends: [],
  2841. referencedClasses: ["HashedCollection"]
  2842. }),
  2843. smalltalk.HashedCollectionTest.klass);
  2844. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  2845. smalltalk.addMethod(
  2846. smalltalk.method({
  2847. selector: "collection",
  2848. protocol: 'fixture',
  2849. fn: function (){
  2850. var self=this;
  2851. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2852. return smalltalk.withContext(function($ctx1) {
  2853. var $2,$3,$1;
  2854. $2=_st($Dictionary())._new();
  2855. _st($2)._at_put_((1),(1));
  2856. $ctx1.sendIdx["at:put:"]=1;
  2857. _st($2)._at_put_("a",(2));
  2858. $ctx1.sendIdx["at:put:"]=2;
  2859. _st($2)._at_put_(true,(3));
  2860. $ctx1.sendIdx["at:put:"]=3;
  2861. _st($2)._at_put_((1).__at((3)),(-4));
  2862. $3=_st($2)._yourself();
  2863. $1=$3;
  2864. return $1;
  2865. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  2866. args: [],
  2867. 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",
  2868. messageSends: ["at:put:", "new", "@", "yourself"],
  2869. referencedClasses: ["Dictionary"]
  2870. }),
  2871. smalltalk.DictionaryTest);
  2872. smalltalk.addMethod(
  2873. smalltalk.method({
  2874. selector: "collectionOfPrintStrings",
  2875. protocol: 'fixture',
  2876. fn: function (){
  2877. var self=this;
  2878. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2879. return smalltalk.withContext(function($ctx1) {
  2880. var $2,$3,$1;
  2881. $2=_st($Dictionary())._new();
  2882. _st($2)._at_put_((1),"1");
  2883. $ctx1.sendIdx["at:put:"]=1;
  2884. _st($2)._at_put_("a","2");
  2885. $ctx1.sendIdx["at:put:"]=2;
  2886. _st($2)._at_put_(true,"3");
  2887. $ctx1.sendIdx["at:put:"]=3;
  2888. _st($2)._at_put_((1).__at((3)),"-4");
  2889. $3=_st($2)._yourself();
  2890. $1=$3;
  2891. return $1;
  2892. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.DictionaryTest)})},
  2893. args: [],
  2894. 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",
  2895. messageSends: ["at:put:", "new", "@", "yourself"],
  2896. referencedClasses: ["Dictionary"]
  2897. }),
  2898. smalltalk.DictionaryTest);
  2899. smalltalk.addMethod(
  2900. smalltalk.method({
  2901. selector: "collectionSize",
  2902. protocol: 'fixture',
  2903. fn: function (){
  2904. var self=this;
  2905. return smalltalk.withContext(function($ctx1) {
  2906. return (4);
  2907. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.DictionaryTest)})},
  2908. args: [],
  2909. source: "collectionSize\x0a\x09^ 4",
  2910. messageSends: [],
  2911. referencedClasses: []
  2912. }),
  2913. smalltalk.DictionaryTest);
  2914. smalltalk.addMethod(
  2915. smalltalk.method({
  2916. selector: "collectionWithDuplicates",
  2917. protocol: 'fixture',
  2918. fn: function (){
  2919. var self=this;
  2920. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2921. return smalltalk.withContext(function($ctx1) {
  2922. var $2,$3,$1;
  2923. $2=_st($Dictionary())._new();
  2924. _st($2)._at_put_((1),(1));
  2925. $ctx1.sendIdx["at:put:"]=1;
  2926. _st($2)._at_put_("a",(2));
  2927. $ctx1.sendIdx["at:put:"]=2;
  2928. _st($2)._at_put_(true,(3));
  2929. $ctx1.sendIdx["at:put:"]=3;
  2930. _st($2)._at_put_((4),(-4));
  2931. $ctx1.sendIdx["at:put:"]=4;
  2932. _st($2)._at_put_("b",(1));
  2933. $ctx1.sendIdx["at:put:"]=5;
  2934. _st($2)._at_put_((3),(3));
  2935. $ctx1.sendIdx["at:put:"]=6;
  2936. _st($2)._at_put_(false,(12));
  2937. $3=_st($2)._yourself();
  2938. $1=$3;
  2939. return $1;
  2940. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  2941. args: [],
  2942. 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",
  2943. messageSends: ["at:put:", "new", "yourself"],
  2944. referencedClasses: ["Dictionary"]
  2945. }),
  2946. smalltalk.DictionaryTest);
  2947. smalltalk.addMethod(
  2948. smalltalk.method({
  2949. selector: "collectionWithNewValue",
  2950. protocol: 'fixture',
  2951. fn: function (){
  2952. var self=this;
  2953. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2954. return smalltalk.withContext(function($ctx1) {
  2955. var $2,$3,$1;
  2956. $2=_st($Dictionary())._new();
  2957. _st($2)._at_put_((1),(1));
  2958. $ctx1.sendIdx["at:put:"]=1;
  2959. _st($2)._at_put_("a",(2));
  2960. $ctx1.sendIdx["at:put:"]=2;
  2961. _st($2)._at_put_(true,(3));
  2962. $ctx1.sendIdx["at:put:"]=3;
  2963. _st($2)._at_put_((1).__at((3)),(-4));
  2964. $ctx1.sendIdx["at:put:"]=4;
  2965. _st($2)._at_put_("new","N");
  2966. $3=_st($2)._yourself();
  2967. $1=$3;
  2968. return $1;
  2969. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.DictionaryTest)})},
  2970. args: [],
  2971. 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",
  2972. messageSends: ["at:put:", "new", "@", "yourself"],
  2973. referencedClasses: ["Dictionary"]
  2974. }),
  2975. smalltalk.DictionaryTest);
  2976. smalltalk.addMethod(
  2977. smalltalk.method({
  2978. selector: "sampleNewValueAsCollection",
  2979. protocol: 'fixture',
  2980. fn: function (){
  2981. var self=this;
  2982. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2983. return smalltalk.withContext(function($ctx1) {
  2984. var $2,$3,$1;
  2985. $2=_st($Dictionary())._new();
  2986. _st($2)._at_put_("new","N");
  2987. $3=_st($2)._yourself();
  2988. $1=$3;
  2989. return $1;
  2990. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.DictionaryTest)})},
  2991. args: [],
  2992. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  2993. messageSends: ["at:put:", "new", "yourself"],
  2994. referencedClasses: ["Dictionary"]
  2995. }),
  2996. smalltalk.DictionaryTest);
  2997. smalltalk.addMethod(
  2998. smalltalk.method({
  2999. selector: "samplesDo:",
  3000. protocol: 'fixture',
  3001. fn: function (aBlock){
  3002. var self=this;
  3003. return smalltalk.withContext(function($ctx1) {
  3004. smalltalk.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3005. _st(aBlock)._value_value_(true,(3));
  3006. $ctx1.sendIdx["value:value:"]=1;
  3007. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3008. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.DictionaryTest)})},
  3009. args: ["aBlock"],
  3010. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3011. messageSends: ["samplesDo:", "value:value:", "@"],
  3012. referencedClasses: []
  3013. }),
  3014. smalltalk.DictionaryTest);
  3015. smalltalk.addMethod(
  3016. smalltalk.method({
  3017. selector: "testAccessing",
  3018. protocol: 'tests',
  3019. fn: function (){
  3020. var self=this;
  3021. var d;
  3022. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3023. return smalltalk.withContext(function($ctx1) {
  3024. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3025. d=_st($Dictionary())._new();
  3026. _st(d)._at_put_("hello","world");
  3027. $ctx1.sendIdx["at:put:"]=1;
  3028. $1=_st(d)._at_("hello");
  3029. $ctx1.sendIdx["at:"]=1;
  3030. self._assert_equals_($1,"world");
  3031. $ctx1.sendIdx["assert:equals:"]=1;
  3032. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3033. return smalltalk.withContext(function($ctx2) {
  3034. return nil;
  3035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3036. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3037. self._assert_equals_($2,"world");
  3038. $ctx1.sendIdx["assert:equals:"]=2;
  3039. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3040. return smalltalk.withContext(function($ctx2) {
  3041. return nil;
  3042. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  3043. $ctx1.sendIdx["deny:"]=1;
  3044. $3=_st(d)._includesKey_("hello");
  3045. $ctx1.sendIdx["includesKey:"]=1;
  3046. self._assert_($3);
  3047. $ctx1.sendIdx["assert:"]=1;
  3048. $4=_st(d)._includesKey_("foo");
  3049. $ctx1.sendIdx["includesKey:"]=2;
  3050. self._deny_($4);
  3051. $ctx1.sendIdx["deny:"]=2;
  3052. _st(d)._at_put_((1),(2));
  3053. $ctx1.sendIdx["at:put:"]=2;
  3054. $5=_st(d)._at_((1));
  3055. $ctx1.sendIdx["at:"]=2;
  3056. self._assert_equals_($5,(2));
  3057. $ctx1.sendIdx["assert:equals:"]=3;
  3058. $6=d;
  3059. $7=(1).__at((3));
  3060. $ctx1.sendIdx["@"]=1;
  3061. _st($6)._at_put_($7,(3));
  3062. $9=d;
  3063. $10=(1).__at((3));
  3064. $ctx1.sendIdx["@"]=2;
  3065. $8=_st($9)._at_($10);
  3066. self._assert_equals_($8,(3));
  3067. $12=d;
  3068. $13=(1).__at((3));
  3069. $ctx1.sendIdx["@"]=3;
  3070. $11=_st($12)._includesKey_($13);
  3071. $ctx1.sendIdx["includesKey:"]=3;
  3072. self._assert_($11);
  3073. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3074. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  3075. args: [],
  3076. 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)",
  3077. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3078. referencedClasses: ["Dictionary"]
  3079. }),
  3080. smalltalk.DictionaryTest);
  3081. smalltalk.addMethod(
  3082. smalltalk.method({
  3083. selector: "testAsHashedCollection",
  3084. protocol: 'tests',
  3085. fn: function (){
  3086. var self=this;
  3087. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3088. return smalltalk.withContext(function($ctx1) {
  3089. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  3090. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  3091. args: [],
  3092. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  3093. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  3094. referencedClasses: ["HashedCollection"]
  3095. }),
  3096. smalltalk.DictionaryTest);
  3097. smalltalk.addMethod(
  3098. smalltalk.method({
  3099. selector: "testDynamicDictionaries",
  3100. protocol: 'tests',
  3101. fn: function (){
  3102. var self=this;
  3103. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3104. return smalltalk.withContext(function($ctx1) {
  3105. var $3,$2,$1;
  3106. $3="hello".__minus_gt((1));
  3107. $ctx1.sendIdx["->"]=1;
  3108. $2=smalltalk.HashedCollection._from_([$3]);
  3109. $1=_st($2)._asDictionary();
  3110. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  3111. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  3112. args: [],
  3113. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3114. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  3115. referencedClasses: ["Dictionary"]
  3116. }),
  3117. smalltalk.DictionaryTest);
  3118. smalltalk.addMethod(
  3119. smalltalk.method({
  3120. selector: "testEquality",
  3121. protocol: 'tests',
  3122. fn: function (){
  3123. var self=this;
  3124. var d1,d2;
  3125. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3126. return smalltalk.withContext(function($ctx1) {
  3127. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  3128. $2=_st($Dictionary())._new();
  3129. $ctx1.sendIdx["new"]=1;
  3130. $3=_st($Dictionary())._new();
  3131. $ctx1.sendIdx["new"]=2;
  3132. $1=_st($2).__eq($3);
  3133. $ctx1.sendIdx["="]=1;
  3134. self._assert_($1);
  3135. $ctx1.sendIdx["assert:"]=1;
  3136. $4=_st($Dictionary())._new();
  3137. $ctx1.sendIdx["new"]=3;
  3138. _st($4)._at_put_((1),(2));
  3139. $ctx1.sendIdx["at:put:"]=1;
  3140. $5=_st($4)._yourself();
  3141. $ctx1.sendIdx["yourself"]=1;
  3142. d1=$5;
  3143. $6=_st($Dictionary())._new();
  3144. $ctx1.sendIdx["new"]=4;
  3145. _st($6)._at_put_((1),(2));
  3146. $ctx1.sendIdx["at:put:"]=2;
  3147. $7=_st($6)._yourself();
  3148. $ctx1.sendIdx["yourself"]=2;
  3149. d2=$7;
  3150. $8=_st(d1).__eq(d2);
  3151. $ctx1.sendIdx["="]=2;
  3152. self._assert_($8);
  3153. $9=_st($Dictionary())._new();
  3154. $ctx1.sendIdx["new"]=5;
  3155. _st($9)._at_put_((1),(3));
  3156. $ctx1.sendIdx["at:put:"]=3;
  3157. $10=_st($9)._yourself();
  3158. $ctx1.sendIdx["yourself"]=3;
  3159. d2=$10;
  3160. $11=_st(d1).__eq(d2);
  3161. $ctx1.sendIdx["="]=3;
  3162. self._deny_($11);
  3163. $ctx1.sendIdx["deny:"]=1;
  3164. $12=_st($Dictionary())._new();
  3165. $ctx1.sendIdx["new"]=6;
  3166. _st($12)._at_put_((2),(2));
  3167. $ctx1.sendIdx["at:put:"]=4;
  3168. $13=_st($12)._yourself();
  3169. $ctx1.sendIdx["yourself"]=4;
  3170. d2=$13;
  3171. $14=_st(d1).__eq(d2);
  3172. $ctx1.sendIdx["="]=4;
  3173. self._deny_($14);
  3174. $ctx1.sendIdx["deny:"]=2;
  3175. $15=_st($Dictionary())._new();
  3176. _st($15)._at_put_((1),(2));
  3177. $ctx1.sendIdx["at:put:"]=5;
  3178. _st($15)._at_put_((3),(4));
  3179. $16=_st($15)._yourself();
  3180. d2=$16;
  3181. self._deny_(_st(d1).__eq(d2));
  3182. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  3183. args: [],
  3184. source: "testEquality\x0a\x09| d1 d2 |\x0a\x0a\x09self assert: (Dictionary new = Dictionary new).\x0a\x09\x09\x0a\x09d1 := Dictionary new at: 1 put: 2; yourself.\x0a\x09d2 := Dictionary new at: 1 put: 2; yourself.\x0a\x09self assert: (d1 = d2).\x0a\x0a\x09d2 := Dictionary new at: 1 put: 3; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 2 put: 2; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 1 put: 2; at: 3 put: 4; yourself.\x0a\x09self deny: d1 = d2.",
  3185. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  3186. referencedClasses: ["Dictionary"]
  3187. }),
  3188. smalltalk.DictionaryTest);
  3189. smalltalk.addMethod(
  3190. smalltalk.method({
  3191. selector: "testKeys",
  3192. protocol: 'tests',
  3193. fn: function (){
  3194. var self=this;
  3195. var d;
  3196. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3197. return smalltalk.withContext(function($ctx1) {
  3198. d=_st($Dictionary())._new();
  3199. _st(d)._at_put_((1),(2));
  3200. $ctx1.sendIdx["at:put:"]=1;
  3201. _st(d)._at_put_((2),(3));
  3202. $ctx1.sendIdx["at:put:"]=2;
  3203. _st(d)._at_put_((3),(4));
  3204. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  3205. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  3206. args: [],
  3207. source: "testKeys\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d keys equals: #(1 2 3)",
  3208. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  3209. referencedClasses: ["Dictionary"]
  3210. }),
  3211. smalltalk.DictionaryTest);
  3212. smalltalk.addMethod(
  3213. smalltalk.method({
  3214. selector: "testPointKey",
  3215. protocol: 'tests',
  3216. fn: function (){
  3217. var self=this;
  3218. var d;
  3219. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3220. return smalltalk.withContext(function($ctx1) {
  3221. var $1,$2,$4,$5,$3,$6,$7,$9,$10,$8,$11,$12,$14,$15,$13;
  3222. d=_st($Dictionary())._new();
  3223. $1=d;
  3224. $2=(1).__at((1));
  3225. $ctx1.sendIdx["@"]=1;
  3226. _st($1)._at_put_($2,"foo");
  3227. $ctx1.sendIdx["at:put:"]=1;
  3228. $4=d;
  3229. $5=(1).__at((1));
  3230. $ctx1.sendIdx["@"]=2;
  3231. $3=_st($4)._at_($5);
  3232. $ctx1.sendIdx["at:"]=1;
  3233. self._assert_equals_($3,"foo");
  3234. $ctx1.sendIdx["assert:equals:"]=1;
  3235. $6=d;
  3236. $7=(1).__at((1));
  3237. $ctx1.sendIdx["@"]=3;
  3238. _st($6)._at_put_($7,"bar");
  3239. $9=d;
  3240. $10=(1).__at((1));
  3241. $ctx1.sendIdx["@"]=4;
  3242. $8=_st($9)._at_($10);
  3243. self._assert_equals_($8,"bar");
  3244. $ctx1.sendIdx["assert:equals:"]=2;
  3245. $11=d;
  3246. $12=(1).__at((1));
  3247. $ctx1.sendIdx["@"]=5;
  3248. _st($11)._removeKey_($12);
  3249. $14=d;
  3250. $15=(1).__at((1));
  3251. $ctx1.sendIdx["@"]=6;
  3252. $13=_st($14)._at_ifAbsent_($15,(function(){
  3253. return smalltalk.withContext(function($ctx2) {
  3254. return "baz";
  3255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3256. self._assert_equals_($13,"baz");
  3257. self._deny_(_st(d)._includesKey_((1).__at((1))));
  3258. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  3259. args: [],
  3260. source: "testPointKey\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09\x0a\x09d at: 1@1 put: 'foo'.\x0a\x09self assert: (d at: 1@1) equals: 'foo'.\x0a\x09d at: 1@1 put: 'bar'.\x0a\x09self assert: (d at: 1@1) equals: 'bar'.\x0a\x09d removeKey: 1@1.\x0a\x09self assert: (d at: 1@1 ifAbsent: [ 'baz' ]) equals: 'baz'.\x0a\x09self deny: (d includesKey: 1@1)",
  3261. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  3262. referencedClasses: ["Dictionary"]
  3263. }),
  3264. smalltalk.DictionaryTest);
  3265. smalltalk.addMethod(
  3266. smalltalk.method({
  3267. selector: "testPrintString",
  3268. protocol: 'tests',
  3269. fn: function (){
  3270. var self=this;
  3271. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3272. return smalltalk.withContext(function($ctx1) {
  3273. var $2,$3,$1;
  3274. $2=_st($Dictionary())._new();
  3275. _st($2)._at_put_("firstname","James");
  3276. $ctx1.sendIdx["at:put:"]=1;
  3277. _st($2)._at_put_("lastname","Bond");
  3278. $3=_st($2)._printString();
  3279. $1=$3;
  3280. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  3281. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  3282. args: [],
  3283. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (Dictionary new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a Dictionary (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  3284. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  3285. referencedClasses: ["Dictionary"]
  3286. }),
  3287. smalltalk.DictionaryTest);
  3288. smalltalk.addMethod(
  3289. smalltalk.method({
  3290. selector: "testRemoveKey",
  3291. protocol: 'tests',
  3292. fn: function (){
  3293. var self=this;
  3294. var d,key;
  3295. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3296. return smalltalk.withContext(function($ctx1) {
  3297. var $1;
  3298. d=_st($Dictionary())._new();
  3299. _st(d)._at_put_((1),(2));
  3300. $ctx1.sendIdx["at:put:"]=1;
  3301. _st(d)._at_put_((2),(3));
  3302. $ctx1.sendIdx["at:put:"]=2;
  3303. _st(d)._at_put_((3),(4));
  3304. key=(2);
  3305. $1=_st(d)._keys();
  3306. $ctx1.sendIdx["keys"]=1;
  3307. self._assert_equals_($1,[(1), (2), (3)]);
  3308. $ctx1.sendIdx["assert:equals:"]=1;
  3309. _st(d)._removeKey_(key);
  3310. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  3311. $ctx1.sendIdx["assert:equals:"]=2;
  3312. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  3313. self._deny_(_st(d)._includesKey_((2)));
  3314. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  3315. args: [],
  3316. source: "testRemoveKey\x0a\x09| d key |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09key := 2.\x0a\x0a\x09self assert: d keys equals: #(1 2 3).\x0a\x0a\x09d removeKey: key.\x0a\x09self assert: d keys equals: #(1 3).\x0a\x09self assert: d values equals: #(2 4).\x0a\x09self deny: (d includesKey: 2)",
  3317. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  3318. referencedClasses: ["Dictionary"]
  3319. }),
  3320. smalltalk.DictionaryTest);
  3321. smalltalk.addMethod(
  3322. smalltalk.method({
  3323. selector: "testRemoveKeyIfAbsent",
  3324. protocol: 'tests',
  3325. fn: function (){
  3326. var self=this;
  3327. var d,key;
  3328. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3329. return smalltalk.withContext(function($ctx1) {
  3330. var $1;
  3331. d=_st($Dictionary())._new();
  3332. _st(d)._at_put_((1),(2));
  3333. $ctx1.sendIdx["at:put:"]=1;
  3334. _st(d)._at_put_((2),(3));
  3335. $ctx1.sendIdx["at:put:"]=2;
  3336. _st(d)._at_put_((3),(4));
  3337. key=(2);
  3338. self._assert_equals_(_st(d)._removeKey_(key),(3));
  3339. $ctx1.sendIdx["assert:equals:"]=1;
  3340. key=(3);
  3341. $1=_st(d)._removeKey_ifAbsent_(key,(function(){
  3342. return smalltalk.withContext(function($ctx2) {
  3343. return (42);
  3344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3345. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  3346. self._assert_equals_($1,(4));
  3347. $ctx1.sendIdx["assert:equals:"]=2;
  3348. key="why";
  3349. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  3350. return smalltalk.withContext(function($ctx2) {
  3351. return (42);
  3352. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  3353. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  3354. args: [],
  3355. source: "testRemoveKeyIfAbsent\x0a\x09| d key |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09key := 2.\x0a\x09self assert: (d removeKey: key) equals: 3.\x0a\x0a\x09key := 3.\x0a\x09self assert: (d removeKey: key ifAbsent: [ 42 ]) equals: 4.\x0a\x0a\x09key := 'why'.\x0a\x09self assert: (d removeKey: key ifAbsent: [ 42 ] ) equals: 42.",
  3356. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  3357. referencedClasses: ["Dictionary"]
  3358. }),
  3359. smalltalk.DictionaryTest);
  3360. smalltalk.addMethod(
  3361. smalltalk.method({
  3362. selector: "testValues",
  3363. protocol: 'tests',
  3364. fn: function (){
  3365. var self=this;
  3366. var d;
  3367. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3368. return smalltalk.withContext(function($ctx1) {
  3369. d=_st($Dictionary())._new();
  3370. _st(d)._at_put_((1),(2));
  3371. $ctx1.sendIdx["at:put:"]=1;
  3372. _st(d)._at_put_((2),(3));
  3373. $ctx1.sendIdx["at:put:"]=2;
  3374. _st(d)._at_put_((3),(4));
  3375. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  3376. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  3377. args: [],
  3378. source: "testValues\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d values equals: #(2 3 4)",
  3379. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  3380. referencedClasses: ["Dictionary"]
  3381. }),
  3382. smalltalk.DictionaryTest);
  3383. smalltalk.addMethod(
  3384. smalltalk.method({
  3385. selector: "collectionClass",
  3386. protocol: 'fixture',
  3387. fn: function (){
  3388. var self=this;
  3389. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3390. return smalltalk.withContext(function($ctx1) {
  3391. return $Dictionary();
  3392. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  3393. args: [],
  3394. source: "collectionClass\x0a\x09^ Dictionary",
  3395. messageSends: [],
  3396. referencedClasses: ["Dictionary"]
  3397. }),
  3398. smalltalk.DictionaryTest.klass);
  3399. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  3400. smalltalk.addMethod(
  3401. smalltalk.method({
  3402. selector: "collectionFirst",
  3403. protocol: 'fixture',
  3404. fn: function (){
  3405. var self=this;
  3406. return smalltalk.withContext(function($ctx1) {
  3407. self._subclassResponsibility();
  3408. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.SequenceableCollectionTest)})},
  3409. args: [],
  3410. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3411. messageSends: ["subclassResponsibility"],
  3412. referencedClasses: []
  3413. }),
  3414. smalltalk.SequenceableCollectionTest);
  3415. smalltalk.addMethod(
  3416. smalltalk.method({
  3417. selector: "collectionFirstTwo",
  3418. protocol: 'fixture',
  3419. fn: function (){
  3420. var self=this;
  3421. return smalltalk.withContext(function($ctx1) {
  3422. self._subclassResponsibility();
  3423. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.SequenceableCollectionTest)})},
  3424. args: [],
  3425. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3426. messageSends: ["subclassResponsibility"],
  3427. referencedClasses: []
  3428. }),
  3429. smalltalk.SequenceableCollectionTest);
  3430. smalltalk.addMethod(
  3431. smalltalk.method({
  3432. selector: "collectionLast",
  3433. protocol: 'fixture',
  3434. fn: function (){
  3435. var self=this;
  3436. return smalltalk.withContext(function($ctx1) {
  3437. self._subclassResponsibility();
  3438. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.SequenceableCollectionTest)})},
  3439. args: [],
  3440. source: "collectionLast\x0a\x09self subclassResponsibility",
  3441. messageSends: ["subclassResponsibility"],
  3442. referencedClasses: []
  3443. }),
  3444. smalltalk.SequenceableCollectionTest);
  3445. smalltalk.addMethod(
  3446. smalltalk.method({
  3447. selector: "collectionLastTwo",
  3448. protocol: 'fixture',
  3449. fn: function (){
  3450. var self=this;
  3451. return smalltalk.withContext(function($ctx1) {
  3452. self._subclassResponsibility();
  3453. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.SequenceableCollectionTest)})},
  3454. args: [],
  3455. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3456. messageSends: ["subclassResponsibility"],
  3457. referencedClasses: []
  3458. }),
  3459. smalltalk.SequenceableCollectionTest);
  3460. smalltalk.addMethod(
  3461. smalltalk.method({
  3462. selector: "nonIndexesDo:",
  3463. protocol: 'fixture',
  3464. fn: function (aBlock){
  3465. var self=this;
  3466. return smalltalk.withContext(function($ctx1) {
  3467. _st(aBlock)._value_((0));
  3468. $ctx1.sendIdx["value:"]=1;
  3469. _st(aBlock)._value_(_st(_st(self._collection())._size()).__plus((1)));
  3470. $ctx1.sendIdx["value:"]=2;
  3471. _st(aBlock)._value_("z");
  3472. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3473. args: ["aBlock"],
  3474. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collection size + 1.\x0a\x09aBlock value: 'z'",
  3475. messageSends: ["value:", "+", "size", "collection"],
  3476. referencedClasses: []
  3477. }),
  3478. smalltalk.SequenceableCollectionTest);
  3479. smalltalk.addMethod(
  3480. smalltalk.method({
  3481. selector: "samplesDo:",
  3482. protocol: 'fixture',
  3483. fn: function (aBlock){
  3484. var self=this;
  3485. return smalltalk.withContext(function($ctx1) {
  3486. _st(aBlock)._value_value_((1),self._collectionFirst());
  3487. $ctx1.sendIdx["value:value:"]=1;
  3488. _st(aBlock)._value_value_(_st(self._collection())._size(),self._collectionLast());
  3489. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3490. args: ["aBlock"],
  3491. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collection size value: self collectionLast",
  3492. messageSends: ["value:value:", "collectionFirst", "size", "collection", "collectionLast"],
  3493. referencedClasses: []
  3494. }),
  3495. smalltalk.SequenceableCollectionTest);
  3496. smalltalk.addMethod(
  3497. smalltalk.method({
  3498. selector: "testBeginsWith",
  3499. protocol: 'tests',
  3500. fn: function (){
  3501. var self=this;
  3502. return smalltalk.withContext(function($ctx1) {
  3503. var $2,$1,$4,$5,$3,$7,$6;
  3504. $2=self._collection();
  3505. $ctx1.sendIdx["collection"]=1;
  3506. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3507. $ctx1.sendIdx["beginsWith:"]=1;
  3508. self._assert_($1);
  3509. $ctx1.sendIdx["assert:"]=1;
  3510. $4=self._collection();
  3511. $ctx1.sendIdx["collection"]=2;
  3512. $5=self._collection();
  3513. $ctx1.sendIdx["collection"]=3;
  3514. $3=_st($4)._beginsWith_($5);
  3515. $ctx1.sendIdx["beginsWith:"]=2;
  3516. self._assert_($3);
  3517. $ctx1.sendIdx["assert:"]=2;
  3518. $7=self._collection();
  3519. $ctx1.sendIdx["collection"]=4;
  3520. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3521. $ctx1.sendIdx["beginsWith:"]=3;
  3522. self._assert_($6);
  3523. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3524. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  3525. args: [],
  3526. 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)",
  3527. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3528. referencedClasses: []
  3529. }),
  3530. smalltalk.SequenceableCollectionTest);
  3531. smalltalk.addMethod(
  3532. smalltalk.method({
  3533. selector: "testEndsWith",
  3534. protocol: 'tests',
  3535. fn: function (){
  3536. var self=this;
  3537. return smalltalk.withContext(function($ctx1) {
  3538. var $2,$1,$4,$5,$3,$7,$6;
  3539. $2=self._collection();
  3540. $ctx1.sendIdx["collection"]=1;
  3541. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3542. $ctx1.sendIdx["endsWith:"]=1;
  3543. self._assert_($1);
  3544. $ctx1.sendIdx["assert:"]=1;
  3545. $4=self._collection();
  3546. $ctx1.sendIdx["collection"]=2;
  3547. $5=self._collection();
  3548. $ctx1.sendIdx["collection"]=3;
  3549. $3=_st($4)._endsWith_($5);
  3550. $ctx1.sendIdx["endsWith:"]=2;
  3551. self._assert_($3);
  3552. $ctx1.sendIdx["assert:"]=2;
  3553. $7=self._collection();
  3554. $ctx1.sendIdx["collection"]=4;
  3555. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3556. $ctx1.sendIdx["endsWith:"]=3;
  3557. self._assert_($6);
  3558. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3559. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  3560. args: [],
  3561. 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)",
  3562. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3563. referencedClasses: []
  3564. }),
  3565. smalltalk.SequenceableCollectionTest);
  3566. smalltalk.addMethod(
  3567. smalltalk.method({
  3568. selector: "testFirst",
  3569. protocol: 'tests',
  3570. fn: function (){
  3571. var self=this;
  3572. return smalltalk.withContext(function($ctx1) {
  3573. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3574. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  3575. args: [],
  3576. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3577. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3578. referencedClasses: []
  3579. }),
  3580. smalltalk.SequenceableCollectionTest);
  3581. smalltalk.addMethod(
  3582. smalltalk.method({
  3583. selector: "testFirstN",
  3584. protocol: 'tests',
  3585. fn: function (){
  3586. var self=this;
  3587. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3588. return smalltalk.withContext(function($ctx1) {
  3589. var $2,$1,$4,$3,$6,$8,$7,$5,$9;
  3590. $2=self._collection();
  3591. $ctx1.sendIdx["collection"]=1;
  3592. $1=_st($2)._first_((2));
  3593. $ctx1.sendIdx["first:"]=1;
  3594. self._assert_equals_($1,self._collectionFirstTwo());
  3595. $ctx1.sendIdx["assert:equals:"]=1;
  3596. $4=self._collection();
  3597. $ctx1.sendIdx["collection"]=2;
  3598. $3=_st($4)._first_((0));
  3599. $ctx1.sendIdx["first:"]=2;
  3600. self._assert_equals_($3,_st(self._collectionClass())._new());
  3601. $ctx1.sendIdx["assert:equals:"]=2;
  3602. $6=self._collection();
  3603. $ctx1.sendIdx["collection"]=3;
  3604. $8=self._collection();
  3605. $ctx1.sendIdx["collection"]=4;
  3606. $7=_st($8)._size();
  3607. $5=_st($6)._first_($7);
  3608. $ctx1.sendIdx["first:"]=3;
  3609. $9=self._collection();
  3610. $ctx1.sendIdx["collection"]=5;
  3611. self._assert_equals_($5,$9);
  3612. self._should_raise_((function(){
  3613. return smalltalk.withContext(function($ctx2) {
  3614. return _st(self._collection())._first_((33));
  3615. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3616. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  3617. args: [],
  3618. 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 collection size)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  3619. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "size", "should:raise:"],
  3620. referencedClasses: ["Error"]
  3621. }),
  3622. smalltalk.SequenceableCollectionTest);
  3623. smalltalk.addMethod(
  3624. smalltalk.method({
  3625. selector: "testFourth",
  3626. protocol: 'tests',
  3627. fn: function (){
  3628. var self=this;
  3629. return smalltalk.withContext(function($ctx1) {
  3630. var $2,$1;
  3631. $2=self._collection();
  3632. $ctx1.sendIdx["collection"]=1;
  3633. $1=_st($2)._fourth();
  3634. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3635. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  3636. args: [],
  3637. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3638. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3639. referencedClasses: []
  3640. }),
  3641. smalltalk.SequenceableCollectionTest);
  3642. smalltalk.addMethod(
  3643. smalltalk.method({
  3644. selector: "testLast",
  3645. protocol: 'tests',
  3646. fn: function (){
  3647. var self=this;
  3648. return smalltalk.withContext(function($ctx1) {
  3649. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3650. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  3651. args: [],
  3652. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3653. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3654. referencedClasses: []
  3655. }),
  3656. smalltalk.SequenceableCollectionTest);
  3657. smalltalk.addMethod(
  3658. smalltalk.method({
  3659. selector: "testLastN",
  3660. protocol: 'tests',
  3661. fn: function (){
  3662. var self=this;
  3663. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3664. return smalltalk.withContext(function($ctx1) {
  3665. var $2,$1,$4,$3,$6,$8,$7,$5,$9;
  3666. $2=self._collection();
  3667. $ctx1.sendIdx["collection"]=1;
  3668. $1=_st($2)._last_((2));
  3669. $ctx1.sendIdx["last:"]=1;
  3670. self._assert_equals_($1,self._collectionLastTwo());
  3671. $ctx1.sendIdx["assert:equals:"]=1;
  3672. $4=self._collection();
  3673. $ctx1.sendIdx["collection"]=2;
  3674. $3=_st($4)._last_((0));
  3675. $ctx1.sendIdx["last:"]=2;
  3676. self._assert_equals_($3,_st(self._collectionClass())._new());
  3677. $ctx1.sendIdx["assert:equals:"]=2;
  3678. $6=self._collection();
  3679. $ctx1.sendIdx["collection"]=3;
  3680. $8=self._collection();
  3681. $ctx1.sendIdx["collection"]=4;
  3682. $7=_st($8)._size();
  3683. $5=_st($6)._last_($7);
  3684. $ctx1.sendIdx["last:"]=3;
  3685. $9=self._collection();
  3686. $ctx1.sendIdx["collection"]=5;
  3687. self._assert_equals_($5,$9);
  3688. self._should_raise_((function(){
  3689. return smalltalk.withContext(function($ctx2) {
  3690. return _st(self._collection())._last_((33));
  3691. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3692. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  3693. args: [],
  3694. 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 collection size)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  3695. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "size", "should:raise:"],
  3696. referencedClasses: ["Error"]
  3697. }),
  3698. smalltalk.SequenceableCollectionTest);
  3699. smalltalk.addMethod(
  3700. smalltalk.method({
  3701. selector: "testSecond",
  3702. protocol: 'tests',
  3703. fn: function (){
  3704. var self=this;
  3705. return smalltalk.withContext(function($ctx1) {
  3706. var $2,$1;
  3707. $2=self._collection();
  3708. $ctx1.sendIdx["collection"]=1;
  3709. $1=_st($2)._second();
  3710. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3711. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  3712. args: [],
  3713. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3714. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3715. referencedClasses: []
  3716. }),
  3717. smalltalk.SequenceableCollectionTest);
  3718. smalltalk.addMethod(
  3719. smalltalk.method({
  3720. selector: "testThird",
  3721. protocol: 'tests',
  3722. fn: function (){
  3723. var self=this;
  3724. return smalltalk.withContext(function($ctx1) {
  3725. var $2,$1;
  3726. $2=self._collection();
  3727. $ctx1.sendIdx["collection"]=1;
  3728. $1=_st($2)._third();
  3729. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3730. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  3731. args: [],
  3732. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3733. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3734. referencedClasses: []
  3735. }),
  3736. smalltalk.SequenceableCollectionTest);
  3737. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3738. smalltalk.addMethod(
  3739. smalltalk.method({
  3740. selector: "collection",
  3741. protocol: 'fixture',
  3742. fn: function (){
  3743. var self=this;
  3744. return smalltalk.withContext(function($ctx1) {
  3745. var $1;
  3746. $1=[(1), (2), (3), (-4)];
  3747. return $1;
  3748. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  3749. args: [],
  3750. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3751. messageSends: [],
  3752. referencedClasses: []
  3753. }),
  3754. smalltalk.ArrayTest);
  3755. smalltalk.addMethod(
  3756. smalltalk.method({
  3757. selector: "collectionFirst",
  3758. protocol: 'fixture',
  3759. fn: function (){
  3760. var self=this;
  3761. return smalltalk.withContext(function($ctx1) {
  3762. return (1);
  3763. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.ArrayTest)})},
  3764. args: [],
  3765. source: "collectionFirst\x0a\x09^ 1",
  3766. messageSends: [],
  3767. referencedClasses: []
  3768. }),
  3769. smalltalk.ArrayTest);
  3770. smalltalk.addMethod(
  3771. smalltalk.method({
  3772. selector: "collectionFirstTwo",
  3773. protocol: 'fixture',
  3774. fn: function (){
  3775. var self=this;
  3776. return smalltalk.withContext(function($ctx1) {
  3777. var $1;
  3778. $1=[(1), (2)];
  3779. return $1;
  3780. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.ArrayTest)})},
  3781. args: [],
  3782. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3783. messageSends: [],
  3784. referencedClasses: []
  3785. }),
  3786. smalltalk.ArrayTest);
  3787. smalltalk.addMethod(
  3788. smalltalk.method({
  3789. selector: "collectionLast",
  3790. protocol: 'fixture',
  3791. fn: function (){
  3792. var self=this;
  3793. return smalltalk.withContext(function($ctx1) {
  3794. return (-4);
  3795. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.ArrayTest)})},
  3796. args: [],
  3797. source: "collectionLast\x0a\x09^ -4",
  3798. messageSends: [],
  3799. referencedClasses: []
  3800. }),
  3801. smalltalk.ArrayTest);
  3802. smalltalk.addMethod(
  3803. smalltalk.method({
  3804. selector: "collectionLastTwo",
  3805. protocol: 'fixture',
  3806. fn: function (){
  3807. var self=this;
  3808. return smalltalk.withContext(function($ctx1) {
  3809. var $1;
  3810. $1=[(3), (-4)];
  3811. return $1;
  3812. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.ArrayTest)})},
  3813. args: [],
  3814. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3815. messageSends: [],
  3816. referencedClasses: []
  3817. }),
  3818. smalltalk.ArrayTest);
  3819. smalltalk.addMethod(
  3820. smalltalk.method({
  3821. selector: "collectionOfPrintStrings",
  3822. protocol: 'fixture',
  3823. fn: function (){
  3824. var self=this;
  3825. return smalltalk.withContext(function($ctx1) {
  3826. var $1;
  3827. $1=["1", "2", "3", "-4"];
  3828. return $1;
  3829. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.ArrayTest)})},
  3830. args: [],
  3831. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  3832. messageSends: [],
  3833. referencedClasses: []
  3834. }),
  3835. smalltalk.ArrayTest);
  3836. smalltalk.addMethod(
  3837. smalltalk.method({
  3838. selector: "collectionSize",
  3839. protocol: 'fixture',
  3840. fn: function (){
  3841. var self=this;
  3842. return smalltalk.withContext(function($ctx1) {
  3843. return (4);
  3844. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.ArrayTest)})},
  3845. args: [],
  3846. source: "collectionSize\x0a\x09^ 4",
  3847. messageSends: [],
  3848. referencedClasses: []
  3849. }),
  3850. smalltalk.ArrayTest);
  3851. smalltalk.addMethod(
  3852. smalltalk.method({
  3853. selector: "collectionWithDuplicates",
  3854. protocol: 'fixture',
  3855. fn: function (){
  3856. var self=this;
  3857. return smalltalk.withContext(function($ctx1) {
  3858. var $1;
  3859. $1=["a", "b", "c", (1), (2), (1), "a"];
  3860. return $1;
  3861. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  3862. args: [],
  3863. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  3864. messageSends: [],
  3865. referencedClasses: []
  3866. }),
  3867. smalltalk.ArrayTest);
  3868. smalltalk.addMethod(
  3869. smalltalk.method({
  3870. selector: "collectionWithNewValue",
  3871. protocol: 'fixture',
  3872. fn: function (){
  3873. var self=this;
  3874. return smalltalk.withContext(function($ctx1) {
  3875. var $1;
  3876. $1=[(1), (2), (3), (-4), "N"];
  3877. return $1;
  3878. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.ArrayTest)})},
  3879. args: [],
  3880. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  3881. messageSends: [],
  3882. referencedClasses: []
  3883. }),
  3884. smalltalk.ArrayTest);
  3885. smalltalk.addMethod(
  3886. smalltalk.method({
  3887. selector: "sampleNewIndex",
  3888. protocol: 'fixture',
  3889. fn: function (){
  3890. var self=this;
  3891. return smalltalk.withContext(function($ctx1) {
  3892. return (5);
  3893. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.ArrayTest)})},
  3894. args: [],
  3895. source: "sampleNewIndex\x0a\x09^ 5",
  3896. messageSends: [],
  3897. referencedClasses: []
  3898. }),
  3899. smalltalk.ArrayTest);
  3900. smalltalk.addMethod(
  3901. smalltalk.method({
  3902. selector: "samplesDo:",
  3903. protocol: 'fixture',
  3904. fn: function (aBlock){
  3905. var self=this;
  3906. return smalltalk.withContext(function($ctx1) {
  3907. smalltalk.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3908. _st(aBlock)._value_value_((3),(3));
  3909. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.ArrayTest)})},
  3910. args: ["aBlock"],
  3911. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  3912. messageSends: ["samplesDo:", "value:value:"],
  3913. referencedClasses: []
  3914. }),
  3915. smalltalk.ArrayTest);
  3916. smalltalk.addMethod(
  3917. smalltalk.method({
  3918. selector: "testAdd",
  3919. protocol: 'tests',
  3920. fn: function (){
  3921. var self=this;
  3922. var array;
  3923. return smalltalk.withContext(function($ctx1) {
  3924. array=self._collection();
  3925. _st(array)._add_((6));
  3926. self._assert_equals_(_st(array)._last(),(6));
  3927. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  3928. args: [],
  3929. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  3930. messageSends: ["collection", "add:", "assert:equals:", "last"],
  3931. referencedClasses: []
  3932. }),
  3933. smalltalk.ArrayTest);
  3934. smalltalk.addMethod(
  3935. smalltalk.method({
  3936. selector: "testAddFirst",
  3937. protocol: 'tests',
  3938. fn: function (){
  3939. var self=this;
  3940. return smalltalk.withContext(function($ctx1) {
  3941. var $1,$2;
  3942. $1=self._collection();
  3943. _st($1)._addFirst_((0));
  3944. $2=_st($1)._yourself();
  3945. self._assert_equals_(_st($2)._first(),(0));
  3946. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  3947. args: [],
  3948. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  3949. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  3950. referencedClasses: []
  3951. }),
  3952. smalltalk.ArrayTest);
  3953. smalltalk.addMethod(
  3954. smalltalk.method({
  3955. selector: "testPrintString",
  3956. protocol: 'tests',
  3957. fn: function (){
  3958. var self=this;
  3959. var array;
  3960. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3961. return smalltalk.withContext(function($ctx1) {
  3962. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  3963. array=_st($Array())._new();
  3964. $1=_st(array)._printString();
  3965. $ctx1.sendIdx["printString"]=1;
  3966. self._assert_equals_($1,"an Array ()");
  3967. $ctx1.sendIdx["assert:equals:"]=1;
  3968. $2=array;
  3969. _st($2)._add_((1));
  3970. $ctx1.sendIdx["add:"]=1;
  3971. $3=_st($2)._add_((3));
  3972. $ctx1.sendIdx["add:"]=2;
  3973. $4=_st(array)._printString();
  3974. $ctx1.sendIdx["printString"]=2;
  3975. self._assert_equals_($4,"an Array (1 3)");
  3976. $ctx1.sendIdx["assert:equals:"]=2;
  3977. _st(array)._add_("foo");
  3978. $5=_st(array)._printString();
  3979. $ctx1.sendIdx["printString"]=3;
  3980. self._assert_equals_($5,"an Array (1 3 'foo')");
  3981. $ctx1.sendIdx["assert:equals:"]=3;
  3982. $6=array;
  3983. _st($6)._remove_((1));
  3984. $ctx1.sendIdx["remove:"]=1;
  3985. $7=_st($6)._remove_((3));
  3986. $8=_st(array)._printString();
  3987. $ctx1.sendIdx["printString"]=4;
  3988. self._assert_equals_($8,"an Array ('foo')");
  3989. $ctx1.sendIdx["assert:equals:"]=4;
  3990. _st(array)._addLast_((3));
  3991. $ctx1.sendIdx["addLast:"]=1;
  3992. $9=_st(array)._printString();
  3993. $ctx1.sendIdx["printString"]=5;
  3994. self._assert_equals_($9,"an Array ('foo' 3)");
  3995. $ctx1.sendIdx["assert:equals:"]=5;
  3996. _st(array)._addLast_((3));
  3997. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  3998. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  3999. args: [],
  4000. 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)'.",
  4001. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4002. referencedClasses: ["Array"]
  4003. }),
  4004. smalltalk.ArrayTest);
  4005. smalltalk.addMethod(
  4006. smalltalk.method({
  4007. selector: "testRemove",
  4008. protocol: 'tests',
  4009. fn: function (){
  4010. var self=this;
  4011. var array;
  4012. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4013. return smalltalk.withContext(function($ctx1) {
  4014. array=[(1), (2), (3), (4), (5)];
  4015. _st(array)._remove_((3));
  4016. $ctx1.sendIdx["remove:"]=1;
  4017. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4018. self._should_raise_((function(){
  4019. return smalltalk.withContext(function($ctx2) {
  4020. return _st(array)._remove_((3));
  4021. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4022. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  4023. args: [],
  4024. 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",
  4025. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4026. referencedClasses: ["Error"]
  4027. }),
  4028. smalltalk.ArrayTest);
  4029. smalltalk.addMethod(
  4030. smalltalk.method({
  4031. selector: "testRemoveFromTo",
  4032. protocol: 'tests',
  4033. fn: function (){
  4034. var self=this;
  4035. return smalltalk.withContext(function($ctx1) {
  4036. var $1,$2;
  4037. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4038. $ctx1.sendIdx["removeFrom:to:"]=1;
  4039. self._assert_equals_($1,[(4)]);
  4040. $ctx1.sendIdx["assert:equals:"]=1;
  4041. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4042. $ctx1.sendIdx["removeFrom:to:"]=2;
  4043. self._assert_equals_($2,[(1), (4)]);
  4044. $ctx1.sendIdx["assert:equals:"]=2;
  4045. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4046. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  4047. args: [],
  4048. 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)",
  4049. messageSends: ["assert:equals:", "removeFrom:to:"],
  4050. referencedClasses: []
  4051. }),
  4052. smalltalk.ArrayTest);
  4053. smalltalk.addMethod(
  4054. smalltalk.method({
  4055. selector: "testRemoveIndex",
  4056. protocol: 'tests',
  4057. fn: function (){
  4058. var self=this;
  4059. return smalltalk.withContext(function($ctx1) {
  4060. var $1,$2;
  4061. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4062. $ctx1.sendIdx["removeIndex:"]=1;
  4063. self._assert_equals_($1,[(1), (3), (4)]);
  4064. $ctx1.sendIdx["assert:equals:"]=1;
  4065. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4066. $ctx1.sendIdx["removeIndex:"]=2;
  4067. self._assert_equals_($2,[(2), (3), (4)]);
  4068. $ctx1.sendIdx["assert:equals:"]=2;
  4069. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4070. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  4071. args: [],
  4072. 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: #()",
  4073. messageSends: ["assert:equals:", "removeIndex:"],
  4074. referencedClasses: []
  4075. }),
  4076. smalltalk.ArrayTest);
  4077. smalltalk.addMethod(
  4078. smalltalk.method({
  4079. selector: "testRemoveLast",
  4080. protocol: 'tests',
  4081. fn: function (){
  4082. var self=this;
  4083. var array;
  4084. return smalltalk.withContext(function($ctx1) {
  4085. array=[(1), (2)];
  4086. _st(array)._removeLast();
  4087. self._assert_equals_(_st(array)._last(),(1));
  4088. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  4089. args: [],
  4090. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4091. messageSends: ["removeLast", "assert:equals:", "last"],
  4092. referencedClasses: []
  4093. }),
  4094. smalltalk.ArrayTest);
  4095. smalltalk.addMethod(
  4096. smalltalk.method({
  4097. selector: "testReversed",
  4098. protocol: 'tests',
  4099. fn: function (){
  4100. var self=this;
  4101. var array;
  4102. return smalltalk.withContext(function($ctx1) {
  4103. array=[(5), (4), (3), (2), (1)];
  4104. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4105. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  4106. args: [],
  4107. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4108. messageSends: ["assert:equals:", "reversed"],
  4109. referencedClasses: []
  4110. }),
  4111. smalltalk.ArrayTest);
  4112. smalltalk.addMethod(
  4113. smalltalk.method({
  4114. selector: "testSort",
  4115. protocol: 'tests',
  4116. fn: function (){
  4117. var self=this;
  4118. var array;
  4119. return smalltalk.withContext(function($ctx1) {
  4120. array=[(3), (1), (4), (5), (2)];
  4121. _st(array)._sort();
  4122. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  4123. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  4124. args: [],
  4125. source: "testSort\x0a\x09| array |\x0a\x09array := #(3 1 4 5 2). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 2 3 4 5)",
  4126. messageSends: ["sort", "assert:equals:"],
  4127. referencedClasses: []
  4128. }),
  4129. smalltalk.ArrayTest);
  4130. smalltalk.addMethod(
  4131. smalltalk.method({
  4132. selector: "collectionClass",
  4133. protocol: 'fixture',
  4134. fn: function (){
  4135. var self=this;
  4136. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4137. return smalltalk.withContext(function($ctx1) {
  4138. return $Array();
  4139. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  4140. args: [],
  4141. source: "collectionClass\x0a\x09^ Array",
  4142. messageSends: [],
  4143. referencedClasses: ["Array"]
  4144. }),
  4145. smalltalk.ArrayTest.klass);
  4146. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  4147. smalltalk.addMethod(
  4148. smalltalk.method({
  4149. selector: "collection",
  4150. protocol: 'fixture',
  4151. fn: function (){
  4152. var self=this;
  4153. return smalltalk.withContext(function($ctx1) {
  4154. return "hello";
  4155. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  4156. args: [],
  4157. source: "collection\x0a\x09^ 'hello'",
  4158. messageSends: [],
  4159. referencedClasses: []
  4160. }),
  4161. smalltalk.StringTest);
  4162. smalltalk.addMethod(
  4163. smalltalk.method({
  4164. selector: "collectionFirst",
  4165. protocol: 'fixture',
  4166. fn: function (){
  4167. var self=this;
  4168. return smalltalk.withContext(function($ctx1) {
  4169. return "h";
  4170. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.StringTest)})},
  4171. args: [],
  4172. source: "collectionFirst\x0a\x09^ 'h'",
  4173. messageSends: [],
  4174. referencedClasses: []
  4175. }),
  4176. smalltalk.StringTest);
  4177. smalltalk.addMethod(
  4178. smalltalk.method({
  4179. selector: "collectionFirstTwo",
  4180. protocol: 'fixture',
  4181. fn: function (){
  4182. var self=this;
  4183. return smalltalk.withContext(function($ctx1) {
  4184. return "he";
  4185. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.StringTest)})},
  4186. args: [],
  4187. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4188. messageSends: [],
  4189. referencedClasses: []
  4190. }),
  4191. smalltalk.StringTest);
  4192. smalltalk.addMethod(
  4193. smalltalk.method({
  4194. selector: "collectionLast",
  4195. protocol: 'fixture',
  4196. fn: function (){
  4197. var self=this;
  4198. return smalltalk.withContext(function($ctx1) {
  4199. return "o";
  4200. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.StringTest)})},
  4201. args: [],
  4202. source: "collectionLast\x0a\x09^ 'o'",
  4203. messageSends: [],
  4204. referencedClasses: []
  4205. }),
  4206. smalltalk.StringTest);
  4207. smalltalk.addMethod(
  4208. smalltalk.method({
  4209. selector: "collectionLastTwo",
  4210. protocol: 'fixture',
  4211. fn: function (){
  4212. var self=this;
  4213. return smalltalk.withContext(function($ctx1) {
  4214. return "lo";
  4215. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.StringTest)})},
  4216. args: [],
  4217. source: "collectionLastTwo\x0a\x09^ 'lo'",
  4218. messageSends: [],
  4219. referencedClasses: []
  4220. }),
  4221. smalltalk.StringTest);
  4222. smalltalk.addMethod(
  4223. smalltalk.method({
  4224. selector: "collectionOfPrintStrings",
  4225. protocol: 'fixture',
  4226. fn: function (){
  4227. var self=this;
  4228. return smalltalk.withContext(function($ctx1) {
  4229. return "'h''e''l''l''o'";
  4230. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.StringTest)})},
  4231. args: [],
  4232. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''l''''o'''",
  4233. messageSends: [],
  4234. referencedClasses: []
  4235. }),
  4236. smalltalk.StringTest);
  4237. smalltalk.addMethod(
  4238. smalltalk.method({
  4239. selector: "collectionSize",
  4240. protocol: 'fixture',
  4241. fn: function (){
  4242. var self=this;
  4243. return smalltalk.withContext(function($ctx1) {
  4244. return (5);
  4245. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.StringTest)})},
  4246. args: [],
  4247. source: "collectionSize\x0a\x09^ 5",
  4248. messageSends: [],
  4249. referencedClasses: []
  4250. }),
  4251. smalltalk.StringTest);
  4252. smalltalk.addMethod(
  4253. smalltalk.method({
  4254. selector: "collectionWithDuplicates",
  4255. protocol: 'fixture',
  4256. fn: function (){
  4257. var self=this;
  4258. return smalltalk.withContext(function($ctx1) {
  4259. return "abbaerte";
  4260. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  4261. args: [],
  4262. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4263. messageSends: [],
  4264. referencedClasses: []
  4265. }),
  4266. smalltalk.StringTest);
  4267. smalltalk.addMethod(
  4268. smalltalk.method({
  4269. selector: "collectionWithNewValue",
  4270. protocol: 'fixture',
  4271. fn: function (){
  4272. var self=this;
  4273. return smalltalk.withContext(function($ctx1) {
  4274. return "helloN";
  4275. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.StringTest)})},
  4276. args: [],
  4277. source: "collectionWithNewValue\x0a\x09^ 'helloN'",
  4278. messageSends: [],
  4279. referencedClasses: []
  4280. }),
  4281. smalltalk.StringTest);
  4282. smalltalk.addMethod(
  4283. smalltalk.method({
  4284. selector: "sampleNewValueAsCollection",
  4285. protocol: 'fixture',
  4286. fn: function (){
  4287. var self=this;
  4288. return smalltalk.withContext(function($ctx1) {
  4289. return "N";
  4290. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.StringTest)})},
  4291. args: [],
  4292. source: "sampleNewValueAsCollection\x0a\x09\x0a\x09^ 'N'",
  4293. messageSends: [],
  4294. referencedClasses: []
  4295. }),
  4296. smalltalk.StringTest);
  4297. smalltalk.addMethod(
  4298. smalltalk.method({
  4299. selector: "samplesDo:",
  4300. protocol: 'fixture',
  4301. fn: function (aBlock){
  4302. var self=this;
  4303. return smalltalk.withContext(function($ctx1) {
  4304. smalltalk.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4305. _st(aBlock)._value_value_((3),"l");
  4306. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.StringTest)})},
  4307. args: ["aBlock"],
  4308. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4309. messageSends: ["samplesDo:", "value:value:"],
  4310. referencedClasses: []
  4311. }),
  4312. smalltalk.StringTest);
  4313. smalltalk.addMethod(
  4314. smalltalk.method({
  4315. selector: "testAddAll",
  4316. protocol: 'tests',
  4317. fn: function (){
  4318. var self=this;
  4319. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4320. return smalltalk.withContext(function($ctx1) {
  4321. var $1;
  4322. self._should_raise_((function(){
  4323. return smalltalk.withContext(function($ctx2) {
  4324. $1=self._collection();
  4325. $ctx2.sendIdx["collection"]=1;
  4326. return _st($1)._addAll_(self._collection());
  4327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4328. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.StringTest)})},
  4329. args: [],
  4330. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4331. messageSends: ["should:raise:", "addAll:", "collection"],
  4332. referencedClasses: ["Error"]
  4333. }),
  4334. smalltalk.StringTest);
  4335. smalltalk.addMethod(
  4336. smalltalk.method({
  4337. selector: "testAddRemove",
  4338. protocol: 'tests',
  4339. fn: function (){
  4340. var self=this;
  4341. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4342. return smalltalk.withContext(function($ctx1) {
  4343. self._should_raise_((function(){
  4344. return smalltalk.withContext(function($ctx2) {
  4345. return "hello"._add_("a");
  4346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4347. $ctx1.sendIdx["should:raise:"]=1;
  4348. self._should_raise_((function(){
  4349. return smalltalk.withContext(function($ctx2) {
  4350. return "hello"._remove_("h");
  4351. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4352. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  4353. args: [],
  4354. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4355. messageSends: ["should:raise:", "add:", "remove:"],
  4356. referencedClasses: ["Error"]
  4357. }),
  4358. smalltalk.StringTest);
  4359. smalltalk.addMethod(
  4360. smalltalk.method({
  4361. selector: "testAsArray",
  4362. protocol: 'tests',
  4363. fn: function (){
  4364. var self=this;
  4365. return smalltalk.withContext(function($ctx1) {
  4366. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4367. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  4368. args: [],
  4369. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4370. messageSends: ["assert:equals:", "asArray"],
  4371. referencedClasses: []
  4372. }),
  4373. smalltalk.StringTest);
  4374. smalltalk.addMethod(
  4375. smalltalk.method({
  4376. selector: "testAsLowerCase",
  4377. protocol: 'tests',
  4378. fn: function (){
  4379. var self=this;
  4380. return smalltalk.withContext(function($ctx1) {
  4381. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4382. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  4383. args: [],
  4384. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4385. messageSends: ["assert:equals:", "asLowercase"],
  4386. referencedClasses: []
  4387. }),
  4388. smalltalk.StringTest);
  4389. smalltalk.addMethod(
  4390. smalltalk.method({
  4391. selector: "testAsNumber",
  4392. protocol: 'tests',
  4393. fn: function (){
  4394. var self=this;
  4395. return smalltalk.withContext(function($ctx1) {
  4396. var $1,$2;
  4397. $1="3"._asNumber();
  4398. $ctx1.sendIdx["asNumber"]=1;
  4399. self._assert_equals_($1,(3));
  4400. $ctx1.sendIdx["assert:equals:"]=1;
  4401. $2="-3"._asNumber();
  4402. $ctx1.sendIdx["asNumber"]=2;
  4403. self._assert_equals_($2,(-3));
  4404. $ctx1.sendIdx["assert:equals:"]=2;
  4405. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4406. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  4407. args: [],
  4408. 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.",
  4409. messageSends: ["assert:equals:", "asNumber"],
  4410. referencedClasses: []
  4411. }),
  4412. smalltalk.StringTest);
  4413. smalltalk.addMethod(
  4414. smalltalk.method({
  4415. selector: "testAsUpperCase",
  4416. protocol: 'tests',
  4417. fn: function (){
  4418. var self=this;
  4419. return smalltalk.withContext(function($ctx1) {
  4420. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4421. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  4422. args: [],
  4423. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4424. messageSends: ["assert:equals:", "asUppercase"],
  4425. referencedClasses: []
  4426. }),
  4427. smalltalk.StringTest);
  4428. smalltalk.addMethod(
  4429. smalltalk.method({
  4430. selector: "testAsciiValue",
  4431. protocol: 'tests',
  4432. fn: function (){
  4433. var self=this;
  4434. var characterA,characterU;
  4435. return smalltalk.withContext(function($ctx1) {
  4436. var $1;
  4437. characterA="A";
  4438. characterU="U";
  4439. $1=_st(characterA)._asciiValue();
  4440. $ctx1.sendIdx["asciiValue"]=1;
  4441. self._assert_equals_($1,(65));
  4442. $ctx1.sendIdx["assert:equals:"]=1;
  4443. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4444. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  4445. args: [],
  4446. 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",
  4447. messageSends: ["assert:equals:", "asciiValue"],
  4448. referencedClasses: []
  4449. }),
  4450. smalltalk.StringTest);
  4451. smalltalk.addMethod(
  4452. smalltalk.method({
  4453. selector: "testAtPut",
  4454. protocol: 'tests',
  4455. fn: function (){
  4456. var self=this;
  4457. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4458. return smalltalk.withContext(function($ctx1) {
  4459. self._should_raise_((function(){
  4460. return smalltalk.withContext(function($ctx2) {
  4461. return "hello"._at_put_((1),"a");
  4462. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4463. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  4464. args: [],
  4465. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4466. messageSends: ["should:raise:", "at:put:"],
  4467. referencedClasses: ["Error"]
  4468. }),
  4469. smalltalk.StringTest);
  4470. smalltalk.addMethod(
  4471. smalltalk.method({
  4472. selector: "testCapitalized",
  4473. protocol: 'tests',
  4474. fn: function (){
  4475. var self=this;
  4476. return smalltalk.withContext(function($ctx1) {
  4477. var $1,$2,$3;
  4478. $1="test"._capitalized();
  4479. $ctx1.sendIdx["capitalized"]=1;
  4480. self._assert_equals_($1,"Test");
  4481. $ctx1.sendIdx["assert:equals:"]=1;
  4482. $2="Test"._capitalized();
  4483. $ctx1.sendIdx["capitalized"]=2;
  4484. self._assert_equals_($2,"Test");
  4485. $ctx1.sendIdx["assert:equals:"]=2;
  4486. self._assert_equals_(""._capitalized(),"");
  4487. $ctx1.sendIdx["assert:equals:"]=3;
  4488. $3="Test"._isCapitalized();
  4489. $ctx1.sendIdx["isCapitalized"]=1;
  4490. self._assert_equals_($3,true);
  4491. $ctx1.sendIdx["assert:equals:"]=4;
  4492. self._assert_equals_("test"._isCapitalized(),false);
  4493. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  4494. args: [],
  4495. 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.",
  4496. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4497. referencedClasses: []
  4498. }),
  4499. smalltalk.StringTest);
  4500. smalltalk.addMethod(
  4501. smalltalk.method({
  4502. selector: "testCharCodeAt",
  4503. protocol: 'tests',
  4504. fn: function (){
  4505. var self=this;
  4506. return smalltalk.withContext(function($ctx1) {
  4507. var $1,$2,$3,$4,$5;
  4508. $1="jackie"._charCodeAt_((1));
  4509. $ctx1.sendIdx["charCodeAt:"]=1;
  4510. self._assert_equals_($1,(106));
  4511. $ctx1.sendIdx["assert:equals:"]=1;
  4512. $2="jackie"._charCodeAt_((2));
  4513. $ctx1.sendIdx["charCodeAt:"]=2;
  4514. self._assert_equals_($2,(97));
  4515. $ctx1.sendIdx["assert:equals:"]=2;
  4516. $3="jackie"._charCodeAt_((3));
  4517. $ctx1.sendIdx["charCodeAt:"]=3;
  4518. self._assert_equals_($3,(99));
  4519. $ctx1.sendIdx["assert:equals:"]=3;
  4520. $4="jackie"._charCodeAt_((4));
  4521. $ctx1.sendIdx["charCodeAt:"]=4;
  4522. self._assert_equals_($4,(107));
  4523. $ctx1.sendIdx["assert:equals:"]=4;
  4524. $5="jackie"._charCodeAt_((5));
  4525. $ctx1.sendIdx["charCodeAt:"]=5;
  4526. self._assert_equals_($5,(105));
  4527. $ctx1.sendIdx["assert:equals:"]=5;
  4528. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4529. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  4530. args: [],
  4531. 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",
  4532. messageSends: ["assert:equals:", "charCodeAt:"],
  4533. referencedClasses: []
  4534. }),
  4535. smalltalk.StringTest);
  4536. smalltalk.addMethod(
  4537. smalltalk.method({
  4538. selector: "testCopyFromTo",
  4539. protocol: 'tests',
  4540. fn: function (){
  4541. var self=this;
  4542. return smalltalk.withContext(function($ctx1) {
  4543. var $1;
  4544. $1="jackie"._copyFrom_to_((1),(3));
  4545. $ctx1.sendIdx["copyFrom:to:"]=1;
  4546. self._assert_equals_($1,"jac");
  4547. $ctx1.sendIdx["assert:equals:"]=1;
  4548. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4549. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  4550. args: [],
  4551. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4552. messageSends: ["assert:equals:", "copyFrom:to:"],
  4553. referencedClasses: []
  4554. }),
  4555. smalltalk.StringTest);
  4556. smalltalk.addMethod(
  4557. smalltalk.method({
  4558. selector: "testCopyWithoutAll",
  4559. protocol: 'tests',
  4560. fn: function (){
  4561. var self=this;
  4562. return smalltalk.withContext(function($ctx1) {
  4563. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4564. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  4565. args: [],
  4566. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4567. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4568. referencedClasses: []
  4569. }),
  4570. smalltalk.StringTest);
  4571. smalltalk.addMethod(
  4572. smalltalk.method({
  4573. selector: "testEquality",
  4574. protocol: 'tests',
  4575. fn: function (){
  4576. var self=this;
  4577. return smalltalk.withContext(function($ctx1) {
  4578. var $1,$2,$3;
  4579. self._assert_equals_("hello","hello");
  4580. $ctx1.sendIdx["assert:equals:"]=1;
  4581. $1="hello".__eq("world");
  4582. $ctx1.sendIdx["="]=1;
  4583. self._deny_($1);
  4584. $ctx1.sendIdx["deny:"]=1;
  4585. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4586. return smalltalk.withContext(function($ctx2) {
  4587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  4588. $ctx1.sendIdx["="]=2;
  4589. self._deny_($2);
  4590. $ctx1.sendIdx["deny:"]=2;
  4591. $3="hello"._yourself();
  4592. $ctx1.sendIdx["yourself"]=1;
  4593. self._assert_equals_("hello",$3);
  4594. $ctx1.sendIdx["assert:equals:"]=2;
  4595. self._assert_equals_("hello"._yourself(),"hello");
  4596. self._deny_("".__eq((0)));
  4597. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  4598. args: [],
  4599. 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",
  4600. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4601. referencedClasses: []
  4602. }),
  4603. smalltalk.StringTest);
  4604. smalltalk.addMethod(
  4605. smalltalk.method({
  4606. selector: "testIdentity",
  4607. protocol: 'tests',
  4608. fn: function (){
  4609. var self=this;
  4610. return smalltalk.withContext(function($ctx1) {
  4611. var $1,$2,$4,$3,$5;
  4612. $1="hello".__eq_eq("hello");
  4613. $ctx1.sendIdx["=="]=1;
  4614. self._assert_($1);
  4615. $ctx1.sendIdx["assert:"]=1;
  4616. $2="hello".__eq_eq("world");
  4617. $ctx1.sendIdx["=="]=2;
  4618. self._deny_($2);
  4619. $ctx1.sendIdx["deny:"]=1;
  4620. $4="hello"._yourself();
  4621. $ctx1.sendIdx["yourself"]=1;
  4622. $3="hello".__eq_eq($4);
  4623. $ctx1.sendIdx["=="]=3;
  4624. self._assert_($3);
  4625. $ctx1.sendIdx["assert:"]=2;
  4626. $5=_st("hello"._yourself()).__eq_eq("hello");
  4627. $ctx1.sendIdx["=="]=4;
  4628. self._assert_($5);
  4629. self._deny_("".__eq_eq((0)));
  4630. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  4631. args: [],
  4632. 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",
  4633. messageSends: ["assert:", "==", "deny:", "yourself"],
  4634. referencedClasses: []
  4635. }),
  4636. smalltalk.StringTest);
  4637. smalltalk.addMethod(
  4638. smalltalk.method({
  4639. selector: "testIdentityHash",
  4640. protocol: 'tests',
  4641. fn: function (){
  4642. var self=this;
  4643. return smalltalk.withContext(function($ctx1) {
  4644. var $1,$2,$4,$3;
  4645. $1="foo"._identityHash();
  4646. $ctx1.sendIdx["identityHash"]=1;
  4647. $2="foo"._identityHash();
  4648. $ctx1.sendIdx["identityHash"]=2;
  4649. self._assert_equals_($1,$2);
  4650. $4="foo"._identityHash();
  4651. $ctx1.sendIdx["identityHash"]=3;
  4652. $3=_st($4).__eq("bar"._identityHash());
  4653. self._deny_($3);
  4654. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  4655. args: [],
  4656. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4657. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4658. referencedClasses: []
  4659. }),
  4660. smalltalk.StringTest);
  4661. smalltalk.addMethod(
  4662. smalltalk.method({
  4663. selector: "testIncludesSubString",
  4664. protocol: 'tests',
  4665. fn: function (){
  4666. var self=this;
  4667. return smalltalk.withContext(function($ctx1) {
  4668. var $1;
  4669. $1="amber"._includesSubString_("ber");
  4670. $ctx1.sendIdx["includesSubString:"]=1;
  4671. self._assert_($1);
  4672. self._deny_("amber"._includesSubString_("zork"));
  4673. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  4674. args: [],
  4675. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4676. messageSends: ["assert:", "includesSubString:", "deny:"],
  4677. referencedClasses: []
  4678. }),
  4679. smalltalk.StringTest);
  4680. smalltalk.addMethod(
  4681. smalltalk.method({
  4682. selector: "testIsVowel",
  4683. protocol: 'tests',
  4684. fn: function (){
  4685. var self=this;
  4686. var vowel,consonant;
  4687. return smalltalk.withContext(function($ctx1) {
  4688. var $1;
  4689. vowel="u";
  4690. consonant="z";
  4691. $1=_st(vowel)._isVowel();
  4692. $ctx1.sendIdx["isVowel"]=1;
  4693. self._assert_equals_($1,true);
  4694. $ctx1.sendIdx["assert:equals:"]=1;
  4695. self._assert_equals_(_st(consonant)._isVowel(),false);
  4696. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  4697. args: [],
  4698. 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",
  4699. messageSends: ["assert:equals:", "isVowel"],
  4700. referencedClasses: []
  4701. }),
  4702. smalltalk.StringTest);
  4703. smalltalk.addMethod(
  4704. smalltalk.method({
  4705. selector: "testJoin",
  4706. protocol: 'tests',
  4707. fn: function (){
  4708. var self=this;
  4709. return smalltalk.withContext(function($ctx1) {
  4710. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4711. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  4712. args: [],
  4713. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4714. messageSends: ["assert:equals:", "join:"],
  4715. referencedClasses: []
  4716. }),
  4717. smalltalk.StringTest);
  4718. smalltalk.addMethod(
  4719. smalltalk.method({
  4720. selector: "testRemoveAll",
  4721. protocol: 'tests',
  4722. fn: function (){
  4723. var self=this;
  4724. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4725. return smalltalk.withContext(function($ctx1) {
  4726. self._should_raise_((function(){
  4727. return smalltalk.withContext(function($ctx2) {
  4728. return _st(self._collection())._removeAll();
  4729. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4730. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  4731. args: [],
  4732. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4733. messageSends: ["should:raise:", "removeAll", "collection"],
  4734. referencedClasses: ["Error"]
  4735. }),
  4736. smalltalk.StringTest);
  4737. smalltalk.addMethod(
  4738. smalltalk.method({
  4739. selector: "testReversed",
  4740. protocol: 'tests',
  4741. fn: function (){
  4742. var self=this;
  4743. return smalltalk.withContext(function($ctx1) {
  4744. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4745. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  4746. args: [],
  4747. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4748. messageSends: ["assert:equals:", "reversed"],
  4749. referencedClasses: []
  4750. }),
  4751. smalltalk.StringTest);
  4752. smalltalk.addMethod(
  4753. smalltalk.method({
  4754. selector: "testStreamContents",
  4755. protocol: 'tests',
  4756. fn: function (){
  4757. var self=this;
  4758. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4759. return smalltalk.withContext(function($ctx1) {
  4760. var $1;
  4761. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4762. return smalltalk.withContext(function($ctx2) {
  4763. _st(aStream)._nextPutAll_("hello");
  4764. $ctx2.sendIdx["nextPutAll:"]=1;
  4765. _st(aStream)._space();
  4766. $1=_st(aStream)._nextPutAll_("world");
  4767. return $1;
  4768. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4769. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  4770. args: [],
  4771. 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'",
  4772. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4773. referencedClasses: ["String"]
  4774. }),
  4775. smalltalk.StringTest);
  4776. smalltalk.addMethod(
  4777. smalltalk.method({
  4778. selector: "testSubStrings",
  4779. protocol: 'tests',
  4780. fn: function (){
  4781. var self=this;
  4782. return smalltalk.withContext(function($ctx1) {
  4783. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4784. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  4785. args: [],
  4786. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4787. messageSends: ["assert:equals:", "subStrings:"],
  4788. referencedClasses: []
  4789. }),
  4790. smalltalk.StringTest);
  4791. smalltalk.addMethod(
  4792. smalltalk.method({
  4793. selector: "testTrim",
  4794. protocol: 'tests',
  4795. fn: function (){
  4796. var self=this;
  4797. return smalltalk.withContext(function($ctx1) {
  4798. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  4799. $ctx1.sendIdx["assert:equals:"]=1;
  4800. self._assert_equals_("jackie "._trimRight(),"jackie");
  4801. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  4802. args: [],
  4803. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  4804. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  4805. referencedClasses: []
  4806. }),
  4807. smalltalk.StringTest);
  4808. smalltalk.addMethod(
  4809. smalltalk.method({
  4810. selector: "collectionClass",
  4811. protocol: 'fixture',
  4812. fn: function (){
  4813. var self=this;
  4814. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4815. return smalltalk.withContext(function($ctx1) {
  4816. return $String();
  4817. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  4818. args: [],
  4819. source: "collectionClass\x0a\x09^ String",
  4820. messageSends: [],
  4821. referencedClasses: ["String"]
  4822. }),
  4823. smalltalk.StringTest.klass);
  4824. smalltalk.addClass('SetTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  4825. smalltalk.addMethod(
  4826. smalltalk.method({
  4827. selector: "collection",
  4828. protocol: 'fixture',
  4829. fn: function (){
  4830. var self=this;
  4831. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4832. return smalltalk.withContext(function($ctx1) {
  4833. var $2,$3,$1;
  4834. $2=_st($Set())._new();
  4835. _st($2)._add_((1));
  4836. $ctx1.sendIdx["add:"]=1;
  4837. _st($2)._add_((2));
  4838. $ctx1.sendIdx["add:"]=2;
  4839. _st($2)._add_((3));
  4840. $ctx1.sendIdx["add:"]=3;
  4841. _st($2)._add_((-4));
  4842. $3=_st($2)._yourself();
  4843. $1=$3;
  4844. return $1;
  4845. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.SetTest)})},
  4846. args: [],
  4847. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: 1;\x0a\x09\x09add: 2;\x0a\x09\x09add: 3;\x0a\x09\x09add: -4;\x0a\x09\x09yourself",
  4848. messageSends: ["add:", "new", "yourself"],
  4849. referencedClasses: ["Set"]
  4850. }),
  4851. smalltalk.SetTest);
  4852. smalltalk.addMethod(
  4853. smalltalk.method({
  4854. selector: "collectionOfPrintStrings",
  4855. protocol: 'fixture',
  4856. fn: function (){
  4857. var self=this;
  4858. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4859. return smalltalk.withContext(function($ctx1) {
  4860. var $2,$3,$1;
  4861. $2=_st($Set())._new();
  4862. _st($2)._add_("1");
  4863. $ctx1.sendIdx["add:"]=1;
  4864. _st($2)._add_("2");
  4865. $ctx1.sendIdx["add:"]=2;
  4866. _st($2)._add_("3");
  4867. $ctx1.sendIdx["add:"]=3;
  4868. _st($2)._add_("-4");
  4869. $3=_st($2)._yourself();
  4870. $1=$3;
  4871. return $1;
  4872. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.SetTest)})},
  4873. args: [],
  4874. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: '1';\x0a\x09\x09add: '2';\x0a\x09\x09add: '3';\x0a\x09\x09add: '-4';\x0a\x09\x09yourself",
  4875. messageSends: ["add:", "new", "yourself"],
  4876. referencedClasses: ["Set"]
  4877. }),
  4878. smalltalk.SetTest);
  4879. smalltalk.addMethod(
  4880. smalltalk.method({
  4881. selector: "collectionSize",
  4882. protocol: 'fixture',
  4883. fn: function (){
  4884. var self=this;
  4885. return smalltalk.withContext(function($ctx1) {
  4886. return (4);
  4887. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.SetTest)})},
  4888. args: [],
  4889. source: "collectionSize\x0a\x09^ 4",
  4890. messageSends: [],
  4891. referencedClasses: []
  4892. }),
  4893. smalltalk.SetTest);
  4894. smalltalk.addMethod(
  4895. smalltalk.method({
  4896. selector: "collectionWithDuplicates",
  4897. protocol: 'fixture',
  4898. fn: function (){
  4899. var self=this;
  4900. return smalltalk.withContext(function($ctx1) {
  4901. var $2,$3,$1;
  4902. $2=self._collection();
  4903. _st($2)._add_("yet another");
  4904. $3=_st($2)._yourself();
  4905. $1=$3;
  4906. return $1;
  4907. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.SetTest)})},
  4908. args: [],
  4909. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 'yet another'; yourself",
  4910. messageSends: ["add:", "collection", "yourself"],
  4911. referencedClasses: []
  4912. }),
  4913. smalltalk.SetTest);
  4914. smalltalk.addMethod(
  4915. smalltalk.method({
  4916. selector: "collectionWithNewValue",
  4917. protocol: 'fixture',
  4918. fn: function (){
  4919. var self=this;
  4920. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4921. return smalltalk.withContext(function($ctx1) {
  4922. var $2,$3,$1;
  4923. $2=_st($Set())._new();
  4924. _st($2)._add_((1));
  4925. $ctx1.sendIdx["add:"]=1;
  4926. _st($2)._add_((2));
  4927. $ctx1.sendIdx["add:"]=2;
  4928. _st($2)._add_((3));
  4929. $ctx1.sendIdx["add:"]=3;
  4930. _st($2)._add_("N");
  4931. $ctx1.sendIdx["add:"]=4;
  4932. _st($2)._add_((-4));
  4933. $3=_st($2)._yourself();
  4934. $1=$3;
  4935. return $1;
  4936. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.SetTest)})},
  4937. args: [],
  4938. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: 1;\x0a\x09\x09add: 2;\x0a\x09\x09add: 3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: -4;\x0a\x09\x09yourself",
  4939. messageSends: ["add:", "new", "yourself"],
  4940. referencedClasses: ["Set"]
  4941. }),
  4942. smalltalk.SetTest);
  4943. smalltalk.addMethod(
  4944. smalltalk.method({
  4945. selector: "testAddRemove",
  4946. protocol: 'tests',
  4947. fn: function (){
  4948. var self=this;
  4949. var set;
  4950. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4951. return smalltalk.withContext(function($ctx1) {
  4952. var $1,$2;
  4953. set=_st($Set())._new();
  4954. self._assert_(_st(set)._isEmpty());
  4955. $ctx1.sendIdx["assert:"]=1;
  4956. _st(set)._add_((3));
  4957. $ctx1.sendIdx["add:"]=1;
  4958. $1=_st(set)._includes_((3));
  4959. $ctx1.sendIdx["includes:"]=1;
  4960. self._assert_($1);
  4961. $ctx1.sendIdx["assert:"]=2;
  4962. _st(set)._add_((5));
  4963. $2=_st(set)._includes_((5));
  4964. $ctx1.sendIdx["includes:"]=2;
  4965. self._assert_($2);
  4966. _st(set)._remove_((3));
  4967. self._deny_(_st(set)._includes_((3)));
  4968. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  4969. args: [],
  4970. 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)",
  4971. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  4972. referencedClasses: ["Set"]
  4973. }),
  4974. smalltalk.SetTest);
  4975. smalltalk.addMethod(
  4976. smalltalk.method({
  4977. selector: "testAt",
  4978. protocol: 'tests',
  4979. fn: function (){
  4980. var self=this;
  4981. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4982. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4983. return smalltalk.withContext(function($ctx1) {
  4984. self._should_raise_((function(){
  4985. return smalltalk.withContext(function($ctx2) {
  4986. return _st(_st($Set())._new())._at_put_((1),(2));
  4987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4988. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  4989. args: [],
  4990. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  4991. messageSends: ["should:raise:", "at:put:", "new"],
  4992. referencedClasses: ["Set", "Error"]
  4993. }),
  4994. smalltalk.SetTest);
  4995. smalltalk.addMethod(
  4996. smalltalk.method({
  4997. selector: "testCollect",
  4998. protocol: 'tests',
  4999. fn: function (){
  5000. var self=this;
  5001. return smalltalk.withContext(function($ctx1) {
  5002. var $2,$1;
  5003. smalltalk.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  5004. $2=[(5), (6), (8)]._asSet();
  5005. $ctx1.sendIdx["asSet"]=1;
  5006. $1=_st($2)._collect_((function(x){
  5007. return smalltalk.withContext(function($ctx2) {
  5008. return _st(x).__backslash_backslash((3));
  5009. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5010. self._assert_equals_($1,[(0), (2)]._asSet());
  5011. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  5012. args: [],
  5013. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5014. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5015. referencedClasses: []
  5016. }),
  5017. smalltalk.SetTest);
  5018. smalltalk.addMethod(
  5019. smalltalk.method({
  5020. selector: "testComparing",
  5021. protocol: 'tests',
  5022. fn: function (){
  5023. var self=this;
  5024. return smalltalk.withContext(function($ctx1) {
  5025. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5026. $1=[(0), (2)]._asSet();
  5027. $ctx1.sendIdx["asSet"]=1;
  5028. $2=[(0), (2)]._asSet();
  5029. $ctx1.sendIdx["asSet"]=2;
  5030. self._assert_equals_($1,$2);
  5031. $ctx1.sendIdx["assert:equals:"]=1;
  5032. $3=[(2), (0)]._asSet();
  5033. $ctx1.sendIdx["asSet"]=3;
  5034. $4=[(0), (2)]._asSet();
  5035. $ctx1.sendIdx["asSet"]=4;
  5036. self._assert_equals_($3,$4);
  5037. $6=[(0), (2), (3)]._asSet();
  5038. $ctx1.sendIdx["asSet"]=5;
  5039. $7=[(0), (2)]._asSet();
  5040. $ctx1.sendIdx["asSet"]=6;
  5041. $5=_st($6).__eq($7);
  5042. $ctx1.sendIdx["="]=1;
  5043. self._deny_($5);
  5044. $ctx1.sendIdx["deny:"]=1;
  5045. $9=[(1), (2)]._asSet();
  5046. $ctx1.sendIdx["asSet"]=7;
  5047. $8=_st($9).__eq([(0), (2)]._asSet());
  5048. self._deny_($8);
  5049. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  5050. args: [],
  5051. 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",
  5052. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5053. referencedClasses: []
  5054. }),
  5055. smalltalk.SetTest);
  5056. smalltalk.addMethod(
  5057. smalltalk.method({
  5058. selector: "testPrintString",
  5059. protocol: 'tests',
  5060. fn: function (){
  5061. var self=this;
  5062. var set;
  5063. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5064. return smalltalk.withContext(function($ctx1) {
  5065. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5066. set=_st($Set())._new();
  5067. $1=_st(set)._printString();
  5068. $ctx1.sendIdx["printString"]=1;
  5069. self._assert_equals_($1,"a Set ()");
  5070. $ctx1.sendIdx["assert:equals:"]=1;
  5071. $2=set;
  5072. _st($2)._add_((1));
  5073. $ctx1.sendIdx["add:"]=1;
  5074. $3=_st($2)._add_((3));
  5075. $ctx1.sendIdx["add:"]=2;
  5076. $4=_st(set)._printString();
  5077. $ctx1.sendIdx["printString"]=2;
  5078. self._assert_equals_($4,"a Set (1 3)");
  5079. $ctx1.sendIdx["assert:equals:"]=2;
  5080. _st(set)._add_("foo");
  5081. $ctx1.sendIdx["add:"]=3;
  5082. $5=_st(set)._printString();
  5083. $ctx1.sendIdx["printString"]=3;
  5084. self._assert_equals_($5,"a Set (1 3 'foo')");
  5085. $ctx1.sendIdx["assert:equals:"]=3;
  5086. $6=set;
  5087. _st($6)._remove_((1));
  5088. $ctx1.sendIdx["remove:"]=1;
  5089. $7=_st($6)._remove_((3));
  5090. $8=_st(set)._printString();
  5091. $ctx1.sendIdx["printString"]=4;
  5092. self._assert_equals_($8,"a Set ('foo')");
  5093. $ctx1.sendIdx["assert:equals:"]=4;
  5094. _st(set)._add_((3));
  5095. $ctx1.sendIdx["add:"]=4;
  5096. $9=_st(set)._printString();
  5097. $ctx1.sendIdx["printString"]=5;
  5098. self._assert_equals_($9,"a Set ('foo' 3)");
  5099. $ctx1.sendIdx["assert:equals:"]=5;
  5100. _st(set)._add_((3));
  5101. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  5102. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  5103. args: [],
  5104. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'",
  5105. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5106. referencedClasses: ["Set"]
  5107. }),
  5108. smalltalk.SetTest);
  5109. smalltalk.addMethod(
  5110. smalltalk.method({
  5111. selector: "testUnboxedObjects",
  5112. protocol: 'tests',
  5113. fn: function (){
  5114. var self=this;
  5115. return smalltalk.withContext(function($ctx1) {
  5116. var $4,$3,$2,$1;
  5117. $4="foo"._yourself();
  5118. $ctx1.sendIdx["yourself"]=1;
  5119. $3=[$4,"foo"._yourself()];
  5120. $2=_st($3)._asSet();
  5121. $1=_st($2)._asArray();
  5122. self._assert_equals_($1,["foo"]);
  5123. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  5124. args: [],
  5125. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5126. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5127. referencedClasses: []
  5128. }),
  5129. smalltalk.SetTest);
  5130. smalltalk.addMethod(
  5131. smalltalk.method({
  5132. selector: "testUnicity",
  5133. protocol: 'tests',
  5134. fn: function (){
  5135. var self=this;
  5136. var set;
  5137. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5138. return smalltalk.withContext(function($ctx1) {
  5139. var $1;
  5140. set=_st($Set())._new();
  5141. _st(set)._add_((21));
  5142. $ctx1.sendIdx["add:"]=1;
  5143. _st(set)._add_("hello");
  5144. $ctx1.sendIdx["add:"]=2;
  5145. _st(set)._add_((21));
  5146. $ctx1.sendIdx["add:"]=3;
  5147. $1=_st(set)._size();
  5148. $ctx1.sendIdx["size"]=1;
  5149. self._assert_equals_($1,(2));
  5150. $ctx1.sendIdx["assert:equals:"]=1;
  5151. _st(set)._add_("hello");
  5152. self._assert_equals_(_st(set)._size(),(2));
  5153. $ctx1.sendIdx["assert:equals:"]=2;
  5154. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5155. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  5156. args: [],
  5157. 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')",
  5158. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5159. referencedClasses: ["Set"]
  5160. }),
  5161. smalltalk.SetTest);
  5162. smalltalk.addMethod(
  5163. smalltalk.method({
  5164. selector: "collectionClass",
  5165. protocol: 'fixture',
  5166. fn: function (){
  5167. var self=this;
  5168. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5169. return smalltalk.withContext(function($ctx1) {
  5170. return $Set();
  5171. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.SetTest.klass)})},
  5172. args: [],
  5173. source: "collectionClass\x0a\x09^ Set",
  5174. messageSends: [],
  5175. referencedClasses: ["Set"]
  5176. }),
  5177. smalltalk.SetTest.klass);
  5178. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5179. smalltalk.addMethod(
  5180. smalltalk.method({
  5181. selector: "testShow",
  5182. protocol: 'tests',
  5183. fn: function (){
  5184. var self=this;
  5185. var originalTranscript;
  5186. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5187. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5188. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5189. return smalltalk.withContext(function($ctx1) {
  5190. originalTranscript=_st($Transcript())._current();
  5191. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5192. $ctx1.sendIdx["register:"]=1;
  5193. self._shouldnt_raise_((function(){
  5194. return smalltalk.withContext(function($ctx2) {
  5195. return _st($Transcript())._show_("Hello console!");
  5196. $ctx2.sendIdx["show:"]=1;
  5197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5198. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5199. self._shouldnt_raise_((function(){
  5200. return smalltalk.withContext(function($ctx2) {
  5201. return _st($Transcript())._show_(console);
  5202. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5203. _st($Transcript())._register_(originalTranscript);
  5204. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  5205. args: [],
  5206. 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.",
  5207. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5208. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5209. }),
  5210. smalltalk.ConsoleTranscriptTest);
  5211. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5212. smalltalk.addMethod(
  5213. smalltalk.method({
  5214. selector: "jsObject",
  5215. protocol: 'accessing',
  5216. fn: function (){
  5217. var self=this;
  5218. return smalltalk.withContext(function($ctx1) {
  5219. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5220. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  5221. args: [],
  5222. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5223. messageSends: [],
  5224. referencedClasses: []
  5225. }),
  5226. smalltalk.JSObjectProxyTest);
  5227. smalltalk.addMethod(
  5228. smalltalk.method({
  5229. selector: "testAtIfAbsent",
  5230. protocol: 'tests',
  5231. fn: function (){
  5232. var self=this;
  5233. var testObject;
  5234. return smalltalk.withContext(function($ctx1) {
  5235. var $1,$2,$3;
  5236. testObject=self._jsObject();
  5237. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5238. return smalltalk.withContext(function($ctx2) {
  5239. return "Property does not exist";
  5240. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5241. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5242. self._assert_equals_($1,"Property does not exist");
  5243. $ctx1.sendIdx["assert:equals:"]=1;
  5244. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5245. return smalltalk.withContext(function($ctx2) {
  5246. return "Property does not exist";
  5247. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5248. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5249. self._assert_equals_($2,nil);
  5250. $ctx1.sendIdx["assert:equals:"]=2;
  5251. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5252. return smalltalk.withContext(function($ctx2) {
  5253. return "Property does not exist";
  5254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  5255. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5256. self._assert_equals_($3,(1));
  5257. $ctx1.sendIdx["assert:equals:"]=3;
  5258. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5259. return smalltalk.withContext(function($ctx2) {
  5260. return "Property does not exist";
  5261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  5262. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5263. args: [],
  5264. 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.",
  5265. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5266. referencedClasses: []
  5267. }),
  5268. smalltalk.JSObjectProxyTest);
  5269. smalltalk.addMethod(
  5270. smalltalk.method({
  5271. selector: "testAtIfPresent",
  5272. protocol: 'tests',
  5273. fn: function (){
  5274. var self=this;
  5275. var testObject;
  5276. return smalltalk.withContext(function($ctx1) {
  5277. var $2,$1,$4,$3,$6,$5;
  5278. testObject=self._jsObject();
  5279. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5280. return smalltalk.withContext(function($ctx2) {
  5281. $2=_st(x)._asString();
  5282. $ctx2.sendIdx["asString"]=1;
  5283. return "hello ".__comma($2);
  5284. $ctx2.sendIdx[","]=1;
  5285. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5286. $ctx1.sendIdx["at:ifPresent:"]=1;
  5287. self._assert_equals_($1,nil);
  5288. $ctx1.sendIdx["assert:equals:"]=1;
  5289. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5290. return smalltalk.withContext(function($ctx2) {
  5291. $4=_st(x)._asString();
  5292. $ctx2.sendIdx["asString"]=2;
  5293. return "hello ".__comma($4);
  5294. $ctx2.sendIdx[","]=2;
  5295. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5296. $ctx1.sendIdx["at:ifPresent:"]=2;
  5297. self._assert_equals_($3,"hello nil");
  5298. $ctx1.sendIdx["assert:equals:"]=2;
  5299. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5300. return smalltalk.withContext(function($ctx2) {
  5301. $6=_st(x)._asString();
  5302. $ctx2.sendIdx["asString"]=3;
  5303. return "hello ".__comma($6);
  5304. $ctx2.sendIdx[","]=3;
  5305. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5306. $ctx1.sendIdx["at:ifPresent:"]=3;
  5307. self._assert_equals_($5,"hello 1");
  5308. $ctx1.sendIdx["assert:equals:"]=3;
  5309. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5310. return smalltalk.withContext(function($ctx2) {
  5311. return "hello ".__comma(_st(x)._asString());
  5312. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5313. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5314. args: [],
  5315. 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'.",
  5316. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5317. referencedClasses: []
  5318. }),
  5319. smalltalk.JSObjectProxyTest);
  5320. smalltalk.addMethod(
  5321. smalltalk.method({
  5322. selector: "testAtIfPresentIfAbsent",
  5323. protocol: 'tests',
  5324. fn: function (){
  5325. var self=this;
  5326. var testObject;
  5327. return smalltalk.withContext(function($ctx1) {
  5328. var $2,$1,$4,$3,$6,$5;
  5329. testObject=self._jsObject();
  5330. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5331. return smalltalk.withContext(function($ctx2) {
  5332. $2=_st(x)._asString();
  5333. $ctx2.sendIdx["asString"]=1;
  5334. return "hello ".__comma($2);
  5335. $ctx2.sendIdx[","]=1;
  5336. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5337. return smalltalk.withContext(function($ctx2) {
  5338. return "not present";
  5339. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5340. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5341. self._assert_equals_($1,"not present");
  5342. $ctx1.sendIdx["assert:equals:"]=1;
  5343. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5344. return smalltalk.withContext(function($ctx2) {
  5345. $4=_st(x)._asString();
  5346. $ctx2.sendIdx["asString"]=2;
  5347. return "hello ".__comma($4);
  5348. $ctx2.sendIdx[","]=2;
  5349. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5350. return smalltalk.withContext(function($ctx2) {
  5351. return "not present";
  5352. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5353. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5354. self._assert_equals_($3,"hello nil");
  5355. $ctx1.sendIdx["assert:equals:"]=2;
  5356. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5357. return smalltalk.withContext(function($ctx2) {
  5358. $6=_st(x)._asString();
  5359. $ctx2.sendIdx["asString"]=3;
  5360. return "hello ".__comma($6);
  5361. $ctx2.sendIdx[","]=3;
  5362. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5363. return smalltalk.withContext(function($ctx2) {
  5364. return "not present";
  5365. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5366. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5367. self._assert_equals_($5,"hello 1");
  5368. $ctx1.sendIdx["assert:equals:"]=3;
  5369. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5370. return smalltalk.withContext(function($ctx2) {
  5371. return "hello ".__comma(_st(x)._asString());
  5372. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5373. return smalltalk.withContext(function($ctx2) {
  5374. return "not present";
  5375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  5376. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5377. args: [],
  5378. 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'.",
  5379. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5380. referencedClasses: []
  5381. }),
  5382. smalltalk.JSObjectProxyTest);
  5383. smalltalk.addMethod(
  5384. smalltalk.method({
  5385. selector: "testAtPut",
  5386. protocol: 'tests',
  5387. fn: function (){
  5388. var self=this;
  5389. var testObject;
  5390. return smalltalk.withContext(function($ctx1) {
  5391. var $2,$1;
  5392. testObject=self._jsObject();
  5393. $2=_st(testObject)._at_("abc");
  5394. $ctx1.sendIdx["at:"]=1;
  5395. $1=_st($2).__tild_eq("xyz");
  5396. self._assert_($1);
  5397. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5398. $ctx1.sendIdx["assert:equals:"]=1;
  5399. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5400. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5401. args: [],
  5402. 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'",
  5403. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5404. referencedClasses: []
  5405. }),
  5406. smalltalk.JSObjectProxyTest);
  5407. smalltalk.addMethod(
  5408. smalltalk.method({
  5409. selector: "testDNU",
  5410. protocol: 'tests',
  5411. fn: function (){
  5412. var self=this;
  5413. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5414. return smalltalk.withContext(function($ctx1) {
  5415. self._should_raise_((function(){
  5416. return smalltalk.withContext(function($ctx2) {
  5417. return _st(self._jsObject())._foo();
  5418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5419. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  5420. args: [],
  5421. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5422. messageSends: ["should:raise:", "foo", "jsObject"],
  5423. referencedClasses: ["MessageNotUnderstood"]
  5424. }),
  5425. smalltalk.JSObjectProxyTest);
  5426. smalltalk.addMethod(
  5427. smalltalk.method({
  5428. selector: "testMessageSend",
  5429. protocol: 'tests',
  5430. fn: function (){
  5431. var self=this;
  5432. return smalltalk.withContext(function($ctx1) {
  5433. var $2,$1,$4,$3;
  5434. $2=self._jsObject();
  5435. $ctx1.sendIdx["jsObject"]=1;
  5436. $1=_st($2)._a();
  5437. self._assert_equals_($1,(1));
  5438. $ctx1.sendIdx["assert:equals:"]=1;
  5439. $4=self._jsObject();
  5440. $ctx1.sendIdx["jsObject"]=2;
  5441. $3=_st($4)._b();
  5442. self._assert_equals_($3,(2));
  5443. $ctx1.sendIdx["assert:equals:"]=2;
  5444. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5445. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  5446. args: [],
  5447. 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",
  5448. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5449. referencedClasses: []
  5450. }),
  5451. smalltalk.JSObjectProxyTest);
  5452. smalltalk.addMethod(
  5453. smalltalk.method({
  5454. selector: "testMethodWithArguments",
  5455. protocol: 'tests',
  5456. fn: function (){
  5457. var self=this;
  5458. return smalltalk.withContext(function($ctx1) {
  5459. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5460. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  5461. args: [],
  5462. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5463. messageSends: ["assert:equals:", "c:", "jsObject"],
  5464. referencedClasses: []
  5465. }),
  5466. smalltalk.JSObjectProxyTest);
  5467. smalltalk.addMethod(
  5468. smalltalk.method({
  5469. selector: "testPrinting",
  5470. protocol: 'tests',
  5471. fn: function (){
  5472. var self=this;
  5473. return smalltalk.withContext(function($ctx1) {
  5474. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5475. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  5476. args: [],
  5477. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5478. messageSends: ["assert:equals:", "printString", "jsObject"],
  5479. referencedClasses: []
  5480. }),
  5481. smalltalk.JSObjectProxyTest);
  5482. smalltalk.addMethod(
  5483. smalltalk.method({
  5484. selector: "testPropertyThatReturnsEmptyString",
  5485. protocol: 'tests',
  5486. fn: function (){
  5487. var self=this;
  5488. var object;
  5489. return smalltalk.withContext(function($ctx1) {
  5490. var $1;
  5491. object=self._jsObject();
  5492. $1=_st(object)._d();
  5493. $ctx1.sendIdx["d"]=1;
  5494. self._assert_equals_($1,"");
  5495. $ctx1.sendIdx["assert:equals:"]=1;
  5496. _st(object)._d_("hello");
  5497. self._assert_equals_(_st(object)._d(),"hello");
  5498. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  5499. args: [],
  5500. 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'",
  5501. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5502. referencedClasses: []
  5503. }),
  5504. smalltalk.JSObjectProxyTest);
  5505. smalltalk.addMethod(
  5506. smalltalk.method({
  5507. selector: "testPropertyThatReturnsUndefined",
  5508. protocol: 'tests',
  5509. fn: function (){
  5510. var self=this;
  5511. var object;
  5512. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5513. return smalltalk.withContext(function($ctx1) {
  5514. object=self._jsObject();
  5515. self._shouldnt_raise_((function(){
  5516. return smalltalk.withContext(function($ctx2) {
  5517. return _st(object)._e();
  5518. $ctx2.sendIdx["e"]=1;
  5519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5520. self._assert_(_st(_st(object)._e())._isNil());
  5521. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  5522. args: [],
  5523. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5524. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5525. referencedClasses: ["MessageNotUnderstood"]
  5526. }),
  5527. smalltalk.JSObjectProxyTest);
  5528. smalltalk.addMethod(
  5529. smalltalk.method({
  5530. selector: "testValue",
  5531. protocol: 'tests',
  5532. fn: function (){
  5533. var self=this;
  5534. var testObject;
  5535. return smalltalk.withContext(function($ctx1) {
  5536. testObject=self._jsObject();
  5537. _st(testObject)._at_put_("value","aValue");
  5538. self._assert_equals_(_st(testObject)._value(),"aValue");
  5539. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5540. args: [],
  5541. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5542. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5543. referencedClasses: []
  5544. }),
  5545. smalltalk.JSObjectProxyTest);
  5546. smalltalk.addMethod(
  5547. smalltalk.method({
  5548. selector: "testYourself",
  5549. protocol: 'tests',
  5550. fn: function (){
  5551. var self=this;
  5552. var object;
  5553. return smalltalk.withContext(function($ctx1) {
  5554. var $1,$2;
  5555. $1=self._jsObject();
  5556. _st($1)._d_("test");
  5557. $2=_st($1)._yourself();
  5558. object=$2;
  5559. self._assert_equals_(_st(object)._d(),"test");
  5560. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  5561. args: [],
  5562. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5563. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5564. referencedClasses: []
  5565. }),
  5566. smalltalk.JSObjectProxyTest);
  5567. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5568. smalltalk.addMethod(
  5569. smalltalk.method({
  5570. selector: "testCatchingException",
  5571. protocol: 'tests',
  5572. fn: function (){
  5573. var self=this;
  5574. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5575. return smalltalk.withContext(function($ctx1) {
  5576. _st((function(){
  5577. return smalltalk.withContext(function($ctx2) {
  5578. return self._throwException();
  5579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5580. return smalltalk.withContext(function($ctx2) {
  5581. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5582. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5583. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  5584. args: [],
  5585. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5586. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5587. referencedClasses: ["Error"]
  5588. }),
  5589. smalltalk.JavaScriptExceptionTest);
  5590. smalltalk.addMethod(
  5591. smalltalk.method({
  5592. selector: "testRaisingException",
  5593. protocol: 'tests',
  5594. fn: function (){
  5595. var self=this;
  5596. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5597. return smalltalk.withContext(function($ctx1) {
  5598. self._should_raise_((function(){
  5599. return smalltalk.withContext(function($ctx2) {
  5600. return self._throwException();
  5601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5602. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  5603. args: [],
  5604. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5605. messageSends: ["should:raise:", "throwException"],
  5606. referencedClasses: ["JavaScriptException"]
  5607. }),
  5608. smalltalk.JavaScriptExceptionTest);
  5609. smalltalk.addMethod(
  5610. smalltalk.method({
  5611. selector: "throwException",
  5612. protocol: 'helpers',
  5613. fn: function (){
  5614. var self=this;
  5615. return smalltalk.withContext(function($ctx1) {
  5616. throw 'test';
  5617. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  5618. args: [],
  5619. source: "throwException\x0a\x09<throw 'test'>",
  5620. messageSends: [],
  5621. referencedClasses: []
  5622. }),
  5623. smalltalk.JavaScriptExceptionTest);
  5624. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5625. smalltalk.addMethod(
  5626. smalltalk.method({
  5627. selector: "testValue",
  5628. protocol: 'tests',
  5629. fn: function (){
  5630. var self=this;
  5631. var messageSend;
  5632. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5633. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5634. return smalltalk.withContext(function($ctx1) {
  5635. var $1,$2;
  5636. $1=_st($MessageSend())._new();
  5637. $ctx1.sendIdx["new"]=1;
  5638. _st($1)._receiver_(_st($Object())._new());
  5639. _st($1)._selector_("asString");
  5640. $2=_st($1)._yourself();
  5641. messageSend=$2;
  5642. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5643. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5644. args: [],
  5645. 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'",
  5646. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  5647. referencedClasses: ["MessageSend", "Object"]
  5648. }),
  5649. smalltalk.MessageSendTest);
  5650. smalltalk.addMethod(
  5651. smalltalk.method({
  5652. selector: "testValueWithArguments",
  5653. protocol: 'tests',
  5654. fn: function (){
  5655. var self=this;
  5656. var messageSend;
  5657. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5658. return smalltalk.withContext(function($ctx1) {
  5659. var $1,$2;
  5660. $1=_st($MessageSend())._new();
  5661. _st($1)._receiver_((2));
  5662. _st($1)._selector_("+");
  5663. $2=_st($1)._yourself();
  5664. messageSend=$2;
  5665. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  5666. $ctx1.sendIdx["assert:equals:"]=1;
  5667. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  5668. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5669. args: [],
  5670. 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",
  5671. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  5672. referencedClasses: ["MessageSend"]
  5673. }),
  5674. smalltalk.MessageSendTest);
  5675. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  5676. smalltalk.addMethod(
  5677. smalltalk.method({
  5678. selector: "codeGeneratorClass",
  5679. protocol: 'accessing',
  5680. fn: function (){
  5681. var self=this;
  5682. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  5683. return smalltalk.withContext(function($ctx1) {
  5684. return $CodeGenerator();
  5685. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  5686. args: [],
  5687. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  5688. messageSends: [],
  5689. referencedClasses: ["CodeGenerator"]
  5690. }),
  5691. smalltalk.MethodInheritanceTest);
  5692. smalltalk.addMethod(
  5693. smalltalk.method({
  5694. selector: "compiler",
  5695. protocol: 'factory',
  5696. fn: function (){
  5697. var self=this;
  5698. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5699. return smalltalk.withContext(function($ctx1) {
  5700. var $2,$3,$1;
  5701. $2=_st($Compiler())._new();
  5702. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  5703. $3=_st($2)._yourself();
  5704. $1=$3;
  5705. return $1;
  5706. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  5707. args: [],
  5708. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  5709. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  5710. referencedClasses: ["Compiler"]
  5711. }),
  5712. smalltalk.MethodInheritanceTest);
  5713. smalltalk.addMethod(
  5714. smalltalk.method({
  5715. selector: "deinstallBottom",
  5716. protocol: 'testing',
  5717. fn: function (){
  5718. var self=this;
  5719. return smalltalk.withContext(function($ctx1) {
  5720. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  5721. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  5722. args: [],
  5723. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  5724. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  5725. referencedClasses: []
  5726. }),
  5727. smalltalk.MethodInheritanceTest);
  5728. smalltalk.addMethod(
  5729. smalltalk.method({
  5730. selector: "deinstallMiddle",
  5731. protocol: 'testing',
  5732. fn: function (){
  5733. var self=this;
  5734. return smalltalk.withContext(function($ctx1) {
  5735. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  5736. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  5737. args: [],
  5738. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  5739. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  5740. referencedClasses: []
  5741. }),
  5742. smalltalk.MethodInheritanceTest);
  5743. smalltalk.addMethod(
  5744. smalltalk.method({
  5745. selector: "deinstallTop",
  5746. protocol: 'testing',
  5747. fn: function (){
  5748. var self=this;
  5749. return smalltalk.withContext(function($ctx1) {
  5750. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  5751. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  5752. args: [],
  5753. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  5754. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  5755. referencedClasses: []
  5756. }),
  5757. smalltalk.MethodInheritanceTest);
  5758. smalltalk.addMethod(
  5759. smalltalk.method({
  5760. selector: "installBottom:",
  5761. protocol: 'testing',
  5762. fn: function (aString){
  5763. var self=this;
  5764. return smalltalk.withContext(function($ctx1) {
  5765. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  5766. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5767. args: ["aString"],
  5768. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  5769. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  5770. referencedClasses: []
  5771. }),
  5772. smalltalk.MethodInheritanceTest);
  5773. smalltalk.addMethod(
  5774. smalltalk.method({
  5775. selector: "installMiddle:",
  5776. protocol: 'testing',
  5777. fn: function (aString){
  5778. var self=this;
  5779. return smalltalk.withContext(function($ctx1) {
  5780. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  5781. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5782. args: ["aString"],
  5783. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  5784. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  5785. referencedClasses: []
  5786. }),
  5787. smalltalk.MethodInheritanceTest);
  5788. smalltalk.addMethod(
  5789. smalltalk.method({
  5790. selector: "installTop:",
  5791. protocol: 'testing',
  5792. fn: function (aString){
  5793. var self=this;
  5794. return smalltalk.withContext(function($ctx1) {
  5795. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  5796. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5797. args: ["aString"],
  5798. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  5799. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  5800. referencedClasses: []
  5801. }),
  5802. smalltalk.MethodInheritanceTest);
  5803. smalltalk.addMethod(
  5804. smalltalk.method({
  5805. selector: "setUp",
  5806. protocol: 'initialization',
  5807. fn: function (){
  5808. var self=this;
  5809. return smalltalk.withContext(function($ctx1) {
  5810. self["@receiverTop"]=_st(self._targetClassTop())._new();
  5811. $ctx1.sendIdx["new"]=1;
  5812. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  5813. $ctx1.sendIdx["new"]=2;
  5814. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  5815. self["@method"]=nil;
  5816. self["@performBlock"]=(function(){
  5817. return smalltalk.withContext(function($ctx2) {
  5818. return self._error_("performBlock not initialized");
  5819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  5820. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  5821. args: [],
  5822. 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' ]",
  5823. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  5824. referencedClasses: []
  5825. }),
  5826. smalltalk.MethodInheritanceTest);
  5827. smalltalk.addMethod(
  5828. smalltalk.method({
  5829. selector: "shouldMNU",
  5830. protocol: 'testing',
  5831. fn: function (){
  5832. var self=this;
  5833. return smalltalk.withContext(function($ctx1) {
  5834. self._shouldMNUTop();
  5835. self._shouldMNUMiddle();
  5836. self._shouldMNUBottom();
  5837. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  5838. args: [],
  5839. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  5840. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  5841. referencedClasses: []
  5842. }),
  5843. smalltalk.MethodInheritanceTest);
  5844. smalltalk.addMethod(
  5845. smalltalk.method({
  5846. selector: "shouldMNUBottom",
  5847. protocol: 'testing',
  5848. fn: function (){
  5849. var self=this;
  5850. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5851. return smalltalk.withContext(function($ctx1) {
  5852. self._should_raise_((function(){
  5853. return smalltalk.withContext(function($ctx2) {
  5854. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5856. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  5857. args: [],
  5858. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  5859. messageSends: ["should:raise:", "value:"],
  5860. referencedClasses: ["MessageNotUnderstood"]
  5861. }),
  5862. smalltalk.MethodInheritanceTest);
  5863. smalltalk.addMethod(
  5864. smalltalk.method({
  5865. selector: "shouldMNUMiddle",
  5866. protocol: 'testing',
  5867. fn: function (){
  5868. var self=this;
  5869. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5870. return smalltalk.withContext(function($ctx1) {
  5871. self._should_raise_((function(){
  5872. return smalltalk.withContext(function($ctx2) {
  5873. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5875. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  5876. args: [],
  5877. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  5878. messageSends: ["should:raise:", "value:"],
  5879. referencedClasses: ["MessageNotUnderstood"]
  5880. }),
  5881. smalltalk.MethodInheritanceTest);
  5882. smalltalk.addMethod(
  5883. smalltalk.method({
  5884. selector: "shouldMNUTop",
  5885. protocol: 'testing',
  5886. fn: function (){
  5887. var self=this;
  5888. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5889. return smalltalk.withContext(function($ctx1) {
  5890. self._should_raise_((function(){
  5891. return smalltalk.withContext(function($ctx2) {
  5892. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  5893. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5894. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  5895. args: [],
  5896. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  5897. messageSends: ["should:raise:", "value:"],
  5898. referencedClasses: ["MessageNotUnderstood"]
  5899. }),
  5900. smalltalk.MethodInheritanceTest);
  5901. smalltalk.addMethod(
  5902. smalltalk.method({
  5903. selector: "shouldReturn:",
  5904. protocol: 'testing',
  5905. fn: function (anObject){
  5906. var self=this;
  5907. var result;
  5908. return smalltalk.withContext(function($ctx1) {
  5909. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  5910. $ctx1.sendIdx["value:"]=1;
  5911. self._assert_equals_(["top",anObject],["top",result]);
  5912. $ctx1.sendIdx["assert:equals:"]=1;
  5913. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5914. $ctx1.sendIdx["value:"]=2;
  5915. self._assert_equals_(["middle",anObject],["middle",result]);
  5916. $ctx1.sendIdx["assert:equals:"]=2;
  5917. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5918. self._assert_equals_(["bottom",anObject],["bottom",result]);
  5919. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  5920. args: ["anObject"],
  5921. 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 }",
  5922. messageSends: ["value:", "assert:equals:"],
  5923. referencedClasses: []
  5924. }),
  5925. smalltalk.MethodInheritanceTest);
  5926. smalltalk.addMethod(
  5927. smalltalk.method({
  5928. selector: "shouldReturn:and:and:",
  5929. protocol: 'testing',
  5930. fn: function (anObject,anObject2,anObject3){
  5931. var self=this;
  5932. var result;
  5933. return smalltalk.withContext(function($ctx1) {
  5934. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  5935. $ctx1.sendIdx["value:"]=1;
  5936. self._assert_equals_(["top",anObject],["top",result]);
  5937. $ctx1.sendIdx["assert:equals:"]=1;
  5938. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5939. $ctx1.sendIdx["value:"]=2;
  5940. self._assert_equals_(["middle",anObject2],["middle",result]);
  5941. $ctx1.sendIdx["assert:equals:"]=2;
  5942. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5943. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  5944. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  5945. args: ["anObject", "anObject2", "anObject3"],
  5946. 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 }",
  5947. messageSends: ["value:", "assert:equals:"],
  5948. referencedClasses: []
  5949. }),
  5950. smalltalk.MethodInheritanceTest);
  5951. smalltalk.addMethod(
  5952. smalltalk.method({
  5953. selector: "targetClassBottom",
  5954. protocol: 'accessing',
  5955. fn: function (){
  5956. var self=this;
  5957. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5958. return smalltalk.withContext(function($ctx1) {
  5959. return $JavaScriptException();
  5960. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  5961. args: [],
  5962. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  5963. messageSends: [],
  5964. referencedClasses: ["JavaScriptException"]
  5965. }),
  5966. smalltalk.MethodInheritanceTest);
  5967. smalltalk.addMethod(
  5968. smalltalk.method({
  5969. selector: "targetClassMiddle",
  5970. protocol: 'accessing',
  5971. fn: function (){
  5972. var self=this;
  5973. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5974. return smalltalk.withContext(function($ctx1) {
  5975. return $Error();
  5976. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  5977. args: [],
  5978. source: "targetClassMiddle\x0a\x09^ Error",
  5979. messageSends: [],
  5980. referencedClasses: ["Error"]
  5981. }),
  5982. smalltalk.MethodInheritanceTest);
  5983. smalltalk.addMethod(
  5984. smalltalk.method({
  5985. selector: "targetClassTop",
  5986. protocol: 'accessing',
  5987. fn: function (){
  5988. var self=this;
  5989. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5990. return smalltalk.withContext(function($ctx1) {
  5991. return $Object();
  5992. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  5993. args: [],
  5994. source: "targetClassTop\x0a\x09^ Object",
  5995. messageSends: [],
  5996. referencedClasses: ["Object"]
  5997. }),
  5998. smalltalk.MethodInheritanceTest);
  5999. smalltalk.addMethod(
  6000. smalltalk.method({
  6001. selector: "tearDown",
  6002. protocol: 'initialization',
  6003. fn: function (){
  6004. var self=this;
  6005. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6006. return smalltalk.withContext(function($ctx1) {
  6007. _st((function(){
  6008. return smalltalk.withContext(function($ctx2) {
  6009. return self._deinstallTop();
  6010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6011. return smalltalk.withContext(function($ctx2) {
  6012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6013. $ctx1.sendIdx["on:do:"]=1;
  6014. _st((function(){
  6015. return smalltalk.withContext(function($ctx2) {
  6016. return self._deinstallMiddle();
  6017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6018. return smalltalk.withContext(function($ctx2) {
  6019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  6020. $ctx1.sendIdx["on:do:"]=2;
  6021. _st((function(){
  6022. return smalltalk.withContext(function($ctx2) {
  6023. return self._deinstallBottom();
  6024. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6025. return smalltalk.withContext(function($ctx2) {
  6026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  6027. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  6028. args: [],
  6029. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6030. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6031. referencedClasses: ["Error"]
  6032. }),
  6033. smalltalk.MethodInheritanceTest);
  6034. smalltalk.addMethod(
  6035. smalltalk.method({
  6036. selector: "testMNU11",
  6037. protocol: 'tests',
  6038. fn: function (){
  6039. var self=this;
  6040. return smalltalk.withContext(function($ctx1) {
  6041. self["@performBlock"]=(function(x){
  6042. return smalltalk.withContext(function($ctx2) {
  6043. return _st(x)._foo();
  6044. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6045. self._shouldMNU();
  6046. $ctx1.sendIdx["shouldMNU"]=1;
  6047. self._installTop_("foo ^ false");
  6048. $ctx1.sendIdx["installTop:"]=1;
  6049. self._installTop_("foo ^ true");
  6050. self._deinstallTop();
  6051. self._shouldMNU();
  6052. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  6053. args: [],
  6054. 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",
  6055. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6056. referencedClasses: []
  6057. }),
  6058. smalltalk.MethodInheritanceTest);
  6059. smalltalk.addMethod(
  6060. smalltalk.method({
  6061. selector: "testMNU22",
  6062. protocol: 'tests',
  6063. fn: function (){
  6064. var self=this;
  6065. return smalltalk.withContext(function($ctx1) {
  6066. self["@performBlock"]=(function(x){
  6067. return smalltalk.withContext(function($ctx2) {
  6068. return _st(x)._foo();
  6069. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6070. self._shouldMNU();
  6071. $ctx1.sendIdx["shouldMNU"]=1;
  6072. self._installMiddle_("foo ^ false");
  6073. $ctx1.sendIdx["installMiddle:"]=1;
  6074. self._installMiddle_("foo ^ true");
  6075. self._deinstallMiddle();
  6076. self._shouldMNU();
  6077. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  6078. args: [],
  6079. 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",
  6080. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6081. referencedClasses: []
  6082. }),
  6083. smalltalk.MethodInheritanceTest);
  6084. smalltalk.addMethod(
  6085. smalltalk.method({
  6086. selector: "testReturns1",
  6087. protocol: 'tests',
  6088. fn: function (){
  6089. var self=this;
  6090. return smalltalk.withContext(function($ctx1) {
  6091. self["@performBlock"]=(function(x){
  6092. return smalltalk.withContext(function($ctx2) {
  6093. return _st(x)._foo();
  6094. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6095. self._installTop_("foo ^ false");
  6096. $ctx1.sendIdx["installTop:"]=1;
  6097. self._shouldReturn_(false);
  6098. $ctx1.sendIdx["shouldReturn:"]=1;
  6099. self._installTop_("foo ^ true");
  6100. self._shouldReturn_(true);
  6101. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  6102. args: [],
  6103. 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",
  6104. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6105. referencedClasses: []
  6106. }),
  6107. smalltalk.MethodInheritanceTest);
  6108. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6109. smalltalk.addMethod(
  6110. smalltalk.method({
  6111. selector: "testAbs",
  6112. protocol: 'tests',
  6113. fn: function (){
  6114. var self=this;
  6115. return smalltalk.withContext(function($ctx1) {
  6116. var $1;
  6117. $1=(4)._abs();
  6118. $ctx1.sendIdx["abs"]=1;
  6119. self._assert_equals_($1,(4));
  6120. $ctx1.sendIdx["assert:equals:"]=1;
  6121. self._assert_equals_((-4)._abs(),(4));
  6122. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  6123. args: [],
  6124. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6125. messageSends: ["assert:equals:", "abs"],
  6126. referencedClasses: []
  6127. }),
  6128. smalltalk.NumberTest);
  6129. smalltalk.addMethod(
  6130. smalltalk.method({
  6131. selector: "testArithmetic",
  6132. protocol: 'tests',
  6133. fn: function (){
  6134. var self=this;
  6135. return smalltalk.withContext(function($ctx1) {
  6136. var $1,$2,$3,$5,$4;
  6137. $1=(1.5).__plus((1));
  6138. $ctx1.sendIdx["+"]=1;
  6139. self._assert_equals_($1,(2.5));
  6140. $ctx1.sendIdx["assert:equals:"]=1;
  6141. $2=(2).__minus((1));
  6142. $ctx1.sendIdx["-"]=1;
  6143. self._assert_equals_($2,(1));
  6144. $ctx1.sendIdx["assert:equals:"]=2;
  6145. self._assert_equals_((-2).__minus((1)),(-3));
  6146. $ctx1.sendIdx["assert:equals:"]=3;
  6147. self._assert_equals_((12).__slash((2)),(6));
  6148. $ctx1.sendIdx["assert:equals:"]=4;
  6149. $3=(3).__star((4));
  6150. $ctx1.sendIdx["*"]=1;
  6151. self._assert_equals_($3,(12));
  6152. $ctx1.sendIdx["assert:equals:"]=5;
  6153. self._assert_equals_((7).__slash_slash((2)),(3));
  6154. $ctx1.sendIdx["assert:equals:"]=6;
  6155. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6156. $ctx1.sendIdx["assert:equals:"]=7;
  6157. $5=(1).__plus((2));
  6158. $ctx1.sendIdx["+"]=2;
  6159. $4=_st($5).__star((3));
  6160. $ctx1.sendIdx["*"]=2;
  6161. self._assert_equals_($4,(9));
  6162. $ctx1.sendIdx["assert:equals:"]=8;
  6163. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6164. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  6165. args: [],
  6166. 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",
  6167. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6168. referencedClasses: []
  6169. }),
  6170. smalltalk.NumberTest);
  6171. smalltalk.addMethod(
  6172. smalltalk.method({
  6173. selector: "testAsNumber",
  6174. protocol: 'tests',
  6175. fn: function (){
  6176. var self=this;
  6177. return smalltalk.withContext(function($ctx1) {
  6178. self._assert_equals_((3)._asNumber(),(3));
  6179. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  6180. args: [],
  6181. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6182. messageSends: ["assert:equals:", "asNumber"],
  6183. referencedClasses: []
  6184. }),
  6185. smalltalk.NumberTest);
  6186. smalltalk.addMethod(
  6187. smalltalk.method({
  6188. selector: "testCeiling",
  6189. protocol: 'tests',
  6190. fn: function (){
  6191. var self=this;
  6192. return smalltalk.withContext(function($ctx1) {
  6193. var $1,$2;
  6194. $1=(1.2)._ceiling();
  6195. $ctx1.sendIdx["ceiling"]=1;
  6196. self._assert_equals_($1,(2));
  6197. $ctx1.sendIdx["assert:equals:"]=1;
  6198. $2=(-1.2)._ceiling();
  6199. $ctx1.sendIdx["ceiling"]=2;
  6200. self._assert_equals_($2,(-1));
  6201. $ctx1.sendIdx["assert:equals:"]=2;
  6202. self._assert_equals_((1)._ceiling(),(1));
  6203. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  6204. args: [],
  6205. 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.",
  6206. messageSends: ["assert:equals:", "ceiling"],
  6207. referencedClasses: []
  6208. }),
  6209. smalltalk.NumberTest);
  6210. smalltalk.addMethod(
  6211. smalltalk.method({
  6212. selector: "testComparison",
  6213. protocol: 'tests',
  6214. fn: function (){
  6215. var self=this;
  6216. return smalltalk.withContext(function($ctx1) {
  6217. var $1,$2,$3,$4;
  6218. $1=(3).__gt((2));
  6219. $ctx1.sendIdx[">"]=1;
  6220. self._assert_($1);
  6221. $ctx1.sendIdx["assert:"]=1;
  6222. $2=(2).__lt((3));
  6223. $ctx1.sendIdx["<"]=1;
  6224. self._assert_($2);
  6225. $ctx1.sendIdx["assert:"]=2;
  6226. self._deny_((3).__lt((2)));
  6227. $ctx1.sendIdx["deny:"]=1;
  6228. self._deny_((2).__gt((3)));
  6229. $3=(3).__gt_eq((3));
  6230. $ctx1.sendIdx[">="]=1;
  6231. self._assert_($3);
  6232. $ctx1.sendIdx["assert:"]=3;
  6233. self._assert_((3.1).__gt_eq((3)));
  6234. $ctx1.sendIdx["assert:"]=4;
  6235. $4=(3).__lt_eq((3));
  6236. $ctx1.sendIdx["<="]=1;
  6237. self._assert_($4);
  6238. $ctx1.sendIdx["assert:"]=5;
  6239. self._assert_((3).__lt_eq((3.1)));
  6240. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  6241. args: [],
  6242. 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",
  6243. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6244. referencedClasses: []
  6245. }),
  6246. smalltalk.NumberTest);
  6247. smalltalk.addMethod(
  6248. smalltalk.method({
  6249. selector: "testCopying",
  6250. protocol: 'tests',
  6251. fn: function (){
  6252. var self=this;
  6253. return smalltalk.withContext(function($ctx1) {
  6254. var $1;
  6255. $1=_st((1)._copy()).__eq_eq((1));
  6256. $ctx1.sendIdx["=="]=1;
  6257. self._assert_($1);
  6258. $ctx1.sendIdx["assert:"]=1;
  6259. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6260. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  6261. args: [],
  6262. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6263. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6264. referencedClasses: []
  6265. }),
  6266. smalltalk.NumberTest);
  6267. smalltalk.addMethod(
  6268. smalltalk.method({
  6269. selector: "testEquality",
  6270. protocol: 'tests',
  6271. fn: function (){
  6272. var self=this;
  6273. return smalltalk.withContext(function($ctx1) {
  6274. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6275. $1=(1).__eq((1));
  6276. $ctx1.sendIdx["="]=1;
  6277. self._assert_($1);
  6278. $ctx1.sendIdx["assert:"]=1;
  6279. $2=(0).__eq((0));
  6280. $ctx1.sendIdx["="]=2;
  6281. self._assert_($2);
  6282. $ctx1.sendIdx["assert:"]=2;
  6283. $3=(1).__eq((0));
  6284. $ctx1.sendIdx["="]=3;
  6285. self._deny_($3);
  6286. $ctx1.sendIdx["deny:"]=1;
  6287. $5=(1)._yourself();
  6288. $ctx1.sendIdx["yourself"]=1;
  6289. $4=_st($5).__eq((1));
  6290. $ctx1.sendIdx["="]=4;
  6291. self._assert_($4);
  6292. $ctx1.sendIdx["assert:"]=3;
  6293. $7=(1)._yourself();
  6294. $ctx1.sendIdx["yourself"]=2;
  6295. $6=(1).__eq($7);
  6296. $ctx1.sendIdx["="]=5;
  6297. self._assert_($6);
  6298. $ctx1.sendIdx["assert:"]=4;
  6299. $9=(1)._yourself();
  6300. $ctx1.sendIdx["yourself"]=3;
  6301. $8=_st($9).__eq((1)._yourself());
  6302. $ctx1.sendIdx["="]=6;
  6303. self._assert_($8);
  6304. $10=(0).__eq(false);
  6305. $ctx1.sendIdx["="]=7;
  6306. self._deny_($10);
  6307. $ctx1.sendIdx["deny:"]=2;
  6308. $11=false.__eq((0));
  6309. $ctx1.sendIdx["="]=8;
  6310. self._deny_($11);
  6311. $ctx1.sendIdx["deny:"]=3;
  6312. $12="".__eq((0));
  6313. $ctx1.sendIdx["="]=9;
  6314. self._deny_($12);
  6315. $ctx1.sendIdx["deny:"]=4;
  6316. self._deny_((0).__eq(""));
  6317. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  6318. args: [],
  6319. 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 = ''",
  6320. messageSends: ["assert:", "=", "deny:", "yourself"],
  6321. referencedClasses: []
  6322. }),
  6323. smalltalk.NumberTest);
  6324. smalltalk.addMethod(
  6325. smalltalk.method({
  6326. selector: "testFloor",
  6327. protocol: 'tests',
  6328. fn: function (){
  6329. var self=this;
  6330. return smalltalk.withContext(function($ctx1) {
  6331. var $1,$2;
  6332. $1=(1.2)._floor();
  6333. $ctx1.sendIdx["floor"]=1;
  6334. self._assert_equals_($1,(1));
  6335. $ctx1.sendIdx["assert:equals:"]=1;
  6336. $2=(-1.2)._floor();
  6337. $ctx1.sendIdx["floor"]=2;
  6338. self._assert_equals_($2,(-2));
  6339. $ctx1.sendIdx["assert:equals:"]=2;
  6340. self._assert_equals_((1)._floor(),(1));
  6341. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  6342. args: [],
  6343. 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.",
  6344. messageSends: ["assert:equals:", "floor"],
  6345. referencedClasses: []
  6346. }),
  6347. smalltalk.NumberTest);
  6348. smalltalk.addMethod(
  6349. smalltalk.method({
  6350. selector: "testHexNumbers",
  6351. protocol: 'tests',
  6352. fn: function (){
  6353. var self=this;
  6354. return smalltalk.withContext(function($ctx1) {
  6355. var $1,$2,$3,$4,$5;
  6356. self._assert_equals_((9),(9));
  6357. $ctx1.sendIdx["assert:equals:"]=1;
  6358. $1=(10)._truncated();
  6359. $ctx1.sendIdx["truncated"]=1;
  6360. self._assert_equals_($1,(10));
  6361. $ctx1.sendIdx["assert:equals:"]=2;
  6362. $2=(11)._truncated();
  6363. $ctx1.sendIdx["truncated"]=2;
  6364. self._assert_equals_($2,(11));
  6365. $ctx1.sendIdx["assert:equals:"]=3;
  6366. $3=(12)._truncated();
  6367. $ctx1.sendIdx["truncated"]=3;
  6368. self._assert_equals_($3,(12));
  6369. $ctx1.sendIdx["assert:equals:"]=4;
  6370. $4=(13)._truncated();
  6371. $ctx1.sendIdx["truncated"]=4;
  6372. self._assert_equals_($4,(13));
  6373. $ctx1.sendIdx["assert:equals:"]=5;
  6374. $5=(14)._truncated();
  6375. $ctx1.sendIdx["truncated"]=5;
  6376. self._assert_equals_($5,(14));
  6377. $ctx1.sendIdx["assert:equals:"]=6;
  6378. self._assert_equals_((15)._truncated(),(15));
  6379. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  6380. args: [],
  6381. 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",
  6382. messageSends: ["assert:equals:", "truncated"],
  6383. referencedClasses: []
  6384. }),
  6385. smalltalk.NumberTest);
  6386. smalltalk.addMethod(
  6387. smalltalk.method({
  6388. selector: "testIdentity",
  6389. protocol: 'tests',
  6390. fn: function (){
  6391. var self=this;
  6392. return smalltalk.withContext(function($ctx1) {
  6393. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6394. $1=(1).__eq_eq((1));
  6395. $ctx1.sendIdx["=="]=1;
  6396. self._assert_($1);
  6397. $ctx1.sendIdx["assert:"]=1;
  6398. $2=(0).__eq_eq((0));
  6399. $ctx1.sendIdx["=="]=2;
  6400. self._assert_($2);
  6401. $ctx1.sendIdx["assert:"]=2;
  6402. $3=(1).__eq_eq((0));
  6403. $ctx1.sendIdx["=="]=3;
  6404. self._deny_($3);
  6405. $ctx1.sendIdx["deny:"]=1;
  6406. $5=(1)._yourself();
  6407. $ctx1.sendIdx["yourself"]=1;
  6408. $4=_st($5).__eq_eq((1));
  6409. $ctx1.sendIdx["=="]=4;
  6410. self._assert_($4);
  6411. $ctx1.sendIdx["assert:"]=3;
  6412. $7=(1)._yourself();
  6413. $ctx1.sendIdx["yourself"]=2;
  6414. $6=(1).__eq_eq($7);
  6415. $ctx1.sendIdx["=="]=5;
  6416. self._assert_($6);
  6417. $ctx1.sendIdx["assert:"]=4;
  6418. $9=(1)._yourself();
  6419. $ctx1.sendIdx["yourself"]=3;
  6420. $8=_st($9).__eq_eq((1)._yourself());
  6421. $ctx1.sendIdx["=="]=6;
  6422. self._assert_($8);
  6423. self._deny_((1).__eq_eq((2)));
  6424. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  6425. args: [],
  6426. 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",
  6427. messageSends: ["assert:", "==", "deny:", "yourself"],
  6428. referencedClasses: []
  6429. }),
  6430. smalltalk.NumberTest);
  6431. smalltalk.addMethod(
  6432. smalltalk.method({
  6433. selector: "testInvalidHexNumbers",
  6434. protocol: 'tests',
  6435. fn: function (){
  6436. var self=this;
  6437. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6438. return smalltalk.withContext(function($ctx1) {
  6439. self._should_raise_((function(){
  6440. return smalltalk.withContext(function($ctx2) {
  6441. return (16)._rG();
  6442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6443. $ctx1.sendIdx["should:raise:"]=1;
  6444. self._should_raise_((function(){
  6445. return smalltalk.withContext(function($ctx2) {
  6446. return (16)._rg();
  6447. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6448. $ctx1.sendIdx["should:raise:"]=2;
  6449. self._should_raise_((function(){
  6450. return smalltalk.withContext(function($ctx2) {
  6451. return (16)._rH();
  6452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6453. $ctx1.sendIdx["should:raise:"]=3;
  6454. self._should_raise_((function(){
  6455. return smalltalk.withContext(function($ctx2) {
  6456. return (16)._rh();
  6457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6458. $ctx1.sendIdx["should:raise:"]=4;
  6459. self._should_raise_((function(){
  6460. return smalltalk.withContext(function($ctx2) {
  6461. return (16)._rI();
  6462. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6463. $ctx1.sendIdx["should:raise:"]=5;
  6464. self._should_raise_((function(){
  6465. return smalltalk.withContext(function($ctx2) {
  6466. return (16)._ri();
  6467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6468. $ctx1.sendIdx["should:raise:"]=6;
  6469. self._should_raise_((function(){
  6470. return smalltalk.withContext(function($ctx2) {
  6471. return (16)._rJ();
  6472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6473. $ctx1.sendIdx["should:raise:"]=7;
  6474. self._should_raise_((function(){
  6475. return smalltalk.withContext(function($ctx2) {
  6476. return (16)._rj();
  6477. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6478. $ctx1.sendIdx["should:raise:"]=8;
  6479. self._should_raise_((function(){
  6480. return smalltalk.withContext(function($ctx2) {
  6481. return (16)._rK();
  6482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6483. $ctx1.sendIdx["should:raise:"]=9;
  6484. self._should_raise_((function(){
  6485. return smalltalk.withContext(function($ctx2) {
  6486. return (16)._rk();
  6487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6488. $ctx1.sendIdx["should:raise:"]=10;
  6489. self._should_raise_((function(){
  6490. return smalltalk.withContext(function($ctx2) {
  6491. return (16)._rL();
  6492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6493. $ctx1.sendIdx["should:raise:"]=11;
  6494. self._should_raise_((function(){
  6495. return smalltalk.withContext(function($ctx2) {
  6496. return (16)._rl();
  6497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6498. $ctx1.sendIdx["should:raise:"]=12;
  6499. self._should_raise_((function(){
  6500. return smalltalk.withContext(function($ctx2) {
  6501. return (16)._rM();
  6502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6503. $ctx1.sendIdx["should:raise:"]=13;
  6504. self._should_raise_((function(){
  6505. return smalltalk.withContext(function($ctx2) {
  6506. return (16)._rm();
  6507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6508. $ctx1.sendIdx["should:raise:"]=14;
  6509. self._should_raise_((function(){
  6510. return smalltalk.withContext(function($ctx2) {
  6511. return (16)._rN();
  6512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6513. $ctx1.sendIdx["should:raise:"]=15;
  6514. self._should_raise_((function(){
  6515. return smalltalk.withContext(function($ctx2) {
  6516. return (16)._rn();
  6517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6518. $ctx1.sendIdx["should:raise:"]=16;
  6519. self._should_raise_((function(){
  6520. return smalltalk.withContext(function($ctx2) {
  6521. return (16)._rO();
  6522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6523. $ctx1.sendIdx["should:raise:"]=17;
  6524. self._should_raise_((function(){
  6525. return smalltalk.withContext(function($ctx2) {
  6526. return (16)._ro();
  6527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6528. $ctx1.sendIdx["should:raise:"]=18;
  6529. self._should_raise_((function(){
  6530. return smalltalk.withContext(function($ctx2) {
  6531. return (16)._rP();
  6532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6533. $ctx1.sendIdx["should:raise:"]=19;
  6534. self._should_raise_((function(){
  6535. return smalltalk.withContext(function($ctx2) {
  6536. return (16)._rp();
  6537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6538. $ctx1.sendIdx["should:raise:"]=20;
  6539. self._should_raise_((function(){
  6540. return smalltalk.withContext(function($ctx2) {
  6541. return (16)._rQ();
  6542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6543. $ctx1.sendIdx["should:raise:"]=21;
  6544. self._should_raise_((function(){
  6545. return smalltalk.withContext(function($ctx2) {
  6546. return (16)._rq();
  6547. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6548. $ctx1.sendIdx["should:raise:"]=22;
  6549. self._should_raise_((function(){
  6550. return smalltalk.withContext(function($ctx2) {
  6551. return (16)._rR();
  6552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6553. $ctx1.sendIdx["should:raise:"]=23;
  6554. self._should_raise_((function(){
  6555. return smalltalk.withContext(function($ctx2) {
  6556. return (16)._rr();
  6557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6558. $ctx1.sendIdx["should:raise:"]=24;
  6559. self._should_raise_((function(){
  6560. return smalltalk.withContext(function($ctx2) {
  6561. return (16)._rS();
  6562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6563. $ctx1.sendIdx["should:raise:"]=25;
  6564. self._should_raise_((function(){
  6565. return smalltalk.withContext(function($ctx2) {
  6566. return (16)._rs();
  6567. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6568. $ctx1.sendIdx["should:raise:"]=26;
  6569. self._should_raise_((function(){
  6570. return smalltalk.withContext(function($ctx2) {
  6571. return (16)._rT();
  6572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6573. $ctx1.sendIdx["should:raise:"]=27;
  6574. self._should_raise_((function(){
  6575. return smalltalk.withContext(function($ctx2) {
  6576. return (16)._rt();
  6577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6578. $ctx1.sendIdx["should:raise:"]=28;
  6579. self._should_raise_((function(){
  6580. return smalltalk.withContext(function($ctx2) {
  6581. return (16)._rU();
  6582. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6583. $ctx1.sendIdx["should:raise:"]=29;
  6584. self._should_raise_((function(){
  6585. return smalltalk.withContext(function($ctx2) {
  6586. return (16)._ru();
  6587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6588. $ctx1.sendIdx["should:raise:"]=30;
  6589. self._should_raise_((function(){
  6590. return smalltalk.withContext(function($ctx2) {
  6591. return (16)._rV();
  6592. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6593. $ctx1.sendIdx["should:raise:"]=31;
  6594. self._should_raise_((function(){
  6595. return smalltalk.withContext(function($ctx2) {
  6596. return (16)._rv();
  6597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6598. $ctx1.sendIdx["should:raise:"]=32;
  6599. self._should_raise_((function(){
  6600. return smalltalk.withContext(function($ctx2) {
  6601. return (16)._rW();
  6602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6603. $ctx1.sendIdx["should:raise:"]=33;
  6604. self._should_raise_((function(){
  6605. return smalltalk.withContext(function($ctx2) {
  6606. return (16)._rw();
  6607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6608. $ctx1.sendIdx["should:raise:"]=34;
  6609. self._should_raise_((function(){
  6610. return smalltalk.withContext(function($ctx2) {
  6611. return (16)._rX();
  6612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6613. $ctx1.sendIdx["should:raise:"]=35;
  6614. self._should_raise_((function(){
  6615. return smalltalk.withContext(function($ctx2) {
  6616. return (16)._rx();
  6617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6618. $ctx1.sendIdx["should:raise:"]=36;
  6619. self._should_raise_((function(){
  6620. return smalltalk.withContext(function($ctx2) {
  6621. return (16)._rY();
  6622. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6623. $ctx1.sendIdx["should:raise:"]=37;
  6624. self._should_raise_((function(){
  6625. return smalltalk.withContext(function($ctx2) {
  6626. return (16)._ry();
  6627. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6628. $ctx1.sendIdx["should:raise:"]=38;
  6629. self._should_raise_((function(){
  6630. return smalltalk.withContext(function($ctx2) {
  6631. return (16)._rZ();
  6632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6633. $ctx1.sendIdx["should:raise:"]=39;
  6634. self._should_raise_((function(){
  6635. return smalltalk.withContext(function($ctx2) {
  6636. return (16)._rz();
  6637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6638. $ctx1.sendIdx["should:raise:"]=40;
  6639. self._should_raise_((function(){
  6640. return smalltalk.withContext(function($ctx2) {
  6641. return (11259375)._Z();
  6642. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6643. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  6644. args: [],
  6645. 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.",
  6646. 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"],
  6647. referencedClasses: ["MessageNotUnderstood"]
  6648. }),
  6649. smalltalk.NumberTest);
  6650. smalltalk.addMethod(
  6651. smalltalk.method({
  6652. selector: "testLog",
  6653. protocol: 'tests',
  6654. fn: function (){
  6655. var self=this;
  6656. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  6657. return smalltalk.withContext(function($ctx1) {
  6658. self._assert_equals_((10000)._log(),(4));
  6659. $ctx1.sendIdx["assert:equals:"]=1;
  6660. self._assert_equals_((512)._log_((2)),(9));
  6661. $ctx1.sendIdx["assert:equals:"]=2;
  6662. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  6663. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  6664. args: [],
  6665. 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.",
  6666. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  6667. referencedClasses: ["Number"]
  6668. }),
  6669. smalltalk.NumberTest);
  6670. smalltalk.addMethod(
  6671. smalltalk.method({
  6672. selector: "testMinMax",
  6673. protocol: 'tests',
  6674. fn: function (){
  6675. var self=this;
  6676. return smalltalk.withContext(function($ctx1) {
  6677. self._assert_equals_((2)._max_((5)),(5));
  6678. $ctx1.sendIdx["assert:equals:"]=1;
  6679. self._assert_equals_((2)._min_((5)),(2));
  6680. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  6681. args: [],
  6682. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  6683. messageSends: ["assert:equals:", "max:", "min:"],
  6684. referencedClasses: []
  6685. }),
  6686. smalltalk.NumberTest);
  6687. smalltalk.addMethod(
  6688. smalltalk.method({
  6689. selector: "testNegated",
  6690. protocol: 'tests',
  6691. fn: function (){
  6692. var self=this;
  6693. return smalltalk.withContext(function($ctx1) {
  6694. var $1;
  6695. $1=(3)._negated();
  6696. $ctx1.sendIdx["negated"]=1;
  6697. self._assert_equals_($1,(-3));
  6698. $ctx1.sendIdx["assert:equals:"]=1;
  6699. self._assert_equals_((-3)._negated(),(3));
  6700. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  6701. args: [],
  6702. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  6703. messageSends: ["assert:equals:", "negated"],
  6704. referencedClasses: []
  6705. }),
  6706. smalltalk.NumberTest);
  6707. smalltalk.addMethod(
  6708. smalltalk.method({
  6709. selector: "testPrintShowingDecimalPlaces",
  6710. protocol: 'tests',
  6711. fn: function (){
  6712. var self=this;
  6713. return smalltalk.withContext(function($ctx1) {
  6714. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  6715. $1=(23)._printShowingDecimalPlaces_((2));
  6716. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  6717. self._assert_equals_($1,"23.00");
  6718. $ctx1.sendIdx["assert:equals:"]=1;
  6719. $2=(23.5698)._printShowingDecimalPlaces_((2));
  6720. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  6721. self._assert_equals_($2,"23.57");
  6722. $ctx1.sendIdx["assert:equals:"]=2;
  6723. $4=(234.567)._negated();
  6724. $ctx1.sendIdx["negated"]=1;
  6725. $3=_st($4)._printShowingDecimalPlaces_((5));
  6726. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  6727. self._assert_equals_($3,"-234.56700");
  6728. $ctx1.sendIdx["assert:equals:"]=3;
  6729. $5=(23.4567)._printShowingDecimalPlaces_((0));
  6730. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  6731. self._assert_equals_($5,"23");
  6732. $ctx1.sendIdx["assert:equals:"]=4;
  6733. $6=(23.5567)._printShowingDecimalPlaces_((0));
  6734. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  6735. self._assert_equals_($6,"24");
  6736. $ctx1.sendIdx["assert:equals:"]=5;
  6737. $8=(23.4567)._negated();
  6738. $ctx1.sendIdx["negated"]=2;
  6739. $7=_st($8)._printShowingDecimalPlaces_((0));
  6740. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  6741. self._assert_equals_($7,"-23");
  6742. $ctx1.sendIdx["assert:equals:"]=6;
  6743. $10=(23.5567)._negated();
  6744. $ctx1.sendIdx["negated"]=3;
  6745. $9=_st($10)._printShowingDecimalPlaces_((0));
  6746. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  6747. self._assert_equals_($9,"-24");
  6748. $ctx1.sendIdx["assert:equals:"]=7;
  6749. $11=(100000000)._printShowingDecimalPlaces_((1));
  6750. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  6751. self._assert_equals_($11,"100000000.0");
  6752. $ctx1.sendIdx["assert:equals:"]=8;
  6753. $12=(0.98)._printShowingDecimalPlaces_((5));
  6754. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  6755. self._assert_equals_($12,"0.98000");
  6756. $ctx1.sendIdx["assert:equals:"]=9;
  6757. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  6758. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  6759. self._assert_equals_($13,"-0.98");
  6760. $ctx1.sendIdx["assert:equals:"]=10;
  6761. $14=(2.567)._printShowingDecimalPlaces_((2));
  6762. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  6763. self._assert_equals_($14,"2.57");
  6764. $ctx1.sendIdx["assert:equals:"]=11;
  6765. $15=(-2.567)._printShowingDecimalPlaces_((2));
  6766. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  6767. self._assert_equals_($15,"-2.57");
  6768. $ctx1.sendIdx["assert:equals:"]=12;
  6769. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  6770. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  6771. args: [],
  6772. 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'.",
  6773. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  6774. referencedClasses: []
  6775. }),
  6776. smalltalk.NumberTest);
  6777. smalltalk.addMethod(
  6778. smalltalk.method({
  6779. selector: "testRaisedTo",
  6780. protocol: 'tests',
  6781. fn: function (){
  6782. var self=this;
  6783. return smalltalk.withContext(function($ctx1) {
  6784. var $1,$2,$3;
  6785. $1=(2)._raisedTo_((4));
  6786. $ctx1.sendIdx["raisedTo:"]=1;
  6787. self._assert_equals_($1,(16));
  6788. $ctx1.sendIdx["assert:equals:"]=1;
  6789. $2=(2)._raisedTo_((0));
  6790. $ctx1.sendIdx["raisedTo:"]=2;
  6791. self._assert_equals_($2,(1));
  6792. $ctx1.sendIdx["assert:equals:"]=2;
  6793. $3=(2)._raisedTo_((-3));
  6794. $ctx1.sendIdx["raisedTo:"]=3;
  6795. self._assert_equals_($3,(0.125));
  6796. $ctx1.sendIdx["assert:equals:"]=3;
  6797. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  6798. $ctx1.sendIdx["assert:equals:"]=4;
  6799. self._assert_equals_((2).__star_star((4)),(16));
  6800. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  6801. args: [],
  6802. 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.",
  6803. messageSends: ["assert:equals:", "raisedTo:", "**"],
  6804. referencedClasses: []
  6805. }),
  6806. smalltalk.NumberTest);
  6807. smalltalk.addMethod(
  6808. smalltalk.method({
  6809. selector: "testRounded",
  6810. protocol: 'tests',
  6811. fn: function (){
  6812. var self=this;
  6813. return smalltalk.withContext(function($ctx1) {
  6814. var $1,$2;
  6815. $1=(3)._rounded();
  6816. $ctx1.sendIdx["rounded"]=1;
  6817. self._assert_equals_($1,(3));
  6818. $ctx1.sendIdx["assert:equals:"]=1;
  6819. $2=(3.212)._rounded();
  6820. $ctx1.sendIdx["rounded"]=2;
  6821. self._assert_equals_($2,(3));
  6822. $ctx1.sendIdx["assert:equals:"]=2;
  6823. self._assert_equals_((3.51)._rounded(),(4));
  6824. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  6825. args: [],
  6826. 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",
  6827. messageSends: ["assert:equals:", "rounded"],
  6828. referencedClasses: []
  6829. }),
  6830. smalltalk.NumberTest);
  6831. smalltalk.addMethod(
  6832. smalltalk.method({
  6833. selector: "testSign",
  6834. protocol: 'tests',
  6835. fn: function (){
  6836. var self=this;
  6837. return smalltalk.withContext(function($ctx1) {
  6838. var $1,$2;
  6839. $1=(5)._sign();
  6840. $ctx1.sendIdx["sign"]=1;
  6841. self._assert_equals_($1,(1));
  6842. $ctx1.sendIdx["assert:equals:"]=1;
  6843. $2=(0)._sign();
  6844. $ctx1.sendIdx["sign"]=2;
  6845. self._assert_equals_($2,(0));
  6846. $ctx1.sendIdx["assert:equals:"]=2;
  6847. self._assert_equals_((-1.4)._sign(),(-1));
  6848. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  6849. args: [],
  6850. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  6851. messageSends: ["assert:equals:", "sign"],
  6852. referencedClasses: []
  6853. }),
  6854. smalltalk.NumberTest);
  6855. smalltalk.addMethod(
  6856. smalltalk.method({
  6857. selector: "testSqrt",
  6858. protocol: 'tests',
  6859. fn: function (){
  6860. var self=this;
  6861. return smalltalk.withContext(function($ctx1) {
  6862. var $1;
  6863. $1=(4)._sqrt();
  6864. $ctx1.sendIdx["sqrt"]=1;
  6865. self._assert_equals_($1,(2));
  6866. $ctx1.sendIdx["assert:equals:"]=1;
  6867. self._assert_equals_((16)._sqrt(),(4));
  6868. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  6869. args: [],
  6870. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  6871. messageSends: ["assert:equals:", "sqrt"],
  6872. referencedClasses: []
  6873. }),
  6874. smalltalk.NumberTest);
  6875. smalltalk.addMethod(
  6876. smalltalk.method({
  6877. selector: "testSquared",
  6878. protocol: 'tests',
  6879. fn: function (){
  6880. var self=this;
  6881. return smalltalk.withContext(function($ctx1) {
  6882. self._assert_equals_((4)._squared(),(16));
  6883. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  6884. args: [],
  6885. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  6886. messageSends: ["assert:equals:", "squared"],
  6887. referencedClasses: []
  6888. }),
  6889. smalltalk.NumberTest);
  6890. smalltalk.addMethod(
  6891. smalltalk.method({
  6892. selector: "testTimesRepeat",
  6893. protocol: 'tests',
  6894. fn: function (){
  6895. var self=this;
  6896. var i;
  6897. return smalltalk.withContext(function($ctx1) {
  6898. i=(0);
  6899. (0)._timesRepeat_((function(){
  6900. return smalltalk.withContext(function($ctx2) {
  6901. i=_st(i).__plus((1));
  6902. $ctx2.sendIdx["+"]=1;
  6903. return i;
  6904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6905. $ctx1.sendIdx["timesRepeat:"]=1;
  6906. self._assert_equals_(i,(0));
  6907. $ctx1.sendIdx["assert:equals:"]=1;
  6908. (5)._timesRepeat_((function(){
  6909. return smalltalk.withContext(function($ctx2) {
  6910. i=_st(i).__plus((1));
  6911. return i;
  6912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6913. self._assert_equals_(i,(5));
  6914. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  6915. args: [],
  6916. 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",
  6917. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  6918. referencedClasses: []
  6919. }),
  6920. smalltalk.NumberTest);
  6921. smalltalk.addMethod(
  6922. smalltalk.method({
  6923. selector: "testTo",
  6924. protocol: 'tests',
  6925. fn: function (){
  6926. var self=this;
  6927. return smalltalk.withContext(function($ctx1) {
  6928. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  6929. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  6930. args: [],
  6931. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  6932. messageSends: ["assert:equals:", "to:"],
  6933. referencedClasses: []
  6934. }),
  6935. smalltalk.NumberTest);
  6936. smalltalk.addMethod(
  6937. smalltalk.method({
  6938. selector: "testToBy",
  6939. protocol: 'tests',
  6940. fn: function (){
  6941. var self=this;
  6942. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6943. return smalltalk.withContext(function($ctx1) {
  6944. var $1;
  6945. $1=(0)._to_by_((6),(2));
  6946. $ctx1.sendIdx["to:by:"]=1;
  6947. self._assert_equals_($1,[(0), (2), (4), (6)]);
  6948. self._should_raise_((function(){
  6949. return smalltalk.withContext(function($ctx2) {
  6950. return (1)._to_by_((4),(0));
  6951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6952. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  6953. args: [],
  6954. 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",
  6955. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  6956. referencedClasses: ["Error"]
  6957. }),
  6958. smalltalk.NumberTest);
  6959. smalltalk.addMethod(
  6960. smalltalk.method({
  6961. selector: "testTrigonometry",
  6962. protocol: 'tests',
  6963. fn: function (){
  6964. var self=this;
  6965. return smalltalk.withContext(function($ctx1) {
  6966. self._assert_equals_((0)._cos(),(1));
  6967. $ctx1.sendIdx["assert:equals:"]=1;
  6968. self._assert_equals_((0)._sin(),(0));
  6969. $ctx1.sendIdx["assert:equals:"]=2;
  6970. self._assert_equals_((0)._tan(),(0));
  6971. $ctx1.sendIdx["assert:equals:"]=3;
  6972. self._assert_equals_((1)._arcCos(),(0));
  6973. $ctx1.sendIdx["assert:equals:"]=4;
  6974. self._assert_equals_((0)._arcSin(),(0));
  6975. $ctx1.sendIdx["assert:equals:"]=5;
  6976. self._assert_equals_((0)._arcTan(),(0));
  6977. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  6978. args: [],
  6979. 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.",
  6980. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  6981. referencedClasses: []
  6982. }),
  6983. smalltalk.NumberTest);
  6984. smalltalk.addMethod(
  6985. smalltalk.method({
  6986. selector: "testTruncated",
  6987. protocol: 'tests',
  6988. fn: function (){
  6989. var self=this;
  6990. return smalltalk.withContext(function($ctx1) {
  6991. var $1,$2;
  6992. $1=(3)._truncated();
  6993. $ctx1.sendIdx["truncated"]=1;
  6994. self._assert_equals_($1,(3));
  6995. $ctx1.sendIdx["assert:equals:"]=1;
  6996. $2=(3.212)._truncated();
  6997. $ctx1.sendIdx["truncated"]=2;
  6998. self._assert_equals_($2,(3));
  6999. $ctx1.sendIdx["assert:equals:"]=2;
  7000. self._assert_equals_((3.51)._truncated(),(3));
  7001. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  7002. args: [],
  7003. 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",
  7004. messageSends: ["assert:equals:", "truncated"],
  7005. referencedClasses: []
  7006. }),
  7007. smalltalk.NumberTest);
  7008. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  7009. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7010. smalltalk.addMethod(
  7011. smalltalk.method({
  7012. selector: "foo",
  7013. protocol: 'not yet classified',
  7014. fn: function (){
  7015. var self=this;
  7016. return smalltalk.withContext(function($ctx1) {
  7017. var $1;
  7018. $1=self["@foo"];
  7019. return $1;
  7020. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  7021. args: [],
  7022. source: "foo\x0a\x09^ foo",
  7023. messageSends: [],
  7024. referencedClasses: []
  7025. }),
  7026. smalltalk.ObjectMock);
  7027. smalltalk.addMethod(
  7028. smalltalk.method({
  7029. selector: "foo:",
  7030. protocol: 'not yet classified',
  7031. fn: function (anObject){
  7032. var self=this;
  7033. return smalltalk.withContext(function($ctx1) {
  7034. self["@foo"]=anObject;
  7035. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  7036. args: ["anObject"],
  7037. source: "foo: anObject\x0a\x09foo := anObject",
  7038. messageSends: [],
  7039. referencedClasses: []
  7040. }),
  7041. smalltalk.ObjectMock);
  7042. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7043. smalltalk.addMethod(
  7044. smalltalk.method({
  7045. selector: "notDefined",
  7046. protocol: 'tests',
  7047. fn: function (){
  7048. var self=this;
  7049. return smalltalk.withContext(function($ctx1) {
  7050. return void 0;;
  7051. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  7052. args: [],
  7053. source: "notDefined\x0a\x09<return void 0;>",
  7054. messageSends: [],
  7055. referencedClasses: []
  7056. }),
  7057. smalltalk.ObjectTest);
  7058. smalltalk.addMethod(
  7059. smalltalk.method({
  7060. selector: "testBasicAccess",
  7061. protocol: 'tests',
  7062. fn: function (){
  7063. var self=this;
  7064. var o;
  7065. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7066. return smalltalk.withContext(function($ctx1) {
  7067. var $1;
  7068. o=_st($Object())._new();
  7069. _st(o)._basicAt_put_("a",(1));
  7070. $1=_st(o)._basicAt_("a");
  7071. $ctx1.sendIdx["basicAt:"]=1;
  7072. self._assert_equals_($1,(1));
  7073. $ctx1.sendIdx["assert:equals:"]=1;
  7074. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7075. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  7076. args: [],
  7077. 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",
  7078. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7079. referencedClasses: ["Object"]
  7080. }),
  7081. smalltalk.ObjectTest);
  7082. smalltalk.addMethod(
  7083. smalltalk.method({
  7084. selector: "testBasicPerform",
  7085. protocol: 'tests',
  7086. fn: function (){
  7087. var self=this;
  7088. var o;
  7089. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7090. return smalltalk.withContext(function($ctx1) {
  7091. o=_st($Object())._new();
  7092. _st(o)._basicAt_put_("func",(function(){
  7093. return smalltalk.withContext(function($ctx2) {
  7094. return "hello";
  7095. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7096. $ctx1.sendIdx["basicAt:put:"]=1;
  7097. _st(o)._basicAt_put_("func2",(function(a){
  7098. return smalltalk.withContext(function($ctx2) {
  7099. return _st(a).__plus((1));
  7100. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7101. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7102. $ctx1.sendIdx["assert:equals:"]=1;
  7103. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7104. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  7105. args: [],
  7106. 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",
  7107. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7108. referencedClasses: ["Object"]
  7109. }),
  7110. smalltalk.ObjectTest);
  7111. smalltalk.addMethod(
  7112. smalltalk.method({
  7113. selector: "testDNU",
  7114. protocol: 'tests',
  7115. fn: function (){
  7116. var self=this;
  7117. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7118. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7119. return smalltalk.withContext(function($ctx1) {
  7120. self._should_raise_((function(){
  7121. return smalltalk.withContext(function($ctx2) {
  7122. return _st(_st($Object())._new())._foo();
  7123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7124. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  7125. args: [],
  7126. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7127. messageSends: ["should:raise:", "foo", "new"],
  7128. referencedClasses: ["Object", "MessageNotUnderstood"]
  7129. }),
  7130. smalltalk.ObjectTest);
  7131. smalltalk.addMethod(
  7132. smalltalk.method({
  7133. selector: "testEquality",
  7134. protocol: 'tests',
  7135. fn: function (){
  7136. var self=this;
  7137. var o;
  7138. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7139. return smalltalk.withContext(function($ctx1) {
  7140. var $1,$2,$4,$3;
  7141. o=_st($Object())._new();
  7142. $ctx1.sendIdx["new"]=1;
  7143. $1=_st(o).__eq(_st($Object())._new());
  7144. $ctx1.sendIdx["="]=1;
  7145. self._deny_($1);
  7146. $2=_st(o).__eq(o);
  7147. $ctx1.sendIdx["="]=2;
  7148. self._assert_($2);
  7149. $ctx1.sendIdx["assert:"]=1;
  7150. $4=_st(o)._yourself();
  7151. $ctx1.sendIdx["yourself"]=1;
  7152. $3=_st($4).__eq(o);
  7153. $ctx1.sendIdx["="]=3;
  7154. self._assert_($3);
  7155. $ctx1.sendIdx["assert:"]=2;
  7156. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7157. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  7158. args: [],
  7159. 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)",
  7160. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7161. referencedClasses: ["Object"]
  7162. }),
  7163. smalltalk.ObjectTest);
  7164. smalltalk.addMethod(
  7165. smalltalk.method({
  7166. selector: "testHalt",
  7167. protocol: 'tests',
  7168. fn: function (){
  7169. var self=this;
  7170. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7171. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7172. return smalltalk.withContext(function($ctx1) {
  7173. self._should_raise_((function(){
  7174. return smalltalk.withContext(function($ctx2) {
  7175. return _st(_st($Object())._new())._halt();
  7176. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7177. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  7178. args: [],
  7179. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7180. messageSends: ["should:raise:", "halt", "new"],
  7181. referencedClasses: ["Object", "Error"]
  7182. }),
  7183. smalltalk.ObjectTest);
  7184. smalltalk.addMethod(
  7185. smalltalk.method({
  7186. selector: "testIdentity",
  7187. protocol: 'tests',
  7188. fn: function (){
  7189. var self=this;
  7190. var o;
  7191. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7192. return smalltalk.withContext(function($ctx1) {
  7193. var $1,$2,$4,$3;
  7194. o=_st($Object())._new();
  7195. $ctx1.sendIdx["new"]=1;
  7196. $1=_st(o).__eq_eq(_st($Object())._new());
  7197. $ctx1.sendIdx["=="]=1;
  7198. self._deny_($1);
  7199. $2=_st(o).__eq_eq(o);
  7200. $ctx1.sendIdx["=="]=2;
  7201. self._assert_($2);
  7202. $ctx1.sendIdx["assert:"]=1;
  7203. $4=_st(o)._yourself();
  7204. $ctx1.sendIdx["yourself"]=1;
  7205. $3=_st($4).__eq_eq(o);
  7206. $ctx1.sendIdx["=="]=3;
  7207. self._assert_($3);
  7208. $ctx1.sendIdx["assert:"]=2;
  7209. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7210. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  7211. args: [],
  7212. 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",
  7213. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7214. referencedClasses: ["Object"]
  7215. }),
  7216. smalltalk.ObjectTest);
  7217. smalltalk.addMethod(
  7218. smalltalk.method({
  7219. selector: "testIfNil",
  7220. protocol: 'tests',
  7221. fn: function (){
  7222. var self=this;
  7223. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7224. return smalltalk.withContext(function($ctx1) {
  7225. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  7226. $2=_st($Object())._new();
  7227. $ctx1.sendIdx["new"]=1;
  7228. $1=_st($2)._isNil();
  7229. self._deny_($1);
  7230. $ctx1.sendIdx["deny:"]=1;
  7231. $5=_st($Object())._new();
  7232. $ctx1.sendIdx["new"]=2;
  7233. if(($receiver = $5) == nil || $receiver == null){
  7234. $4=true;
  7235. } else {
  7236. $4=$5;
  7237. };
  7238. $3=_st($4).__eq(true);
  7239. self._deny_($3);
  7240. $7=_st($Object())._new();
  7241. $ctx1.sendIdx["new"]=3;
  7242. if(($receiver = $7) == nil || $receiver == null){
  7243. $6=$7;
  7244. } else {
  7245. $6=true;
  7246. };
  7247. self._assert_equals_($6,true);
  7248. $ctx1.sendIdx["assert:equals:"]=1;
  7249. $9=_st($Object())._new();
  7250. $ctx1.sendIdx["new"]=4;
  7251. if(($receiver = $9) == nil || $receiver == null){
  7252. $8=false;
  7253. } else {
  7254. $8=true;
  7255. };
  7256. self._assert_equals_($8,true);
  7257. $ctx1.sendIdx["assert:equals:"]=2;
  7258. $11=_st($Object())._new();
  7259. if(($receiver = $11) == nil || $receiver == null){
  7260. $10=false;
  7261. } else {
  7262. $10=true;
  7263. };
  7264. self._assert_equals_($10,true);
  7265. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  7266. args: [],
  7267. 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",
  7268. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7269. referencedClasses: ["Object"]
  7270. }),
  7271. smalltalk.ObjectTest);
  7272. smalltalk.addMethod(
  7273. smalltalk.method({
  7274. selector: "testInstVars",
  7275. protocol: 'tests',
  7276. fn: function (){
  7277. var self=this;
  7278. var o;
  7279. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7280. return smalltalk.withContext(function($ctx1) {
  7281. var $1,$2;
  7282. o=_st($ObjectMock())._new();
  7283. $1=_st(o)._instVarAt_("foo");
  7284. $ctx1.sendIdx["instVarAt:"]=1;
  7285. self._assert_equals_($1,nil);
  7286. $ctx1.sendIdx["assert:equals:"]=1;
  7287. _st(o)._instVarAt_put_("foo",(1));
  7288. $2=_st(o)._instVarAt_("foo");
  7289. $ctx1.sendIdx["instVarAt:"]=2;
  7290. self._assert_equals_($2,(1));
  7291. $ctx1.sendIdx["assert:equals:"]=2;
  7292. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7293. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  7294. args: [],
  7295. 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",
  7296. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7297. referencedClasses: ["ObjectMock"]
  7298. }),
  7299. smalltalk.ObjectTest);
  7300. smalltalk.addMethod(
  7301. smalltalk.method({
  7302. selector: "testNilUndefined",
  7303. protocol: 'tests',
  7304. fn: function (){
  7305. var self=this;
  7306. return smalltalk.withContext(function($ctx1) {
  7307. self._assert_equals_(self._notDefined(),nil);
  7308. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  7309. args: [],
  7310. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7311. messageSends: ["assert:equals:", "notDefined"],
  7312. referencedClasses: []
  7313. }),
  7314. smalltalk.ObjectTest);
  7315. smalltalk.addMethod(
  7316. smalltalk.method({
  7317. selector: "testYourself",
  7318. protocol: 'tests',
  7319. fn: function (){
  7320. var self=this;
  7321. var o;
  7322. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7323. return smalltalk.withContext(function($ctx1) {
  7324. o=_st($ObjectMock())._new();
  7325. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7326. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  7327. args: [],
  7328. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7329. messageSends: ["new", "assert:", "==", "yourself"],
  7330. referencedClasses: ["ObjectMock"]
  7331. }),
  7332. smalltalk.ObjectTest);
  7333. smalltalk.addMethod(
  7334. smalltalk.method({
  7335. selector: "testidentityHash",
  7336. protocol: 'tests',
  7337. fn: function (){
  7338. var self=this;
  7339. var o1,o2;
  7340. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7341. return smalltalk.withContext(function($ctx1) {
  7342. var $2,$3,$1,$5,$4;
  7343. o1=_st($Object())._new();
  7344. $ctx1.sendIdx["new"]=1;
  7345. o2=_st($Object())._new();
  7346. $2=_st(o1)._identityHash();
  7347. $ctx1.sendIdx["identityHash"]=1;
  7348. $3=_st(o1)._identityHash();
  7349. $ctx1.sendIdx["identityHash"]=2;
  7350. $1=_st($2).__eq_eq($3);
  7351. $ctx1.sendIdx["=="]=1;
  7352. self._assert_($1);
  7353. $5=_st(o1)._identityHash();
  7354. $ctx1.sendIdx["identityHash"]=3;
  7355. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7356. self._deny_($4);
  7357. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  7358. args: [],
  7359. 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",
  7360. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7361. referencedClasses: ["Object"]
  7362. }),
  7363. smalltalk.ObjectTest);
  7364. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7365. smalltalk.addMethod(
  7366. smalltalk.method({
  7367. selector: "testAccessing",
  7368. protocol: 'tests',
  7369. fn: function (){
  7370. var self=this;
  7371. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7372. return smalltalk.withContext(function($ctx1) {
  7373. var $2,$1,$3,$6,$5,$4;
  7374. $2=_st($Point())._x_y_((3),(4));
  7375. $ctx1.sendIdx["x:y:"]=1;
  7376. $1=_st($2)._x();
  7377. $ctx1.sendIdx["x"]=1;
  7378. self._assert_equals_($1,(3));
  7379. $ctx1.sendIdx["assert:equals:"]=1;
  7380. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7381. $ctx1.sendIdx["y"]=1;
  7382. self._assert_equals_($3,(4));
  7383. $ctx1.sendIdx["assert:equals:"]=2;
  7384. $6=_st($Point())._new();
  7385. $ctx1.sendIdx["new"]=1;
  7386. $5=_st($6)._x_((3));
  7387. $4=_st($5)._x();
  7388. self._assert_equals_($4,(3));
  7389. $ctx1.sendIdx["assert:equals:"]=3;
  7390. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7391. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  7392. args: [],
  7393. 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",
  7394. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7395. referencedClasses: ["Point"]
  7396. }),
  7397. smalltalk.PointTest);
  7398. smalltalk.addMethod(
  7399. smalltalk.method({
  7400. selector: "testArithmetic",
  7401. protocol: 'tests',
  7402. fn: function (){
  7403. var self=this;
  7404. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7405. return smalltalk.withContext(function($ctx1) {
  7406. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7407. $2=(3).__at((4));
  7408. $ctx1.sendIdx["@"]=1;
  7409. $3=(3).__at((4));
  7410. $ctx1.sendIdx["@"]=2;
  7411. $1=_st($2).__star($3);
  7412. $4=_st($Point())._x_y_((9),(16));
  7413. $ctx1.sendIdx["x:y:"]=1;
  7414. self._assert_equals_($1,$4);
  7415. $ctx1.sendIdx["assert:equals:"]=1;
  7416. $6=(3).__at((4));
  7417. $ctx1.sendIdx["@"]=3;
  7418. $7=(3).__at((4));
  7419. $ctx1.sendIdx["@"]=4;
  7420. $5=_st($6).__plus($7);
  7421. $8=_st($Point())._x_y_((6),(8));
  7422. $ctx1.sendIdx["x:y:"]=2;
  7423. self._assert_equals_($5,$8);
  7424. $ctx1.sendIdx["assert:equals:"]=2;
  7425. $10=(3).__at((4));
  7426. $ctx1.sendIdx["@"]=5;
  7427. $11=(3).__at((4));
  7428. $ctx1.sendIdx["@"]=6;
  7429. $9=_st($10).__minus($11);
  7430. $12=_st($Point())._x_y_((0),(0));
  7431. $ctx1.sendIdx["x:y:"]=3;
  7432. self._assert_equals_($9,$12);
  7433. $ctx1.sendIdx["assert:equals:"]=3;
  7434. $14=(6).__at((8));
  7435. $ctx1.sendIdx["@"]=7;
  7436. $13=_st($14).__slash((3).__at((4)));
  7437. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7438. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  7439. args: [],
  7440. 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)",
  7441. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7442. referencedClasses: ["Point"]
  7443. }),
  7444. smalltalk.PointTest);
  7445. smalltalk.addMethod(
  7446. smalltalk.method({
  7447. selector: "testAt",
  7448. protocol: 'tests',
  7449. fn: function (){
  7450. var self=this;
  7451. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7452. return smalltalk.withContext(function($ctx1) {
  7453. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7454. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  7455. args: [],
  7456. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7457. messageSends: ["assert:equals:", "@", "x:y:"],
  7458. referencedClasses: ["Point"]
  7459. }),
  7460. smalltalk.PointTest);
  7461. smalltalk.addMethod(
  7462. smalltalk.method({
  7463. selector: "testEgality",
  7464. protocol: 'tests',
  7465. fn: function (){
  7466. var self=this;
  7467. return smalltalk.withContext(function($ctx1) {
  7468. var $2,$3,$1,$5,$4;
  7469. $2=(3).__at((4));
  7470. $ctx1.sendIdx["@"]=1;
  7471. $3=(3).__at((4));
  7472. $ctx1.sendIdx["@"]=2;
  7473. $1=_st($2).__eq($3);
  7474. $ctx1.sendIdx["="]=1;
  7475. self._assert_($1);
  7476. $5=(3).__at((5));
  7477. $ctx1.sendIdx["@"]=3;
  7478. $4=_st($5).__eq((3).__at((6)));
  7479. self._deny_($4);
  7480. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  7481. args: [],
  7482. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7483. messageSends: ["assert:", "=", "@", "deny:"],
  7484. referencedClasses: []
  7485. }),
  7486. smalltalk.PointTest);
  7487. smalltalk.addMethod(
  7488. smalltalk.method({
  7489. selector: "testNew",
  7490. protocol: 'tests',
  7491. fn: function (){
  7492. var self=this;
  7493. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7494. return smalltalk.withContext(function($ctx1) {
  7495. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7496. $3=_st($Point())._new();
  7497. $ctx1.sendIdx["new"]=1;
  7498. $2=_st($3)._x_((3));
  7499. $ctx1.sendIdx["x:"]=1;
  7500. $1=_st($2)._y();
  7501. $ctx1.sendIdx["y"]=1;
  7502. self._assert_equals_($1,nil);
  7503. $ctx1.sendIdx["assert:equals:"]=1;
  7504. $7=_st($Point())._new();
  7505. $ctx1.sendIdx["new"]=2;
  7506. $6=_st($7)._x_((3));
  7507. $5=_st($6)._x();
  7508. $ctx1.sendIdx["x"]=1;
  7509. $4=_st($5).__eq((0));
  7510. $ctx1.sendIdx["="]=1;
  7511. self._deny_($4);
  7512. $ctx1.sendIdx["deny:"]=1;
  7513. $10=_st($Point())._new();
  7514. $ctx1.sendIdx["new"]=3;
  7515. $9=_st($10)._y_((4));
  7516. $ctx1.sendIdx["y:"]=1;
  7517. $8=_st($9)._x();
  7518. self._assert_equals_($8,nil);
  7519. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7520. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  7521. args: [],
  7522. 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",
  7523. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7524. referencedClasses: ["Point"]
  7525. }),
  7526. smalltalk.PointTest);
  7527. smalltalk.addMethod(
  7528. smalltalk.method({
  7529. selector: "testTranslateBy",
  7530. protocol: 'tests',
  7531. fn: function (){
  7532. var self=this;
  7533. return smalltalk.withContext(function($ctx1) {
  7534. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7535. $2=(3).__at((3));
  7536. $ctx1.sendIdx["@"]=1;
  7537. $3=(0).__at((1));
  7538. $ctx1.sendIdx["@"]=2;
  7539. $1=_st($2)._translateBy_($3);
  7540. $ctx1.sendIdx["translateBy:"]=1;
  7541. $4=(3).__at((4));
  7542. $ctx1.sendIdx["@"]=3;
  7543. self._assert_equals_($1,$4);
  7544. $ctx1.sendIdx["assert:equals:"]=1;
  7545. $6=(3).__at((3));
  7546. $ctx1.sendIdx["@"]=4;
  7547. $8=(1)._negated();
  7548. $ctx1.sendIdx["negated"]=1;
  7549. $7=(0).__at($8);
  7550. $ctx1.sendIdx["@"]=5;
  7551. $5=_st($6)._translateBy_($7);
  7552. $ctx1.sendIdx["translateBy:"]=2;
  7553. $9=(3).__at((2));
  7554. $ctx1.sendIdx["@"]=6;
  7555. self._assert_equals_($5,$9);
  7556. $ctx1.sendIdx["assert:equals:"]=2;
  7557. $11=(3).__at((3));
  7558. $ctx1.sendIdx["@"]=7;
  7559. $12=(2).__at((3));
  7560. $ctx1.sendIdx["@"]=8;
  7561. $10=_st($11)._translateBy_($12);
  7562. $ctx1.sendIdx["translateBy:"]=3;
  7563. $13=(5).__at((6));
  7564. $ctx1.sendIdx["@"]=9;
  7565. self._assert_equals_($10,$13);
  7566. $ctx1.sendIdx["assert:equals:"]=3;
  7567. $15=(3).__at((3));
  7568. $ctx1.sendIdx["@"]=10;
  7569. $16=_st((3)._negated()).__at((0));
  7570. $ctx1.sendIdx["@"]=11;
  7571. $14=_st($15)._translateBy_($16);
  7572. self._assert_equals_($14,(0).__at((3)));
  7573. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  7574. args: [],
  7575. 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.",
  7576. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7577. referencedClasses: []
  7578. }),
  7579. smalltalk.PointTest);
  7580. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7581. smalltalk.addMethod(
  7582. smalltalk.method({
  7583. selector: "testNextIfAbsent",
  7584. protocol: 'tests',
  7585. fn: function (){
  7586. var self=this;
  7587. var queue;
  7588. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7589. return smalltalk.withContext(function($ctx1) {
  7590. var $2,$1;
  7591. queue=_st($Queue())._new();
  7592. _st(queue)._nextPut_("index1");
  7593. $2=_st(queue)._nextIfAbsent_("empty");
  7594. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7595. $1=_st($2).__eq("index1");
  7596. $ctx1.sendIdx["="]=1;
  7597. self._assert_($1);
  7598. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7599. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  7600. args: [],
  7601. 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'",
  7602. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7603. referencedClasses: ["Queue"]
  7604. }),
  7605. smalltalk.QueueTest);
  7606. smalltalk.addMethod(
  7607. smalltalk.method({
  7608. selector: "testQueueNext",
  7609. protocol: 'tests',
  7610. fn: function (){
  7611. var self=this;
  7612. var queue;
  7613. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7614. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7615. return smalltalk.withContext(function($ctx1) {
  7616. var $1,$2,$4,$3,$6,$5;
  7617. queue=_st($Queue())._new();
  7618. $1=queue;
  7619. _st($1)._nextPut_("index1");
  7620. $ctx1.sendIdx["nextPut:"]=1;
  7621. $2=_st($1)._nextPut_("index2");
  7622. $4=_st(queue)._next();
  7623. $ctx1.sendIdx["next"]=1;
  7624. $3=_st($4).__eq("index1");
  7625. $ctx1.sendIdx["="]=1;
  7626. self._assert_($3);
  7627. $6=_st(queue)._next();
  7628. $ctx1.sendIdx["next"]=2;
  7629. $5=_st($6).__eq("index");
  7630. self._deny_($5);
  7631. self._should_raise_((function(){
  7632. return smalltalk.withContext(function($ctx2) {
  7633. return _st(queue)._next();
  7634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7635. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  7636. args: [],
  7637. 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",
  7638. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  7639. referencedClasses: ["Queue", "Error"]
  7640. }),
  7641. smalltalk.QueueTest);
  7642. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7643. smalltalk.addMethod(
  7644. smalltalk.method({
  7645. selector: "testAtRandomNumber",
  7646. protocol: 'tests',
  7647. fn: function (){
  7648. var self=this;
  7649. var val;
  7650. return smalltalk.withContext(function($ctx1) {
  7651. (100)._timesRepeat_((function(){
  7652. return smalltalk.withContext(function($ctx2) {
  7653. val=(10)._atRandom();
  7654. val;
  7655. self._assert_(_st(val).__gt((0)));
  7656. $ctx2.sendIdx["assert:"]=1;
  7657. return self._assert_(_st(val).__lt((11)));
  7658. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7659. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  7660. args: [],
  7661. 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]",
  7662. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  7663. referencedClasses: []
  7664. }),
  7665. smalltalk.RandomTest);
  7666. smalltalk.addMethod(
  7667. smalltalk.method({
  7668. selector: "testAtRandomSequenceableCollection",
  7669. protocol: 'tests',
  7670. fn: function (){
  7671. var self=this;
  7672. var val;
  7673. return smalltalk.withContext(function($ctx1) {
  7674. var $3,$4,$2,$1;
  7675. (100)._timesRepeat_((function(){
  7676. return smalltalk.withContext(function($ctx2) {
  7677. val="abc"._atRandom();
  7678. val;
  7679. $3=_st(val).__eq("a");
  7680. $ctx2.sendIdx["="]=1;
  7681. $4=_st(val).__eq("b");
  7682. $ctx2.sendIdx["="]=2;
  7683. $2=_st($3).__or($4);
  7684. $1=_st($2).__or(_st(val).__eq("c"));
  7685. $ctx2.sendIdx["|"]=1;
  7686. return self._assert_($1);
  7687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7688. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  7689. args: [],
  7690. 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].",
  7691. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  7692. referencedClasses: []
  7693. }),
  7694. smalltalk.RandomTest);
  7695. smalltalk.addMethod(
  7696. smalltalk.method({
  7697. selector: "textNext",
  7698. protocol: 'tests',
  7699. fn: function (){
  7700. var self=this;
  7701. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  7702. return smalltalk.withContext(function($ctx1) {
  7703. var $1;
  7704. (10000)._timesRepeat_((function(){
  7705. var current,next;
  7706. return smalltalk.withContext(function($ctx2) {
  7707. next=_st(_st($Random())._new())._next();
  7708. next;
  7709. self._assert_(_st(next).__gt_eq((0)));
  7710. $ctx2.sendIdx["assert:"]=1;
  7711. self._assert_(_st(next).__lt((1)));
  7712. $1=_st(current).__eq(next);
  7713. $ctx2.sendIdx["="]=1;
  7714. self._deny_($1);
  7715. return _st(next).__eq(current);
  7716. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  7717. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  7718. args: [],
  7719. 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 ]",
  7720. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  7721. referencedClasses: ["Random"]
  7722. }),
  7723. smalltalk.RandomTest);
  7724. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7725. smalltalk.addMethod(
  7726. smalltalk.method({
  7727. selector: "collectionClass",
  7728. protocol: 'accessing',
  7729. fn: function (){
  7730. var self=this;
  7731. return smalltalk.withContext(function($ctx1) {
  7732. var $1;
  7733. $1=_st(self._class())._collectionClass();
  7734. return $1;
  7735. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  7736. args: [],
  7737. source: "collectionClass\x0a\x09^ self class collectionClass",
  7738. messageSends: ["collectionClass", "class"],
  7739. referencedClasses: []
  7740. }),
  7741. smalltalk.StreamTest);
  7742. smalltalk.addMethod(
  7743. smalltalk.method({
  7744. selector: "newCollection",
  7745. protocol: 'accessing',
  7746. fn: function (){
  7747. var self=this;
  7748. return smalltalk.withContext(function($ctx1) {
  7749. var $1;
  7750. $1=_st(self._collectionClass())._new();
  7751. return $1;
  7752. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  7753. args: [],
  7754. source: "newCollection\x0a\x09^ self collectionClass new",
  7755. messageSends: ["new", "collectionClass"],
  7756. referencedClasses: []
  7757. }),
  7758. smalltalk.StreamTest);
  7759. smalltalk.addMethod(
  7760. smalltalk.method({
  7761. selector: "newStream",
  7762. protocol: 'accessing',
  7763. fn: function (){
  7764. var self=this;
  7765. return smalltalk.withContext(function($ctx1) {
  7766. var $1;
  7767. $1=_st(_st(self._collectionClass())._new())._stream();
  7768. return $1;
  7769. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  7770. args: [],
  7771. source: "newStream\x0a\x09^ self collectionClass new stream",
  7772. messageSends: ["stream", "new", "collectionClass"],
  7773. referencedClasses: []
  7774. }),
  7775. smalltalk.StreamTest);
  7776. smalltalk.addMethod(
  7777. smalltalk.method({
  7778. selector: "testAtStartAtEnd",
  7779. protocol: 'tests',
  7780. fn: function (){
  7781. var self=this;
  7782. var stream;
  7783. return smalltalk.withContext(function($ctx1) {
  7784. var $1,$2,$3,$4;
  7785. stream=self._newStream();
  7786. $1=_st(stream)._atStart();
  7787. $ctx1.sendIdx["atStart"]=1;
  7788. self._assert_($1);
  7789. $ctx1.sendIdx["assert:"]=1;
  7790. $2=_st(stream)._atEnd();
  7791. $ctx1.sendIdx["atEnd"]=1;
  7792. self._assert_($2);
  7793. $ctx1.sendIdx["assert:"]=2;
  7794. _st(stream)._nextPutAll_(self._newCollection());
  7795. $3=_st(stream)._atEnd();
  7796. $ctx1.sendIdx["atEnd"]=2;
  7797. self._assert_($3);
  7798. $4=_st(stream)._atStart();
  7799. $ctx1.sendIdx["atStart"]=2;
  7800. self._deny_($4);
  7801. $ctx1.sendIdx["deny:"]=1;
  7802. _st(stream)._position_((1));
  7803. self._deny_(_st(stream)._atEnd());
  7804. $ctx1.sendIdx["deny:"]=2;
  7805. self._deny_(_st(stream)._atStart());
  7806. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  7807. args: [],
  7808. 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",
  7809. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  7810. referencedClasses: []
  7811. }),
  7812. smalltalk.StreamTest);
  7813. smalltalk.addMethod(
  7814. smalltalk.method({
  7815. selector: "testContents",
  7816. protocol: 'tests',
  7817. fn: function (){
  7818. var self=this;
  7819. var stream;
  7820. return smalltalk.withContext(function($ctx1) {
  7821. var $1,$2;
  7822. stream=self._newStream();
  7823. $1=stream;
  7824. $2=self._newCollection();
  7825. $ctx1.sendIdx["newCollection"]=1;
  7826. _st($1)._nextPutAll_($2);
  7827. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  7828. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  7829. args: [],
  7830. 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",
  7831. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  7832. referencedClasses: []
  7833. }),
  7834. smalltalk.StreamTest);
  7835. smalltalk.addMethod(
  7836. smalltalk.method({
  7837. selector: "testIsEmpty",
  7838. protocol: 'tests',
  7839. fn: function (){
  7840. var self=this;
  7841. var stream;
  7842. return smalltalk.withContext(function($ctx1) {
  7843. var $1;
  7844. stream=self._newStream();
  7845. $1=_st(stream)._isEmpty();
  7846. $ctx1.sendIdx["isEmpty"]=1;
  7847. self._assert_($1);
  7848. _st(stream)._nextPutAll_(self._newCollection());
  7849. self._deny_(_st(stream)._isEmpty());
  7850. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  7851. args: [],
  7852. 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",
  7853. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  7854. referencedClasses: []
  7855. }),
  7856. smalltalk.StreamTest);
  7857. smalltalk.addMethod(
  7858. smalltalk.method({
  7859. selector: "testPosition",
  7860. protocol: 'tests',
  7861. fn: function (){
  7862. var self=this;
  7863. var collection,stream;
  7864. return smalltalk.withContext(function($ctx1) {
  7865. var $1,$2,$3;
  7866. collection=self._newCollection();
  7867. stream=self._newStream();
  7868. _st(stream)._nextPutAll_(collection);
  7869. $1=_st(stream)._position();
  7870. $ctx1.sendIdx["position"]=1;
  7871. self._assert_equals_($1,_st(collection)._size());
  7872. $ctx1.sendIdx["assert:equals:"]=1;
  7873. _st(stream)._position_((0));
  7874. $2=_st(stream)._position();
  7875. $ctx1.sendIdx["position"]=2;
  7876. self._assert_equals_($2,(0));
  7877. $ctx1.sendIdx["assert:equals:"]=2;
  7878. _st(stream)._next();
  7879. $ctx1.sendIdx["next"]=1;
  7880. $3=_st(stream)._position();
  7881. $ctx1.sendIdx["position"]=3;
  7882. self._assert_equals_($3,(1));
  7883. $ctx1.sendIdx["assert:equals:"]=3;
  7884. _st(stream)._next();
  7885. self._assert_equals_(_st(stream)._position(),(2));
  7886. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  7887. args: [],
  7888. 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",
  7889. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  7890. referencedClasses: []
  7891. }),
  7892. smalltalk.StreamTest);
  7893. smalltalk.addMethod(
  7894. smalltalk.method({
  7895. selector: "testReading",
  7896. protocol: 'tests',
  7897. fn: function (){
  7898. var self=this;
  7899. var stream,collection;
  7900. return smalltalk.withContext(function($ctx1) {
  7901. var $1,$2,$3;
  7902. collection=self._newCollection();
  7903. stream=self._newStream();
  7904. $1=stream;
  7905. _st($1)._nextPutAll_(collection);
  7906. $2=_st($1)._position_((0));
  7907. _st(collection)._do_((function(each){
  7908. return smalltalk.withContext(function($ctx2) {
  7909. $3=_st(stream)._next();
  7910. $ctx2.sendIdx["next"]=1;
  7911. return self._assert_equals_($3,each);
  7912. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7913. self._assert_(_st(_st(stream)._next())._isNil());
  7914. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7915. args: [],
  7916. 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",
  7917. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  7918. referencedClasses: []
  7919. }),
  7920. smalltalk.StreamTest);
  7921. smalltalk.addMethod(
  7922. smalltalk.method({
  7923. selector: "testStreamContents",
  7924. protocol: 'tests',
  7925. fn: function (){
  7926. var self=this;
  7927. return smalltalk.withContext(function($ctx1) {
  7928. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  7929. args: [],
  7930. source: "testStreamContents",
  7931. messageSends: [],
  7932. referencedClasses: []
  7933. }),
  7934. smalltalk.StreamTest);
  7935. smalltalk.addMethod(
  7936. smalltalk.method({
  7937. selector: "testWrite",
  7938. protocol: 'tests',
  7939. fn: function (){
  7940. var self=this;
  7941. var stream,collection;
  7942. return smalltalk.withContext(function($ctx1) {
  7943. collection=self._newCollection();
  7944. stream=self._newStream();
  7945. _st(collection)._do_((function(each){
  7946. return smalltalk.withContext(function($ctx2) {
  7947. return _st(stream).__lt_lt(each);
  7948. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7949. self._assert_equals_(_st(stream)._contents(),collection);
  7950. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7951. args: [],
  7952. 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",
  7953. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  7954. referencedClasses: []
  7955. }),
  7956. smalltalk.StreamTest);
  7957. smalltalk.addMethod(
  7958. smalltalk.method({
  7959. selector: "testWriting",
  7960. protocol: 'tests',
  7961. fn: function (){
  7962. var self=this;
  7963. var stream,collection;
  7964. return smalltalk.withContext(function($ctx1) {
  7965. var $1;
  7966. collection=self._newCollection();
  7967. stream=self._newStream();
  7968. $ctx1.sendIdx["newStream"]=1;
  7969. _st(collection)._do_((function(each){
  7970. return smalltalk.withContext(function($ctx2) {
  7971. return _st(stream)._nextPut_(each);
  7972. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7973. $1=_st(stream)._contents();
  7974. $ctx1.sendIdx["contents"]=1;
  7975. self._assert_equals_($1,collection);
  7976. $ctx1.sendIdx["assert:equals:"]=1;
  7977. stream=self._newStream();
  7978. _st(stream)._nextPutAll_(collection);
  7979. self._assert_equals_(_st(stream)._contents(),collection);
  7980. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7981. args: [],
  7982. 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",
  7983. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  7984. referencedClasses: []
  7985. }),
  7986. smalltalk.StreamTest);
  7987. smalltalk.addMethod(
  7988. smalltalk.method({
  7989. selector: "collectionClass",
  7990. protocol: 'accessing',
  7991. fn: function (){
  7992. var self=this;
  7993. return smalltalk.withContext(function($ctx1) {
  7994. return nil;
  7995. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  7996. args: [],
  7997. source: "collectionClass\x0a\x09^ nil",
  7998. messageSends: [],
  7999. referencedClasses: []
  8000. }),
  8001. smalltalk.StreamTest.klass);
  8002. smalltalk.addMethod(
  8003. smalltalk.method({
  8004. selector: "isAbstract",
  8005. protocol: 'testing',
  8006. fn: function (){
  8007. var self=this;
  8008. return smalltalk.withContext(function($ctx1) {
  8009. var $1;
  8010. $1=_st(self._collectionClass())._isNil();
  8011. return $1;
  8012. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  8013. args: [],
  8014. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8015. messageSends: ["isNil", "collectionClass"],
  8016. referencedClasses: []
  8017. }),
  8018. smalltalk.StreamTest.klass);
  8019. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8020. smalltalk.addMethod(
  8021. smalltalk.method({
  8022. selector: "newCollection",
  8023. protocol: 'accessing',
  8024. fn: function (){
  8025. var self=this;
  8026. return smalltalk.withContext(function($ctx1) {
  8027. var $1;
  8028. $1=[true,(1),(3).__at((4)),"foo"];
  8029. return $1;
  8030. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  8031. args: [],
  8032. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8033. messageSends: ["@"],
  8034. referencedClasses: []
  8035. }),
  8036. smalltalk.ArrayStreamTest);
  8037. smalltalk.addMethod(
  8038. smalltalk.method({
  8039. selector: "collectionClass",
  8040. protocol: 'accessing',
  8041. fn: function (){
  8042. var self=this;
  8043. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  8044. return smalltalk.withContext(function($ctx1) {
  8045. return $Array();
  8046. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  8047. args: [],
  8048. source: "collectionClass\x0a\x09^ Array",
  8049. messageSends: [],
  8050. referencedClasses: ["Array"]
  8051. }),
  8052. smalltalk.ArrayStreamTest.klass);
  8053. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8054. smalltalk.addMethod(
  8055. smalltalk.method({
  8056. selector: "newCollection",
  8057. protocol: 'accessing',
  8058. fn: function (){
  8059. var self=this;
  8060. return smalltalk.withContext(function($ctx1) {
  8061. return "hello world";
  8062. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  8063. args: [],
  8064. source: "newCollection\x0a\x09^ 'hello world'",
  8065. messageSends: [],
  8066. referencedClasses: []
  8067. }),
  8068. smalltalk.StringStreamTest);
  8069. smalltalk.addMethod(
  8070. smalltalk.method({
  8071. selector: "collectionClass",
  8072. protocol: 'accessing',
  8073. fn: function (){
  8074. var self=this;
  8075. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  8076. return smalltalk.withContext(function($ctx1) {
  8077. return $String();
  8078. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  8079. args: [],
  8080. source: "collectionClass\x0a\x09^ String",
  8081. messageSends: [],
  8082. referencedClasses: ["String"]
  8083. }),
  8084. smalltalk.StringStreamTest.klass);
  8085. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8086. smalltalk.addMethod(
  8087. smalltalk.method({
  8088. selector: "testCopying",
  8089. protocol: 'tests',
  8090. fn: function (){
  8091. var self=this;
  8092. return smalltalk.withContext(function($ctx1) {
  8093. self._assert_equals_(nil._copy(),nil);
  8094. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  8095. args: [],
  8096. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8097. messageSends: ["assert:equals:", "copy"],
  8098. referencedClasses: []
  8099. }),
  8100. smalltalk.UndefinedTest);
  8101. smalltalk.addMethod(
  8102. smalltalk.method({
  8103. selector: "testDeepCopy",
  8104. protocol: 'tests',
  8105. fn: function (){
  8106. var self=this;
  8107. return smalltalk.withContext(function($ctx1) {
  8108. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8109. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  8110. args: [],
  8111. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8112. messageSends: ["assert:", "=", "deepCopy"],
  8113. referencedClasses: []
  8114. }),
  8115. smalltalk.UndefinedTest);
  8116. smalltalk.addMethod(
  8117. smalltalk.method({
  8118. selector: "testIfNil",
  8119. protocol: 'tests',
  8120. fn: function (){
  8121. var self=this;
  8122. return smalltalk.withContext(function($ctx1) {
  8123. var $1,$3,$2,$4,$6,$5;
  8124. if(($receiver = nil) == nil || $receiver == null){
  8125. $1=true;
  8126. } else {
  8127. $1=nil;
  8128. };
  8129. self._assert_equals_($1,true);
  8130. $ctx1.sendIdx["assert:equals:"]=1;
  8131. if(($receiver = nil) == nil || $receiver == null){
  8132. $3=nil;
  8133. } else {
  8134. $3=true;
  8135. };
  8136. $2=_st($3).__eq(true);
  8137. $ctx1.sendIdx["="]=1;
  8138. self._deny_($2);
  8139. $ctx1.sendIdx["deny:"]=1;
  8140. if(($receiver = nil) == nil || $receiver == null){
  8141. $4=true;
  8142. } else {
  8143. $4=false;
  8144. };
  8145. self._assert_equals_($4,true);
  8146. if(($receiver = nil) == nil || $receiver == null){
  8147. $6=false;
  8148. } else {
  8149. $6=true;
  8150. };
  8151. $5=_st($6).__eq(true);
  8152. self._deny_($5);
  8153. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  8154. args: [],
  8155. 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",
  8156. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8157. referencedClasses: []
  8158. }),
  8159. smalltalk.UndefinedTest);
  8160. smalltalk.addMethod(
  8161. smalltalk.method({
  8162. selector: "testIsNil",
  8163. protocol: 'tests',
  8164. fn: function (){
  8165. var self=this;
  8166. return smalltalk.withContext(function($ctx1) {
  8167. self._assert_(nil._isNil());
  8168. self._deny_(nil._notNil());
  8169. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  8170. args: [],
  8171. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8172. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8173. referencedClasses: []
  8174. }),
  8175. smalltalk.UndefinedTest);
  8176. });