Kernel-Tests.js 270 KB

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