Kernel-Tests.js 218 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253
  1. (function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4. smalltalk.addMethod(
  5. smalltalk.method({
  6. selector: "testCanClearInterval",
  7. category: 'tests',
  8. fn: function (){
  9. var self=this;
  10. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  11. return smalltalk.withContext(function($ctx1) {
  12. self._shouldnt_raise_((function(){
  13. return smalltalk.withContext(function($ctx2) {
  14. return _st(_st((function(){
  15. return smalltalk.withContext(function($ctx3) {
  16. return _st(_st($Error())._new())._signal();
  17. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._valueWithInterval_((0)))._clearInterval();
  18. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  19. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  20. args: [],
  21. source: "testCanClearInterval\x0a\x09self shouldnt: [([Error new signal] valueWithInterval: 0) clearInterval] raise: Error",
  22. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  23. referencedClasses: ["Error"]
  24. }),
  25. smalltalk.BlockClosureTest);
  26. smalltalk.addMethod(
  27. smalltalk.method({
  28. selector: "testCanClearTimeout",
  29. category: 'tests',
  30. fn: function (){
  31. var self=this;
  32. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  33. return smalltalk.withContext(function($ctx1) {
  34. self._shouldnt_raise_((function(){
  35. return smalltalk.withContext(function($ctx2) {
  36. return _st(_st((function(){
  37. return smalltalk.withContext(function($ctx3) {
  38. return _st(_st($Error())._new())._signal();
  39. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._valueWithTimeout_((0)))._clearTimeout();
  40. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  41. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  42. args: [],
  43. source: "testCanClearTimeout\x0a\x09self shouldnt: [([Error new signal] valueWithTimeout: 0) clearTimeout] raise: Error",
  44. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  45. referencedClasses: ["Error"]
  46. }),
  47. smalltalk.BlockClosureTest);
  48. smalltalk.addMethod(
  49. smalltalk.method({
  50. selector: "testCompiledSource",
  51. category: 'tests',
  52. fn: function (){
  53. var self=this;
  54. return smalltalk.withContext(function($ctx1) {
  55. self._assert_(_st(_st((function(){
  56. return smalltalk.withContext(function($ctx2) {
  57. return (1).__plus((1));
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._compiledSource())._includesSubString_("function"));
  59. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  60. args: [],
  61. source: "testCompiledSource\x0a\x09self assert: ([1+1] compiledSource includesSubString: 'function')",
  62. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  63. referencedClasses: []
  64. }),
  65. smalltalk.BlockClosureTest);
  66. smalltalk.addMethod(
  67. smalltalk.method({
  68. selector: "testCurrySelf",
  69. category: 'tests',
  70. fn: function (){
  71. var self=this;
  72. var curriedMethod,array;
  73. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  74. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  75. return smalltalk.withContext(function($ctx1) {
  76. curriedMethod=_st(_st((function(selfarg,x){
  77. return smalltalk.withContext(function($ctx2) {
  78. return _st(selfarg)._at_(x);
  79. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1)})}))._currySelf())._asCompiledMethod_("foo:");
  80. array=[(3), (1), (4)];
  81. _st(_st($ClassBuilder())._new())._installMethod_forClass_category_(curriedMethod,$Array(),"**test helper");
  82. _st((function(){
  83. return smalltalk.withContext(function($ctx2) {
  84. return self._assert_equals_(_st(array)._foo_((2)),(1));
  85. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  86. return smalltalk.withContext(function($ctx2) {
  87. return _st($Array())._removeCompiledMethod_(curriedMethod);
  88. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  89. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  90. args: [],
  91. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array category: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  92. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:category:", "new", "ensure:", "removeCompiledMethod:", "assert:equals:", "foo:"],
  93. referencedClasses: ["Array", "ClassBuilder"]
  94. }),
  95. smalltalk.BlockClosureTest);
  96. smalltalk.addMethod(
  97. smalltalk.method({
  98. selector: "testEnsure",
  99. category: 'tests',
  100. fn: function (){
  101. var self=this;
  102. return smalltalk.withContext(function($ctx1) {
  103. self._assert_equals_(_st((function(){
  104. return smalltalk.withContext(function($ctx2) {
  105. return (3);
  106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  107. return smalltalk.withContext(function($ctx2) {
  108. return (4);
  109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(3));
  110. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  111. args: [],
  112. source: "testEnsure\x0a\x09self assert: ([3] ensure: [4]) equals: 3",
  113. messageSends: ["assert:equals:", "ensure:"],
  114. referencedClasses: []
  115. }),
  116. smalltalk.BlockClosureTest);
  117. smalltalk.addMethod(
  118. smalltalk.method({
  119. selector: "testEnsureRaises",
  120. category: 'tests',
  121. fn: function (){
  122. var self=this;
  123. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  124. return smalltalk.withContext(function($ctx1) {
  125. self._should_raise_((function(){
  126. return smalltalk.withContext(function($ctx2) {
  127. return _st((function(){
  128. return smalltalk.withContext(function($ctx3) {
  129. return _st(_st($Error())._new())._signal();
  130. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._ensure_((function(){
  131. return smalltalk.withContext(function($ctx3) {
  132. return true;
  133. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  135. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  136. args: [],
  137. source: "testEnsureRaises\x0a\x09self should: [[Error new signal] ensure: [true]] raise: Error",
  138. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  139. referencedClasses: ["Error"]
  140. }),
  141. smalltalk.BlockClosureTest);
  142. smalltalk.addMethod(
  143. smalltalk.method({
  144. selector: "testExceptionSemantics",
  145. category: 'tests',
  146. fn: function (){
  147. var self=this;
  148. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  149. return smalltalk.withContext(function($ctx1) {
  150. self._timeout_((100));
  151. _st(self._async_((function(){
  152. return smalltalk.withContext(function($ctx2) {
  153. return _st((function(){
  154. return smalltalk.withContext(function($ctx3) {
  155. self._assert_(true);
  156. _st($Error())._signal();
  157. self._deny_(true);
  158. return self._finished();
  159. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._on_do_($Error(),(function(ex){
  160. return smalltalk.withContext(function($ctx3) {
  161. return self._finished();
  162. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2)})}));
  163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((0));
  164. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  165. args: [],
  166. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  167. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "finished", "assert:", "signal", "deny:"],
  168. referencedClasses: ["Error"]
  169. }),
  170. smalltalk.BlockClosureTest);
  171. smalltalk.addMethod(
  172. smalltalk.method({
  173. selector: "testNewWithValues",
  174. category: 'tests',
  175. fn: function (){
  176. var self=this;
  177. return smalltalk.withContext(function($ctx1) {
  178. function theTestPrototype() {this.name = "theTestPrototype";}
  179. function theTestConstructor(arg1, arg2, arg3) {}
  180. theTestConstructor.prototype = new theTestPrototype;
  181. var theWrappedConstructor = _st(theTestConstructor);
  182. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3]);
  183. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  184. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  185. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  186. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  187. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  188. args: [],
  189. source: "testNewWithValues\x0a<\x0a\x09function theTestPrototype() {this.name = \x22theTestPrototype\x22;}\x0a\x09function theTestConstructor(arg1, arg2, arg3) {}\x0a\x09theTestConstructor.prototype = new theTestPrototype;\x0a\x0a\x09var theWrappedConstructor = _st(theTestConstructor);\x0a\x09var theResult = theWrappedConstructor._newWithValues_([1, 2, 3]);\x0a\x09self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}\x0a\x09self._should_raise_(_st(constructionShouldFail), smalltalk.Error);\x0a>",
  190. messageSends: [],
  191. referencedClasses: []
  192. }),
  193. smalltalk.BlockClosureTest);
  194. smalltalk.addMethod(
  195. smalltalk.method({
  196. selector: "testNumArgs",
  197. category: 'tests',
  198. fn: function (){
  199. var self=this;
  200. return smalltalk.withContext(function($ctx1) {
  201. self._assert_equals_(_st((function(){
  202. return smalltalk.withContext(function($ctx2) {
  203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._numArgs(),(0));
  204. self._assert_equals_(_st((function(a,b){
  205. return smalltalk.withContext(function($ctx2) {
  206. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._numArgs(),(2));
  207. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  208. args: [],
  209. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [:a :b | ] numArgs equals: 2",
  210. messageSends: ["assert:equals:", "numArgs"],
  211. referencedClasses: []
  212. }),
  213. smalltalk.BlockClosureTest);
  214. smalltalk.addMethod(
  215. smalltalk.method({
  216. selector: "testOnDo",
  217. category: 'tests',
  218. fn: function (){
  219. var self=this;
  220. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  221. return smalltalk.withContext(function($ctx1) {
  222. self._assert_(_st((function(){
  223. return smalltalk.withContext(function($ctx2) {
  224. return _st(_st($Error())._new())._signal();
  225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){
  226. return smalltalk.withContext(function($ctx2) {
  227. return true;
  228. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})})));
  229. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  230. args: [],
  231. source: "testOnDo\x0a\x09self assert: ([Error new signal] on: Error do: [:ex | true])",
  232. messageSends: ["assert:", "on:do:", "signal", "new"],
  233. referencedClasses: ["Error"]
  234. }),
  235. smalltalk.BlockClosureTest);
  236. smalltalk.addMethod(
  237. smalltalk.method({
  238. selector: "testValue",
  239. category: 'tests',
  240. fn: function (){
  241. var self=this;
  242. return smalltalk.withContext(function($ctx1) {
  243. self._assert_equals_(_st((function(){
  244. return smalltalk.withContext(function($ctx2) {
  245. return (1).__plus((1));
  246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._value(),(2));
  247. self._assert_equals_(_st((function(x){
  248. return smalltalk.withContext(function($ctx2) {
  249. return _st(x).__plus((1));
  250. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}))._value_((2)),(3));
  251. self._assert_equals_(_st((function(x,y){
  252. return smalltalk.withContext(function($ctx2) {
  253. return _st(x).__star(y);
  254. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1)})}))._value_value_((2),(4)),(8));
  255. self._assert_equals_(_st((function(a,b,c){
  256. return smalltalk.withContext(function($ctx2) {
  257. return (1);
  258. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1)})}))._value(),(1));
  259. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  260. args: [],
  261. 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",
  262. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  263. referencedClasses: []
  264. }),
  265. smalltalk.BlockClosureTest);
  266. smalltalk.addMethod(
  267. smalltalk.method({
  268. selector: "testValueWithPossibleArguments",
  269. category: 'tests',
  270. fn: function (){
  271. var self=this;
  272. return smalltalk.withContext(function($ctx1) {
  273. self._assert_equals_(_st((function(){
  274. return smalltalk.withContext(function($ctx2) {
  275. return (1);
  276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(1));
  277. self._assert_equals_(_st((function(a){
  278. return smalltalk.withContext(function($ctx2) {
  279. return _st(a).__plus((4));
  280. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}))._valueWithPossibleArguments_([(3), (4)]),(7));
  281. self._assert_equals_(_st((function(a,b){
  282. return smalltalk.withContext(function($ctx2) {
  283. return _st(a).__plus(b);
  284. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  285. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  286. args: [],
  287. 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.",
  288. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  289. referencedClasses: []
  290. }),
  291. smalltalk.BlockClosureTest);
  292. smalltalk.addMethod(
  293. smalltalk.method({
  294. selector: "testWhileFalse",
  295. category: 'tests',
  296. fn: function (){
  297. var self=this;
  298. var i;
  299. return smalltalk.withContext(function($ctx1) {
  300. i=(0);
  301. _st((function(){
  302. return smalltalk.withContext(function($ctx2) {
  303. return _st(i).__gt((5));
  304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  305. return smalltalk.withContext(function($ctx2) {
  306. i=_st(i).__plus((1));
  307. return i;
  308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  309. self._assert_equals_(i,(6));
  310. i=(0);
  311. _st((function(){
  312. return smalltalk.withContext(function($ctx2) {
  313. i=_st(i).__plus((1));
  314. i;
  315. return _st(i).__gt((5));
  316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse();
  317. self._assert_equals_(i,(6));
  318. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  319. args: [],
  320. 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",
  321. messageSends: ["whileFalse:", "+", ">", "assert:equals:", "whileFalse"],
  322. referencedClasses: []
  323. }),
  324. smalltalk.BlockClosureTest);
  325. smalltalk.addMethod(
  326. smalltalk.method({
  327. selector: "testWhileTrue",
  328. category: 'tests',
  329. fn: function (){
  330. var self=this;
  331. var i;
  332. return smalltalk.withContext(function($ctx1) {
  333. i=(0);
  334. _st((function(){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st(i).__lt((5));
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  338. return smalltalk.withContext(function($ctx2) {
  339. i=_st(i).__plus((1));
  340. return i;
  341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  342. self._assert_equals_(i,(5));
  343. i=(0);
  344. _st((function(){
  345. return smalltalk.withContext(function($ctx2) {
  346. i=_st(i).__plus((1));
  347. i;
  348. return _st(i).__lt((5));
  349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue();
  350. self._assert_equals_(i,(5));
  351. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  352. args: [],
  353. 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",
  354. messageSends: ["whileTrue:", "+", "<", "assert:equals:", "whileTrue"],
  355. referencedClasses: []
  356. }),
  357. smalltalk.BlockClosureTest);
  358. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  359. smalltalk.addMethod(
  360. smalltalk.method({
  361. selector: "testEquality",
  362. category: 'tests',
  363. fn: function (){
  364. var self=this;
  365. return smalltalk.withContext(function($ctx1) {
  366. self._deny_((0).__eq(false));
  367. self._deny_(false.__eq((0)));
  368. self._deny_("".__eq(false));
  369. self._deny_(false.__eq(""));
  370. self._assert_(true.__eq(true));
  371. self._deny_(false.__eq(true));
  372. self._deny_(true.__eq(false));
  373. self._assert_(false.__eq(false));
  374. self._assert_(_st(true._yourself()).__eq(true));
  375. self._assert_(_st(true._yourself()).__eq(true._yourself()));
  376. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  377. args: [],
  378. 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)",
  379. messageSends: ["deny:", "=", "assert:", "yourself"],
  380. referencedClasses: []
  381. }),
  382. smalltalk.BooleanTest);
  383. smalltalk.addMethod(
  384. smalltalk.method({
  385. selector: "testIdentity",
  386. category: 'tests',
  387. fn: function (){
  388. var self=this;
  389. return smalltalk.withContext(function($ctx1) {
  390. self._deny_((0).__eq_eq(false));
  391. self._deny_(false.__eq_eq((0)));
  392. self._deny_("".__eq_eq(false));
  393. self._deny_(false.__eq_eq(""));
  394. self._assert_(true.__eq_eq(true));
  395. self._deny_(false.__eq_eq(true));
  396. self._deny_(true.__eq_eq(false));
  397. self._assert_(false.__eq_eq(false));
  398. self._assert_(_st(true._yourself()).__eq_eq(true));
  399. self._assert_(_st(true._yourself()).__eq_eq(true._yourself()));
  400. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  401. args: [],
  402. 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",
  403. messageSends: ["deny:", "==", "assert:", "yourself"],
  404. referencedClasses: []
  405. }),
  406. smalltalk.BooleanTest);
  407. smalltalk.addMethod(
  408. smalltalk.method({
  409. selector: "testIfTrueIfFalse",
  410. category: 'tests',
  411. fn: function (){
  412. var self=this;
  413. return smalltalk.withContext(function($ctx1) {
  414. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  415. $1=self;
  416. if(smalltalk.assert(true)){
  417. $2="alternative block";
  418. };
  419. _st($1)._assert_equals_($2,"alternative block");
  420. $3=self;
  421. if(! smalltalk.assert(true)){
  422. $4="alternative block";
  423. };
  424. _st($3)._assert_equals_($4,nil);
  425. $5=self;
  426. if(smalltalk.assert(false)){
  427. $6="alternative block";
  428. };
  429. _st($5)._assert_equals_($6,nil);
  430. $7=self;
  431. if(! smalltalk.assert(false)){
  432. $8="alternative block";
  433. };
  434. _st($7)._assert_equals_($8,"alternative block");
  435. $9=self;
  436. if(smalltalk.assert(false)){
  437. $10="alternative block";
  438. } else {
  439. $10="alternative block2";
  440. };
  441. _st($9)._assert_equals_($10,"alternative block2");
  442. $11=self;
  443. if(smalltalk.assert(false)){
  444. $12="alternative block2";
  445. } else {
  446. $12="alternative block";
  447. };
  448. _st($11)._assert_equals_($12,"alternative block");
  449. $13=self;
  450. if(smalltalk.assert(true)){
  451. $14="alternative block";
  452. } else {
  453. $14="alternative block2";
  454. };
  455. _st($13)._assert_equals_($14,"alternative block");
  456. $15=self;
  457. if(smalltalk.assert(true)){
  458. $16="alternative block2";
  459. } else {
  460. $16="alternative block";
  461. };
  462. _st($15)._assert_equals_($16,"alternative block2");
  463. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  464. args: [],
  465. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: ['alternative block']) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: ['alternative block']) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: ['alternative block']) equals: nil.\x0a\x09self assert: (false ifFalse: ['alternative block']) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: ['alternative block'] ifFalse: ['alternative block2']) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: ['alternative block'] ifTrue: ['alternative block2']) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: ['alternative block'] ifFalse: ['alternative block2']) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: ['alternative block'] ifTrue: ['alternative block2']) equals: 'alternative block2'.",
  466. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  467. referencedClasses: []
  468. }),
  469. smalltalk.BooleanTest);
  470. smalltalk.addMethod(
  471. smalltalk.method({
  472. selector: "testIfTrueIfFalseWithBoxing",
  473. category: 'tests',
  474. fn: function (){
  475. var self=this;
  476. return smalltalk.withContext(function($ctx1) {
  477. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$10,$12,$11,$13,$15,$14,$16,$18,$17,$19,$21,$20,$22,$24,$23;
  478. $1=self;
  479. $3=true._yourself();
  480. if(smalltalk.assert($3)){
  481. $2="alternative block";
  482. };
  483. _st($1)._assert_equals_($2,"alternative block");
  484. $4=self;
  485. $6=true._yourself();
  486. if(! smalltalk.assert($6)){
  487. $5="alternative block";
  488. };
  489. _st($4)._assert_equals_($5,nil);
  490. $7=self;
  491. $9=false._yourself();
  492. if(smalltalk.assert($9)){
  493. $8="alternative block";
  494. };
  495. _st($7)._assert_equals_($8,nil);
  496. $10=self;
  497. $12=false._yourself();
  498. if(! smalltalk.assert($12)){
  499. $11="alternative block";
  500. };
  501. _st($10)._assert_equals_($11,"alternative block");
  502. $13=self;
  503. $15=false._yourself();
  504. if(smalltalk.assert($15)){
  505. $14="alternative block";
  506. } else {
  507. $14="alternative block2";
  508. };
  509. _st($13)._assert_equals_($14,"alternative block2");
  510. $16=self;
  511. $18=false._yourself();
  512. if(smalltalk.assert($18)){
  513. $17="alternative block2";
  514. } else {
  515. $17="alternative block";
  516. };
  517. _st($16)._assert_equals_($17,"alternative block");
  518. $19=self;
  519. $21=true._yourself();
  520. if(smalltalk.assert($21)){
  521. $20="alternative block";
  522. } else {
  523. $20="alternative block2";
  524. };
  525. _st($19)._assert_equals_($20,"alternative block");
  526. $22=self;
  527. $24=true._yourself();
  528. if(smalltalk.assert($24)){
  529. $23="alternative block2";
  530. } else {
  531. $23="alternative block";
  532. };
  533. _st($22)._assert_equals_($23,"alternative block2");
  534. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  535. args: [],
  536. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: ['alternative block']) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: ['alternative block']) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: ['alternative block']) equals: nil.\x0a\x09self assert: (false yourself ifFalse: ['alternative block']) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: ['alternative block'] ifFalse: ['alternative block2']) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: ['alternative block'] ifTrue: ['alternative block2']) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: ['alternative block'] ifFalse: ['alternative block2']) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: ['alternative block'] ifTrue: ['alternative block2']) equals: 'alternative block2'.",
  537. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  538. referencedClasses: []
  539. }),
  540. smalltalk.BooleanTest);
  541. smalltalk.addMethod(
  542. smalltalk.method({
  543. selector: "testLogic",
  544. category: 'tests',
  545. fn: function (){
  546. var self=this;
  547. return smalltalk.withContext(function($ctx1) {
  548. var $1,$2,$3,$4,$5,$6,$7,$8;
  549. $1=self;
  550. _st($1)._assert_(true.__and(true));
  551. _st($1)._deny_(true.__and(false));
  552. _st($1)._deny_(false.__and(true));
  553. $2=_st($1)._deny_(false.__and(false));
  554. $3=self;
  555. _st($3)._assert_(true.__or(true));
  556. _st($3)._assert_(true.__or(false));
  557. _st($3)._assert_(false.__or(true));
  558. $4=_st($3)._deny_(false.__or(false));
  559. $5=self;
  560. _st($5)._assert_(true.__and((1).__gt((0))));
  561. _st($5)._deny_(_st((1).__gt((0))).__and(false));
  562. $6=_st($5)._deny_(_st((1).__gt((0))).__and((1).__gt((2))));
  563. $7=self;
  564. _st($7)._assert_(false.__or((1).__gt((0))));
  565. _st($7)._assert_(_st((1).__gt((0))).__or(false));
  566. $8=_st($7)._assert_(_st((1).__gt((0))).__or((1).__gt((2))));
  567. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  568. args: [],
  569. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  570. messageSends: ["assert:", "&", "deny:", "|", ">"],
  571. referencedClasses: []
  572. }),
  573. smalltalk.BooleanTest);
  574. smalltalk.addMethod(
  575. smalltalk.method({
  576. selector: "testLogicKeywords",
  577. category: 'tests',
  578. fn: function (){
  579. var self=this;
  580. return smalltalk.withContext(function($ctx1) {
  581. var $1,$2,$3,$4,$5,$6,$7,$8;
  582. $1=self;
  583. _st($1)._assert_(true._and_((function(){
  584. return smalltalk.withContext(function($ctx2) {
  585. return true;
  586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  587. _st($1)._deny_(true._and_((function(){
  588. return smalltalk.withContext(function($ctx2) {
  589. return false;
  590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  591. _st($1)._deny_(false._and_((function(){
  592. return smalltalk.withContext(function($ctx2) {
  593. return true;
  594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  595. $2=_st($1)._deny_(false._and_((function(){
  596. return smalltalk.withContext(function($ctx2) {
  597. return false;
  598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  599. $3=self;
  600. _st($3)._assert_(true._or_((function(){
  601. return smalltalk.withContext(function($ctx2) {
  602. return true;
  603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  604. _st($3)._assert_(true._or_((function(){
  605. return smalltalk.withContext(function($ctx2) {
  606. return false;
  607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  608. _st($3)._assert_(false._or_((function(){
  609. return smalltalk.withContext(function($ctx2) {
  610. return true;
  611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  612. $4=_st($3)._deny_(false._or_((function(){
  613. return smalltalk.withContext(function($ctx2) {
  614. return false;
  615. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  616. $5=self;
  617. _st($5)._assert_(true._and_((function(){
  618. return smalltalk.withContext(function($ctx2) {
  619. return (1).__gt((0));
  620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  621. _st($5)._deny_(_st((1).__gt((0)))._and_((function(){
  622. return smalltalk.withContext(function($ctx2) {
  623. return false;
  624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  625. $6=_st($5)._deny_(_st((1).__gt((0)))._and_((function(){
  626. return smalltalk.withContext(function($ctx2) {
  627. return (1).__gt((2));
  628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  629. $7=self;
  630. _st($7)._assert_(false._or_((function(){
  631. return smalltalk.withContext(function($ctx2) {
  632. return (1).__gt((0));
  633. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  634. _st($7)._assert_(_st((1).__gt((0)))._or_((function(){
  635. return smalltalk.withContext(function($ctx2) {
  636. return false;
  637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  638. $8=_st($7)._assert_(_st((1).__gt((0)))._or_((function(){
  639. return smalltalk.withContext(function($ctx2) {
  640. return (1).__gt((2));
  641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
  642. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  643. args: [],
  644. source: "testLogicKeywords\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\x09\x09\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\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  645. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  646. referencedClasses: []
  647. }),
  648. smalltalk.BooleanTest);
  649. smalltalk.addMethod(
  650. smalltalk.method({
  651. selector: "testNonBooleanError",
  652. category: 'tests',
  653. fn: function (){
  654. var self=this;
  655. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  656. return smalltalk.withContext(function($ctx1) {
  657. self._should_raise_((function(){
  658. return smalltalk.withContext(function($ctx2) {
  659. if(smalltalk.assert("")){
  660. } else {
  661. };
  662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$NonBooleanReceiver());
  663. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  664. args: [],
  665. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  666. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  667. referencedClasses: ["NonBooleanReceiver"]
  668. }),
  669. smalltalk.BooleanTest);
  670. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  671. smalltalk.addMethod(
  672. smalltalk.method({
  673. selector: "setUp",
  674. category: 'running',
  675. fn: function (){
  676. var self=this;
  677. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  678. return smalltalk.withContext(function($ctx1) {
  679. self["@builder"]=_st($ClassBuilder())._new();
  680. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  681. args: [],
  682. source: "setUp\x0a\x09builder := ClassBuilder new",
  683. messageSends: ["new"],
  684. referencedClasses: ["ClassBuilder"]
  685. }),
  686. smalltalk.ClassBuilderTest);
  687. smalltalk.addMethod(
  688. smalltalk.method({
  689. selector: "tearDown",
  690. category: 'running',
  691. fn: function (){
  692. var self=this;
  693. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  694. return smalltalk.withContext(function($ctx1) {
  695. var $1;
  696. $1=self["@theClass"];
  697. if(($receiver = $1) == nil || $receiver == undefined){
  698. $1;
  699. } else {
  700. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  701. self["@theClass"]=nil;
  702. self["@theClass"];
  703. };
  704. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  705. args: [],
  706. source: "tearDown\x0a\x09theClass ifNotNil: [Smalltalk current removeClass: theClass. theClass := nil]",
  707. messageSends: ["ifNotNil:", "removeClass:", "current"],
  708. referencedClasses: ["Smalltalk"]
  709. }),
  710. smalltalk.ClassBuilderTest);
  711. smalltalk.addMethod(
  712. smalltalk.method({
  713. selector: "testClassCopy",
  714. category: 'tests',
  715. fn: function (){
  716. var self=this;
  717. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  718. return smalltalk.withContext(function($ctx1) {
  719. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  720. self._assert_(_st(_st(self["@theClass"])._superclass()).__eq_eq(_st($ObjectMock())._superclass()));
  721. self._assert_(_st(_st(self["@theClass"])._instanceVariableNames()).__eq_eq(_st($ObjectMock())._instanceVariableNames()));
  722. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  723. self._assert_(_st(_st(self["@theClass"])._package()).__eq_eq(_st($ObjectMock())._package()));
  724. self._assert_equals_(_st(_st(self["@theClass"])._methodDictionary())._keys(),_st(_st($ObjectMock())._methodDictionary())._keys());
  725. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  726. args: [],
  727. 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",
  728. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  729. referencedClasses: ["ObjectMock"]
  730. }),
  731. smalltalk.ClassBuilderTest);
  732. smalltalk.addMethod(
  733. smalltalk.method({
  734. selector: "testClassMigration",
  735. category: 'tests',
  736. fn: function (){
  737. var self=this;
  738. var instance,oldClass;
  739. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  740. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  741. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  742. return smalltalk.withContext(function($ctx1) {
  743. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  744. instance=_st(_st(_st($Smalltalk())._current())._at_("ObjectMock2"))._new();
  745. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  746. self._deny_(_st(oldClass).__eq_eq($ObjectMock2()));
  747. self._assert_(_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock()));
  748. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  749. self._assert_equals_(_st($ObjectMock2())._selectors(),_st(oldClass)._selectors());
  750. self._assert_equals_(_st($ObjectMock2())._comment(),_st(oldClass)._comment());
  751. self._assert_equals_(_st(_st($ObjectMock2())._package())._name(),"Kernel-Tests");
  752. self._deny_(_st(_st(instance)._class()).__eq_eq($ObjectMock2()));
  753. self._assert_(_st(_st(_st($Smalltalk())._current())._at_(_st(_st(instance)._class())._name()))._isNil());
  754. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  755. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  756. args: [],
  757. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk current at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk current at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  758. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  759. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  760. }),
  761. smalltalk.ClassBuilderTest);
  762. smalltalk.addMethod(
  763. smalltalk.method({
  764. selector: "testClassMigrationWithClassInstanceVariables",
  765. category: 'tests',
  766. fn: function (){
  767. var self=this;
  768. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  769. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  770. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  771. return smalltalk.withContext(function($ctx1) {
  772. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  773. _st(_st($ObjectMock2())._class())._instanceVariableNames_("foo bar");
  774. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  775. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  776. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  777. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  778. args: [],
  779. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  780. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  781. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  782. }),
  783. smalltalk.ClassBuilderTest);
  784. smalltalk.addMethod(
  785. smalltalk.method({
  786. selector: "testClassMigrationWithSubclasses",
  787. category: 'tests',
  788. fn: function (){
  789. var self=this;
  790. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  791. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  792. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  793. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  794. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  795. return smalltalk.withContext(function($ctx1) {
  796. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  797. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  798. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  799. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._current())._at_("ObjectMock2"),"","Kernel-Tests");
  800. self._assert_(_st(_st($ObjectMock())._subclasses())._includes_($ObjectMock2()));
  801. self._assert_(_st(_st($ObjectMock2())._subclasses())._includes_($ObjectMock3()));
  802. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  803. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  804. return smalltalk.withContext(function($ctx2) {
  805. return _st(_st($Smalltalk())._current())._removeClass_(each);
  806. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  807. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  808. args: [],
  809. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]",
  810. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "removeClass:", "allSubclasses"],
  811. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  812. }),
  813. smalltalk.ClassBuilderTest);
  814. smalltalk.addMethod(
  815. smalltalk.method({
  816. selector: "testInstanceVariableNames",
  817. category: 'tests',
  818. fn: function (){
  819. var self=this;
  820. return smalltalk.withContext(function($ctx1) {
  821. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  822. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  823. args: [],
  824. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  825. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  826. referencedClasses: []
  827. }),
  828. smalltalk.ClassBuilderTest);
  829. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  830. smalltalk.addMethod(
  831. smalltalk.method({
  832. selector: "assertSameContents:as:",
  833. category: 'convenience',
  834. fn: function (aCollection,anotherCollection){
  835. var self=this;
  836. return smalltalk.withContext(function($ctx1) {
  837. self._assert_(_st(_st(aCollection)._size()).__eq(_st(anotherCollection)._size()));
  838. _st(aCollection)._do_((function(each){
  839. return smalltalk.withContext(function($ctx2) {
  840. return self._assert_(_st(_st(aCollection)._occurrencesOf_(each)).__eq(_st(anotherCollection)._occurrencesOf_(each)));
  841. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  842. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  843. args: ["aCollection", "anotherCollection"],
  844. source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]",
  845. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  846. referencedClasses: []
  847. }),
  848. smalltalk.CollectionTest);
  849. smalltalk.addMethod(
  850. smalltalk.method({
  851. selector: "collection",
  852. category: 'accessing',
  853. fn: function (){
  854. var self=this;
  855. return smalltalk.withContext(function($ctx1) {
  856. var $1;
  857. $1=_st(self._collectionClass())._withAll_(self._defaultValues());
  858. return $1;
  859. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  860. args: [],
  861. source: "collection\x0a\x09^ self collectionClass withAll: self defaultValues",
  862. messageSends: ["withAll:", "defaultValues", "collectionClass"],
  863. referencedClasses: []
  864. }),
  865. smalltalk.CollectionTest);
  866. smalltalk.addMethod(
  867. smalltalk.method({
  868. selector: "collectionClass",
  869. category: 'accessing',
  870. fn: function (){
  871. var self=this;
  872. return smalltalk.withContext(function($ctx1) {
  873. var $1;
  874. $1=_st(self._class())._collectionClass();
  875. return $1;
  876. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  877. args: [],
  878. source: "collectionClass\x0a\x09^ self class collectionClass",
  879. messageSends: ["collectionClass", "class"],
  880. referencedClasses: []
  881. }),
  882. smalltalk.CollectionTest);
  883. smalltalk.addMethod(
  884. smalltalk.method({
  885. selector: "collectionWithDuplicates",
  886. category: 'accessing',
  887. fn: function (){
  888. var self=this;
  889. return smalltalk.withContext(function($ctx1) {
  890. var $1;
  891. $1=_st(self._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  892. return $1;
  893. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  894. args: [],
  895. source: "collectionWithDuplicates\x0a\x09^ self collectionClass withAll: #('a' 'b' 'c' 1 2 1 'a')",
  896. messageSends: ["withAll:", "collectionClass"],
  897. referencedClasses: []
  898. }),
  899. smalltalk.CollectionTest);
  900. smalltalk.addMethod(
  901. smalltalk.method({
  902. selector: "defaultValues",
  903. category: 'accessing',
  904. fn: function (){
  905. var self=this;
  906. return smalltalk.withContext(function($ctx1) {
  907. var $1;
  908. $1=[(1), (2), (3), (-4)];
  909. return $1;
  910. }, function($ctx1) {$ctx1.fill(self,"defaultValues",{},smalltalk.CollectionTest)})},
  911. args: [],
  912. source: "defaultValues\x0a\x09^ #(1 2 3 -4)",
  913. messageSends: [],
  914. referencedClasses: []
  915. }),
  916. smalltalk.CollectionTest);
  917. smalltalk.addMethod(
  918. smalltalk.method({
  919. selector: "isCollectionReadOnly",
  920. category: 'testing',
  921. fn: function (){
  922. var self=this;
  923. return smalltalk.withContext(function($ctx1) {
  924. return false;
  925. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  926. args: [],
  927. source: "isCollectionReadOnly\x0a\x09^ false",
  928. messageSends: [],
  929. referencedClasses: []
  930. }),
  931. smalltalk.CollectionTest);
  932. smalltalk.addMethod(
  933. smalltalk.method({
  934. selector: "testAsArray",
  935. category: 'tests',
  936. fn: function (){
  937. var self=this;
  938. return smalltalk.withContext(function($ctx1) {
  939. self._assertSameContents_as_(self._collection(),_st(self._collection())._asArray());
  940. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  941. args: [],
  942. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  943. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  944. referencedClasses: []
  945. }),
  946. smalltalk.CollectionTest);
  947. smalltalk.addMethod(
  948. smalltalk.method({
  949. selector: "testAsOrderedCollection",
  950. category: 'tests',
  951. fn: function (){
  952. var self=this;
  953. return smalltalk.withContext(function($ctx1) {
  954. self._assertSameContents_as_(self._collection(),_st(self._collection())._asOrderedCollection());
  955. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  956. args: [],
  957. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  958. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  959. referencedClasses: []
  960. }),
  961. smalltalk.CollectionTest);
  962. smalltalk.addMethod(
  963. smalltalk.method({
  964. selector: "testAsSet",
  965. category: 'tests',
  966. fn: function (){
  967. var self=this;
  968. var c,set;
  969. return smalltalk.withContext(function($ctx1) {
  970. c=self._collectionWithDuplicates();
  971. set=_st(c)._asSet();
  972. self._assert_equals_(_st(set)._size(),(5));
  973. _st(c)._do_((function(each){
  974. return smalltalk.withContext(function($ctx2) {
  975. return self._assert_(_st(set)._includes_(each));
  976. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  977. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  978. args: [],
  979. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  980. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  981. referencedClasses: []
  982. }),
  983. smalltalk.CollectionTest);
  984. smalltalk.addMethod(
  985. smalltalk.method({
  986. selector: "testCollect",
  987. category: 'tests',
  988. fn: function (){
  989. var self=this;
  990. var newCollection;
  991. return smalltalk.withContext(function($ctx1) {
  992. newCollection=[(1), (2), (3), (4)];
  993. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  994. return smalltalk.withContext(function($ctx2) {
  995. return _st(each)._abs();
  996. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  997. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  998. args: [],
  999. 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",
  1000. messageSends: ["assertSameContents:as:", "collect:", "abs", "collection"],
  1001. referencedClasses: []
  1002. }),
  1003. smalltalk.CollectionTest);
  1004. smalltalk.addMethod(
  1005. smalltalk.method({
  1006. selector: "testDetect",
  1007. category: 'tests',
  1008. fn: function (){
  1009. var self=this;
  1010. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1011. return smalltalk.withContext(function($ctx1) {
  1012. self._assert_equals_(_st(self._collection())._detect_((function(each){
  1013. return smalltalk.withContext(function($ctx2) {
  1014. return _st(each).__lt((0));
  1015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),(-4));
  1016. self._should_raise_((function(){
  1017. return smalltalk.withContext(function($ctx2) {
  1018. return _st(self._collection())._detect_((function(each){
  1019. return smalltalk.withContext(function($ctx3) {
  1020. return _st(each).__eq((6));
  1021. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  1022. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1023. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1024. args: [],
  1025. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each < 0 ]) equals: -4.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
  1026. messageSends: ["assert:equals:", "detect:", "<", "collection", "should:raise:", "="],
  1027. referencedClasses: ["Error"]
  1028. }),
  1029. smalltalk.CollectionTest);
  1030. smalltalk.addMethod(
  1031. smalltalk.method({
  1032. selector: "testDo",
  1033. category: 'tests',
  1034. fn: function (){
  1035. var self=this;
  1036. var newCollection;
  1037. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1038. return smalltalk.withContext(function($ctx1) {
  1039. newCollection=_st($OrderedCollection())._new();
  1040. _st(self._collection())._do_((function(each){
  1041. return smalltalk.withContext(function($ctx2) {
  1042. return _st(newCollection)._add_(each);
  1043. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1044. self._assertSameContents_as_(self._collection(),newCollection);
  1045. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1046. args: [],
  1047. 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",
  1048. messageSends: ["new", "do:", "add:", "collection", "assertSameContents:as:"],
  1049. referencedClasses: ["OrderedCollection"]
  1050. }),
  1051. smalltalk.CollectionTest);
  1052. smalltalk.addMethod(
  1053. smalltalk.method({
  1054. selector: "testIsEmpty",
  1055. category: 'tests',
  1056. fn: function (){
  1057. var self=this;
  1058. return smalltalk.withContext(function($ctx1) {
  1059. self._assert_(_st(_st(self._collectionClass())._new())._isEmpty());
  1060. self._deny_(_st(self._collection())._isEmpty());
  1061. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1062. args: [],
  1063. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1064. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1065. referencedClasses: []
  1066. }),
  1067. smalltalk.CollectionTest);
  1068. smalltalk.addMethod(
  1069. smalltalk.method({
  1070. selector: "testSelect",
  1071. category: 'tests',
  1072. fn: function (){
  1073. var self=this;
  1074. var newCollection;
  1075. return smalltalk.withContext(function($ctx1) {
  1076. newCollection=[(2), (-4)];
  1077. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  1078. return smalltalk.withContext(function($ctx2) {
  1079. return _st(each)._even();
  1080. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  1081. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1082. args: [],
  1083. 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",
  1084. messageSends: ["assertSameContents:as:", "select:", "even", "collection"],
  1085. referencedClasses: []
  1086. }),
  1087. smalltalk.CollectionTest);
  1088. smalltalk.addMethod(
  1089. smalltalk.method({
  1090. selector: "testSize",
  1091. category: 'tests',
  1092. fn: function (){
  1093. var self=this;
  1094. return smalltalk.withContext(function($ctx1) {
  1095. self._assert_equals_(_st(_st(self._collectionClass())._new())._size(),(0));
  1096. self._assert_equals_(_st(self._collection())._size(),(4));
  1097. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  1098. args: [],
  1099. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self collection size equals: 4",
  1100. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"],
  1101. referencedClasses: []
  1102. }),
  1103. smalltalk.CollectionTest);
  1104. smalltalk.addMethod(
  1105. smalltalk.method({
  1106. selector: "collectionClass",
  1107. category: 'accessing',
  1108. fn: function (){
  1109. var self=this;
  1110. return smalltalk.withContext(function($ctx1) {
  1111. return nil;
  1112. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  1113. args: [],
  1114. source: "collectionClass\x0a\x09^ nil",
  1115. messageSends: [],
  1116. referencedClasses: []
  1117. }),
  1118. smalltalk.CollectionTest.klass);
  1119. smalltalk.addMethod(
  1120. smalltalk.method({
  1121. selector: "isAbstract",
  1122. category: 'testing',
  1123. fn: function (){
  1124. var self=this;
  1125. return smalltalk.withContext(function($ctx1) {
  1126. var $1;
  1127. $1=_st(self._collectionClass())._isNil();
  1128. return $1;
  1129. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  1130. args: [],
  1131. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1132. messageSends: ["isNil", "collectionClass"],
  1133. referencedClasses: []
  1134. }),
  1135. smalltalk.CollectionTest.klass);
  1136. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1137. smalltalk.addMethod(
  1138. smalltalk.method({
  1139. selector: "testAt",
  1140. category: 'tests',
  1141. fn: function (){
  1142. var self=this;
  1143. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1144. return smalltalk.withContext(function($ctx1) {
  1145. self._assert_equals_(_st(self._collection())._at_((4)),(-4));
  1146. self._should_raise_((function(){
  1147. return smalltalk.withContext(function($ctx2) {
  1148. return _st(self._collection())._at_((5));
  1149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1150. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  1151. args: [],
  1152. source: "testAt\x0a\x09self assert: (self collection at: 4) equals: -4.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1153. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1154. referencedClasses: ["Error"]
  1155. }),
  1156. smalltalk.IndexableCollectionTest);
  1157. smalltalk.addMethod(
  1158. smalltalk.method({
  1159. selector: "testAtIfAbsent",
  1160. category: 'tests',
  1161. fn: function (){
  1162. var self=this;
  1163. return smalltalk.withContext(function($ctx1) {
  1164. self._assert_equals_(_st(self._collection())._at_ifAbsent_(_st(_st(self._collection())._size()).__plus((1)),(function(){
  1165. return smalltalk.withContext(function($ctx2) {
  1166. return "none";
  1167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"none");
  1168. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  1169. args: [],
  1170. source: "testAtIfAbsent\x0a\x09self assert: (self collection at: (self collection size + 1) ifAbsent: [ 'none' ]) equals: 'none'",
  1171. messageSends: ["assert:equals:", "at:ifAbsent:", "+", "size", "collection"],
  1172. referencedClasses: []
  1173. }),
  1174. smalltalk.IndexableCollectionTest);
  1175. smalltalk.addMethod(
  1176. smalltalk.method({
  1177. selector: "testContains",
  1178. category: 'tests',
  1179. fn: function (){
  1180. var self=this;
  1181. var collection;
  1182. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1183. return smalltalk.withContext(function($ctx1) {
  1184. collection=self._collection();
  1185. self._assert_(_st(self._collection())._contains_((function(each){
  1186. return smalltalk.withContext(function($ctx2) {
  1187. return _st(each).__eq(_st(self._collection())._first());
  1188. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  1189. self._deny_(_st(self._collection())._contains_((function(each){
  1190. return smalltalk.withContext(function($ctx2) {
  1191. return _st(each).__eq(_st($Object())._new());
  1192. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  1193. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1194. args: [],
  1195. source: "testContains\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self assert: (self collection contains: [ :each | each = self collection first ]).\x0a\x09self deny: (self collection contains: [ :each | each = Object new ])",
  1196. messageSends: ["collection", "assert:", "contains:", "=", "first", "deny:", "new"],
  1197. referencedClasses: ["Object"]
  1198. }),
  1199. smalltalk.IndexableCollectionTest);
  1200. smalltalk.addMethod(
  1201. smalltalk.method({
  1202. selector: "testIndexOf",
  1203. category: 'tests',
  1204. fn: function (){
  1205. var self=this;
  1206. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1207. return smalltalk.withContext(function($ctx1) {
  1208. self._assert_equals_(_st(self._collection())._indexOf_((2)),(2));
  1209. self._should_raise_((function(){
  1210. return smalltalk.withContext(function($ctx2) {
  1211. return _st(self._collection())._indexOf_((999));
  1212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1213. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1214. return smalltalk.withContext(function($ctx2) {
  1215. return "sentinel";
  1216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  1217. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  1218. args: [],
  1219. source: "testIndexOf\x0a\x09self assert: (self collection indexOf: 2) equals: 2.\x0a\x09self should: [ self collection indexOf: 999 ] raise: Error.\x0a\x09self assert: (self collection indexOf: 999 ifAbsent: [ 'sentinel' ]) equals: 'sentinel'",
  1220. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1221. referencedClasses: ["Error"]
  1222. }),
  1223. smalltalk.IndexableCollectionTest);
  1224. smalltalk.addMethod(
  1225. smalltalk.method({
  1226. selector: "testWithIndexDo",
  1227. category: 'tests',
  1228. fn: function (){
  1229. var self=this;
  1230. var collection;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. collection=self._collection();
  1233. _st(self._collection())._withIndexDo_((function(each,index){
  1234. return smalltalk.withContext(function($ctx2) {
  1235. return self._assert_equals_(_st(collection)._at_(index),each);
  1236. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  1237. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1238. args: [],
  1239. source: "testWithIndexDo\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self collection withIndexDo: [ :each :index |\x0a\x09\x09self assert: (collection at: index) equals: each ]",
  1240. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  1241. referencedClasses: []
  1242. }),
  1243. smalltalk.IndexableCollectionTest);
  1244. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1245. smalltalk.addMethod(
  1246. smalltalk.method({
  1247. selector: "collection",
  1248. category: 'accessing',
  1249. fn: function (){
  1250. var self=this;
  1251. return smalltalk.withContext(function($ctx1) {
  1252. var $1;
  1253. $1=smalltalk.HashedCollection._from_(["b".__minus_gt((1)),"a".__minus_gt((2)),"c".__minus_gt((3)),"d".__minus_gt((-4))]);
  1254. return $1;
  1255. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  1256. args: [],
  1257. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  1258. messageSends: ["->"],
  1259. referencedClasses: []
  1260. }),
  1261. smalltalk.HashedCollectionTest);
  1262. smalltalk.addMethod(
  1263. smalltalk.method({
  1264. selector: "collectionWithDuplicates",
  1265. category: 'accessing',
  1266. fn: function (){
  1267. var self=this;
  1268. return smalltalk.withContext(function($ctx1) {
  1269. var $1;
  1270. $1=smalltalk.HashedCollection._from_(["b".__minus_gt((1)),"a".__minus_gt((2)),"c".__minus_gt((3)),"d".__minus_gt((-4)),"e".__minus_gt((1)),"f".__minus_gt((2)),"g".__minus_gt((10))]);
  1271. return $1;
  1272. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  1273. args: [],
  1274. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  1275. messageSends: ["->"],
  1276. referencedClasses: []
  1277. }),
  1278. smalltalk.HashedCollectionTest);
  1279. smalltalk.addMethod(
  1280. smalltalk.method({
  1281. selector: "testAsDictionary",
  1282. category: 'tests',
  1283. fn: function (){
  1284. var self=this;
  1285. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1286. return smalltalk.withContext(function($ctx1) {
  1287. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  1288. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  1289. args: [],
  1290. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  1291. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  1292. referencedClasses: ["Dictionary"]
  1293. }),
  1294. smalltalk.HashedCollectionTest);
  1295. smalltalk.addMethod(
  1296. smalltalk.method({
  1297. selector: "testAt",
  1298. category: 'tests',
  1299. fn: function (){
  1300. var self=this;
  1301. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1302. return smalltalk.withContext(function($ctx1) {
  1303. self._assert_equals_(_st(self._collection())._at_("a"),(2));
  1304. self._should_raise_((function(){
  1305. return smalltalk.withContext(function($ctx2) {
  1306. return _st(self._collection())._at_((5));
  1307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1308. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.HashedCollectionTest)})},
  1309. args: [],
  1310. source: "testAt\x0a\x09self assert: (self collection at: 'a') equals: 2.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1311. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1312. referencedClasses: ["Error"]
  1313. }),
  1314. smalltalk.HashedCollectionTest);
  1315. smalltalk.addMethod(
  1316. smalltalk.method({
  1317. selector: "testContains",
  1318. category: 'tests',
  1319. fn: function (){
  1320. var self=this;
  1321. var collection;
  1322. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1323. return smalltalk.withContext(function($ctx1) {
  1324. collection=self._collection();
  1325. self._assert_(_st(self._collection())._contains_((function(each){
  1326. return smalltalk.withContext(function($ctx2) {
  1327. return _st(each).__eq(_st(_st(self._collection())._values())._first());
  1328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  1329. self._deny_(_st(self._collection())._contains_((function(each){
  1330. return smalltalk.withContext(function($ctx2) {
  1331. return _st(each).__eq(_st($Object())._new());
  1332. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  1333. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.HashedCollectionTest)})},
  1334. args: [],
  1335. source: "testContains\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self assert: (self collection contains: [ :each | each = self collection values first ]).\x0a\x09self deny: (self collection contains: [ :each | each = Object new ])",
  1336. messageSends: ["collection", "assert:", "contains:", "=", "first", "values", "deny:", "new"],
  1337. referencedClasses: ["Object"]
  1338. }),
  1339. smalltalk.HashedCollectionTest);
  1340. smalltalk.addMethod(
  1341. smalltalk.method({
  1342. selector: "testFrom",
  1343. category: 'tests',
  1344. fn: function (){
  1345. var self=this;
  1346. var associations;
  1347. return smalltalk.withContext(function($ctx1) {
  1348. associations=["a".__minus_gt((1)),"b".__minus_gt((2))];
  1349. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),smalltalk.HashedCollection._from_(["a".__minus_gt((1)),"b".__minus_gt((2))]));
  1350. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  1351. args: [],
  1352. source: "testFrom\x0a\x22Accept a collection of associations.\x22\x0a| associations |\x0aassociations := { 'a' -> 1. 'b' -> 2 }.\x0aself assertSameContents: ( self class collectionClass from: associations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  1353. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  1354. referencedClasses: []
  1355. }),
  1356. smalltalk.HashedCollectionTest);
  1357. smalltalk.addMethod(
  1358. smalltalk.method({
  1359. selector: "testIndexOf",
  1360. category: 'tests',
  1361. fn: function (){
  1362. var self=this;
  1363. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1364. return smalltalk.withContext(function($ctx1) {
  1365. self._assert_equals_(_st(self._collection())._indexOf_((2)),"a");
  1366. self._should_raise_((function(){
  1367. return smalltalk.withContext(function($ctx2) {
  1368. return _st(self._collection())._indexOf_((999));
  1369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  1370. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  1371. return smalltalk.withContext(function($ctx2) {
  1372. return "sentinel";
  1373. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  1374. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.HashedCollectionTest)})},
  1375. args: [],
  1376. source: "testIndexOf\x0a\x09self assert: (self collection indexOf: 2) equals: 'a'.\x0a\x09self should: [ self collection indexOf: 999 ] raise: Error.\x0a\x09self assert: (self collection indexOf: 999 ifAbsent: [ 'sentinel' ]) equals: 'sentinel'",
  1377. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1378. referencedClasses: ["Error"]
  1379. }),
  1380. smalltalk.HashedCollectionTest);
  1381. smalltalk.addMethod(
  1382. smalltalk.method({
  1383. selector: "testNewFromPairs",
  1384. category: 'tests',
  1385. fn: function (){
  1386. var self=this;
  1387. var flattenedAssociations;
  1388. return smalltalk.withContext(function($ctx1) {
  1389. flattenedAssociations=["a",(1),"b",(2)];
  1390. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),smalltalk.HashedCollection._from_(["a".__minus_gt((1)),"b".__minus_gt((2))]));
  1391. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  1392. args: [],
  1393. source: "testNewFromPairs\x0a\x22Accept an array in which all odd indexes are keys and evens are values.\x22\x0a| flattenedAssociations |\x0aflattenedAssociations := { 'a'. 1. 'b'. 2 }.\x0aself assertSameContents: ( self class collectionClass newFromPairs: flattenedAssociations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  1394. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  1395. referencedClasses: []
  1396. }),
  1397. smalltalk.HashedCollectionTest);
  1398. smalltalk.addMethod(
  1399. smalltalk.method({
  1400. selector: "collectionClass",
  1401. category: 'accessing',
  1402. fn: function (){
  1403. var self=this;
  1404. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1405. return smalltalk.withContext(function($ctx1) {
  1406. var $1;
  1407. $1=$HashedCollection();
  1408. return $1;
  1409. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  1410. args: [],
  1411. source: "collectionClass\x0a\x09^ HashedCollection",
  1412. messageSends: [],
  1413. referencedClasses: ["HashedCollection"]
  1414. }),
  1415. smalltalk.HashedCollectionTest.klass);
  1416. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  1417. smalltalk.addMethod(
  1418. smalltalk.method({
  1419. selector: "collection",
  1420. category: 'accessing',
  1421. fn: function (){
  1422. var self=this;
  1423. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1424. return smalltalk.withContext(function($ctx1) {
  1425. var $2,$3,$1;
  1426. $2=_st($Dictionary())._new();
  1427. _st($2)._at_put_((1),(1));
  1428. _st($2)._at_put_("a",(2));
  1429. _st($2)._at_put_(true,(3));
  1430. _st($2)._at_put_((4),(-4));
  1431. $3=_st($2)._yourself();
  1432. $1=$3;
  1433. return $1;
  1434. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  1435. args: [],
  1436. 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",
  1437. messageSends: ["at:put:", "new", "yourself"],
  1438. referencedClasses: ["Dictionary"]
  1439. }),
  1440. smalltalk.DictionaryTest);
  1441. smalltalk.addMethod(
  1442. smalltalk.method({
  1443. selector: "collectionWithDuplicates",
  1444. category: 'accessing',
  1445. fn: function (){
  1446. var self=this;
  1447. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1448. return smalltalk.withContext(function($ctx1) {
  1449. var $2,$3,$1;
  1450. $2=_st($Dictionary())._new();
  1451. _st($2)._at_put_((1),(1));
  1452. _st($2)._at_put_("a",(2));
  1453. _st($2)._at_put_(true,(3));
  1454. _st($2)._at_put_((4),(-4));
  1455. _st($2)._at_put_("b",(1));
  1456. _st($2)._at_put_((3),(3));
  1457. _st($2)._at_put_(false,(12));
  1458. $3=_st($2)._yourself();
  1459. $1=$3;
  1460. return $1;
  1461. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  1462. args: [],
  1463. 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",
  1464. messageSends: ["at:put:", "new", "yourself"],
  1465. referencedClasses: ["Dictionary"]
  1466. }),
  1467. smalltalk.DictionaryTest);
  1468. smalltalk.addMethod(
  1469. smalltalk.method({
  1470. selector: "testAccessing",
  1471. category: 'tests',
  1472. fn: function (){
  1473. var self=this;
  1474. var d;
  1475. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1476. return smalltalk.withContext(function($ctx1) {
  1477. d=_st($Dictionary())._new();
  1478. _st(d)._at_put_("hello","world");
  1479. self._assert_equals_(_st(d)._at_("hello"),"world");
  1480. self._assert_equals_(_st(d)._at_ifAbsent_("hello",(function(){
  1481. return smalltalk.withContext(function($ctx2) {
  1482. return nil;
  1483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"world");
  1484. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  1485. return smalltalk.withContext(function($ctx2) {
  1486. return nil;
  1487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__eq("world"));
  1488. self._assert_(_st(d)._includesKey_("hello"));
  1489. self._deny_(_st(d)._includesKey_("foo"));
  1490. _st(d)._at_put_((1),(2));
  1491. self._assert_equals_(_st(d)._at_((1)),(2));
  1492. _st(d)._at_put_((1).__at((3)),(3));
  1493. self._assert_equals_(_st(d)._at_((1).__at((3))),(3));
  1494. self._assert_(_st(d)._includesKey_((1).__at((3))));
  1495. self._deny_(_st(d)._includesKey_((3).__at((1))));
  1496. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  1497. args: [],
  1498. source: "testAccessing\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' put: 'world'.\x0a\x09self assert: (d at: 'hello') equals: 'world'.\x0a\x09self assert: (d at: 'hello' ifAbsent: [nil]) equals: 'world'.\x0a\x09self deny: (d at: 'foo' ifAbsent: [nil]) = 'world'.\x0a\x0a\x09self assert: (d includesKey: 'hello').\x0a\x09self deny: (d includesKey: 'foo').\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: (d at: 1) equals: 2.\x0a\x0a\x09d at: 1@3 put: 3.\x0a\x09self assert: (d at: 1@3) equals: 3.\x0a\x0a\x09self assert: (d includesKey: 1@3).\x0a\x09self deny: (d includesKey: 3@1)",
  1499. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  1500. referencedClasses: ["Dictionary"]
  1501. }),
  1502. smalltalk.DictionaryTest);
  1503. smalltalk.addMethod(
  1504. smalltalk.method({
  1505. selector: "testAsHashedCollection",
  1506. category: 'tests',
  1507. fn: function (){
  1508. var self=this;
  1509. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1510. return smalltalk.withContext(function($ctx1) {
  1511. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  1512. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  1513. args: [],
  1514. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  1515. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  1516. referencedClasses: ["HashedCollection"]
  1517. }),
  1518. smalltalk.DictionaryTest);
  1519. smalltalk.addMethod(
  1520. smalltalk.method({
  1521. selector: "testDynamicDictionaries",
  1522. category: 'tests',
  1523. fn: function (){
  1524. var self=this;
  1525. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1526. return smalltalk.withContext(function($ctx1) {
  1527. self._assert_equals_(_st(smalltalk.HashedCollection._from_(["hello".__minus_gt((1))]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  1528. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  1529. args: [],
  1530. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  1531. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  1532. referencedClasses: ["Dictionary"]
  1533. }),
  1534. smalltalk.DictionaryTest);
  1535. smalltalk.addMethod(
  1536. smalltalk.method({
  1537. selector: "testEquality",
  1538. category: 'tests',
  1539. fn: function (){
  1540. var self=this;
  1541. var d1,d2;
  1542. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1543. return smalltalk.withContext(function($ctx1) {
  1544. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  1545. self._assert_(_st(_st($Dictionary())._new()).__eq(_st($Dictionary())._new()));
  1546. $1=_st($Dictionary())._new();
  1547. _st($1)._at_put_((1),(2));
  1548. $2=_st($1)._yourself();
  1549. d1=$2;
  1550. $3=_st($Dictionary())._new();
  1551. _st($3)._at_put_((1),(2));
  1552. $4=_st($3)._yourself();
  1553. d2=$4;
  1554. self._assert_(_st(d1).__eq(d2));
  1555. $5=_st($Dictionary())._new();
  1556. _st($5)._at_put_((1),(3));
  1557. $6=_st($5)._yourself();
  1558. d2=$6;
  1559. self._deny_(_st(d1).__eq(d2));
  1560. $7=_st($Dictionary())._new();
  1561. _st($7)._at_put_((2),(2));
  1562. $8=_st($7)._yourself();
  1563. d2=$8;
  1564. self._deny_(_st(d1).__eq(d2));
  1565. $9=_st($Dictionary())._new();
  1566. _st($9)._at_put_((1),(2));
  1567. _st($9)._at_put_((3),(4));
  1568. $10=_st($9)._yourself();
  1569. d2=$10;
  1570. self._deny_(_st(d1).__eq(d2));
  1571. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  1572. args: [],
  1573. 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.",
  1574. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  1575. referencedClasses: ["Dictionary"]
  1576. }),
  1577. smalltalk.DictionaryTest);
  1578. smalltalk.addMethod(
  1579. smalltalk.method({
  1580. selector: "testIfAbsent",
  1581. category: 'tests',
  1582. fn: function (){
  1583. var self=this;
  1584. var d,visited;
  1585. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1586. return smalltalk.withContext(function($ctx1) {
  1587. visited=false;
  1588. d=_st($Dictionary())._new();
  1589. _st(d)._at_ifAbsent_("hello",(function(){
  1590. return smalltalk.withContext(function($ctx2) {
  1591. visited=true;
  1592. return visited;
  1593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1594. self._assert_(visited);
  1595. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  1596. args: [],
  1597. 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.",
  1598. messageSends: ["new", "at:ifAbsent:", "assert:"],
  1599. referencedClasses: ["Dictionary"]
  1600. }),
  1601. smalltalk.DictionaryTest);
  1602. smalltalk.addMethod(
  1603. smalltalk.method({
  1604. selector: "testIfPresent",
  1605. category: 'tests',
  1606. fn: function (){
  1607. var self=this;
  1608. var d,visited,absent;
  1609. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1610. return smalltalk.withContext(function($ctx1) {
  1611. visited=false;
  1612. d=_st($Dictionary())._new();
  1613. _st(d)._at_put_("hello","world");
  1614. _st(d)._at_ifPresent_("hello",(function(value){
  1615. return smalltalk.withContext(function($ctx2) {
  1616. visited=value;
  1617. return visited;
  1618. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1619. self._assert_equals_(visited,"world");
  1620. absent=_st(d)._at_ifPresent_("bye",(function(value){
  1621. return smalltalk.withContext(function($ctx2) {
  1622. visited=value;
  1623. return visited;
  1624. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1625. self._assert_(_st(absent)._isNil());
  1626. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent},smalltalk.DictionaryTest)})},
  1627. args: [],
  1628. 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 equals: 'world'.\x0a\x0a\x09absent := d at: 'bye' ifPresent: [ :value | visited := value ].\x0a\x09self assert: absent isNil.",
  1629. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"],
  1630. referencedClasses: ["Dictionary"]
  1631. }),
  1632. smalltalk.DictionaryTest);
  1633. smalltalk.addMethod(
  1634. smalltalk.method({
  1635. selector: "testIfPresentIfAbsent",
  1636. category: 'tests',
  1637. fn: function (){
  1638. var self=this;
  1639. var d,visited;
  1640. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1641. return smalltalk.withContext(function($ctx1) {
  1642. visited=false;
  1643. d=_st($Dictionary())._new();
  1644. _st(d)._at_put_("hello","world");
  1645. _st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  1646. return smalltalk.withContext(function($ctx2) {
  1647. visited=value;
  1648. return visited;
  1649. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1650. return smalltalk.withContext(function($ctx2) {
  1651. visited=true;
  1652. return visited;
  1653. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1654. self._assert_equals_(visited,"world");
  1655. _st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  1656. return smalltalk.withContext(function($ctx2) {
  1657. visited=value;
  1658. return visited;
  1659. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}),(function(){
  1660. return smalltalk.withContext(function($ctx2) {
  1661. visited=true;
  1662. return visited;
  1663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1664. self._assert_(visited);
  1665. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  1666. args: [],
  1667. 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 equals: 'world'.\x0a\x0a\x09d at: 'buy' ifPresent: [ :value | visited := value ] ifAbsent: [ visited := true ].\x0a\x09self assert: visited.",
  1668. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"],
  1669. referencedClasses: ["Dictionary"]
  1670. }),
  1671. smalltalk.DictionaryTest);
  1672. smalltalk.addMethod(
  1673. smalltalk.method({
  1674. selector: "testKeys",
  1675. category: 'tests',
  1676. fn: function (){
  1677. var self=this;
  1678. var d;
  1679. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1680. return smalltalk.withContext(function($ctx1) {
  1681. d=_st($Dictionary())._new();
  1682. _st(d)._at_put_((1),(2));
  1683. _st(d)._at_put_((2),(3));
  1684. _st(d)._at_put_((3),(4));
  1685. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1686. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  1687. args: [],
  1688. 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 equals: #(1 2 3)",
  1689. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  1690. referencedClasses: ["Dictionary"]
  1691. }),
  1692. smalltalk.DictionaryTest);
  1693. smalltalk.addMethod(
  1694. smalltalk.method({
  1695. selector: "testPointKey",
  1696. category: 'tests',
  1697. fn: function (){
  1698. var self=this;
  1699. var d;
  1700. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1701. return smalltalk.withContext(function($ctx1) {
  1702. d=_st($Dictionary())._new();
  1703. _st(d)._at_put_((1).__at((1)),"foo");
  1704. self._assert_equals_(_st(d)._at_((1).__at((1))),"foo");
  1705. _st(d)._at_put_((1).__at((1)),"bar");
  1706. self._assert_equals_(_st(d)._at_((1).__at((1))),"bar");
  1707. _st(d)._removeKey_((1).__at((1)));
  1708. self._assert_equals_(_st(d)._at_ifAbsent_((1).__at((1)),(function(){
  1709. return smalltalk.withContext(function($ctx2) {
  1710. return "baz";
  1711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"baz");
  1712. self._deny_(_st(d)._includesKey_((1).__at((1))));
  1713. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  1714. args: [],
  1715. source: "testPointKey\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09\x0a\x09d at: 1@1 put: 'foo'.\x0a\x09self assert: (d at: 1@1) equals: 'foo'.\x0a\x09d at: 1@1 put: 'bar'.\x0a\x09self assert: (d at: 1@1) equals: 'bar'.\x0a\x09d removeKey: 1@1.\x0a\x09self assert: (d at: 1@1 ifAbsent: [ 'baz' ]) equals: 'baz'.\x0a\x09self deny: (d includesKey: 1@1)",
  1716. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  1717. referencedClasses: ["Dictionary"]
  1718. }),
  1719. smalltalk.DictionaryTest);
  1720. smalltalk.addMethod(
  1721. smalltalk.method({
  1722. selector: "testPrintString",
  1723. category: 'tests',
  1724. fn: function (){
  1725. var self=this;
  1726. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1727. return smalltalk.withContext(function($ctx1) {
  1728. var $1,$2;
  1729. $1=_st($Dictionary())._new();
  1730. _st($1)._at_put_("firstname","James");
  1731. _st($1)._at_put_("lastname","Bond");
  1732. $2=_st($1)._printString();
  1733. self._assert_equals_($2,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  1734. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  1735. args: [],
  1736. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (Dictionary new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a Dictionary (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  1737. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  1738. referencedClasses: ["Dictionary"]
  1739. }),
  1740. smalltalk.DictionaryTest);
  1741. smalltalk.addMethod(
  1742. smalltalk.method({
  1743. selector: "testRemoveKey",
  1744. category: 'tests',
  1745. fn: function (){
  1746. var self=this;
  1747. var d,key;
  1748. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1749. return smalltalk.withContext(function($ctx1) {
  1750. d=_st($Dictionary())._new();
  1751. _st(d)._at_put_((1),(2));
  1752. _st(d)._at_put_((2),(3));
  1753. _st(d)._at_put_((3),(4));
  1754. key=(2);
  1755. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  1756. _st(d)._removeKey_(key);
  1757. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  1758. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  1759. self._deny_(_st(d)._includesKey_((2)));
  1760. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  1761. args: [],
  1762. source: "testRemoveKey\x0a\x09| d key |\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\x09key := 2.\x0a\x0a\x09self assert: d keys equals: #(1 2 3).\x0a\x0a\x09d removeKey: key.\x0a\x09self assert: d keys equals: #(1 3).\x0a\x09self assert: d values equals: #(2 4).\x0a\x09self deny: (d includesKey: 2)",
  1763. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  1764. referencedClasses: ["Dictionary"]
  1765. }),
  1766. smalltalk.DictionaryTest);
  1767. smalltalk.addMethod(
  1768. smalltalk.method({
  1769. selector: "testRemoveKeyIfAbsent",
  1770. category: 'tests',
  1771. fn: function (){
  1772. var self=this;
  1773. var d,key;
  1774. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1775. return smalltalk.withContext(function($ctx1) {
  1776. d=_st($Dictionary())._new();
  1777. _st(d)._at_put_((1),(2));
  1778. _st(d)._at_put_((2),(3));
  1779. _st(d)._at_put_((3),(4));
  1780. key=(2);
  1781. self._assert_equals_(_st(d)._removeKey_(key),(3));
  1782. key=(3);
  1783. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1784. return smalltalk.withContext(function($ctx2) {
  1785. return (42);
  1786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(4));
  1787. key="why";
  1788. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  1789. return smalltalk.withContext(function($ctx2) {
  1790. return (42);
  1791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(42));
  1792. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  1793. args: [],
  1794. source: "testRemoveKeyIfAbsent\x0a\x09| d key |\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\x09key := 2.\x0a\x09self assert: (d removeKey: key) equals: 3.\x0a\x0a\x09key := 3.\x0a\x09self assert: (d removeKey: key ifAbsent: [42]) equals: 4.\x0a\x0a\x09key := 'why'.\x0a\x09self assert: (d removeKey: key ifAbsent: [42] ) equals: 42.",
  1795. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  1796. referencedClasses: ["Dictionary"]
  1797. }),
  1798. smalltalk.DictionaryTest);
  1799. smalltalk.addMethod(
  1800. smalltalk.method({
  1801. selector: "testSize",
  1802. category: 'tests',
  1803. fn: function (){
  1804. var self=this;
  1805. var d;
  1806. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1807. return smalltalk.withContext(function($ctx1) {
  1808. d=_st($Dictionary())._new();
  1809. self._assert_equals_(_st(d)._size(),(0));
  1810. _st(d)._at_put_((1),(2));
  1811. self._assert_equals_(_st(d)._size(),(1));
  1812. _st(d)._at_put_((2),(3));
  1813. self._assert_equals_(_st(d)._size(),(2));
  1814. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d},smalltalk.DictionaryTest)})},
  1815. args: [],
  1816. source: "testSize\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09self assert: d size equals: 0.\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: d size equals: 1.\x0a\x0a\x09d at: 2 put: 3.\x0a\x09self assert: d size equals: 2.",
  1817. messageSends: ["new", "assert:equals:", "size", "at:put:"],
  1818. referencedClasses: ["Dictionary"]
  1819. }),
  1820. smalltalk.DictionaryTest);
  1821. smalltalk.addMethod(
  1822. smalltalk.method({
  1823. selector: "testValues",
  1824. category: 'tests',
  1825. fn: function (){
  1826. var self=this;
  1827. var d;
  1828. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1829. return smalltalk.withContext(function($ctx1) {
  1830. d=_st($Dictionary())._new();
  1831. _st(d)._at_put_((1),(2));
  1832. _st(d)._at_put_((2),(3));
  1833. _st(d)._at_put_((3),(4));
  1834. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  1835. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  1836. args: [],
  1837. 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 equals: #(2 3 4)",
  1838. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  1839. referencedClasses: ["Dictionary"]
  1840. }),
  1841. smalltalk.DictionaryTest);
  1842. smalltalk.addMethod(
  1843. smalltalk.method({
  1844. selector: "collectionClass",
  1845. category: 'accessing',
  1846. fn: function (){
  1847. var self=this;
  1848. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1849. return smalltalk.withContext(function($ctx1) {
  1850. var $1;
  1851. $1=$Dictionary();
  1852. return $1;
  1853. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  1854. args: [],
  1855. source: "collectionClass\x0a\x09^ Dictionary",
  1856. messageSends: [],
  1857. referencedClasses: ["Dictionary"]
  1858. }),
  1859. smalltalk.DictionaryTest.klass);
  1860. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1861. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1862. smalltalk.addMethod(
  1863. smalltalk.method({
  1864. selector: "testAtIfAbsent",
  1865. category: 'tests',
  1866. fn: function (){
  1867. var self=this;
  1868. var array;
  1869. return smalltalk.withContext(function($ctx1) {
  1870. array=["hello", "world"];
  1871. self._assert_equals_(_st(array)._at_((1)),"hello");
  1872. self._assert_equals_(_st(array)._at_((2)),"world");
  1873. self._assert_equals_(_st(array)._at_ifAbsent_((2),(function(){
  1874. return smalltalk.withContext(function($ctx2) {
  1875. return "not found";
  1876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"world");
  1877. self._assert_equals_(_st(array)._at_ifAbsent_((0),(function(){
  1878. return smalltalk.withContext(function($ctx2) {
  1879. return "not found";
  1880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1881. self._assert_equals_(_st(array)._at_ifAbsent_((-10),(function(){
  1882. return smalltalk.withContext(function($ctx2) {
  1883. return "not found";
  1884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1885. self._assert_equals_(_st(array)._at_ifAbsent_((3),(function(){
  1886. return smalltalk.withContext(function($ctx2) {
  1887. return "not found";
  1888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not found");
  1889. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array},smalltalk.ArrayTest)})},
  1890. args: [],
  1891. 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'.",
  1892. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  1893. referencedClasses: []
  1894. }),
  1895. smalltalk.ArrayTest);
  1896. smalltalk.addMethod(
  1897. smalltalk.method({
  1898. selector: "testFirstN",
  1899. category: 'tests',
  1900. fn: function (){
  1901. var self=this;
  1902. return smalltalk.withContext(function($ctx1) {
  1903. self._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  1904. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.ArrayTest)})},
  1905. args: [],
  1906. source: "testFirstN\x0a\x09self assert: ({1. 2. 3. 4. 5} first: 3) equals: {1. 2. 3}",
  1907. messageSends: ["assert:equals:", "first:"],
  1908. referencedClasses: []
  1909. }),
  1910. smalltalk.ArrayTest);
  1911. smalltalk.addMethod(
  1912. smalltalk.method({
  1913. selector: "testIfEmpty",
  1914. category: 'tests',
  1915. fn: function (){
  1916. var self=this;
  1917. return smalltalk.withContext(function($ctx1) {
  1918. self._assert_equals_(""._ifEmpty_((function(){
  1919. return smalltalk.withContext(function($ctx2) {
  1920. return "zork";
  1921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"zork");
  1922. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{},smalltalk.ArrayTest)})},
  1923. args: [],
  1924. source: "testIfEmpty\x0a\x09self assert: ( '' ifEmpty: ['zork'] ) equals: 'zork'",
  1925. messageSends: ["assert:equals:", "ifEmpty:"],
  1926. referencedClasses: []
  1927. }),
  1928. smalltalk.ArrayTest);
  1929. smalltalk.addMethod(
  1930. smalltalk.method({
  1931. selector: "testPrintString",
  1932. category: 'tests',
  1933. fn: function (){
  1934. var self=this;
  1935. var array;
  1936. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  1937. return smalltalk.withContext(function($ctx1) {
  1938. var $1,$2,$3,$4;
  1939. array=_st($Array())._new();
  1940. self._assert_equals_(_st(array)._printString(),"an Array ()");
  1941. $1=array;
  1942. _st($1)._add_((1));
  1943. $2=_st($1)._add_((3));
  1944. self._assert_equals_(_st(array)._printString(),"an Array (1 3)");
  1945. _st(array)._add_("foo");
  1946. self._assert_equals_(_st(array)._printString(),"an Array (1 3 'foo')");
  1947. $3=array;
  1948. _st($3)._remove_((1));
  1949. $4=_st($3)._remove_((3));
  1950. self._assert_equals_(_st(array)._printString(),"an Array ('foo')");
  1951. _st(array)._addLast_((3));
  1952. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3)");
  1953. _st(array)._addLast_((3));
  1954. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  1955. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  1956. args: [],
  1957. source: "testPrintString\x0a\x09| array |\x0a\x09array := Array new.\x0a\x09self assert: array printString equals: 'an Array ()'.\x0a\x09array add: 1; add: 3.\x0a\x09self assert: array printString equals: 'an Array (1 3)'.\x0a\x09array add: 'foo'.\x0a\x09self assert: array printString equals: 'an Array (1 3 ''foo'')'.\x0a\x09array remove: 1; remove: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'')'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3)'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3 3)'.",
  1958. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  1959. referencedClasses: ["Array"]
  1960. }),
  1961. smalltalk.ArrayTest);
  1962. smalltalk.addMethod(
  1963. smalltalk.method({
  1964. selector: "testRemoveFromTo",
  1965. category: 'tests',
  1966. fn: function (){
  1967. var self=this;
  1968. return smalltalk.withContext(function($ctx1) {
  1969. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((1),(3)),[(4)]);
  1970. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(3)),[(1), (4)]);
  1971. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  1972. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  1973. args: [],
  1974. source: "testRemoveFromTo\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeFrom: 1 to: 3) equals: #(4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 3) equals: #(1 4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 4) equals: #(1)",
  1975. messageSends: ["assert:equals:", "removeFrom:to:"],
  1976. referencedClasses: []
  1977. }),
  1978. smalltalk.ArrayTest);
  1979. smalltalk.addMethod(
  1980. smalltalk.method({
  1981. selector: "testRemoveIndex",
  1982. category: 'tests',
  1983. fn: function (){
  1984. var self=this;
  1985. return smalltalk.withContext(function($ctx1) {
  1986. self._assert_equals_([(1), (2), (3), (4)]._removeIndex_((2)),[(1), (3), (4)]);
  1987. self._assert_equals_([(1), (2), (3), (4)]._removeIndex_((1)),[(2), (3), (4)]);
  1988. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  1989. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  1990. args: [],
  1991. source: "testRemoveIndex\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeIndex: 2) equals: #(1 3 4).\x0a\x09self assert: (#(1 2 3 4) removeIndex: 1) equals: #(2 3 4).\x0a\x09self assert: (#('hello') removeIndex: 1) equals: #()",
  1992. messageSends: ["assert:equals:", "removeIndex:"],
  1993. referencedClasses: []
  1994. }),
  1995. smalltalk.ArrayTest);
  1996. smalltalk.addMethod(
  1997. smalltalk.method({
  1998. selector: "collectionClass",
  1999. category: 'accessing',
  2000. fn: function (){
  2001. var self=this;
  2002. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2003. return smalltalk.withContext(function($ctx1) {
  2004. var $1;
  2005. $1=$Array();
  2006. return $1;
  2007. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  2008. args: [],
  2009. source: "collectionClass\x0a\x09^ Array",
  2010. messageSends: [],
  2011. referencedClasses: ["Array"]
  2012. }),
  2013. smalltalk.ArrayTest.klass);
  2014. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2015. smalltalk.addMethod(
  2016. smalltalk.method({
  2017. selector: "collection",
  2018. category: 'accessing',
  2019. fn: function (){
  2020. var self=this;
  2021. return smalltalk.withContext(function($ctx1) {
  2022. return "hello";
  2023. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  2024. args: [],
  2025. source: "collection\x0a\x09^'hello'",
  2026. messageSends: [],
  2027. referencedClasses: []
  2028. }),
  2029. smalltalk.StringTest);
  2030. smalltalk.addMethod(
  2031. smalltalk.method({
  2032. selector: "collectionWithDuplicates",
  2033. category: 'accessing',
  2034. fn: function (){
  2035. var self=this;
  2036. return smalltalk.withContext(function($ctx1) {
  2037. return "abbaerte";
  2038. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  2039. args: [],
  2040. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  2041. messageSends: [],
  2042. referencedClasses: []
  2043. }),
  2044. smalltalk.StringTest);
  2045. smalltalk.addMethod(
  2046. smalltalk.method({
  2047. selector: "testAddRemove",
  2048. category: 'tests',
  2049. fn: function (){
  2050. var self=this;
  2051. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2052. return smalltalk.withContext(function($ctx1) {
  2053. self._should_raise_((function(){
  2054. return smalltalk.withContext(function($ctx2) {
  2055. return "hello"._add_("a");
  2056. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2057. self._should_raise_((function(){
  2058. return smalltalk.withContext(function($ctx2) {
  2059. return "hello"._remove_("h");
  2060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2061. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  2062. args: [],
  2063. source: "testAddRemove\x0a\x09self should: ['hello' add: 'a'] raise: Error.\x0a\x09self should: ['hello' remove: 'h'] raise: Error",
  2064. messageSends: ["should:raise:", "add:", "remove:"],
  2065. referencedClasses: ["Error"]
  2066. }),
  2067. smalltalk.StringTest);
  2068. smalltalk.addMethod(
  2069. smalltalk.method({
  2070. selector: "testAsArray",
  2071. category: 'tests',
  2072. fn: function (){
  2073. var self=this;
  2074. return smalltalk.withContext(function($ctx1) {
  2075. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  2076. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  2077. args: [],
  2078. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  2079. messageSends: ["assert:equals:", "asArray"],
  2080. referencedClasses: []
  2081. }),
  2082. smalltalk.StringTest);
  2083. smalltalk.addMethod(
  2084. smalltalk.method({
  2085. selector: "testAsNumber",
  2086. category: 'tests',
  2087. fn: function (){
  2088. var self=this;
  2089. return smalltalk.withContext(function($ctx1) {
  2090. self._assert_equals_("3"._asNumber(),(3));
  2091. self._assert_equals_("-3"._asNumber(),(-3));
  2092. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  2093. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  2094. args: [],
  2095. source: "testAsNumber\x0a\x09self assert: '3' asNumber equals: 3.\x0a\x09self assert: '-3' asNumber equals: -3.\x0a\x09self assert: '-1.5' asNumber equals: -1.5.",
  2096. messageSends: ["assert:equals:", "asNumber"],
  2097. referencedClasses: []
  2098. }),
  2099. smalltalk.StringTest);
  2100. smalltalk.addMethod(
  2101. smalltalk.method({
  2102. selector: "testAt",
  2103. category: 'tests',
  2104. fn: function (){
  2105. var self=this;
  2106. return smalltalk.withContext(function($ctx1) {
  2107. self._assert_equals_("hello"._at_((1)),"h");
  2108. self._assert_equals_("hello"._at_((5)),"o");
  2109. self._assert_equals_("hello"._at_ifAbsent_((6),(function(){
  2110. return smalltalk.withContext(function($ctx2) {
  2111. return nil;
  2112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2113. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.StringTest)})},
  2114. args: [],
  2115. source: "testAt\x0a\x09self assert: ('hello' at: 1) equals: 'h'.\x0a\x09self assert: ('hello' at: 5) equals: 'o'.\x0a\x09self assert: ('hello' at: 6 ifAbsent: [nil]) equals: nil",
  2116. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2117. referencedClasses: []
  2118. }),
  2119. smalltalk.StringTest);
  2120. smalltalk.addMethod(
  2121. smalltalk.method({
  2122. selector: "testAtPut",
  2123. category: 'tests',
  2124. fn: function (){
  2125. var self=this;
  2126. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2127. return smalltalk.withContext(function($ctx1) {
  2128. self._should_raise_((function(){
  2129. return smalltalk.withContext(function($ctx2) {
  2130. return "hello"._at_put_((1),"a");
  2131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2132. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  2133. args: [],
  2134. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  2135. messageSends: ["should:raise:", "at:put:"],
  2136. referencedClasses: ["Error"]
  2137. }),
  2138. smalltalk.StringTest);
  2139. smalltalk.addMethod(
  2140. smalltalk.method({
  2141. selector: "testCollect",
  2142. category: 'tests',
  2143. fn: function (){
  2144. var self=this;
  2145. var newCollection;
  2146. return smalltalk.withContext(function($ctx1) {
  2147. newCollection="hheelllloo";
  2148. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  2149. return smalltalk.withContext(function($ctx2) {
  2150. return _st(each).__comma(each);
  2151. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  2152. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  2153. args: [],
  2154. 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",
  2155. messageSends: ["assertSameContents:as:", "collect:", ",", "collection"],
  2156. referencedClasses: []
  2157. }),
  2158. smalltalk.StringTest);
  2159. smalltalk.addMethod(
  2160. smalltalk.method({
  2161. selector: "testCopyWithoutAll",
  2162. category: 'tests',
  2163. fn: function (){
  2164. var self=this;
  2165. return smalltalk.withContext(function($ctx1) {
  2166. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  2167. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  2168. args: [],
  2169. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  2170. messageSends: ["assert:equals:", "copyWithoutAll:"],
  2171. referencedClasses: []
  2172. }),
  2173. smalltalk.StringTest);
  2174. smalltalk.addMethod(
  2175. smalltalk.method({
  2176. selector: "testDetect",
  2177. category: 'tests',
  2178. fn: function (){
  2179. var self=this;
  2180. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2181. return smalltalk.withContext(function($ctx1) {
  2182. self._assert_equals_(_st(self._collection())._detect_((function(each){
  2183. return smalltalk.withContext(function($ctx2) {
  2184. return _st(each).__eq("h");
  2185. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),"h");
  2186. self._should_raise_((function(){
  2187. return smalltalk.withContext(function($ctx2) {
  2188. return _st(self._collection())._detect_((function(each){
  2189. return smalltalk.withContext(function($ctx3) {
  2190. return _st(each).__eq((6));
  2191. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  2192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2193. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  2194. args: [],
  2195. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each = 'h' ]) equals: 'h'.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
  2196. messageSends: ["assert:equals:", "detect:", "=", "collection", "should:raise:"],
  2197. referencedClasses: ["Error"]
  2198. }),
  2199. smalltalk.StringTest);
  2200. smalltalk.addMethod(
  2201. smalltalk.method({
  2202. selector: "testEquality",
  2203. category: 'tests',
  2204. fn: function (){
  2205. var self=this;
  2206. return smalltalk.withContext(function($ctx1) {
  2207. self._assert_equals_("hello","hello");
  2208. self._deny_("hello".__eq("world"));
  2209. self._deny_("hello".__eq([]._at_ifAbsent_((1),(function(){
  2210. return smalltalk.withContext(function($ctx2) {
  2211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))));
  2212. self._assert_equals_("hello","hello"._yourself());
  2213. self._assert_equals_("hello"._yourself(),"hello");
  2214. self._deny_("".__eq((0)));
  2215. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  2216. args: [],
  2217. source: "testEquality\x0a\x09self assert: 'hello' equals: 'hello'.\x0a\x09self deny: 'hello' = 'world'.\x0a\x09\x0a\x09\x22Test for issue 459\x22\x0a\x09self deny: 'hello' = (#() at: 1 ifAbsent: [ ]).\x0a\x0a\x09self assert: 'hello' equals: 'hello' yourself.\x0a\x09self assert: 'hello' yourself equals: 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' = 0",
  2218. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  2219. referencedClasses: []
  2220. }),
  2221. smalltalk.StringTest);
  2222. smalltalk.addMethod(
  2223. smalltalk.method({
  2224. selector: "testIdentity",
  2225. category: 'tests',
  2226. fn: function (){
  2227. var self=this;
  2228. return smalltalk.withContext(function($ctx1) {
  2229. self._assert_("hello".__eq_eq("hello"));
  2230. self._deny_("hello".__eq_eq("world"));
  2231. self._assert_("hello".__eq_eq("hello"._yourself()));
  2232. self._assert_(_st("hello"._yourself()).__eq_eq("hello"));
  2233. self._deny_("".__eq_eq((0)));
  2234. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  2235. args: [],
  2236. 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",
  2237. messageSends: ["assert:", "==", "deny:", "yourself"],
  2238. referencedClasses: []
  2239. }),
  2240. smalltalk.StringTest);
  2241. smalltalk.addMethod(
  2242. smalltalk.method({
  2243. selector: "testIncludesSubString",
  2244. category: 'tests',
  2245. fn: function (){
  2246. var self=this;
  2247. return smalltalk.withContext(function($ctx1) {
  2248. self._assert_("amber"._includesSubString_("ber"));
  2249. self._deny_("amber"._includesSubString_("zork"));
  2250. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  2251. args: [],
  2252. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  2253. messageSends: ["assert:", "includesSubString:", "deny:"],
  2254. referencedClasses: []
  2255. }),
  2256. smalltalk.StringTest);
  2257. smalltalk.addMethod(
  2258. smalltalk.method({
  2259. selector: "testIndexOf",
  2260. category: 'tests',
  2261. fn: function (){
  2262. var self=this;
  2263. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2264. return smalltalk.withContext(function($ctx1) {
  2265. self._assert_equals_(_st(self._collection())._indexOf_("e"),(2));
  2266. self._should_raise_((function(){
  2267. return smalltalk.withContext(function($ctx2) {
  2268. return _st(self._collection())._indexOf_((999));
  2269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2270. self._assert_equals_(_st(self._collection())._indexOf_ifAbsent_((999),(function(){
  2271. return smalltalk.withContext(function($ctx2) {
  2272. return "sentinel";
  2273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"sentinel");
  2274. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.StringTest)})},
  2275. args: [],
  2276. source: "testIndexOf\x0a\x09self assert: (self collection indexOf: 'e') equals: 2.\x0a\x09self should: [ self collection indexOf: 999 ] raise: Error.\x0a\x09self assert: (self collection indexOf: 999 ifAbsent: [ 'sentinel' ]) equals: 'sentinel'",
  2277. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  2278. referencedClasses: ["Error"]
  2279. }),
  2280. smalltalk.StringTest);
  2281. smalltalk.addMethod(
  2282. smalltalk.method({
  2283. selector: "testJoin",
  2284. category: 'tests',
  2285. fn: function (){
  2286. var self=this;
  2287. return smalltalk.withContext(function($ctx1) {
  2288. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  2289. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  2290. args: [],
  2291. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  2292. messageSends: ["assert:equals:", "join:"],
  2293. referencedClasses: []
  2294. }),
  2295. smalltalk.StringTest);
  2296. smalltalk.addMethod(
  2297. smalltalk.method({
  2298. selector: "testSelect",
  2299. category: 'tests',
  2300. fn: function (){
  2301. var self=this;
  2302. var newCollection;
  2303. return smalltalk.withContext(function($ctx1) {
  2304. newCollection="o";
  2305. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  2306. return smalltalk.withContext(function($ctx2) {
  2307. return _st(each).__eq("o");
  2308. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})),newCollection);
  2309. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  2310. args: [],
  2311. 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",
  2312. messageSends: ["assertSameContents:as:", "select:", "=", "collection"],
  2313. referencedClasses: []
  2314. }),
  2315. smalltalk.StringTest);
  2316. smalltalk.addMethod(
  2317. smalltalk.method({
  2318. selector: "testSize",
  2319. category: 'tests',
  2320. fn: function (){
  2321. var self=this;
  2322. return smalltalk.withContext(function($ctx1) {
  2323. self._assert_equals_("smalltalk"._size(),(9));
  2324. self._assert_equals_(""._size(),(0));
  2325. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  2326. args: [],
  2327. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  2328. messageSends: ["assert:equals:", "size"],
  2329. referencedClasses: []
  2330. }),
  2331. smalltalk.StringTest);
  2332. smalltalk.addMethod(
  2333. smalltalk.method({
  2334. selector: "testStreamContents",
  2335. category: 'tests',
  2336. fn: function (){
  2337. var self=this;
  2338. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  2339. return smalltalk.withContext(function($ctx1) {
  2340. var $1,$2;
  2341. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  2342. return smalltalk.withContext(function($ctx2) {
  2343. $1=aStream;
  2344. _st($1)._nextPutAll_("hello");
  2345. _st($1)._space();
  2346. $2=_st($1)._nextPutAll_("world");
  2347. return $2;
  2348. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})})),"hello world");
  2349. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  2350. args: [],
  2351. source: "testStreamContents\x0a\x09self\x0a\x09\x09assert: (String streamContents: [ :aStream |\x0a\x09\x09\x09aStream\x0a\x09\x09\x09\x09nextPutAll: 'hello'; space;\x0a\x09\x09\x09\x09nextPutAll: 'world' ])\x0a\x09\x09equals: 'hello world'",
  2352. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  2353. referencedClasses: ["String"]
  2354. }),
  2355. smalltalk.StringTest);
  2356. smalltalk.addMethod(
  2357. smalltalk.method({
  2358. selector: "collectionClass",
  2359. category: 'accessing',
  2360. fn: function (){
  2361. var self=this;
  2362. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  2363. return smalltalk.withContext(function($ctx1) {
  2364. var $1;
  2365. $1=$String();
  2366. return $1;
  2367. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  2368. args: [],
  2369. source: "collectionClass\x0a\x09^ String",
  2370. messageSends: [],
  2371. referencedClasses: ["String"]
  2372. }),
  2373. smalltalk.StringTest.klass);
  2374. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2375. smalltalk.addMethod(
  2376. smalltalk.method({
  2377. selector: "testShow",
  2378. category: 'tests',
  2379. fn: function (){
  2380. var self=this;
  2381. var originalTranscript;
  2382. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  2383. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  2384. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2385. return smalltalk.withContext(function($ctx1) {
  2386. originalTranscript=_st($Transcript())._current();
  2387. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  2388. self._shouldnt_raise_((function(){
  2389. return smalltalk.withContext(function($ctx2) {
  2390. return _st($Transcript())._show_("Hello console!");
  2391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2392. self._shouldnt_raise_((function(){
  2393. return smalltalk.withContext(function($ctx2) {
  2394. return _st($Transcript())._show_(console);
  2395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  2396. _st($Transcript())._register_(originalTranscript);
  2397. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  2398. args: [],
  2399. source: "testShow\x0a| originalTranscript |\x0aoriginalTranscript := Transcript current.\x0aTranscript register: ConsoleTranscript new.\x0a\x0aself shouldnt: [ Transcript show: 'Hello console!' ] raise: Error.\x0aself shouldnt: [ Transcript show: console ] raise: Error.\x0a\x0aTranscript register: originalTranscript.",
  2400. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  2401. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  2402. }),
  2403. smalltalk.ConsoleTranscriptTest);
  2404. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2405. smalltalk.addMethod(
  2406. smalltalk.method({
  2407. selector: "jsObject",
  2408. category: 'accessing',
  2409. fn: function (){
  2410. var self=this;
  2411. return smalltalk.withContext(function($ctx1) {
  2412. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined};
  2413. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  2414. args: [],
  2415. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined}>",
  2416. messageSends: [],
  2417. referencedClasses: []
  2418. }),
  2419. smalltalk.JSObjectProxyTest);
  2420. smalltalk.addMethod(
  2421. smalltalk.method({
  2422. selector: "testAtIfAbsent",
  2423. category: 'tests',
  2424. fn: function (){
  2425. var self=this;
  2426. var testObject;
  2427. return smalltalk.withContext(function($ctx1) {
  2428. testObject=self._jsObject();
  2429. self._assert_equals_(_st(testObject)._at_ifAbsent_("abc",(function(){
  2430. return smalltalk.withContext(function($ctx2) {
  2431. return "Property does not exist";
  2432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"Property does not exist");
  2433. self._assert_equals_(_st(testObject)._at_ifAbsent_("e",(function(){
  2434. return smalltalk.withContext(function($ctx2) {
  2435. return "Property does not exist";
  2436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2437. self._assert_equals_(_st(testObject)._at_ifAbsent_("a",(function(){
  2438. return smalltalk.withContext(function($ctx2) {
  2439. return "Property does not exist";
  2440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),(1));
  2441. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  2442. return smalltalk.withContext(function($ctx2) {
  2443. return "Property does not exist";
  2444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),nil);
  2445. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2446. args: [],
  2447. source: "testAtIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifAbsent: ['Property does not exist']) equals: 'Property does not exist'.\x0a\x09self assert: (testObject at: 'e' ifAbsent: ['Property does not exist']) equals: nil.\x0a\x09self assert: (testObject at: 'a' ifAbsent: ['Property does not exist']) equals: 1.\x0a\x09self assert: (testObject at: 'f' ifAbsent: ['Property does not exist']) equals: nil.",
  2448. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  2449. referencedClasses: []
  2450. }),
  2451. smalltalk.JSObjectProxyTest);
  2452. smalltalk.addMethod(
  2453. smalltalk.method({
  2454. selector: "testAtIfPresent",
  2455. category: 'tests',
  2456. fn: function (){
  2457. var self=this;
  2458. var testObject;
  2459. return smalltalk.withContext(function($ctx1) {
  2460. testObject=self._jsObject();
  2461. self._assert_equals_(_st(testObject)._at_ifPresent_("abc",(function(x){
  2462. return smalltalk.withContext(function($ctx2) {
  2463. return "hello ".__comma(_st(x)._asString());
  2464. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),nil);
  2465. self._assert_equals_(_st(testObject)._at_ifPresent_("e",(function(x){
  2466. return smalltalk.withContext(function($ctx2) {
  2467. return "hello ".__comma(_st(x)._asString());
  2468. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello nil");
  2469. self._assert_equals_(_st(testObject)._at_ifPresent_("a",(function(x){
  2470. return smalltalk.withContext(function($ctx2) {
  2471. return "hello ".__comma(_st(x)._asString());
  2472. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello 1");
  2473. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  2474. return smalltalk.withContext(function($ctx2) {
  2475. return "hello ".__comma(_st(x)._asString());
  2476. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),"hello nil");
  2477. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2478. args: [],
  2479. source: "testAtIfPresent\x0a\x09| testObject |\x0a\x09\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x | 'hello ',x asString ]) equals: nil.\x0a\x09self assert: (testObject at: 'e' ifPresent: [:x | 'hello ',x asString ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [:x | 'hello ',x asString ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [:x | 'hello ',x asString ]) equals: 'hello nil'.",
  2480. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  2481. referencedClasses: []
  2482. }),
  2483. smalltalk.JSObjectProxyTest);
  2484. smalltalk.addMethod(
  2485. smalltalk.method({
  2486. selector: "testAtIfPresentIfAbsent",
  2487. category: 'tests',
  2488. fn: function (){
  2489. var self=this;
  2490. var testObject;
  2491. return smalltalk.withContext(function($ctx1) {
  2492. testObject=self._jsObject();
  2493. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  2494. return smalltalk.withContext(function($ctx2) {
  2495. return "hello ".__comma(_st(x)._asString());
  2496. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  2497. return smalltalk.withContext(function($ctx2) {
  2498. return "not present";
  2499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"not present");
  2500. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  2501. return smalltalk.withContext(function($ctx2) {
  2502. return "hello ".__comma(_st(x)._asString());
  2503. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  2504. return smalltalk.withContext(function($ctx2) {
  2505. return "not present";
  2506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello nil");
  2507. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  2508. return smalltalk.withContext(function($ctx2) {
  2509. return "hello ".__comma(_st(x)._asString());
  2510. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  2511. return smalltalk.withContext(function($ctx2) {
  2512. return "not present";
  2513. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello 1");
  2514. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  2515. return smalltalk.withContext(function($ctx2) {
  2516. return "hello ".__comma(_st(x)._asString());
  2517. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}),(function(){
  2518. return smalltalk.withContext(function($ctx2) {
  2519. return "not present";
  2520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"hello nil");
  2521. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2522. args: [],
  2523. source: "testAtIfPresentIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifPresent: [:x|'hello ',x asString] ifAbsent: ['not present']) equals: 'not present'.\x0a\x09self assert: (testObject at: 'e' ifPresent: [:x|'hello ',x asString] ifAbsent: ['not present']) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [:x|'hello ',x asString] ifAbsent: ['not present']) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [:x|'hello ',x asString] ifAbsent: ['not present']) equals: 'hello nil'.",
  2524. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  2525. referencedClasses: []
  2526. }),
  2527. smalltalk.JSObjectProxyTest);
  2528. smalltalk.addMethod(
  2529. smalltalk.method({
  2530. selector: "testDNU",
  2531. category: 'tests',
  2532. fn: function (){
  2533. var self=this;
  2534. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2535. return smalltalk.withContext(function($ctx1) {
  2536. self._should_raise_((function(){
  2537. return smalltalk.withContext(function($ctx2) {
  2538. return _st(self._jsObject())._foo();
  2539. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2540. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  2541. args: [],
  2542. source: "testDNU\x0a\x09self should: [self jsObject foo] raise: MessageNotUnderstood",
  2543. messageSends: ["should:raise:", "foo", "jsObject"],
  2544. referencedClasses: ["MessageNotUnderstood"]
  2545. }),
  2546. smalltalk.JSObjectProxyTest);
  2547. smalltalk.addMethod(
  2548. smalltalk.method({
  2549. selector: "testMessageSend",
  2550. category: 'tests',
  2551. fn: function (){
  2552. var self=this;
  2553. return smalltalk.withContext(function($ctx1) {
  2554. self._assert_equals_(_st(self._jsObject())._a(),(1));
  2555. self._assert_equals_(_st(self._jsObject())._b(),(2));
  2556. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  2557. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  2558. args: [],
  2559. 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",
  2560. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  2561. referencedClasses: []
  2562. }),
  2563. smalltalk.JSObjectProxyTest);
  2564. smalltalk.addMethod(
  2565. smalltalk.method({
  2566. selector: "testMethodWithArguments",
  2567. category: 'tests',
  2568. fn: function (){
  2569. var self=this;
  2570. return smalltalk.withContext(function($ctx1) {
  2571. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  2572. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  2573. args: [],
  2574. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  2575. messageSends: ["assert:equals:", "c:", "jsObject"],
  2576. referencedClasses: []
  2577. }),
  2578. smalltalk.JSObjectProxyTest);
  2579. smalltalk.addMethod(
  2580. smalltalk.method({
  2581. selector: "testPrinting",
  2582. category: 'tests',
  2583. fn: function (){
  2584. var self=this;
  2585. return smalltalk.withContext(function($ctx1) {
  2586. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  2587. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  2588. args: [],
  2589. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  2590. messageSends: ["assert:equals:", "printString", "jsObject"],
  2591. referencedClasses: []
  2592. }),
  2593. smalltalk.JSObjectProxyTest);
  2594. smalltalk.addMethod(
  2595. smalltalk.method({
  2596. selector: "testPropertyThatReturnsEmptyString",
  2597. category: 'tests',
  2598. fn: function (){
  2599. var self=this;
  2600. var object;
  2601. return smalltalk.withContext(function($ctx1) {
  2602. object=self._jsObject();
  2603. self._assert_equals_(_st(object)._d(),"");
  2604. _st(object)._d_("hello");
  2605. self._assert_equals_(_st(object)._d(),"hello");
  2606. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  2607. args: [],
  2608. source: "testPropertyThatReturnsEmptyString\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self assert: object d equals: ''.\x0a\x0a\x09object d: 'hello'.\x0a\x09self assert: object d equals: 'hello'",
  2609. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  2610. referencedClasses: []
  2611. }),
  2612. smalltalk.JSObjectProxyTest);
  2613. smalltalk.addMethod(
  2614. smalltalk.method({
  2615. selector: "testPropertyThatReturnsUndefined",
  2616. category: 'tests',
  2617. fn: function (){
  2618. var self=this;
  2619. var object;
  2620. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2621. return smalltalk.withContext(function($ctx1) {
  2622. object=self._jsObject();
  2623. self._shouldnt_raise_((function(){
  2624. return smalltalk.withContext(function($ctx2) {
  2625. return _st(object)._e();
  2626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  2627. self._assert_(_st(_st(object)._e())._isNil());
  2628. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  2629. args: [],
  2630. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  2631. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  2632. referencedClasses: ["MessageNotUnderstood"]
  2633. }),
  2634. smalltalk.JSObjectProxyTest);
  2635. smalltalk.addMethod(
  2636. smalltalk.method({
  2637. selector: "testValue",
  2638. category: 'tests',
  2639. fn: function (){
  2640. var self=this;
  2641. var testObject;
  2642. return smalltalk.withContext(function($ctx1) {
  2643. testObject=self._jsObject();
  2644. self._assert_equals_(_st(_st(testObject)._value())._printString(),"[object Object]");
  2645. _st(testObject)._at_put_("value","aValue");
  2646. self._assert_equals_(_st(testObject)._value(),"aValue");
  2647. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  2648. args: [],
  2649. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: testObject value printString equals: '[object Object]'.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  2650. messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"],
  2651. referencedClasses: []
  2652. }),
  2653. smalltalk.JSObjectProxyTest);
  2654. smalltalk.addMethod(
  2655. smalltalk.method({
  2656. selector: "testYourself",
  2657. category: 'tests',
  2658. fn: function (){
  2659. var self=this;
  2660. var object;
  2661. return smalltalk.withContext(function($ctx1) {
  2662. var $1,$2;
  2663. $1=self._jsObject();
  2664. _st($1)._d_("test");
  2665. $2=_st($1)._yourself();
  2666. object=$2;
  2667. self._assert_equals_(_st(object)._d(),"test");
  2668. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  2669. args: [],
  2670. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  2671. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  2672. referencedClasses: []
  2673. }),
  2674. smalltalk.JSObjectProxyTest);
  2675. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2676. smalltalk.addMethod(
  2677. smalltalk.method({
  2678. selector: "testCatchingException",
  2679. category: 'tests',
  2680. fn: function (){
  2681. var self=this;
  2682. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2683. return smalltalk.withContext(function($ctx1) {
  2684. _st((function(){
  2685. return smalltalk.withContext(function($ctx2) {
  2686. return self._throwException();
  2687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(error){
  2688. return smalltalk.withContext(function($ctx2) {
  2689. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  2690. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  2691. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  2692. args: [],
  2693. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  2694. messageSends: ["on:do:", "assert:", "=", "exception", "throwException"],
  2695. referencedClasses: ["Error"]
  2696. }),
  2697. smalltalk.JavaScriptExceptionTest);
  2698. smalltalk.addMethod(
  2699. smalltalk.method({
  2700. selector: "testRaisingException",
  2701. category: 'tests',
  2702. fn: function (){
  2703. var self=this;
  2704. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  2705. return smalltalk.withContext(function($ctx1) {
  2706. self._should_raise_((function(){
  2707. return smalltalk.withContext(function($ctx2) {
  2708. return self._throwException();
  2709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$JavaScriptException());
  2710. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  2711. args: [],
  2712. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  2713. messageSends: ["should:raise:", "throwException"],
  2714. referencedClasses: ["JavaScriptException"]
  2715. }),
  2716. smalltalk.JavaScriptExceptionTest);
  2717. smalltalk.addMethod(
  2718. smalltalk.method({
  2719. selector: "throwException",
  2720. category: 'helpers',
  2721. fn: function (){
  2722. var self=this;
  2723. return smalltalk.withContext(function($ctx1) {
  2724. throw 'test';
  2725. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  2726. args: [],
  2727. source: "throwException\x0a\x09<throw 'test'>",
  2728. messageSends: [],
  2729. referencedClasses: []
  2730. }),
  2731. smalltalk.JavaScriptExceptionTest);
  2732. smalltalk.addClass('LegacyPackageHandlerTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  2733. smalltalk.addMethod(
  2734. smalltalk.method({
  2735. selector: "setUp",
  2736. category: 'running',
  2737. fn: function (){
  2738. var self=this;
  2739. function $LegacyPackageHandler(){return smalltalk.LegacyPackageHandler||(typeof LegacyPackageHandler=="undefined"?nil:LegacyPackageHandler)}
  2740. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  2741. return smalltalk.withContext(function($ctx1) {
  2742. var $1,$2;
  2743. self["@backUpCommitPathJs"]=_st($LegacyPackageHandler())._defaultCommitPathJs();
  2744. self["@backUpCommitPathSt"]=_st($LegacyPackageHandler())._defaultCommitPathSt();
  2745. _st($LegacyPackageHandler())._resetCommitPaths();
  2746. self["@zorkPackage"]=_st(_st($Package())._new())._name_("Zork");
  2747. $1=_st($Package())._new();
  2748. _st($1)._name_("Grul");
  2749. _st($1)._commitPathJs_("server/grul/js");
  2750. _st($1)._commitPathSt_("grul/st");
  2751. $2=_st($1)._yourself();
  2752. self["@grulPackage"]=$2;
  2753. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.LegacyPackageHandlerTest)})},
  2754. args: [],
  2755. source: "setUp\x0a\x09backUpCommitPathJs := LegacyPackageHandler defaultCommitPathJs.\x0a\x09backUpCommitPathSt := LegacyPackageHandler defaultCommitPathSt.\x0a\x0a\x09LegacyPackageHandler 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",
  2756. messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"],
  2757. referencedClasses: ["LegacyPackageHandler", "Package"]
  2758. }),
  2759. smalltalk.LegacyPackageHandlerTest);
  2760. smalltalk.addMethod(
  2761. smalltalk.method({
  2762. selector: "tearDown",
  2763. category: 'running',
  2764. fn: function (){
  2765. var self=this;
  2766. function $LegacyPackageHandler(){return smalltalk.LegacyPackageHandler||(typeof LegacyPackageHandler=="undefined"?nil:LegacyPackageHandler)}
  2767. return smalltalk.withContext(function($ctx1) {
  2768. var $1,$2;
  2769. $1=$LegacyPackageHandler();
  2770. _st($1)._defaultCommitPathJs_(self["@backUpCommitPathJs"]);
  2771. $2=_st($1)._defaultCommitPathSt_(self["@backUpCommitPathSt"]);
  2772. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.LegacyPackageHandlerTest)})},
  2773. args: [],
  2774. source: "tearDown\x0a\x09LegacyPackageHandler\x0a\x09\x09defaultCommitPathJs: backUpCommitPathJs;\x0a\x09\x09defaultCommitPathSt: backUpCommitPathSt",
  2775. messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"],
  2776. referencedClasses: ["LegacyPackageHandler"]
  2777. }),
  2778. smalltalk.LegacyPackageHandlerTest);
  2779. smalltalk.addMethod(
  2780. smalltalk.method({
  2781. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2782. category: 'tests',
  2783. fn: function (){
  2784. var self=this;
  2785. return smalltalk.withContext(function($ctx1) {
  2786. self._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  2787. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{},smalltalk.LegacyPackageHandlerTest)})},
  2788. args: [],
  2789. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: grulPackage commitPathJs equals: 'server/grul/js'",
  2790. messageSends: ["assert:equals:", "commitPathJs"],
  2791. referencedClasses: []
  2792. }),
  2793. smalltalk.LegacyPackageHandlerTest);
  2794. smalltalk.addMethod(
  2795. smalltalk.method({
  2796. selector: "testGrulCommitPathStShouldBeGrulSt",
  2797. category: 'tests',
  2798. fn: function (){
  2799. var self=this;
  2800. return smalltalk.withContext(function($ctx1) {
  2801. self._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  2802. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{},smalltalk.LegacyPackageHandlerTest)})},
  2803. args: [],
  2804. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: grulPackage commitPathSt equals: 'grul/st'",
  2805. messageSends: ["assert:equals:", "commitPathSt"],
  2806. referencedClasses: []
  2807. }),
  2808. smalltalk.LegacyPackageHandlerTest);
  2809. smalltalk.addMethod(
  2810. smalltalk.method({
  2811. selector: "testZorkCommitPathJsShouldBeJs",
  2812. category: 'tests',
  2813. fn: function (){
  2814. var self=this;
  2815. return smalltalk.withContext(function($ctx1) {
  2816. self._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"js");
  2817. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJs",{},smalltalk.LegacyPackageHandlerTest)})},
  2818. args: [],
  2819. source: "testZorkCommitPathJsShouldBeJs\x0a\x09self assert: zorkPackage commitPathJs equals: 'js'",
  2820. messageSends: ["assert:equals:", "commitPathJs"],
  2821. referencedClasses: []
  2822. }),
  2823. smalltalk.LegacyPackageHandlerTest);
  2824. smalltalk.addMethod(
  2825. smalltalk.method({
  2826. selector: "testZorkCommitPathStShouldBeSt",
  2827. category: 'tests',
  2828. fn: function (){
  2829. var self=this;
  2830. return smalltalk.withContext(function($ctx1) {
  2831. self._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"st");
  2832. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSt",{},smalltalk.LegacyPackageHandlerTest)})},
  2833. args: [],
  2834. source: "testZorkCommitPathStShouldBeSt\x0a\x09self assert: zorkPackage commitPathSt equals: 'st'",
  2835. messageSends: ["assert:equals:", "commitPathSt"],
  2836. referencedClasses: []
  2837. }),
  2838. smalltalk.LegacyPackageHandlerTest);
  2839. smalltalk.addClass('LegacyPackageHandlerTestWithDefaultsChanged', smalltalk.LegacyPackageHandlerTest, [], 'Kernel-Tests');
  2840. smalltalk.addMethod(
  2841. smalltalk.method({
  2842. selector: "setUp",
  2843. category: 'running',
  2844. fn: function (){
  2845. var self=this;
  2846. function $LegacyPackageHandler(){return smalltalk.LegacyPackageHandler||(typeof LegacyPackageHandler=="undefined"?nil:LegacyPackageHandler)}
  2847. return smalltalk.withContext(function($ctx1) {
  2848. var $1,$2;
  2849. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged.superclass.fn.prototype._setUp.apply(_st(self), []);
  2850. $1=$LegacyPackageHandler();
  2851. _st($1)._defaultCommitPathJs_("javascripts/");
  2852. $2=_st($1)._defaultCommitPathSt_("smalltalk/");
  2853. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2854. args: [],
  2855. source: "setUp\x0a\x09super setUp.\x0a\x0a\x09LegacyPackageHandler\x0a\x09\x09defaultCommitPathJs: 'javascripts/';\x0a\x09\x09defaultCommitPathSt: 'smalltalk/'.",
  2856. messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"],
  2857. referencedClasses: ["LegacyPackageHandler"]
  2858. }),
  2859. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2860. smalltalk.addMethod(
  2861. smalltalk.method({
  2862. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2863. category: 'tests',
  2864. fn: function (){
  2865. var self=this;
  2866. return smalltalk.withContext(function($ctx1) {
  2867. self._assert_equals_(_st(self["@grulPackage"])._commitPathJs(),"server/grul/js");
  2868. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathJsShouldBeServerGrulJs",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2869. args: [],
  2870. source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: grulPackage commitPathJs equals: 'server/grul/js'",
  2871. messageSends: ["assert:equals:", "commitPathJs"],
  2872. referencedClasses: []
  2873. }),
  2874. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2875. smalltalk.addMethod(
  2876. smalltalk.method({
  2877. selector: "testGrulCommitPathStShouldBeGrulSt",
  2878. category: 'tests',
  2879. fn: function (){
  2880. var self=this;
  2881. return smalltalk.withContext(function($ctx1) {
  2882. self._assert_equals_(_st(self["@grulPackage"])._commitPathSt(),"grul/st");
  2883. return self}, function($ctx1) {$ctx1.fill(self,"testGrulCommitPathStShouldBeGrulSt",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2884. args: [],
  2885. source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: grulPackage commitPathSt equals: 'grul/st'",
  2886. messageSends: ["assert:equals:", "commitPathSt"],
  2887. referencedClasses: []
  2888. }),
  2889. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2890. smalltalk.addMethod(
  2891. smalltalk.method({
  2892. selector: "testZorkCommitPathJsShouldBeJavascript",
  2893. category: 'tests',
  2894. fn: function (){
  2895. var self=this;
  2896. return smalltalk.withContext(function($ctx1) {
  2897. self._assert_equals_(_st(self["@zorkPackage"])._commitPathJs(),"javascripts/");
  2898. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathJsShouldBeJavascript",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2899. args: [],
  2900. source: "testZorkCommitPathJsShouldBeJavascript\x0a\x09self assert: zorkPackage commitPathJs equals: 'javascripts/'",
  2901. messageSends: ["assert:equals:", "commitPathJs"],
  2902. referencedClasses: []
  2903. }),
  2904. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2905. smalltalk.addMethod(
  2906. smalltalk.method({
  2907. selector: "testZorkCommitPathStShouldBeSmalltalk",
  2908. category: 'tests',
  2909. fn: function (){
  2910. var self=this;
  2911. return smalltalk.withContext(function($ctx1) {
  2912. self._assert_equals_(_st(self["@zorkPackage"])._commitPathSt(),"smalltalk/");
  2913. return self}, function($ctx1) {$ctx1.fill(self,"testZorkCommitPathStShouldBeSmalltalk",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged)})},
  2914. args: [],
  2915. source: "testZorkCommitPathStShouldBeSmalltalk\x0a\x09self assert: zorkPackage commitPathSt equals: 'smalltalk/'",
  2916. messageSends: ["assert:equals:", "commitPathSt"],
  2917. referencedClasses: []
  2918. }),
  2919. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged);
  2920. smalltalk.addMethod(
  2921. smalltalk.method({
  2922. selector: "shouldInheritSelectors",
  2923. category: 'accessing',
  2924. fn: function (){
  2925. var self=this;
  2926. return smalltalk.withContext(function($ctx1) {
  2927. return false;
  2928. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},smalltalk.LegacyPackageHandlerTestWithDefaultsChanged.klass)})},
  2929. args: [],
  2930. source: "shouldInheritSelectors\x0a\x09^ false",
  2931. messageSends: [],
  2932. referencedClasses: []
  2933. }),
  2934. smalltalk.LegacyPackageHandlerTestWithDefaultsChanged.klass);
  2935. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2936. smalltalk.addMethod(
  2937. smalltalk.method({
  2938. selector: "testValue",
  2939. category: 'tests',
  2940. fn: function (){
  2941. var self=this;
  2942. var messageSend;
  2943. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2944. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  2945. return smalltalk.withContext(function($ctx1) {
  2946. var $1,$2;
  2947. $1=_st($MessageSend())._new();
  2948. _st($1)._receiver_(_st($Object())._new());
  2949. _st($1)._selector_("asString");
  2950. $2=_st($1)._yourself();
  2951. messageSend=$2;
  2952. self._assert_equals_(_st(messageSend)._value(),"an Object");
  2953. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  2954. args: [],
  2955. source: "testValue\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: Object new;\x0a\x09\x09selector: #asString;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: messageSend value equals: 'an Object'",
  2956. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  2957. referencedClasses: ["Object", "MessageSend"]
  2958. }),
  2959. smalltalk.MessageSendTest);
  2960. smalltalk.addMethod(
  2961. smalltalk.method({
  2962. selector: "testValueWithArguments",
  2963. category: 'tests',
  2964. fn: function (){
  2965. var self=this;
  2966. var messageSend;
  2967. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  2968. return smalltalk.withContext(function($ctx1) {
  2969. var $1,$2;
  2970. $1=_st($MessageSend())._new();
  2971. _st($1)._receiver_((2));
  2972. _st($1)._selector_("+");
  2973. $2=_st($1)._yourself();
  2974. messageSend=$2;
  2975. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  2976. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  2977. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  2978. args: [],
  2979. source: "testValueWithArguments\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: 2;\x0a\x09\x09selector: '+';\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: (messageSend value: 3) equals: 5.\x0a\x09\x0a\x09self assert: (messageSend valueWithPossibleArguments: #(4)) equals: 6",
  2980. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  2981. referencedClasses: ["MessageSend"]
  2982. }),
  2983. smalltalk.MessageSendTest);
  2984. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  2985. smalltalk.addMethod(
  2986. smalltalk.method({
  2987. selector: "codeGeneratorClass",
  2988. category: 'accessing',
  2989. fn: function (){
  2990. var self=this;
  2991. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  2992. return smalltalk.withContext(function($ctx1) {
  2993. var $1;
  2994. $1=$CodeGenerator();
  2995. return $1;
  2996. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  2997. args: [],
  2998. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  2999. messageSends: [],
  3000. referencedClasses: ["CodeGenerator"]
  3001. }),
  3002. smalltalk.MethodInheritanceTest);
  3003. smalltalk.addMethod(
  3004. smalltalk.method({
  3005. selector: "compiler",
  3006. category: 'factory',
  3007. fn: function (){
  3008. var self=this;
  3009. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  3010. return smalltalk.withContext(function($ctx1) {
  3011. var $2,$3,$1;
  3012. $2=_st($Compiler())._new();
  3013. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  3014. $3=_st($2)._yourself();
  3015. $1=$3;
  3016. return $1;
  3017. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  3018. args: [],
  3019. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  3020. messageSends: ["codeGeneratorClass:", "codeGeneratorClass", "new", "yourself"],
  3021. referencedClasses: ["Compiler"]
  3022. }),
  3023. smalltalk.MethodInheritanceTest);
  3024. smalltalk.addMethod(
  3025. smalltalk.method({
  3026. selector: "deinstallBottom",
  3027. category: 'testing',
  3028. fn: function (){
  3029. var self=this;
  3030. return smalltalk.withContext(function($ctx1) {
  3031. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  3032. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  3033. args: [],
  3034. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  3035. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  3036. referencedClasses: []
  3037. }),
  3038. smalltalk.MethodInheritanceTest);
  3039. smalltalk.addMethod(
  3040. smalltalk.method({
  3041. selector: "deinstallMiddle",
  3042. category: 'testing',
  3043. fn: function (){
  3044. var self=this;
  3045. return smalltalk.withContext(function($ctx1) {
  3046. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  3047. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  3048. args: [],
  3049. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  3050. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  3051. referencedClasses: []
  3052. }),
  3053. smalltalk.MethodInheritanceTest);
  3054. smalltalk.addMethod(
  3055. smalltalk.method({
  3056. selector: "deinstallTop",
  3057. category: 'testing',
  3058. fn: function (){
  3059. var self=this;
  3060. return smalltalk.withContext(function($ctx1) {
  3061. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  3062. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  3063. args: [],
  3064. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  3065. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  3066. referencedClasses: []
  3067. }),
  3068. smalltalk.MethodInheritanceTest);
  3069. smalltalk.addMethod(
  3070. smalltalk.method({
  3071. selector: "installBottom:",
  3072. category: 'testing',
  3073. fn: function (aString){
  3074. var self=this;
  3075. return smalltalk.withContext(function($ctx1) {
  3076. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassBottom(),"tests");
  3077. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  3078. args: ["aString"],
  3079. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom category: 'tests'",
  3080. messageSends: ["install:forClass:category:", "targetClassBottom", "compiler"],
  3081. referencedClasses: []
  3082. }),
  3083. smalltalk.MethodInheritanceTest);
  3084. smalltalk.addMethod(
  3085. smalltalk.method({
  3086. selector: "installMiddle:",
  3087. category: 'testing',
  3088. fn: function (aString){
  3089. var self=this;
  3090. return smalltalk.withContext(function($ctx1) {
  3091. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassMiddle(),"tests");
  3092. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  3093. args: ["aString"],
  3094. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle category: 'tests'",
  3095. messageSends: ["install:forClass:category:", "targetClassMiddle", "compiler"],
  3096. referencedClasses: []
  3097. }),
  3098. smalltalk.MethodInheritanceTest);
  3099. smalltalk.addMethod(
  3100. smalltalk.method({
  3101. selector: "installTop:",
  3102. category: 'testing',
  3103. fn: function (aString){
  3104. var self=this;
  3105. return smalltalk.withContext(function($ctx1) {
  3106. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassTop(),"tests");
  3107. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  3108. args: ["aString"],
  3109. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop category: 'tests'",
  3110. messageSends: ["install:forClass:category:", "targetClassTop", "compiler"],
  3111. referencedClasses: []
  3112. }),
  3113. smalltalk.MethodInheritanceTest);
  3114. smalltalk.addMethod(
  3115. smalltalk.method({
  3116. selector: "setUp",
  3117. category: 'initialization',
  3118. fn: function (){
  3119. var self=this;
  3120. return smalltalk.withContext(function($ctx1) {
  3121. self["@receiverTop"]=_st(self._targetClassTop())._new();
  3122. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  3123. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  3124. self["@method"]=nil;
  3125. self["@performBlock"]=(function(){
  3126. return smalltalk.withContext(function($ctx2) {
  3127. return self._error_("performBlock not initialized");
  3128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  3129. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  3130. args: [],
  3131. source: "setUp\x0a\x09receiverTop := self targetClassTop new.\x0a\x09receiverMiddle := self targetClassMiddle new.\x0a\x09receiverBottom := self targetClassBottom new.\x0a\x09method := nil.\x0a\x09performBlock := [ self error: 'performBlock not initialized' ]",
  3132. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  3133. referencedClasses: []
  3134. }),
  3135. smalltalk.MethodInheritanceTest);
  3136. smalltalk.addMethod(
  3137. smalltalk.method({
  3138. selector: "shouldMNU",
  3139. category: 'testing',
  3140. fn: function (){
  3141. var self=this;
  3142. return smalltalk.withContext(function($ctx1) {
  3143. self._shouldMNUTop();
  3144. self._shouldMNUMiddle();
  3145. self._shouldMNUBottom();
  3146. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  3147. args: [],
  3148. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  3149. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  3150. referencedClasses: []
  3151. }),
  3152. smalltalk.MethodInheritanceTest);
  3153. smalltalk.addMethod(
  3154. smalltalk.method({
  3155. selector: "shouldMNUBottom",
  3156. category: 'testing',
  3157. fn: function (){
  3158. var self=this;
  3159. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3160. return smalltalk.withContext(function($ctx1) {
  3161. self._should_raise_((function(){
  3162. return smalltalk.withContext(function($ctx2) {
  3163. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  3164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3165. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  3166. args: [],
  3167. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  3168. messageSends: ["should:raise:", "value:"],
  3169. referencedClasses: ["MessageNotUnderstood"]
  3170. }),
  3171. smalltalk.MethodInheritanceTest);
  3172. smalltalk.addMethod(
  3173. smalltalk.method({
  3174. selector: "shouldMNUMiddle",
  3175. category: 'testing',
  3176. fn: function (){
  3177. var self=this;
  3178. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3179. return smalltalk.withContext(function($ctx1) {
  3180. self._should_raise_((function(){
  3181. return smalltalk.withContext(function($ctx2) {
  3182. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  3183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3184. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  3185. args: [],
  3186. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  3187. messageSends: ["should:raise:", "value:"],
  3188. referencedClasses: ["MessageNotUnderstood"]
  3189. }),
  3190. smalltalk.MethodInheritanceTest);
  3191. smalltalk.addMethod(
  3192. smalltalk.method({
  3193. selector: "shouldMNUTop",
  3194. category: 'testing',
  3195. fn: function (){
  3196. var self=this;
  3197. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3198. return smalltalk.withContext(function($ctx1) {
  3199. self._should_raise_((function(){
  3200. return smalltalk.withContext(function($ctx2) {
  3201. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  3202. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3203. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  3204. args: [],
  3205. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  3206. messageSends: ["should:raise:", "value:"],
  3207. referencedClasses: ["MessageNotUnderstood"]
  3208. }),
  3209. smalltalk.MethodInheritanceTest);
  3210. smalltalk.addMethod(
  3211. smalltalk.method({
  3212. selector: "shouldReturn:",
  3213. category: 'testing',
  3214. fn: function (anObject){
  3215. var self=this;
  3216. var result;
  3217. return smalltalk.withContext(function($ctx1) {
  3218. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  3219. self._assert_equals_(["top",anObject],["top",result]);
  3220. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  3221. self._assert_equals_(["middle",anObject],["middle",result]);
  3222. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  3223. self._assert_equals_(["bottom",anObject],["bottom",result]);
  3224. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  3225. args: ["anObject"],
  3226. source: "shouldReturn: anObject\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject } equals: { 'bottom'. result }",
  3227. messageSends: ["value:", "assert:equals:"],
  3228. referencedClasses: []
  3229. }),
  3230. smalltalk.MethodInheritanceTest);
  3231. smalltalk.addMethod(
  3232. smalltalk.method({
  3233. selector: "shouldReturn:and:and:",
  3234. category: 'testing',
  3235. fn: function (anObject,anObject2,anObject3){
  3236. var self=this;
  3237. var result;
  3238. return smalltalk.withContext(function($ctx1) {
  3239. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  3240. self._assert_equals_(["top",anObject],["top",result]);
  3241. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  3242. self._assert_equals_(["middle",anObject2],["middle",result]);
  3243. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  3244. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  3245. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  3246. args: ["anObject", "anObject2", "anObject3"],
  3247. source: "shouldReturn: anObject and: anObject2 and: anObject3\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject2 } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject3 } equals: { 'bottom'. result }",
  3248. messageSends: ["value:", "assert:equals:"],
  3249. referencedClasses: []
  3250. }),
  3251. smalltalk.MethodInheritanceTest);
  3252. smalltalk.addMethod(
  3253. smalltalk.method({
  3254. selector: "targetClassBottom",
  3255. category: 'accessing',
  3256. fn: function (){
  3257. var self=this;
  3258. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  3259. return smalltalk.withContext(function($ctx1) {
  3260. var $1;
  3261. $1=$JavaScriptException();
  3262. return $1;
  3263. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  3264. args: [],
  3265. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  3266. messageSends: [],
  3267. referencedClasses: ["JavaScriptException"]
  3268. }),
  3269. smalltalk.MethodInheritanceTest);
  3270. smalltalk.addMethod(
  3271. smalltalk.method({
  3272. selector: "targetClassMiddle",
  3273. category: 'accessing',
  3274. fn: function (){
  3275. var self=this;
  3276. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3277. return smalltalk.withContext(function($ctx1) {
  3278. var $1;
  3279. $1=$Error();
  3280. return $1;
  3281. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  3282. args: [],
  3283. source: "targetClassMiddle\x0a\x09^ Error",
  3284. messageSends: [],
  3285. referencedClasses: ["Error"]
  3286. }),
  3287. smalltalk.MethodInheritanceTest);
  3288. smalltalk.addMethod(
  3289. smalltalk.method({
  3290. selector: "targetClassTop",
  3291. category: 'accessing',
  3292. fn: function (){
  3293. var self=this;
  3294. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3295. return smalltalk.withContext(function($ctx1) {
  3296. var $1;
  3297. $1=$Object();
  3298. return $1;
  3299. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  3300. args: [],
  3301. source: "targetClassTop\x0a\x09^ Object",
  3302. messageSends: [],
  3303. referencedClasses: ["Object"]
  3304. }),
  3305. smalltalk.MethodInheritanceTest);
  3306. smalltalk.addMethod(
  3307. smalltalk.method({
  3308. selector: "tearDown",
  3309. category: 'initialization',
  3310. fn: function (){
  3311. var self=this;
  3312. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3313. return smalltalk.withContext(function($ctx1) {
  3314. _st((function(){
  3315. return smalltalk.withContext(function($ctx2) {
  3316. return self._deinstallTop();
  3317. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(){
  3318. return smalltalk.withContext(function($ctx2) {
  3319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3320. _st((function(){
  3321. return smalltalk.withContext(function($ctx2) {
  3322. return self._deinstallMiddle();
  3323. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(){
  3324. return smalltalk.withContext(function($ctx2) {
  3325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3326. _st((function(){
  3327. return smalltalk.withContext(function($ctx2) {
  3328. return self._deinstallBottom();
  3329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(){
  3330. return smalltalk.withContext(function($ctx2) {
  3331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3332. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  3333. args: [],
  3334. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [].\x0a\x09[ self deinstallMiddle ] on: Error do: [].\x0a\x09[ self deinstallBottom ] on: Error do: []",
  3335. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  3336. referencedClasses: ["Error"]
  3337. }),
  3338. smalltalk.MethodInheritanceTest);
  3339. smalltalk.addMethod(
  3340. smalltalk.method({
  3341. selector: "testMNU11",
  3342. category: 'tests',
  3343. fn: function (){
  3344. var self=this;
  3345. return smalltalk.withContext(function($ctx1) {
  3346. self["@performBlock"]=(function(x){
  3347. return smalltalk.withContext(function($ctx2) {
  3348. return _st(x)._foo();
  3349. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})});
  3350. self._shouldMNU();
  3351. self._installTop_("foo ^ false");
  3352. self._installTop_("foo ^ true");
  3353. self._deinstallTop();
  3354. self._shouldMNU();
  3355. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  3356. args: [],
  3357. source: "testMNU11\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self deinstallTop.\x0a\x09self shouldMNU",
  3358. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  3359. referencedClasses: []
  3360. }),
  3361. smalltalk.MethodInheritanceTest);
  3362. smalltalk.addMethod(
  3363. smalltalk.method({
  3364. selector: "testMNU22",
  3365. category: 'tests',
  3366. fn: function (){
  3367. var self=this;
  3368. return smalltalk.withContext(function($ctx1) {
  3369. self["@performBlock"]=(function(x){
  3370. return smalltalk.withContext(function($ctx2) {
  3371. return _st(x)._foo();
  3372. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})});
  3373. self._shouldMNU();
  3374. self._installMiddle_("foo ^ false");
  3375. self._installMiddle_("foo ^ true");
  3376. self._deinstallMiddle();
  3377. self._shouldMNU();
  3378. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  3379. args: [],
  3380. source: "testMNU22\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installMiddle: 'foo ^ false'.\x0a\x09self installMiddle: 'foo ^ true'.\x0a\x09self deinstallMiddle.\x0a\x09self shouldMNU",
  3381. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  3382. referencedClasses: []
  3383. }),
  3384. smalltalk.MethodInheritanceTest);
  3385. smalltalk.addMethod(
  3386. smalltalk.method({
  3387. selector: "testReturns1",
  3388. category: 'tests',
  3389. fn: function (){
  3390. var self=this;
  3391. return smalltalk.withContext(function($ctx1) {
  3392. self["@performBlock"]=(function(x){
  3393. return smalltalk.withContext(function($ctx2) {
  3394. return _st(x)._foo();
  3395. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})});
  3396. self._installTop_("foo ^ false");
  3397. self._shouldReturn_(false);
  3398. self._installTop_("foo ^ true");
  3399. self._shouldReturn_(true);
  3400. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  3401. args: [],
  3402. source: "testReturns1\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self shouldReturn: false.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self shouldReturn: true",
  3403. messageSends: ["foo", "installTop:", "shouldReturn:"],
  3404. referencedClasses: []
  3405. }),
  3406. smalltalk.MethodInheritanceTest);
  3407. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3408. smalltalk.addMethod(
  3409. smalltalk.method({
  3410. selector: "testAbs",
  3411. category: 'tests',
  3412. fn: function (){
  3413. var self=this;
  3414. return smalltalk.withContext(function($ctx1) {
  3415. self._assert_equals_((4)._abs(),(4));
  3416. self._assert_equals_((-4)._abs(),(4));
  3417. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  3418. args: [],
  3419. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  3420. messageSends: ["assert:equals:", "abs"],
  3421. referencedClasses: []
  3422. }),
  3423. smalltalk.NumberTest);
  3424. smalltalk.addMethod(
  3425. smalltalk.method({
  3426. selector: "testArithmetic",
  3427. category: 'tests',
  3428. fn: function (){
  3429. var self=this;
  3430. return smalltalk.withContext(function($ctx1) {
  3431. self._assert_equals_((1.5).__plus((1)),(2.5));
  3432. self._assert_equals_((2).__minus((1)),(1));
  3433. self._assert_equals_((-2).__minus((1)),(-3));
  3434. self._assert_equals_((12).__slash((2)),(6));
  3435. self._assert_equals_((3).__star((4)),(12));
  3436. self._assert_equals_(_st((1).__plus((2))).__star((3)),(9));
  3437. self._assert_equals_((1).__plus((2).__star((3))),(7));
  3438. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  3439. args: [],
  3440. 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 equals: 2.5.\x0a\x09self assert: 2 - 1 equals: 1.\x0a\x09self assert: -2 - 1 equals: -3.\x0a\x09self assert: 12 / 2 equals: 6.\x0a\x09self assert: 3 * 4 equals: 12.\x0a\x0a\x09\x22Simple parenthesis and execution order\x22\x0a\x09self assert: 1 + 2 * 3 equals: 9.\x0a\x09self assert: 1 + (2 * 3) equals: 7",
  3441. messageSends: ["assert:equals:", "+", "-", "/", "*"],
  3442. referencedClasses: []
  3443. }),
  3444. smalltalk.NumberTest);
  3445. smalltalk.addMethod(
  3446. smalltalk.method({
  3447. selector: "testAsNumber",
  3448. category: 'tests',
  3449. fn: function (){
  3450. var self=this;
  3451. return smalltalk.withContext(function($ctx1) {
  3452. self._assert_equals_((3)._asNumber(),(3));
  3453. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  3454. args: [],
  3455. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  3456. messageSends: ["assert:equals:", "asNumber"],
  3457. referencedClasses: []
  3458. }),
  3459. smalltalk.NumberTest);
  3460. smalltalk.addMethod(
  3461. smalltalk.method({
  3462. selector: "testCeiling",
  3463. category: 'tests',
  3464. fn: function (){
  3465. var self=this;
  3466. return smalltalk.withContext(function($ctx1) {
  3467. self._assert_equals_((1.2)._ceiling(),(2));
  3468. self._assert_equals_((-1.2)._ceiling(),(-1));
  3469. self._assert_equals_((1)._ceiling(),(1));
  3470. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  3471. args: [],
  3472. source: "testCeiling\x0a\x09self assert: 1.2 ceiling equals: 2.\x0a\x09self assert: -1.2 ceiling equals: -1.\x0a\x09self assert: 1.0 ceiling equals: 1.",
  3473. messageSends: ["assert:equals:", "ceiling"],
  3474. referencedClasses: []
  3475. }),
  3476. smalltalk.NumberTest);
  3477. smalltalk.addMethod(
  3478. smalltalk.method({
  3479. selector: "testComparison",
  3480. category: 'tests',
  3481. fn: function (){
  3482. var self=this;
  3483. return smalltalk.withContext(function($ctx1) {
  3484. self._assert_((3).__gt((2)));
  3485. self._assert_((2).__lt((3)));
  3486. self._deny_((3).__lt((2)));
  3487. self._deny_((2).__gt((3)));
  3488. self._assert_((3).__gt_eq((3)));
  3489. self._assert_((3.1).__gt_eq((3)));
  3490. self._assert_((3).__lt_eq((3)));
  3491. self._assert_((3).__lt_eq((3.1)));
  3492. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  3493. args: [],
  3494. 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",
  3495. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  3496. referencedClasses: []
  3497. }),
  3498. smalltalk.NumberTest);
  3499. smalltalk.addMethod(
  3500. smalltalk.method({
  3501. selector: "testCopying",
  3502. category: 'tests',
  3503. fn: function (){
  3504. var self=this;
  3505. return smalltalk.withContext(function($ctx1) {
  3506. self._assert_(_st((1)._copy()).__eq_eq((1)));
  3507. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  3508. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  3509. args: [],
  3510. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  3511. messageSends: ["assert:", "==", "copy", "deepCopy"],
  3512. referencedClasses: []
  3513. }),
  3514. smalltalk.NumberTest);
  3515. smalltalk.addMethod(
  3516. smalltalk.method({
  3517. selector: "testEquality",
  3518. category: 'tests',
  3519. fn: function (){
  3520. var self=this;
  3521. return smalltalk.withContext(function($ctx1) {
  3522. self._assert_((1).__eq((1)));
  3523. self._assert_((0).__eq((0)));
  3524. self._deny_((1).__eq((0)));
  3525. self._assert_(_st((1)._yourself()).__eq((1)));
  3526. self._assert_((1).__eq((1)._yourself()));
  3527. self._assert_(_st((1)._yourself()).__eq((1)._yourself()));
  3528. self._deny_((0).__eq(false));
  3529. self._deny_(false.__eq((0)));
  3530. self._deny_("".__eq((0)));
  3531. self._deny_((0).__eq(""));
  3532. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  3533. args: [],
  3534. 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 = ''",
  3535. messageSends: ["assert:", "=", "deny:", "yourself"],
  3536. referencedClasses: []
  3537. }),
  3538. smalltalk.NumberTest);
  3539. smalltalk.addMethod(
  3540. smalltalk.method({
  3541. selector: "testFloor",
  3542. category: 'tests',
  3543. fn: function (){
  3544. var self=this;
  3545. return smalltalk.withContext(function($ctx1) {
  3546. self._assert_equals_((1.2)._floor(),(1));
  3547. self._assert_equals_((-1.2)._floor(),(-2));
  3548. self._assert_equals_((1)._floor(),(1));
  3549. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  3550. args: [],
  3551. source: "testFloor\x0a\x09self assert: 1.2 floor equals: 1.\x0a\x09self assert: -1.2 floor equals: -2.\x0a\x09self assert: 1.0 floor equals: 1.",
  3552. messageSends: ["assert:equals:", "floor"],
  3553. referencedClasses: []
  3554. }),
  3555. smalltalk.NumberTest);
  3556. smalltalk.addMethod(
  3557. smalltalk.method({
  3558. selector: "testHexNumbers",
  3559. category: 'tests',
  3560. fn: function (){
  3561. var self=this;
  3562. return smalltalk.withContext(function($ctx1) {
  3563. self._assert_equals_((9),(9));
  3564. self._assert_equals_((10)._truncated(),(10));
  3565. self._assert_equals_((11)._truncated(),(11));
  3566. self._assert_equals_((12)._truncated(),(12));
  3567. self._assert_equals_((13)._truncated(),(13));
  3568. self._assert_equals_((14)._truncated(),(14));
  3569. self._assert_equals_((15)._truncated(),(15));
  3570. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  3571. args: [],
  3572. source: "testHexNumbers\x0a\x0a\x09self assert: 16r9 equals: 9.\x0a\x09self assert: 16rA truncated equals: 10.\x0a\x09self assert: 16rB truncated equals: 11.\x0a\x09self assert: 16rC truncated equals: 12.\x0a\x09self assert: 16rD truncated equals: 13.\x0a\x09self assert: 16rE truncated equals: 14.\x0a\x09self assert: 16rF truncated equals: 15",
  3573. messageSends: ["assert:equals:", "truncated"],
  3574. referencedClasses: []
  3575. }),
  3576. smalltalk.NumberTest);
  3577. smalltalk.addMethod(
  3578. smalltalk.method({
  3579. selector: "testIdentity",
  3580. category: 'tests',
  3581. fn: function (){
  3582. var self=this;
  3583. return smalltalk.withContext(function($ctx1) {
  3584. self._assert_((1).__eq_eq((1)));
  3585. self._assert_((0).__eq_eq((0)));
  3586. self._deny_((1).__eq_eq((0)));
  3587. self._assert_(_st((1)._yourself()).__eq_eq((1)));
  3588. self._assert_((1).__eq_eq((1)._yourself()));
  3589. self._assert_(_st((1)._yourself()).__eq_eq((1)._yourself()));
  3590. self._deny_((1).__eq_eq((2)));
  3591. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  3592. args: [],
  3593. 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",
  3594. messageSends: ["assert:", "==", "deny:", "yourself"],
  3595. referencedClasses: []
  3596. }),
  3597. smalltalk.NumberTest);
  3598. smalltalk.addMethod(
  3599. smalltalk.method({
  3600. selector: "testInvalidHexNumbers",
  3601. category: 'tests',
  3602. fn: function (){
  3603. var self=this;
  3604. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3605. return smalltalk.withContext(function($ctx1) {
  3606. self._should_raise_((function(){
  3607. return smalltalk.withContext(function($ctx2) {
  3608. return (16)._rG();
  3609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3610. self._should_raise_((function(){
  3611. return smalltalk.withContext(function($ctx2) {
  3612. return (16)._rg();
  3613. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3614. self._should_raise_((function(){
  3615. return smalltalk.withContext(function($ctx2) {
  3616. return (16)._rH();
  3617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3618. self._should_raise_((function(){
  3619. return smalltalk.withContext(function($ctx2) {
  3620. return (16)._rh();
  3621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3622. self._should_raise_((function(){
  3623. return smalltalk.withContext(function($ctx2) {
  3624. return (16)._rI();
  3625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3626. self._should_raise_((function(){
  3627. return smalltalk.withContext(function($ctx2) {
  3628. return (16)._ri();
  3629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3630. self._should_raise_((function(){
  3631. return smalltalk.withContext(function($ctx2) {
  3632. return (16)._rJ();
  3633. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3634. self._should_raise_((function(){
  3635. return smalltalk.withContext(function($ctx2) {
  3636. return (16)._rj();
  3637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3638. self._should_raise_((function(){
  3639. return smalltalk.withContext(function($ctx2) {
  3640. return (16)._rK();
  3641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3642. self._should_raise_((function(){
  3643. return smalltalk.withContext(function($ctx2) {
  3644. return (16)._rk();
  3645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3646. self._should_raise_((function(){
  3647. return smalltalk.withContext(function($ctx2) {
  3648. return (16)._rL();
  3649. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3650. self._should_raise_((function(){
  3651. return smalltalk.withContext(function($ctx2) {
  3652. return (16)._rl();
  3653. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3654. self._should_raise_((function(){
  3655. return smalltalk.withContext(function($ctx2) {
  3656. return (16)._rM();
  3657. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3658. self._should_raise_((function(){
  3659. return smalltalk.withContext(function($ctx2) {
  3660. return (16)._rm();
  3661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3662. self._should_raise_((function(){
  3663. return smalltalk.withContext(function($ctx2) {
  3664. return (16)._rN();
  3665. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3666. self._should_raise_((function(){
  3667. return smalltalk.withContext(function($ctx2) {
  3668. return (16)._rn();
  3669. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3670. self._should_raise_((function(){
  3671. return smalltalk.withContext(function($ctx2) {
  3672. return (16)._rO();
  3673. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3674. self._should_raise_((function(){
  3675. return smalltalk.withContext(function($ctx2) {
  3676. return (16)._ro();
  3677. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3678. self._should_raise_((function(){
  3679. return smalltalk.withContext(function($ctx2) {
  3680. return (16)._rP();
  3681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3682. self._should_raise_((function(){
  3683. return smalltalk.withContext(function($ctx2) {
  3684. return (16)._rp();
  3685. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3686. self._should_raise_((function(){
  3687. return smalltalk.withContext(function($ctx2) {
  3688. return (16)._rQ();
  3689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3690. self._should_raise_((function(){
  3691. return smalltalk.withContext(function($ctx2) {
  3692. return (16)._rq();
  3693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3694. self._should_raise_((function(){
  3695. return smalltalk.withContext(function($ctx2) {
  3696. return (16)._rR();
  3697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3698. self._should_raise_((function(){
  3699. return smalltalk.withContext(function($ctx2) {
  3700. return (16)._rr();
  3701. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3702. self._should_raise_((function(){
  3703. return smalltalk.withContext(function($ctx2) {
  3704. return (16)._rS();
  3705. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3706. self._should_raise_((function(){
  3707. return smalltalk.withContext(function($ctx2) {
  3708. return (16)._rs();
  3709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3710. self._should_raise_((function(){
  3711. return smalltalk.withContext(function($ctx2) {
  3712. return (16)._rT();
  3713. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3714. self._should_raise_((function(){
  3715. return smalltalk.withContext(function($ctx2) {
  3716. return (16)._rt();
  3717. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3718. self._should_raise_((function(){
  3719. return smalltalk.withContext(function($ctx2) {
  3720. return (16)._rU();
  3721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3722. self._should_raise_((function(){
  3723. return smalltalk.withContext(function($ctx2) {
  3724. return (16)._ru();
  3725. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3726. self._should_raise_((function(){
  3727. return smalltalk.withContext(function($ctx2) {
  3728. return (16)._rV();
  3729. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3730. self._should_raise_((function(){
  3731. return smalltalk.withContext(function($ctx2) {
  3732. return (16)._rv();
  3733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3734. self._should_raise_((function(){
  3735. return smalltalk.withContext(function($ctx2) {
  3736. return (16)._rW();
  3737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3738. self._should_raise_((function(){
  3739. return smalltalk.withContext(function($ctx2) {
  3740. return (16)._rw();
  3741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3742. self._should_raise_((function(){
  3743. return smalltalk.withContext(function($ctx2) {
  3744. return (16)._rX();
  3745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3746. self._should_raise_((function(){
  3747. return smalltalk.withContext(function($ctx2) {
  3748. return (16)._rx();
  3749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3750. self._should_raise_((function(){
  3751. return smalltalk.withContext(function($ctx2) {
  3752. return (16)._rY();
  3753. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3754. self._should_raise_((function(){
  3755. return smalltalk.withContext(function($ctx2) {
  3756. return (16)._ry();
  3757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3758. self._should_raise_((function(){
  3759. return smalltalk.withContext(function($ctx2) {
  3760. return (16)._rZ();
  3761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3762. self._should_raise_((function(){
  3763. return smalltalk.withContext(function($ctx2) {
  3764. return (16)._rz();
  3765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3766. self._should_raise_((function(){
  3767. return smalltalk.withContext(function($ctx2) {
  3768. return (11259375)._Z();
  3769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  3770. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  3771. args: [],
  3772. 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\x09self should: [16rABcdEfZ] raise: MessageNotUnderstood.",
  3773. 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"],
  3774. referencedClasses: ["MessageNotUnderstood"]
  3775. }),
  3776. smalltalk.NumberTest);
  3777. smalltalk.addMethod(
  3778. smalltalk.method({
  3779. selector: "testMinMax",
  3780. category: 'tests',
  3781. fn: function (){
  3782. var self=this;
  3783. return smalltalk.withContext(function($ctx1) {
  3784. self._assert_equals_((2)._max_((5)),(5));
  3785. self._assert_equals_((2)._min_((5)),(2));
  3786. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  3787. args: [],
  3788. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  3789. messageSends: ["assert:equals:", "max:", "min:"],
  3790. referencedClasses: []
  3791. }),
  3792. smalltalk.NumberTest);
  3793. smalltalk.addMethod(
  3794. smalltalk.method({
  3795. selector: "testNegated",
  3796. category: 'tests',
  3797. fn: function (){
  3798. var self=this;
  3799. return smalltalk.withContext(function($ctx1) {
  3800. self._assert_equals_((3)._negated(),(-3));
  3801. self._assert_equals_((-3)._negated(),(3));
  3802. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  3803. args: [],
  3804. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  3805. messageSends: ["assert:equals:", "negated"],
  3806. referencedClasses: []
  3807. }),
  3808. smalltalk.NumberTest);
  3809. smalltalk.addMethod(
  3810. smalltalk.method({
  3811. selector: "testPrintShowingDecimalPlaces",
  3812. category: 'tests',
  3813. fn: function (){
  3814. var self=this;
  3815. return smalltalk.withContext(function($ctx1) {
  3816. self._assert_equals_((23)._printShowingDecimalPlaces_((2)),"23.00");
  3817. self._assert_equals_((23.5698)._printShowingDecimalPlaces_((2)),"23.57");
  3818. self._assert_equals_(_st((234.567)._negated())._printShowingDecimalPlaces_((5)),"-234.56700");
  3819. self._assert_equals_((23.4567)._printShowingDecimalPlaces_((0)),"23");
  3820. self._assert_equals_((23.5567)._printShowingDecimalPlaces_((0)),"24");
  3821. self._assert_equals_(_st((23.4567)._negated())._printShowingDecimalPlaces_((0)),"-23");
  3822. self._assert_equals_(_st((23.5567)._negated())._printShowingDecimalPlaces_((0)),"-24");
  3823. self._assert_equals_((100000000)._printShowingDecimalPlaces_((1)),"100000000.0");
  3824. self._assert_equals_((0.98)._printShowingDecimalPlaces_((5)),"0.98000");
  3825. self._assert_equals_(_st((0.98)._negated())._printShowingDecimalPlaces_((2)),"-0.98");
  3826. self._assert_equals_((2.567)._printShowingDecimalPlaces_((2)),"2.57");
  3827. self._assert_equals_((-2.567)._printShowingDecimalPlaces_((2)),"-2.57");
  3828. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  3829. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  3830. args: [],
  3831. source: "testPrintShowingDecimalPlaces\x0a\x09self assert: (23 printShowingDecimalPlaces: 2) equals: '23.00'.\x0a\x09self assert: (23.5698 printShowingDecimalPlaces: 2) equals: '23.57'.\x0a\x09self assert: (234.567 negated printShowingDecimalPlaces: 5) equals: '-234.56700'.\x0a\x09self assert: (23.4567 printShowingDecimalPlaces: 0) equals: '23'.\x0a\x09self assert: (23.5567 printShowingDecimalPlaces: 0) equals: '24'.\x0a\x09self assert: (23.4567 negated printShowingDecimalPlaces: 0) equals: '-23'.\x0a\x09self assert: (23.5567 negated printShowingDecimalPlaces: 0) equals: '-24'.\x0a\x09self assert: (100000000 printShowingDecimalPlaces: 1) equals: '100000000.0'.\x0a\x09self assert: (0.98 printShowingDecimalPlaces: 5) equals: '0.98000'.\x0a\x09self assert: (0.98 negated printShowingDecimalPlaces: 2) equals: '-0.98'.\x0a\x09self assert: (2.567 printShowingDecimalPlaces: 2) equals: '2.57'.\x0a\x09self assert: (-2.567 printShowingDecimalPlaces: 2) equals: '-2.57'.\x0a\x09self assert: (0 printShowingDecimalPlaces: 2) equals: '0.00'.",
  3832. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  3833. referencedClasses: []
  3834. }),
  3835. smalltalk.NumberTest);
  3836. smalltalk.addMethod(
  3837. smalltalk.method({
  3838. selector: "testRounded",
  3839. category: 'tests',
  3840. fn: function (){
  3841. var self=this;
  3842. return smalltalk.withContext(function($ctx1) {
  3843. self._assert_equals_((3)._rounded(),(3));
  3844. self._assert_equals_((3.212)._rounded(),(3));
  3845. self._assert_equals_((3.51)._rounded(),(4));
  3846. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  3847. args: [],
  3848. source: "testRounded\x0a\x09\x0a\x09self assert: 3 rounded equals: 3.\x0a\x09self assert: 3.212 rounded equals: 3.\x0a\x09self assert: 3.51 rounded equals: 4",
  3849. messageSends: ["assert:equals:", "rounded"],
  3850. referencedClasses: []
  3851. }),
  3852. smalltalk.NumberTest);
  3853. smalltalk.addMethod(
  3854. smalltalk.method({
  3855. selector: "testSqrt",
  3856. category: 'tests',
  3857. fn: function (){
  3858. var self=this;
  3859. return smalltalk.withContext(function($ctx1) {
  3860. self._assert_equals_((4)._sqrt(),(2));
  3861. self._assert_equals_((16)._sqrt(),(4));
  3862. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  3863. args: [],
  3864. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  3865. messageSends: ["assert:equals:", "sqrt"],
  3866. referencedClasses: []
  3867. }),
  3868. smalltalk.NumberTest);
  3869. smalltalk.addMethod(
  3870. smalltalk.method({
  3871. selector: "testSquared",
  3872. category: 'tests',
  3873. fn: function (){
  3874. var self=this;
  3875. return smalltalk.withContext(function($ctx1) {
  3876. self._assert_equals_((4)._squared(),(16));
  3877. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  3878. args: [],
  3879. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  3880. messageSends: ["assert:equals:", "squared"],
  3881. referencedClasses: []
  3882. }),
  3883. smalltalk.NumberTest);
  3884. smalltalk.addMethod(
  3885. smalltalk.method({
  3886. selector: "testTimesRepeat",
  3887. category: 'tests',
  3888. fn: function (){
  3889. var self=this;
  3890. var i;
  3891. return smalltalk.withContext(function($ctx1) {
  3892. i=(0);
  3893. (0)._timesRepeat_((function(){
  3894. return smalltalk.withContext(function($ctx2) {
  3895. i=_st(i).__plus((1));
  3896. return i;
  3897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3898. self._assert_equals_(i,(0));
  3899. (5)._timesRepeat_((function(){
  3900. return smalltalk.withContext(function($ctx2) {
  3901. i=_st(i).__plus((1));
  3902. return i;
  3903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3904. self._assert_equals_(i,(5));
  3905. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  3906. args: [],
  3907. 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",
  3908. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  3909. referencedClasses: []
  3910. }),
  3911. smalltalk.NumberTest);
  3912. smalltalk.addMethod(
  3913. smalltalk.method({
  3914. selector: "testTo",
  3915. category: 'tests',
  3916. fn: function (){
  3917. var self=this;
  3918. return smalltalk.withContext(function($ctx1) {
  3919. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  3920. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  3921. args: [],
  3922. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  3923. messageSends: ["assert:equals:", "to:"],
  3924. referencedClasses: []
  3925. }),
  3926. smalltalk.NumberTest);
  3927. smalltalk.addMethod(
  3928. smalltalk.method({
  3929. selector: "testToBy",
  3930. category: 'tests',
  3931. fn: function (){
  3932. var self=this;
  3933. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3934. return smalltalk.withContext(function($ctx1) {
  3935. self._assert_equals_((0)._to_by_((6),(2)),[(0), (2), (4), (6)]);
  3936. self._should_raise_((function(){
  3937. return smalltalk.withContext(function($ctx2) {
  3938. return (1)._to_by_((4),(0));
  3939. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  3940. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  3941. args: [],
  3942. 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",
  3943. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  3944. referencedClasses: ["Error"]
  3945. }),
  3946. smalltalk.NumberTest);
  3947. smalltalk.addMethod(
  3948. smalltalk.method({
  3949. selector: "testTruncated",
  3950. category: 'tests',
  3951. fn: function (){
  3952. var self=this;
  3953. return smalltalk.withContext(function($ctx1) {
  3954. self._assert_equals_((3)._truncated(),(3));
  3955. self._assert_equals_((3.212)._truncated(),(3));
  3956. self._assert_equals_((3.51)._truncated(),(3));
  3957. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  3958. args: [],
  3959. source: "testTruncated\x0a\x09\x0a\x09self assert: 3 truncated equals: 3.\x0a\x09self assert: 3.212 truncated equals: 3.\x0a\x09self assert: 3.51 truncated equals: 3",
  3960. messageSends: ["assert:equals:", "truncated"],
  3961. referencedClasses: []
  3962. }),
  3963. smalltalk.NumberTest);
  3964. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  3965. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  3966. smalltalk.addMethod(
  3967. smalltalk.method({
  3968. selector: "foo",
  3969. category: 'not yet classified',
  3970. fn: function (){
  3971. var self=this;
  3972. return smalltalk.withContext(function($ctx1) {
  3973. var $1;
  3974. $1=self["@foo"];
  3975. return $1;
  3976. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  3977. args: [],
  3978. source: "foo\x0a\x09^foo",
  3979. messageSends: [],
  3980. referencedClasses: []
  3981. }),
  3982. smalltalk.ObjectMock);
  3983. smalltalk.addMethod(
  3984. smalltalk.method({
  3985. selector: "foo:",
  3986. category: 'not yet classified',
  3987. fn: function (anObject){
  3988. var self=this;
  3989. return smalltalk.withContext(function($ctx1) {
  3990. self["@foo"]=anObject;
  3991. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  3992. args: ["anObject"],
  3993. source: "foo: anObject\x0a\x09foo := anObject",
  3994. messageSends: [],
  3995. referencedClasses: []
  3996. }),
  3997. smalltalk.ObjectMock);
  3998. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3999. smalltalk.addMethod(
  4000. smalltalk.method({
  4001. selector: "notDefined",
  4002. category: 'tests',
  4003. fn: function (){
  4004. var self=this;
  4005. return smalltalk.withContext(function($ctx1) {
  4006. return undefined;;
  4007. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  4008. args: [],
  4009. source: "notDefined\x0a\x09<return undefined;>",
  4010. messageSends: [],
  4011. referencedClasses: []
  4012. }),
  4013. smalltalk.ObjectTest);
  4014. smalltalk.addMethod(
  4015. smalltalk.method({
  4016. selector: "testBasicAccess",
  4017. category: 'tests',
  4018. fn: function (){
  4019. var self=this;
  4020. var o;
  4021. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4022. return smalltalk.withContext(function($ctx1) {
  4023. o=_st($Object())._new();
  4024. _st(o)._basicAt_put_("a",(1));
  4025. self._assert_equals_(_st(o)._basicAt_("a"),(1));
  4026. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  4027. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  4028. args: [],
  4029. 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",
  4030. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  4031. referencedClasses: ["Object"]
  4032. }),
  4033. smalltalk.ObjectTest);
  4034. smalltalk.addMethod(
  4035. smalltalk.method({
  4036. selector: "testBasicPerform",
  4037. category: 'tests',
  4038. fn: function (){
  4039. var self=this;
  4040. var o;
  4041. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4042. return smalltalk.withContext(function($ctx1) {
  4043. o=_st($Object())._new();
  4044. _st(o)._basicAt_put_("func",(function(){
  4045. return smalltalk.withContext(function($ctx2) {
  4046. return "hello";
  4047. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4048. _st(o)._basicAt_put_("func2",(function(a){
  4049. return smalltalk.withContext(function($ctx2) {
  4050. return _st(a).__plus((1));
  4051. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1)})}));
  4052. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  4053. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  4054. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  4055. args: [],
  4056. source: "testBasicPerform\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'func' put: ['hello'].\x0a\x09o basicAt: 'func2' put: [:a | a + 1].\x0a\x0a\x09self assert: (o basicPerform: 'func') equals: 'hello'.\x0a\x09self assert: (o basicPerform: 'func2' withArguments: #(3)) equals: 4",
  4057. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  4058. referencedClasses: ["Object"]
  4059. }),
  4060. smalltalk.ObjectTest);
  4061. smalltalk.addMethod(
  4062. smalltalk.method({
  4063. selector: "testDNU",
  4064. category: 'tests',
  4065. fn: function (){
  4066. var self=this;
  4067. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4068. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4069. return smalltalk.withContext(function($ctx1) {
  4070. self._should_raise_((function(){
  4071. return smalltalk.withContext(function($ctx2) {
  4072. return _st(_st($Object())._new())._foo();
  4073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$MessageNotUnderstood());
  4074. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  4075. args: [],
  4076. source: "testDNU\x0a\x09self should: [Object new foo] raise: MessageNotUnderstood",
  4077. messageSends: ["should:raise:", "foo", "new"],
  4078. referencedClasses: ["Object", "MessageNotUnderstood"]
  4079. }),
  4080. smalltalk.ObjectTest);
  4081. smalltalk.addMethod(
  4082. smalltalk.method({
  4083. selector: "testEquality",
  4084. category: 'tests',
  4085. fn: function (){
  4086. var self=this;
  4087. var o;
  4088. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4089. return smalltalk.withContext(function($ctx1) {
  4090. o=_st($Object())._new();
  4091. self._deny_(_st(o).__eq(_st($Object())._new()));
  4092. self._assert_(_st(o).__eq(o));
  4093. self._assert_(_st(_st(o)._yourself()).__eq(o));
  4094. self._assert_(_st(o).__eq(_st(o)._yourself()));
  4095. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  4096. args: [],
  4097. 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)",
  4098. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  4099. referencedClasses: ["Object"]
  4100. }),
  4101. smalltalk.ObjectTest);
  4102. smalltalk.addMethod(
  4103. smalltalk.method({
  4104. selector: "testHalt",
  4105. category: 'tests',
  4106. fn: function (){
  4107. var self=this;
  4108. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4109. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4110. return smalltalk.withContext(function($ctx1) {
  4111. self._should_raise_((function(){
  4112. return smalltalk.withContext(function($ctx2) {
  4113. return _st(_st($Object())._new())._halt();
  4114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  4115. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  4116. args: [],
  4117. source: "testHalt\x0a\x09self should: [Object new halt] raise: Error",
  4118. messageSends: ["should:raise:", "halt", "new"],
  4119. referencedClasses: ["Object", "Error"]
  4120. }),
  4121. smalltalk.ObjectTest);
  4122. smalltalk.addMethod(
  4123. smalltalk.method({
  4124. selector: "testIdentity",
  4125. category: 'tests',
  4126. fn: function (){
  4127. var self=this;
  4128. var o;
  4129. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4130. return smalltalk.withContext(function($ctx1) {
  4131. o=_st($Object())._new();
  4132. self._deny_(_st(o).__eq_eq(_st($Object())._new()));
  4133. self._assert_(_st(o).__eq_eq(o));
  4134. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  4135. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  4136. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  4137. args: [],
  4138. 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",
  4139. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  4140. referencedClasses: ["Object"]
  4141. }),
  4142. smalltalk.ObjectTest);
  4143. smalltalk.addMethod(
  4144. smalltalk.method({
  4145. selector: "testIfNil",
  4146. category: 'tests',
  4147. fn: function (){
  4148. var self=this;
  4149. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4150. return smalltalk.withContext(function($ctx1) {
  4151. var $1,$4,$3,$2,$5,$7,$6,$8,$10,$9,$11,$13,$12;
  4152. self._deny_(_st(_st($Object())._new())._isNil());
  4153. $1=self;
  4154. $4=_st($Object())._new();
  4155. if(($receiver = $4) == nil || $receiver == undefined){
  4156. $3=true;
  4157. } else {
  4158. $3=$4;
  4159. };
  4160. $2=_st($3).__eq(true);
  4161. _st($1)._deny_($2);
  4162. $5=self;
  4163. $7=_st($Object())._new();
  4164. if(($receiver = $7) == nil || $receiver == undefined){
  4165. $6=$7;
  4166. } else {
  4167. $6=true;
  4168. };
  4169. _st($5)._assert_equals_($6,true);
  4170. $8=self;
  4171. $10=_st($Object())._new();
  4172. if(($receiver = $10) == nil || $receiver == undefined){
  4173. $9=false;
  4174. } else {
  4175. $9=true;
  4176. };
  4177. _st($8)._assert_equals_($9,true);
  4178. $11=self;
  4179. $13=_st($Object())._new();
  4180. if(($receiver = $13) == nil || $receiver == undefined){
  4181. $12=false;
  4182. } else {
  4183. $12=true;
  4184. };
  4185. _st($11)._assert_equals_($12,true);
  4186. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  4187. args: [],
  4188. source: "testIfNil\x0a\x09self deny: Object new isNil.\x0a\x09self deny: (Object new ifNil: [true]) = true.\x0a\x09self assert: (Object new ifNotNil: [true]) equals: true.\x0a\x0a\x09self assert: (Object new ifNil: [false] ifNotNil: [true]) equals: true.\x0a\x09self assert: (Object new ifNotNil: [true] ifNil: [false]) equals: true",
  4189. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  4190. referencedClasses: ["Object"]
  4191. }),
  4192. smalltalk.ObjectTest);
  4193. smalltalk.addMethod(
  4194. smalltalk.method({
  4195. selector: "testInstVars",
  4196. category: 'tests',
  4197. fn: function (){
  4198. var self=this;
  4199. var o;
  4200. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  4201. return smalltalk.withContext(function($ctx1) {
  4202. o=_st($ObjectMock())._new();
  4203. self._assert_equals_(_st(o)._instVarAt_("foo"),nil);
  4204. _st(o)._instVarAt_put_("foo",(1));
  4205. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  4206. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  4207. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  4208. args: [],
  4209. 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",
  4210. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  4211. referencedClasses: ["ObjectMock"]
  4212. }),
  4213. smalltalk.ObjectTest);
  4214. smalltalk.addMethod(
  4215. smalltalk.method({
  4216. selector: "testNilUndefined",
  4217. category: 'tests',
  4218. fn: function (){
  4219. var self=this;
  4220. return smalltalk.withContext(function($ctx1) {
  4221. self._assert_equals_(self._notDefined(),nil);
  4222. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  4223. args: [],
  4224. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  4225. messageSends: ["assert:equals:", "notDefined"],
  4226. referencedClasses: []
  4227. }),
  4228. smalltalk.ObjectTest);
  4229. smalltalk.addMethod(
  4230. smalltalk.method({
  4231. selector: "testYourself",
  4232. category: 'tests',
  4233. fn: function (){
  4234. var self=this;
  4235. var o;
  4236. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  4237. return smalltalk.withContext(function($ctx1) {
  4238. o=_st($ObjectMock())._new();
  4239. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  4240. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  4241. args: [],
  4242. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  4243. messageSends: ["new", "assert:", "==", "yourself"],
  4244. referencedClasses: ["ObjectMock"]
  4245. }),
  4246. smalltalk.ObjectTest);
  4247. smalltalk.addMethod(
  4248. smalltalk.method({
  4249. selector: "testidentityHash",
  4250. category: 'tests',
  4251. fn: function (){
  4252. var self=this;
  4253. var o1,o2;
  4254. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4255. return smalltalk.withContext(function($ctx1) {
  4256. o1=_st($Object())._new();
  4257. o2=_st($Object())._new();
  4258. self._assert_(_st(_st(o1)._identityHash()).__eq_eq(_st(o1)._identityHash()));
  4259. self._deny_(_st(_st(o1)._identityHash()).__eq_eq(_st(o2)._identityHash()));
  4260. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  4261. args: [],
  4262. 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",
  4263. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  4264. referencedClasses: ["Object"]
  4265. }),
  4266. smalltalk.ObjectTest);
  4267. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4268. smalltalk.addMethod(
  4269. smalltalk.method({
  4270. selector: "testAccessing",
  4271. category: 'tests',
  4272. fn: function (){
  4273. var self=this;
  4274. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4275. return smalltalk.withContext(function($ctx1) {
  4276. self._assert_equals_(_st(_st($Point())._x_y_((3),(4)))._x(),(3));
  4277. self._assert_equals_(_st(_st($Point())._x_y_((3),(4)))._y(),(4));
  4278. self._assert_equals_(_st(_st(_st($Point())._new())._x_((3)))._x(),(3));
  4279. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  4280. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  4281. args: [],
  4282. 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",
  4283. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  4284. referencedClasses: ["Point"]
  4285. }),
  4286. smalltalk.PointTest);
  4287. smalltalk.addMethod(
  4288. smalltalk.method({
  4289. selector: "testArithmetic",
  4290. category: 'tests',
  4291. fn: function (){
  4292. var self=this;
  4293. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4294. return smalltalk.withContext(function($ctx1) {
  4295. self._assert_equals_(_st((3).__at((4))).__star((3).__at((4))),_st($Point())._x_y_((9),(16)));
  4296. self._assert_equals_(_st((3).__at((4))).__plus((3).__at((4))),_st($Point())._x_y_((6),(8)));
  4297. self._assert_equals_(_st((3).__at((4))).__minus((3).__at((4))),_st($Point())._x_y_((0),(0)));
  4298. self._assert_equals_(_st((6).__at((8))).__slash((3).__at((4))),_st($Point())._x_y_((2),(2)));
  4299. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  4300. args: [],
  4301. 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)",
  4302. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  4303. referencedClasses: ["Point"]
  4304. }),
  4305. smalltalk.PointTest);
  4306. smalltalk.addMethod(
  4307. smalltalk.method({
  4308. selector: "testAt",
  4309. category: 'tests',
  4310. fn: function (){
  4311. var self=this;
  4312. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4313. return smalltalk.withContext(function($ctx1) {
  4314. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  4315. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  4316. args: [],
  4317. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  4318. messageSends: ["assert:equals:", "@", "x:y:"],
  4319. referencedClasses: ["Point"]
  4320. }),
  4321. smalltalk.PointTest);
  4322. smalltalk.addMethod(
  4323. smalltalk.method({
  4324. selector: "testEgality",
  4325. category: 'tests',
  4326. fn: function (){
  4327. var self=this;
  4328. return smalltalk.withContext(function($ctx1) {
  4329. self._assert_(_st((3).__at((4))).__eq((3).__at((4))));
  4330. self._deny_(_st((3).__at((5))).__eq((3).__at((6))));
  4331. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  4332. args: [],
  4333. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  4334. messageSends: ["assert:", "=", "@", "deny:"],
  4335. referencedClasses: []
  4336. }),
  4337. smalltalk.PointTest);
  4338. smalltalk.addMethod(
  4339. smalltalk.method({
  4340. selector: "testTranslateBy",
  4341. category: 'tests',
  4342. fn: function (){
  4343. var self=this;
  4344. return smalltalk.withContext(function($ctx1) {
  4345. self._assert_equals_(_st((3).__at((3)))._translateBy_((0).__at((1))),(3).__at((4)));
  4346. self._assert_equals_(_st((3).__at((3)))._translateBy_((0).__at((1)._negated())),(3).__at((2)));
  4347. self._assert_equals_(_st((3).__at((3)))._translateBy_((2).__at((3))),(5).__at((6)));
  4348. self._assert_equals_(_st((3).__at((3)))._translateBy_(_st((3)._negated()).__at((0))),(0).__at((3)));
  4349. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  4350. args: [],
  4351. source: "testTranslateBy\x0a\x09self assert: (3@3 translateBy: 0@1) equals: 3@4.\x0a\x09self assert: (3@3 translateBy: 0@1 negated) equals: 3@2.\x0a\x09self assert: (3@3 translateBy: 2@3) equals: 5@6.\x0a\x09self assert: (3@3 translateBy: 3 negated @0) equals: 0@3.",
  4352. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  4353. referencedClasses: []
  4354. }),
  4355. smalltalk.PointTest);
  4356. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4357. smalltalk.addMethod(
  4358. smalltalk.method({
  4359. selector: "textNext",
  4360. category: 'tests',
  4361. fn: function (){
  4362. var self=this;
  4363. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  4364. return smalltalk.withContext(function($ctx1) {
  4365. (10000)._timesRepeat_((function(){
  4366. var current,next;
  4367. return smalltalk.withContext(function($ctx2) {
  4368. next=_st(_st($Random())._new())._next();
  4369. next;
  4370. self._assert_(_st(next).__gt_eq((0)));
  4371. self._assert_(_st(next).__lt((1)));
  4372. self._deny_(_st(current).__eq(next));
  4373. return _st(next).__eq(current);
  4374. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1)})}));
  4375. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  4376. args: [],
  4377. 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]",
  4378. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  4379. referencedClasses: ["Random"]
  4380. }),
  4381. smalltalk.RandomTest);
  4382. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4383. smalltalk.addMethod(
  4384. smalltalk.method({
  4385. selector: "testAddRemove",
  4386. category: 'tests',
  4387. fn: function (){
  4388. var self=this;
  4389. var set;
  4390. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4391. return smalltalk.withContext(function($ctx1) {
  4392. set=_st($Set())._new();
  4393. self._assert_(_st(set)._isEmpty());
  4394. _st(set)._add_((3));
  4395. self._assert_(_st(set)._includes_((3)));
  4396. _st(set)._add_((5));
  4397. self._assert_(_st(set)._includes_((5)));
  4398. _st(set)._remove_((3));
  4399. self._deny_(_st(set)._includes_((3)));
  4400. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  4401. args: [],
  4402. 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)",
  4403. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  4404. referencedClasses: ["Set"]
  4405. }),
  4406. smalltalk.SetTest);
  4407. smalltalk.addMethod(
  4408. smalltalk.method({
  4409. selector: "testAt",
  4410. category: 'tests',
  4411. fn: function (){
  4412. var self=this;
  4413. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4414. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4415. return smalltalk.withContext(function($ctx1) {
  4416. self._should_raise_((function(){
  4417. return smalltalk.withContext(function($ctx2) {
  4418. return _st(_st($Set())._new())._at_put_((1),(2));
  4419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
  4420. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  4421. args: [],
  4422. source: "testAt\x0a\x09self should: [Set new at: 1 put: 2] raise: Error",
  4423. messageSends: ["should:raise:", "at:put:", "new"],
  4424. referencedClasses: ["Set", "Error"]
  4425. }),
  4426. smalltalk.SetTest);
  4427. smalltalk.addMethod(
  4428. smalltalk.method({
  4429. selector: "testCollect",
  4430. category: 'tests',
  4431. fn: function (){
  4432. var self=this;
  4433. return smalltalk.withContext(function($ctx1) {
  4434. self._assert_equals_(_st([(5), (6), (8)]._asSet())._collect_((function(x){
  4435. return smalltalk.withContext(function($ctx2) {
  4436. return _st(x).__backslash_backslash((3));
  4437. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})})),[(0), (2)]._asSet());
  4438. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  4439. args: [],
  4440. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  4441. messageSends: ["assert:equals:", "collect:", "\x5c\x5c", "asSet"],
  4442. referencedClasses: []
  4443. }),
  4444. smalltalk.SetTest);
  4445. smalltalk.addMethod(
  4446. smalltalk.method({
  4447. selector: "testComparing",
  4448. category: 'tests',
  4449. fn: function (){
  4450. var self=this;
  4451. return smalltalk.withContext(function($ctx1) {
  4452. self._assert_equals_([(0), (2)]._asSet(),[(0), (2)]._asSet());
  4453. self._assert_equals_([(2), (0)]._asSet(),[(0), (2)]._asSet());
  4454. self._deny_(_st([(0), (2), (3)]._asSet()).__eq([(0), (2)]._asSet()));
  4455. self._deny_(_st([(1), (2)]._asSet()).__eq([(0), (2)]._asSet()));
  4456. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  4457. args: [],
  4458. source: "testComparing\x0a\x09self assert: #(0 2) asSet equals: #(0 2) asSet.\x0a\x09self assert: #(2 0) asSet equals: #(0 2) asSet.\x0a\x09self deny: #(0 2 3) asSet = #(0 2) asSet.\x0a\x09self deny: #(1 2) asSet = #(0 2) asSet",
  4459. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  4460. referencedClasses: []
  4461. }),
  4462. smalltalk.SetTest);
  4463. smalltalk.addMethod(
  4464. smalltalk.method({
  4465. selector: "testPrintString",
  4466. category: 'tests',
  4467. fn: function (){
  4468. var self=this;
  4469. var set;
  4470. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4471. return smalltalk.withContext(function($ctx1) {
  4472. var $1,$2,$3,$4;
  4473. set=_st($Set())._new();
  4474. self._assert_equals_(_st(set)._printString(),"a Set ()");
  4475. $1=set;
  4476. _st($1)._add_((1));
  4477. $2=_st($1)._add_((3));
  4478. self._assert_equals_(_st(set)._printString(),"a Set (1 3)");
  4479. _st(set)._add_("foo");
  4480. self._assert_equals_(_st(set)._printString(),"a Set (1 3 'foo')");
  4481. $3=set;
  4482. _st($3)._remove_((1));
  4483. $4=_st($3)._remove_((3));
  4484. self._assert_equals_(_st(set)._printString(),"a Set ('foo')");
  4485. _st(set)._add_((3));
  4486. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  4487. _st(set)._add_((3));
  4488. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  4489. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  4490. args: [],
  4491. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'",
  4492. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  4493. referencedClasses: ["Set"]
  4494. }),
  4495. smalltalk.SetTest);
  4496. smalltalk.addMethod(
  4497. smalltalk.method({
  4498. selector: "testSize",
  4499. category: 'tests',
  4500. fn: function (){
  4501. var self=this;
  4502. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4503. return smalltalk.withContext(function($ctx1) {
  4504. self._assert_equals_(_st(_st($Set())._new())._size(),(0));
  4505. self._assert_equals_(_st(_st($Set())._withAll_([(1), (2), (3), (4)]))._size(),(4));
  4506. self._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  4507. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  4508. args: [],
  4509. 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",
  4510. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  4511. referencedClasses: ["Set"]
  4512. }),
  4513. smalltalk.SetTest);
  4514. smalltalk.addMethod(
  4515. smalltalk.method({
  4516. selector: "testUnboxedObjects",
  4517. category: 'tests',
  4518. fn: function (){
  4519. var self=this;
  4520. return smalltalk.withContext(function($ctx1) {
  4521. self._assert_equals_(_st(_st(["foo"._yourself(),"foo"._yourself()])._asSet())._asArray(),["foo"]);
  4522. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  4523. args: [],
  4524. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  4525. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  4526. referencedClasses: []
  4527. }),
  4528. smalltalk.SetTest);
  4529. smalltalk.addMethod(
  4530. smalltalk.method({
  4531. selector: "testUnicity",
  4532. category: 'tests',
  4533. fn: function (){
  4534. var self=this;
  4535. var set;
  4536. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4537. return smalltalk.withContext(function($ctx1) {
  4538. set=_st($Set())._new();
  4539. _st(set)._add_((21));
  4540. _st(set)._add_("hello");
  4541. _st(set)._add_((21));
  4542. self._assert_equals_(_st(set)._size(),(2));
  4543. _st(set)._add_("hello");
  4544. self._assert_equals_(_st(set)._size(),(2));
  4545. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  4546. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  4547. args: [],
  4548. 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 equals: 2.\x0a\x09\x0a\x09set add: 'hello'.\x0a\x09self assert: set size equals: 2.\x0a\x0a\x09self assert: set asArray equals: #(21 'hello')",
  4549. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  4550. referencedClasses: ["Set"]
  4551. }),
  4552. smalltalk.SetTest);
  4553. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4554. smalltalk.addMethod(
  4555. smalltalk.method({
  4556. selector: "collectionClass",
  4557. category: 'accessing',
  4558. fn: function (){
  4559. var self=this;
  4560. return smalltalk.withContext(function($ctx1) {
  4561. var $1;
  4562. $1=_st(self._class())._collectionClass();
  4563. return $1;
  4564. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  4565. args: [],
  4566. source: "collectionClass\x0a\x09^ self class collectionClass",
  4567. messageSends: ["collectionClass", "class"],
  4568. referencedClasses: []
  4569. }),
  4570. smalltalk.StreamTest);
  4571. smalltalk.addMethod(
  4572. smalltalk.method({
  4573. selector: "newCollection",
  4574. category: 'accessing',
  4575. fn: function (){
  4576. var self=this;
  4577. return smalltalk.withContext(function($ctx1) {
  4578. var $1;
  4579. $1=_st(self._collectionClass())._new();
  4580. return $1;
  4581. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  4582. args: [],
  4583. source: "newCollection\x0a\x09^ self collectionClass new",
  4584. messageSends: ["new", "collectionClass"],
  4585. referencedClasses: []
  4586. }),
  4587. smalltalk.StreamTest);
  4588. smalltalk.addMethod(
  4589. smalltalk.method({
  4590. selector: "newStream",
  4591. category: 'accessing',
  4592. fn: function (){
  4593. var self=this;
  4594. return smalltalk.withContext(function($ctx1) {
  4595. var $1;
  4596. $1=_st(_st(self._collectionClass())._new())._stream();
  4597. return $1;
  4598. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  4599. args: [],
  4600. source: "newStream\x0a\x09^ self collectionClass new stream",
  4601. messageSends: ["stream", "new", "collectionClass"],
  4602. referencedClasses: []
  4603. }),
  4604. smalltalk.StreamTest);
  4605. smalltalk.addMethod(
  4606. smalltalk.method({
  4607. selector: "testAtStartAtEnd",
  4608. category: 'tests',
  4609. fn: function (){
  4610. var self=this;
  4611. var stream;
  4612. return smalltalk.withContext(function($ctx1) {
  4613. stream=self._newStream();
  4614. self._assert_(_st(stream)._atStart());
  4615. self._assert_(_st(stream)._atEnd());
  4616. _st(stream)._nextPutAll_(self._newCollection());
  4617. self._assert_(_st(stream)._atEnd());
  4618. self._deny_(_st(stream)._atStart());
  4619. _st(stream)._position_((1));
  4620. self._deny_(_st(stream)._atEnd());
  4621. self._deny_(_st(stream)._atStart());
  4622. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  4623. args: [],
  4624. source: "testAtStartAtEnd\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream atStart.\x0a\x09self assert: stream atEnd.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self assert: stream atEnd.\x0a\x09self deny: stream atStart.\x0a\x09\x0a\x09stream position: 1.\x0a\x09self deny: stream atEnd.\x0a\x09self deny: stream atStart",
  4625. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  4626. referencedClasses: []
  4627. }),
  4628. smalltalk.StreamTest);
  4629. smalltalk.addMethod(
  4630. smalltalk.method({
  4631. selector: "testContents",
  4632. category: 'tests',
  4633. fn: function (){
  4634. var self=this;
  4635. var stream;
  4636. return smalltalk.withContext(function($ctx1) {
  4637. stream=self._newStream();
  4638. _st(stream)._nextPutAll_(self._newCollection());
  4639. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  4640. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  4641. args: [],
  4642. source: "testContents\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: self newCollection.\x0a\x09\x0a\x09self assert: stream contents equals: self newCollection",
  4643. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  4644. referencedClasses: []
  4645. }),
  4646. smalltalk.StreamTest);
  4647. smalltalk.addMethod(
  4648. smalltalk.method({
  4649. selector: "testIsEmpty",
  4650. category: 'tests',
  4651. fn: function (){
  4652. var self=this;
  4653. var stream;
  4654. return smalltalk.withContext(function($ctx1) {
  4655. stream=self._newStream();
  4656. self._assert_(_st(stream)._isEmpty());
  4657. _st(stream)._nextPutAll_(self._newCollection());
  4658. self._deny_(_st(stream)._isEmpty());
  4659. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  4660. args: [],
  4661. source: "testIsEmpty\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream isEmpty.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self deny: stream isEmpty",
  4662. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  4663. referencedClasses: []
  4664. }),
  4665. smalltalk.StreamTest);
  4666. smalltalk.addMethod(
  4667. smalltalk.method({
  4668. selector: "testPosition",
  4669. category: 'tests',
  4670. fn: function (){
  4671. var self=this;
  4672. var collection,stream;
  4673. return smalltalk.withContext(function($ctx1) {
  4674. collection=self._newCollection();
  4675. stream=self._newStream();
  4676. _st(stream)._nextPutAll_(collection);
  4677. self._assert_equals_(_st(stream)._position(),_st(collection)._size());
  4678. _st(stream)._position_((0));
  4679. self._assert_equals_(_st(stream)._position(),(0));
  4680. _st(stream)._next();
  4681. self._assert_equals_(_st(stream)._position(),(1));
  4682. _st(stream)._next();
  4683. self._assert_equals_(_st(stream)._position(),(2));
  4684. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  4685. args: [],
  4686. source: "testPosition\x0a\x09| collection stream |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream position equals: collection size.\x0a\x09\x0a\x09stream position: 0.\x0a\x09self assert: stream position equals: 0.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 1.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 2",
  4687. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  4688. referencedClasses: []
  4689. }),
  4690. smalltalk.StreamTest);
  4691. smalltalk.addMethod(
  4692. smalltalk.method({
  4693. selector: "testReading",
  4694. category: 'tests',
  4695. fn: function (){
  4696. var self=this;
  4697. var stream,collection;
  4698. return smalltalk.withContext(function($ctx1) {
  4699. var $1,$2;
  4700. collection=self._newCollection();
  4701. stream=self._newStream();
  4702. $1=stream;
  4703. _st($1)._nextPutAll_(collection);
  4704. $2=_st($1)._position_((0));
  4705. _st(collection)._do_((function(each){
  4706. return smalltalk.withContext(function($ctx2) {
  4707. return self._assert_equals_(_st(stream)._next(),each);
  4708. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4709. self._assert_(_st(_st(stream)._next())._isNil());
  4710. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  4711. args: [],
  4712. source: "testReading\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream \x0a\x09\x09nextPutAll: collection;\x0a\x09\x09position: 0.\x0a\x09\x0a\x09collection do: [ :each |\x0a\x09\x09self assert: stream next equals: each ].\x0a\x09\x09\x0a\x09self assert: stream next isNil",
  4713. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  4714. referencedClasses: []
  4715. }),
  4716. smalltalk.StreamTest);
  4717. smalltalk.addMethod(
  4718. smalltalk.method({
  4719. selector: "testStreamContents",
  4720. category: 'tests',
  4721. fn: function (){
  4722. var self=this;
  4723. return smalltalk.withContext(function($ctx1) {
  4724. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  4725. args: [],
  4726. source: "testStreamContents",
  4727. messageSends: [],
  4728. referencedClasses: []
  4729. }),
  4730. smalltalk.StreamTest);
  4731. smalltalk.addMethod(
  4732. smalltalk.method({
  4733. selector: "testWrite",
  4734. category: 'tests',
  4735. fn: function (){
  4736. var self=this;
  4737. var stream,collection;
  4738. return smalltalk.withContext(function($ctx1) {
  4739. collection=self._newCollection();
  4740. stream=self._newStream();
  4741. _st(collection)._do_((function(each){
  4742. return smalltalk.withContext(function($ctx2) {
  4743. return _st(stream).__lt_lt(each);
  4744. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4745. self._assert_equals_(_st(stream)._contents(),collection);
  4746. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  4747. args: [],
  4748. source: "testWrite\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream << each ].\x0a\x09self assert: stream contents equals: collection",
  4749. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  4750. referencedClasses: []
  4751. }),
  4752. smalltalk.StreamTest);
  4753. smalltalk.addMethod(
  4754. smalltalk.method({
  4755. selector: "testWriting",
  4756. category: 'tests',
  4757. fn: function (){
  4758. var self=this;
  4759. var stream,collection;
  4760. return smalltalk.withContext(function($ctx1) {
  4761. collection=self._newCollection();
  4762. stream=self._newStream();
  4763. _st(collection)._do_((function(each){
  4764. return smalltalk.withContext(function($ctx2) {
  4765. return _st(stream)._nextPut_(each);
  4766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4767. self._assert_equals_(_st(stream)._contents(),collection);
  4768. stream=self._newStream();
  4769. _st(stream)._nextPutAll_(collection);
  4770. self._assert_equals_(_st(stream)._contents(),collection);
  4771. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  4772. args: [],
  4773. source: "testWriting\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream nextPut: each ].\x0a\x09self assert: stream contents equals: collection.\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream contents equals: collection",
  4774. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  4775. referencedClasses: []
  4776. }),
  4777. smalltalk.StreamTest);
  4778. smalltalk.addMethod(
  4779. smalltalk.method({
  4780. selector: "collectionClass",
  4781. category: 'accessing',
  4782. fn: function (){
  4783. var self=this;
  4784. return smalltalk.withContext(function($ctx1) {
  4785. return nil;
  4786. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  4787. args: [],
  4788. source: "collectionClass\x0a\x09^ nil",
  4789. messageSends: [],
  4790. referencedClasses: []
  4791. }),
  4792. smalltalk.StreamTest.klass);
  4793. smalltalk.addMethod(
  4794. smalltalk.method({
  4795. selector: "isAbstract",
  4796. category: 'testing',
  4797. fn: function (){
  4798. var self=this;
  4799. return smalltalk.withContext(function($ctx1) {
  4800. var $1;
  4801. $1=_st(self._collectionClass())._isNil();
  4802. return $1;
  4803. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  4804. args: [],
  4805. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  4806. messageSends: ["isNil", "collectionClass"],
  4807. referencedClasses: []
  4808. }),
  4809. smalltalk.StreamTest.klass);
  4810. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  4811. smalltalk.addMethod(
  4812. smalltalk.method({
  4813. selector: "newCollection",
  4814. category: 'accessing',
  4815. fn: function (){
  4816. var self=this;
  4817. return smalltalk.withContext(function($ctx1) {
  4818. var $1;
  4819. $1=[true,(1),(3).__at((4)),"foo"];
  4820. return $1;
  4821. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  4822. args: [],
  4823. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  4824. messageSends: ["@"],
  4825. referencedClasses: []
  4826. }),
  4827. smalltalk.ArrayStreamTest);
  4828. smalltalk.addMethod(
  4829. smalltalk.method({
  4830. selector: "collectionClass",
  4831. category: 'accessing',
  4832. fn: function (){
  4833. var self=this;
  4834. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4835. return smalltalk.withContext(function($ctx1) {
  4836. var $1;
  4837. $1=$Array();
  4838. return $1;
  4839. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  4840. args: [],
  4841. source: "collectionClass\x0a\x09^ Array",
  4842. messageSends: [],
  4843. referencedClasses: ["Array"]
  4844. }),
  4845. smalltalk.ArrayStreamTest.klass);
  4846. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  4847. smalltalk.addMethod(
  4848. smalltalk.method({
  4849. selector: "newCollection",
  4850. category: 'accessing',
  4851. fn: function (){
  4852. var self=this;
  4853. return smalltalk.withContext(function($ctx1) {
  4854. return "hello world";
  4855. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  4856. args: [],
  4857. source: "newCollection\x0a\x09^ 'hello world'",
  4858. messageSends: [],
  4859. referencedClasses: []
  4860. }),
  4861. smalltalk.StringStreamTest);
  4862. smalltalk.addMethod(
  4863. smalltalk.method({
  4864. selector: "collectionClass",
  4865. category: 'accessing',
  4866. fn: function (){
  4867. var self=this;
  4868. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4869. return smalltalk.withContext(function($ctx1) {
  4870. var $1;
  4871. $1=$String();
  4872. return $1;
  4873. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  4874. args: [],
  4875. source: "collectionClass\x0a\x09^ String",
  4876. messageSends: [],
  4877. referencedClasses: ["String"]
  4878. }),
  4879. smalltalk.StringStreamTest.klass);
  4880. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4881. smalltalk.addMethod(
  4882. smalltalk.method({
  4883. selector: "testCopying",
  4884. category: 'tests',
  4885. fn: function (){
  4886. var self=this;
  4887. return smalltalk.withContext(function($ctx1) {
  4888. self._assert_equals_(nil._copy(),nil);
  4889. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  4890. args: [],
  4891. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  4892. messageSends: ["assert:equals:", "copy"],
  4893. referencedClasses: []
  4894. }),
  4895. smalltalk.UndefinedTest);
  4896. smalltalk.addMethod(
  4897. smalltalk.method({
  4898. selector: "testDeepCopy",
  4899. category: 'tests',
  4900. fn: function (){
  4901. var self=this;
  4902. return smalltalk.withContext(function($ctx1) {
  4903. self._assert_(_st(nil._deepCopy()).__eq(nil));
  4904. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  4905. args: [],
  4906. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  4907. messageSends: ["assert:", "=", "deepCopy"],
  4908. referencedClasses: []
  4909. }),
  4910. smalltalk.UndefinedTest);
  4911. smalltalk.addMethod(
  4912. smalltalk.method({
  4913. selector: "testIfNil",
  4914. category: 'tests',
  4915. fn: function (){
  4916. var self=this;
  4917. return smalltalk.withContext(function($ctx1) {
  4918. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9;
  4919. $1=self;
  4920. if(($receiver = nil) == nil || $receiver == undefined){
  4921. $2=true;
  4922. } else {
  4923. $2=nil;
  4924. };
  4925. _st($1)._assert_equals_($2,true);
  4926. $3=self;
  4927. if(($receiver = nil) == nil || $receiver == undefined){
  4928. $5=nil;
  4929. } else {
  4930. $5=true;
  4931. };
  4932. $4=_st($5).__eq(true);
  4933. _st($3)._deny_($4);
  4934. $6=self;
  4935. if(($receiver = nil) == nil || $receiver == undefined){
  4936. $7=true;
  4937. } else {
  4938. $7=false;
  4939. };
  4940. _st($6)._assert_equals_($7,true);
  4941. $8=self;
  4942. if(($receiver = nil) == nil || $receiver == undefined){
  4943. $10=false;
  4944. } else {
  4945. $10=true;
  4946. };
  4947. $9=_st($10).__eq(true);
  4948. _st($8)._deny_($9);
  4949. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  4950. args: [],
  4951. 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",
  4952. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  4953. referencedClasses: []
  4954. }),
  4955. smalltalk.UndefinedTest);
  4956. smalltalk.addMethod(
  4957. smalltalk.method({
  4958. selector: "testIsNil",
  4959. category: 'tests',
  4960. fn: function (){
  4961. var self=this;
  4962. return smalltalk.withContext(function($ctx1) {
  4963. self._assert_(nil._isNil());
  4964. self._deny_(nil._notNil());
  4965. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  4966. args: [],
  4967. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  4968. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  4969. referencedClasses: []
  4970. }),
  4971. smalltalk.UndefinedTest);
  4972. })(global_smalltalk,global_nil,global__st);