Kernel-Tests.js 149 KB

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