Kernel-Tests.js 162 KB

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