Kernel-Tests.deploy.js 78 KB

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