2
0

Kernel-Tests.js 218 KB

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