Kernel-Tests.deploy.js 78 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556
  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. fn: function (){
  8. var self=this;
  9. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((function(){
  10. return smalltalk.send((1),"__plus",[(1)]);
  11. }),"_compiledSource",[]),"_includesSubString_",["function"])]);
  12. return self}
  13. }),
  14. smalltalk.BlockClosureTest);
  15. smalltalk.addMethod(
  16. "_testEnsure",
  17. smalltalk.method({
  18. selector: "testEnsure",
  19. fn: function (){
  20. var self=this;
  21. smalltalk.send(self,"_assert_",[smalltalk.send((function(){
  22. return smalltalk.send((smalltalk.Error || Error),"_new",[]);
  23. }),"_ensure_",[(function(){
  24. return true;
  25. })])]);
  26. return self}
  27. }),
  28. smalltalk.BlockClosureTest);
  29. smalltalk.addMethod(
  30. "_testEnsureRaises",
  31. smalltalk.method({
  32. selector: "testEnsureRaises",
  33. fn: function (){
  34. var self=this;
  35. smalltalk.send(self,"_should_raise_",[(function(){
  36. return smalltalk.send((function(){
  37. return smalltalk.send(smalltalk.send((smalltalk.Error || Error),"_new",[]),"_signal",[]);
  38. }),"_ensure_",[(function(){
  39. return true;
  40. })]);
  41. }),(smalltalk.Error || Error)]);
  42. return self}
  43. }),
  44. smalltalk.BlockClosureTest);
  45. smalltalk.addMethod(
  46. "_testNumArgs",
  47. smalltalk.method({
  48. selector: "testNumArgs",
  49. fn: function (){
  50. var self=this;
  51. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(){
  52. }),"_numArgs",[]),(0)]);
  53. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(a,b){
  54. }),"_numArgs",[]),(2)]);
  55. return self}
  56. }),
  57. smalltalk.BlockClosureTest);
  58. smalltalk.addMethod(
  59. "_testOnDo",
  60. smalltalk.method({
  61. selector: "testOnDo",
  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. }),
  71. smalltalk.BlockClosureTest);
  72. smalltalk.addMethod(
  73. "_testValue",
  74. smalltalk.method({
  75. selector: "testValue",
  76. fn: function (){
  77. var self=this;
  78. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(){
  79. return smalltalk.send((1),"__plus",[(1)]);
  80. }),"_value",[]),(2)]);
  81. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(x){
  82. return smalltalk.send(x,"__plus",[(1)]);
  83. }),"_value_",[(2)]),(3)]);
  84. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(x,y){
  85. return smalltalk.send(x,"__star",[y]);
  86. }),"_value_value_",[(2),(4)]),(8)]);
  87. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(a,b,c){
  88. return (1);
  89. }),"_value",[]),(1)]);
  90. return self}
  91. }),
  92. smalltalk.BlockClosureTest);
  93. smalltalk.addMethod(
  94. "_testValueWithPossibleArguments",
  95. smalltalk.method({
  96. selector: "testValueWithPossibleArguments",
  97. fn: function (){
  98. var self=this;
  99. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(){
  100. return (1);
  101. }),"_valueWithPossibleArguments_",[[(3), (4)]]),(1)]);
  102. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(a){
  103. return smalltalk.send(a,"__plus",[(4)]);
  104. }),"_valueWithPossibleArguments_",[[(3), (4)]]),(7)]);
  105. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(a,b){
  106. return smalltalk.send(a,"__plus",[b]);
  107. }),"_valueWithPossibleArguments_",[[(3), (4), (5)]]),(7)]);
  108. return self}
  109. }),
  110. smalltalk.BlockClosureTest);
  111. smalltalk.addMethod(
  112. "_testWhileFalse",
  113. smalltalk.method({
  114. selector: "testWhileFalse",
  115. fn: function (){
  116. var self=this;
  117. var i;
  118. i=(0);
  119. smalltalk.send((function(){
  120. return smalltalk.send(i,"__gt",[(5)]);
  121. }),"_whileFalse_",[(function(){
  122. i=smalltalk.send(i,"__plus",[(1)]);
  123. return i;
  124. })]);
  125. smalltalk.send(self,"_assert_equals_",[i,(6)]);
  126. i=(0);
  127. smalltalk.send((function(){
  128. i=smalltalk.send(i,"__plus",[(1)]);
  129. i;
  130. return smalltalk.send(i,"__gt",[(5)]);
  131. }),"_whileFalse",[]);
  132. smalltalk.send(self,"_assert_equals_",[i,(6)]);
  133. return self}
  134. }),
  135. smalltalk.BlockClosureTest);
  136. smalltalk.addMethod(
  137. "_testWhileTrue",
  138. smalltalk.method({
  139. selector: "testWhileTrue",
  140. fn: function (){
  141. var self=this;
  142. var i;
  143. i=(0);
  144. smalltalk.send((function(){
  145. return smalltalk.send(i,"__lt",[(5)]);
  146. }),"_whileTrue_",[(function(){
  147. i=smalltalk.send(i,"__plus",[(1)]);
  148. return i;
  149. })]);
  150. smalltalk.send(self,"_assert_equals_",[i,(5)]);
  151. i=(0);
  152. smalltalk.send((function(){
  153. i=smalltalk.send(i,"__plus",[(1)]);
  154. i;
  155. return smalltalk.send(i,"__lt",[(5)]);
  156. }),"_whileTrue",[]);
  157. smalltalk.send(self,"_assert_equals_",[i,(5)]);
  158. return self}
  159. }),
  160. smalltalk.BlockClosureTest);
  161. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  162. smalltalk.addMethod(
  163. "_testEquality",
  164. smalltalk.method({
  165. selector: "testEquality",
  166. fn: function (){
  167. var self=this;
  168. smalltalk.send(self,"_deny_",[smalltalk.send((0),"__eq",[false])]);
  169. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq",[(0)])]);
  170. smalltalk.send(self,"_deny_",[smalltalk.send("","__eq",[false])]);
  171. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq",[""])]);
  172. smalltalk.send(self,"_assert_",[smalltalk.send(true,"__eq",[true])]);
  173. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq",[true])]);
  174. smalltalk.send(self,"_deny_",[smalltalk.send(true,"__eq",[false])]);
  175. smalltalk.send(self,"_assert_",[smalltalk.send(false,"__eq",[false])]);
  176. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(true,"_yourself",[]),"__eq",[true])]);
  177. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(true,"_yourself",[]),"__eq",[smalltalk.send(true,"_yourself",[])])]);
  178. return self}
  179. }),
  180. smalltalk.BooleanTest);
  181. smalltalk.addMethod(
  182. "_testIdentity",
  183. smalltalk.method({
  184. selector: "testIdentity",
  185. fn: function (){
  186. var self=this;
  187. smalltalk.send(self,"_deny_",[smalltalk.send((0),"__eq_eq",[false])]);
  188. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq_eq",[(0)])]);
  189. smalltalk.send(self,"_deny_",[smalltalk.send("","__eq_eq",[false])]);
  190. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq_eq",[""])]);
  191. smalltalk.send(self,"_assert_",[smalltalk.send(true,"__eq_eq",[true])]);
  192. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq_eq",[true])]);
  193. smalltalk.send(self,"_deny_",[smalltalk.send(true,"__eq_eq",[false])]);
  194. smalltalk.send(self,"_assert_",[smalltalk.send(false,"__eq_eq",[false])]);
  195. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(true,"_yourself",[]),"__eq_eq",[true])]);
  196. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(true,"_yourself",[]),"__eq_eq",[smalltalk.send(true,"_yourself",[])])]);
  197. return self}
  198. }),
  199. smalltalk.BooleanTest);
  200. smalltalk.addMethod(
  201. "_testIfTrueIfFalse",
  202. smalltalk.method({
  203. selector: "testIfTrueIfFalse",
  204. fn: function (){
  205. var self=this;
  206. var $1,$2,$3,$4,$5,$6,$7,$8;
  207. if(smalltalk.assert(true)){
  208. $1="alternative block";
  209. };
  210. smalltalk.send(self,"_assert_",[smalltalk.send($1,"__eq",["alternative block"])]);
  211. if(! smalltalk.assert(true)){
  212. $2="alternative block";
  213. };
  214. smalltalk.send(self,"_assert_",[smalltalk.send($2,"__eq",[nil])]);
  215. if(smalltalk.assert(false)){
  216. $3="alternative block";
  217. };
  218. smalltalk.send(self,"_assert_",[smalltalk.send($3,"__eq",[nil])]);
  219. if(! smalltalk.assert(false)){
  220. $4="alternative block";
  221. };
  222. smalltalk.send(self,"_assert_",[smalltalk.send($4,"__eq",["alternative block"])]);
  223. if(smalltalk.assert(false)){
  224. $5="alternative block";
  225. } else {
  226. $5="alternative block2";
  227. };
  228. smalltalk.send(self,"_assert_",[smalltalk.send($5,"__eq",["alternative block2"])]);
  229. if(smalltalk.assert(false)){
  230. $6="alternative block2";
  231. } else {
  232. $6="alternative block";
  233. };
  234. smalltalk.send(self,"_assert_",[smalltalk.send($6,"__eq",["alternative block"])]);
  235. if(smalltalk.assert(true)){
  236. $7="alternative block";
  237. } else {
  238. $7="alternative block2";
  239. };
  240. smalltalk.send(self,"_assert_",[smalltalk.send($7,"__eq",["alternative block"])]);
  241. if(smalltalk.assert(true)){
  242. $8="alternative block2";
  243. } else {
  244. $8="alternative block";
  245. };
  246. smalltalk.send(self,"_assert_",[smalltalk.send($8,"__eq",["alternative block2"])]);
  247. return self}
  248. }),
  249. smalltalk.BooleanTest);
  250. smalltalk.addMethod(
  251. "_testLogic",
  252. smalltalk.method({
  253. selector: "testLogic",
  254. fn: function (){
  255. var self=this;
  256. var $1,$2,$3,$4;
  257. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_&",[true])]);
  258. smalltalk.send(self,"_deny_",[smalltalk.send(true,"_&",[false])]);
  259. smalltalk.send(self,"_deny_",[smalltalk.send(false,"_&",[true])]);
  260. $1=smalltalk.send(self,"_deny_",[smalltalk.send(false,"_&",[false])]);
  261. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_|",[true])]);
  262. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_|",[false])]);
  263. smalltalk.send(self,"_assert_",[smalltalk.send(false,"_|",[true])]);
  264. $2=smalltalk.send(self,"_deny_",[smalltalk.send(false,"_|",[false])]);
  265. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_&",[smalltalk.send((1),"__gt",[(0)])])]);
  266. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_&",[false])]);
  267. $3=smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_&",[smalltalk.send((1),"__gt",[(2)])])]);
  268. smalltalk.send(self,"_assert_",[smalltalk.send(false,"_|",[smalltalk.send((1),"__gt",[(0)])])]);
  269. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_|",[false])]);
  270. $4=smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_|",[smalltalk.send((1),"__gt",[(2)])])]);
  271. return self}
  272. }),
  273. smalltalk.BooleanTest);
  274. smalltalk.addMethod(
  275. "_testLogicKeywords",
  276. smalltalk.method({
  277. selector: "testLogicKeywords",
  278. fn: function (){
  279. var self=this;
  280. var $1,$2,$3,$4;
  281. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_and_",[(function(){
  282. return true;
  283. })])]);
  284. smalltalk.send(self,"_deny_",[smalltalk.send(true,"_and_",[(function(){
  285. return false;
  286. })])]);
  287. smalltalk.send(self,"_deny_",[smalltalk.send(false,"_and_",[(function(){
  288. return true;
  289. })])]);
  290. $1=smalltalk.send(self,"_deny_",[smalltalk.send(false,"_and_",[(function(){
  291. return false;
  292. })])]);
  293. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_or_",[(function(){
  294. return true;
  295. })])]);
  296. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_or_",[(function(){
  297. return false;
  298. })])]);
  299. smalltalk.send(self,"_assert_",[smalltalk.send(false,"_or_",[(function(){
  300. return true;
  301. })])]);
  302. $2=smalltalk.send(self,"_deny_",[smalltalk.send(false,"_or_",[(function(){
  303. return false;
  304. })])]);
  305. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_and_",[(function(){
  306. return smalltalk.send((1),"__gt",[(0)]);
  307. })])]);
  308. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_and_",[(function(){
  309. return false;
  310. })])]);
  311. $3=smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_and_",[(function(){
  312. return smalltalk.send((1),"__gt",[(2)]);
  313. })])]);
  314. smalltalk.send(self,"_assert_",[smalltalk.send(false,"_or_",[(function(){
  315. return smalltalk.send((1),"__gt",[(0)]);
  316. })])]);
  317. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_or_",[(function(){
  318. return false;
  319. })])]);
  320. $4=smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_or_",[(function(){
  321. return smalltalk.send((1),"__gt",[(2)]);
  322. })])]);
  323. return self}
  324. }),
  325. smalltalk.BooleanTest);
  326. smalltalk.addMethod(
  327. "_testNonBooleanError",
  328. smalltalk.method({
  329. selector: "testNonBooleanError",
  330. fn: function (){
  331. var self=this;
  332. var b;
  333. b= '' ;
  334. ;
  335. smalltalk.send(self,"_should_raise_",[(function(){
  336. if(smalltalk.assert(self["@nonBoolean"])){
  337. } else {
  338. };
  339. }),(smalltalk.NonBooleanReceiver || NonBooleanReceiver)]);
  340. return self}
  341. }),
  342. smalltalk.BooleanTest);
  343. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  344. smalltalk.addMethod(
  345. "_setUp",
  346. smalltalk.method({
  347. selector: "setUp",
  348. fn: function (){
  349. var self=this;
  350. self["@builder"]=smalltalk.send((smalltalk.ClassBuilder || ClassBuilder),"_new",[]);
  351. return self}
  352. }),
  353. smalltalk.ClassBuilderTest);
  354. smalltalk.addMethod(
  355. "_tearDown",
  356. smalltalk.method({
  357. selector: "tearDown",
  358. fn: function (){
  359. var self=this;
  360. if(($receiver = self["@theClass"]) == nil || $receiver == undefined){
  361. self["@theClass"];
  362. } else {
  363. smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_removeClass_",[self["@theClass"]]);
  364. self["@theClass"]=nil;
  365. self["@theClass"];
  366. };
  367. return self}
  368. }),
  369. smalltalk.ClassBuilderTest);
  370. smalltalk.addMethod(
  371. "_testClassCopy",
  372. smalltalk.method({
  373. selector: "testClassCopy",
  374. fn: function (){
  375. var self=this;
  376. self["@theClass"]=smalltalk.send(self["@builder"],"_copyClass_named_",[(smalltalk.ObjectMock || ObjectMock),"ObjectMock2"]);
  377. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(self["@theClass"],"_superclass",[]),"__eq_eq",[smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_superclass",[])])]);
  378. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(self["@theClass"],"_instanceVariableNames",[]),"__eq_eq",[smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_instanceVariableNames",[])])]);
  379. smalltalk.send(self,"_assert_equals_",[smalltalk.send(self["@theClass"],"_name",[]),"ObjectMock2"]);
  380. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(self["@theClass"],"_package",[]),"__eq_eq",[smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_package",[])])]);
  381. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self["@theClass"],"_methodDictionary",[]),"_keys",[]),smalltalk.send(smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_methodDictionary",[]),"_keys",[])]);
  382. return self}
  383. }),
  384. smalltalk.ClassBuilderTest);
  385. smalltalk.addMethod(
  386. "_testInstanceVariableNames",
  387. smalltalk.method({
  388. selector: "testInstanceVariableNames",
  389. fn: function (){
  390. var self=this;
  391. smalltalk.send(self,"_assert_equals_",[smalltalk.send(self["@builder"],"_instanceVariableNamesFor_",[" hello world "]),["hello", "world"]]);
  392. return self}
  393. }),
  394. smalltalk.ClassBuilderTest);
  395. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  396. smalltalk.addMethod(
  397. "_assertSameContents_as_",
  398. smalltalk.method({
  399. selector: "assertSameContents:as:",
  400. fn: function (aCollection,anotherCollection){
  401. var self=this;
  402. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(aCollection,"_size",[]),"__eq",[smalltalk.send(anotherCollection,"_size",[])])]);
  403. smalltalk.send(aCollection,"_do_",[(function(each){
  404. return smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(aCollection,"_occurrencesOf_",[each]),"__eq",[smalltalk.send(anotherCollection,"_occurrencesOf_",[each])])]);
  405. })]);
  406. return self}
  407. }),
  408. smalltalk.CollectionTest);
  409. smalltalk.addMethod(
  410. "_collection",
  411. smalltalk.method({
  412. selector: "collection",
  413. fn: function (){
  414. var self=this;
  415. var $1;
  416. $1=smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_withAll_",[smalltalk.send(self,"_defaultValues",[])]);
  417. return $1;
  418. }
  419. }),
  420. smalltalk.CollectionTest);
  421. smalltalk.addMethod(
  422. "_collectionClass",
  423. smalltalk.method({
  424. selector: "collectionClass",
  425. fn: function (){
  426. var self=this;
  427. var $1;
  428. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_collectionClass",[]);
  429. return $1;
  430. }
  431. }),
  432. smalltalk.CollectionTest);
  433. smalltalk.addMethod(
  434. "_collectionWithDuplicates",
  435. smalltalk.method({
  436. selector: "collectionWithDuplicates",
  437. fn: function (){
  438. var self=this;
  439. var $1;
  440. $1=smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_withAll_",[["a", "b", "c", (1), (2), (1), "a"]]);
  441. return $1;
  442. }
  443. }),
  444. smalltalk.CollectionTest);
  445. smalltalk.addMethod(
  446. "_defaultValues",
  447. smalltalk.method({
  448. selector: "defaultValues",
  449. fn: function (){
  450. var self=this;
  451. return [(1), (2), (3), (-4)];
  452. }
  453. }),
  454. smalltalk.CollectionTest);
  455. smalltalk.addMethod(
  456. "_isCollectionReadOnly",
  457. smalltalk.method({
  458. selector: "isCollectionReadOnly",
  459. fn: function (){
  460. var self=this;
  461. return false;
  462. }
  463. }),
  464. smalltalk.CollectionTest);
  465. smalltalk.addMethod(
  466. "_testAsArray",
  467. smalltalk.method({
  468. selector: "testAsArray",
  469. fn: function (){
  470. var self=this;
  471. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(self,"_collection",[]),smalltalk.send(smalltalk.send(self,"_collection",[]),"_asArray",[])]);
  472. return self}
  473. }),
  474. smalltalk.CollectionTest);
  475. smalltalk.addMethod(
  476. "_testAsOrderedCollection",
  477. smalltalk.method({
  478. selector: "testAsOrderedCollection",
  479. fn: function (){
  480. var self=this;
  481. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(self,"_collection",[]),smalltalk.send(smalltalk.send(self,"_collection",[]),"_asOrderedCollection",[])]);
  482. return self}
  483. }),
  484. smalltalk.CollectionTest);
  485. smalltalk.addMethod(
  486. "_testAsSet",
  487. smalltalk.method({
  488. selector: "testAsSet",
  489. fn: function (){
  490. var self=this;
  491. var c;
  492. var set;
  493. c=smalltalk.send(self,"_collectionWithDuplicates",[]);
  494. set=smalltalk.send(c,"_asSet",[]);
  495. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(set,"_size",[]),"__eq",[(5)])]);
  496. smalltalk.send(c,"_do_",[(function(each){
  497. return smalltalk.send(self,"_assert_",[smalltalk.send(set,"_includes_",[each])]);
  498. })]);
  499. return self}
  500. }),
  501. smalltalk.CollectionTest);
  502. smalltalk.addMethod(
  503. "_testCollect",
  504. smalltalk.method({
  505. selector: "testCollect",
  506. fn: function (){
  507. var self=this;
  508. var newCollection;
  509. newCollection=[(1), (2), (3), (4)];
  510. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_collect_",[(function(each){
  511. return smalltalk.send(each,"_abs",[]);
  512. })]),newCollection]);
  513. return self}
  514. }),
  515. smalltalk.CollectionTest);
  516. smalltalk.addMethod(
  517. "_testDetect",
  518. smalltalk.method({
  519. selector: "testDetect",
  520. fn: function (){
  521. var self=this;
  522. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  523. return smalltalk.send(each,"__lt",[(0)]);
  524. })]),"__eq",[(-4)])]);
  525. smalltalk.send(self,"_should_raise_",[(function(){
  526. return smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  527. return smalltalk.send(each,"__eq",[(6)]);
  528. })]);
  529. }),(smalltalk.Error || Error)]);
  530. return self}
  531. }),
  532. smalltalk.CollectionTest);
  533. smalltalk.addMethod(
  534. "_testDo",
  535. smalltalk.method({
  536. selector: "testDo",
  537. fn: function (){
  538. var self=this;
  539. var newCollection;
  540. newCollection=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  541. smalltalk.send(smalltalk.send(self,"_collection",[]),"_do_",[(function(each){
  542. return smalltalk.send(newCollection,"_add_",[each]);
  543. })]);
  544. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(self,"_collection",[]),newCollection]);
  545. return self}
  546. }),
  547. smalltalk.CollectionTest);
  548. smalltalk.addMethod(
  549. "_testIsEmpty",
  550. smalltalk.method({
  551. selector: "testIsEmpty",
  552. fn: function (){
  553. var self=this;
  554. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_new",[]),"_isEmpty",[])]);
  555. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_isEmpty",[])]);
  556. return self}
  557. }),
  558. smalltalk.CollectionTest);
  559. smalltalk.addMethod(
  560. "_testSelect",
  561. smalltalk.method({
  562. selector: "testSelect",
  563. fn: function (){
  564. var self=this;
  565. var newCollection;
  566. newCollection=[(2), (-4)];
  567. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_select_",[(function(each){
  568. return smalltalk.send(each,"_even",[]);
  569. })]),newCollection]);
  570. return self}
  571. }),
  572. smalltalk.CollectionTest);
  573. smalltalk.addMethod(
  574. "_testSize",
  575. smalltalk.method({
  576. selector: "testSize",
  577. fn: function (){
  578. var self=this;
  579. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_new",[]),"_size",[]),"__eq",[(0)])]);
  580. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_size",[]),"__eq",[(4)])]);
  581. return self}
  582. }),
  583. smalltalk.CollectionTest);
  584. smalltalk.addMethod(
  585. "_collectionClass",
  586. smalltalk.method({
  587. selector: "collectionClass",
  588. fn: function (){
  589. var self=this;
  590. return nil;
  591. }
  592. }),
  593. smalltalk.CollectionTest.klass);
  594. smalltalk.addMethod(
  595. "_isAbstract",
  596. smalltalk.method({
  597. selector: "isAbstract",
  598. fn: function (){
  599. var self=this;
  600. var $1;
  601. $1=smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_isNil",[]);
  602. return $1;
  603. }
  604. }),
  605. smalltalk.CollectionTest.klass);
  606. smalltalk.addClass('HashedCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  607. smalltalk.addMethod(
  608. "_collection",
  609. smalltalk.method({
  610. selector: "collection",
  611. fn: function (){
  612. var self=this;
  613. var $1;
  614. $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)])]);
  615. return $1;
  616. }
  617. }),
  618. smalltalk.HashedCollectionTest);
  619. smalltalk.addMethod(
  620. "_collectionWithDuplicates",
  621. smalltalk.method({
  622. selector: "collectionWithDuplicates",
  623. fn: function (){
  624. var self=this;
  625. var $1;
  626. $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)])]);
  627. return $1;
  628. }
  629. }),
  630. smalltalk.HashedCollectionTest);
  631. smalltalk.addMethod(
  632. "_collectionClass",
  633. smalltalk.method({
  634. selector: "collectionClass",
  635. fn: function (){
  636. var self=this;
  637. return (smalltalk.HashedCollection || HashedCollection);
  638. }
  639. }),
  640. smalltalk.HashedCollectionTest.klass);
  641. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  642. smalltalk.addMethod(
  643. "_collection",
  644. smalltalk.method({
  645. selector: "collection",
  646. fn: function (){
  647. var self=this;
  648. var $2,$3,$1;
  649. $2=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  650. smalltalk.send($2,"_at_put_",[(1),(1)]);
  651. smalltalk.send($2,"_at_put_",["a",(2)]);
  652. smalltalk.send($2,"_at_put_",[true,(3)]);
  653. smalltalk.send($2,"_at_put_",[(4),(-4)]);
  654. $3=smalltalk.send($2,"_yourself",[]);
  655. $1=$3;
  656. return $1;
  657. }
  658. }),
  659. smalltalk.DictionaryTest);
  660. smalltalk.addMethod(
  661. "_collectionWithDuplicates",
  662. smalltalk.method({
  663. selector: "collectionWithDuplicates",
  664. fn: function (){
  665. var self=this;
  666. var $2,$3,$1;
  667. $2=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  668. smalltalk.send($2,"_at_put_",[(1),(1)]);
  669. smalltalk.send($2,"_at_put_",["a",(2)]);
  670. smalltalk.send($2,"_at_put_",[true,(3)]);
  671. smalltalk.send($2,"_at_put_",[(4),(-4)]);
  672. smalltalk.send($2,"_at_put_",["b",(1)]);
  673. smalltalk.send($2,"_at_put_",[(3),(3)]);
  674. smalltalk.send($2,"_at_put_",[false,(12)]);
  675. $3=smalltalk.send($2,"_yourself",[]);
  676. $1=$3;
  677. return $1;
  678. }
  679. }),
  680. smalltalk.DictionaryTest);
  681. smalltalk.addMethod(
  682. "_testAccessing",
  683. smalltalk.method({
  684. selector: "testAccessing",
  685. fn: function (){
  686. var self=this;
  687. var d;
  688. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  689. smalltalk.send(d,"_at_put_",["hello","world"]);
  690. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_at_",["hello"]),"__eq",["world"])]);
  691. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_at_ifAbsent_",["hello",(function(){
  692. return nil;
  693. })]),"__eq",["world"])]);
  694. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(d,"_at_ifAbsent_",["foo",(function(){
  695. return nil;
  696. })]),"__eq",["world"])]);
  697. smalltalk.send(d,"_at_put_",[(1),(2)]);
  698. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_at_",[(1)]),"__eq",[(2)])]);
  699. smalltalk.send(d,"_at_put_",[smalltalk.send((1),"__at",[(3)]),(3)]);
  700. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_at_",[smalltalk.send((1),"__at",[(3)])]),"__eq",[(3)])]);
  701. return self}
  702. }),
  703. smalltalk.DictionaryTest);
  704. smalltalk.addMethod(
  705. "_testDynamicDictionaries",
  706. smalltalk.method({
  707. selector: "testDynamicDictionaries",
  708. fn: function (){
  709. var self=this;
  710. 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)])])])]);
  711. return self}
  712. }),
  713. smalltalk.DictionaryTest);
  714. smalltalk.addMethod(
  715. "_testEquality",
  716. smalltalk.method({
  717. selector: "testEquality",
  718. fn: function (){
  719. var self=this;
  720. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  721. var d1;
  722. var d2;
  723. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]),"__eq",[smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[])])]);
  724. $1=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  725. smalltalk.send($1,"_at_put_",[(1),(2)]);
  726. $2=smalltalk.send($1,"_yourself",[]);
  727. d1=$2;
  728. $3=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  729. smalltalk.send($3,"_at_put_",[(1),(2)]);
  730. $4=smalltalk.send($3,"_yourself",[]);
  731. d2=$4;
  732. smalltalk.send(self,"_assert_",[smalltalk.send(d1,"__eq",[d2])]);
  733. $5=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  734. smalltalk.send($5,"_at_put_",[(1),(3)]);
  735. $6=smalltalk.send($5,"_yourself",[]);
  736. d2=$6;
  737. smalltalk.send(self,"_deny_",[smalltalk.send(d1,"__eq",[d2])]);
  738. $7=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  739. smalltalk.send($7,"_at_put_",[(2),(2)]);
  740. $8=smalltalk.send($7,"_yourself",[]);
  741. d2=$8;
  742. smalltalk.send(self,"_deny_",[smalltalk.send(d1,"__eq",[d2])]);
  743. $9=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  744. smalltalk.send($9,"_at_put_",[(1),(2)]);
  745. smalltalk.send($9,"_at_put_",[(3),(4)]);
  746. $10=smalltalk.send($9,"_yourself",[]);
  747. d2=$10;
  748. smalltalk.send(self,"_deny_",[smalltalk.send(d1,"__eq",[d2])]);
  749. return self}
  750. }),
  751. smalltalk.DictionaryTest);
  752. smalltalk.addMethod(
  753. "_testIfAbsent",
  754. smalltalk.method({
  755. selector: "testIfAbsent",
  756. fn: function (){
  757. var self=this;
  758. var d;
  759. var visited;
  760. visited=false;
  761. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  762. smalltalk.send(d,"_at_ifAbsent_",["hello",(function(){
  763. visited=true;
  764. return visited;
  765. })]);
  766. smalltalk.send(self,"_assert_",[visited]);
  767. return self}
  768. }),
  769. smalltalk.DictionaryTest);
  770. smalltalk.addMethod(
  771. "_testIfPresent",
  772. smalltalk.method({
  773. selector: "testIfPresent",
  774. fn: function (){
  775. var self=this;
  776. var d;
  777. var visited;
  778. var absent;
  779. visited=false;
  780. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  781. smalltalk.send(d,"_at_put_",["hello","world"]);
  782. smalltalk.send(d,"_at_ifPresent_",["hello",(function(value){
  783. visited=value;
  784. return visited;
  785. })]);
  786. smalltalk.send(self,"_assert_",[smalltalk.send(visited,"__eq",["world"])]);
  787. absent=smalltalk.send(d,"_at_ifPresent_",["bye",(function(value){
  788. visited=value;
  789. return visited;
  790. })]);
  791. smalltalk.send(self,"_assert_",[smalltalk.send(absent,"_isNil",[])]);
  792. return self}
  793. }),
  794. smalltalk.DictionaryTest);
  795. smalltalk.addMethod(
  796. "_testIfPresentIfAbsent",
  797. smalltalk.method({
  798. selector: "testIfPresentIfAbsent",
  799. fn: function (){
  800. var self=this;
  801. var d;
  802. var visited;
  803. visited=false;
  804. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  805. smalltalk.send(d,"_at_put_",["hello","world"]);
  806. smalltalk.send(d,"_at_ifPresent_ifAbsent_",["hello",(function(value){
  807. visited=value;
  808. return visited;
  809. }),(function(){
  810. visited=true;
  811. return visited;
  812. })]);
  813. smalltalk.send(self,"_assert_",[smalltalk.send(visited,"__eq",["world"])]);
  814. smalltalk.send(d,"_at_ifPresent_ifAbsent_",["buy",(function(value){
  815. visited=value;
  816. return visited;
  817. }),(function(){
  818. visited=true;
  819. return visited;
  820. })]);
  821. smalltalk.send(self,"_assert_",[visited]);
  822. return self}
  823. }),
  824. smalltalk.DictionaryTest);
  825. smalltalk.addMethod(
  826. "_testKeys",
  827. smalltalk.method({
  828. selector: "testKeys",
  829. fn: function (){
  830. var self=this;
  831. var d;
  832. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  833. smalltalk.send(d,"_at_put_",[(1),(2)]);
  834. smalltalk.send(d,"_at_put_",[(2),(3)]);
  835. smalltalk.send(d,"_at_put_",[(3),(4)]);
  836. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_keys",[]),"__eq",[[(1), (2), (3)]])]);
  837. return self}
  838. }),
  839. smalltalk.DictionaryTest);
  840. smalltalk.addMethod(
  841. "_testPrintString",
  842. smalltalk.method({
  843. selector: "testPrintString",
  844. fn: function (){
  845. var self=this;
  846. var $1,$2;
  847. $1=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  848. smalltalk.send($1,"_at_put_",["firstname","James"]);
  849. smalltalk.send($1,"_at_put_",["lastname","Bond"]);
  850. $2=smalltalk.send($1,"_printString",[]);
  851. smalltalk.send(self,"_assert_equals_",["a Dictionary('firstname'->'James' , 'lastname'->'Bond')",$2]);
  852. return self}
  853. }),
  854. smalltalk.DictionaryTest);
  855. smalltalk.addMethod(
  856. "_testRemoveKey",
  857. smalltalk.method({
  858. selector: "testRemoveKey",
  859. fn: function (){
  860. var self=this;
  861. var d;
  862. var key;
  863. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  864. smalltalk.send(d,"_at_put_",[(1),(2)]);
  865. smalltalk.send(d,"_at_put_",[(2),(3)]);
  866. smalltalk.send(d,"_at_put_",[(3),(4)]);
  867. key=(2);
  868. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_keys",[]),"__eq",[[(1), (2), (3)]])]);
  869. smalltalk.send(d,"_removeKey_",[key]);
  870. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_keys",[]),"__eq",[[(1), (3)]])]);
  871. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_values",[]),"__eq",[[(2), (4)]])]);
  872. smalltalk.send(self,"_deny_",[smalltalk.send(d,"_includesKey_",[(2)])]);
  873. return self}
  874. }),
  875. smalltalk.DictionaryTest);
  876. smalltalk.addMethod(
  877. "_testRemoveKeyIfAbsent",
  878. smalltalk.method({
  879. selector: "testRemoveKeyIfAbsent",
  880. fn: function (){
  881. var self=this;
  882. var d;
  883. var key;
  884. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  885. smalltalk.send(d,"_at_put_",[(1),(2)]);
  886. smalltalk.send(d,"_at_put_",[(2),(3)]);
  887. smalltalk.send(d,"_at_put_",[(3),(4)]);
  888. key=(2);
  889. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_removeKey_",[key]),"__eq",[(3)])]);
  890. key=(3);
  891. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_removeKey_ifAbsent_",[key,(function(){
  892. return (42);
  893. })]),"__eq",[(4)])]);
  894. key="why";
  895. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_removeKey_ifAbsent_",[key,(function(){
  896. return (42);
  897. })]),"__eq",[(42)])]);
  898. return self}
  899. }),
  900. smalltalk.DictionaryTest);
  901. smalltalk.addMethod(
  902. "_testSize",
  903. smalltalk.method({
  904. selector: "testSize",
  905. fn: function (){
  906. var self=this;
  907. var d;
  908. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  909. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_size",[]),"__eq",[(0)])]);
  910. smalltalk.send(d,"_at_put_",[(1),(2)]);
  911. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_size",[]),"__eq",[(1)])]);
  912. smalltalk.send(d,"_at_put_",[(2),(3)]);
  913. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_size",[]),"__eq",[(2)])]);
  914. return self}
  915. }),
  916. smalltalk.DictionaryTest);
  917. smalltalk.addMethod(
  918. "_testValues",
  919. smalltalk.method({
  920. selector: "testValues",
  921. fn: function (){
  922. var self=this;
  923. var d;
  924. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  925. smalltalk.send(d,"_at_put_",[(1),(2)]);
  926. smalltalk.send(d,"_at_put_",[(2),(3)]);
  927. smalltalk.send(d,"_at_put_",[(3),(4)]);
  928. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_values",[]),"__eq",[[(2), (3), (4)]])]);
  929. return self}
  930. }),
  931. smalltalk.DictionaryTest);
  932. smalltalk.addMethod(
  933. "_collectionClass",
  934. smalltalk.method({
  935. selector: "collectionClass",
  936. fn: function (){
  937. var self=this;
  938. return (smalltalk.Dictionary || Dictionary);
  939. }
  940. }),
  941. smalltalk.DictionaryTest.klass);
  942. smalltalk.addClass('SequenceableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  943. smalltalk.addMethod(
  944. "_testAt",
  945. smalltalk.method({
  946. selector: "testAt",
  947. fn: function (){
  948. var self=this;
  949. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_",[(4)]),"__eq",[(-4)])]);
  950. smalltalk.send(self,"_should_raise_",[(function(){
  951. return smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_",[(5)]);
  952. }),(smalltalk.Error || Error)]);
  953. return self}
  954. }),
  955. smalltalk.SequenceableCollectionTest);
  956. smalltalk.addMethod(
  957. "_testAtIfAbsent",
  958. smalltalk.method({
  959. selector: "testAtIfAbsent",
  960. fn: function (){
  961. var self=this;
  962. 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(){
  963. return "none";
  964. })]),"__eq",["none"])]);
  965. return self}
  966. }),
  967. smalltalk.SequenceableCollectionTest);
  968. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  969. smalltalk.addMethod(
  970. "_testAtIfAbsent",
  971. smalltalk.method({
  972. selector: "testAtIfAbsent",
  973. fn: function (){
  974. var self=this;
  975. var array;
  976. array=["hello", "world"];
  977. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_",[(1)]),"hello"]);
  978. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_",[(2)]),"world"]);
  979. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_ifAbsent_",[(2),(function(){
  980. return "not found";
  981. })]),"world"]);
  982. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_ifAbsent_",[(0),(function(){
  983. return "not found";
  984. })]),"not found"]);
  985. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_ifAbsent_",[(-10),(function(){
  986. return "not found";
  987. })]),"not found"]);
  988. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_ifAbsent_",[(3),(function(){
  989. return "not found";
  990. })]),"not found"]);
  991. return self}
  992. }),
  993. smalltalk.ArrayTest);
  994. smalltalk.addMethod(
  995. "_testFirstN",
  996. smalltalk.method({
  997. selector: "testFirstN",
  998. fn: function (){
  999. var self=this;
  1000. smalltalk.send(self,"_assert_equals_",[[(1),(2),(3)],smalltalk.send([(1),(2),(3),(4),(5)],"_first_",[(3)])]);
  1001. return self}
  1002. }),
  1003. smalltalk.ArrayTest);
  1004. smalltalk.addMethod(
  1005. "_testIfEmpty",
  1006. smalltalk.method({
  1007. selector: "testIfEmpty",
  1008. fn: function (){
  1009. var self=this;
  1010. smalltalk.send(self,"_assert_equals_",["zork",smalltalk.send("","_ifEmpty_",[(function(){
  1011. return "zork";
  1012. })])]);
  1013. return self}
  1014. }),
  1015. smalltalk.ArrayTest);
  1016. smalltalk.addMethod(
  1017. "_testPrintString",
  1018. smalltalk.method({
  1019. selector: "testPrintString",
  1020. fn: function (){
  1021. var self=this;
  1022. var $1,$2;
  1023. var array;
  1024. array=smalltalk.send((smalltalk.Array || Array),"_new",[]);
  1025. smalltalk.send(self,"_assert_equals_",["a Array ()",smalltalk.send(array,"_printString",[])]);
  1026. smalltalk.send(array,"_add_",[(1)]);
  1027. $1=smalltalk.send(array,"_add_",[(3)]);
  1028. smalltalk.send(self,"_assert_equals_",["a Array (1 3)",smalltalk.send(array,"_printString",[])]);
  1029. smalltalk.send(array,"_add_",["foo"]);
  1030. smalltalk.send(self,"_assert_equals_",["a Array (1 3 'foo')",smalltalk.send(array,"_printString",[])]);
  1031. smalltalk.send(array,"_remove_",[(1)]);
  1032. $2=smalltalk.send(array,"_remove_",[(3)]);
  1033. smalltalk.send(self,"_assert_equals_",["a Array ('foo')",smalltalk.send(array,"_printString",[])]);
  1034. smalltalk.send(array,"_addLast_",[(3)]);
  1035. smalltalk.send(self,"_assert_equals_",["a Array ('foo' 3)",smalltalk.send(array,"_printString",[])]);
  1036. smalltalk.send(array,"_addLast_",[(3)]);
  1037. smalltalk.send(self,"_assert_equals_",["a Array ('foo' 3 3)",smalltalk.send(array,"_printString",[])]);
  1038. return self}
  1039. }),
  1040. smalltalk.ArrayTest);
  1041. smalltalk.addMethod(
  1042. "_collectionClass",
  1043. smalltalk.method({
  1044. selector: "collectionClass",
  1045. fn: function (){
  1046. var self=this;
  1047. return (smalltalk.Array || Array);
  1048. }
  1049. }),
  1050. smalltalk.ArrayTest.klass);
  1051. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1052. smalltalk.addMethod(
  1053. "_collection",
  1054. smalltalk.method({
  1055. selector: "collection",
  1056. fn: function (){
  1057. var self=this;
  1058. return "hello";
  1059. }
  1060. }),
  1061. smalltalk.StringTest);
  1062. smalltalk.addMethod(
  1063. "_collectionWithDuplicates",
  1064. smalltalk.method({
  1065. selector: "collectionWithDuplicates",
  1066. fn: function (){
  1067. var self=this;
  1068. return "abbaerte";
  1069. }
  1070. }),
  1071. smalltalk.StringTest);
  1072. smalltalk.addMethod(
  1073. "_testAddRemove",
  1074. smalltalk.method({
  1075. selector: "testAddRemove",
  1076. fn: function (){
  1077. var self=this;
  1078. smalltalk.send(self,"_should_raise_",[(function(){
  1079. return smalltalk.send("hello","_add_",["a"]);
  1080. }),(smalltalk.Error || Error)]);
  1081. smalltalk.send(self,"_should_raise_",[(function(){
  1082. return smalltalk.send("hello","_remove_",["h"]);
  1083. }),(smalltalk.Error || Error)]);
  1084. return self}
  1085. }),
  1086. smalltalk.StringTest);
  1087. smalltalk.addMethod(
  1088. "_testAsArray",
  1089. smalltalk.method({
  1090. selector: "testAsArray",
  1091. fn: function (){
  1092. var self=this;
  1093. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_asArray",[]),"__eq",[["h", "e", "l", "l", "o"]])]);
  1094. return self}
  1095. }),
  1096. smalltalk.StringTest);
  1097. smalltalk.addMethod(
  1098. "_testAt",
  1099. smalltalk.method({
  1100. selector: "testAt",
  1101. fn: function (){
  1102. var self=this;
  1103. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_at_",[(1)]),"__eq",["h"])]);
  1104. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_at_",[(5)]),"__eq",["o"])]);
  1105. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_at_ifAbsent_",[(6),(function(){
  1106. return nil;
  1107. })]),"__eq",[nil])]);
  1108. return self}
  1109. }),
  1110. smalltalk.StringTest);
  1111. smalltalk.addMethod(
  1112. "_testAtPut",
  1113. smalltalk.method({
  1114. selector: "testAtPut",
  1115. fn: function (){
  1116. var self=this;
  1117. smalltalk.send(self,"_should_raise_",[(function(){
  1118. return smalltalk.send("hello","_at_put_",[(1),"a"]);
  1119. }),(smalltalk.Error || Error)]);
  1120. return self}
  1121. }),
  1122. smalltalk.StringTest);
  1123. smalltalk.addMethod(
  1124. "_testCollect",
  1125. smalltalk.method({
  1126. selector: "testCollect",
  1127. fn: function (){
  1128. var self=this;
  1129. var newCollection;
  1130. newCollection="hheelllloo";
  1131. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_collect_",[(function(each){
  1132. return smalltalk.send(each,"__comma",[each]);
  1133. })]),newCollection]);
  1134. return self}
  1135. }),
  1136. smalltalk.StringTest);
  1137. smalltalk.addMethod(
  1138. "_testCopyWithoutAll",
  1139. smalltalk.method({
  1140. selector: "testCopyWithoutAll",
  1141. fn: function (){
  1142. var self=this;
  1143. smalltalk.send(self,"_assert_equals_",["hello world",smalltalk.send("*hello* *world*","_copyWithoutAll_",["*"])]);
  1144. return self}
  1145. }),
  1146. smalltalk.StringTest);
  1147. smalltalk.addMethod(
  1148. "_testDetect",
  1149. smalltalk.method({
  1150. selector: "testDetect",
  1151. fn: function (){
  1152. var self=this;
  1153. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  1154. return smalltalk.send(each,"__eq",["h"]);
  1155. })]),"__eq",["h"])]);
  1156. smalltalk.send(self,"_should_raise_",[(function(){
  1157. return smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  1158. return smalltalk.send(each,"__eq",[(6)]);
  1159. })]);
  1160. }),(smalltalk.Error || Error)]);
  1161. return self}
  1162. }),
  1163. smalltalk.StringTest);
  1164. smalltalk.addMethod(
  1165. "_testEquality",
  1166. smalltalk.method({
  1167. selector: "testEquality",
  1168. fn: function (){
  1169. var self=this;
  1170. smalltalk.send(self,"_assert_",[smalltalk.send("hello","__eq",["hello"])]);
  1171. smalltalk.send(self,"_deny_",[smalltalk.send("hello","__eq",["world"])]);
  1172. smalltalk.send(self,"_assert_",[smalltalk.send("hello","__eq",[smalltalk.send("hello","_yourself",[])])]);
  1173. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_yourself",[]),"__eq",["hello"])]);
  1174. smalltalk.send(self,"_deny_",[smalltalk.send("","__eq",[(0)])]);
  1175. return self}
  1176. }),
  1177. smalltalk.StringTest);
  1178. smalltalk.addMethod(
  1179. "_testIdentity",
  1180. smalltalk.method({
  1181. selector: "testIdentity",
  1182. fn: function (){
  1183. var self=this;
  1184. smalltalk.send(self,"_assert_",[smalltalk.send("hello","__eq_eq",["hello"])]);
  1185. smalltalk.send(self,"_deny_",[smalltalk.send("hello","__eq_eq",["world"])]);
  1186. smalltalk.send(self,"_assert_",[smalltalk.send("hello","__eq_eq",[smalltalk.send("hello","_yourself",[])])]);
  1187. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_yourself",[]),"__eq_eq",["hello"])]);
  1188. smalltalk.send(self,"_deny_",[smalltalk.send("","__eq_eq",[(0)])]);
  1189. return self}
  1190. }),
  1191. smalltalk.StringTest);
  1192. smalltalk.addMethod(
  1193. "_testIncludesSubString",
  1194. smalltalk.method({
  1195. selector: "testIncludesSubString",
  1196. fn: function (){
  1197. var self=this;
  1198. smalltalk.send(self,"_assert_",[smalltalk.send("amber","_includesSubString_",["ber"])]);
  1199. smalltalk.send(self,"_deny_",[smalltalk.send("amber","_includesSubString_",["zork"])]);
  1200. return self}
  1201. }),
  1202. smalltalk.StringTest);
  1203. smalltalk.addMethod(
  1204. "_testJoin",
  1205. smalltalk.method({
  1206. selector: "testJoin",
  1207. fn: function (){
  1208. var self=this;
  1209. smalltalk.send(self,"_assert_equals_",["hello,world",smalltalk.send(",","_join_",[["hello", "world"]])]);
  1210. return self}
  1211. }),
  1212. smalltalk.StringTest);
  1213. smalltalk.addMethod(
  1214. "_testSelect",
  1215. smalltalk.method({
  1216. selector: "testSelect",
  1217. fn: function (){
  1218. var self=this;
  1219. var newCollection;
  1220. newCollection="o";
  1221. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_select_",[(function(each){
  1222. return smalltalk.send(each,"__eq",["o"]);
  1223. })]),newCollection]);
  1224. return self}
  1225. }),
  1226. smalltalk.StringTest);
  1227. smalltalk.addMethod(
  1228. "_testSize",
  1229. smalltalk.method({
  1230. selector: "testSize",
  1231. fn: function (){
  1232. var self=this;
  1233. smalltalk.send(self,"_assert_equals_",[smalltalk.send("smalltalk","_size",[]),(9)]);
  1234. smalltalk.send(self,"_assert_equals_",[smalltalk.send("","_size",[]),(0)]);
  1235. return self}
  1236. }),
  1237. smalltalk.StringTest);
  1238. smalltalk.addMethod(
  1239. "_testStreamContents",
  1240. smalltalk.method({
  1241. selector: "testStreamContents",
  1242. fn: function (){
  1243. var self=this;
  1244. var $1;
  1245. smalltalk.send(self,"_assert_equals_",["hello world",smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(aStream){
  1246. smalltalk.send(aStream,"_nextPutAll_",["hello"]);
  1247. smalltalk.send(aStream,"_space",[]);
  1248. $1=smalltalk.send(aStream,"_nextPutAll_",["world"]);
  1249. return $1;
  1250. })])]);
  1251. return self}
  1252. }),
  1253. smalltalk.StringTest);
  1254. smalltalk.addMethod(
  1255. "_collectionClass",
  1256. smalltalk.method({
  1257. selector: "collectionClass",
  1258. fn: function (){
  1259. var self=this;
  1260. return (smalltalk.String || String);
  1261. }
  1262. }),
  1263. smalltalk.StringTest.klass);
  1264. smalltalk.addClass('SymbolTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1265. smalltalk.addMethod(
  1266. "_collection",
  1267. smalltalk.method({
  1268. selector: "collection",
  1269. fn: function (){
  1270. var self=this;
  1271. return smalltalk.symbolFor("hello");
  1272. }
  1273. }),
  1274. smalltalk.SymbolTest);
  1275. smalltalk.addMethod(
  1276. "_collectionWithDuplicates",
  1277. smalltalk.method({
  1278. selector: "collectionWithDuplicates",
  1279. fn: function (){
  1280. var self=this;
  1281. return smalltalk.symbolFor("phhaaarorra");
  1282. }
  1283. }),
  1284. smalltalk.SymbolTest);
  1285. smalltalk.addMethod(
  1286. "_testAsString",
  1287. smalltalk.method({
  1288. selector: "testAsString",
  1289. fn: function (){
  1290. var self=this;
  1291. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.symbolFor("hello"),"_asString",[]),"hello"]);
  1292. return self}
  1293. }),
  1294. smalltalk.SymbolTest);
  1295. smalltalk.addMethod(
  1296. "_testAsSymbol",
  1297. smalltalk.method({
  1298. selector: "testAsSymbol",
  1299. fn: function (){
  1300. var self=this;
  1301. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq_eq",[smalltalk.send(smalltalk.symbolFor("hello"),"_asSymbol",[])])]);
  1302. return self}
  1303. }),
  1304. smalltalk.SymbolTest);
  1305. smalltalk.addMethod(
  1306. "_testAt",
  1307. smalltalk.method({
  1308. selector: "testAt",
  1309. fn: function (){
  1310. var self=this;
  1311. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_at_",[(1)]),"__eq",["h"])]);
  1312. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_at_",[(5)]),"__eq",["o"])]);
  1313. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_at_ifAbsent_",[(6),(function(){
  1314. return nil;
  1315. })]),"__eq",[nil])]);
  1316. return self}
  1317. }),
  1318. smalltalk.SymbolTest);
  1319. smalltalk.addMethod(
  1320. "_testAtPut",
  1321. smalltalk.method({
  1322. selector: "testAtPut",
  1323. fn: function (){
  1324. var self=this;
  1325. smalltalk.send(self,"_should_raise_",[(function(){
  1326. return smalltalk.send("hello","_at_put_",[(1),"a"]);
  1327. }),(smalltalk.Error || Error)]);
  1328. return self}
  1329. }),
  1330. smalltalk.SymbolTest);
  1331. smalltalk.addMethod(
  1332. "_testCollect",
  1333. smalltalk.method({
  1334. selector: "testCollect",
  1335. fn: function (){
  1336. var self=this;
  1337. var newCollection;
  1338. newCollection=smalltalk.symbolFor("hheelllloo");
  1339. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_collect_",[(function(each){
  1340. return smalltalk.send(each,"__comma",[each]);
  1341. })]),newCollection]);
  1342. return self}
  1343. }),
  1344. smalltalk.SymbolTest);
  1345. smalltalk.addMethod(
  1346. "_testComparing",
  1347. smalltalk.method({
  1348. selector: "testComparing",
  1349. fn: function (){
  1350. var self=this;
  1351. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("ab"),"__gt",[smalltalk.symbolFor("aa")])]);
  1352. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("ab"),"__gt",[smalltalk.symbolFor("ba")])]);
  1353. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("ab"),"__lt",[smalltalk.symbolFor("ba")])]);
  1354. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("bb"),"__lt",[smalltalk.symbolFor("ba")])]);
  1355. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("ab"),"__gt_eq",[smalltalk.symbolFor("aa")])]);
  1356. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("ab"),"__gt_eq",[smalltalk.symbolFor("ba")])]);
  1357. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("ab"),"__lt_eq",[smalltalk.symbolFor("ba")])]);
  1358. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("bb"),"__lt_eq",[smalltalk.symbolFor("ba")])]);
  1359. return self}
  1360. }),
  1361. smalltalk.SymbolTest);
  1362. smalltalk.addMethod(
  1363. "_testCopying",
  1364. smalltalk.method({
  1365. selector: "testCopying",
  1366. fn: function (){
  1367. var self=this;
  1368. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_copy",[]),"__eq_eq",[smalltalk.symbolFor("hello")])]);
  1369. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_deepCopy",[]),"__eq_eq",[smalltalk.symbolFor("hello")])]);
  1370. return self}
  1371. }),
  1372. smalltalk.SymbolTest);
  1373. smalltalk.addMethod(
  1374. "_testDetect",
  1375. smalltalk.method({
  1376. selector: "testDetect",
  1377. fn: function (){
  1378. var self=this;
  1379. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  1380. return smalltalk.send(each,"__eq",["h"]);
  1381. })]),"__eq",["h"])]);
  1382. smalltalk.send(self,"_should_raise_",[(function(){
  1383. return smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  1384. return smalltalk.send(each,"__eq",["z"]);
  1385. })]);
  1386. }),(smalltalk.Error || Error)]);
  1387. return self}
  1388. }),
  1389. smalltalk.SymbolTest);
  1390. smalltalk.addMethod(
  1391. "_testEquality",
  1392. smalltalk.method({
  1393. selector: "testEquality",
  1394. fn: function (){
  1395. var self=this;
  1396. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",[smalltalk.symbolFor("hello")])]);
  1397. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",[smalltalk.symbolFor("world")])]);
  1398. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",[smalltalk.send(smalltalk.symbolFor("hello"),"_yourself",[])])]);
  1399. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_yourself",[]),"__eq",[smalltalk.symbolFor("hello")])]);
  1400. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",["hello"])]);
  1401. smalltalk.send(self,"_deny_",[smalltalk.send("hello","__eq",[smalltalk.symbolFor("hello")])]);
  1402. return self}
  1403. }),
  1404. smalltalk.SymbolTest);
  1405. smalltalk.addMethod(
  1406. "_testIdentity",
  1407. smalltalk.method({
  1408. selector: "testIdentity",
  1409. fn: function (){
  1410. var self=this;
  1411. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq_eq",[smalltalk.symbolFor("hello")])]);
  1412. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq_eq",[smalltalk.symbolFor("world")])]);
  1413. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",[smalltalk.send(smalltalk.symbolFor("hello"),"_yourself",[])])]);
  1414. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_yourself",[]),"__eq",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_asString",[]),"_asSymbol",[])])]);
  1415. return self}
  1416. }),
  1417. smalltalk.SymbolTest);
  1418. smalltalk.addMethod(
  1419. "_testIsEmpty",
  1420. smalltalk.method({
  1421. selector: "testIsEmpty",
  1422. fn: function (){
  1423. var self=this;
  1424. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_isEmpty",[])]);
  1425. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("","_asSymbol",[]),"_isEmpty",[])]);
  1426. return self}
  1427. }),
  1428. smalltalk.SymbolTest);
  1429. smalltalk.addMethod(
  1430. "_testIsSymbolIsString",
  1431. smalltalk.method({
  1432. selector: "testIsSymbolIsString",
  1433. fn: function (){
  1434. var self=this;
  1435. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"_isSymbol",[])]);
  1436. smalltalk.send(self,"_deny_",[smalltalk.send("hello","_isSymbol",[])]);
  1437. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("hello"),"_isString",[])]);
  1438. smalltalk.send(self,"_assert_",[smalltalk.send("hello","_isString",[])]);
  1439. return self}
  1440. }),
  1441. smalltalk.SymbolTest);
  1442. smalltalk.addMethod(
  1443. "_testSelect",
  1444. smalltalk.method({
  1445. selector: "testSelect",
  1446. fn: function (){
  1447. var self=this;
  1448. var newCollection;
  1449. newCollection="o";
  1450. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_select_",[(function(each){
  1451. return smalltalk.send(each,"__eq",["o"]);
  1452. })]),newCollection]);
  1453. return self}
  1454. }),
  1455. smalltalk.SymbolTest);
  1456. smalltalk.addMethod(
  1457. "_testSize",
  1458. smalltalk.method({
  1459. selector: "testSize",
  1460. fn: function (){
  1461. var self=this;
  1462. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.symbolFor("a"),"_size",[]),(1)]);
  1463. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.symbolFor("aaaaa"),"_size",[]),(5)]);
  1464. return self}
  1465. }),
  1466. smalltalk.SymbolTest);
  1467. smalltalk.addMethod(
  1468. "_collectionClass",
  1469. smalltalk.method({
  1470. selector: "collectionClass",
  1471. fn: function (){
  1472. var self=this;
  1473. return (smalltalk.Symbol || Symbol);
  1474. }
  1475. }),
  1476. smalltalk.SymbolTest.klass);
  1477. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1478. smalltalk.addMethod(
  1479. "_jsObject",
  1480. smalltalk.method({
  1481. selector: "jsObject",
  1482. fn: function (){
  1483. var self=this;
  1484. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: ''};
  1485. ;
  1486. return self}
  1487. }),
  1488. smalltalk.JSObjectProxyTest);
  1489. smalltalk.addMethod(
  1490. "_testDNU",
  1491. smalltalk.method({
  1492. selector: "testDNU",
  1493. fn: function (){
  1494. var self=this;
  1495. smalltalk.send(self,"_should_raise_",[(function(){
  1496. return smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_foo",[]);
  1497. }),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  1498. return self}
  1499. }),
  1500. smalltalk.JSObjectProxyTest);
  1501. smalltalk.addMethod(
  1502. "_testMessageSend",
  1503. smalltalk.method({
  1504. selector: "testMessageSend",
  1505. fn: function (){
  1506. var self=this;
  1507. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_a",[]),(1)]);
  1508. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_b",[]),(2)]);
  1509. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_c_",[(3)]),(3)]);
  1510. return self}
  1511. }),
  1512. smalltalk.JSObjectProxyTest);
  1513. smalltalk.addMethod(
  1514. "_testMethodWithArguments",
  1515. smalltalk.method({
  1516. selector: "testMethodWithArguments",
  1517. fn: function (){
  1518. var self=this;
  1519. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_c_",[(1)]),(1)]);
  1520. return self}
  1521. }),
  1522. smalltalk.JSObjectProxyTest);
  1523. smalltalk.addMethod(
  1524. "_testPrinting",
  1525. smalltalk.method({
  1526. selector: "testPrinting",
  1527. fn: function (){
  1528. var self=this;
  1529. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_printString",[]),"__eq",["[object Object]"])]);
  1530. return self}
  1531. }),
  1532. smalltalk.JSObjectProxyTest);
  1533. smalltalk.addMethod(
  1534. "_testPropertyThatReturnsEmptyString",
  1535. smalltalk.method({
  1536. selector: "testPropertyThatReturnsEmptyString",
  1537. fn: function (){
  1538. var self=this;
  1539. var object;
  1540. object=smalltalk.send(self,"_jsObject",[]);
  1541. smalltalk.send(self,"_assert_equals_",["",smalltalk.send(object,"_d",[])]);
  1542. smalltalk.send(object,"_d_",["hello"]);
  1543. smalltalk.send(self,"_assert_equals_",["hello",smalltalk.send(object,"_d",[])]);
  1544. return self}
  1545. }),
  1546. smalltalk.JSObjectProxyTest);
  1547. smalltalk.addMethod(
  1548. "_testYourself",
  1549. smalltalk.method({
  1550. selector: "testYourself",
  1551. fn: function (){
  1552. var self=this;
  1553. var $1,$2;
  1554. var object;
  1555. $1=smalltalk.send(self,"_jsObject",[]);
  1556. smalltalk.send($1,"_d_",["test"]);
  1557. $2=smalltalk.send($1,"_yourself",[]);
  1558. object=$2;
  1559. smalltalk.send(self,"_assert_equals_",[smalltalk.send(object,"_d",[]),"test"]);
  1560. return self}
  1561. }),
  1562. smalltalk.JSObjectProxyTest);
  1563. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1564. smalltalk.addMethod(
  1565. "_testAbs",
  1566. smalltalk.method({
  1567. selector: "testAbs",
  1568. fn: function (){
  1569. var self=this;
  1570. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((4),"_abs",[]),"__eq",[(4)])]);
  1571. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((-4),"_abs",[]),"__eq",[(4)])]);
  1572. return self}
  1573. }),
  1574. smalltalk.NumberTest);
  1575. smalltalk.addMethod(
  1576. "_testArithmetic",
  1577. smalltalk.method({
  1578. selector: "testArithmetic",
  1579. fn: function (){
  1580. var self=this;
  1581. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1.5),"__plus",[(1)]),"__eq",[(2.5)])]);
  1582. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((2),"__minus",[(1)]),"__eq",[(1)])]);
  1583. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((-2),"__minus",[(1)]),"__eq",[(-3)])]);
  1584. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((12),"__slash",[(2)]),"__eq",[(6)])]);
  1585. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"__star",[(4)]),"__eq",[(12)])]);
  1586. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send((1),"__plus",[(2)]),"__star",[(3)]),"__eq",[(9)])]);
  1587. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__plus",[smalltalk.send((2),"__star",[(3)])]),"__eq",[(7)])]);
  1588. return self}
  1589. }),
  1590. smalltalk.NumberTest);
  1591. smalltalk.addMethod(
  1592. "_testComparison",
  1593. smalltalk.method({
  1594. selector: "testComparison",
  1595. fn: function (){
  1596. var self=this;
  1597. smalltalk.send(self,"_assert_",[smalltalk.send((3),"__gt",[(2)])]);
  1598. smalltalk.send(self,"_assert_",[smalltalk.send((2),"__lt",[(3)])]);
  1599. smalltalk.send(self,"_deny_",[smalltalk.send((3),"__lt",[(2)])]);
  1600. smalltalk.send(self,"_deny_",[smalltalk.send((2),"__gt",[(3)])]);
  1601. smalltalk.send(self,"_assert_",[smalltalk.send((3),"__gt_eq",[(3)])]);
  1602. smalltalk.send(self,"_assert_",[smalltalk.send((3.1),"__gt_eq",[(3)])]);
  1603. smalltalk.send(self,"_assert_",[smalltalk.send((3),"__lt_eq",[(3)])]);
  1604. smalltalk.send(self,"_assert_",[smalltalk.send((3),"__lt_eq",[(3.1)])]);
  1605. return self}
  1606. }),
  1607. smalltalk.NumberTest);
  1608. smalltalk.addMethod(
  1609. "_testCopying",
  1610. smalltalk.method({
  1611. selector: "testCopying",
  1612. fn: function (){
  1613. var self=this;
  1614. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_copy",[]),"__eq_eq",[(1)])]);
  1615. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_deepCopy",[]),"__eq_eq",[(1)])]);
  1616. return self}
  1617. }),
  1618. smalltalk.NumberTest);
  1619. smalltalk.addMethod(
  1620. "_testEquality",
  1621. smalltalk.method({
  1622. selector: "testEquality",
  1623. fn: function (){
  1624. var self=this;
  1625. smalltalk.send(self,"_assert_",[smalltalk.send((1),"__eq",[(1)])]);
  1626. smalltalk.send(self,"_assert_",[smalltalk.send((0),"__eq",[(0)])]);
  1627. smalltalk.send(self,"_deny_",[smalltalk.send((1),"__eq",[(0)])]);
  1628. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_yourself",[]),"__eq",[(1)])]);
  1629. smalltalk.send(self,"_assert_",[smalltalk.send((1),"__eq",[smalltalk.send((1),"_yourself",[])])]);
  1630. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_yourself",[]),"__eq",[smalltalk.send((1),"_yourself",[])])]);
  1631. smalltalk.send(self,"_deny_",[smalltalk.send((0),"__eq",[false])]);
  1632. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq",[(0)])]);
  1633. smalltalk.send(self,"_deny_",[smalltalk.send("","__eq",[(0)])]);
  1634. smalltalk.send(self,"_deny_",[smalltalk.send((0),"__eq",[""])]);
  1635. return self}
  1636. }),
  1637. smalltalk.NumberTest);
  1638. smalltalk.addMethod(
  1639. "_testIdentity",
  1640. smalltalk.method({
  1641. selector: "testIdentity",
  1642. fn: function (){
  1643. var self=this;
  1644. smalltalk.send(self,"_assert_",[smalltalk.send((1),"__eq_eq",[(1)])]);
  1645. smalltalk.send(self,"_assert_",[smalltalk.send((0),"__eq_eq",[(0)])]);
  1646. smalltalk.send(self,"_deny_",[smalltalk.send((1),"__eq_eq",[(0)])]);
  1647. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_yourself",[]),"__eq_eq",[(1)])]);
  1648. smalltalk.send(self,"_assert_",[smalltalk.send((1),"__eq_eq",[smalltalk.send((1),"_yourself",[])])]);
  1649. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_yourself",[]),"__eq_eq",[smalltalk.send((1),"_yourself",[])])]);
  1650. smalltalk.send(self,"_deny_",[smalltalk.send((1),"__eq_eq",[(2)])]);
  1651. return self}
  1652. }),
  1653. smalltalk.NumberTest);
  1654. smalltalk.addMethod(
  1655. "_testMinMax",
  1656. smalltalk.method({
  1657. selector: "testMinMax",
  1658. fn: function (){
  1659. var self=this;
  1660. smalltalk.send(self,"_assert_equals_",[smalltalk.send((2),"_max_",[(5)]),(5)]);
  1661. smalltalk.send(self,"_assert_equals_",[smalltalk.send((2),"_min_",[(5)]),(2)]);
  1662. return self}
  1663. }),
  1664. smalltalk.NumberTest);
  1665. smalltalk.addMethod(
  1666. "_testNegated",
  1667. smalltalk.method({
  1668. selector: "testNegated",
  1669. fn: function (){
  1670. var self=this;
  1671. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"_negated",[]),"__eq",[(-3)])]);
  1672. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((-3),"_negated",[]),"__eq",[(3)])]);
  1673. return self}
  1674. }),
  1675. smalltalk.NumberTest);
  1676. smalltalk.addMethod(
  1677. "_testPrintShowingDecimalPlaces",
  1678. smalltalk.method({
  1679. selector: "testPrintShowingDecimalPlaces",
  1680. fn: function (){
  1681. var self=this;
  1682. smalltalk.send(self,"_assert_equals_",["23.00",smalltalk.send((23),"_printShowingDecimalPlaces_",[(2)])]);
  1683. smalltalk.send(self,"_assert_equals_",["23.57",smalltalk.send((23.5698),"_printShowingDecimalPlaces_",[(2)])]);
  1684. smalltalk.send(self,"_assert_equals_",["-234.56700",smalltalk.send(smalltalk.send((234.567),"_negated",[]),"_printShowingDecimalPlaces_",[(5)])]);
  1685. smalltalk.send(self,"_assert_equals_",["23",smalltalk.send((23.4567),"_printShowingDecimalPlaces_",[(0)])]);
  1686. smalltalk.send(self,"_assert_equals_",["24",smalltalk.send((23.5567),"_printShowingDecimalPlaces_",[(0)])]);
  1687. smalltalk.send(self,"_assert_equals_",["-23",smalltalk.send(smalltalk.send((23.4567),"_negated",[]),"_printShowingDecimalPlaces_",[(0)])]);
  1688. smalltalk.send(self,"_assert_equals_",["-24",smalltalk.send(smalltalk.send((23.5567),"_negated",[]),"_printShowingDecimalPlaces_",[(0)])]);
  1689. smalltalk.send(self,"_assert_equals_",["100000000.0",smalltalk.send((100000000),"_printShowingDecimalPlaces_",[(1)])]);
  1690. smalltalk.send(self,"_assert_equals_",["0.98000",smalltalk.send((0.98),"_printShowingDecimalPlaces_",[(5)])]);
  1691. smalltalk.send(self,"_assert_equals_",["-0.98",smalltalk.send(smalltalk.send((0.98),"_negated",[]),"_printShowingDecimalPlaces_",[(2)])]);
  1692. smalltalk.send(self,"_assert_equals_",["2.57",smalltalk.send((2.567),"_printShowingDecimalPlaces_",[(2)])]);
  1693. smalltalk.send(self,"_assert_equals_",["-2.57",smalltalk.send((-2.567),"_printShowingDecimalPlaces_",[(2)])]);
  1694. smalltalk.send(self,"_assert_equals_",["0.00",smalltalk.send((0),"_printShowingDecimalPlaces_",[(2)])]);
  1695. return self}
  1696. }),
  1697. smalltalk.NumberTest);
  1698. smalltalk.addMethod(
  1699. "_testRounded",
  1700. smalltalk.method({
  1701. selector: "testRounded",
  1702. fn: function (){
  1703. var self=this;
  1704. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"_rounded",[]),"__eq",[(3)])]);
  1705. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3.212),"_rounded",[]),"__eq",[(3)])]);
  1706. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3.51),"_rounded",[]),"__eq",[(4)])]);
  1707. return self}
  1708. }),
  1709. smalltalk.NumberTest);
  1710. smalltalk.addMethod(
  1711. "_testSqrt",
  1712. smalltalk.method({
  1713. selector: "testSqrt",
  1714. fn: function (){
  1715. var self=this;
  1716. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((4),"_sqrt",[]),"__eq",[(2)])]);
  1717. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((16),"_sqrt",[]),"__eq",[(4)])]);
  1718. return self}
  1719. }),
  1720. smalltalk.NumberTest);
  1721. smalltalk.addMethod(
  1722. "_testSquared",
  1723. smalltalk.method({
  1724. selector: "testSquared",
  1725. fn: function (){
  1726. var self=this;
  1727. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((4),"_squared",[]),"__eq",[(16)])]);
  1728. return self}
  1729. }),
  1730. smalltalk.NumberTest);
  1731. smalltalk.addMethod(
  1732. "_testTimesRepeat",
  1733. smalltalk.method({
  1734. selector: "testTimesRepeat",
  1735. fn: function (){
  1736. var self=this;
  1737. var i;
  1738. i=(0);
  1739. smalltalk.send((0),"_timesRepeat_",[(function(){
  1740. i=smalltalk.send(i,"__plus",[(1)]);
  1741. return i;
  1742. })]);
  1743. smalltalk.send(self,"_assert_equals_",[i,(0)]);
  1744. smalltalk.send((5),"_timesRepeat_",[(function(){
  1745. i=smalltalk.send(i,"__plus",[(1)]);
  1746. return i;
  1747. })]);
  1748. smalltalk.send(self,"_assert_equals_",[i,(5)]);
  1749. return self}
  1750. }),
  1751. smalltalk.NumberTest);
  1752. smalltalk.addMethod(
  1753. "_testTo",
  1754. smalltalk.method({
  1755. selector: "testTo",
  1756. fn: function (){
  1757. var self=this;
  1758. smalltalk.send(self,"_assert_equals_",[smalltalk.send((1),"_to_",[(5)]),[(1), (2), (3), (4), (5)]]);
  1759. return self}
  1760. }),
  1761. smalltalk.NumberTest);
  1762. smalltalk.addMethod(
  1763. "_testToBy",
  1764. smalltalk.method({
  1765. selector: "testToBy",
  1766. fn: function (){
  1767. var self=this;
  1768. smalltalk.send(self,"_assert_equals_",[smalltalk.send((0),"_to_by_",[(6),(2)]),[(0), (2), (4), (6)]]);
  1769. smalltalk.send(self,"_should_raise_",[(function(){
  1770. return smalltalk.send((1),"_to_by_",[(4),(0)]);
  1771. }),(smalltalk.Error || Error)]);
  1772. return self}
  1773. }),
  1774. smalltalk.NumberTest);
  1775. smalltalk.addMethod(
  1776. "_testTruncated",
  1777. smalltalk.method({
  1778. selector: "testTruncated",
  1779. fn: function (){
  1780. var self=this;
  1781. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"_truncated",[]),"__eq",[(3)])]);
  1782. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3.212),"_truncated",[]),"__eq",[(3)])]);
  1783. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3.51),"_truncated",[]),"__eq",[(3)])]);
  1784. return self}
  1785. }),
  1786. smalltalk.NumberTest);
  1787. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  1788. smalltalk.addMethod(
  1789. "_foo",
  1790. smalltalk.method({
  1791. selector: "foo",
  1792. fn: function (){
  1793. var self=this;
  1794. return self["@foo"];
  1795. }
  1796. }),
  1797. smalltalk.ObjectMock);
  1798. smalltalk.addMethod(
  1799. "_foo_",
  1800. smalltalk.method({
  1801. selector: "foo:",
  1802. fn: function (anObject){
  1803. var self=this;
  1804. self["@foo"]=anObject;
  1805. return self}
  1806. }),
  1807. smalltalk.ObjectMock);
  1808. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1809. smalltalk.addMethod(
  1810. "_testBasicAccess",
  1811. smalltalk.method({
  1812. selector: "testBasicAccess",
  1813. fn: function (){
  1814. var self=this;
  1815. var o;
  1816. o=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1817. smalltalk.send(o,"_basicAt_put_",["a",(1)]);
  1818. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_basicAt_",["a"]),(1)]);
  1819. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_basicAt_",["b"]),nil]);
  1820. return self}
  1821. }),
  1822. smalltalk.ObjectTest);
  1823. smalltalk.addMethod(
  1824. "_testBasicPerform",
  1825. smalltalk.method({
  1826. selector: "testBasicPerform",
  1827. fn: function (){
  1828. var self=this;
  1829. var o;
  1830. o=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1831. smalltalk.send(o,"_basicAt_put_",["func",(function(){
  1832. return "hello";
  1833. })]);
  1834. smalltalk.send(o,"_basicAt_put_",["func2",(function(a){
  1835. return smalltalk.send(a,"__plus",[(1)]);
  1836. })]);
  1837. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_basicPerform_",["func"]),"hello"]);
  1838. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_basicPerform_withArguments_",["func2",[(3)]]),(4)]);
  1839. return self}
  1840. }),
  1841. smalltalk.ObjectTest);
  1842. smalltalk.addMethod(
  1843. "_testDNU",
  1844. smalltalk.method({
  1845. selector: "testDNU",
  1846. fn: function (){
  1847. var self=this;
  1848. smalltalk.send(self,"_should_raise_",[(function(){
  1849. return smalltalk.send(smalltalk.send((smalltalk.Object || Object),"_new",[]),"_foo",[]);
  1850. }),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  1851. return self}
  1852. }),
  1853. smalltalk.ObjectTest);
  1854. smalltalk.addMethod(
  1855. "_testEquality",
  1856. smalltalk.method({
  1857. selector: "testEquality",
  1858. fn: function (){
  1859. var self=this;
  1860. var o;
  1861. o=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1862. smalltalk.send(self,"_deny_",[smalltalk.send(o,"__eq",[smalltalk.send((smalltalk.Object || Object),"_new",[])])]);
  1863. smalltalk.send(self,"_assert_",[smalltalk.send(o,"__eq",[o])]);
  1864. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(o,"_yourself",[]),"__eq",[o])]);
  1865. smalltalk.send(self,"_assert_",[smalltalk.send(o,"__eq",[smalltalk.send(o,"_yourself",[])])]);
  1866. return self}
  1867. }),
  1868. smalltalk.ObjectTest);
  1869. smalltalk.addMethod(
  1870. "_testHalt",
  1871. smalltalk.method({
  1872. selector: "testHalt",
  1873. fn: function (){
  1874. var self=this;
  1875. smalltalk.send(self,"_should_raise_",[(function(){
  1876. return smalltalk.send(smalltalk.send((smalltalk.Object || Object),"_new",[]),"_halt",[]);
  1877. }),(smalltalk.Error || Error)]);
  1878. return self}
  1879. }),
  1880. smalltalk.ObjectTest);
  1881. smalltalk.addMethod(
  1882. "_testIdentity",
  1883. smalltalk.method({
  1884. selector: "testIdentity",
  1885. fn: function (){
  1886. var self=this;
  1887. var o;
  1888. o=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1889. smalltalk.send(self,"_deny_",[smalltalk.send(o,"__eq_eq",[smalltalk.send((smalltalk.Object || Object),"_new",[])])]);
  1890. smalltalk.send(self,"_assert_",[smalltalk.send(o,"__eq_eq",[o])]);
  1891. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(o,"_yourself",[]),"__eq_eq",[o])]);
  1892. smalltalk.send(self,"_assert_",[smalltalk.send(o,"__eq_eq",[smalltalk.send(o,"_yourself",[])])]);
  1893. return self}
  1894. }),
  1895. smalltalk.ObjectTest);
  1896. smalltalk.addMethod(
  1897. "_testIfNil",
  1898. smalltalk.method({
  1899. selector: "testIfNil",
  1900. fn: function (){
  1901. var self=this;
  1902. var $2,$1,$4,$3,$6,$5;
  1903. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((smalltalk.Object || Object),"_new",[]),"_isNil",[])]);
  1904. $2=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1905. if(($receiver = $2) == nil || $receiver == undefined){
  1906. $1=true;
  1907. } else {
  1908. $1=$2;
  1909. };
  1910. smalltalk.send(self,"_deny_",[smalltalk.send($1,"__eq",[true])]);
  1911. $4=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1912. if(($receiver = $4) == nil || $receiver == undefined){
  1913. $3=$4;
  1914. } else {
  1915. $3=true;
  1916. };
  1917. smalltalk.send(self,"_assert_",[smalltalk.send($3,"__eq",[true])]);
  1918. $6=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1919. if(($receiver = $6) == nil || $receiver == undefined){
  1920. $5=false;
  1921. } else {
  1922. $5=true;
  1923. };
  1924. smalltalk.send(self,"_assert_",[smalltalk.send($5,"__eq",[true])]);
  1925. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Object || Object),"_new",[]),"_ifNotNil_ifNil_",[(function(){
  1926. return true;
  1927. }),(function(){
  1928. return false;
  1929. })]),"__eq",[true])]);
  1930. return self}
  1931. }),
  1932. smalltalk.ObjectTest);
  1933. smalltalk.addMethod(
  1934. "_testInstVars",
  1935. smalltalk.method({
  1936. selector: "testInstVars",
  1937. fn: function (){
  1938. var self=this;
  1939. var o;
  1940. o=smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_new",[]);
  1941. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_instVarAt_",[smalltalk.symbolFor("foo")]),nil]);
  1942. smalltalk.send(o,"_instVarAt_put_",[smalltalk.symbolFor("foo"),(1)]);
  1943. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_instVarAt_",[smalltalk.symbolFor("foo")]),(1)]);
  1944. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_instVarAt_",["foo"]),(1)]);
  1945. return self}
  1946. }),
  1947. smalltalk.ObjectTest);
  1948. smalltalk.addMethod(
  1949. "_testNilUndefined",
  1950. smalltalk.method({
  1951. selector: "testNilUndefined",
  1952. fn: function (){
  1953. var self=this;
  1954. var notDefined;
  1955. notDefined = undefined;
  1956. ;
  1957. smalltalk.send(self,"_assert_",[smalltalk.send(nil,"__eq",[notDefined])]);
  1958. return self}
  1959. }),
  1960. smalltalk.ObjectTest);
  1961. smalltalk.addMethod(
  1962. "_testYourself",
  1963. smalltalk.method({
  1964. selector: "testYourself",
  1965. fn: function () {
  1966. var self = this;
  1967. var o;
  1968. o = smalltalk.send(smalltalk.ObjectMock || ObjectMock, "_new", []);
  1969. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  1970. return self;
  1971. }
  1972. }),
  1973. smalltalk.ObjectTest);
  1974. smalltalk.addMethod(
  1975. "_testidentityHash",
  1976. smalltalk.method({
  1977. selector: "testidentityHash",
  1978. fn: function () {
  1979. var self = this;
  1980. var o1;
  1981. var o2;
  1982. o1 = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1983. o2 = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1984. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o1, "_identityHash", [])])]);
  1985. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o2, "_identityHash", [])])]);
  1986. return self;
  1987. }
  1988. }),
  1989. smalltalk.ObjectTest);
  1990. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  1991. smalltalk.addMethod(
  1992. "_setUp",
  1993. smalltalk.method({
  1994. selector: "setUp",
  1995. fn: function (){
  1996. var self=this;
  1997. var $1,$2;
  1998. self["@backUpCommitPathJs"]=smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathJs",[]);
  1999. self["@backUpCommitPathSt"]=smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathSt",[]);
  2000. smalltalk.send((smalltalk.Package || Package),"_resetCommitPaths",[]);
  2001. self["@zorkPackage"]=smalltalk.send(smalltalk.send((smalltalk.Package || Package),"_new",[]),"_name_",["Zork"]);
  2002. $1=smalltalk.send((smalltalk.Package || Package),"_new",[]);
  2003. smalltalk.send($1,"_name_",["Grul"]);
  2004. smalltalk.send($1,"_commitPathJs_",["server/grul/js"]);
  2005. smalltalk.send($1,"_commitPathSt_",["grul/st"]);
  2006. $2=smalltalk.send($1,"_yourself",[]);
  2007. self["@grulPackage"]=$2;
  2008. return self}
  2009. }),
  2010. smalltalk.PackageTest);
  2011. smalltalk.addMethod(
  2012. "_tearDown",
  2013. smalltalk.method({
  2014. selector: "tearDown",
  2015. fn: function (){
  2016. var self=this;
  2017. var $1;
  2018. smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathJs_",[self["@backUpCommitPathJs"]]);
  2019. $1=smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathSt_",[self["@backUpCommitPathSt"]]);
  2020. return self}
  2021. }),
  2022. smalltalk.PackageTest);
  2023. smalltalk.addMethod(
  2024. "_testGrulCommitPathJsShouldBeServerGrulJs",
  2025. smalltalk.method({
  2026. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2027. fn: function (){
  2028. var self=this;
  2029. smalltalk.send(self,"_assert_equals_",["server/grul/js",smalltalk.send(self["@grulPackage"],"_commitPathJs",[])]);
  2030. return self}
  2031. }),
  2032. smalltalk.PackageTest);
  2033. smalltalk.addMethod(
  2034. "_testGrulCommitPathStShouldBeGrulSt",
  2035. smalltalk.method({
  2036. selector: "testGrulCommitPathStShouldBeGrulSt",
  2037. fn: function (){
  2038. var self=this;
  2039. smalltalk.send(self,"_assert_equals_",["grul/st",smalltalk.send(self["@grulPackage"],"_commitPathSt",[])]);
  2040. return self}
  2041. }),
  2042. smalltalk.PackageTest);
  2043. smalltalk.addMethod(
  2044. "_testZorkCommitPathJsShouldBeJs",
  2045. smalltalk.method({
  2046. selector: "testZorkCommitPathJsShouldBeJs",
  2047. fn: function (){
  2048. var self=this;
  2049. smalltalk.send(self,"_assert_equals_",["js",smalltalk.send(self["@zorkPackage"],"_commitPathJs",[])]);
  2050. return self}
  2051. }),
  2052. smalltalk.PackageTest);
  2053. smalltalk.addMethod(
  2054. "_testZorkCommitPathStShouldBeSt",
  2055. smalltalk.method({
  2056. selector: "testZorkCommitPathStShouldBeSt",
  2057. fn: function (){
  2058. var self=this;
  2059. smalltalk.send(self,"_assert_equals_",["st",smalltalk.send(self["@zorkPackage"],"_commitPathSt",[])]);
  2060. return self}
  2061. }),
  2062. smalltalk.PackageTest);
  2063. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  2064. smalltalk.addMethod(
  2065. "_setUp",
  2066. smalltalk.method({
  2067. selector: "setUp",
  2068. fn: function (){
  2069. var self=this;
  2070. var $1;
  2071. smalltalk.send(self,"_setUp",[],smalltalk.PackageTest);
  2072. smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathJs_",["javascripts/"]);
  2073. $1=smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathSt_",["smalltalk/"]);
  2074. return self}
  2075. }),
  2076. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2077. smalltalk.addMethod(
  2078. "_testGrulCommitPathJsShouldBeServerGrulJs",
  2079. smalltalk.method({
  2080. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2081. fn: function (){
  2082. var self=this;
  2083. smalltalk.send(self,"_assert_equals_",["server/grul/js",smalltalk.send(self["@grulPackage"],"_commitPathJs",[])]);
  2084. return self}
  2085. }),
  2086. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2087. smalltalk.addMethod(
  2088. "_testGrulCommitPathStShouldBeGrulSt",
  2089. smalltalk.method({
  2090. selector: "testGrulCommitPathStShouldBeGrulSt",
  2091. fn: function (){
  2092. var self=this;
  2093. smalltalk.send(self,"_assert_equals_",["grul/st",smalltalk.send(self["@grulPackage"],"_commitPathSt",[])]);
  2094. return self}
  2095. }),
  2096. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2097. smalltalk.addMethod(
  2098. "_testZorkCommitPathJsShouldBeJavascript",
  2099. smalltalk.method({
  2100. selector: "testZorkCommitPathJsShouldBeJavascript",
  2101. fn: function (){
  2102. var self=this;
  2103. smalltalk.send(self,"_assert_equals_",["javascripts/",smalltalk.send(self["@zorkPackage"],"_commitPathJs",[])]);
  2104. return self}
  2105. }),
  2106. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2107. smalltalk.addMethod(
  2108. "_testZorkCommitPathStShouldBeSmalltalk",
  2109. smalltalk.method({
  2110. selector: "testZorkCommitPathStShouldBeSmalltalk",
  2111. fn: function (){
  2112. var self=this;
  2113. smalltalk.send(self,"_assert_equals_",["smalltalk/",smalltalk.send(self["@zorkPackage"],"_commitPathSt",[])]);
  2114. return self}
  2115. }),
  2116. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2117. smalltalk.addMethod(
  2118. "_shouldInheritSelectors",
  2119. smalltalk.method({
  2120. selector: "shouldInheritSelectors",
  2121. fn: function (){
  2122. var self=this;
  2123. return false;
  2124. }
  2125. }),
  2126. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  2127. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2128. smalltalk.addMethod(
  2129. "_testAccessing",
  2130. smalltalk.method({
  2131. selector: "testAccessing",
  2132. fn: function (){
  2133. var self=this;
  2134. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Point || Point),"_x_y_",[(3),(4)]),"_x",[]),(3)]);
  2135. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Point || Point),"_x_y_",[(3),(4)]),"_y",[]),(4)]);
  2136. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point),"_new",[]),"_x_",[(3)]),"_x",[]),(3)]);
  2137. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point),"_new",[]),"_y_",[(4)]),"_y",[]),(4)]);
  2138. return self}
  2139. }),
  2140. smalltalk.PointTest);
  2141. smalltalk.addMethod(
  2142. "_testArithmetic",
  2143. smalltalk.method({
  2144. selector: "testArithmetic",
  2145. fn: function (){
  2146. var self=this;
  2147. 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)])]);
  2148. 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)])]);
  2149. 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)])]);
  2150. 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)])]);
  2151. return self}
  2152. }),
  2153. smalltalk.PointTest);
  2154. smalltalk.addMethod(
  2155. "_testAt",
  2156. smalltalk.method({
  2157. selector: "testAt",
  2158. fn: function (){
  2159. var self=this;
  2160. smalltalk.send(self,"_assert_equals_",[smalltalk.send((3),"__at",[(4)]),smalltalk.send((smalltalk.Point || Point),"_x_y_",[(3),(4)])]);
  2161. return self}
  2162. }),
  2163. smalltalk.PointTest);
  2164. smalltalk.addMethod(
  2165. "_testEgality",
  2166. smalltalk.method({
  2167. selector: "testEgality",
  2168. fn: function (){
  2169. var self=this;
  2170. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"__at",[(4)]),"__eq",[smalltalk.send((3),"__at",[(4)])])]);
  2171. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((3),"__at",[(5)]),"__eq",[smalltalk.send((3),"__at",[(6)])])]);
  2172. return self}
  2173. }),
  2174. smalltalk.PointTest);
  2175. smalltalk.addMethod(
  2176. "_testTranslateBy",
  2177. smalltalk.method({
  2178. selector: "testTranslateBy",
  2179. fn: function (){
  2180. var self=this;
  2181. smalltalk.send(self,"_assert_equals_",[smalltalk.send((3),"__at",[(4)]),smalltalk.send(smalltalk.send((3),"__at",[(3)]),"_translateBy_",[smalltalk.send((0),"__at",[(1)])])]);
  2182. 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",[])])])]);
  2183. smalltalk.send(self,"_assert_equals_",[smalltalk.send((5),"__at",[(6)]),smalltalk.send(smalltalk.send((3),"__at",[(3)]),"_translateBy_",[smalltalk.send((2),"__at",[(3)])])]);
  2184. 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)])])]);
  2185. return self}
  2186. }),
  2187. smalltalk.PointTest);
  2188. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2189. smalltalk.addMethod(
  2190. "_textNext",
  2191. smalltalk.method({
  2192. selector: "textNext",
  2193. fn: function (){
  2194. var self=this;
  2195. smalltalk.send((10000),"_timesRepeat_",[(function(){
  2196. var current;
  2197. var next;
  2198. next=smalltalk.send(smalltalk.send((smalltalk.Random || Random),"_new",[]),"_next",[]);
  2199. next;
  2200. smalltalk.send(self,"_assert_",[smalltalk.send(next,"__gt_eq",[(0)])]);
  2201. smalltalk.send(self,"_assert_",[smalltalk.send(next,"__lt",[(1)])]);
  2202. smalltalk.send(self,"_deny_",[smalltalk.send(current,"__eq",[next])]);
  2203. return smalltalk.send(next,"__eq",[current]);
  2204. })]);
  2205. return self}
  2206. }),
  2207. smalltalk.RandomTest);
  2208. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2209. smalltalk.addMethod(
  2210. "_testAddRemove",
  2211. smalltalk.method({
  2212. selector: "testAddRemove",
  2213. fn: function (){
  2214. var self=this;
  2215. var set;
  2216. set=smalltalk.send((smalltalk.Set || Set),"_new",[]);
  2217. smalltalk.send(self,"_assert_",[smalltalk.send(set,"_isEmpty",[])]);
  2218. smalltalk.send(set,"_add_",[(3)]);
  2219. smalltalk.send(self,"_assert_",[smalltalk.send(set,"_includes_",[(3)])]);
  2220. smalltalk.send(set,"_add_",[(5)]);
  2221. smalltalk.send(self,"_assert_",[smalltalk.send(set,"_includes_",[(5)])]);
  2222. smalltalk.send(set,"_remove_",[(3)]);
  2223. smalltalk.send(self,"_deny_",[smalltalk.send(set,"_includes_",[(3)])]);
  2224. return self}
  2225. }),
  2226. smalltalk.SetTest);
  2227. smalltalk.addMethod(
  2228. "_testAt",
  2229. smalltalk.method({
  2230. selector: "testAt",
  2231. fn: function (){
  2232. var self=this;
  2233. smalltalk.send(self,"_should_raise_",[(function(){
  2234. return smalltalk.send(smalltalk.send((smalltalk.Set || Set),"_new",[]),"_at_put_",[(1),(2)]);
  2235. }),(smalltalk.Error || Error)]);
  2236. return self}
  2237. }),
  2238. smalltalk.SetTest);
  2239. smalltalk.addMethod(
  2240. "_testPrintString",
  2241. smalltalk.method({
  2242. selector: "testPrintString",
  2243. fn: function (){
  2244. var self=this;
  2245. var $1,$2;
  2246. var set;
  2247. set=smalltalk.send((smalltalk.Set || Set),"_new",[]);
  2248. smalltalk.send(self,"_assert_equals_",["a Set ()",smalltalk.send(set,"_printString",[])]);
  2249. smalltalk.send(set,"_add_",[(1)]);
  2250. $1=smalltalk.send(set,"_add_",[(3)]);
  2251. smalltalk.send(self,"_assert_equals_",["a Set (1 3)",smalltalk.send(set,"_printString",[])]);
  2252. smalltalk.send(set,"_add_",["foo"]);
  2253. smalltalk.send(self,"_assert_equals_",["a Set (1 3 'foo')",smalltalk.send(set,"_printString",[])]);
  2254. smalltalk.send(set,"_remove_",[(1)]);
  2255. $2=smalltalk.send(set,"_remove_",[(3)]);
  2256. smalltalk.send(self,"_assert_equals_",["a Set ('foo')",smalltalk.send(set,"_printString",[])]);
  2257. smalltalk.send(set,"_add_",[(3)]);
  2258. smalltalk.send(self,"_assert_equals_",["a Set ('foo' 3)",smalltalk.send(set,"_printString",[])]);
  2259. smalltalk.send(set,"_add_",[(3)]);
  2260. smalltalk.send(self,"_assert_equals_",["a Set ('foo' 3)",smalltalk.send(set,"_printString",[])]);
  2261. return self}
  2262. }),
  2263. smalltalk.SetTest);
  2264. smalltalk.addMethod(
  2265. "_testSize",
  2266. smalltalk.method({
  2267. selector: "testSize",
  2268. fn: function (){
  2269. var self=this;
  2270. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Set || Set),"_new",[]),"_size",[]),(0)]);
  2271. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Set || Set),"_withAll_",[[(1), (2), (3), (4)]]),"_size",[]),(4)]);
  2272. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Set || Set),"_withAll_",[[(1), (1), (1), (1)]]),"_size",[]),(1)]);
  2273. return self}
  2274. }),
  2275. smalltalk.SetTest);
  2276. smalltalk.addMethod(
  2277. "_testUnicity",
  2278. smalltalk.method({
  2279. selector: "testUnicity",
  2280. fn: function (){
  2281. var self=this;
  2282. var set;
  2283. set=smalltalk.send((smalltalk.Set || Set),"_new",[]);
  2284. smalltalk.send(set,"_add_",[(21)]);
  2285. smalltalk.send(set,"_add_",["hello"]);
  2286. smalltalk.send(set,"_add_",[(21)]);
  2287. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(set,"_size",[]),"__eq",[(2)])]);
  2288. smalltalk.send(set,"_add_",["hello"]);
  2289. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(set,"_size",[]),"__eq",[(2)])]);
  2290. smalltalk.send(self,"_assert_equals_",[smalltalk.send(set,"_asArray",[]),[(21), "hello"]]);
  2291. return self}
  2292. }),
  2293. smalltalk.SetTest);
  2294. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2295. smalltalk.addMethod(
  2296. "_testCopying",
  2297. smalltalk.method({
  2298. selector: "testCopying",
  2299. fn: function (){
  2300. var self=this;
  2301. smalltalk.send(self,"_assert_equals_",[smalltalk.send(nil,"_copy",[]),nil]);
  2302. return self}
  2303. }),
  2304. smalltalk.UndefinedTest);
  2305. smalltalk.addMethod(
  2306. "_testDeepCopy",
  2307. smalltalk.method({
  2308. selector: "testDeepCopy",
  2309. fn: function (){
  2310. var self=this;
  2311. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(nil,"_deepCopy",[]),"__eq",[nil])]);
  2312. return self}
  2313. }),
  2314. smalltalk.UndefinedTest);
  2315. smalltalk.addMethod(
  2316. "_testIfNil",
  2317. smalltalk.method({
  2318. selector: "testIfNil",
  2319. fn: function (){
  2320. var self=this;
  2321. var $1,$2,$3;
  2322. if(($receiver = nil) == nil || $receiver == undefined){
  2323. $1=true;
  2324. } else {
  2325. $1=nil;
  2326. };
  2327. smalltalk.send(self,"_assert_equals_",[$1,true]);
  2328. if(($receiver = nil) == nil || $receiver == undefined){
  2329. $2=nil;
  2330. } else {
  2331. $2=true;
  2332. };
  2333. smalltalk.send(self,"_deny_",[smalltalk.send($2,"__eq",[true])]);
  2334. if(($receiver = nil) == nil || $receiver == undefined){
  2335. $3=true;
  2336. } else {
  2337. $3=false;
  2338. };
  2339. smalltalk.send(self,"_assert_equals_",[$3,true]);
  2340. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(nil,"_ifNotNil_ifNil_",[(function(){
  2341. return true;
  2342. }),(function(){
  2343. return false;
  2344. })]),"__eq",[true])]);
  2345. return self}
  2346. }),
  2347. smalltalk.UndefinedTest);
  2348. smalltalk.addMethod(
  2349. "_testIsNil",
  2350. smalltalk.method({
  2351. selector: "testIsNil",
  2352. fn: function (){
  2353. var self=this;
  2354. smalltalk.send(self,"_assert_",[smalltalk.send(nil,"_isNil",[])]);
  2355. smalltalk.send(self,"_deny_",[smalltalk.send(nil,"_notNil",[])]);
  2356. return self}
  2357. }),
  2358. smalltalk.UndefinedTest);