Kernel-Tests.js 198 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738
  1. define("amber/Kernel-Tests", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber"};
  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: "testAt",
  2087. category: 'tests',
  2088. fn: function (){
  2089. var self=this;
  2090. return smalltalk.withContext(function($ctx1) {
  2091. self._assert_equals_("hello"._at_((1)),"h");
  2092. self._assert_equals_("hello"._at_((5)),"o");
  2093. self._assert_equals_("hello"._at_ifAbsent_((6),(function(){
  2094. return smalltalk.withContext(function($ctx2) {
  2095. return nil;
  2096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2097. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.StringTest)})},
  2098. args: [],
  2099. 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",
  2100. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2101. referencedClasses: []
  2102. }),
  2103. smalltalk.StringTest);
  2104. smalltalk.addMethod(
  2105. smalltalk.method({
  2106. selector: "testAtPut",
  2107. category: 'tests',
  2108. fn: function (){
  2109. var self=this;
  2110. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2111. return smalltalk.withContext(function($ctx1) {
  2112. self._should_raise_((function(){
  2113. return smalltalk.withContext(function($ctx2) {
  2114. return "hello"._at_put_((1),"a");
  2115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2116. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  2117. args: [],
  2118. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  2119. messageSends: ["should:raise:", "at:put:"],
  2120. referencedClasses: ["Error"]
  2121. }),
  2122. smalltalk.StringTest);
  2123. smalltalk.addMethod(
  2124. smalltalk.method({
  2125. selector: "testCollect",
  2126. category: 'tests',
  2127. fn: function (){
  2128. var self=this;
  2129. var newCollection;
  2130. return smalltalk.withContext(function($ctx1) {
  2131. newCollection="hheelllloo";
  2132. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  2133. return smalltalk.withContext(function($ctx2) {
  2134. return _st(each).__comma(each);
  2135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  2136. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  2137. args: [],
  2138. 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",
  2139. messageSends: ["assertSameContents:as:", "collect:", ",", "collection"],
  2140. referencedClasses: []
  2141. }),
  2142. smalltalk.StringTest);
  2143. smalltalk.addMethod(
  2144. smalltalk.method({
  2145. selector: "testCopyWithoutAll",
  2146. category: 'tests',
  2147. fn: function (){
  2148. var self=this;
  2149. return smalltalk.withContext(function($ctx1) {
  2150. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  2151. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  2152. args: [],
  2153. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  2154. messageSends: ["assert:equals:", "copyWithoutAll:"],
  2155. referencedClasses: []
  2156. }),
  2157. smalltalk.StringTest);
  2158. smalltalk.addMethod(
  2159. smalltalk.method({
  2160. selector: "testDetect",
  2161. category: 'tests',
  2162. fn: function (){
  2163. var self=this;
  2164. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2165. return smalltalk.withContext(function($ctx1) {
  2166. self._assert_equals_(_st(self._collection())._detect_((function(each){
  2167. return smalltalk.withContext(function($ctx2) {
  2168. return _st(each).__eq("h");
  2169. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),"h");
  2170. self._should_raise_((function(){
  2171. return smalltalk.withContext(function($ctx2) {
  2172. return _st(self._collection())._detect_((function(each){
  2173. return smalltalk.withContext(function($ctx3) {
  2174. return _st(each).__eq((6));
  2175. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  2176. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2177. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  2178. args: [],
  2179. 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",
  2180. messageSends: ["assert:equals:", "detect:", "=", "collection", "should:raise:"],
  2181. referencedClasses: ["Error"]
  2182. }),
  2183. smalltalk.StringTest);
  2184. smalltalk.addMethod(
  2185. smalltalk.method({
  2186. selector: "testEquality",
  2187. category: 'tests',
  2188. fn: function (){
  2189. var self=this;
  2190. return smalltalk.withContext(function($ctx1) {
  2191. self._assert_equals_("hello","hello");
  2192. self._deny_("hello".__eq("world"));
  2193. self._deny_("hello".__eq([]._at_ifAbsent_((1),(function(){
  2194. return smalltalk.withContext(function($ctx2) {
  2195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))));
  2196. self._assert_equals_("hello","hello"._yourself());
  2197. self._assert_equals_("hello"._yourself(),"hello");
  2198. self._deny_("".__eq((0)));
  2199. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  2200. args: [],
  2201. 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",
  2202. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  2203. referencedClasses: []
  2204. }),
  2205. smalltalk.StringTest);
  2206. smalltalk.addMethod(
  2207. smalltalk.method({
  2208. selector: "testIdentity",
  2209. category: 'tests',
  2210. fn: function (){
  2211. var self=this;
  2212. return smalltalk.withContext(function($ctx1) {
  2213. self._assert_("hello".__eq_eq("hello"));
  2214. self._deny_("hello".__eq_eq("world"));
  2215. self._assert_("hello".__eq_eq("hello"._yourself()));
  2216. self._assert_(_st("hello"._yourself()).__eq_eq("hello"));
  2217. self._deny_("".__eq_eq((0)));
  2218. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  2219. args: [],
  2220. 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",
  2221. messageSends: ["assert:", "==", "deny:", "yourself"],
  2222. referencedClasses: []
  2223. }),
  2224. smalltalk.StringTest);
  2225. smalltalk.addMethod(
  2226. smalltalk.method({
  2227. selector: "testIncludesSubString",
  2228. category: 'tests',
  2229. fn: function (){
  2230. var self=this;
  2231. return smalltalk.withContext(function($ctx1) {
  2232. self._assert_("amber"._includesSubString_("ber"));
  2233. self._deny_("amber"._includesSubString_("zork"));
  2234. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  2235. args: [],
  2236. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  2237. messageSends: ["assert:", "includesSubString:", "deny:"],
  2238. referencedClasses: []
  2239. }),
  2240. smalltalk.StringTest);
  2241. smalltalk.addMethod(
  2242. smalltalk.method({
  2243. selector: "testIndexOf",
  2244. category: 'tests',
  2245. fn: function (){
  2246. var self=this;
  2247. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2248. return smalltalk.withContext(function($ctx1) {
  2249. self._assert_equals_(_st(self._collection())._indexOf_("e"),(2));
  2250. self._should_raise_((function(){
  2251. return smalltalk.withContext(function($ctx2) {
  2252. return _st(self._collection())._indexOf_((999));
  2253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2254. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  2255. return smalltalk.withContext(function($ctx2) {
  2256. return "sentinel";
  2257. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  2258. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.StringTest)})},
  2259. args: [],
  2260. 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'",
  2261. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  2262. referencedClasses: ["Error"]
  2263. }),
  2264. smalltalk.StringTest);
  2265. smalltalk.addMethod(
  2266. smalltalk.method({
  2267. selector: "testJoin",
  2268. category: 'tests',
  2269. fn: function (){
  2270. var self=this;
  2271. return smalltalk.withContext(function($ctx1) {
  2272. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  2273. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  2274. args: [],
  2275. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  2276. messageSends: ["assert:equals:", "join:"],
  2277. referencedClasses: []
  2278. }),
  2279. smalltalk.StringTest);
  2280. smalltalk.addMethod(
  2281. smalltalk.method({
  2282. selector: "testSelect",
  2283. category: 'tests',
  2284. fn: function (){
  2285. var self=this;
  2286. var newCollection;
  2287. return smalltalk.withContext(function($ctx1) {
  2288. newCollection="o";
  2289. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  2290. return smalltalk.withContext(function($ctx2) {
  2291. return _st(each).__eq("o");
  2292. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  2293. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  2294. args: [],
  2295. 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",
  2296. messageSends: ["assertSameContents:as:", "select:", "=", "collection"],
  2297. referencedClasses: []
  2298. }),
  2299. smalltalk.StringTest);
  2300. smalltalk.addMethod(
  2301. smalltalk.method({
  2302. selector: "testSize",
  2303. category: 'tests',
  2304. fn: function (){
  2305. var self=this;
  2306. return smalltalk.withContext(function($ctx1) {
  2307. self._assert_equals_("smalltalk"._size(),(9));
  2308. self._assert_equals_(""._size(),(0));
  2309. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  2310. args: [],
  2311. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  2312. messageSends: ["assert:equals:", "size"],
  2313. referencedClasses: []
  2314. }),
  2315. smalltalk.StringTest);
  2316. smalltalk.addMethod(
  2317. smalltalk.method({
  2318. selector: "testStreamContents",
  2319. category: 'tests',
  2320. fn: function (){
  2321. var self=this;
  2322. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  2323. return smalltalk.withContext(function($ctx1) {
  2324. var $1,$2;
  2325. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  2326. return smalltalk.withContext(function($ctx2) {
  2327. $1=aStream;
  2328. _st($1)._nextPutAll_("hello");
  2329. _st($1)._space();
  2330. $2=_st($1)._nextPutAll_("world");
  2331. return $2;
  2332. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})})),"hello world");
  2333. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  2334. args: [],
  2335. 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'",
  2336. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  2337. referencedClasses: ["String"]
  2338. }),
  2339. smalltalk.StringTest);
  2340. smalltalk.addMethod(
  2341. smalltalk.method({
  2342. selector: "collectionClass",
  2343. category: 'accessing',
  2344. fn: function (){
  2345. var self=this;
  2346. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  2347. return smalltalk.withContext(function($ctx1) {
  2348. var $1;
  2349. $1=$String();
  2350. return $1;
  2351. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  2352. args: [],
  2353. source: "collectionClass\x0a\x09^ String",
  2354. messageSends: [],
  2355. referencedClasses: ["String"]
  2356. }),
  2357. smalltalk.StringTest.klass);
  2358. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2359. smalltalk.addMethod(
  2360. smalltalk.method({
  2361. selector: "testShow",
  2362. category: 'tests',
  2363. fn: function (){
  2364. var self=this;
  2365. var originalTranscript;
  2366. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  2367. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  2368. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2369. return smalltalk.withContext(function($ctx1) {
  2370. originalTranscript=_st($Transcript())._current();
  2371. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  2372. self._shouldnt_raise_((function(){
  2373. return smalltalk.withContext(function($ctx2) {
  2374. return _st($Transcript())._show_("Hello console!");
  2375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2376. self._shouldnt_raise_((function(){
  2377. return smalltalk.withContext(function($ctx2) {
  2378. return _st($Transcript())._show_(console);
  2379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2380. _st($Transcript())._register_(originalTranscript);
  2381. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  2382. args: [],
  2383. 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.",
  2384. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  2385. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  2386. }),
  2387. smalltalk.ConsoleTranscriptTest);
  2388. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2389. smalltalk.addMethod(
  2390. smalltalk.method({
  2391. selector: "jsObject",
  2392. category: 'accessing',
  2393. fn: function (){
  2394. var self=this;
  2395. return smalltalk.withContext(function($ctx1) {
  2396. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined};
  2397. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  2398. args: [],
  2399. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined}>",
  2400. messageSends: [],
  2401. referencedClasses: []
  2402. }),
  2403. smalltalk.JSObjectProxyTest);
  2404. smalltalk.addMethod(
  2405. smalltalk.method({
  2406. selector: "testAtIfAbsent",
  2407. category: 'tests',
  2408. fn: function (){
  2409. var self=this;
  2410. var testObject;
  2411. return smalltalk.withContext(function($ctx1) {
  2412. testObject=self._jsObject();
  2413. self._assert_equals_(_st(testObject)._at_ifAbsent_("abc",(function(){
  2414. return smalltalk.withContext(function($ctx2) {
  2415. return "Property does not exist";
  2416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"Property does not exist");
  2417. self._assert_equals_(_st(testObject)._at_ifAbsent_("e",(function(){
  2418. return smalltalk.withContext(function($ctx2) {
  2419. return "Property does not exist";
  2420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2421. self._assert_equals_(_st(testObject)._at_ifAbsent_("a",(function(){
  2422. return smalltalk.withContext(function($ctx2) {
  2423. return "Property does not exist";
  2424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(1));
  2425. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  2426. return smalltalk.withContext(function($ctx2) {
  2427. return "Property does not exist";
  2428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2429. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2430. args: [],
  2431. 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.",
  2432. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  2433. referencedClasses: []
  2434. }),
  2435. smalltalk.JSObjectProxyTest);
  2436. smalltalk.addMethod(
  2437. smalltalk.method({
  2438. selector: "testAtIfPresent",
  2439. category: 'tests',
  2440. fn: function (){
  2441. var self=this;
  2442. var testObject;
  2443. return smalltalk.withContext(function($ctx1) {
  2444. testObject=self._jsObject();
  2445. self._assert_equals_(_st(testObject)._at_ifPresent_("abc",(function(x){
  2446. return smalltalk.withContext(function($ctx2) {
  2447. return "hello ".__comma(_st(x)._asString());
  2448. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),nil);
  2449. self._assert_equals_(_st(testObject)._at_ifPresent_("e",(function(x){
  2450. return smalltalk.withContext(function($ctx2) {
  2451. return "hello ".__comma(_st(x)._asString());
  2452. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello nil");
  2453. self._assert_equals_(_st(testObject)._at_ifPresent_("a",(function(x){
  2454. return smalltalk.withContext(function($ctx2) {
  2455. return "hello ".__comma(_st(x)._asString());
  2456. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello 1");
  2457. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  2458. return smalltalk.withContext(function($ctx2) {
  2459. return "hello ".__comma(_st(x)._asString());
  2460. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello nil");
  2461. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2462. args: [],
  2463. 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'.",
  2464. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  2465. referencedClasses: []
  2466. }),
  2467. smalltalk.JSObjectProxyTest);
  2468. smalltalk.addMethod(
  2469. smalltalk.method({
  2470. selector: "testAtIfPresentIfAbsent",
  2471. category: 'tests',
  2472. fn: function (){
  2473. var self=this;
  2474. var testObject;
  2475. return smalltalk.withContext(function($ctx1) {
  2476. testObject=self._jsObject();
  2477. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  2478. return smalltalk.withContext(function($ctx2) {
  2479. return "hello ".__comma(_st(x)._asString());
  2480. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  2481. return smalltalk.withContext(function($ctx2) {
  2482. return "not present";
  2483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not present");
  2484. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  2485. return smalltalk.withContext(function($ctx2) {
  2486. return "hello ".__comma(_st(x)._asString());
  2487. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  2488. return smalltalk.withContext(function($ctx2) {
  2489. return "not present";
  2490. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello nil");
  2491. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  2492. return smalltalk.withContext(function($ctx2) {
  2493. return "hello ".__comma(_st(x)._asString());
  2494. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  2495. return smalltalk.withContext(function($ctx2) {
  2496. return "not present";
  2497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello 1");
  2498. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  2499. return smalltalk.withContext(function($ctx2) {
  2500. return "hello ".__comma(_st(x)._asString());
  2501. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  2502. return smalltalk.withContext(function($ctx2) {
  2503. return "not present";
  2504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello nil");
  2505. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2506. args: [],
  2507. 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'.",
  2508. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  2509. referencedClasses: []
  2510. }),
  2511. smalltalk.JSObjectProxyTest);
  2512. smalltalk.addMethod(
  2513. smalltalk.method({
  2514. selector: "testDNU",
  2515. category: 'tests',
  2516. fn: function (){
  2517. var self=this;
  2518. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2519. return smalltalk.withContext(function($ctx1) {
  2520. self._should_raise_((function(){
  2521. return smalltalk.withContext(function($ctx2) {
  2522. return _st(self._jsObject())._foo();
  2523. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2524. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  2525. args: [],
  2526. source: "testDNU\x0a\x09self should: [self jsObject foo] raise: MessageNotUnderstood",
  2527. messageSends: ["should:raise:", "foo", "jsObject"],
  2528. referencedClasses: ["MessageNotUnderstood"]
  2529. }),
  2530. smalltalk.JSObjectProxyTest);
  2531. smalltalk.addMethod(
  2532. smalltalk.method({
  2533. selector: "testMessageSend",
  2534. category: 'tests',
  2535. fn: function (){
  2536. var self=this;
  2537. return smalltalk.withContext(function($ctx1) {
  2538. self._assert_equals_(_st(self._jsObject())._a(),(1));
  2539. self._assert_equals_(_st(self._jsObject())._b(),(2));
  2540. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  2541. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  2542. args: [],
  2543. 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",
  2544. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  2545. referencedClasses: []
  2546. }),
  2547. smalltalk.JSObjectProxyTest);
  2548. smalltalk.addMethod(
  2549. smalltalk.method({
  2550. selector: "testMethodWithArguments",
  2551. category: 'tests',
  2552. fn: function (){
  2553. var self=this;
  2554. return smalltalk.withContext(function($ctx1) {
  2555. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  2556. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  2557. args: [],
  2558. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  2559. messageSends: ["assert:equals:", "c:", "jsObject"],
  2560. referencedClasses: []
  2561. }),
  2562. smalltalk.JSObjectProxyTest);
  2563. smalltalk.addMethod(
  2564. smalltalk.method({
  2565. selector: "testPrinting",
  2566. category: 'tests',
  2567. fn: function (){
  2568. var self=this;
  2569. return smalltalk.withContext(function($ctx1) {
  2570. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  2571. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  2572. args: [],
  2573. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  2574. messageSends: ["assert:equals:", "printString", "jsObject"],
  2575. referencedClasses: []
  2576. }),
  2577. smalltalk.JSObjectProxyTest);
  2578. smalltalk.addMethod(
  2579. smalltalk.method({
  2580. selector: "testPropertyThatReturnsEmptyString",
  2581. category: 'tests',
  2582. fn: function (){
  2583. var self=this;
  2584. var object;
  2585. return smalltalk.withContext(function($ctx1) {
  2586. object=self._jsObject();
  2587. self._assert_equals_(_st(object)._d(),"");
  2588. _st(object)._d_("hello");
  2589. self._assert_equals_(_st(object)._d(),"hello");
  2590. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  2591. args: [],
  2592. 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'",
  2593. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  2594. referencedClasses: []
  2595. }),
  2596. smalltalk.JSObjectProxyTest);
  2597. smalltalk.addMethod(
  2598. smalltalk.method({
  2599. selector: "testPropertyThatReturnsUndefined",
  2600. category: 'tests',
  2601. fn: function (){
  2602. var self=this;
  2603. var object;
  2604. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2605. return smalltalk.withContext(function($ctx1) {
  2606. object=self._jsObject();
  2607. self._shouldnt_raise_((function(){
  2608. return smalltalk.withContext(function($ctx2) {
  2609. return _st(object)._e();
  2610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2611. self._assert_(_st(_st(object)._e())._isNil());
  2612. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  2613. args: [],
  2614. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  2615. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  2616. referencedClasses: ["MessageNotUnderstood"]
  2617. }),
  2618. smalltalk.JSObjectProxyTest);
  2619. smalltalk.addMethod(
  2620. smalltalk.method({
  2621. selector: "testValue",
  2622. category: 'tests',
  2623. fn: function (){
  2624. var self=this;
  2625. var testObject;
  2626. return smalltalk.withContext(function($ctx1) {
  2627. testObject=self._jsObject();
  2628. self._assert_equals_(_st(_st(testObject)._value())._printString(),"[object Object]");
  2629. _st(testObject)._at_put_("value","aValue");
  2630. self._assert_equals_(_st(testObject)._value(),"aValue");
  2631. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2632. args: [],
  2633. 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'",
  2634. messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"],
  2635. referencedClasses: []
  2636. }),
  2637. smalltalk.JSObjectProxyTest);
  2638. smalltalk.addMethod(
  2639. smalltalk.method({
  2640. selector: "testYourself",
  2641. category: 'tests',
  2642. fn: function (){
  2643. var self=this;
  2644. var object;
  2645. return smalltalk.withContext(function($ctx1) {
  2646. var $1,$2;
  2647. $1=self._jsObject();
  2648. _st($1)._d_("test");
  2649. $2=_st($1)._yourself();
  2650. object=$2;
  2651. self._assert_equals_(_st(object)._d(),"test");
  2652. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  2653. args: [],
  2654. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  2655. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  2656. referencedClasses: []
  2657. }),
  2658. smalltalk.JSObjectProxyTest);
  2659. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2660. smalltalk.addMethod(
  2661. smalltalk.method({
  2662. selector: "testCatchingException",
  2663. category: 'tests',
  2664. fn: function (){
  2665. var self=this;
  2666. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2667. return smalltalk.withContext(function($ctx1) {
  2668. _st((function(){
  2669. return smalltalk.withContext(function($ctx2) {
  2670. return self._throwException();
  2671. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(error){
  2672. return smalltalk.withContext(function($ctx2) {
  2673. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  2674. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  2675. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  2676. args: [],
  2677. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  2678. messageSends: ["on:do:", "assert:", "=", "exception", "throwException"],
  2679. referencedClasses: ["Error"]
  2680. }),
  2681. smalltalk.JavaScriptExceptionTest);
  2682. smalltalk.addMethod(
  2683. smalltalk.method({
  2684. selector: "testRaisingException",
  2685. category: 'tests',
  2686. fn: function (){
  2687. var self=this;
  2688. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  2689. return smalltalk.withContext(function($ctx1) {
  2690. self._should_raise_((function(){
  2691. return smalltalk.withContext(function($ctx2) {
  2692. return self._throwException();
  2693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$JavaScriptException());
  2694. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  2695. args: [],
  2696. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  2697. messageSends: ["should:raise:", "throwException"],
  2698. referencedClasses: ["JavaScriptException"]
  2699. }),
  2700. smalltalk.JavaScriptExceptionTest);
  2701. smalltalk.addMethod(
  2702. smalltalk.method({
  2703. selector: "throwException",
  2704. category: 'helpers',
  2705. fn: function (){
  2706. var self=this;
  2707. return smalltalk.withContext(function($ctx1) {
  2708. throw 'test';
  2709. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  2710. args: [],
  2711. source: "throwException\x0a\x09<throw 'test'>",
  2712. messageSends: [],
  2713. referencedClasses: []
  2714. }),
  2715. smalltalk.JavaScriptExceptionTest);
  2716. smalltalk.addClass('LegacyPackageHandlerTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  2717. smalltalk.addMethod(
  2718. smalltalk.method({
  2719. selector: "setUp",
  2720. category: 'running',
  2721. fn: function (){
  2722. var self=this;
  2723. function $LegacyPackageHandler(){return smalltalk.LegacyPackageHandler||(typeof LegacyPackageHandler=="undefined"?nil:LegacyPackageHandler)}
  2724. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  2725. return smalltalk.withContext(function($ctx1) {
  2726. var $1,$2;
  2727. self["@backUpCommitPathJs"]=_st($LegacyPackageHandler())._defaultCommitPathJs();
  2728. self["@backUpCommitPathSt"]=_st($LegacyPackageHandler())._defaultCommitPathSt();
  2729. _st($LegacyPackageHandler())._resetCommitPaths();
  2730. self["@zorkPackage"]=_st(_st($Package())._new())._name_("Zork");
  2731. $1=_st($Package())._new();
  2732. _st($1)._name_("Grul");
  2733. _st($1)._commitPathJs_("server/grul/js");
  2734. _st($1)._commitPathSt_("grul/st");
  2735. $2=_st($1)._yourself();
  2736. self["@grulPackage"]=$2;
  2737. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.LegacyPackageHandlerTest)})},
  2738. args: [],
  2739. 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",
  2740. messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"],
  2741. referencedClasses: ["LegacyPackageHandler", "Package"]
  2742. }),
  2743. smalltalk.LegacyPackageHandlerTest);
  2744. smalltalk.addMethod(
  2745. smalltalk.method({
  2746. selector: "tearDown",
  2747. category: 'running',
  2748. fn: function (){
  2749. var self=this;
  2750. function $LegacyPackageHandler(){return smalltalk.LegacyPackageHandler||(typeof LegacyPackageHandler=="undefined"?nil:LegacyPackageHandler)}
  2751. return smalltalk.withContext(function($ctx1) {
  2752. var $1,$2;
  2753. $1=$LegacyPackageHandler();
  2754. _st($1)._defaultCommitPathJs_(self["@backUpCommitPathJs"]);
  2755. $2=_st($1)._defaultCommitPathSt_(self["@backUpCommitPathSt"]);
  2756. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.LegacyPackageHandlerTest)})},
  2757. args: [],
  2758. source: "tearDown\x0a\x09LegacyPackageHandler\x0a\x09\x09defaultCommitPathJs: backUpCommitPathJs;\x0a\x09\x09defaultCommitPathSt: backUpCommitPathSt",
  2759. messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"],
  2760. referencedClasses: ["LegacyPackageHandler"]
  2761. }),
  2762. smalltalk.LegacyPackageHandlerTest);
  2763. smalltalk.addMethod(
  2764. smalltalk.method({
  2765. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2766. category: 'tests',
  2767. fn: function (){
  2768. var self=this;
  2769. return smalltalk.withContext(function($ctx1) {
  2770. self._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  2771. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{},smalltalk.LegacyPackageHandlerTest)})},
  2772. args: [],
  2773. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: grulPackage commitPathJs equals: 'server/grul/js'",
  2774. messageSends: ["assert:equals:", "commitPathJs"],
  2775. referencedClasses: []
  2776. }),
  2777. smalltalk.LegacyPackageHandlerTest);
  2778. smalltalk.addMethod(
  2779. smalltalk.method({
  2780. selector: "testGrulCommitPathStShouldBeGrulSt",
  2781. category: 'tests',
  2782. fn: function (){
  2783. var self=this;
  2784. return smalltalk.withContext(function($ctx1) {
  2785. self._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  2786. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{},smalltalk.LegacyPackageHandlerTest)})},
  2787. args: [],
  2788. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: grulPackage commitPathSt equals: 'grul/st'",
  2789. messageSends: ["assert:equals:", "commitPathSt"],
  2790. referencedClasses: []
  2791. }),
  2792. smalltalk.LegacyPackageHandlerTest);
  2793. smalltalk.addMethod(
  2794. smalltalk.method({
  2795. selector: "testZorkCommitPathJsShouldBeJs",
  2796. category: 'tests',
  2797. fn: function (){
  2798. var self=this;
  2799. return smalltalk.withContext(function($ctx1) {
  2800. self._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"js");
  2801. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJs",{},smalltalk.LegacyPackageHandlerTest)})},
  2802. args: [],
  2803. source: "testZorkCommitPathJsShouldBeJs\x0a\x09self assert: zorkPackage commitPathJs equals: 'js'",
  2804. messageSends: ["assert:equals:", "commitPathJs"],
  2805. referencedClasses: []
  2806. }),
  2807. smalltalk.LegacyPackageHandlerTest);
  2808. smalltalk.addMethod(
  2809. smalltalk.method({
  2810. selector: "testZorkCommitPathStShouldBeSt",
  2811. category: 'tests',
  2812. fn: function (){
  2813. var self=this;
  2814. return smalltalk.withContext(function($ctx1) {
  2815. self._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"st");
  2816. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSt",{},smalltalk.LegacyPackageHandlerTest)})},
  2817. args: [],
  2818. source: "testZorkCommitPathStShouldBeSt\x0a\x09self assert: zorkPackage commitPathSt equals: 'st'",
  2819. messageSends: ["assert:equals:", "commitPathSt"],
  2820. referencedClasses: []
  2821. }),
  2822. smalltalk.LegacyPackageHandlerTest);
  2823. smalltalk.addClass('LegacyPackageHandlerTestWithDefaultsChanged', smalltalk.LegacyPackageHandlerTest, [], 'Kernel-Tests');
  2824. smalltalk.addMethod(
  2825. smalltalk.method({
  2826. selector: "setUp",
  2827. category: 'running',
  2828. fn: function (){
  2829. var self=this;
  2830. function $LegacyPackageHandler(){return smalltalk.LegacyPackageHandler||(typeof LegacyPackageHandler=="undefined"?nil:LegacyPackageHandler)}
  2831. return smalltalk.withContext(function($ctx1) {
  2832. var $1,$2;
  2833. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged.superclass.fn.prototype._setUp.apply(_st(self), []);
  2834. $1=$LegacyPackageHandler();
  2835. _st($1)._defaultCommitPathJs_("javascripts/");
  2836. $2=_st($1)._defaultCommitPathSt_("smalltalk/");
  2837. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2838. args: [],
  2839. source: "setUp\x0a\x09super setUp.\x0a\x0a\x09LegacyPackageHandler\x0a\x09\x09defaultCommitPathJs: 'javascripts/';\x0a\x09\x09defaultCommitPathSt: 'smalltalk/'.",
  2840. messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"],
  2841. referencedClasses: ["LegacyPackageHandler"]
  2842. }),
  2843. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2844. smalltalk.addMethod(
  2845. smalltalk.method({
  2846. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2847. category: 'tests',
  2848. fn: function (){
  2849. var self=this;
  2850. return smalltalk.withContext(function($ctx1) {
  2851. self._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  2852. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2853. args: [],
  2854. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: grulPackage commitPathJs equals: 'server/grul/js'",
  2855. messageSends: ["assert:equals:", "commitPathJs"],
  2856. referencedClasses: []
  2857. }),
  2858. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2859. smalltalk.addMethod(
  2860. smalltalk.method({
  2861. selector: "testGrulCommitPathStShouldBeGrulSt",
  2862. category: 'tests',
  2863. fn: function (){
  2864. var self=this;
  2865. return smalltalk.withContext(function($ctx1) {
  2866. self._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  2867. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2868. args: [],
  2869. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: grulPackage commitPathSt equals: 'grul/st'",
  2870. messageSends: ["assert:equals:", "commitPathSt"],
  2871. referencedClasses: []
  2872. }),
  2873. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2874. smalltalk.addMethod(
  2875. smalltalk.method({
  2876. selector: "testZorkCommitPathJsShouldBeJavascript",
  2877. category: 'tests',
  2878. fn: function (){
  2879. var self=this;
  2880. return smalltalk.withContext(function($ctx1) {
  2881. self._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"javascripts/");
  2882. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJavascript",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2883. args: [],
  2884. source: "testZorkCommitPathJsShouldBeJavascript\x0a\x09self assert: zorkPackage commitPathJs equals: 'javascripts/'",
  2885. messageSends: ["assert:equals:", "commitPathJs"],
  2886. referencedClasses: []
  2887. }),
  2888. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2889. smalltalk.addMethod(
  2890. smalltalk.method({
  2891. selector: "testZorkCommitPathStShouldBeSmalltalk",
  2892. category: 'tests',
  2893. fn: function (){
  2894. var self=this;
  2895. return smalltalk.withContext(function($ctx1) {
  2896. self._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"smalltalk/");
  2897. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSmalltalk",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2898. args: [],
  2899. source: "testZorkCommitPathStShouldBeSmalltalk\x0a\x09self assert: zorkPackage commitPathSt equals: 'smalltalk/'",
  2900. messageSends: ["assert:equals:", "commitPathSt"],
  2901. referencedClasses: []
  2902. }),
  2903. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2904. smalltalk.addMethod(
  2905. smalltalk.method({
  2906. selector: "shouldInheritSelectors",
  2907. category: 'accessing',
  2908. fn: function (){
  2909. var self=this;
  2910. return smalltalk.withContext(function($ctx1) {
  2911. return false;
  2912. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged.klass)})},
  2913. args: [],
  2914. source: "shouldInheritSelectors\x0a\x09^ false",
  2915. messageSends: [],
  2916. referencedClasses: []
  2917. }),
  2918. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged.klass);
  2919. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2920. smalltalk.addMethod(
  2921. smalltalk.method({
  2922. selector: "testValue",
  2923. category: 'tests',
  2924. fn: function (){
  2925. var self=this;
  2926. var messageSend;
  2927. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2928. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  2929. return smalltalk.withContext(function($ctx1) {
  2930. var $1,$2;
  2931. $1=_st($MessageSend())._new();
  2932. _st($1)._receiver_(_st($Object())._new());
  2933. _st($1)._selector_("asString");
  2934. $2=_st($1)._yourself();
  2935. messageSend=$2;
  2936. self._assert_equals_(_st(messageSend)._value(),"an Object");
  2937. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  2938. args: [],
  2939. 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'",
  2940. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  2941. referencedClasses: ["Object", "MessageSend"]
  2942. }),
  2943. smalltalk.MessageSendTest);
  2944. smalltalk.addMethod(
  2945. smalltalk.method({
  2946. selector: "testValueWithArguments",
  2947. category: 'tests',
  2948. fn: function (){
  2949. var self=this;
  2950. var messageSend;
  2951. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  2952. return smalltalk.withContext(function($ctx1) {
  2953. var $1,$2;
  2954. $1=_st($MessageSend())._new();
  2955. _st($1)._receiver_((2));
  2956. _st($1)._selector_("+");
  2957. $2=_st($1)._yourself();
  2958. messageSend=$2;
  2959. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  2960. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  2961. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  2962. args: [],
  2963. 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",
  2964. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  2965. referencedClasses: ["MessageSend"]
  2966. }),
  2967. smalltalk.MessageSendTest);
  2968. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2969. smalltalk.addMethod(
  2970. smalltalk.method({
  2971. selector: "testAbs",
  2972. category: 'tests',
  2973. fn: function (){
  2974. var self=this;
  2975. return smalltalk.withContext(function($ctx1) {
  2976. self._assert_equals_((4)._abs(),(4));
  2977. self._assert_equals_((-4)._abs(),(4));
  2978. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  2979. args: [],
  2980. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  2981. messageSends: ["assert:equals:", "abs"],
  2982. referencedClasses: []
  2983. }),
  2984. smalltalk.NumberTest);
  2985. smalltalk.addMethod(
  2986. smalltalk.method({
  2987. selector: "testArithmetic",
  2988. category: 'tests',
  2989. fn: function (){
  2990. var self=this;
  2991. return smalltalk.withContext(function($ctx1) {
  2992. self._assert_equals_((1.5).__plus((1)),(2.5));
  2993. self._assert_equals_((2).__minus((1)),(1));
  2994. self._assert_equals_((-2).__minus((1)),(-3));
  2995. self._assert_equals_((12).__slash((2)),(6));
  2996. self._assert_equals_((3).__star((4)),(12));
  2997. self._assert_equals_(_st((1).__plus((2))).__star((3)),(9));
  2998. self._assert_equals_((1).__plus((2).__star((3))),(7));
  2999. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  3000. args: [],
  3001. 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",
  3002. messageSends: ["assert:equals:", "+", "-", "/", "*"],
  3003. referencedClasses: []
  3004. }),
  3005. smalltalk.NumberTest);
  3006. smalltalk.addMethod(
  3007. smalltalk.method({
  3008. selector: "testComparison",
  3009. category: 'tests',
  3010. fn: function (){
  3011. var self=this;
  3012. return smalltalk.withContext(function($ctx1) {
  3013. self._assert_((3).__gt((2)));
  3014. self._assert_((2).__lt((3)));
  3015. self._deny_((3).__lt((2)));
  3016. self._deny_((2).__gt((3)));
  3017. self._assert_((3).__gt_eq((3)));
  3018. self._assert_((3.1).__gt_eq((3)));
  3019. self._assert_((3).__lt_eq((3)));
  3020. self._assert_((3).__lt_eq((3.1)));
  3021. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  3022. args: [],
  3023. 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",
  3024. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  3025. referencedClasses: []
  3026. }),
  3027. smalltalk.NumberTest);
  3028. smalltalk.addMethod(
  3029. smalltalk.method({
  3030. selector: "testCopying",
  3031. category: 'tests',
  3032. fn: function (){
  3033. var self=this;
  3034. return smalltalk.withContext(function($ctx1) {
  3035. self._assert_(_st((1)._copy()).__eq_eq((1)));
  3036. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  3037. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  3038. args: [],
  3039. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  3040. messageSends: ["assert:", "==", "copy", "deepCopy"],
  3041. referencedClasses: []
  3042. }),
  3043. smalltalk.NumberTest);
  3044. smalltalk.addMethod(
  3045. smalltalk.method({
  3046. selector: "testEquality",
  3047. category: 'tests',
  3048. fn: function (){
  3049. var self=this;
  3050. return smalltalk.withContext(function($ctx1) {
  3051. self._assert_((1).__eq((1)));
  3052. self._assert_((0).__eq((0)));
  3053. self._deny_((1).__eq((0)));
  3054. self._assert_(_st((1)._yourself()).__eq((1)));
  3055. self._assert_((1).__eq((1)._yourself()));
  3056. self._assert_(_st((1)._yourself()).__eq((1)._yourself()));
  3057. self._deny_((0).__eq(false));
  3058. self._deny_(false.__eq((0)));
  3059. self._deny_("".__eq((0)));
  3060. self._deny_((0).__eq(""));
  3061. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  3062. args: [],
  3063. 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 = ''",
  3064. messageSends: ["assert:", "=", "deny:", "yourself"],
  3065. referencedClasses: []
  3066. }),
  3067. smalltalk.NumberTest);
  3068. smalltalk.addMethod(
  3069. smalltalk.method({
  3070. selector: "testHexNumbers",
  3071. category: 'tests',
  3072. fn: function (){
  3073. var self=this;
  3074. return smalltalk.withContext(function($ctx1) {
  3075. self._assert_equals_((9),(9));
  3076. self._assert_equals_((10)._truncated(),(10));
  3077. self._assert_equals_((11)._truncated(),(11));
  3078. self._assert_equals_((12)._truncated(),(12));
  3079. self._assert_equals_((13)._truncated(),(13));
  3080. self._assert_equals_((14)._truncated(),(14));
  3081. self._assert_equals_((15)._truncated(),(15));
  3082. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  3083. args: [],
  3084. 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",
  3085. messageSends: ["assert:equals:", "truncated"],
  3086. referencedClasses: []
  3087. }),
  3088. smalltalk.NumberTest);
  3089. smalltalk.addMethod(
  3090. smalltalk.method({
  3091. selector: "testIdentity",
  3092. category: 'tests',
  3093. fn: function (){
  3094. var self=this;
  3095. return smalltalk.withContext(function($ctx1) {
  3096. self._assert_((1).__eq_eq((1)));
  3097. self._assert_((0).__eq_eq((0)));
  3098. self._deny_((1).__eq_eq((0)));
  3099. self._assert_(_st((1)._yourself()).__eq_eq((1)));
  3100. self._assert_((1).__eq_eq((1)._yourself()));
  3101. self._assert_(_st((1)._yourself()).__eq_eq((1)._yourself()));
  3102. self._deny_((1).__eq_eq((2)));
  3103. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  3104. args: [],
  3105. 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",
  3106. messageSends: ["assert:", "==", "deny:", "yourself"],
  3107. referencedClasses: []
  3108. }),
  3109. smalltalk.NumberTest);
  3110. smalltalk.addMethod(
  3111. smalltalk.method({
  3112. selector: "testInvalidHexNumbers",
  3113. category: 'tests',
  3114. fn: function (){
  3115. var self=this;
  3116. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3117. return smalltalk.withContext(function($ctx1) {
  3118. self._should_raise_((function(){
  3119. return smalltalk.withContext(function($ctx2) {
  3120. return (16)._rG();
  3121. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3122. self._should_raise_((function(){
  3123. return smalltalk.withContext(function($ctx2) {
  3124. return (16)._rg();
  3125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3126. self._should_raise_((function(){
  3127. return smalltalk.withContext(function($ctx2) {
  3128. return (16)._rH();
  3129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3130. self._should_raise_((function(){
  3131. return smalltalk.withContext(function($ctx2) {
  3132. return (16)._rh();
  3133. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3134. self._should_raise_((function(){
  3135. return smalltalk.withContext(function($ctx2) {
  3136. return (16)._rI();
  3137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3138. self._should_raise_((function(){
  3139. return smalltalk.withContext(function($ctx2) {
  3140. return (16)._ri();
  3141. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3142. self._should_raise_((function(){
  3143. return smalltalk.withContext(function($ctx2) {
  3144. return (16)._rJ();
  3145. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3146. self._should_raise_((function(){
  3147. return smalltalk.withContext(function($ctx2) {
  3148. return (16)._rj();
  3149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3150. self._should_raise_((function(){
  3151. return smalltalk.withContext(function($ctx2) {
  3152. return (16)._rK();
  3153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3154. self._should_raise_((function(){
  3155. return smalltalk.withContext(function($ctx2) {
  3156. return (16)._rk();
  3157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3158. self._should_raise_((function(){
  3159. return smalltalk.withContext(function($ctx2) {
  3160. return (16)._rL();
  3161. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3162. self._should_raise_((function(){
  3163. return smalltalk.withContext(function($ctx2) {
  3164. return (16)._rl();
  3165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3166. self._should_raise_((function(){
  3167. return smalltalk.withContext(function($ctx2) {
  3168. return (16)._rM();
  3169. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3170. self._should_raise_((function(){
  3171. return smalltalk.withContext(function($ctx2) {
  3172. return (16)._rm();
  3173. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3174. self._should_raise_((function(){
  3175. return smalltalk.withContext(function($ctx2) {
  3176. return (16)._rN();
  3177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3178. self._should_raise_((function(){
  3179. return smalltalk.withContext(function($ctx2) {
  3180. return (16)._rn();
  3181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3182. self._should_raise_((function(){
  3183. return smalltalk.withContext(function($ctx2) {
  3184. return (16)._rO();
  3185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3186. self._should_raise_((function(){
  3187. return smalltalk.withContext(function($ctx2) {
  3188. return (16)._ro();
  3189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3190. self._should_raise_((function(){
  3191. return smalltalk.withContext(function($ctx2) {
  3192. return (16)._rP();
  3193. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3194. self._should_raise_((function(){
  3195. return smalltalk.withContext(function($ctx2) {
  3196. return (16)._rp();
  3197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3198. self._should_raise_((function(){
  3199. return smalltalk.withContext(function($ctx2) {
  3200. return (16)._rQ();
  3201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3202. self._should_raise_((function(){
  3203. return smalltalk.withContext(function($ctx2) {
  3204. return (16)._rq();
  3205. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3206. self._should_raise_((function(){
  3207. return smalltalk.withContext(function($ctx2) {
  3208. return (16)._rR();
  3209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3210. self._should_raise_((function(){
  3211. return smalltalk.withContext(function($ctx2) {
  3212. return (16)._rr();
  3213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3214. self._should_raise_((function(){
  3215. return smalltalk.withContext(function($ctx2) {
  3216. return (16)._rS();
  3217. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3218. self._should_raise_((function(){
  3219. return smalltalk.withContext(function($ctx2) {
  3220. return (16)._rs();
  3221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3222. self._should_raise_((function(){
  3223. return smalltalk.withContext(function($ctx2) {
  3224. return (16)._rT();
  3225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3226. self._should_raise_((function(){
  3227. return smalltalk.withContext(function($ctx2) {
  3228. return (16)._rt();
  3229. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3230. self._should_raise_((function(){
  3231. return smalltalk.withContext(function($ctx2) {
  3232. return (16)._rU();
  3233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3234. self._should_raise_((function(){
  3235. return smalltalk.withContext(function($ctx2) {
  3236. return (16)._ru();
  3237. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3238. self._should_raise_((function(){
  3239. return smalltalk.withContext(function($ctx2) {
  3240. return (16)._rV();
  3241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3242. self._should_raise_((function(){
  3243. return smalltalk.withContext(function($ctx2) {
  3244. return (16)._rv();
  3245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3246. self._should_raise_((function(){
  3247. return smalltalk.withContext(function($ctx2) {
  3248. return (16)._rW();
  3249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3250. self._should_raise_((function(){
  3251. return smalltalk.withContext(function($ctx2) {
  3252. return (16)._rw();
  3253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3254. self._should_raise_((function(){
  3255. return smalltalk.withContext(function($ctx2) {
  3256. return (16)._rX();
  3257. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3258. self._should_raise_((function(){
  3259. return smalltalk.withContext(function($ctx2) {
  3260. return (16)._rx();
  3261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3262. self._should_raise_((function(){
  3263. return smalltalk.withContext(function($ctx2) {
  3264. return (16)._rY();
  3265. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3266. self._should_raise_((function(){
  3267. return smalltalk.withContext(function($ctx2) {
  3268. return (16)._ry();
  3269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3270. self._should_raise_((function(){
  3271. return smalltalk.withContext(function($ctx2) {
  3272. return (16)._rZ();
  3273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3274. self._should_raise_((function(){
  3275. return smalltalk.withContext(function($ctx2) {
  3276. return (16)._rz();
  3277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3278. self._should_raise_((function(){
  3279. return smalltalk.withContext(function($ctx2) {
  3280. return (11259375)._Z();
  3281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3282. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  3283. args: [],
  3284. 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.",
  3285. 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"],
  3286. referencedClasses: ["MessageNotUnderstood"]
  3287. }),
  3288. smalltalk.NumberTest);
  3289. smalltalk.addMethod(
  3290. smalltalk.method({
  3291. selector: "testMinMax",
  3292. category: 'tests',
  3293. fn: function (){
  3294. var self=this;
  3295. return smalltalk.withContext(function($ctx1) {
  3296. self._assert_equals_((2)._max_((5)),(5));
  3297. self._assert_equals_((2)._min_((5)),(2));
  3298. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  3299. args: [],
  3300. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  3301. messageSends: ["assert:equals:", "max:", "min:"],
  3302. referencedClasses: []
  3303. }),
  3304. smalltalk.NumberTest);
  3305. smalltalk.addMethod(
  3306. smalltalk.method({
  3307. selector: "testNegated",
  3308. category: 'tests',
  3309. fn: function (){
  3310. var self=this;
  3311. return smalltalk.withContext(function($ctx1) {
  3312. self._assert_equals_((3)._negated(),(-3));
  3313. self._assert_equals_((-3)._negated(),(3));
  3314. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  3315. args: [],
  3316. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  3317. messageSends: ["assert:equals:", "negated"],
  3318. referencedClasses: []
  3319. }),
  3320. smalltalk.NumberTest);
  3321. smalltalk.addMethod(
  3322. smalltalk.method({
  3323. selector: "testPrintShowingDecimalPlaces",
  3324. category: 'tests',
  3325. fn: function (){
  3326. var self=this;
  3327. return smalltalk.withContext(function($ctx1) {
  3328. self._assert_equals_((23)._printShowingDecimalPlaces_((2)),"23.00");
  3329. self._assert_equals_((23.5698)._printShowingDecimalPlaces_((2)),"23.57");
  3330. self._assert_equals_(_st((234.567)._negated())._printShowingDecimalPlaces_((5)),"-234.56700");
  3331. self._assert_equals_((23.4567)._printShowingDecimalPlaces_((0)),"23");
  3332. self._assert_equals_((23.5567)._printShowingDecimalPlaces_((0)),"24");
  3333. self._assert_equals_(_st((23.4567)._negated())._printShowingDecimalPlaces_((0)),"-23");
  3334. self._assert_equals_(_st((23.5567)._negated())._printShowingDecimalPlaces_((0)),"-24");
  3335. self._assert_equals_((100000000)._printShowingDecimalPlaces_((1)),"100000000.0");
  3336. self._assert_equals_((0.98)._printShowingDecimalPlaces_((5)),"0.98000");
  3337. self._assert_equals_(_st((0.98)._negated())._printShowingDecimalPlaces_((2)),"-0.98");
  3338. self._assert_equals_((2.567)._printShowingDecimalPlaces_((2)),"2.57");
  3339. self._assert_equals_((-2.567)._printShowingDecimalPlaces_((2)),"-2.57");
  3340. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  3341. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  3342. args: [],
  3343. 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'.",
  3344. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  3345. referencedClasses: []
  3346. }),
  3347. smalltalk.NumberTest);
  3348. smalltalk.addMethod(
  3349. smalltalk.method({
  3350. selector: "testRounded",
  3351. category: 'tests',
  3352. fn: function (){
  3353. var self=this;
  3354. return smalltalk.withContext(function($ctx1) {
  3355. self._assert_equals_((3)._rounded(),(3));
  3356. self._assert_equals_((3.212)._rounded(),(3));
  3357. self._assert_equals_((3.51)._rounded(),(4));
  3358. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  3359. args: [],
  3360. 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",
  3361. messageSends: ["assert:equals:", "rounded"],
  3362. referencedClasses: []
  3363. }),
  3364. smalltalk.NumberTest);
  3365. smalltalk.addMethod(
  3366. smalltalk.method({
  3367. selector: "testSqrt",
  3368. category: 'tests',
  3369. fn: function (){
  3370. var self=this;
  3371. return smalltalk.withContext(function($ctx1) {
  3372. self._assert_equals_((4)._sqrt(),(2));
  3373. self._assert_equals_((16)._sqrt(),(4));
  3374. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  3375. args: [],
  3376. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  3377. messageSends: ["assert:equals:", "sqrt"],
  3378. referencedClasses: []
  3379. }),
  3380. smalltalk.NumberTest);
  3381. smalltalk.addMethod(
  3382. smalltalk.method({
  3383. selector: "testSquared",
  3384. category: 'tests',
  3385. fn: function (){
  3386. var self=this;
  3387. return smalltalk.withContext(function($ctx1) {
  3388. self._assert_equals_((4)._squared(),(16));
  3389. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  3390. args: [],
  3391. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  3392. messageSends: ["assert:equals:", "squared"],
  3393. referencedClasses: []
  3394. }),
  3395. smalltalk.NumberTest);
  3396. smalltalk.addMethod(
  3397. smalltalk.method({
  3398. selector: "testTimesRepeat",
  3399. category: 'tests',
  3400. fn: function (){
  3401. var self=this;
  3402. var i;
  3403. return smalltalk.withContext(function($ctx1) {
  3404. i=(0);
  3405. (0)._timesRepeat_((function(){
  3406. return smalltalk.withContext(function($ctx2) {
  3407. i=_st(i).__plus((1));
  3408. return i;
  3409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3410. self._assert_equals_(i,(0));
  3411. (5)._timesRepeat_((function(){
  3412. return smalltalk.withContext(function($ctx2) {
  3413. i=_st(i).__plus((1));
  3414. return i;
  3415. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3416. self._assert_equals_(i,(5));
  3417. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  3418. args: [],
  3419. 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",
  3420. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  3421. referencedClasses: []
  3422. }),
  3423. smalltalk.NumberTest);
  3424. smalltalk.addMethod(
  3425. smalltalk.method({
  3426. selector: "testTo",
  3427. category: 'tests',
  3428. fn: function (){
  3429. var self=this;
  3430. return smalltalk.withContext(function($ctx1) {
  3431. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  3432. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  3433. args: [],
  3434. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  3435. messageSends: ["assert:equals:", "to:"],
  3436. referencedClasses: []
  3437. }),
  3438. smalltalk.NumberTest);
  3439. smalltalk.addMethod(
  3440. smalltalk.method({
  3441. selector: "testToBy",
  3442. category: 'tests',
  3443. fn: function (){
  3444. var self=this;
  3445. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3446. return smalltalk.withContext(function($ctx1) {
  3447. self._assert_equals_((0)._to_by_((6),(2)),[(0), (2), (4), (6)]);
  3448. self._should_raise_((function(){
  3449. return smalltalk.withContext(function($ctx2) {
  3450. return (1)._to_by_((4),(0));
  3451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  3452. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  3453. args: [],
  3454. 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",
  3455. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  3456. referencedClasses: ["Error"]
  3457. }),
  3458. smalltalk.NumberTest);
  3459. smalltalk.addMethod(
  3460. smalltalk.method({
  3461. selector: "testTruncated",
  3462. category: 'tests',
  3463. fn: function (){
  3464. var self=this;
  3465. return smalltalk.withContext(function($ctx1) {
  3466. self._assert_equals_((3)._truncated(),(3));
  3467. self._assert_equals_((3.212)._truncated(),(3));
  3468. self._assert_equals_((3.51)._truncated(),(3));
  3469. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  3470. args: [],
  3471. 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",
  3472. messageSends: ["assert:equals:", "truncated"],
  3473. referencedClasses: []
  3474. }),
  3475. smalltalk.NumberTest);
  3476. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  3477. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  3478. smalltalk.addMethod(
  3479. smalltalk.method({
  3480. selector: "foo",
  3481. category: 'not yet classified',
  3482. fn: function (){
  3483. var self=this;
  3484. return smalltalk.withContext(function($ctx1) {
  3485. var $1;
  3486. $1=self["@foo"];
  3487. return $1;
  3488. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  3489. args: [],
  3490. source: "foo\x0a\x09^foo",
  3491. messageSends: [],
  3492. referencedClasses: []
  3493. }),
  3494. smalltalk.ObjectMock);
  3495. smalltalk.addMethod(
  3496. smalltalk.method({
  3497. selector: "foo:",
  3498. category: 'not yet classified',
  3499. fn: function (anObject){
  3500. var self=this;
  3501. return smalltalk.withContext(function($ctx1) {
  3502. self["@foo"]=anObject;
  3503. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  3504. args: ["anObject"],
  3505. source: "foo: anObject\x0a\x09foo := anObject",
  3506. messageSends: [],
  3507. referencedClasses: []
  3508. }),
  3509. smalltalk.ObjectMock);
  3510. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3511. smalltalk.addMethod(
  3512. smalltalk.method({
  3513. selector: "notDefined",
  3514. category: 'tests',
  3515. fn: function (){
  3516. var self=this;
  3517. return smalltalk.withContext(function($ctx1) {
  3518. return undefined;;
  3519. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  3520. args: [],
  3521. source: "notDefined\x0a\x09<return undefined;>",
  3522. messageSends: [],
  3523. referencedClasses: []
  3524. }),
  3525. smalltalk.ObjectTest);
  3526. smalltalk.addMethod(
  3527. smalltalk.method({
  3528. selector: "testBasicAccess",
  3529. category: 'tests',
  3530. fn: function (){
  3531. var self=this;
  3532. var o;
  3533. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3534. return smalltalk.withContext(function($ctx1) {
  3535. o=_st($Object())._new();
  3536. _st(o)._basicAt_put_("a",(1));
  3537. self._assert_equals_(_st(o)._basicAt_("a"),(1));
  3538. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  3539. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  3540. args: [],
  3541. 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",
  3542. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  3543. referencedClasses: ["Object"]
  3544. }),
  3545. smalltalk.ObjectTest);
  3546. smalltalk.addMethod(
  3547. smalltalk.method({
  3548. selector: "testBasicPerform",
  3549. category: 'tests',
  3550. fn: function (){
  3551. var self=this;
  3552. var o;
  3553. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3554. return smalltalk.withContext(function($ctx1) {
  3555. o=_st($Object())._new();
  3556. _st(o)._basicAt_put_("func",(function(){
  3557. return smalltalk.withContext(function($ctx2) {
  3558. return "hello";
  3559. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3560. _st(o)._basicAt_put_("func2",(function(a){
  3561. return smalltalk.withContext(function($ctx2) {
  3562. return _st(a).__plus((1));
  3563. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}));
  3564. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  3565. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  3566. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  3567. args: [],
  3568. 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",
  3569. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  3570. referencedClasses: ["Object"]
  3571. }),
  3572. smalltalk.ObjectTest);
  3573. smalltalk.addMethod(
  3574. smalltalk.method({
  3575. selector: "testDNU",
  3576. category: 'tests',
  3577. fn: function (){
  3578. var self=this;
  3579. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3580. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3581. return smalltalk.withContext(function($ctx1) {
  3582. self._should_raise_((function(){
  3583. return smalltalk.withContext(function($ctx2) {
  3584. return _st(_st($Object())._new())._foo();
  3585. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3586. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  3587. args: [],
  3588. source: "testDNU\x0a\x09self should: [Object new foo] raise: MessageNotUnderstood",
  3589. messageSends: ["should:raise:", "foo", "new"],
  3590. referencedClasses: ["Object", "MessageNotUnderstood"]
  3591. }),
  3592. smalltalk.ObjectTest);
  3593. smalltalk.addMethod(
  3594. smalltalk.method({
  3595. selector: "testEquality",
  3596. category: 'tests',
  3597. fn: function (){
  3598. var self=this;
  3599. var o;
  3600. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3601. return smalltalk.withContext(function($ctx1) {
  3602. o=_st($Object())._new();
  3603. self._deny_(_st(o).__eq(_st($Object())._new()));
  3604. self._assert_(_st(o).__eq(o));
  3605. self._assert_(_st(_st(o)._yourself()).__eq(o));
  3606. self._assert_(_st(o).__eq(_st(o)._yourself()));
  3607. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  3608. args: [],
  3609. 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)",
  3610. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  3611. referencedClasses: ["Object"]
  3612. }),
  3613. smalltalk.ObjectTest);
  3614. smalltalk.addMethod(
  3615. smalltalk.method({
  3616. selector: "testHalt",
  3617. category: 'tests',
  3618. fn: function (){
  3619. var self=this;
  3620. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3621. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3622. return smalltalk.withContext(function($ctx1) {
  3623. self._should_raise_((function(){
  3624. return smalltalk.withContext(function($ctx2) {
  3625. return _st(_st($Object())._new())._halt();
  3626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  3627. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  3628. args: [],
  3629. source: "testHalt\x0a\x09self should: [Object new halt] raise: Error",
  3630. messageSends: ["should:raise:", "halt", "new"],
  3631. referencedClasses: ["Object", "Error"]
  3632. }),
  3633. smalltalk.ObjectTest);
  3634. smalltalk.addMethod(
  3635. smalltalk.method({
  3636. selector: "testIdentity",
  3637. category: 'tests',
  3638. fn: function (){
  3639. var self=this;
  3640. var o;
  3641. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3642. return smalltalk.withContext(function($ctx1) {
  3643. o=_st($Object())._new();
  3644. self._deny_(_st(o).__eq_eq(_st($Object())._new()));
  3645. self._assert_(_st(o).__eq_eq(o));
  3646. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  3647. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  3648. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  3649. args: [],
  3650. 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",
  3651. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  3652. referencedClasses: ["Object"]
  3653. }),
  3654. smalltalk.ObjectTest);
  3655. smalltalk.addMethod(
  3656. smalltalk.method({
  3657. selector: "testIfNil",
  3658. category: 'tests',
  3659. fn: function (){
  3660. var self=this;
  3661. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3662. return smalltalk.withContext(function($ctx1) {
  3663. var $1,$4,$3,$2,$5,$7,$6,$8,$10,$9,$11,$13,$12;
  3664. self._deny_(_st(_st($Object())._new())._isNil());
  3665. $1=self;
  3666. $4=_st($Object())._new();
  3667. if(($receiver = $4) == nil || $receiver == undefined){
  3668. $3=true;
  3669. } else {
  3670. $3=$4;
  3671. };
  3672. $2=_st($3).__eq(true);
  3673. _st($1)._deny_($2);
  3674. $5=self;
  3675. $7=_st($Object())._new();
  3676. if(($receiver = $7) == nil || $receiver == undefined){
  3677. $6=$7;
  3678. } else {
  3679. $6=true;
  3680. };
  3681. _st($5)._assert_equals_($6,true);
  3682. $8=self;
  3683. $10=_st($Object())._new();
  3684. if(($receiver = $10) == nil || $receiver == undefined){
  3685. $9=false;
  3686. } else {
  3687. $9=true;
  3688. };
  3689. _st($8)._assert_equals_($9,true);
  3690. $11=self;
  3691. $13=_st($Object())._new();
  3692. if(($receiver = $13) == nil || $receiver == undefined){
  3693. $12=false;
  3694. } else {
  3695. $12=true;
  3696. };
  3697. _st($11)._assert_equals_($12,true);
  3698. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  3699. args: [],
  3700. 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",
  3701. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  3702. referencedClasses: ["Object"]
  3703. }),
  3704. smalltalk.ObjectTest);
  3705. smalltalk.addMethod(
  3706. smalltalk.method({
  3707. selector: "testInstVars",
  3708. category: 'tests',
  3709. fn: function (){
  3710. var self=this;
  3711. var o;
  3712. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  3713. return smalltalk.withContext(function($ctx1) {
  3714. o=_st($ObjectMock())._new();
  3715. self._assert_equals_(_st(o)._instVarAt_("foo"),nil);
  3716. _st(o)._instVarAt_put_("foo",(1));
  3717. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  3718. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  3719. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  3720. args: [],
  3721. 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",
  3722. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  3723. referencedClasses: ["ObjectMock"]
  3724. }),
  3725. smalltalk.ObjectTest);
  3726. smalltalk.addMethod(
  3727. smalltalk.method({
  3728. selector: "testNilUndefined",
  3729. category: 'tests',
  3730. fn: function (){
  3731. var self=this;
  3732. return smalltalk.withContext(function($ctx1) {
  3733. self._assert_equals_(self._notDefined(),nil);
  3734. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  3735. args: [],
  3736. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  3737. messageSends: ["assert:equals:", "notDefined"],
  3738. referencedClasses: []
  3739. }),
  3740. smalltalk.ObjectTest);
  3741. smalltalk.addMethod(
  3742. smalltalk.method({
  3743. selector: "testYourself",
  3744. category: 'tests',
  3745. fn: function (){
  3746. var self=this;
  3747. var o;
  3748. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  3749. return smalltalk.withContext(function($ctx1) {
  3750. o=_st($ObjectMock())._new();
  3751. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  3752. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  3753. args: [],
  3754. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  3755. messageSends: ["new", "assert:", "==", "yourself"],
  3756. referencedClasses: ["ObjectMock"]
  3757. }),
  3758. smalltalk.ObjectTest);
  3759. smalltalk.addMethod(
  3760. smalltalk.method({
  3761. selector: "testidentityHash",
  3762. category: 'tests',
  3763. fn: function (){
  3764. var self=this;
  3765. var o1,o2;
  3766. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3767. return smalltalk.withContext(function($ctx1) {
  3768. o1=_st($Object())._new();
  3769. o2=_st($Object())._new();
  3770. self._assert_(_st(_st(o1)._identityHash()).__eq_eq(_st(o1)._identityHash()));
  3771. self._deny_(_st(_st(o1)._identityHash()).__eq_eq(_st(o2)._identityHash()));
  3772. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  3773. args: [],
  3774. 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",
  3775. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  3776. referencedClasses: ["Object"]
  3777. }),
  3778. smalltalk.ObjectTest);
  3779. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3780. smalltalk.addMethod(
  3781. smalltalk.method({
  3782. selector: "testAccessing",
  3783. category: 'tests',
  3784. fn: function (){
  3785. var self=this;
  3786. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3787. return smalltalk.withContext(function($ctx1) {
  3788. self._assert_equals_(_st(_st($Point())._x_y_((3),(4)))._x(),(3));
  3789. self._assert_equals_(_st(_st($Point())._x_y_((3),(4)))._y(),(4));
  3790. self._assert_equals_(_st(_st(_st($Point())._new())._x_((3)))._x(),(3));
  3791. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  3792. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  3793. args: [],
  3794. 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",
  3795. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  3796. referencedClasses: ["Point"]
  3797. }),
  3798. smalltalk.PointTest);
  3799. smalltalk.addMethod(
  3800. smalltalk.method({
  3801. selector: "testArithmetic",
  3802. category: 'tests',
  3803. fn: function (){
  3804. var self=this;
  3805. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3806. return smalltalk.withContext(function($ctx1) {
  3807. self._assert_equals_(_st((3).__at((4))).__star((3).__at((4))),_st($Point())._x_y_((9),(16)));
  3808. self._assert_equals_(_st((3).__at((4))).__plus((3).__at((4))),_st($Point())._x_y_((6),(8)));
  3809. self._assert_equals_(_st((3).__at((4))).__minus((3).__at((4))),_st($Point())._x_y_((0),(0)));
  3810. self._assert_equals_(_st((6).__at((8))).__slash((3).__at((4))),_st($Point())._x_y_((2),(2)));
  3811. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  3812. args: [],
  3813. 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)",
  3814. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  3815. referencedClasses: ["Point"]
  3816. }),
  3817. smalltalk.PointTest);
  3818. smalltalk.addMethod(
  3819. smalltalk.method({
  3820. selector: "testAt",
  3821. category: 'tests',
  3822. fn: function (){
  3823. var self=this;
  3824. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3825. return smalltalk.withContext(function($ctx1) {
  3826. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  3827. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  3828. args: [],
  3829. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  3830. messageSends: ["assert:equals:", "@", "x:y:"],
  3831. referencedClasses: ["Point"]
  3832. }),
  3833. smalltalk.PointTest);
  3834. smalltalk.addMethod(
  3835. smalltalk.method({
  3836. selector: "testEgality",
  3837. category: 'tests',
  3838. fn: function (){
  3839. var self=this;
  3840. return smalltalk.withContext(function($ctx1) {
  3841. self._assert_(_st((3).__at((4))).__eq((3).__at((4))));
  3842. self._deny_(_st((3).__at((5))).__eq((3).__at((6))));
  3843. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  3844. args: [],
  3845. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  3846. messageSends: ["assert:", "=", "@", "deny:"],
  3847. referencedClasses: []
  3848. }),
  3849. smalltalk.PointTest);
  3850. smalltalk.addMethod(
  3851. smalltalk.method({
  3852. selector: "testTranslateBy",
  3853. category: 'tests',
  3854. fn: function (){
  3855. var self=this;
  3856. return smalltalk.withContext(function($ctx1) {
  3857. self._assert_equals_(_st((3).__at((3)))._translateBy_((0).__at((1))),(3).__at((4)));
  3858. self._assert_equals_(_st((3).__at((3)))._translateBy_((0).__at((1)._negated())),(3).__at((2)));
  3859. self._assert_equals_(_st((3).__at((3)))._translateBy_((2).__at((3))),(5).__at((6)));
  3860. self._assert_equals_(_st((3).__at((3)))._translateBy_(_st((3)._negated()).__at((0))),(0).__at((3)));
  3861. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  3862. args: [],
  3863. 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.",
  3864. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  3865. referencedClasses: []
  3866. }),
  3867. smalltalk.PointTest);
  3868. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3869. smalltalk.addMethod(
  3870. smalltalk.method({
  3871. selector: "textNext",
  3872. category: 'tests',
  3873. fn: function (){
  3874. var self=this;
  3875. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  3876. return smalltalk.withContext(function($ctx1) {
  3877. (10000)._timesRepeat_((function(){
  3878. var current,next;
  3879. return smalltalk.withContext(function($ctx2) {
  3880. next=_st(_st($Random())._new())._next();
  3881. next;
  3882. self._assert_(_st(next).__gt_eq((0)));
  3883. self._assert_(_st(next).__lt((1)));
  3884. self._deny_(_st(current).__eq(next));
  3885. return _st(next).__eq(current);
  3886. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1)})}));
  3887. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  3888. args: [],
  3889. 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]",
  3890. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  3891. referencedClasses: ["Random"]
  3892. }),
  3893. smalltalk.RandomTest);
  3894. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3895. smalltalk.addMethod(
  3896. smalltalk.method({
  3897. selector: "testAddRemove",
  3898. category: 'tests',
  3899. fn: function (){
  3900. var self=this;
  3901. var set;
  3902. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3903. return smalltalk.withContext(function($ctx1) {
  3904. set=_st($Set())._new();
  3905. self._assert_(_st(set)._isEmpty());
  3906. _st(set)._add_((3));
  3907. self._assert_(_st(set)._includes_((3)));
  3908. _st(set)._add_((5));
  3909. self._assert_(_st(set)._includes_((5)));
  3910. _st(set)._remove_((3));
  3911. self._deny_(_st(set)._includes_((3)));
  3912. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  3913. args: [],
  3914. 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)",
  3915. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  3916. referencedClasses: ["Set"]
  3917. }),
  3918. smalltalk.SetTest);
  3919. smalltalk.addMethod(
  3920. smalltalk.method({
  3921. selector: "testAt",
  3922. category: 'tests',
  3923. fn: function (){
  3924. var self=this;
  3925. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3926. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3927. return smalltalk.withContext(function($ctx1) {
  3928. self._should_raise_((function(){
  3929. return smalltalk.withContext(function($ctx2) {
  3930. return _st(_st($Set())._new())._at_put_((1),(2));
  3931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  3932. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  3933. args: [],
  3934. source: "testAt\x0a\x09self should: [Set new at: 1 put: 2] raise: Error",
  3935. messageSends: ["should:raise:", "at:put:", "new"],
  3936. referencedClasses: ["Set", "Error"]
  3937. }),
  3938. smalltalk.SetTest);
  3939. smalltalk.addMethod(
  3940. smalltalk.method({
  3941. selector: "testCollect",
  3942. category: 'tests',
  3943. fn: function (){
  3944. var self=this;
  3945. return smalltalk.withContext(function($ctx1) {
  3946. self._assert_equals_(_st([(5), (6), (8)]._asSet())._collect_((function(x){
  3947. return smalltalk.withContext(function($ctx2) {
  3948. return _st(x).__backslash_backslash((3));
  3949. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),[(0), (2)]._asSet());
  3950. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  3951. args: [],
  3952. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  3953. messageSends: ["assert:equals:", "collect:", "\x5c\x5c", "asSet"],
  3954. referencedClasses: []
  3955. }),
  3956. smalltalk.SetTest);
  3957. smalltalk.addMethod(
  3958. smalltalk.method({
  3959. selector: "testComparing",
  3960. category: 'tests',
  3961. fn: function (){
  3962. var self=this;
  3963. return smalltalk.withContext(function($ctx1) {
  3964. self._assert_equals_([(0), (2)]._asSet(),[(0), (2)]._asSet());
  3965. self._assert_equals_([(2), (0)]._asSet(),[(0), (2)]._asSet());
  3966. self._deny_(_st([(0), (2), (3)]._asSet()).__eq([(0), (2)]._asSet()));
  3967. self._deny_(_st([(1), (2)]._asSet()).__eq([(0), (2)]._asSet()));
  3968. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  3969. args: [],
  3970. 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",
  3971. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  3972. referencedClasses: []
  3973. }),
  3974. smalltalk.SetTest);
  3975. smalltalk.addMethod(
  3976. smalltalk.method({
  3977. selector: "testPrintString",
  3978. category: 'tests',
  3979. fn: function (){
  3980. var self=this;
  3981. var set;
  3982. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  3983. return smalltalk.withContext(function($ctx1) {
  3984. var $1,$2,$3,$4;
  3985. set=_st($Set())._new();
  3986. self._assert_equals_(_st(set)._printString(),"a Set ()");
  3987. $1=set;
  3988. _st($1)._add_((1));
  3989. $2=_st($1)._add_((3));
  3990. self._assert_equals_(_st(set)._printString(),"a Set (1 3)");
  3991. _st(set)._add_("foo");
  3992. self._assert_equals_(_st(set)._printString(),"a Set (1 3 'foo')");
  3993. $3=set;
  3994. _st($3)._remove_((1));
  3995. $4=_st($3)._remove_((3));
  3996. self._assert_equals_(_st(set)._printString(),"a Set ('foo')");
  3997. _st(set)._add_((3));
  3998. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  3999. _st(set)._add_((3));
  4000. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  4001. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  4002. args: [],
  4003. 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)'",
  4004. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  4005. referencedClasses: ["Set"]
  4006. }),
  4007. smalltalk.SetTest);
  4008. smalltalk.addMethod(
  4009. smalltalk.method({
  4010. selector: "testSize",
  4011. category: 'tests',
  4012. fn: function (){
  4013. var self=this;
  4014. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4015. return smalltalk.withContext(function($ctx1) {
  4016. self._assert_equals_(_st(_st($Set())._new())._size(),(0));
  4017. self._assert_equals_(_st(_st($Set())._withAll_([(1), (2), (3), (4)]))._size(),(4));
  4018. self._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  4019. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  4020. args: [],
  4021. 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",
  4022. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  4023. referencedClasses: ["Set"]
  4024. }),
  4025. smalltalk.SetTest);
  4026. smalltalk.addMethod(
  4027. smalltalk.method({
  4028. selector: "testUnboxedObjects",
  4029. category: 'tests',
  4030. fn: function (){
  4031. var self=this;
  4032. return smalltalk.withContext(function($ctx1) {
  4033. self._assert_equals_(_st(_st(["foo"._yourself(),"foo"._yourself()])._asSet())._asArray(),["foo"]);
  4034. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  4035. args: [],
  4036. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  4037. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  4038. referencedClasses: []
  4039. }),
  4040. smalltalk.SetTest);
  4041. smalltalk.addMethod(
  4042. smalltalk.method({
  4043. selector: "testUnicity",
  4044. category: 'tests',
  4045. fn: function (){
  4046. var self=this;
  4047. var set;
  4048. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4049. return smalltalk.withContext(function($ctx1) {
  4050. set=_st($Set())._new();
  4051. _st(set)._add_((21));
  4052. _st(set)._add_("hello");
  4053. _st(set)._add_((21));
  4054. self._assert_equals_(_st(set)._size(),(2));
  4055. _st(set)._add_("hello");
  4056. self._assert_equals_(_st(set)._size(),(2));
  4057. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  4058. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  4059. args: [],
  4060. 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')",
  4061. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  4062. referencedClasses: ["Set"]
  4063. }),
  4064. smalltalk.SetTest);
  4065. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4066. smalltalk.addMethod(
  4067. smalltalk.method({
  4068. selector: "collectionClass",
  4069. category: 'accessing',
  4070. fn: function (){
  4071. var self=this;
  4072. return smalltalk.withContext(function($ctx1) {
  4073. var $1;
  4074. $1=_st(self._class())._collectionClass();
  4075. return $1;
  4076. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  4077. args: [],
  4078. source: "collectionClass\x0a\x09^ self class collectionClass",
  4079. messageSends: ["collectionClass", "class"],
  4080. referencedClasses: []
  4081. }),
  4082. smalltalk.StreamTest);
  4083. smalltalk.addMethod(
  4084. smalltalk.method({
  4085. selector: "newCollection",
  4086. category: 'accessing',
  4087. fn: function (){
  4088. var self=this;
  4089. return smalltalk.withContext(function($ctx1) {
  4090. var $1;
  4091. $1=_st(self._collectionClass())._new();
  4092. return $1;
  4093. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  4094. args: [],
  4095. source: "newCollection\x0a\x09^ self collectionClass new",
  4096. messageSends: ["new", "collectionClass"],
  4097. referencedClasses: []
  4098. }),
  4099. smalltalk.StreamTest);
  4100. smalltalk.addMethod(
  4101. smalltalk.method({
  4102. selector: "newStream",
  4103. category: 'accessing',
  4104. fn: function (){
  4105. var self=this;
  4106. return smalltalk.withContext(function($ctx1) {
  4107. var $1;
  4108. $1=_st(_st(self._collectionClass())._new())._stream();
  4109. return $1;
  4110. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  4111. args: [],
  4112. source: "newStream\x0a\x09^ self collectionClass new stream",
  4113. messageSends: ["stream", "new", "collectionClass"],
  4114. referencedClasses: []
  4115. }),
  4116. smalltalk.StreamTest);
  4117. smalltalk.addMethod(
  4118. smalltalk.method({
  4119. selector: "testAtStartAtEnd",
  4120. category: 'tests',
  4121. fn: function (){
  4122. var self=this;
  4123. var stream;
  4124. return smalltalk.withContext(function($ctx1) {
  4125. stream=self._newStream();
  4126. self._assert_(_st(stream)._atStart());
  4127. self._assert_(_st(stream)._atEnd());
  4128. _st(stream)._nextPutAll_(self._newCollection());
  4129. self._assert_(_st(stream)._atEnd());
  4130. self._deny_(_st(stream)._atStart());
  4131. _st(stream)._position_((1));
  4132. self._deny_(_st(stream)._atEnd());
  4133. self._deny_(_st(stream)._atStart());
  4134. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  4135. args: [],
  4136. 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",
  4137. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  4138. referencedClasses: []
  4139. }),
  4140. smalltalk.StreamTest);
  4141. smalltalk.addMethod(
  4142. smalltalk.method({
  4143. selector: "testContents",
  4144. category: 'tests',
  4145. fn: function (){
  4146. var self=this;
  4147. var stream;
  4148. return smalltalk.withContext(function($ctx1) {
  4149. stream=self._newStream();
  4150. _st(stream)._nextPutAll_(self._newCollection());
  4151. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  4152. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  4153. args: [],
  4154. 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",
  4155. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  4156. referencedClasses: []
  4157. }),
  4158. smalltalk.StreamTest);
  4159. smalltalk.addMethod(
  4160. smalltalk.method({
  4161. selector: "testIsEmpty",
  4162. category: 'tests',
  4163. fn: function (){
  4164. var self=this;
  4165. var stream;
  4166. return smalltalk.withContext(function($ctx1) {
  4167. stream=self._newStream();
  4168. self._assert_(_st(stream)._isEmpty());
  4169. _st(stream)._nextPutAll_(self._newCollection());
  4170. self._deny_(_st(stream)._isEmpty());
  4171. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  4172. args: [],
  4173. 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",
  4174. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  4175. referencedClasses: []
  4176. }),
  4177. smalltalk.StreamTest);
  4178. smalltalk.addMethod(
  4179. smalltalk.method({
  4180. selector: "testPosition",
  4181. category: 'tests',
  4182. fn: function (){
  4183. var self=this;
  4184. var collection,stream;
  4185. return smalltalk.withContext(function($ctx1) {
  4186. collection=self._newCollection();
  4187. stream=self._newStream();
  4188. _st(stream)._nextPutAll_(collection);
  4189. self._assert_equals_(_st(stream)._position(),_st(collection)._size());
  4190. _st(stream)._position_((0));
  4191. self._assert_equals_(_st(stream)._position(),(0));
  4192. _st(stream)._next();
  4193. self._assert_equals_(_st(stream)._position(),(1));
  4194. _st(stream)._next();
  4195. self._assert_equals_(_st(stream)._position(),(2));
  4196. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  4197. args: [],
  4198. 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",
  4199. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  4200. referencedClasses: []
  4201. }),
  4202. smalltalk.StreamTest);
  4203. smalltalk.addMethod(
  4204. smalltalk.method({
  4205. selector: "testReading",
  4206. category: 'tests',
  4207. fn: function (){
  4208. var self=this;
  4209. var stream,collection;
  4210. return smalltalk.withContext(function($ctx1) {
  4211. var $1,$2;
  4212. collection=self._newCollection();
  4213. stream=self._newStream();
  4214. $1=stream;
  4215. _st($1)._nextPutAll_(collection);
  4216. $2=_st($1)._position_((0));
  4217. _st(collection)._do_((function(each){
  4218. return smalltalk.withContext(function($ctx2) {
  4219. return self._assert_equals_(_st(stream)._next(),each);
  4220. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4221. self._assert_(_st(_st(stream)._next())._isNil());
  4222. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  4223. args: [],
  4224. 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",
  4225. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  4226. referencedClasses: []
  4227. }),
  4228. smalltalk.StreamTest);
  4229. smalltalk.addMethod(
  4230. smalltalk.method({
  4231. selector: "testStreamContents",
  4232. category: 'tests',
  4233. fn: function (){
  4234. var self=this;
  4235. return smalltalk.withContext(function($ctx1) {
  4236. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  4237. args: [],
  4238. source: "testStreamContents",
  4239. messageSends: [],
  4240. referencedClasses: []
  4241. }),
  4242. smalltalk.StreamTest);
  4243. smalltalk.addMethod(
  4244. smalltalk.method({
  4245. selector: "testWrite",
  4246. category: 'tests',
  4247. fn: function (){
  4248. var self=this;
  4249. var stream,collection;
  4250. return smalltalk.withContext(function($ctx1) {
  4251. collection=self._newCollection();
  4252. stream=self._newStream();
  4253. _st(collection)._do_((function(each){
  4254. return smalltalk.withContext(function($ctx2) {
  4255. return _st(stream).__lt_lt(each);
  4256. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4257. self._assert_equals_(_st(stream)._contents(),collection);
  4258. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  4259. args: [],
  4260. 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",
  4261. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  4262. referencedClasses: []
  4263. }),
  4264. smalltalk.StreamTest);
  4265. smalltalk.addMethod(
  4266. smalltalk.method({
  4267. selector: "testWriting",
  4268. category: 'tests',
  4269. fn: function (){
  4270. var self=this;
  4271. var stream,collection;
  4272. return smalltalk.withContext(function($ctx1) {
  4273. collection=self._newCollection();
  4274. stream=self._newStream();
  4275. _st(collection)._do_((function(each){
  4276. return smalltalk.withContext(function($ctx2) {
  4277. return _st(stream)._nextPut_(each);
  4278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4279. self._assert_equals_(_st(stream)._contents(),collection);
  4280. stream=self._newStream();
  4281. _st(stream)._nextPutAll_(collection);
  4282. self._assert_equals_(_st(stream)._contents(),collection);
  4283. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  4284. args: [],
  4285. 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",
  4286. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  4287. referencedClasses: []
  4288. }),
  4289. smalltalk.StreamTest);
  4290. smalltalk.addMethod(
  4291. smalltalk.method({
  4292. selector: "collectionClass",
  4293. category: 'accessing',
  4294. fn: function (){
  4295. var self=this;
  4296. return smalltalk.withContext(function($ctx1) {
  4297. return nil;
  4298. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  4299. args: [],
  4300. source: "collectionClass\x0a\x09^ nil",
  4301. messageSends: [],
  4302. referencedClasses: []
  4303. }),
  4304. smalltalk.StreamTest.klass);
  4305. smalltalk.addMethod(
  4306. smalltalk.method({
  4307. selector: "isAbstract",
  4308. category: 'testing',
  4309. fn: function (){
  4310. var self=this;
  4311. return smalltalk.withContext(function($ctx1) {
  4312. var $1;
  4313. $1=_st(self._collectionClass())._isNil();
  4314. return $1;
  4315. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  4316. args: [],
  4317. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  4318. messageSends: ["isNil", "collectionClass"],
  4319. referencedClasses: []
  4320. }),
  4321. smalltalk.StreamTest.klass);
  4322. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  4323. smalltalk.addMethod(
  4324. smalltalk.method({
  4325. selector: "newCollection",
  4326. category: 'accessing',
  4327. fn: function (){
  4328. var self=this;
  4329. return smalltalk.withContext(function($ctx1) {
  4330. var $1;
  4331. $1=[true,(1),(3).__at((4)),"foo"];
  4332. return $1;
  4333. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  4334. args: [],
  4335. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  4336. messageSends: ["@"],
  4337. referencedClasses: []
  4338. }),
  4339. smalltalk.ArrayStreamTest);
  4340. smalltalk.addMethod(
  4341. smalltalk.method({
  4342. selector: "collectionClass",
  4343. category: 'accessing',
  4344. fn: function (){
  4345. var self=this;
  4346. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4347. return smalltalk.withContext(function($ctx1) {
  4348. var $1;
  4349. $1=$Array();
  4350. return $1;
  4351. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  4352. args: [],
  4353. source: "collectionClass\x0a\x09^ Array",
  4354. messageSends: [],
  4355. referencedClasses: ["Array"]
  4356. }),
  4357. smalltalk.ArrayStreamTest.klass);
  4358. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  4359. smalltalk.addMethod(
  4360. smalltalk.method({
  4361. selector: "newCollection",
  4362. category: 'accessing',
  4363. fn: function (){
  4364. var self=this;
  4365. return smalltalk.withContext(function($ctx1) {
  4366. return "hello world";
  4367. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  4368. args: [],
  4369. source: "newCollection\x0a\x09^ 'hello world'",
  4370. messageSends: [],
  4371. referencedClasses: []
  4372. }),
  4373. smalltalk.StringStreamTest);
  4374. smalltalk.addMethod(
  4375. smalltalk.method({
  4376. selector: "collectionClass",
  4377. category: 'accessing',
  4378. fn: function (){
  4379. var self=this;
  4380. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4381. return smalltalk.withContext(function($ctx1) {
  4382. var $1;
  4383. $1=$String();
  4384. return $1;
  4385. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  4386. args: [],
  4387. source: "collectionClass\x0a\x09^ String",
  4388. messageSends: [],
  4389. referencedClasses: ["String"]
  4390. }),
  4391. smalltalk.StringStreamTest.klass);
  4392. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4393. smalltalk.addMethod(
  4394. smalltalk.method({
  4395. selector: "testCopying",
  4396. category: 'tests',
  4397. fn: function (){
  4398. var self=this;
  4399. return smalltalk.withContext(function($ctx1) {
  4400. self._assert_equals_(nil._copy(),nil);
  4401. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  4402. args: [],
  4403. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  4404. messageSends: ["assert:equals:", "copy"],
  4405. referencedClasses: []
  4406. }),
  4407. smalltalk.UndefinedTest);
  4408. smalltalk.addMethod(
  4409. smalltalk.method({
  4410. selector: "testDeepCopy",
  4411. category: 'tests',
  4412. fn: function (){
  4413. var self=this;
  4414. return smalltalk.withContext(function($ctx1) {
  4415. self._assert_(_st(nil._deepCopy()).__eq(nil));
  4416. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  4417. args: [],
  4418. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  4419. messageSends: ["assert:", "=", "deepCopy"],
  4420. referencedClasses: []
  4421. }),
  4422. smalltalk.UndefinedTest);
  4423. smalltalk.addMethod(
  4424. smalltalk.method({
  4425. selector: "testIfNil",
  4426. category: 'tests',
  4427. fn: function (){
  4428. var self=this;
  4429. return smalltalk.withContext(function($ctx1) {
  4430. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9;
  4431. $1=self;
  4432. if(($receiver = nil) == nil || $receiver == undefined){
  4433. $2=true;
  4434. } else {
  4435. $2=nil;
  4436. };
  4437. _st($1)._assert_equals_($2,true);
  4438. $3=self;
  4439. if(($receiver = nil) == nil || $receiver == undefined){
  4440. $5=nil;
  4441. } else {
  4442. $5=true;
  4443. };
  4444. $4=_st($5).__eq(true);
  4445. _st($3)._deny_($4);
  4446. $6=self;
  4447. if(($receiver = nil) == nil || $receiver == undefined){
  4448. $7=true;
  4449. } else {
  4450. $7=false;
  4451. };
  4452. _st($6)._assert_equals_($7,true);
  4453. $8=self;
  4454. if(($receiver = nil) == nil || $receiver == undefined){
  4455. $10=false;
  4456. } else {
  4457. $10=true;
  4458. };
  4459. $9=_st($10).__eq(true);
  4460. _st($8)._deny_($9);
  4461. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  4462. args: [],
  4463. 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",
  4464. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  4465. referencedClasses: []
  4466. }),
  4467. smalltalk.UndefinedTest);
  4468. smalltalk.addMethod(
  4469. smalltalk.method({
  4470. selector: "testIsNil",
  4471. category: 'tests',
  4472. fn: function (){
  4473. var self=this;
  4474. return smalltalk.withContext(function($ctx1) {
  4475. self._assert_(nil._isNil());
  4476. self._deny_(nil._notNil());
  4477. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  4478. args: [],
  4479. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  4480. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  4481. referencedClasses: []
  4482. }),
  4483. smalltalk.UndefinedTest);
  4484. });