Kernel-Tests.js 178 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. "_testCanClearInterval",
  5. smalltalk.method({
  6. selector: "testCanClearInterval",
  7. category: 'tests',
  8. fn: function () {
  9. var self=this;
  10. return smalltalk.withContext(function($ctx1) {
  11. _st(self)._shouldnt_raise_((function(){
  12. return smalltalk.withContext(function($ctx2) {
  13. return _st(_st((function(){
  14. return smalltalk.withContext(function($ctx3) {
  15. return _st(_st((smalltalk.Error || Error))._new())._signal();
  16. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._valueWithInterval_((0)))._clearInterval();
  17. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  18. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{}, smalltalk.BlockClosureTest)});},
  19. args: [],
  20. source: "testCanClearInterval\x0a\x09self shouldnt: [([Error new signal] valueWithInterval: 0) clearInterval] raise: Error",
  21. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  22. referencedClasses: ["Error"]
  23. }),
  24. smalltalk.BlockClosureTest);
  25. smalltalk.addMethod(
  26. "_testCanClearTimeout",
  27. smalltalk.method({
  28. selector: "testCanClearTimeout",
  29. category: 'tests',
  30. fn: function () {
  31. var self=this;
  32. return smalltalk.withContext(function($ctx1) {
  33. _st(self)._shouldnt_raise_((function(){
  34. return smalltalk.withContext(function($ctx2) {
  35. return _st(_st((function(){
  36. return smalltalk.withContext(function($ctx3) {
  37. return _st(_st((smalltalk.Error || Error))._new())._signal();
  38. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._valueWithTimeout_((0)))._clearTimeout();
  39. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  40. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{}, smalltalk.BlockClosureTest)});},
  41. args: [],
  42. source: "testCanClearTimeout\x0a\x09self shouldnt: [([Error new signal] valueWithTimeout: 0) clearTimeout] raise: Error",
  43. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  44. referencedClasses: ["Error"]
  45. }),
  46. smalltalk.BlockClosureTest);
  47. smalltalk.addMethod(
  48. "_testCompiledSource",
  49. smalltalk.method({
  50. selector: "testCompiledSource",
  51. category: 'tests',
  52. fn: function () {
  53. var self=this;
  54. return smalltalk.withContext(function($ctx1) {
  55. _st(self)._assert_(_st(_st((function(){
  56. return smalltalk.withContext(function($ctx2) {
  57. return _st((1)).__plus((1));
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._compiledSource())._includesSubString_("function"));
  59. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{}, smalltalk.BlockClosureTest)});},
  60. args: [],
  61. source: "testCompiledSource\x0a\x09self assert: ([1+1] compiledSource includesSubString: 'function')",
  62. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  63. referencedClasses: []
  64. }),
  65. smalltalk.BlockClosureTest);
  66. smalltalk.addMethod(
  67. "_testCurrySelf",
  68. smalltalk.method({
  69. selector: "testCurrySelf",
  70. category: 'tests',
  71. fn: function (){
  72. var self=this;
  73. var curriedMethod,array;
  74. return smalltalk.withContext(function($ctx1) {
  75. curriedMethod=_st(_st((function(selfarg,x){
  76. return smalltalk.withContext(function($ctx2) {
  77. return _st(selfarg)._at_(x);
  78. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1)})}))._currySelf())._asCompiledMethod_("foo:");
  79. array=[(3), (1), (4)];
  80. _st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._installMethod_forClass_category_(curriedMethod,(smalltalk.Array || Array),"**test helper");
  81. _st((function(){
  82. return smalltalk.withContext(function($ctx2) {
  83. return _st(self)._assert_equals_(_st(array)._foo_((2)),(1));
  84. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  85. return smalltalk.withContext(function($ctx2) {
  86. return _st((smalltalk.Array || Array))._removeCompiledMethod_(curriedMethod);
  87. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  88. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array}, smalltalk.BlockClosureTest)})},
  89. args: [],
  90. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a array := #(3 1 4).\x0a ClassBuilder new installMethod: curriedMethod forClass: Array category: '**test helper'.\x0a [ self assert: (array foo: 2) equals: 1 ]\x0a ensure: [ Array removeCompiledMethod: curriedMethod ]",
  91. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:category:", "new", "ensure:", "removeCompiledMethod:", "assert:equals:", "foo:"],
  92. referencedClasses: ["Array", "ClassBuilder"]
  93. }),
  94. smalltalk.BlockClosureTest);
  95. smalltalk.addMethod(
  96. "_testEnsure",
  97. smalltalk.method({
  98. selector: "testEnsure",
  99. category: 'tests',
  100. fn: function (){
  101. var self=this;
  102. return smalltalk.withContext(function($ctx1) {
  103. _st(self)._assert_equals_(_st((function(){
  104. return smalltalk.withContext(function($ctx2) {
  105. return (3);
  106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  107. return smalltalk.withContext(function($ctx2) {
  108. return (4);
  109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(3));
  110. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{}, smalltalk.BlockClosureTest)})},
  111. args: [],
  112. source: "testEnsure\x0a\x09self assert: ([3] ensure: [4]) equals: 3",
  113. messageSends: ["assert:equals:", "ensure:"],
  114. referencedClasses: []
  115. }),
  116. smalltalk.BlockClosureTest);
  117. smalltalk.addMethod(
  118. "_testEnsureRaises",
  119. smalltalk.method({
  120. selector: "testEnsureRaises",
  121. category: 'tests',
  122. fn: function () {
  123. var self=this;
  124. return smalltalk.withContext(function($ctx1) {
  125. _st(self)._should_raise_((function(){
  126. return smalltalk.withContext(function($ctx2) {
  127. return _st((function(){
  128. return smalltalk.withContext(function($ctx3) {
  129. return _st(_st((smalltalk.Error || Error))._new())._signal();
  130. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._ensure_((function(){
  131. return smalltalk.withContext(function($ctx3) {
  132. return true;
  133. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  135. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{}, smalltalk.BlockClosureTest)});},
  136. args: [],
  137. source: "testEnsureRaises\x0a\x09self should: [[Error new signal] ensure: [true]] raise: Error",
  138. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  139. referencedClasses: ["Error"]
  140. }),
  141. smalltalk.BlockClosureTest);
  142. smalltalk.addMethod(
  143. "_testExceptionSemantics",
  144. smalltalk.method({
  145. selector: "testExceptionSemantics",
  146. category: 'tests',
  147. fn: function () {
  148. var self=this;
  149. return smalltalk.withContext(function($ctx1) {
  150. _st(self)._timeout_((100));
  151. _st(_st(self)._async_((function(){
  152. return smalltalk.withContext(function($ctx2) {
  153. return _st((function(){
  154. return smalltalk.withContext(function($ctx3) {
  155. _st(self)._assert_(true);
  156. _st((smalltalk.Error || Error))._signal();
  157. _st(self)._deny_(true);
  158. return _st(self)._finished();
  159. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(ex){
  160. return smalltalk.withContext(function($ctx3) {
  161. return _st(self)._finished();
  162. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx1)})}));
  163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((0));
  164. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{}, smalltalk.BlockClosureTest)});},
  165. args: [],
  166. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a self timeout: 100.\x0a \x0a (self async: [ \x0a \x09[ \x0a \x09self assert: true. \x0a Error signal. \x0a \x22The following should *not* be run\x22\x0a self deny: true.\x0a self finished.\x0a \x09\x09] on: Error do: [ :ex | self finished ] \x0a\x09]) valueWithTimeout: 0",
  167. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "finished", "assert:", "signal", "deny:"],
  168. referencedClasses: ["Error"]
  169. }),
  170. smalltalk.BlockClosureTest);
  171. smalltalk.addMethod(
  172. "_testNumArgs",
  173. smalltalk.method({
  174. selector: "testNumArgs",
  175. category: 'tests',
  176. fn: function () {
  177. var self=this;
  178. return smalltalk.withContext(function($ctx1) {
  179. _st(self)._assert_equals_(_st((function(){
  180. return smalltalk.withContext(function($ctx2) {
  181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._numArgs(),(0));
  182. _st(self)._assert_equals_(_st((function(a,b){
  183. return smalltalk.withContext(function($ctx2) {
  184. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._numArgs(),(2));
  185. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{}, smalltalk.BlockClosureTest)});},
  186. args: [],
  187. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [:a :b | ] numArgs equals: 2",
  188. messageSends: ["assert:equals:", "numArgs"],
  189. referencedClasses: []
  190. }),
  191. smalltalk.BlockClosureTest);
  192. smalltalk.addMethod(
  193. "_testOnDo",
  194. smalltalk.method({
  195. selector: "testOnDo",
  196. category: 'tests',
  197. fn: function () {
  198. var self=this;
  199. return smalltalk.withContext(function($ctx1) {
  200. _st(self)._assert_(_st((function(){
  201. return smalltalk.withContext(function($ctx2) {
  202. return _st(_st((smalltalk.Error || Error))._new())._signal();
  203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(ex){
  204. return smalltalk.withContext(function($ctx2) {
  205. return true;
  206. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})})));
  207. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{}, smalltalk.BlockClosureTest)});},
  208. args: [],
  209. source: "testOnDo\x0a\x09self assert: ([Error new signal] on: Error do: [:ex | true])",
  210. messageSends: ["assert:", "on:do:", "signal", "new"],
  211. referencedClasses: ["Error"]
  212. }),
  213. smalltalk.BlockClosureTest);
  214. smalltalk.addMethod(
  215. "_testValue",
  216. smalltalk.method({
  217. selector: "testValue",
  218. category: 'tests',
  219. fn: function () {
  220. var self=this;
  221. return smalltalk.withContext(function($ctx1) {
  222. _st(self)._assert_equals_(_st((function(){
  223. return smalltalk.withContext(function($ctx2) {
  224. return _st((1)).__plus((1));
  225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._value(),(2));
  226. _st(self)._assert_equals_(_st((function(x){
  227. return smalltalk.withContext(function($ctx2) {
  228. return _st(x).__plus((1));
  229. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}))._value_((2)),(3));
  230. _st(self)._assert_equals_(_st((function(x,y){
  231. return smalltalk.withContext(function($ctx2) {
  232. return _st(x).__star(y);
  233. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1)})}))._value_value_((2),(4)),(8));
  234. _st(self)._assert_equals_(_st((function(a,b,c){
  235. return smalltalk.withContext(function($ctx2) {
  236. return (1);
  237. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1)})}))._value(),(1));
  238. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{}, smalltalk.BlockClosureTest)});},
  239. args: [],
  240. 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",
  241. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  242. referencedClasses: []
  243. }),
  244. smalltalk.BlockClosureTest);
  245. smalltalk.addMethod(
  246. "_testValueWithPossibleArguments",
  247. smalltalk.method({
  248. selector: "testValueWithPossibleArguments",
  249. category: 'tests',
  250. fn: function () {
  251. var self=this;
  252. return smalltalk.withContext(function($ctx1) {
  253. _st(self)._assert_equals_(_st((function(){
  254. return smalltalk.withContext(function($ctx2) {
  255. return (1);
  256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(1));
  257. _st(self)._assert_equals_(_st((function(a){
  258. return smalltalk.withContext(function($ctx2) {
  259. return _st(a).__plus((4));
  260. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(7));
  261. _st(self)._assert_equals_(_st((function(a,b){
  262. return smalltalk.withContext(function($ctx2) {
  263. return _st(a).__plus(b);
  264. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  265. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{}, smalltalk.BlockClosureTest)});},
  266. args: [],
  267. 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.",
  268. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  269. referencedClasses: []
  270. }),
  271. smalltalk.BlockClosureTest);
  272. smalltalk.addMethod(
  273. "_testWhileFalse",
  274. smalltalk.method({
  275. selector: "testWhileFalse",
  276. category: 'tests',
  277. fn: function () {
  278. var self=this;
  279. var i;
  280. return smalltalk.withContext(function($ctx1) {
  281. i=(0);
  282. _st((function(){
  283. return smalltalk.withContext(function($ctx2) {
  284. return _st(i).__gt((5));
  285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  286. return smalltalk.withContext(function($ctx2) {
  287. i=_st(i).__plus((1));
  288. return i;
  289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  290. _st(self)._assert_equals_(i,(6));
  291. i=(0);
  292. _st((function(){
  293. return smalltalk.withContext(function($ctx2) {
  294. i=_st(i).__plus((1));
  295. i;
  296. return _st(i).__gt((5));
  297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse();
  298. _st(self)._assert_equals_(i,(6));
  299. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i}, smalltalk.BlockClosureTest)});},
  300. args: [],
  301. 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",
  302. messageSends: ["whileFalse:", "+", ">", "assert:equals:", "whileFalse"],
  303. referencedClasses: []
  304. }),
  305. smalltalk.BlockClosureTest);
  306. smalltalk.addMethod(
  307. "_testWhileTrue",
  308. smalltalk.method({
  309. selector: "testWhileTrue",
  310. category: 'tests',
  311. fn: function () {
  312. var self=this;
  313. var i;
  314. return smalltalk.withContext(function($ctx1) {
  315. i=(0);
  316. _st((function(){
  317. return smalltalk.withContext(function($ctx2) {
  318. return _st(i).__lt((5));
  319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  320. return smalltalk.withContext(function($ctx2) {
  321. i=_st(i).__plus((1));
  322. return i;
  323. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  324. _st(self)._assert_equals_(i,(5));
  325. i=(0);
  326. _st((function(){
  327. return smalltalk.withContext(function($ctx2) {
  328. i=_st(i).__plus((1));
  329. i;
  330. return _st(i).__lt((5));
  331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue();
  332. _st(self)._assert_equals_(i,(5));
  333. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i}, smalltalk.BlockClosureTest)});},
  334. args: [],
  335. 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",
  336. messageSends: ["whileTrue:", "+", "<", "assert:equals:", "whileTrue"],
  337. referencedClasses: []
  338. }),
  339. smalltalk.BlockClosureTest);
  340. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  341. smalltalk.addMethod(
  342. "_testEquality",
  343. smalltalk.method({
  344. selector: "testEquality",
  345. category: 'tests',
  346. fn: function (){
  347. var self=this;
  348. return smalltalk.withContext(function($ctx1) {
  349. _st(self)._deny_(_st((0)).__eq(false));
  350. _st(self)._deny_(_st(false).__eq((0)));
  351. _st(self)._deny_(_st("").__eq(false));
  352. _st(self)._deny_(_st(false).__eq(""));
  353. _st(self)._assert_(_st(true).__eq(true));
  354. _st(self)._deny_(_st(false).__eq(true));
  355. _st(self)._deny_(_st(true).__eq(false));
  356. _st(self)._assert_(_st(false).__eq(false));
  357. _st(self)._assert_(_st(_st(true)._yourself()).__eq(true));
  358. _st(self)._assert_(_st(_st(true)._yourself()).__eq(_st(true)._yourself()));
  359. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{}, smalltalk.BooleanTest)})},
  360. args: [],
  361. 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)",
  362. messageSends: ["deny:", "=", "assert:", "yourself"],
  363. referencedClasses: []
  364. }),
  365. smalltalk.BooleanTest);
  366. smalltalk.addMethod(
  367. "_testIdentity",
  368. smalltalk.method({
  369. selector: "testIdentity",
  370. category: 'tests',
  371. fn: function () {
  372. var self=this;
  373. return smalltalk.withContext(function($ctx1) {
  374. _st(self)._deny_(_st((0)).__eq_eq(false));
  375. _st(self)._deny_(_st(false).__eq_eq((0)));
  376. _st(self)._deny_(_st("").__eq_eq(false));
  377. _st(self)._deny_(_st(false).__eq_eq(""));
  378. _st(self)._assert_(_st(true).__eq_eq(true));
  379. _st(self)._deny_(_st(false).__eq_eq(true));
  380. _st(self)._deny_(_st(true).__eq_eq(false));
  381. _st(self)._assert_(_st(false).__eq_eq(false));
  382. _st(self)._assert_(_st(_st(true)._yourself()).__eq_eq(true));
  383. _st(self)._assert_(_st(_st(true)._yourself()).__eq_eq(_st(true)._yourself()));
  384. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{}, smalltalk.BooleanTest)});},
  385. args: [],
  386. 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",
  387. messageSends: ["deny:", "==", "assert:", "yourself"],
  388. referencedClasses: []
  389. }),
  390. smalltalk.BooleanTest);
  391. smalltalk.addMethod(
  392. "_testIfTrueIfFalse",
  393. smalltalk.method({
  394. selector: "testIfTrueIfFalse",
  395. category: 'tests',
  396. fn: function (){
  397. var self=this;
  398. return smalltalk.withContext(function($ctx1) {
  399. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  400. $1=self;
  401. if(smalltalk.assert(true)){
  402. $2="alternative block";
  403. };
  404. _st($1)._assert_equals_($2,"alternative block");
  405. $3=self;
  406. if(! smalltalk.assert(true)){
  407. $4="alternative block";
  408. };
  409. _st($3)._assert_equals_($4,nil);
  410. $5=self;
  411. if(smalltalk.assert(false)){
  412. $6="alternative block";
  413. };
  414. _st($5)._assert_equals_($6,nil);
  415. $7=self;
  416. if(! smalltalk.assert(false)){
  417. $8="alternative block";
  418. };
  419. _st($7)._assert_equals_($8,"alternative block");
  420. $9=self;
  421. if(smalltalk.assert(false)){
  422. $10="alternative block";
  423. } else {
  424. $10="alternative block2";
  425. };
  426. _st($9)._assert_equals_($10,"alternative block2");
  427. $11=self;
  428. if(smalltalk.assert(false)){
  429. $12="alternative block2";
  430. } else {
  431. $12="alternative block";
  432. };
  433. _st($11)._assert_equals_($12,"alternative block");
  434. $13=self;
  435. if(smalltalk.assert(true)){
  436. $14="alternative block";
  437. } else {
  438. $14="alternative block2";
  439. };
  440. _st($13)._assert_equals_($14,"alternative block");
  441. $15=self;
  442. if(smalltalk.assert(true)){
  443. $16="alternative block2";
  444. } else {
  445. $16="alternative block";
  446. };
  447. _st($15)._assert_equals_($16,"alternative block2");
  448. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{}, smalltalk.BooleanTest)})},
  449. args: [],
  450. 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'.",
  451. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  452. referencedClasses: []
  453. }),
  454. smalltalk.BooleanTest);
  455. smalltalk.addMethod(
  456. "_testIfTrueIfFalseWithBoxing",
  457. smalltalk.method({
  458. selector: "testIfTrueIfFalseWithBoxing",
  459. category: 'tests',
  460. fn: function (){
  461. var self=this;
  462. return smalltalk.withContext(function($ctx1) {
  463. 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;
  464. $1=self;
  465. $3=_st(true)._yourself();
  466. if(smalltalk.assert($3)){
  467. $2="alternative block";
  468. };
  469. _st($1)._assert_equals_($2,"alternative block");
  470. $4=self;
  471. $6=_st(true)._yourself();
  472. if(! smalltalk.assert($6)){
  473. $5="alternative block";
  474. };
  475. _st($4)._assert_equals_($5,nil);
  476. $7=self;
  477. $9=_st(false)._yourself();
  478. if(smalltalk.assert($9)){
  479. $8="alternative block";
  480. };
  481. _st($7)._assert_equals_($8,nil);
  482. $10=self;
  483. $12=_st(false)._yourself();
  484. if(! smalltalk.assert($12)){
  485. $11="alternative block";
  486. };
  487. _st($10)._assert_equals_($11,"alternative block");
  488. $13=self;
  489. $15=_st(false)._yourself();
  490. if(smalltalk.assert($15)){
  491. $14="alternative block";
  492. } else {
  493. $14="alternative block2";
  494. };
  495. _st($13)._assert_equals_($14,"alternative block2");
  496. $16=self;
  497. $18=_st(false)._yourself();
  498. if(smalltalk.assert($18)){
  499. $17="alternative block2";
  500. } else {
  501. $17="alternative block";
  502. };
  503. _st($16)._assert_equals_($17,"alternative block");
  504. $19=self;
  505. $21=_st(true)._yourself();
  506. if(smalltalk.assert($21)){
  507. $20="alternative block";
  508. } else {
  509. $20="alternative block2";
  510. };
  511. _st($19)._assert_equals_($20,"alternative block");
  512. $22=self;
  513. $24=_st(true)._yourself();
  514. if(smalltalk.assert($24)){
  515. $23="alternative block2";
  516. } else {
  517. $23="alternative block";
  518. };
  519. _st($22)._assert_equals_($23,"alternative block2");
  520. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{}, smalltalk.BooleanTest)})},
  521. args: [],
  522. 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'.",
  523. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  524. referencedClasses: []
  525. }),
  526. smalltalk.BooleanTest);
  527. smalltalk.addMethod(
  528. "_testLogic",
  529. smalltalk.method({
  530. selector: "testLogic",
  531. category: 'tests',
  532. fn: function (){
  533. var self=this;
  534. return smalltalk.withContext(function($ctx1) {
  535. var $1,$2,$3,$4,$5,$6,$7,$8;
  536. $1=self;
  537. _st($1)._assert_(_st(true).__and(true));
  538. _st($1)._deny_(_st(true).__and(false));
  539. _st($1)._deny_(_st(false).__and(true));
  540. $2=_st($1)._deny_(_st(false).__and(false));
  541. $3=self;
  542. _st($3)._assert_(_st(true).__or(true));
  543. _st($3)._assert_(_st(true).__or(false));
  544. _st($3)._assert_(_st(false).__or(true));
  545. $4=_st($3)._deny_(_st(false).__or(false));
  546. $5=self;
  547. _st($5)._assert_(_st(true).__and(_st((1)).__gt((0))));
  548. _st($5)._deny_(_st(_st((1)).__gt((0))).__and(false));
  549. $6=_st($5)._deny_(_st(_st((1)).__gt((0))).__and(_st((1)).__gt((2))));
  550. $7=self;
  551. _st($7)._assert_(_st(false).__or(_st((1)).__gt((0))));
  552. _st($7)._assert_(_st(_st((1)).__gt((0))).__or(false));
  553. $8=_st($7)._assert_(_st(_st((1)).__gt((0))).__or(_st((1)).__gt((2))));
  554. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{}, smalltalk.BooleanTest)})},
  555. args: [],
  556. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a \x09deny: (true & false);\x0a deny: (false & true);\x0a deny: (false & false).\x0a\x09self assert: (true | true);\x0a \x09assert: (true | false);\x0a assert: (false | true);\x0a deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a \x09deny: ((1 > 0) & false);\x0a deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a \x09assert: ((1 > 0) | false);\x0a assert: ((1 > 0) | (1 > 2))",
  557. messageSends: ["assert:", "&", "deny:", "|", ">"],
  558. referencedClasses: []
  559. }),
  560. smalltalk.BooleanTest);
  561. smalltalk.addMethod(
  562. "_testLogicKeywords",
  563. smalltalk.method({
  564. selector: "testLogicKeywords",
  565. category: 'tests',
  566. fn: function (){
  567. var self=this;
  568. return smalltalk.withContext(function($ctx1) {
  569. var $1,$2,$3,$4,$5,$6,$7,$8;
  570. $1=self;
  571. _st($1)._assert_(_st(true)._and_((function(){
  572. return smalltalk.withContext(function($ctx2) {
  573. return true;
  574. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  575. _st($1)._deny_(_st(true)._and_((function(){
  576. return smalltalk.withContext(function($ctx2) {
  577. return false;
  578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  579. _st($1)._deny_(_st(false)._and_((function(){
  580. return smalltalk.withContext(function($ctx2) {
  581. return true;
  582. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  583. $2=_st($1)._deny_(_st(false)._and_((function(){
  584. return smalltalk.withContext(function($ctx2) {
  585. return false;
  586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  587. $3=self;
  588. _st($3)._assert_(_st(true)._or_((function(){
  589. return smalltalk.withContext(function($ctx2) {
  590. return true;
  591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  592. _st($3)._assert_(_st(true)._or_((function(){
  593. return smalltalk.withContext(function($ctx2) {
  594. return false;
  595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  596. _st($3)._assert_(_st(false)._or_((function(){
  597. return smalltalk.withContext(function($ctx2) {
  598. return true;
  599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  600. $4=_st($3)._deny_(_st(false)._or_((function(){
  601. return smalltalk.withContext(function($ctx2) {
  602. return false;
  603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  604. $5=self;
  605. _st($5)._assert_(_st(true)._and_((function(){
  606. return smalltalk.withContext(function($ctx2) {
  607. return _st((1)).__gt((0));
  608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  609. _st($5)._deny_(_st(_st((1)).__gt((0)))._and_((function(){
  610. return smalltalk.withContext(function($ctx2) {
  611. return false;
  612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  613. $6=_st($5)._deny_(_st(_st((1)).__gt((0)))._and_((function(){
  614. return smalltalk.withContext(function($ctx2) {
  615. return _st((1)).__gt((2));
  616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  617. $7=self;
  618. _st($7)._assert_(_st(false)._or_((function(){
  619. return smalltalk.withContext(function($ctx2) {
  620. return _st((1)).__gt((0));
  621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  622. _st($7)._assert_(_st(_st((1)).__gt((0)))._or_((function(){
  623. return smalltalk.withContext(function($ctx2) {
  624. return false;
  625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  626. $8=_st($7)._assert_(_st(_st((1)).__gt((0)))._or_((function(){
  627. return smalltalk.withContext(function($ctx2) {
  628. return _st((1)).__gt((2));
  629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  630. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{}, smalltalk.BooleanTest)})},
  631. args: [],
  632. 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 \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 ])",
  633. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  634. referencedClasses: []
  635. }),
  636. smalltalk.BooleanTest);
  637. smalltalk.addMethod(
  638. "_testNonBooleanError",
  639. smalltalk.method({
  640. selector: "testNonBooleanError",
  641. category: 'tests',
  642. fn: function () {
  643. var self=this;
  644. return smalltalk.withContext(function($ctx1) {
  645. var $1,$2;
  646. $1=self;
  647. $2=(function(){
  648. return smalltalk.withContext(function($ctx2) {
  649. if(smalltalk.assert("")){
  650. } else {
  651. };
  652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  653. _st($1)._should_raise_($2,(smalltalk.NonBooleanReceiver || NonBooleanReceiver));
  654. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{}, smalltalk.BooleanTest)});},
  655. args: [],
  656. source: "testNonBooleanError\x0a self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  657. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  658. referencedClasses: ["NonBooleanReceiver"]
  659. }),
  660. smalltalk.BooleanTest);
  661. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  662. smalltalk.addMethod(
  663. "_setUp",
  664. smalltalk.method({
  665. selector: "setUp",
  666. category: 'running',
  667. fn: function () {
  668. var self=this;
  669. return smalltalk.withContext(function($ctx1) {
  670. self["@builder"]=_st((smalltalk.ClassBuilder || ClassBuilder))._new();
  671. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{}, smalltalk.ClassBuilderTest)});},
  672. args: [],
  673. source: "setUp\x0a\x09builder := ClassBuilder new",
  674. messageSends: ["new"],
  675. referencedClasses: ["ClassBuilder"]
  676. }),
  677. smalltalk.ClassBuilderTest);
  678. smalltalk.addMethod(
  679. "_tearDown",
  680. smalltalk.method({
  681. selector: "tearDown",
  682. category: 'running',
  683. fn: function () {
  684. var self=this;
  685. return smalltalk.withContext(function($ctx1) {
  686. var $1;
  687. $1=self["@theClass"];
  688. if(($receiver = $1) == nil || $receiver == undefined){
  689. $1;
  690. } else {
  691. _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_(self["@theClass"]);
  692. self["@theClass"]=nil;
  693. self["@theClass"];
  694. };
  695. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{}, smalltalk.ClassBuilderTest)});},
  696. args: [],
  697. source: "tearDown\x0a\x09theClass ifNotNil: [Smalltalk current removeClass: theClass. theClass := nil]",
  698. messageSends: ["ifNotNil:", "removeClass:", "current"],
  699. referencedClasses: ["Smalltalk"]
  700. }),
  701. smalltalk.ClassBuilderTest);
  702. smalltalk.addMethod(
  703. "_testClassCopy",
  704. smalltalk.method({
  705. selector: "testClassCopy",
  706. category: 'tests',
  707. fn: function () {
  708. var self=this;
  709. return smalltalk.withContext(function($ctx1) {
  710. self["@theClass"]=_st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  711. _st(self)._assert_(_st(_st(self["@theClass"])._superclass()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._superclass()));
  712. _st(self)._assert_(_st(_st(self["@theClass"])._instanceVariableNames()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._instanceVariableNames()));
  713. _st(self)._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  714. _st(self)._assert_(_st(_st(self["@theClass"])._package()).__eq_eq(_st((smalltalk.ObjectMock || ObjectMock))._package()));
  715. _st(self)._assert_equals_(_st(_st(self["@theClass"])._methodDictionary())._keys(),_st(_st((smalltalk.ObjectMock || ObjectMock))._methodDictionary())._keys());
  716. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{}, smalltalk.ClassBuilderTest)});},
  717. args: [],
  718. 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",
  719. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  720. referencedClasses: ["ObjectMock"]
  721. }),
  722. smalltalk.ClassBuilderTest);
  723. smalltalk.addMethod(
  724. "_testClassMigration",
  725. smalltalk.method({
  726. selector: "testClassMigration",
  727. category: 'tests',
  728. fn: function (){
  729. var self=this;
  730. var instance,oldClass;
  731. return smalltalk.withContext(function($ctx1) {
  732. oldClass=_st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  733. instance=_st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("ObjectMock2"))._new();
  734. _st((smalltalk.ObjectMock || ObjectMock))._subclass_instanceVariableNames_package_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("ObjectMock2"),"","Kernel-Tests");
  735. _st(self)._deny_(_st(oldClass).__eq_eq((smalltalk.ObjectMock2 || ObjectMock2)));
  736. _st(self)._assert_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._superclass()).__eq_eq((smalltalk.ObjectMock || ObjectMock)));
  737. _st(self)._assert_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._instanceVariableNames())._isEmpty());
  738. _st(self)._assert_equals_(_st((smalltalk.ObjectMock2 || ObjectMock2))._selectors(),_st(oldClass)._selectors());
  739. _st(self)._assert_equals_(_st((smalltalk.ObjectMock2 || ObjectMock2))._comment(),_st(oldClass)._comment());
  740. _st(self)._assert_equals_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._package())._name(),"Kernel-Tests");
  741. _st(self)._deny_(_st(_st(instance)._class()).__eq_eq((smalltalk.ObjectMock2 || ObjectMock2)));
  742. _st(self)._assert_(_st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_(_st(_st(instance)._class())._name()))._isNil());
  743. _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_((smalltalk.ObjectMock2 || ObjectMock2));
  744. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass}, smalltalk.ClassBuilderTest)})},
  745. args: [],
  746. source: "testClassMigration\x0a\x09| instance oldClass |\x0a \x0a oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a instance := (Smalltalk current at: 'ObjectMock2') new.\x0a \x0a \x22Change the superclass of ObjectMock2\x22\x0a ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a \x09instanceVariableNames: ''\x0a package: 'Kernel-Tests'.\x0a \x0a self deny: oldClass == ObjectMock2.\x0a \x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a self assert: ObjectMock2 comment equals: oldClass comment.\x0a self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a \x0a\x09self deny: instance class == ObjectMock2.\x0a \x22Commeting this out. Tests implementation detail.\x22\x0a \x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a \x0a\x09self assert: (Smalltalk current at: instance class name) isNil.\x0a \x0a Smalltalk current removeClass: ObjectMock2",
  747. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  748. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  749. }),
  750. smalltalk.ClassBuilderTest);
  751. smalltalk.addMethod(
  752. "_testClassMigrationWithClassInstanceVariables",
  753. smalltalk.method({
  754. selector: "testClassMigrationWithClassInstanceVariables",
  755. category: 'tests',
  756. fn: function () {
  757. var self=this;
  758. return smalltalk.withContext(function($ctx1) {
  759. _st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  760. _st(_st((smalltalk.ObjectMock2 || ObjectMock2))._class())._instanceVariableNames_("foo bar");
  761. _st((smalltalk.ObjectMock || ObjectMock))._subclass_instanceVariableNames_package_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("ObjectMock2"),"","Kernel-Tests");
  762. _st(self)._assert_equals_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._class())._instanceVariableNames(),["foo", "bar"]);
  763. _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_((smalltalk.ObjectMock2 || ObjectMock2));
  764. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{}, smalltalk.ClassBuilderTest)});},
  765. args: [],
  766. source: "testClassMigrationWithClassInstanceVariables\x0a \x0a builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a \x0a \x22Change the superclass of ObjectMock2\x22\x0a ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a \x09instanceVariableNames: ''\x0a package: 'Kernel-Tests'.\x0a \x0a self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a \x0a Smalltalk current removeClass: ObjectMock2",
  767. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  768. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  769. }),
  770. smalltalk.ClassBuilderTest);
  771. smalltalk.addMethod(
  772. "_testClassMigrationWithSubclasses",
  773. smalltalk.method({
  774. selector: "testClassMigrationWithSubclasses",
  775. category: 'tests',
  776. fn: function () {
  777. var self=this;
  778. return smalltalk.withContext(function($ctx1) {
  779. _st(self["@builder"])._copyClass_named_((smalltalk.ObjectMock || ObjectMock),"ObjectMock2");
  780. _st((smalltalk.ObjectMock2 || ObjectMock2))._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  781. _st((smalltalk.ObjectMock3 || ObjectMock3))._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  782. _st((smalltalk.ObjectMock || ObjectMock))._subclass_instanceVariableNames_package_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_("ObjectMock2"),"","Kernel-Tests");
  783. _st(self)._assert_(_st(_st((smalltalk.ObjectMock || ObjectMock))._subclasses())._includes_((smalltalk.ObjectMock2 || ObjectMock2)));
  784. _st(self)._assert_(_st(_st((smalltalk.ObjectMock2 || ObjectMock2))._subclasses())._includes_((smalltalk.ObjectMock3 || ObjectMock3)));
  785. _st(self)._assert_(_st(_st((smalltalk.ObjectMock3 || ObjectMock3))._subclasses())._includes_((smalltalk.ObjectMock4 || ObjectMock4)));
  786. _st(_st((smalltalk.ObjectMock || ObjectMock))._allSubclasses())._do_((function(each){
  787. return smalltalk.withContext(function($ctx2) {
  788. return _st(_st((smalltalk.Smalltalk || Smalltalk))._current())._removeClass_(each);
  789. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  790. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{}, smalltalk.ClassBuilderTest)});},
  791. args: [],
  792. source: "testClassMigrationWithSubclasses\x0a \x0a builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a \x0a \x22Change the superclass of ObjectMock2\x22\x0a ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a \x09instanceVariableNames: ''\x0a package: 'Kernel-Tests'.\x0a \x0a self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a \x0a ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]",
  793. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "removeClass:", "allSubclasses"],
  794. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  795. }),
  796. smalltalk.ClassBuilderTest);
  797. smalltalk.addMethod(
  798. "_testInstanceVariableNames",
  799. smalltalk.method({
  800. selector: "testInstanceVariableNames",
  801. category: 'tests',
  802. fn: function () {
  803. var self=this;
  804. return smalltalk.withContext(function($ctx1) {
  805. _st(self)._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  806. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{}, smalltalk.ClassBuilderTest)});},
  807. args: [],
  808. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  809. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  810. referencedClasses: []
  811. }),
  812. smalltalk.ClassBuilderTest);
  813. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  814. smalltalk.addMethod(
  815. "_assertSameContents_as_",
  816. smalltalk.method({
  817. selector: "assertSameContents:as:",
  818. category: 'convenience',
  819. fn: function (aCollection,anotherCollection){
  820. var self=this;
  821. return smalltalk.withContext(function($ctx1) {
  822. _st(self)._assert_(_st(_st(aCollection)._size()).__eq(_st(anotherCollection)._size()));
  823. _st(aCollection)._do_((function(each){
  824. return smalltalk.withContext(function($ctx2) {
  825. return _st(self)._assert_(_st(_st(aCollection)._occurrencesOf_(each)).__eq(_st(anotherCollection)._occurrencesOf_(each)));
  826. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  827. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection}, smalltalk.CollectionTest)})},
  828. args: ["aCollection", "anotherCollection"],
  829. 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)) ]",
  830. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  831. referencedClasses: []
  832. }),
  833. smalltalk.CollectionTest);
  834. smalltalk.addMethod(
  835. "_collection",
  836. smalltalk.method({
  837. selector: "collection",
  838. category: 'accessing',
  839. fn: function () {
  840. var self=this;
  841. return smalltalk.withContext(function($ctx1) {
  842. var $1;
  843. $1=_st(_st(self)._collectionClass())._withAll_(_st(self)._defaultValues());
  844. return $1;
  845. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.CollectionTest)});},
  846. args: [],
  847. source: "collection\x0a\x09^ self collectionClass withAll: self defaultValues",
  848. messageSends: ["withAll:", "defaultValues", "collectionClass"],
  849. referencedClasses: []
  850. }),
  851. smalltalk.CollectionTest);
  852. smalltalk.addMethod(
  853. "_collectionClass",
  854. smalltalk.method({
  855. selector: "collectionClass",
  856. category: 'accessing',
  857. fn: function () {
  858. var self=this;
  859. return smalltalk.withContext(function($ctx1) {
  860. var $1;
  861. $1=_st(_st(self)._class())._collectionClass();
  862. return $1;
  863. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.CollectionTest)});},
  864. args: [],
  865. source: "collectionClass\x0a\x09^ self class collectionClass",
  866. messageSends: ["collectionClass", "class"],
  867. referencedClasses: []
  868. }),
  869. smalltalk.CollectionTest);
  870. smalltalk.addMethod(
  871. "_collectionWithDuplicates",
  872. smalltalk.method({
  873. selector: "collectionWithDuplicates",
  874. category: 'accessing',
  875. fn: function () {
  876. var self=this;
  877. return smalltalk.withContext(function($ctx1) {
  878. var $1;
  879. $1=_st(_st(self)._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  880. return $1;
  881. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.CollectionTest)});},
  882. args: [],
  883. source: "collectionWithDuplicates\x0a\x09^ self collectionClass withAll: #('a' 'b' 'c' 1 2 1 'a')",
  884. messageSends: ["withAll:", "collectionClass"],
  885. referencedClasses: []
  886. }),
  887. smalltalk.CollectionTest);
  888. smalltalk.addMethod(
  889. "_defaultValues",
  890. smalltalk.method({
  891. selector: "defaultValues",
  892. category: 'accessing',
  893. fn: function () {
  894. var self=this;
  895. return smalltalk.withContext(function($ctx1) {
  896. return [(1), (2), (3), (-4)];
  897. }, function($ctx1) {$ctx1.fill(self,"defaultValues",{}, smalltalk.CollectionTest)});},
  898. args: [],
  899. source: "defaultValues\x0a\x09^ #(1 2 3 -4)",
  900. messageSends: [],
  901. referencedClasses: []
  902. }),
  903. smalltalk.CollectionTest);
  904. smalltalk.addMethod(
  905. "_isCollectionReadOnly",
  906. smalltalk.method({
  907. selector: "isCollectionReadOnly",
  908. category: 'testing',
  909. fn: function () {
  910. var self=this;
  911. return smalltalk.withContext(function($ctx1) {
  912. return false;
  913. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{}, smalltalk.CollectionTest)});},
  914. args: [],
  915. source: "isCollectionReadOnly\x0a\x09^ false",
  916. messageSends: [],
  917. referencedClasses: []
  918. }),
  919. smalltalk.CollectionTest);
  920. smalltalk.addMethod(
  921. "_testAsArray",
  922. smalltalk.method({
  923. selector: "testAsArray",
  924. category: 'tests',
  925. fn: function () {
  926. var self=this;
  927. return smalltalk.withContext(function($ctx1) {
  928. _st(self)._assertSameContents_as_(_st(self)._collection(),_st(_st(self)._collection())._asArray());
  929. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{}, smalltalk.CollectionTest)});},
  930. args: [],
  931. source: "testAsArray\x0a\x09self \x0a\x09\x09assertSameContents: self collection \x0a\x09\x09as: self collection asArray",
  932. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  933. referencedClasses: []
  934. }),
  935. smalltalk.CollectionTest);
  936. smalltalk.addMethod(
  937. "_testAsOrderedCollection",
  938. smalltalk.method({
  939. selector: "testAsOrderedCollection",
  940. category: 'tests',
  941. fn: function () {
  942. var self=this;
  943. return smalltalk.withContext(function($ctx1) {
  944. _st(self)._assertSameContents_as_(_st(self)._collection(),_st(_st(self)._collection())._asOrderedCollection());
  945. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{}, smalltalk.CollectionTest)});},
  946. args: [],
  947. source: "testAsOrderedCollection\x0a\x09self \x0a\x09\x09assertSameContents: self collection \x0a\x09\x09as: self collection asOrderedCollection",
  948. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  949. referencedClasses: []
  950. }),
  951. smalltalk.CollectionTest);
  952. smalltalk.addMethod(
  953. "_testAsSet",
  954. smalltalk.method({
  955. selector: "testAsSet",
  956. category: 'tests',
  957. fn: function (){
  958. var self=this;
  959. var c,set;
  960. return smalltalk.withContext(function($ctx1) {
  961. c=_st(self)._collectionWithDuplicates();
  962. set=_st(c)._asSet();
  963. _st(self)._assert_equals_(_st(set)._size(),(5));
  964. _st(c)._do_((function(each){
  965. return smalltalk.withContext(function($ctx2) {
  966. return _st(self)._assert_(_st(set)._includes_(each));
  967. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  968. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set}, smalltalk.CollectionTest)})},
  969. args: [],
  970. 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) ]",
  971. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  972. referencedClasses: []
  973. }),
  974. smalltalk.CollectionTest);
  975. smalltalk.addMethod(
  976. "_testCollect",
  977. smalltalk.method({
  978. selector: "testCollect",
  979. category: 'tests',
  980. fn: function () {
  981. var self=this;
  982. var newCollection;
  983. return smalltalk.withContext(function($ctx1) {
  984. newCollection=[(1), (2), (3), (4)];
  985. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  986. return smalltalk.withContext(function($ctx2) {
  987. return _st(each)._abs();
  988. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  989. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection}, smalltalk.CollectionTest)});},
  990. args: [],
  991. 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",
  992. messageSends: ["assertSameContents:as:", "collect:", "abs", "collection"],
  993. referencedClasses: []
  994. }),
  995. smalltalk.CollectionTest);
  996. smalltalk.addMethod(
  997. "_testDetect",
  998. smalltalk.method({
  999. selector: "testDetect",
  1000. category: 'tests',
  1001. fn: function (){
  1002. var self=this;
  1003. return smalltalk.withContext(function($ctx1) {
  1004. _st(self)._assert_equals_(_st(_st(self)._collection())._detect_((function(each){
  1005. return smalltalk.withContext(function($ctx2) {
  1006. return _st(each).__lt((0));
  1007. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),(-4));
  1008. _st(self)._should_raise_((function(){
  1009. return smalltalk.withContext(function($ctx2) {
  1010. return _st(_st(self)._collection())._detect_((function(each){
  1011. return smalltalk.withContext(function($ctx3) {
  1012. return _st(each).__eq((6));
  1013. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  1014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1015. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{}, smalltalk.CollectionTest)})},
  1016. args: [],
  1017. 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",
  1018. messageSends: ["assert:equals:", "detect:", "<", "collection", "should:raise:", "="],
  1019. referencedClasses: ["Error"]
  1020. }),
  1021. smalltalk.CollectionTest);
  1022. smalltalk.addMethod(
  1023. "_testDo",
  1024. smalltalk.method({
  1025. selector: "testDo",
  1026. category: 'tests',
  1027. fn: function () {
  1028. var self=this;
  1029. var newCollection;
  1030. return smalltalk.withContext(function($ctx1) {
  1031. newCollection=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  1032. _st(_st(self)._collection())._do_((function(each){
  1033. return smalltalk.withContext(function($ctx2) {
  1034. return _st(newCollection)._add_(each);
  1035. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1036. _st(self)._assertSameContents_as_(_st(self)._collection(),newCollection);
  1037. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection}, smalltalk.CollectionTest)});},
  1038. args: [],
  1039. 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",
  1040. messageSends: ["new", "do:", "add:", "collection", "assertSameContents:as:"],
  1041. referencedClasses: ["OrderedCollection"]
  1042. }),
  1043. smalltalk.CollectionTest);
  1044. smalltalk.addMethod(
  1045. "_testIsEmpty",
  1046. smalltalk.method({
  1047. selector: "testIsEmpty",
  1048. category: 'tests',
  1049. fn: function () {
  1050. var self=this;
  1051. return smalltalk.withContext(function($ctx1) {
  1052. _st(self)._assert_(_st(_st(_st(self)._collectionClass())._new())._isEmpty());
  1053. _st(self)._deny_(_st(_st(self)._collection())._isEmpty());
  1054. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{}, smalltalk.CollectionTest)});},
  1055. args: [],
  1056. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1057. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1058. referencedClasses: []
  1059. }),
  1060. smalltalk.CollectionTest);
  1061. smalltalk.addMethod(
  1062. "_testSelect",
  1063. smalltalk.method({
  1064. selector: "testSelect",
  1065. category: 'tests',
  1066. fn: function () {
  1067. var self=this;
  1068. var newCollection;
  1069. return smalltalk.withContext(function($ctx1) {
  1070. newCollection=[(2), (-4)];
  1071. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  1072. return smalltalk.withContext(function($ctx2) {
  1073. return _st(each)._even();
  1074. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1075. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection}, smalltalk.CollectionTest)});},
  1076. args: [],
  1077. 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",
  1078. messageSends: ["assertSameContents:as:", "select:", "even", "collection"],
  1079. referencedClasses: []
  1080. }),
  1081. smalltalk.CollectionTest);
  1082. smalltalk.addMethod(
  1083. "_testSize",
  1084. smalltalk.method({
  1085. selector: "testSize",
  1086. category: 'tests',
  1087. fn: function (){
  1088. var self=this;
  1089. return smalltalk.withContext(function($ctx1) {
  1090. _st(self)._assert_equals_(_st(_st(_st(self)._collectionClass())._new())._size(),(0));
  1091. _st(self)._assert_equals_(_st(_st(self)._collection())._size(),(4));
  1092. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{}, smalltalk.CollectionTest)})},
  1093. args: [],
  1094. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self collection size equals: 4",
  1095. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"],
  1096. referencedClasses: []
  1097. }),
  1098. smalltalk.CollectionTest);
  1099. smalltalk.addMethod(
  1100. "_collectionClass",
  1101. smalltalk.method({
  1102. selector: "collectionClass",
  1103. category: 'accessing',
  1104. fn: function () {
  1105. var self=this;
  1106. return smalltalk.withContext(function($ctx1) {
  1107. return nil;
  1108. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.CollectionTest.klass)});},
  1109. args: [],
  1110. source: "collectionClass\x0a\x09^ nil",
  1111. messageSends: [],
  1112. referencedClasses: []
  1113. }),
  1114. smalltalk.CollectionTest.klass);
  1115. smalltalk.addMethod(
  1116. "_isAbstract",
  1117. smalltalk.method({
  1118. selector: "isAbstract",
  1119. category: 'testing',
  1120. fn: function () {
  1121. var self=this;
  1122. return smalltalk.withContext(function($ctx1) {
  1123. var $1;
  1124. $1=_st(_st(self)._collectionClass())._isNil();
  1125. return $1;
  1126. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{}, smalltalk.CollectionTest.klass)});},
  1127. args: [],
  1128. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1129. messageSends: ["isNil", "collectionClass"],
  1130. referencedClasses: []
  1131. }),
  1132. smalltalk.CollectionTest.klass);
  1133. smalltalk.addClass('HashedCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1134. smalltalk.addMethod(
  1135. "_collection",
  1136. smalltalk.method({
  1137. selector: "collection",
  1138. category: 'accessing',
  1139. fn: function () {
  1140. var self=this;
  1141. return smalltalk.withContext(function($ctx1) {
  1142. var $1;
  1143. $1=smalltalk.HashedCollection._fromPairs_([_st("a").__minus_gt((1)),_st("b").__minus_gt((2)),_st("c").__minus_gt((3)),_st("d").__minus_gt((-4))]);
  1144. return $1;
  1145. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.HashedCollectionTest)});},
  1146. args: [],
  1147. source: "collection\x0a\x09^ #{ 'a' -> 1. 'b' -> 2. 'c' -> 3. 'd' -> -4 }",
  1148. messageSends: ["->"],
  1149. referencedClasses: []
  1150. }),
  1151. smalltalk.HashedCollectionTest);
  1152. smalltalk.addMethod(
  1153. "_collectionWithDuplicates",
  1154. smalltalk.method({
  1155. selector: "collectionWithDuplicates",
  1156. category: 'accessing',
  1157. fn: function () {
  1158. var self=this;
  1159. return smalltalk.withContext(function($ctx1) {
  1160. var $1;
  1161. $1=smalltalk.HashedCollection._fromPairs_([_st("a").__minus_gt((1)),_st("b").__minus_gt((2)),_st("c").__minus_gt((3)),_st("d").__minus_gt((-4)),_st("e").__minus_gt((1)),_st("f").__minus_gt((2)),_st("g").__minus_gt((10))]);
  1162. return $1;
  1163. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.HashedCollectionTest)});},
  1164. args: [],
  1165. source: "collectionWithDuplicates\x0a\x09^ #{ 'a' -> 1. 'b' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  1166. messageSends: ["->"],
  1167. referencedClasses: []
  1168. }),
  1169. smalltalk.HashedCollectionTest);
  1170. smalltalk.addMethod(
  1171. "_collectionClass",
  1172. smalltalk.method({
  1173. selector: "collectionClass",
  1174. category: 'accessing',
  1175. fn: function () {
  1176. var self=this;
  1177. return smalltalk.withContext(function($ctx1) {
  1178. var $1;
  1179. $1=(smalltalk.HashedCollection || HashedCollection);
  1180. return $1;
  1181. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.HashedCollectionTest.klass)});},
  1182. args: [],
  1183. source: "collectionClass\x0a\x09^ HashedCollection",
  1184. messageSends: [],
  1185. referencedClasses: ["HashedCollection"]
  1186. }),
  1187. smalltalk.HashedCollectionTest.klass);
  1188. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  1189. smalltalk.addMethod(
  1190. "_collection",
  1191. smalltalk.method({
  1192. selector: "collection",
  1193. category: 'accessing',
  1194. fn: function () {
  1195. var self=this;
  1196. return smalltalk.withContext(function($ctx1) {
  1197. var $2,$3,$1;
  1198. $2=_st((smalltalk.Dictionary || Dictionary))._new();
  1199. _st($2)._at_put_((1),(1));
  1200. _st($2)._at_put_("a",(2));
  1201. _st($2)._at_put_(true,(3));
  1202. _st($2)._at_put_((4),(-4));
  1203. $3=_st($2)._yourself();
  1204. $1=$3;
  1205. return $1;
  1206. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.DictionaryTest)});},
  1207. args: [],
  1208. 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",
  1209. messageSends: ["at:put:", "new", "yourself"],
  1210. referencedClasses: ["Dictionary"]
  1211. }),
  1212. smalltalk.DictionaryTest);
  1213. smalltalk.addMethod(
  1214. "_collectionWithDuplicates",
  1215. smalltalk.method({
  1216. selector: "collectionWithDuplicates",
  1217. category: 'accessing',
  1218. fn: function () {
  1219. var self=this;
  1220. return smalltalk.withContext(function($ctx1) {
  1221. var $2,$3,$1;
  1222. $2=_st((smalltalk.Dictionary || Dictionary))._new();
  1223. _st($2)._at_put_((1),(1));
  1224. _st($2)._at_put_("a",(2));
  1225. _st($2)._at_put_(true,(3));
  1226. _st($2)._at_put_((4),(-4));
  1227. _st($2)._at_put_("b",(1));
  1228. _st($2)._at_put_((3),(3));
  1229. _st($2)._at_put_(false,(12));
  1230. $3=_st($2)._yourself();
  1231. $1=$3;
  1232. return $1;
  1233. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.DictionaryTest)});},
  1234. args: [],
  1235. 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",
  1236. messageSends: ["at:put:", "new", "yourself"],
  1237. referencedClasses: ["Dictionary"]
  1238. }),
  1239. smalltalk.DictionaryTest);
  1240. smalltalk.addMethod(
  1241. "_testAccessing",
  1242. smalltalk.method({
  1243. selector: "testAccessing",
  1244. category: 'tests',
  1245. fn: function (){
  1246. var self=this;
  1247. var d;
  1248. return smalltalk.withContext(function($ctx1) {
  1249. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1250. _st(d)._at_put_("hello","world");
  1251. _st(self)._assert_equals_(_st(d)._at_("hello"),"world");
  1252. _st(self)._assert_equals_(_st(d)._at_ifAbsent_("hello",(function(){
  1253. return smalltalk.withContext(function($ctx2) {
  1254. return nil;
  1255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"world");
  1256. _st(self)._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  1257. return smalltalk.withContext(function($ctx2) {
  1258. return nil;
  1259. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq("world"));
  1260. _st(self)._assert_(_st(d)._includesKey_("hello"));
  1261. _st(self)._deny_(_st(d)._includesKey_("foo"));
  1262. _st(d)._at_put_((1),(2));
  1263. _st(self)._assert_equals_(_st(d)._at_((1)),(2));
  1264. _st(d)._at_put_(_st((1)).__at((3)),(3));
  1265. _st(self)._assert_equals_(_st(d)._at_(_st((1)).__at((3))),(3));
  1266. _st(self)._assert_(_st(d)._includesKey_(_st((1)).__at((3))));
  1267. _st(self)._deny_(_st(d)._includesKey_(_st((3)).__at((1))));
  1268. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d}, smalltalk.DictionaryTest)})},
  1269. args: [],
  1270. 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)\x0a",
  1271. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  1272. referencedClasses: ["Dictionary"]
  1273. }),
  1274. smalltalk.DictionaryTest);
  1275. smalltalk.addMethod(
  1276. "_testDynamicDictionaries",
  1277. smalltalk.method({
  1278. selector: "testDynamicDictionaries",
  1279. category: 'tests',
  1280. fn: function (){
  1281. var self=this;
  1282. return smalltalk.withContext(function($ctx1) {
  1283. _st(self)._assert_equals_(_st(smalltalk.HashedCollection._fromPairs_([_st("hello").__minus_gt((1))]))._asDictionary(),_st((smalltalk.Dictionary || Dictionary))._with_(_st("hello").__minus_gt((1))));
  1284. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{}, smalltalk.DictionaryTest)})},
  1285. args: [],
  1286. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  1287. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  1288. referencedClasses: ["Dictionary"]
  1289. }),
  1290. smalltalk.DictionaryTest);
  1291. smalltalk.addMethod(
  1292. "_testEquality",
  1293. smalltalk.method({
  1294. selector: "testEquality",
  1295. category: 'tests',
  1296. fn: function (){
  1297. var self=this;
  1298. var d1,d2;
  1299. return smalltalk.withContext(function($ctx1) {
  1300. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  1301. _st(self)._assert_(_st(_st((smalltalk.Dictionary || Dictionary))._new()).__eq(_st((smalltalk.Dictionary || Dictionary))._new()));
  1302. $1=_st((smalltalk.Dictionary || Dictionary))._new();
  1303. _st($1)._at_put_((1),(2));
  1304. $2=_st($1)._yourself();
  1305. d1=$2;
  1306. $3=_st((smalltalk.Dictionary || Dictionary))._new();
  1307. _st($3)._at_put_((1),(2));
  1308. $4=_st($3)._yourself();
  1309. d2=$4;
  1310. _st(self)._assert_(_st(d1).__eq(d2));
  1311. $5=_st((smalltalk.Dictionary || Dictionary))._new();
  1312. _st($5)._at_put_((1),(3));
  1313. $6=_st($5)._yourself();
  1314. d2=$6;
  1315. _st(self)._deny_(_st(d1).__eq(d2));
  1316. $7=_st((smalltalk.Dictionary || Dictionary))._new();
  1317. _st($7)._at_put_((2),(2));
  1318. $8=_st($7)._yourself();
  1319. d2=$8;
  1320. _st(self)._deny_(_st(d1).__eq(d2));
  1321. $9=_st((smalltalk.Dictionary || Dictionary))._new();
  1322. _st($9)._at_put_((1),(2));
  1323. _st($9)._at_put_((3),(4));
  1324. $10=_st($9)._yourself();
  1325. d2=$10;
  1326. _st(self)._deny_(_st(d1).__eq(d2));
  1327. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2}, smalltalk.DictionaryTest)})},
  1328. args: [],
  1329. 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.",
  1330. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  1331. referencedClasses: ["Dictionary"]
  1332. }),
  1333. smalltalk.DictionaryTest);
  1334. smalltalk.addMethod(
  1335. "_testIfAbsent",
  1336. smalltalk.method({
  1337. selector: "testIfAbsent",
  1338. category: 'tests',
  1339. fn: function () {
  1340. var self=this;
  1341. var d,visited;
  1342. return smalltalk.withContext(function($ctx1) {
  1343. visited=false;
  1344. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1345. _st(d)._at_ifAbsent_("hello",(function(){
  1346. return smalltalk.withContext(function($ctx2) {
  1347. visited=true;
  1348. return visited;
  1349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1350. _st(self)._assert_(visited);
  1351. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited}, smalltalk.DictionaryTest)});},
  1352. args: [],
  1353. 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.",
  1354. messageSends: ["new", "at:ifAbsent:", "assert:"],
  1355. referencedClasses: ["Dictionary"]
  1356. }),
  1357. smalltalk.DictionaryTest);
  1358. smalltalk.addMethod(
  1359. "_testIfPresent",
  1360. smalltalk.method({
  1361. selector: "testIfPresent",
  1362. category: 'tests',
  1363. fn: function (){
  1364. var self=this;
  1365. var d,visited,absent;
  1366. return smalltalk.withContext(function($ctx1) {
  1367. visited=false;
  1368. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1369. _st(d)._at_put_("hello","world");
  1370. _st(d)._at_ifPresent_("hello",(function(value){
  1371. return smalltalk.withContext(function($ctx2) {
  1372. visited=value;
  1373. return visited;
  1374. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1375. _st(self)._assert_equals_(visited,"world");
  1376. absent=_st(d)._at_ifPresent_("bye",(function(value){
  1377. return smalltalk.withContext(function($ctx2) {
  1378. visited=value;
  1379. return visited;
  1380. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1381. _st(self)._assert_(_st(absent)._isNil());
  1382. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent}, smalltalk.DictionaryTest)})},
  1383. args: [],
  1384. 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.",
  1385. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"],
  1386. referencedClasses: ["Dictionary"]
  1387. }),
  1388. smalltalk.DictionaryTest);
  1389. smalltalk.addMethod(
  1390. "_testIfPresentIfAbsent",
  1391. smalltalk.method({
  1392. selector: "testIfPresentIfAbsent",
  1393. category: 'tests',
  1394. fn: function (){
  1395. var self=this;
  1396. var d,visited;
  1397. return smalltalk.withContext(function($ctx1) {
  1398. visited=false;
  1399. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1400. _st(d)._at_put_("hello","world");
  1401. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  1402. return smalltalk.withContext(function($ctx2) {
  1403. visited=value;
  1404. return visited;
  1405. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1406. return smalltalk.withContext(function($ctx2) {
  1407. visited=true;
  1408. return visited;
  1409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1410. _st(self)._assert_equals_(visited,"world");
  1411. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  1412. return smalltalk.withContext(function($ctx2) {
  1413. visited=value;
  1414. return visited;
  1415. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1416. return smalltalk.withContext(function($ctx2) {
  1417. visited=true;
  1418. return visited;
  1419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1420. _st(self)._assert_(visited);
  1421. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited}, smalltalk.DictionaryTest)})},
  1422. args: [],
  1423. 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.",
  1424. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"],
  1425. referencedClasses: ["Dictionary"]
  1426. }),
  1427. smalltalk.DictionaryTest);
  1428. smalltalk.addMethod(
  1429. "_testKeys",
  1430. smalltalk.method({
  1431. selector: "testKeys",
  1432. category: 'tests',
  1433. fn: function (){
  1434. var self=this;
  1435. var d;
  1436. return smalltalk.withContext(function($ctx1) {
  1437. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1438. _st(d)._at_put_((1),(2));
  1439. _st(d)._at_put_((2),(3));
  1440. _st(d)._at_put_((3),(4));
  1441. _st(self)._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1442. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d}, smalltalk.DictionaryTest)})},
  1443. args: [],
  1444. 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)",
  1445. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  1446. referencedClasses: ["Dictionary"]
  1447. }),
  1448. smalltalk.DictionaryTest);
  1449. smalltalk.addMethod(
  1450. "_testPointKey",
  1451. smalltalk.method({
  1452. selector: "testPointKey",
  1453. category: 'tests',
  1454. fn: function (){
  1455. var self=this;
  1456. var d;
  1457. return smalltalk.withContext(function($ctx1) {
  1458. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1459. _st(d)._at_put_(_st((1)).__at((1)),"foo");
  1460. _st(self)._assert_equals_(_st(d)._at_(_st((1)).__at((1))),"foo");
  1461. _st(d)._at_put_(_st((1)).__at((1)),"bar");
  1462. _st(self)._assert_equals_(_st(d)._at_(_st((1)).__at((1))),"bar");
  1463. _st(d)._removeKey_(_st((1)).__at((1)));
  1464. _st(self)._assert_equals_(_st(d)._at_ifAbsent_(_st((1)).__at((1)),(function(){
  1465. return smalltalk.withContext(function($ctx2) {
  1466. return "baz";
  1467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"baz");
  1468. _st(self)._deny_(_st(d)._includesKey_(_st((1)).__at((1))));
  1469. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d}, smalltalk.DictionaryTest)})},
  1470. args: [],
  1471. source: "testPointKey\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a \x0a d at: 1@1 put: 'foo'.\x0a\x09self assert: (d at: 1@1) equals: 'foo'.\x0a d at: 1@1 put: 'bar'.\x0a\x09self assert: (d at: 1@1) equals: 'bar'.\x0a d removeKey: 1@1.\x0a self assert: (d at: 1@1 ifAbsent: [ 'baz' ]) equals: 'baz'.\x0a self deny: (d includesKey: 1@1)",
  1472. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  1473. referencedClasses: ["Dictionary"]
  1474. }),
  1475. smalltalk.DictionaryTest);
  1476. smalltalk.addMethod(
  1477. "_testPrintString",
  1478. smalltalk.method({
  1479. selector: "testPrintString",
  1480. category: 'tests',
  1481. fn: function (){
  1482. var self=this;
  1483. return smalltalk.withContext(function($ctx1) {
  1484. var $1,$2;
  1485. $1=_st((smalltalk.Dictionary || Dictionary))._new();
  1486. _st($1)._at_put_("firstname","James");
  1487. _st($1)._at_put_("lastname","Bond");
  1488. $2=_st($1)._printString();
  1489. _st(self)._assert_equals_($2,"a Dictionary('firstname'->'James' , 'lastname'->'Bond')");
  1490. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{}, smalltalk.DictionaryTest)})},
  1491. args: [],
  1492. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (Dictionary new \x0a \x09at:'firstname' put: 'James';\x0a \x09at:'lastname' put: 'Bond';\x0a \x09printString)\x0a\x09\x09equals: 'a Dictionary(''firstname''->''James'' , ''lastname''->''Bond'')' ",
  1493. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  1494. referencedClasses: ["Dictionary"]
  1495. }),
  1496. smalltalk.DictionaryTest);
  1497. smalltalk.addMethod(
  1498. "_testRemoveKey",
  1499. smalltalk.method({
  1500. selector: "testRemoveKey",
  1501. category: 'tests',
  1502. fn: function (){
  1503. var self=this;
  1504. var d,key;
  1505. return smalltalk.withContext(function($ctx1) {
  1506. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1507. _st(d)._at_put_((1),(2));
  1508. _st(d)._at_put_((2),(3));
  1509. _st(d)._at_put_((3),(4));
  1510. key=(2);
  1511. _st(self)._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1512. _st(d)._removeKey_(key);
  1513. _st(self)._assert_equals_(_st(d)._keys(),[(1), (3)]);
  1514. _st(self)._assert_equals_(_st(d)._values(),[(2), (4)]);
  1515. _st(self)._deny_(_st(d)._includesKey_((2)));
  1516. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key}, smalltalk.DictionaryTest)})},
  1517. args: [],
  1518. source: "testRemoveKey\x0a | d key |\x0a\x0a d := Dictionary new.\x0a d at: 1 put: 2.\x0a d at: 2 put: 3.\x0a d at: 3 put: 4.\x0a\x0a key := 2.\x0a\x0a self assert: d keys equals: #(1 2 3).\x0a\x0a d removeKey: key.\x0a self assert: d keys equals: #(1 3).\x0a self assert: d values equals: #(2 4).\x0a self deny: (d includesKey: 2)",
  1519. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  1520. referencedClasses: ["Dictionary"]
  1521. }),
  1522. smalltalk.DictionaryTest);
  1523. smalltalk.addMethod(
  1524. "_testRemoveKeyIfAbsent",
  1525. smalltalk.method({
  1526. selector: "testRemoveKeyIfAbsent",
  1527. category: 'tests',
  1528. fn: function (){
  1529. var self=this;
  1530. var d,key;
  1531. return smalltalk.withContext(function($ctx1) {
  1532. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1533. _st(d)._at_put_((1),(2));
  1534. _st(d)._at_put_((2),(3));
  1535. _st(d)._at_put_((3),(4));
  1536. key=(2);
  1537. _st(self)._assert_equals_(_st(d)._removeKey_(key),(3));
  1538. key=(3);
  1539. _st(self)._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1540. return smalltalk.withContext(function($ctx2) {
  1541. return (42);
  1542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(4));
  1543. key="why";
  1544. _st(self)._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1545. return smalltalk.withContext(function($ctx2) {
  1546. return (42);
  1547. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(42));
  1548. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key}, smalltalk.DictionaryTest)})},
  1549. args: [],
  1550. source: "testRemoveKeyIfAbsent\x0a | d key |\x0a\x0a d := Dictionary new.\x0a d at: 1 put: 2.\x0a d at: 2 put: 3.\x0a d at: 3 put: 4.\x0a\x0a key := 2.\x0a self assert: (d removeKey: key) equals: 3.\x0a\x0a key := 3.\x0a self assert: (d removeKey: key ifAbsent: [42]) equals: 4.\x0a\x0a key := 'why'.\x0a self assert: (d removeKey: key ifAbsent: [42] ) equals: 42.",
  1551. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  1552. referencedClasses: ["Dictionary"]
  1553. }),
  1554. smalltalk.DictionaryTest);
  1555. smalltalk.addMethod(
  1556. "_testSize",
  1557. smalltalk.method({
  1558. selector: "testSize",
  1559. category: 'tests',
  1560. fn: function (){
  1561. var self=this;
  1562. var d;
  1563. return smalltalk.withContext(function($ctx1) {
  1564. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1565. _st(self)._assert_equals_(_st(d)._size(),(0));
  1566. _st(d)._at_put_((1),(2));
  1567. _st(self)._assert_equals_(_st(d)._size(),(1));
  1568. _st(d)._at_put_((2),(3));
  1569. _st(self)._assert_equals_(_st(d)._size(),(2));
  1570. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d}, smalltalk.DictionaryTest)})},
  1571. args: [],
  1572. 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.",
  1573. messageSends: ["new", "assert:equals:", "size", "at:put:"],
  1574. referencedClasses: ["Dictionary"]
  1575. }),
  1576. smalltalk.DictionaryTest);
  1577. smalltalk.addMethod(
  1578. "_testValues",
  1579. smalltalk.method({
  1580. selector: "testValues",
  1581. category: 'tests',
  1582. fn: function (){
  1583. var self=this;
  1584. var d;
  1585. return smalltalk.withContext(function($ctx1) {
  1586. d=_st((smalltalk.Dictionary || Dictionary))._new();
  1587. _st(d)._at_put_((1),(2));
  1588. _st(d)._at_put_((2),(3));
  1589. _st(d)._at_put_((3),(4));
  1590. _st(self)._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  1591. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d}, smalltalk.DictionaryTest)})},
  1592. args: [],
  1593. 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)",
  1594. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  1595. referencedClasses: ["Dictionary"]
  1596. }),
  1597. smalltalk.DictionaryTest);
  1598. smalltalk.addMethod(
  1599. "_collectionClass",
  1600. smalltalk.method({
  1601. selector: "collectionClass",
  1602. category: 'accessing',
  1603. fn: function () {
  1604. var self=this;
  1605. return smalltalk.withContext(function($ctx1) {
  1606. var $1;
  1607. $1=(smalltalk.Dictionary || Dictionary);
  1608. return $1;
  1609. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.DictionaryTest.klass)});},
  1610. args: [],
  1611. source: "collectionClass\x0a\x09^ Dictionary",
  1612. messageSends: [],
  1613. referencedClasses: ["Dictionary"]
  1614. }),
  1615. smalltalk.DictionaryTest.klass);
  1616. smalltalk.addClass('SequenceableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1617. smalltalk.addMethod(
  1618. "_testAt",
  1619. smalltalk.method({
  1620. selector: "testAt",
  1621. category: 'tests',
  1622. fn: function (){
  1623. var self=this;
  1624. return smalltalk.withContext(function($ctx1) {
  1625. _st(self)._assert_equals_(_st(_st(self)._collection())._at_((4)),(-4));
  1626. _st(self)._should_raise_((function(){
  1627. return smalltalk.withContext(function($ctx2) {
  1628. return _st(_st(self)._collection())._at_((5));
  1629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1630. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.SequenceableCollectionTest)})},
  1631. args: [],
  1632. source: "testAt\x0a\x09self assert: (self collection at: 4) equals: -4.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1633. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1634. referencedClasses: ["Error"]
  1635. }),
  1636. smalltalk.SequenceableCollectionTest);
  1637. smalltalk.addMethod(
  1638. "_testAtIfAbsent",
  1639. smalltalk.method({
  1640. selector: "testAtIfAbsent",
  1641. category: 'tests',
  1642. fn: function (){
  1643. var self=this;
  1644. return smalltalk.withContext(function($ctx1) {
  1645. _st(self)._assert_equals_(_st(_st(self)._collection())._at_ifAbsent_(_st(_st(_st(self)._collection())._size()).__plus((1)),(function(){
  1646. return smalltalk.withContext(function($ctx2) {
  1647. return "none";
  1648. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"none");
  1649. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{}, smalltalk.SequenceableCollectionTest)})},
  1650. args: [],
  1651. source: "testAtIfAbsent\x0a\x09self assert: (self collection at: (self collection size + 1) ifAbsent: [ 'none' ]) equals: 'none'",
  1652. messageSends: ["assert:equals:", "at:ifAbsent:", "+", "size", "collection"],
  1653. referencedClasses: []
  1654. }),
  1655. smalltalk.SequenceableCollectionTest);
  1656. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1657. smalltalk.addMethod(
  1658. "_testAtIfAbsent",
  1659. smalltalk.method({
  1660. selector: "testAtIfAbsent",
  1661. category: 'tests',
  1662. fn: function () {
  1663. var self=this;
  1664. var array;
  1665. return smalltalk.withContext(function($ctx1) {
  1666. array=["hello", "world"];
  1667. _st(self)._assert_equals_(_st(array)._at_((1)),"hello");
  1668. _st(self)._assert_equals_(_st(array)._at_((2)),"world");
  1669. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((2),(function(){
  1670. return smalltalk.withContext(function($ctx2) {
  1671. return "not found";
  1672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"world");
  1673. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((0),(function(){
  1674. return smalltalk.withContext(function($ctx2) {
  1675. return "not found";
  1676. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1677. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((-10),(function(){
  1678. return smalltalk.withContext(function($ctx2) {
  1679. return "not found";
  1680. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1681. _st(self)._assert_equals_(_st(array)._at_ifAbsent_((3),(function(){
  1682. return smalltalk.withContext(function($ctx2) {
  1683. return "not found";
  1684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1685. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array}, smalltalk.ArrayTest)});},
  1686. args: [],
  1687. 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'.",
  1688. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  1689. referencedClasses: []
  1690. }),
  1691. smalltalk.ArrayTest);
  1692. smalltalk.addMethod(
  1693. "_testFirstN",
  1694. smalltalk.method({
  1695. selector: "testFirstN",
  1696. category: 'tests',
  1697. fn: function (){
  1698. var self=this;
  1699. return smalltalk.withContext(function($ctx1) {
  1700. _st(self)._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  1701. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{}, smalltalk.ArrayTest)})},
  1702. args: [],
  1703. source: "testFirstN\x0a\x09self assert: ({1. 2. 3. 4. 5} first: 3) equals: {1. 2. 3}",
  1704. messageSends: ["assert:equals:", "first:"],
  1705. referencedClasses: []
  1706. }),
  1707. smalltalk.ArrayTest);
  1708. smalltalk.addMethod(
  1709. "_testIfEmpty",
  1710. smalltalk.method({
  1711. selector: "testIfEmpty",
  1712. category: 'tests',
  1713. fn: function (){
  1714. var self=this;
  1715. return smalltalk.withContext(function($ctx1) {
  1716. _st(self)._assert_equals_(_st("")._ifEmpty_((function(){
  1717. return smalltalk.withContext(function($ctx2) {
  1718. return "zork";
  1719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"zork");
  1720. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{}, smalltalk.ArrayTest)})},
  1721. args: [],
  1722. source: "testIfEmpty\x0a\x09self assert: ( '' ifEmpty: ['zork'] ) equals: 'zork'",
  1723. messageSends: ["assert:equals:", "ifEmpty:"],
  1724. referencedClasses: []
  1725. }),
  1726. smalltalk.ArrayTest);
  1727. smalltalk.addMethod(
  1728. "_testPrintString",
  1729. smalltalk.method({
  1730. selector: "testPrintString",
  1731. category: 'tests',
  1732. fn: function (){
  1733. var self=this;
  1734. var array;
  1735. return smalltalk.withContext(function($ctx1) {
  1736. var $1,$2,$3,$4;
  1737. array=_st((smalltalk.Array || Array))._new();
  1738. _st(self)._assert_equals_(_st(array)._printString(),"a Array ()");
  1739. $1=array;
  1740. _st($1)._add_((1));
  1741. $2=_st($1)._add_((3));
  1742. _st(self)._assert_equals_(_st(array)._printString(),"a Array (1 3)");
  1743. _st(array)._add_("foo");
  1744. _st(self)._assert_equals_(_st(array)._printString(),"a Array (1 3 'foo')");
  1745. $3=array;
  1746. _st($3)._remove_((1));
  1747. $4=_st($3)._remove_((3));
  1748. _st(self)._assert_equals_(_st(array)._printString(),"a Array ('foo')");
  1749. _st(array)._addLast_((3));
  1750. _st(self)._assert_equals_(_st(array)._printString(),"a Array ('foo' 3)");
  1751. _st(array)._addLast_((3));
  1752. _st(self)._assert_equals_(_st(array)._printString(),"a Array ('foo' 3 3)");
  1753. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array}, smalltalk.ArrayTest)})},
  1754. args: [],
  1755. source: "testPrintString\x0a\x09| array |\x0a\x09array := Array new.\x0a\x09self assert: array printString equals: 'a Array ()'.\x0a\x09array add: 1; add: 3.\x0a\x09self assert: array printString equals: 'a Array (1 3)'.\x0a\x09array add: 'foo'.\x0a\x09self assert: array printString equals: 'a Array (1 3 ''foo'')'.\x0a\x09array remove: 1; remove: 3.\x0a\x09self assert: array printString equals: 'a Array (''foo'')'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'a Array (''foo'' 3)'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'a Array (''foo'' 3 3)'.",
  1756. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  1757. referencedClasses: ["Array"]
  1758. }),
  1759. smalltalk.ArrayTest);
  1760. smalltalk.addMethod(
  1761. "_collectionClass",
  1762. smalltalk.method({
  1763. selector: "collectionClass",
  1764. category: 'accessing',
  1765. fn: function () {
  1766. var self=this;
  1767. return smalltalk.withContext(function($ctx1) {
  1768. var $1;
  1769. $1=(smalltalk.Array || Array);
  1770. return $1;
  1771. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.ArrayTest.klass)});},
  1772. args: [],
  1773. source: "collectionClass\x0a\x09^ Array",
  1774. messageSends: [],
  1775. referencedClasses: ["Array"]
  1776. }),
  1777. smalltalk.ArrayTest.klass);
  1778. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1779. smalltalk.addMethod(
  1780. "_collection",
  1781. smalltalk.method({
  1782. selector: "collection",
  1783. category: 'accessing',
  1784. fn: function () {
  1785. var self=this;
  1786. return smalltalk.withContext(function($ctx1) {
  1787. return "hello";
  1788. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.StringTest)});},
  1789. args: [],
  1790. source: "collection\x0a\x09^'hello'",
  1791. messageSends: [],
  1792. referencedClasses: []
  1793. }),
  1794. smalltalk.StringTest);
  1795. smalltalk.addMethod(
  1796. "_collectionWithDuplicates",
  1797. smalltalk.method({
  1798. selector: "collectionWithDuplicates",
  1799. category: 'accessing',
  1800. fn: function () {
  1801. var self=this;
  1802. return smalltalk.withContext(function($ctx1) {
  1803. return "abbaerte";
  1804. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.StringTest)});},
  1805. args: [],
  1806. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  1807. messageSends: [],
  1808. referencedClasses: []
  1809. }),
  1810. smalltalk.StringTest);
  1811. smalltalk.addMethod(
  1812. "_testAddRemove",
  1813. smalltalk.method({
  1814. selector: "testAddRemove",
  1815. category: 'tests',
  1816. fn: function () {
  1817. var self=this;
  1818. return smalltalk.withContext(function($ctx1) {
  1819. _st(self)._should_raise_((function(){
  1820. return smalltalk.withContext(function($ctx2) {
  1821. return _st("hello")._add_("a");
  1822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1823. _st(self)._should_raise_((function(){
  1824. return smalltalk.withContext(function($ctx2) {
  1825. return _st("hello")._remove_("h");
  1826. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1827. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{}, smalltalk.StringTest)});},
  1828. args: [],
  1829. source: "testAddRemove\x0a\x09self should: ['hello' add: 'a'] raise: Error.\x0a\x09self should: ['hello' remove: 'h'] raise: Error",
  1830. messageSends: ["should:raise:", "add:", "remove:"],
  1831. referencedClasses: ["Error"]
  1832. }),
  1833. smalltalk.StringTest);
  1834. smalltalk.addMethod(
  1835. "_testAsArray",
  1836. smalltalk.method({
  1837. selector: "testAsArray",
  1838. category: 'tests',
  1839. fn: function (){
  1840. var self=this;
  1841. return smalltalk.withContext(function($ctx1) {
  1842. _st(self)._assert_equals_(_st("hello")._asArray(),["h", "e", "l", "l", "o"]);
  1843. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{}, smalltalk.StringTest)})},
  1844. args: [],
  1845. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  1846. messageSends: ["assert:equals:", "asArray"],
  1847. referencedClasses: []
  1848. }),
  1849. smalltalk.StringTest);
  1850. smalltalk.addMethod(
  1851. "_testAt",
  1852. smalltalk.method({
  1853. selector: "testAt",
  1854. category: 'tests',
  1855. fn: function (){
  1856. var self=this;
  1857. return smalltalk.withContext(function($ctx1) {
  1858. _st(self)._assert_equals_(_st("hello")._at_((1)),"h");
  1859. _st(self)._assert_equals_(_st("hello")._at_((5)),"o");
  1860. _st(self)._assert_equals_(_st("hello")._at_ifAbsent_((6),(function(){
  1861. return smalltalk.withContext(function($ctx2) {
  1862. return nil;
  1863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  1864. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.StringTest)})},
  1865. args: [],
  1866. 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",
  1867. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  1868. referencedClasses: []
  1869. }),
  1870. smalltalk.StringTest);
  1871. smalltalk.addMethod(
  1872. "_testAtPut",
  1873. smalltalk.method({
  1874. selector: "testAtPut",
  1875. category: 'tests',
  1876. fn: function () {
  1877. var self=this;
  1878. return smalltalk.withContext(function($ctx1) {
  1879. _st(self)._should_raise_((function(){
  1880. return smalltalk.withContext(function($ctx2) {
  1881. return _st("hello")._at_put_((1),"a");
  1882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1883. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{}, smalltalk.StringTest)});},
  1884. args: [],
  1885. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  1886. messageSends: ["should:raise:", "at:put:"],
  1887. referencedClasses: ["Error"]
  1888. }),
  1889. smalltalk.StringTest);
  1890. smalltalk.addMethod(
  1891. "_testCollect",
  1892. smalltalk.method({
  1893. selector: "testCollect",
  1894. category: 'tests',
  1895. fn: function () {
  1896. var self=this;
  1897. var newCollection;
  1898. return smalltalk.withContext(function($ctx1) {
  1899. newCollection="hheelllloo";
  1900. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  1901. return smalltalk.withContext(function($ctx2) {
  1902. return _st(each).__comma(each);
  1903. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1904. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection}, smalltalk.StringTest)});},
  1905. args: [],
  1906. 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",
  1907. messageSends: ["assertSameContents:as:", "collect:", ",", "collection"],
  1908. referencedClasses: []
  1909. }),
  1910. smalltalk.StringTest);
  1911. smalltalk.addMethod(
  1912. "_testCopyWithoutAll",
  1913. smalltalk.method({
  1914. selector: "testCopyWithoutAll",
  1915. category: 'tests',
  1916. fn: function (){
  1917. var self=this;
  1918. return smalltalk.withContext(function($ctx1) {
  1919. _st(self)._assert_equals_(_st("*hello* *world*")._copyWithoutAll_("*"),"hello world");
  1920. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{}, smalltalk.StringTest)})},
  1921. args: [],
  1922. source: "testCopyWithoutAll\x0a\x09self \x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a equals: 'hello world'",
  1923. messageSends: ["assert:equals:", "copyWithoutAll:"],
  1924. referencedClasses: []
  1925. }),
  1926. smalltalk.StringTest);
  1927. smalltalk.addMethod(
  1928. "_testDetect",
  1929. smalltalk.method({
  1930. selector: "testDetect",
  1931. category: 'tests',
  1932. fn: function (){
  1933. var self=this;
  1934. return smalltalk.withContext(function($ctx1) {
  1935. _st(self)._assert_equals_(_st(_st(self)._collection())._detect_((function(each){
  1936. return smalltalk.withContext(function($ctx2) {
  1937. return _st(each).__eq("h");
  1938. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),"h");
  1939. _st(self)._should_raise_((function(){
  1940. return smalltalk.withContext(function($ctx2) {
  1941. return _st(_st(self)._collection())._detect_((function(each){
  1942. return smalltalk.withContext(function($ctx3) {
  1943. return _st(each).__eq((6));
  1944. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  1945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  1946. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{}, smalltalk.StringTest)})},
  1947. args: [],
  1948. 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",
  1949. messageSends: ["assert:equals:", "detect:", "=", "collection", "should:raise:"],
  1950. referencedClasses: ["Error"]
  1951. }),
  1952. smalltalk.StringTest);
  1953. smalltalk.addMethod(
  1954. "_testEquality",
  1955. smalltalk.method({
  1956. selector: "testEquality",
  1957. category: 'tests',
  1958. fn: function (){
  1959. var self=this;
  1960. return smalltalk.withContext(function($ctx1) {
  1961. _st(self)._assert_equals_("hello","hello");
  1962. _st(self)._deny_(_st("hello").__eq("world"));
  1963. _st(self)._assert_equals_("hello",_st("hello")._yourself());
  1964. _st(self)._assert_equals_(_st("hello")._yourself(),"hello");
  1965. _st(self)._deny_(_st("").__eq((0)));
  1966. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{}, smalltalk.StringTest)})},
  1967. args: [],
  1968. source: "testEquality\x0a\x09self assert: 'hello' equals: 'hello'.\x0a\x09self deny: 'hello' = 'world'.\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",
  1969. messageSends: ["assert:equals:", "deny:", "=", "yourself"],
  1970. referencedClasses: []
  1971. }),
  1972. smalltalk.StringTest);
  1973. smalltalk.addMethod(
  1974. "_testIdentity",
  1975. smalltalk.method({
  1976. selector: "testIdentity",
  1977. category: 'tests',
  1978. fn: function () {
  1979. var self=this;
  1980. return smalltalk.withContext(function($ctx1) {
  1981. _st(self)._assert_(_st("hello").__eq_eq("hello"));
  1982. _st(self)._deny_(_st("hello").__eq_eq("world"));
  1983. _st(self)._assert_(_st("hello").__eq_eq(_st("hello")._yourself()));
  1984. _st(self)._assert_(_st(_st("hello")._yourself()).__eq_eq("hello"));
  1985. _st(self)._deny_(_st("").__eq_eq((0)));
  1986. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{}, smalltalk.StringTest)});},
  1987. args: [],
  1988. 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",
  1989. messageSends: ["assert:", "==", "deny:", "yourself"],
  1990. referencedClasses: []
  1991. }),
  1992. smalltalk.StringTest);
  1993. smalltalk.addMethod(
  1994. "_testIncludesSubString",
  1995. smalltalk.method({
  1996. selector: "testIncludesSubString",
  1997. category: 'tests',
  1998. fn: function () {
  1999. var self=this;
  2000. return smalltalk.withContext(function($ctx1) {
  2001. _st(self)._assert_(_st("amber")._includesSubString_("ber"));
  2002. _st(self)._deny_(_st("amber")._includesSubString_("zork"));
  2003. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{}, smalltalk.StringTest)});},
  2004. args: [],
  2005. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  2006. messageSends: ["assert:", "includesSubString:", "deny:"],
  2007. referencedClasses: []
  2008. }),
  2009. smalltalk.StringTest);
  2010. smalltalk.addMethod(
  2011. "_testJoin",
  2012. smalltalk.method({
  2013. selector: "testJoin",
  2014. category: 'tests',
  2015. fn: function (){
  2016. var self=this;
  2017. return smalltalk.withContext(function($ctx1) {
  2018. _st(self)._assert_equals_(_st(",")._join_(["hello", "world"]),"hello,world");
  2019. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{}, smalltalk.StringTest)})},
  2020. args: [],
  2021. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  2022. messageSends: ["assert:equals:", "join:"],
  2023. referencedClasses: []
  2024. }),
  2025. smalltalk.StringTest);
  2026. smalltalk.addMethod(
  2027. "_testSelect",
  2028. smalltalk.method({
  2029. selector: "testSelect",
  2030. category: 'tests',
  2031. fn: function () {
  2032. var self=this;
  2033. var newCollection;
  2034. return smalltalk.withContext(function($ctx1) {
  2035. newCollection="o";
  2036. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  2037. return smalltalk.withContext(function($ctx2) {
  2038. return _st(each).__eq("o");
  2039. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  2040. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection}, smalltalk.StringTest)});},
  2041. args: [],
  2042. 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",
  2043. messageSends: ["assertSameContents:as:", "select:", "=", "collection"],
  2044. referencedClasses: []
  2045. }),
  2046. smalltalk.StringTest);
  2047. smalltalk.addMethod(
  2048. "_testSize",
  2049. smalltalk.method({
  2050. selector: "testSize",
  2051. category: 'tests',
  2052. fn: function () {
  2053. var self=this;
  2054. return smalltalk.withContext(function($ctx1) {
  2055. _st(self)._assert_equals_(_st("smalltalk")._size(),(9));
  2056. _st(self)._assert_equals_(_st("")._size(),(0));
  2057. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{}, smalltalk.StringTest)});},
  2058. args: [],
  2059. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  2060. messageSends: ["assert:equals:", "size"],
  2061. referencedClasses: []
  2062. }),
  2063. smalltalk.StringTest);
  2064. smalltalk.addMethod(
  2065. "_testStreamContents",
  2066. smalltalk.method({
  2067. selector: "testStreamContents",
  2068. category: 'tests',
  2069. fn: function (){
  2070. var self=this;
  2071. return smalltalk.withContext(function($ctx1) {
  2072. var $1,$2;
  2073. _st(self)._assert_equals_(_st((smalltalk.String || String))._streamContents_((function(aStream){
  2074. return smalltalk.withContext(function($ctx2) {
  2075. $1=aStream;
  2076. _st($1)._nextPutAll_("hello");
  2077. _st($1)._space();
  2078. $2=_st($1)._nextPutAll_("world");
  2079. return $2;
  2080. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})})),"hello world");
  2081. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{}, smalltalk.StringTest)})},
  2082. args: [],
  2083. 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'",
  2084. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  2085. referencedClasses: ["String"]
  2086. }),
  2087. smalltalk.StringTest);
  2088. smalltalk.addMethod(
  2089. "_collectionClass",
  2090. smalltalk.method({
  2091. selector: "collectionClass",
  2092. category: 'accessing',
  2093. fn: function () {
  2094. var self=this;
  2095. return smalltalk.withContext(function($ctx1) {
  2096. var $1;
  2097. $1=(smalltalk.String || String);
  2098. return $1;
  2099. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.StringTest.klass)});},
  2100. args: [],
  2101. source: "collectionClass\x0a\x09^ String",
  2102. messageSends: [],
  2103. referencedClasses: ["String"]
  2104. }),
  2105. smalltalk.StringTest.klass);
  2106. smalltalk.addClass('SymbolTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2107. smalltalk.addMethod(
  2108. "_collection",
  2109. smalltalk.method({
  2110. selector: "collection",
  2111. category: 'accessing',
  2112. fn: function () {
  2113. var self=this;
  2114. return smalltalk.withContext(function($ctx1) {
  2115. return smalltalk.symbolFor("hello");
  2116. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.SymbolTest)});},
  2117. args: [],
  2118. source: "collection\x0a\x09^ #hello",
  2119. messageSends: [],
  2120. referencedClasses: []
  2121. }),
  2122. smalltalk.SymbolTest);
  2123. smalltalk.addMethod(
  2124. "_collectionWithDuplicates",
  2125. smalltalk.method({
  2126. selector: "collectionWithDuplicates",
  2127. category: 'accessing',
  2128. fn: function () {
  2129. var self=this;
  2130. return smalltalk.withContext(function($ctx1) {
  2131. return smalltalk.symbolFor("phhaaarorra");
  2132. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{}, smalltalk.SymbolTest)});},
  2133. args: [],
  2134. source: "collectionWithDuplicates\x0a\x09^ #phhaaarorra",
  2135. messageSends: [],
  2136. referencedClasses: []
  2137. }),
  2138. smalltalk.SymbolTest);
  2139. smalltalk.addMethod(
  2140. "_testAsString",
  2141. smalltalk.method({
  2142. selector: "testAsString",
  2143. category: 'tests',
  2144. fn: function () {
  2145. var self=this;
  2146. return smalltalk.withContext(function($ctx1) {
  2147. _st(self)._assert_equals_(_st(smalltalk.symbolFor("hello"))._asString(),"hello");
  2148. return self}, function($ctx1) {$ctx1.fill(self,"testAsString",{}, smalltalk.SymbolTest)});},
  2149. args: [],
  2150. source: "testAsString\x0a\x09self assert: #hello asString equals: 'hello'",
  2151. messageSends: ["assert:equals:", "asString"],
  2152. referencedClasses: []
  2153. }),
  2154. smalltalk.SymbolTest);
  2155. smalltalk.addMethod(
  2156. "_testAsSymbol",
  2157. smalltalk.method({
  2158. selector: "testAsSymbol",
  2159. category: 'tests',
  2160. fn: function () {
  2161. var self=this;
  2162. return smalltalk.withContext(function($ctx1) {
  2163. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq_eq(_st(smalltalk.symbolFor("hello"))._asSymbol()));
  2164. return self}, function($ctx1) {$ctx1.fill(self,"testAsSymbol",{}, smalltalk.SymbolTest)});},
  2165. args: [],
  2166. source: "testAsSymbol\x0a\x09self assert: #hello == #hello asSymbol",
  2167. messageSends: ["assert:", "==", "asSymbol"],
  2168. referencedClasses: []
  2169. }),
  2170. smalltalk.SymbolTest);
  2171. smalltalk.addMethod(
  2172. "_testAt",
  2173. smalltalk.method({
  2174. selector: "testAt",
  2175. category: 'tests',
  2176. fn: function (){
  2177. var self=this;
  2178. return smalltalk.withContext(function($ctx1) {
  2179. _st(self)._assert_equals_(_st(smalltalk.symbolFor("hello"))._at_((1)),"h");
  2180. _st(self)._assert_equals_(_st(smalltalk.symbolFor("hello"))._at_((5)),"o");
  2181. _st(self)._assert_equals_(_st(smalltalk.symbolFor("hello"))._at_ifAbsent_((6),(function(){
  2182. return smalltalk.withContext(function($ctx2) {
  2183. return nil;
  2184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2185. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.SymbolTest)})},
  2186. args: [],
  2187. 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",
  2188. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2189. referencedClasses: []
  2190. }),
  2191. smalltalk.SymbolTest);
  2192. smalltalk.addMethod(
  2193. "_testAtPut",
  2194. smalltalk.method({
  2195. selector: "testAtPut",
  2196. category: 'tests',
  2197. fn: function () {
  2198. var self=this;
  2199. return smalltalk.withContext(function($ctx1) {
  2200. _st(self)._should_raise_((function(){
  2201. return smalltalk.withContext(function($ctx2) {
  2202. return _st("hello")._at_put_((1),"a");
  2203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  2204. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{}, smalltalk.SymbolTest)});},
  2205. args: [],
  2206. source: "testAtPut\x0a\x09\x22Symbol instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  2207. messageSends: ["should:raise:", "at:put:"],
  2208. referencedClasses: ["Error"]
  2209. }),
  2210. smalltalk.SymbolTest);
  2211. smalltalk.addMethod(
  2212. "_testCollect",
  2213. smalltalk.method({
  2214. selector: "testCollect",
  2215. category: 'tests',
  2216. fn: function () {
  2217. var self=this;
  2218. var newCollection;
  2219. return smalltalk.withContext(function($ctx1) {
  2220. newCollection=smalltalk.symbolFor("hheelllloo");
  2221. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._collect_((function(each){
  2222. return smalltalk.withContext(function($ctx2) {
  2223. return _st(each).__comma(each);
  2224. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  2225. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection}, smalltalk.SymbolTest)});},
  2226. args: [],
  2227. 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",
  2228. messageSends: ["assertSameContents:as:", "collect:", ",", "collection"],
  2229. referencedClasses: []
  2230. }),
  2231. smalltalk.SymbolTest);
  2232. smalltalk.addMethod(
  2233. "_testComparing",
  2234. smalltalk.method({
  2235. selector: "testComparing",
  2236. category: 'tests',
  2237. fn: function () {
  2238. var self=this;
  2239. return smalltalk.withContext(function($ctx1) {
  2240. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__gt(smalltalk.symbolFor("aa")));
  2241. _st(self)._deny_(_st(smalltalk.symbolFor("ab")).__gt(smalltalk.symbolFor("ba")));
  2242. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__lt(smalltalk.symbolFor("ba")));
  2243. _st(self)._deny_(_st(smalltalk.symbolFor("bb")).__lt(smalltalk.symbolFor("ba")));
  2244. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__gt_eq(smalltalk.symbolFor("aa")));
  2245. _st(self)._deny_(_st(smalltalk.symbolFor("ab")).__gt_eq(smalltalk.symbolFor("ba")));
  2246. _st(self)._assert_(_st(smalltalk.symbolFor("ab")).__lt_eq(smalltalk.symbolFor("ba")));
  2247. _st(self)._deny_(_st(smalltalk.symbolFor("bb")).__lt_eq(smalltalk.symbolFor("ba")));
  2248. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{}, smalltalk.SymbolTest)});},
  2249. args: [],
  2250. source: "testComparing\x0a\x09self assert: #ab > #aa.\x0a\x09self deny: #ab > #ba.\x0a\x0a\x09self assert: #ab < #ba.\x0a\x09self deny: #bb < #ba.\x0a\x0a\x09self assert: #ab >= #aa.\x0a\x09self deny: #ab >= #ba.\x0a\x0a\x09self assert: #ab <= #ba.\x0a\x09self deny: #bb <= #ba",
  2251. messageSends: ["assert:", ">", "deny:", "<", ">=", "<="],
  2252. referencedClasses: []
  2253. }),
  2254. smalltalk.SymbolTest);
  2255. smalltalk.addMethod(
  2256. "_testCopying",
  2257. smalltalk.method({
  2258. selector: "testCopying",
  2259. category: 'tests',
  2260. fn: function () {
  2261. var self=this;
  2262. return smalltalk.withContext(function($ctx1) {
  2263. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._copy()).__eq_eq(smalltalk.symbolFor("hello")));
  2264. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._deepCopy()).__eq_eq(smalltalk.symbolFor("hello")));
  2265. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{}, smalltalk.SymbolTest)});},
  2266. args: [],
  2267. source: "testCopying\x0a\x09self assert: #hello copy == #hello.\x0a\x09self assert: #hello deepCopy == #hello",
  2268. messageSends: ["assert:", "==", "copy", "deepCopy"],
  2269. referencedClasses: []
  2270. }),
  2271. smalltalk.SymbolTest);
  2272. smalltalk.addMethod(
  2273. "_testDetect",
  2274. smalltalk.method({
  2275. selector: "testDetect",
  2276. category: 'tests',
  2277. fn: function (){
  2278. var self=this;
  2279. return smalltalk.withContext(function($ctx1) {
  2280. _st(self)._assert_equals_(_st(_st(self)._collection())._detect_((function(each){
  2281. return smalltalk.withContext(function($ctx2) {
  2282. return _st(each).__eq("h");
  2283. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),"h");
  2284. _st(self)._should_raise_((function(){
  2285. return smalltalk.withContext(function($ctx2) {
  2286. return _st(_st(self)._collection())._detect_((function(each){
  2287. return smalltalk.withContext(function($ctx3) {
  2288. return _st(each).__eq("z");
  2289. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  2290. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  2291. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{}, smalltalk.SymbolTest)})},
  2292. args: [],
  2293. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each = 'h' ]) equals: 'h'.\x0a\x09self \x0a\x09\x09should: [ self collection detect: [ :each | each = 'z' ] ]\x0a\x09\x09raise: Error",
  2294. messageSends: ["assert:equals:", "detect:", "=", "collection", "should:raise:"],
  2295. referencedClasses: ["Error"]
  2296. }),
  2297. smalltalk.SymbolTest);
  2298. smalltalk.addMethod(
  2299. "_testEquality",
  2300. smalltalk.method({
  2301. selector: "testEquality",
  2302. category: 'tests',
  2303. fn: function (){
  2304. var self=this;
  2305. return smalltalk.withContext(function($ctx1) {
  2306. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(smalltalk.symbolFor("hello")));
  2307. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq(smalltalk.symbolFor("world")));
  2308. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(_st(smalltalk.symbolFor("hello"))._yourself()));
  2309. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._yourself()).__eq(smalltalk.symbolFor("hello")));
  2310. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq("hello"));
  2311. _st(self)._deny_(_st("hello").__eq(smalltalk.symbolFor("hello")));
  2312. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{}, smalltalk.SymbolTest)})},
  2313. args: [],
  2314. source: "testEquality\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\x09self deny: #hello = 'hello'.\x0a\x09self deny: 'hello' = #hello.",
  2315. messageSends: ["assert:", "=", "deny:", "yourself"],
  2316. referencedClasses: []
  2317. }),
  2318. smalltalk.SymbolTest);
  2319. smalltalk.addMethod(
  2320. "_testIdentity",
  2321. smalltalk.method({
  2322. selector: "testIdentity",
  2323. category: 'tests',
  2324. fn: function () {
  2325. var self=this;
  2326. return smalltalk.withContext(function($ctx1) {
  2327. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq_eq(smalltalk.symbolFor("hello")));
  2328. _st(self)._deny_(_st(smalltalk.symbolFor("hello")).__eq_eq(smalltalk.symbolFor("world")));
  2329. _st(self)._assert_(_st(smalltalk.symbolFor("hello")).__eq(_st(smalltalk.symbolFor("hello"))._yourself()));
  2330. _st(self)._assert_(_st(_st(smalltalk.symbolFor("hello"))._yourself()).__eq(_st(_st(smalltalk.symbolFor("hello"))._asString())._asSymbol()));
  2331. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{}, smalltalk.SymbolTest)});},
  2332. args: [],
  2333. 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 asString asSymbol",
  2334. messageSends: ["assert:", "==", "deny:", "=", "yourself", "asSymbol", "asString"],
  2335. referencedClasses: []
  2336. }),
  2337. smalltalk.SymbolTest);
  2338. smalltalk.addMethod(
  2339. "_testIsEmpty",
  2340. smalltalk.method({
  2341. selector: "testIsEmpty",
  2342. category: 'tests',
  2343. fn: function () {
  2344. var self=this;
  2345. return smalltalk.withContext(function($ctx1) {
  2346. _st(self)._deny_(_st(_st(self)._collection())._isEmpty());
  2347. _st(self)._assert_(_st(_st("")._asSymbol())._isEmpty());
  2348. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{}, smalltalk.SymbolTest)});},
  2349. args: [],
  2350. source: "testIsEmpty\x0a\x09self deny: self collection isEmpty.\x0a\x09self assert: '' asSymbol isEmpty",
  2351. messageSends: ["deny:", "isEmpty", "collection", "assert:", "asSymbol"],
  2352. referencedClasses: []
  2353. }),
  2354. smalltalk.SymbolTest);
  2355. smalltalk.addMethod(
  2356. "_testIsSymbolIsString",
  2357. smalltalk.method({
  2358. selector: "testIsSymbolIsString",
  2359. category: 'tests',
  2360. fn: function () {
  2361. var self=this;
  2362. return smalltalk.withContext(function($ctx1) {
  2363. _st(self)._assert_(_st(smalltalk.symbolFor("hello"))._isSymbol());
  2364. _st(self)._deny_(_st("hello")._isSymbol());
  2365. _st(self)._deny_(_st(smalltalk.symbolFor("hello"))._isString());
  2366. _st(self)._assert_(_st("hello")._isString());
  2367. return self}, function($ctx1) {$ctx1.fill(self,"testIsSymbolIsString",{}, smalltalk.SymbolTest)});},
  2368. args: [],
  2369. source: "testIsSymbolIsString\x0a\x09self assert: #hello isSymbol.\x0a\x09self deny: 'hello' isSymbol.\x0a\x09self deny: #hello isString.\x0a\x09self assert: 'hello' isString",
  2370. messageSends: ["assert:", "isSymbol", "deny:", "isString"],
  2371. referencedClasses: []
  2372. }),
  2373. smalltalk.SymbolTest);
  2374. smalltalk.addMethod(
  2375. "_testSelect",
  2376. smalltalk.method({
  2377. selector: "testSelect",
  2378. category: 'tests',
  2379. fn: function () {
  2380. var self=this;
  2381. var newCollection;
  2382. return smalltalk.withContext(function($ctx1) {
  2383. newCollection="o";
  2384. _st(self)._assertSameContents_as_(_st(_st(self)._collection())._select_((function(each){
  2385. return smalltalk.withContext(function($ctx2) {
  2386. return _st(each).__eq("o");
  2387. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  2388. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection}, smalltalk.SymbolTest)});},
  2389. args: [],
  2390. 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",
  2391. messageSends: ["assertSameContents:as:", "select:", "=", "collection"],
  2392. referencedClasses: []
  2393. }),
  2394. smalltalk.SymbolTest);
  2395. smalltalk.addMethod(
  2396. "_testSize",
  2397. smalltalk.method({
  2398. selector: "testSize",
  2399. category: 'tests',
  2400. fn: function () {
  2401. var self=this;
  2402. return smalltalk.withContext(function($ctx1) {
  2403. _st(self)._assert_equals_(_st(smalltalk.symbolFor("a"))._size(),(1));
  2404. _st(self)._assert_equals_(_st(smalltalk.symbolFor("aaaaa"))._size(),(5));
  2405. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{}, smalltalk.SymbolTest)});},
  2406. args: [],
  2407. source: "testSize\x0a\x09self assert: #a size equals: 1.\x0a\x09self assert: #aaaaa size equals: 5",
  2408. messageSends: ["assert:equals:", "size"],
  2409. referencedClasses: []
  2410. }),
  2411. smalltalk.SymbolTest);
  2412. smalltalk.addMethod(
  2413. "_collectionClass",
  2414. smalltalk.method({
  2415. selector: "collectionClass",
  2416. category: 'accessing',
  2417. fn: function () {
  2418. var self=this;
  2419. return smalltalk.withContext(function($ctx1) {
  2420. var $1;
  2421. $1=(smalltalk.Symbol || Symbol);
  2422. return $1;
  2423. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{}, smalltalk.SymbolTest.klass)});},
  2424. args: [],
  2425. source: "collectionClass\x0a\x09^ Symbol",
  2426. messageSends: [],
  2427. referencedClasses: ["Symbol"]
  2428. }),
  2429. smalltalk.SymbolTest.klass);
  2430. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2431. smalltalk.addMethod(
  2432. "_jsObject",
  2433. smalltalk.method({
  2434. selector: "jsObject",
  2435. category: 'accessing',
  2436. fn: function (){
  2437. var self=this;
  2438. return smalltalk.withContext(function($ctx1) {
  2439. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined};
  2440. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{}, smalltalk.JSObjectProxyTest)})},
  2441. args: [],
  2442. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined}>",
  2443. messageSends: [],
  2444. referencedClasses: []
  2445. }),
  2446. smalltalk.JSObjectProxyTest);
  2447. smalltalk.addMethod(
  2448. "_testAtIfAbsent",
  2449. smalltalk.method({
  2450. selector: "testAtIfAbsent",
  2451. category: 'tests',
  2452. fn: function (){
  2453. var self=this;
  2454. var testObject;
  2455. return smalltalk.withContext(function($ctx1) {
  2456. testObject=_st(self)._jsObject();
  2457. _st(self)._assert_equals_(_st(testObject)._at_ifAbsent_("abc",(function(){
  2458. return smalltalk.withContext(function($ctx2) {
  2459. return "Property does not exist";
  2460. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"Property does not exist");
  2461. _st(self)._assert_equals_(_st(testObject)._at_ifAbsent_("e",(function(){
  2462. return smalltalk.withContext(function($ctx2) {
  2463. return "Property does not exist";
  2464. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2465. _st(self)._assert_equals_(_st(testObject)._at_ifAbsent_("a",(function(){
  2466. return smalltalk.withContext(function($ctx2) {
  2467. return "Property does not exist";
  2468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(1));
  2469. _st(self)._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  2470. return smalltalk.withContext(function($ctx2) {
  2471. return "Property does not exist";
  2472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2473. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject}, smalltalk.JSObjectProxyTest)})},
  2474. args: [],
  2475. source: "testAtIfAbsent\x0a\x09| testObject |\x0a testObject := 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 self assert: (testObject at: 'a' ifAbsent: ['Property does not exist']) equals: 1.\x0a self assert: (testObject at: 'f' ifAbsent: ['Property does not exist']) equals: nil.",
  2476. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  2477. referencedClasses: []
  2478. }),
  2479. smalltalk.JSObjectProxyTest);
  2480. smalltalk.addMethod(
  2481. "_testDNU",
  2482. smalltalk.method({
  2483. selector: "testDNU",
  2484. category: 'tests',
  2485. fn: function () {
  2486. var self=this;
  2487. return smalltalk.withContext(function($ctx1) {
  2488. _st(self)._should_raise_((function(){
  2489. return smalltalk.withContext(function($ctx2) {
  2490. return _st(_st(self)._jsObject())._foo();
  2491. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2492. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{}, smalltalk.JSObjectProxyTest)});},
  2493. args: [],
  2494. source: "testDNU\x0a\x09self should: [self jsObject foo] raise: MessageNotUnderstood",
  2495. messageSends: ["should:raise:", "foo", "jsObject"],
  2496. referencedClasses: ["MessageNotUnderstood"]
  2497. }),
  2498. smalltalk.JSObjectProxyTest);
  2499. smalltalk.addMethod(
  2500. "_testMessageSend",
  2501. smalltalk.method({
  2502. selector: "testMessageSend",
  2503. category: 'tests',
  2504. fn: function () {
  2505. var self=this;
  2506. return smalltalk.withContext(function($ctx1) {
  2507. _st(self)._assert_equals_(_st(_st(self)._jsObject())._a(),(1));
  2508. _st(self)._assert_equals_(_st(_st(self)._jsObject())._b(),(2));
  2509. _st(self)._assert_equals_(_st(_st(self)._jsObject())._c_((3)),(3));
  2510. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{}, smalltalk.JSObjectProxyTest)});},
  2511. args: [],
  2512. 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",
  2513. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  2514. referencedClasses: []
  2515. }),
  2516. smalltalk.JSObjectProxyTest);
  2517. smalltalk.addMethod(
  2518. "_testMethodWithArguments",
  2519. smalltalk.method({
  2520. selector: "testMethodWithArguments",
  2521. category: 'tests',
  2522. fn: function () {
  2523. var self=this;
  2524. return smalltalk.withContext(function($ctx1) {
  2525. _st(self)._assert_equals_(_st(_st(self)._jsObject())._c_((1)),(1));
  2526. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{}, smalltalk.JSObjectProxyTest)});},
  2527. args: [],
  2528. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  2529. messageSends: ["assert:equals:", "c:", "jsObject"],
  2530. referencedClasses: []
  2531. }),
  2532. smalltalk.JSObjectProxyTest);
  2533. smalltalk.addMethod(
  2534. "_testPrinting",
  2535. smalltalk.method({
  2536. selector: "testPrinting",
  2537. category: 'tests',
  2538. fn: function (){
  2539. var self=this;
  2540. return smalltalk.withContext(function($ctx1) {
  2541. _st(self)._assert_equals_(_st(_st(self)._jsObject())._printString(),"[object Object]");
  2542. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{}, smalltalk.JSObjectProxyTest)})},
  2543. args: [],
  2544. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  2545. messageSends: ["assert:equals:", "printString", "jsObject"],
  2546. referencedClasses: []
  2547. }),
  2548. smalltalk.JSObjectProxyTest);
  2549. smalltalk.addMethod(
  2550. "_testPropertyThatReturnsEmptyString",
  2551. smalltalk.method({
  2552. selector: "testPropertyThatReturnsEmptyString",
  2553. category: 'tests',
  2554. fn: function (){
  2555. var self=this;
  2556. var object;
  2557. return smalltalk.withContext(function($ctx1) {
  2558. object=_st(self)._jsObject();
  2559. _st(self)._assert_equals_(_st(object)._d(),"");
  2560. _st(object)._d_("hello");
  2561. _st(self)._assert_equals_(_st(object)._d(),"hello");
  2562. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object}, smalltalk.JSObjectProxyTest)})},
  2563. args: [],
  2564. 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'",
  2565. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  2566. referencedClasses: []
  2567. }),
  2568. smalltalk.JSObjectProxyTest);
  2569. smalltalk.addMethod(
  2570. "_testPropertyThatReturnsUndefined",
  2571. smalltalk.method({
  2572. selector: "testPropertyThatReturnsUndefined",
  2573. category: 'tests',
  2574. fn: function () {
  2575. var self=this;
  2576. var object;
  2577. return smalltalk.withContext(function($ctx1) {
  2578. object=_st(self)._jsObject();
  2579. _st(self)._shouldnt_raise_((function(){
  2580. return smalltalk.withContext(function($ctx2) {
  2581. return _st(object)._e();
  2582. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2583. _st(self)._assert_(_st(_st(object)._e())._isNil());
  2584. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object}, smalltalk.JSObjectProxyTest)});},
  2585. args: [],
  2586. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a self assert: object e isNil",
  2587. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  2588. referencedClasses: ["MessageNotUnderstood"]
  2589. }),
  2590. smalltalk.JSObjectProxyTest);
  2591. smalltalk.addMethod(
  2592. "_testValue",
  2593. smalltalk.method({
  2594. selector: "testValue",
  2595. category: 'tests',
  2596. fn: function (){
  2597. var self=this;
  2598. var testObject;
  2599. return smalltalk.withContext(function($ctx1) {
  2600. testObject=_st(self)._jsObject();
  2601. _st(self)._assert_equals_(_st(_st(testObject)._value())._printString(),"[object Object]");
  2602. _st(testObject)._at_put_("value","aValue");
  2603. _st(self)._assert_equals_(_st(testObject)._value(),"aValue");
  2604. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject}, smalltalk.JSObjectProxyTest)})},
  2605. args: [],
  2606. source: "testValue\x0a\x09| testObject |\x0a testObject := self jsObject.\x0a\x09self assert: testObject value printString equals: '[object Object]'.\x0a testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  2607. messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"],
  2608. referencedClasses: []
  2609. }),
  2610. smalltalk.JSObjectProxyTest);
  2611. smalltalk.addMethod(
  2612. "_testYourself",
  2613. smalltalk.method({
  2614. selector: "testYourself",
  2615. category: 'tests',
  2616. fn: function () {
  2617. var self=this;
  2618. var object;
  2619. return smalltalk.withContext(function($ctx1) {
  2620. var $1,$2;
  2621. $1=_st(self)._jsObject();
  2622. _st($1)._d_("test");
  2623. $2=_st($1)._yourself();
  2624. object=$2;
  2625. _st(self)._assert_equals_(_st(object)._d(),"test");
  2626. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object}, smalltalk.JSObjectProxyTest)});},
  2627. args: [],
  2628. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  2629. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  2630. referencedClasses: []
  2631. }),
  2632. smalltalk.JSObjectProxyTest);
  2633. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2634. smalltalk.addMethod(
  2635. "_testCatchingException",
  2636. smalltalk.method({
  2637. selector: "testCatchingException",
  2638. category: 'tests',
  2639. fn: function () {
  2640. var self=this;
  2641. return smalltalk.withContext(function($ctx1) {
  2642. _st((function(){
  2643. return smalltalk.withContext(function($ctx2) {
  2644. return _st(self)._throwException();
  2645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(error){
  2646. return smalltalk.withContext(function($ctx2) {
  2647. return _st(self)._assert_(_st(_st(error)._exception()).__eq("test"));
  2648. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  2649. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{}, smalltalk.JavaScriptExceptionTest)});},
  2650. args: [],
  2651. source: "testCatchingException\x0a\x09[ self throwException ]\x0a \x09\x09on: Error\x0a do: [ :error | \x0a\x09\x09\x09self assert: error exception = 'test' ]",
  2652. messageSends: ["on:do:", "assert:", "=", "exception", "throwException"],
  2653. referencedClasses: ["Error"]
  2654. }),
  2655. smalltalk.JavaScriptExceptionTest);
  2656. smalltalk.addMethod(
  2657. "_testRaisingException",
  2658. smalltalk.method({
  2659. selector: "testRaisingException",
  2660. category: 'tests',
  2661. fn: function () {
  2662. var self=this;
  2663. return smalltalk.withContext(function($ctx1) {
  2664. _st(self)._should_raise_((function(){
  2665. return smalltalk.withContext(function($ctx2) {
  2666. return _st(self)._throwException();
  2667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.JavaScriptException || JavaScriptException));
  2668. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{}, smalltalk.JavaScriptExceptionTest)});},
  2669. args: [],
  2670. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  2671. messageSends: ["should:raise:", "throwException"],
  2672. referencedClasses: ["JavaScriptException"]
  2673. }),
  2674. smalltalk.JavaScriptExceptionTest);
  2675. smalltalk.addMethod(
  2676. "_throwException",
  2677. smalltalk.method({
  2678. selector: "throwException",
  2679. category: 'helpers',
  2680. fn: function () {
  2681. var self=this;
  2682. return smalltalk.withContext(function($ctx1) {
  2683. throw 'test';
  2684. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{}, smalltalk.JavaScriptExceptionTest)});},
  2685. args: [],
  2686. source: "throwException\x0a\x09<throw 'test'>",
  2687. messageSends: [],
  2688. referencedClasses: []
  2689. }),
  2690. smalltalk.JavaScriptExceptionTest);
  2691. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2692. smalltalk.addMethod(
  2693. "_testAbs",
  2694. smalltalk.method({
  2695. selector: "testAbs",
  2696. category: 'tests',
  2697. fn: function (){
  2698. var self=this;
  2699. return smalltalk.withContext(function($ctx1) {
  2700. _st(self)._assert_equals_(_st((4))._abs(),(4));
  2701. _st(self)._assert_equals_(_st((-4))._abs(),(4));
  2702. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{}, smalltalk.NumberTest)})},
  2703. args: [],
  2704. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  2705. messageSends: ["assert:equals:", "abs"],
  2706. referencedClasses: []
  2707. }),
  2708. smalltalk.NumberTest);
  2709. smalltalk.addMethod(
  2710. "_testArithmetic",
  2711. smalltalk.method({
  2712. selector: "testArithmetic",
  2713. category: 'tests',
  2714. fn: function (){
  2715. var self=this;
  2716. return smalltalk.withContext(function($ctx1) {
  2717. _st(self)._assert_equals_(_st((1.5)).__plus((1)),(2.5));
  2718. _st(self)._assert_equals_(_st((2)).__minus((1)),(1));
  2719. _st(self)._assert_equals_(_st((-2)).__minus((1)),(-3));
  2720. _st(self)._assert_equals_(_st((12)).__slash((2)),(6));
  2721. _st(self)._assert_equals_(_st((3)).__star((4)),(12));
  2722. _st(self)._assert_equals_(_st(_st((1)).__plus((2))).__star((3)),(9));
  2723. _st(self)._assert_equals_(_st((1)).__plus(_st((2)).__star((3))),(7));
  2724. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{}, smalltalk.NumberTest)})},
  2725. args: [],
  2726. 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",
  2727. messageSends: ["assert:equals:", "+", "-", "/", "*"],
  2728. referencedClasses: []
  2729. }),
  2730. smalltalk.NumberTest);
  2731. smalltalk.addMethod(
  2732. "_testComparison",
  2733. smalltalk.method({
  2734. selector: "testComparison",
  2735. category: 'tests',
  2736. fn: function () {
  2737. var self=this;
  2738. return smalltalk.withContext(function($ctx1) {
  2739. _st(self)._assert_(_st((3)).__gt((2)));
  2740. _st(self)._assert_(_st((2)).__lt((3)));
  2741. _st(self)._deny_(_st((3)).__lt((2)));
  2742. _st(self)._deny_(_st((2)).__gt((3)));
  2743. _st(self)._assert_(_st((3)).__gt_eq((3)));
  2744. _st(self)._assert_(_st((3.1)).__gt_eq((3)));
  2745. _st(self)._assert_(_st((3)).__lt_eq((3)));
  2746. _st(self)._assert_(_st((3)).__lt_eq((3.1)));
  2747. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{}, smalltalk.NumberTest)});},
  2748. args: [],
  2749. 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",
  2750. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  2751. referencedClasses: []
  2752. }),
  2753. smalltalk.NumberTest);
  2754. smalltalk.addMethod(
  2755. "_testCopying",
  2756. smalltalk.method({
  2757. selector: "testCopying",
  2758. category: 'tests',
  2759. fn: function () {
  2760. var self=this;
  2761. return smalltalk.withContext(function($ctx1) {
  2762. _st(self)._assert_(_st(_st((1))._copy()).__eq_eq((1)));
  2763. _st(self)._assert_(_st(_st((1))._deepCopy()).__eq_eq((1)));
  2764. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{}, smalltalk.NumberTest)});},
  2765. args: [],
  2766. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  2767. messageSends: ["assert:", "==", "copy", "deepCopy"],
  2768. referencedClasses: []
  2769. }),
  2770. smalltalk.NumberTest);
  2771. smalltalk.addMethod(
  2772. "_testEquality",
  2773. smalltalk.method({
  2774. selector: "testEquality",
  2775. category: 'tests',
  2776. fn: function (){
  2777. var self=this;
  2778. return smalltalk.withContext(function($ctx1) {
  2779. _st(self)._assert_(_st((1)).__eq((1)));
  2780. _st(self)._assert_(_st((0)).__eq((0)));
  2781. _st(self)._deny_(_st((1)).__eq((0)));
  2782. _st(self)._assert_(_st(_st((1))._yourself()).__eq((1)));
  2783. _st(self)._assert_(_st((1)).__eq(_st((1))._yourself()));
  2784. _st(self)._assert_(_st(_st((1))._yourself()).__eq(_st((1))._yourself()));
  2785. _st(self)._deny_(_st((0)).__eq(false));
  2786. _st(self)._deny_(_st(false).__eq((0)));
  2787. _st(self)._deny_(_st("").__eq((0)));
  2788. _st(self)._deny_(_st((0)).__eq(""));
  2789. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{}, smalltalk.NumberTest)})},
  2790. args: [],
  2791. 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 = ''",
  2792. messageSends: ["assert:", "=", "deny:", "yourself"],
  2793. referencedClasses: []
  2794. }),
  2795. smalltalk.NumberTest);
  2796. smalltalk.addMethod(
  2797. "_testHexNumbers",
  2798. smalltalk.method({
  2799. selector: "testHexNumbers",
  2800. category: 'tests',
  2801. fn: function (){
  2802. var self=this;
  2803. return smalltalk.withContext(function($ctx1) {
  2804. _st(self)._assert_equals_((9),(9));
  2805. _st(self)._assert_equals_(_st((10))._truncated(),(10));
  2806. _st(self)._assert_equals_(_st((11))._truncated(),(11));
  2807. _st(self)._assert_equals_(_st((12))._truncated(),(12));
  2808. _st(self)._assert_equals_(_st((13))._truncated(),(13));
  2809. _st(self)._assert_equals_(_st((14))._truncated(),(14));
  2810. _st(self)._assert_equals_(_st((15))._truncated(),(15));
  2811. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{}, smalltalk.NumberTest)})},
  2812. args: [],
  2813. 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",
  2814. messageSends: ["assert:equals:", "truncated"],
  2815. referencedClasses: []
  2816. }),
  2817. smalltalk.NumberTest);
  2818. smalltalk.addMethod(
  2819. "_testIdentity",
  2820. smalltalk.method({
  2821. selector: "testIdentity",
  2822. category: 'tests',
  2823. fn: function () {
  2824. var self=this;
  2825. return smalltalk.withContext(function($ctx1) {
  2826. _st(self)._assert_(_st((1)).__eq_eq((1)));
  2827. _st(self)._assert_(_st((0)).__eq_eq((0)));
  2828. _st(self)._deny_(_st((1)).__eq_eq((0)));
  2829. _st(self)._assert_(_st(_st((1))._yourself()).__eq_eq((1)));
  2830. _st(self)._assert_(_st((1)).__eq_eq(_st((1))._yourself()));
  2831. _st(self)._assert_(_st(_st((1))._yourself()).__eq_eq(_st((1))._yourself()));
  2832. _st(self)._deny_(_st((1)).__eq_eq((2)));
  2833. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{}, smalltalk.NumberTest)});},
  2834. args: [],
  2835. 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",
  2836. messageSends: ["assert:", "==", "deny:", "yourself"],
  2837. referencedClasses: []
  2838. }),
  2839. smalltalk.NumberTest);
  2840. smalltalk.addMethod(
  2841. "_testInvalidHexNumbers",
  2842. smalltalk.method({
  2843. selector: "testInvalidHexNumbers",
  2844. category: 'tests',
  2845. fn: function () {
  2846. var self=this;
  2847. return smalltalk.withContext(function($ctx1) {
  2848. _st(self)._should_raise_((function(){
  2849. return smalltalk.withContext(function($ctx2) {
  2850. return _st((16))._rG();
  2851. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2852. _st(self)._should_raise_((function(){
  2853. return smalltalk.withContext(function($ctx2) {
  2854. return _st((16))._rg();
  2855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2856. _st(self)._should_raise_((function(){
  2857. return smalltalk.withContext(function($ctx2) {
  2858. return _st((16))._rH();
  2859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2860. _st(self)._should_raise_((function(){
  2861. return smalltalk.withContext(function($ctx2) {
  2862. return _st((16))._rh();
  2863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2864. _st(self)._should_raise_((function(){
  2865. return smalltalk.withContext(function($ctx2) {
  2866. return _st((16))._rI();
  2867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2868. _st(self)._should_raise_((function(){
  2869. return smalltalk.withContext(function($ctx2) {
  2870. return _st((16))._ri();
  2871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2872. _st(self)._should_raise_((function(){
  2873. return smalltalk.withContext(function($ctx2) {
  2874. return _st((16))._rJ();
  2875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2876. _st(self)._should_raise_((function(){
  2877. return smalltalk.withContext(function($ctx2) {
  2878. return _st((16))._rj();
  2879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2880. _st(self)._should_raise_((function(){
  2881. return smalltalk.withContext(function($ctx2) {
  2882. return _st((16))._rK();
  2883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2884. _st(self)._should_raise_((function(){
  2885. return smalltalk.withContext(function($ctx2) {
  2886. return _st((16))._rk();
  2887. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2888. _st(self)._should_raise_((function(){
  2889. return smalltalk.withContext(function($ctx2) {
  2890. return _st((16))._rL();
  2891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2892. _st(self)._should_raise_((function(){
  2893. return smalltalk.withContext(function($ctx2) {
  2894. return _st((16))._rl();
  2895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2896. _st(self)._should_raise_((function(){
  2897. return smalltalk.withContext(function($ctx2) {
  2898. return _st((16))._rM();
  2899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2900. _st(self)._should_raise_((function(){
  2901. return smalltalk.withContext(function($ctx2) {
  2902. return _st((16))._rm();
  2903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2904. _st(self)._should_raise_((function(){
  2905. return smalltalk.withContext(function($ctx2) {
  2906. return _st((16))._rN();
  2907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2908. _st(self)._should_raise_((function(){
  2909. return smalltalk.withContext(function($ctx2) {
  2910. return _st((16))._rn();
  2911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2912. _st(self)._should_raise_((function(){
  2913. return smalltalk.withContext(function($ctx2) {
  2914. return _st((16))._rO();
  2915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2916. _st(self)._should_raise_((function(){
  2917. return smalltalk.withContext(function($ctx2) {
  2918. return _st((16))._ro();
  2919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2920. _st(self)._should_raise_((function(){
  2921. return smalltalk.withContext(function($ctx2) {
  2922. return _st((16))._rP();
  2923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2924. _st(self)._should_raise_((function(){
  2925. return smalltalk.withContext(function($ctx2) {
  2926. return _st((16))._rp();
  2927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2928. _st(self)._should_raise_((function(){
  2929. return smalltalk.withContext(function($ctx2) {
  2930. return _st((16))._rQ();
  2931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2932. _st(self)._should_raise_((function(){
  2933. return smalltalk.withContext(function($ctx2) {
  2934. return _st((16))._rq();
  2935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2936. _st(self)._should_raise_((function(){
  2937. return smalltalk.withContext(function($ctx2) {
  2938. return _st((16))._rR();
  2939. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2940. _st(self)._should_raise_((function(){
  2941. return smalltalk.withContext(function($ctx2) {
  2942. return _st((16))._rr();
  2943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2944. _st(self)._should_raise_((function(){
  2945. return smalltalk.withContext(function($ctx2) {
  2946. return _st((16))._rS();
  2947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2948. _st(self)._should_raise_((function(){
  2949. return smalltalk.withContext(function($ctx2) {
  2950. return _st((16))._rs();
  2951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2952. _st(self)._should_raise_((function(){
  2953. return smalltalk.withContext(function($ctx2) {
  2954. return _st((16))._rT();
  2955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2956. _st(self)._should_raise_((function(){
  2957. return smalltalk.withContext(function($ctx2) {
  2958. return _st((16))._rt();
  2959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2960. _st(self)._should_raise_((function(){
  2961. return smalltalk.withContext(function($ctx2) {
  2962. return _st((16))._rU();
  2963. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2964. _st(self)._should_raise_((function(){
  2965. return smalltalk.withContext(function($ctx2) {
  2966. return _st((16))._ru();
  2967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2968. _st(self)._should_raise_((function(){
  2969. return smalltalk.withContext(function($ctx2) {
  2970. return _st((16))._rV();
  2971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2972. _st(self)._should_raise_((function(){
  2973. return smalltalk.withContext(function($ctx2) {
  2974. return _st((16))._rv();
  2975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2976. _st(self)._should_raise_((function(){
  2977. return smalltalk.withContext(function($ctx2) {
  2978. return _st((16))._rW();
  2979. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2980. _st(self)._should_raise_((function(){
  2981. return smalltalk.withContext(function($ctx2) {
  2982. return _st((16))._rw();
  2983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2984. _st(self)._should_raise_((function(){
  2985. return smalltalk.withContext(function($ctx2) {
  2986. return _st((16))._rX();
  2987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2988. _st(self)._should_raise_((function(){
  2989. return smalltalk.withContext(function($ctx2) {
  2990. return _st((16))._rx();
  2991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2992. _st(self)._should_raise_((function(){
  2993. return smalltalk.withContext(function($ctx2) {
  2994. return _st((16))._rY();
  2995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  2996. _st(self)._should_raise_((function(){
  2997. return smalltalk.withContext(function($ctx2) {
  2998. return _st((16))._ry();
  2999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  3000. _st(self)._should_raise_((function(){
  3001. return smalltalk.withContext(function($ctx2) {
  3002. return _st((16))._rZ();
  3003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  3004. _st(self)._should_raise_((function(){
  3005. return smalltalk.withContext(function($ctx2) {
  3006. return _st((16))._rz();
  3007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  3008. _st(self)._should_raise_((function(){
  3009. return smalltalk.withContext(function($ctx2) {
  3010. return _st((11259375))._Z();
  3011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  3012. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{}, smalltalk.NumberTest)});},
  3013. args: [],
  3014. 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 self should: [16rABcdEfZ] raise: MessageNotUnderstood.",
  3015. 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"],
  3016. referencedClasses: ["MessageNotUnderstood"]
  3017. }),
  3018. smalltalk.NumberTest);
  3019. smalltalk.addMethod(
  3020. "_testMinMax",
  3021. smalltalk.method({
  3022. selector: "testMinMax",
  3023. category: 'tests',
  3024. fn: function () {
  3025. var self=this;
  3026. return smalltalk.withContext(function($ctx1) {
  3027. _st(self)._assert_equals_(_st((2))._max_((5)),(5));
  3028. _st(self)._assert_equals_(_st((2))._min_((5)),(2));
  3029. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{}, smalltalk.NumberTest)});},
  3030. args: [],
  3031. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  3032. messageSends: ["assert:equals:", "max:", "min:"],
  3033. referencedClasses: []
  3034. }),
  3035. smalltalk.NumberTest);
  3036. smalltalk.addMethod(
  3037. "_testNegated",
  3038. smalltalk.method({
  3039. selector: "testNegated",
  3040. category: 'tests',
  3041. fn: function (){
  3042. var self=this;
  3043. return smalltalk.withContext(function($ctx1) {
  3044. _st(self)._assert_equals_(_st((3))._negated(),(-3));
  3045. _st(self)._assert_equals_(_st((-3))._negated(),(3));
  3046. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{}, smalltalk.NumberTest)})},
  3047. args: [],
  3048. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  3049. messageSends: ["assert:equals:", "negated"],
  3050. referencedClasses: []
  3051. }),
  3052. smalltalk.NumberTest);
  3053. smalltalk.addMethod(
  3054. "_testPrintShowingDecimalPlaces",
  3055. smalltalk.method({
  3056. selector: "testPrintShowingDecimalPlaces",
  3057. category: 'tests',
  3058. fn: function (){
  3059. var self=this;
  3060. return smalltalk.withContext(function($ctx1) {
  3061. _st(self)._assert_equals_(_st((23))._printShowingDecimalPlaces_((2)),"23.00");
  3062. _st(self)._assert_equals_(_st((23.5698))._printShowingDecimalPlaces_((2)),"23.57");
  3063. _st(self)._assert_equals_(_st(_st((234.567))._negated())._printShowingDecimalPlaces_((5)),"-234.56700");
  3064. _st(self)._assert_equals_(_st((23.4567))._printShowingDecimalPlaces_((0)),"23");
  3065. _st(self)._assert_equals_(_st((23.5567))._printShowingDecimalPlaces_((0)),"24");
  3066. _st(self)._assert_equals_(_st(_st((23.4567))._negated())._printShowingDecimalPlaces_((0)),"-23");
  3067. _st(self)._assert_equals_(_st(_st((23.5567))._negated())._printShowingDecimalPlaces_((0)),"-24");
  3068. _st(self)._assert_equals_(_st((100000000))._printShowingDecimalPlaces_((1)),"100000000.0");
  3069. _st(self)._assert_equals_(_st((0.98))._printShowingDecimalPlaces_((5)),"0.98000");
  3070. _st(self)._assert_equals_(_st(_st((0.98))._negated())._printShowingDecimalPlaces_((2)),"-0.98");
  3071. _st(self)._assert_equals_(_st((2.567))._printShowingDecimalPlaces_((2)),"2.57");
  3072. _st(self)._assert_equals_(_st((-2.567))._printShowingDecimalPlaces_((2)),"-2.57");
  3073. _st(self)._assert_equals_(_st((0))._printShowingDecimalPlaces_((2)),"0.00");
  3074. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{}, smalltalk.NumberTest)})},
  3075. args: [],
  3076. 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'.",
  3077. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  3078. referencedClasses: []
  3079. }),
  3080. smalltalk.NumberTest);
  3081. smalltalk.addMethod(
  3082. "_testRounded",
  3083. smalltalk.method({
  3084. selector: "testRounded",
  3085. category: 'tests',
  3086. fn: function (){
  3087. var self=this;
  3088. return smalltalk.withContext(function($ctx1) {
  3089. _st(self)._assert_equals_(_st((3))._rounded(),(3));
  3090. _st(self)._assert_equals_(_st((3.212))._rounded(),(3));
  3091. _st(self)._assert_equals_(_st((3.51))._rounded(),(4));
  3092. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{}, smalltalk.NumberTest)})},
  3093. args: [],
  3094. 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",
  3095. messageSends: ["assert:equals:", "rounded"],
  3096. referencedClasses: []
  3097. }),
  3098. smalltalk.NumberTest);
  3099. smalltalk.addMethod(
  3100. "_testSqrt",
  3101. smalltalk.method({
  3102. selector: "testSqrt",
  3103. category: 'tests',
  3104. fn: function (){
  3105. var self=this;
  3106. return smalltalk.withContext(function($ctx1) {
  3107. _st(self)._assert_equals_(_st((4))._sqrt(),(2));
  3108. _st(self)._assert_equals_(_st((16))._sqrt(),(4));
  3109. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{}, smalltalk.NumberTest)})},
  3110. args: [],
  3111. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  3112. messageSends: ["assert:equals:", "sqrt"],
  3113. referencedClasses: []
  3114. }),
  3115. smalltalk.NumberTest);
  3116. smalltalk.addMethod(
  3117. "_testSquared",
  3118. smalltalk.method({
  3119. selector: "testSquared",
  3120. category: 'tests',
  3121. fn: function (){
  3122. var self=this;
  3123. return smalltalk.withContext(function($ctx1) {
  3124. _st(self)._assert_equals_(_st((4))._squared(),(16));
  3125. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{}, smalltalk.NumberTest)})},
  3126. args: [],
  3127. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  3128. messageSends: ["assert:equals:", "squared"],
  3129. referencedClasses: []
  3130. }),
  3131. smalltalk.NumberTest);
  3132. smalltalk.addMethod(
  3133. "_testTimesRepeat",
  3134. smalltalk.method({
  3135. selector: "testTimesRepeat",
  3136. category: 'tests',
  3137. fn: function () {
  3138. var self=this;
  3139. var i;
  3140. return smalltalk.withContext(function($ctx1) {
  3141. i=(0);
  3142. _st((0))._timesRepeat_((function(){
  3143. return smalltalk.withContext(function($ctx2) {
  3144. i=_st(i).__plus((1));
  3145. return i;
  3146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3147. _st(self)._assert_equals_(i,(0));
  3148. _st((5))._timesRepeat_((function(){
  3149. return smalltalk.withContext(function($ctx2) {
  3150. i=_st(i).__plus((1));
  3151. return i;
  3152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3153. _st(self)._assert_equals_(i,(5));
  3154. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i}, smalltalk.NumberTest)});},
  3155. args: [],
  3156. 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",
  3157. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  3158. referencedClasses: []
  3159. }),
  3160. smalltalk.NumberTest);
  3161. smalltalk.addMethod(
  3162. "_testTo",
  3163. smalltalk.method({
  3164. selector: "testTo",
  3165. category: 'tests',
  3166. fn: function () {
  3167. var self=this;
  3168. return smalltalk.withContext(function($ctx1) {
  3169. _st(self)._assert_equals_(_st((1))._to_((5)),[(1), (2), (3), (4), (5)]);
  3170. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{}, smalltalk.NumberTest)});},
  3171. args: [],
  3172. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  3173. messageSends: ["assert:equals:", "to:"],
  3174. referencedClasses: []
  3175. }),
  3176. smalltalk.NumberTest);
  3177. smalltalk.addMethod(
  3178. "_testToBy",
  3179. smalltalk.method({
  3180. selector: "testToBy",
  3181. category: 'tests',
  3182. fn: function () {
  3183. var self=this;
  3184. return smalltalk.withContext(function($ctx1) {
  3185. _st(self)._assert_equals_(_st((0))._to_by_((6),(2)),[(0), (2), (4), (6)]);
  3186. _st(self)._should_raise_((function(){
  3187. return smalltalk.withContext(function($ctx2) {
  3188. return _st((1))._to_by_((4),(0));
  3189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  3190. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{}, smalltalk.NumberTest)});},
  3191. args: [],
  3192. 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",
  3193. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  3194. referencedClasses: ["Error"]
  3195. }),
  3196. smalltalk.NumberTest);
  3197. smalltalk.addMethod(
  3198. "_testTruncated",
  3199. smalltalk.method({
  3200. selector: "testTruncated",
  3201. category: 'tests',
  3202. fn: function (){
  3203. var self=this;
  3204. return smalltalk.withContext(function($ctx1) {
  3205. _st(self)._assert_equals_(_st((3))._truncated(),(3));
  3206. _st(self)._assert_equals_(_st((3.212))._truncated(),(3));
  3207. _st(self)._assert_equals_(_st((3.51))._truncated(),(3));
  3208. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{}, smalltalk.NumberTest)})},
  3209. args: [],
  3210. 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",
  3211. messageSends: ["assert:equals:", "truncated"],
  3212. referencedClasses: []
  3213. }),
  3214. smalltalk.NumberTest);
  3215. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  3216. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes."
  3217. smalltalk.addMethod(
  3218. "_foo",
  3219. smalltalk.method({
  3220. selector: "foo",
  3221. category: 'not yet classified',
  3222. fn: function () {
  3223. var self=this;
  3224. return smalltalk.withContext(function($ctx1) {
  3225. var $1;
  3226. $1=self["@foo"];
  3227. return $1;
  3228. }, function($ctx1) {$ctx1.fill(self,"foo",{}, smalltalk.ObjectMock)});},
  3229. args: [],
  3230. source: "foo\x0a\x09^foo",
  3231. messageSends: [],
  3232. referencedClasses: []
  3233. }),
  3234. smalltalk.ObjectMock);
  3235. smalltalk.addMethod(
  3236. "_foo_",
  3237. smalltalk.method({
  3238. selector: "foo:",
  3239. category: 'not yet classified',
  3240. fn: function (anObject) {
  3241. var self=this;
  3242. return smalltalk.withContext(function($ctx1) {
  3243. self["@foo"]=anObject;
  3244. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject}, smalltalk.ObjectMock)});},
  3245. args: ["anObject"],
  3246. source: "foo: anObject\x0a\x09foo := anObject",
  3247. messageSends: [],
  3248. referencedClasses: []
  3249. }),
  3250. smalltalk.ObjectMock);
  3251. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3252. smalltalk.addMethod(
  3253. "_notDefined",
  3254. smalltalk.method({
  3255. selector: "notDefined",
  3256. category: 'tests',
  3257. fn: function () {
  3258. var self=this;
  3259. return smalltalk.withContext(function($ctx1) {
  3260. return undefined;;
  3261. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{}, smalltalk.ObjectTest)});},
  3262. args: [],
  3263. source: "notDefined\x0a\x09<return undefined;>",
  3264. messageSends: [],
  3265. referencedClasses: []
  3266. }),
  3267. smalltalk.ObjectTest);
  3268. smalltalk.addMethod(
  3269. "_testBasicAccess",
  3270. smalltalk.method({
  3271. selector: "testBasicAccess",
  3272. category: 'tests',
  3273. fn: function () {
  3274. var self=this;
  3275. var o;
  3276. return smalltalk.withContext(function($ctx1) {
  3277. o=_st((smalltalk.Object || Object))._new();
  3278. _st(o)._basicAt_put_("a",(1));
  3279. _st(self)._assert_equals_(_st(o)._basicAt_("a"),(1));
  3280. _st(self)._assert_equals_(_st(o)._basicAt_("b"),nil);
  3281. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o}, smalltalk.ObjectTest)});},
  3282. args: [],
  3283. 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",
  3284. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  3285. referencedClasses: ["Object"]
  3286. }),
  3287. smalltalk.ObjectTest);
  3288. smalltalk.addMethod(
  3289. "_testBasicPerform",
  3290. smalltalk.method({
  3291. selector: "testBasicPerform",
  3292. category: 'tests',
  3293. fn: function (){
  3294. var self=this;
  3295. var o;
  3296. return smalltalk.withContext(function($ctx1) {
  3297. o=_st((smalltalk.Object || Object))._new();
  3298. _st(o)._basicAt_put_("func",(function(){
  3299. return smalltalk.withContext(function($ctx2) {
  3300. return "hello";
  3301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3302. _st(o)._basicAt_put_("func2",(function(a){
  3303. return smalltalk.withContext(function($ctx2) {
  3304. return _st(a).__plus((1));
  3305. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}));
  3306. _st(self)._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  3307. _st(self)._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  3308. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o}, smalltalk.ObjectTest)})},
  3309. args: [],
  3310. source: "testBasicPerform\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'func' put: ['hello'].\x09\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",
  3311. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  3312. referencedClasses: ["Object"]
  3313. }),
  3314. smalltalk.ObjectTest);
  3315. smalltalk.addMethod(
  3316. "_testDNU",
  3317. smalltalk.method({
  3318. selector: "testDNU",
  3319. category: 'tests',
  3320. fn: function () {
  3321. var self=this;
  3322. return smalltalk.withContext(function($ctx1) {
  3323. _st(self)._should_raise_((function(){
  3324. return smalltalk.withContext(function($ctx2) {
  3325. return _st(_st((smalltalk.Object || Object))._new())._foo();
  3326. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood));
  3327. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{}, smalltalk.ObjectTest)});},
  3328. args: [],
  3329. source: "testDNU\x0a\x09self should: [Object new foo] raise: MessageNotUnderstood",
  3330. messageSends: ["should:raise:", "foo", "new"],
  3331. referencedClasses: ["Object", "MessageNotUnderstood"]
  3332. }),
  3333. smalltalk.ObjectTest);
  3334. smalltalk.addMethod(
  3335. "_testEquality",
  3336. smalltalk.method({
  3337. selector: "testEquality",
  3338. category: 'tests',
  3339. fn: function (){
  3340. var self=this;
  3341. var o;
  3342. return smalltalk.withContext(function($ctx1) {
  3343. o=_st((smalltalk.Object || Object))._new();
  3344. _st(self)._deny_(_st(o).__eq(_st((smalltalk.Object || Object))._new()));
  3345. _st(self)._assert_(_st(o).__eq(o));
  3346. _st(self)._assert_(_st(_st(o)._yourself()).__eq(o));
  3347. _st(self)._assert_(_st(o).__eq(_st(o)._yourself()));
  3348. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o}, smalltalk.ObjectTest)})},
  3349. args: [],
  3350. 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)",
  3351. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  3352. referencedClasses: ["Object"]
  3353. }),
  3354. smalltalk.ObjectTest);
  3355. smalltalk.addMethod(
  3356. "_testHalt",
  3357. smalltalk.method({
  3358. selector: "testHalt",
  3359. category: 'tests',
  3360. fn: function () {
  3361. var self=this;
  3362. return smalltalk.withContext(function($ctx1) {
  3363. _st(self)._should_raise_((function(){
  3364. return smalltalk.withContext(function($ctx2) {
  3365. return _st(_st((smalltalk.Object || Object))._new())._halt();
  3366. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  3367. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{}, smalltalk.ObjectTest)});},
  3368. args: [],
  3369. source: "testHalt\x0a\x09self should: [Object new halt] raise: Error",
  3370. messageSends: ["should:raise:", "halt", "new"],
  3371. referencedClasses: ["Object", "Error"]
  3372. }),
  3373. smalltalk.ObjectTest);
  3374. smalltalk.addMethod(
  3375. "_testIdentity",
  3376. smalltalk.method({
  3377. selector: "testIdentity",
  3378. category: 'tests',
  3379. fn: function () {
  3380. var self=this;
  3381. var o;
  3382. return smalltalk.withContext(function($ctx1) {
  3383. o=_st((smalltalk.Object || Object))._new();
  3384. _st(self)._deny_(_st(o).__eq_eq(_st((smalltalk.Object || Object))._new()));
  3385. _st(self)._assert_(_st(o).__eq_eq(o));
  3386. _st(self)._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  3387. _st(self)._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  3388. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o}, smalltalk.ObjectTest)});},
  3389. args: [],
  3390. 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",
  3391. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  3392. referencedClasses: ["Object"]
  3393. }),
  3394. smalltalk.ObjectTest);
  3395. smalltalk.addMethod(
  3396. "_testIfNil",
  3397. smalltalk.method({
  3398. selector: "testIfNil",
  3399. category: 'tests',
  3400. fn: function (){
  3401. var self=this;
  3402. return smalltalk.withContext(function($ctx1) {
  3403. var $1,$4,$3,$2,$5,$7,$6,$8,$10,$9;
  3404. _st(self)._deny_(_st(_st((smalltalk.Object || Object))._new())._isNil());
  3405. $1=self;
  3406. $4=_st((smalltalk.Object || Object))._new();
  3407. if(($receiver = $4) == nil || $receiver == undefined){
  3408. $3=true;
  3409. } else {
  3410. $3=$4;
  3411. };
  3412. $2=_st($3).__eq(true);
  3413. _st($1)._deny_($2);
  3414. $5=self;
  3415. $7=_st((smalltalk.Object || Object))._new();
  3416. if(($receiver = $7) == nil || $receiver == undefined){
  3417. $6=$7;
  3418. } else {
  3419. $6=true;
  3420. };
  3421. _st($5)._assert_equals_($6,true);
  3422. $8=self;
  3423. $10=_st((smalltalk.Object || Object))._new();
  3424. if(($receiver = $10) == nil || $receiver == undefined){
  3425. $9=false;
  3426. } else {
  3427. $9=true;
  3428. };
  3429. _st($8)._assert_equals_($9,true);
  3430. _st(self)._assert_equals_(_st(_st((smalltalk.Object || Object))._new())._ifNotNil_ifNil_((function(){
  3431. return smalltalk.withContext(function($ctx2) {
  3432. return true;
  3433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  3434. return smalltalk.withContext(function($ctx2) {
  3435. return false;
  3436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),true);
  3437. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{}, smalltalk.ObjectTest)})},
  3438. args: [],
  3439. 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",
  3440. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  3441. referencedClasses: ["Object"]
  3442. }),
  3443. smalltalk.ObjectTest);
  3444. smalltalk.addMethod(
  3445. "_testInstVars",
  3446. smalltalk.method({
  3447. selector: "testInstVars",
  3448. category: 'tests',
  3449. fn: function () {
  3450. var self=this;
  3451. var o;
  3452. return smalltalk.withContext(function($ctx1) {
  3453. o=_st((smalltalk.ObjectMock || ObjectMock))._new();
  3454. _st(self)._assert_equals_(_st(o)._instVarAt_(smalltalk.symbolFor("foo")),nil);
  3455. _st(o)._instVarAt_put_(smalltalk.symbolFor("foo"),(1));
  3456. _st(self)._assert_equals_(_st(o)._instVarAt_(smalltalk.symbolFor("foo")),(1));
  3457. _st(self)._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  3458. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o}, smalltalk.ObjectTest)});},
  3459. args: [],
  3460. 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",
  3461. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  3462. referencedClasses: ["ObjectMock"]
  3463. }),
  3464. smalltalk.ObjectTest);
  3465. smalltalk.addMethod(
  3466. "_testNilUndefined",
  3467. smalltalk.method({
  3468. selector: "testNilUndefined",
  3469. category: 'tests',
  3470. fn: function (){
  3471. var self=this;
  3472. return smalltalk.withContext(function($ctx1) {
  3473. _st(self)._assert_equals_(_st(self)._notDefined(),nil);
  3474. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{}, smalltalk.ObjectTest)})},
  3475. args: [],
  3476. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  3477. messageSends: ["assert:equals:", "notDefined"],
  3478. referencedClasses: []
  3479. }),
  3480. smalltalk.ObjectTest);
  3481. smalltalk.addMethod(
  3482. "_testYourself",
  3483. smalltalk.method({
  3484. selector: "testYourself",
  3485. category: 'tests',
  3486. fn: function () {
  3487. var self=this;
  3488. var o;
  3489. return smalltalk.withContext(function($ctx1) {
  3490. o=_st((smalltalk.ObjectMock || ObjectMock))._new();
  3491. _st(self)._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  3492. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o}, smalltalk.ObjectTest)});},
  3493. args: [],
  3494. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  3495. messageSends: ["new", "assert:", "==", "yourself"],
  3496. referencedClasses: ["ObjectMock"]
  3497. }),
  3498. smalltalk.ObjectTest);
  3499. smalltalk.addMethod(
  3500. "_testidentityHash",
  3501. smalltalk.method({
  3502. selector: "testidentityHash",
  3503. category: 'tests',
  3504. fn: function () {
  3505. var self=this;
  3506. var o1,o2;
  3507. return smalltalk.withContext(function($ctx1) {
  3508. o1=_st((smalltalk.Object || Object))._new();
  3509. o2=_st((smalltalk.Object || Object))._new();
  3510. _st(self)._assert_(_st(_st(o1)._identityHash()).__eq_eq(_st(o1)._identityHash()));
  3511. _st(self)._deny_(_st(_st(o1)._identityHash()).__eq_eq(_st(o2)._identityHash()));
  3512. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2}, smalltalk.ObjectTest)});},
  3513. args: [],
  3514. 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",
  3515. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  3516. referencedClasses: ["Object"]
  3517. }),
  3518. smalltalk.ObjectTest);
  3519. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  3520. smalltalk.addMethod(
  3521. "_setUp",
  3522. smalltalk.method({
  3523. selector: "setUp",
  3524. category: 'running',
  3525. fn: function () {
  3526. var self=this;
  3527. return smalltalk.withContext(function($ctx1) {
  3528. var $1,$2;
  3529. self["@backUpCommitPathJs"]=_st((smalltalk.Package || Package))._defaultCommitPathJs();
  3530. self["@backUpCommitPathSt"]=_st((smalltalk.Package || Package))._defaultCommitPathSt();
  3531. _st((smalltalk.Package || Package))._resetCommitPaths();
  3532. self["@zorkPackage"]=_st(_st((smalltalk.Package || Package))._new())._name_("Zork");
  3533. $1=_st((smalltalk.Package || Package))._new();
  3534. _st($1)._name_("Grul");
  3535. _st($1)._commitPathJs_("server/grul/js");
  3536. _st($1)._commitPathSt_("grul/st");
  3537. $2=_st($1)._yourself();
  3538. self["@grulPackage"]=$2;
  3539. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{}, smalltalk.PackageTest)});},
  3540. args: [],
  3541. source: "setUp\x0a\x09backUpCommitPathJs := Package defaultCommitPathJs.\x0a\x09backUpCommitPathSt := Package defaultCommitPathSt.\x0a\x0a\x09Package 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",
  3542. messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"],
  3543. referencedClasses: ["Package"]
  3544. }),
  3545. smalltalk.PackageTest);
  3546. smalltalk.addMethod(
  3547. "_tearDown",
  3548. smalltalk.method({
  3549. selector: "tearDown",
  3550. category: 'running',
  3551. fn: function () {
  3552. var self=this;
  3553. return smalltalk.withContext(function($ctx1) {
  3554. var $1,$2;
  3555. $1=(smalltalk.Package || Package);
  3556. _st($1)._defaultCommitPathJs_(self["@backUpCommitPathJs"]);
  3557. $2=_st($1)._defaultCommitPathSt_(self["@backUpCommitPathSt"]);
  3558. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{}, smalltalk.PackageTest)});},
  3559. args: [],
  3560. source: "tearDown\x0a\x09 Package \x0a\x09\x09defaultCommitPathJs: backUpCommitPathJs;\x0a\x09\x09defaultCommitPathSt: backUpCommitPathSt",
  3561. messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"],
  3562. referencedClasses: ["Package"]
  3563. }),
  3564. smalltalk.PackageTest);
  3565. smalltalk.addMethod(
  3566. "_testGrulCommitPathJsShouldBeServerGrulJs",
  3567. smalltalk.method({
  3568. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  3569. category: 'tests',
  3570. fn: function (){
  3571. var self=this;
  3572. return smalltalk.withContext(function($ctx1) {
  3573. _st(self)._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  3574. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{}, smalltalk.PackageTest)})},
  3575. args: [],
  3576. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: grulPackage commitPathJs equals: 'server/grul/js'",
  3577. messageSends: ["assert:equals:", "commitPathJs"],
  3578. referencedClasses: []
  3579. }),
  3580. smalltalk.PackageTest);
  3581. smalltalk.addMethod(
  3582. "_testGrulCommitPathStShouldBeGrulSt",
  3583. smalltalk.method({
  3584. selector: "testGrulCommitPathStShouldBeGrulSt",
  3585. category: 'tests',
  3586. fn: function (){
  3587. var self=this;
  3588. return smalltalk.withContext(function($ctx1) {
  3589. _st(self)._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  3590. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{}, smalltalk.PackageTest)})},
  3591. args: [],
  3592. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: grulPackage commitPathSt equals: 'grul/st'",
  3593. messageSends: ["assert:equals:", "commitPathSt"],
  3594. referencedClasses: []
  3595. }),
  3596. smalltalk.PackageTest);
  3597. smalltalk.addMethod(
  3598. "_testZorkCommitPathJsShouldBeJs",
  3599. smalltalk.method({
  3600. selector: "testZorkCommitPathJsShouldBeJs",
  3601. category: 'tests',
  3602. fn: function (){
  3603. var self=this;
  3604. return smalltalk.withContext(function($ctx1) {
  3605. _st(self)._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"js");
  3606. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJs",{}, smalltalk.PackageTest)})},
  3607. args: [],
  3608. source: "testZorkCommitPathJsShouldBeJs\x0a\x09self assert: zorkPackage commitPathJs equals: 'js'",
  3609. messageSends: ["assert:equals:", "commitPathJs"],
  3610. referencedClasses: []
  3611. }),
  3612. smalltalk.PackageTest);
  3613. smalltalk.addMethod(
  3614. "_testZorkCommitPathStShouldBeSt",
  3615. smalltalk.method({
  3616. selector: "testZorkCommitPathStShouldBeSt",
  3617. category: 'tests',
  3618. fn: function (){
  3619. var self=this;
  3620. return smalltalk.withContext(function($ctx1) {
  3621. _st(self)._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"st");
  3622. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSt",{}, smalltalk.PackageTest)})},
  3623. args: [],
  3624. source: "testZorkCommitPathStShouldBeSt\x0a\x09self assert: zorkPackage commitPathSt equals: 'st'",
  3625. messageSends: ["assert:equals:", "commitPathSt"],
  3626. referencedClasses: []
  3627. }),
  3628. smalltalk.PackageTest);
  3629. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  3630. smalltalk.addMethod(
  3631. "_setUp",
  3632. smalltalk.method({
  3633. selector: "setUp",
  3634. category: 'running',
  3635. fn: function () {
  3636. var self=this;
  3637. return smalltalk.withContext(function($ctx1) {
  3638. var $1,$2;
  3639. smalltalk.PackageTest.fn.prototype._setUp.apply(_st(self), []);
  3640. $1=(smalltalk.Package || Package);
  3641. _st($1)._defaultCommitPathJs_("javascripts/");
  3642. $2=_st($1)._defaultCommitPathSt_("smalltalk/");
  3643. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)});},
  3644. args: [],
  3645. source: "setUp\x0a\x09super setUp.\x0a\x0a\x09Package\x0a\x09\x09defaultCommitPathJs: 'javascripts/';\x0a\x09\x09defaultCommitPathSt: 'smalltalk/'.",
  3646. messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"],
  3647. referencedClasses: ["Package"]
  3648. }),
  3649. smalltalk.PackageWithDefaultCommitPathChangedTest);
  3650. smalltalk.addMethod(
  3651. "_testGrulCommitPathJsShouldBeServerGrulJs",
  3652. smalltalk.method({
  3653. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  3654. category: 'tests',
  3655. fn: function (){
  3656. var self=this;
  3657. return smalltalk.withContext(function($ctx1) {
  3658. _st(self)._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  3659. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  3660. args: [],
  3661. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: grulPackage commitPathJs equals: 'server/grul/js'",
  3662. messageSends: ["assert:equals:", "commitPathJs"],
  3663. referencedClasses: []
  3664. }),
  3665. smalltalk.PackageWithDefaultCommitPathChangedTest);
  3666. smalltalk.addMethod(
  3667. "_testGrulCommitPathStShouldBeGrulSt",
  3668. smalltalk.method({
  3669. selector: "testGrulCommitPathStShouldBeGrulSt",
  3670. category: 'tests',
  3671. fn: function (){
  3672. var self=this;
  3673. return smalltalk.withContext(function($ctx1) {
  3674. _st(self)._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  3675. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  3676. args: [],
  3677. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: grulPackage commitPathSt equals: 'grul/st'",
  3678. messageSends: ["assert:equals:", "commitPathSt"],
  3679. referencedClasses: []
  3680. }),
  3681. smalltalk.PackageWithDefaultCommitPathChangedTest);
  3682. smalltalk.addMethod(
  3683. "_testZorkCommitPathJsShouldBeJavascript",
  3684. smalltalk.method({
  3685. selector: "testZorkCommitPathJsShouldBeJavascript",
  3686. category: 'tests',
  3687. fn: function (){
  3688. var self=this;
  3689. return smalltalk.withContext(function($ctx1) {
  3690. _st(self)._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"javascripts/");
  3691. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJavascript",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  3692. args: [],
  3693. source: "testZorkCommitPathJsShouldBeJavascript\x0a\x09self assert: zorkPackage commitPathJs equals: 'javascripts/'",
  3694. messageSends: ["assert:equals:", "commitPathJs"],
  3695. referencedClasses: []
  3696. }),
  3697. smalltalk.PackageWithDefaultCommitPathChangedTest);
  3698. smalltalk.addMethod(
  3699. "_testZorkCommitPathStShouldBeSmalltalk",
  3700. smalltalk.method({
  3701. selector: "testZorkCommitPathStShouldBeSmalltalk",
  3702. category: 'tests',
  3703. fn: function (){
  3704. var self=this;
  3705. return smalltalk.withContext(function($ctx1) {
  3706. _st(self)._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"smalltalk/");
  3707. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSmalltalk",{}, smalltalk.PackageWithDefaultCommitPathChangedTest)})},
  3708. args: [],
  3709. source: "testZorkCommitPathStShouldBeSmalltalk\x0a\x09self assert: zorkPackage commitPathSt equals: 'smalltalk/'",
  3710. messageSends: ["assert:equals:", "commitPathSt"],
  3711. referencedClasses: []
  3712. }),
  3713. smalltalk.PackageWithDefaultCommitPathChangedTest);
  3714. smalltalk.addMethod(
  3715. "_shouldInheritSelectors",
  3716. smalltalk.method({
  3717. selector: "shouldInheritSelectors",
  3718. category: 'accessing',
  3719. fn: function () {
  3720. var self=this;
  3721. return smalltalk.withContext(function($ctx1) {
  3722. return false;
  3723. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{}, smalltalk.PackageWithDefaultCommitPathChangedTest.klass)});},
  3724. args: [],
  3725. source: "shouldInheritSelectors\x0a\x09^ false",
  3726. messageSends: [],
  3727. referencedClasses: []
  3728. }),
  3729. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  3730. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3731. smalltalk.addMethod(
  3732. "_testAccessing",
  3733. smalltalk.method({
  3734. selector: "testAccessing",
  3735. category: 'tests',
  3736. fn: function () {
  3737. var self=this;
  3738. return smalltalk.withContext(function($ctx1) {
  3739. _st(self)._assert_equals_(_st(_st((smalltalk.Point || Point))._x_y_((3),(4)))._x(),(3));
  3740. _st(self)._assert_equals_(_st(_st((smalltalk.Point || Point))._x_y_((3),(4)))._y(),(4));
  3741. _st(self)._assert_equals_(_st(_st(_st((smalltalk.Point || Point))._new())._x_((3)))._x(),(3));
  3742. _st(self)._assert_equals_(_st(_st(_st((smalltalk.Point || Point))._new())._y_((4)))._y(),(4));
  3743. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{}, smalltalk.PointTest)});},
  3744. args: [],
  3745. 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",
  3746. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  3747. referencedClasses: ["Point"]
  3748. }),
  3749. smalltalk.PointTest);
  3750. smalltalk.addMethod(
  3751. "_testArithmetic",
  3752. smalltalk.method({
  3753. selector: "testArithmetic",
  3754. category: 'tests',
  3755. fn: function () {
  3756. var self=this;
  3757. return smalltalk.withContext(function($ctx1) {
  3758. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__star(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((9),(16)));
  3759. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__plus(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((6),(8)));
  3760. _st(self)._assert_equals_(_st(_st((3)).__at((4))).__minus(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((0),(0)));
  3761. _st(self)._assert_equals_(_st(_st((6)).__at((8))).__slash(_st((3)).__at((4))),_st((smalltalk.Point || Point))._x_y_((2),(2)));
  3762. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{}, smalltalk.PointTest)});},
  3763. args: [],
  3764. 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)",
  3765. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  3766. referencedClasses: ["Point"]
  3767. }),
  3768. smalltalk.PointTest);
  3769. smalltalk.addMethod(
  3770. "_testAt",
  3771. smalltalk.method({
  3772. selector: "testAt",
  3773. category: 'tests',
  3774. fn: function () {
  3775. var self=this;
  3776. return smalltalk.withContext(function($ctx1) {
  3777. _st(self)._assert_equals_(_st((3)).__at((4)),_st((smalltalk.Point || Point))._x_y_((3),(4)));
  3778. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.PointTest)});},
  3779. args: [],
  3780. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  3781. messageSends: ["assert:equals:", "@", "x:y:"],
  3782. referencedClasses: ["Point"]
  3783. }),
  3784. smalltalk.PointTest);
  3785. smalltalk.addMethod(
  3786. "_testEgality",
  3787. smalltalk.method({
  3788. selector: "testEgality",
  3789. category: 'tests',
  3790. fn: function (){
  3791. var self=this;
  3792. return smalltalk.withContext(function($ctx1) {
  3793. _st(self)._assert_(_st(_st((3)).__at((4))).__eq(_st((3)).__at((4))));
  3794. _st(self)._deny_(_st(_st((3)).__at((5))).__eq(_st((3)).__at((6))));
  3795. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{}, smalltalk.PointTest)})},
  3796. args: [],
  3797. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  3798. messageSends: ["assert:", "=", "@", "deny:"],
  3799. referencedClasses: []
  3800. }),
  3801. smalltalk.PointTest);
  3802. smalltalk.addMethod(
  3803. "_testTranslateBy",
  3804. smalltalk.method({
  3805. selector: "testTranslateBy",
  3806. category: 'tests',
  3807. fn: function (){
  3808. var self=this;
  3809. return smalltalk.withContext(function($ctx1) {
  3810. _st(self)._assert_equals_(_st(_st((3)).__at((3)))._translateBy_(_st((0)).__at((1))),_st((3)).__at((4)));
  3811. _st(self)._assert_equals_(_st(_st((3)).__at((3)))._translateBy_(_st((0)).__at(_st((1))._negated())),_st((3)).__at((2)));
  3812. _st(self)._assert_equals_(_st(_st((3)).__at((3)))._translateBy_(_st((2)).__at((3))),_st((5)).__at((6)));
  3813. _st(self)._assert_equals_(_st(_st((3)).__at((3)))._translateBy_(_st(_st((3))._negated()).__at((0))),_st((0)).__at((3)));
  3814. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{}, smalltalk.PointTest)})},
  3815. args: [],
  3816. 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.",
  3817. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  3818. referencedClasses: []
  3819. }),
  3820. smalltalk.PointTest);
  3821. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3822. smalltalk.addMethod(
  3823. "_textNext",
  3824. smalltalk.method({
  3825. selector: "textNext",
  3826. category: 'tests',
  3827. fn: function (){
  3828. var self=this;
  3829. return smalltalk.withContext(function($ctx1) {
  3830. _st((10000))._timesRepeat_((function(){
  3831. var current,next;
  3832. return smalltalk.withContext(function($ctx2) {
  3833. next=_st(_st((smalltalk.Random || Random))._new())._next();
  3834. next;
  3835. _st(self)._assert_(_st(next).__gt_eq((0)));
  3836. _st(self)._assert_(_st(next).__lt((1)));
  3837. _st(self)._deny_(_st(current).__eq(next));
  3838. return _st(next).__eq(current);
  3839. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1)})}));
  3840. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{}, smalltalk.RandomTest)})},
  3841. args: [],
  3842. 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]",
  3843. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  3844. referencedClasses: ["Random"]
  3845. }),
  3846. smalltalk.RandomTest);
  3847. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3848. smalltalk.addMethod(
  3849. "_testAddRemove",
  3850. smalltalk.method({
  3851. selector: "testAddRemove",
  3852. category: 'tests',
  3853. fn: function () {
  3854. var self=this;
  3855. var set;
  3856. return smalltalk.withContext(function($ctx1) {
  3857. set=_st((smalltalk.Set || Set))._new();
  3858. _st(self)._assert_(_st(set)._isEmpty());
  3859. _st(set)._add_((3));
  3860. _st(self)._assert_(_st(set)._includes_((3)));
  3861. _st(set)._add_((5));
  3862. _st(self)._assert_(_st(set)._includes_((5)));
  3863. _st(set)._remove_((3));
  3864. _st(self)._deny_(_st(set)._includes_((3)));
  3865. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set}, smalltalk.SetTest)});},
  3866. args: [],
  3867. 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)",
  3868. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  3869. referencedClasses: ["Set"]
  3870. }),
  3871. smalltalk.SetTest);
  3872. smalltalk.addMethod(
  3873. "_testAt",
  3874. smalltalk.method({
  3875. selector: "testAt",
  3876. category: 'tests',
  3877. fn: function () {
  3878. var self=this;
  3879. return smalltalk.withContext(function($ctx1) {
  3880. _st(self)._should_raise_((function(){
  3881. return smalltalk.withContext(function($ctx2) {
  3882. return _st(_st((smalltalk.Set || Set))._new())._at_put_((1),(2));
  3883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
  3884. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{}, smalltalk.SetTest)});},
  3885. args: [],
  3886. source: "testAt\x0a\x09self should: [Set new at: 1 put: 2] raise: Error",
  3887. messageSends: ["should:raise:", "at:put:", "new"],
  3888. referencedClasses: ["Set", "Error"]
  3889. }),
  3890. smalltalk.SetTest);
  3891. smalltalk.addMethod(
  3892. "_testCollect",
  3893. smalltalk.method({
  3894. selector: "testCollect",
  3895. category: 'tests',
  3896. fn: function (){
  3897. var self=this;
  3898. return smalltalk.withContext(function($ctx1) {
  3899. _st(self)._assert_equals_(_st(_st([(5), (6), (8)])._asSet())._collect_((function(x){
  3900. return smalltalk.withContext(function($ctx2) {
  3901. return _st(x).__backslash_backslash((3));
  3902. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),_st([(0), (2)])._asSet());
  3903. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{}, smalltalk.SetTest)})},
  3904. args: [],
  3905. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  3906. messageSends: ["assert:equals:", "collect:", "\x5c\x5c", "asSet"],
  3907. referencedClasses: []
  3908. }),
  3909. smalltalk.SetTest);
  3910. smalltalk.addMethod(
  3911. "_testComparing",
  3912. smalltalk.method({
  3913. selector: "testComparing",
  3914. category: 'tests',
  3915. fn: function () {
  3916. var self=this;
  3917. return smalltalk.withContext(function($ctx1) {
  3918. _st(self)._assert_equals_(_st([(0), (2)])._asSet(),_st([(0), (2)])._asSet());
  3919. _st(self)._assert_equals_(_st([(2), (0)])._asSet(),_st([(0), (2)])._asSet());
  3920. _st(self)._deny_(_st(_st([(0), (2), (3)])._asSet()).__eq(_st([(0), (2)])._asSet()));
  3921. _st(self)._deny_(_st(_st([(1), (2)])._asSet()).__eq(_st([(0), (2)])._asSet()));
  3922. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{}, smalltalk.SetTest)});},
  3923. args: [],
  3924. source: "testComparing\x0a\x09self assert: #(0 2) asSet equals: #(0 2) asSet.\x0a self assert: #(2 0) asSet equals: #(0 2) asSet.\x0a self deny: #(0 2 3) asSet = #(0 2) asSet.\x0a self deny: #(1 2) asSet = #(0 2) asSet",
  3925. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  3926. referencedClasses: []
  3927. }),
  3928. smalltalk.SetTest);
  3929. smalltalk.addMethod(
  3930. "_testPrintString",
  3931. smalltalk.method({
  3932. selector: "testPrintString",
  3933. category: 'tests',
  3934. fn: function (){
  3935. var self=this;
  3936. var set;
  3937. return smalltalk.withContext(function($ctx1) {
  3938. var $1,$2,$3,$4;
  3939. set=_st((smalltalk.Set || Set))._new();
  3940. _st(self)._assert_equals_(_st(set)._printString(),"a Set ()");
  3941. $1=set;
  3942. _st($1)._add_((1));
  3943. $2=_st($1)._add_((3));
  3944. _st(self)._assert_equals_(_st(set)._printString(),"a Set (1 3)");
  3945. _st(set)._add_("foo");
  3946. _st(self)._assert_equals_(_st(set)._printString(),"a Set (1 3 'foo')");
  3947. $3=set;
  3948. _st($3)._remove_((1));
  3949. $4=_st($3)._remove_((3));
  3950. _st(self)._assert_equals_(_st(set)._printString(),"a Set ('foo')");
  3951. _st(set)._add_((3));
  3952. _st(self)._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  3953. _st(set)._add_((3));
  3954. _st(self)._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  3955. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set}, smalltalk.SetTest)})},
  3956. args: [],
  3957. 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)'",
  3958. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  3959. referencedClasses: ["Set"]
  3960. }),
  3961. smalltalk.SetTest);
  3962. smalltalk.addMethod(
  3963. "_testSize",
  3964. smalltalk.method({
  3965. selector: "testSize",
  3966. category: 'tests',
  3967. fn: function () {
  3968. var self=this;
  3969. return smalltalk.withContext(function($ctx1) {
  3970. _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._new())._size(),(0));
  3971. _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._withAll_([(1), (2), (3), (4)]))._size(),(4));
  3972. _st(self)._assert_equals_(_st(_st((smalltalk.Set || Set))._withAll_([(1), (1), (1), (1)]))._size(),(1));
  3973. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{}, smalltalk.SetTest)});},
  3974. args: [],
  3975. 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",
  3976. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  3977. referencedClasses: ["Set"]
  3978. }),
  3979. smalltalk.SetTest);
  3980. smalltalk.addMethod(
  3981. "_testUnicity",
  3982. smalltalk.method({
  3983. selector: "testUnicity",
  3984. category: 'tests',
  3985. fn: function (){
  3986. var self=this;
  3987. var set;
  3988. return smalltalk.withContext(function($ctx1) {
  3989. set=_st((smalltalk.Set || Set))._new();
  3990. _st(set)._add_((21));
  3991. _st(set)._add_("hello");
  3992. _st(set)._add_((21));
  3993. _st(self)._assert_equals_(_st(set)._size(),(2));
  3994. _st(set)._add_("hello");
  3995. _st(self)._assert_equals_(_st(set)._size(),(2));
  3996. _st(self)._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  3997. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set}, smalltalk.SetTest)})},
  3998. args: [],
  3999. 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')",
  4000. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  4001. referencedClasses: ["Set"]
  4002. }),
  4003. smalltalk.SetTest);
  4004. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4005. smalltalk.addMethod(
  4006. "_testCopying",
  4007. smalltalk.method({
  4008. selector: "testCopying",
  4009. category: 'tests',
  4010. fn: function () {
  4011. var self=this;
  4012. return smalltalk.withContext(function($ctx1) {
  4013. _st(self)._assert_equals_(_st(nil)._copy(),nil);
  4014. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{}, smalltalk.UndefinedTest)});},
  4015. args: [],
  4016. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  4017. messageSends: ["assert:equals:", "copy"],
  4018. referencedClasses: []
  4019. }),
  4020. smalltalk.UndefinedTest);
  4021. smalltalk.addMethod(
  4022. "_testDeepCopy",
  4023. smalltalk.method({
  4024. selector: "testDeepCopy",
  4025. category: 'tests',
  4026. fn: function () {
  4027. var self=this;
  4028. return smalltalk.withContext(function($ctx1) {
  4029. _st(self)._assert_(_st(_st(nil)._deepCopy()).__eq(nil));
  4030. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{}, smalltalk.UndefinedTest)});},
  4031. args: [],
  4032. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  4033. messageSends: ["assert:", "=", "deepCopy"],
  4034. referencedClasses: []
  4035. }),
  4036. smalltalk.UndefinedTest);
  4037. smalltalk.addMethod(
  4038. "_testIfNil",
  4039. smalltalk.method({
  4040. selector: "testIfNil",
  4041. category: 'tests',
  4042. fn: function () {
  4043. var self=this;
  4044. return smalltalk.withContext(function($ctx1) {
  4045. var $1,$2,$3,$5,$4,$6,$7;
  4046. $1=self;
  4047. if(($receiver = nil) == nil || $receiver == undefined){
  4048. $2=true;
  4049. } else {
  4050. $2=nil;
  4051. };
  4052. _st($1)._assert_equals_($2,true);
  4053. $3=self;
  4054. if(($receiver = nil) == nil || $receiver == undefined){
  4055. $5=nil;
  4056. } else {
  4057. $5=true;
  4058. };
  4059. $4=_st($5).__eq(true);
  4060. _st($3)._deny_($4);
  4061. $6=self;
  4062. if(($receiver = nil) == nil || $receiver == undefined){
  4063. $7=true;
  4064. } else {
  4065. $7=false;
  4066. };
  4067. _st($6)._assert_equals_($7,true);
  4068. _st(self)._deny_(_st(_st(nil)._ifNotNil_ifNil_((function(){
  4069. return smalltalk.withContext(function($ctx2) {
  4070. return true;
  4071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  4072. return smalltalk.withContext(function($ctx2) {
  4073. return false;
  4074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq(true));
  4075. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{}, smalltalk.UndefinedTest)});},
  4076. args: [],
  4077. 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",
  4078. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  4079. referencedClasses: []
  4080. }),
  4081. smalltalk.UndefinedTest);
  4082. smalltalk.addMethod(
  4083. "_testIsNil",
  4084. smalltalk.method({
  4085. selector: "testIsNil",
  4086. category: 'tests',
  4087. fn: function () {
  4088. var self=this;
  4089. return smalltalk.withContext(function($ctx1) {
  4090. _st(self)._assert_(_st(nil)._isNil());
  4091. _st(self)._deny_(_st(nil)._notNil());
  4092. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{}, smalltalk.UndefinedTest)});},
  4093. args: [],
  4094. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  4095. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  4096. referencedClasses: []
  4097. }),
  4098. smalltalk.UndefinedTest);