1
0

Kernel-Tests.js 218 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239
  1. (function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4. smalltalk.addMethod(
  5. smalltalk.method({
  6. selector: "testCanClearInterval",
  7. category: 'tests',
  8. fn: function (){
  9. var self=this;
  10. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  11. return smalltalk.withContext(function($ctx1) {
  12. self._shouldnt_raise_((function(){
  13. return smalltalk.withContext(function($ctx2) {
  14. return _st(_st((function(){
  15. return smalltalk.withContext(function($ctx3) {
  16. return _st(_st($Error())._new())._signal();
  17. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  18. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  19. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  20. args: [],
  21. source: "testCanClearInterval\x0a\x09self shouldnt: [([Error new signal] valueWithInterval: 0) clearInterval] raise: Error",
  22. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  23. referencedClasses: ["Error"]
  24. }),
  25. smalltalk.BlockClosureTest);
  26. smalltalk.addMethod(
  27. smalltalk.method({
  28. selector: "testCanClearTimeout",
  29. category: 'tests',
  30. fn: function (){
  31. var self=this;
  32. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  33. return smalltalk.withContext(function($ctx1) {
  34. self._shouldnt_raise_((function(){
  35. return smalltalk.withContext(function($ctx2) {
  36. return _st(_st((function(){
  37. return smalltalk.withContext(function($ctx3) {
  38. return _st(_st($Error())._new())._signal();
  39. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  40. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  41. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  42. args: [],
  43. source: "testCanClearTimeout\x0a\x09self shouldnt: [([Error new signal] valueWithTimeout: 0) clearTimeout] raise: Error",
  44. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  45. referencedClasses: ["Error"]
  46. }),
  47. smalltalk.BlockClosureTest);
  48. smalltalk.addMethod(
  49. smalltalk.method({
  50. selector: "testCompiledSource",
  51. category: 'tests',
  52. fn: function (){
  53. var self=this;
  54. return smalltalk.withContext(function($ctx1) {
  55. self._assert_(_st(_st((function(){
  56. return smalltalk.withContext(function($ctx2) {
  57. return (1).__plus((1));
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  59. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  60. args: [],
  61. source: "testCompiledSource\x0a\x09self assert: ([1+1] compiledSource includesSubString: 'function')",
  62. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  63. referencedClasses: []
  64. }),
  65. smalltalk.BlockClosureTest);
  66. smalltalk.addMethod(
  67. smalltalk.method({
  68. selector: "testCurrySelf",
  69. category: 'tests',
  70. fn: function (){
  71. var self=this;
  72. var curriedMethod,array;
  73. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  74. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  75. return smalltalk.withContext(function($ctx1) {
  76. curriedMethod=_st(_st((function(selfarg,x){
  77. return smalltalk.withContext(function($ctx2) {
  78. return _st(selfarg)._at_(x);
  79. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  80. array=[(3), (1), (4)];
  81. _st(_st($ClassBuilder())._new())._installMethod_forClass_category_(curriedMethod,$Array(),"**test helper");
  82. _st((function(){
  83. return smalltalk.withContext(function($ctx2) {
  84. return self._assert_equals_(_st(array)._foo_((2)),(1));
  85. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  86. return smalltalk.withContext(function($ctx2) {
  87. return _st($Array())._removeCompiledMethod_(curriedMethod);
  88. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  89. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  90. args: [],
  91. 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 ]",
  92. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:category:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  93. referencedClasses: ["ClassBuilder", "Array"]
  94. }),
  95. smalltalk.BlockClosureTest);
  96. smalltalk.addMethod(
  97. smalltalk.method({
  98. selector: "testEnsure",
  99. category: 'tests',
  100. fn: function (){
  101. var self=this;
  102. return smalltalk.withContext(function($ctx1) {
  103. self._assert_equals_(_st((function(){
  104. return smalltalk.withContext(function($ctx2) {
  105. return (3);
  106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  107. return smalltalk.withContext(function($ctx2) {
  108. return (4);
  109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  110. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  111. args: [],
  112. source: "testEnsure\x0a\x09self assert: ([3] ensure: [4]) equals: 3",
  113. messageSends: ["assert:equals:", "ensure:"],
  114. referencedClasses: []
  115. }),
  116. smalltalk.BlockClosureTest);
  117. smalltalk.addMethod(
  118. smalltalk.method({
  119. selector: "testEnsureRaises",
  120. category: 'tests',
  121. fn: function (){
  122. var self=this;
  123. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  124. return smalltalk.withContext(function($ctx1) {
  125. self._should_raise_((function(){
  126. return smalltalk.withContext(function($ctx2) {
  127. return _st((function(){
  128. return smalltalk.withContext(function($ctx3) {
  129. return _st(_st($Error())._new())._signal();
  130. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  131. return smalltalk.withContext(function($ctx3) {
  132. return true;
  133. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  135. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  136. args: [],
  137. source: "testEnsureRaises\x0a\x09self should: [[Error new signal] ensure: [true]] raise: Error",
  138. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  139. referencedClasses: ["Error"]
  140. }),
  141. smalltalk.BlockClosureTest);
  142. smalltalk.addMethod(
  143. smalltalk.method({
  144. selector: "testExceptionSemantics",
  145. category: 'tests',
  146. fn: function (){
  147. var self=this;
  148. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  149. return smalltalk.withContext(function($ctx1) {
  150. self._timeout_((100));
  151. _st(self._async_((function(){
  152. return smalltalk.withContext(function($ctx2) {
  153. return _st((function(){
  154. return smalltalk.withContext(function($ctx3) {
  155. self._assert_(true);
  156. _st($Error())._signal();
  157. self._deny_(true);
  158. return self._finished();
  159. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  160. return smalltalk.withContext(function($ctx3) {
  161. return self._finished();
  162. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  164. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  165. args: [],
  166. 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",
  167. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  168. referencedClasses: ["Error"]
  169. }),
  170. smalltalk.BlockClosureTest);
  171. smalltalk.addMethod(
  172. smalltalk.method({
  173. selector: "testNewWithValues",
  174. category: 'tests',
  175. fn: function (){
  176. var self=this;
  177. return smalltalk.withContext(function($ctx1) {
  178. function theTestPrototype() {this.name = "theTestPrototype";}
  179. function theTestConstructor(arg1, arg2, arg3) {}
  180. theTestConstructor.prototype = new theTestPrototype;
  181. var theWrappedConstructor = _st(theTestConstructor);
  182. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3]);
  183. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  184. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  185. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  186. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  187. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  188. args: [],
  189. 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>",
  190. messageSends: [],
  191. referencedClasses: []
  192. }),
  193. smalltalk.BlockClosureTest);
  194. smalltalk.addMethod(
  195. smalltalk.method({
  196. selector: "testNumArgs",
  197. category: 'tests',
  198. fn: function (){
  199. var self=this;
  200. return smalltalk.withContext(function($ctx1) {
  201. self._assert_equals_(_st((function(){
  202. return smalltalk.withContext(function($ctx2) {
  203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs(),(0));
  204. self._assert_equals_(_st((function(a,b){
  205. return smalltalk.withContext(function($ctx2) {
  206. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs(),(2));
  207. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  208. args: [],
  209. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [:a :b | ] numArgs equals: 2",
  210. messageSends: ["assert:equals:", "numArgs"],
  211. referencedClasses: []
  212. }),
  213. smalltalk.BlockClosureTest);
  214. smalltalk.addMethod(
  215. smalltalk.method({
  216. selector: "testOnDo",
  217. category: 'tests',
  218. fn: function (){
  219. var self=this;
  220. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  221. return smalltalk.withContext(function($ctx1) {
  222. self._assert_(_st((function(){
  223. return smalltalk.withContext(function($ctx2) {
  224. return _st(_st($Error())._new())._signal();
  225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  226. return smalltalk.withContext(function($ctx2) {
  227. return true;
  228. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  229. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  230. args: [],
  231. source: "testOnDo\x0a\x09self assert: ([Error new signal] on: Error do: [:ex | true])",
  232. messageSends: ["assert:", "on:do:", "signal", "new"],
  233. referencedClasses: ["Error"]
  234. }),
  235. smalltalk.BlockClosureTest);
  236. smalltalk.addMethod(
  237. smalltalk.method({
  238. selector: "testValue",
  239. category: 'tests',
  240. fn: function (){
  241. var self=this;
  242. return smalltalk.withContext(function($ctx1) {
  243. self._assert_equals_(_st((function(){
  244. return smalltalk.withContext(function($ctx2) {
  245. return (1).__plus((1));
  246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value(),(2));
  247. self._assert_equals_(_st((function(x){
  248. return smalltalk.withContext(function($ctx2) {
  249. return _st(x).__plus((1));
  250. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  251. self._assert_equals_(_st((function(x,y){
  252. return smalltalk.withContext(function($ctx2) {
  253. return _st(x).__star(y);
  254. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  255. self._assert_equals_(_st((function(a,b,c){
  256. return smalltalk.withContext(function($ctx2) {
  257. return (1);
  258. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value(),(1));
  259. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  260. args: [],
  261. 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",
  262. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  263. referencedClasses: []
  264. }),
  265. smalltalk.BlockClosureTest);
  266. smalltalk.addMethod(
  267. smalltalk.method({
  268. selector: "testValueWithPossibleArguments",
  269. category: 'tests',
  270. fn: function (){
  271. var self=this;
  272. return smalltalk.withContext(function($ctx1) {
  273. self._assert_equals_(_st((function(){
  274. return smalltalk.withContext(function($ctx2) {
  275. return (1);
  276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]),(1));
  277. self._assert_equals_(_st((function(a){
  278. return smalltalk.withContext(function($ctx2) {
  279. return _st(a).__plus((4));
  280. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]),(7));
  281. self._assert_equals_(_st((function(a,b){
  282. return smalltalk.withContext(function($ctx2) {
  283. return _st(a).__plus(b);
  284. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  285. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  286. args: [],
  287. 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.",
  288. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  289. referencedClasses: []
  290. }),
  291. smalltalk.BlockClosureTest);
  292. smalltalk.addMethod(
  293. smalltalk.method({
  294. selector: "testWhileFalse",
  295. category: 'tests',
  296. fn: function (){
  297. var self=this;
  298. var i;
  299. return smalltalk.withContext(function($ctx1) {
  300. i=(0);
  301. _st((function(){
  302. return smalltalk.withContext(function($ctx2) {
  303. return _st(i).__gt((5));
  304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  305. return smalltalk.withContext(function($ctx2) {
  306. i=_st(i).__plus((1));
  307. return i;
  308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  309. self._assert_equals_(i,(6));
  310. i=(0);
  311. _st((function(){
  312. return smalltalk.withContext(function($ctx2) {
  313. i=_st(i).__plus((1));
  314. i;
  315. return _st(i).__gt((5));
  316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  317. self._assert_equals_(i,(6));
  318. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  319. args: [],
  320. 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",
  321. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  322. referencedClasses: []
  323. }),
  324. smalltalk.BlockClosureTest);
  325. smalltalk.addMethod(
  326. smalltalk.method({
  327. selector: "testWhileTrue",
  328. category: 'tests',
  329. fn: function (){
  330. var self=this;
  331. var i;
  332. return smalltalk.withContext(function($ctx1) {
  333. i=(0);
  334. _st((function(){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st(i).__lt((5));
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  338. return smalltalk.withContext(function($ctx2) {
  339. i=_st(i).__plus((1));
  340. return i;
  341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  342. self._assert_equals_(i,(5));
  343. i=(0);
  344. _st((function(){
  345. return smalltalk.withContext(function($ctx2) {
  346. i=_st(i).__plus((1));
  347. i;
  348. return _st(i).__lt((5));
  349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  350. self._assert_equals_(i,(5));
  351. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  352. args: [],
  353. 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",
  354. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  355. referencedClasses: []
  356. }),
  357. smalltalk.BlockClosureTest);
  358. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  359. smalltalk.addMethod(
  360. smalltalk.method({
  361. selector: "testEquality",
  362. category: 'tests',
  363. fn: function (){
  364. var self=this;
  365. return smalltalk.withContext(function($ctx1) {
  366. self._deny_((0).__eq(false));
  367. self._deny_(false.__eq((0)));
  368. self._deny_("".__eq(false));
  369. self._deny_(false.__eq(""));
  370. self._assert_(true.__eq(true));
  371. self._deny_(false.__eq(true));
  372. self._deny_(true.__eq(false));
  373. self._assert_(false.__eq(false));
  374. self._assert_(_st(true._yourself()).__eq(true));
  375. self._assert_(_st(true._yourself()).__eq(true._yourself()));
  376. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  377. args: [],
  378. 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)",
  379. messageSends: ["deny:", "=", "assert:", "yourself"],
  380. referencedClasses: []
  381. }),
  382. smalltalk.BooleanTest);
  383. smalltalk.addMethod(
  384. smalltalk.method({
  385. selector: "testIdentity",
  386. category: 'tests',
  387. fn: function (){
  388. var self=this;
  389. return smalltalk.withContext(function($ctx1) {
  390. self._deny_((0).__eq_eq(false));
  391. self._deny_(false.__eq_eq((0)));
  392. self._deny_("".__eq_eq(false));
  393. self._deny_(false.__eq_eq(""));
  394. self._assert_(true.__eq_eq(true));
  395. self._deny_(false.__eq_eq(true));
  396. self._deny_(true.__eq_eq(false));
  397. self._assert_(false.__eq_eq(false));
  398. self._assert_(_st(true._yourself()).__eq_eq(true));
  399. self._assert_(_st(true._yourself()).__eq_eq(true._yourself()));
  400. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  401. args: [],
  402. 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",
  403. messageSends: ["deny:", "==", "assert:", "yourself"],
  404. referencedClasses: []
  405. }),
  406. smalltalk.BooleanTest);
  407. smalltalk.addMethod(
  408. smalltalk.method({
  409. selector: "testIfTrueIfFalse",
  410. category: 'tests',
  411. fn: function (){
  412. var self=this;
  413. return smalltalk.withContext(function($ctx1) {
  414. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  415. $1=self;
  416. if(smalltalk.assert(true)){
  417. $2="alternative block";
  418. };
  419. _st($1)._assert_equals_($2,"alternative block");
  420. $3=self;
  421. if(! smalltalk.assert(true)){
  422. $4="alternative block";
  423. };
  424. _st($3)._assert_equals_($4,nil);
  425. $5=self;
  426. if(smalltalk.assert(false)){
  427. $6="alternative block";
  428. };
  429. _st($5)._assert_equals_($6,nil);
  430. $7=self;
  431. if(! smalltalk.assert(false)){
  432. $8="alternative block";
  433. };
  434. _st($7)._assert_equals_($8,"alternative block");
  435. $9=self;
  436. if(smalltalk.assert(false)){
  437. $10="alternative block";
  438. } else {
  439. $10="alternative block2";
  440. };
  441. _st($9)._assert_equals_($10,"alternative block2");
  442. $11=self;
  443. if(smalltalk.assert(false)){
  444. $12="alternative block2";
  445. } else {
  446. $12="alternative block";
  447. };
  448. _st($11)._assert_equals_($12,"alternative block");
  449. $13=self;
  450. if(smalltalk.assert(true)){
  451. $14="alternative block";
  452. } else {
  453. $14="alternative block2";
  454. };
  455. _st($13)._assert_equals_($14,"alternative block");
  456. $15=self;
  457. if(smalltalk.assert(true)){
  458. $16="alternative block2";
  459. } else {
  460. $16="alternative block";
  461. };
  462. _st($15)._assert_equals_($16,"alternative block2");
  463. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  464. args: [],
  465. 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'.",
  466. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  467. referencedClasses: []
  468. }),
  469. smalltalk.BooleanTest);
  470. smalltalk.addMethod(
  471. smalltalk.method({
  472. selector: "testIfTrueIfFalseWithBoxing",
  473. category: 'tests',
  474. fn: function (){
  475. var self=this;
  476. return smalltalk.withContext(function($ctx1) {
  477. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$10,$12,$11,$13,$15,$14,$16,$18,$17,$19,$21,$20,$22,$24,$23;
  478. $1=self;
  479. $3=true._yourself();
  480. if(smalltalk.assert($3)){
  481. $2="alternative block";
  482. };
  483. _st($1)._assert_equals_($2,"alternative block");
  484. $4=self;
  485. $6=true._yourself();
  486. if(! smalltalk.assert($6)){
  487. $5="alternative block";
  488. };
  489. _st($4)._assert_equals_($5,nil);
  490. $7=self;
  491. $9=false._yourself();
  492. if(smalltalk.assert($9)){
  493. $8="alternative block";
  494. };
  495. _st($7)._assert_equals_($8,nil);
  496. $10=self;
  497. $12=false._yourself();
  498. if(! smalltalk.assert($12)){
  499. $11="alternative block";
  500. };
  501. _st($10)._assert_equals_($11,"alternative block");
  502. $13=self;
  503. $15=false._yourself();
  504. if(smalltalk.assert($15)){
  505. $14="alternative block";
  506. } else {
  507. $14="alternative block2";
  508. };
  509. _st($13)._assert_equals_($14,"alternative block2");
  510. $16=self;
  511. $18=false._yourself();
  512. if(smalltalk.assert($18)){
  513. $17="alternative block2";
  514. } else {
  515. $17="alternative block";
  516. };
  517. _st($16)._assert_equals_($17,"alternative block");
  518. $19=self;
  519. $21=true._yourself();
  520. if(smalltalk.assert($21)){
  521. $20="alternative block";
  522. } else {
  523. $20="alternative block2";
  524. };
  525. _st($19)._assert_equals_($20,"alternative block");
  526. $22=self;
  527. $24=true._yourself();
  528. if(smalltalk.assert($24)){
  529. $23="alternative block2";
  530. } else {
  531. $23="alternative block";
  532. };
  533. _st($22)._assert_equals_($23,"alternative block2");
  534. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  535. args: [],
  536. 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'.",
  537. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  538. referencedClasses: []
  539. }),
  540. smalltalk.BooleanTest);
  541. smalltalk.addMethod(
  542. smalltalk.method({
  543. selector: "testLogic",
  544. category: 'tests',
  545. fn: function (){
  546. var self=this;
  547. return smalltalk.withContext(function($ctx1) {
  548. var $1,$2,$3,$4,$5,$6,$7,$8;
  549. $1=self;
  550. _st($1)._assert_(true.__and(true));
  551. _st($1)._deny_(true.__and(false));
  552. _st($1)._deny_(false.__and(true));
  553. $2=_st($1)._deny_(false.__and(false));
  554. $3=self;
  555. _st($3)._assert_(true.__or(true));
  556. _st($3)._assert_(true.__or(false));
  557. _st($3)._assert_(false.__or(true));
  558. $4=_st($3)._deny_(false.__or(false));
  559. $5=self;
  560. _st($5)._assert_(true.__and((1).__gt((0))));
  561. _st($5)._deny_(_st((1).__gt((0))).__and(false));
  562. $6=_st($5)._deny_(_st((1).__gt((0))).__and((1).__gt((2))));
  563. $7=self;
  564. _st($7)._assert_(false.__or((1).__gt((0))));
  565. _st($7)._assert_(_st((1).__gt((0))).__or(false));
  566. $8=_st($7)._assert_(_st((1).__gt((0))).__or((1).__gt((2))));
  567. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  568. args: [],
  569. 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))",
  570. messageSends: ["assert:", "&", "deny:", "|", ">"],
  571. referencedClasses: []
  572. }),
  573. smalltalk.BooleanTest);
  574. smalltalk.addMethod(
  575. smalltalk.method({
  576. selector: "testLogicKeywords",
  577. category: 'tests',
  578. fn: function (){
  579. var self=this;
  580. return smalltalk.withContext(function($ctx1) {
  581. var $1,$2,$3,$4,$5,$6,$7,$8;
  582. $1=self;
  583. _st($1)._assert_(true._and_((function(){
  584. return smalltalk.withContext(function($ctx2) {
  585. return true;
  586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  587. _st($1)._deny_(true._and_((function(){
  588. return smalltalk.withContext(function($ctx2) {
  589. return false;
  590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})));
  591. _st($1)._deny_(false._and_((function(){
  592. return smalltalk.withContext(function($ctx2) {
  593. return true;
  594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})));
  595. $2=_st($1)._deny_(false._and_((function(){
  596. return smalltalk.withContext(function($ctx2) {
  597. return false;
  598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})));
  599. $3=self;
  600. _st($3)._assert_(true._or_((function(){
  601. return smalltalk.withContext(function($ctx2) {
  602. return true;
  603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})})));
  604. _st($3)._assert_(true._or_((function(){
  605. return smalltalk.withContext(function($ctx2) {
  606. return false;
  607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})})));
  608. _st($3)._assert_(false._or_((function(){
  609. return smalltalk.withContext(function($ctx2) {
  610. return true;
  611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})})));
  612. $4=_st($3)._deny_(false._or_((function(){
  613. return smalltalk.withContext(function($ctx2) {
  614. return false;
  615. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})));
  616. $5=self;
  617. _st($5)._assert_(true._and_((function(){
  618. return smalltalk.withContext(function($ctx2) {
  619. return (1).__gt((0));
  620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})})));
  621. _st($5)._deny_(_st((1).__gt((0)))._and_((function(){
  622. return smalltalk.withContext(function($ctx2) {
  623. return false;
  624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})})));
  625. $6=_st($5)._deny_(_st((1).__gt((0)))._and_((function(){
  626. return smalltalk.withContext(function($ctx2) {
  627. return (1).__gt((2));
  628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})})));
  629. $7=self;
  630. _st($7)._assert_(false._or_((function(){
  631. return smalltalk.withContext(function($ctx2) {
  632. return (1).__gt((0));
  633. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})));
  634. _st($7)._assert_(_st((1).__gt((0)))._or_((function(){
  635. return smalltalk.withContext(function($ctx2) {
  636. return false;
  637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})})));
  638. $8=_st($7)._assert_(_st((1).__gt((0)))._or_((function(){
  639. return smalltalk.withContext(function($ctx2) {
  640. return (1).__gt((2));
  641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})})));
  642. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  643. args: [],
  644. 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 ])",
  645. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  646. referencedClasses: []
  647. }),
  648. smalltalk.BooleanTest);
  649. smalltalk.addMethod(
  650. smalltalk.method({
  651. selector: "testNonBooleanError",
  652. category: 'tests',
  653. fn: function (){
  654. var self=this;
  655. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  656. return smalltalk.withContext(function($ctx1) {
  657. self._should_raise_((function(){
  658. return smalltalk.withContext(function($ctx2) {
  659. if(smalltalk.assert("")){
  660. } else {
  661. };
  662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  663. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  664. args: [],
  665. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  666. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  667. referencedClasses: ["NonBooleanReceiver"]
  668. }),
  669. smalltalk.BooleanTest);
  670. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  671. smalltalk.addMethod(
  672. smalltalk.method({
  673. selector: "setUp",
  674. category: 'running',
  675. fn: function (){
  676. var self=this;
  677. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  678. return smalltalk.withContext(function($ctx1) {
  679. self["@builder"]=_st($ClassBuilder())._new();
  680. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  681. args: [],
  682. source: "setUp\x0a\x09builder := ClassBuilder new",
  683. messageSends: ["new"],
  684. referencedClasses: ["ClassBuilder"]
  685. }),
  686. smalltalk.ClassBuilderTest);
  687. smalltalk.addMethod(
  688. smalltalk.method({
  689. selector: "tearDown",
  690. category: 'running',
  691. fn: function (){
  692. var self=this;
  693. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  694. return smalltalk.withContext(function($ctx1) {
  695. var $1;
  696. $1=self["@theClass"];
  697. if(($receiver = $1) == nil || $receiver == undefined){
  698. $1;
  699. } else {
  700. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  701. self["@theClass"]=nil;
  702. self["@theClass"];
  703. };
  704. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  705. args: [],
  706. source: "tearDown\x0a\x09theClass ifNotNil: [Smalltalk current removeClass: theClass. theClass := nil]",
  707. messageSends: ["ifNotNil:", "removeClass:", "current"],
  708. referencedClasses: ["Smalltalk"]
  709. }),
  710. smalltalk.ClassBuilderTest);
  711. smalltalk.addMethod(
  712. smalltalk.method({
  713. selector: "testClassCopy",
  714. category: 'tests',
  715. fn: function (){
  716. var self=this;
  717. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  718. return smalltalk.withContext(function($ctx1) {
  719. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  720. self._assert_(_st(_st(self["@theClass"])._superclass()).__eq_eq(_st($ObjectMock())._superclass()));
  721. self._assert_(_st(_st(self["@theClass"])._instanceVariableNames()).__eq_eq(_st($ObjectMock())._instanceVariableNames()));
  722. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  723. self._assert_(_st(_st(self["@theClass"])._package()).__eq_eq(_st($ObjectMock())._package()));
  724. self._assert_equals_(_st(_st(self["@theClass"])._methodDictionary())._keys(),_st(_st($ObjectMock())._methodDictionary())._keys());
  725. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  726. args: [],
  727. 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",
  728. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  729. referencedClasses: ["ObjectMock"]
  730. }),
  731. smalltalk.ClassBuilderTest);
  732. smalltalk.addMethod(
  733. smalltalk.method({
  734. selector: "testClassMigration",
  735. category: 'tests',
  736. fn: function (){
  737. var self=this;
  738. var instance,oldClass;
  739. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  740. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  741. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  742. return smalltalk.withContext(function($ctx1) {
  743. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  744. instance=_st(_st(_st($Smalltalk())._current())._at_("ObjectMock2"))._new();
  745. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  746. self._deny_(_st(oldClass).__eq_eq($ObjectMock2()));
  747. self._assert_(_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock()));
  748. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  749. self._assert_equals_(_st($ObjectMock2())._selectors(),_st(oldClass)._selectors());
  750. self._assert_equals_(_st($ObjectMock2())._comment(),_st(oldClass)._comment());
  751. self._assert_equals_(_st(_st($ObjectMock2())._package())._name(),"Kernel-Tests");
  752. self._deny_(_st(_st(instance)._class()).__eq_eq($ObjectMock2()));
  753. self._assert_(_st(_st(_st($Smalltalk())._current())._at_(_st(_st(instance)._class())._name()))._isNil());
  754. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  755. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  756. args: [],
  757. 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",
  758. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  759. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  760. }),
  761. smalltalk.ClassBuilderTest);
  762. smalltalk.addMethod(
  763. smalltalk.method({
  764. selector: "testClassMigrationWithClassInstanceVariables",
  765. category: 'tests',
  766. fn: function (){
  767. var self=this;
  768. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  769. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  770. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  771. return smalltalk.withContext(function($ctx1) {
  772. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  773. _st(_st($ObjectMock2())._class())._instanceVariableNames_("foo bar");
  774. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  775. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  776. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  777. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  778. args: [],
  779. 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",
  780. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  781. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  782. }),
  783. smalltalk.ClassBuilderTest);
  784. smalltalk.addMethod(
  785. smalltalk.method({
  786. selector: "testClassMigrationWithSubclasses",
  787. category: 'tests',
  788. fn: function (){
  789. var self=this;
  790. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  791. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  792. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  793. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  794. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  795. return smalltalk.withContext(function($ctx1) {
  796. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  797. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  798. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  799. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  800. self._assert_(_st(_st($ObjectMock())._subclasses())._includes_($ObjectMock2()));
  801. self._assert_(_st(_st($ObjectMock2())._subclasses())._includes_($ObjectMock3()));
  802. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  803. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  804. return smalltalk.withContext(function($ctx2) {
  805. return _st(_st($Smalltalk())._current())._removeClass_(each);
  806. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  807. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  808. args: [],
  809. 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 ]",
  810. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  811. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  812. }),
  813. smalltalk.ClassBuilderTest);
  814. smalltalk.addMethod(
  815. smalltalk.method({
  816. selector: "testInstanceVariableNames",
  817. category: 'tests',
  818. fn: function (){
  819. var self=this;
  820. return smalltalk.withContext(function($ctx1) {
  821. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  822. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  823. args: [],
  824. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  825. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  826. referencedClasses: []
  827. }),
  828. smalltalk.ClassBuilderTest);
  829. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  830. smalltalk.addMethod(
  831. smalltalk.method({
  832. selector: "assertSameContents:as:",
  833. category: 'convenience',
  834. fn: function (aCollection,anotherCollection){
  835. var self=this;
  836. return smalltalk.withContext(function($ctx1) {
  837. self._assert_(_st(_st(aCollection)._size()).__eq(_st(anotherCollection)._size()));
  838. _st(aCollection)._do_((function(each){
  839. return smalltalk.withContext(function($ctx2) {
  840. return self._assert_(_st(_st(aCollection)._occurrencesOf_(each)).__eq(_st(anotherCollection)._occurrencesOf_(each)));
  841. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  842. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  843. args: ["aCollection", "anotherCollection"],
  844. 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)) ]",
  845. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  846. referencedClasses: []
  847. }),
  848. smalltalk.CollectionTest);
  849. smalltalk.addMethod(
  850. smalltalk.method({
  851. selector: "collection",
  852. category: 'accessing',
  853. fn: function (){
  854. var self=this;
  855. return smalltalk.withContext(function($ctx1) {
  856. var $1;
  857. $1=_st(self._collectionClass())._withAll_(self._defaultValues());
  858. return $1;
  859. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  860. args: [],
  861. source: "collection\x0a\x09^ self collectionClass withAll: self defaultValues",
  862. messageSends: ["withAll:", "collectionClass", "defaultValues"],
  863. referencedClasses: []
  864. }),
  865. smalltalk.CollectionTest);
  866. smalltalk.addMethod(
  867. smalltalk.method({
  868. selector: "collectionClass",
  869. category: 'accessing',
  870. fn: function (){
  871. var self=this;
  872. return smalltalk.withContext(function($ctx1) {
  873. var $1;
  874. $1=_st(self._class())._collectionClass();
  875. return $1;
  876. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  877. args: [],
  878. source: "collectionClass\x0a\x09^ self class collectionClass",
  879. messageSends: ["collectionClass", "class"],
  880. referencedClasses: []
  881. }),
  882. smalltalk.CollectionTest);
  883. smalltalk.addMethod(
  884. smalltalk.method({
  885. selector: "collectionWithDuplicates",
  886. category: 'accessing',
  887. fn: function (){
  888. var self=this;
  889. return smalltalk.withContext(function($ctx1) {
  890. var $1;
  891. $1=_st(self._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  892. return $1;
  893. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  894. args: [],
  895. source: "collectionWithDuplicates\x0a\x09^ self collectionClass withAll: #('a' 'b' 'c' 1 2 1 'a')",
  896. messageSends: ["withAll:", "collectionClass"],
  897. referencedClasses: []
  898. }),
  899. smalltalk.CollectionTest);
  900. smalltalk.addMethod(
  901. smalltalk.method({
  902. selector: "defaultValues",
  903. category: 'accessing',
  904. fn: function (){
  905. var self=this;
  906. return smalltalk.withContext(function($ctx1) {
  907. var $1;
  908. $1=[(1), (2), (3), (-4)];
  909. return $1;
  910. }, function($ctx1) {$ctx1.fill(self,"defaultValues",{},smalltalk.CollectionTest)})},
  911. args: [],
  912. source: "defaultValues\x0a\x09^ #(1 2 3 -4)",
  913. messageSends: [],
  914. referencedClasses: []
  915. }),
  916. smalltalk.CollectionTest);
  917. smalltalk.addMethod(
  918. smalltalk.method({
  919. selector: "isCollectionReadOnly",
  920. category: 'testing',
  921. fn: function (){
  922. var self=this;
  923. return smalltalk.withContext(function($ctx1) {
  924. return false;
  925. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  926. args: [],
  927. source: "isCollectionReadOnly\x0a\x09^ false",
  928. messageSends: [],
  929. referencedClasses: []
  930. }),
  931. smalltalk.CollectionTest);
  932. smalltalk.addMethod(
  933. smalltalk.method({
  934. selector: "testAsArray",
  935. category: 'tests',
  936. fn: function (){
  937. var self=this;
  938. return smalltalk.withContext(function($ctx1) {
  939. self._assertSameContents_as_(self._collection(),_st(self._collection())._asArray());
  940. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  941. args: [],
  942. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  943. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  944. referencedClasses: []
  945. }),
  946. smalltalk.CollectionTest);
  947. smalltalk.addMethod(
  948. smalltalk.method({
  949. selector: "testAsOrderedCollection",
  950. category: 'tests',
  951. fn: function (){
  952. var self=this;
  953. return smalltalk.withContext(function($ctx1) {
  954. self._assertSameContents_as_(self._collection(),_st(self._collection())._asOrderedCollection());
  955. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  956. args: [],
  957. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  958. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  959. referencedClasses: []
  960. }),
  961. smalltalk.CollectionTest);
  962. smalltalk.addMethod(
  963. smalltalk.method({
  964. selector: "testAsSet",
  965. category: 'tests',
  966. fn: function (){
  967. var self=this;
  968. var c,set;
  969. return smalltalk.withContext(function($ctx1) {
  970. c=self._collectionWithDuplicates();
  971. set=_st(c)._asSet();
  972. self._assert_equals_(_st(set)._size(),(5));
  973. _st(c)._do_((function(each){
  974. return smalltalk.withContext(function($ctx2) {
  975. return self._assert_(_st(set)._includes_(each));
  976. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  977. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  978. args: [],
  979. 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) ]",
  980. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  981. referencedClasses: []
  982. }),
  983. smalltalk.CollectionTest);
  984. smalltalk.addMethod(
  985. smalltalk.method({
  986. selector: "testCollect",
  987. category: 'tests',
  988. fn: function (){
  989. var self=this;
  990. var newCollection;
  991. return smalltalk.withContext(function($ctx1) {
  992. newCollection=[(1), (2), (3), (4)];
  993. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  994. return smalltalk.withContext(function($ctx2) {
  995. return _st(each)._abs();
  996. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  997. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  998. args: [],
  999. 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",
  1000. messageSends: ["assertSameContents:as:", "collect:", "collection", "abs"],
  1001. referencedClasses: []
  1002. }),
  1003. smalltalk.CollectionTest);
  1004. smalltalk.addMethod(
  1005. smalltalk.method({
  1006. selector: "testDetect",
  1007. category: 'tests',
  1008. fn: function (){
  1009. var self=this;
  1010. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1011. return smalltalk.withContext(function($ctx1) {
  1012. self._assert_equals_(_st(self._collection())._detect_((function(each){
  1013. return smalltalk.withContext(function($ctx2) {
  1014. return _st(each).__lt((0));
  1015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),(-4));
  1016. self._should_raise_((function(){
  1017. return smalltalk.withContext(function($ctx2) {
  1018. return _st(self._collection())._detect_((function(each){
  1019. return smalltalk.withContext(function($ctx3) {
  1020. return _st(each).__eq((6));
  1021. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  1022. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  1023. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1024. args: [],
  1025. 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",
  1026. messageSends: ["assert:equals:", "detect:", "collection", "<", "should:raise:", "="],
  1027. referencedClasses: ["Error"]
  1028. }),
  1029. smalltalk.CollectionTest);
  1030. smalltalk.addMethod(
  1031. smalltalk.method({
  1032. selector: "testDo",
  1033. category: 'tests',
  1034. fn: function (){
  1035. var self=this;
  1036. var newCollection;
  1037. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1038. return smalltalk.withContext(function($ctx1) {
  1039. newCollection=_st($OrderedCollection())._new();
  1040. _st(self._collection())._do_((function(each){
  1041. return smalltalk.withContext(function($ctx2) {
  1042. return _st(newCollection)._add_(each);
  1043. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1044. self._assertSameContents_as_(self._collection(),newCollection);
  1045. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1046. args: [],
  1047. 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",
  1048. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:"],
  1049. referencedClasses: ["OrderedCollection"]
  1050. }),
  1051. smalltalk.CollectionTest);
  1052. smalltalk.addMethod(
  1053. smalltalk.method({
  1054. selector: "testIsEmpty",
  1055. category: 'tests',
  1056. fn: function (){
  1057. var self=this;
  1058. return smalltalk.withContext(function($ctx1) {
  1059. self._assert_(_st(_st(self._collectionClass())._new())._isEmpty());
  1060. self._deny_(_st(self._collection())._isEmpty());
  1061. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1062. args: [],
  1063. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1064. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1065. referencedClasses: []
  1066. }),
  1067. smalltalk.CollectionTest);
  1068. smalltalk.addMethod(
  1069. smalltalk.method({
  1070. selector: "testSelect",
  1071. category: 'tests',
  1072. fn: function (){
  1073. var self=this;
  1074. var newCollection;
  1075. return smalltalk.withContext(function($ctx1) {
  1076. newCollection=[(2), (-4)];
  1077. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  1078. return smalltalk.withContext(function($ctx2) {
  1079. return _st(each)._even();
  1080. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1081. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1082. args: [],
  1083. 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",
  1084. messageSends: ["assertSameContents:as:", "select:", "collection", "even"],
  1085. referencedClasses: []
  1086. }),
  1087. smalltalk.CollectionTest);
  1088. smalltalk.addMethod(
  1089. smalltalk.method({
  1090. selector: "testSize",
  1091. category: 'tests',
  1092. fn: function (){
  1093. var self=this;
  1094. return smalltalk.withContext(function($ctx1) {
  1095. self._assert_equals_(_st(_st(self._collectionClass())._new())._size(),(0));
  1096. self._assert_equals_(_st(self._collection())._size(),(4));
  1097. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  1098. args: [],
  1099. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self collection size equals: 4",
  1100. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"],
  1101. referencedClasses: []
  1102. }),
  1103. smalltalk.CollectionTest);
  1104. smalltalk.addMethod(
  1105. smalltalk.method({
  1106. selector: "collectionClass",
  1107. category: 'accessing',
  1108. fn: function (){
  1109. var self=this;
  1110. return smalltalk.withContext(function($ctx1) {
  1111. return nil;
  1112. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  1113. args: [],
  1114. source: "collectionClass\x0a\x09^ nil",
  1115. messageSends: [],
  1116. referencedClasses: []
  1117. }),
  1118. smalltalk.CollectionTest.klass);
  1119. smalltalk.addMethod(
  1120. smalltalk.method({
  1121. selector: "isAbstract",
  1122. category: 'testing',
  1123. fn: function (){
  1124. var self=this;
  1125. return smalltalk.withContext(function($ctx1) {
  1126. var $1;
  1127. $1=_st(self._collectionClass())._isNil();
  1128. return $1;
  1129. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  1130. args: [],
  1131. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1132. messageSends: ["isNil", "collectionClass"],
  1133. referencedClasses: []
  1134. }),
  1135. smalltalk.CollectionTest.klass);
  1136. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1137. smalltalk.addMethod(
  1138. smalltalk.method({
  1139. selector: "testAt",
  1140. category: 'tests',
  1141. fn: function (){
  1142. var self=this;
  1143. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1144. return smalltalk.withContext(function($ctx1) {
  1145. self._assert_equals_(_st(self._collection())._at_((4)),(-4));
  1146. self._should_raise_((function(){
  1147. return smalltalk.withContext(function($ctx2) {
  1148. return _st(self._collection())._at_((5));
  1149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1150. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  1151. args: [],
  1152. source: "testAt\x0a\x09self assert: (self collection at: 4) equals: -4.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1153. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1154. referencedClasses: ["Error"]
  1155. }),
  1156. smalltalk.IndexableCollectionTest);
  1157. smalltalk.addMethod(
  1158. smalltalk.method({
  1159. selector: "testAtIfAbsent",
  1160. category: 'tests',
  1161. fn: function (){
  1162. var self=this;
  1163. return smalltalk.withContext(function($ctx1) {
  1164. self._assert_equals_(_st(self._collection())._at_ifAbsent_(_st(_st(self._collection())._size()).__plus((1)),(function(){
  1165. return smalltalk.withContext(function($ctx2) {
  1166. return "none";
  1167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"none");
  1168. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  1169. args: [],
  1170. source: "testAtIfAbsent\x0a\x09self assert: (self collection at: (self collection size + 1) ifAbsent: [ 'none' ]) equals: 'none'",
  1171. messageSends: ["assert:equals:", "at:ifAbsent:", "collection", "+", "size"],
  1172. referencedClasses: []
  1173. }),
  1174. smalltalk.IndexableCollectionTest);
  1175. smalltalk.addMethod(
  1176. smalltalk.method({
  1177. selector: "testContains",
  1178. category: 'tests',
  1179. fn: function (){
  1180. var self=this;
  1181. var collection;
  1182. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1183. return smalltalk.withContext(function($ctx1) {
  1184. collection=self._collection();
  1185. self._assert_(_st(self._collection())._contains_((function(each){
  1186. return smalltalk.withContext(function($ctx2) {
  1187. return _st(each).__eq(_st(self._collection())._first());
  1188. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
  1189. self._deny_(_st(self._collection())._contains_((function(each){
  1190. return smalltalk.withContext(function($ctx2) {
  1191. return _st(each).__eq(_st($Object())._new());
  1192. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1193. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1194. args: [],
  1195. 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 ])",
  1196. messageSends: ["collection", "assert:", "contains:", "=", "first", "deny:", "new"],
  1197. referencedClasses: ["Object"]
  1198. }),
  1199. smalltalk.IndexableCollectionTest);
  1200. smalltalk.addMethod(
  1201. smalltalk.method({
  1202. selector: "testIndexOf",
  1203. category: 'tests',
  1204. fn: function (){
  1205. var self=this;
  1206. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1207. return smalltalk.withContext(function($ctx1) {
  1208. self._assert_equals_(_st(self._collection())._indexOf_((2)),(2));
  1209. self._should_raise_((function(){
  1210. return smalltalk.withContext(function($ctx2) {
  1211. return _st(self._collection())._indexOf_((999));
  1212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1213. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1214. return smalltalk.withContext(function($ctx2) {
  1215. return "sentinel";
  1216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  1217. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  1218. args: [],
  1219. 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'",
  1220. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1221. referencedClasses: ["Error"]
  1222. }),
  1223. smalltalk.IndexableCollectionTest);
  1224. smalltalk.addMethod(
  1225. smalltalk.method({
  1226. selector: "testWithIndexDo",
  1227. category: 'tests',
  1228. fn: function (){
  1229. var self=this;
  1230. var collection;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. collection=self._collection();
  1233. _st(self._collection())._withIndexDo_((function(each,index){
  1234. return smalltalk.withContext(function($ctx2) {
  1235. return self._assert_equals_(_st(collection)._at_(index),each);
  1236. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  1237. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1238. args: [],
  1239. 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 ]",
  1240. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  1241. referencedClasses: []
  1242. }),
  1243. smalltalk.IndexableCollectionTest);
  1244. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1245. smalltalk.addMethod(
  1246. smalltalk.method({
  1247. selector: "collection",
  1248. category: 'accessing',
  1249. fn: function (){
  1250. var self=this;
  1251. return smalltalk.withContext(function($ctx1) {
  1252. var $1;
  1253. $1=smalltalk.HashedCollection._from_(["b".__minus_gt((1)),"a".__minus_gt((2)),"c".__minus_gt((3)),"d".__minus_gt((-4))]);
  1254. return $1;
  1255. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  1256. args: [],
  1257. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  1258. messageSends: ["->"],
  1259. referencedClasses: []
  1260. }),
  1261. smalltalk.HashedCollectionTest);
  1262. smalltalk.addMethod(
  1263. smalltalk.method({
  1264. selector: "collectionWithDuplicates",
  1265. category: 'accessing',
  1266. fn: function (){
  1267. var self=this;
  1268. return smalltalk.withContext(function($ctx1) {
  1269. var $1;
  1270. $1=smalltalk.HashedCollection._from_(["b".__minus_gt((1)),"a".__minus_gt((2)),"c".__minus_gt((3)),"d".__minus_gt((-4)),"e".__minus_gt((1)),"f".__minus_gt((2)),"g".__minus_gt((10))]);
  1271. return $1;
  1272. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  1273. args: [],
  1274. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  1275. messageSends: ["->"],
  1276. referencedClasses: []
  1277. }),
  1278. smalltalk.HashedCollectionTest);
  1279. smalltalk.addMethod(
  1280. smalltalk.method({
  1281. selector: "testAsDictionary",
  1282. category: 'tests',
  1283. fn: function (){
  1284. var self=this;
  1285. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1286. return smalltalk.withContext(function($ctx1) {
  1287. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  1288. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  1289. args: [],
  1290. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  1291. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  1292. referencedClasses: ["Dictionary"]
  1293. }),
  1294. smalltalk.HashedCollectionTest);
  1295. smalltalk.addMethod(
  1296. smalltalk.method({
  1297. selector: "testAt",
  1298. category: 'tests',
  1299. fn: function (){
  1300. var self=this;
  1301. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1302. return smalltalk.withContext(function($ctx1) {
  1303. self._assert_equals_(_st(self._collection())._at_("a"),(2));
  1304. self._should_raise_((function(){
  1305. return smalltalk.withContext(function($ctx2) {
  1306. return _st(self._collection())._at_((5));
  1307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1308. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.HashedCollectionTest)})},
  1309. args: [],
  1310. source: "testAt\x0a\x09self assert: (self collection at: 'a') equals: 2.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1311. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1312. referencedClasses: ["Error"]
  1313. }),
  1314. smalltalk.HashedCollectionTest);
  1315. smalltalk.addMethod(
  1316. smalltalk.method({
  1317. selector: "testContains",
  1318. category: 'tests',
  1319. fn: function (){
  1320. var self=this;
  1321. var collection;
  1322. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1323. return smalltalk.withContext(function($ctx1) {
  1324. collection=self._collection();
  1325. self._assert_(_st(self._collection())._contains_((function(each){
  1326. return smalltalk.withContext(function($ctx2) {
  1327. return _st(each).__eq(_st(_st(self._collection())._values())._first());
  1328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
  1329. self._deny_(_st(self._collection())._contains_((function(each){
  1330. return smalltalk.withContext(function($ctx2) {
  1331. return _st(each).__eq(_st($Object())._new());
  1332. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1333. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.HashedCollectionTest)})},
  1334. args: [],
  1335. 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 ])",
  1336. messageSends: ["collection", "assert:", "contains:", "=", "first", "values", "deny:", "new"],
  1337. referencedClasses: ["Object"]
  1338. }),
  1339. smalltalk.HashedCollectionTest);
  1340. smalltalk.addMethod(
  1341. smalltalk.method({
  1342. selector: "testFrom",
  1343. category: 'tests',
  1344. fn: function (){
  1345. var self=this;
  1346. var associations;
  1347. return smalltalk.withContext(function($ctx1) {
  1348. associations=["a".__minus_gt((1)),"b".__minus_gt((2))];
  1349. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),smalltalk.HashedCollection._from_(["a".__minus_gt((1)),"b".__minus_gt((2))]));
  1350. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  1351. args: [],
  1352. 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 }.",
  1353. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  1354. referencedClasses: []
  1355. }),
  1356. smalltalk.HashedCollectionTest);
  1357. smalltalk.addMethod(
  1358. smalltalk.method({
  1359. selector: "testIndexOf",
  1360. category: 'tests',
  1361. fn: function (){
  1362. var self=this;
  1363. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1364. return smalltalk.withContext(function($ctx1) {
  1365. self._assert_equals_(_st(self._collection())._indexOf_((2)),"a");
  1366. self._should_raise_((function(){
  1367. return smalltalk.withContext(function($ctx2) {
  1368. return _st(self._collection())._indexOf_((999));
  1369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1370. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1371. return smalltalk.withContext(function($ctx2) {
  1372. return "sentinel";
  1373. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  1374. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.HashedCollectionTest)})},
  1375. args: [],
  1376. 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'",
  1377. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1378. referencedClasses: ["Error"]
  1379. }),
  1380. smalltalk.HashedCollectionTest);
  1381. smalltalk.addMethod(
  1382. smalltalk.method({
  1383. selector: "testNewFromPairs",
  1384. category: 'tests',
  1385. fn: function (){
  1386. var self=this;
  1387. var flattenedAssociations;
  1388. return smalltalk.withContext(function($ctx1) {
  1389. flattenedAssociations=["a",(1),"b",(2)];
  1390. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),smalltalk.HashedCollection._from_(["a".__minus_gt((1)),"b".__minus_gt((2))]));
  1391. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  1392. args: [],
  1393. 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 }.",
  1394. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  1395. referencedClasses: []
  1396. }),
  1397. smalltalk.HashedCollectionTest);
  1398. smalltalk.addMethod(
  1399. smalltalk.method({
  1400. selector: "collectionClass",
  1401. category: 'accessing',
  1402. fn: function (){
  1403. var self=this;
  1404. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1405. return smalltalk.withContext(function($ctx1) {
  1406. var $1;
  1407. $1=$HashedCollection();
  1408. return $1;
  1409. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  1410. args: [],
  1411. source: "collectionClass\x0a\x09^ HashedCollection",
  1412. messageSends: [],
  1413. referencedClasses: ["HashedCollection"]
  1414. }),
  1415. smalltalk.HashedCollectionTest.klass);
  1416. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  1417. smalltalk.addMethod(
  1418. smalltalk.method({
  1419. selector: "collection",
  1420. category: 'accessing',
  1421. fn: function (){
  1422. var self=this;
  1423. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1424. return smalltalk.withContext(function($ctx1) {
  1425. var $2,$3,$1;
  1426. $2=_st($Dictionary())._new();
  1427. _st($2)._at_put_((1),(1));
  1428. _st($2)._at_put_("a",(2));
  1429. _st($2)._at_put_(true,(3));
  1430. _st($2)._at_put_((4),(-4));
  1431. $3=_st($2)._yourself();
  1432. $1=$3;
  1433. return $1;
  1434. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  1435. args: [],
  1436. 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",
  1437. messageSends: ["at:put:", "new", "yourself"],
  1438. referencedClasses: ["Dictionary"]
  1439. }),
  1440. smalltalk.DictionaryTest);
  1441. smalltalk.addMethod(
  1442. smalltalk.method({
  1443. selector: "collectionWithDuplicates",
  1444. category: 'accessing',
  1445. fn: function (){
  1446. var self=this;
  1447. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1448. return smalltalk.withContext(function($ctx1) {
  1449. var $2,$3,$1;
  1450. $2=_st($Dictionary())._new();
  1451. _st($2)._at_put_((1),(1));
  1452. _st($2)._at_put_("a",(2));
  1453. _st($2)._at_put_(true,(3));
  1454. _st($2)._at_put_((4),(-4));
  1455. _st($2)._at_put_("b",(1));
  1456. _st($2)._at_put_((3),(3));
  1457. _st($2)._at_put_(false,(12));
  1458. $3=_st($2)._yourself();
  1459. $1=$3;
  1460. return $1;
  1461. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  1462. args: [],
  1463. 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",
  1464. messageSends: ["at:put:", "new", "yourself"],
  1465. referencedClasses: ["Dictionary"]
  1466. }),
  1467. smalltalk.DictionaryTest);
  1468. smalltalk.addMethod(
  1469. smalltalk.method({
  1470. selector: "testAccessing",
  1471. category: 'tests',
  1472. fn: function (){
  1473. var self=this;
  1474. var d;
  1475. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1476. return smalltalk.withContext(function($ctx1) {
  1477. d=_st($Dictionary())._new();
  1478. _st(d)._at_put_("hello","world");
  1479. self._assert_equals_(_st(d)._at_("hello"),"world");
  1480. self._assert_equals_(_st(d)._at_ifAbsent_("hello",(function(){
  1481. return smalltalk.withContext(function($ctx2) {
  1482. return nil;
  1483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"world");
  1484. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  1485. return smalltalk.withContext(function($ctx2) {
  1486. return nil;
  1487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  1488. self._assert_(_st(d)._includesKey_("hello"));
  1489. self._deny_(_st(d)._includesKey_("foo"));
  1490. _st(d)._at_put_((1),(2));
  1491. self._assert_equals_(_st(d)._at_((1)),(2));
  1492. _st(d)._at_put_((1).__at((3)),(3));
  1493. self._assert_equals_(_st(d)._at_((1).__at((3))),(3));
  1494. self._assert_(_st(d)._includesKey_((1).__at((3))));
  1495. self._deny_(_st(d)._includesKey_((3).__at((1))));
  1496. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  1497. args: [],
  1498. 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)",
  1499. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  1500. referencedClasses: ["Dictionary"]
  1501. }),
  1502. smalltalk.DictionaryTest);
  1503. smalltalk.addMethod(
  1504. smalltalk.method({
  1505. selector: "testAsHashedCollection",
  1506. category: 'tests',
  1507. fn: function (){
  1508. var self=this;
  1509. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1510. return smalltalk.withContext(function($ctx1) {
  1511. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  1512. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  1513. args: [],
  1514. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  1515. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  1516. referencedClasses: ["HashedCollection"]
  1517. }),
  1518. smalltalk.DictionaryTest);
  1519. smalltalk.addMethod(
  1520. smalltalk.method({
  1521. selector: "testDynamicDictionaries",
  1522. category: 'tests',
  1523. fn: function (){
  1524. var self=this;
  1525. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1526. return smalltalk.withContext(function($ctx1) {
  1527. self._assert_equals_(_st(smalltalk.HashedCollection._from_(["hello".__minus_gt((1))]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  1528. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  1529. args: [],
  1530. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  1531. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  1532. referencedClasses: ["Dictionary"]
  1533. }),
  1534. smalltalk.DictionaryTest);
  1535. smalltalk.addMethod(
  1536. smalltalk.method({
  1537. selector: "testEquality",
  1538. category: 'tests',
  1539. fn: function (){
  1540. var self=this;
  1541. var d1,d2;
  1542. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1543. return smalltalk.withContext(function($ctx1) {
  1544. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  1545. self._assert_(_st(_st($Dictionary())._new()).__eq(_st($Dictionary())._new()));
  1546. $1=_st($Dictionary())._new();
  1547. _st($1)._at_put_((1),(2));
  1548. $2=_st($1)._yourself();
  1549. d1=$2;
  1550. $3=_st($Dictionary())._new();
  1551. _st($3)._at_put_((1),(2));
  1552. $4=_st($3)._yourself();
  1553. d2=$4;
  1554. self._assert_(_st(d1).__eq(d2));
  1555. $5=_st($Dictionary())._new();
  1556. _st($5)._at_put_((1),(3));
  1557. $6=_st($5)._yourself();
  1558. d2=$6;
  1559. self._deny_(_st(d1).__eq(d2));
  1560. $7=_st($Dictionary())._new();
  1561. _st($7)._at_put_((2),(2));
  1562. $8=_st($7)._yourself();
  1563. d2=$8;
  1564. self._deny_(_st(d1).__eq(d2));
  1565. $9=_st($Dictionary())._new();
  1566. _st($9)._at_put_((1),(2));
  1567. _st($9)._at_put_((3),(4));
  1568. $10=_st($9)._yourself();
  1569. d2=$10;
  1570. self._deny_(_st(d1).__eq(d2));
  1571. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  1572. args: [],
  1573. 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.",
  1574. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  1575. referencedClasses: ["Dictionary"]
  1576. }),
  1577. smalltalk.DictionaryTest);
  1578. smalltalk.addMethod(
  1579. smalltalk.method({
  1580. selector: "testIfAbsent",
  1581. category: 'tests',
  1582. fn: function (){
  1583. var self=this;
  1584. var d,visited;
  1585. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1586. return smalltalk.withContext(function($ctx1) {
  1587. visited=false;
  1588. d=_st($Dictionary())._new();
  1589. _st(d)._at_ifAbsent_("hello",(function(){
  1590. return smalltalk.withContext(function($ctx2) {
  1591. visited=true;
  1592. return visited;
  1593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1594. self._assert_(visited);
  1595. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  1596. args: [],
  1597. 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.",
  1598. messageSends: ["new", "at:ifAbsent:", "assert:"],
  1599. referencedClasses: ["Dictionary"]
  1600. }),
  1601. smalltalk.DictionaryTest);
  1602. smalltalk.addMethod(
  1603. smalltalk.method({
  1604. selector: "testIfPresent",
  1605. category: 'tests',
  1606. fn: function (){
  1607. var self=this;
  1608. var d,visited,absent;
  1609. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1610. return smalltalk.withContext(function($ctx1) {
  1611. visited=false;
  1612. d=_st($Dictionary())._new();
  1613. _st(d)._at_put_("hello","world");
  1614. _st(d)._at_ifPresent_("hello",(function(value){
  1615. return smalltalk.withContext(function($ctx2) {
  1616. visited=value;
  1617. return visited;
  1618. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}));
  1619. self._assert_equals_(visited,"world");
  1620. absent=_st(d)._at_ifPresent_("bye",(function(value){
  1621. return smalltalk.withContext(function($ctx2) {
  1622. visited=value;
  1623. return visited;
  1624. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,2)})}));
  1625. self._assert_(_st(absent)._isNil());
  1626. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent},smalltalk.DictionaryTest)})},
  1627. args: [],
  1628. 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.",
  1629. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"],
  1630. referencedClasses: ["Dictionary"]
  1631. }),
  1632. smalltalk.DictionaryTest);
  1633. smalltalk.addMethod(
  1634. smalltalk.method({
  1635. selector: "testIfPresentIfAbsent",
  1636. category: 'tests',
  1637. fn: function (){
  1638. var self=this;
  1639. var d,visited;
  1640. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1641. return smalltalk.withContext(function($ctx1) {
  1642. visited=false;
  1643. d=_st($Dictionary())._new();
  1644. _st(d)._at_put_("hello","world");
  1645. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  1646. return smalltalk.withContext(function($ctx2) {
  1647. visited=value;
  1648. return visited;
  1649. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}),(function(){
  1650. return smalltalk.withContext(function($ctx2) {
  1651. visited=true;
  1652. return visited;
  1653. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1654. self._assert_equals_(visited,"world");
  1655. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  1656. return smalltalk.withContext(function($ctx2) {
  1657. visited=value;
  1658. return visited;
  1659. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,3)})}),(function(){
  1660. return smalltalk.withContext(function($ctx2) {
  1661. visited=true;
  1662. return visited;
  1663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1664. self._assert_(visited);
  1665. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  1666. args: [],
  1667. 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.",
  1668. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"],
  1669. referencedClasses: ["Dictionary"]
  1670. }),
  1671. smalltalk.DictionaryTest);
  1672. smalltalk.addMethod(
  1673. smalltalk.method({
  1674. selector: "testKeys",
  1675. category: 'tests',
  1676. fn: function (){
  1677. var self=this;
  1678. var d;
  1679. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1680. return smalltalk.withContext(function($ctx1) {
  1681. d=_st($Dictionary())._new();
  1682. _st(d)._at_put_((1),(2));
  1683. _st(d)._at_put_((2),(3));
  1684. _st(d)._at_put_((3),(4));
  1685. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1686. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  1687. args: [],
  1688. 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)",
  1689. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  1690. referencedClasses: ["Dictionary"]
  1691. }),
  1692. smalltalk.DictionaryTest);
  1693. smalltalk.addMethod(
  1694. smalltalk.method({
  1695. selector: "testPointKey",
  1696. category: 'tests',
  1697. fn: function (){
  1698. var self=this;
  1699. var d;
  1700. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1701. return smalltalk.withContext(function($ctx1) {
  1702. d=_st($Dictionary())._new();
  1703. _st(d)._at_put_((1).__at((1)),"foo");
  1704. self._assert_equals_(_st(d)._at_((1).__at((1))),"foo");
  1705. _st(d)._at_put_((1).__at((1)),"bar");
  1706. self._assert_equals_(_st(d)._at_((1).__at((1))),"bar");
  1707. _st(d)._removeKey_((1).__at((1)));
  1708. self._assert_equals_(_st(d)._at_ifAbsent_((1).__at((1)),(function(){
  1709. return smalltalk.withContext(function($ctx2) {
  1710. return "baz";
  1711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"baz");
  1712. self._deny_(_st(d)._includesKey_((1).__at((1))));
  1713. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  1714. args: [],
  1715. 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)",
  1716. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  1717. referencedClasses: ["Dictionary"]
  1718. }),
  1719. smalltalk.DictionaryTest);
  1720. smalltalk.addMethod(
  1721. smalltalk.method({
  1722. selector: "testPrintString",
  1723. category: 'tests',
  1724. fn: function (){
  1725. var self=this;
  1726. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1727. return smalltalk.withContext(function($ctx1) {
  1728. var $1,$2;
  1729. $1=_st($Dictionary())._new();
  1730. _st($1)._at_put_("firstname","James");
  1731. _st($1)._at_put_("lastname","Bond");
  1732. $2=_st($1)._printString();
  1733. self._assert_equals_($2,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  1734. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  1735. args: [],
  1736. 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'')'",
  1737. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  1738. referencedClasses: ["Dictionary"]
  1739. }),
  1740. smalltalk.DictionaryTest);
  1741. smalltalk.addMethod(
  1742. smalltalk.method({
  1743. selector: "testRemoveKey",
  1744. category: 'tests',
  1745. fn: function (){
  1746. var self=this;
  1747. var d,key;
  1748. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1749. return smalltalk.withContext(function($ctx1) {
  1750. d=_st($Dictionary())._new();
  1751. _st(d)._at_put_((1),(2));
  1752. _st(d)._at_put_((2),(3));
  1753. _st(d)._at_put_((3),(4));
  1754. key=(2);
  1755. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1756. _st(d)._removeKey_(key);
  1757. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  1758. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  1759. self._deny_(_st(d)._includesKey_((2)));
  1760. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  1761. args: [],
  1762. 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)",
  1763. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  1764. referencedClasses: ["Dictionary"]
  1765. }),
  1766. smalltalk.DictionaryTest);
  1767. smalltalk.addMethod(
  1768. smalltalk.method({
  1769. selector: "testRemoveKeyIfAbsent",
  1770. category: 'tests',
  1771. fn: function (){
  1772. var self=this;
  1773. var d,key;
  1774. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1775. return smalltalk.withContext(function($ctx1) {
  1776. d=_st($Dictionary())._new();
  1777. _st(d)._at_put_((1),(2));
  1778. _st(d)._at_put_((2),(3));
  1779. _st(d)._at_put_((3),(4));
  1780. key=(2);
  1781. self._assert_equals_(_st(d)._removeKey_(key),(3));
  1782. key=(3);
  1783. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1784. return smalltalk.withContext(function($ctx2) {
  1785. return (42);
  1786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),(4));
  1787. key="why";
  1788. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1789. return smalltalk.withContext(function($ctx2) {
  1790. return (42);
  1791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  1792. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  1793. args: [],
  1794. 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.",
  1795. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  1796. referencedClasses: ["Dictionary"]
  1797. }),
  1798. smalltalk.DictionaryTest);
  1799. smalltalk.addMethod(
  1800. smalltalk.method({
  1801. selector: "testSize",
  1802. category: 'tests',
  1803. fn: function (){
  1804. var self=this;
  1805. var d;
  1806. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1807. return smalltalk.withContext(function($ctx1) {
  1808. d=_st($Dictionary())._new();
  1809. self._assert_equals_(_st(d)._size(),(0));
  1810. _st(d)._at_put_((1),(2));
  1811. self._assert_equals_(_st(d)._size(),(1));
  1812. _st(d)._at_put_((2),(3));
  1813. self._assert_equals_(_st(d)._size(),(2));
  1814. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d},smalltalk.DictionaryTest)})},
  1815. args: [],
  1816. 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.",
  1817. messageSends: ["new", "assert:equals:", "size", "at:put:"],
  1818. referencedClasses: ["Dictionary"]
  1819. }),
  1820. smalltalk.DictionaryTest);
  1821. smalltalk.addMethod(
  1822. smalltalk.method({
  1823. selector: "testValues",
  1824. category: 'tests',
  1825. fn: function (){
  1826. var self=this;
  1827. var d;
  1828. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1829. return smalltalk.withContext(function($ctx1) {
  1830. d=_st($Dictionary())._new();
  1831. _st(d)._at_put_((1),(2));
  1832. _st(d)._at_put_((2),(3));
  1833. _st(d)._at_put_((3),(4));
  1834. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  1835. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  1836. args: [],
  1837. 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)",
  1838. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  1839. referencedClasses: ["Dictionary"]
  1840. }),
  1841. smalltalk.DictionaryTest);
  1842. smalltalk.addMethod(
  1843. smalltalk.method({
  1844. selector: "collectionClass",
  1845. category: 'accessing',
  1846. fn: function (){
  1847. var self=this;
  1848. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1849. return smalltalk.withContext(function($ctx1) {
  1850. var $1;
  1851. $1=$Dictionary();
  1852. return $1;
  1853. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  1854. args: [],
  1855. source: "collectionClass\x0a\x09^ Dictionary",
  1856. messageSends: [],
  1857. referencedClasses: ["Dictionary"]
  1858. }),
  1859. smalltalk.DictionaryTest.klass);
  1860. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1861. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1862. smalltalk.addMethod(
  1863. smalltalk.method({
  1864. selector: "testAddFirst",
  1865. category: 'tests',
  1866. fn: function (){
  1867. var self=this;
  1868. return smalltalk.withContext(function($ctx1) {
  1869. var $1,$2;
  1870. $1=[(2), (3), (4), (5)];
  1871. _st($1)._addFirst_((1));
  1872. $2=_st($1)._yourself();
  1873. self._assert_equals_($2,[(1), (2), (3), (4), (5)]);
  1874. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  1875. args: [],
  1876. source: "testAddFirst\x0a\x09self assert: (#(2 3 4 5) addFirst: 1; yourself) equals: #(1 2 3 4 5)",
  1877. messageSends: ["assert:equals:", "addFirst:", "yourself"],
  1878. referencedClasses: []
  1879. }),
  1880. smalltalk.ArrayTest);
  1881. smalltalk.addMethod(
  1882. smalltalk.method({
  1883. selector: "testAtIfAbsent",
  1884. category: 'tests',
  1885. fn: function (){
  1886. var self=this;
  1887. var array;
  1888. return smalltalk.withContext(function($ctx1) {
  1889. array=["hello", "world"];
  1890. self._assert_equals_(_st(array)._at_((1)),"hello");
  1891. self._assert_equals_(_st(array)._at_((2)),"world");
  1892. self._assert_equals_(_st(array)._at_ifAbsent_((2),(function(){
  1893. return smalltalk.withContext(function($ctx2) {
  1894. return "not found";
  1895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"world");
  1896. self._assert_equals_(_st(array)._at_ifAbsent_((0),(function(){
  1897. return smalltalk.withContext(function($ctx2) {
  1898. return "not found";
  1899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"not found");
  1900. self._assert_equals_(_st(array)._at_ifAbsent_((-10),(function(){
  1901. return smalltalk.withContext(function($ctx2) {
  1902. return "not found";
  1903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),"not found");
  1904. self._assert_equals_(_st(array)._at_ifAbsent_((3),(function(){
  1905. return smalltalk.withContext(function($ctx2) {
  1906. return "not found";
  1907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),"not found");
  1908. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array},smalltalk.ArrayTest)})},
  1909. args: [],
  1910. 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'.",
  1911. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  1912. referencedClasses: []
  1913. }),
  1914. smalltalk.ArrayTest);
  1915. smalltalk.addMethod(
  1916. smalltalk.method({
  1917. selector: "testFirstN",
  1918. category: 'tests',
  1919. fn: function (){
  1920. var self=this;
  1921. return smalltalk.withContext(function($ctx1) {
  1922. self._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  1923. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.ArrayTest)})},
  1924. args: [],
  1925. source: "testFirstN\x0a\x09self assert: ({1. 2. 3. 4. 5} first: 3) equals: {1. 2. 3}",
  1926. messageSends: ["assert:equals:", "first:"],
  1927. referencedClasses: []
  1928. }),
  1929. smalltalk.ArrayTest);
  1930. smalltalk.addMethod(
  1931. smalltalk.method({
  1932. selector: "testIfEmpty",
  1933. category: 'tests',
  1934. fn: function (){
  1935. var self=this;
  1936. return smalltalk.withContext(function($ctx1) {
  1937. self._assert_equals_(""._ifEmpty_((function(){
  1938. return smalltalk.withContext(function($ctx2) {
  1939. return "zork";
  1940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"zork");
  1941. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{},smalltalk.ArrayTest)})},
  1942. args: [],
  1943. source: "testIfEmpty\x0a\x09self assert: ( '' ifEmpty: ['zork'] ) equals: 'zork'",
  1944. messageSends: ["assert:equals:", "ifEmpty:"],
  1945. referencedClasses: []
  1946. }),
  1947. smalltalk.ArrayTest);
  1948. smalltalk.addMethod(
  1949. smalltalk.method({
  1950. selector: "testPrintString",
  1951. category: 'tests',
  1952. fn: function (){
  1953. var self=this;
  1954. var array;
  1955. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  1956. return smalltalk.withContext(function($ctx1) {
  1957. var $1,$2,$3,$4;
  1958. array=_st($Array())._new();
  1959. self._assert_equals_(_st(array)._printString(),"an Array ()");
  1960. $1=array;
  1961. _st($1)._add_((1));
  1962. $2=_st($1)._add_((3));
  1963. self._assert_equals_(_st(array)._printString(),"an Array (1 3)");
  1964. _st(array)._add_("foo");
  1965. self._assert_equals_(_st(array)._printString(),"an Array (1 3 'foo')");
  1966. $3=array;
  1967. _st($3)._remove_((1));
  1968. $4=_st($3)._remove_((3));
  1969. self._assert_equals_(_st(array)._printString(),"an Array ('foo')");
  1970. _st(array)._addLast_((3));
  1971. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3)");
  1972. _st(array)._addLast_((3));
  1973. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  1974. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  1975. args: [],
  1976. 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)'.",
  1977. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  1978. referencedClasses: ["Array"]
  1979. }),
  1980. smalltalk.ArrayTest);
  1981. smalltalk.addMethod(
  1982. smalltalk.method({
  1983. selector: "testRemoveFromTo",
  1984. category: 'tests',
  1985. fn: function (){
  1986. var self=this;
  1987. return smalltalk.withContext(function($ctx1) {
  1988. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((1),(3)),[(4)]);
  1989. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(3)),[(1), (4)]);
  1990. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  1991. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  1992. args: [],
  1993. 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)",
  1994. messageSends: ["assert:equals:", "removeFrom:to:"],
  1995. referencedClasses: []
  1996. }),
  1997. smalltalk.ArrayTest);
  1998. smalltalk.addMethod(
  1999. smalltalk.method({
  2000. selector: "testRemoveIndex",
  2001. category: 'tests',
  2002. fn: function (){
  2003. var self=this;
  2004. return smalltalk.withContext(function($ctx1) {
  2005. self._assert_equals_([(1), (2), (3), (4)]._removeIndex_((2)),[(1), (3), (4)]);
  2006. self._assert_equals_([(1), (2), (3), (4)]._removeIndex_((1)),[(2), (3), (4)]);
  2007. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  2008. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  2009. args: [],
  2010. 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: #()",
  2011. messageSends: ["assert:equals:", "removeIndex:"],
  2012. referencedClasses: []
  2013. }),
  2014. smalltalk.ArrayTest);
  2015. smalltalk.addMethod(
  2016. smalltalk.method({
  2017. selector: "collectionClass",
  2018. category: 'accessing',
  2019. fn: function (){
  2020. var self=this;
  2021. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2022. return smalltalk.withContext(function($ctx1) {
  2023. var $1;
  2024. $1=$Array();
  2025. return $1;
  2026. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  2027. args: [],
  2028. source: "collectionClass\x0a\x09^ Array",
  2029. messageSends: [],
  2030. referencedClasses: ["Array"]
  2031. }),
  2032. smalltalk.ArrayTest.klass);
  2033. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2034. smalltalk.addMethod(
  2035. smalltalk.method({
  2036. selector: "collection",
  2037. category: 'accessing',
  2038. fn: function (){
  2039. var self=this;
  2040. return smalltalk.withContext(function($ctx1) {
  2041. return "hello";
  2042. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  2043. args: [],
  2044. source: "collection\x0a\x09^'hello'",
  2045. messageSends: [],
  2046. referencedClasses: []
  2047. }),
  2048. smalltalk.StringTest);
  2049. smalltalk.addMethod(
  2050. smalltalk.method({
  2051. selector: "collectionWithDuplicates",
  2052. category: 'accessing',
  2053. fn: function (){
  2054. var self=this;
  2055. return smalltalk.withContext(function($ctx1) {
  2056. return "abbaerte";
  2057. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  2058. args: [],
  2059. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  2060. messageSends: [],
  2061. referencedClasses: []
  2062. }),
  2063. smalltalk.StringTest);
  2064. smalltalk.addMethod(
  2065. smalltalk.method({
  2066. selector: "testAddRemove",
  2067. category: 'tests',
  2068. fn: function (){
  2069. var self=this;
  2070. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2071. return smalltalk.withContext(function($ctx1) {
  2072. self._should_raise_((function(){
  2073. return smalltalk.withContext(function($ctx2) {
  2074. return "hello"._add_("a");
  2075. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2076. self._should_raise_((function(){
  2077. return smalltalk.withContext(function($ctx2) {
  2078. return "hello"._remove_("h");
  2079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  2080. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  2081. args: [],
  2082. source: "testAddRemove\x0a\x09self should: ['hello' add: 'a'] raise: Error.\x0a\x09self should: ['hello' remove: 'h'] raise: Error",
  2083. messageSends: ["should:raise:", "add:", "remove:"],
  2084. referencedClasses: ["Error"]
  2085. }),
  2086. smalltalk.StringTest);
  2087. smalltalk.addMethod(
  2088. smalltalk.method({
  2089. selector: "testAsArray",
  2090. category: 'tests',
  2091. fn: function (){
  2092. var self=this;
  2093. return smalltalk.withContext(function($ctx1) {
  2094. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  2095. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  2096. args: [],
  2097. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  2098. messageSends: ["assert:equals:", "asArray"],
  2099. referencedClasses: []
  2100. }),
  2101. smalltalk.StringTest);
  2102. smalltalk.addMethod(
  2103. smalltalk.method({
  2104. selector: "testAt",
  2105. category: 'tests',
  2106. fn: function (){
  2107. var self=this;
  2108. return smalltalk.withContext(function($ctx1) {
  2109. self._assert_equals_("hello"._at_((1)),"h");
  2110. self._assert_equals_("hello"._at_((5)),"o");
  2111. self._assert_equals_("hello"._at_ifAbsent_((6),(function(){
  2112. return smalltalk.withContext(function($ctx2) {
  2113. return nil;
  2114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),nil);
  2115. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.StringTest)})},
  2116. args: [],
  2117. 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",
  2118. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2119. referencedClasses: []
  2120. }),
  2121. smalltalk.StringTest);
  2122. smalltalk.addMethod(
  2123. smalltalk.method({
  2124. selector: "testAtPut",
  2125. category: 'tests',
  2126. fn: function (){
  2127. var self=this;
  2128. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2129. return smalltalk.withContext(function($ctx1) {
  2130. self._should_raise_((function(){
  2131. return smalltalk.withContext(function($ctx2) {
  2132. return "hello"._at_put_((1),"a");
  2133. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2134. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  2135. args: [],
  2136. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  2137. messageSends: ["should:raise:", "at:put:"],
  2138. referencedClasses: ["Error"]
  2139. }),
  2140. smalltalk.StringTest);
  2141. smalltalk.addMethod(
  2142. smalltalk.method({
  2143. selector: "testCollect",
  2144. category: 'tests',
  2145. fn: function (){
  2146. var self=this;
  2147. var newCollection;
  2148. return smalltalk.withContext(function($ctx1) {
  2149. newCollection="hheelllloo";
  2150. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  2151. return smalltalk.withContext(function($ctx2) {
  2152. return _st(each).__comma(each);
  2153. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  2154. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  2155. args: [],
  2156. 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",
  2157. messageSends: ["assertSameContents:as:", "collect:", "collection", ","],
  2158. referencedClasses: []
  2159. }),
  2160. smalltalk.StringTest);
  2161. smalltalk.addMethod(
  2162. smalltalk.method({
  2163. selector: "testCopyWithoutAll",
  2164. category: 'tests',
  2165. fn: function (){
  2166. var self=this;
  2167. return smalltalk.withContext(function($ctx1) {
  2168. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  2169. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  2170. args: [],
  2171. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  2172. messageSends: ["assert:equals:", "copyWithoutAll:"],
  2173. referencedClasses: []
  2174. }),
  2175. smalltalk.StringTest);
  2176. smalltalk.addMethod(
  2177. smalltalk.method({
  2178. selector: "testDetect",
  2179. category: 'tests',
  2180. fn: function (){
  2181. var self=this;
  2182. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2183. return smalltalk.withContext(function($ctx1) {
  2184. self._assert_equals_(_st(self._collection())._detect_((function(each){
  2185. return smalltalk.withContext(function($ctx2) {
  2186. return _st(each).__eq("h");
  2187. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),"h");
  2188. self._should_raise_((function(){
  2189. return smalltalk.withContext(function($ctx2) {
  2190. return _st(self._collection())._detect_((function(each){
  2191. return smalltalk.withContext(function($ctx3) {
  2192. return _st(each).__eq((6));
  2193. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  2194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  2195. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  2196. args: [],
  2197. 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",
  2198. messageSends: ["assert:equals:", "detect:", "collection", "=", "should:raise:"],
  2199. referencedClasses: ["Error"]
  2200. }),
  2201. smalltalk.StringTest);
  2202. smalltalk.addMethod(
  2203. smalltalk.method({
  2204. selector: "testEquality",
  2205. category: 'tests',
  2206. fn: function (){
  2207. var self=this;
  2208. return smalltalk.withContext(function($ctx1) {
  2209. self._assert_equals_("hello","hello");
  2210. self._deny_("hello".__eq("world"));
  2211. self._deny_("hello".__eq([]._at_ifAbsent_((1),(function(){
  2212. return smalltalk.withContext(function($ctx2) {
  2213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))));
  2214. self._assert_equals_("hello","hello"._yourself());
  2215. self._assert_equals_("hello"._yourself(),"hello");
  2216. self._deny_("".__eq((0)));
  2217. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  2218. args: [],
  2219. 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",
  2220. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  2221. referencedClasses: []
  2222. }),
  2223. smalltalk.StringTest);
  2224. smalltalk.addMethod(
  2225. smalltalk.method({
  2226. selector: "testIdentity",
  2227. category: 'tests',
  2228. fn: function (){
  2229. var self=this;
  2230. return smalltalk.withContext(function($ctx1) {
  2231. self._assert_("hello".__eq_eq("hello"));
  2232. self._deny_("hello".__eq_eq("world"));
  2233. self._assert_("hello".__eq_eq("hello"._yourself()));
  2234. self._assert_(_st("hello"._yourself()).__eq_eq("hello"));
  2235. self._deny_("".__eq_eq((0)));
  2236. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  2237. args: [],
  2238. 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",
  2239. messageSends: ["assert:", "==", "deny:", "yourself"],
  2240. referencedClasses: []
  2241. }),
  2242. smalltalk.StringTest);
  2243. smalltalk.addMethod(
  2244. smalltalk.method({
  2245. selector: "testIncludesSubString",
  2246. category: 'tests',
  2247. fn: function (){
  2248. var self=this;
  2249. return smalltalk.withContext(function($ctx1) {
  2250. self._assert_("amber"._includesSubString_("ber"));
  2251. self._deny_("amber"._includesSubString_("zork"));
  2252. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  2253. args: [],
  2254. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  2255. messageSends: ["assert:", "includesSubString:", "deny:"],
  2256. referencedClasses: []
  2257. }),
  2258. smalltalk.StringTest);
  2259. smalltalk.addMethod(
  2260. smalltalk.method({
  2261. selector: "testIndexOf",
  2262. category: 'tests',
  2263. fn: function (){
  2264. var self=this;
  2265. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2266. return smalltalk.withContext(function($ctx1) {
  2267. self._assert_equals_(_st(self._collection())._indexOf_("e"),(2));
  2268. self._should_raise_((function(){
  2269. return smalltalk.withContext(function($ctx2) {
  2270. return _st(self._collection())._indexOf_((999));
  2271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2272. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  2273. return smalltalk.withContext(function($ctx2) {
  2274. return "sentinel";
  2275. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"sentinel");
  2276. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.StringTest)})},
  2277. args: [],
  2278. 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'",
  2279. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  2280. referencedClasses: ["Error"]
  2281. }),
  2282. smalltalk.StringTest);
  2283. smalltalk.addMethod(
  2284. smalltalk.method({
  2285. selector: "testJoin",
  2286. category: 'tests',
  2287. fn: function (){
  2288. var self=this;
  2289. return smalltalk.withContext(function($ctx1) {
  2290. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  2291. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  2292. args: [],
  2293. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  2294. messageSends: ["assert:equals:", "join:"],
  2295. referencedClasses: []
  2296. }),
  2297. smalltalk.StringTest);
  2298. smalltalk.addMethod(
  2299. smalltalk.method({
  2300. selector: "testSelect",
  2301. category: 'tests',
  2302. fn: function (){
  2303. var self=this;
  2304. var newCollection;
  2305. return smalltalk.withContext(function($ctx1) {
  2306. newCollection="o";
  2307. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  2308. return smalltalk.withContext(function($ctx2) {
  2309. return _st(each).__eq("o");
  2310. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  2311. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  2312. args: [],
  2313. 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",
  2314. messageSends: ["assertSameContents:as:", "select:", "collection", "="],
  2315. referencedClasses: []
  2316. }),
  2317. smalltalk.StringTest);
  2318. smalltalk.addMethod(
  2319. smalltalk.method({
  2320. selector: "testSize",
  2321. category: 'tests',
  2322. fn: function (){
  2323. var self=this;
  2324. return smalltalk.withContext(function($ctx1) {
  2325. self._assert_equals_("smalltalk"._size(),(9));
  2326. self._assert_equals_(""._size(),(0));
  2327. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  2328. args: [],
  2329. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  2330. messageSends: ["assert:equals:", "size"],
  2331. referencedClasses: []
  2332. }),
  2333. smalltalk.StringTest);
  2334. smalltalk.addMethod(
  2335. smalltalk.method({
  2336. selector: "testStreamContents",
  2337. category: 'tests',
  2338. fn: function (){
  2339. var self=this;
  2340. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  2341. return smalltalk.withContext(function($ctx1) {
  2342. var $1,$2;
  2343. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  2344. return smalltalk.withContext(function($ctx2) {
  2345. $1=aStream;
  2346. _st($1)._nextPutAll_("hello");
  2347. _st($1)._space();
  2348. $2=_st($1)._nextPutAll_("world");
  2349. return $2;
  2350. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  2351. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  2352. args: [],
  2353. 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'",
  2354. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  2355. referencedClasses: ["String"]
  2356. }),
  2357. smalltalk.StringTest);
  2358. smalltalk.addMethod(
  2359. smalltalk.method({
  2360. selector: "collectionClass",
  2361. category: 'accessing',
  2362. fn: function (){
  2363. var self=this;
  2364. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  2365. return smalltalk.withContext(function($ctx1) {
  2366. var $1;
  2367. $1=$String();
  2368. return $1;
  2369. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  2370. args: [],
  2371. source: "collectionClass\x0a\x09^ String",
  2372. messageSends: [],
  2373. referencedClasses: ["String"]
  2374. }),
  2375. smalltalk.StringTest.klass);
  2376. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2377. smalltalk.addMethod(
  2378. smalltalk.method({
  2379. selector: "testShow",
  2380. category: 'tests',
  2381. fn: function (){
  2382. var self=this;
  2383. var originalTranscript;
  2384. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  2385. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  2386. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2387. return smalltalk.withContext(function($ctx1) {
  2388. originalTranscript=_st($Transcript())._current();
  2389. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  2390. self._shouldnt_raise_((function(){
  2391. return smalltalk.withContext(function($ctx2) {
  2392. return _st($Transcript())._show_("Hello console!");
  2393. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2394. self._shouldnt_raise_((function(){
  2395. return smalltalk.withContext(function($ctx2) {
  2396. return _st($Transcript())._show_(console);
  2397. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  2398. _st($Transcript())._register_(originalTranscript);
  2399. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  2400. args: [],
  2401. 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.",
  2402. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  2403. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  2404. }),
  2405. smalltalk.ConsoleTranscriptTest);
  2406. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2407. smalltalk.addMethod(
  2408. smalltalk.method({
  2409. selector: "jsObject",
  2410. category: 'accessing',
  2411. fn: function (){
  2412. var self=this;
  2413. return smalltalk.withContext(function($ctx1) {
  2414. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined};
  2415. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  2416. args: [],
  2417. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined}>",
  2418. messageSends: [],
  2419. referencedClasses: []
  2420. }),
  2421. smalltalk.JSObjectProxyTest);
  2422. smalltalk.addMethod(
  2423. smalltalk.method({
  2424. selector: "testAtIfAbsent",
  2425. category: 'tests',
  2426. fn: function (){
  2427. var self=this;
  2428. var testObject;
  2429. return smalltalk.withContext(function($ctx1) {
  2430. testObject=self._jsObject();
  2431. self._assert_equals_(_st(testObject)._at_ifAbsent_("abc",(function(){
  2432. return smalltalk.withContext(function($ctx2) {
  2433. return "Property does not exist";
  2434. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"Property does not exist");
  2435. self._assert_equals_(_st(testObject)._at_ifAbsent_("e",(function(){
  2436. return smalltalk.withContext(function($ctx2) {
  2437. return "Property does not exist";
  2438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),nil);
  2439. self._assert_equals_(_st(testObject)._at_ifAbsent_("a",(function(){
  2440. return smalltalk.withContext(function($ctx2) {
  2441. return "Property does not exist";
  2442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),(1));
  2443. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  2444. return smalltalk.withContext(function($ctx2) {
  2445. return "Property does not exist";
  2446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  2447. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2448. args: [],
  2449. 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.",
  2450. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  2451. referencedClasses: []
  2452. }),
  2453. smalltalk.JSObjectProxyTest);
  2454. smalltalk.addMethod(
  2455. smalltalk.method({
  2456. selector: "testAtIfPresent",
  2457. category: 'tests',
  2458. fn: function (){
  2459. var self=this;
  2460. var testObject;
  2461. return smalltalk.withContext(function($ctx1) {
  2462. testObject=self._jsObject();
  2463. self._assert_equals_(_st(testObject)._at_ifPresent_("abc",(function(x){
  2464. return smalltalk.withContext(function($ctx2) {
  2465. return "hello ".__comma(_st(x)._asString());
  2466. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})})),nil);
  2467. self._assert_equals_(_st(testObject)._at_ifPresent_("e",(function(x){
  2468. return smalltalk.withContext(function($ctx2) {
  2469. return "hello ".__comma(_st(x)._asString());
  2470. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})})),"hello nil");
  2471. self._assert_equals_(_st(testObject)._at_ifPresent_("a",(function(x){
  2472. return smalltalk.withContext(function($ctx2) {
  2473. return "hello ".__comma(_st(x)._asString());
  2474. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})})),"hello 1");
  2475. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  2476. return smalltalk.withContext(function($ctx2) {
  2477. return "hello ".__comma(_st(x)._asString());
  2478. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  2479. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2480. args: [],
  2481. 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'.",
  2482. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  2483. referencedClasses: []
  2484. }),
  2485. smalltalk.JSObjectProxyTest);
  2486. smalltalk.addMethod(
  2487. smalltalk.method({
  2488. selector: "testAtIfPresentIfAbsent",
  2489. category: 'tests',
  2490. fn: function (){
  2491. var self=this;
  2492. var testObject;
  2493. return smalltalk.withContext(function($ctx1) {
  2494. testObject=self._jsObject();
  2495. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  2496. return smalltalk.withContext(function($ctx2) {
  2497. return "hello ".__comma(_st(x)._asString());
  2498. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  2499. return smalltalk.withContext(function($ctx2) {
  2500. return "not present";
  2501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),"not present");
  2502. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  2503. return smalltalk.withContext(function($ctx2) {
  2504. return "hello ".__comma(_st(x)._asString());
  2505. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  2506. return smalltalk.withContext(function($ctx2) {
  2507. return "not present";
  2508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),"hello nil");
  2509. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  2510. return smalltalk.withContext(function($ctx2) {
  2511. return "hello ".__comma(_st(x)._asString());
  2512. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  2513. return smalltalk.withContext(function($ctx2) {
  2514. return "not present";
  2515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})})),"hello 1");
  2516. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  2517. return smalltalk.withContext(function($ctx2) {
  2518. return "hello ".__comma(_st(x)._asString());
  2519. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  2520. return smalltalk.withContext(function($ctx2) {
  2521. return "not present";
  2522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  2523. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2524. args: [],
  2525. 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'.",
  2526. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  2527. referencedClasses: []
  2528. }),
  2529. smalltalk.JSObjectProxyTest);
  2530. smalltalk.addMethod(
  2531. smalltalk.method({
  2532. selector: "testDNU",
  2533. category: 'tests',
  2534. fn: function (){
  2535. var self=this;
  2536. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2537. return smalltalk.withContext(function($ctx1) {
  2538. self._should_raise_((function(){
  2539. return smalltalk.withContext(function($ctx2) {
  2540. return _st(self._jsObject())._foo();
  2541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  2542. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  2543. args: [],
  2544. source: "testDNU\x0a\x09self should: [self jsObject foo] raise: MessageNotUnderstood",
  2545. messageSends: ["should:raise:", "foo", "jsObject"],
  2546. referencedClasses: ["MessageNotUnderstood"]
  2547. }),
  2548. smalltalk.JSObjectProxyTest);
  2549. smalltalk.addMethod(
  2550. smalltalk.method({
  2551. selector: "testMessageSend",
  2552. category: 'tests',
  2553. fn: function (){
  2554. var self=this;
  2555. return smalltalk.withContext(function($ctx1) {
  2556. self._assert_equals_(_st(self._jsObject())._a(),(1));
  2557. self._assert_equals_(_st(self._jsObject())._b(),(2));
  2558. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  2559. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  2560. args: [],
  2561. 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",
  2562. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  2563. referencedClasses: []
  2564. }),
  2565. smalltalk.JSObjectProxyTest);
  2566. smalltalk.addMethod(
  2567. smalltalk.method({
  2568. selector: "testMethodWithArguments",
  2569. category: 'tests',
  2570. fn: function (){
  2571. var self=this;
  2572. return smalltalk.withContext(function($ctx1) {
  2573. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  2574. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  2575. args: [],
  2576. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  2577. messageSends: ["assert:equals:", "c:", "jsObject"],
  2578. referencedClasses: []
  2579. }),
  2580. smalltalk.JSObjectProxyTest);
  2581. smalltalk.addMethod(
  2582. smalltalk.method({
  2583. selector: "testPrinting",
  2584. category: 'tests',
  2585. fn: function (){
  2586. var self=this;
  2587. return smalltalk.withContext(function($ctx1) {
  2588. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  2589. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  2590. args: [],
  2591. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  2592. messageSends: ["assert:equals:", "printString", "jsObject"],
  2593. referencedClasses: []
  2594. }),
  2595. smalltalk.JSObjectProxyTest);
  2596. smalltalk.addMethod(
  2597. smalltalk.method({
  2598. selector: "testPropertyThatReturnsEmptyString",
  2599. category: 'tests',
  2600. fn: function (){
  2601. var self=this;
  2602. var object;
  2603. return smalltalk.withContext(function($ctx1) {
  2604. object=self._jsObject();
  2605. self._assert_equals_(_st(object)._d(),"");
  2606. _st(object)._d_("hello");
  2607. self._assert_equals_(_st(object)._d(),"hello");
  2608. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  2609. args: [],
  2610. 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'",
  2611. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  2612. referencedClasses: []
  2613. }),
  2614. smalltalk.JSObjectProxyTest);
  2615. smalltalk.addMethod(
  2616. smalltalk.method({
  2617. selector: "testPropertyThatReturnsUndefined",
  2618. category: 'tests',
  2619. fn: function (){
  2620. var self=this;
  2621. var object;
  2622. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2623. return smalltalk.withContext(function($ctx1) {
  2624. object=self._jsObject();
  2625. self._shouldnt_raise_((function(){
  2626. return smalltalk.withContext(function($ctx2) {
  2627. return _st(object)._e();
  2628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  2629. self._assert_(_st(_st(object)._e())._isNil());
  2630. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  2631. args: [],
  2632. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  2633. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  2634. referencedClasses: ["MessageNotUnderstood"]
  2635. }),
  2636. smalltalk.JSObjectProxyTest);
  2637. smalltalk.addMethod(
  2638. smalltalk.method({
  2639. selector: "testValue",
  2640. category: 'tests',
  2641. fn: function (){
  2642. var self=this;
  2643. var testObject;
  2644. return smalltalk.withContext(function($ctx1) {
  2645. testObject=self._jsObject();
  2646. self._assert_equals_(_st(_st(testObject)._value())._printString(),"[object Object]");
  2647. _st(testObject)._at_put_("value","aValue");
  2648. self._assert_equals_(_st(testObject)._value(),"aValue");
  2649. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2650. args: [],
  2651. 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'",
  2652. messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"],
  2653. referencedClasses: []
  2654. }),
  2655. smalltalk.JSObjectProxyTest);
  2656. smalltalk.addMethod(
  2657. smalltalk.method({
  2658. selector: "testYourself",
  2659. category: 'tests',
  2660. fn: function (){
  2661. var self=this;
  2662. var object;
  2663. return smalltalk.withContext(function($ctx1) {
  2664. var $1,$2;
  2665. $1=self._jsObject();
  2666. _st($1)._d_("test");
  2667. $2=_st($1)._yourself();
  2668. object=$2;
  2669. self._assert_equals_(_st(object)._d(),"test");
  2670. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  2671. args: [],
  2672. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  2673. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  2674. referencedClasses: []
  2675. }),
  2676. smalltalk.JSObjectProxyTest);
  2677. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2678. smalltalk.addMethod(
  2679. smalltalk.method({
  2680. selector: "testCatchingException",
  2681. category: 'tests',
  2682. fn: function (){
  2683. var self=this;
  2684. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2685. return smalltalk.withContext(function($ctx1) {
  2686. _st((function(){
  2687. return smalltalk.withContext(function($ctx2) {
  2688. return self._throwException();
  2689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  2690. return smalltalk.withContext(function($ctx2) {
  2691. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  2692. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  2693. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  2694. args: [],
  2695. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  2696. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  2697. referencedClasses: ["Error"]
  2698. }),
  2699. smalltalk.JavaScriptExceptionTest);
  2700. smalltalk.addMethod(
  2701. smalltalk.method({
  2702. selector: "testRaisingException",
  2703. category: 'tests',
  2704. fn: function (){
  2705. var self=this;
  2706. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  2707. return smalltalk.withContext(function($ctx1) {
  2708. self._should_raise_((function(){
  2709. return smalltalk.withContext(function($ctx2) {
  2710. return self._throwException();
  2711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  2712. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  2713. args: [],
  2714. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  2715. messageSends: ["should:raise:", "throwException"],
  2716. referencedClasses: ["JavaScriptException"]
  2717. }),
  2718. smalltalk.JavaScriptExceptionTest);
  2719. smalltalk.addMethod(
  2720. smalltalk.method({
  2721. selector: "throwException",
  2722. category: 'helpers',
  2723. fn: function (){
  2724. var self=this;
  2725. return smalltalk.withContext(function($ctx1) {
  2726. throw 'test';
  2727. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  2728. args: [],
  2729. source: "throwException\x0a\x09<throw 'test'>",
  2730. messageSends: [],
  2731. referencedClasses: []
  2732. }),
  2733. smalltalk.JavaScriptExceptionTest);
  2734. smalltalk.addClass('LegacyPackageHandlerTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  2735. smalltalk.addMethod(
  2736. smalltalk.method({
  2737. selector: "setUp",
  2738. category: 'running',
  2739. fn: function (){
  2740. var self=this;
  2741. function $LegacyPackageHandler(){return smalltalk.LegacyPackageHandler||(typeof LegacyPackageHandler=="undefined"?nil:LegacyPackageHandler)}
  2742. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  2743. return smalltalk.withContext(function($ctx1) {
  2744. var $1,$2;
  2745. self["@backUpCommitPathJs"]=_st($LegacyPackageHandler())._defaultCommitPathJs();
  2746. self["@backUpCommitPathSt"]=_st($LegacyPackageHandler())._defaultCommitPathSt();
  2747. _st($LegacyPackageHandler())._resetCommitPaths();
  2748. self["@zorkPackage"]=_st(_st($Package())._new())._name_("Zork");
  2749. $1=_st($Package())._new();
  2750. _st($1)._name_("Grul");
  2751. _st($1)._commitPathJs_("server/grul/js");
  2752. _st($1)._commitPathSt_("grul/st");
  2753. $2=_st($1)._yourself();
  2754. self["@grulPackage"]=$2;
  2755. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.LegacyPackageHandlerTest)})},
  2756. args: [],
  2757. source: "setUp\x0a\x09backUpCommitPathJs := LegacyPackageHandler defaultCommitPathJs.\x0a\x09backUpCommitPathSt := LegacyPackageHandler defaultCommitPathSt.\x0a\x0a\x09LegacyPackageHandler resetCommitPaths.\x0a\x0a\x09zorkPackage := Package new name: 'Zork'.\x0a\x09grulPackage := Package new\x0a\x09\x09\x09\x09\x09name: 'Grul';\x0a\x09\x09\x09\x09\x09commitPathJs: 'server/grul/js';\x0a\x09\x09\x09\x09\x09commitPathSt: 'grul/st';\x0a\x09\x09\x09\x09\x09yourself",
  2758. messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"],
  2759. referencedClasses: ["LegacyPackageHandler", "Package"]
  2760. }),
  2761. smalltalk.LegacyPackageHandlerTest);
  2762. smalltalk.addMethod(
  2763. smalltalk.method({
  2764. selector: "tearDown",
  2765. category: 'running',
  2766. fn: function (){
  2767. var self=this;
  2768. function $LegacyPackageHandler(){return smalltalk.LegacyPackageHandler||(typeof LegacyPackageHandler=="undefined"?nil:LegacyPackageHandler)}
  2769. return smalltalk.withContext(function($ctx1) {
  2770. var $1,$2;
  2771. $1=$LegacyPackageHandler();
  2772. _st($1)._defaultCommitPathJs_(self["@backUpCommitPathJs"]);
  2773. $2=_st($1)._defaultCommitPathSt_(self["@backUpCommitPathSt"]);
  2774. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.LegacyPackageHandlerTest)})},
  2775. args: [],
  2776. source: "tearDown\x0a\x09LegacyPackageHandler\x0a\x09\x09defaultCommitPathJs: backUpCommitPathJs;\x0a\x09\x09defaultCommitPathSt: backUpCommitPathSt",
  2777. messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"],
  2778. referencedClasses: ["LegacyPackageHandler"]
  2779. }),
  2780. smalltalk.LegacyPackageHandlerTest);
  2781. smalltalk.addMethod(
  2782. smalltalk.method({
  2783. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2784. category: 'tests',
  2785. fn: function (){
  2786. var self=this;
  2787. return smalltalk.withContext(function($ctx1) {
  2788. self._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  2789. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{},smalltalk.LegacyPackageHandlerTest)})},
  2790. args: [],
  2791. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: grulPackage commitPathJs equals: 'server/grul/js'",
  2792. messageSends: ["assert:equals:", "commitPathJs"],
  2793. referencedClasses: []
  2794. }),
  2795. smalltalk.LegacyPackageHandlerTest);
  2796. smalltalk.addMethod(
  2797. smalltalk.method({
  2798. selector: "testGrulCommitPathStShouldBeGrulSt",
  2799. category: 'tests',
  2800. fn: function (){
  2801. var self=this;
  2802. return smalltalk.withContext(function($ctx1) {
  2803. self._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  2804. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{},smalltalk.LegacyPackageHandlerTest)})},
  2805. args: [],
  2806. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: grulPackage commitPathSt equals: 'grul/st'",
  2807. messageSends: ["assert:equals:", "commitPathSt"],
  2808. referencedClasses: []
  2809. }),
  2810. smalltalk.LegacyPackageHandlerTest);
  2811. smalltalk.addMethod(
  2812. smalltalk.method({
  2813. selector: "testZorkCommitPathJsShouldBeJs",
  2814. category: 'tests',
  2815. fn: function (){
  2816. var self=this;
  2817. return smalltalk.withContext(function($ctx1) {
  2818. self._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"js");
  2819. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJs",{},smalltalk.LegacyPackageHandlerTest)})},
  2820. args: [],
  2821. source: "testZorkCommitPathJsShouldBeJs\x0a\x09self assert: zorkPackage commitPathJs equals: 'js'",
  2822. messageSends: ["assert:equals:", "commitPathJs"],
  2823. referencedClasses: []
  2824. }),
  2825. smalltalk.LegacyPackageHandlerTest);
  2826. smalltalk.addMethod(
  2827. smalltalk.method({
  2828. selector: "testZorkCommitPathStShouldBeSt",
  2829. category: 'tests',
  2830. fn: function (){
  2831. var self=this;
  2832. return smalltalk.withContext(function($ctx1) {
  2833. self._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"st");
  2834. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSt",{},smalltalk.LegacyPackageHandlerTest)})},
  2835. args: [],
  2836. source: "testZorkCommitPathStShouldBeSt\x0a\x09self assert: zorkPackage commitPathSt equals: 'st'",
  2837. messageSends: ["assert:equals:", "commitPathSt"],
  2838. referencedClasses: []
  2839. }),
  2840. smalltalk.LegacyPackageHandlerTest);
  2841. smalltalk.addClass('LegacyPackageHandlerTestWithDefaultsChanged', smalltalk.LegacyPackageHandlerTest, [], 'Kernel-Tests');
  2842. smalltalk.addMethod(
  2843. smalltalk.method({
  2844. selector: "setUp",
  2845. category: 'running',
  2846. fn: function (){
  2847. var self=this;
  2848. function $LegacyPackageHandler(){return smalltalk.LegacyPackageHandler||(typeof LegacyPackageHandler=="undefined"?nil:LegacyPackageHandler)}
  2849. return smalltalk.withContext(function($ctx1) {
  2850. var $1,$2;
  2851. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged.superclass.fn.prototype._setUp.apply(_st(self), []);
  2852. $1=$LegacyPackageHandler();
  2853. _st($1)._defaultCommitPathJs_("javascripts/");
  2854. $2=_st($1)._defaultCommitPathSt_("smalltalk/");
  2855. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2856. args: [],
  2857. source: "setUp\x0a\x09super setUp.\x0a\x0a\x09LegacyPackageHandler\x0a\x09\x09defaultCommitPathJs: 'javascripts/';\x0a\x09\x09defaultCommitPathSt: 'smalltalk/'.",
  2858. messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"],
  2859. referencedClasses: ["LegacyPackageHandler"]
  2860. }),
  2861. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2862. smalltalk.addMethod(
  2863. smalltalk.method({
  2864. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2865. category: 'tests',
  2866. fn: function (){
  2867. var self=this;
  2868. return smalltalk.withContext(function($ctx1) {
  2869. self._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  2870. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2871. args: [],
  2872. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: grulPackage commitPathJs equals: 'server/grul/js'",
  2873. messageSends: ["assert:equals:", "commitPathJs"],
  2874. referencedClasses: []
  2875. }),
  2876. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2877. smalltalk.addMethod(
  2878. smalltalk.method({
  2879. selector: "testGrulCommitPathStShouldBeGrulSt",
  2880. category: 'tests',
  2881. fn: function (){
  2882. var self=this;
  2883. return smalltalk.withContext(function($ctx1) {
  2884. self._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  2885. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2886. args: [],
  2887. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: grulPackage commitPathSt equals: 'grul/st'",
  2888. messageSends: ["assert:equals:", "commitPathSt"],
  2889. referencedClasses: []
  2890. }),
  2891. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2892. smalltalk.addMethod(
  2893. smalltalk.method({
  2894. selector: "testZorkCommitPathJsShouldBeJavascript",
  2895. category: 'tests',
  2896. fn: function (){
  2897. var self=this;
  2898. return smalltalk.withContext(function($ctx1) {
  2899. self._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"javascripts/");
  2900. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJavascript",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2901. args: [],
  2902. source: "testZorkCommitPathJsShouldBeJavascript\x0a\x09self assert: zorkPackage commitPathJs equals: 'javascripts/'",
  2903. messageSends: ["assert:equals:", "commitPathJs"],
  2904. referencedClasses: []
  2905. }),
  2906. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2907. smalltalk.addMethod(
  2908. smalltalk.method({
  2909. selector: "testZorkCommitPathStShouldBeSmalltalk",
  2910. category: 'tests',
  2911. fn: function (){
  2912. var self=this;
  2913. return smalltalk.withContext(function($ctx1) {
  2914. self._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"smalltalk/");
  2915. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSmalltalk",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2916. args: [],
  2917. source: "testZorkCommitPathStShouldBeSmalltalk\x0a\x09self assert: zorkPackage commitPathSt equals: 'smalltalk/'",
  2918. messageSends: ["assert:equals:", "commitPathSt"],
  2919. referencedClasses: []
  2920. }),
  2921. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2922. smalltalk.addMethod(
  2923. smalltalk.method({
  2924. selector: "shouldInheritSelectors",
  2925. category: 'accessing',
  2926. fn: function (){
  2927. var self=this;
  2928. return smalltalk.withContext(function($ctx1) {
  2929. return false;
  2930. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged.klass)})},
  2931. args: [],
  2932. source: "shouldInheritSelectors\x0a\x09^ false",
  2933. messageSends: [],
  2934. referencedClasses: []
  2935. }),
  2936. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged.klass);
  2937. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2938. smalltalk.addMethod(
  2939. smalltalk.method({
  2940. selector: "testValue",
  2941. category: 'tests',
  2942. fn: function (){
  2943. var self=this;
  2944. var messageSend;
  2945. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  2946. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2947. return smalltalk.withContext(function($ctx1) {
  2948. var $1,$2;
  2949. $1=_st($MessageSend())._new();
  2950. _st($1)._receiver_(_st($Object())._new());
  2951. _st($1)._selector_("asString");
  2952. $2=_st($1)._yourself();
  2953. messageSend=$2;
  2954. self._assert_equals_(_st(messageSend)._value(),"an Object");
  2955. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  2956. args: [],
  2957. 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'",
  2958. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  2959. referencedClasses: ["MessageSend", "Object"]
  2960. }),
  2961. smalltalk.MessageSendTest);
  2962. smalltalk.addMethod(
  2963. smalltalk.method({
  2964. selector: "testValueWithArguments",
  2965. category: 'tests',
  2966. fn: function (){
  2967. var self=this;
  2968. var messageSend;
  2969. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  2970. return smalltalk.withContext(function($ctx1) {
  2971. var $1,$2;
  2972. $1=_st($MessageSend())._new();
  2973. _st($1)._receiver_((2));
  2974. _st($1)._selector_("+");
  2975. $2=_st($1)._yourself();
  2976. messageSend=$2;
  2977. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  2978. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  2979. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  2980. args: [],
  2981. 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",
  2982. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  2983. referencedClasses: ["MessageSend"]
  2984. }),
  2985. smalltalk.MessageSendTest);
  2986. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  2987. smalltalk.addMethod(
  2988. smalltalk.method({
  2989. selector: "codeGeneratorClass",
  2990. category: 'accessing',
  2991. fn: function (){
  2992. var self=this;
  2993. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  2994. return smalltalk.withContext(function($ctx1) {
  2995. var $1;
  2996. $1=$CodeGenerator();
  2997. return $1;
  2998. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  2999. args: [],
  3000. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  3001. messageSends: [],
  3002. referencedClasses: ["CodeGenerator"]
  3003. }),
  3004. smalltalk.MethodInheritanceTest);
  3005. smalltalk.addMethod(
  3006. smalltalk.method({
  3007. selector: "compiler",
  3008. category: 'factory',
  3009. fn: function (){
  3010. var self=this;
  3011. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  3012. return smalltalk.withContext(function($ctx1) {
  3013. var $2,$3,$1;
  3014. $2=_st($Compiler())._new();
  3015. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  3016. $3=_st($2)._yourself();
  3017. $1=$3;
  3018. return $1;
  3019. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  3020. args: [],
  3021. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  3022. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  3023. referencedClasses: ["Compiler"]
  3024. }),
  3025. smalltalk.MethodInheritanceTest);
  3026. smalltalk.addMethod(
  3027. smalltalk.method({
  3028. selector: "deinstallBottom",
  3029. category: 'testing',
  3030. fn: function (){
  3031. var self=this;
  3032. return smalltalk.withContext(function($ctx1) {
  3033. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  3034. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  3035. args: [],
  3036. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  3037. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  3038. referencedClasses: []
  3039. }),
  3040. smalltalk.MethodInheritanceTest);
  3041. smalltalk.addMethod(
  3042. smalltalk.method({
  3043. selector: "deinstallMiddle",
  3044. category: 'testing',
  3045. fn: function (){
  3046. var self=this;
  3047. return smalltalk.withContext(function($ctx1) {
  3048. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  3049. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  3050. args: [],
  3051. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  3052. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  3053. referencedClasses: []
  3054. }),
  3055. smalltalk.MethodInheritanceTest);
  3056. smalltalk.addMethod(
  3057. smalltalk.method({
  3058. selector: "deinstallTop",
  3059. category: 'testing',
  3060. fn: function (){
  3061. var self=this;
  3062. return smalltalk.withContext(function($ctx1) {
  3063. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  3064. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  3065. args: [],
  3066. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  3067. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  3068. referencedClasses: []
  3069. }),
  3070. smalltalk.MethodInheritanceTest);
  3071. smalltalk.addMethod(
  3072. smalltalk.method({
  3073. selector: "installBottom:",
  3074. category: 'testing',
  3075. fn: function (aString){
  3076. var self=this;
  3077. return smalltalk.withContext(function($ctx1) {
  3078. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassBottom(),"tests");
  3079. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  3080. args: ["aString"],
  3081. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom category: 'tests'",
  3082. messageSends: ["install:forClass:category:", "compiler", "targetClassBottom"],
  3083. referencedClasses: []
  3084. }),
  3085. smalltalk.MethodInheritanceTest);
  3086. smalltalk.addMethod(
  3087. smalltalk.method({
  3088. selector: "installMiddle:",
  3089. category: 'testing',
  3090. fn: function (aString){
  3091. var self=this;
  3092. return smalltalk.withContext(function($ctx1) {
  3093. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassMiddle(),"tests");
  3094. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  3095. args: ["aString"],
  3096. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle category: 'tests'",
  3097. messageSends: ["install:forClass:category:", "compiler", "targetClassMiddle"],
  3098. referencedClasses: []
  3099. }),
  3100. smalltalk.MethodInheritanceTest);
  3101. smalltalk.addMethod(
  3102. smalltalk.method({
  3103. selector: "installTop:",
  3104. category: 'testing',
  3105. fn: function (aString){
  3106. var self=this;
  3107. return smalltalk.withContext(function($ctx1) {
  3108. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassTop(),"tests");
  3109. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  3110. args: ["aString"],
  3111. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop category: 'tests'",
  3112. messageSends: ["install:forClass:category:", "compiler", "targetClassTop"],
  3113. referencedClasses: []
  3114. }),
  3115. smalltalk.MethodInheritanceTest);
  3116. smalltalk.addMethod(
  3117. smalltalk.method({
  3118. selector: "setUp",
  3119. category: 'initialization',
  3120. fn: function (){
  3121. var self=this;
  3122. return smalltalk.withContext(function($ctx1) {
  3123. self["@receiverTop"]=_st(self._targetClassTop())._new();
  3124. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  3125. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  3126. self["@method"]=nil;
  3127. self["@performBlock"]=(function(){
  3128. return smalltalk.withContext(function($ctx2) {
  3129. return self._error_("performBlock not initialized");
  3130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  3131. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  3132. args: [],
  3133. 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' ]",
  3134. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  3135. referencedClasses: []
  3136. }),
  3137. smalltalk.MethodInheritanceTest);
  3138. smalltalk.addMethod(
  3139. smalltalk.method({
  3140. selector: "shouldMNU",
  3141. category: 'testing',
  3142. fn: function (){
  3143. var self=this;
  3144. return smalltalk.withContext(function($ctx1) {
  3145. self._shouldMNUTop();
  3146. self._shouldMNUMiddle();
  3147. self._shouldMNUBottom();
  3148. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  3149. args: [],
  3150. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  3151. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  3152. referencedClasses: []
  3153. }),
  3154. smalltalk.MethodInheritanceTest);
  3155. smalltalk.addMethod(
  3156. smalltalk.method({
  3157. selector: "shouldMNUBottom",
  3158. category: 'testing',
  3159. fn: function (){
  3160. var self=this;
  3161. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3162. return smalltalk.withContext(function($ctx1) {
  3163. self._should_raise_((function(){
  3164. return smalltalk.withContext(function($ctx2) {
  3165. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  3166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3167. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  3168. args: [],
  3169. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  3170. messageSends: ["should:raise:", "value:"],
  3171. referencedClasses: ["MessageNotUnderstood"]
  3172. }),
  3173. smalltalk.MethodInheritanceTest);
  3174. smalltalk.addMethod(
  3175. smalltalk.method({
  3176. selector: "shouldMNUMiddle",
  3177. category: 'testing',
  3178. fn: function (){
  3179. var self=this;
  3180. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3181. return smalltalk.withContext(function($ctx1) {
  3182. self._should_raise_((function(){
  3183. return smalltalk.withContext(function($ctx2) {
  3184. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  3185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3186. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  3187. args: [],
  3188. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  3189. messageSends: ["should:raise:", "value:"],
  3190. referencedClasses: ["MessageNotUnderstood"]
  3191. }),
  3192. smalltalk.MethodInheritanceTest);
  3193. smalltalk.addMethod(
  3194. smalltalk.method({
  3195. selector: "shouldMNUTop",
  3196. category: 'testing',
  3197. fn: function (){
  3198. var self=this;
  3199. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3200. return smalltalk.withContext(function($ctx1) {
  3201. self._should_raise_((function(){
  3202. return smalltalk.withContext(function($ctx2) {
  3203. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  3204. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3205. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  3206. args: [],
  3207. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  3208. messageSends: ["should:raise:", "value:"],
  3209. referencedClasses: ["MessageNotUnderstood"]
  3210. }),
  3211. smalltalk.MethodInheritanceTest);
  3212. smalltalk.addMethod(
  3213. smalltalk.method({
  3214. selector: "shouldReturn:",
  3215. category: 'testing',
  3216. fn: function (anObject){
  3217. var self=this;
  3218. var result;
  3219. return smalltalk.withContext(function($ctx1) {
  3220. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  3221. self._assert_equals_(["top",anObject],["top",result]);
  3222. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  3223. self._assert_equals_(["middle",anObject],["middle",result]);
  3224. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  3225. self._assert_equals_(["bottom",anObject],["bottom",result]);
  3226. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  3227. args: ["anObject"],
  3228. 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 }",
  3229. messageSends: ["value:", "assert:equals:"],
  3230. referencedClasses: []
  3231. }),
  3232. smalltalk.MethodInheritanceTest);
  3233. smalltalk.addMethod(
  3234. smalltalk.method({
  3235. selector: "shouldReturn:and:and:",
  3236. category: 'testing',
  3237. fn: function (anObject,anObject2,anObject3){
  3238. var self=this;
  3239. var result;
  3240. return smalltalk.withContext(function($ctx1) {
  3241. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  3242. self._assert_equals_(["top",anObject],["top",result]);
  3243. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  3244. self._assert_equals_(["middle",anObject2],["middle",result]);
  3245. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  3246. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  3247. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  3248. args: ["anObject", "anObject2", "anObject3"],
  3249. 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 }",
  3250. messageSends: ["value:", "assert:equals:"],
  3251. referencedClasses: []
  3252. }),
  3253. smalltalk.MethodInheritanceTest);
  3254. smalltalk.addMethod(
  3255. smalltalk.method({
  3256. selector: "targetClassBottom",
  3257. category: 'accessing',
  3258. fn: function (){
  3259. var self=this;
  3260. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  3261. return smalltalk.withContext(function($ctx1) {
  3262. var $1;
  3263. $1=$JavaScriptException();
  3264. return $1;
  3265. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  3266. args: [],
  3267. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  3268. messageSends: [],
  3269. referencedClasses: ["JavaScriptException"]
  3270. }),
  3271. smalltalk.MethodInheritanceTest);
  3272. smalltalk.addMethod(
  3273. smalltalk.method({
  3274. selector: "targetClassMiddle",
  3275. category: 'accessing',
  3276. fn: function (){
  3277. var self=this;
  3278. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3279. return smalltalk.withContext(function($ctx1) {
  3280. var $1;
  3281. $1=$Error();
  3282. return $1;
  3283. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  3284. args: [],
  3285. source: "targetClassMiddle\x0a\x09^ Error",
  3286. messageSends: [],
  3287. referencedClasses: ["Error"]
  3288. }),
  3289. smalltalk.MethodInheritanceTest);
  3290. smalltalk.addMethod(
  3291. smalltalk.method({
  3292. selector: "targetClassTop",
  3293. category: 'accessing',
  3294. fn: function (){
  3295. var self=this;
  3296. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3297. return smalltalk.withContext(function($ctx1) {
  3298. var $1;
  3299. $1=$Object();
  3300. return $1;
  3301. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  3302. args: [],
  3303. source: "targetClassTop\x0a\x09^ Object",
  3304. messageSends: [],
  3305. referencedClasses: ["Object"]
  3306. }),
  3307. smalltalk.MethodInheritanceTest);
  3308. smalltalk.addMethod(
  3309. smalltalk.method({
  3310. selector: "tearDown",
  3311. category: 'initialization',
  3312. fn: function (){
  3313. var self=this;
  3314. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3315. return smalltalk.withContext(function($ctx1) {
  3316. _st((function(){
  3317. return smalltalk.withContext(function($ctx2) {
  3318. return self._deinstallTop();
  3319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  3320. return smalltalk.withContext(function($ctx2) {
  3321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3322. _st((function(){
  3323. return smalltalk.withContext(function($ctx2) {
  3324. return self._deinstallMiddle();
  3325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  3326. return smalltalk.withContext(function($ctx2) {
  3327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  3328. _st((function(){
  3329. return smalltalk.withContext(function($ctx2) {
  3330. return self._deinstallBottom();
  3331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  3332. return smalltalk.withContext(function($ctx2) {
  3333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  3334. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  3335. args: [],
  3336. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [].\x0a\x09[ self deinstallMiddle ] on: Error do: [].\x0a\x09[ self deinstallBottom ] on: Error do: []",
  3337. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  3338. referencedClasses: ["Error"]
  3339. }),
  3340. smalltalk.MethodInheritanceTest);
  3341. smalltalk.addMethod(
  3342. smalltalk.method({
  3343. selector: "testMNU11",
  3344. category: 'tests',
  3345. fn: function (){
  3346. var self=this;
  3347. return smalltalk.withContext(function($ctx1) {
  3348. self["@performBlock"]=(function(x){
  3349. return smalltalk.withContext(function($ctx2) {
  3350. return _st(x)._foo();
  3351. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  3352. self._shouldMNU();
  3353. self._installTop_("foo ^ false");
  3354. self._installTop_("foo ^ true");
  3355. self._deinstallTop();
  3356. self._shouldMNU();
  3357. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  3358. args: [],
  3359. 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",
  3360. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  3361. referencedClasses: []
  3362. }),
  3363. smalltalk.MethodInheritanceTest);
  3364. smalltalk.addMethod(
  3365. smalltalk.method({
  3366. selector: "testMNU22",
  3367. category: 'tests',
  3368. fn: function (){
  3369. var self=this;
  3370. return smalltalk.withContext(function($ctx1) {
  3371. self["@performBlock"]=(function(x){
  3372. return smalltalk.withContext(function($ctx2) {
  3373. return _st(x)._foo();
  3374. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  3375. self._shouldMNU();
  3376. self._installMiddle_("foo ^ false");
  3377. self._installMiddle_("foo ^ true");
  3378. self._deinstallMiddle();
  3379. self._shouldMNU();
  3380. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  3381. args: [],
  3382. 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",
  3383. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  3384. referencedClasses: []
  3385. }),
  3386. smalltalk.MethodInheritanceTest);
  3387. smalltalk.addMethod(
  3388. smalltalk.method({
  3389. selector: "testReturns1",
  3390. category: 'tests',
  3391. fn: function (){
  3392. var self=this;
  3393. return smalltalk.withContext(function($ctx1) {
  3394. self["@performBlock"]=(function(x){
  3395. return smalltalk.withContext(function($ctx2) {
  3396. return _st(x)._foo();
  3397. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  3398. self._installTop_("foo ^ false");
  3399. self._shouldReturn_(false);
  3400. self._installTop_("foo ^ true");
  3401. self._shouldReturn_(true);
  3402. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  3403. args: [],
  3404. 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",
  3405. messageSends: ["foo", "installTop:", "shouldReturn:"],
  3406. referencedClasses: []
  3407. }),
  3408. smalltalk.MethodInheritanceTest);
  3409. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3410. smalltalk.addMethod(
  3411. smalltalk.method({
  3412. selector: "testAbs",
  3413. category: 'tests',
  3414. fn: function (){
  3415. var self=this;
  3416. return smalltalk.withContext(function($ctx1) {
  3417. self._assert_equals_((4)._abs(),(4));
  3418. self._assert_equals_((-4)._abs(),(4));
  3419. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  3420. args: [],
  3421. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  3422. messageSends: ["assert:equals:", "abs"],
  3423. referencedClasses: []
  3424. }),
  3425. smalltalk.NumberTest);
  3426. smalltalk.addMethod(
  3427. smalltalk.method({
  3428. selector: "testArithmetic",
  3429. category: 'tests',
  3430. fn: function (){
  3431. var self=this;
  3432. return smalltalk.withContext(function($ctx1) {
  3433. self._assert_equals_((1.5).__plus((1)),(2.5));
  3434. self._assert_equals_((2).__minus((1)),(1));
  3435. self._assert_equals_((-2).__minus((1)),(-3));
  3436. self._assert_equals_((12).__slash((2)),(6));
  3437. self._assert_equals_((3).__star((4)),(12));
  3438. self._assert_equals_(_st((1).__plus((2))).__star((3)),(9));
  3439. self._assert_equals_((1).__plus((2).__star((3))),(7));
  3440. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  3441. args: [],
  3442. 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\x0a\x09\x22Simple parenthesis and execution order\x22\x0a\x09self assert: 1 + 2 * 3 equals: 9.\x0a\x09self assert: 1 + (2 * 3) equals: 7",
  3443. messageSends: ["assert:equals:", "+", "-", "/", "*"],
  3444. referencedClasses: []
  3445. }),
  3446. smalltalk.NumberTest);
  3447. smalltalk.addMethod(
  3448. smalltalk.method({
  3449. selector: "testCeiling",
  3450. category: 'tests',
  3451. fn: function (){
  3452. var self=this;
  3453. return smalltalk.withContext(function($ctx1) {
  3454. self._assert_equals_((1.2)._ceiling(),(2));
  3455. self._assert_equals_((-1.2)._ceiling(),(-1));
  3456. self._assert_equals_((1)._ceiling(),(1));
  3457. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  3458. args: [],
  3459. 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.",
  3460. messageSends: ["assert:equals:", "ceiling"],
  3461. referencedClasses: []
  3462. }),
  3463. smalltalk.NumberTest);
  3464. smalltalk.addMethod(
  3465. smalltalk.method({
  3466. selector: "testComparison",
  3467. category: 'tests',
  3468. fn: function (){
  3469. var self=this;
  3470. return smalltalk.withContext(function($ctx1) {
  3471. self._assert_((3).__gt((2)));
  3472. self._assert_((2).__lt((3)));
  3473. self._deny_((3).__lt((2)));
  3474. self._deny_((2).__gt((3)));
  3475. self._assert_((3).__gt_eq((3)));
  3476. self._assert_((3.1).__gt_eq((3)));
  3477. self._assert_((3).__lt_eq((3)));
  3478. self._assert_((3).__lt_eq((3.1)));
  3479. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  3480. args: [],
  3481. 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",
  3482. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  3483. referencedClasses: []
  3484. }),
  3485. smalltalk.NumberTest);
  3486. smalltalk.addMethod(
  3487. smalltalk.method({
  3488. selector: "testCopying",
  3489. category: 'tests',
  3490. fn: function (){
  3491. var self=this;
  3492. return smalltalk.withContext(function($ctx1) {
  3493. self._assert_(_st((1)._copy()).__eq_eq((1)));
  3494. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  3495. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  3496. args: [],
  3497. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  3498. messageSends: ["assert:", "==", "copy", "deepCopy"],
  3499. referencedClasses: []
  3500. }),
  3501. smalltalk.NumberTest);
  3502. smalltalk.addMethod(
  3503. smalltalk.method({
  3504. selector: "testEquality",
  3505. category: 'tests',
  3506. fn: function (){
  3507. var self=this;
  3508. return smalltalk.withContext(function($ctx1) {
  3509. self._assert_((1).__eq((1)));
  3510. self._assert_((0).__eq((0)));
  3511. self._deny_((1).__eq((0)));
  3512. self._assert_(_st((1)._yourself()).__eq((1)));
  3513. self._assert_((1).__eq((1)._yourself()));
  3514. self._assert_(_st((1)._yourself()).__eq((1)._yourself()));
  3515. self._deny_((0).__eq(false));
  3516. self._deny_(false.__eq((0)));
  3517. self._deny_("".__eq((0)));
  3518. self._deny_((0).__eq(""));
  3519. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  3520. args: [],
  3521. 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 = ''",
  3522. messageSends: ["assert:", "=", "deny:", "yourself"],
  3523. referencedClasses: []
  3524. }),
  3525. smalltalk.NumberTest);
  3526. smalltalk.addMethod(
  3527. smalltalk.method({
  3528. selector: "testFloor",
  3529. category: 'tests',
  3530. fn: function (){
  3531. var self=this;
  3532. return smalltalk.withContext(function($ctx1) {
  3533. self._assert_equals_((1.2)._floor(),(1));
  3534. self._assert_equals_((-1.2)._floor(),(-2));
  3535. self._assert_equals_((1)._floor(),(1));
  3536. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  3537. args: [],
  3538. 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.",
  3539. messageSends: ["assert:equals:", "floor"],
  3540. referencedClasses: []
  3541. }),
  3542. smalltalk.NumberTest);
  3543. smalltalk.addMethod(
  3544. smalltalk.method({
  3545. selector: "testHexNumbers",
  3546. category: 'tests',
  3547. fn: function (){
  3548. var self=this;
  3549. return smalltalk.withContext(function($ctx1) {
  3550. self._assert_equals_((9),(9));
  3551. self._assert_equals_((10)._truncated(),(10));
  3552. self._assert_equals_((11)._truncated(),(11));
  3553. self._assert_equals_((12)._truncated(),(12));
  3554. self._assert_equals_((13)._truncated(),(13));
  3555. self._assert_equals_((14)._truncated(),(14));
  3556. self._assert_equals_((15)._truncated(),(15));
  3557. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  3558. args: [],
  3559. 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",
  3560. messageSends: ["assert:equals:", "truncated"],
  3561. referencedClasses: []
  3562. }),
  3563. smalltalk.NumberTest);
  3564. smalltalk.addMethod(
  3565. smalltalk.method({
  3566. selector: "testIdentity",
  3567. category: 'tests',
  3568. fn: function (){
  3569. var self=this;
  3570. return smalltalk.withContext(function($ctx1) {
  3571. self._assert_((1).__eq_eq((1)));
  3572. self._assert_((0).__eq_eq((0)));
  3573. self._deny_((1).__eq_eq((0)));
  3574. self._assert_(_st((1)._yourself()).__eq_eq((1)));
  3575. self._assert_((1).__eq_eq((1)._yourself()));
  3576. self._assert_(_st((1)._yourself()).__eq_eq((1)._yourself()));
  3577. self._deny_((1).__eq_eq((2)));
  3578. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  3579. args: [],
  3580. 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",
  3581. messageSends: ["assert:", "==", "deny:", "yourself"],
  3582. referencedClasses: []
  3583. }),
  3584. smalltalk.NumberTest);
  3585. smalltalk.addMethod(
  3586. smalltalk.method({
  3587. selector: "testInvalidHexNumbers",
  3588. category: 'tests',
  3589. fn: function (){
  3590. var self=this;
  3591. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3592. return smalltalk.withContext(function($ctx1) {
  3593. self._should_raise_((function(){
  3594. return smalltalk.withContext(function($ctx2) {
  3595. return (16)._rG();
  3596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3597. self._should_raise_((function(){
  3598. return smalltalk.withContext(function($ctx2) {
  3599. return (16)._rg();
  3600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  3601. self._should_raise_((function(){
  3602. return smalltalk.withContext(function($ctx2) {
  3603. return (16)._rH();
  3604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  3605. self._should_raise_((function(){
  3606. return smalltalk.withContext(function($ctx2) {
  3607. return (16)._rh();
  3608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  3609. self._should_raise_((function(){
  3610. return smalltalk.withContext(function($ctx2) {
  3611. return (16)._rI();
  3612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  3613. self._should_raise_((function(){
  3614. return smalltalk.withContext(function($ctx2) {
  3615. return (16)._ri();
  3616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  3617. self._should_raise_((function(){
  3618. return smalltalk.withContext(function($ctx2) {
  3619. return (16)._rJ();
  3620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  3621. self._should_raise_((function(){
  3622. return smalltalk.withContext(function($ctx2) {
  3623. return (16)._rj();
  3624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  3625. self._should_raise_((function(){
  3626. return smalltalk.withContext(function($ctx2) {
  3627. return (16)._rK();
  3628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  3629. self._should_raise_((function(){
  3630. return smalltalk.withContext(function($ctx2) {
  3631. return (16)._rk();
  3632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  3633. self._should_raise_((function(){
  3634. return smalltalk.withContext(function($ctx2) {
  3635. return (16)._rL();
  3636. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  3637. self._should_raise_((function(){
  3638. return smalltalk.withContext(function($ctx2) {
  3639. return (16)._rl();
  3640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  3641. self._should_raise_((function(){
  3642. return smalltalk.withContext(function($ctx2) {
  3643. return (16)._rM();
  3644. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  3645. self._should_raise_((function(){
  3646. return smalltalk.withContext(function($ctx2) {
  3647. return (16)._rm();
  3648. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  3649. self._should_raise_((function(){
  3650. return smalltalk.withContext(function($ctx2) {
  3651. return (16)._rN();
  3652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  3653. self._should_raise_((function(){
  3654. return smalltalk.withContext(function($ctx2) {
  3655. return (16)._rn();
  3656. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  3657. self._should_raise_((function(){
  3658. return smalltalk.withContext(function($ctx2) {
  3659. return (16)._rO();
  3660. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  3661. self._should_raise_((function(){
  3662. return smalltalk.withContext(function($ctx2) {
  3663. return (16)._ro();
  3664. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  3665. self._should_raise_((function(){
  3666. return smalltalk.withContext(function($ctx2) {
  3667. return (16)._rP();
  3668. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  3669. self._should_raise_((function(){
  3670. return smalltalk.withContext(function($ctx2) {
  3671. return (16)._rp();
  3672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  3673. self._should_raise_((function(){
  3674. return smalltalk.withContext(function($ctx2) {
  3675. return (16)._rQ();
  3676. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  3677. self._should_raise_((function(){
  3678. return smalltalk.withContext(function($ctx2) {
  3679. return (16)._rq();
  3680. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  3681. self._should_raise_((function(){
  3682. return smalltalk.withContext(function($ctx2) {
  3683. return (16)._rR();
  3684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  3685. self._should_raise_((function(){
  3686. return smalltalk.withContext(function($ctx2) {
  3687. return (16)._rr();
  3688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  3689. self._should_raise_((function(){
  3690. return smalltalk.withContext(function($ctx2) {
  3691. return (16)._rS();
  3692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  3693. self._should_raise_((function(){
  3694. return smalltalk.withContext(function($ctx2) {
  3695. return (16)._rs();
  3696. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  3697. self._should_raise_((function(){
  3698. return smalltalk.withContext(function($ctx2) {
  3699. return (16)._rT();
  3700. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  3701. self._should_raise_((function(){
  3702. return smalltalk.withContext(function($ctx2) {
  3703. return (16)._rt();
  3704. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  3705. self._should_raise_((function(){
  3706. return smalltalk.withContext(function($ctx2) {
  3707. return (16)._rU();
  3708. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  3709. self._should_raise_((function(){
  3710. return smalltalk.withContext(function($ctx2) {
  3711. return (16)._ru();
  3712. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  3713. self._should_raise_((function(){
  3714. return smalltalk.withContext(function($ctx2) {
  3715. return (16)._rV();
  3716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  3717. self._should_raise_((function(){
  3718. return smalltalk.withContext(function($ctx2) {
  3719. return (16)._rv();
  3720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  3721. self._should_raise_((function(){
  3722. return smalltalk.withContext(function($ctx2) {
  3723. return (16)._rW();
  3724. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  3725. self._should_raise_((function(){
  3726. return smalltalk.withContext(function($ctx2) {
  3727. return (16)._rw();
  3728. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  3729. self._should_raise_((function(){
  3730. return smalltalk.withContext(function($ctx2) {
  3731. return (16)._rX();
  3732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  3733. self._should_raise_((function(){
  3734. return smalltalk.withContext(function($ctx2) {
  3735. return (16)._rx();
  3736. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  3737. self._should_raise_((function(){
  3738. return smalltalk.withContext(function($ctx2) {
  3739. return (16)._rY();
  3740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  3741. self._should_raise_((function(){
  3742. return smalltalk.withContext(function($ctx2) {
  3743. return (16)._ry();
  3744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  3745. self._should_raise_((function(){
  3746. return smalltalk.withContext(function($ctx2) {
  3747. return (16)._rZ();
  3748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  3749. self._should_raise_((function(){
  3750. return smalltalk.withContext(function($ctx2) {
  3751. return (16)._rz();
  3752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  3753. self._should_raise_((function(){
  3754. return smalltalk.withContext(function($ctx2) {
  3755. return (11259375)._Z();
  3756. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  3757. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  3758. args: [],
  3759. 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.",
  3760. 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"],
  3761. referencedClasses: ["MessageNotUnderstood"]
  3762. }),
  3763. smalltalk.NumberTest);
  3764. smalltalk.addMethod(
  3765. smalltalk.method({
  3766. selector: "testMinMax",
  3767. category: 'tests',
  3768. fn: function (){
  3769. var self=this;
  3770. return smalltalk.withContext(function($ctx1) {
  3771. self._assert_equals_((2)._max_((5)),(5));
  3772. self._assert_equals_((2)._min_((5)),(2));
  3773. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  3774. args: [],
  3775. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  3776. messageSends: ["assert:equals:", "max:", "min:"],
  3777. referencedClasses: []
  3778. }),
  3779. smalltalk.NumberTest);
  3780. smalltalk.addMethod(
  3781. smalltalk.method({
  3782. selector: "testNegated",
  3783. category: 'tests',
  3784. fn: function (){
  3785. var self=this;
  3786. return smalltalk.withContext(function($ctx1) {
  3787. self._assert_equals_((3)._negated(),(-3));
  3788. self._assert_equals_((-3)._negated(),(3));
  3789. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  3790. args: [],
  3791. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  3792. messageSends: ["assert:equals:", "negated"],
  3793. referencedClasses: []
  3794. }),
  3795. smalltalk.NumberTest);
  3796. smalltalk.addMethod(
  3797. smalltalk.method({
  3798. selector: "testPrintShowingDecimalPlaces",
  3799. category: 'tests',
  3800. fn: function (){
  3801. var self=this;
  3802. return smalltalk.withContext(function($ctx1) {
  3803. self._assert_equals_((23)._printShowingDecimalPlaces_((2)),"23.00");
  3804. self._assert_equals_((23.5698)._printShowingDecimalPlaces_((2)),"23.57");
  3805. self._assert_equals_(_st((234.567)._negated())._printShowingDecimalPlaces_((5)),"-234.56700");
  3806. self._assert_equals_((23.4567)._printShowingDecimalPlaces_((0)),"23");
  3807. self._assert_equals_((23.5567)._printShowingDecimalPlaces_((0)),"24");
  3808. self._assert_equals_(_st((23.4567)._negated())._printShowingDecimalPlaces_((0)),"-23");
  3809. self._assert_equals_(_st((23.5567)._negated())._printShowingDecimalPlaces_((0)),"-24");
  3810. self._assert_equals_((100000000)._printShowingDecimalPlaces_((1)),"100000000.0");
  3811. self._assert_equals_((0.98)._printShowingDecimalPlaces_((5)),"0.98000");
  3812. self._assert_equals_(_st((0.98)._negated())._printShowingDecimalPlaces_((2)),"-0.98");
  3813. self._assert_equals_((2.567)._printShowingDecimalPlaces_((2)),"2.57");
  3814. self._assert_equals_((-2.567)._printShowingDecimalPlaces_((2)),"-2.57");
  3815. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  3816. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  3817. args: [],
  3818. 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'.",
  3819. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  3820. referencedClasses: []
  3821. }),
  3822. smalltalk.NumberTest);
  3823. smalltalk.addMethod(
  3824. smalltalk.method({
  3825. selector: "testRounded",
  3826. category: 'tests',
  3827. fn: function (){
  3828. var self=this;
  3829. return smalltalk.withContext(function($ctx1) {
  3830. self._assert_equals_((3)._rounded(),(3));
  3831. self._assert_equals_((3.212)._rounded(),(3));
  3832. self._assert_equals_((3.51)._rounded(),(4));
  3833. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  3834. args: [],
  3835. 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",
  3836. messageSends: ["assert:equals:", "rounded"],
  3837. referencedClasses: []
  3838. }),
  3839. smalltalk.NumberTest);
  3840. smalltalk.addMethod(
  3841. smalltalk.method({
  3842. selector: "testSqrt",
  3843. category: 'tests',
  3844. fn: function (){
  3845. var self=this;
  3846. return smalltalk.withContext(function($ctx1) {
  3847. self._assert_equals_((4)._sqrt(),(2));
  3848. self._assert_equals_((16)._sqrt(),(4));
  3849. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  3850. args: [],
  3851. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  3852. messageSends: ["assert:equals:", "sqrt"],
  3853. referencedClasses: []
  3854. }),
  3855. smalltalk.NumberTest);
  3856. smalltalk.addMethod(
  3857. smalltalk.method({
  3858. selector: "testSquared",
  3859. category: 'tests',
  3860. fn: function (){
  3861. var self=this;
  3862. return smalltalk.withContext(function($ctx1) {
  3863. self._assert_equals_((4)._squared(),(16));
  3864. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  3865. args: [],
  3866. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  3867. messageSends: ["assert:equals:", "squared"],
  3868. referencedClasses: []
  3869. }),
  3870. smalltalk.NumberTest);
  3871. smalltalk.addMethod(
  3872. smalltalk.method({
  3873. selector: "testTimesRepeat",
  3874. category: 'tests',
  3875. fn: function (){
  3876. var self=this;
  3877. var i;
  3878. return smalltalk.withContext(function($ctx1) {
  3879. i=(0);
  3880. (0)._timesRepeat_((function(){
  3881. return smalltalk.withContext(function($ctx2) {
  3882. i=_st(i).__plus((1));
  3883. return i;
  3884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3885. self._assert_equals_(i,(0));
  3886. (5)._timesRepeat_((function(){
  3887. return smalltalk.withContext(function($ctx2) {
  3888. i=_st(i).__plus((1));
  3889. return i;
  3890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3891. self._assert_equals_(i,(5));
  3892. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  3893. args: [],
  3894. 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",
  3895. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  3896. referencedClasses: []
  3897. }),
  3898. smalltalk.NumberTest);
  3899. smalltalk.addMethod(
  3900. smalltalk.method({
  3901. selector: "testTo",
  3902. category: 'tests',
  3903. fn: function (){
  3904. var self=this;
  3905. return smalltalk.withContext(function($ctx1) {
  3906. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  3907. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  3908. args: [],
  3909. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  3910. messageSends: ["assert:equals:", "to:"],
  3911. referencedClasses: []
  3912. }),
  3913. smalltalk.NumberTest);
  3914. smalltalk.addMethod(
  3915. smalltalk.method({
  3916. selector: "testToBy",
  3917. category: 'tests',
  3918. fn: function (){
  3919. var self=this;
  3920. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3921. return smalltalk.withContext(function($ctx1) {
  3922. self._assert_equals_((0)._to_by_((6),(2)),[(0), (2), (4), (6)]);
  3923. self._should_raise_((function(){
  3924. return smalltalk.withContext(function($ctx2) {
  3925. return (1)._to_by_((4),(0));
  3926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3927. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  3928. args: [],
  3929. 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",
  3930. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  3931. referencedClasses: ["Error"]
  3932. }),
  3933. smalltalk.NumberTest);
  3934. smalltalk.addMethod(
  3935. smalltalk.method({
  3936. selector: "testTruncated",
  3937. category: 'tests',
  3938. fn: function (){
  3939. var self=this;
  3940. return smalltalk.withContext(function($ctx1) {
  3941. self._assert_equals_((3)._truncated(),(3));
  3942. self._assert_equals_((3.212)._truncated(),(3));
  3943. self._assert_equals_((3.51)._truncated(),(3));
  3944. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  3945. args: [],
  3946. 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",
  3947. messageSends: ["assert:equals:", "truncated"],
  3948. referencedClasses: []
  3949. }),
  3950. smalltalk.NumberTest);
  3951. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  3952. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  3953. smalltalk.addMethod(
  3954. smalltalk.method({
  3955. selector: "foo",
  3956. category: 'not yet classified',
  3957. fn: function (){
  3958. var self=this;
  3959. return smalltalk.withContext(function($ctx1) {
  3960. var $1;
  3961. $1=self["@foo"];
  3962. return $1;
  3963. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  3964. args: [],
  3965. source: "foo\x0a\x09^foo",
  3966. messageSends: [],
  3967. referencedClasses: []
  3968. }),
  3969. smalltalk.ObjectMock);
  3970. smalltalk.addMethod(
  3971. smalltalk.method({
  3972. selector: "foo:",
  3973. category: 'not yet classified',
  3974. fn: function (anObject){
  3975. var self=this;
  3976. return smalltalk.withContext(function($ctx1) {
  3977. self["@foo"]=anObject;
  3978. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  3979. args: ["anObject"],
  3980. source: "foo: anObject\x0a\x09foo := anObject",
  3981. messageSends: [],
  3982. referencedClasses: []
  3983. }),
  3984. smalltalk.ObjectMock);
  3985. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3986. smalltalk.addMethod(
  3987. smalltalk.method({
  3988. selector: "notDefined",
  3989. category: 'tests',
  3990. fn: function (){
  3991. var self=this;
  3992. return smalltalk.withContext(function($ctx1) {
  3993. return undefined;;
  3994. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  3995. args: [],
  3996. source: "notDefined\x0a\x09<return undefined;>",
  3997. messageSends: [],
  3998. referencedClasses: []
  3999. }),
  4000. smalltalk.ObjectTest);
  4001. smalltalk.addMethod(
  4002. smalltalk.method({
  4003. selector: "testBasicAccess",
  4004. category: 'tests',
  4005. fn: function (){
  4006. var self=this;
  4007. var o;
  4008. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4009. return smalltalk.withContext(function($ctx1) {
  4010. o=_st($Object())._new();
  4011. _st(o)._basicAt_put_("a",(1));
  4012. self._assert_equals_(_st(o)._basicAt_("a"),(1));
  4013. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  4014. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  4015. args: [],
  4016. 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",
  4017. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  4018. referencedClasses: ["Object"]
  4019. }),
  4020. smalltalk.ObjectTest);
  4021. smalltalk.addMethod(
  4022. smalltalk.method({
  4023. selector: "testBasicPerform",
  4024. category: 'tests',
  4025. fn: function (){
  4026. var self=this;
  4027. var o;
  4028. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4029. return smalltalk.withContext(function($ctx1) {
  4030. o=_st($Object())._new();
  4031. _st(o)._basicAt_put_("func",(function(){
  4032. return smalltalk.withContext(function($ctx2) {
  4033. return "hello";
  4034. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4035. _st(o)._basicAt_put_("func2",(function(a){
  4036. return smalltalk.withContext(function($ctx2) {
  4037. return _st(a).__plus((1));
  4038. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  4039. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  4040. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  4041. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  4042. args: [],
  4043. 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",
  4044. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  4045. referencedClasses: ["Object"]
  4046. }),
  4047. smalltalk.ObjectTest);
  4048. smalltalk.addMethod(
  4049. smalltalk.method({
  4050. selector: "testDNU",
  4051. category: 'tests',
  4052. fn: function (){
  4053. var self=this;
  4054. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4055. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4056. return smalltalk.withContext(function($ctx1) {
  4057. self._should_raise_((function(){
  4058. return smalltalk.withContext(function($ctx2) {
  4059. return _st(_st($Object())._new())._foo();
  4060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4061. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  4062. args: [],
  4063. source: "testDNU\x0a\x09self should: [Object new foo] raise: MessageNotUnderstood",
  4064. messageSends: ["should:raise:", "foo", "new"],
  4065. referencedClasses: ["Object", "MessageNotUnderstood"]
  4066. }),
  4067. smalltalk.ObjectTest);
  4068. smalltalk.addMethod(
  4069. smalltalk.method({
  4070. selector: "testEquality",
  4071. category: 'tests',
  4072. fn: function (){
  4073. var self=this;
  4074. var o;
  4075. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4076. return smalltalk.withContext(function($ctx1) {
  4077. o=_st($Object())._new();
  4078. self._deny_(_st(o).__eq(_st($Object())._new()));
  4079. self._assert_(_st(o).__eq(o));
  4080. self._assert_(_st(_st(o)._yourself()).__eq(o));
  4081. self._assert_(_st(o).__eq(_st(o)._yourself()));
  4082. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  4083. args: [],
  4084. 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)",
  4085. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  4086. referencedClasses: ["Object"]
  4087. }),
  4088. smalltalk.ObjectTest);
  4089. smalltalk.addMethod(
  4090. smalltalk.method({
  4091. selector: "testHalt",
  4092. category: 'tests',
  4093. fn: function (){
  4094. var self=this;
  4095. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4096. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4097. return smalltalk.withContext(function($ctx1) {
  4098. self._should_raise_((function(){
  4099. return smalltalk.withContext(function($ctx2) {
  4100. return _st(_st($Object())._new())._halt();
  4101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4102. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  4103. args: [],
  4104. source: "testHalt\x0a\x09self should: [Object new halt] raise: Error",
  4105. messageSends: ["should:raise:", "halt", "new"],
  4106. referencedClasses: ["Object", "Error"]
  4107. }),
  4108. smalltalk.ObjectTest);
  4109. smalltalk.addMethod(
  4110. smalltalk.method({
  4111. selector: "testIdentity",
  4112. category: 'tests',
  4113. fn: function (){
  4114. var self=this;
  4115. var o;
  4116. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4117. return smalltalk.withContext(function($ctx1) {
  4118. o=_st($Object())._new();
  4119. self._deny_(_st(o).__eq_eq(_st($Object())._new()));
  4120. self._assert_(_st(o).__eq_eq(o));
  4121. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  4122. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  4123. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  4124. args: [],
  4125. 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",
  4126. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  4127. referencedClasses: ["Object"]
  4128. }),
  4129. smalltalk.ObjectTest);
  4130. smalltalk.addMethod(
  4131. smalltalk.method({
  4132. selector: "testIfNil",
  4133. category: 'tests',
  4134. fn: function (){
  4135. var self=this;
  4136. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4137. return smalltalk.withContext(function($ctx1) {
  4138. var $1,$4,$3,$2,$5,$7,$6,$8,$10,$9,$11,$13,$12;
  4139. self._deny_(_st(_st($Object())._new())._isNil());
  4140. $1=self;
  4141. $4=_st($Object())._new();
  4142. if(($receiver = $4) == nil || $receiver == undefined){
  4143. $3=true;
  4144. } else {
  4145. $3=$4;
  4146. };
  4147. $2=_st($3).__eq(true);
  4148. _st($1)._deny_($2);
  4149. $5=self;
  4150. $7=_st($Object())._new();
  4151. if(($receiver = $7) == nil || $receiver == undefined){
  4152. $6=$7;
  4153. } else {
  4154. $6=true;
  4155. };
  4156. _st($5)._assert_equals_($6,true);
  4157. $8=self;
  4158. $10=_st($Object())._new();
  4159. if(($receiver = $10) == nil || $receiver == undefined){
  4160. $9=false;
  4161. } else {
  4162. $9=true;
  4163. };
  4164. _st($8)._assert_equals_($9,true);
  4165. $11=self;
  4166. $13=_st($Object())._new();
  4167. if(($receiver = $13) == nil || $receiver == undefined){
  4168. $12=false;
  4169. } else {
  4170. $12=true;
  4171. };
  4172. _st($11)._assert_equals_($12,true);
  4173. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  4174. args: [],
  4175. 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",
  4176. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  4177. referencedClasses: ["Object"]
  4178. }),
  4179. smalltalk.ObjectTest);
  4180. smalltalk.addMethod(
  4181. smalltalk.method({
  4182. selector: "testInstVars",
  4183. category: 'tests',
  4184. fn: function (){
  4185. var self=this;
  4186. var o;
  4187. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  4188. return smalltalk.withContext(function($ctx1) {
  4189. o=_st($ObjectMock())._new();
  4190. self._assert_equals_(_st(o)._instVarAt_("foo"),nil);
  4191. _st(o)._instVarAt_put_("foo",(1));
  4192. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  4193. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  4194. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  4195. args: [],
  4196. 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",
  4197. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  4198. referencedClasses: ["ObjectMock"]
  4199. }),
  4200. smalltalk.ObjectTest);
  4201. smalltalk.addMethod(
  4202. smalltalk.method({
  4203. selector: "testNilUndefined",
  4204. category: 'tests',
  4205. fn: function (){
  4206. var self=this;
  4207. return smalltalk.withContext(function($ctx1) {
  4208. self._assert_equals_(self._notDefined(),nil);
  4209. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  4210. args: [],
  4211. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  4212. messageSends: ["assert:equals:", "notDefined"],
  4213. referencedClasses: []
  4214. }),
  4215. smalltalk.ObjectTest);
  4216. smalltalk.addMethod(
  4217. smalltalk.method({
  4218. selector: "testYourself",
  4219. category: 'tests',
  4220. fn: function (){
  4221. var self=this;
  4222. var o;
  4223. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  4224. return smalltalk.withContext(function($ctx1) {
  4225. o=_st($ObjectMock())._new();
  4226. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  4227. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  4228. args: [],
  4229. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  4230. messageSends: ["new", "assert:", "==", "yourself"],
  4231. referencedClasses: ["ObjectMock"]
  4232. }),
  4233. smalltalk.ObjectTest);
  4234. smalltalk.addMethod(
  4235. smalltalk.method({
  4236. selector: "testidentityHash",
  4237. category: 'tests',
  4238. fn: function (){
  4239. var self=this;
  4240. var o1,o2;
  4241. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4242. return smalltalk.withContext(function($ctx1) {
  4243. o1=_st($Object())._new();
  4244. o2=_st($Object())._new();
  4245. self._assert_(_st(_st(o1)._identityHash()).__eq_eq(_st(o1)._identityHash()));
  4246. self._deny_(_st(_st(o1)._identityHash()).__eq_eq(_st(o2)._identityHash()));
  4247. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  4248. args: [],
  4249. 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",
  4250. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  4251. referencedClasses: ["Object"]
  4252. }),
  4253. smalltalk.ObjectTest);
  4254. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4255. smalltalk.addMethod(
  4256. smalltalk.method({
  4257. selector: "testAccessing",
  4258. category: 'tests',
  4259. fn: function (){
  4260. var self=this;
  4261. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4262. return smalltalk.withContext(function($ctx1) {
  4263. self._assert_equals_(_st(_st($Point())._x_y_((3),(4)))._x(),(3));
  4264. self._assert_equals_(_st(_st($Point())._x_y_((3),(4)))._y(),(4));
  4265. self._assert_equals_(_st(_st(_st($Point())._new())._x_((3)))._x(),(3));
  4266. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  4267. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  4268. args: [],
  4269. 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",
  4270. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  4271. referencedClasses: ["Point"]
  4272. }),
  4273. smalltalk.PointTest);
  4274. smalltalk.addMethod(
  4275. smalltalk.method({
  4276. selector: "testArithmetic",
  4277. category: 'tests',
  4278. fn: function (){
  4279. var self=this;
  4280. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4281. return smalltalk.withContext(function($ctx1) {
  4282. self._assert_equals_(_st((3).__at((4))).__star((3).__at((4))),_st($Point())._x_y_((9),(16)));
  4283. self._assert_equals_(_st((3).__at((4))).__plus((3).__at((4))),_st($Point())._x_y_((6),(8)));
  4284. self._assert_equals_(_st((3).__at((4))).__minus((3).__at((4))),_st($Point())._x_y_((0),(0)));
  4285. self._assert_equals_(_st((6).__at((8))).__slash((3).__at((4))),_st($Point())._x_y_((2),(2)));
  4286. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  4287. args: [],
  4288. 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)",
  4289. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  4290. referencedClasses: ["Point"]
  4291. }),
  4292. smalltalk.PointTest);
  4293. smalltalk.addMethod(
  4294. smalltalk.method({
  4295. selector: "testAt",
  4296. category: 'tests',
  4297. fn: function (){
  4298. var self=this;
  4299. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4300. return smalltalk.withContext(function($ctx1) {
  4301. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  4302. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  4303. args: [],
  4304. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  4305. messageSends: ["assert:equals:", "@", "x:y:"],
  4306. referencedClasses: ["Point"]
  4307. }),
  4308. smalltalk.PointTest);
  4309. smalltalk.addMethod(
  4310. smalltalk.method({
  4311. selector: "testEgality",
  4312. category: 'tests',
  4313. fn: function (){
  4314. var self=this;
  4315. return smalltalk.withContext(function($ctx1) {
  4316. self._assert_(_st((3).__at((4))).__eq((3).__at((4))));
  4317. self._deny_(_st((3).__at((5))).__eq((3).__at((6))));
  4318. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  4319. args: [],
  4320. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  4321. messageSends: ["assert:", "=", "@", "deny:"],
  4322. referencedClasses: []
  4323. }),
  4324. smalltalk.PointTest);
  4325. smalltalk.addMethod(
  4326. smalltalk.method({
  4327. selector: "testTranslateBy",
  4328. category: 'tests',
  4329. fn: function (){
  4330. var self=this;
  4331. return smalltalk.withContext(function($ctx1) {
  4332. self._assert_equals_(_st((3).__at((3)))._translateBy_((0).__at((1))),(3).__at((4)));
  4333. self._assert_equals_(_st((3).__at((3)))._translateBy_((0).__at((1)._negated())),(3).__at((2)));
  4334. self._assert_equals_(_st((3).__at((3)))._translateBy_((2).__at((3))),(5).__at((6)));
  4335. self._assert_equals_(_st((3).__at((3)))._translateBy_(_st((3)._negated()).__at((0))),(0).__at((3)));
  4336. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  4337. args: [],
  4338. 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.",
  4339. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  4340. referencedClasses: []
  4341. }),
  4342. smalltalk.PointTest);
  4343. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4344. smalltalk.addMethod(
  4345. smalltalk.method({
  4346. selector: "textNext",
  4347. category: 'tests',
  4348. fn: function (){
  4349. var self=this;
  4350. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  4351. return smalltalk.withContext(function($ctx1) {
  4352. (10000)._timesRepeat_((function(){
  4353. var current,next;
  4354. return smalltalk.withContext(function($ctx2) {
  4355. next=_st(_st($Random())._new())._next();
  4356. next;
  4357. self._assert_(_st(next).__gt_eq((0)));
  4358. self._assert_(_st(next).__lt((1)));
  4359. self._deny_(_st(current).__eq(next));
  4360. return _st(next).__eq(current);
  4361. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  4362. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  4363. args: [],
  4364. 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]",
  4365. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  4366. referencedClasses: ["Random"]
  4367. }),
  4368. smalltalk.RandomTest);
  4369. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4370. smalltalk.addMethod(
  4371. smalltalk.method({
  4372. selector: "testAddRemove",
  4373. category: 'tests',
  4374. fn: function (){
  4375. var self=this;
  4376. var set;
  4377. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4378. return smalltalk.withContext(function($ctx1) {
  4379. set=_st($Set())._new();
  4380. self._assert_(_st(set)._isEmpty());
  4381. _st(set)._add_((3));
  4382. self._assert_(_st(set)._includes_((3)));
  4383. _st(set)._add_((5));
  4384. self._assert_(_st(set)._includes_((5)));
  4385. _st(set)._remove_((3));
  4386. self._deny_(_st(set)._includes_((3)));
  4387. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  4388. args: [],
  4389. 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)",
  4390. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  4391. referencedClasses: ["Set"]
  4392. }),
  4393. smalltalk.SetTest);
  4394. smalltalk.addMethod(
  4395. smalltalk.method({
  4396. selector: "testAt",
  4397. category: 'tests',
  4398. fn: function (){
  4399. var self=this;
  4400. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4401. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4402. return smalltalk.withContext(function($ctx1) {
  4403. self._should_raise_((function(){
  4404. return smalltalk.withContext(function($ctx2) {
  4405. return _st(_st($Set())._new())._at_put_((1),(2));
  4406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4407. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  4408. args: [],
  4409. source: "testAt\x0a\x09self should: [Set new at: 1 put: 2] raise: Error",
  4410. messageSends: ["should:raise:", "at:put:", "new"],
  4411. referencedClasses: ["Set", "Error"]
  4412. }),
  4413. smalltalk.SetTest);
  4414. smalltalk.addMethod(
  4415. smalltalk.method({
  4416. selector: "testCollect",
  4417. category: 'tests',
  4418. fn: function (){
  4419. var self=this;
  4420. return smalltalk.withContext(function($ctx1) {
  4421. self._assert_equals_(_st([(5), (6), (8)]._asSet())._collect_((function(x){
  4422. return smalltalk.withContext(function($ctx2) {
  4423. return _st(x).__backslash_backslash((3));
  4424. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})})),[(0), (2)]._asSet());
  4425. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  4426. args: [],
  4427. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  4428. messageSends: ["assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  4429. referencedClasses: []
  4430. }),
  4431. smalltalk.SetTest);
  4432. smalltalk.addMethod(
  4433. smalltalk.method({
  4434. selector: "testComparing",
  4435. category: 'tests',
  4436. fn: function (){
  4437. var self=this;
  4438. return smalltalk.withContext(function($ctx1) {
  4439. self._assert_equals_([(0), (2)]._asSet(),[(0), (2)]._asSet());
  4440. self._assert_equals_([(2), (0)]._asSet(),[(0), (2)]._asSet());
  4441. self._deny_(_st([(0), (2), (3)]._asSet()).__eq([(0), (2)]._asSet()));
  4442. self._deny_(_st([(1), (2)]._asSet()).__eq([(0), (2)]._asSet()));
  4443. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  4444. args: [],
  4445. 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",
  4446. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  4447. referencedClasses: []
  4448. }),
  4449. smalltalk.SetTest);
  4450. smalltalk.addMethod(
  4451. smalltalk.method({
  4452. selector: "testPrintString",
  4453. category: 'tests',
  4454. fn: function (){
  4455. var self=this;
  4456. var set;
  4457. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4458. return smalltalk.withContext(function($ctx1) {
  4459. var $1,$2,$3,$4;
  4460. set=_st($Set())._new();
  4461. self._assert_equals_(_st(set)._printString(),"a Set ()");
  4462. $1=set;
  4463. _st($1)._add_((1));
  4464. $2=_st($1)._add_((3));
  4465. self._assert_equals_(_st(set)._printString(),"a Set (1 3)");
  4466. _st(set)._add_("foo");
  4467. self._assert_equals_(_st(set)._printString(),"a Set (1 3 'foo')");
  4468. $3=set;
  4469. _st($3)._remove_((1));
  4470. $4=_st($3)._remove_((3));
  4471. self._assert_equals_(_st(set)._printString(),"a Set ('foo')");
  4472. _st(set)._add_((3));
  4473. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  4474. _st(set)._add_((3));
  4475. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  4476. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  4477. args: [],
  4478. 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)'",
  4479. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  4480. referencedClasses: ["Set"]
  4481. }),
  4482. smalltalk.SetTest);
  4483. smalltalk.addMethod(
  4484. smalltalk.method({
  4485. selector: "testSize",
  4486. category: 'tests',
  4487. fn: function (){
  4488. var self=this;
  4489. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4490. return smalltalk.withContext(function($ctx1) {
  4491. self._assert_equals_(_st(_st($Set())._new())._size(),(0));
  4492. self._assert_equals_(_st(_st($Set())._withAll_([(1), (2), (3), (4)]))._size(),(4));
  4493. self._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  4494. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  4495. args: [],
  4496. 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",
  4497. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  4498. referencedClasses: ["Set"]
  4499. }),
  4500. smalltalk.SetTest);
  4501. smalltalk.addMethod(
  4502. smalltalk.method({
  4503. selector: "testUnboxedObjects",
  4504. category: 'tests',
  4505. fn: function (){
  4506. var self=this;
  4507. return smalltalk.withContext(function($ctx1) {
  4508. self._assert_equals_(_st(_st(["foo"._yourself(),"foo"._yourself()])._asSet())._asArray(),["foo"]);
  4509. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  4510. args: [],
  4511. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  4512. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  4513. referencedClasses: []
  4514. }),
  4515. smalltalk.SetTest);
  4516. smalltalk.addMethod(
  4517. smalltalk.method({
  4518. selector: "testUnicity",
  4519. category: 'tests',
  4520. fn: function (){
  4521. var self=this;
  4522. var set;
  4523. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4524. return smalltalk.withContext(function($ctx1) {
  4525. set=_st($Set())._new();
  4526. _st(set)._add_((21));
  4527. _st(set)._add_("hello");
  4528. _st(set)._add_((21));
  4529. self._assert_equals_(_st(set)._size(),(2));
  4530. _st(set)._add_("hello");
  4531. self._assert_equals_(_st(set)._size(),(2));
  4532. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  4533. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  4534. args: [],
  4535. 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')",
  4536. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  4537. referencedClasses: ["Set"]
  4538. }),
  4539. smalltalk.SetTest);
  4540. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4541. smalltalk.addMethod(
  4542. smalltalk.method({
  4543. selector: "collectionClass",
  4544. category: 'accessing',
  4545. fn: function (){
  4546. var self=this;
  4547. return smalltalk.withContext(function($ctx1) {
  4548. var $1;
  4549. $1=_st(self._class())._collectionClass();
  4550. return $1;
  4551. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  4552. args: [],
  4553. source: "collectionClass\x0a\x09^ self class collectionClass",
  4554. messageSends: ["collectionClass", "class"],
  4555. referencedClasses: []
  4556. }),
  4557. smalltalk.StreamTest);
  4558. smalltalk.addMethod(
  4559. smalltalk.method({
  4560. selector: "newCollection",
  4561. category: 'accessing',
  4562. fn: function (){
  4563. var self=this;
  4564. return smalltalk.withContext(function($ctx1) {
  4565. var $1;
  4566. $1=_st(self._collectionClass())._new();
  4567. return $1;
  4568. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  4569. args: [],
  4570. source: "newCollection\x0a\x09^ self collectionClass new",
  4571. messageSends: ["new", "collectionClass"],
  4572. referencedClasses: []
  4573. }),
  4574. smalltalk.StreamTest);
  4575. smalltalk.addMethod(
  4576. smalltalk.method({
  4577. selector: "newStream",
  4578. category: 'accessing',
  4579. fn: function (){
  4580. var self=this;
  4581. return smalltalk.withContext(function($ctx1) {
  4582. var $1;
  4583. $1=_st(_st(self._collectionClass())._new())._stream();
  4584. return $1;
  4585. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  4586. args: [],
  4587. source: "newStream\x0a\x09^ self collectionClass new stream",
  4588. messageSends: ["stream", "new", "collectionClass"],
  4589. referencedClasses: []
  4590. }),
  4591. smalltalk.StreamTest);
  4592. smalltalk.addMethod(
  4593. smalltalk.method({
  4594. selector: "testAtStartAtEnd",
  4595. category: 'tests',
  4596. fn: function (){
  4597. var self=this;
  4598. var stream;
  4599. return smalltalk.withContext(function($ctx1) {
  4600. stream=self._newStream();
  4601. self._assert_(_st(stream)._atStart());
  4602. self._assert_(_st(stream)._atEnd());
  4603. _st(stream)._nextPutAll_(self._newCollection());
  4604. self._assert_(_st(stream)._atEnd());
  4605. self._deny_(_st(stream)._atStart());
  4606. _st(stream)._position_((1));
  4607. self._deny_(_st(stream)._atEnd());
  4608. self._deny_(_st(stream)._atStart());
  4609. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  4610. args: [],
  4611. 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",
  4612. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  4613. referencedClasses: []
  4614. }),
  4615. smalltalk.StreamTest);
  4616. smalltalk.addMethod(
  4617. smalltalk.method({
  4618. selector: "testContents",
  4619. category: 'tests',
  4620. fn: function (){
  4621. var self=this;
  4622. var stream;
  4623. return smalltalk.withContext(function($ctx1) {
  4624. stream=self._newStream();
  4625. _st(stream)._nextPutAll_(self._newCollection());
  4626. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  4627. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  4628. args: [],
  4629. 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",
  4630. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  4631. referencedClasses: []
  4632. }),
  4633. smalltalk.StreamTest);
  4634. smalltalk.addMethod(
  4635. smalltalk.method({
  4636. selector: "testIsEmpty",
  4637. category: 'tests',
  4638. fn: function (){
  4639. var self=this;
  4640. var stream;
  4641. return smalltalk.withContext(function($ctx1) {
  4642. stream=self._newStream();
  4643. self._assert_(_st(stream)._isEmpty());
  4644. _st(stream)._nextPutAll_(self._newCollection());
  4645. self._deny_(_st(stream)._isEmpty());
  4646. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  4647. args: [],
  4648. 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",
  4649. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  4650. referencedClasses: []
  4651. }),
  4652. smalltalk.StreamTest);
  4653. smalltalk.addMethod(
  4654. smalltalk.method({
  4655. selector: "testPosition",
  4656. category: 'tests',
  4657. fn: function (){
  4658. var self=this;
  4659. var collection,stream;
  4660. return smalltalk.withContext(function($ctx1) {
  4661. collection=self._newCollection();
  4662. stream=self._newStream();
  4663. _st(stream)._nextPutAll_(collection);
  4664. self._assert_equals_(_st(stream)._position(),_st(collection)._size());
  4665. _st(stream)._position_((0));
  4666. self._assert_equals_(_st(stream)._position(),(0));
  4667. _st(stream)._next();
  4668. self._assert_equals_(_st(stream)._position(),(1));
  4669. _st(stream)._next();
  4670. self._assert_equals_(_st(stream)._position(),(2));
  4671. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  4672. args: [],
  4673. 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",
  4674. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  4675. referencedClasses: []
  4676. }),
  4677. smalltalk.StreamTest);
  4678. smalltalk.addMethod(
  4679. smalltalk.method({
  4680. selector: "testReading",
  4681. category: 'tests',
  4682. fn: function (){
  4683. var self=this;
  4684. var stream,collection;
  4685. return smalltalk.withContext(function($ctx1) {
  4686. var $1,$2;
  4687. collection=self._newCollection();
  4688. stream=self._newStream();
  4689. $1=stream;
  4690. _st($1)._nextPutAll_(collection);
  4691. $2=_st($1)._position_((0));
  4692. _st(collection)._do_((function(each){
  4693. return smalltalk.withContext(function($ctx2) {
  4694. return self._assert_equals_(_st(stream)._next(),each);
  4695. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  4696. self._assert_(_st(_st(stream)._next())._isNil());
  4697. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  4698. args: [],
  4699. 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",
  4700. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  4701. referencedClasses: []
  4702. }),
  4703. smalltalk.StreamTest);
  4704. smalltalk.addMethod(
  4705. smalltalk.method({
  4706. selector: "testStreamContents",
  4707. category: 'tests',
  4708. fn: function (){
  4709. var self=this;
  4710. return smalltalk.withContext(function($ctx1) {
  4711. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  4712. args: [],
  4713. source: "testStreamContents",
  4714. messageSends: [],
  4715. referencedClasses: []
  4716. }),
  4717. smalltalk.StreamTest);
  4718. smalltalk.addMethod(
  4719. smalltalk.method({
  4720. selector: "testWrite",
  4721. category: 'tests',
  4722. fn: function (){
  4723. var self=this;
  4724. var stream,collection;
  4725. return smalltalk.withContext(function($ctx1) {
  4726. collection=self._newCollection();
  4727. stream=self._newStream();
  4728. _st(collection)._do_((function(each){
  4729. return smalltalk.withContext(function($ctx2) {
  4730. return _st(stream).__lt_lt(each);
  4731. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  4732. self._assert_equals_(_st(stream)._contents(),collection);
  4733. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  4734. args: [],
  4735. 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",
  4736. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  4737. referencedClasses: []
  4738. }),
  4739. smalltalk.StreamTest);
  4740. smalltalk.addMethod(
  4741. smalltalk.method({
  4742. selector: "testWriting",
  4743. category: 'tests',
  4744. fn: function (){
  4745. var self=this;
  4746. var stream,collection;
  4747. return smalltalk.withContext(function($ctx1) {
  4748. collection=self._newCollection();
  4749. stream=self._newStream();
  4750. _st(collection)._do_((function(each){
  4751. return smalltalk.withContext(function($ctx2) {
  4752. return _st(stream)._nextPut_(each);
  4753. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  4754. self._assert_equals_(_st(stream)._contents(),collection);
  4755. stream=self._newStream();
  4756. _st(stream)._nextPutAll_(collection);
  4757. self._assert_equals_(_st(stream)._contents(),collection);
  4758. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  4759. args: [],
  4760. 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",
  4761. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  4762. referencedClasses: []
  4763. }),
  4764. smalltalk.StreamTest);
  4765. smalltalk.addMethod(
  4766. smalltalk.method({
  4767. selector: "collectionClass",
  4768. category: 'accessing',
  4769. fn: function (){
  4770. var self=this;
  4771. return smalltalk.withContext(function($ctx1) {
  4772. return nil;
  4773. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  4774. args: [],
  4775. source: "collectionClass\x0a\x09^ nil",
  4776. messageSends: [],
  4777. referencedClasses: []
  4778. }),
  4779. smalltalk.StreamTest.klass);
  4780. smalltalk.addMethod(
  4781. smalltalk.method({
  4782. selector: "isAbstract",
  4783. category: 'testing',
  4784. fn: function (){
  4785. var self=this;
  4786. return smalltalk.withContext(function($ctx1) {
  4787. var $1;
  4788. $1=_st(self._collectionClass())._isNil();
  4789. return $1;
  4790. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  4791. args: [],
  4792. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  4793. messageSends: ["isNil", "collectionClass"],
  4794. referencedClasses: []
  4795. }),
  4796. smalltalk.StreamTest.klass);
  4797. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  4798. smalltalk.addMethod(
  4799. smalltalk.method({
  4800. selector: "newCollection",
  4801. category: 'accessing',
  4802. fn: function (){
  4803. var self=this;
  4804. return smalltalk.withContext(function($ctx1) {
  4805. var $1;
  4806. $1=[true,(1),(3).__at((4)),"foo"];
  4807. return $1;
  4808. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  4809. args: [],
  4810. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  4811. messageSends: ["@"],
  4812. referencedClasses: []
  4813. }),
  4814. smalltalk.ArrayStreamTest);
  4815. smalltalk.addMethod(
  4816. smalltalk.method({
  4817. selector: "collectionClass",
  4818. category: 'accessing',
  4819. fn: function (){
  4820. var self=this;
  4821. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4822. return smalltalk.withContext(function($ctx1) {
  4823. var $1;
  4824. $1=$Array();
  4825. return $1;
  4826. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  4827. args: [],
  4828. source: "collectionClass\x0a\x09^ Array",
  4829. messageSends: [],
  4830. referencedClasses: ["Array"]
  4831. }),
  4832. smalltalk.ArrayStreamTest.klass);
  4833. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  4834. smalltalk.addMethod(
  4835. smalltalk.method({
  4836. selector: "newCollection",
  4837. category: 'accessing',
  4838. fn: function (){
  4839. var self=this;
  4840. return smalltalk.withContext(function($ctx1) {
  4841. return "hello world";
  4842. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  4843. args: [],
  4844. source: "newCollection\x0a\x09^ 'hello world'",
  4845. messageSends: [],
  4846. referencedClasses: []
  4847. }),
  4848. smalltalk.StringStreamTest);
  4849. smalltalk.addMethod(
  4850. smalltalk.method({
  4851. selector: "collectionClass",
  4852. category: 'accessing',
  4853. fn: function (){
  4854. var self=this;
  4855. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4856. return smalltalk.withContext(function($ctx1) {
  4857. var $1;
  4858. $1=$String();
  4859. return $1;
  4860. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  4861. args: [],
  4862. source: "collectionClass\x0a\x09^ String",
  4863. messageSends: [],
  4864. referencedClasses: ["String"]
  4865. }),
  4866. smalltalk.StringStreamTest.klass);
  4867. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4868. smalltalk.addMethod(
  4869. smalltalk.method({
  4870. selector: "testCopying",
  4871. category: 'tests',
  4872. fn: function (){
  4873. var self=this;
  4874. return smalltalk.withContext(function($ctx1) {
  4875. self._assert_equals_(nil._copy(),nil);
  4876. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  4877. args: [],
  4878. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  4879. messageSends: ["assert:equals:", "copy"],
  4880. referencedClasses: []
  4881. }),
  4882. smalltalk.UndefinedTest);
  4883. smalltalk.addMethod(
  4884. smalltalk.method({
  4885. selector: "testDeepCopy",
  4886. category: 'tests',
  4887. fn: function (){
  4888. var self=this;
  4889. return smalltalk.withContext(function($ctx1) {
  4890. self._assert_(_st(nil._deepCopy()).__eq(nil));
  4891. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  4892. args: [],
  4893. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  4894. messageSends: ["assert:", "=", "deepCopy"],
  4895. referencedClasses: []
  4896. }),
  4897. smalltalk.UndefinedTest);
  4898. smalltalk.addMethod(
  4899. smalltalk.method({
  4900. selector: "testIfNil",
  4901. category: 'tests',
  4902. fn: function (){
  4903. var self=this;
  4904. return smalltalk.withContext(function($ctx1) {
  4905. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9;
  4906. $1=self;
  4907. if(($receiver = nil) == nil || $receiver == undefined){
  4908. $2=true;
  4909. } else {
  4910. $2=nil;
  4911. };
  4912. _st($1)._assert_equals_($2,true);
  4913. $3=self;
  4914. if(($receiver = nil) == nil || $receiver == undefined){
  4915. $5=nil;
  4916. } else {
  4917. $5=true;
  4918. };
  4919. $4=_st($5).__eq(true);
  4920. _st($3)._deny_($4);
  4921. $6=self;
  4922. if(($receiver = nil) == nil || $receiver == undefined){
  4923. $7=true;
  4924. } else {
  4925. $7=false;
  4926. };
  4927. _st($6)._assert_equals_($7,true);
  4928. $8=self;
  4929. if(($receiver = nil) == nil || $receiver == undefined){
  4930. $10=false;
  4931. } else {
  4932. $10=true;
  4933. };
  4934. $9=_st($10).__eq(true);
  4935. _st($8)._deny_($9);
  4936. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  4937. args: [],
  4938. 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",
  4939. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  4940. referencedClasses: []
  4941. }),
  4942. smalltalk.UndefinedTest);
  4943. smalltalk.addMethod(
  4944. smalltalk.method({
  4945. selector: "testIsNil",
  4946. category: 'tests',
  4947. fn: function (){
  4948. var self=this;
  4949. return smalltalk.withContext(function($ctx1) {
  4950. self._assert_(nil._isNil());
  4951. self._deny_(nil._notNil());
  4952. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  4953. args: [],
  4954. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  4955. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  4956. referencedClasses: []
  4957. }),
  4958. smalltalk.UndefinedTest);
  4959. })(global_smalltalk,global_nil,global__st);