1
0

Kernel-Tests.js 125 KB

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