Kernel-Tests.js 249 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "testHandlesAnnouncement",
  8. category: 'tests',
  9. fn: function (){
  10. var self=this;
  11. var subscription,announcementClass1,announcementClass2,classBuilder;
  12. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  16. return smalltalk.withContext(function($ctx1) {
  17. var $1,$3,$2,$5,$4,$7,$6;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. $1=_st($AnnouncementSubscription())._new();
  22. subscription=_st($1)._announcementClass_($SystemAnnouncement());
  23. $3=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  24. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  25. $2=self._assert_equals_($3,true);
  26. $ctx1.sendIdx["assert:equals:"]=1;
  27. $5=_st(subscription)._handlesAnnouncement_(announcementClass1);
  28. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  29. $4=self._assert_equals_($5,true);
  30. $ctx1.sendIdx["assert:equals:"]=2;
  31. $7=_st(subscription)._handlesAnnouncement_($Object());
  32. $6=self._assert_equals_($7,false);
  33. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  34. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},smalltalk.AnnouncementSubscriptionTest)})},
  35. args: [],
  36. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  37. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  38. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  39. }),
  40. smalltalk.AnnouncementSubscriptionTest);
  41. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  42. smalltalk.addMethod(
  43. smalltalk.method({
  44. selector: "testCanClearInterval",
  45. category: 'tests',
  46. fn: function (){
  47. var self=this;
  48. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  49. return smalltalk.withContext(function($ctx1) {
  50. self._shouldnt_raise_((function(){
  51. return smalltalk.withContext(function($ctx2) {
  52. return _st(_st((function(){
  53. return smalltalk.withContext(function($ctx3) {
  54. return _st(_st($Error())._new())._signal();
  55. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  56. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  57. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  58. args: [],
  59. source: "testCanClearInterval\x0a\x09self shouldnt: [([Error new signal] valueWithInterval: 0) clearInterval] raise: Error",
  60. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  61. referencedClasses: ["Error"]
  62. }),
  63. smalltalk.BlockClosureTest);
  64. smalltalk.addMethod(
  65. smalltalk.method({
  66. selector: "testCanClearTimeout",
  67. category: 'tests',
  68. fn: function (){
  69. var self=this;
  70. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  71. return smalltalk.withContext(function($ctx1) {
  72. self._shouldnt_raise_((function(){
  73. return smalltalk.withContext(function($ctx2) {
  74. return _st(_st((function(){
  75. return smalltalk.withContext(function($ctx3) {
  76. return _st(_st($Error())._new())._signal();
  77. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  78. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  79. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  80. args: [],
  81. source: "testCanClearTimeout\x0a\x09self shouldnt: [([Error new signal] valueWithTimeout: 0) clearTimeout] raise: Error",
  82. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  83. referencedClasses: ["Error"]
  84. }),
  85. smalltalk.BlockClosureTest);
  86. smalltalk.addMethod(
  87. smalltalk.method({
  88. selector: "testCompiledSource",
  89. category: 'tests',
  90. fn: function (){
  91. var self=this;
  92. return smalltalk.withContext(function($ctx1) {
  93. self._assert_(_st(_st((function(){
  94. return smalltalk.withContext(function($ctx2) {
  95. return (1).__plus((1));
  96. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  97. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  98. args: [],
  99. source: "testCompiledSource\x0a\x09self assert: ([1+1] compiledSource includesSubString: 'function')",
  100. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  101. referencedClasses: []
  102. }),
  103. smalltalk.BlockClosureTest);
  104. smalltalk.addMethod(
  105. smalltalk.method({
  106. selector: "testCurrySelf",
  107. category: 'tests',
  108. fn: function (){
  109. var self=this;
  110. var curriedMethod,array;
  111. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  112. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  113. return smalltalk.withContext(function($ctx1) {
  114. curriedMethod=_st(_st((function(selfarg,x){
  115. return smalltalk.withContext(function($ctx2) {
  116. return _st(selfarg)._at_(x);
  117. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  118. array=[(3), (1), (4)];
  119. _st(_st($ClassBuilder())._new())._installMethod_forClass_category_(curriedMethod,$Array(),"**test helper");
  120. _st((function(){
  121. return smalltalk.withContext(function($ctx2) {
  122. return self._assert_equals_(_st(array)._foo_((2)),(1));
  123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  124. return smalltalk.withContext(function($ctx2) {
  125. return _st($Array())._removeCompiledMethod_(curriedMethod);
  126. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  127. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  128. args: [],
  129. 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 ]",
  130. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:category:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  131. referencedClasses: ["ClassBuilder", "Array"]
  132. }),
  133. smalltalk.BlockClosureTest);
  134. smalltalk.addMethod(
  135. smalltalk.method({
  136. selector: "testEnsure",
  137. category: 'tests',
  138. fn: function (){
  139. var self=this;
  140. return smalltalk.withContext(function($ctx1) {
  141. self._assert_equals_(_st((function(){
  142. return smalltalk.withContext(function($ctx2) {
  143. return (3);
  144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  145. return smalltalk.withContext(function($ctx2) {
  146. return (4);
  147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  148. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  149. args: [],
  150. source: "testEnsure\x0a\x09self assert: ([3] ensure: [4]) equals: 3",
  151. messageSends: ["assert:equals:", "ensure:"],
  152. referencedClasses: []
  153. }),
  154. smalltalk.BlockClosureTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testEnsureRaises",
  158. category: 'tests',
  159. fn: function (){
  160. var self=this;
  161. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  162. return smalltalk.withContext(function($ctx1) {
  163. self._should_raise_((function(){
  164. return smalltalk.withContext(function($ctx2) {
  165. return _st((function(){
  166. return smalltalk.withContext(function($ctx3) {
  167. return _st(_st($Error())._new())._signal();
  168. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  169. return smalltalk.withContext(function($ctx3) {
  170. return true;
  171. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  173. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  174. args: [],
  175. source: "testEnsureRaises\x0a\x09self should: [[Error new signal] ensure: [true]] raise: Error",
  176. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  177. referencedClasses: ["Error"]
  178. }),
  179. smalltalk.BlockClosureTest);
  180. smalltalk.addMethod(
  181. smalltalk.method({
  182. selector: "testExceptionSemantics",
  183. category: 'tests',
  184. fn: function (){
  185. var self=this;
  186. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  187. return smalltalk.withContext(function($ctx1) {
  188. self._timeout_((100));
  189. _st(self._async_((function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return _st((function(){
  192. return smalltalk.withContext(function($ctx3) {
  193. self._assert_(true);
  194. _st($Error())._signal();
  195. self._deny_(true);
  196. return self._finished();
  197. $ctx3.sendIdx["finished"]=1;
  198. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  199. return smalltalk.withContext(function($ctx3) {
  200. return self._finished();
  201. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  202. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  203. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  204. args: [],
  205. 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",
  206. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  207. referencedClasses: ["Error"]
  208. }),
  209. smalltalk.BlockClosureTest);
  210. smalltalk.addMethod(
  211. smalltalk.method({
  212. selector: "testNewWithValues",
  213. category: 'tests',
  214. fn: function (){
  215. var self=this;
  216. return smalltalk.withContext(function($ctx1) {
  217. function theTestPrototype() {this.name = "theTestPrototype";}
  218. function theTestConstructor(arg1, arg2, arg3) {}
  219. theTestConstructor.prototype = new theTestPrototype;
  220. var theWrappedConstructor = _st(theTestConstructor);
  221. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3]);
  222. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  223. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  224. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  225. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  226. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  227. args: [],
  228. 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>",
  229. messageSends: [],
  230. referencedClasses: []
  231. }),
  232. smalltalk.BlockClosureTest);
  233. smalltalk.addMethod(
  234. smalltalk.method({
  235. selector: "testNumArgs",
  236. category: 'tests',
  237. fn: function (){
  238. var self=this;
  239. return smalltalk.withContext(function($ctx1) {
  240. var $2,$1,$4,$3;
  241. $2=_st((function(){
  242. return smalltalk.withContext(function($ctx2) {
  243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  244. $ctx1.sendIdx["numArgs"]=1;
  245. $1=self._assert_equals_($2,(0));
  246. $ctx1.sendIdx["assert:equals:"]=1;
  247. $4=_st((function(a,b){
  248. return smalltalk.withContext(function($ctx2) {
  249. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs();
  250. $3=self._assert_equals_($4,(2));
  251. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  252. args: [],
  253. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [:a :b | ] numArgs equals: 2",
  254. messageSends: ["assert:equals:", "numArgs"],
  255. referencedClasses: []
  256. }),
  257. smalltalk.BlockClosureTest);
  258. smalltalk.addMethod(
  259. smalltalk.method({
  260. selector: "testOnDo",
  261. category: 'tests',
  262. fn: function (){
  263. var self=this;
  264. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  265. return smalltalk.withContext(function($ctx1) {
  266. self._assert_(_st((function(){
  267. return smalltalk.withContext(function($ctx2) {
  268. return _st(_st($Error())._new())._signal();
  269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  270. return smalltalk.withContext(function($ctx2) {
  271. return true;
  272. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  273. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  274. args: [],
  275. source: "testOnDo\x0a\x09self assert: ([Error new signal] on: Error do: [:ex | true])",
  276. messageSends: ["assert:", "on:do:", "signal", "new"],
  277. referencedClasses: ["Error"]
  278. }),
  279. smalltalk.BlockClosureTest);
  280. smalltalk.addMethod(
  281. smalltalk.method({
  282. selector: "testValue",
  283. category: 'tests',
  284. fn: function (){
  285. var self=this;
  286. return smalltalk.withContext(function($ctx1) {
  287. var $2,$1,$3,$4,$6,$5;
  288. $2=_st((function(){
  289. return smalltalk.withContext(function($ctx2) {
  290. return (1).__plus((1));
  291. $ctx2.sendIdx["+"]=1;
  292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  293. $ctx1.sendIdx["value"]=1;
  294. $1=self._assert_equals_($2,(2));
  295. $ctx1.sendIdx["assert:equals:"]=1;
  296. $3=self._assert_equals_(_st((function(x){
  297. return smalltalk.withContext(function($ctx2) {
  298. return _st(x).__plus((1));
  299. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  300. $ctx1.sendIdx["assert:equals:"]=2;
  301. $4=self._assert_equals_(_st((function(x,y){
  302. return smalltalk.withContext(function($ctx2) {
  303. return _st(x).__star(y);
  304. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  305. $ctx1.sendIdx["assert:equals:"]=3;
  306. $6=_st((function(a,b,c){
  307. return smalltalk.withContext(function($ctx2) {
  308. return (1);
  309. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value();
  310. $5=self._assert_equals_($6,(1));
  311. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  312. args: [],
  313. 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",
  314. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  315. referencedClasses: []
  316. }),
  317. smalltalk.BlockClosureTest);
  318. smalltalk.addMethod(
  319. smalltalk.method({
  320. selector: "testValueWithPossibleArguments",
  321. category: 'tests',
  322. fn: function (){
  323. var self=this;
  324. return smalltalk.withContext(function($ctx1) {
  325. var $2,$1,$4,$3,$6,$5;
  326. $2=_st((function(){
  327. return smalltalk.withContext(function($ctx2) {
  328. return (1);
  329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  330. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  331. $1=self._assert_equals_($2,(1));
  332. $ctx1.sendIdx["assert:equals:"]=1;
  333. $4=_st((function(a){
  334. return smalltalk.withContext(function($ctx2) {
  335. return _st(a).__plus((4));
  336. $ctx2.sendIdx["+"]=1;
  337. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  338. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  339. $3=self._assert_equals_($4,(7));
  340. $ctx1.sendIdx["assert:equals:"]=2;
  341. $6=_st((function(a,b){
  342. return smalltalk.withContext(function($ctx2) {
  343. return _st(a).__plus(b);
  344. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]);
  345. $5=self._assert_equals_($6,(7));
  346. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  347. args: [],
  348. 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.",
  349. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  350. referencedClasses: []
  351. }),
  352. smalltalk.BlockClosureTest);
  353. smalltalk.addMethod(
  354. smalltalk.method({
  355. selector: "testWhileFalse",
  356. category: 'tests',
  357. fn: function (){
  358. var self=this;
  359. var i;
  360. return smalltalk.withContext(function($ctx1) {
  361. var $1,$2;
  362. i=(0);
  363. _st((function(){
  364. return smalltalk.withContext(function($ctx2) {
  365. return _st(i).__gt((5));
  366. $ctx2.sendIdx[">"]=1;
  367. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  368. return smalltalk.withContext(function($ctx2) {
  369. i=_st(i).__plus((1));
  370. $ctx2.sendIdx["+"]=1;
  371. return i;
  372. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  373. $1=self._assert_equals_(i,(6));
  374. $ctx1.sendIdx["assert:equals:"]=1;
  375. i=(0);
  376. _st((function(){
  377. return smalltalk.withContext(function($ctx2) {
  378. i=_st(i).__plus((1));
  379. i;
  380. return _st(i).__gt((5));
  381. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  382. $2=self._assert_equals_(i,(6));
  383. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  384. args: [],
  385. 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",
  386. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  387. referencedClasses: []
  388. }),
  389. smalltalk.BlockClosureTest);
  390. smalltalk.addMethod(
  391. smalltalk.method({
  392. selector: "testWhileTrue",
  393. category: 'tests',
  394. fn: function (){
  395. var self=this;
  396. var i;
  397. return smalltalk.withContext(function($ctx1) {
  398. var $1,$2;
  399. i=(0);
  400. _st((function(){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(i).__lt((5));
  403. $ctx2.sendIdx["<"]=1;
  404. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  405. return smalltalk.withContext(function($ctx2) {
  406. i=_st(i).__plus((1));
  407. $ctx2.sendIdx["+"]=1;
  408. return i;
  409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  410. $1=self._assert_equals_(i,(5));
  411. $ctx1.sendIdx["assert:equals:"]=1;
  412. i=(0);
  413. _st((function(){
  414. return smalltalk.withContext(function($ctx2) {
  415. i=_st(i).__plus((1));
  416. i;
  417. return _st(i).__lt((5));
  418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  419. $2=self._assert_equals_(i,(5));
  420. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  421. args: [],
  422. 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",
  423. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  424. referencedClasses: []
  425. }),
  426. smalltalk.BlockClosureTest);
  427. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  428. smalltalk.addMethod(
  429. smalltalk.method({
  430. selector: "testEquality",
  431. category: 'tests',
  432. fn: function (){
  433. var self=this;
  434. return smalltalk.withContext(function($ctx1) {
  435. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15,$19,$18,$17,$22,$23,$21,$20;
  436. $2=(0).__eq(false);
  437. $ctx1.sendIdx["="]=1;
  438. $1=self._deny_($2);
  439. $ctx1.sendIdx["deny:"]=1;
  440. $4=false.__eq((0));
  441. $ctx1.sendIdx["="]=2;
  442. $3=self._deny_($4);
  443. $ctx1.sendIdx["deny:"]=2;
  444. $6="".__eq(false);
  445. $ctx1.sendIdx["="]=3;
  446. $5=self._deny_($6);
  447. $ctx1.sendIdx["deny:"]=3;
  448. $8=false.__eq("");
  449. $ctx1.sendIdx["="]=4;
  450. $7=self._deny_($8);
  451. $ctx1.sendIdx["deny:"]=4;
  452. $10=true.__eq(true);
  453. $ctx1.sendIdx["="]=5;
  454. $9=self._assert_($10);
  455. $ctx1.sendIdx["assert:"]=1;
  456. $12=false.__eq(true);
  457. $ctx1.sendIdx["="]=6;
  458. $11=self._deny_($12);
  459. $ctx1.sendIdx["deny:"]=5;
  460. $14=true.__eq(false);
  461. $ctx1.sendIdx["="]=7;
  462. $13=self._deny_($14);
  463. $16=false.__eq(false);
  464. $ctx1.sendIdx["="]=8;
  465. $15=self._assert_($16);
  466. $ctx1.sendIdx["assert:"]=2;
  467. $19=true._yourself();
  468. $ctx1.sendIdx["yourself"]=1;
  469. $18=_st($19).__eq(true);
  470. $ctx1.sendIdx["="]=9;
  471. $17=self._assert_($18);
  472. $ctx1.sendIdx["assert:"]=3;
  473. $22=true._yourself();
  474. $ctx1.sendIdx["yourself"]=2;
  475. $23=true._yourself();
  476. $21=_st($22).__eq($23);
  477. $20=self._assert_($21);
  478. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  479. args: [],
  480. 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)",
  481. messageSends: ["deny:", "=", "assert:", "yourself"],
  482. referencedClasses: []
  483. }),
  484. smalltalk.BooleanTest);
  485. smalltalk.addMethod(
  486. smalltalk.method({
  487. selector: "testIdentity",
  488. category: 'tests',
  489. fn: function (){
  490. var self=this;
  491. return smalltalk.withContext(function($ctx1) {
  492. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15,$19,$18,$17,$22,$23,$21,$20;
  493. $2=(0).__eq_eq(false);
  494. $ctx1.sendIdx["=="]=1;
  495. $1=self._deny_($2);
  496. $ctx1.sendIdx["deny:"]=1;
  497. $4=false.__eq_eq((0));
  498. $ctx1.sendIdx["=="]=2;
  499. $3=self._deny_($4);
  500. $ctx1.sendIdx["deny:"]=2;
  501. $6="".__eq_eq(false);
  502. $ctx1.sendIdx["=="]=3;
  503. $5=self._deny_($6);
  504. $ctx1.sendIdx["deny:"]=3;
  505. $8=false.__eq_eq("");
  506. $ctx1.sendIdx["=="]=4;
  507. $7=self._deny_($8);
  508. $ctx1.sendIdx["deny:"]=4;
  509. $10=true.__eq_eq(true);
  510. $ctx1.sendIdx["=="]=5;
  511. $9=self._assert_($10);
  512. $ctx1.sendIdx["assert:"]=1;
  513. $12=false.__eq_eq(true);
  514. $ctx1.sendIdx["=="]=6;
  515. $11=self._deny_($12);
  516. $ctx1.sendIdx["deny:"]=5;
  517. $14=true.__eq_eq(false);
  518. $ctx1.sendIdx["=="]=7;
  519. $13=self._deny_($14);
  520. $16=false.__eq_eq(false);
  521. $ctx1.sendIdx["=="]=8;
  522. $15=self._assert_($16);
  523. $ctx1.sendIdx["assert:"]=2;
  524. $19=true._yourself();
  525. $ctx1.sendIdx["yourself"]=1;
  526. $18=_st($19).__eq_eq(true);
  527. $ctx1.sendIdx["=="]=9;
  528. $17=self._assert_($18);
  529. $ctx1.sendIdx["assert:"]=3;
  530. $22=true._yourself();
  531. $ctx1.sendIdx["yourself"]=2;
  532. $23=true._yourself();
  533. $21=_st($22).__eq_eq($23);
  534. $20=self._assert_($21);
  535. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  536. args: [],
  537. 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",
  538. messageSends: ["deny:", "==", "assert:", "yourself"],
  539. referencedClasses: []
  540. }),
  541. smalltalk.BooleanTest);
  542. smalltalk.addMethod(
  543. smalltalk.method({
  544. selector: "testIfTrueIfFalse",
  545. category: 'tests',
  546. fn: function (){
  547. var self=this;
  548. return smalltalk.withContext(function($ctx1) {
  549. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  550. if(smalltalk.assert(true)){
  551. $2="alternative block";
  552. };
  553. $1=self._assert_equals_($2,"alternative block");
  554. $ctx1.sendIdx["assert:equals:"]=1;
  555. if(! smalltalk.assert(true)){
  556. $4="alternative block";
  557. };
  558. $3=self._assert_equals_($4,nil);
  559. $ctx1.sendIdx["assert:equals:"]=2;
  560. if(smalltalk.assert(false)){
  561. $6="alternative block";
  562. };
  563. $5=self._assert_equals_($6,nil);
  564. $ctx1.sendIdx["assert:equals:"]=3;
  565. if(! smalltalk.assert(false)){
  566. $8="alternative block";
  567. };
  568. $7=self._assert_equals_($8,"alternative block");
  569. $ctx1.sendIdx["assert:equals:"]=4;
  570. if(smalltalk.assert(false)){
  571. $10="alternative block";
  572. } else {
  573. $10="alternative block2";
  574. };
  575. $9=self._assert_equals_($10,"alternative block2");
  576. $ctx1.sendIdx["assert:equals:"]=5;
  577. if(smalltalk.assert(false)){
  578. $12="alternative block2";
  579. } else {
  580. $12="alternative block";
  581. };
  582. $11=self._assert_equals_($12,"alternative block");
  583. $ctx1.sendIdx["assert:equals:"]=6;
  584. if(smalltalk.assert(true)){
  585. $14="alternative block";
  586. } else {
  587. $14="alternative block2";
  588. };
  589. $13=self._assert_equals_($14,"alternative block");
  590. $ctx1.sendIdx["assert:equals:"]=7;
  591. if(smalltalk.assert(true)){
  592. $16="alternative block2";
  593. } else {
  594. $16="alternative block";
  595. };
  596. $15=self._assert_equals_($16,"alternative block2");
  597. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  598. args: [],
  599. 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'.",
  600. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.BooleanTest);
  604. smalltalk.addMethod(
  605. smalltalk.method({
  606. selector: "testIfTrueIfFalseWithBoxing",
  607. category: 'tests',
  608. fn: function (){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) {
  611. var $3,$2,$1,$6,$5,$4,$9,$8,$7,$12,$11,$10,$15,$14,$13,$18,$17,$16,$21,$20,$19,$24,$23,$22;
  612. $3=true._yourself();
  613. $ctx1.sendIdx["yourself"]=1;
  614. if(smalltalk.assert($3)){
  615. $2="alternative block";
  616. };
  617. $1=self._assert_equals_($2,"alternative block");
  618. $ctx1.sendIdx["assert:equals:"]=1;
  619. $6=true._yourself();
  620. $ctx1.sendIdx["yourself"]=2;
  621. if(! smalltalk.assert($6)){
  622. $5="alternative block";
  623. };
  624. $4=self._assert_equals_($5,nil);
  625. $ctx1.sendIdx["assert:equals:"]=2;
  626. $9=false._yourself();
  627. $ctx1.sendIdx["yourself"]=3;
  628. if(smalltalk.assert($9)){
  629. $8="alternative block";
  630. };
  631. $7=self._assert_equals_($8,nil);
  632. $ctx1.sendIdx["assert:equals:"]=3;
  633. $12=false._yourself();
  634. $ctx1.sendIdx["yourself"]=4;
  635. if(! smalltalk.assert($12)){
  636. $11="alternative block";
  637. };
  638. $10=self._assert_equals_($11,"alternative block");
  639. $ctx1.sendIdx["assert:equals:"]=4;
  640. $15=false._yourself();
  641. $ctx1.sendIdx["yourself"]=5;
  642. if(smalltalk.assert($15)){
  643. $14="alternative block";
  644. } else {
  645. $14="alternative block2";
  646. };
  647. $13=self._assert_equals_($14,"alternative block2");
  648. $ctx1.sendIdx["assert:equals:"]=5;
  649. $18=false._yourself();
  650. $ctx1.sendIdx["yourself"]=6;
  651. if(smalltalk.assert($18)){
  652. $17="alternative block2";
  653. } else {
  654. $17="alternative block";
  655. };
  656. $16=self._assert_equals_($17,"alternative block");
  657. $ctx1.sendIdx["assert:equals:"]=6;
  658. $21=true._yourself();
  659. $ctx1.sendIdx["yourself"]=7;
  660. if(smalltalk.assert($21)){
  661. $20="alternative block";
  662. } else {
  663. $20="alternative block2";
  664. };
  665. $19=self._assert_equals_($20,"alternative block");
  666. $ctx1.sendIdx["assert:equals:"]=7;
  667. $24=true._yourself();
  668. if(smalltalk.assert($24)){
  669. $23="alternative block2";
  670. } else {
  671. $23="alternative block";
  672. };
  673. $22=self._assert_equals_($23,"alternative block2");
  674. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  675. args: [],
  676. 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'.",
  677. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  678. referencedClasses: []
  679. }),
  680. smalltalk.BooleanTest);
  681. smalltalk.addMethod(
  682. smalltalk.method({
  683. selector: "testLogic",
  684. category: 'tests',
  685. fn: function (){
  686. var self=this;
  687. return smalltalk.withContext(function($ctx1) {
  688. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$26,$24,$23;
  689. $1=true.__and(true);
  690. $ctx1.sendIdx["&"]=1;
  691. self._assert_($1);
  692. $ctx1.sendIdx["assert:"]=1;
  693. $2=true.__and(false);
  694. $ctx1.sendIdx["&"]=2;
  695. self._deny_($2);
  696. $ctx1.sendIdx["deny:"]=1;
  697. $3=false.__and(true);
  698. $ctx1.sendIdx["&"]=3;
  699. self._deny_($3);
  700. $ctx1.sendIdx["deny:"]=2;
  701. $5=false.__and(false);
  702. $ctx1.sendIdx["&"]=4;
  703. $4=self._deny_($5);
  704. $ctx1.sendIdx["deny:"]=3;
  705. $6=true.__or(true);
  706. $ctx1.sendIdx["|"]=1;
  707. self._assert_($6);
  708. $ctx1.sendIdx["assert:"]=2;
  709. $7=true.__or(false);
  710. $ctx1.sendIdx["|"]=2;
  711. self._assert_($7);
  712. $ctx1.sendIdx["assert:"]=3;
  713. $8=false.__or(true);
  714. $ctx1.sendIdx["|"]=3;
  715. self._assert_($8);
  716. $ctx1.sendIdx["assert:"]=4;
  717. $10=false.__or(false);
  718. $ctx1.sendIdx["|"]=4;
  719. $9=self._deny_($10);
  720. $ctx1.sendIdx["deny:"]=4;
  721. $12=(1).__gt((0));
  722. $ctx1.sendIdx[">"]=1;
  723. $11=true.__and($12);
  724. $ctx1.sendIdx["&"]=5;
  725. self._assert_($11);
  726. $ctx1.sendIdx["assert:"]=5;
  727. $14=(1).__gt((0));
  728. $ctx1.sendIdx[">"]=2;
  729. $13=_st($14).__and(false);
  730. $ctx1.sendIdx["&"]=6;
  731. self._deny_($13);
  732. $ctx1.sendIdx["deny:"]=5;
  733. $17=(1).__gt((0));
  734. $ctx1.sendIdx[">"]=3;
  735. $18=(1).__gt((2));
  736. $ctx1.sendIdx[">"]=4;
  737. $16=_st($17).__and($18);
  738. $15=self._deny_($16);
  739. $20=(1).__gt((0));
  740. $ctx1.sendIdx[">"]=5;
  741. $19=false.__or($20);
  742. $ctx1.sendIdx["|"]=5;
  743. self._assert_($19);
  744. $ctx1.sendIdx["assert:"]=6;
  745. $22=(1).__gt((0));
  746. $ctx1.sendIdx[">"]=6;
  747. $21=_st($22).__or(false);
  748. $ctx1.sendIdx["|"]=6;
  749. self._assert_($21);
  750. $ctx1.sendIdx["assert:"]=7;
  751. $25=(1).__gt((0));
  752. $ctx1.sendIdx[">"]=7;
  753. $26=(1).__gt((2));
  754. $24=_st($25).__or($26);
  755. $23=self._assert_($24);
  756. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  757. args: [],
  758. 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))",
  759. messageSends: ["assert:", "&", "deny:", "|", ">"],
  760. referencedClasses: []
  761. }),
  762. smalltalk.BooleanTest);
  763. smalltalk.addMethod(
  764. smalltalk.method({
  765. selector: "testLogicKeywords",
  766. category: 'tests',
  767. fn: function (){
  768. var self=this;
  769. return smalltalk.withContext(function($ctx1) {
  770. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  771. $1=true._and_((function(){
  772. return smalltalk.withContext(function($ctx2) {
  773. return true;
  774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  775. $ctx1.sendIdx["and:"]=1;
  776. self._assert_($1);
  777. $ctx1.sendIdx["assert:"]=1;
  778. $2=true._and_((function(){
  779. return smalltalk.withContext(function($ctx2) {
  780. return false;
  781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  782. $ctx1.sendIdx["and:"]=2;
  783. self._deny_($2);
  784. $ctx1.sendIdx["deny:"]=1;
  785. $3=false._and_((function(){
  786. return smalltalk.withContext(function($ctx2) {
  787. return true;
  788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  789. $ctx1.sendIdx["and:"]=3;
  790. self._deny_($3);
  791. $ctx1.sendIdx["deny:"]=2;
  792. $5=false._and_((function(){
  793. return smalltalk.withContext(function($ctx2) {
  794. return false;
  795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  796. $ctx1.sendIdx["and:"]=4;
  797. $4=self._deny_($5);
  798. $ctx1.sendIdx["deny:"]=3;
  799. $6=true._or_((function(){
  800. return smalltalk.withContext(function($ctx2) {
  801. return true;
  802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  803. $ctx1.sendIdx["or:"]=1;
  804. self._assert_($6);
  805. $ctx1.sendIdx["assert:"]=2;
  806. $7=true._or_((function(){
  807. return smalltalk.withContext(function($ctx2) {
  808. return false;
  809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  810. $ctx1.sendIdx["or:"]=2;
  811. self._assert_($7);
  812. $ctx1.sendIdx["assert:"]=3;
  813. $8=false._or_((function(){
  814. return smalltalk.withContext(function($ctx2) {
  815. return true;
  816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  817. $ctx1.sendIdx["or:"]=3;
  818. self._assert_($8);
  819. $ctx1.sendIdx["assert:"]=4;
  820. $10=false._or_((function(){
  821. return smalltalk.withContext(function($ctx2) {
  822. return false;
  823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  824. $ctx1.sendIdx["or:"]=4;
  825. $9=self._deny_($10);
  826. $ctx1.sendIdx["deny:"]=4;
  827. $11=true._and_((function(){
  828. return smalltalk.withContext(function($ctx2) {
  829. return (1).__gt((0));
  830. $ctx2.sendIdx[">"]=1;
  831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  832. $ctx1.sendIdx["and:"]=5;
  833. self._assert_($11);
  834. $ctx1.sendIdx["assert:"]=5;
  835. $13=(1).__gt((0));
  836. $ctx1.sendIdx[">"]=2;
  837. $12=_st($13)._and_((function(){
  838. return smalltalk.withContext(function($ctx2) {
  839. return false;
  840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  841. $ctx1.sendIdx["and:"]=6;
  842. self._deny_($12);
  843. $ctx1.sendIdx["deny:"]=5;
  844. $16=(1).__gt((0));
  845. $ctx1.sendIdx[">"]=3;
  846. $15=_st($16)._and_((function(){
  847. return smalltalk.withContext(function($ctx2) {
  848. return (1).__gt((2));
  849. $ctx2.sendIdx[">"]=4;
  850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  851. $14=self._deny_($15);
  852. $17=false._or_((function(){
  853. return smalltalk.withContext(function($ctx2) {
  854. return (1).__gt((0));
  855. $ctx2.sendIdx[">"]=5;
  856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  857. $ctx1.sendIdx["or:"]=5;
  858. self._assert_($17);
  859. $ctx1.sendIdx["assert:"]=6;
  860. $19=(1).__gt((0));
  861. $ctx1.sendIdx[">"]=6;
  862. $18=_st($19)._or_((function(){
  863. return smalltalk.withContext(function($ctx2) {
  864. return false;
  865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  866. $ctx1.sendIdx["or:"]=6;
  867. self._assert_($18);
  868. $ctx1.sendIdx["assert:"]=7;
  869. $22=(1).__gt((0));
  870. $ctx1.sendIdx[">"]=7;
  871. $21=_st($22)._or_((function(){
  872. return smalltalk.withContext(function($ctx2) {
  873. return (1).__gt((2));
  874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  875. $20=self._assert_($21);
  876. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  877. args: [],
  878. 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 ])",
  879. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  880. referencedClasses: []
  881. }),
  882. smalltalk.BooleanTest);
  883. smalltalk.addMethod(
  884. smalltalk.method({
  885. selector: "testNonBooleanError",
  886. category: 'tests',
  887. fn: function (){
  888. var self=this;
  889. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  890. return smalltalk.withContext(function($ctx1) {
  891. self._should_raise_((function(){
  892. return smalltalk.withContext(function($ctx2) {
  893. if(smalltalk.assert("")){
  894. } else {
  895. };
  896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  897. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  898. args: [],
  899. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  900. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  901. referencedClasses: ["NonBooleanReceiver"]
  902. }),
  903. smalltalk.BooleanTest);
  904. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  905. smalltalk.addMethod(
  906. smalltalk.method({
  907. selector: "setUp",
  908. category: 'running',
  909. fn: function (){
  910. var self=this;
  911. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  912. return smalltalk.withContext(function($ctx1) {
  913. self["@builder"]=_st($ClassBuilder())._new();
  914. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  915. args: [],
  916. source: "setUp\x0a\x09builder := ClassBuilder new",
  917. messageSends: ["new"],
  918. referencedClasses: ["ClassBuilder"]
  919. }),
  920. smalltalk.ClassBuilderTest);
  921. smalltalk.addMethod(
  922. smalltalk.method({
  923. selector: "tearDown",
  924. category: 'running',
  925. fn: function (){
  926. var self=this;
  927. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  928. return smalltalk.withContext(function($ctx1) {
  929. var $1;
  930. $1=self["@theClass"];
  931. if(($receiver = $1) == nil || $receiver == null){
  932. $1;
  933. } else {
  934. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  935. self["@theClass"]=nil;
  936. self["@theClass"];
  937. };
  938. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  939. args: [],
  940. source: "tearDown\x0a\x09theClass ifNotNil: [Smalltalk current removeClass: theClass. theClass := nil]",
  941. messageSends: ["ifNotNil:", "removeClass:", "current"],
  942. referencedClasses: ["Smalltalk"]
  943. }),
  944. smalltalk.ClassBuilderTest);
  945. smalltalk.addMethod(
  946. smalltalk.method({
  947. selector: "testClassCopy",
  948. category: 'tests',
  949. fn: function (){
  950. var self=this;
  951. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  952. return smalltalk.withContext(function($ctx1) {
  953. var $3,$4,$2,$1,$7,$8,$6,$5,$9,$12,$13,$11,$10,$16,$15,$18,$17,$14;
  954. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  955. $3=_st(self["@theClass"])._superclass();
  956. $ctx1.sendIdx["superclass"]=1;
  957. $4=_st($ObjectMock())._superclass();
  958. $2=_st($3).__eq_eq($4);
  959. $ctx1.sendIdx["=="]=1;
  960. $1=self._assert_($2);
  961. $ctx1.sendIdx["assert:"]=1;
  962. $7=_st(self["@theClass"])._instanceVariableNames();
  963. $ctx1.sendIdx["instanceVariableNames"]=1;
  964. $8=_st($ObjectMock())._instanceVariableNames();
  965. $6=_st($7).__eq_eq($8);
  966. $ctx1.sendIdx["=="]=2;
  967. $5=self._assert_($6);
  968. $ctx1.sendIdx["assert:"]=2;
  969. $9=self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  970. $ctx1.sendIdx["assert:equals:"]=1;
  971. $12=_st(self["@theClass"])._package();
  972. $ctx1.sendIdx["package"]=1;
  973. $13=_st($ObjectMock())._package();
  974. $11=_st($12).__eq_eq($13);
  975. $10=self._assert_($11);
  976. $16=_st(self["@theClass"])._methodDictionary();
  977. $ctx1.sendIdx["methodDictionary"]=1;
  978. $15=_st($16)._keys();
  979. $ctx1.sendIdx["keys"]=1;
  980. $18=_st($ObjectMock())._methodDictionary();
  981. $17=_st($18)._keys();
  982. $14=self._assert_equals_($15,$17);
  983. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  984. args: [],
  985. 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",
  986. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  987. referencedClasses: ["ObjectMock"]
  988. }),
  989. smalltalk.ClassBuilderTest);
  990. smalltalk.addMethod(
  991. smalltalk.method({
  992. selector: "testClassMigration",
  993. category: 'tests',
  994. fn: function (){
  995. var self=this;
  996. var instance,oldClass;
  997. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  998. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  999. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1000. return smalltalk.withContext(function($ctx1) {
  1001. var $2,$1,$3,$5,$4,$7,$6,$9,$8,$10,$12,$13,$11,$15,$16,$14,$18,$17,$21,$20,$19,$25,$27,$26,$24,$23,$22,$28;
  1002. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1003. $2=_st($Smalltalk())._current();
  1004. $ctx1.sendIdx["current"]=1;
  1005. $1=_st($2)._at_("ObjectMock2");
  1006. $ctx1.sendIdx["at:"]=1;
  1007. instance=_st($1)._new();
  1008. $3=$ObjectMock();
  1009. $5=_st($Smalltalk())._current();
  1010. $ctx1.sendIdx["current"]=2;
  1011. $4=_st($5)._at_("ObjectMock2");
  1012. $ctx1.sendIdx["at:"]=2;
  1013. _st($3)._subclass_instanceVariableNames_package_($4,"","Kernel-Tests");
  1014. $7=_st(oldClass).__eq_eq($ObjectMock2());
  1015. $ctx1.sendIdx["=="]=1;
  1016. $6=self._deny_($7);
  1017. $ctx1.sendIdx["deny:"]=1;
  1018. $9=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1019. $ctx1.sendIdx["=="]=2;
  1020. $8=self._assert_($9);
  1021. $ctx1.sendIdx["assert:"]=1;
  1022. $10=self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1023. $ctx1.sendIdx["assert:"]=2;
  1024. $12=_st($ObjectMock2())._selectors();
  1025. $ctx1.sendIdx["selectors"]=1;
  1026. $13=_st(oldClass)._selectors();
  1027. $11=self._assert_equals_($12,$13);
  1028. $ctx1.sendIdx["assert:equals:"]=1;
  1029. $15=_st($ObjectMock2())._comment();
  1030. $ctx1.sendIdx["comment"]=1;
  1031. $16=_st(oldClass)._comment();
  1032. $14=self._assert_equals_($15,$16);
  1033. $ctx1.sendIdx["assert:equals:"]=2;
  1034. $18=_st(_st($ObjectMock2())._package())._name();
  1035. $ctx1.sendIdx["name"]=1;
  1036. $17=self._assert_equals_($18,"Kernel-Tests");
  1037. $21=_st(instance)._class();
  1038. $ctx1.sendIdx["class"]=1;
  1039. $20=_st($21).__eq_eq($ObjectMock2());
  1040. $19=self._deny_($20);
  1041. $25=_st($Smalltalk())._current();
  1042. $ctx1.sendIdx["current"]=3;
  1043. $27=_st(instance)._class();
  1044. $26=_st($27)._name();
  1045. $24=_st($25)._at_($26);
  1046. $23=_st($24)._isNil();
  1047. $22=self._assert_($23);
  1048. $28=_st($Smalltalk())._current();
  1049. _st($28)._removeClass_($ObjectMock2());
  1050. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  1051. args: [],
  1052. 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",
  1053. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1054. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1055. }),
  1056. smalltalk.ClassBuilderTest);
  1057. smalltalk.addMethod(
  1058. smalltalk.method({
  1059. selector: "testClassMigrationWithClassInstanceVariables",
  1060. category: 'tests',
  1061. fn: function (){
  1062. var self=this;
  1063. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1064. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1065. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1066. return smalltalk.withContext(function($ctx1) {
  1067. var $1,$2,$4,$3,$6,$5,$7;
  1068. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1069. $1=_st($ObjectMock2())._class();
  1070. $ctx1.sendIdx["class"]=1;
  1071. _st($1)._instanceVariableNames_("foo bar");
  1072. $2=$ObjectMock();
  1073. $4=_st($Smalltalk())._current();
  1074. $ctx1.sendIdx["current"]=1;
  1075. $3=_st($4)._at_("ObjectMock2");
  1076. _st($2)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1077. $6=_st($ObjectMock2())._class();
  1078. $5=_st($6)._instanceVariableNames();
  1079. self._assert_equals_($5,["foo", "bar"]);
  1080. $7=_st($Smalltalk())._current();
  1081. _st($7)._removeClass_($ObjectMock2());
  1082. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  1083. args: [],
  1084. 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",
  1085. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1086. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1087. }),
  1088. smalltalk.ClassBuilderTest);
  1089. smalltalk.addMethod(
  1090. smalltalk.method({
  1091. selector: "testClassMigrationWithSubclasses",
  1092. category: 'tests',
  1093. fn: function (){
  1094. var self=this;
  1095. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1096. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1097. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1098. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1099. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1100. return smalltalk.withContext(function($ctx1) {
  1101. var $1,$2,$4,$6,$5,$3,$9,$8,$7,$12,$11,$10,$15,$14,$13,$16;
  1102. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1103. $1=_st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1104. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1105. $2=_st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1106. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1107. $4=$ObjectMock();
  1108. $6=_st($Smalltalk())._current();
  1109. $ctx1.sendIdx["current"]=1;
  1110. $5=_st($6)._at_("ObjectMock2");
  1111. $3=_st($4)._subclass_instanceVariableNames_package_($5,"","Kernel-Tests");
  1112. $9=_st($ObjectMock())._subclasses();
  1113. $ctx1.sendIdx["subclasses"]=1;
  1114. $8=_st($9)._includes_($ObjectMock2());
  1115. $ctx1.sendIdx["includes:"]=1;
  1116. $7=self._assert_($8);
  1117. $ctx1.sendIdx["assert:"]=1;
  1118. $12=_st($ObjectMock2())._subclasses();
  1119. $ctx1.sendIdx["subclasses"]=2;
  1120. $11=_st($12)._includes_($ObjectMock3());
  1121. $ctx1.sendIdx["includes:"]=2;
  1122. $10=self._assert_($11);
  1123. $ctx1.sendIdx["assert:"]=2;
  1124. $15=_st($ObjectMock3())._subclasses();
  1125. $14=_st($15)._includes_($ObjectMock4());
  1126. $13=self._assert_($14);
  1127. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1128. return smalltalk.withContext(function($ctx2) {
  1129. $16=_st($Smalltalk())._current();
  1130. return _st($16)._removeClass_(each);
  1131. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1132. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  1133. args: [],
  1134. 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 ]",
  1135. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1136. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1137. }),
  1138. smalltalk.ClassBuilderTest);
  1139. smalltalk.addMethod(
  1140. smalltalk.method({
  1141. selector: "testInstanceVariableNames",
  1142. category: 'tests',
  1143. fn: function (){
  1144. var self=this;
  1145. return smalltalk.withContext(function($ctx1) {
  1146. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1147. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  1148. args: [],
  1149. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1150. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1151. referencedClasses: []
  1152. }),
  1153. smalltalk.ClassBuilderTest);
  1154. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1155. smalltalk.addMethod(
  1156. smalltalk.method({
  1157. selector: "assertSameContents:as:",
  1158. category: 'convenience',
  1159. fn: function (aCollection,anotherCollection){
  1160. var self=this;
  1161. return smalltalk.withContext(function($ctx1) {
  1162. var $3,$4,$2,$1,$6,$7,$5;
  1163. $3=_st(aCollection)._size();
  1164. $ctx1.sendIdx["size"]=1;
  1165. $4=_st(anotherCollection)._size();
  1166. $2=_st($3).__eq($4);
  1167. $ctx1.sendIdx["="]=1;
  1168. $1=self._assert_($2);
  1169. $ctx1.sendIdx["assert:"]=1;
  1170. _st(aCollection)._do_((function(each){
  1171. return smalltalk.withContext(function($ctx2) {
  1172. $6=_st(aCollection)._occurrencesOf_(each);
  1173. $ctx2.sendIdx["occurrencesOf:"]=1;
  1174. $7=_st(anotherCollection)._occurrencesOf_(each);
  1175. $5=_st($6).__eq($7);
  1176. return self._assert_($5);
  1177. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1178. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  1179. args: ["aCollection", "anotherCollection"],
  1180. 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)) ]",
  1181. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1182. referencedClasses: []
  1183. }),
  1184. smalltalk.CollectionTest);
  1185. smalltalk.addMethod(
  1186. smalltalk.method({
  1187. selector: "collection",
  1188. category: 'accessing',
  1189. fn: function (){
  1190. var self=this;
  1191. return smalltalk.withContext(function($ctx1) {
  1192. var $1;
  1193. $1=_st(self._collectionClass())._withAll_(self._defaultValues());
  1194. return $1;
  1195. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  1196. args: [],
  1197. source: "collection\x0a\x09^ self collectionClass withAll: self defaultValues",
  1198. messageSends: ["withAll:", "collectionClass", "defaultValues"],
  1199. referencedClasses: []
  1200. }),
  1201. smalltalk.CollectionTest);
  1202. smalltalk.addMethod(
  1203. smalltalk.method({
  1204. selector: "collectionClass",
  1205. category: 'accessing',
  1206. fn: function (){
  1207. var self=this;
  1208. return smalltalk.withContext(function($ctx1) {
  1209. var $1;
  1210. $1=_st(self._class())._collectionClass();
  1211. return $1;
  1212. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  1213. args: [],
  1214. source: "collectionClass\x0a\x09^ self class collectionClass",
  1215. messageSends: ["collectionClass", "class"],
  1216. referencedClasses: []
  1217. }),
  1218. smalltalk.CollectionTest);
  1219. smalltalk.addMethod(
  1220. smalltalk.method({
  1221. selector: "collectionWithDuplicates",
  1222. category: 'accessing',
  1223. fn: function (){
  1224. var self=this;
  1225. return smalltalk.withContext(function($ctx1) {
  1226. var $1;
  1227. $1=_st(self._collectionClass())._withAll_(["a", "b", "c", (1), (2), (1), "a"]);
  1228. return $1;
  1229. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1230. args: [],
  1231. source: "collectionWithDuplicates\x0a\x09^ self collectionClass withAll: #('a' 'b' 'c' 1 2 1 'a')",
  1232. messageSends: ["withAll:", "collectionClass"],
  1233. referencedClasses: []
  1234. }),
  1235. smalltalk.CollectionTest);
  1236. smalltalk.addMethod(
  1237. smalltalk.method({
  1238. selector: "defaultValues",
  1239. category: 'accessing',
  1240. fn: function (){
  1241. var self=this;
  1242. return smalltalk.withContext(function($ctx1) {
  1243. var $1;
  1244. $1=[(1), (2), (3), (-4)];
  1245. return $1;
  1246. }, function($ctx1) {$ctx1.fill(self,"defaultValues",{},smalltalk.CollectionTest)})},
  1247. args: [],
  1248. source: "defaultValues\x0a\x09^ #(1 2 3 -4)",
  1249. messageSends: [],
  1250. referencedClasses: []
  1251. }),
  1252. smalltalk.CollectionTest);
  1253. smalltalk.addMethod(
  1254. smalltalk.method({
  1255. selector: "isCollectionReadOnly",
  1256. category: 'testing',
  1257. fn: function (){
  1258. var self=this;
  1259. return smalltalk.withContext(function($ctx1) {
  1260. return false;
  1261. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1262. args: [],
  1263. source: "isCollectionReadOnly\x0a\x09^ false",
  1264. messageSends: [],
  1265. referencedClasses: []
  1266. }),
  1267. smalltalk.CollectionTest);
  1268. smalltalk.addMethod(
  1269. smalltalk.method({
  1270. selector: "testAsArray",
  1271. category: 'tests',
  1272. fn: function (){
  1273. var self=this;
  1274. return smalltalk.withContext(function($ctx1) {
  1275. var $1,$3,$2;
  1276. $1=self._collection();
  1277. $ctx1.sendIdx["collection"]=1;
  1278. $3=self._collection();
  1279. $2=_st($3)._asArray();
  1280. self._assertSameContents_as_($1,$2);
  1281. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1282. args: [],
  1283. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1284. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1285. referencedClasses: []
  1286. }),
  1287. smalltalk.CollectionTest);
  1288. smalltalk.addMethod(
  1289. smalltalk.method({
  1290. selector: "testAsOrderedCollection",
  1291. category: 'tests',
  1292. fn: function (){
  1293. var self=this;
  1294. return smalltalk.withContext(function($ctx1) {
  1295. var $1,$3,$2;
  1296. $1=self._collection();
  1297. $ctx1.sendIdx["collection"]=1;
  1298. $3=self._collection();
  1299. $2=_st($3)._asOrderedCollection();
  1300. self._assertSameContents_as_($1,$2);
  1301. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1302. args: [],
  1303. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1304. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1305. referencedClasses: []
  1306. }),
  1307. smalltalk.CollectionTest);
  1308. smalltalk.addMethod(
  1309. smalltalk.method({
  1310. selector: "testAsSet",
  1311. category: 'tests',
  1312. fn: function (){
  1313. var self=this;
  1314. var c,set;
  1315. return smalltalk.withContext(function($ctx1) {
  1316. c=self._collectionWithDuplicates();
  1317. set=_st(c)._asSet();
  1318. self._assert_equals_(_st(set)._size(),(5));
  1319. _st(c)._do_((function(each){
  1320. return smalltalk.withContext(function($ctx2) {
  1321. return self._assert_(_st(set)._includes_(each));
  1322. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1323. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1324. args: [],
  1325. 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) ]",
  1326. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1327. referencedClasses: []
  1328. }),
  1329. smalltalk.CollectionTest);
  1330. smalltalk.addMethod(
  1331. smalltalk.method({
  1332. selector: "testCollect",
  1333. category: 'tests',
  1334. fn: function (){
  1335. var self=this;
  1336. var newCollection;
  1337. return smalltalk.withContext(function($ctx1) {
  1338. newCollection=[(1), (2), (3), (4)];
  1339. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  1340. return smalltalk.withContext(function($ctx2) {
  1341. return _st(each)._abs();
  1342. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1343. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1344. args: [],
  1345. 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",
  1346. messageSends: ["assertSameContents:as:", "collect:", "collection", "abs"],
  1347. referencedClasses: []
  1348. }),
  1349. smalltalk.CollectionTest);
  1350. smalltalk.addMethod(
  1351. smalltalk.method({
  1352. selector: "testDetect",
  1353. category: 'tests',
  1354. fn: function (){
  1355. var self=this;
  1356. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1357. return smalltalk.withContext(function($ctx1) {
  1358. var $2,$1,$3;
  1359. $2=self._collection();
  1360. $ctx1.sendIdx["collection"]=1;
  1361. $1=_st($2)._detect_((function(each){
  1362. return smalltalk.withContext(function($ctx2) {
  1363. return _st(each).__lt((0));
  1364. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1365. $ctx1.sendIdx["detect:"]=1;
  1366. self._assert_equals_($1,(-4));
  1367. self._should_raise_((function(){
  1368. return smalltalk.withContext(function($ctx2) {
  1369. $3=self._collection();
  1370. return _st($3)._detect_((function(each){
  1371. return smalltalk.withContext(function($ctx3) {
  1372. return _st(each).__eq((6));
  1373. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  1374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  1375. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1376. args: [],
  1377. 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",
  1378. messageSends: ["assert:equals:", "detect:", "collection", "<", "should:raise:", "="],
  1379. referencedClasses: ["Error"]
  1380. }),
  1381. smalltalk.CollectionTest);
  1382. smalltalk.addMethod(
  1383. smalltalk.method({
  1384. selector: "testDo",
  1385. category: 'tests',
  1386. fn: function (){
  1387. var self=this;
  1388. var newCollection;
  1389. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1390. return smalltalk.withContext(function($ctx1) {
  1391. var $1,$2;
  1392. newCollection=_st($OrderedCollection())._new();
  1393. $1=self._collection();
  1394. $ctx1.sendIdx["collection"]=1;
  1395. _st($1)._do_((function(each){
  1396. return smalltalk.withContext(function($ctx2) {
  1397. return _st(newCollection)._add_(each);
  1398. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1399. $2=self._collection();
  1400. self._assertSameContents_as_($2,newCollection);
  1401. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1402. args: [],
  1403. 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",
  1404. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:"],
  1405. referencedClasses: ["OrderedCollection"]
  1406. }),
  1407. smalltalk.CollectionTest);
  1408. smalltalk.addMethod(
  1409. smalltalk.method({
  1410. selector: "testIsEmpty",
  1411. category: 'tests',
  1412. fn: function (){
  1413. var self=this;
  1414. return smalltalk.withContext(function($ctx1) {
  1415. var $1,$2;
  1416. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1417. $ctx1.sendIdx["isEmpty"]=1;
  1418. self._assert_($1);
  1419. $2=_st(self._collection())._isEmpty();
  1420. self._deny_($2);
  1421. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1422. args: [],
  1423. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1424. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1425. referencedClasses: []
  1426. }),
  1427. smalltalk.CollectionTest);
  1428. smalltalk.addMethod(
  1429. smalltalk.method({
  1430. selector: "testSelect",
  1431. category: 'tests',
  1432. fn: function (){
  1433. var self=this;
  1434. var newCollection;
  1435. return smalltalk.withContext(function($ctx1) {
  1436. newCollection=[(2), (-4)];
  1437. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  1438. return smalltalk.withContext(function($ctx2) {
  1439. return _st(each)._even();
  1440. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1441. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1442. args: [],
  1443. 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",
  1444. messageSends: ["assertSameContents:as:", "select:", "collection", "even"],
  1445. referencedClasses: []
  1446. }),
  1447. smalltalk.CollectionTest);
  1448. smalltalk.addMethod(
  1449. smalltalk.method({
  1450. selector: "testSize",
  1451. category: 'tests',
  1452. fn: function (){
  1453. var self=this;
  1454. return smalltalk.withContext(function($ctx1) {
  1455. var $2,$1,$4,$3;
  1456. $2=_st(_st(self._collectionClass())._new())._size();
  1457. $ctx1.sendIdx["size"]=1;
  1458. $1=self._assert_equals_($2,(0));
  1459. $ctx1.sendIdx["assert:equals:"]=1;
  1460. $4=_st(self._collection())._size();
  1461. $3=self._assert_equals_($4,(4));
  1462. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  1463. args: [],
  1464. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self collection size equals: 4",
  1465. messageSends: ["assert:equals:", "size", "new", "collectionClass", "collection"],
  1466. referencedClasses: []
  1467. }),
  1468. smalltalk.CollectionTest);
  1469. smalltalk.addMethod(
  1470. smalltalk.method({
  1471. selector: "collectionClass",
  1472. category: 'accessing',
  1473. fn: function (){
  1474. var self=this;
  1475. return smalltalk.withContext(function($ctx1) {
  1476. return nil;
  1477. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  1478. args: [],
  1479. source: "collectionClass\x0a\x09^ nil",
  1480. messageSends: [],
  1481. referencedClasses: []
  1482. }),
  1483. smalltalk.CollectionTest.klass);
  1484. smalltalk.addMethod(
  1485. smalltalk.method({
  1486. selector: "isAbstract",
  1487. category: 'testing',
  1488. fn: function (){
  1489. var self=this;
  1490. return smalltalk.withContext(function($ctx1) {
  1491. var $1;
  1492. $1=_st(self._collectionClass())._isNil();
  1493. return $1;
  1494. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  1495. args: [],
  1496. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1497. messageSends: ["isNil", "collectionClass"],
  1498. referencedClasses: []
  1499. }),
  1500. smalltalk.CollectionTest.klass);
  1501. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1502. smalltalk.addMethod(
  1503. smalltalk.method({
  1504. selector: "testAt",
  1505. category: 'tests',
  1506. fn: function (){
  1507. var self=this;
  1508. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1509. return smalltalk.withContext(function($ctx1) {
  1510. var $2,$1,$3;
  1511. $2=self._collection();
  1512. $ctx1.sendIdx["collection"]=1;
  1513. $1=_st($2)._at_((4));
  1514. $ctx1.sendIdx["at:"]=1;
  1515. self._assert_equals_($1,(-4));
  1516. self._should_raise_((function(){
  1517. return smalltalk.withContext(function($ctx2) {
  1518. $3=self._collection();
  1519. return _st($3)._at_((5));
  1520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1521. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  1522. args: [],
  1523. source: "testAt\x0a\x09self assert: (self collection at: 4) equals: -4.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1524. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1525. referencedClasses: ["Error"]
  1526. }),
  1527. smalltalk.IndexableCollectionTest);
  1528. smalltalk.addMethod(
  1529. smalltalk.method({
  1530. selector: "testAtIfAbsent",
  1531. category: 'tests',
  1532. fn: function (){
  1533. var self=this;
  1534. return smalltalk.withContext(function($ctx1) {
  1535. var $2,$5,$4,$3,$1;
  1536. $2=self._collection();
  1537. $ctx1.sendIdx["collection"]=1;
  1538. $5=self._collection();
  1539. $4=_st($5)._size();
  1540. $3=_st($4).__plus((1));
  1541. $1=_st($2)._at_ifAbsent_($3,(function(){
  1542. return smalltalk.withContext(function($ctx2) {
  1543. return "none";
  1544. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1545. self._assert_equals_($1,"none");
  1546. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  1547. args: [],
  1548. source: "testAtIfAbsent\x0a\x09self assert: (self collection at: (self collection size + 1) ifAbsent: [ 'none' ]) equals: 'none'",
  1549. messageSends: ["assert:equals:", "at:ifAbsent:", "collection", "+", "size"],
  1550. referencedClasses: []
  1551. }),
  1552. smalltalk.IndexableCollectionTest);
  1553. smalltalk.addMethod(
  1554. smalltalk.method({
  1555. selector: "testContains",
  1556. category: 'tests',
  1557. fn: function (){
  1558. var self=this;
  1559. var collection;
  1560. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1561. return smalltalk.withContext(function($ctx1) {
  1562. var $2,$3,$5,$4,$1,$7,$6;
  1563. collection=self._collection();
  1564. $ctx1.sendIdx["collection"]=1;
  1565. $2=self._collection();
  1566. $ctx1.sendIdx["collection"]=2;
  1567. $1=_st($2)._contains_((function(each){
  1568. return smalltalk.withContext(function($ctx2) {
  1569. $3=each;
  1570. $5=self._collection();
  1571. $ctx2.sendIdx["collection"]=3;
  1572. $4=_st($5)._first();
  1573. return _st($3).__eq($4);
  1574. $ctx2.sendIdx["="]=1;
  1575. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1576. $ctx1.sendIdx["contains:"]=1;
  1577. self._assert_($1);
  1578. $7=self._collection();
  1579. $6=_st($7)._contains_((function(each){
  1580. return smalltalk.withContext(function($ctx2) {
  1581. return _st(each).__eq(_st($Object())._new());
  1582. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1583. self._deny_($6);
  1584. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1585. args: [],
  1586. 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 ])",
  1587. messageSends: ["collection", "assert:", "contains:", "=", "first", "deny:", "new"],
  1588. referencedClasses: ["Object"]
  1589. }),
  1590. smalltalk.IndexableCollectionTest);
  1591. smalltalk.addMethod(
  1592. smalltalk.method({
  1593. selector: "testIndexOf",
  1594. category: 'tests',
  1595. fn: function (){
  1596. var self=this;
  1597. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1598. return smalltalk.withContext(function($ctx1) {
  1599. var $3,$2,$1,$4,$7,$6,$5;
  1600. $3=self._collection();
  1601. $ctx1.sendIdx["collection"]=1;
  1602. $2=_st($3)._indexOf_((2));
  1603. $ctx1.sendIdx["indexOf:"]=1;
  1604. $1=self._assert_equals_($2,(2));
  1605. $ctx1.sendIdx["assert:equals:"]=1;
  1606. self._should_raise_((function(){
  1607. return smalltalk.withContext(function($ctx2) {
  1608. $4=self._collection();
  1609. $ctx2.sendIdx["collection"]=2;
  1610. return _st($4)._indexOf_((999));
  1611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1612. $7=self._collection();
  1613. $6=_st($7)._indexOf_ifAbsent_((999),(function(){
  1614. return smalltalk.withContext(function($ctx2) {
  1615. return "sentinel";
  1616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1617. $5=self._assert_equals_($6,"sentinel");
  1618. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  1619. args: [],
  1620. 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'",
  1621. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1622. referencedClasses: ["Error"]
  1623. }),
  1624. smalltalk.IndexableCollectionTest);
  1625. smalltalk.addMethod(
  1626. smalltalk.method({
  1627. selector: "testWithIndexDo",
  1628. category: 'tests',
  1629. fn: function (){
  1630. var self=this;
  1631. var collection;
  1632. return smalltalk.withContext(function($ctx1) {
  1633. var $1;
  1634. collection=self._collection();
  1635. $ctx1.sendIdx["collection"]=1;
  1636. $1=self._collection();
  1637. _st($1)._withIndexDo_((function(each,index){
  1638. return smalltalk.withContext(function($ctx2) {
  1639. return self._assert_equals_(_st(collection)._at_(index),each);
  1640. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  1641. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  1642. args: [],
  1643. 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 ]",
  1644. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  1645. referencedClasses: []
  1646. }),
  1647. smalltalk.IndexableCollectionTest);
  1648. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  1649. smalltalk.addMethod(
  1650. smalltalk.method({
  1651. selector: "collection",
  1652. category: 'accessing',
  1653. fn: function (){
  1654. var self=this;
  1655. return smalltalk.withContext(function($ctx1) {
  1656. var $2,$3,$4,$5,$1;
  1657. $2="b".__minus_gt((1));
  1658. $ctx1.sendIdx["->"]=1;
  1659. $3="a".__minus_gt((2));
  1660. $ctx1.sendIdx["->"]=2;
  1661. $4="c".__minus_gt((3));
  1662. $ctx1.sendIdx["->"]=3;
  1663. $5="d".__minus_gt((-4));
  1664. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5]);
  1665. return $1;
  1666. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  1667. args: [],
  1668. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  1669. messageSends: ["->"],
  1670. referencedClasses: []
  1671. }),
  1672. smalltalk.HashedCollectionTest);
  1673. smalltalk.addMethod(
  1674. smalltalk.method({
  1675. selector: "collectionWithDuplicates",
  1676. category: 'accessing',
  1677. fn: function (){
  1678. var self=this;
  1679. return smalltalk.withContext(function($ctx1) {
  1680. var $2,$3,$4,$5,$6,$7,$8,$1;
  1681. $2="b".__minus_gt((1));
  1682. $ctx1.sendIdx["->"]=1;
  1683. $3="a".__minus_gt((2));
  1684. $ctx1.sendIdx["->"]=2;
  1685. $4="c".__minus_gt((3));
  1686. $ctx1.sendIdx["->"]=3;
  1687. $5="d".__minus_gt((-4));
  1688. $ctx1.sendIdx["->"]=4;
  1689. $6="e".__minus_gt((1));
  1690. $ctx1.sendIdx["->"]=5;
  1691. $7="f".__minus_gt((2));
  1692. $ctx1.sendIdx["->"]=6;
  1693. $8="g".__minus_gt((10));
  1694. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,$8]);
  1695. return $1;
  1696. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  1697. args: [],
  1698. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  1699. messageSends: ["->"],
  1700. referencedClasses: []
  1701. }),
  1702. smalltalk.HashedCollectionTest);
  1703. smalltalk.addMethod(
  1704. smalltalk.method({
  1705. selector: "testAsDictionary",
  1706. category: 'tests',
  1707. fn: function (){
  1708. var self=this;
  1709. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1710. return smalltalk.withContext(function($ctx1) {
  1711. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  1712. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  1713. args: [],
  1714. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  1715. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  1716. referencedClasses: ["Dictionary"]
  1717. }),
  1718. smalltalk.HashedCollectionTest);
  1719. smalltalk.addMethod(
  1720. smalltalk.method({
  1721. selector: "testAt",
  1722. category: 'tests',
  1723. fn: function (){
  1724. var self=this;
  1725. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1726. return smalltalk.withContext(function($ctx1) {
  1727. var $2,$1,$3;
  1728. $2=self._collection();
  1729. $ctx1.sendIdx["collection"]=1;
  1730. $1=_st($2)._at_("a");
  1731. $ctx1.sendIdx["at:"]=1;
  1732. self._assert_equals_($1,(2));
  1733. self._should_raise_((function(){
  1734. return smalltalk.withContext(function($ctx2) {
  1735. $3=self._collection();
  1736. return _st($3)._at_((5));
  1737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1738. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.HashedCollectionTest)})},
  1739. args: [],
  1740. source: "testAt\x0a\x09self assert: (self collection at: 'a') equals: 2.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
  1741. messageSends: ["assert:equals:", "at:", "collection", "should:raise:"],
  1742. referencedClasses: ["Error"]
  1743. }),
  1744. smalltalk.HashedCollectionTest);
  1745. smalltalk.addMethod(
  1746. smalltalk.method({
  1747. selector: "testContains",
  1748. category: 'tests',
  1749. fn: function (){
  1750. var self=this;
  1751. var collection;
  1752. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1753. return smalltalk.withContext(function($ctx1) {
  1754. var $2,$3,$6,$5,$4,$1,$8,$7;
  1755. collection=self._collection();
  1756. $ctx1.sendIdx["collection"]=1;
  1757. $2=self._collection();
  1758. $ctx1.sendIdx["collection"]=2;
  1759. $1=_st($2)._contains_((function(each){
  1760. return smalltalk.withContext(function($ctx2) {
  1761. $3=each;
  1762. $6=self._collection();
  1763. $ctx2.sendIdx["collection"]=3;
  1764. $5=_st($6)._values();
  1765. $4=_st($5)._first();
  1766. return _st($3).__eq($4);
  1767. $ctx2.sendIdx["="]=1;
  1768. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1769. $ctx1.sendIdx["contains:"]=1;
  1770. self._assert_($1);
  1771. $8=self._collection();
  1772. $7=_st($8)._contains_((function(each){
  1773. return smalltalk.withContext(function($ctx2) {
  1774. return _st(each).__eq(_st($Object())._new());
  1775. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1776. self._deny_($7);
  1777. return self}, function($ctx1) {$ctx1.fill(self,"testContains",{collection:collection},smalltalk.HashedCollectionTest)})},
  1778. args: [],
  1779. 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 ])",
  1780. messageSends: ["collection", "assert:", "contains:", "=", "first", "values", "deny:", "new"],
  1781. referencedClasses: ["Object"]
  1782. }),
  1783. smalltalk.HashedCollectionTest);
  1784. smalltalk.addMethod(
  1785. smalltalk.method({
  1786. selector: "testFrom",
  1787. category: 'tests',
  1788. fn: function (){
  1789. var self=this;
  1790. var associations;
  1791. return smalltalk.withContext(function($ctx1) {
  1792. var $1,$2,$3,$5,$6,$4;
  1793. $1="a".__minus_gt((1));
  1794. $ctx1.sendIdx["->"]=1;
  1795. $2="b".__minus_gt((2));
  1796. $ctx1.sendIdx["->"]=2;
  1797. associations=[$1,$2];
  1798. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  1799. $5="a".__minus_gt((1));
  1800. $ctx1.sendIdx["->"]=3;
  1801. $6="b".__minus_gt((2));
  1802. $4=smalltalk.HashedCollection._from_([$5,$6]);
  1803. self._assertSameContents_as_($3,$4);
  1804. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  1805. args: [],
  1806. 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 }.",
  1807. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  1808. referencedClasses: []
  1809. }),
  1810. smalltalk.HashedCollectionTest);
  1811. smalltalk.addMethod(
  1812. smalltalk.method({
  1813. selector: "testIndexOf",
  1814. category: 'tests',
  1815. fn: function (){
  1816. var self=this;
  1817. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1818. return smalltalk.withContext(function($ctx1) {
  1819. var $3,$2,$1,$4,$7,$6,$5;
  1820. $3=self._collection();
  1821. $ctx1.sendIdx["collection"]=1;
  1822. $2=_st($3)._indexOf_((2));
  1823. $ctx1.sendIdx["indexOf:"]=1;
  1824. $1=self._assert_equals_($2,"a");
  1825. $ctx1.sendIdx["assert:equals:"]=1;
  1826. self._should_raise_((function(){
  1827. return smalltalk.withContext(function($ctx2) {
  1828. $4=self._collection();
  1829. $ctx2.sendIdx["collection"]=2;
  1830. return _st($4)._indexOf_((999));
  1831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1832. $7=self._collection();
  1833. $6=_st($7)._indexOf_ifAbsent_((999),(function(){
  1834. return smalltalk.withContext(function($ctx2) {
  1835. return "sentinel";
  1836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1837. $5=self._assert_equals_($6,"sentinel");
  1838. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.HashedCollectionTest)})},
  1839. args: [],
  1840. 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'",
  1841. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  1842. referencedClasses: ["Error"]
  1843. }),
  1844. smalltalk.HashedCollectionTest);
  1845. smalltalk.addMethod(
  1846. smalltalk.method({
  1847. selector: "testNewFromPairs",
  1848. category: 'tests',
  1849. fn: function (){
  1850. var self=this;
  1851. var flattenedAssociations;
  1852. return smalltalk.withContext(function($ctx1) {
  1853. var $1,$3,$4,$2;
  1854. flattenedAssociations=["a",(1),"b",(2)];
  1855. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  1856. $3="a".__minus_gt((1));
  1857. $ctx1.sendIdx["->"]=1;
  1858. $4="b".__minus_gt((2));
  1859. $2=smalltalk.HashedCollection._from_([$3,$4]);
  1860. self._assertSameContents_as_($1,$2);
  1861. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  1862. args: [],
  1863. 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 }.",
  1864. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  1865. referencedClasses: []
  1866. }),
  1867. smalltalk.HashedCollectionTest);
  1868. smalltalk.addMethod(
  1869. smalltalk.method({
  1870. selector: "collectionClass",
  1871. category: 'accessing',
  1872. fn: function (){
  1873. var self=this;
  1874. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1875. return smalltalk.withContext(function($ctx1) {
  1876. var $1;
  1877. $1=$HashedCollection();
  1878. return $1;
  1879. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  1880. args: [],
  1881. source: "collectionClass\x0a\x09^ HashedCollection",
  1882. messageSends: [],
  1883. referencedClasses: ["HashedCollection"]
  1884. }),
  1885. smalltalk.HashedCollectionTest.klass);
  1886. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  1887. smalltalk.addMethod(
  1888. smalltalk.method({
  1889. selector: "collection",
  1890. category: 'accessing',
  1891. fn: function (){
  1892. var self=this;
  1893. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1894. return smalltalk.withContext(function($ctx1) {
  1895. var $2,$3,$1;
  1896. $2=_st($Dictionary())._new();
  1897. _st($2)._at_put_((1),(1));
  1898. $ctx1.sendIdx["at:put:"]=1;
  1899. _st($2)._at_put_("a",(2));
  1900. $ctx1.sendIdx["at:put:"]=2;
  1901. _st($2)._at_put_(true,(3));
  1902. $ctx1.sendIdx["at:put:"]=3;
  1903. _st($2)._at_put_((4),(-4));
  1904. $3=_st($2)._yourself();
  1905. $1=$3;
  1906. return $1;
  1907. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  1908. args: [],
  1909. 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",
  1910. messageSends: ["at:put:", "new", "yourself"],
  1911. referencedClasses: ["Dictionary"]
  1912. }),
  1913. smalltalk.DictionaryTest);
  1914. smalltalk.addMethod(
  1915. smalltalk.method({
  1916. selector: "collectionWithDuplicates",
  1917. category: 'accessing',
  1918. fn: function (){
  1919. var self=this;
  1920. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1921. return smalltalk.withContext(function($ctx1) {
  1922. var $2,$3,$1;
  1923. $2=_st($Dictionary())._new();
  1924. _st($2)._at_put_((1),(1));
  1925. $ctx1.sendIdx["at:put:"]=1;
  1926. _st($2)._at_put_("a",(2));
  1927. $ctx1.sendIdx["at:put:"]=2;
  1928. _st($2)._at_put_(true,(3));
  1929. $ctx1.sendIdx["at:put:"]=3;
  1930. _st($2)._at_put_((4),(-4));
  1931. $ctx1.sendIdx["at:put:"]=4;
  1932. _st($2)._at_put_("b",(1));
  1933. $ctx1.sendIdx["at:put:"]=5;
  1934. _st($2)._at_put_((3),(3));
  1935. $ctx1.sendIdx["at:put:"]=6;
  1936. _st($2)._at_put_(false,(12));
  1937. $3=_st($2)._yourself();
  1938. $1=$3;
  1939. return $1;
  1940. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  1941. args: [],
  1942. 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",
  1943. messageSends: ["at:put:", "new", "yourself"],
  1944. referencedClasses: ["Dictionary"]
  1945. }),
  1946. smalltalk.DictionaryTest);
  1947. smalltalk.addMethod(
  1948. smalltalk.method({
  1949. selector: "testAccessing",
  1950. category: 'tests',
  1951. fn: function (){
  1952. var self=this;
  1953. var d;
  1954. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1955. return smalltalk.withContext(function($ctx1) {
  1956. var $1,$3,$2,$5,$4,$8,$7,$6,$10,$9,$12,$11,$13,$15,$14,$17,$18,$16,$21,$22,$20,$19,$25,$26,$24,$23,$29,$30,$28,$27;
  1957. d=_st($Dictionary())._new();
  1958. $1=_st(d)._at_put_("hello","world");
  1959. $ctx1.sendIdx["at:put:"]=1;
  1960. $3=_st(d)._at_("hello");
  1961. $ctx1.sendIdx["at:"]=1;
  1962. $2=self._assert_equals_($3,"world");
  1963. $ctx1.sendIdx["assert:equals:"]=1;
  1964. $5=_st(d)._at_ifAbsent_("hello",(function(){
  1965. return smalltalk.withContext(function($ctx2) {
  1966. return nil;
  1967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1968. $ctx1.sendIdx["at:ifAbsent:"]=1;
  1969. $4=self._assert_equals_($5,"world");
  1970. $ctx1.sendIdx["assert:equals:"]=2;
  1971. $8=_st(d)._at_ifAbsent_("foo",(function(){
  1972. return smalltalk.withContext(function($ctx2) {
  1973. return nil;
  1974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1975. $7=_st($8).__eq("world");
  1976. $6=self._deny_($7);
  1977. $ctx1.sendIdx["deny:"]=1;
  1978. $10=_st(d)._includesKey_("hello");
  1979. $ctx1.sendIdx["includesKey:"]=1;
  1980. $9=self._assert_($10);
  1981. $ctx1.sendIdx["assert:"]=1;
  1982. $12=_st(d)._includesKey_("foo");
  1983. $ctx1.sendIdx["includesKey:"]=2;
  1984. $11=self._deny_($12);
  1985. $ctx1.sendIdx["deny:"]=2;
  1986. $13=_st(d)._at_put_((1),(2));
  1987. $ctx1.sendIdx["at:put:"]=2;
  1988. $15=_st(d)._at_((1));
  1989. $ctx1.sendIdx["at:"]=2;
  1990. $14=self._assert_equals_($15,(2));
  1991. $ctx1.sendIdx["assert:equals:"]=3;
  1992. $17=d;
  1993. $18=(1).__at((3));
  1994. $ctx1.sendIdx["@"]=1;
  1995. $16=_st($17)._at_put_($18,(3));
  1996. $21=d;
  1997. $22=(1).__at((3));
  1998. $ctx1.sendIdx["@"]=2;
  1999. $20=_st($21)._at_($22);
  2000. $19=self._assert_equals_($20,(3));
  2001. $25=d;
  2002. $26=(1).__at((3));
  2003. $ctx1.sendIdx["@"]=3;
  2004. $24=_st($25)._includesKey_($26);
  2005. $ctx1.sendIdx["includesKey:"]=3;
  2006. $23=self._assert_($24);
  2007. $29=d;
  2008. $30=(3).__at((1));
  2009. $28=_st($29)._includesKey_($30);
  2010. $27=self._deny_($28);
  2011. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  2012. args: [],
  2013. 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)",
  2014. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  2015. referencedClasses: ["Dictionary"]
  2016. }),
  2017. smalltalk.DictionaryTest);
  2018. smalltalk.addMethod(
  2019. smalltalk.method({
  2020. selector: "testAsHashedCollection",
  2021. category: 'tests',
  2022. fn: function (){
  2023. var self=this;
  2024. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2025. return smalltalk.withContext(function($ctx1) {
  2026. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2027. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  2028. args: [],
  2029. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2030. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2031. referencedClasses: ["HashedCollection"]
  2032. }),
  2033. smalltalk.DictionaryTest);
  2034. smalltalk.addMethod(
  2035. smalltalk.method({
  2036. selector: "testDynamicDictionaries",
  2037. category: 'tests',
  2038. fn: function (){
  2039. var self=this;
  2040. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2041. return smalltalk.withContext(function($ctx1) {
  2042. var $3,$2,$1,$5,$6,$4;
  2043. $3="hello".__minus_gt((1));
  2044. $ctx1.sendIdx["->"]=1;
  2045. $2=smalltalk.HashedCollection._from_([$3]);
  2046. $1=_st($2)._asDictionary();
  2047. $5=$Dictionary();
  2048. $6="hello".__minus_gt((1));
  2049. $4=_st($5)._with_($6);
  2050. self._assert_equals_($1,$4);
  2051. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  2052. args: [],
  2053. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  2054. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  2055. referencedClasses: ["Dictionary"]
  2056. }),
  2057. smalltalk.DictionaryTest);
  2058. smalltalk.addMethod(
  2059. smalltalk.method({
  2060. selector: "testEquality",
  2061. category: 'tests',
  2062. fn: function (){
  2063. var self=this;
  2064. var d1,d2;
  2065. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2066. return smalltalk.withContext(function($ctx1) {
  2067. var $3,$4,$2,$1,$5,$6,$7,$8,$10,$9,$11,$12,$14,$13,$15,$16,$18,$17,$19,$20,$22,$21;
  2068. $3=_st($Dictionary())._new();
  2069. $ctx1.sendIdx["new"]=1;
  2070. $4=_st($Dictionary())._new();
  2071. $ctx1.sendIdx["new"]=2;
  2072. $2=_st($3).__eq($4);
  2073. $ctx1.sendIdx["="]=1;
  2074. $1=self._assert_($2);
  2075. $ctx1.sendIdx["assert:"]=1;
  2076. $5=_st($Dictionary())._new();
  2077. $ctx1.sendIdx["new"]=3;
  2078. _st($5)._at_put_((1),(2));
  2079. $ctx1.sendIdx["at:put:"]=1;
  2080. $6=_st($5)._yourself();
  2081. $ctx1.sendIdx["yourself"]=1;
  2082. d1=$6;
  2083. $7=_st($Dictionary())._new();
  2084. $ctx1.sendIdx["new"]=4;
  2085. _st($7)._at_put_((1),(2));
  2086. $ctx1.sendIdx["at:put:"]=2;
  2087. $8=_st($7)._yourself();
  2088. $ctx1.sendIdx["yourself"]=2;
  2089. d2=$8;
  2090. $10=_st(d1).__eq(d2);
  2091. $ctx1.sendIdx["="]=2;
  2092. $9=self._assert_($10);
  2093. $11=_st($Dictionary())._new();
  2094. $ctx1.sendIdx["new"]=5;
  2095. _st($11)._at_put_((1),(3));
  2096. $ctx1.sendIdx["at:put:"]=3;
  2097. $12=_st($11)._yourself();
  2098. $ctx1.sendIdx["yourself"]=3;
  2099. d2=$12;
  2100. $14=_st(d1).__eq(d2);
  2101. $ctx1.sendIdx["="]=3;
  2102. $13=self._deny_($14);
  2103. $ctx1.sendIdx["deny:"]=1;
  2104. $15=_st($Dictionary())._new();
  2105. $ctx1.sendIdx["new"]=6;
  2106. _st($15)._at_put_((2),(2));
  2107. $ctx1.sendIdx["at:put:"]=4;
  2108. $16=_st($15)._yourself();
  2109. $ctx1.sendIdx["yourself"]=4;
  2110. d2=$16;
  2111. $18=_st(d1).__eq(d2);
  2112. $ctx1.sendIdx["="]=4;
  2113. $17=self._deny_($18);
  2114. $ctx1.sendIdx["deny:"]=2;
  2115. $19=_st($Dictionary())._new();
  2116. _st($19)._at_put_((1),(2));
  2117. $ctx1.sendIdx["at:put:"]=5;
  2118. _st($19)._at_put_((3),(4));
  2119. $20=_st($19)._yourself();
  2120. d2=$20;
  2121. $22=_st(d1).__eq(d2);
  2122. $21=self._deny_($22);
  2123. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  2124. args: [],
  2125. 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.",
  2126. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  2127. referencedClasses: ["Dictionary"]
  2128. }),
  2129. smalltalk.DictionaryTest);
  2130. smalltalk.addMethod(
  2131. smalltalk.method({
  2132. selector: "testIfAbsent",
  2133. category: 'tests',
  2134. fn: function (){
  2135. var self=this;
  2136. var d,visited;
  2137. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2138. return smalltalk.withContext(function($ctx1) {
  2139. visited=false;
  2140. d=_st($Dictionary())._new();
  2141. _st(d)._at_ifAbsent_("hello",(function(){
  2142. return smalltalk.withContext(function($ctx2) {
  2143. visited=true;
  2144. return visited;
  2145. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2146. self._assert_(visited);
  2147. return self}, function($ctx1) {$ctx1.fill(self,"testIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  2148. args: [],
  2149. 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.",
  2150. messageSends: ["new", "at:ifAbsent:", "assert:"],
  2151. referencedClasses: ["Dictionary"]
  2152. }),
  2153. smalltalk.DictionaryTest);
  2154. smalltalk.addMethod(
  2155. smalltalk.method({
  2156. selector: "testIfPresent",
  2157. category: 'tests',
  2158. fn: function (){
  2159. var self=this;
  2160. var d,visited,absent;
  2161. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2162. return smalltalk.withContext(function($ctx1) {
  2163. var $1;
  2164. visited=false;
  2165. d=_st($Dictionary())._new();
  2166. _st(d)._at_put_("hello","world");
  2167. $1=_st(d)._at_ifPresent_("hello",(function(value){
  2168. return smalltalk.withContext(function($ctx2) {
  2169. visited=value;
  2170. return visited;
  2171. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}));
  2172. $ctx1.sendIdx["at:ifPresent:"]=1;
  2173. self._assert_equals_(visited,"world");
  2174. absent=_st(d)._at_ifPresent_("bye",(function(value){
  2175. return smalltalk.withContext(function($ctx2) {
  2176. visited=value;
  2177. return visited;
  2178. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,2)})}));
  2179. self._assert_(_st(absent)._isNil());
  2180. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresent",{d:d,visited:visited,absent:absent},smalltalk.DictionaryTest)})},
  2181. args: [],
  2182. 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.",
  2183. messageSends: ["new", "at:put:", "at:ifPresent:", "assert:equals:", "assert:", "isNil"],
  2184. referencedClasses: ["Dictionary"]
  2185. }),
  2186. smalltalk.DictionaryTest);
  2187. smalltalk.addMethod(
  2188. smalltalk.method({
  2189. selector: "testIfPresentIfAbsent",
  2190. category: 'tests',
  2191. fn: function (){
  2192. var self=this;
  2193. var d,visited;
  2194. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2195. return smalltalk.withContext(function($ctx1) {
  2196. var $1,$2;
  2197. visited=false;
  2198. d=_st($Dictionary())._new();
  2199. _st(d)._at_put_("hello","world");
  2200. $1=_st(d)._at_ifPresent_ifAbsent_("hello",(function(value){
  2201. return smalltalk.withContext(function($ctx2) {
  2202. visited=value;
  2203. return visited;
  2204. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}),(function(){
  2205. return smalltalk.withContext(function($ctx2) {
  2206. visited=true;
  2207. return visited;
  2208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2209. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2210. self._assert_equals_(visited,"world");
  2211. $2=_st(d)._at_ifPresent_ifAbsent_("buy",(function(value){
  2212. return smalltalk.withContext(function($ctx2) {
  2213. visited=value;
  2214. return visited;
  2215. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,3)})}),(function(){
  2216. return smalltalk.withContext(function($ctx2) {
  2217. visited=true;
  2218. return visited;
  2219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  2220. self._assert_(visited);
  2221. return self}, function($ctx1) {$ctx1.fill(self,"testIfPresentIfAbsent",{d:d,visited:visited},smalltalk.DictionaryTest)})},
  2222. args: [],
  2223. 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.",
  2224. messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:equals:", "assert:"],
  2225. referencedClasses: ["Dictionary"]
  2226. }),
  2227. smalltalk.DictionaryTest);
  2228. smalltalk.addMethod(
  2229. smalltalk.method({
  2230. selector: "testKeys",
  2231. category: 'tests',
  2232. fn: function (){
  2233. var self=this;
  2234. var d;
  2235. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2236. return smalltalk.withContext(function($ctx1) {
  2237. var $1,$2,$3;
  2238. d=_st($Dictionary())._new();
  2239. $1=_st(d)._at_put_((1),(2));
  2240. $ctx1.sendIdx["at:put:"]=1;
  2241. $2=_st(d)._at_put_((2),(3));
  2242. $ctx1.sendIdx["at:put:"]=2;
  2243. $3=_st(d)._at_put_((3),(4));
  2244. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  2245. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  2246. args: [],
  2247. 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)",
  2248. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  2249. referencedClasses: ["Dictionary"]
  2250. }),
  2251. smalltalk.DictionaryTest);
  2252. smalltalk.addMethod(
  2253. smalltalk.method({
  2254. selector: "testPointKey",
  2255. category: 'tests',
  2256. fn: function (){
  2257. var self=this;
  2258. var d;
  2259. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2260. return smalltalk.withContext(function($ctx1) {
  2261. var $2,$3,$1,$6,$7,$5,$4,$9,$10,$8,$13,$14,$12,$11,$15,$16,$19,$20,$18,$17,$22,$23,$21;
  2262. d=_st($Dictionary())._new();
  2263. $2=d;
  2264. $3=(1).__at((1));
  2265. $ctx1.sendIdx["@"]=1;
  2266. $1=_st($2)._at_put_($3,"foo");
  2267. $ctx1.sendIdx["at:put:"]=1;
  2268. $6=d;
  2269. $7=(1).__at((1));
  2270. $ctx1.sendIdx["@"]=2;
  2271. $5=_st($6)._at_($7);
  2272. $ctx1.sendIdx["at:"]=1;
  2273. $4=self._assert_equals_($5,"foo");
  2274. $ctx1.sendIdx["assert:equals:"]=1;
  2275. $9=d;
  2276. $10=(1).__at((1));
  2277. $ctx1.sendIdx["@"]=3;
  2278. $8=_st($9)._at_put_($10,"bar");
  2279. $13=d;
  2280. $14=(1).__at((1));
  2281. $ctx1.sendIdx["@"]=4;
  2282. $12=_st($13)._at_($14);
  2283. $11=self._assert_equals_($12,"bar");
  2284. $ctx1.sendIdx["assert:equals:"]=2;
  2285. $15=d;
  2286. $16=(1).__at((1));
  2287. $ctx1.sendIdx["@"]=5;
  2288. _st($15)._removeKey_($16);
  2289. $19=d;
  2290. $20=(1).__at((1));
  2291. $ctx1.sendIdx["@"]=6;
  2292. $18=_st($19)._at_ifAbsent_($20,(function(){
  2293. return smalltalk.withContext(function($ctx2) {
  2294. return "baz";
  2295. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2296. $17=self._assert_equals_($18,"baz");
  2297. $22=d;
  2298. $23=(1).__at((1));
  2299. $21=_st($22)._includesKey_($23);
  2300. self._deny_($21);
  2301. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  2302. args: [],
  2303. 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)",
  2304. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  2305. referencedClasses: ["Dictionary"]
  2306. }),
  2307. smalltalk.DictionaryTest);
  2308. smalltalk.addMethod(
  2309. smalltalk.method({
  2310. selector: "testPrintString",
  2311. category: 'tests',
  2312. fn: function (){
  2313. var self=this;
  2314. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2315. return smalltalk.withContext(function($ctx1) {
  2316. var $2,$3,$1;
  2317. $2=_st($Dictionary())._new();
  2318. _st($2)._at_put_("firstname","James");
  2319. $ctx1.sendIdx["at:put:"]=1;
  2320. _st($2)._at_put_("lastname","Bond");
  2321. $3=_st($2)._printString();
  2322. $1=$3;
  2323. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2324. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  2325. args: [],
  2326. 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'')'",
  2327. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  2328. referencedClasses: ["Dictionary"]
  2329. }),
  2330. smalltalk.DictionaryTest);
  2331. smalltalk.addMethod(
  2332. smalltalk.method({
  2333. selector: "testRemoveKey",
  2334. category: 'tests',
  2335. fn: function (){
  2336. var self=this;
  2337. var d,key;
  2338. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2339. return smalltalk.withContext(function($ctx1) {
  2340. var $1,$2,$3,$5,$4,$7,$6,$8;
  2341. d=_st($Dictionary())._new();
  2342. $1=_st(d)._at_put_((1),(2));
  2343. $ctx1.sendIdx["at:put:"]=1;
  2344. $2=_st(d)._at_put_((2),(3));
  2345. $ctx1.sendIdx["at:put:"]=2;
  2346. $3=_st(d)._at_put_((3),(4));
  2347. key=(2);
  2348. $5=_st(d)._keys();
  2349. $ctx1.sendIdx["keys"]=1;
  2350. $4=self._assert_equals_($5,[(1), (2), (3)]);
  2351. $ctx1.sendIdx["assert:equals:"]=1;
  2352. _st(d)._removeKey_(key);
  2353. $7=_st(d)._keys();
  2354. $6=self._assert_equals_($7,[(1), (3)]);
  2355. $ctx1.sendIdx["assert:equals:"]=2;
  2356. $8=self._assert_equals_(_st(d)._values(),[(2), (4)]);
  2357. self._deny_(_st(d)._includesKey_((2)));
  2358. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  2359. args: [],
  2360. 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)",
  2361. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  2362. referencedClasses: ["Dictionary"]
  2363. }),
  2364. smalltalk.DictionaryTest);
  2365. smalltalk.addMethod(
  2366. smalltalk.method({
  2367. selector: "testRemoveKeyIfAbsent",
  2368. category: 'tests',
  2369. fn: function (){
  2370. var self=this;
  2371. var d,key;
  2372. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2373. return smalltalk.withContext(function($ctx1) {
  2374. var $1,$2,$3,$4,$6,$5,$8,$7;
  2375. d=_st($Dictionary())._new();
  2376. $1=_st(d)._at_put_((1),(2));
  2377. $ctx1.sendIdx["at:put:"]=1;
  2378. $2=_st(d)._at_put_((2),(3));
  2379. $ctx1.sendIdx["at:put:"]=2;
  2380. $3=_st(d)._at_put_((3),(4));
  2381. key=(2);
  2382. $4=self._assert_equals_(_st(d)._removeKey_(key),(3));
  2383. $ctx1.sendIdx["assert:equals:"]=1;
  2384. key=(3);
  2385. $6=_st(d)._removeKey_ifAbsent_(key,(function(){
  2386. return smalltalk.withContext(function($ctx2) {
  2387. return (42);
  2388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2389. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  2390. $5=self._assert_equals_($6,(4));
  2391. $ctx1.sendIdx["assert:equals:"]=2;
  2392. key="why";
  2393. $8=_st(d)._removeKey_ifAbsent_(key,(function(){
  2394. return smalltalk.withContext(function($ctx2) {
  2395. return (42);
  2396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2397. $7=self._assert_equals_($8,(42));
  2398. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  2399. args: [],
  2400. 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.",
  2401. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  2402. referencedClasses: ["Dictionary"]
  2403. }),
  2404. smalltalk.DictionaryTest);
  2405. smalltalk.addMethod(
  2406. smalltalk.method({
  2407. selector: "testSize",
  2408. category: 'tests',
  2409. fn: function (){
  2410. var self=this;
  2411. var d;
  2412. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2413. return smalltalk.withContext(function($ctx1) {
  2414. var $2,$1,$3,$5,$4,$6,$8,$7;
  2415. d=_st($Dictionary())._new();
  2416. $2=_st(d)._size();
  2417. $ctx1.sendIdx["size"]=1;
  2418. $1=self._assert_equals_($2,(0));
  2419. $ctx1.sendIdx["assert:equals:"]=1;
  2420. $3=_st(d)._at_put_((1),(2));
  2421. $ctx1.sendIdx["at:put:"]=1;
  2422. $5=_st(d)._size();
  2423. $ctx1.sendIdx["size"]=2;
  2424. $4=self._assert_equals_($5,(1));
  2425. $ctx1.sendIdx["assert:equals:"]=2;
  2426. $6=_st(d)._at_put_((2),(3));
  2427. $8=_st(d)._size();
  2428. $7=self._assert_equals_($8,(2));
  2429. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{d:d},smalltalk.DictionaryTest)})},
  2430. args: [],
  2431. 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.",
  2432. messageSends: ["new", "assert:equals:", "size", "at:put:"],
  2433. referencedClasses: ["Dictionary"]
  2434. }),
  2435. smalltalk.DictionaryTest);
  2436. smalltalk.addMethod(
  2437. smalltalk.method({
  2438. selector: "testValues",
  2439. category: 'tests',
  2440. fn: function (){
  2441. var self=this;
  2442. var d;
  2443. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2444. return smalltalk.withContext(function($ctx1) {
  2445. var $1,$2,$3;
  2446. d=_st($Dictionary())._new();
  2447. $1=_st(d)._at_put_((1),(2));
  2448. $ctx1.sendIdx["at:put:"]=1;
  2449. $2=_st(d)._at_put_((2),(3));
  2450. $ctx1.sendIdx["at:put:"]=2;
  2451. $3=_st(d)._at_put_((3),(4));
  2452. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  2453. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  2454. args: [],
  2455. 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)",
  2456. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  2457. referencedClasses: ["Dictionary"]
  2458. }),
  2459. smalltalk.DictionaryTest);
  2460. smalltalk.addMethod(
  2461. smalltalk.method({
  2462. selector: "collectionClass",
  2463. category: 'accessing',
  2464. fn: function (){
  2465. var self=this;
  2466. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2467. return smalltalk.withContext(function($ctx1) {
  2468. var $1;
  2469. $1=$Dictionary();
  2470. return $1;
  2471. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  2472. args: [],
  2473. source: "collectionClass\x0a\x09^ Dictionary",
  2474. messageSends: [],
  2475. referencedClasses: ["Dictionary"]
  2476. }),
  2477. smalltalk.DictionaryTest.klass);
  2478. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2479. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2480. smalltalk.addMethod(
  2481. smalltalk.method({
  2482. selector: "testAddFirst",
  2483. category: 'tests',
  2484. fn: function (){
  2485. var self=this;
  2486. return smalltalk.withContext(function($ctx1) {
  2487. var $1,$2;
  2488. $1=[(2), (3), (4), (5)];
  2489. _st($1)._addFirst_((1));
  2490. $2=_st($1)._yourself();
  2491. self._assert_equals_($2,[(1), (2), (3), (4), (5)]);
  2492. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  2493. args: [],
  2494. source: "testAddFirst\x0a\x09self assert: (#(2 3 4 5) addFirst: 1; yourself) equals: #(1 2 3 4 5)",
  2495. messageSends: ["assert:equals:", "addFirst:", "yourself"],
  2496. referencedClasses: []
  2497. }),
  2498. smalltalk.ArrayTest);
  2499. smalltalk.addMethod(
  2500. smalltalk.method({
  2501. selector: "testAtIfAbsent",
  2502. category: 'tests',
  2503. fn: function (){
  2504. var self=this;
  2505. var array;
  2506. return smalltalk.withContext(function($ctx1) {
  2507. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  2508. array=["hello", "world"];
  2509. $2=_st(array)._at_((1));
  2510. $ctx1.sendIdx["at:"]=1;
  2511. $1=self._assert_equals_($2,"hello");
  2512. $ctx1.sendIdx["assert:equals:"]=1;
  2513. $4=_st(array)._at_((2));
  2514. $3=self._assert_equals_($4,"world");
  2515. $ctx1.sendIdx["assert:equals:"]=2;
  2516. $6=_st(array)._at_ifAbsent_((2),(function(){
  2517. return smalltalk.withContext(function($ctx2) {
  2518. return "not found";
  2519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2520. $ctx1.sendIdx["at:ifAbsent:"]=1;
  2521. $5=self._assert_equals_($6,"world");
  2522. $ctx1.sendIdx["assert:equals:"]=3;
  2523. $8=_st(array)._at_ifAbsent_((0),(function(){
  2524. return smalltalk.withContext(function($ctx2) {
  2525. return "not found";
  2526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2527. $ctx1.sendIdx["at:ifAbsent:"]=2;
  2528. $7=self._assert_equals_($8,"not found");
  2529. $ctx1.sendIdx["assert:equals:"]=4;
  2530. $10=_st(array)._at_ifAbsent_((-10),(function(){
  2531. return smalltalk.withContext(function($ctx2) {
  2532. return "not found";
  2533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  2534. $ctx1.sendIdx["at:ifAbsent:"]=3;
  2535. $9=self._assert_equals_($10,"not found");
  2536. $ctx1.sendIdx["assert:equals:"]=5;
  2537. $12=_st(array)._at_ifAbsent_((3),(function(){
  2538. return smalltalk.withContext(function($ctx2) {
  2539. return "not found";
  2540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  2541. $11=self._assert_equals_($12,"not found");
  2542. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{array:array},smalltalk.ArrayTest)})},
  2543. args: [],
  2544. 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'.",
  2545. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2546. referencedClasses: []
  2547. }),
  2548. smalltalk.ArrayTest);
  2549. smalltalk.addMethod(
  2550. smalltalk.method({
  2551. selector: "testFirstN",
  2552. category: 'tests',
  2553. fn: function (){
  2554. var self=this;
  2555. return smalltalk.withContext(function($ctx1) {
  2556. self._assert_equals_(_st([(1),(2),(3),(4),(5)])._first_((3)),[(1),(2),(3)]);
  2557. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.ArrayTest)})},
  2558. args: [],
  2559. source: "testFirstN\x0a\x09self assert: ({1. 2. 3. 4. 5} first: 3) equals: {1. 2. 3}",
  2560. messageSends: ["assert:equals:", "first:"],
  2561. referencedClasses: []
  2562. }),
  2563. smalltalk.ArrayTest);
  2564. smalltalk.addMethod(
  2565. smalltalk.method({
  2566. selector: "testIfEmpty",
  2567. category: 'tests',
  2568. fn: function (){
  2569. var self=this;
  2570. return smalltalk.withContext(function($ctx1) {
  2571. self._assert_equals_(""._ifEmpty_((function(){
  2572. return smalltalk.withContext(function($ctx2) {
  2573. return "zork";
  2574. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),"zork");
  2575. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmpty",{},smalltalk.ArrayTest)})},
  2576. args: [],
  2577. source: "testIfEmpty\x0a\x09self assert: ( '' ifEmpty: ['zork'] ) equals: 'zork'",
  2578. messageSends: ["assert:equals:", "ifEmpty:"],
  2579. referencedClasses: []
  2580. }),
  2581. smalltalk.ArrayTest);
  2582. smalltalk.addMethod(
  2583. smalltalk.method({
  2584. selector: "testPrintString",
  2585. category: 'tests',
  2586. fn: function (){
  2587. var self=this;
  2588. var array;
  2589. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2590. return smalltalk.withContext(function($ctx1) {
  2591. var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10,$11,$13,$12,$14,$16,$15,$17,$19,$18;
  2592. array=_st($Array())._new();
  2593. $2=_st(array)._printString();
  2594. $ctx1.sendIdx["printString"]=1;
  2595. $1=self._assert_equals_($2,"an Array ()");
  2596. $ctx1.sendIdx["assert:equals:"]=1;
  2597. $3=array;
  2598. _st($3)._add_((1));
  2599. $ctx1.sendIdx["add:"]=1;
  2600. $4=_st($3)._add_((3));
  2601. $ctx1.sendIdx["add:"]=2;
  2602. $6=_st(array)._printString();
  2603. $ctx1.sendIdx["printString"]=2;
  2604. $5=self._assert_equals_($6,"an Array (1 3)");
  2605. $ctx1.sendIdx["assert:equals:"]=2;
  2606. $7=_st(array)._add_("foo");
  2607. $9=_st(array)._printString();
  2608. $ctx1.sendIdx["printString"]=3;
  2609. $8=self._assert_equals_($9,"an Array (1 3 'foo')");
  2610. $ctx1.sendIdx["assert:equals:"]=3;
  2611. $10=array;
  2612. _st($10)._remove_((1));
  2613. $ctx1.sendIdx["remove:"]=1;
  2614. $11=_st($10)._remove_((3));
  2615. $13=_st(array)._printString();
  2616. $ctx1.sendIdx["printString"]=4;
  2617. $12=self._assert_equals_($13,"an Array ('foo')");
  2618. $ctx1.sendIdx["assert:equals:"]=4;
  2619. $14=_st(array)._addLast_((3));
  2620. $ctx1.sendIdx["addLast:"]=1;
  2621. $16=_st(array)._printString();
  2622. $ctx1.sendIdx["printString"]=5;
  2623. $15=self._assert_equals_($16,"an Array ('foo' 3)");
  2624. $ctx1.sendIdx["assert:equals:"]=5;
  2625. $17=_st(array)._addLast_((3));
  2626. $19=_st(array)._printString();
  2627. $18=self._assert_equals_($19,"an Array ('foo' 3 3)");
  2628. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  2629. args: [],
  2630. 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)'.",
  2631. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  2632. referencedClasses: ["Array"]
  2633. }),
  2634. smalltalk.ArrayTest);
  2635. smalltalk.addMethod(
  2636. smalltalk.method({
  2637. selector: "testRemoveFromTo",
  2638. category: 'tests',
  2639. fn: function (){
  2640. var self=this;
  2641. return smalltalk.withContext(function($ctx1) {
  2642. var $2,$1,$4,$3,$6,$5;
  2643. $2=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  2644. $ctx1.sendIdx["removeFrom:to:"]=1;
  2645. $1=self._assert_equals_($2,[(4)]);
  2646. $ctx1.sendIdx["assert:equals:"]=1;
  2647. $4=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  2648. $ctx1.sendIdx["removeFrom:to:"]=2;
  2649. $3=self._assert_equals_($4,[(1), (4)]);
  2650. $ctx1.sendIdx["assert:equals:"]=2;
  2651. $6=[(1), (2), (3), (4)]._removeFrom_to_((2),(4));
  2652. $5=self._assert_equals_($6,[(1)]);
  2653. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  2654. args: [],
  2655. 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)",
  2656. messageSends: ["assert:equals:", "removeFrom:to:"],
  2657. referencedClasses: []
  2658. }),
  2659. smalltalk.ArrayTest);
  2660. smalltalk.addMethod(
  2661. smalltalk.method({
  2662. selector: "testRemoveIndex",
  2663. category: 'tests',
  2664. fn: function (){
  2665. var self=this;
  2666. return smalltalk.withContext(function($ctx1) {
  2667. var $2,$1,$4,$3,$6,$5;
  2668. $2=[(1), (2), (3), (4)]._removeIndex_((2));
  2669. $ctx1.sendIdx["removeIndex:"]=1;
  2670. $1=self._assert_equals_($2,[(1), (3), (4)]);
  2671. $ctx1.sendIdx["assert:equals:"]=1;
  2672. $4=[(1), (2), (3), (4)]._removeIndex_((1));
  2673. $ctx1.sendIdx["removeIndex:"]=2;
  2674. $3=self._assert_equals_($4,[(2), (3), (4)]);
  2675. $ctx1.sendIdx["assert:equals:"]=2;
  2676. $6=["hello"]._removeIndex_((1));
  2677. $5=self._assert_equals_($6,[]);
  2678. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  2679. args: [],
  2680. 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: #()",
  2681. messageSends: ["assert:equals:", "removeIndex:"],
  2682. referencedClasses: []
  2683. }),
  2684. smalltalk.ArrayTest);
  2685. smalltalk.addMethod(
  2686. smalltalk.method({
  2687. selector: "collectionClass",
  2688. category: 'accessing',
  2689. fn: function (){
  2690. var self=this;
  2691. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2692. return smalltalk.withContext(function($ctx1) {
  2693. var $1;
  2694. $1=$Array();
  2695. return $1;
  2696. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  2697. args: [],
  2698. source: "collectionClass\x0a\x09^ Array",
  2699. messageSends: [],
  2700. referencedClasses: ["Array"]
  2701. }),
  2702. smalltalk.ArrayTest.klass);
  2703. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  2704. smalltalk.addMethod(
  2705. smalltalk.method({
  2706. selector: "collection",
  2707. category: 'accessing',
  2708. fn: function (){
  2709. var self=this;
  2710. return smalltalk.withContext(function($ctx1) {
  2711. return "hello";
  2712. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  2713. args: [],
  2714. source: "collection\x0a\x09^'hello'",
  2715. messageSends: [],
  2716. referencedClasses: []
  2717. }),
  2718. smalltalk.StringTest);
  2719. smalltalk.addMethod(
  2720. smalltalk.method({
  2721. selector: "collectionWithDuplicates",
  2722. category: 'accessing',
  2723. fn: function (){
  2724. var self=this;
  2725. return smalltalk.withContext(function($ctx1) {
  2726. return "abbaerte";
  2727. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  2728. args: [],
  2729. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  2730. messageSends: [],
  2731. referencedClasses: []
  2732. }),
  2733. smalltalk.StringTest);
  2734. smalltalk.addMethod(
  2735. smalltalk.method({
  2736. selector: "testAddRemove",
  2737. category: 'tests',
  2738. fn: function (){
  2739. var self=this;
  2740. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2741. return smalltalk.withContext(function($ctx1) {
  2742. var $1,$2;
  2743. $1=self._should_raise_((function(){
  2744. return smalltalk.withContext(function($ctx2) {
  2745. return "hello"._add_("a");
  2746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2747. $ctx1.sendIdx["should:raise:"]=1;
  2748. $2=self._should_raise_((function(){
  2749. return smalltalk.withContext(function($ctx2) {
  2750. return "hello"._remove_("h");
  2751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  2752. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  2753. args: [],
  2754. source: "testAddRemove\x0a\x09self should: ['hello' add: 'a'] raise: Error.\x0a\x09self should: ['hello' remove: 'h'] raise: Error",
  2755. messageSends: ["should:raise:", "add:", "remove:"],
  2756. referencedClasses: ["Error"]
  2757. }),
  2758. smalltalk.StringTest);
  2759. smalltalk.addMethod(
  2760. smalltalk.method({
  2761. selector: "testAsArray",
  2762. category: 'tests',
  2763. fn: function (){
  2764. var self=this;
  2765. return smalltalk.withContext(function($ctx1) {
  2766. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  2767. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  2768. args: [],
  2769. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  2770. messageSends: ["assert:equals:", "asArray"],
  2771. referencedClasses: []
  2772. }),
  2773. smalltalk.StringTest);
  2774. smalltalk.addMethod(
  2775. smalltalk.method({
  2776. selector: "testAsNumber",
  2777. category: 'tests',
  2778. fn: function (){
  2779. var self=this;
  2780. return smalltalk.withContext(function($ctx1) {
  2781. var $2,$1,$4,$3,$6,$5;
  2782. $2="3"._asNumber();
  2783. $ctx1.sendIdx["asNumber"]=1;
  2784. $1=self._assert_equals_($2,(3));
  2785. $ctx1.sendIdx["assert:equals:"]=1;
  2786. $4="-3"._asNumber();
  2787. $ctx1.sendIdx["asNumber"]=2;
  2788. $3=self._assert_equals_($4,(-3));
  2789. $ctx1.sendIdx["assert:equals:"]=2;
  2790. $6="-1.5"._asNumber();
  2791. $5=self._assert_equals_($6,(-1.5));
  2792. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  2793. args: [],
  2794. 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.",
  2795. messageSends: ["assert:equals:", "asNumber"],
  2796. referencedClasses: []
  2797. }),
  2798. smalltalk.StringTest);
  2799. smalltalk.addMethod(
  2800. smalltalk.method({
  2801. selector: "testAt",
  2802. category: 'tests',
  2803. fn: function (){
  2804. var self=this;
  2805. return smalltalk.withContext(function($ctx1) {
  2806. var $2,$1,$4,$3,$5;
  2807. $2="hello"._at_((1));
  2808. $ctx1.sendIdx["at:"]=1;
  2809. $1=self._assert_equals_($2,"h");
  2810. $ctx1.sendIdx["assert:equals:"]=1;
  2811. $4="hello"._at_((5));
  2812. $3=self._assert_equals_($4,"o");
  2813. $ctx1.sendIdx["assert:equals:"]=2;
  2814. $5=self._assert_equals_("hello"._at_ifAbsent_((6),(function(){
  2815. return smalltalk.withContext(function($ctx2) {
  2816. return nil;
  2817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),nil);
  2818. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.StringTest)})},
  2819. args: [],
  2820. 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",
  2821. messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
  2822. referencedClasses: []
  2823. }),
  2824. smalltalk.StringTest);
  2825. smalltalk.addMethod(
  2826. smalltalk.method({
  2827. selector: "testAtPut",
  2828. category: 'tests',
  2829. fn: function (){
  2830. var self=this;
  2831. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2832. return smalltalk.withContext(function($ctx1) {
  2833. self._should_raise_((function(){
  2834. return smalltalk.withContext(function($ctx2) {
  2835. return "hello"._at_put_((1),"a");
  2836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2837. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  2838. args: [],
  2839. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
  2840. messageSends: ["should:raise:", "at:put:"],
  2841. referencedClasses: ["Error"]
  2842. }),
  2843. smalltalk.StringTest);
  2844. smalltalk.addMethod(
  2845. smalltalk.method({
  2846. selector: "testCapitalized",
  2847. category: 'tests',
  2848. fn: function (){
  2849. var self=this;
  2850. return smalltalk.withContext(function($ctx1) {
  2851. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9;
  2852. $2="test"._capitalized();
  2853. $ctx1.sendIdx["capitalized"]=1;
  2854. $1=self._assert_equals_($2,"Test");
  2855. $ctx1.sendIdx["assert:equals:"]=1;
  2856. $4="Test"._capitalized();
  2857. $ctx1.sendIdx["capitalized"]=2;
  2858. $3=self._assert_equals_($4,"Test");
  2859. $ctx1.sendIdx["assert:equals:"]=2;
  2860. $6=""._capitalized();
  2861. $5=self._assert_equals_($6,"");
  2862. $ctx1.sendIdx["assert:equals:"]=3;
  2863. $8="Test"._isCapitalized();
  2864. $ctx1.sendIdx["isCapitalized"]=1;
  2865. $7=self._assert_equals_($8,true);
  2866. $ctx1.sendIdx["assert:equals:"]=4;
  2867. $10="test"._isCapitalized();
  2868. $9=self._assert_equals_($10,false);
  2869. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  2870. args: [],
  2871. source: "testCapitalized\x0a\x09self assert: 'test' capitalized equals: 'Test'.\x0a\x09self assert: 'Test' capitalized equals: 'Test'.\x0a\x09self assert: '' capitalized equals: ''.\x0a\x09self assert: 'Test' isCapitalized equals: true.\x0a\x09self assert: 'test' isCapitalized equals: false.",
  2872. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  2873. referencedClasses: []
  2874. }),
  2875. smalltalk.StringTest);
  2876. smalltalk.addMethod(
  2877. smalltalk.method({
  2878. selector: "testCollect",
  2879. category: 'tests',
  2880. fn: function (){
  2881. var self=this;
  2882. var newCollection;
  2883. return smalltalk.withContext(function($ctx1) {
  2884. newCollection="hheelllloo";
  2885. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  2886. return smalltalk.withContext(function($ctx2) {
  2887. return _st(each).__comma(each);
  2888. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  2889. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  2890. args: [],
  2891. 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",
  2892. messageSends: ["assertSameContents:as:", "collect:", "collection", ","],
  2893. referencedClasses: []
  2894. }),
  2895. smalltalk.StringTest);
  2896. smalltalk.addMethod(
  2897. smalltalk.method({
  2898. selector: "testCopyWithoutAll",
  2899. category: 'tests',
  2900. fn: function (){
  2901. var self=this;
  2902. return smalltalk.withContext(function($ctx1) {
  2903. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  2904. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  2905. args: [],
  2906. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  2907. messageSends: ["assert:equals:", "copyWithoutAll:"],
  2908. referencedClasses: []
  2909. }),
  2910. smalltalk.StringTest);
  2911. smalltalk.addMethod(
  2912. smalltalk.method({
  2913. selector: "testDetect",
  2914. category: 'tests',
  2915. fn: function (){
  2916. var self=this;
  2917. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2918. return smalltalk.withContext(function($ctx1) {
  2919. var $2,$1,$3;
  2920. $2=self._collection();
  2921. $ctx1.sendIdx["collection"]=1;
  2922. $1=_st($2)._detect_((function(each){
  2923. return smalltalk.withContext(function($ctx2) {
  2924. return _st(each).__eq("h");
  2925. $ctx2.sendIdx["="]=1;
  2926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2927. $ctx1.sendIdx["detect:"]=1;
  2928. self._assert_equals_($1,"h");
  2929. self._should_raise_((function(){
  2930. return smalltalk.withContext(function($ctx2) {
  2931. $3=self._collection();
  2932. return _st($3)._detect_((function(each){
  2933. return smalltalk.withContext(function($ctx3) {
  2934. return _st(each).__eq((6));
  2935. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  2936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  2937. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  2938. args: [],
  2939. 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",
  2940. messageSends: ["assert:equals:", "detect:", "collection", "=", "should:raise:"],
  2941. referencedClasses: ["Error"]
  2942. }),
  2943. smalltalk.StringTest);
  2944. smalltalk.addMethod(
  2945. smalltalk.method({
  2946. selector: "testEquality",
  2947. category: 'tests',
  2948. fn: function (){
  2949. var self=this;
  2950. return smalltalk.withContext(function($ctx1) {
  2951. var $1,$3,$2,$5,$4,$7,$6,$9,$8,$11,$10;
  2952. $1=self._assert_equals_("hello","hello");
  2953. $ctx1.sendIdx["assert:equals:"]=1;
  2954. $3="hello".__eq("world");
  2955. $ctx1.sendIdx["="]=1;
  2956. $2=self._deny_($3);
  2957. $ctx1.sendIdx["deny:"]=1;
  2958. $5="hello".__eq([]._at_ifAbsent_((1),(function(){
  2959. return smalltalk.withContext(function($ctx2) {
  2960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  2961. $ctx1.sendIdx["="]=2;
  2962. $4=self._deny_($5);
  2963. $ctx1.sendIdx["deny:"]=2;
  2964. $7="hello"._yourself();
  2965. $ctx1.sendIdx["yourself"]=1;
  2966. $6=self._assert_equals_("hello",$7);
  2967. $ctx1.sendIdx["assert:equals:"]=2;
  2968. $9="hello"._yourself();
  2969. $8=self._assert_equals_($9,"hello");
  2970. $11="".__eq((0));
  2971. $10=self._deny_($11);
  2972. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  2973. args: [],
  2974. 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",
  2975. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  2976. referencedClasses: []
  2977. }),
  2978. smalltalk.StringTest);
  2979. smalltalk.addMethod(
  2980. smalltalk.method({
  2981. selector: "testIdentity",
  2982. category: 'tests',
  2983. fn: function (){
  2984. var self=this;
  2985. return smalltalk.withContext(function($ctx1) {
  2986. var $2,$1,$4,$3,$7,$6,$5,$10,$9,$8,$12,$11;
  2987. $2="hello".__eq_eq("hello");
  2988. $ctx1.sendIdx["=="]=1;
  2989. $1=self._assert_($2);
  2990. $ctx1.sendIdx["assert:"]=1;
  2991. $4="hello".__eq_eq("world");
  2992. $ctx1.sendIdx["=="]=2;
  2993. $3=self._deny_($4);
  2994. $ctx1.sendIdx["deny:"]=1;
  2995. $7="hello"._yourself();
  2996. $ctx1.sendIdx["yourself"]=1;
  2997. $6="hello".__eq_eq($7);
  2998. $ctx1.sendIdx["=="]=3;
  2999. $5=self._assert_($6);
  3000. $ctx1.sendIdx["assert:"]=2;
  3001. $10="hello"._yourself();
  3002. $9=_st($10).__eq_eq("hello");
  3003. $ctx1.sendIdx["=="]=4;
  3004. $8=self._assert_($9);
  3005. $12="".__eq_eq((0));
  3006. $11=self._deny_($12);
  3007. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  3008. args: [],
  3009. 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",
  3010. messageSends: ["assert:", "==", "deny:", "yourself"],
  3011. referencedClasses: []
  3012. }),
  3013. smalltalk.StringTest);
  3014. smalltalk.addMethod(
  3015. smalltalk.method({
  3016. selector: "testIdentityHash",
  3017. category: 'tests',
  3018. fn: function (){
  3019. var self=this;
  3020. return smalltalk.withContext(function($ctx1) {
  3021. var $1,$2,$4,$5,$3;
  3022. $1="foo"._identityHash();
  3023. $ctx1.sendIdx["identityHash"]=1;
  3024. $2="foo"._identityHash();
  3025. $ctx1.sendIdx["identityHash"]=2;
  3026. self._assert_equals_($1,$2);
  3027. $4="foo"._identityHash();
  3028. $ctx1.sendIdx["identityHash"]=3;
  3029. $5="bar"._identityHash();
  3030. $3=_st($4).__eq($5);
  3031. self._deny_($3);
  3032. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  3033. args: [],
  3034. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  3035. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  3036. referencedClasses: []
  3037. }),
  3038. smalltalk.StringTest);
  3039. smalltalk.addMethod(
  3040. smalltalk.method({
  3041. selector: "testIncludesSubString",
  3042. category: 'tests',
  3043. fn: function (){
  3044. var self=this;
  3045. return smalltalk.withContext(function($ctx1) {
  3046. var $1,$2;
  3047. $1="amber"._includesSubString_("ber");
  3048. $ctx1.sendIdx["includesSubString:"]=1;
  3049. self._assert_($1);
  3050. $2="amber"._includesSubString_("zork");
  3051. self._deny_($2);
  3052. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  3053. args: [],
  3054. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  3055. messageSends: ["assert:", "includesSubString:", "deny:"],
  3056. referencedClasses: []
  3057. }),
  3058. smalltalk.StringTest);
  3059. smalltalk.addMethod(
  3060. smalltalk.method({
  3061. selector: "testIndexOf",
  3062. category: 'tests',
  3063. fn: function (){
  3064. var self=this;
  3065. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3066. return smalltalk.withContext(function($ctx1) {
  3067. var $3,$2,$1,$4,$7,$6,$5;
  3068. $3=self._collection();
  3069. $ctx1.sendIdx["collection"]=1;
  3070. $2=_st($3)._indexOf_("e");
  3071. $ctx1.sendIdx["indexOf:"]=1;
  3072. $1=self._assert_equals_($2,(2));
  3073. $ctx1.sendIdx["assert:equals:"]=1;
  3074. self._should_raise_((function(){
  3075. return smalltalk.withContext(function($ctx2) {
  3076. $4=self._collection();
  3077. $ctx2.sendIdx["collection"]=2;
  3078. return _st($4)._indexOf_((999));
  3079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3080. $7=self._collection();
  3081. $6=_st($7)._indexOf_ifAbsent_((999),(function(){
  3082. return smalltalk.withContext(function($ctx2) {
  3083. return "sentinel";
  3084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3085. $5=self._assert_equals_($6,"sentinel");
  3086. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.StringTest)})},
  3087. args: [],
  3088. 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'",
  3089. messageSends: ["assert:equals:", "indexOf:", "collection", "should:raise:", "indexOf:ifAbsent:"],
  3090. referencedClasses: ["Error"]
  3091. }),
  3092. smalltalk.StringTest);
  3093. smalltalk.addMethod(
  3094. smalltalk.method({
  3095. selector: "testJoin",
  3096. category: 'tests',
  3097. fn: function (){
  3098. var self=this;
  3099. return smalltalk.withContext(function($ctx1) {
  3100. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  3101. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  3102. args: [],
  3103. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  3104. messageSends: ["assert:equals:", "join:"],
  3105. referencedClasses: []
  3106. }),
  3107. smalltalk.StringTest);
  3108. smalltalk.addMethod(
  3109. smalltalk.method({
  3110. selector: "testSelect",
  3111. category: 'tests',
  3112. fn: function (){
  3113. var self=this;
  3114. var newCollection;
  3115. return smalltalk.withContext(function($ctx1) {
  3116. newCollection="o";
  3117. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  3118. return smalltalk.withContext(function($ctx2) {
  3119. return _st(each).__eq("o");
  3120. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  3121. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  3122. args: [],
  3123. 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",
  3124. messageSends: ["assertSameContents:as:", "select:", "collection", "="],
  3125. referencedClasses: []
  3126. }),
  3127. smalltalk.StringTest);
  3128. smalltalk.addMethod(
  3129. smalltalk.method({
  3130. selector: "testSize",
  3131. category: 'tests',
  3132. fn: function (){
  3133. var self=this;
  3134. return smalltalk.withContext(function($ctx1) {
  3135. var $2,$1,$4,$3;
  3136. $2="smalltalk"._size();
  3137. $ctx1.sendIdx["size"]=1;
  3138. $1=self._assert_equals_($2,(9));
  3139. $ctx1.sendIdx["assert:equals:"]=1;
  3140. $4=""._size();
  3141. $3=self._assert_equals_($4,(0));
  3142. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.StringTest)})},
  3143. args: [],
  3144. source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
  3145. messageSends: ["assert:equals:", "size"],
  3146. referencedClasses: []
  3147. }),
  3148. smalltalk.StringTest);
  3149. smalltalk.addMethod(
  3150. smalltalk.method({
  3151. selector: "testStreamContents",
  3152. category: 'tests',
  3153. fn: function (){
  3154. var self=this;
  3155. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3156. return smalltalk.withContext(function($ctx1) {
  3157. var $1,$2;
  3158. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  3159. return smalltalk.withContext(function($ctx2) {
  3160. $1=aStream;
  3161. _st($1)._nextPutAll_("hello");
  3162. $ctx2.sendIdx["nextPutAll:"]=1;
  3163. _st($1)._space();
  3164. $2=_st($1)._nextPutAll_("world");
  3165. return $2;
  3166. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  3167. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  3168. args: [],
  3169. 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'",
  3170. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  3171. referencedClasses: ["String"]
  3172. }),
  3173. smalltalk.StringTest);
  3174. smalltalk.addMethod(
  3175. smalltalk.method({
  3176. selector: "collectionClass",
  3177. category: 'accessing',
  3178. fn: function (){
  3179. var self=this;
  3180. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  3181. return smalltalk.withContext(function($ctx1) {
  3182. var $1;
  3183. $1=$String();
  3184. return $1;
  3185. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  3186. args: [],
  3187. source: "collectionClass\x0a\x09^ String",
  3188. messageSends: [],
  3189. referencedClasses: ["String"]
  3190. }),
  3191. smalltalk.StringTest.klass);
  3192. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3193. smalltalk.addMethod(
  3194. smalltalk.method({
  3195. selector: "testShow",
  3196. category: 'tests',
  3197. fn: function (){
  3198. var self=this;
  3199. var originalTranscript;
  3200. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  3201. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  3202. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3203. return smalltalk.withContext(function($ctx1) {
  3204. var $1,$2,$3,$4;
  3205. originalTranscript=_st($Transcript())._current();
  3206. $1=_st($Transcript())._register_(_st($ConsoleTranscript())._new());
  3207. $ctx1.sendIdx["register:"]=1;
  3208. $2=self._shouldnt_raise_((function(){
  3209. return smalltalk.withContext(function($ctx2) {
  3210. return _st($Transcript())._show_("Hello console!");
  3211. $ctx2.sendIdx["show:"]=1;
  3212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3213. $ctx1.sendIdx["shouldnt:raise:"]=1;
  3214. $3=self._shouldnt_raise_((function(){
  3215. return smalltalk.withContext(function($ctx2) {
  3216. return _st($Transcript())._show_(console);
  3217. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  3218. $4=_st($Transcript())._register_(originalTranscript);
  3219. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  3220. args: [],
  3221. 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.",
  3222. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  3223. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  3224. }),
  3225. smalltalk.ConsoleTranscriptTest);
  3226. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3227. smalltalk.addMethod(
  3228. smalltalk.method({
  3229. selector: "jsObject",
  3230. category: 'accessing',
  3231. fn: function (){
  3232. var self=this;
  3233. return smalltalk.withContext(function($ctx1) {
  3234. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  3235. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  3236. args: [],
  3237. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  3238. messageSends: [],
  3239. referencedClasses: []
  3240. }),
  3241. smalltalk.JSObjectProxyTest);
  3242. smalltalk.addMethod(
  3243. smalltalk.method({
  3244. selector: "testAtIfAbsent",
  3245. category: 'tests',
  3246. fn: function (){
  3247. var self=this;
  3248. var testObject;
  3249. return smalltalk.withContext(function($ctx1) {
  3250. var $2,$1,$4,$3,$6,$5,$8,$7;
  3251. testObject=self._jsObject();
  3252. $2=_st(testObject)._at_ifAbsent_("abc",(function(){
  3253. return smalltalk.withContext(function($ctx2) {
  3254. return "Property does not exist";
  3255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3256. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3257. $1=self._assert_equals_($2,"Property does not exist");
  3258. $ctx1.sendIdx["assert:equals:"]=1;
  3259. $4=_st(testObject)._at_ifAbsent_("e",(function(){
  3260. return smalltalk.withContext(function($ctx2) {
  3261. return "Property does not exist";
  3262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3263. $ctx1.sendIdx["at:ifAbsent:"]=2;
  3264. $3=self._assert_equals_($4,nil);
  3265. $ctx1.sendIdx["assert:equals:"]=2;
  3266. $6=_st(testObject)._at_ifAbsent_("a",(function(){
  3267. return smalltalk.withContext(function($ctx2) {
  3268. return "Property does not exist";
  3269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  3270. $ctx1.sendIdx["at:ifAbsent:"]=3;
  3271. $5=self._assert_equals_($6,(1));
  3272. $ctx1.sendIdx["assert:equals:"]=3;
  3273. $8=_st(testObject)._at_ifAbsent_("f",(function(){
  3274. return smalltalk.withContext(function($ctx2) {
  3275. return "Property does not exist";
  3276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  3277. $7=self._assert_equals_($8,nil);
  3278. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3279. args: [],
  3280. 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.",
  3281. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  3282. referencedClasses: []
  3283. }),
  3284. smalltalk.JSObjectProxyTest);
  3285. smalltalk.addMethod(
  3286. smalltalk.method({
  3287. selector: "testAtIfPresent",
  3288. category: 'tests',
  3289. fn: function (){
  3290. var self=this;
  3291. var testObject;
  3292. return smalltalk.withContext(function($ctx1) {
  3293. var $3,$2,$1,$6,$5,$4,$9,$8,$7,$12,$11,$10;
  3294. testObject=self._jsObject();
  3295. $2=_st(testObject)._at_ifPresent_("abc",(function(x){
  3296. return smalltalk.withContext(function($ctx2) {
  3297. $3=_st(x)._asString();
  3298. $ctx2.sendIdx["asString"]=1;
  3299. return "hello ".__comma($3);
  3300. $ctx2.sendIdx[","]=1;
  3301. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  3302. $ctx1.sendIdx["at:ifPresent:"]=1;
  3303. $1=self._assert_equals_($2,nil);
  3304. $ctx1.sendIdx["assert:equals:"]=1;
  3305. $5=_st(testObject)._at_ifPresent_("e",(function(x){
  3306. return smalltalk.withContext(function($ctx2) {
  3307. $6=_st(x)._asString();
  3308. $ctx2.sendIdx["asString"]=2;
  3309. return "hello ".__comma($6);
  3310. $ctx2.sendIdx[","]=2;
  3311. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  3312. $ctx1.sendIdx["at:ifPresent:"]=2;
  3313. $4=self._assert_equals_($5,"hello nil");
  3314. $ctx1.sendIdx["assert:equals:"]=2;
  3315. $8=_st(testObject)._at_ifPresent_("a",(function(x){
  3316. return smalltalk.withContext(function($ctx2) {
  3317. $9=_st(x)._asString();
  3318. $ctx2.sendIdx["asString"]=3;
  3319. return "hello ".__comma($9);
  3320. $ctx2.sendIdx[","]=3;
  3321. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  3322. $ctx1.sendIdx["at:ifPresent:"]=3;
  3323. $7=self._assert_equals_($8,"hello 1");
  3324. $ctx1.sendIdx["assert:equals:"]=3;
  3325. $11=_st(testObject)._at_ifPresent_("f",(function(x){
  3326. return smalltalk.withContext(function($ctx2) {
  3327. $12=_st(x)._asString();
  3328. return "hello ".__comma($12);
  3329. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})}));
  3330. $10=self._assert_equals_($11,"hello nil");
  3331. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3332. args: [],
  3333. 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'.",
  3334. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  3335. referencedClasses: []
  3336. }),
  3337. smalltalk.JSObjectProxyTest);
  3338. smalltalk.addMethod(
  3339. smalltalk.method({
  3340. selector: "testAtIfPresentIfAbsent",
  3341. category: 'tests',
  3342. fn: function (){
  3343. var self=this;
  3344. var testObject;
  3345. return smalltalk.withContext(function($ctx1) {
  3346. var $3,$2,$1,$6,$5,$4,$9,$8,$7,$12,$11,$10;
  3347. testObject=self._jsObject();
  3348. $2=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  3349. return smalltalk.withContext(function($ctx2) {
  3350. $3=_st(x)._asString();
  3351. $ctx2.sendIdx["asString"]=1;
  3352. return "hello ".__comma($3);
  3353. $ctx2.sendIdx[","]=1;
  3354. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  3355. return smalltalk.withContext(function($ctx2) {
  3356. return "not present";
  3357. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3358. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  3359. $1=self._assert_equals_($2,"not present");
  3360. $ctx1.sendIdx["assert:equals:"]=1;
  3361. $5=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  3362. return smalltalk.withContext(function($ctx2) {
  3363. $6=_st(x)._asString();
  3364. $ctx2.sendIdx["asString"]=2;
  3365. return "hello ".__comma($6);
  3366. $ctx2.sendIdx[","]=2;
  3367. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  3368. return smalltalk.withContext(function($ctx2) {
  3369. return "not present";
  3370. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  3371. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  3372. $4=self._assert_equals_($5,"hello nil");
  3373. $ctx1.sendIdx["assert:equals:"]=2;
  3374. $8=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  3375. return smalltalk.withContext(function($ctx2) {
  3376. $9=_st(x)._asString();
  3377. $ctx2.sendIdx["asString"]=3;
  3378. return "hello ".__comma($9);
  3379. $ctx2.sendIdx[","]=3;
  3380. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  3381. return smalltalk.withContext(function($ctx2) {
  3382. return "not present";
  3383. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  3384. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  3385. $7=self._assert_equals_($8,"hello 1");
  3386. $ctx1.sendIdx["assert:equals:"]=3;
  3387. $11=_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  3388. return smalltalk.withContext(function($ctx2) {
  3389. $12=_st(x)._asString();
  3390. return "hello ".__comma($12);
  3391. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  3392. return smalltalk.withContext(function($ctx2) {
  3393. return "not present";
  3394. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  3395. $10=self._assert_equals_($11,"hello nil");
  3396. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3397. args: [],
  3398. 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'.",
  3399. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  3400. referencedClasses: []
  3401. }),
  3402. smalltalk.JSObjectProxyTest);
  3403. smalltalk.addMethod(
  3404. smalltalk.method({
  3405. selector: "testDNU",
  3406. category: 'tests',
  3407. fn: function (){
  3408. var self=this;
  3409. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3410. return smalltalk.withContext(function($ctx1) {
  3411. self._should_raise_((function(){
  3412. return smalltalk.withContext(function($ctx2) {
  3413. return _st(self._jsObject())._foo();
  3414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3415. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  3416. args: [],
  3417. source: "testDNU\x0a\x09self should: [self jsObject foo] raise: MessageNotUnderstood",
  3418. messageSends: ["should:raise:", "foo", "jsObject"],
  3419. referencedClasses: ["MessageNotUnderstood"]
  3420. }),
  3421. smalltalk.JSObjectProxyTest);
  3422. smalltalk.addMethod(
  3423. smalltalk.method({
  3424. selector: "testMessageSend",
  3425. category: 'tests',
  3426. fn: function (){
  3427. var self=this;
  3428. return smalltalk.withContext(function($ctx1) {
  3429. var $3,$2,$1,$6,$5,$4,$9,$8,$7;
  3430. $3=self._jsObject();
  3431. $ctx1.sendIdx["jsObject"]=1;
  3432. $2=_st($3)._a();
  3433. $1=self._assert_equals_($2,(1));
  3434. $ctx1.sendIdx["assert:equals:"]=1;
  3435. $6=self._jsObject();
  3436. $ctx1.sendIdx["jsObject"]=2;
  3437. $5=_st($6)._b();
  3438. $4=self._assert_equals_($5,(2));
  3439. $ctx1.sendIdx["assert:equals:"]=2;
  3440. $9=self._jsObject();
  3441. $8=_st($9)._c_((3));
  3442. $7=self._assert_equals_($8,(3));
  3443. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  3444. args: [],
  3445. 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",
  3446. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  3447. referencedClasses: []
  3448. }),
  3449. smalltalk.JSObjectProxyTest);
  3450. smalltalk.addMethod(
  3451. smalltalk.method({
  3452. selector: "testMethodWithArguments",
  3453. category: 'tests',
  3454. fn: function (){
  3455. var self=this;
  3456. return smalltalk.withContext(function($ctx1) {
  3457. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  3458. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  3459. args: [],
  3460. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  3461. messageSends: ["assert:equals:", "c:", "jsObject"],
  3462. referencedClasses: []
  3463. }),
  3464. smalltalk.JSObjectProxyTest);
  3465. smalltalk.addMethod(
  3466. smalltalk.method({
  3467. selector: "testPrinting",
  3468. category: 'tests',
  3469. fn: function (){
  3470. var self=this;
  3471. return smalltalk.withContext(function($ctx1) {
  3472. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  3473. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  3474. args: [],
  3475. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  3476. messageSends: ["assert:equals:", "printString", "jsObject"],
  3477. referencedClasses: []
  3478. }),
  3479. smalltalk.JSObjectProxyTest);
  3480. smalltalk.addMethod(
  3481. smalltalk.method({
  3482. selector: "testPropertyThatReturnsEmptyString",
  3483. category: 'tests',
  3484. fn: function (){
  3485. var self=this;
  3486. var object;
  3487. return smalltalk.withContext(function($ctx1) {
  3488. var $2,$1,$4,$3;
  3489. object=self._jsObject();
  3490. $2=_st(object)._d();
  3491. $ctx1.sendIdx["d"]=1;
  3492. $1=self._assert_equals_($2,"");
  3493. $ctx1.sendIdx["assert:equals:"]=1;
  3494. _st(object)._d_("hello");
  3495. $4=_st(object)._d();
  3496. $3=self._assert_equals_($4,"hello");
  3497. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  3498. args: [],
  3499. 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'",
  3500. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  3501. referencedClasses: []
  3502. }),
  3503. smalltalk.JSObjectProxyTest);
  3504. smalltalk.addMethod(
  3505. smalltalk.method({
  3506. selector: "testPropertyThatReturnsUndefined",
  3507. category: 'tests',
  3508. fn: function (){
  3509. var self=this;
  3510. var object;
  3511. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3512. return smalltalk.withContext(function($ctx1) {
  3513. var $2,$1;
  3514. object=self._jsObject();
  3515. self._shouldnt_raise_((function(){
  3516. return smalltalk.withContext(function($ctx2) {
  3517. return _st(object)._e();
  3518. $ctx2.sendIdx["e"]=1;
  3519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3520. $2=_st(object)._e();
  3521. $1=_st($2)._isNil();
  3522. self._assert_($1);
  3523. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  3524. args: [],
  3525. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  3526. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  3527. referencedClasses: ["MessageNotUnderstood"]
  3528. }),
  3529. smalltalk.JSObjectProxyTest);
  3530. smalltalk.addMethod(
  3531. smalltalk.method({
  3532. selector: "testValue",
  3533. category: 'tests',
  3534. fn: function (){
  3535. var self=this;
  3536. var testObject;
  3537. return smalltalk.withContext(function($ctx1) {
  3538. var $3,$2,$1,$5,$4;
  3539. testObject=self._jsObject();
  3540. $3=_st(testObject)._value();
  3541. $ctx1.sendIdx["value"]=1;
  3542. $2=_st($3)._printString();
  3543. $1=self._assert_equals_($2,"[object Object]");
  3544. $ctx1.sendIdx["assert:equals:"]=1;
  3545. _st(testObject)._at_put_("value","aValue");
  3546. $5=_st(testObject)._value();
  3547. $4=self._assert_equals_($5,"aValue");
  3548. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  3549. args: [],
  3550. 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'",
  3551. messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"],
  3552. referencedClasses: []
  3553. }),
  3554. smalltalk.JSObjectProxyTest);
  3555. smalltalk.addMethod(
  3556. smalltalk.method({
  3557. selector: "testYourself",
  3558. category: 'tests',
  3559. fn: function (){
  3560. var self=this;
  3561. var object;
  3562. return smalltalk.withContext(function($ctx1) {
  3563. var $1,$2;
  3564. $1=self._jsObject();
  3565. _st($1)._d_("test");
  3566. $2=_st($1)._yourself();
  3567. object=$2;
  3568. self._assert_equals_(_st(object)._d(),"test");
  3569. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  3570. args: [],
  3571. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  3572. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  3573. referencedClasses: []
  3574. }),
  3575. smalltalk.JSObjectProxyTest);
  3576. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3577. smalltalk.addMethod(
  3578. smalltalk.method({
  3579. selector: "testCatchingException",
  3580. category: 'tests',
  3581. fn: function (){
  3582. var self=this;
  3583. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3584. return smalltalk.withContext(function($ctx1) {
  3585. _st((function(){
  3586. return smalltalk.withContext(function($ctx2) {
  3587. return self._throwException();
  3588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  3589. return smalltalk.withContext(function($ctx2) {
  3590. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  3591. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  3592. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  3593. args: [],
  3594. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  3595. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  3596. referencedClasses: ["Error"]
  3597. }),
  3598. smalltalk.JavaScriptExceptionTest);
  3599. smalltalk.addMethod(
  3600. smalltalk.method({
  3601. selector: "testRaisingException",
  3602. category: 'tests',
  3603. fn: function (){
  3604. var self=this;
  3605. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  3606. return smalltalk.withContext(function($ctx1) {
  3607. self._should_raise_((function(){
  3608. return smalltalk.withContext(function($ctx2) {
  3609. return self._throwException();
  3610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  3611. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  3612. args: [],
  3613. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  3614. messageSends: ["should:raise:", "throwException"],
  3615. referencedClasses: ["JavaScriptException"]
  3616. }),
  3617. smalltalk.JavaScriptExceptionTest);
  3618. smalltalk.addMethod(
  3619. smalltalk.method({
  3620. selector: "throwException",
  3621. category: 'helpers',
  3622. fn: function (){
  3623. var self=this;
  3624. return smalltalk.withContext(function($ctx1) {
  3625. throw 'test';
  3626. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  3627. args: [],
  3628. source: "throwException\x0a\x09<throw 'test'>",
  3629. messageSends: [],
  3630. referencedClasses: []
  3631. }),
  3632. smalltalk.JavaScriptExceptionTest);
  3633. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3634. smalltalk.addMethod(
  3635. smalltalk.method({
  3636. selector: "testValue",
  3637. category: 'tests',
  3638. fn: function (){
  3639. var self=this;
  3640. var messageSend;
  3641. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  3642. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  3643. return smalltalk.withContext(function($ctx1) {
  3644. var $1,$2,$3,$4;
  3645. $1=_st($MessageSend())._new();
  3646. $ctx1.sendIdx["new"]=1;
  3647. $2=$1;
  3648. $3=_st($Object())._new();
  3649. _st($2)._receiver_($3);
  3650. _st($1)._selector_("asString");
  3651. $4=_st($1)._yourself();
  3652. messageSend=$4;
  3653. self._assert_equals_(_st(messageSend)._value(),"an Object");
  3654. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  3655. args: [],
  3656. 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'",
  3657. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  3658. referencedClasses: ["MessageSend", "Object"]
  3659. }),
  3660. smalltalk.MessageSendTest);
  3661. smalltalk.addMethod(
  3662. smalltalk.method({
  3663. selector: "testValueWithArguments",
  3664. category: 'tests',
  3665. fn: function (){
  3666. var self=this;
  3667. var messageSend;
  3668. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  3669. return smalltalk.withContext(function($ctx1) {
  3670. var $1,$2,$3,$4;
  3671. $1=_st($MessageSend())._new();
  3672. _st($1)._receiver_((2));
  3673. _st($1)._selector_("+");
  3674. $2=_st($1)._yourself();
  3675. messageSend=$2;
  3676. $3=self._assert_equals_(_st(messageSend)._value_((3)),(5));
  3677. $ctx1.sendIdx["assert:equals:"]=1;
  3678. $4=self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  3679. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  3680. args: [],
  3681. 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",
  3682. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  3683. referencedClasses: ["MessageSend"]
  3684. }),
  3685. smalltalk.MessageSendTest);
  3686. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  3687. smalltalk.addMethod(
  3688. smalltalk.method({
  3689. selector: "codeGeneratorClass",
  3690. category: 'accessing',
  3691. fn: function (){
  3692. var self=this;
  3693. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  3694. return smalltalk.withContext(function($ctx1) {
  3695. var $1;
  3696. $1=$CodeGenerator();
  3697. return $1;
  3698. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  3699. args: [],
  3700. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  3701. messageSends: [],
  3702. referencedClasses: ["CodeGenerator"]
  3703. }),
  3704. smalltalk.MethodInheritanceTest);
  3705. smalltalk.addMethod(
  3706. smalltalk.method({
  3707. selector: "compiler",
  3708. category: 'factory',
  3709. fn: function (){
  3710. var self=this;
  3711. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  3712. return smalltalk.withContext(function($ctx1) {
  3713. var $2,$3,$1;
  3714. $2=_st($Compiler())._new();
  3715. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  3716. $3=_st($2)._yourself();
  3717. $1=$3;
  3718. return $1;
  3719. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  3720. args: [],
  3721. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  3722. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  3723. referencedClasses: ["Compiler"]
  3724. }),
  3725. smalltalk.MethodInheritanceTest);
  3726. smalltalk.addMethod(
  3727. smalltalk.method({
  3728. selector: "deinstallBottom",
  3729. category: 'testing',
  3730. fn: function (){
  3731. var self=this;
  3732. return smalltalk.withContext(function($ctx1) {
  3733. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  3734. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  3735. args: [],
  3736. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  3737. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  3738. referencedClasses: []
  3739. }),
  3740. smalltalk.MethodInheritanceTest);
  3741. smalltalk.addMethod(
  3742. smalltalk.method({
  3743. selector: "deinstallMiddle",
  3744. category: 'testing',
  3745. fn: function (){
  3746. var self=this;
  3747. return smalltalk.withContext(function($ctx1) {
  3748. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  3749. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  3750. args: [],
  3751. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  3752. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  3753. referencedClasses: []
  3754. }),
  3755. smalltalk.MethodInheritanceTest);
  3756. smalltalk.addMethod(
  3757. smalltalk.method({
  3758. selector: "deinstallTop",
  3759. category: 'testing',
  3760. fn: function (){
  3761. var self=this;
  3762. return smalltalk.withContext(function($ctx1) {
  3763. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  3764. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  3765. args: [],
  3766. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  3767. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  3768. referencedClasses: []
  3769. }),
  3770. smalltalk.MethodInheritanceTest);
  3771. smalltalk.addMethod(
  3772. smalltalk.method({
  3773. selector: "installBottom:",
  3774. category: 'testing',
  3775. fn: function (aString){
  3776. var self=this;
  3777. return smalltalk.withContext(function($ctx1) {
  3778. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassBottom(),"tests");
  3779. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  3780. args: ["aString"],
  3781. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom category: 'tests'",
  3782. messageSends: ["install:forClass:category:", "compiler", "targetClassBottom"],
  3783. referencedClasses: []
  3784. }),
  3785. smalltalk.MethodInheritanceTest);
  3786. smalltalk.addMethod(
  3787. smalltalk.method({
  3788. selector: "installMiddle:",
  3789. category: 'testing',
  3790. fn: function (aString){
  3791. var self=this;
  3792. return smalltalk.withContext(function($ctx1) {
  3793. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassMiddle(),"tests");
  3794. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  3795. args: ["aString"],
  3796. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle category: 'tests'",
  3797. messageSends: ["install:forClass:category:", "compiler", "targetClassMiddle"],
  3798. referencedClasses: []
  3799. }),
  3800. smalltalk.MethodInheritanceTest);
  3801. smalltalk.addMethod(
  3802. smalltalk.method({
  3803. selector: "installTop:",
  3804. category: 'testing',
  3805. fn: function (aString){
  3806. var self=this;
  3807. return smalltalk.withContext(function($ctx1) {
  3808. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassTop(),"tests");
  3809. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  3810. args: ["aString"],
  3811. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop category: 'tests'",
  3812. messageSends: ["install:forClass:category:", "compiler", "targetClassTop"],
  3813. referencedClasses: []
  3814. }),
  3815. smalltalk.MethodInheritanceTest);
  3816. smalltalk.addMethod(
  3817. smalltalk.method({
  3818. selector: "setUp",
  3819. category: 'initialization',
  3820. fn: function (){
  3821. var self=this;
  3822. return smalltalk.withContext(function($ctx1) {
  3823. self["@receiverTop"]=_st(self._targetClassTop())._new();
  3824. $ctx1.sendIdx["new"]=1;
  3825. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  3826. $ctx1.sendIdx["new"]=2;
  3827. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  3828. self["@method"]=nil;
  3829. self["@performBlock"]=(function(){
  3830. return smalltalk.withContext(function($ctx2) {
  3831. return self._error_("performBlock not initialized");
  3832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  3833. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  3834. args: [],
  3835. 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' ]",
  3836. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  3837. referencedClasses: []
  3838. }),
  3839. smalltalk.MethodInheritanceTest);
  3840. smalltalk.addMethod(
  3841. smalltalk.method({
  3842. selector: "shouldMNU",
  3843. category: 'testing',
  3844. fn: function (){
  3845. var self=this;
  3846. return smalltalk.withContext(function($ctx1) {
  3847. self._shouldMNUTop();
  3848. self._shouldMNUMiddle();
  3849. self._shouldMNUBottom();
  3850. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  3851. args: [],
  3852. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  3853. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  3854. referencedClasses: []
  3855. }),
  3856. smalltalk.MethodInheritanceTest);
  3857. smalltalk.addMethod(
  3858. smalltalk.method({
  3859. selector: "shouldMNUBottom",
  3860. category: 'testing',
  3861. fn: function (){
  3862. var self=this;
  3863. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3864. return smalltalk.withContext(function($ctx1) {
  3865. self._should_raise_((function(){
  3866. return smalltalk.withContext(function($ctx2) {
  3867. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  3868. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3869. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  3870. args: [],
  3871. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  3872. messageSends: ["should:raise:", "value:"],
  3873. referencedClasses: ["MessageNotUnderstood"]
  3874. }),
  3875. smalltalk.MethodInheritanceTest);
  3876. smalltalk.addMethod(
  3877. smalltalk.method({
  3878. selector: "shouldMNUMiddle",
  3879. category: 'testing',
  3880. fn: function (){
  3881. var self=this;
  3882. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3883. return smalltalk.withContext(function($ctx1) {
  3884. self._should_raise_((function(){
  3885. return smalltalk.withContext(function($ctx2) {
  3886. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  3887. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3888. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  3889. args: [],
  3890. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  3891. messageSends: ["should:raise:", "value:"],
  3892. referencedClasses: ["MessageNotUnderstood"]
  3893. }),
  3894. smalltalk.MethodInheritanceTest);
  3895. smalltalk.addMethod(
  3896. smalltalk.method({
  3897. selector: "shouldMNUTop",
  3898. category: 'testing',
  3899. fn: function (){
  3900. var self=this;
  3901. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  3902. return smalltalk.withContext(function($ctx1) {
  3903. self._should_raise_((function(){
  3904. return smalltalk.withContext(function($ctx2) {
  3905. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  3906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  3907. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  3908. args: [],
  3909. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  3910. messageSends: ["should:raise:", "value:"],
  3911. referencedClasses: ["MessageNotUnderstood"]
  3912. }),
  3913. smalltalk.MethodInheritanceTest);
  3914. smalltalk.addMethod(
  3915. smalltalk.method({
  3916. selector: "shouldReturn:",
  3917. category: 'testing',
  3918. fn: function (anObject){
  3919. var self=this;
  3920. var result;
  3921. return smalltalk.withContext(function($ctx1) {
  3922. var $1,$2,$3;
  3923. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  3924. $ctx1.sendIdx["value:"]=1;
  3925. $1=self._assert_equals_(["top",anObject],["top",result]);
  3926. $ctx1.sendIdx["assert:equals:"]=1;
  3927. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  3928. $ctx1.sendIdx["value:"]=2;
  3929. $2=self._assert_equals_(["middle",anObject],["middle",result]);
  3930. $ctx1.sendIdx["assert:equals:"]=2;
  3931. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  3932. $3=self._assert_equals_(["bottom",anObject],["bottom",result]);
  3933. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  3934. args: ["anObject"],
  3935. 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 }",
  3936. messageSends: ["value:", "assert:equals:"],
  3937. referencedClasses: []
  3938. }),
  3939. smalltalk.MethodInheritanceTest);
  3940. smalltalk.addMethod(
  3941. smalltalk.method({
  3942. selector: "shouldReturn:and:and:",
  3943. category: 'testing',
  3944. fn: function (anObject,anObject2,anObject3){
  3945. var self=this;
  3946. var result;
  3947. return smalltalk.withContext(function($ctx1) {
  3948. var $1,$2,$3;
  3949. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  3950. $ctx1.sendIdx["value:"]=1;
  3951. $1=self._assert_equals_(["top",anObject],["top",result]);
  3952. $ctx1.sendIdx["assert:equals:"]=1;
  3953. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  3954. $ctx1.sendIdx["value:"]=2;
  3955. $2=self._assert_equals_(["middle",anObject2],["middle",result]);
  3956. $ctx1.sendIdx["assert:equals:"]=2;
  3957. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  3958. $3=self._assert_equals_(["bottom",anObject3],["bottom",result]);
  3959. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  3960. args: ["anObject", "anObject2", "anObject3"],
  3961. 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 }",
  3962. messageSends: ["value:", "assert:equals:"],
  3963. referencedClasses: []
  3964. }),
  3965. smalltalk.MethodInheritanceTest);
  3966. smalltalk.addMethod(
  3967. smalltalk.method({
  3968. selector: "targetClassBottom",
  3969. category: 'accessing',
  3970. fn: function (){
  3971. var self=this;
  3972. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  3973. return smalltalk.withContext(function($ctx1) {
  3974. var $1;
  3975. $1=$JavaScriptException();
  3976. return $1;
  3977. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  3978. args: [],
  3979. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  3980. messageSends: [],
  3981. referencedClasses: ["JavaScriptException"]
  3982. }),
  3983. smalltalk.MethodInheritanceTest);
  3984. smalltalk.addMethod(
  3985. smalltalk.method({
  3986. selector: "targetClassMiddle",
  3987. category: 'accessing',
  3988. fn: function (){
  3989. var self=this;
  3990. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3991. return smalltalk.withContext(function($ctx1) {
  3992. var $1;
  3993. $1=$Error();
  3994. return $1;
  3995. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  3996. args: [],
  3997. source: "targetClassMiddle\x0a\x09^ Error",
  3998. messageSends: [],
  3999. referencedClasses: ["Error"]
  4000. }),
  4001. smalltalk.MethodInheritanceTest);
  4002. smalltalk.addMethod(
  4003. smalltalk.method({
  4004. selector: "targetClassTop",
  4005. category: 'accessing',
  4006. fn: function (){
  4007. var self=this;
  4008. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4009. return smalltalk.withContext(function($ctx1) {
  4010. var $1;
  4011. $1=$Object();
  4012. return $1;
  4013. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  4014. args: [],
  4015. source: "targetClassTop\x0a\x09^ Object",
  4016. messageSends: [],
  4017. referencedClasses: ["Object"]
  4018. }),
  4019. smalltalk.MethodInheritanceTest);
  4020. smalltalk.addMethod(
  4021. smalltalk.method({
  4022. selector: "tearDown",
  4023. category: 'initialization',
  4024. fn: function (){
  4025. var self=this;
  4026. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4027. return smalltalk.withContext(function($ctx1) {
  4028. var $1,$2,$3;
  4029. $1=_st((function(){
  4030. return smalltalk.withContext(function($ctx2) {
  4031. return self._deinstallTop();
  4032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  4033. return smalltalk.withContext(function($ctx2) {
  4034. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4035. $ctx1.sendIdx["on:do:"]=1;
  4036. $2=_st((function(){
  4037. return smalltalk.withContext(function($ctx2) {
  4038. return self._deinstallMiddle();
  4039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  4040. return smalltalk.withContext(function($ctx2) {
  4041. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4042. $ctx1.sendIdx["on:do:"]=2;
  4043. $3=_st((function(){
  4044. return smalltalk.withContext(function($ctx2) {
  4045. return self._deinstallBottom();
  4046. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  4047. return smalltalk.withContext(function($ctx2) {
  4048. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  4049. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  4050. args: [],
  4051. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [].\x0a\x09[ self deinstallMiddle ] on: Error do: [].\x0a\x09[ self deinstallBottom ] on: Error do: []",
  4052. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  4053. referencedClasses: ["Error"]
  4054. }),
  4055. smalltalk.MethodInheritanceTest);
  4056. smalltalk.addMethod(
  4057. smalltalk.method({
  4058. selector: "testMNU11",
  4059. category: 'tests',
  4060. fn: function (){
  4061. var self=this;
  4062. return smalltalk.withContext(function($ctx1) {
  4063. var $1,$2,$3,$4;
  4064. self["@performBlock"]=(function(x){
  4065. return smalltalk.withContext(function($ctx2) {
  4066. return _st(x)._foo();
  4067. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4068. $1=self._shouldMNU();
  4069. $ctx1.sendIdx["shouldMNU"]=1;
  4070. $2=self._installTop_("foo ^ false");
  4071. $ctx1.sendIdx["installTop:"]=1;
  4072. $3=self._installTop_("foo ^ true");
  4073. self._deinstallTop();
  4074. $4=self._shouldMNU();
  4075. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  4076. args: [],
  4077. 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",
  4078. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  4079. referencedClasses: []
  4080. }),
  4081. smalltalk.MethodInheritanceTest);
  4082. smalltalk.addMethod(
  4083. smalltalk.method({
  4084. selector: "testMNU22",
  4085. category: 'tests',
  4086. fn: function (){
  4087. var self=this;
  4088. return smalltalk.withContext(function($ctx1) {
  4089. var $1,$2,$3,$4;
  4090. self["@performBlock"]=(function(x){
  4091. return smalltalk.withContext(function($ctx2) {
  4092. return _st(x)._foo();
  4093. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4094. $1=self._shouldMNU();
  4095. $ctx1.sendIdx["shouldMNU"]=1;
  4096. $2=self._installMiddle_("foo ^ false");
  4097. $ctx1.sendIdx["installMiddle:"]=1;
  4098. $3=self._installMiddle_("foo ^ true");
  4099. self._deinstallMiddle();
  4100. $4=self._shouldMNU();
  4101. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  4102. args: [],
  4103. 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",
  4104. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  4105. referencedClasses: []
  4106. }),
  4107. smalltalk.MethodInheritanceTest);
  4108. smalltalk.addMethod(
  4109. smalltalk.method({
  4110. selector: "testReturns1",
  4111. category: 'tests',
  4112. fn: function (){
  4113. var self=this;
  4114. return smalltalk.withContext(function($ctx1) {
  4115. var $1,$2,$3,$4;
  4116. self["@performBlock"]=(function(x){
  4117. return smalltalk.withContext(function($ctx2) {
  4118. return _st(x)._foo();
  4119. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4120. $1=self._installTop_("foo ^ false");
  4121. $ctx1.sendIdx["installTop:"]=1;
  4122. $2=self._shouldReturn_(false);
  4123. $ctx1.sendIdx["shouldReturn:"]=1;
  4124. $3=self._installTop_("foo ^ true");
  4125. $4=self._shouldReturn_(true);
  4126. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  4127. args: [],
  4128. 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",
  4129. messageSends: ["foo", "installTop:", "shouldReturn:"],
  4130. referencedClasses: []
  4131. }),
  4132. smalltalk.MethodInheritanceTest);
  4133. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4134. smalltalk.addMethod(
  4135. smalltalk.method({
  4136. selector: "testAbs",
  4137. category: 'tests',
  4138. fn: function (){
  4139. var self=this;
  4140. return smalltalk.withContext(function($ctx1) {
  4141. var $2,$1,$4,$3;
  4142. $2=(4)._abs();
  4143. $ctx1.sendIdx["abs"]=1;
  4144. $1=self._assert_equals_($2,(4));
  4145. $ctx1.sendIdx["assert:equals:"]=1;
  4146. $4=(-4)._abs();
  4147. $3=self._assert_equals_($4,(4));
  4148. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  4149. args: [],
  4150. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  4151. messageSends: ["assert:equals:", "abs"],
  4152. referencedClasses: []
  4153. }),
  4154. smalltalk.NumberTest);
  4155. smalltalk.addMethod(
  4156. smalltalk.method({
  4157. selector: "testArithmetic",
  4158. category: 'tests',
  4159. fn: function (){
  4160. var self=this;
  4161. return smalltalk.withContext(function($ctx1) {
  4162. var $2,$1,$4,$3,$6,$5,$7,$9,$8,$10,$11,$14,$13,$12,$17,$16,$15;
  4163. $2=(1.5).__plus((1));
  4164. $ctx1.sendIdx["+"]=1;
  4165. $1=self._assert_equals_($2,(2.5));
  4166. $ctx1.sendIdx["assert:equals:"]=1;
  4167. $4=(2).__minus((1));
  4168. $ctx1.sendIdx["-"]=1;
  4169. $3=self._assert_equals_($4,(1));
  4170. $ctx1.sendIdx["assert:equals:"]=2;
  4171. $6=(-2).__minus((1));
  4172. $5=self._assert_equals_($6,(-3));
  4173. $ctx1.sendIdx["assert:equals:"]=3;
  4174. $7=self._assert_equals_((12).__slash((2)),(6));
  4175. $ctx1.sendIdx["assert:equals:"]=4;
  4176. $9=(3).__star((4));
  4177. $ctx1.sendIdx["*"]=1;
  4178. $8=self._assert_equals_($9,(12));
  4179. $ctx1.sendIdx["assert:equals:"]=5;
  4180. $10=self._assert_equals_((7).__slash_slash((2)),(3));
  4181. $ctx1.sendIdx["assert:equals:"]=6;
  4182. $11=self._assert_equals_((7).__backslash_backslash((2)),(1));
  4183. $ctx1.sendIdx["assert:equals:"]=7;
  4184. $14=(1).__plus((2));
  4185. $ctx1.sendIdx["+"]=2;
  4186. $13=_st($14).__star((3));
  4187. $ctx1.sendIdx["*"]=2;
  4188. $12=self._assert_equals_($13,(9));
  4189. $ctx1.sendIdx["assert:equals:"]=8;
  4190. $17=(2).__star((3));
  4191. $16=(1).__plus($17);
  4192. $15=self._assert_equals_($16,(7));
  4193. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  4194. args: [],
  4195. 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\x09self assert: 7 // 2 equals: 3.\x0a\x09self assert: 7 \x5c\x5c 2 equals: 1.\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",
  4196. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  4197. referencedClasses: []
  4198. }),
  4199. smalltalk.NumberTest);
  4200. smalltalk.addMethod(
  4201. smalltalk.method({
  4202. selector: "testAsNumber",
  4203. category: 'tests',
  4204. fn: function (){
  4205. var self=this;
  4206. return smalltalk.withContext(function($ctx1) {
  4207. self._assert_equals_((3)._asNumber(),(3));
  4208. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  4209. args: [],
  4210. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  4211. messageSends: ["assert:equals:", "asNumber"],
  4212. referencedClasses: []
  4213. }),
  4214. smalltalk.NumberTest);
  4215. smalltalk.addMethod(
  4216. smalltalk.method({
  4217. selector: "testCeiling",
  4218. category: 'tests',
  4219. fn: function (){
  4220. var self=this;
  4221. return smalltalk.withContext(function($ctx1) {
  4222. var $2,$1,$4,$3,$6,$5;
  4223. $2=(1.2)._ceiling();
  4224. $ctx1.sendIdx["ceiling"]=1;
  4225. $1=self._assert_equals_($2,(2));
  4226. $ctx1.sendIdx["assert:equals:"]=1;
  4227. $4=(-1.2)._ceiling();
  4228. $ctx1.sendIdx["ceiling"]=2;
  4229. $3=self._assert_equals_($4,(-1));
  4230. $ctx1.sendIdx["assert:equals:"]=2;
  4231. $6=(1)._ceiling();
  4232. $5=self._assert_equals_($6,(1));
  4233. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  4234. args: [],
  4235. 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.",
  4236. messageSends: ["assert:equals:", "ceiling"],
  4237. referencedClasses: []
  4238. }),
  4239. smalltalk.NumberTest);
  4240. smalltalk.addMethod(
  4241. smalltalk.method({
  4242. selector: "testComparison",
  4243. category: 'tests',
  4244. fn: function (){
  4245. var self=this;
  4246. return smalltalk.withContext(function($ctx1) {
  4247. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  4248. $2=(3).__gt((2));
  4249. $ctx1.sendIdx[">"]=1;
  4250. $1=self._assert_($2);
  4251. $ctx1.sendIdx["assert:"]=1;
  4252. $4=(2).__lt((3));
  4253. $ctx1.sendIdx["<"]=1;
  4254. $3=self._assert_($4);
  4255. $ctx1.sendIdx["assert:"]=2;
  4256. $6=(3).__lt((2));
  4257. $5=self._deny_($6);
  4258. $ctx1.sendIdx["deny:"]=1;
  4259. $8=(2).__gt((3));
  4260. $7=self._deny_($8);
  4261. $10=(3).__gt_eq((3));
  4262. $ctx1.sendIdx[">="]=1;
  4263. $9=self._assert_($10);
  4264. $ctx1.sendIdx["assert:"]=3;
  4265. $12=(3.1).__gt_eq((3));
  4266. $11=self._assert_($12);
  4267. $ctx1.sendIdx["assert:"]=4;
  4268. $14=(3).__lt_eq((3));
  4269. $ctx1.sendIdx["<="]=1;
  4270. $13=self._assert_($14);
  4271. $ctx1.sendIdx["assert:"]=5;
  4272. $16=(3).__lt_eq((3.1));
  4273. $15=self._assert_($16);
  4274. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  4275. args: [],
  4276. 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",
  4277. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  4278. referencedClasses: []
  4279. }),
  4280. smalltalk.NumberTest);
  4281. smalltalk.addMethod(
  4282. smalltalk.method({
  4283. selector: "testCopying",
  4284. category: 'tests',
  4285. fn: function (){
  4286. var self=this;
  4287. return smalltalk.withContext(function($ctx1) {
  4288. var $2,$1,$4,$3;
  4289. $2=_st((1)._copy()).__eq_eq((1));
  4290. $ctx1.sendIdx["=="]=1;
  4291. $1=self._assert_($2);
  4292. $ctx1.sendIdx["assert:"]=1;
  4293. $4=_st((1)._deepCopy()).__eq_eq((1));
  4294. $3=self._assert_($4);
  4295. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  4296. args: [],
  4297. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  4298. messageSends: ["assert:", "==", "copy", "deepCopy"],
  4299. referencedClasses: []
  4300. }),
  4301. smalltalk.NumberTest);
  4302. smalltalk.addMethod(
  4303. smalltalk.method({
  4304. selector: "testEquality",
  4305. category: 'tests',
  4306. fn: function (){
  4307. var self=this;
  4308. return smalltalk.withContext(function($ctx1) {
  4309. var $2,$1,$4,$3,$6,$5,$9,$8,$7,$12,$11,$10,$15,$16,$14,$13,$18,$17,$20,$19,$22,$21,$24,$23;
  4310. $2=(1).__eq((1));
  4311. $ctx1.sendIdx["="]=1;
  4312. $1=self._assert_($2);
  4313. $ctx1.sendIdx["assert:"]=1;
  4314. $4=(0).__eq((0));
  4315. $ctx1.sendIdx["="]=2;
  4316. $3=self._assert_($4);
  4317. $ctx1.sendIdx["assert:"]=2;
  4318. $6=(1).__eq((0));
  4319. $ctx1.sendIdx["="]=3;
  4320. $5=self._deny_($6);
  4321. $ctx1.sendIdx["deny:"]=1;
  4322. $9=(1)._yourself();
  4323. $ctx1.sendIdx["yourself"]=1;
  4324. $8=_st($9).__eq((1));
  4325. $ctx1.sendIdx["="]=4;
  4326. $7=self._assert_($8);
  4327. $ctx1.sendIdx["assert:"]=3;
  4328. $12=(1)._yourself();
  4329. $ctx1.sendIdx["yourself"]=2;
  4330. $11=(1).__eq($12);
  4331. $ctx1.sendIdx["="]=5;
  4332. $10=self._assert_($11);
  4333. $ctx1.sendIdx["assert:"]=4;
  4334. $15=(1)._yourself();
  4335. $ctx1.sendIdx["yourself"]=3;
  4336. $16=(1)._yourself();
  4337. $14=_st($15).__eq($16);
  4338. $ctx1.sendIdx["="]=6;
  4339. $13=self._assert_($14);
  4340. $18=(0).__eq(false);
  4341. $ctx1.sendIdx["="]=7;
  4342. $17=self._deny_($18);
  4343. $ctx1.sendIdx["deny:"]=2;
  4344. $20=false.__eq((0));
  4345. $ctx1.sendIdx["="]=8;
  4346. $19=self._deny_($20);
  4347. $ctx1.sendIdx["deny:"]=3;
  4348. $22="".__eq((0));
  4349. $ctx1.sendIdx["="]=9;
  4350. $21=self._deny_($22);
  4351. $ctx1.sendIdx["deny:"]=4;
  4352. $24=(0).__eq("");
  4353. $23=self._deny_($24);
  4354. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  4355. args: [],
  4356. 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 = ''",
  4357. messageSends: ["assert:", "=", "deny:", "yourself"],
  4358. referencedClasses: []
  4359. }),
  4360. smalltalk.NumberTest);
  4361. smalltalk.addMethod(
  4362. smalltalk.method({
  4363. selector: "testFloor",
  4364. category: 'tests',
  4365. fn: function (){
  4366. var self=this;
  4367. return smalltalk.withContext(function($ctx1) {
  4368. var $2,$1,$4,$3,$6,$5;
  4369. $2=(1.2)._floor();
  4370. $ctx1.sendIdx["floor"]=1;
  4371. $1=self._assert_equals_($2,(1));
  4372. $ctx1.sendIdx["assert:equals:"]=1;
  4373. $4=(-1.2)._floor();
  4374. $ctx1.sendIdx["floor"]=2;
  4375. $3=self._assert_equals_($4,(-2));
  4376. $ctx1.sendIdx["assert:equals:"]=2;
  4377. $6=(1)._floor();
  4378. $5=self._assert_equals_($6,(1));
  4379. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  4380. args: [],
  4381. 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.",
  4382. messageSends: ["assert:equals:", "floor"],
  4383. referencedClasses: []
  4384. }),
  4385. smalltalk.NumberTest);
  4386. smalltalk.addMethod(
  4387. smalltalk.method({
  4388. selector: "testHexNumbers",
  4389. category: 'tests',
  4390. fn: function (){
  4391. var self=this;
  4392. return smalltalk.withContext(function($ctx1) {
  4393. var $1,$3,$2,$5,$4,$7,$6,$9,$8,$11,$10,$13,$12;
  4394. $1=self._assert_equals_((9),(9));
  4395. $ctx1.sendIdx["assert:equals:"]=1;
  4396. $3=(10)._truncated();
  4397. $ctx1.sendIdx["truncated"]=1;
  4398. $2=self._assert_equals_($3,(10));
  4399. $ctx1.sendIdx["assert:equals:"]=2;
  4400. $5=(11)._truncated();
  4401. $ctx1.sendIdx["truncated"]=2;
  4402. $4=self._assert_equals_($5,(11));
  4403. $ctx1.sendIdx["assert:equals:"]=3;
  4404. $7=(12)._truncated();
  4405. $ctx1.sendIdx["truncated"]=3;
  4406. $6=self._assert_equals_($7,(12));
  4407. $ctx1.sendIdx["assert:equals:"]=4;
  4408. $9=(13)._truncated();
  4409. $ctx1.sendIdx["truncated"]=4;
  4410. $8=self._assert_equals_($9,(13));
  4411. $ctx1.sendIdx["assert:equals:"]=5;
  4412. $11=(14)._truncated();
  4413. $ctx1.sendIdx["truncated"]=5;
  4414. $10=self._assert_equals_($11,(14));
  4415. $ctx1.sendIdx["assert:equals:"]=6;
  4416. $13=(15)._truncated();
  4417. $12=self._assert_equals_($13,(15));
  4418. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  4419. args: [],
  4420. 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",
  4421. messageSends: ["assert:equals:", "truncated"],
  4422. referencedClasses: []
  4423. }),
  4424. smalltalk.NumberTest);
  4425. smalltalk.addMethod(
  4426. smalltalk.method({
  4427. selector: "testIdentity",
  4428. category: 'tests',
  4429. fn: function (){
  4430. var self=this;
  4431. return smalltalk.withContext(function($ctx1) {
  4432. var $2,$1,$4,$3,$6,$5,$9,$8,$7,$12,$11,$10,$15,$16,$14,$13,$18,$17;
  4433. $2=(1).__eq_eq((1));
  4434. $ctx1.sendIdx["=="]=1;
  4435. $1=self._assert_($2);
  4436. $ctx1.sendIdx["assert:"]=1;
  4437. $4=(0).__eq_eq((0));
  4438. $ctx1.sendIdx["=="]=2;
  4439. $3=self._assert_($4);
  4440. $ctx1.sendIdx["assert:"]=2;
  4441. $6=(1).__eq_eq((0));
  4442. $ctx1.sendIdx["=="]=3;
  4443. $5=self._deny_($6);
  4444. $ctx1.sendIdx["deny:"]=1;
  4445. $9=(1)._yourself();
  4446. $ctx1.sendIdx["yourself"]=1;
  4447. $8=_st($9).__eq_eq((1));
  4448. $ctx1.sendIdx["=="]=4;
  4449. $7=self._assert_($8);
  4450. $ctx1.sendIdx["assert:"]=3;
  4451. $12=(1)._yourself();
  4452. $ctx1.sendIdx["yourself"]=2;
  4453. $11=(1).__eq_eq($12);
  4454. $ctx1.sendIdx["=="]=5;
  4455. $10=self._assert_($11);
  4456. $ctx1.sendIdx["assert:"]=4;
  4457. $15=(1)._yourself();
  4458. $ctx1.sendIdx["yourself"]=3;
  4459. $16=(1)._yourself();
  4460. $14=_st($15).__eq_eq($16);
  4461. $ctx1.sendIdx["=="]=6;
  4462. $13=self._assert_($14);
  4463. $18=(1).__eq_eq((2));
  4464. $17=self._deny_($18);
  4465. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  4466. args: [],
  4467. 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",
  4468. messageSends: ["assert:", "==", "deny:", "yourself"],
  4469. referencedClasses: []
  4470. }),
  4471. smalltalk.NumberTest);
  4472. smalltalk.addMethod(
  4473. smalltalk.method({
  4474. selector: "testInvalidHexNumbers",
  4475. category: 'tests',
  4476. fn: function (){
  4477. var self=this;
  4478. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4479. return smalltalk.withContext(function($ctx1) {
  4480. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41;
  4481. $1=self._should_raise_((function(){
  4482. return smalltalk.withContext(function($ctx2) {
  4483. return (16)._rG();
  4484. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4485. $ctx1.sendIdx["should:raise:"]=1;
  4486. $2=self._should_raise_((function(){
  4487. return smalltalk.withContext(function($ctx2) {
  4488. return (16)._rg();
  4489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  4490. $ctx1.sendIdx["should:raise:"]=2;
  4491. $3=self._should_raise_((function(){
  4492. return smalltalk.withContext(function($ctx2) {
  4493. return (16)._rH();
  4494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  4495. $ctx1.sendIdx["should:raise:"]=3;
  4496. $4=self._should_raise_((function(){
  4497. return smalltalk.withContext(function($ctx2) {
  4498. return (16)._rh();
  4499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  4500. $ctx1.sendIdx["should:raise:"]=4;
  4501. $5=self._should_raise_((function(){
  4502. return smalltalk.withContext(function($ctx2) {
  4503. return (16)._rI();
  4504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  4505. $ctx1.sendIdx["should:raise:"]=5;
  4506. $6=self._should_raise_((function(){
  4507. return smalltalk.withContext(function($ctx2) {
  4508. return (16)._ri();
  4509. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  4510. $ctx1.sendIdx["should:raise:"]=6;
  4511. $7=self._should_raise_((function(){
  4512. return smalltalk.withContext(function($ctx2) {
  4513. return (16)._rJ();
  4514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  4515. $ctx1.sendIdx["should:raise:"]=7;
  4516. $8=self._should_raise_((function(){
  4517. return smalltalk.withContext(function($ctx2) {
  4518. return (16)._rj();
  4519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  4520. $ctx1.sendIdx["should:raise:"]=8;
  4521. $9=self._should_raise_((function(){
  4522. return smalltalk.withContext(function($ctx2) {
  4523. return (16)._rK();
  4524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  4525. $ctx1.sendIdx["should:raise:"]=9;
  4526. $10=self._should_raise_((function(){
  4527. return smalltalk.withContext(function($ctx2) {
  4528. return (16)._rk();
  4529. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  4530. $ctx1.sendIdx["should:raise:"]=10;
  4531. $11=self._should_raise_((function(){
  4532. return smalltalk.withContext(function($ctx2) {
  4533. return (16)._rL();
  4534. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  4535. $ctx1.sendIdx["should:raise:"]=11;
  4536. $12=self._should_raise_((function(){
  4537. return smalltalk.withContext(function($ctx2) {
  4538. return (16)._rl();
  4539. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  4540. $ctx1.sendIdx["should:raise:"]=12;
  4541. $13=self._should_raise_((function(){
  4542. return smalltalk.withContext(function($ctx2) {
  4543. return (16)._rM();
  4544. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  4545. $ctx1.sendIdx["should:raise:"]=13;
  4546. $14=self._should_raise_((function(){
  4547. return smalltalk.withContext(function($ctx2) {
  4548. return (16)._rm();
  4549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  4550. $ctx1.sendIdx["should:raise:"]=14;
  4551. $15=self._should_raise_((function(){
  4552. return smalltalk.withContext(function($ctx2) {
  4553. return (16)._rN();
  4554. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  4555. $ctx1.sendIdx["should:raise:"]=15;
  4556. $16=self._should_raise_((function(){
  4557. return smalltalk.withContext(function($ctx2) {
  4558. return (16)._rn();
  4559. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  4560. $ctx1.sendIdx["should:raise:"]=16;
  4561. $17=self._should_raise_((function(){
  4562. return smalltalk.withContext(function($ctx2) {
  4563. return (16)._rO();
  4564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  4565. $ctx1.sendIdx["should:raise:"]=17;
  4566. $18=self._should_raise_((function(){
  4567. return smalltalk.withContext(function($ctx2) {
  4568. return (16)._ro();
  4569. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  4570. $ctx1.sendIdx["should:raise:"]=18;
  4571. $19=self._should_raise_((function(){
  4572. return smalltalk.withContext(function($ctx2) {
  4573. return (16)._rP();
  4574. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  4575. $ctx1.sendIdx["should:raise:"]=19;
  4576. $20=self._should_raise_((function(){
  4577. return smalltalk.withContext(function($ctx2) {
  4578. return (16)._rp();
  4579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  4580. $ctx1.sendIdx["should:raise:"]=20;
  4581. $21=self._should_raise_((function(){
  4582. return smalltalk.withContext(function($ctx2) {
  4583. return (16)._rQ();
  4584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  4585. $ctx1.sendIdx["should:raise:"]=21;
  4586. $22=self._should_raise_((function(){
  4587. return smalltalk.withContext(function($ctx2) {
  4588. return (16)._rq();
  4589. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  4590. $ctx1.sendIdx["should:raise:"]=22;
  4591. $23=self._should_raise_((function(){
  4592. return smalltalk.withContext(function($ctx2) {
  4593. return (16)._rR();
  4594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  4595. $ctx1.sendIdx["should:raise:"]=23;
  4596. $24=self._should_raise_((function(){
  4597. return smalltalk.withContext(function($ctx2) {
  4598. return (16)._rr();
  4599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  4600. $ctx1.sendIdx["should:raise:"]=24;
  4601. $25=self._should_raise_((function(){
  4602. return smalltalk.withContext(function($ctx2) {
  4603. return (16)._rS();
  4604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  4605. $ctx1.sendIdx["should:raise:"]=25;
  4606. $26=self._should_raise_((function(){
  4607. return smalltalk.withContext(function($ctx2) {
  4608. return (16)._rs();
  4609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  4610. $ctx1.sendIdx["should:raise:"]=26;
  4611. $27=self._should_raise_((function(){
  4612. return smalltalk.withContext(function($ctx2) {
  4613. return (16)._rT();
  4614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  4615. $ctx1.sendIdx["should:raise:"]=27;
  4616. $28=self._should_raise_((function(){
  4617. return smalltalk.withContext(function($ctx2) {
  4618. return (16)._rt();
  4619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  4620. $ctx1.sendIdx["should:raise:"]=28;
  4621. $29=self._should_raise_((function(){
  4622. return smalltalk.withContext(function($ctx2) {
  4623. return (16)._rU();
  4624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  4625. $ctx1.sendIdx["should:raise:"]=29;
  4626. $30=self._should_raise_((function(){
  4627. return smalltalk.withContext(function($ctx2) {
  4628. return (16)._ru();
  4629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  4630. $ctx1.sendIdx["should:raise:"]=30;
  4631. $31=self._should_raise_((function(){
  4632. return smalltalk.withContext(function($ctx2) {
  4633. return (16)._rV();
  4634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  4635. $ctx1.sendIdx["should:raise:"]=31;
  4636. $32=self._should_raise_((function(){
  4637. return smalltalk.withContext(function($ctx2) {
  4638. return (16)._rv();
  4639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  4640. $ctx1.sendIdx["should:raise:"]=32;
  4641. $33=self._should_raise_((function(){
  4642. return smalltalk.withContext(function($ctx2) {
  4643. return (16)._rW();
  4644. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  4645. $ctx1.sendIdx["should:raise:"]=33;
  4646. $34=self._should_raise_((function(){
  4647. return smalltalk.withContext(function($ctx2) {
  4648. return (16)._rw();
  4649. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  4650. $ctx1.sendIdx["should:raise:"]=34;
  4651. $35=self._should_raise_((function(){
  4652. return smalltalk.withContext(function($ctx2) {
  4653. return (16)._rX();
  4654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  4655. $ctx1.sendIdx["should:raise:"]=35;
  4656. $36=self._should_raise_((function(){
  4657. return smalltalk.withContext(function($ctx2) {
  4658. return (16)._rx();
  4659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  4660. $ctx1.sendIdx["should:raise:"]=36;
  4661. $37=self._should_raise_((function(){
  4662. return smalltalk.withContext(function($ctx2) {
  4663. return (16)._rY();
  4664. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  4665. $ctx1.sendIdx["should:raise:"]=37;
  4666. $38=self._should_raise_((function(){
  4667. return smalltalk.withContext(function($ctx2) {
  4668. return (16)._ry();
  4669. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  4670. $ctx1.sendIdx["should:raise:"]=38;
  4671. $39=self._should_raise_((function(){
  4672. return smalltalk.withContext(function($ctx2) {
  4673. return (16)._rZ();
  4674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  4675. $ctx1.sendIdx["should:raise:"]=39;
  4676. $40=self._should_raise_((function(){
  4677. return smalltalk.withContext(function($ctx2) {
  4678. return (16)._rz();
  4679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  4680. $ctx1.sendIdx["should:raise:"]=40;
  4681. $41=self._should_raise_((function(){
  4682. return smalltalk.withContext(function($ctx2) {
  4683. return (11259375)._Z();
  4684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  4685. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  4686. args: [],
  4687. 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.",
  4688. 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"],
  4689. referencedClasses: ["MessageNotUnderstood"]
  4690. }),
  4691. smalltalk.NumberTest);
  4692. smalltalk.addMethod(
  4693. smalltalk.method({
  4694. selector: "testLog",
  4695. category: 'tests',
  4696. fn: function (){
  4697. var self=this;
  4698. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  4699. return smalltalk.withContext(function($ctx1) {
  4700. var $1,$2,$3;
  4701. $1=self._assert_equals_((10000)._log(),(4));
  4702. $ctx1.sendIdx["assert:equals:"]=1;
  4703. $2=self._assert_equals_((512)._log_((2)),(9));
  4704. $ctx1.sendIdx["assert:equals:"]=2;
  4705. $3=self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  4706. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  4707. args: [],
  4708. source: "testLog\x0a\x09self assert: 10000 log equals: 4.\x0a\x09self assert: (512 log: 2) equals: 9.\x0a\x09self assert: Number e ln equals: 1.",
  4709. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  4710. referencedClasses: ["Number"]
  4711. }),
  4712. smalltalk.NumberTest);
  4713. smalltalk.addMethod(
  4714. smalltalk.method({
  4715. selector: "testMinMax",
  4716. category: 'tests',
  4717. fn: function (){
  4718. var self=this;
  4719. return smalltalk.withContext(function($ctx1) {
  4720. var $1,$2;
  4721. $1=self._assert_equals_((2)._max_((5)),(5));
  4722. $ctx1.sendIdx["assert:equals:"]=1;
  4723. $2=self._assert_equals_((2)._min_((5)),(2));
  4724. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  4725. args: [],
  4726. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  4727. messageSends: ["assert:equals:", "max:", "min:"],
  4728. referencedClasses: []
  4729. }),
  4730. smalltalk.NumberTest);
  4731. smalltalk.addMethod(
  4732. smalltalk.method({
  4733. selector: "testNegated",
  4734. category: 'tests',
  4735. fn: function (){
  4736. var self=this;
  4737. return smalltalk.withContext(function($ctx1) {
  4738. var $2,$1,$4,$3;
  4739. $2=(3)._negated();
  4740. $ctx1.sendIdx["negated"]=1;
  4741. $1=self._assert_equals_($2,(-3));
  4742. $ctx1.sendIdx["assert:equals:"]=1;
  4743. $4=(-3)._negated();
  4744. $3=self._assert_equals_($4,(3));
  4745. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  4746. args: [],
  4747. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  4748. messageSends: ["assert:equals:", "negated"],
  4749. referencedClasses: []
  4750. }),
  4751. smalltalk.NumberTest);
  4752. smalltalk.addMethod(
  4753. smalltalk.method({
  4754. selector: "testPrintShowingDecimalPlaces",
  4755. category: 'tests',
  4756. fn: function (){
  4757. var self=this;
  4758. return smalltalk.withContext(function($ctx1) {
  4759. var $2,$1,$4,$3,$7,$6,$5,$9,$8,$11,$10,$14,$13,$12,$17,$16,$15,$19,$18,$21,$20,$24,$23,$22,$26,$25,$28,$27,$30,$29;
  4760. $2=(23)._printShowingDecimalPlaces_((2));
  4761. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  4762. $1=self._assert_equals_($2,"23.00");
  4763. $ctx1.sendIdx["assert:equals:"]=1;
  4764. $4=(23.5698)._printShowingDecimalPlaces_((2));
  4765. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  4766. $3=self._assert_equals_($4,"23.57");
  4767. $ctx1.sendIdx["assert:equals:"]=2;
  4768. $7=(234.567)._negated();
  4769. $ctx1.sendIdx["negated"]=1;
  4770. $6=_st($7)._printShowingDecimalPlaces_((5));
  4771. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  4772. $5=self._assert_equals_($6,"-234.56700");
  4773. $ctx1.sendIdx["assert:equals:"]=3;
  4774. $9=(23.4567)._printShowingDecimalPlaces_((0));
  4775. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  4776. $8=self._assert_equals_($9,"23");
  4777. $ctx1.sendIdx["assert:equals:"]=4;
  4778. $11=(23.5567)._printShowingDecimalPlaces_((0));
  4779. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  4780. $10=self._assert_equals_($11,"24");
  4781. $ctx1.sendIdx["assert:equals:"]=5;
  4782. $14=(23.4567)._negated();
  4783. $ctx1.sendIdx["negated"]=2;
  4784. $13=_st($14)._printShowingDecimalPlaces_((0));
  4785. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  4786. $12=self._assert_equals_($13,"-23");
  4787. $ctx1.sendIdx["assert:equals:"]=6;
  4788. $17=(23.5567)._negated();
  4789. $ctx1.sendIdx["negated"]=3;
  4790. $16=_st($17)._printShowingDecimalPlaces_((0));
  4791. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  4792. $15=self._assert_equals_($16,"-24");
  4793. $ctx1.sendIdx["assert:equals:"]=7;
  4794. $19=(100000000)._printShowingDecimalPlaces_((1));
  4795. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  4796. $18=self._assert_equals_($19,"100000000.0");
  4797. $ctx1.sendIdx["assert:equals:"]=8;
  4798. $21=(0.98)._printShowingDecimalPlaces_((5));
  4799. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  4800. $20=self._assert_equals_($21,"0.98000");
  4801. $ctx1.sendIdx["assert:equals:"]=9;
  4802. $24=(0.98)._negated();
  4803. $23=_st($24)._printShowingDecimalPlaces_((2));
  4804. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  4805. $22=self._assert_equals_($23,"-0.98");
  4806. $ctx1.sendIdx["assert:equals:"]=10;
  4807. $26=(2.567)._printShowingDecimalPlaces_((2));
  4808. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  4809. $25=self._assert_equals_($26,"2.57");
  4810. $ctx1.sendIdx["assert:equals:"]=11;
  4811. $28=(-2.567)._printShowingDecimalPlaces_((2));
  4812. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  4813. $27=self._assert_equals_($28,"-2.57");
  4814. $ctx1.sendIdx["assert:equals:"]=12;
  4815. $30=(0)._printShowingDecimalPlaces_((2));
  4816. $29=self._assert_equals_($30,"0.00");
  4817. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  4818. args: [],
  4819. 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'.",
  4820. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  4821. referencedClasses: []
  4822. }),
  4823. smalltalk.NumberTest);
  4824. smalltalk.addMethod(
  4825. smalltalk.method({
  4826. selector: "testRaisedTo",
  4827. category: 'tests',
  4828. fn: function (){
  4829. var self=this;
  4830. return smalltalk.withContext(function($ctx1) {
  4831. var $2,$1,$4,$3,$6,$5,$8,$7,$9;
  4832. $2=(2)._raisedTo_((4));
  4833. $ctx1.sendIdx["raisedTo:"]=1;
  4834. $1=self._assert_equals_($2,(16));
  4835. $ctx1.sendIdx["assert:equals:"]=1;
  4836. $4=(2)._raisedTo_((0));
  4837. $ctx1.sendIdx["raisedTo:"]=2;
  4838. $3=self._assert_equals_($4,(1));
  4839. $ctx1.sendIdx["assert:equals:"]=2;
  4840. $6=(2)._raisedTo_((-3));
  4841. $ctx1.sendIdx["raisedTo:"]=3;
  4842. $5=self._assert_equals_($6,(0.125));
  4843. $ctx1.sendIdx["assert:equals:"]=3;
  4844. $8=(4)._raisedTo_((0.5));
  4845. $7=self._assert_equals_($8,(2));
  4846. $ctx1.sendIdx["assert:equals:"]=4;
  4847. $9=self._assert_equals_((2).__star_star((4)),(16));
  4848. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  4849. args: [],
  4850. source: "testRaisedTo\x0a\x09self assert: (2 raisedTo: 4) equals: 16.\x0a\x09self assert: (2 raisedTo: 0) equals: 1.\x0a\x09self assert: (2 raisedTo: -3) equals: 0.125.\x0a\x09self assert: (4 raisedTo: 0.5) equals: 2.\x0a\x09\x0a\x09self assert: 2 ** 4 equals: 16.",
  4851. messageSends: ["assert:equals:", "raisedTo:", "**"],
  4852. referencedClasses: []
  4853. }),
  4854. smalltalk.NumberTest);
  4855. smalltalk.addMethod(
  4856. smalltalk.method({
  4857. selector: "testRounded",
  4858. category: 'tests',
  4859. fn: function (){
  4860. var self=this;
  4861. return smalltalk.withContext(function($ctx1) {
  4862. var $2,$1,$4,$3,$6,$5;
  4863. $2=(3)._rounded();
  4864. $ctx1.sendIdx["rounded"]=1;
  4865. $1=self._assert_equals_($2,(3));
  4866. $ctx1.sendIdx["assert:equals:"]=1;
  4867. $4=(3.212)._rounded();
  4868. $ctx1.sendIdx["rounded"]=2;
  4869. $3=self._assert_equals_($4,(3));
  4870. $ctx1.sendIdx["assert:equals:"]=2;
  4871. $6=(3.51)._rounded();
  4872. $5=self._assert_equals_($6,(4));
  4873. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  4874. args: [],
  4875. 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",
  4876. messageSends: ["assert:equals:", "rounded"],
  4877. referencedClasses: []
  4878. }),
  4879. smalltalk.NumberTest);
  4880. smalltalk.addMethod(
  4881. smalltalk.method({
  4882. selector: "testSign",
  4883. category: 'tests',
  4884. fn: function (){
  4885. var self=this;
  4886. return smalltalk.withContext(function($ctx1) {
  4887. var $2,$1,$4,$3,$6,$5;
  4888. $2=(5)._sign();
  4889. $ctx1.sendIdx["sign"]=1;
  4890. $1=self._assert_equals_($2,(1));
  4891. $ctx1.sendIdx["assert:equals:"]=1;
  4892. $4=(0)._sign();
  4893. $ctx1.sendIdx["sign"]=2;
  4894. $3=self._assert_equals_($4,(0));
  4895. $ctx1.sendIdx["assert:equals:"]=2;
  4896. $6=(-1.4)._sign();
  4897. $5=self._assert_equals_($6,(-1));
  4898. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  4899. args: [],
  4900. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  4901. messageSends: ["assert:equals:", "sign"],
  4902. referencedClasses: []
  4903. }),
  4904. smalltalk.NumberTest);
  4905. smalltalk.addMethod(
  4906. smalltalk.method({
  4907. selector: "testSqrt",
  4908. category: 'tests',
  4909. fn: function (){
  4910. var self=this;
  4911. return smalltalk.withContext(function($ctx1) {
  4912. var $2,$1,$4,$3;
  4913. $2=(4)._sqrt();
  4914. $ctx1.sendIdx["sqrt"]=1;
  4915. $1=self._assert_equals_($2,(2));
  4916. $ctx1.sendIdx["assert:equals:"]=1;
  4917. $4=(16)._sqrt();
  4918. $3=self._assert_equals_($4,(4));
  4919. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  4920. args: [],
  4921. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  4922. messageSends: ["assert:equals:", "sqrt"],
  4923. referencedClasses: []
  4924. }),
  4925. smalltalk.NumberTest);
  4926. smalltalk.addMethod(
  4927. smalltalk.method({
  4928. selector: "testSquared",
  4929. category: 'tests',
  4930. fn: function (){
  4931. var self=this;
  4932. return smalltalk.withContext(function($ctx1) {
  4933. self._assert_equals_((4)._squared(),(16));
  4934. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  4935. args: [],
  4936. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  4937. messageSends: ["assert:equals:", "squared"],
  4938. referencedClasses: []
  4939. }),
  4940. smalltalk.NumberTest);
  4941. smalltalk.addMethod(
  4942. smalltalk.method({
  4943. selector: "testTimesRepeat",
  4944. category: 'tests',
  4945. fn: function (){
  4946. var self=this;
  4947. var i;
  4948. return smalltalk.withContext(function($ctx1) {
  4949. var $1,$2,$3,$4;
  4950. i=(0);
  4951. $1=(0)._timesRepeat_((function(){
  4952. return smalltalk.withContext(function($ctx2) {
  4953. i=_st(i).__plus((1));
  4954. $ctx2.sendIdx["+"]=1;
  4955. return i;
  4956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4957. $ctx1.sendIdx["timesRepeat:"]=1;
  4958. $2=self._assert_equals_(i,(0));
  4959. $ctx1.sendIdx["assert:equals:"]=1;
  4960. $3=(5)._timesRepeat_((function(){
  4961. return smalltalk.withContext(function($ctx2) {
  4962. i=_st(i).__plus((1));
  4963. return i;
  4964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4965. $4=self._assert_equals_(i,(5));
  4966. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  4967. args: [],
  4968. 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",
  4969. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  4970. referencedClasses: []
  4971. }),
  4972. smalltalk.NumberTest);
  4973. smalltalk.addMethod(
  4974. smalltalk.method({
  4975. selector: "testTo",
  4976. category: 'tests',
  4977. fn: function (){
  4978. var self=this;
  4979. return smalltalk.withContext(function($ctx1) {
  4980. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  4981. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  4982. args: [],
  4983. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  4984. messageSends: ["assert:equals:", "to:"],
  4985. referencedClasses: []
  4986. }),
  4987. smalltalk.NumberTest);
  4988. smalltalk.addMethod(
  4989. smalltalk.method({
  4990. selector: "testToBy",
  4991. category: 'tests',
  4992. fn: function (){
  4993. var self=this;
  4994. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4995. return smalltalk.withContext(function($ctx1) {
  4996. var $1;
  4997. $1=(0)._to_by_((6),(2));
  4998. $ctx1.sendIdx["to:by:"]=1;
  4999. self._assert_equals_($1,[(0), (2), (4), (6)]);
  5000. self._should_raise_((function(){
  5001. return smalltalk.withContext(function($ctx2) {
  5002. return (1)._to_by_((4),(0));
  5003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5004. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  5005. args: [],
  5006. 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",
  5007. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  5008. referencedClasses: ["Error"]
  5009. }),
  5010. smalltalk.NumberTest);
  5011. smalltalk.addMethod(
  5012. smalltalk.method({
  5013. selector: "testTrigonometry",
  5014. category: 'tests',
  5015. fn: function (){
  5016. var self=this;
  5017. return smalltalk.withContext(function($ctx1) {
  5018. var $1,$2,$3,$4,$5,$6;
  5019. $1=self._assert_equals_((0)._cos(),(1));
  5020. $ctx1.sendIdx["assert:equals:"]=1;
  5021. $2=self._assert_equals_((0)._sin(),(0));
  5022. $ctx1.sendIdx["assert:equals:"]=2;
  5023. $3=self._assert_equals_((0)._tan(),(0));
  5024. $ctx1.sendIdx["assert:equals:"]=3;
  5025. $4=self._assert_equals_((1)._arcCos(),(0));
  5026. $ctx1.sendIdx["assert:equals:"]=4;
  5027. $5=self._assert_equals_((0)._arcSin(),(0));
  5028. $ctx1.sendIdx["assert:equals:"]=5;
  5029. $6=self._assert_equals_((0)._arcTan(),(0));
  5030. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  5031. args: [],
  5032. source: "testTrigonometry\x0a\x09self assert: 0 cos equals: 1.\x0a\x09self assert: 0 sin equals: 0.\x0a\x09self assert: 0 tan equals: 0.\x0a\x09self assert: 1 arcCos equals: 0.\x0a\x09self assert: 0 arcSin equals: 0.\x0a\x09self assert: 0 arcTan equals: 0.",
  5033. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  5034. referencedClasses: []
  5035. }),
  5036. smalltalk.NumberTest);
  5037. smalltalk.addMethod(
  5038. smalltalk.method({
  5039. selector: "testTruncated",
  5040. category: 'tests',
  5041. fn: function (){
  5042. var self=this;
  5043. return smalltalk.withContext(function($ctx1) {
  5044. var $2,$1,$4,$3,$6,$5;
  5045. $2=(3)._truncated();
  5046. $ctx1.sendIdx["truncated"]=1;
  5047. $1=self._assert_equals_($2,(3));
  5048. $ctx1.sendIdx["assert:equals:"]=1;
  5049. $4=(3.212)._truncated();
  5050. $ctx1.sendIdx["truncated"]=2;
  5051. $3=self._assert_equals_($4,(3));
  5052. $ctx1.sendIdx["assert:equals:"]=2;
  5053. $6=(3.51)._truncated();
  5054. $5=self._assert_equals_($6,(3));
  5055. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  5056. args: [],
  5057. 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",
  5058. messageSends: ["assert:equals:", "truncated"],
  5059. referencedClasses: []
  5060. }),
  5061. smalltalk.NumberTest);
  5062. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  5063. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  5064. smalltalk.addMethod(
  5065. smalltalk.method({
  5066. selector: "foo",
  5067. category: 'not yet classified',
  5068. fn: function (){
  5069. var self=this;
  5070. return smalltalk.withContext(function($ctx1) {
  5071. var $1;
  5072. $1=self["@foo"];
  5073. return $1;
  5074. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  5075. args: [],
  5076. source: "foo\x0a\x09^foo",
  5077. messageSends: [],
  5078. referencedClasses: []
  5079. }),
  5080. smalltalk.ObjectMock);
  5081. smalltalk.addMethod(
  5082. smalltalk.method({
  5083. selector: "foo:",
  5084. category: 'not yet classified',
  5085. fn: function (anObject){
  5086. var self=this;
  5087. return smalltalk.withContext(function($ctx1) {
  5088. self["@foo"]=anObject;
  5089. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  5090. args: ["anObject"],
  5091. source: "foo: anObject\x0a\x09foo := anObject",
  5092. messageSends: [],
  5093. referencedClasses: []
  5094. }),
  5095. smalltalk.ObjectMock);
  5096. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5097. smalltalk.addMethod(
  5098. smalltalk.method({
  5099. selector: "notDefined",
  5100. category: 'tests',
  5101. fn: function (){
  5102. var self=this;
  5103. return smalltalk.withContext(function($ctx1) {
  5104. return void 0;;
  5105. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  5106. args: [],
  5107. source: "notDefined\x0a\x09<return void 0;>",
  5108. messageSends: [],
  5109. referencedClasses: []
  5110. }),
  5111. smalltalk.ObjectTest);
  5112. smalltalk.addMethod(
  5113. smalltalk.method({
  5114. selector: "testBasicAccess",
  5115. category: 'tests',
  5116. fn: function (){
  5117. var self=this;
  5118. var o;
  5119. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5120. return smalltalk.withContext(function($ctx1) {
  5121. var $2,$1,$4,$3;
  5122. o=_st($Object())._new();
  5123. _st(o)._basicAt_put_("a",(1));
  5124. $2=_st(o)._basicAt_("a");
  5125. $ctx1.sendIdx["basicAt:"]=1;
  5126. $1=self._assert_equals_($2,(1));
  5127. $ctx1.sendIdx["assert:equals:"]=1;
  5128. $4=_st(o)._basicAt_("b");
  5129. $3=self._assert_equals_($4,nil);
  5130. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  5131. args: [],
  5132. 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",
  5133. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  5134. referencedClasses: ["Object"]
  5135. }),
  5136. smalltalk.ObjectTest);
  5137. smalltalk.addMethod(
  5138. smalltalk.method({
  5139. selector: "testBasicPerform",
  5140. category: 'tests',
  5141. fn: function (){
  5142. var self=this;
  5143. var o;
  5144. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5145. return smalltalk.withContext(function($ctx1) {
  5146. var $1,$2,$3,$4;
  5147. o=_st($Object())._new();
  5148. $1=_st(o)._basicAt_put_("func",(function(){
  5149. return smalltalk.withContext(function($ctx2) {
  5150. return "hello";
  5151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5152. $ctx1.sendIdx["basicAt:put:"]=1;
  5153. $2=_st(o)._basicAt_put_("func2",(function(a){
  5154. return smalltalk.withContext(function($ctx2) {
  5155. return _st(a).__plus((1));
  5156. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  5157. $3=self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  5158. $ctx1.sendIdx["assert:equals:"]=1;
  5159. $4=self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  5160. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  5161. args: [],
  5162. 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",
  5163. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  5164. referencedClasses: ["Object"]
  5165. }),
  5166. smalltalk.ObjectTest);
  5167. smalltalk.addMethod(
  5168. smalltalk.method({
  5169. selector: "testDNU",
  5170. category: 'tests',
  5171. fn: function (){
  5172. var self=this;
  5173. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5174. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5175. return smalltalk.withContext(function($ctx1) {
  5176. self._should_raise_((function(){
  5177. return smalltalk.withContext(function($ctx2) {
  5178. return _st(_st($Object())._new())._foo();
  5179. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5180. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  5181. args: [],
  5182. source: "testDNU\x0a\x09self should: [Object new foo] raise: MessageNotUnderstood",
  5183. messageSends: ["should:raise:", "foo", "new"],
  5184. referencedClasses: ["Object", "MessageNotUnderstood"]
  5185. }),
  5186. smalltalk.ObjectTest);
  5187. smalltalk.addMethod(
  5188. smalltalk.method({
  5189. selector: "testEquality",
  5190. category: 'tests',
  5191. fn: function (){
  5192. var self=this;
  5193. var o;
  5194. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5195. return smalltalk.withContext(function($ctx1) {
  5196. var $2,$3,$1,$5,$4,$8,$7,$6,$11,$12,$10,$9;
  5197. o=_st($Object())._new();
  5198. $ctx1.sendIdx["new"]=1;
  5199. $2=o;
  5200. $3=_st($Object())._new();
  5201. $1=_st($2).__eq($3);
  5202. $ctx1.sendIdx["="]=1;
  5203. self._deny_($1);
  5204. $5=_st(o).__eq(o);
  5205. $ctx1.sendIdx["="]=2;
  5206. $4=self._assert_($5);
  5207. $ctx1.sendIdx["assert:"]=1;
  5208. $8=_st(o)._yourself();
  5209. $ctx1.sendIdx["yourself"]=1;
  5210. $7=_st($8).__eq(o);
  5211. $ctx1.sendIdx["="]=3;
  5212. $6=self._assert_($7);
  5213. $ctx1.sendIdx["assert:"]=2;
  5214. $11=o;
  5215. $12=_st(o)._yourself();
  5216. $10=_st($11).__eq($12);
  5217. $9=self._assert_($10);
  5218. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  5219. args: [],
  5220. 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)",
  5221. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  5222. referencedClasses: ["Object"]
  5223. }),
  5224. smalltalk.ObjectTest);
  5225. smalltalk.addMethod(
  5226. smalltalk.method({
  5227. selector: "testHalt",
  5228. category: 'tests',
  5229. fn: function (){
  5230. var self=this;
  5231. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5232. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5233. return smalltalk.withContext(function($ctx1) {
  5234. self._should_raise_((function(){
  5235. return smalltalk.withContext(function($ctx2) {
  5236. return _st(_st($Object())._new())._halt();
  5237. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5238. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  5239. args: [],
  5240. source: "testHalt\x0a\x09self should: [Object new halt] raise: Error",
  5241. messageSends: ["should:raise:", "halt", "new"],
  5242. referencedClasses: ["Object", "Error"]
  5243. }),
  5244. smalltalk.ObjectTest);
  5245. smalltalk.addMethod(
  5246. smalltalk.method({
  5247. selector: "testIdentity",
  5248. category: 'tests',
  5249. fn: function (){
  5250. var self=this;
  5251. var o;
  5252. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5253. return smalltalk.withContext(function($ctx1) {
  5254. var $2,$3,$1,$5,$4,$8,$7,$6,$11,$12,$10,$9;
  5255. o=_st($Object())._new();
  5256. $ctx1.sendIdx["new"]=1;
  5257. $2=o;
  5258. $3=_st($Object())._new();
  5259. $1=_st($2).__eq_eq($3);
  5260. $ctx1.sendIdx["=="]=1;
  5261. self._deny_($1);
  5262. $5=_st(o).__eq_eq(o);
  5263. $ctx1.sendIdx["=="]=2;
  5264. $4=self._assert_($5);
  5265. $ctx1.sendIdx["assert:"]=1;
  5266. $8=_st(o)._yourself();
  5267. $ctx1.sendIdx["yourself"]=1;
  5268. $7=_st($8).__eq_eq(o);
  5269. $ctx1.sendIdx["=="]=3;
  5270. $6=self._assert_($7);
  5271. $ctx1.sendIdx["assert:"]=2;
  5272. $11=o;
  5273. $12=_st(o)._yourself();
  5274. $10=_st($11).__eq_eq($12);
  5275. $9=self._assert_($10);
  5276. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  5277. args: [],
  5278. 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",
  5279. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  5280. referencedClasses: ["Object"]
  5281. }),
  5282. smalltalk.ObjectTest);
  5283. smalltalk.addMethod(
  5284. smalltalk.method({
  5285. selector: "testIfNil",
  5286. category: 'tests',
  5287. fn: function (){
  5288. var self=this;
  5289. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5290. return smalltalk.withContext(function($ctx1) {
  5291. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8,$13,$12,$11,$16,$15,$14;
  5292. $3=_st($Object())._new();
  5293. $ctx1.sendIdx["new"]=1;
  5294. $2=_st($3)._isNil();
  5295. $1=self._deny_($2);
  5296. $ctx1.sendIdx["deny:"]=1;
  5297. $7=_st($Object())._new();
  5298. $ctx1.sendIdx["new"]=2;
  5299. if(($receiver = $7) == nil || $receiver == null){
  5300. $6=true;
  5301. } else {
  5302. $6=$7;
  5303. };
  5304. $5=_st($6).__eq(true);
  5305. $4=self._deny_($5);
  5306. $10=_st($Object())._new();
  5307. $ctx1.sendIdx["new"]=3;
  5308. if(($receiver = $10) == nil || $receiver == null){
  5309. $9=$10;
  5310. } else {
  5311. $9=true;
  5312. };
  5313. $8=self._assert_equals_($9,true);
  5314. $ctx1.sendIdx["assert:equals:"]=1;
  5315. $13=_st($Object())._new();
  5316. $ctx1.sendIdx["new"]=4;
  5317. if(($receiver = $13) == nil || $receiver == null){
  5318. $12=false;
  5319. } else {
  5320. $12=true;
  5321. };
  5322. $11=self._assert_equals_($12,true);
  5323. $ctx1.sendIdx["assert:equals:"]=2;
  5324. $16=_st($Object())._new();
  5325. if(($receiver = $16) == nil || $receiver == null){
  5326. $15=false;
  5327. } else {
  5328. $15=true;
  5329. };
  5330. $14=self._assert_equals_($15,true);
  5331. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  5332. args: [],
  5333. 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",
  5334. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  5335. referencedClasses: ["Object"]
  5336. }),
  5337. smalltalk.ObjectTest);
  5338. smalltalk.addMethod(
  5339. smalltalk.method({
  5340. selector: "testInstVars",
  5341. category: 'tests',
  5342. fn: function (){
  5343. var self=this;
  5344. var o;
  5345. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5346. return smalltalk.withContext(function($ctx1) {
  5347. var $2,$1,$4,$3,$6,$5;
  5348. o=_st($ObjectMock())._new();
  5349. $2=_st(o)._instVarAt_("foo");
  5350. $ctx1.sendIdx["instVarAt:"]=1;
  5351. $1=self._assert_equals_($2,nil);
  5352. $ctx1.sendIdx["assert:equals:"]=1;
  5353. _st(o)._instVarAt_put_("foo",(1));
  5354. $4=_st(o)._instVarAt_("foo");
  5355. $ctx1.sendIdx["instVarAt:"]=2;
  5356. $3=self._assert_equals_($4,(1));
  5357. $ctx1.sendIdx["assert:equals:"]=2;
  5358. $6=_st(o)._instVarAt_("foo");
  5359. $5=self._assert_equals_($6,(1));
  5360. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  5361. args: [],
  5362. 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",
  5363. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  5364. referencedClasses: ["ObjectMock"]
  5365. }),
  5366. smalltalk.ObjectTest);
  5367. smalltalk.addMethod(
  5368. smalltalk.method({
  5369. selector: "testNilUndefined",
  5370. category: 'tests',
  5371. fn: function (){
  5372. var self=this;
  5373. return smalltalk.withContext(function($ctx1) {
  5374. self._assert_equals_(self._notDefined(),nil);
  5375. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  5376. args: [],
  5377. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  5378. messageSends: ["assert:equals:", "notDefined"],
  5379. referencedClasses: []
  5380. }),
  5381. smalltalk.ObjectTest);
  5382. smalltalk.addMethod(
  5383. smalltalk.method({
  5384. selector: "testYourself",
  5385. category: 'tests',
  5386. fn: function (){
  5387. var self=this;
  5388. var o;
  5389. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5390. return smalltalk.withContext(function($ctx1) {
  5391. o=_st($ObjectMock())._new();
  5392. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  5393. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  5394. args: [],
  5395. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  5396. messageSends: ["new", "assert:", "==", "yourself"],
  5397. referencedClasses: ["ObjectMock"]
  5398. }),
  5399. smalltalk.ObjectTest);
  5400. smalltalk.addMethod(
  5401. smalltalk.method({
  5402. selector: "testidentityHash",
  5403. category: 'tests',
  5404. fn: function (){
  5405. var self=this;
  5406. var o1,o2;
  5407. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5408. return smalltalk.withContext(function($ctx1) {
  5409. var $2,$3,$1,$5,$6,$4;
  5410. o1=_st($Object())._new();
  5411. $ctx1.sendIdx["new"]=1;
  5412. o2=_st($Object())._new();
  5413. $2=_st(o1)._identityHash();
  5414. $ctx1.sendIdx["identityHash"]=1;
  5415. $3=_st(o1)._identityHash();
  5416. $ctx1.sendIdx["identityHash"]=2;
  5417. $1=_st($2).__eq_eq($3);
  5418. $ctx1.sendIdx["=="]=1;
  5419. self._assert_($1);
  5420. $5=_st(o1)._identityHash();
  5421. $ctx1.sendIdx["identityHash"]=3;
  5422. $6=_st(o2)._identityHash();
  5423. $4=_st($5).__eq_eq($6);
  5424. self._deny_($4);
  5425. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  5426. args: [],
  5427. 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",
  5428. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  5429. referencedClasses: ["Object"]
  5430. }),
  5431. smalltalk.ObjectTest);
  5432. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5433. smalltalk.addMethod(
  5434. smalltalk.method({
  5435. selector: "testAccessing",
  5436. category: 'tests',
  5437. fn: function (){
  5438. var self=this;
  5439. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5440. return smalltalk.withContext(function($ctx1) {
  5441. var $3,$2,$1,$6,$5,$4,$10,$9,$8,$7,$14,$13,$12,$11;
  5442. $3=_st($Point())._x_y_((3),(4));
  5443. $ctx1.sendIdx["x:y:"]=1;
  5444. $2=_st($3)._x();
  5445. $ctx1.sendIdx["x"]=1;
  5446. $1=self._assert_equals_($2,(3));
  5447. $ctx1.sendIdx["assert:equals:"]=1;
  5448. $6=_st($Point())._x_y_((3),(4));
  5449. $5=_st($6)._y();
  5450. $ctx1.sendIdx["y"]=1;
  5451. $4=self._assert_equals_($5,(4));
  5452. $ctx1.sendIdx["assert:equals:"]=2;
  5453. $10=_st($Point())._new();
  5454. $ctx1.sendIdx["new"]=1;
  5455. $9=_st($10)._x_((3));
  5456. $8=_st($9)._x();
  5457. $7=self._assert_equals_($8,(3));
  5458. $ctx1.sendIdx["assert:equals:"]=3;
  5459. $14=_st($Point())._new();
  5460. $13=_st($14)._y_((4));
  5461. $12=_st($13)._y();
  5462. $11=self._assert_equals_($12,(4));
  5463. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  5464. args: [],
  5465. 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",
  5466. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  5467. referencedClasses: ["Point"]
  5468. }),
  5469. smalltalk.PointTest);
  5470. smalltalk.addMethod(
  5471. smalltalk.method({
  5472. selector: "testArithmetic",
  5473. category: 'tests',
  5474. fn: function (){
  5475. var self=this;
  5476. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5477. return smalltalk.withContext(function($ctx1) {
  5478. var $3,$4,$2,$5,$1,$8,$9,$7,$10,$6,$13,$14,$12,$15,$11,$18,$19,$17,$20,$16;
  5479. $3=(3).__at((4));
  5480. $ctx1.sendIdx["@"]=1;
  5481. $4=(3).__at((4));
  5482. $ctx1.sendIdx["@"]=2;
  5483. $2=_st($3).__star($4);
  5484. $5=_st($Point())._x_y_((9),(16));
  5485. $ctx1.sendIdx["x:y:"]=1;
  5486. $1=self._assert_equals_($2,$5);
  5487. $ctx1.sendIdx["assert:equals:"]=1;
  5488. $8=(3).__at((4));
  5489. $ctx1.sendIdx["@"]=3;
  5490. $9=(3).__at((4));
  5491. $ctx1.sendIdx["@"]=4;
  5492. $7=_st($8).__plus($9);
  5493. $10=_st($Point())._x_y_((6),(8));
  5494. $ctx1.sendIdx["x:y:"]=2;
  5495. $6=self._assert_equals_($7,$10);
  5496. $ctx1.sendIdx["assert:equals:"]=2;
  5497. $13=(3).__at((4));
  5498. $ctx1.sendIdx["@"]=5;
  5499. $14=(3).__at((4));
  5500. $ctx1.sendIdx["@"]=6;
  5501. $12=_st($13).__minus($14);
  5502. $15=_st($Point())._x_y_((0),(0));
  5503. $ctx1.sendIdx["x:y:"]=3;
  5504. $11=self._assert_equals_($12,$15);
  5505. $ctx1.sendIdx["assert:equals:"]=3;
  5506. $18=(6).__at((8));
  5507. $ctx1.sendIdx["@"]=7;
  5508. $19=(3).__at((4));
  5509. $17=_st($18).__slash($19);
  5510. $20=_st($Point())._x_y_((2),(2));
  5511. $16=self._assert_equals_($17,$20);
  5512. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  5513. args: [],
  5514. 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)",
  5515. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  5516. referencedClasses: ["Point"]
  5517. }),
  5518. smalltalk.PointTest);
  5519. smalltalk.addMethod(
  5520. smalltalk.method({
  5521. selector: "testAt",
  5522. category: 'tests',
  5523. fn: function (){
  5524. var self=this;
  5525. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5526. return smalltalk.withContext(function($ctx1) {
  5527. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  5528. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  5529. args: [],
  5530. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  5531. messageSends: ["assert:equals:", "@", "x:y:"],
  5532. referencedClasses: ["Point"]
  5533. }),
  5534. smalltalk.PointTest);
  5535. smalltalk.addMethod(
  5536. smalltalk.method({
  5537. selector: "testEgality",
  5538. category: 'tests',
  5539. fn: function (){
  5540. var self=this;
  5541. return smalltalk.withContext(function($ctx1) {
  5542. var $2,$3,$1,$5,$6,$4;
  5543. $2=(3).__at((4));
  5544. $ctx1.sendIdx["@"]=1;
  5545. $3=(3).__at((4));
  5546. $ctx1.sendIdx["@"]=2;
  5547. $1=_st($2).__eq($3);
  5548. $ctx1.sendIdx["="]=1;
  5549. self._assert_($1);
  5550. $5=(3).__at((5));
  5551. $ctx1.sendIdx["@"]=3;
  5552. $6=(3).__at((6));
  5553. $4=_st($5).__eq($6);
  5554. self._deny_($4);
  5555. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  5556. args: [],
  5557. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  5558. messageSends: ["assert:", "=", "@", "deny:"],
  5559. referencedClasses: []
  5560. }),
  5561. smalltalk.PointTest);
  5562. smalltalk.addMethod(
  5563. smalltalk.method({
  5564. selector: "testTranslateBy",
  5565. category: 'tests',
  5566. fn: function (){
  5567. var self=this;
  5568. return smalltalk.withContext(function($ctx1) {
  5569. var $3,$4,$2,$5,$1,$8,$10,$9,$7,$11,$6,$14,$15,$13,$16,$12,$19,$21,$20,$18,$22,$17;
  5570. $3=(3).__at((3));
  5571. $ctx1.sendIdx["@"]=1;
  5572. $4=(0).__at((1));
  5573. $ctx1.sendIdx["@"]=2;
  5574. $2=_st($3)._translateBy_($4);
  5575. $ctx1.sendIdx["translateBy:"]=1;
  5576. $5=(3).__at((4));
  5577. $ctx1.sendIdx["@"]=3;
  5578. $1=self._assert_equals_($2,$5);
  5579. $ctx1.sendIdx["assert:equals:"]=1;
  5580. $8=(3).__at((3));
  5581. $ctx1.sendIdx["@"]=4;
  5582. $10=(1)._negated();
  5583. $ctx1.sendIdx["negated"]=1;
  5584. $9=(0).__at($10);
  5585. $ctx1.sendIdx["@"]=5;
  5586. $7=_st($8)._translateBy_($9);
  5587. $ctx1.sendIdx["translateBy:"]=2;
  5588. $11=(3).__at((2));
  5589. $ctx1.sendIdx["@"]=6;
  5590. $6=self._assert_equals_($7,$11);
  5591. $ctx1.sendIdx["assert:equals:"]=2;
  5592. $14=(3).__at((3));
  5593. $ctx1.sendIdx["@"]=7;
  5594. $15=(2).__at((3));
  5595. $ctx1.sendIdx["@"]=8;
  5596. $13=_st($14)._translateBy_($15);
  5597. $ctx1.sendIdx["translateBy:"]=3;
  5598. $16=(5).__at((6));
  5599. $ctx1.sendIdx["@"]=9;
  5600. $12=self._assert_equals_($13,$16);
  5601. $ctx1.sendIdx["assert:equals:"]=3;
  5602. $19=(3).__at((3));
  5603. $ctx1.sendIdx["@"]=10;
  5604. $21=(3)._negated();
  5605. $20=_st($21).__at((0));
  5606. $ctx1.sendIdx["@"]=11;
  5607. $18=_st($19)._translateBy_($20);
  5608. $22=(0).__at((3));
  5609. $17=self._assert_equals_($18,$22);
  5610. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  5611. args: [],
  5612. 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.",
  5613. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  5614. referencedClasses: []
  5615. }),
  5616. smalltalk.PointTest);
  5617. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5618. smalltalk.addMethod(
  5619. smalltalk.method({
  5620. selector: "textNext",
  5621. category: 'tests',
  5622. fn: function (){
  5623. var self=this;
  5624. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  5625. return smalltalk.withContext(function($ctx1) {
  5626. var $1;
  5627. (10000)._timesRepeat_((function(){
  5628. var current,next;
  5629. return smalltalk.withContext(function($ctx2) {
  5630. next=_st(_st($Random())._new())._next();
  5631. next;
  5632. self._assert_(_st(next).__gt_eq((0)));
  5633. $ctx2.sendIdx["assert:"]=1;
  5634. self._assert_(_st(next).__lt((1)));
  5635. $1=_st(current).__eq(next);
  5636. $ctx2.sendIdx["="]=1;
  5637. self._deny_($1);
  5638. return _st(next).__eq(current);
  5639. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  5640. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  5641. args: [],
  5642. 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]",
  5643. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  5644. referencedClasses: ["Random"]
  5645. }),
  5646. smalltalk.RandomTest);
  5647. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5648. smalltalk.addMethod(
  5649. smalltalk.method({
  5650. selector: "testAddRemove",
  5651. category: 'tests',
  5652. fn: function (){
  5653. var self=this;
  5654. var set;
  5655. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5656. return smalltalk.withContext(function($ctx1) {
  5657. var $1,$2,$4,$3,$5,$7,$6,$8;
  5658. set=_st($Set())._new();
  5659. $1=self._assert_(_st(set)._isEmpty());
  5660. $ctx1.sendIdx["assert:"]=1;
  5661. $2=_st(set)._add_((3));
  5662. $ctx1.sendIdx["add:"]=1;
  5663. $4=_st(set)._includes_((3));
  5664. $ctx1.sendIdx["includes:"]=1;
  5665. $3=self._assert_($4);
  5666. $ctx1.sendIdx["assert:"]=2;
  5667. $5=_st(set)._add_((5));
  5668. $7=_st(set)._includes_((5));
  5669. $ctx1.sendIdx["includes:"]=2;
  5670. $6=self._assert_($7);
  5671. _st(set)._remove_((3));
  5672. $8=_st(set)._includes_((3));
  5673. self._deny_($8);
  5674. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  5675. args: [],
  5676. 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)",
  5677. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5678. referencedClasses: ["Set"]
  5679. }),
  5680. smalltalk.SetTest);
  5681. smalltalk.addMethod(
  5682. smalltalk.method({
  5683. selector: "testAt",
  5684. category: 'tests',
  5685. fn: function (){
  5686. var self=this;
  5687. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5688. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5689. return smalltalk.withContext(function($ctx1) {
  5690. self._should_raise_((function(){
  5691. return smalltalk.withContext(function($ctx2) {
  5692. return _st(_st($Set())._new())._at_put_((1),(2));
  5693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5694. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  5695. args: [],
  5696. source: "testAt\x0a\x09self should: [Set new at: 1 put: 2] raise: Error",
  5697. messageSends: ["should:raise:", "at:put:", "new"],
  5698. referencedClasses: ["Set", "Error"]
  5699. }),
  5700. smalltalk.SetTest);
  5701. smalltalk.addMethod(
  5702. smalltalk.method({
  5703. selector: "testCollect",
  5704. category: 'tests',
  5705. fn: function (){
  5706. var self=this;
  5707. return smalltalk.withContext(function($ctx1) {
  5708. var $2,$1,$3;
  5709. $2=[(5), (6), (8)]._asSet();
  5710. $ctx1.sendIdx["asSet"]=1;
  5711. $1=_st($2)._collect_((function(x){
  5712. return smalltalk.withContext(function($ctx2) {
  5713. return _st(x).__backslash_backslash((3));
  5714. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5715. $3=[(0), (2)]._asSet();
  5716. self._assert_equals_($1,$3);
  5717. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  5718. args: [],
  5719. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5720. messageSends: ["assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5721. referencedClasses: []
  5722. }),
  5723. smalltalk.SetTest);
  5724. smalltalk.addMethod(
  5725. smalltalk.method({
  5726. selector: "testComparing",
  5727. category: 'tests',
  5728. fn: function (){
  5729. var self=this;
  5730. return smalltalk.withContext(function($ctx1) {
  5731. var $2,$3,$1,$5,$6,$4,$9,$10,$8,$7,$13,$14,$12,$11;
  5732. $2=[(0), (2)]._asSet();
  5733. $ctx1.sendIdx["asSet"]=1;
  5734. $3=[(0), (2)]._asSet();
  5735. $ctx1.sendIdx["asSet"]=2;
  5736. $1=self._assert_equals_($2,$3);
  5737. $ctx1.sendIdx["assert:equals:"]=1;
  5738. $5=[(2), (0)]._asSet();
  5739. $ctx1.sendIdx["asSet"]=3;
  5740. $6=[(0), (2)]._asSet();
  5741. $ctx1.sendIdx["asSet"]=4;
  5742. $4=self._assert_equals_($5,$6);
  5743. $9=[(0), (2), (3)]._asSet();
  5744. $ctx1.sendIdx["asSet"]=5;
  5745. $10=[(0), (2)]._asSet();
  5746. $ctx1.sendIdx["asSet"]=6;
  5747. $8=_st($9).__eq($10);
  5748. $ctx1.sendIdx["="]=1;
  5749. $7=self._deny_($8);
  5750. $ctx1.sendIdx["deny:"]=1;
  5751. $13=[(1), (2)]._asSet();
  5752. $ctx1.sendIdx["asSet"]=7;
  5753. $14=[(0), (2)]._asSet();
  5754. $12=_st($13).__eq($14);
  5755. $11=self._deny_($12);
  5756. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  5757. args: [],
  5758. 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",
  5759. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5760. referencedClasses: []
  5761. }),
  5762. smalltalk.SetTest);
  5763. smalltalk.addMethod(
  5764. smalltalk.method({
  5765. selector: "testPrintString",
  5766. category: 'tests',
  5767. fn: function (){
  5768. var self=this;
  5769. var set;
  5770. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5771. return smalltalk.withContext(function($ctx1) {
  5772. var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10,$11,$13,$12,$14,$16,$15,$17,$19,$18;
  5773. set=_st($Set())._new();
  5774. $2=_st(set)._printString();
  5775. $ctx1.sendIdx["printString"]=1;
  5776. $1=self._assert_equals_($2,"a Set ()");
  5777. $ctx1.sendIdx["assert:equals:"]=1;
  5778. $3=set;
  5779. _st($3)._add_((1));
  5780. $ctx1.sendIdx["add:"]=1;
  5781. $4=_st($3)._add_((3));
  5782. $ctx1.sendIdx["add:"]=2;
  5783. $6=_st(set)._printString();
  5784. $ctx1.sendIdx["printString"]=2;
  5785. $5=self._assert_equals_($6,"a Set (1 3)");
  5786. $ctx1.sendIdx["assert:equals:"]=2;
  5787. $7=_st(set)._add_("foo");
  5788. $ctx1.sendIdx["add:"]=3;
  5789. $9=_st(set)._printString();
  5790. $ctx1.sendIdx["printString"]=3;
  5791. $8=self._assert_equals_($9,"a Set (1 3 'foo')");
  5792. $ctx1.sendIdx["assert:equals:"]=3;
  5793. $10=set;
  5794. _st($10)._remove_((1));
  5795. $ctx1.sendIdx["remove:"]=1;
  5796. $11=_st($10)._remove_((3));
  5797. $13=_st(set)._printString();
  5798. $ctx1.sendIdx["printString"]=4;
  5799. $12=self._assert_equals_($13,"a Set ('foo')");
  5800. $ctx1.sendIdx["assert:equals:"]=4;
  5801. $14=_st(set)._add_((3));
  5802. $ctx1.sendIdx["add:"]=4;
  5803. $16=_st(set)._printString();
  5804. $ctx1.sendIdx["printString"]=5;
  5805. $15=self._assert_equals_($16,"a Set ('foo' 3)");
  5806. $ctx1.sendIdx["assert:equals:"]=5;
  5807. $17=_st(set)._add_((3));
  5808. $19=_st(set)._printString();
  5809. $18=self._assert_equals_($19,"a Set ('foo' 3)");
  5810. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  5811. args: [],
  5812. 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)'",
  5813. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5814. referencedClasses: ["Set"]
  5815. }),
  5816. smalltalk.SetTest);
  5817. smalltalk.addMethod(
  5818. smalltalk.method({
  5819. selector: "testSize",
  5820. category: 'tests',
  5821. fn: function (){
  5822. var self=this;
  5823. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5824. return smalltalk.withContext(function($ctx1) {
  5825. var $2,$1,$5,$4,$3,$8,$7,$6;
  5826. $2=_st(_st($Set())._new())._size();
  5827. $ctx1.sendIdx["size"]=1;
  5828. $1=self._assert_equals_($2,(0));
  5829. $ctx1.sendIdx["assert:equals:"]=1;
  5830. $5=_st($Set())._withAll_([(1), (2), (3), (4)]);
  5831. $ctx1.sendIdx["withAll:"]=1;
  5832. $4=_st($5)._size();
  5833. $ctx1.sendIdx["size"]=2;
  5834. $3=self._assert_equals_($4,(4));
  5835. $ctx1.sendIdx["assert:equals:"]=2;
  5836. $8=_st($Set())._withAll_([(1), (1), (1), (1)]);
  5837. $7=_st($8)._size();
  5838. $6=self._assert_equals_($7,(1));
  5839. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  5840. args: [],
  5841. 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",
  5842. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  5843. referencedClasses: ["Set"]
  5844. }),
  5845. smalltalk.SetTest);
  5846. smalltalk.addMethod(
  5847. smalltalk.method({
  5848. selector: "testUnboxedObjects",
  5849. category: 'tests',
  5850. fn: function (){
  5851. var self=this;
  5852. return smalltalk.withContext(function($ctx1) {
  5853. var $4,$5,$3,$2,$1;
  5854. $4="foo"._yourself();
  5855. $ctx1.sendIdx["yourself"]=1;
  5856. $5="foo"._yourself();
  5857. $3=[$4,$5];
  5858. $2=_st($3)._asSet();
  5859. $1=_st($2)._asArray();
  5860. self._assert_equals_($1,["foo"]);
  5861. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  5862. args: [],
  5863. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5864. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5865. referencedClasses: []
  5866. }),
  5867. smalltalk.SetTest);
  5868. smalltalk.addMethod(
  5869. smalltalk.method({
  5870. selector: "testUnicity",
  5871. category: 'tests',
  5872. fn: function (){
  5873. var self=this;
  5874. var set;
  5875. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5876. return smalltalk.withContext(function($ctx1) {
  5877. var $1,$2,$3,$5,$4,$6,$8,$7,$9;
  5878. set=_st($Set())._new();
  5879. $1=_st(set)._add_((21));
  5880. $ctx1.sendIdx["add:"]=1;
  5881. $2=_st(set)._add_("hello");
  5882. $ctx1.sendIdx["add:"]=2;
  5883. $3=_st(set)._add_((21));
  5884. $ctx1.sendIdx["add:"]=3;
  5885. $5=_st(set)._size();
  5886. $ctx1.sendIdx["size"]=1;
  5887. $4=self._assert_equals_($5,(2));
  5888. $ctx1.sendIdx["assert:equals:"]=1;
  5889. $6=_st(set)._add_("hello");
  5890. $8=_st(set)._size();
  5891. $7=self._assert_equals_($8,(2));
  5892. $ctx1.sendIdx["assert:equals:"]=2;
  5893. $9=self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5894. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  5895. args: [],
  5896. 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')",
  5897. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5898. referencedClasses: ["Set"]
  5899. }),
  5900. smalltalk.SetTest);
  5901. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5902. smalltalk.addMethod(
  5903. smalltalk.method({
  5904. selector: "collectionClass",
  5905. category: 'accessing',
  5906. fn: function (){
  5907. var self=this;
  5908. return smalltalk.withContext(function($ctx1) {
  5909. var $1;
  5910. $1=_st(self._class())._collectionClass();
  5911. return $1;
  5912. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  5913. args: [],
  5914. source: "collectionClass\x0a\x09^ self class collectionClass",
  5915. messageSends: ["collectionClass", "class"],
  5916. referencedClasses: []
  5917. }),
  5918. smalltalk.StreamTest);
  5919. smalltalk.addMethod(
  5920. smalltalk.method({
  5921. selector: "newCollection",
  5922. category: 'accessing',
  5923. fn: function (){
  5924. var self=this;
  5925. return smalltalk.withContext(function($ctx1) {
  5926. var $1;
  5927. $1=_st(self._collectionClass())._new();
  5928. return $1;
  5929. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  5930. args: [],
  5931. source: "newCollection\x0a\x09^ self collectionClass new",
  5932. messageSends: ["new", "collectionClass"],
  5933. referencedClasses: []
  5934. }),
  5935. smalltalk.StreamTest);
  5936. smalltalk.addMethod(
  5937. smalltalk.method({
  5938. selector: "newStream",
  5939. category: 'accessing',
  5940. fn: function (){
  5941. var self=this;
  5942. return smalltalk.withContext(function($ctx1) {
  5943. var $1;
  5944. $1=_st(_st(self._collectionClass())._new())._stream();
  5945. return $1;
  5946. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  5947. args: [],
  5948. source: "newStream\x0a\x09^ self collectionClass new stream",
  5949. messageSends: ["stream", "new", "collectionClass"],
  5950. referencedClasses: []
  5951. }),
  5952. smalltalk.StreamTest);
  5953. smalltalk.addMethod(
  5954. smalltalk.method({
  5955. selector: "testAtStartAtEnd",
  5956. category: 'tests',
  5957. fn: function (){
  5958. var self=this;
  5959. var stream;
  5960. return smalltalk.withContext(function($ctx1) {
  5961. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  5962. stream=self._newStream();
  5963. $2=_st(stream)._atStart();
  5964. $ctx1.sendIdx["atStart"]=1;
  5965. $1=self._assert_($2);
  5966. $ctx1.sendIdx["assert:"]=1;
  5967. $4=_st(stream)._atEnd();
  5968. $ctx1.sendIdx["atEnd"]=1;
  5969. $3=self._assert_($4);
  5970. $ctx1.sendIdx["assert:"]=2;
  5971. _st(stream)._nextPutAll_(self._newCollection());
  5972. $6=_st(stream)._atEnd();
  5973. $ctx1.sendIdx["atEnd"]=2;
  5974. $5=self._assert_($6);
  5975. $8=_st(stream)._atStart();
  5976. $ctx1.sendIdx["atStart"]=2;
  5977. $7=self._deny_($8);
  5978. $ctx1.sendIdx["deny:"]=1;
  5979. _st(stream)._position_((1));
  5980. $10=_st(stream)._atEnd();
  5981. $9=self._deny_($10);
  5982. $ctx1.sendIdx["deny:"]=2;
  5983. $12=_st(stream)._atStart();
  5984. $11=self._deny_($12);
  5985. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  5986. args: [],
  5987. 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",
  5988. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  5989. referencedClasses: []
  5990. }),
  5991. smalltalk.StreamTest);
  5992. smalltalk.addMethod(
  5993. smalltalk.method({
  5994. selector: "testContents",
  5995. category: 'tests',
  5996. fn: function (){
  5997. var self=this;
  5998. var stream;
  5999. return smalltalk.withContext(function($ctx1) {
  6000. var $1,$2,$3,$4;
  6001. stream=self._newStream();
  6002. $1=stream;
  6003. $2=self._newCollection();
  6004. $ctx1.sendIdx["newCollection"]=1;
  6005. _st($1)._nextPutAll_($2);
  6006. $3=_st(stream)._contents();
  6007. $4=self._newCollection();
  6008. self._assert_equals_($3,$4);
  6009. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  6010. args: [],
  6011. 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",
  6012. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  6013. referencedClasses: []
  6014. }),
  6015. smalltalk.StreamTest);
  6016. smalltalk.addMethod(
  6017. smalltalk.method({
  6018. selector: "testIsEmpty",
  6019. category: 'tests',
  6020. fn: function (){
  6021. var self=this;
  6022. var stream;
  6023. return smalltalk.withContext(function($ctx1) {
  6024. var $1,$2;
  6025. stream=self._newStream();
  6026. $1=_st(stream)._isEmpty();
  6027. $ctx1.sendIdx["isEmpty"]=1;
  6028. self._assert_($1);
  6029. _st(stream)._nextPutAll_(self._newCollection());
  6030. $2=_st(stream)._isEmpty();
  6031. self._deny_($2);
  6032. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  6033. args: [],
  6034. 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",
  6035. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  6036. referencedClasses: []
  6037. }),
  6038. smalltalk.StreamTest);
  6039. smalltalk.addMethod(
  6040. smalltalk.method({
  6041. selector: "testPosition",
  6042. category: 'tests',
  6043. fn: function (){
  6044. var self=this;
  6045. var collection,stream;
  6046. return smalltalk.withContext(function($ctx1) {
  6047. var $2,$1,$4,$3,$5,$7,$6,$8,$10,$9;
  6048. collection=self._newCollection();
  6049. stream=self._newStream();
  6050. _st(stream)._nextPutAll_(collection);
  6051. $2=_st(stream)._position();
  6052. $ctx1.sendIdx["position"]=1;
  6053. $1=self._assert_equals_($2,_st(collection)._size());
  6054. $ctx1.sendIdx["assert:equals:"]=1;
  6055. _st(stream)._position_((0));
  6056. $4=_st(stream)._position();
  6057. $ctx1.sendIdx["position"]=2;
  6058. $3=self._assert_equals_($4,(0));
  6059. $ctx1.sendIdx["assert:equals:"]=2;
  6060. $5=_st(stream)._next();
  6061. $ctx1.sendIdx["next"]=1;
  6062. $7=_st(stream)._position();
  6063. $ctx1.sendIdx["position"]=3;
  6064. $6=self._assert_equals_($7,(1));
  6065. $ctx1.sendIdx["assert:equals:"]=3;
  6066. $8=_st(stream)._next();
  6067. $10=_st(stream)._position();
  6068. $9=self._assert_equals_($10,(2));
  6069. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  6070. args: [],
  6071. 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",
  6072. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  6073. referencedClasses: []
  6074. }),
  6075. smalltalk.StreamTest);
  6076. smalltalk.addMethod(
  6077. smalltalk.method({
  6078. selector: "testReading",
  6079. category: 'tests',
  6080. fn: function (){
  6081. var self=this;
  6082. var stream,collection;
  6083. return smalltalk.withContext(function($ctx1) {
  6084. var $1,$2,$3,$5,$4;
  6085. collection=self._newCollection();
  6086. stream=self._newStream();
  6087. $1=stream;
  6088. _st($1)._nextPutAll_(collection);
  6089. $2=_st($1)._position_((0));
  6090. _st(collection)._do_((function(each){
  6091. return smalltalk.withContext(function($ctx2) {
  6092. $3=_st(stream)._next();
  6093. $ctx2.sendIdx["next"]=1;
  6094. return self._assert_equals_($3,each);
  6095. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6096. $5=_st(stream)._next();
  6097. $4=_st($5)._isNil();
  6098. self._assert_($4);
  6099. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6100. args: [],
  6101. 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",
  6102. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  6103. referencedClasses: []
  6104. }),
  6105. smalltalk.StreamTest);
  6106. smalltalk.addMethod(
  6107. smalltalk.method({
  6108. selector: "testStreamContents",
  6109. category: 'tests',
  6110. fn: function (){
  6111. var self=this;
  6112. return smalltalk.withContext(function($ctx1) {
  6113. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  6114. args: [],
  6115. source: "testStreamContents",
  6116. messageSends: [],
  6117. referencedClasses: []
  6118. }),
  6119. smalltalk.StreamTest);
  6120. smalltalk.addMethod(
  6121. smalltalk.method({
  6122. selector: "testWrite",
  6123. category: 'tests',
  6124. fn: function (){
  6125. var self=this;
  6126. var stream,collection;
  6127. return smalltalk.withContext(function($ctx1) {
  6128. collection=self._newCollection();
  6129. stream=self._newStream();
  6130. _st(collection)._do_((function(each){
  6131. return smalltalk.withContext(function($ctx2) {
  6132. return _st(stream).__lt_lt(each);
  6133. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6134. self._assert_equals_(_st(stream)._contents(),collection);
  6135. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6136. args: [],
  6137. 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",
  6138. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  6139. referencedClasses: []
  6140. }),
  6141. smalltalk.StreamTest);
  6142. smalltalk.addMethod(
  6143. smalltalk.method({
  6144. selector: "testWriting",
  6145. category: 'tests',
  6146. fn: function (){
  6147. var self=this;
  6148. var stream,collection;
  6149. return smalltalk.withContext(function($ctx1) {
  6150. var $2,$1,$4,$3;
  6151. collection=self._newCollection();
  6152. stream=self._newStream();
  6153. $ctx1.sendIdx["newStream"]=1;
  6154. _st(collection)._do_((function(each){
  6155. return smalltalk.withContext(function($ctx2) {
  6156. return _st(stream)._nextPut_(each);
  6157. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6158. $2=_st(stream)._contents();
  6159. $ctx1.sendIdx["contents"]=1;
  6160. $1=self._assert_equals_($2,collection);
  6161. $ctx1.sendIdx["assert:equals:"]=1;
  6162. stream=self._newStream();
  6163. _st(stream)._nextPutAll_(collection);
  6164. $4=_st(stream)._contents();
  6165. $3=self._assert_equals_($4,collection);
  6166. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6167. args: [],
  6168. 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",
  6169. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  6170. referencedClasses: []
  6171. }),
  6172. smalltalk.StreamTest);
  6173. smalltalk.addMethod(
  6174. smalltalk.method({
  6175. selector: "collectionClass",
  6176. category: 'accessing',
  6177. fn: function (){
  6178. var self=this;
  6179. return smalltalk.withContext(function($ctx1) {
  6180. return nil;
  6181. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  6182. args: [],
  6183. source: "collectionClass\x0a\x09^ nil",
  6184. messageSends: [],
  6185. referencedClasses: []
  6186. }),
  6187. smalltalk.StreamTest.klass);
  6188. smalltalk.addMethod(
  6189. smalltalk.method({
  6190. selector: "isAbstract",
  6191. category: 'testing',
  6192. fn: function (){
  6193. var self=this;
  6194. return smalltalk.withContext(function($ctx1) {
  6195. var $1;
  6196. $1=_st(self._collectionClass())._isNil();
  6197. return $1;
  6198. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  6199. args: [],
  6200. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  6201. messageSends: ["isNil", "collectionClass"],
  6202. referencedClasses: []
  6203. }),
  6204. smalltalk.StreamTest.klass);
  6205. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6206. smalltalk.addMethod(
  6207. smalltalk.method({
  6208. selector: "newCollection",
  6209. category: 'accessing',
  6210. fn: function (){
  6211. var self=this;
  6212. return smalltalk.withContext(function($ctx1) {
  6213. var $1;
  6214. $1=[true,(1),(3).__at((4)),"foo"];
  6215. return $1;
  6216. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  6217. args: [],
  6218. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  6219. messageSends: ["@"],
  6220. referencedClasses: []
  6221. }),
  6222. smalltalk.ArrayStreamTest);
  6223. smalltalk.addMethod(
  6224. smalltalk.method({
  6225. selector: "collectionClass",
  6226. category: 'accessing',
  6227. fn: function (){
  6228. var self=this;
  6229. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  6230. return smalltalk.withContext(function($ctx1) {
  6231. var $1;
  6232. $1=$Array();
  6233. return $1;
  6234. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  6235. args: [],
  6236. source: "collectionClass\x0a\x09^ Array",
  6237. messageSends: [],
  6238. referencedClasses: ["Array"]
  6239. }),
  6240. smalltalk.ArrayStreamTest.klass);
  6241. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6242. smalltalk.addMethod(
  6243. smalltalk.method({
  6244. selector: "newCollection",
  6245. category: 'accessing',
  6246. fn: function (){
  6247. var self=this;
  6248. return smalltalk.withContext(function($ctx1) {
  6249. return "hello world";
  6250. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  6251. args: [],
  6252. source: "newCollection\x0a\x09^ 'hello world'",
  6253. messageSends: [],
  6254. referencedClasses: []
  6255. }),
  6256. smalltalk.StringStreamTest);
  6257. smalltalk.addMethod(
  6258. smalltalk.method({
  6259. selector: "collectionClass",
  6260. category: 'accessing',
  6261. fn: function (){
  6262. var self=this;
  6263. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  6264. return smalltalk.withContext(function($ctx1) {
  6265. var $1;
  6266. $1=$String();
  6267. return $1;
  6268. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  6269. args: [],
  6270. source: "collectionClass\x0a\x09^ String",
  6271. messageSends: [],
  6272. referencedClasses: ["String"]
  6273. }),
  6274. smalltalk.StringStreamTest.klass);
  6275. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6276. smalltalk.addMethod(
  6277. smalltalk.method({
  6278. selector: "testCopying",
  6279. category: 'tests',
  6280. fn: function (){
  6281. var self=this;
  6282. return smalltalk.withContext(function($ctx1) {
  6283. self._assert_equals_(nil._copy(),nil);
  6284. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  6285. args: [],
  6286. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  6287. messageSends: ["assert:equals:", "copy"],
  6288. referencedClasses: []
  6289. }),
  6290. smalltalk.UndefinedTest);
  6291. smalltalk.addMethod(
  6292. smalltalk.method({
  6293. selector: "testDeepCopy",
  6294. category: 'tests',
  6295. fn: function (){
  6296. var self=this;
  6297. return smalltalk.withContext(function($ctx1) {
  6298. self._assert_(_st(nil._deepCopy()).__eq(nil));
  6299. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  6300. args: [],
  6301. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  6302. messageSends: ["assert:", "=", "deepCopy"],
  6303. referencedClasses: []
  6304. }),
  6305. smalltalk.UndefinedTest);
  6306. smalltalk.addMethod(
  6307. smalltalk.method({
  6308. selector: "testIfNil",
  6309. category: 'tests',
  6310. fn: function (){
  6311. var self=this;
  6312. return smalltalk.withContext(function($ctx1) {
  6313. var $2,$1,$5,$4,$3,$7,$6,$10,$9,$8;
  6314. if(($receiver = nil) == nil || $receiver == null){
  6315. $2=true;
  6316. } else {
  6317. $2=nil;
  6318. };
  6319. $1=self._assert_equals_($2,true);
  6320. $ctx1.sendIdx["assert:equals:"]=1;
  6321. if(($receiver = nil) == nil || $receiver == null){
  6322. $5=nil;
  6323. } else {
  6324. $5=true;
  6325. };
  6326. $4=_st($5).__eq(true);
  6327. $ctx1.sendIdx["="]=1;
  6328. $3=self._deny_($4);
  6329. $ctx1.sendIdx["deny:"]=1;
  6330. if(($receiver = nil) == nil || $receiver == null){
  6331. $7=true;
  6332. } else {
  6333. $7=false;
  6334. };
  6335. $6=self._assert_equals_($7,true);
  6336. if(($receiver = nil) == nil || $receiver == null){
  6337. $10=false;
  6338. } else {
  6339. $10=true;
  6340. };
  6341. $9=_st($10).__eq(true);
  6342. $8=self._deny_($9);
  6343. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  6344. args: [],
  6345. 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",
  6346. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  6347. referencedClasses: []
  6348. }),
  6349. smalltalk.UndefinedTest);
  6350. smalltalk.addMethod(
  6351. smalltalk.method({
  6352. selector: "testIsNil",
  6353. category: 'tests',
  6354. fn: function (){
  6355. var self=this;
  6356. return smalltalk.withContext(function($ctx1) {
  6357. self._assert_(nil._isNil());
  6358. self._deny_(nil._notNil());
  6359. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  6360. args: [],
  6361. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  6362. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  6363. referencedClasses: []
  6364. }),
  6365. smalltalk.UndefinedTest);
  6366. });