1
0

Kernel-Tests.js 280 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414
  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: 'accessing',
  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\x09self subclassResponsibility",
  1236. messageSends: ["subclassResponsibility"],
  1237. referencedClasses: []
  1238. }),
  1239. smalltalk.CollectionTest);
  1240. smalltalk.addMethod(
  1241. smalltalk.method({
  1242. selector: "collectionClass",
  1243. protocol: 'accessing',
  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^ self class collectionClass",
  1253. messageSends: ["collectionClass", "class"],
  1254. referencedClasses: []
  1255. }),
  1256. smalltalk.CollectionTest);
  1257. smalltalk.addMethod(
  1258. smalltalk.method({
  1259. selector: "collectionWithDuplicates",
  1260. protocol: 'accessing',
  1261. fn: function (){
  1262. var self=this;
  1263. return smalltalk.withContext(function($ctx1) {
  1264. self._subclassResponsibility();
  1265. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1266. args: [],
  1267. source: "collectionWithDuplicates\x0a\x09self subclassResponsibility",
  1268. messageSends: ["subclassResponsibility"],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.CollectionTest);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "isCollectionReadOnly",
  1275. protocol: 'testing',
  1276. fn: function (){
  1277. var self=this;
  1278. return smalltalk.withContext(function($ctx1) {
  1279. return false;
  1280. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1281. args: [],
  1282. source: "isCollectionReadOnly\x0a\x09^ false",
  1283. messageSends: [],
  1284. referencedClasses: []
  1285. }),
  1286. smalltalk.CollectionTest);
  1287. smalltalk.addMethod(
  1288. smalltalk.method({
  1289. selector: "testAllSatisfy",
  1290. protocol: 'tests',
  1291. fn: function (){
  1292. var self=this;
  1293. var collection,anyOne;
  1294. return smalltalk.withContext(function($ctx1) {
  1295. var $1;
  1296. collection=self._collection();
  1297. anyOne=_st(collection)._anyOne();
  1298. $1=_st(collection)._allSatisfy_((function(each){
  1299. return smalltalk.withContext(function($ctx2) {
  1300. return _st(collection)._includes_(each);
  1301. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1302. $ctx1.sendIdx["allSatisfy:"]=1;
  1303. self._assert_($1);
  1304. self._deny_(_st(collection)._allSatisfy_((function(each){
  1305. return smalltalk.withContext(function($ctx2) {
  1306. return _st(each).__tild_eq(anyOne);
  1307. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1308. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1309. args: [],
  1310. 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 ])",
  1311. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1312. referencedClasses: []
  1313. }),
  1314. smalltalk.CollectionTest);
  1315. smalltalk.addMethod(
  1316. smalltalk.method({
  1317. selector: "testAnyOne",
  1318. protocol: 'tests',
  1319. fn: function (){
  1320. var self=this;
  1321. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1322. return smalltalk.withContext(function($ctx1) {
  1323. var $2,$1;
  1324. self._should_raise_((function(){
  1325. return smalltalk.withContext(function($ctx2) {
  1326. return _st(_st(self._collectionClass())._new())._anyOne();
  1327. $ctx2.sendIdx["anyOne"]=1;
  1328. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1329. $2=self._collection();
  1330. $ctx1.sendIdx["collection"]=1;
  1331. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1332. self._assert_($1);
  1333. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1334. args: [],
  1335. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1336. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1337. referencedClasses: ["Error"]
  1338. }),
  1339. smalltalk.CollectionTest);
  1340. smalltalk.addMethod(
  1341. smalltalk.method({
  1342. selector: "testAnySatisfy",
  1343. protocol: 'tests',
  1344. fn: function (){
  1345. var self=this;
  1346. var anyOne;
  1347. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1348. return smalltalk.withContext(function($ctx1) {
  1349. var $1,$3,$2;
  1350. $1=self._collection();
  1351. $ctx1.sendIdx["collection"]=1;
  1352. anyOne=_st($1)._anyOne();
  1353. $3=self._collection();
  1354. $ctx1.sendIdx["collection"]=2;
  1355. $2=_st($3)._anySatisfy_((function(each){
  1356. return smalltalk.withContext(function($ctx2) {
  1357. return _st(each).__eq(anyOne);
  1358. $ctx2.sendIdx["="]=1;
  1359. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1360. $ctx1.sendIdx["anySatisfy:"]=1;
  1361. self._assert_($2);
  1362. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1363. return smalltalk.withContext(function($ctx2) {
  1364. return _st(each).__eq(_st($Object())._new());
  1365. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1366. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1367. args: [],
  1368. 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 ])",
  1369. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1370. referencedClasses: ["Object"]
  1371. }),
  1372. smalltalk.CollectionTest);
  1373. smalltalk.addMethod(
  1374. smalltalk.method({
  1375. selector: "testAsArray",
  1376. protocol: 'tests',
  1377. fn: function (){
  1378. var self=this;
  1379. return smalltalk.withContext(function($ctx1) {
  1380. var $1;
  1381. $1=self._collection();
  1382. $ctx1.sendIdx["collection"]=1;
  1383. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1384. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1385. args: [],
  1386. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1387. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1388. referencedClasses: []
  1389. }),
  1390. smalltalk.CollectionTest);
  1391. smalltalk.addMethod(
  1392. smalltalk.method({
  1393. selector: "testAsOrderedCollection",
  1394. protocol: 'tests',
  1395. fn: function (){
  1396. var self=this;
  1397. return smalltalk.withContext(function($ctx1) {
  1398. var $1;
  1399. $1=self._collection();
  1400. $ctx1.sendIdx["collection"]=1;
  1401. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1402. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1403. args: [],
  1404. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1405. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1406. referencedClasses: []
  1407. }),
  1408. smalltalk.CollectionTest);
  1409. smalltalk.addMethod(
  1410. smalltalk.method({
  1411. selector: "testAsSet",
  1412. protocol: 'tests',
  1413. fn: function (){
  1414. var self=this;
  1415. var c,set;
  1416. return smalltalk.withContext(function($ctx1) {
  1417. c=self._collectionWithDuplicates();
  1418. set=_st(c)._asSet();
  1419. self._assert_equals_(_st(set)._size(),(5));
  1420. _st(c)._do_((function(each){
  1421. return smalltalk.withContext(function($ctx2) {
  1422. return self._assert_(_st(set)._includes_(each));
  1423. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1424. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1425. args: [],
  1426. 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) ]",
  1427. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1428. referencedClasses: []
  1429. }),
  1430. smalltalk.CollectionTest);
  1431. smalltalk.addMethod(
  1432. smalltalk.method({
  1433. selector: "testCollect",
  1434. protocol: 'tests',
  1435. fn: function (){
  1436. var self=this;
  1437. var newCollection;
  1438. return smalltalk.withContext(function($ctx1) {
  1439. newCollection=[(1), (2), (3), (4)];
  1440. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  1441. return smalltalk.withContext(function($ctx2) {
  1442. return _st(each)._abs();
  1443. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1444. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1445. args: [],
  1446. source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := #(1 2 3 4).\x0a\x09self\x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each abs ])\x0a\x09\x09as: newCollection",
  1447. messageSends: ["assertSameContents:as:", "collect:", "collection", "abs"],
  1448. referencedClasses: []
  1449. }),
  1450. smalltalk.CollectionTest);
  1451. smalltalk.addMethod(
  1452. smalltalk.method({
  1453. selector: "testDetect",
  1454. protocol: 'tests',
  1455. fn: function (){
  1456. var self=this;
  1457. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1458. return smalltalk.withContext(function($ctx1) {
  1459. var $2,$1;
  1460. $2=self._collection();
  1461. $ctx1.sendIdx["collection"]=1;
  1462. $1=_st($2)._detect_((function(each){
  1463. return smalltalk.withContext(function($ctx2) {
  1464. return _st(each).__lt((0));
  1465. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1466. $ctx1.sendIdx["detect:"]=1;
  1467. self._assert_equals_($1,(-4));
  1468. self._should_raise_((function(){
  1469. return smalltalk.withContext(function($ctx2) {
  1470. return _st(self._collection())._detect_((function(each){
  1471. return smalltalk.withContext(function($ctx3) {
  1472. return _st(each).__eq((6));
  1473. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  1474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  1475. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1476. args: [],
  1477. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each < 0 ]) equals: -4.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
  1478. messageSends: ["assert:equals:", "detect:", "collection", "<", "should:raise:", "="],
  1479. referencedClasses: ["Error"]
  1480. }),
  1481. smalltalk.CollectionTest);
  1482. smalltalk.addMethod(
  1483. smalltalk.method({
  1484. selector: "testDo",
  1485. protocol: 'tests',
  1486. fn: function (){
  1487. var self=this;
  1488. var newCollection;
  1489. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1490. return smalltalk.withContext(function($ctx1) {
  1491. var $1;
  1492. newCollection=_st($OrderedCollection())._new();
  1493. $1=self._collection();
  1494. $ctx1.sendIdx["collection"]=1;
  1495. _st($1)._do_((function(each){
  1496. return smalltalk.withContext(function($ctx2) {
  1497. return _st(newCollection)._add_(each);
  1498. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1499. self._assertSameContents_as_(self._collection(),newCollection);
  1500. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1501. args: [],
  1502. 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",
  1503. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:"],
  1504. referencedClasses: ["OrderedCollection"]
  1505. }),
  1506. smalltalk.CollectionTest);
  1507. smalltalk.addMethod(
  1508. smalltalk.method({
  1509. selector: "testIfEmptyFamily",
  1510. protocol: 'tests',
  1511. fn: function (){
  1512. var self=this;
  1513. return smalltalk.withContext(function($ctx1) {
  1514. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1515. $3=self._collectionClass();
  1516. $ctx1.sendIdx["collectionClass"]=1;
  1517. $2=_st($3)._new();
  1518. $ctx1.sendIdx["new"]=1;
  1519. $1=_st($2)._ifEmpty_((function(){
  1520. return smalltalk.withContext(function($ctx2) {
  1521. return (42);
  1522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1523. $ctx1.sendIdx["ifEmpty:"]=1;
  1524. self._assert_equals_($1,(42));
  1525. $ctx1.sendIdx["assert:equals:"]=1;
  1526. $5=self._collection();
  1527. $ctx1.sendIdx["collection"]=1;
  1528. $4=_st($5)._ifEmpty_((function(){
  1529. return smalltalk.withContext(function($ctx2) {
  1530. return (42);
  1531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1532. $6=self._collection();
  1533. $ctx1.sendIdx["collection"]=2;
  1534. self._assert_equals_($4,$6);
  1535. $ctx1.sendIdx["assert:equals:"]=2;
  1536. $9=self._collectionClass();
  1537. $ctx1.sendIdx["collectionClass"]=2;
  1538. $8=_st($9)._new();
  1539. $ctx1.sendIdx["new"]=2;
  1540. $7=_st($8)._ifNotEmpty_((function(){
  1541. return smalltalk.withContext(function($ctx2) {
  1542. return (42);
  1543. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1544. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1545. $11=self._collectionClass();
  1546. $ctx1.sendIdx["collectionClass"]=3;
  1547. $10=_st($11)._new();
  1548. $ctx1.sendIdx["new"]=3;
  1549. self._assert_equals_($7,$10);
  1550. $ctx1.sendIdx["assert:equals:"]=3;
  1551. $13=self._collection();
  1552. $ctx1.sendIdx["collection"]=3;
  1553. $12=_st($13)._ifNotEmpty_((function(){
  1554. return smalltalk.withContext(function($ctx2) {
  1555. return (42);
  1556. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1557. self._assert_equals_($12,(42));
  1558. $ctx1.sendIdx["assert:equals:"]=4;
  1559. $16=self._collectionClass();
  1560. $ctx1.sendIdx["collectionClass"]=4;
  1561. $15=_st($16)._new();
  1562. $ctx1.sendIdx["new"]=4;
  1563. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1564. return smalltalk.withContext(function($ctx2) {
  1565. return (42);
  1566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1567. return smalltalk.withContext(function($ctx2) {
  1568. return (999);
  1569. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1570. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1571. self._assert_equals_($14,(42));
  1572. $ctx1.sendIdx["assert:equals:"]=5;
  1573. $18=self._collection();
  1574. $ctx1.sendIdx["collection"]=4;
  1575. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1576. return smalltalk.withContext(function($ctx2) {
  1577. return (42);
  1578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1579. return smalltalk.withContext(function($ctx2) {
  1580. return (999);
  1581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1582. self._assert_equals_($17,(999));
  1583. $ctx1.sendIdx["assert:equals:"]=6;
  1584. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1585. return smalltalk.withContext(function($ctx2) {
  1586. return (42);
  1587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1588. return smalltalk.withContext(function($ctx2) {
  1589. return (999);
  1590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1591. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1592. self._assert_equals_($19,(999));
  1593. $ctx1.sendIdx["assert:equals:"]=7;
  1594. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1595. return smalltalk.withContext(function($ctx2) {
  1596. return (42);
  1597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1598. return smalltalk.withContext(function($ctx2) {
  1599. return (999);
  1600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1601. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1602. args: [],
  1603. 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",
  1604. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1605. referencedClasses: []
  1606. }),
  1607. smalltalk.CollectionTest);
  1608. smalltalk.addMethod(
  1609. smalltalk.method({
  1610. selector: "testIsEmpty",
  1611. protocol: 'tests',
  1612. fn: function (){
  1613. var self=this;
  1614. return smalltalk.withContext(function($ctx1) {
  1615. var $1;
  1616. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1617. $ctx1.sendIdx["isEmpty"]=1;
  1618. self._assert_($1);
  1619. self._deny_(_st(self._collection())._isEmpty());
  1620. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1621. args: [],
  1622. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1623. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1624. referencedClasses: []
  1625. }),
  1626. smalltalk.CollectionTest);
  1627. smalltalk.addMethod(
  1628. smalltalk.method({
  1629. selector: "testNoneSatisfy",
  1630. protocol: 'tests',
  1631. fn: function (){
  1632. var self=this;
  1633. var anyOne;
  1634. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1635. return smalltalk.withContext(function($ctx1) {
  1636. var $1,$3,$2;
  1637. $1=self._collection();
  1638. $ctx1.sendIdx["collection"]=1;
  1639. anyOne=_st($1)._anyOne();
  1640. $3=self._collection();
  1641. $ctx1.sendIdx["collection"]=2;
  1642. $2=_st($3)._noneSatisfy_((function(each){
  1643. return smalltalk.withContext(function($ctx2) {
  1644. return _st(each).__eq(anyOne);
  1645. $ctx2.sendIdx["="]=1;
  1646. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1647. $ctx1.sendIdx["noneSatisfy:"]=1;
  1648. self._deny_($2);
  1649. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  1650. return smalltalk.withContext(function($ctx2) {
  1651. return _st(each).__eq(_st($Object())._new());
  1652. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1653. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1654. args: [],
  1655. 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 ])",
  1656. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  1657. referencedClasses: ["Object"]
  1658. }),
  1659. smalltalk.CollectionTest);
  1660. smalltalk.addMethod(
  1661. smalltalk.method({
  1662. selector: "testRemoveAll",
  1663. protocol: 'tests',
  1664. fn: function (){
  1665. var self=this;
  1666. return smalltalk.withContext(function($ctx1) {
  1667. var $1,$2;
  1668. $1=self._collection();
  1669. _st($1)._removeAll();
  1670. $2=_st($1)._yourself();
  1671. self._assert_equals_($2,_st(self._collectionClass())._new());
  1672. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  1673. args: [],
  1674. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  1675. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  1676. referencedClasses: []
  1677. }),
  1678. smalltalk.CollectionTest);
  1679. smalltalk.addMethod(
  1680. smalltalk.method({
  1681. selector: "testSelect",
  1682. protocol: 'tests',
  1683. fn: function (){
  1684. var self=this;
  1685. var newCollection;
  1686. return smalltalk.withContext(function($ctx1) {
  1687. newCollection=[(2), (-4)];
  1688. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  1689. return smalltalk.withContext(function($ctx2) {
  1690. return _st(each)._even();
  1691. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1692. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1693. args: [],
  1694. source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := #(2 -4).\x0a\x09self\x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each even ])\x0a\x09\x09as: newCollection",
  1695. messageSends: ["assertSameContents:as:", "select:", "collection", "even"],
  1696. referencedClasses: []
  1697. }),
  1698. smalltalk.CollectionTest);
  1699. smalltalk.addMethod(
  1700. smalltalk.method({
  1701. selector: "testSize",
  1702. protocol: 'tests',
  1703. fn: function (){
  1704. var self=this;
  1705. return smalltalk.withContext(function($ctx1) {
  1706. var $1;
  1707. $1=_st(_st(self._collectionClass())._new())._size();
  1708. $ctx1.sendIdx["size"]=1;
  1709. self._assert_equals_($1,(0));
  1710. $ctx1.sendIdx["assert:equals:"]=1;
  1711. self._assert_equals_(_st(self._collection())._size(),(4));
  1712. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  1713. args: [],
  1714. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self collection size equals: 4",
  1715. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"],
  1716. referencedClasses: []
  1717. }),
  1718. smalltalk.CollectionTest);
  1719. smalltalk.addMethod(
  1720. smalltalk.method({
  1721. selector: "collectionClass",
  1722. protocol: 'accessing',
  1723. fn: function (){
  1724. var self=this;
  1725. return smalltalk.withContext(function($ctx1) {
  1726. return nil;
  1727. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  1728. args: [],
  1729. source: "collectionClass\x0a\x09^ nil",
  1730. messageSends: [],
  1731. referencedClasses: []
  1732. }),
  1733. smalltalk.CollectionTest.klass);
  1734. smalltalk.addMethod(
  1735. smalltalk.method({
  1736. selector: "isAbstract",
  1737. protocol: 'testing',
  1738. fn: function (){
  1739. var self=this;
  1740. return smalltalk.withContext(function($ctx1) {
  1741. var $1;
  1742. $1=_st(self._collectionClass())._isNil();
  1743. return $1;
  1744. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  1745. args: [],
  1746. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1747. messageSends: ["isNil", "collectionClass"],
  1748. referencedClasses: []
  1749. }),
  1750. smalltalk.CollectionTest.klass);
  1751. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1752. smalltalk.addMethod(
  1753. smalltalk.method({
  1754. selector: "testAt",
  1755. protocol: 'tests',
  1756. fn: function (){
  1757. var self=this;
  1758. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1759. return smalltalk.withContext(function($ctx1) {
  1760. var $2,$1;
  1761. $2=self._collection();
  1762. $ctx1.sendIdx["collection"]=1;
  1763. $1=_st($2)._at_((4));
  1764. $ctx1.sendIdx["at:"]=1;
  1765. self._assert_equals_($1,(-4));
  1766. self._should_raise_((function(){
  1767. return smalltalk.withContext(function($ctx2) {
  1768. return _st(self._collection())._at_((5));
  1769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1770. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  1771. args: [],
  1772. source: "testAt\x0a\x09self assert: (self collection at: 4) equals: -4.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1773. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1774. referencedClasses: ["Error"]
  1775. }),
  1776. smalltalk.IndexableCollectionTest);
  1777. smalltalk.addMethod(
  1778. smalltalk.method({
  1779. selector: "testAtIfAbsent",
  1780. protocol: 'tests',
  1781. fn: function (){
  1782. var self=this;
  1783. return smalltalk.withContext(function($ctx1) {
  1784. var $2,$1;
  1785. $2=self._collection();
  1786. $ctx1.sendIdx["collection"]=1;
  1787. $1=_st($2)._at_ifAbsent_(_st(_st(self._collection())._size()).__plus((1)),(function(){
  1788. return smalltalk.withContext(function($ctx2) {
  1789. return "none";
  1790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1791. self._assert_equals_($1,"none");
  1792. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  1793. args: [],
  1794. source: "testAtIfAbsent\x0a\x09self assert: (self collection at: (self collection size + 1) ifAbsent: [ 'none' ]) equals: 'none'",
  1795. messageSends: ["assert:equals:", "at:ifAbsent:", "collection", "+", "size"],
  1796. referencedClasses: []
  1797. }),
  1798. smalltalk.IndexableCollectionTest);
  1799. smalltalk.addMethod(
  1800. smalltalk.method({
  1801. selector: "testIndexOf",
  1802. protocol: 'tests',
  1803. fn: function (){
  1804. var self=this;
  1805. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1806. return smalltalk.withContext(function($ctx1) {
  1807. var $2,$1,$3;
  1808. $2=self._collection();
  1809. $ctx1.sendIdx["collection"]=1;
  1810. $1=_st($2)._indexOf_((2));
  1811. $ctx1.sendIdx["indexOf:"]=1;
  1812. self._assert_equals_($1,(2));
  1813. $ctx1.sendIdx["assert:equals:"]=1;
  1814. self._should_raise_((function(){
  1815. return smalltalk.withContext(function($ctx2) {
  1816. $3=self._collection();
  1817. $ctx2.sendIdx["collection"]=2;
  1818. return _st($3)._indexOf_((999));
  1819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1820. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1821. return smalltalk.withContext(function($ctx2) {
  1822. return "sentinel";
  1823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  1824. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  1825. args: [],
  1826. source: "testIndexOf\x0a\x09self assert: (self collection indexOf: 2) equals: 2.\x0a\x09self should: [ self collection indexOf: 999 ] raise: Error.\x0a\x09self assert: (self collection indexOf: 999 ifAbsent: [ 'sentinel' ]) equals: 'sentinel'",
  1827. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1828. referencedClasses: ["Error"]
  1829. }),
  1830. smalltalk.IndexableCollectionTest);
  1831. smalltalk.addMethod(
  1832. smalltalk.method({
  1833. selector: "testWithIndexDo",
  1834. protocol: 'tests',
  1835. fn: function (){
  1836. var self=this;
  1837. var collection;
  1838. return smalltalk.withContext(function($ctx1) {
  1839. collection=self._collection();
  1840. $ctx1.sendIdx["collection"]=1;
  1841. _st(self._collection())._withIndexDo_((function(each,index){
  1842. return smalltalk.withContext(function($ctx2) {
  1843. return self._assert_equals_(_st(collection)._at_(index),each);
  1844. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  1845. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1846. args: [],
  1847. 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 ]",
  1848. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  1849. referencedClasses: []
  1850. }),
  1851. smalltalk.IndexableCollectionTest);
  1852. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1853. smalltalk.addMethod(
  1854. smalltalk.method({
  1855. selector: "collection",
  1856. protocol: 'accessing',
  1857. fn: function (){
  1858. var self=this;
  1859. return smalltalk.withContext(function($ctx1) {
  1860. var $2,$3,$4,$1;
  1861. $2="b".__minus_gt((1));
  1862. $ctx1.sendIdx["->"]=1;
  1863. $3="a".__minus_gt((2));
  1864. $ctx1.sendIdx["->"]=2;
  1865. $4="c".__minus_gt((3));
  1866. $ctx1.sendIdx["->"]=3;
  1867. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  1868. return $1;
  1869. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  1870. args: [],
  1871. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  1872. messageSends: ["->"],
  1873. referencedClasses: []
  1874. }),
  1875. smalltalk.HashedCollectionTest);
  1876. smalltalk.addMethod(
  1877. smalltalk.method({
  1878. selector: "collectionWithDuplicates",
  1879. protocol: 'accessing',
  1880. fn: function (){
  1881. var self=this;
  1882. return smalltalk.withContext(function($ctx1) {
  1883. var $2,$3,$4,$5,$6,$7,$1;
  1884. $2="b".__minus_gt((1));
  1885. $ctx1.sendIdx["->"]=1;
  1886. $3="a".__minus_gt((2));
  1887. $ctx1.sendIdx["->"]=2;
  1888. $4="c".__minus_gt((3));
  1889. $ctx1.sendIdx["->"]=3;
  1890. $5="d".__minus_gt((-4));
  1891. $ctx1.sendIdx["->"]=4;
  1892. $6="e".__minus_gt((1));
  1893. $ctx1.sendIdx["->"]=5;
  1894. $7="f".__minus_gt((2));
  1895. $ctx1.sendIdx["->"]=6;
  1896. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  1897. return $1;
  1898. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  1899. args: [],
  1900. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  1901. messageSends: ["->"],
  1902. referencedClasses: []
  1903. }),
  1904. smalltalk.HashedCollectionTest);
  1905. smalltalk.addMethod(
  1906. smalltalk.method({
  1907. selector: "testAsDictionary",
  1908. protocol: 'tests',
  1909. fn: function (){
  1910. var self=this;
  1911. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1912. return smalltalk.withContext(function($ctx1) {
  1913. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  1914. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  1915. args: [],
  1916. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  1917. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  1918. referencedClasses: ["Dictionary"]
  1919. }),
  1920. smalltalk.HashedCollectionTest);
  1921. smalltalk.addMethod(
  1922. smalltalk.method({
  1923. selector: "testAt",
  1924. protocol: 'tests',
  1925. fn: function (){
  1926. var self=this;
  1927. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1928. return smalltalk.withContext(function($ctx1) {
  1929. var $2,$1;
  1930. $2=self._collection();
  1931. $ctx1.sendIdx["collection"]=1;
  1932. $1=_st($2)._at_("a");
  1933. $ctx1.sendIdx["at:"]=1;
  1934. self._assert_equals_($1,(2));
  1935. self._should_raise_((function(){
  1936. return smalltalk.withContext(function($ctx2) {
  1937. return _st(self._collection())._at_((5));
  1938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1939. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.HashedCollectionTest)})},
  1940. args: [],
  1941. source: "testAt\x0a\x09self assert: (self collection at: 'a') equals: 2.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1942. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1943. referencedClasses: ["Error"]
  1944. }),
  1945. smalltalk.HashedCollectionTest);
  1946. smalltalk.addMethod(
  1947. smalltalk.method({
  1948. selector: "testFrom",
  1949. protocol: 'tests',
  1950. fn: function (){
  1951. var self=this;
  1952. var associations;
  1953. return smalltalk.withContext(function($ctx1) {
  1954. var $1,$2,$3,$5,$4;
  1955. $1="a".__minus_gt((1));
  1956. $ctx1.sendIdx["->"]=1;
  1957. $2="b".__minus_gt((2));
  1958. $ctx1.sendIdx["->"]=2;
  1959. associations=[$1,$2];
  1960. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  1961. $5="a".__minus_gt((1));
  1962. $ctx1.sendIdx["->"]=3;
  1963. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  1964. self._assertSameContents_as_($3,$4);
  1965. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  1966. args: [],
  1967. 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 }.",
  1968. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  1969. referencedClasses: []
  1970. }),
  1971. smalltalk.HashedCollectionTest);
  1972. smalltalk.addMethod(
  1973. smalltalk.method({
  1974. selector: "testIndexOf",
  1975. protocol: 'tests',
  1976. fn: function (){
  1977. var self=this;
  1978. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1979. return smalltalk.withContext(function($ctx1) {
  1980. var $2,$1,$3;
  1981. $2=self._collection();
  1982. $ctx1.sendIdx["collection"]=1;
  1983. $1=_st($2)._indexOf_((2));
  1984. $ctx1.sendIdx["indexOf:"]=1;
  1985. self._assert_equals_($1,"a");
  1986. $ctx1.sendIdx["assert:equals:"]=1;
  1987. self._should_raise_((function(){
  1988. return smalltalk.withContext(function($ctx2) {
  1989. $3=self._collection();
  1990. $ctx2.sendIdx["collection"]=2;
  1991. return _st($3)._indexOf_((999));
  1992. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1993. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1994. return smalltalk.withContext(function($ctx2) {
  1995. return "sentinel";
  1996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  1997. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.HashedCollectionTest)})},
  1998. args: [],
  1999. source: "testIndexOf\x0a\x09self assert: (self collection indexOf: 2) equals: 'a'.\x0a\x09self should: [ self collection indexOf: 999 ] raise: Error.\x0a\x09self assert: (self collection indexOf: 999 ifAbsent: [ 'sentinel' ]) equals: 'sentinel'",
  2000. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  2001. referencedClasses: ["Error"]
  2002. }),
  2003. smalltalk.HashedCollectionTest);
  2004. smalltalk.addMethod(
  2005. smalltalk.method({
  2006. selector: "testNewFromPairs",
  2007. protocol: 'tests',
  2008. fn: function (){
  2009. var self=this;
  2010. var flattenedAssociations;
  2011. return smalltalk.withContext(function($ctx1) {
  2012. var $1,$3,$2;
  2013. flattenedAssociations=["a",(1),"b",(2)];
  2014. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2015. $3="a".__minus_gt((1));
  2016. $ctx1.sendIdx["->"]=1;
  2017. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2018. self._assertSameContents_as_($1,$2);
  2019. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  2020. args: [],
  2021. 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 }.",
  2022. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2023. referencedClasses: []
  2024. }),
  2025. smalltalk.HashedCollectionTest);
  2026. smalltalk.addMethod(
  2027. smalltalk.method({
  2028. selector: "collectionClass",
  2029. protocol: 'accessing',
  2030. fn: function (){
  2031. var self=this;
  2032. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2033. return smalltalk.withContext(function($ctx1) {
  2034. return $HashedCollection();
  2035. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  2036. args: [],
  2037. source: "collectionClass\x0a\x09^ HashedCollection",
  2038. messageSends: [],
  2039. referencedClasses: ["HashedCollection"]
  2040. }),
  2041. smalltalk.HashedCollectionTest.klass);
  2042. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  2043. smalltalk.addMethod(
  2044. smalltalk.method({
  2045. selector: "collection",
  2046. protocol: 'accessing',
  2047. fn: function (){
  2048. var self=this;
  2049. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2050. return smalltalk.withContext(function($ctx1) {
  2051. var $2,$3,$1;
  2052. $2=_st($Dictionary())._new();
  2053. _st($2)._at_put_((1),(1));
  2054. $ctx1.sendIdx["at:put:"]=1;
  2055. _st($2)._at_put_("a",(2));
  2056. $ctx1.sendIdx["at:put:"]=2;
  2057. _st($2)._at_put_(true,(3));
  2058. $ctx1.sendIdx["at:put:"]=3;
  2059. _st($2)._at_put_((4),(-4));
  2060. $3=_st($2)._yourself();
  2061. $1=$3;
  2062. return $1;
  2063. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  2064. args: [],
  2065. 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: 4 put: -4;\x0a\x09\x09yourself",
  2066. messageSends: ["at:put:", "new", "yourself"],
  2067. referencedClasses: ["Dictionary"]
  2068. }),
  2069. smalltalk.DictionaryTest);
  2070. smalltalk.addMethod(
  2071. smalltalk.method({
  2072. selector: "collectionWithDuplicates",
  2073. protocol: 'accessing',
  2074. fn: function (){
  2075. var self=this;
  2076. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2077. return smalltalk.withContext(function($ctx1) {
  2078. var $2,$3,$1;
  2079. $2=_st($Dictionary())._new();
  2080. _st($2)._at_put_((1),(1));
  2081. $ctx1.sendIdx["at:put:"]=1;
  2082. _st($2)._at_put_("a",(2));
  2083. $ctx1.sendIdx["at:put:"]=2;
  2084. _st($2)._at_put_(true,(3));
  2085. $ctx1.sendIdx["at:put:"]=3;
  2086. _st($2)._at_put_((4),(-4));
  2087. $ctx1.sendIdx["at:put:"]=4;
  2088. _st($2)._at_put_("b",(1));
  2089. $ctx1.sendIdx["at:put:"]=5;
  2090. _st($2)._at_put_((3),(3));
  2091. $ctx1.sendIdx["at:put:"]=6;
  2092. _st($2)._at_put_(false,(12));
  2093. $3=_st($2)._yourself();
  2094. $1=$3;
  2095. return $1;
  2096. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  2097. args: [],
  2098. 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",
  2099. messageSends: ["at:put:", "new", "yourself"],
  2100. referencedClasses: ["Dictionary"]
  2101. }),
  2102. smalltalk.DictionaryTest);
  2103. smalltalk.addMethod(
  2104. smalltalk.method({
  2105. selector: "testAccessing",
  2106. protocol: 'tests',
  2107. fn: function (){
  2108. var self=this;
  2109. var d;
  2110. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2111. return smalltalk.withContext(function($ctx1) {
  2112. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  2113. d=_st($Dictionary())._new();
  2114. _st(d)._at_put_("hello","world");
  2115. $ctx1.sendIdx["at:put:"]=1;
  2116. $1=_st(d)._at_("hello");
  2117. $ctx1.sendIdx["at:"]=1;
  2118. self._assert_equals_($1,"world");
  2119. $ctx1.sendIdx["assert:equals:"]=1;
  2120. $2=_st(d)._at_ifAbsent_("hello",(function(){
  2121. return smalltalk.withContext(function($ctx2) {
  2122. return nil;
  2123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2124. $ctx1.sendIdx["at:ifAbsent:"]=1;
  2125. self._assert_equals_($2,"world");
  2126. $ctx1.sendIdx["assert:equals:"]=2;
  2127. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  2128. return smalltalk.withContext(function($ctx2) {
  2129. return nil;
  2130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  2131. $ctx1.sendIdx["deny:"]=1;
  2132. $3=_st(d)._includesKey_("hello");
  2133. $ctx1.sendIdx["includesKey:"]=1;
  2134. self._assert_($3);
  2135. $ctx1.sendIdx["assert:"]=1;
  2136. $4=_st(d)._includesKey_("foo");
  2137. $ctx1.sendIdx["includesKey:"]=2;
  2138. self._deny_($4);
  2139. $ctx1.sendIdx["deny:"]=2;
  2140. _st(d)._at_put_((1),(2));
  2141. $ctx1.sendIdx["at:put:"]=2;
  2142. $5=_st(d)._at_((1));
  2143. $ctx1.sendIdx["at:"]=2;
  2144. self._assert_equals_($5,(2));
  2145. $ctx1.sendIdx["assert:equals:"]=3;
  2146. $6=d;
  2147. $7=(1).__at((3));
  2148. $ctx1.sendIdx["@"]=1;
  2149. _st($6)._at_put_($7,(3));
  2150. $9=d;
  2151. $10=(1).__at((3));
  2152. $ctx1.sendIdx["@"]=2;
  2153. $8=_st($9)._at_($10);
  2154. self._assert_equals_($8,(3));
  2155. $12=d;
  2156. $13=(1).__at((3));
  2157. $ctx1.sendIdx["@"]=3;
  2158. $11=_st($12)._includesKey_($13);
  2159. $ctx1.sendIdx["includesKey:"]=3;
  2160. self._assert_($11);
  2161. self._deny_(_st(d)._includesKey_((3).__at((1))));
  2162. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  2163. args: [],
  2164. 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)",
  2165. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  2166. referencedClasses: ["Dictionary"]
  2167. }),
  2168. smalltalk.DictionaryTest);
  2169. smalltalk.addMethod(
  2170. smalltalk.method({
  2171. selector: "testAsHashedCollection",
  2172. protocol: 'tests',
  2173. fn: function (){
  2174. var self=this;
  2175. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2176. return smalltalk.withContext(function($ctx1) {
  2177. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2178. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  2179. args: [],
  2180. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2181. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2182. referencedClasses: ["HashedCollection"]
  2183. }),
  2184. smalltalk.DictionaryTest);
  2185. smalltalk.addMethod(
  2186. smalltalk.method({
  2187. selector: "testDynamicDictionaries",
  2188. protocol: 'tests',
  2189. fn: function (){
  2190. var self=this;
  2191. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2192. return smalltalk.withContext(function($ctx1) {
  2193. var $3,$2,$1;
  2194. $3="hello".__minus_gt((1));
  2195. $ctx1.sendIdx["->"]=1;
  2196. $2=smalltalk.HashedCollection._from_([$3]);
  2197. $1=_st($2)._asDictionary();
  2198. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  2199. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  2200. args: [],
  2201. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  2202. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  2203. referencedClasses: ["Dictionary"]
  2204. }),
  2205. smalltalk.DictionaryTest);
  2206. smalltalk.addMethod(
  2207. smalltalk.method({
  2208. selector: "testEquality",
  2209. protocol: 'tests',
  2210. fn: function (){
  2211. var self=this;
  2212. var d1,d2;
  2213. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2214. return smalltalk.withContext(function($ctx1) {
  2215. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  2216. $2=_st($Dictionary())._new();
  2217. $ctx1.sendIdx["new"]=1;
  2218. $3=_st($Dictionary())._new();
  2219. $ctx1.sendIdx["new"]=2;
  2220. $1=_st($2).__eq($3);
  2221. $ctx1.sendIdx["="]=1;
  2222. self._assert_($1);
  2223. $ctx1.sendIdx["assert:"]=1;
  2224. $4=_st($Dictionary())._new();
  2225. $ctx1.sendIdx["new"]=3;
  2226. _st($4)._at_put_((1),(2));
  2227. $ctx1.sendIdx["at:put:"]=1;
  2228. $5=_st($4)._yourself();
  2229. $ctx1.sendIdx["yourself"]=1;
  2230. d1=$5;
  2231. $6=_st($Dictionary())._new();
  2232. $ctx1.sendIdx["new"]=4;
  2233. _st($6)._at_put_((1),(2));
  2234. $ctx1.sendIdx["at:put:"]=2;
  2235. $7=_st($6)._yourself();
  2236. $ctx1.sendIdx["yourself"]=2;
  2237. d2=$7;
  2238. $8=_st(d1).__eq(d2);
  2239. $ctx1.sendIdx["="]=2;
  2240. self._assert_($8);
  2241. $9=_st($Dictionary())._new();
  2242. $ctx1.sendIdx["new"]=5;
  2243. _st($9)._at_put_((1),(3));
  2244. $ctx1.sendIdx["at:put:"]=3;
  2245. $10=_st($9)._yourself();
  2246. $ctx1.sendIdx["yourself"]=3;
  2247. d2=$10;
  2248. $11=_st(d1).__eq(d2);
  2249. $ctx1.sendIdx["="]=3;
  2250. self._deny_($11);
  2251. $ctx1.sendIdx["deny:"]=1;
  2252. $12=_st($Dictionary())._new();
  2253. $ctx1.sendIdx["new"]=6;
  2254. _st($12)._at_put_((2),(2));
  2255. $ctx1.sendIdx["at:put:"]=4;
  2256. $13=_st($12)._yourself();
  2257. $ctx1.sendIdx["yourself"]=4;
  2258. d2=$13;
  2259. $14=_st(d1).__eq(d2);
  2260. $ctx1.sendIdx["="]=4;
  2261. self._deny_($14);
  2262. $ctx1.sendIdx["deny:"]=2;
  2263. $15=_st($Dictionary())._new();
  2264. _st($15)._at_put_((1),(2));
  2265. $ctx1.sendIdx["at:put:"]=5;
  2266. _st($15)._at_put_((3),(4));
  2267. $16=_st($15)._yourself();
  2268. d2=$16;
  2269. self._deny_(_st(d1).__eq(d2));
  2270. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  2271. args: [],
  2272. 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.",
  2273. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  2274. referencedClasses: ["Dictionary"]
  2275. }),
  2276. smalltalk.DictionaryTest);
  2277. smalltalk.addMethod(
  2278. smalltalk.method({
  2279. selector: "testIfAbsent",
  2280. protocol: 'tests',
  2281. fn: function (){
  2282. var self=this;
  2283. var d,visited;
  2284. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2285. return smalltalk.withContext(function($ctx1) {
  2286. visited=false;
  2287. d=_st($Dictionary())._new();
  2288. _st(d)._at_ifAbsent_("hello",(function(){
  2289. return smalltalk.withContext(function($ctx2) {
  2290. visited=true;
  2291. return visited;
  2292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2293. self._assert_(visited);
  2294. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  2295. args: [],
  2296. source: "testIfAbsent\x0a\x0a\x09| d visited |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' ifAbsent: [ visited := true ].\x0a\x09self assert: visited.",
  2297. messageSends: ["new", "at:ifAbsent:", "assert:"],
  2298. referencedClasses: ["Dictionary"]
  2299. }),
  2300. smalltalk.DictionaryTest);
  2301. smalltalk.addMethod(
  2302. smalltalk.method({
  2303. selector: "testIfPresent",
  2304. protocol: 'tests',
  2305. fn: function (){
  2306. var self=this;
  2307. var d,visited,absent;
  2308. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2309. return smalltalk.withContext(function($ctx1) {
  2310. visited=false;
  2311. d=_st($Dictionary())._new();
  2312. _st(d)._at_put_("hello","world");
  2313. _st(d)._at_ifPresent_("hello",(function(value){
  2314. return smalltalk.withContext(function($ctx2) {
  2315. visited=value;
  2316. return visited;
  2317. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}));
  2318. $ctx1.sendIdx["at:ifPresent:"]=1;
  2319. self._assert_equals_(visited,"world");
  2320. absent=_st(d)._at_ifPresent_("bye",(function(value){
  2321. return smalltalk.withContext(function($ctx2) {
  2322. visited=value;
  2323. return visited;
  2324. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,2)})}));
  2325. self._assert_(_st(absent)._isNil());
  2326. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent},smalltalk.DictionaryTest)})},
  2327. args: [],
  2328. source: "testIfPresent\x0a\x0a\x09| d visited absent |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x09d at: 'hello' put: 'world'.\x0a\x0a\x09d at: 'hello' ifPresent: [ :value | visited := value ].\x0a\x09self assert: visited equals: 'world'.\x0a\x0a\x09absent := d at: 'bye' ifPresent: [ :value | visited := value ].\x0a\x09self assert: absent isNil.",
  2329. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"],
  2330. referencedClasses: ["Dictionary"]
  2331. }),
  2332. smalltalk.DictionaryTest);
  2333. smalltalk.addMethod(
  2334. smalltalk.method({
  2335. selector: "testIfPresentIfAbsent",
  2336. protocol: 'tests',
  2337. fn: function (){
  2338. var self=this;
  2339. var d,visited;
  2340. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2341. return smalltalk.withContext(function($ctx1) {
  2342. visited=false;
  2343. d=_st($Dictionary())._new();
  2344. _st(d)._at_put_("hello","world");
  2345. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  2346. return smalltalk.withContext(function($ctx2) {
  2347. visited=value;
  2348. return visited;
  2349. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}),(function(){
  2350. return smalltalk.withContext(function($ctx2) {
  2351. visited=true;
  2352. return visited;
  2353. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2354. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2355. self._assert_equals_(visited,"world");
  2356. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  2357. return smalltalk.withContext(function($ctx2) {
  2358. visited=value;
  2359. return visited;
  2360. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,3)})}),(function(){
  2361. return smalltalk.withContext(function($ctx2) {
  2362. visited=true;
  2363. return visited;
  2364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  2365. self._assert_(visited);
  2366. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  2367. args: [],
  2368. source: "testIfPresentIfAbsent\x0a\x0a\x09| d visited |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x09d at: 'hello' put: 'world'.\x0a\x0a\x09d at: 'hello' ifPresent: [ :value | visited := value ] ifAbsent: [ visited := true ].\x0a\x09self assert: visited equals: 'world'.\x0a\x0a\x09d at: 'buy' ifPresent: [ :value | visited := value ] ifAbsent: [ visited := true ].\x0a\x09self assert: visited.",
  2369. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"],
  2370. referencedClasses: ["Dictionary"]
  2371. }),
  2372. smalltalk.DictionaryTest);
  2373. smalltalk.addMethod(
  2374. smalltalk.method({
  2375. selector: "testKeys",
  2376. protocol: 'tests',
  2377. fn: function (){
  2378. var self=this;
  2379. var d;
  2380. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2381. return smalltalk.withContext(function($ctx1) {
  2382. d=_st($Dictionary())._new();
  2383. _st(d)._at_put_((1),(2));
  2384. $ctx1.sendIdx["at:put:"]=1;
  2385. _st(d)._at_put_((2),(3));
  2386. $ctx1.sendIdx["at:put:"]=2;
  2387. _st(d)._at_put_((3),(4));
  2388. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  2389. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  2390. args: [],
  2391. 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)",
  2392. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  2393. referencedClasses: ["Dictionary"]
  2394. }),
  2395. smalltalk.DictionaryTest);
  2396. smalltalk.addMethod(
  2397. smalltalk.method({
  2398. selector: "testPointKey",
  2399. protocol: 'tests',
  2400. fn: function (){
  2401. var self=this;
  2402. var d;
  2403. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2404. return smalltalk.withContext(function($ctx1) {
  2405. var $1,$2,$4,$5,$3,$6,$7,$9,$10,$8,$11,$12,$14,$15,$13;
  2406. d=_st($Dictionary())._new();
  2407. $1=d;
  2408. $2=(1).__at((1));
  2409. $ctx1.sendIdx["@"]=1;
  2410. _st($1)._at_put_($2,"foo");
  2411. $ctx1.sendIdx["at:put:"]=1;
  2412. $4=d;
  2413. $5=(1).__at((1));
  2414. $ctx1.sendIdx["@"]=2;
  2415. $3=_st($4)._at_($5);
  2416. $ctx1.sendIdx["at:"]=1;
  2417. self._assert_equals_($3,"foo");
  2418. $ctx1.sendIdx["assert:equals:"]=1;
  2419. $6=d;
  2420. $7=(1).__at((1));
  2421. $ctx1.sendIdx["@"]=3;
  2422. _st($6)._at_put_($7,"bar");
  2423. $9=d;
  2424. $10=(1).__at((1));
  2425. $ctx1.sendIdx["@"]=4;
  2426. $8=_st($9)._at_($10);
  2427. self._assert_equals_($8,"bar");
  2428. $ctx1.sendIdx["assert:equals:"]=2;
  2429. $11=d;
  2430. $12=(1).__at((1));
  2431. $ctx1.sendIdx["@"]=5;
  2432. _st($11)._removeKey_($12);
  2433. $14=d;
  2434. $15=(1).__at((1));
  2435. $ctx1.sendIdx["@"]=6;
  2436. $13=_st($14)._at_ifAbsent_($15,(function(){
  2437. return smalltalk.withContext(function($ctx2) {
  2438. return "baz";
  2439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2440. self._assert_equals_($13,"baz");
  2441. self._deny_(_st(d)._includesKey_((1).__at((1))));
  2442. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  2443. args: [],
  2444. 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)",
  2445. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  2446. referencedClasses: ["Dictionary"]
  2447. }),
  2448. smalltalk.DictionaryTest);
  2449. smalltalk.addMethod(
  2450. smalltalk.method({
  2451. selector: "testPrintString",
  2452. protocol: 'tests',
  2453. fn: function (){
  2454. var self=this;
  2455. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2456. return smalltalk.withContext(function($ctx1) {
  2457. var $2,$3,$1;
  2458. $2=_st($Dictionary())._new();
  2459. _st($2)._at_put_("firstname","James");
  2460. $ctx1.sendIdx["at:put:"]=1;
  2461. _st($2)._at_put_("lastname","Bond");
  2462. $3=_st($2)._printString();
  2463. $1=$3;
  2464. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2465. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  2466. args: [],
  2467. 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'')'",
  2468. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  2469. referencedClasses: ["Dictionary"]
  2470. }),
  2471. smalltalk.DictionaryTest);
  2472. smalltalk.addMethod(
  2473. smalltalk.method({
  2474. selector: "testRemoveKey",
  2475. protocol: 'tests',
  2476. fn: function (){
  2477. var self=this;
  2478. var d,key;
  2479. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2480. return smalltalk.withContext(function($ctx1) {
  2481. var $1;
  2482. d=_st($Dictionary())._new();
  2483. _st(d)._at_put_((1),(2));
  2484. $ctx1.sendIdx["at:put:"]=1;
  2485. _st(d)._at_put_((2),(3));
  2486. $ctx1.sendIdx["at:put:"]=2;
  2487. _st(d)._at_put_((3),(4));
  2488. key=(2);
  2489. $1=_st(d)._keys();
  2490. $ctx1.sendIdx["keys"]=1;
  2491. self._assert_equals_($1,[(1), (2), (3)]);
  2492. $ctx1.sendIdx["assert:equals:"]=1;
  2493. _st(d)._removeKey_(key);
  2494. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  2495. $ctx1.sendIdx["assert:equals:"]=2;
  2496. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  2497. self._deny_(_st(d)._includesKey_((2)));
  2498. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  2499. args: [],
  2500. 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)",
  2501. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  2502. referencedClasses: ["Dictionary"]
  2503. }),
  2504. smalltalk.DictionaryTest);
  2505. smalltalk.addMethod(
  2506. smalltalk.method({
  2507. selector: "testRemoveKeyIfAbsent",
  2508. protocol: 'tests',
  2509. fn: function (){
  2510. var self=this;
  2511. var d,key;
  2512. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2513. return smalltalk.withContext(function($ctx1) {
  2514. var $1;
  2515. d=_st($Dictionary())._new();
  2516. _st(d)._at_put_((1),(2));
  2517. $ctx1.sendIdx["at:put:"]=1;
  2518. _st(d)._at_put_((2),(3));
  2519. $ctx1.sendIdx["at:put:"]=2;
  2520. _st(d)._at_put_((3),(4));
  2521. key=(2);
  2522. self._assert_equals_(_st(d)._removeKey_(key),(3));
  2523. $ctx1.sendIdx["assert:equals:"]=1;
  2524. key=(3);
  2525. $1=_st(d)._removeKey_ifAbsent_(key,(function(){
  2526. return smalltalk.withContext(function($ctx2) {
  2527. return (42);
  2528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2529. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  2530. self._assert_equals_($1,(4));
  2531. $ctx1.sendIdx["assert:equals:"]=2;
  2532. key="why";
  2533. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  2534. return smalltalk.withContext(function($ctx2) {
  2535. return (42);
  2536. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  2537. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  2538. args: [],
  2539. 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.",
  2540. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  2541. referencedClasses: ["Dictionary"]
  2542. }),
  2543. smalltalk.DictionaryTest);
  2544. smalltalk.addMethod(
  2545. smalltalk.method({
  2546. selector: "testSize",
  2547. protocol: 'tests',
  2548. fn: function (){
  2549. var self=this;
  2550. var d;
  2551. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2552. return smalltalk.withContext(function($ctx1) {
  2553. var $1,$2;
  2554. d=_st($Dictionary())._new();
  2555. $1=_st(d)._size();
  2556. $ctx1.sendIdx["size"]=1;
  2557. self._assert_equals_($1,(0));
  2558. $ctx1.sendIdx["assert:equals:"]=1;
  2559. _st(d)._at_put_((1),(2));
  2560. $ctx1.sendIdx["at:put:"]=1;
  2561. $2=_st(d)._size();
  2562. $ctx1.sendIdx["size"]=2;
  2563. self._assert_equals_($2,(1));
  2564. $ctx1.sendIdx["assert:equals:"]=2;
  2565. _st(d)._at_put_((2),(3));
  2566. self._assert_equals_(_st(d)._size(),(2));
  2567. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d},smalltalk.DictionaryTest)})},
  2568. args: [],
  2569. source: "testSize\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09self assert: d size equals: 0.\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: d size equals: 1.\x0a\x0a\x09d at: 2 put: 3.\x0a\x09self assert: d size equals: 2.",
  2570. messageSends: ["new", "assert:equals:", "size", "at:put:"],
  2571. referencedClasses: ["Dictionary"]
  2572. }),
  2573. smalltalk.DictionaryTest);
  2574. smalltalk.addMethod(
  2575. smalltalk.method({
  2576. selector: "testValues",
  2577. protocol: 'tests',
  2578. fn: function (){
  2579. var self=this;
  2580. var d;
  2581. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2582. return smalltalk.withContext(function($ctx1) {
  2583. d=_st($Dictionary())._new();
  2584. _st(d)._at_put_((1),(2));
  2585. $ctx1.sendIdx["at:put:"]=1;
  2586. _st(d)._at_put_((2),(3));
  2587. $ctx1.sendIdx["at:put:"]=2;
  2588. _st(d)._at_put_((3),(4));
  2589. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  2590. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  2591. args: [],
  2592. 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)",
  2593. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  2594. referencedClasses: ["Dictionary"]
  2595. }),
  2596. smalltalk.DictionaryTest);
  2597. smalltalk.addMethod(
  2598. smalltalk.method({
  2599. selector: "collectionClass",
  2600. protocol: 'accessing',
  2601. fn: function (){
  2602. var self=this;
  2603. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2604. return smalltalk.withContext(function($ctx1) {
  2605. return $Dictionary();
  2606. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  2607. args: [],
  2608. source: "collectionClass\x0a\x09^ Dictionary",
  2609. messageSends: [],
  2610. referencedClasses: ["Dictionary"]
  2611. }),
  2612. smalltalk.DictionaryTest.klass);
  2613. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2614. smalltalk.addMethod(
  2615. smalltalk.method({
  2616. selector: "testBeginsWith",
  2617. protocol: 'tests',
  2618. fn: function (){
  2619. var self=this;
  2620. return smalltalk.withContext(function($ctx1) {
  2621. var $2,$4,$3,$1,$6,$5;
  2622. $2=self._collection();
  2623. $ctx1.sendIdx["collection"]=1;
  2624. $4=self._collection();
  2625. $ctx1.sendIdx["collection"]=2;
  2626. $3=_st($4)._first_((3));
  2627. $1=_st($2)._beginsWith_($3);
  2628. $ctx1.sendIdx["beginsWith:"]=1;
  2629. self._assert_($1);
  2630. $6=self._collection();
  2631. $ctx1.sendIdx["collection"]=3;
  2632. $5=_st($6)._beginsWith_(_st(self._collection())._copyFrom_to_((2),(3)));
  2633. self._deny_($5);
  2634. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  2635. args: [],
  2636. source: "testBeginsWith\x0a\x09self assert: (self collection beginsWith: (self collection first: 3)).\x0a\x09self deny: (self collection beginsWith: (self collection copyFrom: 2 to: 3))",
  2637. messageSends: ["assert:", "beginsWith:", "collection", "first:", "deny:", "copyFrom:to:"],
  2638. referencedClasses: []
  2639. }),
  2640. smalltalk.SequenceableCollectionTest);
  2641. smalltalk.addMethod(
  2642. smalltalk.method({
  2643. selector: "testEndsWith",
  2644. protocol: 'tests',
  2645. fn: function (){
  2646. var self=this;
  2647. return smalltalk.withContext(function($ctx1) {
  2648. var $2,$4,$3,$1,$6,$8,$11,$10,$9,$7,$5;
  2649. $2=self._collection();
  2650. $ctx1.sendIdx["collection"]=1;
  2651. $4=self._collection();
  2652. $ctx1.sendIdx["collection"]=2;
  2653. $3=_st($4)._last_((3));
  2654. $1=_st($2)._endsWith_($3);
  2655. $ctx1.sendIdx["endsWith:"]=1;
  2656. self._assert_($1);
  2657. $6=self._collection();
  2658. $ctx1.sendIdx["collection"]=3;
  2659. $8=self._collection();
  2660. $ctx1.sendIdx["collection"]=4;
  2661. $11=self._collection();
  2662. $ctx1.sendIdx["collection"]=5;
  2663. $10=_st($11)._size();
  2664. $ctx1.sendIdx["size"]=1;
  2665. $9=_st($10).__minus((3));
  2666. $ctx1.sendIdx["-"]=1;
  2667. $7=_st($8)._copyFrom_to_($9,_st(_st(self._collection())._size()).__minus((1)));
  2668. $5=_st($6)._endsWith_($7);
  2669. self._deny_($5);
  2670. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  2671. args: [],
  2672. source: "testEndsWith\x0a\x09self assert: (self collection endsWith: (self collection last: 3)).\x0a\x09self deny: (self collection endsWith: (self collection copyFrom: self collection size - 3 to: self collection size - 1))",
  2673. messageSends: ["assert:", "endsWith:", "collection", "last:", "deny:", "copyFrom:to:", "-", "size"],
  2674. referencedClasses: []
  2675. }),
  2676. smalltalk.SequenceableCollectionTest);
  2677. smalltalk.addMethod(
  2678. smalltalk.method({
  2679. selector: "testFirst",
  2680. protocol: 'tests',
  2681. fn: function (){
  2682. var self=this;
  2683. return smalltalk.withContext(function($ctx1) {
  2684. var $2,$1;
  2685. $2=self._collection();
  2686. $ctx1.sendIdx["collection"]=1;
  2687. $1=_st($2)._first();
  2688. self._assert_equals_($1,_st(self._collection())._at_((1)));
  2689. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  2690. args: [],
  2691. source: "testFirst\x0a\x09self assert: (self collection first) equals: (self collection at: 1)",
  2692. messageSends: ["assert:equals:", "first", "collection", "at:"],
  2693. referencedClasses: []
  2694. }),
  2695. smalltalk.SequenceableCollectionTest);
  2696. smalltalk.addMethod(
  2697. smalltalk.method({
  2698. selector: "testFirstN",
  2699. protocol: 'tests',
  2700. fn: function (){
  2701. var self=this;
  2702. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2703. return smalltalk.withContext(function($ctx1) {
  2704. var $2,$1,$4,$3;
  2705. $2=self._collection();
  2706. $ctx1.sendIdx["collection"]=1;
  2707. $1=_st($2)._first_((2));
  2708. $ctx1.sendIdx["first:"]=1;
  2709. $4=self._collection();
  2710. $ctx1.sendIdx["collection"]=2;
  2711. $3=_st($4)._copyFrom_to_((0),(2));
  2712. self._assert_equals_($1,$3);
  2713. self._should_raise_((function(){
  2714. return smalltalk.withContext(function($ctx2) {
  2715. return _st(self._collection())._first_((33));
  2716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2717. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  2718. args: [],
  2719. source: "testFirstN\x0a\x09self \x0a\x09\x09assert: (self collection first: 2) \x0a\x09\x09equals: (self collection copyFrom: 0 to: 2).\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  2720. messageSends: ["assert:equals:", "first:", "collection", "copyFrom:to:", "should:raise:"],
  2721. referencedClasses: ["Error"]
  2722. }),
  2723. smalltalk.SequenceableCollectionTest);
  2724. smalltalk.addMethod(
  2725. smalltalk.method({
  2726. selector: "testFourth",
  2727. protocol: 'tests',
  2728. fn: function (){
  2729. var self=this;
  2730. return smalltalk.withContext(function($ctx1) {
  2731. var $2,$1;
  2732. $2=self._collection();
  2733. $ctx1.sendIdx["collection"]=1;
  2734. $1=_st($2)._fourth();
  2735. self._assert_equals_($1,_st(self._collection())._at_((4)));
  2736. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  2737. args: [],
  2738. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  2739. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  2740. referencedClasses: []
  2741. }),
  2742. smalltalk.SequenceableCollectionTest);
  2743. smalltalk.addMethod(
  2744. smalltalk.method({
  2745. selector: "testLast",
  2746. protocol: 'tests',
  2747. fn: function (){
  2748. var self=this;
  2749. return smalltalk.withContext(function($ctx1) {
  2750. var $2,$1,$4,$3;
  2751. $2=self._collection();
  2752. $ctx1.sendIdx["collection"]=1;
  2753. $1=_st($2)._last();
  2754. $4=self._collection();
  2755. $ctx1.sendIdx["collection"]=2;
  2756. $3=_st($4)._at_(_st(self._collection())._size());
  2757. self._assert_equals_($1,$3);
  2758. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  2759. args: [],
  2760. source: "testLast\x0a\x09self assert: (self collection last) equals: (self collection at: self collection size)",
  2761. messageSends: ["assert:equals:", "last", "collection", "at:", "size"],
  2762. referencedClasses: []
  2763. }),
  2764. smalltalk.SequenceableCollectionTest);
  2765. smalltalk.addMethod(
  2766. smalltalk.method({
  2767. selector: "testLastN",
  2768. protocol: 'tests',
  2769. fn: function (){
  2770. var self=this;
  2771. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2772. return smalltalk.withContext(function($ctx1) {
  2773. var $2,$1,$4,$7,$6,$5,$9,$8,$3;
  2774. $2=self._collection();
  2775. $ctx1.sendIdx["collection"]=1;
  2776. $1=_st($2)._last_((2));
  2777. $ctx1.sendIdx["last:"]=1;
  2778. $4=self._collection();
  2779. $ctx1.sendIdx["collection"]=2;
  2780. $7=self._collection();
  2781. $ctx1.sendIdx["collection"]=3;
  2782. $6=_st($7)._size();
  2783. $ctx1.sendIdx["size"]=1;
  2784. $5=_st($6).__minus((1));
  2785. $9=self._collection();
  2786. $ctx1.sendIdx["collection"]=4;
  2787. $8=_st($9)._size();
  2788. $3=_st($4)._copyFrom_to_($5,$8);
  2789. self._assert_equals_($1,$3);
  2790. self._should_raise_((function(){
  2791. return smalltalk.withContext(function($ctx2) {
  2792. return _st(self._collection())._last_((33));
  2793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2794. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  2795. args: [],
  2796. source: "testLastN\x0a\x09self \x0a\x09\x09assert: (self collection last: 2) \x0a\x09\x09equals: (self collection copyFrom: self collection size -1 to: self collection size).\x0a\x09\x09\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  2797. messageSends: ["assert:equals:", "last:", "collection", "copyFrom:to:", "-", "size", "should:raise:"],
  2798. referencedClasses: ["Error"]
  2799. }),
  2800. smalltalk.SequenceableCollectionTest);
  2801. smalltalk.addMethod(
  2802. smalltalk.method({
  2803. selector: "testSecond",
  2804. protocol: 'tests',
  2805. fn: function (){
  2806. var self=this;
  2807. return smalltalk.withContext(function($ctx1) {
  2808. var $2,$1;
  2809. $2=self._collection();
  2810. $ctx1.sendIdx["collection"]=1;
  2811. $1=_st($2)._second();
  2812. self._assert_equals_($1,_st(self._collection())._at_((2)));
  2813. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  2814. args: [],
  2815. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  2816. messageSends: ["assert:equals:", "second", "collection", "at:"],
  2817. referencedClasses: []
  2818. }),
  2819. smalltalk.SequenceableCollectionTest);
  2820. smalltalk.addMethod(
  2821. smalltalk.method({
  2822. selector: "testThird",
  2823. protocol: 'tests',
  2824. fn: function (){
  2825. var self=this;
  2826. return smalltalk.withContext(function($ctx1) {
  2827. var $2,$1;
  2828. $2=self._collection();
  2829. $ctx1.sendIdx["collection"]=1;
  2830. $1=_st($2)._third();
  2831. self._assert_equals_($1,_st(self._collection())._at_((3)));
  2832. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  2833. args: [],
  2834. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  2835. messageSends: ["assert:equals:", "third", "collection", "at:"],
  2836. referencedClasses: []
  2837. }),
  2838. smalltalk.SequenceableCollectionTest);
  2839. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2840. smalltalk.addMethod(
  2841. smalltalk.method({
  2842. selector: "collection",
  2843. protocol: 'accessing',
  2844. fn: function (){
  2845. var self=this;
  2846. return smalltalk.withContext(function($ctx1) {
  2847. var $1;
  2848. $1=[(1), (2), (3), (-4)];
  2849. return $1;
  2850. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  2851. args: [],
  2852. source: "collection\x0a\x09^#(1 2 3 -4)",
  2853. messageSends: [],
  2854. referencedClasses: []
  2855. }),
  2856. smalltalk.ArrayTest);
  2857. smalltalk.addMethod(
  2858. smalltalk.method({
  2859. selector: "collectionWithDuplicates",
  2860. protocol: 'accessing',
  2861. fn: function (){
  2862. var self=this;
  2863. return smalltalk.withContext(function($ctx1) {
  2864. var $1;
  2865. $1=["a", "b", "c", (1), (2), (1), "a"];
  2866. return $1;
  2867. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  2868. args: [],
  2869. source: "collectionWithDuplicates\x0a\x09^#('a' 'b' 'c' 1 2 1 'a')",
  2870. messageSends: [],
  2871. referencedClasses: []
  2872. }),
  2873. smalltalk.ArrayTest);
  2874. smalltalk.addMethod(
  2875. smalltalk.method({
  2876. selector: "testAdd",
  2877. protocol: 'tests',
  2878. fn: function (){
  2879. var self=this;
  2880. var array;
  2881. return smalltalk.withContext(function($ctx1) {
  2882. array=self._collection();
  2883. _st(array)._add_((6));
  2884. self._assert_equals_(_st(array)._last(),(6));
  2885. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  2886. args: [],
  2887. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  2888. messageSends: ["collection", "add:", "assert:equals:", "last"],
  2889. referencedClasses: []
  2890. }),
  2891. smalltalk.ArrayTest);
  2892. smalltalk.addMethod(
  2893. smalltalk.method({
  2894. selector: "testAddFirst",
  2895. protocol: 'tests',
  2896. fn: function (){
  2897. var self=this;
  2898. return smalltalk.withContext(function($ctx1) {
  2899. var $1,$2;
  2900. $1=self._collection();
  2901. _st($1)._addFirst_((0));
  2902. $2=_st($1)._yourself();
  2903. self._assert_equals_(_st($2)._first(),(0));
  2904. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  2905. args: [],
  2906. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  2907. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  2908. referencedClasses: []
  2909. }),
  2910. smalltalk.ArrayTest);
  2911. smalltalk.addMethod(
  2912. smalltalk.method({
  2913. selector: "testAtIfAbsent",
  2914. protocol: 'tests',
  2915. fn: function (){
  2916. var self=this;
  2917. var array;
  2918. return smalltalk.withContext(function($ctx1) {
  2919. var $1,$2,$3,$4;
  2920. array=["hello", "world"];
  2921. $1=_st(array)._at_((1));
  2922. $ctx1.sendIdx["at:"]=1;
  2923. self._assert_equals_($1,"hello");
  2924. $ctx1.sendIdx["assert:equals:"]=1;
  2925. self._assert_equals_(_st(array)._at_((2)),"world");
  2926. $ctx1.sendIdx["assert:equals:"]=2;
  2927. $2=_st(array)._at_ifAbsent_((2),(function(){
  2928. return smalltalk.withContext(function($ctx2) {
  2929. return "not found";
  2930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2931. $ctx1.sendIdx["at:ifAbsent:"]=1;
  2932. self._assert_equals_($2,"world");
  2933. $ctx1.sendIdx["assert:equals:"]=3;
  2934. $3=_st(array)._at_ifAbsent_((0),(function(){
  2935. return smalltalk.withContext(function($ctx2) {
  2936. return "not found";
  2937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2938. $ctx1.sendIdx["at:ifAbsent:"]=2;
  2939. self._assert_equals_($3,"not found");
  2940. $ctx1.sendIdx["assert:equals:"]=4;
  2941. $4=_st(array)._at_ifAbsent_((-10),(function(){
  2942. return smalltalk.withContext(function($ctx2) {
  2943. return "not found";
  2944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  2945. $ctx1.sendIdx["at:ifAbsent:"]=3;
  2946. self._assert_equals_($4,"not found");
  2947. $ctx1.sendIdx["assert:equals:"]=5;
  2948. self._assert_equals_(_st(array)._at_ifAbsent_((3),(function(){
  2949. return smalltalk.withContext(function($ctx2) {
  2950. return "not found";
  2951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),"not found");
  2952. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array},smalltalk.ArrayTest)})},
  2953. args: [],
  2954. source: "testAtIfAbsent\x0a\x09| array |\x0a\x09array := #('hello' 'world').\x0a\x09self assert: (array at: 1) equals: 'hello'.\x0a\x09self assert: (array at: 2) equals: 'world'.\x0a\x09self assert: (array at: 2 ifAbsent: [ 'not found' ]) equals: 'world'.\x0a\x09self assert: (array at: 0 ifAbsent: [ 'not found' ]) equals: 'not found'.\x0a\x09self assert: (array at: -10 ifAbsent: [ 'not found' ]) equals: 'not found'.\x0a\x09self assert: (array at: 3 ifAbsent: [ 'not found' ]) equals: 'not found'.",
  2955. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2956. referencedClasses: []
  2957. }),
  2958. smalltalk.ArrayTest);
  2959. smalltalk.addMethod(
  2960. smalltalk.method({
  2961. selector: "testFirstN",
  2962. protocol: 'tests',
  2963. fn: function (){
  2964. var self=this;
  2965. return smalltalk.withContext(function($ctx1) {
  2966. self._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  2967. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.ArrayTest)})},
  2968. args: [],
  2969. source: "testFirstN\x0a\x09self assert: ({1. 2. 3. 4. 5} first: 3) equals: {1. 2. 3}",
  2970. messageSends: ["assert:equals:", "first:"],
  2971. referencedClasses: []
  2972. }),
  2973. smalltalk.ArrayTest);
  2974. smalltalk.addMethod(
  2975. smalltalk.method({
  2976. selector: "testIfEmpty",
  2977. protocol: 'tests',
  2978. fn: function (){
  2979. var self=this;
  2980. return smalltalk.withContext(function($ctx1) {
  2981. self._assert_equals_(""._ifEmpty_((function(){
  2982. return smalltalk.withContext(function($ctx2) {
  2983. return "zork";
  2984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"zork");
  2985. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{},smalltalk.ArrayTest)})},
  2986. args: [],
  2987. source: "testIfEmpty\x0a\x09self assert: ( '' ifEmpty: [ 'zork' ] ) equals: 'zork'",
  2988. messageSends: ["assert:equals:", "ifEmpty:"],
  2989. referencedClasses: []
  2990. }),
  2991. smalltalk.ArrayTest);
  2992. smalltalk.addMethod(
  2993. smalltalk.method({
  2994. selector: "testPrintString",
  2995. protocol: 'tests',
  2996. fn: function (){
  2997. var self=this;
  2998. var array;
  2999. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3000. return smalltalk.withContext(function($ctx1) {
  3001. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  3002. array=_st($Array())._new();
  3003. $1=_st(array)._printString();
  3004. $ctx1.sendIdx["printString"]=1;
  3005. self._assert_equals_($1,"an Array ()");
  3006. $ctx1.sendIdx["assert:equals:"]=1;
  3007. $2=array;
  3008. _st($2)._add_((1));
  3009. $ctx1.sendIdx["add:"]=1;
  3010. $3=_st($2)._add_((3));
  3011. $ctx1.sendIdx["add:"]=2;
  3012. $4=_st(array)._printString();
  3013. $ctx1.sendIdx["printString"]=2;
  3014. self._assert_equals_($4,"an Array (1 3)");
  3015. $ctx1.sendIdx["assert:equals:"]=2;
  3016. _st(array)._add_("foo");
  3017. $5=_st(array)._printString();
  3018. $ctx1.sendIdx["printString"]=3;
  3019. self._assert_equals_($5,"an Array (1 3 'foo')");
  3020. $ctx1.sendIdx["assert:equals:"]=3;
  3021. $6=array;
  3022. _st($6)._remove_((1));
  3023. $ctx1.sendIdx["remove:"]=1;
  3024. $7=_st($6)._remove_((3));
  3025. $8=_st(array)._printString();
  3026. $ctx1.sendIdx["printString"]=4;
  3027. self._assert_equals_($8,"an Array ('foo')");
  3028. $ctx1.sendIdx["assert:equals:"]=4;
  3029. _st(array)._addLast_((3));
  3030. $ctx1.sendIdx["addLast:"]=1;
  3031. $9=_st(array)._printString();
  3032. $ctx1.sendIdx["printString"]=5;
  3033. self._assert_equals_($9,"an Array ('foo' 3)");
  3034. $ctx1.sendIdx["assert:equals:"]=5;
  3035. _st(array)._addLast_((3));
  3036. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  3037. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  3038. args: [],
  3039. 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)'.",
  3040. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  3041. referencedClasses: ["Array"]
  3042. }),
  3043. smalltalk.ArrayTest);
  3044. smalltalk.addMethod(
  3045. smalltalk.method({
  3046. selector: "testRemove",
  3047. protocol: 'tests',
  3048. fn: function (){
  3049. var self=this;
  3050. var array;
  3051. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3052. return smalltalk.withContext(function($ctx1) {
  3053. array=[(1), (2), (3), (4), (5)];
  3054. _st(array)._remove_((3));
  3055. $ctx1.sendIdx["remove:"]=1;
  3056. self._assert_equals_(array,[(1), (2), (4), (5)]);
  3057. self._should_raise_((function(){
  3058. return smalltalk.withContext(function($ctx2) {
  3059. return _st(array)._remove_((3));
  3060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3061. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  3062. args: [],
  3063. 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",
  3064. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  3065. referencedClasses: ["Error"]
  3066. }),
  3067. smalltalk.ArrayTest);
  3068. smalltalk.addMethod(
  3069. smalltalk.method({
  3070. selector: "testRemoveFromTo",
  3071. protocol: 'tests',
  3072. fn: function (){
  3073. var self=this;
  3074. return smalltalk.withContext(function($ctx1) {
  3075. var $1,$2;
  3076. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  3077. $ctx1.sendIdx["removeFrom:to:"]=1;
  3078. self._assert_equals_($1,[(4)]);
  3079. $ctx1.sendIdx["assert:equals:"]=1;
  3080. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  3081. $ctx1.sendIdx["removeFrom:to:"]=2;
  3082. self._assert_equals_($2,[(1), (4)]);
  3083. $ctx1.sendIdx["assert:equals:"]=2;
  3084. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  3085. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  3086. args: [],
  3087. 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)",
  3088. messageSends: ["assert:equals:", "removeFrom:to:"],
  3089. referencedClasses: []
  3090. }),
  3091. smalltalk.ArrayTest);
  3092. smalltalk.addMethod(
  3093. smalltalk.method({
  3094. selector: "testRemoveIndex",
  3095. protocol: 'tests',
  3096. fn: function (){
  3097. var self=this;
  3098. return smalltalk.withContext(function($ctx1) {
  3099. var $1,$2;
  3100. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  3101. $ctx1.sendIdx["removeIndex:"]=1;
  3102. self._assert_equals_($1,[(1), (3), (4)]);
  3103. $ctx1.sendIdx["assert:equals:"]=1;
  3104. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  3105. $ctx1.sendIdx["removeIndex:"]=2;
  3106. self._assert_equals_($2,[(2), (3), (4)]);
  3107. $ctx1.sendIdx["assert:equals:"]=2;
  3108. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  3109. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  3110. args: [],
  3111. 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: #()",
  3112. messageSends: ["assert:equals:", "removeIndex:"],
  3113. referencedClasses: []
  3114. }),
  3115. smalltalk.ArrayTest);
  3116. smalltalk.addMethod(
  3117. smalltalk.method({
  3118. selector: "testRemoveLast",
  3119. protocol: 'tests',
  3120. fn: function (){
  3121. var self=this;
  3122. var array;
  3123. return smalltalk.withContext(function($ctx1) {
  3124. array=[(1), (2)];
  3125. _st(array)._removeLast();
  3126. self._assert_equals_(_st(array)._last(),(1));
  3127. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  3128. args: [],
  3129. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  3130. messageSends: ["removeLast", "assert:equals:", "last"],
  3131. referencedClasses: []
  3132. }),
  3133. smalltalk.ArrayTest);
  3134. smalltalk.addMethod(
  3135. smalltalk.method({
  3136. selector: "testReversed",
  3137. protocol: 'tests',
  3138. fn: function (){
  3139. var self=this;
  3140. var array;
  3141. return smalltalk.withContext(function($ctx1) {
  3142. array=[(5), (4), (3), (2), (1)];
  3143. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  3144. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  3145. args: [],
  3146. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  3147. messageSends: ["assert:equals:", "reversed"],
  3148. referencedClasses: []
  3149. }),
  3150. smalltalk.ArrayTest);
  3151. smalltalk.addMethod(
  3152. smalltalk.method({
  3153. selector: "testSort",
  3154. protocol: 'tests',
  3155. fn: function (){
  3156. var self=this;
  3157. var array;
  3158. return smalltalk.withContext(function($ctx1) {
  3159. array=[(3), (1), (4), (5), (2)];
  3160. _st(array)._sort();
  3161. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  3162. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  3163. args: [],
  3164. 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)",
  3165. messageSends: ["sort", "assert:equals:"],
  3166. referencedClasses: []
  3167. }),
  3168. smalltalk.ArrayTest);
  3169. smalltalk.addMethod(
  3170. smalltalk.method({
  3171. selector: "collectionClass",
  3172. protocol: 'accessing',
  3173. fn: function (){
  3174. var self=this;
  3175. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3176. return smalltalk.withContext(function($ctx1) {
  3177. return $Array();
  3178. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  3179. args: [],
  3180. source: "collectionClass\x0a\x09^ Array",
  3181. messageSends: [],
  3182. referencedClasses: ["Array"]
  3183. }),
  3184. smalltalk.ArrayTest.klass);
  3185. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3186. smalltalk.addMethod(
  3187. smalltalk.method({
  3188. selector: "collection",
  3189. protocol: 'accessing',
  3190. fn: function (){
  3191. var self=this;
  3192. return smalltalk.withContext(function($ctx1) {
  3193. return "hello";
  3194. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  3195. args: [],
  3196. source: "collection\x0a\x09^ 'hello'",
  3197. messageSends: [],
  3198. referencedClasses: []
  3199. }),
  3200. smalltalk.StringTest);
  3201. smalltalk.addMethod(
  3202. smalltalk.method({
  3203. selector: "collectionWithDuplicates",
  3204. protocol: 'accessing',
  3205. fn: function (){
  3206. var self=this;
  3207. return smalltalk.withContext(function($ctx1) {
  3208. return "abbaerte";
  3209. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  3210. args: [],
  3211. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  3212. messageSends: [],
  3213. referencedClasses: []
  3214. }),
  3215. smalltalk.StringTest);
  3216. smalltalk.addMethod(
  3217. smalltalk.method({
  3218. selector: "testAddRemove",
  3219. protocol: 'tests',
  3220. fn: function (){
  3221. var self=this;
  3222. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3223. return smalltalk.withContext(function($ctx1) {
  3224. self._should_raise_((function(){
  3225. return smalltalk.withContext(function($ctx2) {
  3226. return "hello"._add_("a");
  3227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3228. $ctx1.sendIdx["should:raise:"]=1;
  3229. self._should_raise_((function(){
  3230. return smalltalk.withContext(function($ctx2) {
  3231. return "hello"._remove_("h");
  3232. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3233. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  3234. args: [],
  3235. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  3236. messageSends: ["should:raise:", "add:", "remove:"],
  3237. referencedClasses: ["Error"]
  3238. }),
  3239. smalltalk.StringTest);
  3240. smalltalk.addMethod(
  3241. smalltalk.method({
  3242. selector: "testAsArray",
  3243. protocol: 'tests',
  3244. fn: function (){
  3245. var self=this;
  3246. return smalltalk.withContext(function($ctx1) {
  3247. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  3248. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  3249. args: [],
  3250. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  3251. messageSends: ["assert:equals:", "asArray"],
  3252. referencedClasses: []
  3253. }),
  3254. smalltalk.StringTest);
  3255. smalltalk.addMethod(
  3256. smalltalk.method({
  3257. selector: "testAsLowerCase",
  3258. protocol: 'tests',
  3259. fn: function (){
  3260. var self=this;
  3261. return smalltalk.withContext(function($ctx1) {
  3262. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  3263. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  3264. args: [],
  3265. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  3266. messageSends: ["assert:equals:", "asLowercase"],
  3267. referencedClasses: []
  3268. }),
  3269. smalltalk.StringTest);
  3270. smalltalk.addMethod(
  3271. smalltalk.method({
  3272. selector: "testAsNumber",
  3273. protocol: 'tests',
  3274. fn: function (){
  3275. var self=this;
  3276. return smalltalk.withContext(function($ctx1) {
  3277. var $1,$2;
  3278. $1="3"._asNumber();
  3279. $ctx1.sendIdx["asNumber"]=1;
  3280. self._assert_equals_($1,(3));
  3281. $ctx1.sendIdx["assert:equals:"]=1;
  3282. $2="-3"._asNumber();
  3283. $ctx1.sendIdx["asNumber"]=2;
  3284. self._assert_equals_($2,(-3));
  3285. $ctx1.sendIdx["assert:equals:"]=2;
  3286. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  3287. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  3288. args: [],
  3289. 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.",
  3290. messageSends: ["assert:equals:", "asNumber"],
  3291. referencedClasses: []
  3292. }),
  3293. smalltalk.StringTest);
  3294. smalltalk.addMethod(
  3295. smalltalk.method({
  3296. selector: "testAsUpperCase",
  3297. protocol: 'tests',
  3298. fn: function (){
  3299. var self=this;
  3300. return smalltalk.withContext(function($ctx1) {
  3301. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  3302. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  3303. args: [],
  3304. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  3305. messageSends: ["assert:equals:", "asUppercase"],
  3306. referencedClasses: []
  3307. }),
  3308. smalltalk.StringTest);
  3309. smalltalk.addMethod(
  3310. smalltalk.method({
  3311. selector: "testAsciiValue",
  3312. protocol: 'tests',
  3313. fn: function (){
  3314. var self=this;
  3315. var characterA,characterU;
  3316. return smalltalk.withContext(function($ctx1) {
  3317. var $1;
  3318. characterA="A";
  3319. characterU="U";
  3320. $1=_st(characterA)._asciiValue();
  3321. $ctx1.sendIdx["asciiValue"]=1;
  3322. self._assert_equals_($1,(65));
  3323. $ctx1.sendIdx["assert:equals:"]=1;
  3324. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  3325. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  3326. args: [],
  3327. 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",
  3328. messageSends: ["assert:equals:", "asciiValue"],
  3329. referencedClasses: []
  3330. }),
  3331. smalltalk.StringTest);
  3332. smalltalk.addMethod(
  3333. smalltalk.method({
  3334. selector: "testAt",
  3335. protocol: 'tests',
  3336. fn: function (){
  3337. var self=this;
  3338. return smalltalk.withContext(function($ctx1) {
  3339. var $1;
  3340. $1="hello"._at_((1));
  3341. $ctx1.sendIdx["at:"]=1;
  3342. self._assert_equals_($1,"h");
  3343. $ctx1.sendIdx["assert:equals:"]=1;
  3344. self._assert_equals_("hello"._at_((5)),"o");
  3345. $ctx1.sendIdx["assert:equals:"]=2;
  3346. self._assert_equals_("hello"._at_ifAbsent_((6),(function(){
  3347. return smalltalk.withContext(function($ctx2) {
  3348. return nil;
  3349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),nil);
  3350. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.StringTest)})},
  3351. args: [],
  3352. source: "testAt\x0a\x09self assert: ('hello' at: 1) equals: 'h'.\x0a\x09self assert: ('hello' at: 5) equals: 'o'.\x0a\x09self assert: ('hello' at: 6 ifAbsent: [ nil ]) equals: nil",
  3353. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  3354. referencedClasses: []
  3355. }),
  3356. smalltalk.StringTest);
  3357. smalltalk.addMethod(
  3358. smalltalk.method({
  3359. selector: "testAtPut",
  3360. protocol: 'tests',
  3361. fn: function (){
  3362. var self=this;
  3363. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3364. return smalltalk.withContext(function($ctx1) {
  3365. self._should_raise_((function(){
  3366. return smalltalk.withContext(function($ctx2) {
  3367. return "hello"._at_put_((1),"a");
  3368. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3369. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  3370. args: [],
  3371. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  3372. messageSends: ["should:raise:", "at:put:"],
  3373. referencedClasses: ["Error"]
  3374. }),
  3375. smalltalk.StringTest);
  3376. smalltalk.addMethod(
  3377. smalltalk.method({
  3378. selector: "testCapitalized",
  3379. protocol: 'tests',
  3380. fn: function (){
  3381. var self=this;
  3382. return smalltalk.withContext(function($ctx1) {
  3383. var $1,$2,$3;
  3384. $1="test"._capitalized();
  3385. $ctx1.sendIdx["capitalized"]=1;
  3386. self._assert_equals_($1,"Test");
  3387. $ctx1.sendIdx["assert:equals:"]=1;
  3388. $2="Test"._capitalized();
  3389. $ctx1.sendIdx["capitalized"]=2;
  3390. self._assert_equals_($2,"Test");
  3391. $ctx1.sendIdx["assert:equals:"]=2;
  3392. self._assert_equals_(""._capitalized(),"");
  3393. $ctx1.sendIdx["assert:equals:"]=3;
  3394. $3="Test"._isCapitalized();
  3395. $ctx1.sendIdx["isCapitalized"]=1;
  3396. self._assert_equals_($3,true);
  3397. $ctx1.sendIdx["assert:equals:"]=4;
  3398. self._assert_equals_("test"._isCapitalized(),false);
  3399. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  3400. args: [],
  3401. 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.",
  3402. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  3403. referencedClasses: []
  3404. }),
  3405. smalltalk.StringTest);
  3406. smalltalk.addMethod(
  3407. smalltalk.method({
  3408. selector: "testCharCodeAt",
  3409. protocol: 'tests',
  3410. fn: function (){
  3411. var self=this;
  3412. return smalltalk.withContext(function($ctx1) {
  3413. var $1,$2,$3,$4,$5;
  3414. $1="jackie"._charCodeAt_((1));
  3415. $ctx1.sendIdx["charCodeAt:"]=1;
  3416. self._assert_equals_($1,(106));
  3417. $ctx1.sendIdx["assert:equals:"]=1;
  3418. $2="jackie"._charCodeAt_((2));
  3419. $ctx1.sendIdx["charCodeAt:"]=2;
  3420. self._assert_equals_($2,(97));
  3421. $ctx1.sendIdx["assert:equals:"]=2;
  3422. $3="jackie"._charCodeAt_((3));
  3423. $ctx1.sendIdx["charCodeAt:"]=3;
  3424. self._assert_equals_($3,(99));
  3425. $ctx1.sendIdx["assert:equals:"]=3;
  3426. $4="jackie"._charCodeAt_((4));
  3427. $ctx1.sendIdx["charCodeAt:"]=4;
  3428. self._assert_equals_($4,(107));
  3429. $ctx1.sendIdx["assert:equals:"]=4;
  3430. $5="jackie"._charCodeAt_((5));
  3431. $ctx1.sendIdx["charCodeAt:"]=5;
  3432. self._assert_equals_($5,(105));
  3433. $ctx1.sendIdx["assert:equals:"]=5;
  3434. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  3435. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  3436. args: [],
  3437. 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",
  3438. messageSends: ["assert:equals:", "charCodeAt:"],
  3439. referencedClasses: []
  3440. }),
  3441. smalltalk.StringTest);
  3442. smalltalk.addMethod(
  3443. smalltalk.method({
  3444. selector: "testCollect",
  3445. protocol: 'tests',
  3446. fn: function (){
  3447. var self=this;
  3448. var newCollection;
  3449. return smalltalk.withContext(function($ctx1) {
  3450. newCollection="hheelllloo";
  3451. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  3452. return smalltalk.withContext(function($ctx2) {
  3453. return _st(each).__comma(each);
  3454. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3455. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  3456. args: [],
  3457. source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := 'hheelllloo'.\x0a\x09self\x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each, each ])\x0a\x09\x09as: newCollection",
  3458. messageSends: ["assertSameContents:as:", "collect:", "collection", ","],
  3459. referencedClasses: []
  3460. }),
  3461. smalltalk.StringTest);
  3462. smalltalk.addMethod(
  3463. smalltalk.method({
  3464. selector: "testCopyFromTo",
  3465. protocol: 'tests',
  3466. fn: function (){
  3467. var self=this;
  3468. return smalltalk.withContext(function($ctx1) {
  3469. var $1;
  3470. $1="jackie"._copyFrom_to_((1),(3));
  3471. $ctx1.sendIdx["copyFrom:to:"]=1;
  3472. self._assert_equals_($1,"jac");
  3473. $ctx1.sendIdx["assert:equals:"]=1;
  3474. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  3475. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  3476. args: [],
  3477. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  3478. messageSends: ["assert:equals:", "copyFrom:to:"],
  3479. referencedClasses: []
  3480. }),
  3481. smalltalk.StringTest);
  3482. smalltalk.addMethod(
  3483. smalltalk.method({
  3484. selector: "testCopyWithoutAll",
  3485. protocol: 'tests',
  3486. fn: function (){
  3487. var self=this;
  3488. return smalltalk.withContext(function($ctx1) {
  3489. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  3490. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  3491. args: [],
  3492. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  3493. messageSends: ["assert:equals:", "copyWithoutAll:"],
  3494. referencedClasses: []
  3495. }),
  3496. smalltalk.StringTest);
  3497. smalltalk.addMethod(
  3498. smalltalk.method({
  3499. selector: "testDetect",
  3500. protocol: 'tests',
  3501. fn: function (){
  3502. var self=this;
  3503. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3504. return smalltalk.withContext(function($ctx1) {
  3505. var $2,$1;
  3506. $2=self._collection();
  3507. $ctx1.sendIdx["collection"]=1;
  3508. $1=_st($2)._detect_((function(each){
  3509. return smalltalk.withContext(function($ctx2) {
  3510. return _st(each).__eq("h");
  3511. $ctx2.sendIdx["="]=1;
  3512. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  3513. $ctx1.sendIdx["detect:"]=1;
  3514. self._assert_equals_($1,"h");
  3515. self._should_raise_((function(){
  3516. return smalltalk.withContext(function($ctx2) {
  3517. return _st(self._collection())._detect_((function(each){
  3518. return smalltalk.withContext(function($ctx3) {
  3519. return _st(each).__eq((6));
  3520. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  3521. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3522. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  3523. args: [],
  3524. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each = 'h' ]) equals: 'h'.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
  3525. messageSends: ["assert:equals:", "detect:", "collection", "=", "should:raise:"],
  3526. referencedClasses: ["Error"]
  3527. }),
  3528. smalltalk.StringTest);
  3529. smalltalk.addMethod(
  3530. smalltalk.method({
  3531. selector: "testEquality",
  3532. protocol: 'tests',
  3533. fn: function (){
  3534. var self=this;
  3535. return smalltalk.withContext(function($ctx1) {
  3536. var $1,$2,$3;
  3537. self._assert_equals_("hello","hello");
  3538. $ctx1.sendIdx["assert:equals:"]=1;
  3539. $1="hello".__eq("world");
  3540. $ctx1.sendIdx["="]=1;
  3541. self._deny_($1);
  3542. $ctx1.sendIdx["deny:"]=1;
  3543. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  3544. return smalltalk.withContext(function($ctx2) {
  3545. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  3546. $ctx1.sendIdx["="]=2;
  3547. self._deny_($2);
  3548. $ctx1.sendIdx["deny:"]=2;
  3549. $3="hello"._yourself();
  3550. $ctx1.sendIdx["yourself"]=1;
  3551. self._assert_equals_("hello",$3);
  3552. $ctx1.sendIdx["assert:equals:"]=2;
  3553. self._assert_equals_("hello"._yourself(),"hello");
  3554. self._deny_("".__eq((0)));
  3555. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  3556. args: [],
  3557. 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",
  3558. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  3559. referencedClasses: []
  3560. }),
  3561. smalltalk.StringTest);
  3562. smalltalk.addMethod(
  3563. smalltalk.method({
  3564. selector: "testIdentity",
  3565. protocol: 'tests',
  3566. fn: function (){
  3567. var self=this;
  3568. return smalltalk.withContext(function($ctx1) {
  3569. var $1,$2,$4,$3,$5;
  3570. $1="hello".__eq_eq("hello");
  3571. $ctx1.sendIdx["=="]=1;
  3572. self._assert_($1);
  3573. $ctx1.sendIdx["assert:"]=1;
  3574. $2="hello".__eq_eq("world");
  3575. $ctx1.sendIdx["=="]=2;
  3576. self._deny_($2);
  3577. $ctx1.sendIdx["deny:"]=1;
  3578. $4="hello"._yourself();
  3579. $ctx1.sendIdx["yourself"]=1;
  3580. $3="hello".__eq_eq($4);
  3581. $ctx1.sendIdx["=="]=3;
  3582. self._assert_($3);
  3583. $ctx1.sendIdx["assert:"]=2;
  3584. $5=_st("hello"._yourself()).__eq_eq("hello");
  3585. $ctx1.sendIdx["=="]=4;
  3586. self._assert_($5);
  3587. self._deny_("".__eq_eq((0)));
  3588. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  3589. args: [],
  3590. 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",
  3591. messageSends: ["assert:", "==", "deny:", "yourself"],
  3592. referencedClasses: []
  3593. }),
  3594. smalltalk.StringTest);
  3595. smalltalk.addMethod(
  3596. smalltalk.method({
  3597. selector: "testIdentityHash",
  3598. protocol: 'tests',
  3599. fn: function (){
  3600. var self=this;
  3601. return smalltalk.withContext(function($ctx1) {
  3602. var $1,$2,$4,$3;
  3603. $1="foo"._identityHash();
  3604. $ctx1.sendIdx["identityHash"]=1;
  3605. $2="foo"._identityHash();
  3606. $ctx1.sendIdx["identityHash"]=2;
  3607. self._assert_equals_($1,$2);
  3608. $4="foo"._identityHash();
  3609. $ctx1.sendIdx["identityHash"]=3;
  3610. $3=_st($4).__eq("bar"._identityHash());
  3611. self._deny_($3);
  3612. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  3613. args: [],
  3614. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  3615. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  3616. referencedClasses: []
  3617. }),
  3618. smalltalk.StringTest);
  3619. smalltalk.addMethod(
  3620. smalltalk.method({
  3621. selector: "testIncludesSubString",
  3622. protocol: 'tests',
  3623. fn: function (){
  3624. var self=this;
  3625. return smalltalk.withContext(function($ctx1) {
  3626. var $1;
  3627. $1="amber"._includesSubString_("ber");
  3628. $ctx1.sendIdx["includesSubString:"]=1;
  3629. self._assert_($1);
  3630. self._deny_("amber"._includesSubString_("zork"));
  3631. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  3632. args: [],
  3633. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  3634. messageSends: ["assert:", "includesSubString:", "deny:"],
  3635. referencedClasses: []
  3636. }),
  3637. smalltalk.StringTest);
  3638. smalltalk.addMethod(
  3639. smalltalk.method({
  3640. selector: "testIndexOf",
  3641. protocol: 'tests',
  3642. fn: function (){
  3643. var self=this;
  3644. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3645. return smalltalk.withContext(function($ctx1) {
  3646. var $2,$1,$3;
  3647. $2=self._collection();
  3648. $ctx1.sendIdx["collection"]=1;
  3649. $1=_st($2)._indexOf_("e");
  3650. $ctx1.sendIdx["indexOf:"]=1;
  3651. self._assert_equals_($1,(2));
  3652. $ctx1.sendIdx["assert:equals:"]=1;
  3653. self._should_raise_((function(){
  3654. return smalltalk.withContext(function($ctx2) {
  3655. $3=self._collection();
  3656. $ctx2.sendIdx["collection"]=2;
  3657. return _st($3)._indexOf_((999));
  3658. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3659. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  3660. return smalltalk.withContext(function($ctx2) {
  3661. return "sentinel";
  3662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  3663. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.StringTest)})},
  3664. args: [],
  3665. source: "testIndexOf\x0a\x09self assert: (self collection indexOf: 'e') equals: 2.\x0a\x09self should: [ self collection indexOf: 999 ] raise: Error.\x0a\x09self assert: (self collection indexOf: 999 ifAbsent: [ 'sentinel' ]) equals: 'sentinel'",
  3666. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  3667. referencedClasses: ["Error"]
  3668. }),
  3669. smalltalk.StringTest);
  3670. smalltalk.addMethod(
  3671. smalltalk.method({
  3672. selector: "testIsVowel",
  3673. protocol: 'tests',
  3674. fn: function (){
  3675. var self=this;
  3676. var vowel,consonant;
  3677. return smalltalk.withContext(function($ctx1) {
  3678. var $1;
  3679. vowel="u";
  3680. consonant="z";
  3681. $1=_st(vowel)._isVowel();
  3682. $ctx1.sendIdx["isVowel"]=1;
  3683. self._assert_equals_($1,true);
  3684. $ctx1.sendIdx["assert:equals:"]=1;
  3685. self._assert_equals_(_st(consonant)._isVowel(),false);
  3686. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  3687. args: [],
  3688. 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",
  3689. messageSends: ["assert:equals:", "isVowel"],
  3690. referencedClasses: []
  3691. }),
  3692. smalltalk.StringTest);
  3693. smalltalk.addMethod(
  3694. smalltalk.method({
  3695. selector: "testJoin",
  3696. protocol: 'tests',
  3697. fn: function (){
  3698. var self=this;
  3699. return smalltalk.withContext(function($ctx1) {
  3700. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  3701. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  3702. args: [],
  3703. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  3704. messageSends: ["assert:equals:", "join:"],
  3705. referencedClasses: []
  3706. }),
  3707. smalltalk.StringTest);
  3708. smalltalk.addMethod(
  3709. smalltalk.method({
  3710. selector: "testRemoveAll",
  3711. protocol: 'tests',
  3712. fn: function (){
  3713. var self=this;
  3714. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3715. return smalltalk.withContext(function($ctx1) {
  3716. self._should_raise_((function(){
  3717. return smalltalk.withContext(function($ctx2) {
  3718. return _st(self._collection())._removeAll();
  3719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3720. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  3721. args: [],
  3722. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  3723. messageSends: ["should:raise:", "removeAll", "collection"],
  3724. referencedClasses: ["Error"]
  3725. }),
  3726. smalltalk.StringTest);
  3727. smalltalk.addMethod(
  3728. smalltalk.method({
  3729. selector: "testReversed",
  3730. protocol: 'tests',
  3731. fn: function (){
  3732. var self=this;
  3733. return smalltalk.withContext(function($ctx1) {
  3734. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  3735. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  3736. args: [],
  3737. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  3738. messageSends: ["assert:equals:", "reversed"],
  3739. referencedClasses: []
  3740. }),
  3741. smalltalk.StringTest);
  3742. smalltalk.addMethod(
  3743. smalltalk.method({
  3744. selector: "testSelect",
  3745. protocol: 'tests',
  3746. fn: function (){
  3747. var self=this;
  3748. var newCollection;
  3749. return smalltalk.withContext(function($ctx1) {
  3750. newCollection="o";
  3751. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  3752. return smalltalk.withContext(function($ctx2) {
  3753. return _st(each).__eq("o");
  3754. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3755. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  3756. args: [],
  3757. source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := 'o'.\x0a\x09self\x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each = 'o' ])\x0a\x09\x09as: newCollection",
  3758. messageSends: ["assertSameContents:as:", "select:", "collection", "="],
  3759. referencedClasses: []
  3760. }),
  3761. smalltalk.StringTest);
  3762. smalltalk.addMethod(
  3763. smalltalk.method({
  3764. selector: "testSize",
  3765. protocol: 'tests',
  3766. fn: function (){
  3767. var self=this;
  3768. return smalltalk.withContext(function($ctx1) {
  3769. var $1;
  3770. $1="smalltalk"._size();
  3771. $ctx1.sendIdx["size"]=1;
  3772. self._assert_equals_($1,(9));
  3773. $ctx1.sendIdx["assert:equals:"]=1;
  3774. self._assert_equals_(""._size(),(0));
  3775. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  3776. args: [],
  3777. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  3778. messageSends: ["assert:equals:", "size"],
  3779. referencedClasses: []
  3780. }),
  3781. smalltalk.StringTest);
  3782. smalltalk.addMethod(
  3783. smalltalk.method({
  3784. selector: "testStreamContents",
  3785. protocol: 'tests',
  3786. fn: function (){
  3787. var self=this;
  3788. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3789. return smalltalk.withContext(function($ctx1) {
  3790. var $1;
  3791. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  3792. return smalltalk.withContext(function($ctx2) {
  3793. _st(aStream)._nextPutAll_("hello");
  3794. $ctx2.sendIdx["nextPutAll:"]=1;
  3795. _st(aStream)._space();
  3796. $1=_st(aStream)._nextPutAll_("world");
  3797. return $1;
  3798. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  3799. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  3800. args: [],
  3801. 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'",
  3802. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  3803. referencedClasses: ["String"]
  3804. }),
  3805. smalltalk.StringTest);
  3806. smalltalk.addMethod(
  3807. smalltalk.method({
  3808. selector: "testSubStrings",
  3809. protocol: 'tests',
  3810. fn: function (){
  3811. var self=this;
  3812. return smalltalk.withContext(function($ctx1) {
  3813. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  3814. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  3815. args: [],
  3816. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  3817. messageSends: ["assert:equals:", "subStrings:"],
  3818. referencedClasses: []
  3819. }),
  3820. smalltalk.StringTest);
  3821. smalltalk.addMethod(
  3822. smalltalk.method({
  3823. selector: "testTrim",
  3824. protocol: 'tests',
  3825. fn: function (){
  3826. var self=this;
  3827. return smalltalk.withContext(function($ctx1) {
  3828. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  3829. $ctx1.sendIdx["assert:equals:"]=1;
  3830. self._assert_equals_("jackie "._trimRight(),"jackie");
  3831. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  3832. args: [],
  3833. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  3834. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  3835. referencedClasses: []
  3836. }),
  3837. smalltalk.StringTest);
  3838. smalltalk.addMethod(
  3839. smalltalk.method({
  3840. selector: "collectionClass",
  3841. protocol: 'accessing',
  3842. fn: function (){
  3843. var self=this;
  3844. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3845. return smalltalk.withContext(function($ctx1) {
  3846. return $String();
  3847. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  3848. args: [],
  3849. source: "collectionClass\x0a\x09^ String",
  3850. messageSends: [],
  3851. referencedClasses: ["String"]
  3852. }),
  3853. smalltalk.StringTest.klass);
  3854. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3855. smalltalk.addMethod(
  3856. smalltalk.method({
  3857. selector: "testShow",
  3858. protocol: 'tests',
  3859. fn: function (){
  3860. var self=this;
  3861. var originalTranscript;
  3862. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  3863. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  3864. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3865. return smalltalk.withContext(function($ctx1) {
  3866. originalTranscript=_st($Transcript())._current();
  3867. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  3868. $ctx1.sendIdx["register:"]=1;
  3869. self._shouldnt_raise_((function(){
  3870. return smalltalk.withContext(function($ctx2) {
  3871. return _st($Transcript())._show_("Hello console!");
  3872. $ctx2.sendIdx["show:"]=1;
  3873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3874. $ctx1.sendIdx["shouldnt:raise:"]=1;
  3875. self._shouldnt_raise_((function(){
  3876. return smalltalk.withContext(function($ctx2) {
  3877. return _st($Transcript())._show_(console);
  3878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3879. _st($Transcript())._register_(originalTranscript);
  3880. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  3881. args: [],
  3882. 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.",
  3883. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  3884. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  3885. }),
  3886. smalltalk.ConsoleTranscriptTest);
  3887. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3888. smalltalk.addMethod(
  3889. smalltalk.method({
  3890. selector: "jsObject",
  3891. protocol: 'accessing',
  3892. fn: function (){
  3893. var self=this;
  3894. return smalltalk.withContext(function($ctx1) {
  3895. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  3896. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  3897. args: [],
  3898. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  3899. messageSends: [],
  3900. referencedClasses: []
  3901. }),
  3902. smalltalk.JSObjectProxyTest);
  3903. smalltalk.addMethod(
  3904. smalltalk.method({
  3905. selector: "testAtIfAbsent",
  3906. protocol: 'tests',
  3907. fn: function (){
  3908. var self=this;
  3909. var testObject;
  3910. return smalltalk.withContext(function($ctx1) {
  3911. var $1,$2,$3;
  3912. testObject=self._jsObject();
  3913. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  3914. return smalltalk.withContext(function($ctx2) {
  3915. return "Property does not exist";
  3916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3917. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3918. self._assert_equals_($1,"Property does not exist");
  3919. $ctx1.sendIdx["assert:equals:"]=1;
  3920. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  3921. return smalltalk.withContext(function($ctx2) {
  3922. return "Property does not exist";
  3923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3924. $ctx1.sendIdx["at:ifAbsent:"]=2;
  3925. self._assert_equals_($2,nil);
  3926. $ctx1.sendIdx["assert:equals:"]=2;
  3927. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  3928. return smalltalk.withContext(function($ctx2) {
  3929. return "Property does not exist";
  3930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  3931. $ctx1.sendIdx["at:ifAbsent:"]=3;
  3932. self._assert_equals_($3,(1));
  3933. $ctx1.sendIdx["assert:equals:"]=3;
  3934. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  3935. return smalltalk.withContext(function($ctx2) {
  3936. return "Property does not exist";
  3937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  3938. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3939. args: [],
  3940. 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.",
  3941. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  3942. referencedClasses: []
  3943. }),
  3944. smalltalk.JSObjectProxyTest);
  3945. smalltalk.addMethod(
  3946. smalltalk.method({
  3947. selector: "testAtIfPresent",
  3948. protocol: 'tests',
  3949. fn: function (){
  3950. var self=this;
  3951. var testObject;
  3952. return smalltalk.withContext(function($ctx1) {
  3953. var $2,$1,$4,$3,$6,$5;
  3954. testObject=self._jsObject();
  3955. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  3956. return smalltalk.withContext(function($ctx2) {
  3957. $2=_st(x)._asString();
  3958. $ctx2.sendIdx["asString"]=1;
  3959. return "hello ".__comma($2);
  3960. $ctx2.sendIdx[","]=1;
  3961. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  3962. $ctx1.sendIdx["at:ifPresent:"]=1;
  3963. self._assert_equals_($1,nil);
  3964. $ctx1.sendIdx["assert:equals:"]=1;
  3965. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  3966. return smalltalk.withContext(function($ctx2) {
  3967. $4=_st(x)._asString();
  3968. $ctx2.sendIdx["asString"]=2;
  3969. return "hello ".__comma($4);
  3970. $ctx2.sendIdx[","]=2;
  3971. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  3972. $ctx1.sendIdx["at:ifPresent:"]=2;
  3973. self._assert_equals_($3,"hello nil");
  3974. $ctx1.sendIdx["assert:equals:"]=2;
  3975. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  3976. return smalltalk.withContext(function($ctx2) {
  3977. $6=_st(x)._asString();
  3978. $ctx2.sendIdx["asString"]=3;
  3979. return "hello ".__comma($6);
  3980. $ctx2.sendIdx[","]=3;
  3981. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  3982. $ctx1.sendIdx["at:ifPresent:"]=3;
  3983. self._assert_equals_($5,"hello 1");
  3984. $ctx1.sendIdx["assert:equals:"]=3;
  3985. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  3986. return smalltalk.withContext(function($ctx2) {
  3987. return "hello ".__comma(_st(x)._asString());
  3988. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  3989. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3990. args: [],
  3991. 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'.",
  3992. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  3993. referencedClasses: []
  3994. }),
  3995. smalltalk.JSObjectProxyTest);
  3996. smalltalk.addMethod(
  3997. smalltalk.method({
  3998. selector: "testAtIfPresentIfAbsent",
  3999. protocol: 'tests',
  4000. fn: function (){
  4001. var self=this;
  4002. var testObject;
  4003. return smalltalk.withContext(function($ctx1) {
  4004. var $2,$1,$4,$3,$6,$5;
  4005. testObject=self._jsObject();
  4006. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  4007. return smalltalk.withContext(function($ctx2) {
  4008. $2=_st(x)._asString();
  4009. $ctx2.sendIdx["asString"]=1;
  4010. return "hello ".__comma($2);
  4011. $ctx2.sendIdx[","]=1;
  4012. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  4013. return smalltalk.withContext(function($ctx2) {
  4014. return "not present";
  4015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4016. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  4017. self._assert_equals_($1,"not present");
  4018. $ctx1.sendIdx["assert:equals:"]=1;
  4019. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  4020. return smalltalk.withContext(function($ctx2) {
  4021. $4=_st(x)._asString();
  4022. $ctx2.sendIdx["asString"]=2;
  4023. return "hello ".__comma($4);
  4024. $ctx2.sendIdx[","]=2;
  4025. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  4026. return smalltalk.withContext(function($ctx2) {
  4027. return "not present";
  4028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4029. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  4030. self._assert_equals_($3,"hello nil");
  4031. $ctx1.sendIdx["assert:equals:"]=2;
  4032. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  4033. return smalltalk.withContext(function($ctx2) {
  4034. $6=_st(x)._asString();
  4035. $ctx2.sendIdx["asString"]=3;
  4036. return "hello ".__comma($6);
  4037. $ctx2.sendIdx[","]=3;
  4038. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  4039. return smalltalk.withContext(function($ctx2) {
  4040. return "not present";
  4041. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  4042. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  4043. self._assert_equals_($5,"hello 1");
  4044. $ctx1.sendIdx["assert:equals:"]=3;
  4045. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  4046. return smalltalk.withContext(function($ctx2) {
  4047. return "hello ".__comma(_st(x)._asString());
  4048. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  4049. return smalltalk.withContext(function($ctx2) {
  4050. return "not present";
  4051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  4052. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4053. args: [],
  4054. 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'.",
  4055. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  4056. referencedClasses: []
  4057. }),
  4058. smalltalk.JSObjectProxyTest);
  4059. smalltalk.addMethod(
  4060. smalltalk.method({
  4061. selector: "testAtPut",
  4062. protocol: 'tests',
  4063. fn: function (){
  4064. var self=this;
  4065. var testObject;
  4066. return smalltalk.withContext(function($ctx1) {
  4067. var $2,$1;
  4068. testObject=self._jsObject();
  4069. $2=_st(testObject)._at_("abc");
  4070. $ctx1.sendIdx["at:"]=1;
  4071. $1=_st($2).__tild_eq("xyz");
  4072. self._assert_($1);
  4073. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  4074. $ctx1.sendIdx["assert:equals:"]=1;
  4075. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  4076. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4077. args: [],
  4078. 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'",
  4079. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  4080. referencedClasses: []
  4081. }),
  4082. smalltalk.JSObjectProxyTest);
  4083. smalltalk.addMethod(
  4084. smalltalk.method({
  4085. selector: "testDNU",
  4086. protocol: 'tests',
  4087. fn: function (){
  4088. var self=this;
  4089. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4090. return smalltalk.withContext(function($ctx1) {
  4091. self._should_raise_((function(){
  4092. return smalltalk.withContext(function($ctx2) {
  4093. return _st(self._jsObject())._foo();
  4094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4095. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  4096. args: [],
  4097. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  4098. messageSends: ["should:raise:", "foo", "jsObject"],
  4099. referencedClasses: ["MessageNotUnderstood"]
  4100. }),
  4101. smalltalk.JSObjectProxyTest);
  4102. smalltalk.addMethod(
  4103. smalltalk.method({
  4104. selector: "testMessageSend",
  4105. protocol: 'tests',
  4106. fn: function (){
  4107. var self=this;
  4108. return smalltalk.withContext(function($ctx1) {
  4109. var $2,$1,$4,$3;
  4110. $2=self._jsObject();
  4111. $ctx1.sendIdx["jsObject"]=1;
  4112. $1=_st($2)._a();
  4113. self._assert_equals_($1,(1));
  4114. $ctx1.sendIdx["assert:equals:"]=1;
  4115. $4=self._jsObject();
  4116. $ctx1.sendIdx["jsObject"]=2;
  4117. $3=_st($4)._b();
  4118. self._assert_equals_($3,(2));
  4119. $ctx1.sendIdx["assert:equals:"]=2;
  4120. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  4121. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  4122. args: [],
  4123. 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",
  4124. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  4125. referencedClasses: []
  4126. }),
  4127. smalltalk.JSObjectProxyTest);
  4128. smalltalk.addMethod(
  4129. smalltalk.method({
  4130. selector: "testMethodWithArguments",
  4131. protocol: 'tests',
  4132. fn: function (){
  4133. var self=this;
  4134. return smalltalk.withContext(function($ctx1) {
  4135. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  4136. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  4137. args: [],
  4138. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  4139. messageSends: ["assert:equals:", "c:", "jsObject"],
  4140. referencedClasses: []
  4141. }),
  4142. smalltalk.JSObjectProxyTest);
  4143. smalltalk.addMethod(
  4144. smalltalk.method({
  4145. selector: "testPrinting",
  4146. protocol: 'tests',
  4147. fn: function (){
  4148. var self=this;
  4149. return smalltalk.withContext(function($ctx1) {
  4150. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  4151. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  4152. args: [],
  4153. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  4154. messageSends: ["assert:equals:", "printString", "jsObject"],
  4155. referencedClasses: []
  4156. }),
  4157. smalltalk.JSObjectProxyTest);
  4158. smalltalk.addMethod(
  4159. smalltalk.method({
  4160. selector: "testPropertyThatReturnsEmptyString",
  4161. protocol: 'tests',
  4162. fn: function (){
  4163. var self=this;
  4164. var object;
  4165. return smalltalk.withContext(function($ctx1) {
  4166. var $1;
  4167. object=self._jsObject();
  4168. $1=_st(object)._d();
  4169. $ctx1.sendIdx["d"]=1;
  4170. self._assert_equals_($1,"");
  4171. $ctx1.sendIdx["assert:equals:"]=1;
  4172. _st(object)._d_("hello");
  4173. self._assert_equals_(_st(object)._d(),"hello");
  4174. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  4175. args: [],
  4176. 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'",
  4177. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  4178. referencedClasses: []
  4179. }),
  4180. smalltalk.JSObjectProxyTest);
  4181. smalltalk.addMethod(
  4182. smalltalk.method({
  4183. selector: "testPropertyThatReturnsUndefined",
  4184. protocol: 'tests',
  4185. fn: function (){
  4186. var self=this;
  4187. var object;
  4188. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4189. return smalltalk.withContext(function($ctx1) {
  4190. object=self._jsObject();
  4191. self._shouldnt_raise_((function(){
  4192. return smalltalk.withContext(function($ctx2) {
  4193. return _st(object)._e();
  4194. $ctx2.sendIdx["e"]=1;
  4195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4196. self._assert_(_st(_st(object)._e())._isNil());
  4197. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  4198. args: [],
  4199. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  4200. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  4201. referencedClasses: ["MessageNotUnderstood"]
  4202. }),
  4203. smalltalk.JSObjectProxyTest);
  4204. smalltalk.addMethod(
  4205. smalltalk.method({
  4206. selector: "testValue",
  4207. protocol: 'tests',
  4208. fn: function (){
  4209. var self=this;
  4210. var testObject;
  4211. return smalltalk.withContext(function($ctx1) {
  4212. testObject=self._jsObject();
  4213. _st(testObject)._at_put_("value","aValue");
  4214. self._assert_equals_(_st(testObject)._value(),"aValue");
  4215. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4216. args: [],
  4217. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  4218. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  4219. referencedClasses: []
  4220. }),
  4221. smalltalk.JSObjectProxyTest);
  4222. smalltalk.addMethod(
  4223. smalltalk.method({
  4224. selector: "testYourself",
  4225. protocol: 'tests',
  4226. fn: function (){
  4227. var self=this;
  4228. var object;
  4229. return smalltalk.withContext(function($ctx1) {
  4230. var $1,$2;
  4231. $1=self._jsObject();
  4232. _st($1)._d_("test");
  4233. $2=_st($1)._yourself();
  4234. object=$2;
  4235. self._assert_equals_(_st(object)._d(),"test");
  4236. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  4237. args: [],
  4238. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  4239. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  4240. referencedClasses: []
  4241. }),
  4242. smalltalk.JSObjectProxyTest);
  4243. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4244. smalltalk.addMethod(
  4245. smalltalk.method({
  4246. selector: "testCatchingException",
  4247. protocol: 'tests',
  4248. fn: function (){
  4249. var self=this;
  4250. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4251. return smalltalk.withContext(function($ctx1) {
  4252. _st((function(){
  4253. return smalltalk.withContext(function($ctx2) {
  4254. return self._throwException();
  4255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  4256. return smalltalk.withContext(function($ctx2) {
  4257. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  4258. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  4259. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  4260. args: [],
  4261. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  4262. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  4263. referencedClasses: ["Error"]
  4264. }),
  4265. smalltalk.JavaScriptExceptionTest);
  4266. smalltalk.addMethod(
  4267. smalltalk.method({
  4268. selector: "testRaisingException",
  4269. protocol: 'tests',
  4270. fn: function (){
  4271. var self=this;
  4272. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  4273. return smalltalk.withContext(function($ctx1) {
  4274. self._should_raise_((function(){
  4275. return smalltalk.withContext(function($ctx2) {
  4276. return self._throwException();
  4277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  4278. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  4279. args: [],
  4280. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  4281. messageSends: ["should:raise:", "throwException"],
  4282. referencedClasses: ["JavaScriptException"]
  4283. }),
  4284. smalltalk.JavaScriptExceptionTest);
  4285. smalltalk.addMethod(
  4286. smalltalk.method({
  4287. selector: "throwException",
  4288. protocol: 'helpers',
  4289. fn: function (){
  4290. var self=this;
  4291. return smalltalk.withContext(function($ctx1) {
  4292. throw 'test';
  4293. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  4294. args: [],
  4295. source: "throwException\x0a\x09<throw 'test'>",
  4296. messageSends: [],
  4297. referencedClasses: []
  4298. }),
  4299. smalltalk.JavaScriptExceptionTest);
  4300. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4301. smalltalk.addMethod(
  4302. smalltalk.method({
  4303. selector: "testValue",
  4304. protocol: 'tests',
  4305. fn: function (){
  4306. var self=this;
  4307. var messageSend;
  4308. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4309. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4310. return smalltalk.withContext(function($ctx1) {
  4311. var $1,$2;
  4312. $1=_st($MessageSend())._new();
  4313. $ctx1.sendIdx["new"]=1;
  4314. _st($1)._receiver_(_st($Object())._new());
  4315. _st($1)._selector_("asString");
  4316. $2=_st($1)._yourself();
  4317. messageSend=$2;
  4318. self._assert_equals_(_st(messageSend)._value(),"an Object");
  4319. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4320. args: [],
  4321. 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'",
  4322. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  4323. referencedClasses: ["MessageSend", "Object"]
  4324. }),
  4325. smalltalk.MessageSendTest);
  4326. smalltalk.addMethod(
  4327. smalltalk.method({
  4328. selector: "testValueWithArguments",
  4329. protocol: 'tests',
  4330. fn: function (){
  4331. var self=this;
  4332. var messageSend;
  4333. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4334. return smalltalk.withContext(function($ctx1) {
  4335. var $1,$2;
  4336. $1=_st($MessageSend())._new();
  4337. _st($1)._receiver_((2));
  4338. _st($1)._selector_("+");
  4339. $2=_st($1)._yourself();
  4340. messageSend=$2;
  4341. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  4342. $ctx1.sendIdx["assert:equals:"]=1;
  4343. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  4344. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4345. args: [],
  4346. 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",
  4347. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  4348. referencedClasses: ["MessageSend"]
  4349. }),
  4350. smalltalk.MessageSendTest);
  4351. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  4352. smalltalk.addMethod(
  4353. smalltalk.method({
  4354. selector: "codeGeneratorClass",
  4355. protocol: 'accessing',
  4356. fn: function (){
  4357. var self=this;
  4358. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  4359. return smalltalk.withContext(function($ctx1) {
  4360. return $CodeGenerator();
  4361. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  4362. args: [],
  4363. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  4364. messageSends: [],
  4365. referencedClasses: ["CodeGenerator"]
  4366. }),
  4367. smalltalk.MethodInheritanceTest);
  4368. smalltalk.addMethod(
  4369. smalltalk.method({
  4370. selector: "compiler",
  4371. protocol: 'factory',
  4372. fn: function (){
  4373. var self=this;
  4374. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  4375. return smalltalk.withContext(function($ctx1) {
  4376. var $2,$3,$1;
  4377. $2=_st($Compiler())._new();
  4378. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  4379. $3=_st($2)._yourself();
  4380. $1=$3;
  4381. return $1;
  4382. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  4383. args: [],
  4384. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  4385. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  4386. referencedClasses: ["Compiler"]
  4387. }),
  4388. smalltalk.MethodInheritanceTest);
  4389. smalltalk.addMethod(
  4390. smalltalk.method({
  4391. selector: "deinstallBottom",
  4392. protocol: 'testing',
  4393. fn: function (){
  4394. var self=this;
  4395. return smalltalk.withContext(function($ctx1) {
  4396. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  4397. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  4398. args: [],
  4399. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  4400. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  4401. referencedClasses: []
  4402. }),
  4403. smalltalk.MethodInheritanceTest);
  4404. smalltalk.addMethod(
  4405. smalltalk.method({
  4406. selector: "deinstallMiddle",
  4407. protocol: 'testing',
  4408. fn: function (){
  4409. var self=this;
  4410. return smalltalk.withContext(function($ctx1) {
  4411. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  4412. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  4413. args: [],
  4414. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  4415. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  4416. referencedClasses: []
  4417. }),
  4418. smalltalk.MethodInheritanceTest);
  4419. smalltalk.addMethod(
  4420. smalltalk.method({
  4421. selector: "deinstallTop",
  4422. protocol: 'testing',
  4423. fn: function (){
  4424. var self=this;
  4425. return smalltalk.withContext(function($ctx1) {
  4426. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  4427. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  4428. args: [],
  4429. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  4430. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  4431. referencedClasses: []
  4432. }),
  4433. smalltalk.MethodInheritanceTest);
  4434. smalltalk.addMethod(
  4435. smalltalk.method({
  4436. selector: "installBottom:",
  4437. protocol: 'testing',
  4438. fn: function (aString){
  4439. var self=this;
  4440. return smalltalk.withContext(function($ctx1) {
  4441. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  4442. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4443. args: ["aString"],
  4444. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  4445. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  4446. referencedClasses: []
  4447. }),
  4448. smalltalk.MethodInheritanceTest);
  4449. smalltalk.addMethod(
  4450. smalltalk.method({
  4451. selector: "installMiddle:",
  4452. protocol: 'testing',
  4453. fn: function (aString){
  4454. var self=this;
  4455. return smalltalk.withContext(function($ctx1) {
  4456. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  4457. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4458. args: ["aString"],
  4459. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  4460. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  4461. referencedClasses: []
  4462. }),
  4463. smalltalk.MethodInheritanceTest);
  4464. smalltalk.addMethod(
  4465. smalltalk.method({
  4466. selector: "installTop:",
  4467. protocol: 'testing',
  4468. fn: function (aString){
  4469. var self=this;
  4470. return smalltalk.withContext(function($ctx1) {
  4471. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  4472. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4473. args: ["aString"],
  4474. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  4475. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  4476. referencedClasses: []
  4477. }),
  4478. smalltalk.MethodInheritanceTest);
  4479. smalltalk.addMethod(
  4480. smalltalk.method({
  4481. selector: "setUp",
  4482. protocol: 'initialization',
  4483. fn: function (){
  4484. var self=this;
  4485. return smalltalk.withContext(function($ctx1) {
  4486. self["@receiverTop"]=_st(self._targetClassTop())._new();
  4487. $ctx1.sendIdx["new"]=1;
  4488. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  4489. $ctx1.sendIdx["new"]=2;
  4490. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  4491. self["@method"]=nil;
  4492. self["@performBlock"]=(function(){
  4493. return smalltalk.withContext(function($ctx2) {
  4494. return self._error_("performBlock not initialized");
  4495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  4496. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  4497. args: [],
  4498. 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' ]",
  4499. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  4500. referencedClasses: []
  4501. }),
  4502. smalltalk.MethodInheritanceTest);
  4503. smalltalk.addMethod(
  4504. smalltalk.method({
  4505. selector: "shouldMNU",
  4506. protocol: 'testing',
  4507. fn: function (){
  4508. var self=this;
  4509. return smalltalk.withContext(function($ctx1) {
  4510. self._shouldMNUTop();
  4511. self._shouldMNUMiddle();
  4512. self._shouldMNUBottom();
  4513. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  4514. args: [],
  4515. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  4516. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  4517. referencedClasses: []
  4518. }),
  4519. smalltalk.MethodInheritanceTest);
  4520. smalltalk.addMethod(
  4521. smalltalk.method({
  4522. selector: "shouldMNUBottom",
  4523. protocol: 'testing',
  4524. fn: function (){
  4525. var self=this;
  4526. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4527. return smalltalk.withContext(function($ctx1) {
  4528. self._should_raise_((function(){
  4529. return smalltalk.withContext(function($ctx2) {
  4530. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4532. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  4533. args: [],
  4534. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  4535. messageSends: ["should:raise:", "value:"],
  4536. referencedClasses: ["MessageNotUnderstood"]
  4537. }),
  4538. smalltalk.MethodInheritanceTest);
  4539. smalltalk.addMethod(
  4540. smalltalk.method({
  4541. selector: "shouldMNUMiddle",
  4542. protocol: 'testing',
  4543. fn: function (){
  4544. var self=this;
  4545. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4546. return smalltalk.withContext(function($ctx1) {
  4547. self._should_raise_((function(){
  4548. return smalltalk.withContext(function($ctx2) {
  4549. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4550. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4551. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  4552. args: [],
  4553. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  4554. messageSends: ["should:raise:", "value:"],
  4555. referencedClasses: ["MessageNotUnderstood"]
  4556. }),
  4557. smalltalk.MethodInheritanceTest);
  4558. smalltalk.addMethod(
  4559. smalltalk.method({
  4560. selector: "shouldMNUTop",
  4561. protocol: 'testing',
  4562. fn: function (){
  4563. var self=this;
  4564. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4565. return smalltalk.withContext(function($ctx1) {
  4566. self._should_raise_((function(){
  4567. return smalltalk.withContext(function($ctx2) {
  4568. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  4569. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4570. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  4571. args: [],
  4572. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  4573. messageSends: ["should:raise:", "value:"],
  4574. referencedClasses: ["MessageNotUnderstood"]
  4575. }),
  4576. smalltalk.MethodInheritanceTest);
  4577. smalltalk.addMethod(
  4578. smalltalk.method({
  4579. selector: "shouldReturn:",
  4580. protocol: 'testing',
  4581. fn: function (anObject){
  4582. var self=this;
  4583. var result;
  4584. return smalltalk.withContext(function($ctx1) {
  4585. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4586. $ctx1.sendIdx["value:"]=1;
  4587. self._assert_equals_(["top",anObject],["top",result]);
  4588. $ctx1.sendIdx["assert:equals:"]=1;
  4589. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4590. $ctx1.sendIdx["value:"]=2;
  4591. self._assert_equals_(["middle",anObject],["middle",result]);
  4592. $ctx1.sendIdx["assert:equals:"]=2;
  4593. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4594. self._assert_equals_(["bottom",anObject],["bottom",result]);
  4595. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  4596. args: ["anObject"],
  4597. 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 }",
  4598. messageSends: ["value:", "assert:equals:"],
  4599. referencedClasses: []
  4600. }),
  4601. smalltalk.MethodInheritanceTest);
  4602. smalltalk.addMethod(
  4603. smalltalk.method({
  4604. selector: "shouldReturn:and:and:",
  4605. protocol: 'testing',
  4606. fn: function (anObject,anObject2,anObject3){
  4607. var self=this;
  4608. var result;
  4609. return smalltalk.withContext(function($ctx1) {
  4610. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4611. $ctx1.sendIdx["value:"]=1;
  4612. self._assert_equals_(["top",anObject],["top",result]);
  4613. $ctx1.sendIdx["assert:equals:"]=1;
  4614. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4615. $ctx1.sendIdx["value:"]=2;
  4616. self._assert_equals_(["middle",anObject2],["middle",result]);
  4617. $ctx1.sendIdx["assert:equals:"]=2;
  4618. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4619. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  4620. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  4621. args: ["anObject", "anObject2", "anObject3"],
  4622. 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 }",
  4623. messageSends: ["value:", "assert:equals:"],
  4624. referencedClasses: []
  4625. }),
  4626. smalltalk.MethodInheritanceTest);
  4627. smalltalk.addMethod(
  4628. smalltalk.method({
  4629. selector: "targetClassBottom",
  4630. protocol: 'accessing',
  4631. fn: function (){
  4632. var self=this;
  4633. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  4634. return smalltalk.withContext(function($ctx1) {
  4635. return $JavaScriptException();
  4636. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  4637. args: [],
  4638. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  4639. messageSends: [],
  4640. referencedClasses: ["JavaScriptException"]
  4641. }),
  4642. smalltalk.MethodInheritanceTest);
  4643. smalltalk.addMethod(
  4644. smalltalk.method({
  4645. selector: "targetClassMiddle",
  4646. protocol: 'accessing',
  4647. fn: function (){
  4648. var self=this;
  4649. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4650. return smalltalk.withContext(function($ctx1) {
  4651. return $Error();
  4652. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  4653. args: [],
  4654. source: "targetClassMiddle\x0a\x09^ Error",
  4655. messageSends: [],
  4656. referencedClasses: ["Error"]
  4657. }),
  4658. smalltalk.MethodInheritanceTest);
  4659. smalltalk.addMethod(
  4660. smalltalk.method({
  4661. selector: "targetClassTop",
  4662. protocol: 'accessing',
  4663. fn: function (){
  4664. var self=this;
  4665. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4666. return smalltalk.withContext(function($ctx1) {
  4667. return $Object();
  4668. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  4669. args: [],
  4670. source: "targetClassTop\x0a\x09^ Object",
  4671. messageSends: [],
  4672. referencedClasses: ["Object"]
  4673. }),
  4674. smalltalk.MethodInheritanceTest);
  4675. smalltalk.addMethod(
  4676. smalltalk.method({
  4677. selector: "tearDown",
  4678. protocol: 'initialization',
  4679. fn: function (){
  4680. var self=this;
  4681. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4682. return smalltalk.withContext(function($ctx1) {
  4683. _st((function(){
  4684. return smalltalk.withContext(function($ctx2) {
  4685. return self._deinstallTop();
  4686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  4687. return smalltalk.withContext(function($ctx2) {
  4688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4689. $ctx1.sendIdx["on:do:"]=1;
  4690. _st((function(){
  4691. return smalltalk.withContext(function($ctx2) {
  4692. return self._deinstallMiddle();
  4693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  4694. return smalltalk.withContext(function($ctx2) {
  4695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4696. $ctx1.sendIdx["on:do:"]=2;
  4697. _st((function(){
  4698. return smalltalk.withContext(function($ctx2) {
  4699. return self._deinstallBottom();
  4700. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  4701. return smalltalk.withContext(function($ctx2) {
  4702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  4703. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  4704. args: [],
  4705. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  4706. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  4707. referencedClasses: ["Error"]
  4708. }),
  4709. smalltalk.MethodInheritanceTest);
  4710. smalltalk.addMethod(
  4711. smalltalk.method({
  4712. selector: "testMNU11",
  4713. protocol: 'tests',
  4714. fn: function (){
  4715. var self=this;
  4716. return smalltalk.withContext(function($ctx1) {
  4717. self["@performBlock"]=(function(x){
  4718. return smalltalk.withContext(function($ctx2) {
  4719. return _st(x)._foo();
  4720. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4721. self._shouldMNU();
  4722. $ctx1.sendIdx["shouldMNU"]=1;
  4723. self._installTop_("foo ^ false");
  4724. $ctx1.sendIdx["installTop:"]=1;
  4725. self._installTop_("foo ^ true");
  4726. self._deinstallTop();
  4727. self._shouldMNU();
  4728. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  4729. args: [],
  4730. 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",
  4731. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  4732. referencedClasses: []
  4733. }),
  4734. smalltalk.MethodInheritanceTest);
  4735. smalltalk.addMethod(
  4736. smalltalk.method({
  4737. selector: "testMNU22",
  4738. protocol: 'tests',
  4739. fn: function (){
  4740. var self=this;
  4741. return smalltalk.withContext(function($ctx1) {
  4742. self["@performBlock"]=(function(x){
  4743. return smalltalk.withContext(function($ctx2) {
  4744. return _st(x)._foo();
  4745. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4746. self._shouldMNU();
  4747. $ctx1.sendIdx["shouldMNU"]=1;
  4748. self._installMiddle_("foo ^ false");
  4749. $ctx1.sendIdx["installMiddle:"]=1;
  4750. self._installMiddle_("foo ^ true");
  4751. self._deinstallMiddle();
  4752. self._shouldMNU();
  4753. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  4754. args: [],
  4755. 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",
  4756. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  4757. referencedClasses: []
  4758. }),
  4759. smalltalk.MethodInheritanceTest);
  4760. smalltalk.addMethod(
  4761. smalltalk.method({
  4762. selector: "testReturns1",
  4763. protocol: 'tests',
  4764. fn: function (){
  4765. var self=this;
  4766. return smalltalk.withContext(function($ctx1) {
  4767. self["@performBlock"]=(function(x){
  4768. return smalltalk.withContext(function($ctx2) {
  4769. return _st(x)._foo();
  4770. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4771. self._installTop_("foo ^ false");
  4772. $ctx1.sendIdx["installTop:"]=1;
  4773. self._shouldReturn_(false);
  4774. $ctx1.sendIdx["shouldReturn:"]=1;
  4775. self._installTop_("foo ^ true");
  4776. self._shouldReturn_(true);
  4777. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  4778. args: [],
  4779. 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",
  4780. messageSends: ["foo", "installTop:", "shouldReturn:"],
  4781. referencedClasses: []
  4782. }),
  4783. smalltalk.MethodInheritanceTest);
  4784. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4785. smalltalk.addMethod(
  4786. smalltalk.method({
  4787. selector: "testAbs",
  4788. protocol: 'tests',
  4789. fn: function (){
  4790. var self=this;
  4791. return smalltalk.withContext(function($ctx1) {
  4792. var $1;
  4793. $1=(4)._abs();
  4794. $ctx1.sendIdx["abs"]=1;
  4795. self._assert_equals_($1,(4));
  4796. $ctx1.sendIdx["assert:equals:"]=1;
  4797. self._assert_equals_((-4)._abs(),(4));
  4798. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  4799. args: [],
  4800. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  4801. messageSends: ["assert:equals:", "abs"],
  4802. referencedClasses: []
  4803. }),
  4804. smalltalk.NumberTest);
  4805. smalltalk.addMethod(
  4806. smalltalk.method({
  4807. selector: "testArithmetic",
  4808. protocol: 'tests',
  4809. fn: function (){
  4810. var self=this;
  4811. return smalltalk.withContext(function($ctx1) {
  4812. var $1,$2,$3,$5,$4;
  4813. $1=(1.5).__plus((1));
  4814. $ctx1.sendIdx["+"]=1;
  4815. self._assert_equals_($1,(2.5));
  4816. $ctx1.sendIdx["assert:equals:"]=1;
  4817. $2=(2).__minus((1));
  4818. $ctx1.sendIdx["-"]=1;
  4819. self._assert_equals_($2,(1));
  4820. $ctx1.sendIdx["assert:equals:"]=2;
  4821. self._assert_equals_((-2).__minus((1)),(-3));
  4822. $ctx1.sendIdx["assert:equals:"]=3;
  4823. self._assert_equals_((12).__slash((2)),(6));
  4824. $ctx1.sendIdx["assert:equals:"]=4;
  4825. $3=(3).__star((4));
  4826. $ctx1.sendIdx["*"]=1;
  4827. self._assert_equals_($3,(12));
  4828. $ctx1.sendIdx["assert:equals:"]=5;
  4829. self._assert_equals_((7).__slash_slash((2)),(3));
  4830. $ctx1.sendIdx["assert:equals:"]=6;
  4831. self._assert_equals_((7).__backslash_backslash((2)),(1));
  4832. $ctx1.sendIdx["assert:equals:"]=7;
  4833. $5=(1).__plus((2));
  4834. $ctx1.sendIdx["+"]=2;
  4835. $4=_st($5).__star((3));
  4836. $ctx1.sendIdx["*"]=2;
  4837. self._assert_equals_($4,(9));
  4838. $ctx1.sendIdx["assert:equals:"]=8;
  4839. self._assert_equals_((1).__plus((2).__star((3))),(7));
  4840. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  4841. args: [],
  4842. 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",
  4843. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  4844. referencedClasses: []
  4845. }),
  4846. smalltalk.NumberTest);
  4847. smalltalk.addMethod(
  4848. smalltalk.method({
  4849. selector: "testAsNumber",
  4850. protocol: 'tests',
  4851. fn: function (){
  4852. var self=this;
  4853. return smalltalk.withContext(function($ctx1) {
  4854. self._assert_equals_((3)._asNumber(),(3));
  4855. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  4856. args: [],
  4857. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  4858. messageSends: ["assert:equals:", "asNumber"],
  4859. referencedClasses: []
  4860. }),
  4861. smalltalk.NumberTest);
  4862. smalltalk.addMethod(
  4863. smalltalk.method({
  4864. selector: "testCeiling",
  4865. protocol: 'tests',
  4866. fn: function (){
  4867. var self=this;
  4868. return smalltalk.withContext(function($ctx1) {
  4869. var $1,$2;
  4870. $1=(1.2)._ceiling();
  4871. $ctx1.sendIdx["ceiling"]=1;
  4872. self._assert_equals_($1,(2));
  4873. $ctx1.sendIdx["assert:equals:"]=1;
  4874. $2=(-1.2)._ceiling();
  4875. $ctx1.sendIdx["ceiling"]=2;
  4876. self._assert_equals_($2,(-1));
  4877. $ctx1.sendIdx["assert:equals:"]=2;
  4878. self._assert_equals_((1)._ceiling(),(1));
  4879. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  4880. args: [],
  4881. 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.",
  4882. messageSends: ["assert:equals:", "ceiling"],
  4883. referencedClasses: []
  4884. }),
  4885. smalltalk.NumberTest);
  4886. smalltalk.addMethod(
  4887. smalltalk.method({
  4888. selector: "testComparison",
  4889. protocol: 'tests',
  4890. fn: function (){
  4891. var self=this;
  4892. return smalltalk.withContext(function($ctx1) {
  4893. var $1,$2,$3,$4;
  4894. $1=(3).__gt((2));
  4895. $ctx1.sendIdx[">"]=1;
  4896. self._assert_($1);
  4897. $ctx1.sendIdx["assert:"]=1;
  4898. $2=(2).__lt((3));
  4899. $ctx1.sendIdx["<"]=1;
  4900. self._assert_($2);
  4901. $ctx1.sendIdx["assert:"]=2;
  4902. self._deny_((3).__lt((2)));
  4903. $ctx1.sendIdx["deny:"]=1;
  4904. self._deny_((2).__gt((3)));
  4905. $3=(3).__gt_eq((3));
  4906. $ctx1.sendIdx[">="]=1;
  4907. self._assert_($3);
  4908. $ctx1.sendIdx["assert:"]=3;
  4909. self._assert_((3.1).__gt_eq((3)));
  4910. $ctx1.sendIdx["assert:"]=4;
  4911. $4=(3).__lt_eq((3));
  4912. $ctx1.sendIdx["<="]=1;
  4913. self._assert_($4);
  4914. $ctx1.sendIdx["assert:"]=5;
  4915. self._assert_((3).__lt_eq((3.1)));
  4916. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  4917. args: [],
  4918. 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",
  4919. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  4920. referencedClasses: []
  4921. }),
  4922. smalltalk.NumberTest);
  4923. smalltalk.addMethod(
  4924. smalltalk.method({
  4925. selector: "testCopying",
  4926. protocol: 'tests',
  4927. fn: function (){
  4928. var self=this;
  4929. return smalltalk.withContext(function($ctx1) {
  4930. var $1;
  4931. $1=_st((1)._copy()).__eq_eq((1));
  4932. $ctx1.sendIdx["=="]=1;
  4933. self._assert_($1);
  4934. $ctx1.sendIdx["assert:"]=1;
  4935. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  4936. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  4937. args: [],
  4938. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  4939. messageSends: ["assert:", "==", "copy", "deepCopy"],
  4940. referencedClasses: []
  4941. }),
  4942. smalltalk.NumberTest);
  4943. smalltalk.addMethod(
  4944. smalltalk.method({
  4945. selector: "testEquality",
  4946. protocol: 'tests',
  4947. fn: function (){
  4948. var self=this;
  4949. return smalltalk.withContext(function($ctx1) {
  4950. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  4951. $1=(1).__eq((1));
  4952. $ctx1.sendIdx["="]=1;
  4953. self._assert_($1);
  4954. $ctx1.sendIdx["assert:"]=1;
  4955. $2=(0).__eq((0));
  4956. $ctx1.sendIdx["="]=2;
  4957. self._assert_($2);
  4958. $ctx1.sendIdx["assert:"]=2;
  4959. $3=(1).__eq((0));
  4960. $ctx1.sendIdx["="]=3;
  4961. self._deny_($3);
  4962. $ctx1.sendIdx["deny:"]=1;
  4963. $5=(1)._yourself();
  4964. $ctx1.sendIdx["yourself"]=1;
  4965. $4=_st($5).__eq((1));
  4966. $ctx1.sendIdx["="]=4;
  4967. self._assert_($4);
  4968. $ctx1.sendIdx["assert:"]=3;
  4969. $7=(1)._yourself();
  4970. $ctx1.sendIdx["yourself"]=2;
  4971. $6=(1).__eq($7);
  4972. $ctx1.sendIdx["="]=5;
  4973. self._assert_($6);
  4974. $ctx1.sendIdx["assert:"]=4;
  4975. $9=(1)._yourself();
  4976. $ctx1.sendIdx["yourself"]=3;
  4977. $8=_st($9).__eq((1)._yourself());
  4978. $ctx1.sendIdx["="]=6;
  4979. self._assert_($8);
  4980. $10=(0).__eq(false);
  4981. $ctx1.sendIdx["="]=7;
  4982. self._deny_($10);
  4983. $ctx1.sendIdx["deny:"]=2;
  4984. $11=false.__eq((0));
  4985. $ctx1.sendIdx["="]=8;
  4986. self._deny_($11);
  4987. $ctx1.sendIdx["deny:"]=3;
  4988. $12="".__eq((0));
  4989. $ctx1.sendIdx["="]=9;
  4990. self._deny_($12);
  4991. $ctx1.sendIdx["deny:"]=4;
  4992. self._deny_((0).__eq(""));
  4993. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  4994. args: [],
  4995. 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 = ''",
  4996. messageSends: ["assert:", "=", "deny:", "yourself"],
  4997. referencedClasses: []
  4998. }),
  4999. smalltalk.NumberTest);
  5000. smalltalk.addMethod(
  5001. smalltalk.method({
  5002. selector: "testFloor",
  5003. protocol: 'tests',
  5004. fn: function (){
  5005. var self=this;
  5006. return smalltalk.withContext(function($ctx1) {
  5007. var $1,$2;
  5008. $1=(1.2)._floor();
  5009. $ctx1.sendIdx["floor"]=1;
  5010. self._assert_equals_($1,(1));
  5011. $ctx1.sendIdx["assert:equals:"]=1;
  5012. $2=(-1.2)._floor();
  5013. $ctx1.sendIdx["floor"]=2;
  5014. self._assert_equals_($2,(-2));
  5015. $ctx1.sendIdx["assert:equals:"]=2;
  5016. self._assert_equals_((1)._floor(),(1));
  5017. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  5018. args: [],
  5019. 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.",
  5020. messageSends: ["assert:equals:", "floor"],
  5021. referencedClasses: []
  5022. }),
  5023. smalltalk.NumberTest);
  5024. smalltalk.addMethod(
  5025. smalltalk.method({
  5026. selector: "testHexNumbers",
  5027. protocol: 'tests',
  5028. fn: function (){
  5029. var self=this;
  5030. return smalltalk.withContext(function($ctx1) {
  5031. var $1,$2,$3,$4,$5;
  5032. self._assert_equals_((9),(9));
  5033. $ctx1.sendIdx["assert:equals:"]=1;
  5034. $1=(10)._truncated();
  5035. $ctx1.sendIdx["truncated"]=1;
  5036. self._assert_equals_($1,(10));
  5037. $ctx1.sendIdx["assert:equals:"]=2;
  5038. $2=(11)._truncated();
  5039. $ctx1.sendIdx["truncated"]=2;
  5040. self._assert_equals_($2,(11));
  5041. $ctx1.sendIdx["assert:equals:"]=3;
  5042. $3=(12)._truncated();
  5043. $ctx1.sendIdx["truncated"]=3;
  5044. self._assert_equals_($3,(12));
  5045. $ctx1.sendIdx["assert:equals:"]=4;
  5046. $4=(13)._truncated();
  5047. $ctx1.sendIdx["truncated"]=4;
  5048. self._assert_equals_($4,(13));
  5049. $ctx1.sendIdx["assert:equals:"]=5;
  5050. $5=(14)._truncated();
  5051. $ctx1.sendIdx["truncated"]=5;
  5052. self._assert_equals_($5,(14));
  5053. $ctx1.sendIdx["assert:equals:"]=6;
  5054. self._assert_equals_((15)._truncated(),(15));
  5055. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  5056. args: [],
  5057. 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",
  5058. messageSends: ["assert:equals:", "truncated"],
  5059. referencedClasses: []
  5060. }),
  5061. smalltalk.NumberTest);
  5062. smalltalk.addMethod(
  5063. smalltalk.method({
  5064. selector: "testIdentity",
  5065. protocol: 'tests',
  5066. fn: function (){
  5067. var self=this;
  5068. return smalltalk.withContext(function($ctx1) {
  5069. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  5070. $1=(1).__eq_eq((1));
  5071. $ctx1.sendIdx["=="]=1;
  5072. self._assert_($1);
  5073. $ctx1.sendIdx["assert:"]=1;
  5074. $2=(0).__eq_eq((0));
  5075. $ctx1.sendIdx["=="]=2;
  5076. self._assert_($2);
  5077. $ctx1.sendIdx["assert:"]=2;
  5078. $3=(1).__eq_eq((0));
  5079. $ctx1.sendIdx["=="]=3;
  5080. self._deny_($3);
  5081. $ctx1.sendIdx["deny:"]=1;
  5082. $5=(1)._yourself();
  5083. $ctx1.sendIdx["yourself"]=1;
  5084. $4=_st($5).__eq_eq((1));
  5085. $ctx1.sendIdx["=="]=4;
  5086. self._assert_($4);
  5087. $ctx1.sendIdx["assert:"]=3;
  5088. $7=(1)._yourself();
  5089. $ctx1.sendIdx["yourself"]=2;
  5090. $6=(1).__eq_eq($7);
  5091. $ctx1.sendIdx["=="]=5;
  5092. self._assert_($6);
  5093. $ctx1.sendIdx["assert:"]=4;
  5094. $9=(1)._yourself();
  5095. $ctx1.sendIdx["yourself"]=3;
  5096. $8=_st($9).__eq_eq((1)._yourself());
  5097. $ctx1.sendIdx["=="]=6;
  5098. self._assert_($8);
  5099. self._deny_((1).__eq_eq((2)));
  5100. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  5101. args: [],
  5102. 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",
  5103. messageSends: ["assert:", "==", "deny:", "yourself"],
  5104. referencedClasses: []
  5105. }),
  5106. smalltalk.NumberTest);
  5107. smalltalk.addMethod(
  5108. smalltalk.method({
  5109. selector: "testInvalidHexNumbers",
  5110. protocol: 'tests',
  5111. fn: function (){
  5112. var self=this;
  5113. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5114. return smalltalk.withContext(function($ctx1) {
  5115. self._should_raise_((function(){
  5116. return smalltalk.withContext(function($ctx2) {
  5117. return (16)._rG();
  5118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5119. $ctx1.sendIdx["should:raise:"]=1;
  5120. self._should_raise_((function(){
  5121. return smalltalk.withContext(function($ctx2) {
  5122. return (16)._rg();
  5123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  5124. $ctx1.sendIdx["should:raise:"]=2;
  5125. self._should_raise_((function(){
  5126. return smalltalk.withContext(function($ctx2) {
  5127. return (16)._rH();
  5128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  5129. $ctx1.sendIdx["should:raise:"]=3;
  5130. self._should_raise_((function(){
  5131. return smalltalk.withContext(function($ctx2) {
  5132. return (16)._rh();
  5133. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  5134. $ctx1.sendIdx["should:raise:"]=4;
  5135. self._should_raise_((function(){
  5136. return smalltalk.withContext(function($ctx2) {
  5137. return (16)._rI();
  5138. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  5139. $ctx1.sendIdx["should:raise:"]=5;
  5140. self._should_raise_((function(){
  5141. return smalltalk.withContext(function($ctx2) {
  5142. return (16)._ri();
  5143. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  5144. $ctx1.sendIdx["should:raise:"]=6;
  5145. self._should_raise_((function(){
  5146. return smalltalk.withContext(function($ctx2) {
  5147. return (16)._rJ();
  5148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  5149. $ctx1.sendIdx["should:raise:"]=7;
  5150. self._should_raise_((function(){
  5151. return smalltalk.withContext(function($ctx2) {
  5152. return (16)._rj();
  5153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  5154. $ctx1.sendIdx["should:raise:"]=8;
  5155. self._should_raise_((function(){
  5156. return smalltalk.withContext(function($ctx2) {
  5157. return (16)._rK();
  5158. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  5159. $ctx1.sendIdx["should:raise:"]=9;
  5160. self._should_raise_((function(){
  5161. return smalltalk.withContext(function($ctx2) {
  5162. return (16)._rk();
  5163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  5164. $ctx1.sendIdx["should:raise:"]=10;
  5165. self._should_raise_((function(){
  5166. return smalltalk.withContext(function($ctx2) {
  5167. return (16)._rL();
  5168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  5169. $ctx1.sendIdx["should:raise:"]=11;
  5170. self._should_raise_((function(){
  5171. return smalltalk.withContext(function($ctx2) {
  5172. return (16)._rl();
  5173. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  5174. $ctx1.sendIdx["should:raise:"]=12;
  5175. self._should_raise_((function(){
  5176. return smalltalk.withContext(function($ctx2) {
  5177. return (16)._rM();
  5178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  5179. $ctx1.sendIdx["should:raise:"]=13;
  5180. self._should_raise_((function(){
  5181. return smalltalk.withContext(function($ctx2) {
  5182. return (16)._rm();
  5183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  5184. $ctx1.sendIdx["should:raise:"]=14;
  5185. self._should_raise_((function(){
  5186. return smalltalk.withContext(function($ctx2) {
  5187. return (16)._rN();
  5188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  5189. $ctx1.sendIdx["should:raise:"]=15;
  5190. self._should_raise_((function(){
  5191. return smalltalk.withContext(function($ctx2) {
  5192. return (16)._rn();
  5193. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  5194. $ctx1.sendIdx["should:raise:"]=16;
  5195. self._should_raise_((function(){
  5196. return smalltalk.withContext(function($ctx2) {
  5197. return (16)._rO();
  5198. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  5199. $ctx1.sendIdx["should:raise:"]=17;
  5200. self._should_raise_((function(){
  5201. return smalltalk.withContext(function($ctx2) {
  5202. return (16)._ro();
  5203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  5204. $ctx1.sendIdx["should:raise:"]=18;
  5205. self._should_raise_((function(){
  5206. return smalltalk.withContext(function($ctx2) {
  5207. return (16)._rP();
  5208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  5209. $ctx1.sendIdx["should:raise:"]=19;
  5210. self._should_raise_((function(){
  5211. return smalltalk.withContext(function($ctx2) {
  5212. return (16)._rp();
  5213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  5214. $ctx1.sendIdx["should:raise:"]=20;
  5215. self._should_raise_((function(){
  5216. return smalltalk.withContext(function($ctx2) {
  5217. return (16)._rQ();
  5218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  5219. $ctx1.sendIdx["should:raise:"]=21;
  5220. self._should_raise_((function(){
  5221. return smalltalk.withContext(function($ctx2) {
  5222. return (16)._rq();
  5223. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  5224. $ctx1.sendIdx["should:raise:"]=22;
  5225. self._should_raise_((function(){
  5226. return smalltalk.withContext(function($ctx2) {
  5227. return (16)._rR();
  5228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  5229. $ctx1.sendIdx["should:raise:"]=23;
  5230. self._should_raise_((function(){
  5231. return smalltalk.withContext(function($ctx2) {
  5232. return (16)._rr();
  5233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  5234. $ctx1.sendIdx["should:raise:"]=24;
  5235. self._should_raise_((function(){
  5236. return smalltalk.withContext(function($ctx2) {
  5237. return (16)._rS();
  5238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  5239. $ctx1.sendIdx["should:raise:"]=25;
  5240. self._should_raise_((function(){
  5241. return smalltalk.withContext(function($ctx2) {
  5242. return (16)._rs();
  5243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  5244. $ctx1.sendIdx["should:raise:"]=26;
  5245. self._should_raise_((function(){
  5246. return smalltalk.withContext(function($ctx2) {
  5247. return (16)._rT();
  5248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  5249. $ctx1.sendIdx["should:raise:"]=27;
  5250. self._should_raise_((function(){
  5251. return smalltalk.withContext(function($ctx2) {
  5252. return (16)._rt();
  5253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  5254. $ctx1.sendIdx["should:raise:"]=28;
  5255. self._should_raise_((function(){
  5256. return smalltalk.withContext(function($ctx2) {
  5257. return (16)._rU();
  5258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  5259. $ctx1.sendIdx["should:raise:"]=29;
  5260. self._should_raise_((function(){
  5261. return smalltalk.withContext(function($ctx2) {
  5262. return (16)._ru();
  5263. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  5264. $ctx1.sendIdx["should:raise:"]=30;
  5265. self._should_raise_((function(){
  5266. return smalltalk.withContext(function($ctx2) {
  5267. return (16)._rV();
  5268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  5269. $ctx1.sendIdx["should:raise:"]=31;
  5270. self._should_raise_((function(){
  5271. return smalltalk.withContext(function($ctx2) {
  5272. return (16)._rv();
  5273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  5274. $ctx1.sendIdx["should:raise:"]=32;
  5275. self._should_raise_((function(){
  5276. return smalltalk.withContext(function($ctx2) {
  5277. return (16)._rW();
  5278. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  5279. $ctx1.sendIdx["should:raise:"]=33;
  5280. self._should_raise_((function(){
  5281. return smalltalk.withContext(function($ctx2) {
  5282. return (16)._rw();
  5283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  5284. $ctx1.sendIdx["should:raise:"]=34;
  5285. self._should_raise_((function(){
  5286. return smalltalk.withContext(function($ctx2) {
  5287. return (16)._rX();
  5288. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  5289. $ctx1.sendIdx["should:raise:"]=35;
  5290. self._should_raise_((function(){
  5291. return smalltalk.withContext(function($ctx2) {
  5292. return (16)._rx();
  5293. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  5294. $ctx1.sendIdx["should:raise:"]=36;
  5295. self._should_raise_((function(){
  5296. return smalltalk.withContext(function($ctx2) {
  5297. return (16)._rY();
  5298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  5299. $ctx1.sendIdx["should:raise:"]=37;
  5300. self._should_raise_((function(){
  5301. return smalltalk.withContext(function($ctx2) {
  5302. return (16)._ry();
  5303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  5304. $ctx1.sendIdx["should:raise:"]=38;
  5305. self._should_raise_((function(){
  5306. return smalltalk.withContext(function($ctx2) {
  5307. return (16)._rZ();
  5308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  5309. $ctx1.sendIdx["should:raise:"]=39;
  5310. self._should_raise_((function(){
  5311. return smalltalk.withContext(function($ctx2) {
  5312. return (16)._rz();
  5313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  5314. $ctx1.sendIdx["should:raise:"]=40;
  5315. self._should_raise_((function(){
  5316. return smalltalk.withContext(function($ctx2) {
  5317. return (11259375)._Z();
  5318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  5319. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  5320. args: [],
  5321. 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.",
  5322. 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"],
  5323. referencedClasses: ["MessageNotUnderstood"]
  5324. }),
  5325. smalltalk.NumberTest);
  5326. smalltalk.addMethod(
  5327. smalltalk.method({
  5328. selector: "testLog",
  5329. protocol: 'tests',
  5330. fn: function (){
  5331. var self=this;
  5332. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  5333. return smalltalk.withContext(function($ctx1) {
  5334. self._assert_equals_((10000)._log(),(4));
  5335. $ctx1.sendIdx["assert:equals:"]=1;
  5336. self._assert_equals_((512)._log_((2)),(9));
  5337. $ctx1.sendIdx["assert:equals:"]=2;
  5338. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  5339. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  5340. args: [],
  5341. 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.",
  5342. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  5343. referencedClasses: ["Number"]
  5344. }),
  5345. smalltalk.NumberTest);
  5346. smalltalk.addMethod(
  5347. smalltalk.method({
  5348. selector: "testMinMax",
  5349. protocol: 'tests',
  5350. fn: function (){
  5351. var self=this;
  5352. return smalltalk.withContext(function($ctx1) {
  5353. self._assert_equals_((2)._max_((5)),(5));
  5354. $ctx1.sendIdx["assert:equals:"]=1;
  5355. self._assert_equals_((2)._min_((5)),(2));
  5356. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  5357. args: [],
  5358. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  5359. messageSends: ["assert:equals:", "max:", "min:"],
  5360. referencedClasses: []
  5361. }),
  5362. smalltalk.NumberTest);
  5363. smalltalk.addMethod(
  5364. smalltalk.method({
  5365. selector: "testNegated",
  5366. protocol: 'tests',
  5367. fn: function (){
  5368. var self=this;
  5369. return smalltalk.withContext(function($ctx1) {
  5370. var $1;
  5371. $1=(3)._negated();
  5372. $ctx1.sendIdx["negated"]=1;
  5373. self._assert_equals_($1,(-3));
  5374. $ctx1.sendIdx["assert:equals:"]=1;
  5375. self._assert_equals_((-3)._negated(),(3));
  5376. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  5377. args: [],
  5378. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  5379. messageSends: ["assert:equals:", "negated"],
  5380. referencedClasses: []
  5381. }),
  5382. smalltalk.NumberTest);
  5383. smalltalk.addMethod(
  5384. smalltalk.method({
  5385. selector: "testPrintShowingDecimalPlaces",
  5386. protocol: 'tests',
  5387. fn: function (){
  5388. var self=this;
  5389. return smalltalk.withContext(function($ctx1) {
  5390. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  5391. $1=(23)._printShowingDecimalPlaces_((2));
  5392. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  5393. self._assert_equals_($1,"23.00");
  5394. $ctx1.sendIdx["assert:equals:"]=1;
  5395. $2=(23.5698)._printShowingDecimalPlaces_((2));
  5396. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  5397. self._assert_equals_($2,"23.57");
  5398. $ctx1.sendIdx["assert:equals:"]=2;
  5399. $4=(234.567)._negated();
  5400. $ctx1.sendIdx["negated"]=1;
  5401. $3=_st($4)._printShowingDecimalPlaces_((5));
  5402. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  5403. self._assert_equals_($3,"-234.56700");
  5404. $ctx1.sendIdx["assert:equals:"]=3;
  5405. $5=(23.4567)._printShowingDecimalPlaces_((0));
  5406. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  5407. self._assert_equals_($5,"23");
  5408. $ctx1.sendIdx["assert:equals:"]=4;
  5409. $6=(23.5567)._printShowingDecimalPlaces_((0));
  5410. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  5411. self._assert_equals_($6,"24");
  5412. $ctx1.sendIdx["assert:equals:"]=5;
  5413. $8=(23.4567)._negated();
  5414. $ctx1.sendIdx["negated"]=2;
  5415. $7=_st($8)._printShowingDecimalPlaces_((0));
  5416. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  5417. self._assert_equals_($7,"-23");
  5418. $ctx1.sendIdx["assert:equals:"]=6;
  5419. $10=(23.5567)._negated();
  5420. $ctx1.sendIdx["negated"]=3;
  5421. $9=_st($10)._printShowingDecimalPlaces_((0));
  5422. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  5423. self._assert_equals_($9,"-24");
  5424. $ctx1.sendIdx["assert:equals:"]=7;
  5425. $11=(100000000)._printShowingDecimalPlaces_((1));
  5426. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  5427. self._assert_equals_($11,"100000000.0");
  5428. $ctx1.sendIdx["assert:equals:"]=8;
  5429. $12=(0.98)._printShowingDecimalPlaces_((5));
  5430. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  5431. self._assert_equals_($12,"0.98000");
  5432. $ctx1.sendIdx["assert:equals:"]=9;
  5433. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  5434. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  5435. self._assert_equals_($13,"-0.98");
  5436. $ctx1.sendIdx["assert:equals:"]=10;
  5437. $14=(2.567)._printShowingDecimalPlaces_((2));
  5438. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  5439. self._assert_equals_($14,"2.57");
  5440. $ctx1.sendIdx["assert:equals:"]=11;
  5441. $15=(-2.567)._printShowingDecimalPlaces_((2));
  5442. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  5443. self._assert_equals_($15,"-2.57");
  5444. $ctx1.sendIdx["assert:equals:"]=12;
  5445. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  5446. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  5447. args: [],
  5448. 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'.",
  5449. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  5450. referencedClasses: []
  5451. }),
  5452. smalltalk.NumberTest);
  5453. smalltalk.addMethod(
  5454. smalltalk.method({
  5455. selector: "testRaisedTo",
  5456. protocol: 'tests',
  5457. fn: function (){
  5458. var self=this;
  5459. return smalltalk.withContext(function($ctx1) {
  5460. var $1,$2,$3;
  5461. $1=(2)._raisedTo_((4));
  5462. $ctx1.sendIdx["raisedTo:"]=1;
  5463. self._assert_equals_($1,(16));
  5464. $ctx1.sendIdx["assert:equals:"]=1;
  5465. $2=(2)._raisedTo_((0));
  5466. $ctx1.sendIdx["raisedTo:"]=2;
  5467. self._assert_equals_($2,(1));
  5468. $ctx1.sendIdx["assert:equals:"]=2;
  5469. $3=(2)._raisedTo_((-3));
  5470. $ctx1.sendIdx["raisedTo:"]=3;
  5471. self._assert_equals_($3,(0.125));
  5472. $ctx1.sendIdx["assert:equals:"]=3;
  5473. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  5474. $ctx1.sendIdx["assert:equals:"]=4;
  5475. self._assert_equals_((2).__star_star((4)),(16));
  5476. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  5477. args: [],
  5478. 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.",
  5479. messageSends: ["assert:equals:", "raisedTo:", "**"],
  5480. referencedClasses: []
  5481. }),
  5482. smalltalk.NumberTest);
  5483. smalltalk.addMethod(
  5484. smalltalk.method({
  5485. selector: "testRounded",
  5486. protocol: 'tests',
  5487. fn: function (){
  5488. var self=this;
  5489. return smalltalk.withContext(function($ctx1) {
  5490. var $1,$2;
  5491. $1=(3)._rounded();
  5492. $ctx1.sendIdx["rounded"]=1;
  5493. self._assert_equals_($1,(3));
  5494. $ctx1.sendIdx["assert:equals:"]=1;
  5495. $2=(3.212)._rounded();
  5496. $ctx1.sendIdx["rounded"]=2;
  5497. self._assert_equals_($2,(3));
  5498. $ctx1.sendIdx["assert:equals:"]=2;
  5499. self._assert_equals_((3.51)._rounded(),(4));
  5500. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  5501. args: [],
  5502. 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",
  5503. messageSends: ["assert:equals:", "rounded"],
  5504. referencedClasses: []
  5505. }),
  5506. smalltalk.NumberTest);
  5507. smalltalk.addMethod(
  5508. smalltalk.method({
  5509. selector: "testSign",
  5510. protocol: 'tests',
  5511. fn: function (){
  5512. var self=this;
  5513. return smalltalk.withContext(function($ctx1) {
  5514. var $1,$2;
  5515. $1=(5)._sign();
  5516. $ctx1.sendIdx["sign"]=1;
  5517. self._assert_equals_($1,(1));
  5518. $ctx1.sendIdx["assert:equals:"]=1;
  5519. $2=(0)._sign();
  5520. $ctx1.sendIdx["sign"]=2;
  5521. self._assert_equals_($2,(0));
  5522. $ctx1.sendIdx["assert:equals:"]=2;
  5523. self._assert_equals_((-1.4)._sign(),(-1));
  5524. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  5525. args: [],
  5526. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  5527. messageSends: ["assert:equals:", "sign"],
  5528. referencedClasses: []
  5529. }),
  5530. smalltalk.NumberTest);
  5531. smalltalk.addMethod(
  5532. smalltalk.method({
  5533. selector: "testSqrt",
  5534. protocol: 'tests',
  5535. fn: function (){
  5536. var self=this;
  5537. return smalltalk.withContext(function($ctx1) {
  5538. var $1;
  5539. $1=(4)._sqrt();
  5540. $ctx1.sendIdx["sqrt"]=1;
  5541. self._assert_equals_($1,(2));
  5542. $ctx1.sendIdx["assert:equals:"]=1;
  5543. self._assert_equals_((16)._sqrt(),(4));
  5544. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  5545. args: [],
  5546. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  5547. messageSends: ["assert:equals:", "sqrt"],
  5548. referencedClasses: []
  5549. }),
  5550. smalltalk.NumberTest);
  5551. smalltalk.addMethod(
  5552. smalltalk.method({
  5553. selector: "testSquared",
  5554. protocol: 'tests',
  5555. fn: function (){
  5556. var self=this;
  5557. return smalltalk.withContext(function($ctx1) {
  5558. self._assert_equals_((4)._squared(),(16));
  5559. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  5560. args: [],
  5561. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  5562. messageSends: ["assert:equals:", "squared"],
  5563. referencedClasses: []
  5564. }),
  5565. smalltalk.NumberTest);
  5566. smalltalk.addMethod(
  5567. smalltalk.method({
  5568. selector: "testTimesRepeat",
  5569. protocol: 'tests',
  5570. fn: function (){
  5571. var self=this;
  5572. var i;
  5573. return smalltalk.withContext(function($ctx1) {
  5574. i=(0);
  5575. (0)._timesRepeat_((function(){
  5576. return smalltalk.withContext(function($ctx2) {
  5577. i=_st(i).__plus((1));
  5578. $ctx2.sendIdx["+"]=1;
  5579. return i;
  5580. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5581. $ctx1.sendIdx["timesRepeat:"]=1;
  5582. self._assert_equals_(i,(0));
  5583. $ctx1.sendIdx["assert:equals:"]=1;
  5584. (5)._timesRepeat_((function(){
  5585. return smalltalk.withContext(function($ctx2) {
  5586. i=_st(i).__plus((1));
  5587. return i;
  5588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5589. self._assert_equals_(i,(5));
  5590. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  5591. args: [],
  5592. 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",
  5593. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  5594. referencedClasses: []
  5595. }),
  5596. smalltalk.NumberTest);
  5597. smalltalk.addMethod(
  5598. smalltalk.method({
  5599. selector: "testTo",
  5600. protocol: 'tests',
  5601. fn: function (){
  5602. var self=this;
  5603. return smalltalk.withContext(function($ctx1) {
  5604. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  5605. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  5606. args: [],
  5607. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  5608. messageSends: ["assert:equals:", "to:"],
  5609. referencedClasses: []
  5610. }),
  5611. smalltalk.NumberTest);
  5612. smalltalk.addMethod(
  5613. smalltalk.method({
  5614. selector: "testToBy",
  5615. protocol: 'tests',
  5616. fn: function (){
  5617. var self=this;
  5618. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5619. return smalltalk.withContext(function($ctx1) {
  5620. var $1;
  5621. $1=(0)._to_by_((6),(2));
  5622. $ctx1.sendIdx["to:by:"]=1;
  5623. self._assert_equals_($1,[(0), (2), (4), (6)]);
  5624. self._should_raise_((function(){
  5625. return smalltalk.withContext(function($ctx2) {
  5626. return (1)._to_by_((4),(0));
  5627. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5628. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  5629. args: [],
  5630. 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",
  5631. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  5632. referencedClasses: ["Error"]
  5633. }),
  5634. smalltalk.NumberTest);
  5635. smalltalk.addMethod(
  5636. smalltalk.method({
  5637. selector: "testTrigonometry",
  5638. protocol: 'tests',
  5639. fn: function (){
  5640. var self=this;
  5641. return smalltalk.withContext(function($ctx1) {
  5642. self._assert_equals_((0)._cos(),(1));
  5643. $ctx1.sendIdx["assert:equals:"]=1;
  5644. self._assert_equals_((0)._sin(),(0));
  5645. $ctx1.sendIdx["assert:equals:"]=2;
  5646. self._assert_equals_((0)._tan(),(0));
  5647. $ctx1.sendIdx["assert:equals:"]=3;
  5648. self._assert_equals_((1)._arcCos(),(0));
  5649. $ctx1.sendIdx["assert:equals:"]=4;
  5650. self._assert_equals_((0)._arcSin(),(0));
  5651. $ctx1.sendIdx["assert:equals:"]=5;
  5652. self._assert_equals_((0)._arcTan(),(0));
  5653. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  5654. args: [],
  5655. 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.",
  5656. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  5657. referencedClasses: []
  5658. }),
  5659. smalltalk.NumberTest);
  5660. smalltalk.addMethod(
  5661. smalltalk.method({
  5662. selector: "testTruncated",
  5663. protocol: 'tests',
  5664. fn: function (){
  5665. var self=this;
  5666. return smalltalk.withContext(function($ctx1) {
  5667. var $1,$2;
  5668. $1=(3)._truncated();
  5669. $ctx1.sendIdx["truncated"]=1;
  5670. self._assert_equals_($1,(3));
  5671. $ctx1.sendIdx["assert:equals:"]=1;
  5672. $2=(3.212)._truncated();
  5673. $ctx1.sendIdx["truncated"]=2;
  5674. self._assert_equals_($2,(3));
  5675. $ctx1.sendIdx["assert:equals:"]=2;
  5676. self._assert_equals_((3.51)._truncated(),(3));
  5677. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  5678. args: [],
  5679. 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",
  5680. messageSends: ["assert:equals:", "truncated"],
  5681. referencedClasses: []
  5682. }),
  5683. smalltalk.NumberTest);
  5684. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  5685. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  5686. smalltalk.addMethod(
  5687. smalltalk.method({
  5688. selector: "foo",
  5689. protocol: 'not yet classified',
  5690. fn: function (){
  5691. var self=this;
  5692. return smalltalk.withContext(function($ctx1) {
  5693. var $1;
  5694. $1=self["@foo"];
  5695. return $1;
  5696. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  5697. args: [],
  5698. source: "foo\x0a\x09^ foo",
  5699. messageSends: [],
  5700. referencedClasses: []
  5701. }),
  5702. smalltalk.ObjectMock);
  5703. smalltalk.addMethod(
  5704. smalltalk.method({
  5705. selector: "foo:",
  5706. protocol: 'not yet classified',
  5707. fn: function (anObject){
  5708. var self=this;
  5709. return smalltalk.withContext(function($ctx1) {
  5710. self["@foo"]=anObject;
  5711. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  5712. args: ["anObject"],
  5713. source: "foo: anObject\x0a\x09foo := anObject",
  5714. messageSends: [],
  5715. referencedClasses: []
  5716. }),
  5717. smalltalk.ObjectMock);
  5718. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5719. smalltalk.addMethod(
  5720. smalltalk.method({
  5721. selector: "notDefined",
  5722. protocol: 'tests',
  5723. fn: function (){
  5724. var self=this;
  5725. return smalltalk.withContext(function($ctx1) {
  5726. return void 0;;
  5727. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  5728. args: [],
  5729. source: "notDefined\x0a\x09<return void 0;>",
  5730. messageSends: [],
  5731. referencedClasses: []
  5732. }),
  5733. smalltalk.ObjectTest);
  5734. smalltalk.addMethod(
  5735. smalltalk.method({
  5736. selector: "testBasicAccess",
  5737. protocol: 'tests',
  5738. fn: function (){
  5739. var self=this;
  5740. var o;
  5741. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5742. return smalltalk.withContext(function($ctx1) {
  5743. var $1;
  5744. o=_st($Object())._new();
  5745. _st(o)._basicAt_put_("a",(1));
  5746. $1=_st(o)._basicAt_("a");
  5747. $ctx1.sendIdx["basicAt:"]=1;
  5748. self._assert_equals_($1,(1));
  5749. $ctx1.sendIdx["assert:equals:"]=1;
  5750. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  5751. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  5752. args: [],
  5753. 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",
  5754. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  5755. referencedClasses: ["Object"]
  5756. }),
  5757. smalltalk.ObjectTest);
  5758. smalltalk.addMethod(
  5759. smalltalk.method({
  5760. selector: "testBasicPerform",
  5761. protocol: 'tests',
  5762. fn: function (){
  5763. var self=this;
  5764. var o;
  5765. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5766. return smalltalk.withContext(function($ctx1) {
  5767. o=_st($Object())._new();
  5768. _st(o)._basicAt_put_("func",(function(){
  5769. return smalltalk.withContext(function($ctx2) {
  5770. return "hello";
  5771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5772. $ctx1.sendIdx["basicAt:put:"]=1;
  5773. _st(o)._basicAt_put_("func2",(function(a){
  5774. return smalltalk.withContext(function($ctx2) {
  5775. return _st(a).__plus((1));
  5776. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  5777. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  5778. $ctx1.sendIdx["assert:equals:"]=1;
  5779. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  5780. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  5781. args: [],
  5782. 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",
  5783. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  5784. referencedClasses: ["Object"]
  5785. }),
  5786. smalltalk.ObjectTest);
  5787. smalltalk.addMethod(
  5788. smalltalk.method({
  5789. selector: "testDNU",
  5790. protocol: 'tests',
  5791. fn: function (){
  5792. var self=this;
  5793. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5794. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5795. return smalltalk.withContext(function($ctx1) {
  5796. self._should_raise_((function(){
  5797. return smalltalk.withContext(function($ctx2) {
  5798. return _st(_st($Object())._new())._foo();
  5799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5800. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  5801. args: [],
  5802. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  5803. messageSends: ["should:raise:", "foo", "new"],
  5804. referencedClasses: ["Object", "MessageNotUnderstood"]
  5805. }),
  5806. smalltalk.ObjectTest);
  5807. smalltalk.addMethod(
  5808. smalltalk.method({
  5809. selector: "testEquality",
  5810. protocol: 'tests',
  5811. fn: function (){
  5812. var self=this;
  5813. var o;
  5814. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5815. return smalltalk.withContext(function($ctx1) {
  5816. var $1,$2,$4,$3;
  5817. o=_st($Object())._new();
  5818. $ctx1.sendIdx["new"]=1;
  5819. $1=_st(o).__eq(_st($Object())._new());
  5820. $ctx1.sendIdx["="]=1;
  5821. self._deny_($1);
  5822. $2=_st(o).__eq(o);
  5823. $ctx1.sendIdx["="]=2;
  5824. self._assert_($2);
  5825. $ctx1.sendIdx["assert:"]=1;
  5826. $4=_st(o)._yourself();
  5827. $ctx1.sendIdx["yourself"]=1;
  5828. $3=_st($4).__eq(o);
  5829. $ctx1.sendIdx["="]=3;
  5830. self._assert_($3);
  5831. $ctx1.sendIdx["assert:"]=2;
  5832. self._assert_(_st(o).__eq(_st(o)._yourself()));
  5833. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  5834. args: [],
  5835. 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)",
  5836. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  5837. referencedClasses: ["Object"]
  5838. }),
  5839. smalltalk.ObjectTest);
  5840. smalltalk.addMethod(
  5841. smalltalk.method({
  5842. selector: "testHalt",
  5843. protocol: 'tests',
  5844. fn: function (){
  5845. var self=this;
  5846. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5847. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5848. return smalltalk.withContext(function($ctx1) {
  5849. self._should_raise_((function(){
  5850. return smalltalk.withContext(function($ctx2) {
  5851. return _st(_st($Object())._new())._halt();
  5852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5853. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  5854. args: [],
  5855. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  5856. messageSends: ["should:raise:", "halt", "new"],
  5857. referencedClasses: ["Object", "Error"]
  5858. }),
  5859. smalltalk.ObjectTest);
  5860. smalltalk.addMethod(
  5861. smalltalk.method({
  5862. selector: "testIdentity",
  5863. protocol: 'tests',
  5864. fn: function (){
  5865. var self=this;
  5866. var o;
  5867. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5868. return smalltalk.withContext(function($ctx1) {
  5869. var $1,$2,$4,$3;
  5870. o=_st($Object())._new();
  5871. $ctx1.sendIdx["new"]=1;
  5872. $1=_st(o).__eq_eq(_st($Object())._new());
  5873. $ctx1.sendIdx["=="]=1;
  5874. self._deny_($1);
  5875. $2=_st(o).__eq_eq(o);
  5876. $ctx1.sendIdx["=="]=2;
  5877. self._assert_($2);
  5878. $ctx1.sendIdx["assert:"]=1;
  5879. $4=_st(o)._yourself();
  5880. $ctx1.sendIdx["yourself"]=1;
  5881. $3=_st($4).__eq_eq(o);
  5882. $ctx1.sendIdx["=="]=3;
  5883. self._assert_($3);
  5884. $ctx1.sendIdx["assert:"]=2;
  5885. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  5886. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  5887. args: [],
  5888. 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",
  5889. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  5890. referencedClasses: ["Object"]
  5891. }),
  5892. smalltalk.ObjectTest);
  5893. smalltalk.addMethod(
  5894. smalltalk.method({
  5895. selector: "testIfNil",
  5896. protocol: 'tests',
  5897. fn: function (){
  5898. var self=this;
  5899. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5900. return smalltalk.withContext(function($ctx1) {
  5901. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  5902. $2=_st($Object())._new();
  5903. $ctx1.sendIdx["new"]=1;
  5904. $1=_st($2)._isNil();
  5905. self._deny_($1);
  5906. $ctx1.sendIdx["deny:"]=1;
  5907. $5=_st($Object())._new();
  5908. $ctx1.sendIdx["new"]=2;
  5909. if(($receiver = $5) == nil || $receiver == null){
  5910. $4=true;
  5911. } else {
  5912. $4=$5;
  5913. };
  5914. $3=_st($4).__eq(true);
  5915. self._deny_($3);
  5916. $7=_st($Object())._new();
  5917. $ctx1.sendIdx["new"]=3;
  5918. if(($receiver = $7) == nil || $receiver == null){
  5919. $6=$7;
  5920. } else {
  5921. $6=true;
  5922. };
  5923. self._assert_equals_($6,true);
  5924. $ctx1.sendIdx["assert:equals:"]=1;
  5925. $9=_st($Object())._new();
  5926. $ctx1.sendIdx["new"]=4;
  5927. if(($receiver = $9) == nil || $receiver == null){
  5928. $8=false;
  5929. } else {
  5930. $8=true;
  5931. };
  5932. self._assert_equals_($8,true);
  5933. $ctx1.sendIdx["assert:equals:"]=2;
  5934. $11=_st($Object())._new();
  5935. if(($receiver = $11) == nil || $receiver == null){
  5936. $10=false;
  5937. } else {
  5938. $10=true;
  5939. };
  5940. self._assert_equals_($10,true);
  5941. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  5942. args: [],
  5943. 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",
  5944. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  5945. referencedClasses: ["Object"]
  5946. }),
  5947. smalltalk.ObjectTest);
  5948. smalltalk.addMethod(
  5949. smalltalk.method({
  5950. selector: "testInstVars",
  5951. protocol: 'tests',
  5952. fn: function (){
  5953. var self=this;
  5954. var o;
  5955. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5956. return smalltalk.withContext(function($ctx1) {
  5957. var $1,$2;
  5958. o=_st($ObjectMock())._new();
  5959. $1=_st(o)._instVarAt_("foo");
  5960. $ctx1.sendIdx["instVarAt:"]=1;
  5961. self._assert_equals_($1,nil);
  5962. $ctx1.sendIdx["assert:equals:"]=1;
  5963. _st(o)._instVarAt_put_("foo",(1));
  5964. $2=_st(o)._instVarAt_("foo");
  5965. $ctx1.sendIdx["instVarAt:"]=2;
  5966. self._assert_equals_($2,(1));
  5967. $ctx1.sendIdx["assert:equals:"]=2;
  5968. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  5969. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  5970. args: [],
  5971. 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",
  5972. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  5973. referencedClasses: ["ObjectMock"]
  5974. }),
  5975. smalltalk.ObjectTest);
  5976. smalltalk.addMethod(
  5977. smalltalk.method({
  5978. selector: "testNilUndefined",
  5979. protocol: 'tests',
  5980. fn: function (){
  5981. var self=this;
  5982. return smalltalk.withContext(function($ctx1) {
  5983. self._assert_equals_(self._notDefined(),nil);
  5984. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  5985. args: [],
  5986. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  5987. messageSends: ["assert:equals:", "notDefined"],
  5988. referencedClasses: []
  5989. }),
  5990. smalltalk.ObjectTest);
  5991. smalltalk.addMethod(
  5992. smalltalk.method({
  5993. selector: "testYourself",
  5994. protocol: 'tests',
  5995. fn: function (){
  5996. var self=this;
  5997. var o;
  5998. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5999. return smalltalk.withContext(function($ctx1) {
  6000. o=_st($ObjectMock())._new();
  6001. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  6002. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  6003. args: [],
  6004. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  6005. messageSends: ["new", "assert:", "==", "yourself"],
  6006. referencedClasses: ["ObjectMock"]
  6007. }),
  6008. smalltalk.ObjectTest);
  6009. smalltalk.addMethod(
  6010. smalltalk.method({
  6011. selector: "testidentityHash",
  6012. protocol: 'tests',
  6013. fn: function (){
  6014. var self=this;
  6015. var o1,o2;
  6016. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6017. return smalltalk.withContext(function($ctx1) {
  6018. var $2,$3,$1,$5,$4;
  6019. o1=_st($Object())._new();
  6020. $ctx1.sendIdx["new"]=1;
  6021. o2=_st($Object())._new();
  6022. $2=_st(o1)._identityHash();
  6023. $ctx1.sendIdx["identityHash"]=1;
  6024. $3=_st(o1)._identityHash();
  6025. $ctx1.sendIdx["identityHash"]=2;
  6026. $1=_st($2).__eq_eq($3);
  6027. $ctx1.sendIdx["=="]=1;
  6028. self._assert_($1);
  6029. $5=_st(o1)._identityHash();
  6030. $ctx1.sendIdx["identityHash"]=3;
  6031. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  6032. self._deny_($4);
  6033. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  6034. args: [],
  6035. 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",
  6036. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  6037. referencedClasses: ["Object"]
  6038. }),
  6039. smalltalk.ObjectTest);
  6040. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6041. smalltalk.addMethod(
  6042. smalltalk.method({
  6043. selector: "testAccessing",
  6044. protocol: 'tests',
  6045. fn: function (){
  6046. var self=this;
  6047. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6048. return smalltalk.withContext(function($ctx1) {
  6049. var $2,$1,$3,$6,$5,$4;
  6050. $2=_st($Point())._x_y_((3),(4));
  6051. $ctx1.sendIdx["x:y:"]=1;
  6052. $1=_st($2)._x();
  6053. $ctx1.sendIdx["x"]=1;
  6054. self._assert_equals_($1,(3));
  6055. $ctx1.sendIdx["assert:equals:"]=1;
  6056. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  6057. $ctx1.sendIdx["y"]=1;
  6058. self._assert_equals_($3,(4));
  6059. $ctx1.sendIdx["assert:equals:"]=2;
  6060. $6=_st($Point())._new();
  6061. $ctx1.sendIdx["new"]=1;
  6062. $5=_st($6)._x_((3));
  6063. $4=_st($5)._x();
  6064. self._assert_equals_($4,(3));
  6065. $ctx1.sendIdx["assert:equals:"]=3;
  6066. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  6067. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  6068. args: [],
  6069. 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",
  6070. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  6071. referencedClasses: ["Point"]
  6072. }),
  6073. smalltalk.PointTest);
  6074. smalltalk.addMethod(
  6075. smalltalk.method({
  6076. selector: "testArithmetic",
  6077. protocol: 'tests',
  6078. fn: function (){
  6079. var self=this;
  6080. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6081. return smalltalk.withContext(function($ctx1) {
  6082. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  6083. $2=(3).__at((4));
  6084. $ctx1.sendIdx["@"]=1;
  6085. $3=(3).__at((4));
  6086. $ctx1.sendIdx["@"]=2;
  6087. $1=_st($2).__star($3);
  6088. $4=_st($Point())._x_y_((9),(16));
  6089. $ctx1.sendIdx["x:y:"]=1;
  6090. self._assert_equals_($1,$4);
  6091. $ctx1.sendIdx["assert:equals:"]=1;
  6092. $6=(3).__at((4));
  6093. $ctx1.sendIdx["@"]=3;
  6094. $7=(3).__at((4));
  6095. $ctx1.sendIdx["@"]=4;
  6096. $5=_st($6).__plus($7);
  6097. $8=_st($Point())._x_y_((6),(8));
  6098. $ctx1.sendIdx["x:y:"]=2;
  6099. self._assert_equals_($5,$8);
  6100. $ctx1.sendIdx["assert:equals:"]=2;
  6101. $10=(3).__at((4));
  6102. $ctx1.sendIdx["@"]=5;
  6103. $11=(3).__at((4));
  6104. $ctx1.sendIdx["@"]=6;
  6105. $9=_st($10).__minus($11);
  6106. $12=_st($Point())._x_y_((0),(0));
  6107. $ctx1.sendIdx["x:y:"]=3;
  6108. self._assert_equals_($9,$12);
  6109. $ctx1.sendIdx["assert:equals:"]=3;
  6110. $14=(6).__at((8));
  6111. $ctx1.sendIdx["@"]=7;
  6112. $13=_st($14).__slash((3).__at((4)));
  6113. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  6114. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  6115. args: [],
  6116. 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)",
  6117. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  6118. referencedClasses: ["Point"]
  6119. }),
  6120. smalltalk.PointTest);
  6121. smalltalk.addMethod(
  6122. smalltalk.method({
  6123. selector: "testAt",
  6124. protocol: 'tests',
  6125. fn: function (){
  6126. var self=this;
  6127. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6128. return smalltalk.withContext(function($ctx1) {
  6129. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  6130. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  6131. args: [],
  6132. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  6133. messageSends: ["assert:equals:", "@", "x:y:"],
  6134. referencedClasses: ["Point"]
  6135. }),
  6136. smalltalk.PointTest);
  6137. smalltalk.addMethod(
  6138. smalltalk.method({
  6139. selector: "testEgality",
  6140. protocol: 'tests',
  6141. fn: function (){
  6142. var self=this;
  6143. return smalltalk.withContext(function($ctx1) {
  6144. var $2,$3,$1,$5,$4;
  6145. $2=(3).__at((4));
  6146. $ctx1.sendIdx["@"]=1;
  6147. $3=(3).__at((4));
  6148. $ctx1.sendIdx["@"]=2;
  6149. $1=_st($2).__eq($3);
  6150. $ctx1.sendIdx["="]=1;
  6151. self._assert_($1);
  6152. $5=(3).__at((5));
  6153. $ctx1.sendIdx["@"]=3;
  6154. $4=_st($5).__eq((3).__at((6)));
  6155. self._deny_($4);
  6156. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  6157. args: [],
  6158. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  6159. messageSends: ["assert:", "=", "@", "deny:"],
  6160. referencedClasses: []
  6161. }),
  6162. smalltalk.PointTest);
  6163. smalltalk.addMethod(
  6164. smalltalk.method({
  6165. selector: "testNew",
  6166. protocol: 'tests',
  6167. fn: function (){
  6168. var self=this;
  6169. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6170. return smalltalk.withContext(function($ctx1) {
  6171. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  6172. $3=_st($Point())._new();
  6173. $ctx1.sendIdx["new"]=1;
  6174. $2=_st($3)._x_((3));
  6175. $ctx1.sendIdx["x:"]=1;
  6176. $1=_st($2)._y();
  6177. $ctx1.sendIdx["y"]=1;
  6178. self._assert_equals_($1,nil);
  6179. $ctx1.sendIdx["assert:equals:"]=1;
  6180. $7=_st($Point())._new();
  6181. $ctx1.sendIdx["new"]=2;
  6182. $6=_st($7)._x_((3));
  6183. $5=_st($6)._x();
  6184. $ctx1.sendIdx["x"]=1;
  6185. $4=_st($5).__eq((0));
  6186. $ctx1.sendIdx["="]=1;
  6187. self._deny_($4);
  6188. $ctx1.sendIdx["deny:"]=1;
  6189. $10=_st($Point())._new();
  6190. $ctx1.sendIdx["new"]=3;
  6191. $9=_st($10)._y_((4));
  6192. $ctx1.sendIdx["y:"]=1;
  6193. $8=_st($9)._x();
  6194. self._assert_equals_($8,nil);
  6195. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  6196. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  6197. args: [],
  6198. 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",
  6199. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  6200. referencedClasses: ["Point"]
  6201. }),
  6202. smalltalk.PointTest);
  6203. smalltalk.addMethod(
  6204. smalltalk.method({
  6205. selector: "testTranslateBy",
  6206. protocol: 'tests',
  6207. fn: function (){
  6208. var self=this;
  6209. return smalltalk.withContext(function($ctx1) {
  6210. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  6211. $2=(3).__at((3));
  6212. $ctx1.sendIdx["@"]=1;
  6213. $3=(0).__at((1));
  6214. $ctx1.sendIdx["@"]=2;
  6215. $1=_st($2)._translateBy_($3);
  6216. $ctx1.sendIdx["translateBy:"]=1;
  6217. $4=(3).__at((4));
  6218. $ctx1.sendIdx["@"]=3;
  6219. self._assert_equals_($1,$4);
  6220. $ctx1.sendIdx["assert:equals:"]=1;
  6221. $6=(3).__at((3));
  6222. $ctx1.sendIdx["@"]=4;
  6223. $8=(1)._negated();
  6224. $ctx1.sendIdx["negated"]=1;
  6225. $7=(0).__at($8);
  6226. $ctx1.sendIdx["@"]=5;
  6227. $5=_st($6)._translateBy_($7);
  6228. $ctx1.sendIdx["translateBy:"]=2;
  6229. $9=(3).__at((2));
  6230. $ctx1.sendIdx["@"]=6;
  6231. self._assert_equals_($5,$9);
  6232. $ctx1.sendIdx["assert:equals:"]=2;
  6233. $11=(3).__at((3));
  6234. $ctx1.sendIdx["@"]=7;
  6235. $12=(2).__at((3));
  6236. $ctx1.sendIdx["@"]=8;
  6237. $10=_st($11)._translateBy_($12);
  6238. $ctx1.sendIdx["translateBy:"]=3;
  6239. $13=(5).__at((6));
  6240. $ctx1.sendIdx["@"]=9;
  6241. self._assert_equals_($10,$13);
  6242. $ctx1.sendIdx["assert:equals:"]=3;
  6243. $15=(3).__at((3));
  6244. $ctx1.sendIdx["@"]=10;
  6245. $16=_st((3)._negated()).__at((0));
  6246. $ctx1.sendIdx["@"]=11;
  6247. $14=_st($15)._translateBy_($16);
  6248. self._assert_equals_($14,(0).__at((3)));
  6249. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  6250. args: [],
  6251. 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.",
  6252. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  6253. referencedClasses: []
  6254. }),
  6255. smalltalk.PointTest);
  6256. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6257. smalltalk.addMethod(
  6258. smalltalk.method({
  6259. selector: "testNextIfAbsent",
  6260. protocol: 'tests',
  6261. fn: function (){
  6262. var self=this;
  6263. var queue;
  6264. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6265. return smalltalk.withContext(function($ctx1) {
  6266. var $2,$1;
  6267. queue=_st($Queue())._new();
  6268. _st(queue)._nextPut_("index1");
  6269. $2=_st(queue)._nextIfAbsent_("empty");
  6270. $ctx1.sendIdx["nextIfAbsent:"]=1;
  6271. $1=_st($2).__eq("index1");
  6272. $ctx1.sendIdx["="]=1;
  6273. self._assert_($1);
  6274. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  6275. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  6276. args: [],
  6277. 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'",
  6278. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  6279. referencedClasses: ["Queue"]
  6280. }),
  6281. smalltalk.QueueTest);
  6282. smalltalk.addMethod(
  6283. smalltalk.method({
  6284. selector: "testQueueNext",
  6285. protocol: 'tests',
  6286. fn: function (){
  6287. var self=this;
  6288. var queue;
  6289. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6290. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6291. return smalltalk.withContext(function($ctx1) {
  6292. var $1,$2,$4,$3,$6,$5;
  6293. queue=_st($Queue())._new();
  6294. $1=queue;
  6295. _st($1)._nextPut_("index1");
  6296. $ctx1.sendIdx["nextPut:"]=1;
  6297. $2=_st($1)._nextPut_("index2");
  6298. $4=_st(queue)._next();
  6299. $ctx1.sendIdx["next"]=1;
  6300. $3=_st($4).__eq("index1");
  6301. $ctx1.sendIdx["="]=1;
  6302. self._assert_($3);
  6303. $6=_st(queue)._next();
  6304. $ctx1.sendIdx["next"]=2;
  6305. $5=_st($6).__eq("index");
  6306. self._deny_($5);
  6307. self._should_raise_((function(){
  6308. return smalltalk.withContext(function($ctx2) {
  6309. return _st(queue)._next();
  6310. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6311. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  6312. args: [],
  6313. 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",
  6314. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  6315. referencedClasses: ["Queue", "Error"]
  6316. }),
  6317. smalltalk.QueueTest);
  6318. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6319. smalltalk.addMethod(
  6320. smalltalk.method({
  6321. selector: "testAtRandomNumber",
  6322. protocol: 'tests',
  6323. fn: function (){
  6324. var self=this;
  6325. var val;
  6326. return smalltalk.withContext(function($ctx1) {
  6327. (100)._timesRepeat_((function(){
  6328. return smalltalk.withContext(function($ctx2) {
  6329. val=(10)._atRandom();
  6330. val;
  6331. self._assert_(_st(val).__gt((0)));
  6332. $ctx2.sendIdx["assert:"]=1;
  6333. return self._assert_(_st(val).__lt((11)));
  6334. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6335. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  6336. args: [],
  6337. 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]",
  6338. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  6339. referencedClasses: []
  6340. }),
  6341. smalltalk.RandomTest);
  6342. smalltalk.addMethod(
  6343. smalltalk.method({
  6344. selector: "testAtRandomSequenceableCollection",
  6345. protocol: 'tests',
  6346. fn: function (){
  6347. var self=this;
  6348. var val;
  6349. return smalltalk.withContext(function($ctx1) {
  6350. var $3,$4,$2,$1;
  6351. (100)._timesRepeat_((function(){
  6352. return smalltalk.withContext(function($ctx2) {
  6353. val="abc"._atRandom();
  6354. val;
  6355. $3=_st(val).__eq("a");
  6356. $ctx2.sendIdx["="]=1;
  6357. $4=_st(val).__eq("b");
  6358. $ctx2.sendIdx["="]=2;
  6359. $2=_st($3).__or($4);
  6360. $1=_st($2).__or(_st(val).__eq("c"));
  6361. $ctx2.sendIdx["|"]=1;
  6362. return self._assert_($1);
  6363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6364. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  6365. args: [],
  6366. 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].",
  6367. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  6368. referencedClasses: []
  6369. }),
  6370. smalltalk.RandomTest);
  6371. smalltalk.addMethod(
  6372. smalltalk.method({
  6373. selector: "textNext",
  6374. protocol: 'tests',
  6375. fn: function (){
  6376. var self=this;
  6377. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  6378. return smalltalk.withContext(function($ctx1) {
  6379. var $1;
  6380. (10000)._timesRepeat_((function(){
  6381. var current,next;
  6382. return smalltalk.withContext(function($ctx2) {
  6383. next=_st(_st($Random())._new())._next();
  6384. next;
  6385. self._assert_(_st(next).__gt_eq((0)));
  6386. $ctx2.sendIdx["assert:"]=1;
  6387. self._assert_(_st(next).__lt((1)));
  6388. $1=_st(current).__eq(next);
  6389. $ctx2.sendIdx["="]=1;
  6390. self._deny_($1);
  6391. return _st(next).__eq(current);
  6392. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  6393. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  6394. args: [],
  6395. 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 ]",
  6396. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  6397. referencedClasses: ["Random"]
  6398. }),
  6399. smalltalk.RandomTest);
  6400. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6401. smalltalk.addMethod(
  6402. smalltalk.method({
  6403. selector: "testAddRemove",
  6404. protocol: 'tests',
  6405. fn: function (){
  6406. var self=this;
  6407. var set;
  6408. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6409. return smalltalk.withContext(function($ctx1) {
  6410. var $1,$2;
  6411. set=_st($Set())._new();
  6412. self._assert_(_st(set)._isEmpty());
  6413. $ctx1.sendIdx["assert:"]=1;
  6414. _st(set)._add_((3));
  6415. $ctx1.sendIdx["add:"]=1;
  6416. $1=_st(set)._includes_((3));
  6417. $ctx1.sendIdx["includes:"]=1;
  6418. self._assert_($1);
  6419. $ctx1.sendIdx["assert:"]=2;
  6420. _st(set)._add_((5));
  6421. $2=_st(set)._includes_((5));
  6422. $ctx1.sendIdx["includes:"]=2;
  6423. self._assert_($2);
  6424. _st(set)._remove_((3));
  6425. self._deny_(_st(set)._includes_((3)));
  6426. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  6427. args: [],
  6428. 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)",
  6429. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  6430. referencedClasses: ["Set"]
  6431. }),
  6432. smalltalk.SetTest);
  6433. smalltalk.addMethod(
  6434. smalltalk.method({
  6435. selector: "testAt",
  6436. protocol: 'tests',
  6437. fn: function (){
  6438. var self=this;
  6439. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6440. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6441. return smalltalk.withContext(function($ctx1) {
  6442. self._should_raise_((function(){
  6443. return smalltalk.withContext(function($ctx2) {
  6444. return _st(_st($Set())._new())._at_put_((1),(2));
  6445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6446. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  6447. args: [],
  6448. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  6449. messageSends: ["should:raise:", "at:put:", "new"],
  6450. referencedClasses: ["Set", "Error"]
  6451. }),
  6452. smalltalk.SetTest);
  6453. smalltalk.addMethod(
  6454. smalltalk.method({
  6455. selector: "testCollect",
  6456. protocol: 'tests',
  6457. fn: function (){
  6458. var self=this;
  6459. return smalltalk.withContext(function($ctx1) {
  6460. var $2,$1;
  6461. $2=[(5), (6), (8)]._asSet();
  6462. $ctx1.sendIdx["asSet"]=1;
  6463. $1=_st($2)._collect_((function(x){
  6464. return smalltalk.withContext(function($ctx2) {
  6465. return _st(x).__backslash_backslash((3));
  6466. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  6467. self._assert_equals_($1,[(0), (2)]._asSet());
  6468. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  6469. args: [],
  6470. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  6471. messageSends: ["assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  6472. referencedClasses: []
  6473. }),
  6474. smalltalk.SetTest);
  6475. smalltalk.addMethod(
  6476. smalltalk.method({
  6477. selector: "testComparing",
  6478. protocol: 'tests',
  6479. fn: function (){
  6480. var self=this;
  6481. return smalltalk.withContext(function($ctx1) {
  6482. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  6483. $1=[(0), (2)]._asSet();
  6484. $ctx1.sendIdx["asSet"]=1;
  6485. $2=[(0), (2)]._asSet();
  6486. $ctx1.sendIdx["asSet"]=2;
  6487. self._assert_equals_($1,$2);
  6488. $ctx1.sendIdx["assert:equals:"]=1;
  6489. $3=[(2), (0)]._asSet();
  6490. $ctx1.sendIdx["asSet"]=3;
  6491. $4=[(0), (2)]._asSet();
  6492. $ctx1.sendIdx["asSet"]=4;
  6493. self._assert_equals_($3,$4);
  6494. $6=[(0), (2), (3)]._asSet();
  6495. $ctx1.sendIdx["asSet"]=5;
  6496. $7=[(0), (2)]._asSet();
  6497. $ctx1.sendIdx["asSet"]=6;
  6498. $5=_st($6).__eq($7);
  6499. $ctx1.sendIdx["="]=1;
  6500. self._deny_($5);
  6501. $ctx1.sendIdx["deny:"]=1;
  6502. $9=[(1), (2)]._asSet();
  6503. $ctx1.sendIdx["asSet"]=7;
  6504. $8=_st($9).__eq([(0), (2)]._asSet());
  6505. self._deny_($8);
  6506. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  6507. args: [],
  6508. 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",
  6509. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  6510. referencedClasses: []
  6511. }),
  6512. smalltalk.SetTest);
  6513. smalltalk.addMethod(
  6514. smalltalk.method({
  6515. selector: "testPrintString",
  6516. protocol: 'tests',
  6517. fn: function (){
  6518. var self=this;
  6519. var set;
  6520. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6521. return smalltalk.withContext(function($ctx1) {
  6522. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  6523. set=_st($Set())._new();
  6524. $1=_st(set)._printString();
  6525. $ctx1.sendIdx["printString"]=1;
  6526. self._assert_equals_($1,"a Set ()");
  6527. $ctx1.sendIdx["assert:equals:"]=1;
  6528. $2=set;
  6529. _st($2)._add_((1));
  6530. $ctx1.sendIdx["add:"]=1;
  6531. $3=_st($2)._add_((3));
  6532. $ctx1.sendIdx["add:"]=2;
  6533. $4=_st(set)._printString();
  6534. $ctx1.sendIdx["printString"]=2;
  6535. self._assert_equals_($4,"a Set (1 3)");
  6536. $ctx1.sendIdx["assert:equals:"]=2;
  6537. _st(set)._add_("foo");
  6538. $ctx1.sendIdx["add:"]=3;
  6539. $5=_st(set)._printString();
  6540. $ctx1.sendIdx["printString"]=3;
  6541. self._assert_equals_($5,"a Set (1 3 'foo')");
  6542. $ctx1.sendIdx["assert:equals:"]=3;
  6543. $6=set;
  6544. _st($6)._remove_((1));
  6545. $ctx1.sendIdx["remove:"]=1;
  6546. $7=_st($6)._remove_((3));
  6547. $8=_st(set)._printString();
  6548. $ctx1.sendIdx["printString"]=4;
  6549. self._assert_equals_($8,"a Set ('foo')");
  6550. $ctx1.sendIdx["assert:equals:"]=4;
  6551. _st(set)._add_((3));
  6552. $ctx1.sendIdx["add:"]=4;
  6553. $9=_st(set)._printString();
  6554. $ctx1.sendIdx["printString"]=5;
  6555. self._assert_equals_($9,"a Set ('foo' 3)");
  6556. $ctx1.sendIdx["assert:equals:"]=5;
  6557. _st(set)._add_((3));
  6558. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  6559. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  6560. args: [],
  6561. 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)'",
  6562. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  6563. referencedClasses: ["Set"]
  6564. }),
  6565. smalltalk.SetTest);
  6566. smalltalk.addMethod(
  6567. smalltalk.method({
  6568. selector: "testSize",
  6569. protocol: 'tests',
  6570. fn: function (){
  6571. var self=this;
  6572. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6573. return smalltalk.withContext(function($ctx1) {
  6574. var $1,$3,$2;
  6575. $1=_st(_st($Set())._new())._size();
  6576. $ctx1.sendIdx["size"]=1;
  6577. self._assert_equals_($1,(0));
  6578. $ctx1.sendIdx["assert:equals:"]=1;
  6579. $3=_st($Set())._withAll_([(1), (2), (3), (4)]);
  6580. $ctx1.sendIdx["withAll:"]=1;
  6581. $2=_st($3)._size();
  6582. $ctx1.sendIdx["size"]=2;
  6583. self._assert_equals_($2,(4));
  6584. $ctx1.sendIdx["assert:equals:"]=2;
  6585. self._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  6586. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  6587. args: [],
  6588. source: "testSize\x0a\x09self assert: Set new size equals: 0.\x0a\x09self assert: (Set withAll: #(1 2 3 4)) size equals: 4.\x0a\x09self assert: (Set withAll: #(1 1 1 1)) size equals: 1",
  6589. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  6590. referencedClasses: ["Set"]
  6591. }),
  6592. smalltalk.SetTest);
  6593. smalltalk.addMethod(
  6594. smalltalk.method({
  6595. selector: "testUnboxedObjects",
  6596. protocol: 'tests',
  6597. fn: function (){
  6598. var self=this;
  6599. return smalltalk.withContext(function($ctx1) {
  6600. var $4,$3,$2,$1;
  6601. $4="foo"._yourself();
  6602. $ctx1.sendIdx["yourself"]=1;
  6603. $3=[$4,"foo"._yourself()];
  6604. $2=_st($3)._asSet();
  6605. $1=_st($2)._asArray();
  6606. self._assert_equals_($1,["foo"]);
  6607. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  6608. args: [],
  6609. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  6610. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  6611. referencedClasses: []
  6612. }),
  6613. smalltalk.SetTest);
  6614. smalltalk.addMethod(
  6615. smalltalk.method({
  6616. selector: "testUnicity",
  6617. protocol: 'tests',
  6618. fn: function (){
  6619. var self=this;
  6620. var set;
  6621. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6622. return smalltalk.withContext(function($ctx1) {
  6623. var $1;
  6624. set=_st($Set())._new();
  6625. _st(set)._add_((21));
  6626. $ctx1.sendIdx["add:"]=1;
  6627. _st(set)._add_("hello");
  6628. $ctx1.sendIdx["add:"]=2;
  6629. _st(set)._add_((21));
  6630. $ctx1.sendIdx["add:"]=3;
  6631. $1=_st(set)._size();
  6632. $ctx1.sendIdx["size"]=1;
  6633. self._assert_equals_($1,(2));
  6634. $ctx1.sendIdx["assert:equals:"]=1;
  6635. _st(set)._add_("hello");
  6636. self._assert_equals_(_st(set)._size(),(2));
  6637. $ctx1.sendIdx["assert:equals:"]=2;
  6638. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  6639. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  6640. args: [],
  6641. 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')",
  6642. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  6643. referencedClasses: ["Set"]
  6644. }),
  6645. smalltalk.SetTest);
  6646. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6647. smalltalk.addMethod(
  6648. smalltalk.method({
  6649. selector: "collectionClass",
  6650. protocol: 'accessing',
  6651. fn: function (){
  6652. var self=this;
  6653. return smalltalk.withContext(function($ctx1) {
  6654. var $1;
  6655. $1=_st(self._class())._collectionClass();
  6656. return $1;
  6657. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  6658. args: [],
  6659. source: "collectionClass\x0a\x09^ self class collectionClass",
  6660. messageSends: ["collectionClass", "class"],
  6661. referencedClasses: []
  6662. }),
  6663. smalltalk.StreamTest);
  6664. smalltalk.addMethod(
  6665. smalltalk.method({
  6666. selector: "newCollection",
  6667. protocol: 'accessing',
  6668. fn: function (){
  6669. var self=this;
  6670. return smalltalk.withContext(function($ctx1) {
  6671. var $1;
  6672. $1=_st(self._collectionClass())._new();
  6673. return $1;
  6674. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  6675. args: [],
  6676. source: "newCollection\x0a\x09^ self collectionClass new",
  6677. messageSends: ["new", "collectionClass"],
  6678. referencedClasses: []
  6679. }),
  6680. smalltalk.StreamTest);
  6681. smalltalk.addMethod(
  6682. smalltalk.method({
  6683. selector: "newStream",
  6684. protocol: 'accessing',
  6685. fn: function (){
  6686. var self=this;
  6687. return smalltalk.withContext(function($ctx1) {
  6688. var $1;
  6689. $1=_st(_st(self._collectionClass())._new())._stream();
  6690. return $1;
  6691. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  6692. args: [],
  6693. source: "newStream\x0a\x09^ self collectionClass new stream",
  6694. messageSends: ["stream", "new", "collectionClass"],
  6695. referencedClasses: []
  6696. }),
  6697. smalltalk.StreamTest);
  6698. smalltalk.addMethod(
  6699. smalltalk.method({
  6700. selector: "testAtStartAtEnd",
  6701. protocol: 'tests',
  6702. fn: function (){
  6703. var self=this;
  6704. var stream;
  6705. return smalltalk.withContext(function($ctx1) {
  6706. var $1,$2,$3,$4;
  6707. stream=self._newStream();
  6708. $1=_st(stream)._atStart();
  6709. $ctx1.sendIdx["atStart"]=1;
  6710. self._assert_($1);
  6711. $ctx1.sendIdx["assert:"]=1;
  6712. $2=_st(stream)._atEnd();
  6713. $ctx1.sendIdx["atEnd"]=1;
  6714. self._assert_($2);
  6715. $ctx1.sendIdx["assert:"]=2;
  6716. _st(stream)._nextPutAll_(self._newCollection());
  6717. $3=_st(stream)._atEnd();
  6718. $ctx1.sendIdx["atEnd"]=2;
  6719. self._assert_($3);
  6720. $4=_st(stream)._atStart();
  6721. $ctx1.sendIdx["atStart"]=2;
  6722. self._deny_($4);
  6723. $ctx1.sendIdx["deny:"]=1;
  6724. _st(stream)._position_((1));
  6725. self._deny_(_st(stream)._atEnd());
  6726. $ctx1.sendIdx["deny:"]=2;
  6727. self._deny_(_st(stream)._atStart());
  6728. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  6729. args: [],
  6730. 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",
  6731. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  6732. referencedClasses: []
  6733. }),
  6734. smalltalk.StreamTest);
  6735. smalltalk.addMethod(
  6736. smalltalk.method({
  6737. selector: "testContents",
  6738. protocol: 'tests',
  6739. fn: function (){
  6740. var self=this;
  6741. var stream;
  6742. return smalltalk.withContext(function($ctx1) {
  6743. var $1,$2;
  6744. stream=self._newStream();
  6745. $1=stream;
  6746. $2=self._newCollection();
  6747. $ctx1.sendIdx["newCollection"]=1;
  6748. _st($1)._nextPutAll_($2);
  6749. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  6750. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  6751. args: [],
  6752. 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",
  6753. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  6754. referencedClasses: []
  6755. }),
  6756. smalltalk.StreamTest);
  6757. smalltalk.addMethod(
  6758. smalltalk.method({
  6759. selector: "testIsEmpty",
  6760. protocol: 'tests',
  6761. fn: function (){
  6762. var self=this;
  6763. var stream;
  6764. return smalltalk.withContext(function($ctx1) {
  6765. var $1;
  6766. stream=self._newStream();
  6767. $1=_st(stream)._isEmpty();
  6768. $ctx1.sendIdx["isEmpty"]=1;
  6769. self._assert_($1);
  6770. _st(stream)._nextPutAll_(self._newCollection());
  6771. self._deny_(_st(stream)._isEmpty());
  6772. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  6773. args: [],
  6774. 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",
  6775. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  6776. referencedClasses: []
  6777. }),
  6778. smalltalk.StreamTest);
  6779. smalltalk.addMethod(
  6780. smalltalk.method({
  6781. selector: "testPosition",
  6782. protocol: 'tests',
  6783. fn: function (){
  6784. var self=this;
  6785. var collection,stream;
  6786. return smalltalk.withContext(function($ctx1) {
  6787. var $1,$2,$3;
  6788. collection=self._newCollection();
  6789. stream=self._newStream();
  6790. _st(stream)._nextPutAll_(collection);
  6791. $1=_st(stream)._position();
  6792. $ctx1.sendIdx["position"]=1;
  6793. self._assert_equals_($1,_st(collection)._size());
  6794. $ctx1.sendIdx["assert:equals:"]=1;
  6795. _st(stream)._position_((0));
  6796. $2=_st(stream)._position();
  6797. $ctx1.sendIdx["position"]=2;
  6798. self._assert_equals_($2,(0));
  6799. $ctx1.sendIdx["assert:equals:"]=2;
  6800. _st(stream)._next();
  6801. $ctx1.sendIdx["next"]=1;
  6802. $3=_st(stream)._position();
  6803. $ctx1.sendIdx["position"]=3;
  6804. self._assert_equals_($3,(1));
  6805. $ctx1.sendIdx["assert:equals:"]=3;
  6806. _st(stream)._next();
  6807. self._assert_equals_(_st(stream)._position(),(2));
  6808. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  6809. args: [],
  6810. 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",
  6811. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  6812. referencedClasses: []
  6813. }),
  6814. smalltalk.StreamTest);
  6815. smalltalk.addMethod(
  6816. smalltalk.method({
  6817. selector: "testReading",
  6818. protocol: 'tests',
  6819. fn: function (){
  6820. var self=this;
  6821. var stream,collection;
  6822. return smalltalk.withContext(function($ctx1) {
  6823. var $1,$2,$3;
  6824. collection=self._newCollection();
  6825. stream=self._newStream();
  6826. $1=stream;
  6827. _st($1)._nextPutAll_(collection);
  6828. $2=_st($1)._position_((0));
  6829. _st(collection)._do_((function(each){
  6830. return smalltalk.withContext(function($ctx2) {
  6831. $3=_st(stream)._next();
  6832. $ctx2.sendIdx["next"]=1;
  6833. return self._assert_equals_($3,each);
  6834. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6835. self._assert_(_st(_st(stream)._next())._isNil());
  6836. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6837. args: [],
  6838. 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",
  6839. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  6840. referencedClasses: []
  6841. }),
  6842. smalltalk.StreamTest);
  6843. smalltalk.addMethod(
  6844. smalltalk.method({
  6845. selector: "testStreamContents",
  6846. protocol: 'tests',
  6847. fn: function (){
  6848. var self=this;
  6849. return smalltalk.withContext(function($ctx1) {
  6850. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  6851. args: [],
  6852. source: "testStreamContents",
  6853. messageSends: [],
  6854. referencedClasses: []
  6855. }),
  6856. smalltalk.StreamTest);
  6857. smalltalk.addMethod(
  6858. smalltalk.method({
  6859. selector: "testWrite",
  6860. protocol: 'tests',
  6861. fn: function (){
  6862. var self=this;
  6863. var stream,collection;
  6864. return smalltalk.withContext(function($ctx1) {
  6865. collection=self._newCollection();
  6866. stream=self._newStream();
  6867. _st(collection)._do_((function(each){
  6868. return smalltalk.withContext(function($ctx2) {
  6869. return _st(stream).__lt_lt(each);
  6870. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6871. self._assert_equals_(_st(stream)._contents(),collection);
  6872. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6873. args: [],
  6874. 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",
  6875. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  6876. referencedClasses: []
  6877. }),
  6878. smalltalk.StreamTest);
  6879. smalltalk.addMethod(
  6880. smalltalk.method({
  6881. selector: "testWriting",
  6882. protocol: 'tests',
  6883. fn: function (){
  6884. var self=this;
  6885. var stream,collection;
  6886. return smalltalk.withContext(function($ctx1) {
  6887. var $1;
  6888. collection=self._newCollection();
  6889. stream=self._newStream();
  6890. $ctx1.sendIdx["newStream"]=1;
  6891. _st(collection)._do_((function(each){
  6892. return smalltalk.withContext(function($ctx2) {
  6893. return _st(stream)._nextPut_(each);
  6894. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6895. $1=_st(stream)._contents();
  6896. $ctx1.sendIdx["contents"]=1;
  6897. self._assert_equals_($1,collection);
  6898. $ctx1.sendIdx["assert:equals:"]=1;
  6899. stream=self._newStream();
  6900. _st(stream)._nextPutAll_(collection);
  6901. self._assert_equals_(_st(stream)._contents(),collection);
  6902. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6903. args: [],
  6904. 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",
  6905. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  6906. referencedClasses: []
  6907. }),
  6908. smalltalk.StreamTest);
  6909. smalltalk.addMethod(
  6910. smalltalk.method({
  6911. selector: "collectionClass",
  6912. protocol: 'accessing',
  6913. fn: function (){
  6914. var self=this;
  6915. return smalltalk.withContext(function($ctx1) {
  6916. return nil;
  6917. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  6918. args: [],
  6919. source: "collectionClass\x0a\x09^ nil",
  6920. messageSends: [],
  6921. referencedClasses: []
  6922. }),
  6923. smalltalk.StreamTest.klass);
  6924. smalltalk.addMethod(
  6925. smalltalk.method({
  6926. selector: "isAbstract",
  6927. protocol: 'testing',
  6928. fn: function (){
  6929. var self=this;
  6930. return smalltalk.withContext(function($ctx1) {
  6931. var $1;
  6932. $1=_st(self._collectionClass())._isNil();
  6933. return $1;
  6934. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  6935. args: [],
  6936. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  6937. messageSends: ["isNil", "collectionClass"],
  6938. referencedClasses: []
  6939. }),
  6940. smalltalk.StreamTest.klass);
  6941. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6942. smalltalk.addMethod(
  6943. smalltalk.method({
  6944. selector: "newCollection",
  6945. protocol: 'accessing',
  6946. fn: function (){
  6947. var self=this;
  6948. return smalltalk.withContext(function($ctx1) {
  6949. var $1;
  6950. $1=[true,(1),(3).__at((4)),"foo"];
  6951. return $1;
  6952. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  6953. args: [],
  6954. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  6955. messageSends: ["@"],
  6956. referencedClasses: []
  6957. }),
  6958. smalltalk.ArrayStreamTest);
  6959. smalltalk.addMethod(
  6960. smalltalk.method({
  6961. selector: "collectionClass",
  6962. protocol: 'accessing',
  6963. fn: function (){
  6964. var self=this;
  6965. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  6966. return smalltalk.withContext(function($ctx1) {
  6967. return $Array();
  6968. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  6969. args: [],
  6970. source: "collectionClass\x0a\x09^ Array",
  6971. messageSends: [],
  6972. referencedClasses: ["Array"]
  6973. }),
  6974. smalltalk.ArrayStreamTest.klass);
  6975. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6976. smalltalk.addMethod(
  6977. smalltalk.method({
  6978. selector: "newCollection",
  6979. protocol: 'accessing',
  6980. fn: function (){
  6981. var self=this;
  6982. return smalltalk.withContext(function($ctx1) {
  6983. return "hello world";
  6984. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  6985. args: [],
  6986. source: "newCollection\x0a\x09^ 'hello world'",
  6987. messageSends: [],
  6988. referencedClasses: []
  6989. }),
  6990. smalltalk.StringStreamTest);
  6991. smalltalk.addMethod(
  6992. smalltalk.method({
  6993. selector: "collectionClass",
  6994. protocol: 'accessing',
  6995. fn: function (){
  6996. var self=this;
  6997. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  6998. return smalltalk.withContext(function($ctx1) {
  6999. return $String();
  7000. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  7001. args: [],
  7002. source: "collectionClass\x0a\x09^ String",
  7003. messageSends: [],
  7004. referencedClasses: ["String"]
  7005. }),
  7006. smalltalk.StringStreamTest.klass);
  7007. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7008. smalltalk.addMethod(
  7009. smalltalk.method({
  7010. selector: "testCopying",
  7011. protocol: 'tests',
  7012. fn: function (){
  7013. var self=this;
  7014. return smalltalk.withContext(function($ctx1) {
  7015. self._assert_equals_(nil._copy(),nil);
  7016. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  7017. args: [],
  7018. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  7019. messageSends: ["assert:equals:", "copy"],
  7020. referencedClasses: []
  7021. }),
  7022. smalltalk.UndefinedTest);
  7023. smalltalk.addMethod(
  7024. smalltalk.method({
  7025. selector: "testDeepCopy",
  7026. protocol: 'tests',
  7027. fn: function (){
  7028. var self=this;
  7029. return smalltalk.withContext(function($ctx1) {
  7030. self._assert_(_st(nil._deepCopy()).__eq(nil));
  7031. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  7032. args: [],
  7033. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  7034. messageSends: ["assert:", "=", "deepCopy"],
  7035. referencedClasses: []
  7036. }),
  7037. smalltalk.UndefinedTest);
  7038. smalltalk.addMethod(
  7039. smalltalk.method({
  7040. selector: "testIfNil",
  7041. protocol: 'tests',
  7042. fn: function (){
  7043. var self=this;
  7044. return smalltalk.withContext(function($ctx1) {
  7045. var $1,$3,$2,$4,$6,$5;
  7046. if(($receiver = nil) == nil || $receiver == null){
  7047. $1=true;
  7048. } else {
  7049. $1=nil;
  7050. };
  7051. self._assert_equals_($1,true);
  7052. $ctx1.sendIdx["assert:equals:"]=1;
  7053. if(($receiver = nil) == nil || $receiver == null){
  7054. $3=nil;
  7055. } else {
  7056. $3=true;
  7057. };
  7058. $2=_st($3).__eq(true);
  7059. $ctx1.sendIdx["="]=1;
  7060. self._deny_($2);
  7061. $ctx1.sendIdx["deny:"]=1;
  7062. if(($receiver = nil) == nil || $receiver == null){
  7063. $4=true;
  7064. } else {
  7065. $4=false;
  7066. };
  7067. self._assert_equals_($4,true);
  7068. if(($receiver = nil) == nil || $receiver == null){
  7069. $6=false;
  7070. } else {
  7071. $6=true;
  7072. };
  7073. $5=_st($6).__eq(true);
  7074. self._deny_($5);
  7075. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  7076. args: [],
  7077. 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",
  7078. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7079. referencedClasses: []
  7080. }),
  7081. smalltalk.UndefinedTest);
  7082. smalltalk.addMethod(
  7083. smalltalk.method({
  7084. selector: "testIsNil",
  7085. protocol: 'tests',
  7086. fn: function (){
  7087. var self=this;
  7088. return smalltalk.withContext(function($ctx1) {
  7089. self._assert_(nil._isNil());
  7090. self._deny_(nil._notNil());
  7091. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  7092. args: [],
  7093. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  7094. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  7095. referencedClasses: []
  7096. }),
  7097. smalltalk.UndefinedTest);
  7098. });