Kernel-Tests.js 137 KB

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