Kernel-Tests.js 160 KB

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