1
0

Kernel-Tests.js 149 KB

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