Kernel-Tests.js 151 KB

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