2
0

Kernel-Tests.deploy.js 78 KB

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