Kernel-Tests.js 140 KB

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