Kernel-Tests.js 338 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948
  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. protocol: '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,$2;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  22. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  23. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  24. self._assert_equals_($1,true);
  25. $ctx1.sendIdx["assert:equals:"]=1;
  26. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  27. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  28. self._assert_equals_($2,true);
  29. $ctx1.sendIdx["assert:equals:"]=2;
  30. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  31. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  32. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},smalltalk.AnnouncementSubscriptionTest)})},
  33. args: [],
  34. 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.",
  35. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  36. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  37. }),
  38. smalltalk.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', smalltalk.TestCase, [], 'Kernel-Tests');
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "testOnDo",
  43. protocol: 'not yet classified',
  44. fn: function (){
  45. var self=this;
  46. var counter,announcer;
  47. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  49. return smalltalk.withContext(function($ctx1) {
  50. var $1,$2;
  51. counter=(0);
  52. announcer=_st($Announcer())._new();
  53. $ctx1.sendIdx["new"]=1;
  54. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  55. return smalltalk.withContext(function($ctx2) {
  56. counter=_st(counter).__plus((1));
  57. return counter;
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  59. $1=announcer;
  60. $2=_st($SystemAnnouncement())._new();
  61. $ctx1.sendIdx["new"]=2;
  62. _st($1)._announce_($2);
  63. $ctx1.sendIdx["announce:"]=1;
  64. self._assert_equals_(counter,(1));
  65. $ctx1.sendIdx["assert:equals:"]=1;
  66. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  67. self._assert_equals_(counter,(2));
  68. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  69. args: [],
  70. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  71. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  72. referencedClasses: ["Announcer", "SystemAnnouncement"]
  73. }),
  74. smalltalk.AnnouncerTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testOnDoOnce",
  78. protocol: 'not yet classified',
  79. fn: function (){
  80. var self=this;
  81. var counter,announcer;
  82. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  84. return smalltalk.withContext(function($ctx1) {
  85. var $1,$2;
  86. counter=(0);
  87. announcer=_st($Announcer())._new();
  88. $ctx1.sendIdx["new"]=1;
  89. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  90. return smalltalk.withContext(function($ctx2) {
  91. counter=_st(counter).__plus((1));
  92. return counter;
  93. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  94. $1=announcer;
  95. $2=_st($SystemAnnouncement())._new();
  96. $ctx1.sendIdx["new"]=2;
  97. _st($1)._announce_($2);
  98. $ctx1.sendIdx["announce:"]=1;
  99. self._assert_equals_(counter,(1));
  100. $ctx1.sendIdx["assert:equals:"]=1;
  101. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  102. self._assert_equals_(counter,(1));
  103. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  104. args: [],
  105. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  106. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  107. referencedClasses: ["Announcer", "SystemAnnouncement"]
  108. }),
  109. smalltalk.AnnouncerTest);
  110. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testCanClearInterval",
  114. protocol: 'tests',
  115. fn: function (){
  116. var self=this;
  117. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  118. return smalltalk.withContext(function($ctx1) {
  119. self._shouldnt_raise_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. return _st(_st((function(){
  122. return smalltalk.withContext(function($ctx3) {
  123. return _st(_st($Error())._new())._signal();
  124. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  126. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  127. args: [],
  128. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  129. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  130. referencedClasses: ["Error"]
  131. }),
  132. smalltalk.BlockClosureTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testCanClearTimeout",
  136. protocol: 'tests',
  137. fn: function (){
  138. var self=this;
  139. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  140. return smalltalk.withContext(function($ctx1) {
  141. self._shouldnt_raise_((function(){
  142. return smalltalk.withContext(function($ctx2) {
  143. return _st(_st((function(){
  144. return smalltalk.withContext(function($ctx3) {
  145. return _st(_st($Error())._new())._signal();
  146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  148. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  149. args: [],
  150. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  151. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  152. referencedClasses: ["Error"]
  153. }),
  154. smalltalk.BlockClosureTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testCompiledSource",
  158. protocol: 'tests',
  159. fn: function (){
  160. var self=this;
  161. return smalltalk.withContext(function($ctx1) {
  162. self._assert_(_st(_st((function(){
  163. return smalltalk.withContext(function($ctx2) {
  164. return (1).__plus((1));
  165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  166. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  167. args: [],
  168. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  169. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  170. referencedClasses: []
  171. }),
  172. smalltalk.BlockClosureTest);
  173. smalltalk.addMethod(
  174. smalltalk.method({
  175. selector: "testCurrySelf",
  176. protocol: 'tests',
  177. fn: function (){
  178. var self=this;
  179. var curriedMethod,array;
  180. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  181. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  182. return smalltalk.withContext(function($ctx1) {
  183. curriedMethod=_st(_st((function(selfarg,x){
  184. return smalltalk.withContext(function($ctx2) {
  185. return _st(selfarg)._at_(x);
  186. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  187. array=[(3), (1), (4)];
  188. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  189. _st((function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return self._assert_equals_(_st(array)._foo_((2)),(1));
  192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  193. return smalltalk.withContext(function($ctx2) {
  194. return _st($Array())._removeCompiledMethod_(curriedMethod);
  195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  196. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  197. args: [],
  198. 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 protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  199. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  200. referencedClasses: ["ClassBuilder", "Array"]
  201. }),
  202. smalltalk.BlockClosureTest);
  203. smalltalk.addMethod(
  204. smalltalk.method({
  205. selector: "testEnsure",
  206. protocol: 'tests',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. self._assert_equals_(_st((function(){
  211. return smalltalk.withContext(function($ctx2) {
  212. return (3);
  213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  214. return smalltalk.withContext(function($ctx2) {
  215. return (4);
  216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  217. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  218. args: [],
  219. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  220. messageSends: ["assert:equals:", "ensure:"],
  221. referencedClasses: []
  222. }),
  223. smalltalk.BlockClosureTest);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "testEnsureRaises",
  227. protocol: 'tests',
  228. fn: function (){
  229. var self=this;
  230. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  231. return smalltalk.withContext(function($ctx1) {
  232. self._should_raise_((function(){
  233. return smalltalk.withContext(function($ctx2) {
  234. return _st((function(){
  235. return smalltalk.withContext(function($ctx3) {
  236. return _st(_st($Error())._new())._signal();
  237. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  238. return smalltalk.withContext(function($ctx3) {
  239. return true;
  240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  242. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  243. args: [],
  244. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  245. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  246. referencedClasses: ["Error"]
  247. }),
  248. smalltalk.BlockClosureTest);
  249. smalltalk.addMethod(
  250. smalltalk.method({
  251. selector: "testExceptionSemantics",
  252. protocol: 'tests',
  253. fn: function (){
  254. var self=this;
  255. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  256. return smalltalk.withContext(function($ctx1) {
  257. self._timeout_((100));
  258. _st(self._async_((function(){
  259. return smalltalk.withContext(function($ctx2) {
  260. return _st((function(){
  261. return smalltalk.withContext(function($ctx3) {
  262. self._assert_(true);
  263. _st($Error())._signal();
  264. self._deny_(true);
  265. return self._finished();
  266. $ctx3.sendIdx["finished"]=1;
  267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  268. return smalltalk.withContext(function($ctx3) {
  269. return self._finished();
  270. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  272. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  273. args: [],
  274. 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",
  275. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  276. referencedClasses: ["Error"]
  277. }),
  278. smalltalk.BlockClosureTest);
  279. smalltalk.addMethod(
  280. smalltalk.method({
  281. selector: "testNewWithValues",
  282. protocol: 'tests',
  283. fn: function (){
  284. var self=this;
  285. return smalltalk.withContext(function($ctx1) {
  286. function theTestPrototype() {this.name = "theTestPrototype";}
  287. function theTestConstructor(arg1, arg2, arg3) {}
  288. theTestConstructor.prototype = new theTestPrototype;
  289. var theWrappedConstructor = _st(theTestConstructor);
  290. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);
  291. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  292. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  293. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  294. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  295. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  296. args: [],
  297. 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>",
  298. messageSends: [],
  299. referencedClasses: []
  300. }),
  301. smalltalk.BlockClosureTest);
  302. smalltalk.addMethod(
  303. smalltalk.method({
  304. selector: "testNumArgs",
  305. protocol: 'tests',
  306. fn: function (){
  307. var self=this;
  308. return smalltalk.withContext(function($ctx1) {
  309. var $1;
  310. $1=_st((function(){
  311. return smalltalk.withContext(function($ctx2) {
  312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  313. $ctx1.sendIdx["numArgs"]=1;
  314. self._assert_equals_($1,(0));
  315. $ctx1.sendIdx["assert:equals:"]=1;
  316. self._assert_equals_(_st((function(a,b){
  317. return smalltalk.withContext(function($ctx2) {
  318. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs(),(2));
  319. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  320. args: [],
  321. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  322. messageSends: ["assert:equals:", "numArgs"],
  323. referencedClasses: []
  324. }),
  325. smalltalk.BlockClosureTest);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "testOnDo",
  329. protocol: 'tests',
  330. fn: function (){
  331. var self=this;
  332. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  333. return smalltalk.withContext(function($ctx1) {
  334. self._assert_(_st((function(){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st(_st($Error())._new())._signal();
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  338. return smalltalk.withContext(function($ctx2) {
  339. return true;
  340. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  341. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  342. args: [],
  343. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  344. messageSends: ["assert:", "on:do:", "signal", "new"],
  345. referencedClasses: ["Error"]
  346. }),
  347. smalltalk.BlockClosureTest);
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "testValue",
  351. protocol: 'tests',
  352. fn: function (){
  353. var self=this;
  354. return smalltalk.withContext(function($ctx1) {
  355. var $1;
  356. $1=_st((function(){
  357. return smalltalk.withContext(function($ctx2) {
  358. return (1).__plus((1));
  359. $ctx2.sendIdx["+"]=1;
  360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  361. $ctx1.sendIdx["value"]=1;
  362. self._assert_equals_($1,(2));
  363. $ctx1.sendIdx["assert:equals:"]=1;
  364. self._assert_equals_(_st((function(x){
  365. return smalltalk.withContext(function($ctx2) {
  366. return _st(x).__plus((1));
  367. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  368. $ctx1.sendIdx["assert:equals:"]=2;
  369. self._assert_equals_(_st((function(x,y){
  370. return smalltalk.withContext(function($ctx2) {
  371. return _st(x).__star(y);
  372. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  373. $ctx1.sendIdx["assert:equals:"]=3;
  374. self._assert_equals_(_st((function(a,b,c){
  375. return smalltalk.withContext(function($ctx2) {
  376. return (1);
  377. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value(),(1));
  378. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  379. args: [],
  380. 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",
  381. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  382. referencedClasses: []
  383. }),
  384. smalltalk.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testValueWithPossibleArguments",
  388. protocol: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1,$2;
  393. $1=_st((function(){
  394. return smalltalk.withContext(function($ctx2) {
  395. return (1);
  396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  397. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  398. self._assert_equals_($1,(1));
  399. $ctx1.sendIdx["assert:equals:"]=1;
  400. $2=_st((function(a){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(a).__plus((4));
  403. $ctx2.sendIdx["+"]=1;
  404. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  405. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  406. self._assert_equals_($2,(7));
  407. $ctx1.sendIdx["assert:equals:"]=2;
  408. self._assert_equals_(_st((function(a,b){
  409. return smalltalk.withContext(function($ctx2) {
  410. return _st(a).__plus(b);
  411. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  412. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  413. args: [],
  414. 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.",
  415. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  416. referencedClasses: []
  417. }),
  418. smalltalk.BlockClosureTest);
  419. smalltalk.addMethod(
  420. smalltalk.method({
  421. selector: "testWhileFalse",
  422. protocol: 'tests',
  423. fn: function (){
  424. var self=this;
  425. var i;
  426. return smalltalk.withContext(function($ctx1) {
  427. i=(0);
  428. _st((function(){
  429. return smalltalk.withContext(function($ctx2) {
  430. return _st(i).__gt((5));
  431. $ctx2.sendIdx[">"]=1;
  432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  433. return smalltalk.withContext(function($ctx2) {
  434. i=_st(i).__plus((1));
  435. $ctx2.sendIdx["+"]=1;
  436. return i;
  437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  438. self._assert_equals_(i,(6));
  439. $ctx1.sendIdx["assert:equals:"]=1;
  440. i=(0);
  441. _st((function(){
  442. return smalltalk.withContext(function($ctx2) {
  443. i=_st(i).__plus((1));
  444. i;
  445. return _st(i).__gt((5));
  446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  447. self._assert_equals_(i,(6));
  448. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  449. args: [],
  450. 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",
  451. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  452. referencedClasses: []
  453. }),
  454. smalltalk.BlockClosureTest);
  455. smalltalk.addMethod(
  456. smalltalk.method({
  457. selector: "testWhileTrue",
  458. protocol: 'tests',
  459. fn: function (){
  460. var self=this;
  461. var i;
  462. return smalltalk.withContext(function($ctx1) {
  463. i=(0);
  464. _st((function(){
  465. return smalltalk.withContext(function($ctx2) {
  466. return _st(i).__lt((5));
  467. $ctx2.sendIdx["<"]=1;
  468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  469. return smalltalk.withContext(function($ctx2) {
  470. i=_st(i).__plus((1));
  471. $ctx2.sendIdx["+"]=1;
  472. return i;
  473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  474. self._assert_equals_(i,(5));
  475. $ctx1.sendIdx["assert:equals:"]=1;
  476. i=(0);
  477. _st((function(){
  478. return smalltalk.withContext(function($ctx2) {
  479. i=_st(i).__plus((1));
  480. i;
  481. return _st(i).__lt((5));
  482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  483. self._assert_equals_(i,(5));
  484. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  485. args: [],
  486. 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",
  487. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  488. referencedClasses: []
  489. }),
  490. smalltalk.BlockClosureTest);
  491. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "testEquality",
  495. protocol: 'tests',
  496. fn: function (){
  497. var self=this;
  498. return smalltalk.withContext(function($ctx1) {
  499. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  500. $1=(0).__eq(false);
  501. $ctx1.sendIdx["="]=1;
  502. self._deny_($1);
  503. $ctx1.sendIdx["deny:"]=1;
  504. $2=false.__eq((0));
  505. $ctx1.sendIdx["="]=2;
  506. self._deny_($2);
  507. $ctx1.sendIdx["deny:"]=2;
  508. $3="".__eq(false);
  509. $ctx1.sendIdx["="]=3;
  510. self._deny_($3);
  511. $ctx1.sendIdx["deny:"]=3;
  512. $4=false.__eq("");
  513. $ctx1.sendIdx["="]=4;
  514. self._deny_($4);
  515. $ctx1.sendIdx["deny:"]=4;
  516. $5=true.__eq(true);
  517. $ctx1.sendIdx["="]=5;
  518. self._assert_($5);
  519. $ctx1.sendIdx["assert:"]=1;
  520. $6=false.__eq(true);
  521. $ctx1.sendIdx["="]=6;
  522. self._deny_($6);
  523. $ctx1.sendIdx["deny:"]=5;
  524. $7=true.__eq(false);
  525. $ctx1.sendIdx["="]=7;
  526. self._deny_($7);
  527. $8=false.__eq(false);
  528. $ctx1.sendIdx["="]=8;
  529. self._assert_($8);
  530. $ctx1.sendIdx["assert:"]=2;
  531. $10=true._yourself();
  532. $ctx1.sendIdx["yourself"]=1;
  533. $9=_st($10).__eq(true);
  534. $ctx1.sendIdx["="]=9;
  535. self._assert_($9);
  536. $ctx1.sendIdx["assert:"]=3;
  537. $12=true._yourself();
  538. $ctx1.sendIdx["yourself"]=2;
  539. $11=_st($12).__eq(true._yourself());
  540. self._assert_($11);
  541. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  542. args: [],
  543. 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)",
  544. messageSends: ["deny:", "=", "assert:", "yourself"],
  545. referencedClasses: []
  546. }),
  547. smalltalk.BooleanTest);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "testIdentity",
  551. protocol: 'tests',
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) {
  555. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  556. $1=(0).__eq_eq(false);
  557. $ctx1.sendIdx["=="]=1;
  558. self._deny_($1);
  559. $ctx1.sendIdx["deny:"]=1;
  560. $2=false.__eq_eq((0));
  561. $ctx1.sendIdx["=="]=2;
  562. self._deny_($2);
  563. $ctx1.sendIdx["deny:"]=2;
  564. $3="".__eq_eq(false);
  565. $ctx1.sendIdx["=="]=3;
  566. self._deny_($3);
  567. $ctx1.sendIdx["deny:"]=3;
  568. $4=false.__eq_eq("");
  569. $ctx1.sendIdx["=="]=4;
  570. self._deny_($4);
  571. $ctx1.sendIdx["deny:"]=4;
  572. $5=true.__eq_eq(true);
  573. $ctx1.sendIdx["=="]=5;
  574. self._assert_($5);
  575. $ctx1.sendIdx["assert:"]=1;
  576. $6=false.__eq_eq(true);
  577. $ctx1.sendIdx["=="]=6;
  578. self._deny_($6);
  579. $ctx1.sendIdx["deny:"]=5;
  580. $7=true.__eq_eq(false);
  581. $ctx1.sendIdx["=="]=7;
  582. self._deny_($7);
  583. $8=false.__eq_eq(false);
  584. $ctx1.sendIdx["=="]=8;
  585. self._assert_($8);
  586. $ctx1.sendIdx["assert:"]=2;
  587. $10=true._yourself();
  588. $ctx1.sendIdx["yourself"]=1;
  589. $9=_st($10).__eq_eq(true);
  590. $ctx1.sendIdx["=="]=9;
  591. self._assert_($9);
  592. $ctx1.sendIdx["assert:"]=3;
  593. $12=true._yourself();
  594. $ctx1.sendIdx["yourself"]=2;
  595. $11=_st($12).__eq_eq(true._yourself());
  596. self._assert_($11);
  597. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  598. args: [],
  599. 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",
  600. messageSends: ["deny:", "==", "assert:", "yourself"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.BooleanTest);
  604. smalltalk.addMethod(
  605. smalltalk.method({
  606. selector: "testIfTrueIfFalse",
  607. protocol: 'tests',
  608. fn: function (){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) {
  611. var $1,$2,$3,$4,$5,$6,$7,$8;
  612. if(smalltalk.assert(true)){
  613. $1="alternative block";
  614. };
  615. self._assert_equals_($1,"alternative block");
  616. $ctx1.sendIdx["assert:equals:"]=1;
  617. if(! smalltalk.assert(true)){
  618. $2="alternative block";
  619. };
  620. self._assert_equals_($2,nil);
  621. $ctx1.sendIdx["assert:equals:"]=2;
  622. if(smalltalk.assert(false)){
  623. $3="alternative block";
  624. };
  625. self._assert_equals_($3,nil);
  626. $ctx1.sendIdx["assert:equals:"]=3;
  627. if(! smalltalk.assert(false)){
  628. $4="alternative block";
  629. };
  630. self._assert_equals_($4,"alternative block");
  631. $ctx1.sendIdx["assert:equals:"]=4;
  632. if(smalltalk.assert(false)){
  633. $5="alternative block";
  634. } else {
  635. $5="alternative block2";
  636. };
  637. self._assert_equals_($5,"alternative block2");
  638. $ctx1.sendIdx["assert:equals:"]=5;
  639. if(smalltalk.assert(false)){
  640. $6="alternative block2";
  641. } else {
  642. $6="alternative block";
  643. };
  644. self._assert_equals_($6,"alternative block");
  645. $ctx1.sendIdx["assert:equals:"]=6;
  646. if(smalltalk.assert(true)){
  647. $7="alternative block";
  648. } else {
  649. $7="alternative block2";
  650. };
  651. self._assert_equals_($7,"alternative block");
  652. $ctx1.sendIdx["assert:equals:"]=7;
  653. if(smalltalk.assert(true)){
  654. $8="alternative block2";
  655. } else {
  656. $8="alternative block";
  657. };
  658. self._assert_equals_($8,"alternative block2");
  659. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  660. args: [],
  661. 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'.",
  662. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  663. referencedClasses: []
  664. }),
  665. smalltalk.BooleanTest);
  666. smalltalk.addMethod(
  667. smalltalk.method({
  668. selector: "testIfTrueIfFalseWithBoxing",
  669. protocol: 'tests',
  670. fn: function (){
  671. var self=this;
  672. return smalltalk.withContext(function($ctx1) {
  673. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  674. $2=true._yourself();
  675. $ctx1.sendIdx["yourself"]=1;
  676. if(smalltalk.assert($2)){
  677. $1="alternative block";
  678. };
  679. self._assert_equals_($1,"alternative block");
  680. $ctx1.sendIdx["assert:equals:"]=1;
  681. $4=true._yourself();
  682. $ctx1.sendIdx["yourself"]=2;
  683. if(! smalltalk.assert($4)){
  684. $3="alternative block";
  685. };
  686. self._assert_equals_($3,nil);
  687. $ctx1.sendIdx["assert:equals:"]=2;
  688. $6=false._yourself();
  689. $ctx1.sendIdx["yourself"]=3;
  690. if(smalltalk.assert($6)){
  691. $5="alternative block";
  692. };
  693. self._assert_equals_($5,nil);
  694. $ctx1.sendIdx["assert:equals:"]=3;
  695. $8=false._yourself();
  696. $ctx1.sendIdx["yourself"]=4;
  697. if(! smalltalk.assert($8)){
  698. $7="alternative block";
  699. };
  700. self._assert_equals_($7,"alternative block");
  701. $ctx1.sendIdx["assert:equals:"]=4;
  702. $10=false._yourself();
  703. $ctx1.sendIdx["yourself"]=5;
  704. if(smalltalk.assert($10)){
  705. $9="alternative block";
  706. } else {
  707. $9="alternative block2";
  708. };
  709. self._assert_equals_($9,"alternative block2");
  710. $ctx1.sendIdx["assert:equals:"]=5;
  711. $12=false._yourself();
  712. $ctx1.sendIdx["yourself"]=6;
  713. if(smalltalk.assert($12)){
  714. $11="alternative block2";
  715. } else {
  716. $11="alternative block";
  717. };
  718. self._assert_equals_($11,"alternative block");
  719. $ctx1.sendIdx["assert:equals:"]=6;
  720. $14=true._yourself();
  721. $ctx1.sendIdx["yourself"]=7;
  722. if(smalltalk.assert($14)){
  723. $13="alternative block";
  724. } else {
  725. $13="alternative block2";
  726. };
  727. self._assert_equals_($13,"alternative block");
  728. $ctx1.sendIdx["assert:equals:"]=7;
  729. $16=true._yourself();
  730. if(smalltalk.assert($16)){
  731. $15="alternative block2";
  732. } else {
  733. $15="alternative block";
  734. };
  735. self._assert_equals_($15,"alternative block2");
  736. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  737. args: [],
  738. 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'.",
  739. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  740. referencedClasses: []
  741. }),
  742. smalltalk.BooleanTest);
  743. smalltalk.addMethod(
  744. smalltalk.method({
  745. selector: "testLogic",
  746. protocol: 'tests',
  747. fn: function (){
  748. var self=this;
  749. return smalltalk.withContext(function($ctx1) {
  750. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  751. $1=true.__and(true);
  752. $ctx1.sendIdx["&"]=1;
  753. self._assert_($1);
  754. $ctx1.sendIdx["assert:"]=1;
  755. $2=true.__and(false);
  756. $ctx1.sendIdx["&"]=2;
  757. self._deny_($2);
  758. $ctx1.sendIdx["deny:"]=1;
  759. $3=false.__and(true);
  760. $ctx1.sendIdx["&"]=3;
  761. self._deny_($3);
  762. $ctx1.sendIdx["deny:"]=2;
  763. $5=false.__and(false);
  764. $ctx1.sendIdx["&"]=4;
  765. $4=self._deny_($5);
  766. $ctx1.sendIdx["deny:"]=3;
  767. $6=true.__or(true);
  768. $ctx1.sendIdx["|"]=1;
  769. self._assert_($6);
  770. $ctx1.sendIdx["assert:"]=2;
  771. $7=true.__or(false);
  772. $ctx1.sendIdx["|"]=2;
  773. self._assert_($7);
  774. $ctx1.sendIdx["assert:"]=3;
  775. $8=false.__or(true);
  776. $ctx1.sendIdx["|"]=3;
  777. self._assert_($8);
  778. $ctx1.sendIdx["assert:"]=4;
  779. $10=false.__or(false);
  780. $ctx1.sendIdx["|"]=4;
  781. $9=self._deny_($10);
  782. $ctx1.sendIdx["deny:"]=4;
  783. $12=(1).__gt((0));
  784. $ctx1.sendIdx[">"]=1;
  785. $11=true.__and($12);
  786. $ctx1.sendIdx["&"]=5;
  787. self._assert_($11);
  788. $ctx1.sendIdx["assert:"]=5;
  789. $14=(1).__gt((0));
  790. $ctx1.sendIdx[">"]=2;
  791. $13=_st($14).__and(false);
  792. $ctx1.sendIdx["&"]=6;
  793. self._deny_($13);
  794. $ctx1.sendIdx["deny:"]=5;
  795. $17=(1).__gt((0));
  796. $ctx1.sendIdx[">"]=3;
  797. $18=(1).__gt((2));
  798. $ctx1.sendIdx[">"]=4;
  799. $16=_st($17).__and($18);
  800. $15=self._deny_($16);
  801. $20=(1).__gt((0));
  802. $ctx1.sendIdx[">"]=5;
  803. $19=false.__or($20);
  804. $ctx1.sendIdx["|"]=5;
  805. self._assert_($19);
  806. $ctx1.sendIdx["assert:"]=6;
  807. $22=(1).__gt((0));
  808. $ctx1.sendIdx[">"]=6;
  809. $21=_st($22).__or(false);
  810. $ctx1.sendIdx["|"]=6;
  811. self._assert_($21);
  812. $ctx1.sendIdx["assert:"]=7;
  813. $25=(1).__gt((0));
  814. $ctx1.sendIdx[">"]=7;
  815. $24=_st($25).__or((1).__gt((2)));
  816. $23=self._assert_($24);
  817. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  818. args: [],
  819. 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))",
  820. messageSends: ["assert:", "&", "deny:", "|", ">"],
  821. referencedClasses: []
  822. }),
  823. smalltalk.BooleanTest);
  824. smalltalk.addMethod(
  825. smalltalk.method({
  826. selector: "testLogicKeywords",
  827. protocol: 'tests',
  828. fn: function (){
  829. var self=this;
  830. return smalltalk.withContext(function($ctx1) {
  831. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  832. $1=true._and_((function(){
  833. return smalltalk.withContext(function($ctx2) {
  834. return true;
  835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  836. $ctx1.sendIdx["and:"]=1;
  837. self._assert_($1);
  838. $ctx1.sendIdx["assert:"]=1;
  839. $2=true._and_((function(){
  840. return smalltalk.withContext(function($ctx2) {
  841. return false;
  842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  843. $ctx1.sendIdx["and:"]=2;
  844. self._deny_($2);
  845. $ctx1.sendIdx["deny:"]=1;
  846. $3=false._and_((function(){
  847. return smalltalk.withContext(function($ctx2) {
  848. return true;
  849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  850. $ctx1.sendIdx["and:"]=3;
  851. self._deny_($3);
  852. $ctx1.sendIdx["deny:"]=2;
  853. $5=false._and_((function(){
  854. return smalltalk.withContext(function($ctx2) {
  855. return false;
  856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  857. $ctx1.sendIdx["and:"]=4;
  858. $4=self._deny_($5);
  859. $ctx1.sendIdx["deny:"]=3;
  860. $6=true._or_((function(){
  861. return smalltalk.withContext(function($ctx2) {
  862. return true;
  863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  864. $ctx1.sendIdx["or:"]=1;
  865. self._assert_($6);
  866. $ctx1.sendIdx["assert:"]=2;
  867. $7=true._or_((function(){
  868. return smalltalk.withContext(function($ctx2) {
  869. return false;
  870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  871. $ctx1.sendIdx["or:"]=2;
  872. self._assert_($7);
  873. $ctx1.sendIdx["assert:"]=3;
  874. $8=false._or_((function(){
  875. return smalltalk.withContext(function($ctx2) {
  876. return true;
  877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  878. $ctx1.sendIdx["or:"]=3;
  879. self._assert_($8);
  880. $ctx1.sendIdx["assert:"]=4;
  881. $10=false._or_((function(){
  882. return smalltalk.withContext(function($ctx2) {
  883. return false;
  884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  885. $ctx1.sendIdx["or:"]=4;
  886. $9=self._deny_($10);
  887. $ctx1.sendIdx["deny:"]=4;
  888. $11=true._and_((function(){
  889. return smalltalk.withContext(function($ctx2) {
  890. return (1).__gt((0));
  891. $ctx2.sendIdx[">"]=1;
  892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  893. $ctx1.sendIdx["and:"]=5;
  894. self._assert_($11);
  895. $ctx1.sendIdx["assert:"]=5;
  896. $13=(1).__gt((0));
  897. $ctx1.sendIdx[">"]=2;
  898. $12=_st($13)._and_((function(){
  899. return smalltalk.withContext(function($ctx2) {
  900. return false;
  901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  902. $ctx1.sendIdx["and:"]=6;
  903. self._deny_($12);
  904. $ctx1.sendIdx["deny:"]=5;
  905. $16=(1).__gt((0));
  906. $ctx1.sendIdx[">"]=3;
  907. $15=_st($16)._and_((function(){
  908. return smalltalk.withContext(function($ctx2) {
  909. return (1).__gt((2));
  910. $ctx2.sendIdx[">"]=4;
  911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  912. $14=self._deny_($15);
  913. $17=false._or_((function(){
  914. return smalltalk.withContext(function($ctx2) {
  915. return (1).__gt((0));
  916. $ctx2.sendIdx[">"]=5;
  917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  918. $ctx1.sendIdx["or:"]=5;
  919. self._assert_($17);
  920. $ctx1.sendIdx["assert:"]=6;
  921. $19=(1).__gt((0));
  922. $ctx1.sendIdx[">"]=6;
  923. $18=_st($19)._or_((function(){
  924. return smalltalk.withContext(function($ctx2) {
  925. return false;
  926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  927. $ctx1.sendIdx["or:"]=6;
  928. self._assert_($18);
  929. $ctx1.sendIdx["assert:"]=7;
  930. $22=(1).__gt((0));
  931. $ctx1.sendIdx[">"]=7;
  932. $21=_st($22)._or_((function(){
  933. return smalltalk.withContext(function($ctx2) {
  934. return (1).__gt((2));
  935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  936. $20=self._assert_($21);
  937. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  938. args: [],
  939. 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 ])",
  940. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  941. referencedClasses: []
  942. }),
  943. smalltalk.BooleanTest);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "testNonBooleanError",
  947. protocol: 'tests',
  948. fn: function (){
  949. var self=this;
  950. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  951. return smalltalk.withContext(function($ctx1) {
  952. self._should_raise_((function(){
  953. return smalltalk.withContext(function($ctx2) {
  954. if(smalltalk.assert("")){
  955. } else {
  956. };
  957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  958. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  959. args: [],
  960. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  961. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  962. referencedClasses: ["NonBooleanReceiver"]
  963. }),
  964. smalltalk.BooleanTest);
  965. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "setUp",
  969. protocol: 'running',
  970. fn: function (){
  971. var self=this;
  972. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  973. return smalltalk.withContext(function($ctx1) {
  974. self["@builder"]=_st($ClassBuilder())._new();
  975. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  976. args: [],
  977. source: "setUp\x0a\x09builder := ClassBuilder new",
  978. messageSends: ["new"],
  979. referencedClasses: ["ClassBuilder"]
  980. }),
  981. smalltalk.ClassBuilderTest);
  982. smalltalk.addMethod(
  983. smalltalk.method({
  984. selector: "tearDown",
  985. protocol: 'running',
  986. fn: function (){
  987. var self=this;
  988. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  989. return smalltalk.withContext(function($ctx1) {
  990. var $1;
  991. $1=self["@theClass"];
  992. if(($receiver = $1) == nil || $receiver == null){
  993. $1;
  994. } else {
  995. _st($Smalltalk())._removeClass_(self["@theClass"]);
  996. self["@theClass"]=nil;
  997. self["@theClass"];
  998. };
  999. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  1000. args: [],
  1001. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  1002. messageSends: ["ifNotNil:", "removeClass:"],
  1003. referencedClasses: ["Smalltalk"]
  1004. }),
  1005. smalltalk.ClassBuilderTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "testClassCopy",
  1009. protocol: 'tests',
  1010. fn: function (){
  1011. var self=this;
  1012. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1013. return smalltalk.withContext(function($ctx1) {
  1014. var $2,$1,$4,$3,$6,$5,$8,$7;
  1015. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1016. $2=_st(self["@theClass"])._superclass();
  1017. $ctx1.sendIdx["superclass"]=1;
  1018. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1019. $ctx1.sendIdx["=="]=1;
  1020. self._assert_($1);
  1021. $ctx1.sendIdx["assert:"]=1;
  1022. $4=_st(self["@theClass"])._instanceVariableNames();
  1023. $ctx1.sendIdx["instanceVariableNames"]=1;
  1024. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1025. $ctx1.sendIdx["=="]=2;
  1026. self._assert_($3);
  1027. $ctx1.sendIdx["assert:"]=2;
  1028. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1029. $ctx1.sendIdx["assert:equals:"]=1;
  1030. $6=_st(self["@theClass"])._package();
  1031. $ctx1.sendIdx["package"]=1;
  1032. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1033. self._assert_($5);
  1034. $8=_st(self["@theClass"])._methodDictionary();
  1035. $ctx1.sendIdx["methodDictionary"]=1;
  1036. $7=_st($8)._keys();
  1037. $ctx1.sendIdx["keys"]=1;
  1038. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1039. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  1040. args: [],
  1041. 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",
  1042. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1043. referencedClasses: ["ObjectMock"]
  1044. }),
  1045. smalltalk.ClassBuilderTest);
  1046. smalltalk.addMethod(
  1047. smalltalk.method({
  1048. selector: "testClassMigration",
  1049. protocol: 'tests',
  1050. fn: function (){
  1051. var self=this;
  1052. var instance,oldClass;
  1053. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1054. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1055. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1056. return smalltalk.withContext(function($ctx1) {
  1057. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  1058. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1059. $2=_st($Smalltalk())._globals();
  1060. $ctx1.sendIdx["globals"]=1;
  1061. $1=_st($2)._at_("ObjectMock2");
  1062. $ctx1.sendIdx["at:"]=1;
  1063. instance=_st($1)._new();
  1064. $4=_st($Smalltalk())._globals();
  1065. $ctx1.sendIdx["globals"]=2;
  1066. $3=_st($4)._at_("ObjectMock2");
  1067. $ctx1.sendIdx["at:"]=2;
  1068. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1069. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1070. $ctx1.sendIdx["=="]=1;
  1071. self._deny_($5);
  1072. $ctx1.sendIdx["deny:"]=1;
  1073. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1074. $ctx1.sendIdx["=="]=2;
  1075. self._assert_($6);
  1076. $ctx1.sendIdx["assert:"]=1;
  1077. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1078. $ctx1.sendIdx["assert:"]=2;
  1079. $7=_st($ObjectMock2())._selectors();
  1080. $ctx1.sendIdx["selectors"]=1;
  1081. self._assert_equals_($7,_st(oldClass)._selectors());
  1082. $ctx1.sendIdx["assert:equals:"]=1;
  1083. $8=_st($ObjectMock2())._comment();
  1084. $ctx1.sendIdx["comment"]=1;
  1085. self._assert_equals_($8,_st(oldClass)._comment());
  1086. $ctx1.sendIdx["assert:equals:"]=2;
  1087. $9=_st(_st($ObjectMock2())._package())._name();
  1088. $ctx1.sendIdx["name"]=1;
  1089. self._assert_equals_($9,"Kernel-Tests");
  1090. $11=_st(instance)._class();
  1091. $ctx1.sendIdx["class"]=1;
  1092. $10=_st($11).__eq_eq($ObjectMock2());
  1093. self._deny_($10);
  1094. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  1095. _st($Smalltalk())._removeClass_($ObjectMock2());
  1096. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  1097. args: [],
  1098. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals 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 globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  1099. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1100. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1101. }),
  1102. smalltalk.ClassBuilderTest);
  1103. smalltalk.addMethod(
  1104. smalltalk.method({
  1105. selector: "testClassMigrationWithClassInstanceVariables",
  1106. protocol: 'tests',
  1107. fn: function (){
  1108. var self=this;
  1109. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1110. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1111. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1112. return smalltalk.withContext(function($ctx1) {
  1113. var $1;
  1114. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1115. $1=_st($ObjectMock2())._class();
  1116. $ctx1.sendIdx["class"]=1;
  1117. _st($1)._instanceVariableNames_("foo bar");
  1118. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1119. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1120. _st($Smalltalk())._removeClass_($ObjectMock2());
  1121. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  1122. args: [],
  1123. 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 globals 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 removeClass: ObjectMock2",
  1124. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1125. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1126. }),
  1127. smalltalk.ClassBuilderTest);
  1128. smalltalk.addMethod(
  1129. smalltalk.method({
  1130. selector: "testClassMigrationWithSubclasses",
  1131. protocol: 'tests',
  1132. fn: function (){
  1133. var self=this;
  1134. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1135. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1136. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1137. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1138. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1139. return smalltalk.withContext(function($ctx1) {
  1140. var $2,$1,$4,$3;
  1141. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1142. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1143. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1144. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1145. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1146. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1147. $2=_st($ObjectMock())._subclasses();
  1148. $ctx1.sendIdx["subclasses"]=1;
  1149. $1=_st($2)._includes_($ObjectMock2());
  1150. $ctx1.sendIdx["includes:"]=1;
  1151. self._assert_($1);
  1152. $ctx1.sendIdx["assert:"]=1;
  1153. $4=_st($ObjectMock2())._subclasses();
  1154. $ctx1.sendIdx["subclasses"]=2;
  1155. $3=_st($4)._includes_($ObjectMock3());
  1156. $ctx1.sendIdx["includes:"]=2;
  1157. self._assert_($3);
  1158. $ctx1.sendIdx["assert:"]=2;
  1159. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1160. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1161. return smalltalk.withContext(function($ctx2) {
  1162. return _st($Smalltalk())._removeClass_(each);
  1163. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1164. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  1165. args: [],
  1166. 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 globals 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 removeClass: each ]",
  1167. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1168. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1169. }),
  1170. smalltalk.ClassBuilderTest);
  1171. smalltalk.addMethod(
  1172. smalltalk.method({
  1173. selector: "testInstanceVariableNames",
  1174. protocol: 'tests',
  1175. fn: function (){
  1176. var self=this;
  1177. return smalltalk.withContext(function($ctx1) {
  1178. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1179. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  1180. args: [],
  1181. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1182. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1183. referencedClasses: []
  1184. }),
  1185. smalltalk.ClassBuilderTest);
  1186. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1187. smalltalk.addMethod(
  1188. smalltalk.method({
  1189. selector: "assertSameContents:as:",
  1190. protocol: 'convenience',
  1191. fn: function (aCollection,anotherCollection){
  1192. var self=this;
  1193. return smalltalk.withContext(function($ctx1) {
  1194. var $2,$1,$4,$3;
  1195. $2=_st(aCollection)._size();
  1196. $ctx1.sendIdx["size"]=1;
  1197. $1=_st($2).__eq(_st(anotherCollection)._size());
  1198. $ctx1.sendIdx["="]=1;
  1199. self._assert_($1);
  1200. $ctx1.sendIdx["assert:"]=1;
  1201. _st(aCollection)._do_((function(each){
  1202. return smalltalk.withContext(function($ctx2) {
  1203. $4=_st(aCollection)._occurrencesOf_(each);
  1204. $ctx2.sendIdx["occurrencesOf:"]=1;
  1205. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1206. return self._assert_($3);
  1207. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1208. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  1209. args: ["aCollection", "anotherCollection"],
  1210. 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)) ]",
  1211. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1212. referencedClasses: []
  1213. }),
  1214. smalltalk.CollectionTest);
  1215. smalltalk.addMethod(
  1216. smalltalk.method({
  1217. selector: "collection",
  1218. protocol: 'fixture',
  1219. fn: function (){
  1220. var self=this;
  1221. return smalltalk.withContext(function($ctx1) {
  1222. self._subclassResponsibility();
  1223. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  1224. args: [],
  1225. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1226. messageSends: ["subclassResponsibility"],
  1227. referencedClasses: []
  1228. }),
  1229. smalltalk.CollectionTest);
  1230. smalltalk.addMethod(
  1231. smalltalk.method({
  1232. selector: "collectionClass",
  1233. protocol: 'fixture',
  1234. fn: function (){
  1235. var self=this;
  1236. return smalltalk.withContext(function($ctx1) {
  1237. var $1;
  1238. $1=_st(self._class())._collectionClass();
  1239. return $1;
  1240. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  1241. args: [],
  1242. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1243. messageSends: ["collectionClass", "class"],
  1244. referencedClasses: []
  1245. }),
  1246. smalltalk.CollectionTest);
  1247. smalltalk.addMethod(
  1248. smalltalk.method({
  1249. selector: "collectionOfPrintStrings",
  1250. protocol: 'fixture',
  1251. fn: function (){
  1252. var self=this;
  1253. return smalltalk.withContext(function($ctx1) {
  1254. self._subclassResponsibility();
  1255. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.CollectionTest)})},
  1256. args: [],
  1257. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1258. messageSends: ["subclassResponsibility"],
  1259. referencedClasses: []
  1260. }),
  1261. smalltalk.CollectionTest);
  1262. smalltalk.addMethod(
  1263. smalltalk.method({
  1264. selector: "collectionSize",
  1265. protocol: 'fixture',
  1266. fn: function (){
  1267. var self=this;
  1268. return smalltalk.withContext(function($ctx1) {
  1269. self._subclassResponsibility();
  1270. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.CollectionTest)})},
  1271. args: [],
  1272. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1273. messageSends: ["subclassResponsibility"],
  1274. referencedClasses: []
  1275. }),
  1276. smalltalk.CollectionTest);
  1277. smalltalk.addMethod(
  1278. smalltalk.method({
  1279. selector: "collectionWithDuplicates",
  1280. protocol: 'fixture',
  1281. fn: function (){
  1282. var self=this;
  1283. return smalltalk.withContext(function($ctx1) {
  1284. self._subclassResponsibility();
  1285. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1286. args: [],
  1287. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  1288. messageSends: ["subclassResponsibility"],
  1289. referencedClasses: []
  1290. }),
  1291. smalltalk.CollectionTest);
  1292. smalltalk.addMethod(
  1293. smalltalk.method({
  1294. selector: "collectionWithNewValue",
  1295. protocol: 'fixture',
  1296. fn: function (){
  1297. var self=this;
  1298. return smalltalk.withContext(function($ctx1) {
  1299. self._subclassResponsibility();
  1300. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.CollectionTest)})},
  1301. args: [],
  1302. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility",
  1303. messageSends: ["subclassResponsibility"],
  1304. referencedClasses: []
  1305. }),
  1306. smalltalk.CollectionTest);
  1307. smalltalk.addMethod(
  1308. smalltalk.method({
  1309. selector: "isCollectionReadOnly",
  1310. protocol: 'testing',
  1311. fn: function (){
  1312. var self=this;
  1313. return smalltalk.withContext(function($ctx1) {
  1314. return false;
  1315. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1316. args: [],
  1317. source: "isCollectionReadOnly\x0a\x09^ false",
  1318. messageSends: [],
  1319. referencedClasses: []
  1320. }),
  1321. smalltalk.CollectionTest);
  1322. smalltalk.addMethod(
  1323. smalltalk.method({
  1324. selector: "sampleNewValue",
  1325. protocol: 'fixture',
  1326. fn: function (){
  1327. var self=this;
  1328. return smalltalk.withContext(function($ctx1) {
  1329. return "N";
  1330. }, function($ctx1) {$ctx1.fill(self,"sampleNewValue",{},smalltalk.CollectionTest)})},
  1331. args: [],
  1332. source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'",
  1333. messageSends: [],
  1334. referencedClasses: []
  1335. }),
  1336. smalltalk.CollectionTest);
  1337. smalltalk.addMethod(
  1338. smalltalk.method({
  1339. selector: "sampleNewValueAsCollection",
  1340. protocol: 'fixture',
  1341. fn: function (){
  1342. var self=this;
  1343. return smalltalk.withContext(function($ctx1) {
  1344. var $1;
  1345. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1346. return $1;
  1347. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.CollectionTest)})},
  1348. args: [],
  1349. source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  1350. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1351. referencedClasses: []
  1352. }),
  1353. smalltalk.CollectionTest);
  1354. smalltalk.addMethod(
  1355. smalltalk.method({
  1356. selector: "testAddAll",
  1357. protocol: 'tests',
  1358. fn: function (){
  1359. var self=this;
  1360. return smalltalk.withContext(function($ctx1) {
  1361. var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29;
  1362. $2=self._collection();
  1363. $ctx1.sendIdx["collection"]=1;
  1364. $3=$2;
  1365. $5=self._collectionClass();
  1366. $ctx1.sendIdx["collectionClass"]=1;
  1367. $4=_st($5)._new();
  1368. $ctx1.sendIdx["new"]=1;
  1369. _st($3)._addAll_($4);
  1370. $ctx1.sendIdx["addAll:"]=1;
  1371. $6=_st($2)._yourself();
  1372. $ctx1.sendIdx["yourself"]=1;
  1373. $1=$6;
  1374. $7=self._collection();
  1375. $ctx1.sendIdx["collection"]=2;
  1376. self._assert_equals_($1,$7);
  1377. $ctx1.sendIdx["assert:equals:"]=1;
  1378. $10=self._collectionClass();
  1379. $ctx1.sendIdx["collectionClass"]=2;
  1380. $9=_st($10)._new();
  1381. $ctx1.sendIdx["new"]=2;
  1382. $11=$9;
  1383. $12=self._collection();
  1384. $ctx1.sendIdx["collection"]=3;
  1385. _st($11)._addAll_($12);
  1386. $ctx1.sendIdx["addAll:"]=2;
  1387. $13=_st($9)._yourself();
  1388. $ctx1.sendIdx["yourself"]=2;
  1389. $8=$13;
  1390. $14=self._collection();
  1391. $ctx1.sendIdx["collection"]=4;
  1392. self._assert_equals_($8,$14);
  1393. $ctx1.sendIdx["assert:equals:"]=2;
  1394. $17=self._collectionClass();
  1395. $ctx1.sendIdx["collectionClass"]=3;
  1396. $16=_st($17)._new();
  1397. $ctx1.sendIdx["new"]=3;
  1398. $18=$16;
  1399. $20=self._collectionClass();
  1400. $ctx1.sendIdx["collectionClass"]=4;
  1401. $19=_st($20)._new();
  1402. $ctx1.sendIdx["new"]=4;
  1403. _st($18)._addAll_($19);
  1404. $ctx1.sendIdx["addAll:"]=3;
  1405. $21=_st($16)._yourself();
  1406. $ctx1.sendIdx["yourself"]=3;
  1407. $15=$21;
  1408. self._assert_equals_($15,_st(self._collectionClass())._new());
  1409. $ctx1.sendIdx["assert:equals:"]=3;
  1410. $23=self._collection();
  1411. $ctx1.sendIdx["collection"]=5;
  1412. $24=$23;
  1413. $25=self._sampleNewValueAsCollection();
  1414. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1415. _st($24)._addAll_($25);
  1416. $ctx1.sendIdx["addAll:"]=4;
  1417. $26=_st($23)._yourself();
  1418. $ctx1.sendIdx["yourself"]=4;
  1419. $22=$26;
  1420. $27=self._collectionWithNewValue();
  1421. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1422. self._assert_equals_($22,$27);
  1423. $28=self._sampleNewValueAsCollection();
  1424. _st($28)._addAll_(self._collection());
  1425. $29=_st($28)._yourself();
  1426. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1427. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.CollectionTest)})},
  1428. args: [],
  1429. source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue",
  1430. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1431. referencedClasses: []
  1432. }),
  1433. smalltalk.CollectionTest);
  1434. smalltalk.addMethod(
  1435. smalltalk.method({
  1436. selector: "testAllSatisfy",
  1437. protocol: 'tests',
  1438. fn: function (){
  1439. var self=this;
  1440. var collection,anyOne;
  1441. return smalltalk.withContext(function($ctx1) {
  1442. var $1;
  1443. collection=self._collection();
  1444. anyOne=_st(collection)._anyOne();
  1445. $1=_st(collection)._allSatisfy_((function(each){
  1446. return smalltalk.withContext(function($ctx2) {
  1447. return _st(collection)._includes_(each);
  1448. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1449. $ctx1.sendIdx["allSatisfy:"]=1;
  1450. self._assert_($1);
  1451. self._deny_(_st(collection)._allSatisfy_((function(each){
  1452. return smalltalk.withContext(function($ctx2) {
  1453. return _st(each).__tild_eq(anyOne);
  1454. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1455. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1456. args: [],
  1457. source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])",
  1458. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1459. referencedClasses: []
  1460. }),
  1461. smalltalk.CollectionTest);
  1462. smalltalk.addMethod(
  1463. smalltalk.method({
  1464. selector: "testAnyOne",
  1465. protocol: 'tests',
  1466. fn: function (){
  1467. var self=this;
  1468. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1469. return smalltalk.withContext(function($ctx1) {
  1470. var $2,$1;
  1471. self._should_raise_((function(){
  1472. return smalltalk.withContext(function($ctx2) {
  1473. return _st(_st(self._collectionClass())._new())._anyOne();
  1474. $ctx2.sendIdx["anyOne"]=1;
  1475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1476. $2=self._collection();
  1477. $ctx1.sendIdx["collection"]=1;
  1478. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1479. self._assert_($1);
  1480. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1481. args: [],
  1482. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1483. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1484. referencedClasses: ["Error"]
  1485. }),
  1486. smalltalk.CollectionTest);
  1487. smalltalk.addMethod(
  1488. smalltalk.method({
  1489. selector: "testAnySatisfy",
  1490. protocol: 'tests',
  1491. fn: function (){
  1492. var self=this;
  1493. var anyOne;
  1494. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1495. return smalltalk.withContext(function($ctx1) {
  1496. var $1,$3,$2;
  1497. $1=self._collection();
  1498. $ctx1.sendIdx["collection"]=1;
  1499. anyOne=_st($1)._anyOne();
  1500. $3=self._collection();
  1501. $ctx1.sendIdx["collection"]=2;
  1502. $2=_st($3)._anySatisfy_((function(each){
  1503. return smalltalk.withContext(function($ctx2) {
  1504. return _st(each).__eq(anyOne);
  1505. $ctx2.sendIdx["="]=1;
  1506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1507. $ctx1.sendIdx["anySatisfy:"]=1;
  1508. self._assert_($2);
  1509. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1510. return smalltalk.withContext(function($ctx2) {
  1511. return _st(each).__eq(_st($Object())._new());
  1512. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1513. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1514. args: [],
  1515. source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])",
  1516. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1517. referencedClasses: ["Object"]
  1518. }),
  1519. smalltalk.CollectionTest);
  1520. smalltalk.addMethod(
  1521. smalltalk.method({
  1522. selector: "testAsArray",
  1523. protocol: 'tests',
  1524. fn: function (){
  1525. var self=this;
  1526. return smalltalk.withContext(function($ctx1) {
  1527. var $1;
  1528. $1=self._collection();
  1529. $ctx1.sendIdx["collection"]=1;
  1530. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1531. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1532. args: [],
  1533. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1534. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1535. referencedClasses: []
  1536. }),
  1537. smalltalk.CollectionTest);
  1538. smalltalk.addMethod(
  1539. smalltalk.method({
  1540. selector: "testAsOrderedCollection",
  1541. protocol: 'tests',
  1542. fn: function (){
  1543. var self=this;
  1544. return smalltalk.withContext(function($ctx1) {
  1545. var $1;
  1546. $1=self._collection();
  1547. $ctx1.sendIdx["collection"]=1;
  1548. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1549. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1550. args: [],
  1551. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1552. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1553. referencedClasses: []
  1554. }),
  1555. smalltalk.CollectionTest);
  1556. smalltalk.addMethod(
  1557. smalltalk.method({
  1558. selector: "testAsSet",
  1559. protocol: 'tests',
  1560. fn: function (){
  1561. var self=this;
  1562. var c,set;
  1563. return smalltalk.withContext(function($ctx1) {
  1564. c=self._collectionWithDuplicates();
  1565. set=_st(c)._asSet();
  1566. self._assert_equals_(_st(set)._size(),(5));
  1567. _st(c)._do_((function(each){
  1568. return smalltalk.withContext(function($ctx2) {
  1569. return self._assert_(_st(set)._includes_(each));
  1570. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1571. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1572. args: [],
  1573. 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) ]",
  1574. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1575. referencedClasses: []
  1576. }),
  1577. smalltalk.CollectionTest);
  1578. smalltalk.addMethod(
  1579. smalltalk.method({
  1580. selector: "testCollect",
  1581. protocol: 'tests',
  1582. fn: function (){
  1583. var self=this;
  1584. return smalltalk.withContext(function($ctx1) {
  1585. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1586. $2=self._collection();
  1587. $ctx1.sendIdx["collection"]=1;
  1588. $1=_st($2)._collect_((function(each){
  1589. return smalltalk.withContext(function($ctx2) {
  1590. return each;
  1591. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1592. $ctx1.sendIdx["collect:"]=1;
  1593. $3=self._collection();
  1594. $ctx1.sendIdx["collection"]=2;
  1595. self._assert_equals_($1,$3);
  1596. $ctx1.sendIdx["assert:equals:"]=1;
  1597. $5=self._collectionWithNewValue();
  1598. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1599. $4=_st($5)._collect_((function(each){
  1600. return smalltalk.withContext(function($ctx2) {
  1601. return each;
  1602. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1603. $ctx1.sendIdx["collect:"]=2;
  1604. self._assert_equals_($4,self._collectionWithNewValue());
  1605. $ctx1.sendIdx["assert:equals:"]=2;
  1606. $8=self._collectionClass();
  1607. $ctx1.sendIdx["collectionClass"]=1;
  1608. $7=_st($8)._new();
  1609. $ctx1.sendIdx["new"]=1;
  1610. $6=_st($7)._collect_((function(each){
  1611. return smalltalk.withContext(function($ctx2) {
  1612. return _st(each)._printString();
  1613. $ctx2.sendIdx["printString"]=1;
  1614. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1615. $ctx1.sendIdx["collect:"]=3;
  1616. self._assert_equals_($6,_st(self._collectionClass())._new());
  1617. $ctx1.sendIdx["assert:equals:"]=3;
  1618. $11=self._collection();
  1619. $ctx1.sendIdx["collection"]=3;
  1620. $10=_st($11)._collect_((function(){
  1621. return smalltalk.withContext(function($ctx2) {
  1622. return self._sampleNewValue();
  1623. $ctx2.sendIdx["sampleNewValue"]=1;
  1624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1625. $ctx1.sendIdx["collect:"]=4;
  1626. $9=_st($10)._detect_((function(){
  1627. return smalltalk.withContext(function($ctx2) {
  1628. return true;
  1629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1630. self._assert_equals_($9,self._sampleNewValue());
  1631. $ctx1.sendIdx["assert:equals:"]=4;
  1632. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1633. return smalltalk.withContext(function($ctx2) {
  1634. return _st(each)._printString();
  1635. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1636. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.CollectionTest)})},
  1637. args: [],
  1638. source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings",
  1639. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1640. referencedClasses: []
  1641. }),
  1642. smalltalk.CollectionTest);
  1643. smalltalk.addMethod(
  1644. smalltalk.method({
  1645. selector: "testComma",
  1646. protocol: 'tests',
  1647. fn: function (){
  1648. var self=this;
  1649. return smalltalk.withContext(function($ctx1) {
  1650. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1651. $2=self._collection();
  1652. $ctx1.sendIdx["collection"]=1;
  1653. $4=self._collectionClass();
  1654. $ctx1.sendIdx["collectionClass"]=1;
  1655. $3=_st($4)._new();
  1656. $ctx1.sendIdx["new"]=1;
  1657. $1=_st($2).__comma($3);
  1658. $ctx1.sendIdx[","]=1;
  1659. $5=self._collection();
  1660. $ctx1.sendIdx["collection"]=2;
  1661. self._assert_equals_($1,$5);
  1662. $ctx1.sendIdx["assert:equals:"]=1;
  1663. $8=self._collectionClass();
  1664. $ctx1.sendIdx["collectionClass"]=2;
  1665. $7=_st($8)._new();
  1666. $ctx1.sendIdx["new"]=2;
  1667. $9=self._collection();
  1668. $ctx1.sendIdx["collection"]=3;
  1669. $6=_st($7).__comma($9);
  1670. $ctx1.sendIdx[","]=2;
  1671. $10=self._collection();
  1672. $ctx1.sendIdx["collection"]=4;
  1673. self._assert_equals_($6,$10);
  1674. $ctx1.sendIdx["assert:equals:"]=2;
  1675. $13=self._collectionClass();
  1676. $ctx1.sendIdx["collectionClass"]=3;
  1677. $12=_st($13)._new();
  1678. $ctx1.sendIdx["new"]=3;
  1679. $15=self._collectionClass();
  1680. $ctx1.sendIdx["collectionClass"]=4;
  1681. $14=_st($15)._new();
  1682. $ctx1.sendIdx["new"]=4;
  1683. $11=_st($12).__comma($14);
  1684. $ctx1.sendIdx[","]=3;
  1685. self._assert_equals_($11,_st(self._collectionClass())._new());
  1686. $ctx1.sendIdx["assert:equals:"]=3;
  1687. $17=self._collection();
  1688. $ctx1.sendIdx["collection"]=5;
  1689. $18=self._sampleNewValueAsCollection();
  1690. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1691. $16=_st($17).__comma($18);
  1692. $ctx1.sendIdx[","]=4;
  1693. $19=self._collectionWithNewValue();
  1694. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1695. self._assert_equals_($16,$19);
  1696. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1697. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.CollectionTest)})},
  1698. args: [],
  1699. source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue",
  1700. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1701. referencedClasses: []
  1702. }),
  1703. smalltalk.CollectionTest);
  1704. smalltalk.addMethod(
  1705. smalltalk.method({
  1706. selector: "testDetect",
  1707. protocol: 'tests',
  1708. fn: function (){
  1709. var self=this;
  1710. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1711. return smalltalk.withContext(function($ctx1) {
  1712. var $1,$2,$3,$4,$6,$5,$7;
  1713. self._shouldnt_raise_((function(){
  1714. return smalltalk.withContext(function($ctx2) {
  1715. $1=self._collection();
  1716. $ctx2.sendIdx["collection"]=1;
  1717. return _st($1)._detect_((function(){
  1718. return smalltalk.withContext(function($ctx3) {
  1719. return true;
  1720. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1721. $ctx2.sendIdx["detect:"]=1;
  1722. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1723. self._should_raise_((function(){
  1724. return smalltalk.withContext(function($ctx2) {
  1725. $2=self._collection();
  1726. $ctx2.sendIdx["collection"]=2;
  1727. return _st($2)._detect_((function(){
  1728. return smalltalk.withContext(function($ctx3) {
  1729. return false;
  1730. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  1731. $ctx2.sendIdx["detect:"]=2;
  1732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1733. $ctx1.sendIdx["should:raise:"]=1;
  1734. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1735. return smalltalk.withContext(function($ctx2) {
  1736. return true;
  1737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1738. $ctx1.sendIdx["detect:"]=3;
  1739. $4=self._sampleNewValue();
  1740. $ctx1.sendIdx["sampleNewValue"]=1;
  1741. self._assert_equals_($3,$4);
  1742. $ctx1.sendIdx["assert:equals:"]=1;
  1743. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1744. return smalltalk.withContext(function($ctx2) {
  1745. $6=self._sampleNewValue();
  1746. $ctx2.sendIdx["sampleNewValue"]=2;
  1747. return _st(each).__eq($6);
  1748. $ctx2.sendIdx["="]=1;
  1749. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1750. $ctx1.sendIdx["detect:"]=4;
  1751. $7=self._sampleNewValue();
  1752. $ctx1.sendIdx["sampleNewValue"]=3;
  1753. self._assert_equals_($5,$7);
  1754. self._should_raise_((function(){
  1755. return smalltalk.withContext(function($ctx2) {
  1756. return _st(self._collection())._detect_((function(each){
  1757. return smalltalk.withContext(function($ctx3) {
  1758. return _st(each).__eq(self._sampleNewValue());
  1759. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1761. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1762. args: [],
  1763. source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error",
  1764. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1765. referencedClasses: ["Error"]
  1766. }),
  1767. smalltalk.CollectionTest);
  1768. smalltalk.addMethod(
  1769. smalltalk.method({
  1770. selector: "testDetectIfNone",
  1771. protocol: 'tests',
  1772. fn: function (){
  1773. var self=this;
  1774. var sentinel;
  1775. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1776. return smalltalk.withContext(function($ctx1) {
  1777. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1778. sentinel=_st($Object())._new();
  1779. $3=self._collection();
  1780. $ctx1.sendIdx["collection"]=1;
  1781. $2=_st($3)._detect_ifNone_((function(){
  1782. return smalltalk.withContext(function($ctx2) {
  1783. return true;
  1784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  1785. return smalltalk.withContext(function($ctx2) {
  1786. return sentinel;
  1787. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1788. $ctx1.sendIdx["detect:ifNone:"]=1;
  1789. $1=_st($2).__tild_eq(sentinel);
  1790. self._assert_($1);
  1791. $5=self._collection();
  1792. $ctx1.sendIdx["collection"]=2;
  1793. $4=_st($5)._detect_ifNone_((function(){
  1794. return smalltalk.withContext(function($ctx2) {
  1795. return false;
  1796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),(function(){
  1797. return smalltalk.withContext(function($ctx2) {
  1798. return sentinel;
  1799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1800. $ctx1.sendIdx["detect:ifNone:"]=2;
  1801. self._assert_equals_($4,sentinel);
  1802. $ctx1.sendIdx["assert:equals:"]=1;
  1803. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. return true;
  1806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1807. return smalltalk.withContext(function($ctx2) {
  1808. return sentinel;
  1809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1810. $ctx1.sendIdx["detect:ifNone:"]=3;
  1811. $7=self._sampleNewValue();
  1812. $ctx1.sendIdx["sampleNewValue"]=1;
  1813. self._assert_equals_($6,$7);
  1814. $ctx1.sendIdx["assert:equals:"]=2;
  1815. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1816. return smalltalk.withContext(function($ctx2) {
  1817. $9=self._sampleNewValue();
  1818. $ctx2.sendIdx["sampleNewValue"]=2;
  1819. return _st(each).__eq($9);
  1820. $ctx2.sendIdx["="]=1;
  1821. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1822. return smalltalk.withContext(function($ctx2) {
  1823. return sentinel;
  1824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1825. $ctx1.sendIdx["detect:ifNone:"]=4;
  1826. $10=self._sampleNewValue();
  1827. $ctx1.sendIdx["sampleNewValue"]=3;
  1828. self._assert_equals_($8,$10);
  1829. $ctx1.sendIdx["assert:equals:"]=3;
  1830. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1831. return smalltalk.withContext(function($ctx2) {
  1832. return _st(each).__eq(self._sampleNewValue());
  1833. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1834. return smalltalk.withContext(function($ctx2) {
  1835. return sentinel;
  1836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})})),sentinel);
  1837. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},smalltalk.CollectionTest)})},
  1838. args: [],
  1839. source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel",
  1840. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1841. referencedClasses: ["Object"]
  1842. }),
  1843. smalltalk.CollectionTest);
  1844. smalltalk.addMethod(
  1845. smalltalk.method({
  1846. selector: "testDo",
  1847. protocol: 'tests',
  1848. fn: function (){
  1849. var self=this;
  1850. var newCollection;
  1851. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1852. return smalltalk.withContext(function($ctx1) {
  1853. var $1,$2;
  1854. newCollection=_st($OrderedCollection())._new();
  1855. $ctx1.sendIdx["new"]=1;
  1856. $1=self._collection();
  1857. $ctx1.sendIdx["collection"]=1;
  1858. _st($1)._do_((function(each){
  1859. return smalltalk.withContext(function($ctx2) {
  1860. return _st(newCollection)._add_(each);
  1861. $ctx2.sendIdx["add:"]=1;
  1862. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1863. $ctx1.sendIdx["do:"]=1;
  1864. self._assertSameContents_as_(self._collection(),newCollection);
  1865. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1866. newCollection=_st($OrderedCollection())._new();
  1867. $2=self._collectionWithDuplicates();
  1868. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1869. _st($2)._do_((function(each){
  1870. return smalltalk.withContext(function($ctx2) {
  1871. return _st(newCollection)._add_(each);
  1872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1873. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1874. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1875. args: [],
  1876. 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.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection",
  1877. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1878. referencedClasses: ["OrderedCollection"]
  1879. }),
  1880. smalltalk.CollectionTest);
  1881. smalltalk.addMethod(
  1882. smalltalk.method({
  1883. selector: "testIfEmptyFamily",
  1884. protocol: 'tests',
  1885. fn: function (){
  1886. var self=this;
  1887. return smalltalk.withContext(function($ctx1) {
  1888. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1889. $3=self._collectionClass();
  1890. $ctx1.sendIdx["collectionClass"]=1;
  1891. $2=_st($3)._new();
  1892. $ctx1.sendIdx["new"]=1;
  1893. $1=_st($2)._ifEmpty_((function(){
  1894. return smalltalk.withContext(function($ctx2) {
  1895. return (42);
  1896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1897. $ctx1.sendIdx["ifEmpty:"]=1;
  1898. self._assert_equals_($1,(42));
  1899. $ctx1.sendIdx["assert:equals:"]=1;
  1900. $5=self._collection();
  1901. $ctx1.sendIdx["collection"]=1;
  1902. $4=_st($5)._ifEmpty_((function(){
  1903. return smalltalk.withContext(function($ctx2) {
  1904. return (42);
  1905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1906. $6=self._collection();
  1907. $ctx1.sendIdx["collection"]=2;
  1908. self._assert_equals_($4,$6);
  1909. $ctx1.sendIdx["assert:equals:"]=2;
  1910. $9=self._collectionClass();
  1911. $ctx1.sendIdx["collectionClass"]=2;
  1912. $8=_st($9)._new();
  1913. $ctx1.sendIdx["new"]=2;
  1914. $7=_st($8)._ifNotEmpty_((function(){
  1915. return smalltalk.withContext(function($ctx2) {
  1916. return (42);
  1917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1918. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1919. $11=self._collectionClass();
  1920. $ctx1.sendIdx["collectionClass"]=3;
  1921. $10=_st($11)._new();
  1922. $ctx1.sendIdx["new"]=3;
  1923. self._assert_equals_($7,$10);
  1924. $ctx1.sendIdx["assert:equals:"]=3;
  1925. $13=self._collection();
  1926. $ctx1.sendIdx["collection"]=3;
  1927. $12=_st($13)._ifNotEmpty_((function(){
  1928. return smalltalk.withContext(function($ctx2) {
  1929. return (42);
  1930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1931. self._assert_equals_($12,(42));
  1932. $ctx1.sendIdx["assert:equals:"]=4;
  1933. $16=self._collectionClass();
  1934. $ctx1.sendIdx["collectionClass"]=4;
  1935. $15=_st($16)._new();
  1936. $ctx1.sendIdx["new"]=4;
  1937. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1938. return smalltalk.withContext(function($ctx2) {
  1939. return (42);
  1940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1941. return smalltalk.withContext(function($ctx2) {
  1942. return (999);
  1943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1944. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1945. self._assert_equals_($14,(42));
  1946. $ctx1.sendIdx["assert:equals:"]=5;
  1947. $18=self._collection();
  1948. $ctx1.sendIdx["collection"]=4;
  1949. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1950. return smalltalk.withContext(function($ctx2) {
  1951. return (42);
  1952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1953. return smalltalk.withContext(function($ctx2) {
  1954. return (999);
  1955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1956. self._assert_equals_($17,(999));
  1957. $ctx1.sendIdx["assert:equals:"]=6;
  1958. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1959. return smalltalk.withContext(function($ctx2) {
  1960. return (42);
  1961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1962. return smalltalk.withContext(function($ctx2) {
  1963. return (999);
  1964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1965. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1966. self._assert_equals_($19,(999));
  1967. $ctx1.sendIdx["assert:equals:"]=7;
  1968. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1969. return smalltalk.withContext(function($ctx2) {
  1970. return (42);
  1971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1972. return smalltalk.withContext(function($ctx2) {
  1973. return (999);
  1974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1975. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1976. args: [],
  1977. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42",
  1978. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1979. referencedClasses: []
  1980. }),
  1981. smalltalk.CollectionTest);
  1982. smalltalk.addMethod(
  1983. smalltalk.method({
  1984. selector: "testIsEmpty",
  1985. protocol: 'tests',
  1986. fn: function (){
  1987. var self=this;
  1988. return smalltalk.withContext(function($ctx1) {
  1989. var $1;
  1990. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1991. $ctx1.sendIdx["isEmpty"]=1;
  1992. self._assert_($1);
  1993. self._deny_(_st(self._collection())._isEmpty());
  1994. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1995. args: [],
  1996. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1997. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1998. referencedClasses: []
  1999. }),
  2000. smalltalk.CollectionTest);
  2001. smalltalk.addMethod(
  2002. smalltalk.method({
  2003. selector: "testNoneSatisfy",
  2004. protocol: 'tests',
  2005. fn: function (){
  2006. var self=this;
  2007. var anyOne;
  2008. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2009. return smalltalk.withContext(function($ctx1) {
  2010. var $1,$3,$2;
  2011. $1=self._collection();
  2012. $ctx1.sendIdx["collection"]=1;
  2013. anyOne=_st($1)._anyOne();
  2014. $3=self._collection();
  2015. $ctx1.sendIdx["collection"]=2;
  2016. $2=_st($3)._noneSatisfy_((function(each){
  2017. return smalltalk.withContext(function($ctx2) {
  2018. return _st(each).__eq(anyOne);
  2019. $ctx2.sendIdx["="]=1;
  2020. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2021. $ctx1.sendIdx["noneSatisfy:"]=1;
  2022. self._deny_($2);
  2023. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2024. return smalltalk.withContext(function($ctx2) {
  2025. return _st(each).__eq(_st($Object())._new());
  2026. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2027. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  2028. args: [],
  2029. source: "testNoneSatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self deny: (self collection noneSatisfy: [ :each | each = anyOne ]).\x0a\x09self assert: (self collection noneSatisfy: [ :each | each = Object new ])",
  2030. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2031. referencedClasses: ["Object"]
  2032. }),
  2033. smalltalk.CollectionTest);
  2034. smalltalk.addMethod(
  2035. smalltalk.method({
  2036. selector: "testRemoveAll",
  2037. protocol: 'tests',
  2038. fn: function (){
  2039. var self=this;
  2040. return smalltalk.withContext(function($ctx1) {
  2041. var $1,$2;
  2042. $1=self._collection();
  2043. _st($1)._removeAll();
  2044. $2=_st($1)._yourself();
  2045. self._assert_equals_($2,_st(self._collectionClass())._new());
  2046. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  2047. args: [],
  2048. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2049. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2050. referencedClasses: []
  2051. }),
  2052. smalltalk.CollectionTest);
  2053. smalltalk.addMethod(
  2054. smalltalk.method({
  2055. selector: "testSelect",
  2056. protocol: 'tests',
  2057. fn: function (){
  2058. var self=this;
  2059. return smalltalk.withContext(function($ctx1) {
  2060. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2061. $2=self._collection();
  2062. $ctx1.sendIdx["collection"]=1;
  2063. $1=_st($2)._select_((function(){
  2064. return smalltalk.withContext(function($ctx2) {
  2065. return false;
  2066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2067. $ctx1.sendIdx["select:"]=1;
  2068. $4=self._collectionClass();
  2069. $ctx1.sendIdx["collectionClass"]=1;
  2070. $3=_st($4)._new();
  2071. $ctx1.sendIdx["new"]=1;
  2072. self._assert_equals_($1,$3);
  2073. $ctx1.sendIdx["assert:equals:"]=1;
  2074. $6=self._collection();
  2075. $ctx1.sendIdx["collection"]=2;
  2076. $5=_st($6)._select_((function(){
  2077. return smalltalk.withContext(function($ctx2) {
  2078. return true;
  2079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2080. $ctx1.sendIdx["select:"]=2;
  2081. $7=self._collection();
  2082. $ctx1.sendIdx["collection"]=3;
  2083. self._assert_equals_($5,$7);
  2084. $ctx1.sendIdx["assert:equals:"]=2;
  2085. $9=self._collectionWithNewValue();
  2086. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2087. $8=_st($9)._select_((function(each){
  2088. return smalltalk.withContext(function($ctx2) {
  2089. $10=self._sampleNewValue();
  2090. $ctx2.sendIdx["sampleNewValue"]=1;
  2091. return _st(each).__eq($10);
  2092. $ctx2.sendIdx["="]=1;
  2093. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2094. $ctx1.sendIdx["select:"]=3;
  2095. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2096. $ctx1.sendIdx["assert:equals:"]=3;
  2097. $12=self._collectionWithNewValue();
  2098. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2099. $11=_st($12)._select_((function(each){
  2100. return smalltalk.withContext(function($ctx2) {
  2101. $13=self._sampleNewValue();
  2102. $ctx2.sendIdx["sampleNewValue"]=2;
  2103. return _st(each).__tild_eq($13);
  2104. $ctx2.sendIdx["~="]=1;
  2105. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2106. $ctx1.sendIdx["select:"]=4;
  2107. $14=self._collection();
  2108. $ctx1.sendIdx["collection"]=4;
  2109. self._assert_equals_($11,$14);
  2110. $ctx1.sendIdx["assert:equals:"]=4;
  2111. $16=self._collection();
  2112. $ctx1.sendIdx["collection"]=5;
  2113. $15=_st($16)._select_((function(each){
  2114. return smalltalk.withContext(function($ctx2) {
  2115. $17=self._sampleNewValue();
  2116. $ctx2.sendIdx["sampleNewValue"]=3;
  2117. return _st(each).__eq($17);
  2118. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2119. $ctx1.sendIdx["select:"]=5;
  2120. self._assert_equals_($15,_st(self._collectionClass())._new());
  2121. $ctx1.sendIdx["assert:equals:"]=5;
  2122. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2123. return smalltalk.withContext(function($ctx2) {
  2124. return _st(each).__tild_eq(self._sampleNewValue());
  2125. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2126. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},smalltalk.CollectionTest)})},
  2127. args: [],
  2128. source: "testSelect\x0a\x09self assert: (self collection select: [ false ]) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each = self sampleNewValue ]) equals: self sampleNewValueAsCollection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection",
  2129. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2130. referencedClasses: []
  2131. }),
  2132. smalltalk.CollectionTest);
  2133. smalltalk.addMethod(
  2134. smalltalk.method({
  2135. selector: "testSize",
  2136. protocol: 'tests',
  2137. fn: function (){
  2138. var self=this;
  2139. return smalltalk.withContext(function($ctx1) {
  2140. var $1,$2;
  2141. $1=_st(_st(self._collectionClass())._new())._size();
  2142. $ctx1.sendIdx["size"]=1;
  2143. self._assert_equals_($1,(0));
  2144. $ctx1.sendIdx["assert:equals:"]=1;
  2145. $2=_st(self._sampleNewValueAsCollection())._size();
  2146. $ctx1.sendIdx["size"]=2;
  2147. self._assert_equals_($2,(1));
  2148. $ctx1.sendIdx["assert:equals:"]=2;
  2149. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2150. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  2151. args: [],
  2152. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self sampleNewValueAsCollection size equals: 1.\x0a\x09self assert: self collection size equals: self collectionSize",
  2153. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2154. referencedClasses: []
  2155. }),
  2156. smalltalk.CollectionTest);
  2157. smalltalk.addMethod(
  2158. smalltalk.method({
  2159. selector: "collectionClass",
  2160. protocol: 'fixture',
  2161. fn: function (){
  2162. var self=this;
  2163. return smalltalk.withContext(function($ctx1) {
  2164. return nil;
  2165. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  2166. args: [],
  2167. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2168. messageSends: [],
  2169. referencedClasses: []
  2170. }),
  2171. smalltalk.CollectionTest.klass);
  2172. smalltalk.addMethod(
  2173. smalltalk.method({
  2174. selector: "isAbstract",
  2175. protocol: 'testing',
  2176. fn: function (){
  2177. var self=this;
  2178. return smalltalk.withContext(function($ctx1) {
  2179. var $1;
  2180. $1=_st(self._collectionClass())._isNil();
  2181. return $1;
  2182. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  2183. args: [],
  2184. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2185. messageSends: ["isNil", "collectionClass"],
  2186. referencedClasses: []
  2187. }),
  2188. smalltalk.CollectionTest.klass);
  2189. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  2190. smalltalk.addMethod(
  2191. smalltalk.method({
  2192. selector: "collectionWithNewValue",
  2193. protocol: 'fixture',
  2194. fn: function (){
  2195. var self=this;
  2196. return smalltalk.withContext(function($ctx1) {
  2197. self._subclassResponsibility();
  2198. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.IndexableCollectionTest)})},
  2199. args: [],
  2200. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2201. messageSends: ["subclassResponsibility"],
  2202. referencedClasses: []
  2203. }),
  2204. smalltalk.IndexableCollectionTest);
  2205. smalltalk.addMethod(
  2206. smalltalk.method({
  2207. selector: "sampleNewIndex",
  2208. protocol: 'fixture',
  2209. fn: function (){
  2210. var self=this;
  2211. return smalltalk.withContext(function($ctx1) {
  2212. self._subclassResponsibility();
  2213. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.IndexableCollectionTest)})},
  2214. args: [],
  2215. source: "sampleNewIndex\x0a\x09\x22Answers a value that can be used as index in at:put: or at:ifAbsentPut:\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2216. messageSends: ["subclassResponsibility"],
  2217. referencedClasses: []
  2218. }),
  2219. smalltalk.IndexableCollectionTest);
  2220. smalltalk.addMethod(
  2221. smalltalk.method({
  2222. selector: "sampleNonIndexesDo:",
  2223. protocol: 'fixture',
  2224. fn: function (aBlock){
  2225. var self=this;
  2226. return smalltalk.withContext(function($ctx1) {
  2227. self._subclassResponsibility();
  2228. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2229. args: ["aBlock"],
  2230. source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2231. messageSends: ["subclassResponsibility"],
  2232. referencedClasses: []
  2233. }),
  2234. smalltalk.IndexableCollectionTest);
  2235. smalltalk.addMethod(
  2236. smalltalk.method({
  2237. selector: "samplesDo:",
  2238. protocol: 'fixture',
  2239. fn: function (aBlock){
  2240. var self=this;
  2241. return smalltalk.withContext(function($ctx1) {
  2242. self._subclassResponsibility();
  2243. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2244. args: ["aBlock"],
  2245. source: "samplesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing known index and value stored\x0a\x09under that index as the parameters\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2246. messageSends: ["subclassResponsibility"],
  2247. referencedClasses: []
  2248. }),
  2249. smalltalk.IndexableCollectionTest);
  2250. smalltalk.addMethod(
  2251. smalltalk.method({
  2252. selector: "testAt",
  2253. protocol: 'tests',
  2254. fn: function (){
  2255. var self=this;
  2256. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2257. return smalltalk.withContext(function($ctx1) {
  2258. var $1;
  2259. self._nonIndexesDo_((function(each){
  2260. return smalltalk.withContext(function($ctx2) {
  2261. return self._should_raise_((function(){
  2262. return smalltalk.withContext(function($ctx3) {
  2263. $1=self._collection();
  2264. $ctx3.sendIdx["collection"]=1;
  2265. return _st($1)._at_(each);
  2266. $ctx3.sendIdx["at:"]=1;
  2267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2268. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2269. self._samplesDo_((function(index,value){
  2270. return smalltalk.withContext(function($ctx2) {
  2271. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2272. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2273. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  2274. args: [],
  2275. source: "testAt\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self should: [ self collection at: each ] raise: Error ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index) equals: value ]",
  2276. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2277. referencedClasses: ["Error"]
  2278. }),
  2279. smalltalk.IndexableCollectionTest);
  2280. smalltalk.addMethod(
  2281. smalltalk.method({
  2282. selector: "testAtIfAbsent",
  2283. protocol: 'tests',
  2284. fn: function (){
  2285. var self=this;
  2286. return smalltalk.withContext(function($ctx1) {
  2287. var $2,$1,$3;
  2288. self._nonIndexesDo_((function(each){
  2289. return smalltalk.withContext(function($ctx2) {
  2290. $2=self._collection();
  2291. $ctx2.sendIdx["collection"]=1;
  2292. $1=_st($2)._at_ifAbsent_(each,(function(){
  2293. return smalltalk.withContext(function($ctx3) {
  2294. return self._sampleNewValue();
  2295. $ctx3.sendIdx["sampleNewValue"]=1;
  2296. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2297. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2298. $3=self._sampleNewValue();
  2299. $ctx2.sendIdx["sampleNewValue"]=2;
  2300. return self._assert_equals_($1,$3);
  2301. $ctx2.sendIdx["assert:equals:"]=1;
  2302. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2303. self._samplesDo_((function(index,value){
  2304. return smalltalk.withContext(function($ctx2) {
  2305. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2306. return smalltalk.withContext(function($ctx3) {
  2307. return self._sampleNewValue();
  2308. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2309. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2310. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  2311. args: [],
  2312. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNewValue ]) equals: value ].",
  2313. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2314. referencedClasses: []
  2315. }),
  2316. smalltalk.IndexableCollectionTest);
  2317. smalltalk.addMethod(
  2318. smalltalk.method({
  2319. selector: "testAtIfAbsentPut",
  2320. protocol: 'tests',
  2321. fn: function (){
  2322. var self=this;
  2323. var newCollection;
  2324. return smalltalk.withContext(function($ctx1) {
  2325. var $1;
  2326. newCollection=self._collection();
  2327. $ctx1.sendIdx["collection"]=1;
  2328. self._samplesDo_((function(index,value){
  2329. return smalltalk.withContext(function($ctx2) {
  2330. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2331. return smalltalk.withContext(function($ctx3) {
  2332. return self._sampleNewValue();
  2333. $ctx3.sendIdx["sampleNewValue"]=1;
  2334. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2335. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2336. return self._assert_equals_($1,value);
  2337. $ctx2.sendIdx["assert:equals:"]=1;
  2338. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2339. self._assert_equals_(newCollection,self._collection());
  2340. $ctx1.sendIdx["assert:equals:"]=2;
  2341. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2342. return smalltalk.withContext(function($ctx2) {
  2343. return self._sampleNewValue();
  2344. $ctx2.sendIdx["sampleNewValue"]=2;
  2345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2346. $ctx1.sendIdx["assert:equals:"]=3;
  2347. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2348. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2349. args: [],
  2350. source: "testAtIfAbsentPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (newCollection at: index ifAbsentPut: [ self sampleNewValue ]) equals: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09self assert: (newCollection at: self sampleNewIndex ifAbsentPut: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  2351. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2352. referencedClasses: []
  2353. }),
  2354. smalltalk.IndexableCollectionTest);
  2355. smalltalk.addMethod(
  2356. smalltalk.method({
  2357. selector: "testAtIfPresent",
  2358. protocol: 'tests',
  2359. fn: function (){
  2360. var self=this;
  2361. var visited,sentinel;
  2362. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2363. return smalltalk.withContext(function($ctx1) {
  2364. var $2,$1,$4,$3;
  2365. sentinel=_st($Object())._new();
  2366. self._nonIndexesDo_((function(each){
  2367. return smalltalk.withContext(function($ctx2) {
  2368. visited=nil;
  2369. visited;
  2370. $2=self._collection();
  2371. $ctx2.sendIdx["collection"]=1;
  2372. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2373. return smalltalk.withContext(function($ctx3) {
  2374. visited=value1;
  2375. visited;
  2376. return sentinel;
  2377. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}));
  2378. $ctx2.sendIdx["at:ifPresent:"]=1;
  2379. self._assert_equals_($1,nil);
  2380. $ctx2.sendIdx["assert:equals:"]=1;
  2381. return self._assert_(_st(visited)._isNil());
  2382. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2383. self._samplesDo_((function(index,value){
  2384. return smalltalk.withContext(function($ctx2) {
  2385. visited=nil;
  2386. visited;
  2387. $4=self._collection();
  2388. $ctx2.sendIdx["collection"]=2;
  2389. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2390. return smalltalk.withContext(function($ctx3) {
  2391. visited=value2;
  2392. visited;
  2393. return sentinel;
  2394. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,4)})}));
  2395. self._assert_equals_($3,sentinel);
  2396. $ctx2.sendIdx["assert:equals:"]=2;
  2397. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2398. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2399. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2400. args: [],
  2401. source: "testAtIfPresent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ]) equals: nil.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2402. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2403. referencedClasses: ["Object"]
  2404. }),
  2405. smalltalk.IndexableCollectionTest);
  2406. smalltalk.addMethod(
  2407. smalltalk.method({
  2408. selector: "testAtIfPresentIfAbsent",
  2409. protocol: 'tests',
  2410. fn: function (){
  2411. var self=this;
  2412. var visited,sentinel;
  2413. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2414. return smalltalk.withContext(function($ctx1) {
  2415. var $2,$1,$3,$5,$4;
  2416. sentinel=_st($Object())._new();
  2417. self._nonIndexesDo_((function(each){
  2418. return smalltalk.withContext(function($ctx2) {
  2419. visited=nil;
  2420. visited;
  2421. $2=self._collection();
  2422. $ctx2.sendIdx["collection"]=1;
  2423. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2424. return smalltalk.withContext(function($ctx3) {
  2425. visited=value1;
  2426. visited;
  2427. return sentinel;
  2428. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}),(function(){
  2429. return smalltalk.withContext(function($ctx3) {
  2430. return self._sampleNewValue();
  2431. $ctx3.sendIdx["sampleNewValue"]=1;
  2432. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2433. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2434. $3=self._sampleNewValue();
  2435. $ctx2.sendIdx["sampleNewValue"]=2;
  2436. self._assert_equals_($1,$3);
  2437. $ctx2.sendIdx["assert:equals:"]=1;
  2438. return self._assert_(_st(visited)._isNil());
  2439. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2440. self._samplesDo_((function(index,value){
  2441. return smalltalk.withContext(function($ctx2) {
  2442. visited=nil;
  2443. visited;
  2444. $5=self._collection();
  2445. $ctx2.sendIdx["collection"]=2;
  2446. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2447. return smalltalk.withContext(function($ctx3) {
  2448. visited=value2;
  2449. visited;
  2450. return sentinel;
  2451. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,5)})}),(function(){
  2452. return smalltalk.withContext(function($ctx3) {
  2453. return self._sampleNewValue();
  2454. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2455. self._assert_equals_($4,sentinel);
  2456. $ctx2.sendIdx["assert:equals:"]=2;
  2457. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2458. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2459. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2460. args: [],
  2461. source: "testAtIfPresentIfAbsent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ] ifAbsent: [ self sampleNewValue ] ) equals: self sampleNewValue.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ] ifAbsent: [ self sampleNewValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2462. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2463. referencedClasses: ["Object"]
  2464. }),
  2465. smalltalk.IndexableCollectionTest);
  2466. smalltalk.addMethod(
  2467. smalltalk.method({
  2468. selector: "testAtPut",
  2469. protocol: 'tests',
  2470. fn: function (){
  2471. var self=this;
  2472. var newCollection;
  2473. return smalltalk.withContext(function($ctx1) {
  2474. newCollection=self._collection();
  2475. $ctx1.sendIdx["collection"]=1;
  2476. self._samplesDo_((function(index,value){
  2477. return smalltalk.withContext(function($ctx2) {
  2478. return _st(newCollection)._at_put_(index,value);
  2479. $ctx2.sendIdx["at:put:"]=1;
  2480. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2481. self._assert_equals_(newCollection,self._collection());
  2482. $ctx1.sendIdx["assert:equals:"]=1;
  2483. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2484. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2485. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2486. args: [],
  2487. source: "testAtPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09newCollection at: index put: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09newCollection at: self sampleNewIndex put: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  2488. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2489. referencedClasses: []
  2490. }),
  2491. smalltalk.IndexableCollectionTest);
  2492. smalltalk.addMethod(
  2493. smalltalk.method({
  2494. selector: "testEquality",
  2495. protocol: 'tests',
  2496. fn: function (){
  2497. var self=this;
  2498. return smalltalk.withContext(function($ctx1) {
  2499. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2500. $2=self._collectionClass();
  2501. $ctx1.sendIdx["collectionClass"]=1;
  2502. $1=_st($2)._new();
  2503. $ctx1.sendIdx["new"]=1;
  2504. $4=self._collectionClass();
  2505. $ctx1.sendIdx["collectionClass"]=2;
  2506. $3=_st($4)._new();
  2507. $ctx1.sendIdx["new"]=2;
  2508. self._assert_equals_($1,$3);
  2509. $ctx1.sendIdx["assert:equals:"]=1;
  2510. $5=self._collection();
  2511. $ctx1.sendIdx["collection"]=1;
  2512. $6=self._collection();
  2513. $ctx1.sendIdx["collection"]=2;
  2514. self._assert_equals_($5,$6);
  2515. $ctx1.sendIdx["assert:equals:"]=2;
  2516. $7=self._collectionWithNewValue();
  2517. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2518. self._assert_equals_($7,self._collectionWithNewValue());
  2519. $10=self._collectionClass();
  2520. $ctx1.sendIdx["collectionClass"]=3;
  2521. $9=_st($10)._new();
  2522. $ctx1.sendIdx["new"]=3;
  2523. $11=self._collection();
  2524. $ctx1.sendIdx["collection"]=3;
  2525. $8=_st($9).__eq($11);
  2526. $ctx1.sendIdx["="]=1;
  2527. self._deny_($8);
  2528. $ctx1.sendIdx["deny:"]=1;
  2529. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2530. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.IndexableCollectionTest)})},
  2531. args: [],
  2532. source: "testEquality\x0a\x09self assert: self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection equals: self collection.\x0a\x09self assert: self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new = self collection.\x0a\x09self deny: self collection = self collectionClass new",
  2533. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2534. referencedClasses: []
  2535. }),
  2536. smalltalk.IndexableCollectionTest);
  2537. smalltalk.addMethod(
  2538. smalltalk.method({
  2539. selector: "testIndexOf",
  2540. protocol: 'tests',
  2541. fn: function (){
  2542. var self=this;
  2543. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2544. return smalltalk.withContext(function($ctx1) {
  2545. var $1;
  2546. self._should_raise_((function(){
  2547. return smalltalk.withContext(function($ctx2) {
  2548. $1=self._collection();
  2549. $ctx2.sendIdx["collection"]=1;
  2550. return _st($1)._indexOf_(self._sampleNewValue());
  2551. $ctx2.sendIdx["indexOf:"]=1;
  2552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2553. self._samplesDo_((function(index,value){
  2554. return smalltalk.withContext(function($ctx2) {
  2555. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2556. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2557. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  2558. args: [],
  2559. source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNewValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]",
  2560. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2561. referencedClasses: ["Error"]
  2562. }),
  2563. smalltalk.IndexableCollectionTest);
  2564. smalltalk.addMethod(
  2565. smalltalk.method({
  2566. selector: "testIndexOfWithNull",
  2567. protocol: 'tests',
  2568. fn: function (){
  2569. var self=this;
  2570. var jsNull;
  2571. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2572. return smalltalk.withContext(function($ctx1) {
  2573. var $1,$2;
  2574. jsNull=_st($JSON())._parse_("null");
  2575. self._samplesDo_((function(index,value){
  2576. return smalltalk.withContext(function($ctx2) {
  2577. $1=self._collection();
  2578. _st($1)._at_put_(index,jsNull);
  2579. $2=_st($1)._indexOf_(jsNull);
  2580. return self._assert_equals_($2,index);
  2581. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2582. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},smalltalk.IndexableCollectionTest)})},
  2583. args: [],
  2584. source: "testIndexOfWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index put: jsNull; indexOf: jsNull) equals: index ]",
  2585. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2586. referencedClasses: ["JSON"]
  2587. }),
  2588. smalltalk.IndexableCollectionTest);
  2589. smalltalk.addMethod(
  2590. smalltalk.method({
  2591. selector: "testWithIndexDo",
  2592. protocol: 'tests',
  2593. fn: function (){
  2594. var self=this;
  2595. var collection;
  2596. return smalltalk.withContext(function($ctx1) {
  2597. collection=self._collection();
  2598. $ctx1.sendIdx["collection"]=1;
  2599. _st(self._collection())._withIndexDo_((function(each,index){
  2600. return smalltalk.withContext(function($ctx2) {
  2601. return self._assert_equals_(_st(collection)._at_(index),each);
  2602. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2603. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  2604. args: [],
  2605. 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 ]",
  2606. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2607. referencedClasses: []
  2608. }),
  2609. smalltalk.IndexableCollectionTest);
  2610. smalltalk.addClass('AssociativeCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2611. smalltalk.addMethod(
  2612. smalltalk.method({
  2613. selector: "collectionKeys",
  2614. protocol: 'fixture',
  2615. fn: function (){
  2616. var self=this;
  2617. return smalltalk.withContext(function($ctx1) {
  2618. self._subclassResponsibility();
  2619. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},smalltalk.AssociativeCollectionTest)})},
  2620. args: [],
  2621. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2622. messageSends: ["subclassResponsibility"],
  2623. referencedClasses: []
  2624. }),
  2625. smalltalk.AssociativeCollectionTest);
  2626. smalltalk.addMethod(
  2627. smalltalk.method({
  2628. selector: "collectionValues",
  2629. protocol: 'fixture',
  2630. fn: function (){
  2631. var self=this;
  2632. return smalltalk.withContext(function($ctx1) {
  2633. self._subclassResponsibility();
  2634. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},smalltalk.AssociativeCollectionTest)})},
  2635. args: [],
  2636. source: "collectionValues\x0a\x09self subclassResponsibility",
  2637. messageSends: ["subclassResponsibility"],
  2638. referencedClasses: []
  2639. }),
  2640. smalltalk.AssociativeCollectionTest);
  2641. smalltalk.addMethod(
  2642. smalltalk.method({
  2643. selector: "nonIndexesDo:",
  2644. protocol: 'fixture',
  2645. fn: function (aBlock){
  2646. var self=this;
  2647. return smalltalk.withContext(function($ctx1) {
  2648. _st(aBlock)._value_((5));
  2649. $ctx1.sendIdx["value:"]=1;
  2650. _st(aBlock)._value_("z");
  2651. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.AssociativeCollectionTest)})},
  2652. args: ["aBlock"],
  2653. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2654. messageSends: ["value:"],
  2655. referencedClasses: []
  2656. }),
  2657. smalltalk.AssociativeCollectionTest);
  2658. smalltalk.addMethod(
  2659. smalltalk.method({
  2660. selector: "sampleNewIndex",
  2661. protocol: 'fixture',
  2662. fn: function (){
  2663. var self=this;
  2664. return smalltalk.withContext(function($ctx1) {
  2665. return "new";
  2666. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.AssociativeCollectionTest)})},
  2667. args: [],
  2668. source: "sampleNewIndex\x0a\x09^ 'new'",
  2669. messageSends: [],
  2670. referencedClasses: []
  2671. }),
  2672. smalltalk.AssociativeCollectionTest);
  2673. smalltalk.addMethod(
  2674. smalltalk.method({
  2675. selector: "samplesDo:",
  2676. protocol: 'fixture',
  2677. fn: function (aBlock){
  2678. var self=this;
  2679. return smalltalk.withContext(function($ctx1) {
  2680. _st(aBlock)._value_value_("a",(2));
  2681. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.AssociativeCollectionTest)})},
  2682. args: ["aBlock"],
  2683. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2684. messageSends: ["value:value:"],
  2685. referencedClasses: []
  2686. }),
  2687. smalltalk.AssociativeCollectionTest);
  2688. smalltalk.addMethod(
  2689. smalltalk.method({
  2690. selector: "testAddAll",
  2691. protocol: 'tests',
  2692. fn: function (){
  2693. var self=this;
  2694. return smalltalk.withContext(function($ctx1) {
  2695. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2696. smalltalk.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2697. $2=self._collection();
  2698. $ctx1.sendIdx["collection"]=1;
  2699. $3=$2;
  2700. $4=self._collection();
  2701. $ctx1.sendIdx["collection"]=2;
  2702. _st($3)._addAll_($4);
  2703. $ctx1.sendIdx["addAll:"]=1;
  2704. $5=_st($2)._yourself();
  2705. $ctx1.sendIdx["yourself"]=1;
  2706. $1=$5;
  2707. $6=self._collection();
  2708. $ctx1.sendIdx["collection"]=3;
  2709. self._assert_equals_($1,$6);
  2710. $ctx1.sendIdx["assert:equals:"]=1;
  2711. $8=self._collection();
  2712. $ctx1.sendIdx["collection"]=4;
  2713. $9=$8;
  2714. $10=self._collectionWithNewValue();
  2715. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2716. _st($9)._addAll_($10);
  2717. $ctx1.sendIdx["addAll:"]=2;
  2718. $11=_st($8)._yourself();
  2719. $ctx1.sendIdx["yourself"]=2;
  2720. $7=$11;
  2721. $12=self._collectionWithNewValue();
  2722. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2723. self._assert_equals_($7,$12);
  2724. $ctx1.sendIdx["assert:equals:"]=2;
  2725. $14=self._collectionWithNewValue();
  2726. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2727. _st($14)._addAll_(self._collection());
  2728. $15=_st($14)._yourself();
  2729. $13=$15;
  2730. self._assert_equals_($13,self._collectionWithNewValue());
  2731. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.AssociativeCollectionTest)})},
  2732. args: [],
  2733. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  2734. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2735. referencedClasses: []
  2736. }),
  2737. smalltalk.AssociativeCollectionTest);
  2738. smalltalk.addMethod(
  2739. smalltalk.method({
  2740. selector: "testAsDictionary",
  2741. protocol: 'tests',
  2742. fn: function (){
  2743. var self=this;
  2744. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2745. return smalltalk.withContext(function($ctx1) {
  2746. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2747. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.AssociativeCollectionTest)})},
  2748. args: [],
  2749. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2750. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2751. referencedClasses: ["Dictionary"]
  2752. }),
  2753. smalltalk.AssociativeCollectionTest);
  2754. smalltalk.addMethod(
  2755. smalltalk.method({
  2756. selector: "testAsHashedCollection",
  2757. protocol: 'tests',
  2758. fn: function (){
  2759. var self=this;
  2760. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2761. return smalltalk.withContext(function($ctx1) {
  2762. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2763. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.AssociativeCollectionTest)})},
  2764. args: [],
  2765. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2766. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2767. referencedClasses: ["HashedCollection"]
  2768. }),
  2769. smalltalk.AssociativeCollectionTest);
  2770. smalltalk.addMethod(
  2771. smalltalk.method({
  2772. selector: "testComma",
  2773. protocol: 'tests',
  2774. fn: function (){
  2775. var self=this;
  2776. return smalltalk.withContext(function($ctx1) {
  2777. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2778. smalltalk.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  2779. $2=self._collection();
  2780. $ctx1.sendIdx["collection"]=1;
  2781. $3=self._collection();
  2782. $ctx1.sendIdx["collection"]=2;
  2783. $1=_st($2).__comma($3);
  2784. $ctx1.sendIdx[","]=1;
  2785. $4=self._collection();
  2786. $ctx1.sendIdx["collection"]=3;
  2787. self._assert_equals_($1,$4);
  2788. $ctx1.sendIdx["assert:equals:"]=1;
  2789. $6=self._collection();
  2790. $ctx1.sendIdx["collection"]=4;
  2791. $7=self._collectionWithNewValue();
  2792. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2793. $5=_st($6).__comma($7);
  2794. $ctx1.sendIdx[","]=2;
  2795. $8=self._collectionWithNewValue();
  2796. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2797. self._assert_equals_($5,$8);
  2798. $ctx1.sendIdx["assert:equals:"]=2;
  2799. $10=self._collectionWithNewValue();
  2800. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2801. $9=_st($10).__comma(self._collection());
  2802. self._assert_equals_($9,self._collectionWithNewValue());
  2803. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.AssociativeCollectionTest)})},
  2804. args: [],
  2805. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  2806. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2807. referencedClasses: []
  2808. }),
  2809. smalltalk.AssociativeCollectionTest);
  2810. smalltalk.addMethod(
  2811. smalltalk.method({
  2812. selector: "testFrom",
  2813. protocol: 'tests',
  2814. fn: function (){
  2815. var self=this;
  2816. var associations;
  2817. return smalltalk.withContext(function($ctx1) {
  2818. var $1,$2,$3,$5,$4;
  2819. $1="a".__minus_gt((1));
  2820. $ctx1.sendIdx["->"]=1;
  2821. $2="b".__minus_gt((2));
  2822. $ctx1.sendIdx["->"]=2;
  2823. associations=[$1,$2];
  2824. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2825. $5="a".__minus_gt((1));
  2826. $ctx1.sendIdx["->"]=3;
  2827. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2828. self._assertSameContents_as_($3,$4);
  2829. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.AssociativeCollectionTest)})},
  2830. args: [],
  2831. 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 }.",
  2832. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2833. referencedClasses: []
  2834. }),
  2835. smalltalk.AssociativeCollectionTest);
  2836. smalltalk.addMethod(
  2837. smalltalk.method({
  2838. selector: "testKeys",
  2839. protocol: 'tests',
  2840. fn: function (){
  2841. var self=this;
  2842. return smalltalk.withContext(function($ctx1) {
  2843. var $2,$1,$3,$4;
  2844. $2=_st(_st(self._collectionClass())._new())._keys();
  2845. $ctx1.sendIdx["keys"]=1;
  2846. $1=_st($2)._isEmpty();
  2847. self._assert_($1);
  2848. $3=_st(self._collection())._keys();
  2849. $ctx1.sendIdx["keys"]=2;
  2850. $4=self._collectionKeys();
  2851. $ctx1.sendIdx["collectionKeys"]=1;
  2852. self._assertSameContents_as_($3,$4);
  2853. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2854. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2855. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},smalltalk.AssociativeCollectionTest)})},
  2856. args: [],
  2857. source: "testKeys\x0a\x09self assert:self collectionClass new keys isEmpty.\x0a\x09self assertSameContents:self collection keys as: self collectionKeys.\x0a\x09self assertSameContents:self collectionWithNewValue keys as: self collectionKeys, { self sampleNewIndex }",
  2858. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2859. referencedClasses: []
  2860. }),
  2861. smalltalk.AssociativeCollectionTest);
  2862. smalltalk.addMethod(
  2863. smalltalk.method({
  2864. selector: "testNewFromPairs",
  2865. protocol: 'tests',
  2866. fn: function (){
  2867. var self=this;
  2868. var flattenedAssociations;
  2869. return smalltalk.withContext(function($ctx1) {
  2870. var $1,$3,$2;
  2871. flattenedAssociations=["a",(1),"b",(2)];
  2872. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2873. $3="a".__minus_gt((1));
  2874. $ctx1.sendIdx["->"]=1;
  2875. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2876. self._assertSameContents_as_($1,$2);
  2877. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.AssociativeCollectionTest)})},
  2878. args: [],
  2879. 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 }.",
  2880. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2881. referencedClasses: []
  2882. }),
  2883. smalltalk.AssociativeCollectionTest);
  2884. smalltalk.addMethod(
  2885. smalltalk.method({
  2886. selector: "testPrintString",
  2887. protocol: 'tests',
  2888. fn: function (){
  2889. var self=this;
  2890. return smalltalk.withContext(function($ctx1) {
  2891. var $3,$2,$4,$1,$5;
  2892. $3=self._collectionClass();
  2893. $ctx1.sendIdx["collectionClass"]=1;
  2894. $2=_st($3)._new();
  2895. _st($2)._at_put_("firstname","James");
  2896. $ctx1.sendIdx["at:put:"]=1;
  2897. _st($2)._at_put_("lastname","Bond");
  2898. $4=_st($2)._printString();
  2899. $1=$4;
  2900. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2901. $ctx1.sendIdx[","]=1;
  2902. self._assert_equals_($1,$5);
  2903. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.AssociativeCollectionTest)})},
  2904. args: [],
  2905. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (self collectionClass 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 ', self collectionClass name, ' (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  2906. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2907. referencedClasses: []
  2908. }),
  2909. smalltalk.AssociativeCollectionTest);
  2910. smalltalk.addMethod(
  2911. smalltalk.method({
  2912. selector: "testRemoveKey",
  2913. protocol: 'tests',
  2914. fn: function (){
  2915. var self=this;
  2916. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2917. return smalltalk.withContext(function($ctx1) {
  2918. var $1,$2,$3,$5,$6,$4,$7,$8;
  2919. self._nonIndexesDo_((function(each){
  2920. var collection;
  2921. return smalltalk.withContext(function($ctx2) {
  2922. collection=self._collection();
  2923. $ctx2.sendIdx["collection"]=1;
  2924. collection;
  2925. self._should_raise_((function(){
  2926. return smalltalk.withContext(function($ctx3) {
  2927. return _st(collection)._removeKey_(each);
  2928. $ctx3.sendIdx["removeKey:"]=1;
  2929. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2930. $1=collection;
  2931. $2=self._collection();
  2932. $ctx2.sendIdx["collection"]=2;
  2933. return self._assert_equals_($1,$2);
  2934. $ctx2.sendIdx["assert:equals:"]=1;
  2935. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2936. self._samplesDo_((function(index,value){
  2937. var collection;
  2938. return smalltalk.withContext(function($ctx2) {
  2939. collection=self._collection();
  2940. $ctx2.sendIdx["collection"]=3;
  2941. collection;
  2942. $3=_st(collection)._removeKey_(index);
  2943. $ctx2.sendIdx["removeKey:"]=2;
  2944. self._assert_equals_($3,value);
  2945. $ctx2.sendIdx["assert:equals:"]=2;
  2946. $5=collection;
  2947. $6=self._collection();
  2948. $ctx2.sendIdx["collection"]=4;
  2949. $4=_st($5).__eq($6);
  2950. return self._deny_($4);
  2951. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2952. $7=self._collectionWithNewValue();
  2953. _st($7)._removeKey_(self._sampleNewIndex());
  2954. $8=_st($7)._yourself();
  2955. self._assert_equals_($8,self._collection());
  2956. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},smalltalk.AssociativeCollectionTest)})},
  2957. args: [],
  2958. source: "testRemoveKey\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self should: [ collection removeKey: each ] raise: Error.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex; yourself)\x0a\x09\x09equals: self collection",
  2959. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  2960. referencedClasses: ["Error"]
  2961. }),
  2962. smalltalk.AssociativeCollectionTest);
  2963. smalltalk.addMethod(
  2964. smalltalk.method({
  2965. selector: "testRemoveKeyIfAbsent",
  2966. protocol: 'tests',
  2967. fn: function (){
  2968. var self=this;
  2969. return smalltalk.withContext(function($ctx1) {
  2970. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  2971. self._nonIndexesDo_((function(each){
  2972. var collection;
  2973. return smalltalk.withContext(function($ctx2) {
  2974. collection=self._collection();
  2975. $ctx2.sendIdx["collection"]=1;
  2976. collection;
  2977. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  2978. return smalltalk.withContext(function($ctx3) {
  2979. return self._sampleNewValue();
  2980. $ctx3.sendIdx["sampleNewValue"]=1;
  2981. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2982. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  2983. $2=self._sampleNewValue();
  2984. $ctx2.sendIdx["sampleNewValue"]=2;
  2985. self._assert_equals_($1,$2);
  2986. $ctx2.sendIdx["assert:equals:"]=1;
  2987. $3=collection;
  2988. $4=self._collection();
  2989. $ctx2.sendIdx["collection"]=2;
  2990. return self._assert_equals_($3,$4);
  2991. $ctx2.sendIdx["assert:equals:"]=2;
  2992. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2993. self._samplesDo_((function(index,value){
  2994. var collection;
  2995. return smalltalk.withContext(function($ctx2) {
  2996. collection=self._collection();
  2997. $ctx2.sendIdx["collection"]=3;
  2998. collection;
  2999. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  3000. return smalltalk.withContext(function($ctx3) {
  3001. return self._sampleNewValue();
  3002. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  3003. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  3004. self._assert_equals_($5,value);
  3005. $ctx2.sendIdx["assert:equals:"]=3;
  3006. $7=collection;
  3007. $8=self._collection();
  3008. $ctx2.sendIdx["collection"]=4;
  3009. $6=_st($7).__eq($8);
  3010. return self._deny_($6);
  3011. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3012. $9=self._collectionWithNewValue();
  3013. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  3014. return smalltalk.withContext(function($ctx2) {
  3015. return self._assert_(false);
  3016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  3017. $10=_st($9)._yourself();
  3018. self._assert_equals_($10,self._collection());
  3019. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},smalltalk.AssociativeCollectionTest)})},
  3020. args: [],
  3021. source: "testRemoveKeyIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index ifAbsent: [ self sampleNewValue ]) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex ifAbsent: [ self assert: false ]; yourself)\x0a\x09\x09equals: self collection",
  3022. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3023. referencedClasses: []
  3024. }),
  3025. smalltalk.AssociativeCollectionTest);
  3026. smalltalk.addMethod(
  3027. smalltalk.method({
  3028. selector: "testValues",
  3029. protocol: 'tests',
  3030. fn: function (){
  3031. var self=this;
  3032. return smalltalk.withContext(function($ctx1) {
  3033. var $2,$1,$3,$4;
  3034. $2=_st(_st(self._collectionClass())._new())._values();
  3035. $ctx1.sendIdx["values"]=1;
  3036. $1=_st($2)._isEmpty();
  3037. self._assert_($1);
  3038. $3=_st(self._collection())._values();
  3039. $ctx1.sendIdx["values"]=2;
  3040. $4=self._collectionValues();
  3041. $ctx1.sendIdx["collectionValues"]=1;
  3042. self._assertSameContents_as_($3,$4);
  3043. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3044. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3045. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},smalltalk.AssociativeCollectionTest)})},
  3046. args: [],
  3047. source: "testValues\x0a\x09self assert:self collectionClass new values isEmpty.\x0a\x09self assertSameContents:self collection values as: self collectionValues.\x0a\x09self assertSameContents:self collectionWithNewValue values as: self collectionValues, { self sampleNewValue }",
  3048. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3049. referencedClasses: []
  3050. }),
  3051. smalltalk.AssociativeCollectionTest);
  3052. smalltalk.addClass('DictionaryTest', smalltalk.AssociativeCollectionTest, [], 'Kernel-Tests');
  3053. smalltalk.addMethod(
  3054. smalltalk.method({
  3055. selector: "collection",
  3056. protocol: 'fixture',
  3057. fn: function (){
  3058. var self=this;
  3059. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3060. return smalltalk.withContext(function($ctx1) {
  3061. var $2,$3,$1;
  3062. $2=_st($Dictionary())._new();
  3063. _st($2)._at_put_((1),(1));
  3064. $ctx1.sendIdx["at:put:"]=1;
  3065. _st($2)._at_put_("a",(2));
  3066. $ctx1.sendIdx["at:put:"]=2;
  3067. _st($2)._at_put_(true,(3));
  3068. $ctx1.sendIdx["at:put:"]=3;
  3069. _st($2)._at_put_((1).__at((3)),(-4));
  3070. $3=_st($2)._yourself();
  3071. $1=$3;
  3072. return $1;
  3073. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  3074. args: [],
  3075. 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: 1@3 put: -4;\x0a\x09\x09yourself",
  3076. messageSends: ["at:put:", "new", "@", "yourself"],
  3077. referencedClasses: ["Dictionary"]
  3078. }),
  3079. smalltalk.DictionaryTest);
  3080. smalltalk.addMethod(
  3081. smalltalk.method({
  3082. selector: "collectionKeys",
  3083. protocol: 'fixture',
  3084. fn: function (){
  3085. var self=this;
  3086. return smalltalk.withContext(function($ctx1) {
  3087. var $1;
  3088. $1=[(1),"a",true,(1).__at((3))];
  3089. return $1;
  3090. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},smalltalk.DictionaryTest)})},
  3091. args: [],
  3092. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3093. messageSends: ["@"],
  3094. referencedClasses: []
  3095. }),
  3096. smalltalk.DictionaryTest);
  3097. smalltalk.addMethod(
  3098. smalltalk.method({
  3099. selector: "collectionOfPrintStrings",
  3100. protocol: 'fixture',
  3101. fn: function (){
  3102. var self=this;
  3103. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3104. return smalltalk.withContext(function($ctx1) {
  3105. var $2,$3,$1;
  3106. $2=_st($Dictionary())._new();
  3107. _st($2)._at_put_((1),"1");
  3108. $ctx1.sendIdx["at:put:"]=1;
  3109. _st($2)._at_put_("a","2");
  3110. $ctx1.sendIdx["at:put:"]=2;
  3111. _st($2)._at_put_(true,"3");
  3112. $ctx1.sendIdx["at:put:"]=3;
  3113. _st($2)._at_put_((1).__at((3)),"-4");
  3114. $3=_st($2)._yourself();
  3115. $1=$3;
  3116. return $1;
  3117. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.DictionaryTest)})},
  3118. args: [],
  3119. source: "collectionOfPrintStrings\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: 1@3 put: '-4';\x0a\x09\x09yourself",
  3120. messageSends: ["at:put:", "new", "@", "yourself"],
  3121. referencedClasses: ["Dictionary"]
  3122. }),
  3123. smalltalk.DictionaryTest);
  3124. smalltalk.addMethod(
  3125. smalltalk.method({
  3126. selector: "collectionSize",
  3127. protocol: 'fixture',
  3128. fn: function (){
  3129. var self=this;
  3130. return smalltalk.withContext(function($ctx1) {
  3131. return (4);
  3132. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.DictionaryTest)})},
  3133. args: [],
  3134. source: "collectionSize\x0a\x09^ 4",
  3135. messageSends: [],
  3136. referencedClasses: []
  3137. }),
  3138. smalltalk.DictionaryTest);
  3139. smalltalk.addMethod(
  3140. smalltalk.method({
  3141. selector: "collectionValues",
  3142. protocol: 'fixture',
  3143. fn: function (){
  3144. var self=this;
  3145. return smalltalk.withContext(function($ctx1) {
  3146. var $1;
  3147. $1=[(1),(2),(3),(-4)];
  3148. return $1;
  3149. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},smalltalk.DictionaryTest)})},
  3150. args: [],
  3151. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3152. messageSends: [],
  3153. referencedClasses: []
  3154. }),
  3155. smalltalk.DictionaryTest);
  3156. smalltalk.addMethod(
  3157. smalltalk.method({
  3158. selector: "collectionWithDuplicates",
  3159. protocol: 'fixture',
  3160. fn: function (){
  3161. var self=this;
  3162. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3163. return smalltalk.withContext(function($ctx1) {
  3164. var $2,$3,$1;
  3165. $2=_st($Dictionary())._new();
  3166. _st($2)._at_put_((1),(1));
  3167. $ctx1.sendIdx["at:put:"]=1;
  3168. _st($2)._at_put_("a",(2));
  3169. $ctx1.sendIdx["at:put:"]=2;
  3170. _st($2)._at_put_(true,(3));
  3171. $ctx1.sendIdx["at:put:"]=3;
  3172. _st($2)._at_put_((4),(-4));
  3173. $ctx1.sendIdx["at:put:"]=4;
  3174. _st($2)._at_put_("b",(1));
  3175. $ctx1.sendIdx["at:put:"]=5;
  3176. _st($2)._at_put_((3),(3));
  3177. $ctx1.sendIdx["at:put:"]=6;
  3178. _st($2)._at_put_(false,(12));
  3179. $3=_st($2)._yourself();
  3180. $1=$3;
  3181. return $1;
  3182. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  3183. args: [],
  3184. 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",
  3185. messageSends: ["at:put:", "new", "yourself"],
  3186. referencedClasses: ["Dictionary"]
  3187. }),
  3188. smalltalk.DictionaryTest);
  3189. smalltalk.addMethod(
  3190. smalltalk.method({
  3191. selector: "collectionWithNewValue",
  3192. protocol: 'fixture',
  3193. fn: function (){
  3194. var self=this;
  3195. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3196. return smalltalk.withContext(function($ctx1) {
  3197. var $2,$3,$1;
  3198. $2=_st($Dictionary())._new();
  3199. _st($2)._at_put_((1),(1));
  3200. $ctx1.sendIdx["at:put:"]=1;
  3201. _st($2)._at_put_("a",(2));
  3202. $ctx1.sendIdx["at:put:"]=2;
  3203. _st($2)._at_put_(true,(3));
  3204. $ctx1.sendIdx["at:put:"]=3;
  3205. _st($2)._at_put_((1).__at((3)),(-4));
  3206. $ctx1.sendIdx["at:put:"]=4;
  3207. _st($2)._at_put_("new","N");
  3208. $3=_st($2)._yourself();
  3209. $1=$3;
  3210. return $1;
  3211. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.DictionaryTest)})},
  3212. args: [],
  3213. source: "collectionWithNewValue\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: 1@3 put: -4;\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3214. messageSends: ["at:put:", "new", "@", "yourself"],
  3215. referencedClasses: ["Dictionary"]
  3216. }),
  3217. smalltalk.DictionaryTest);
  3218. smalltalk.addMethod(
  3219. smalltalk.method({
  3220. selector: "sampleNewValueAsCollection",
  3221. protocol: 'fixture',
  3222. fn: function (){
  3223. var self=this;
  3224. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3225. return smalltalk.withContext(function($ctx1) {
  3226. var $2,$3,$1;
  3227. $2=_st($Dictionary())._new();
  3228. _st($2)._at_put_("new","N");
  3229. $3=_st($2)._yourself();
  3230. $1=$3;
  3231. return $1;
  3232. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.DictionaryTest)})},
  3233. args: [],
  3234. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3235. messageSends: ["at:put:", "new", "yourself"],
  3236. referencedClasses: ["Dictionary"]
  3237. }),
  3238. smalltalk.DictionaryTest);
  3239. smalltalk.addMethod(
  3240. smalltalk.method({
  3241. selector: "samplesDo:",
  3242. protocol: 'fixture',
  3243. fn: function (aBlock){
  3244. var self=this;
  3245. return smalltalk.withContext(function($ctx1) {
  3246. smalltalk.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3247. _st(aBlock)._value_value_(true,(3));
  3248. $ctx1.sendIdx["value:value:"]=1;
  3249. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3250. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.DictionaryTest)})},
  3251. args: ["aBlock"],
  3252. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3253. messageSends: ["samplesDo:", "value:value:", "@"],
  3254. referencedClasses: []
  3255. }),
  3256. smalltalk.DictionaryTest);
  3257. smalltalk.addMethod(
  3258. smalltalk.method({
  3259. selector: "testAccessing",
  3260. protocol: 'tests',
  3261. fn: function (){
  3262. var self=this;
  3263. var d;
  3264. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3265. return smalltalk.withContext(function($ctx1) {
  3266. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3267. d=_st($Dictionary())._new();
  3268. _st(d)._at_put_("hello","world");
  3269. $ctx1.sendIdx["at:put:"]=1;
  3270. $1=_st(d)._at_("hello");
  3271. $ctx1.sendIdx["at:"]=1;
  3272. self._assert_equals_($1,"world");
  3273. $ctx1.sendIdx["assert:equals:"]=1;
  3274. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3275. return smalltalk.withContext(function($ctx2) {
  3276. return nil;
  3277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3278. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3279. self._assert_equals_($2,"world");
  3280. $ctx1.sendIdx["assert:equals:"]=2;
  3281. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3282. return smalltalk.withContext(function($ctx2) {
  3283. return nil;
  3284. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  3285. $ctx1.sendIdx["deny:"]=1;
  3286. $3=_st(d)._includesKey_("hello");
  3287. $ctx1.sendIdx["includesKey:"]=1;
  3288. self._assert_($3);
  3289. $ctx1.sendIdx["assert:"]=1;
  3290. $4=_st(d)._includesKey_("foo");
  3291. $ctx1.sendIdx["includesKey:"]=2;
  3292. self._deny_($4);
  3293. $ctx1.sendIdx["deny:"]=2;
  3294. _st(d)._at_put_((1),(2));
  3295. $ctx1.sendIdx["at:put:"]=2;
  3296. $5=_st(d)._at_((1));
  3297. $ctx1.sendIdx["at:"]=2;
  3298. self._assert_equals_($5,(2));
  3299. $ctx1.sendIdx["assert:equals:"]=3;
  3300. $6=d;
  3301. $7=(1).__at((3));
  3302. $ctx1.sendIdx["@"]=1;
  3303. _st($6)._at_put_($7,(3));
  3304. $9=d;
  3305. $10=(1).__at((3));
  3306. $ctx1.sendIdx["@"]=2;
  3307. $8=_st($9)._at_($10);
  3308. self._assert_equals_($8,(3));
  3309. $12=d;
  3310. $13=(1).__at((3));
  3311. $ctx1.sendIdx["@"]=3;
  3312. $11=_st($12)._includesKey_($13);
  3313. $ctx1.sendIdx["includesKey:"]=3;
  3314. self._assert_($11);
  3315. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3316. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  3317. args: [],
  3318. 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)",
  3319. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3320. referencedClasses: ["Dictionary"]
  3321. }),
  3322. smalltalk.DictionaryTest);
  3323. smalltalk.addMethod(
  3324. smalltalk.method({
  3325. selector: "testDynamicDictionaries",
  3326. protocol: 'tests',
  3327. fn: function (){
  3328. var self=this;
  3329. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3330. return smalltalk.withContext(function($ctx1) {
  3331. var $3,$2,$1;
  3332. $3="hello".__minus_gt((1));
  3333. $ctx1.sendIdx["->"]=1;
  3334. $2=smalltalk.HashedCollection._from_([$3]);
  3335. $1=_st($2)._asDictionary();
  3336. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  3337. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  3338. args: [],
  3339. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3340. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  3341. referencedClasses: ["Dictionary"]
  3342. }),
  3343. smalltalk.DictionaryTest);
  3344. smalltalk.addMethod(
  3345. smalltalk.method({
  3346. selector: "collectionClass",
  3347. protocol: 'fixture',
  3348. fn: function (){
  3349. var self=this;
  3350. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3351. return smalltalk.withContext(function($ctx1) {
  3352. return $Dictionary();
  3353. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  3354. args: [],
  3355. source: "collectionClass\x0a\x09^ Dictionary",
  3356. messageSends: [],
  3357. referencedClasses: ["Dictionary"]
  3358. }),
  3359. smalltalk.DictionaryTest.klass);
  3360. smalltalk.addClass('HashedCollectionTest', smalltalk.AssociativeCollectionTest, [], 'Kernel-Tests');
  3361. smalltalk.addMethod(
  3362. smalltalk.method({
  3363. selector: "collection",
  3364. protocol: 'fixture',
  3365. fn: function (){
  3366. var self=this;
  3367. return smalltalk.withContext(function($ctx1) {
  3368. var $2,$3,$4,$1;
  3369. $2="b".__minus_gt((1));
  3370. $ctx1.sendIdx["->"]=1;
  3371. $3="a".__minus_gt((2));
  3372. $ctx1.sendIdx["->"]=2;
  3373. $4="c".__minus_gt((3));
  3374. $ctx1.sendIdx["->"]=3;
  3375. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  3376. return $1;
  3377. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  3378. args: [],
  3379. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3380. messageSends: ["->"],
  3381. referencedClasses: []
  3382. }),
  3383. smalltalk.HashedCollectionTest);
  3384. smalltalk.addMethod(
  3385. smalltalk.method({
  3386. selector: "collectionKeys",
  3387. protocol: 'fixture',
  3388. fn: function (){
  3389. var self=this;
  3390. return smalltalk.withContext(function($ctx1) {
  3391. var $1;
  3392. $1=["b","a","c","d"];
  3393. return $1;
  3394. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},smalltalk.HashedCollectionTest)})},
  3395. args: [],
  3396. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3397. messageSends: [],
  3398. referencedClasses: []
  3399. }),
  3400. smalltalk.HashedCollectionTest);
  3401. smalltalk.addMethod(
  3402. smalltalk.method({
  3403. selector: "collectionOfPrintStrings",
  3404. protocol: 'fixture',
  3405. fn: function (){
  3406. var self=this;
  3407. return smalltalk.withContext(function($ctx1) {
  3408. var $2,$3,$4,$1;
  3409. $2="b".__minus_gt("1");
  3410. $ctx1.sendIdx["->"]=1;
  3411. $3="a".__minus_gt("2");
  3412. $ctx1.sendIdx["->"]=2;
  3413. $4="c".__minus_gt("3");
  3414. $ctx1.sendIdx["->"]=3;
  3415. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt("-4")]);
  3416. return $1;
  3417. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.HashedCollectionTest)})},
  3418. args: [],
  3419. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3420. messageSends: ["->"],
  3421. referencedClasses: []
  3422. }),
  3423. smalltalk.HashedCollectionTest);
  3424. smalltalk.addMethod(
  3425. smalltalk.method({
  3426. selector: "collectionSize",
  3427. protocol: 'fixture',
  3428. fn: function (){
  3429. var self=this;
  3430. return smalltalk.withContext(function($ctx1) {
  3431. return (4);
  3432. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.HashedCollectionTest)})},
  3433. args: [],
  3434. source: "collectionSize\x0a\x09^ 4",
  3435. messageSends: [],
  3436. referencedClasses: []
  3437. }),
  3438. smalltalk.HashedCollectionTest);
  3439. smalltalk.addMethod(
  3440. smalltalk.method({
  3441. selector: "collectionValues",
  3442. protocol: 'fixture',
  3443. fn: function (){
  3444. var self=this;
  3445. return smalltalk.withContext(function($ctx1) {
  3446. var $1;
  3447. $1=[(1),(2),(3),(-4)];
  3448. return $1;
  3449. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},smalltalk.HashedCollectionTest)})},
  3450. args: [],
  3451. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3452. messageSends: [],
  3453. referencedClasses: []
  3454. }),
  3455. smalltalk.HashedCollectionTest);
  3456. smalltalk.addMethod(
  3457. smalltalk.method({
  3458. selector: "collectionWithDuplicates",
  3459. protocol: 'fixture',
  3460. fn: function (){
  3461. var self=this;
  3462. return smalltalk.withContext(function($ctx1) {
  3463. var $2,$3,$4,$5,$6,$7,$1;
  3464. $2="b".__minus_gt((1));
  3465. $ctx1.sendIdx["->"]=1;
  3466. $3="a".__minus_gt((2));
  3467. $ctx1.sendIdx["->"]=2;
  3468. $4="c".__minus_gt((3));
  3469. $ctx1.sendIdx["->"]=3;
  3470. $5="d".__minus_gt((-4));
  3471. $ctx1.sendIdx["->"]=4;
  3472. $6="e".__minus_gt((1));
  3473. $ctx1.sendIdx["->"]=5;
  3474. $7="f".__minus_gt((2));
  3475. $ctx1.sendIdx["->"]=6;
  3476. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  3477. return $1;
  3478. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  3479. args: [],
  3480. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3481. messageSends: ["->"],
  3482. referencedClasses: []
  3483. }),
  3484. smalltalk.HashedCollectionTest);
  3485. smalltalk.addMethod(
  3486. smalltalk.method({
  3487. selector: "collectionWithNewValue",
  3488. protocol: 'fixture',
  3489. fn: function (){
  3490. var self=this;
  3491. return smalltalk.withContext(function($ctx1) {
  3492. var $2,$3,$4,$5,$1;
  3493. $2="b".__minus_gt((1));
  3494. $ctx1.sendIdx["->"]=1;
  3495. $3="a".__minus_gt((2));
  3496. $ctx1.sendIdx["->"]=2;
  3497. $4="c".__minus_gt((3));
  3498. $ctx1.sendIdx["->"]=3;
  3499. $5="d".__minus_gt((-4));
  3500. $ctx1.sendIdx["->"]=4;
  3501. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  3502. return $1;
  3503. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.HashedCollectionTest)})},
  3504. args: [],
  3505. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3506. messageSends: ["->"],
  3507. referencedClasses: []
  3508. }),
  3509. smalltalk.HashedCollectionTest);
  3510. smalltalk.addMethod(
  3511. smalltalk.method({
  3512. selector: "sampleNewValueAsCollection",
  3513. protocol: 'fixture',
  3514. fn: function (){
  3515. var self=this;
  3516. return smalltalk.withContext(function($ctx1) {
  3517. var $1;
  3518. $1=smalltalk.HashedCollection._from_(["new".__minus_gt("N")]);
  3519. return $1;
  3520. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.HashedCollectionTest)})},
  3521. args: [],
  3522. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3523. messageSends: ["->"],
  3524. referencedClasses: []
  3525. }),
  3526. smalltalk.HashedCollectionTest);
  3527. smalltalk.addMethod(
  3528. smalltalk.method({
  3529. selector: "testDynamicDictionaries",
  3530. protocol: 'tests',
  3531. fn: function (){
  3532. var self=this;
  3533. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3534. return smalltalk.withContext(function($ctx1) {
  3535. var $3,$2,$1;
  3536. $3="hello".__minus_gt((1));
  3537. $ctx1.sendIdx["->"]=1;
  3538. $2=smalltalk.HashedCollection._from_([$3]);
  3539. $1=_st($2)._asHashedCollection();
  3540. self._assert_equals_($1,_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3541. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.HashedCollectionTest)})},
  3542. args: [],
  3543. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3544. messageSends: ["assert:equals:", "asHashedCollection", "->", "with:"],
  3545. referencedClasses: ["HashedCollection"]
  3546. }),
  3547. smalltalk.HashedCollectionTest);
  3548. smalltalk.addMethod(
  3549. smalltalk.method({
  3550. selector: "collectionClass",
  3551. protocol: 'fixture',
  3552. fn: function (){
  3553. var self=this;
  3554. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3555. return smalltalk.withContext(function($ctx1) {
  3556. return $HashedCollection();
  3557. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  3558. args: [],
  3559. source: "collectionClass\x0a\x09^ HashedCollection",
  3560. messageSends: [],
  3561. referencedClasses: ["HashedCollection"]
  3562. }),
  3563. smalltalk.HashedCollectionTest.klass);
  3564. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  3565. smalltalk.addMethod(
  3566. smalltalk.method({
  3567. selector: "collectionFirst",
  3568. protocol: 'fixture',
  3569. fn: function (){
  3570. var self=this;
  3571. return smalltalk.withContext(function($ctx1) {
  3572. self._subclassResponsibility();
  3573. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.SequenceableCollectionTest)})},
  3574. args: [],
  3575. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3576. messageSends: ["subclassResponsibility"],
  3577. referencedClasses: []
  3578. }),
  3579. smalltalk.SequenceableCollectionTest);
  3580. smalltalk.addMethod(
  3581. smalltalk.method({
  3582. selector: "collectionFirstTwo",
  3583. protocol: 'fixture',
  3584. fn: function (){
  3585. var self=this;
  3586. return smalltalk.withContext(function($ctx1) {
  3587. self._subclassResponsibility();
  3588. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.SequenceableCollectionTest)})},
  3589. args: [],
  3590. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3591. messageSends: ["subclassResponsibility"],
  3592. referencedClasses: []
  3593. }),
  3594. smalltalk.SequenceableCollectionTest);
  3595. smalltalk.addMethod(
  3596. smalltalk.method({
  3597. selector: "collectionLast",
  3598. protocol: 'fixture',
  3599. fn: function (){
  3600. var self=this;
  3601. return smalltalk.withContext(function($ctx1) {
  3602. self._subclassResponsibility();
  3603. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.SequenceableCollectionTest)})},
  3604. args: [],
  3605. source: "collectionLast\x0a\x09self subclassResponsibility",
  3606. messageSends: ["subclassResponsibility"],
  3607. referencedClasses: []
  3608. }),
  3609. smalltalk.SequenceableCollectionTest);
  3610. smalltalk.addMethod(
  3611. smalltalk.method({
  3612. selector: "collectionLastTwo",
  3613. protocol: 'fixture',
  3614. fn: function (){
  3615. var self=this;
  3616. return smalltalk.withContext(function($ctx1) {
  3617. self._subclassResponsibility();
  3618. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.SequenceableCollectionTest)})},
  3619. args: [],
  3620. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3621. messageSends: ["subclassResponsibility"],
  3622. referencedClasses: []
  3623. }),
  3624. smalltalk.SequenceableCollectionTest);
  3625. smalltalk.addMethod(
  3626. smalltalk.method({
  3627. selector: "nonIndexesDo:",
  3628. protocol: 'fixture',
  3629. fn: function (aBlock){
  3630. var self=this;
  3631. return smalltalk.withContext(function($ctx1) {
  3632. _st(aBlock)._value_((0));
  3633. $ctx1.sendIdx["value:"]=1;
  3634. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3635. $ctx1.sendIdx["value:"]=2;
  3636. _st(aBlock)._value_("z");
  3637. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3638. args: ["aBlock"],
  3639. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3640. messageSends: ["value:", "+", "collectionSize"],
  3641. referencedClasses: []
  3642. }),
  3643. smalltalk.SequenceableCollectionTest);
  3644. smalltalk.addMethod(
  3645. smalltalk.method({
  3646. selector: "samplesDo:",
  3647. protocol: 'fixture',
  3648. fn: function (aBlock){
  3649. var self=this;
  3650. return smalltalk.withContext(function($ctx1) {
  3651. _st(aBlock)._value_value_((1),self._collectionFirst());
  3652. $ctx1.sendIdx["value:value:"]=1;
  3653. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3654. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3655. args: ["aBlock"],
  3656. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3657. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3658. referencedClasses: []
  3659. }),
  3660. smalltalk.SequenceableCollectionTest);
  3661. smalltalk.addMethod(
  3662. smalltalk.method({
  3663. selector: "testBeginsWith",
  3664. protocol: 'tests',
  3665. fn: function (){
  3666. var self=this;
  3667. return smalltalk.withContext(function($ctx1) {
  3668. var $2,$1,$4,$5,$3,$7,$6;
  3669. $2=self._collection();
  3670. $ctx1.sendIdx["collection"]=1;
  3671. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3672. $ctx1.sendIdx["beginsWith:"]=1;
  3673. self._assert_($1);
  3674. $ctx1.sendIdx["assert:"]=1;
  3675. $4=self._collection();
  3676. $ctx1.sendIdx["collection"]=2;
  3677. $5=self._collection();
  3678. $ctx1.sendIdx["collection"]=3;
  3679. $3=_st($4)._beginsWith_($5);
  3680. $ctx1.sendIdx["beginsWith:"]=2;
  3681. self._assert_($3);
  3682. $ctx1.sendIdx["assert:"]=2;
  3683. $7=self._collection();
  3684. $ctx1.sendIdx["collection"]=4;
  3685. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3686. $ctx1.sendIdx["beginsWith:"]=3;
  3687. self._assert_($6);
  3688. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3689. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  3690. args: [],
  3691. source: "testBeginsWith\x0a\x09self assert: (self collection beginsWith: self collectionClass new).\x0a\x09self assert: (self collection beginsWith: self collection).\x0a\x09self assert: (self collection beginsWith: self collectionFirstTwo).\x0a\x09self deny: (self collection beginsWith: self collectionLastTwo)",
  3692. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3693. referencedClasses: []
  3694. }),
  3695. smalltalk.SequenceableCollectionTest);
  3696. smalltalk.addMethod(
  3697. smalltalk.method({
  3698. selector: "testEndsWith",
  3699. protocol: 'tests',
  3700. fn: function (){
  3701. var self=this;
  3702. return smalltalk.withContext(function($ctx1) {
  3703. var $2,$1,$4,$5,$3,$7,$6;
  3704. $2=self._collection();
  3705. $ctx1.sendIdx["collection"]=1;
  3706. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3707. $ctx1.sendIdx["endsWith:"]=1;
  3708. self._assert_($1);
  3709. $ctx1.sendIdx["assert:"]=1;
  3710. $4=self._collection();
  3711. $ctx1.sendIdx["collection"]=2;
  3712. $5=self._collection();
  3713. $ctx1.sendIdx["collection"]=3;
  3714. $3=_st($4)._endsWith_($5);
  3715. $ctx1.sendIdx["endsWith:"]=2;
  3716. self._assert_($3);
  3717. $ctx1.sendIdx["assert:"]=2;
  3718. $7=self._collection();
  3719. $ctx1.sendIdx["collection"]=4;
  3720. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3721. $ctx1.sendIdx["endsWith:"]=3;
  3722. self._assert_($6);
  3723. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3724. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  3725. args: [],
  3726. source: "testEndsWith\x0a\x09self assert: (self collection endsWith: self collectionClass new).\x0a\x09self assert: (self collection endsWith: self collection).\x0a\x09self assert: (self collection endsWith: self collectionLastTwo).\x0a\x09self deny: (self collection endsWith: self collectionFirstTwo)",
  3727. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3728. referencedClasses: []
  3729. }),
  3730. smalltalk.SequenceableCollectionTest);
  3731. smalltalk.addMethod(
  3732. smalltalk.method({
  3733. selector: "testFirst",
  3734. protocol: 'tests',
  3735. fn: function (){
  3736. var self=this;
  3737. return smalltalk.withContext(function($ctx1) {
  3738. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3739. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  3740. args: [],
  3741. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3742. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3743. referencedClasses: []
  3744. }),
  3745. smalltalk.SequenceableCollectionTest);
  3746. smalltalk.addMethod(
  3747. smalltalk.method({
  3748. selector: "testFirstN",
  3749. protocol: 'tests',
  3750. fn: function (){
  3751. var self=this;
  3752. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3753. return smalltalk.withContext(function($ctx1) {
  3754. var $2,$1,$4,$3,$6,$5,$7;
  3755. $2=self._collection();
  3756. $ctx1.sendIdx["collection"]=1;
  3757. $1=_st($2)._first_((2));
  3758. $ctx1.sendIdx["first:"]=1;
  3759. self._assert_equals_($1,self._collectionFirstTwo());
  3760. $ctx1.sendIdx["assert:equals:"]=1;
  3761. $4=self._collection();
  3762. $ctx1.sendIdx["collection"]=2;
  3763. $3=_st($4)._first_((0));
  3764. $ctx1.sendIdx["first:"]=2;
  3765. self._assert_equals_($3,_st(self._collectionClass())._new());
  3766. $ctx1.sendIdx["assert:equals:"]=2;
  3767. $6=self._collection();
  3768. $ctx1.sendIdx["collection"]=3;
  3769. $5=_st($6)._first_(self._collectionSize());
  3770. $ctx1.sendIdx["first:"]=3;
  3771. $7=self._collection();
  3772. $ctx1.sendIdx["collection"]=4;
  3773. self._assert_equals_($5,$7);
  3774. self._should_raise_((function(){
  3775. return smalltalk.withContext(function($ctx2) {
  3776. return _st(self._collection())._first_((33));
  3777. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3778. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  3779. args: [],
  3780. source: "testFirstN\x0a\x09self \x0a\x09\x09assert: (self collection first: 2)\x0a\x09\x09equals: self collectionFirstTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  3781. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3782. referencedClasses: ["Error"]
  3783. }),
  3784. smalltalk.SequenceableCollectionTest);
  3785. smalltalk.addMethod(
  3786. smalltalk.method({
  3787. selector: "testFourth",
  3788. protocol: 'tests',
  3789. fn: function (){
  3790. var self=this;
  3791. return smalltalk.withContext(function($ctx1) {
  3792. var $2,$1;
  3793. $2=self._collection();
  3794. $ctx1.sendIdx["collection"]=1;
  3795. $1=_st($2)._fourth();
  3796. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3797. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  3798. args: [],
  3799. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3800. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3801. referencedClasses: []
  3802. }),
  3803. smalltalk.SequenceableCollectionTest);
  3804. smalltalk.addMethod(
  3805. smalltalk.method({
  3806. selector: "testIndexOfStartingAt",
  3807. protocol: 'tests',
  3808. fn: function (){
  3809. var self=this;
  3810. var jsNull;
  3811. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3812. return smalltalk.withContext(function($ctx1) {
  3813. var $2,$1,$4,$3;
  3814. jsNull=_st($JSON())._parse_("null");
  3815. self._samplesDo_((function(index,value){
  3816. return smalltalk.withContext(function($ctx2) {
  3817. $2=self._collection();
  3818. $ctx2.sendIdx["collection"]=1;
  3819. $1=_st($2)._indexOf_startingAt_(value,(1));
  3820. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3821. self._assert_equals_($1,index);
  3822. $ctx2.sendIdx["assert:equals:"]=1;
  3823. $4=self._collection();
  3824. $ctx2.sendIdx["collection"]=2;
  3825. $3=_st($4)._indexOf_startingAt_(value,index);
  3826. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3827. self._assert_equals_($3,index);
  3828. $ctx2.sendIdx["assert:equals:"]=2;
  3829. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3830. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3831. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},smalltalk.SequenceableCollectionTest)})},
  3832. args: [],
  3833. source: "testIndexOfStartingAt\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value startingAt: 1) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index+1) equals: 0 ]",
  3834. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3835. referencedClasses: ["JSON"]
  3836. }),
  3837. smalltalk.SequenceableCollectionTest);
  3838. smalltalk.addMethod(
  3839. smalltalk.method({
  3840. selector: "testIndexOfStartingAtWithNull",
  3841. protocol: 'tests',
  3842. fn: function (){
  3843. var self=this;
  3844. var jsNull;
  3845. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3846. return smalltalk.withContext(function($ctx1) {
  3847. var $1,$2;
  3848. jsNull=_st($JSON())._parse_("null");
  3849. self._samplesDo_((function(index,value){
  3850. var collection;
  3851. return smalltalk.withContext(function($ctx2) {
  3852. collection=self._collection();
  3853. collection;
  3854. _st(collection)._at_put_(index,jsNull);
  3855. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3856. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3857. self._assert_equals_($1,index);
  3858. $ctx2.sendIdx["assert:equals:"]=1;
  3859. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3860. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3861. self._assert_equals_($2,index);
  3862. $ctx2.sendIdx["assert:equals:"]=2;
  3863. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3864. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3865. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},smalltalk.SequenceableCollectionTest)})},
  3866. args: [],
  3867. source: "testIndexOfStartingAtWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value | | collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09collection at: index put: jsNull.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: 1) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index+1) equals: 0 ]",
  3868. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3869. referencedClasses: ["JSON"]
  3870. }),
  3871. smalltalk.SequenceableCollectionTest);
  3872. smalltalk.addMethod(
  3873. smalltalk.method({
  3874. selector: "testLast",
  3875. protocol: 'tests',
  3876. fn: function (){
  3877. var self=this;
  3878. return smalltalk.withContext(function($ctx1) {
  3879. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3880. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  3881. args: [],
  3882. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3883. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3884. referencedClasses: []
  3885. }),
  3886. smalltalk.SequenceableCollectionTest);
  3887. smalltalk.addMethod(
  3888. smalltalk.method({
  3889. selector: "testLastN",
  3890. protocol: 'tests',
  3891. fn: function (){
  3892. var self=this;
  3893. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3894. return smalltalk.withContext(function($ctx1) {
  3895. var $2,$1,$4,$3,$6,$5,$7;
  3896. $2=self._collection();
  3897. $ctx1.sendIdx["collection"]=1;
  3898. $1=_st($2)._last_((2));
  3899. $ctx1.sendIdx["last:"]=1;
  3900. self._assert_equals_($1,self._collectionLastTwo());
  3901. $ctx1.sendIdx["assert:equals:"]=1;
  3902. $4=self._collection();
  3903. $ctx1.sendIdx["collection"]=2;
  3904. $3=_st($4)._last_((0));
  3905. $ctx1.sendIdx["last:"]=2;
  3906. self._assert_equals_($3,_st(self._collectionClass())._new());
  3907. $ctx1.sendIdx["assert:equals:"]=2;
  3908. $6=self._collection();
  3909. $ctx1.sendIdx["collection"]=3;
  3910. $5=_st($6)._last_(self._collectionSize());
  3911. $ctx1.sendIdx["last:"]=3;
  3912. $7=self._collection();
  3913. $ctx1.sendIdx["collection"]=4;
  3914. self._assert_equals_($5,$7);
  3915. self._should_raise_((function(){
  3916. return smalltalk.withContext(function($ctx2) {
  3917. return _st(self._collection())._last_((33));
  3918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3919. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  3920. args: [],
  3921. source: "testLastN\x0a\x09self \x0a\x09\x09assert: (self collection last: 2) \x0a\x09\x09equals: self collectionLastTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection last: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x0a\x09self\x0a\x09\x09assert: (self collection last: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  3922. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3923. referencedClasses: ["Error"]
  3924. }),
  3925. smalltalk.SequenceableCollectionTest);
  3926. smalltalk.addMethod(
  3927. smalltalk.method({
  3928. selector: "testSecond",
  3929. protocol: 'tests',
  3930. fn: function (){
  3931. var self=this;
  3932. return smalltalk.withContext(function($ctx1) {
  3933. var $2,$1;
  3934. $2=self._collection();
  3935. $ctx1.sendIdx["collection"]=1;
  3936. $1=_st($2)._second();
  3937. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3938. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  3939. args: [],
  3940. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3941. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3942. referencedClasses: []
  3943. }),
  3944. smalltalk.SequenceableCollectionTest);
  3945. smalltalk.addMethod(
  3946. smalltalk.method({
  3947. selector: "testThird",
  3948. protocol: 'tests',
  3949. fn: function (){
  3950. var self=this;
  3951. return smalltalk.withContext(function($ctx1) {
  3952. var $2,$1;
  3953. $2=self._collection();
  3954. $ctx1.sendIdx["collection"]=1;
  3955. $1=_st($2)._third();
  3956. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3957. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  3958. args: [],
  3959. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3960. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3961. referencedClasses: []
  3962. }),
  3963. smalltalk.SequenceableCollectionTest);
  3964. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3965. smalltalk.addMethod(
  3966. smalltalk.method({
  3967. selector: "collection",
  3968. protocol: 'fixture',
  3969. fn: function (){
  3970. var self=this;
  3971. return smalltalk.withContext(function($ctx1) {
  3972. var $1;
  3973. $1=[(1), (2), (3), (-4)];
  3974. return $1;
  3975. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  3976. args: [],
  3977. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3978. messageSends: [],
  3979. referencedClasses: []
  3980. }),
  3981. smalltalk.ArrayTest);
  3982. smalltalk.addMethod(
  3983. smalltalk.method({
  3984. selector: "collectionFirst",
  3985. protocol: 'fixture',
  3986. fn: function (){
  3987. var self=this;
  3988. return smalltalk.withContext(function($ctx1) {
  3989. return (1);
  3990. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.ArrayTest)})},
  3991. args: [],
  3992. source: "collectionFirst\x0a\x09^ 1",
  3993. messageSends: [],
  3994. referencedClasses: []
  3995. }),
  3996. smalltalk.ArrayTest);
  3997. smalltalk.addMethod(
  3998. smalltalk.method({
  3999. selector: "collectionFirstTwo",
  4000. protocol: 'fixture',
  4001. fn: function (){
  4002. var self=this;
  4003. return smalltalk.withContext(function($ctx1) {
  4004. var $1;
  4005. $1=[(1), (2)];
  4006. return $1;
  4007. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.ArrayTest)})},
  4008. args: [],
  4009. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  4010. messageSends: [],
  4011. referencedClasses: []
  4012. }),
  4013. smalltalk.ArrayTest);
  4014. smalltalk.addMethod(
  4015. smalltalk.method({
  4016. selector: "collectionLast",
  4017. protocol: 'fixture',
  4018. fn: function (){
  4019. var self=this;
  4020. return smalltalk.withContext(function($ctx1) {
  4021. return (-4);
  4022. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.ArrayTest)})},
  4023. args: [],
  4024. source: "collectionLast\x0a\x09^ -4",
  4025. messageSends: [],
  4026. referencedClasses: []
  4027. }),
  4028. smalltalk.ArrayTest);
  4029. smalltalk.addMethod(
  4030. smalltalk.method({
  4031. selector: "collectionLastTwo",
  4032. protocol: 'fixture',
  4033. fn: function (){
  4034. var self=this;
  4035. return smalltalk.withContext(function($ctx1) {
  4036. var $1;
  4037. $1=[(3), (-4)];
  4038. return $1;
  4039. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.ArrayTest)})},
  4040. args: [],
  4041. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  4042. messageSends: [],
  4043. referencedClasses: []
  4044. }),
  4045. smalltalk.ArrayTest);
  4046. smalltalk.addMethod(
  4047. smalltalk.method({
  4048. selector: "collectionOfPrintStrings",
  4049. protocol: 'fixture',
  4050. fn: function (){
  4051. var self=this;
  4052. return smalltalk.withContext(function($ctx1) {
  4053. var $1;
  4054. $1=["1", "2", "3", "-4"];
  4055. return $1;
  4056. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.ArrayTest)})},
  4057. args: [],
  4058. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  4059. messageSends: [],
  4060. referencedClasses: []
  4061. }),
  4062. smalltalk.ArrayTest);
  4063. smalltalk.addMethod(
  4064. smalltalk.method({
  4065. selector: "collectionSize",
  4066. protocol: 'fixture',
  4067. fn: function (){
  4068. var self=this;
  4069. return smalltalk.withContext(function($ctx1) {
  4070. return (4);
  4071. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.ArrayTest)})},
  4072. args: [],
  4073. source: "collectionSize\x0a\x09^ 4",
  4074. messageSends: [],
  4075. referencedClasses: []
  4076. }),
  4077. smalltalk.ArrayTest);
  4078. smalltalk.addMethod(
  4079. smalltalk.method({
  4080. selector: "collectionWithDuplicates",
  4081. protocol: 'fixture',
  4082. fn: function (){
  4083. var self=this;
  4084. return smalltalk.withContext(function($ctx1) {
  4085. var $1;
  4086. $1=["a", "b", "c", (1), (2), (1), "a"];
  4087. return $1;
  4088. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  4089. args: [],
  4090. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4091. messageSends: [],
  4092. referencedClasses: []
  4093. }),
  4094. smalltalk.ArrayTest);
  4095. smalltalk.addMethod(
  4096. smalltalk.method({
  4097. selector: "collectionWithNewValue",
  4098. protocol: 'fixture',
  4099. fn: function (){
  4100. var self=this;
  4101. return smalltalk.withContext(function($ctx1) {
  4102. var $1;
  4103. $1=[(1), (2), (3), (-4), "N"];
  4104. return $1;
  4105. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.ArrayTest)})},
  4106. args: [],
  4107. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4108. messageSends: [],
  4109. referencedClasses: []
  4110. }),
  4111. smalltalk.ArrayTest);
  4112. smalltalk.addMethod(
  4113. smalltalk.method({
  4114. selector: "sampleNewIndex",
  4115. protocol: 'fixture',
  4116. fn: function (){
  4117. var self=this;
  4118. return smalltalk.withContext(function($ctx1) {
  4119. return (5);
  4120. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.ArrayTest)})},
  4121. args: [],
  4122. source: "sampleNewIndex\x0a\x09^ 5",
  4123. messageSends: [],
  4124. referencedClasses: []
  4125. }),
  4126. smalltalk.ArrayTest);
  4127. smalltalk.addMethod(
  4128. smalltalk.method({
  4129. selector: "samplesDo:",
  4130. protocol: 'fixture',
  4131. fn: function (aBlock){
  4132. var self=this;
  4133. return smalltalk.withContext(function($ctx1) {
  4134. smalltalk.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4135. _st(aBlock)._value_value_((3),(3));
  4136. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.ArrayTest)})},
  4137. args: ["aBlock"],
  4138. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4139. messageSends: ["samplesDo:", "value:value:"],
  4140. referencedClasses: []
  4141. }),
  4142. smalltalk.ArrayTest);
  4143. smalltalk.addMethod(
  4144. smalltalk.method({
  4145. selector: "testAdd",
  4146. protocol: 'tests',
  4147. fn: function (){
  4148. var self=this;
  4149. var array;
  4150. return smalltalk.withContext(function($ctx1) {
  4151. array=self._collection();
  4152. _st(array)._add_((6));
  4153. self._assert_equals_(_st(array)._last(),(6));
  4154. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  4155. args: [],
  4156. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4157. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4158. referencedClasses: []
  4159. }),
  4160. smalltalk.ArrayTest);
  4161. smalltalk.addMethod(
  4162. smalltalk.method({
  4163. selector: "testAddFirst",
  4164. protocol: 'tests',
  4165. fn: function (){
  4166. var self=this;
  4167. return smalltalk.withContext(function($ctx1) {
  4168. var $1,$2;
  4169. $1=self._collection();
  4170. _st($1)._addFirst_((0));
  4171. $2=_st($1)._yourself();
  4172. self._assert_equals_(_st($2)._first(),(0));
  4173. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  4174. args: [],
  4175. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4176. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4177. referencedClasses: []
  4178. }),
  4179. smalltalk.ArrayTest);
  4180. smalltalk.addMethod(
  4181. smalltalk.method({
  4182. selector: "testPrintString",
  4183. protocol: 'tests',
  4184. fn: function (){
  4185. var self=this;
  4186. var array;
  4187. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4188. return smalltalk.withContext(function($ctx1) {
  4189. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4190. array=_st($Array())._new();
  4191. $1=_st(array)._printString();
  4192. $ctx1.sendIdx["printString"]=1;
  4193. self._assert_equals_($1,"an Array ()");
  4194. $ctx1.sendIdx["assert:equals:"]=1;
  4195. $2=array;
  4196. _st($2)._add_((1));
  4197. $ctx1.sendIdx["add:"]=1;
  4198. $3=_st($2)._add_((3));
  4199. $ctx1.sendIdx["add:"]=2;
  4200. $4=_st(array)._printString();
  4201. $ctx1.sendIdx["printString"]=2;
  4202. self._assert_equals_($4,"an Array (1 3)");
  4203. $ctx1.sendIdx["assert:equals:"]=2;
  4204. _st(array)._add_("foo");
  4205. $5=_st(array)._printString();
  4206. $ctx1.sendIdx["printString"]=3;
  4207. self._assert_equals_($5,"an Array (1 3 'foo')");
  4208. $ctx1.sendIdx["assert:equals:"]=3;
  4209. $6=array;
  4210. _st($6)._remove_((1));
  4211. $ctx1.sendIdx["remove:"]=1;
  4212. $7=_st($6)._remove_((3));
  4213. $8=_st(array)._printString();
  4214. $ctx1.sendIdx["printString"]=4;
  4215. self._assert_equals_($8,"an Array ('foo')");
  4216. $ctx1.sendIdx["assert:equals:"]=4;
  4217. _st(array)._addLast_((3));
  4218. $ctx1.sendIdx["addLast:"]=1;
  4219. $9=_st(array)._printString();
  4220. $ctx1.sendIdx["printString"]=5;
  4221. self._assert_equals_($9,"an Array ('foo' 3)");
  4222. $ctx1.sendIdx["assert:equals:"]=5;
  4223. _st(array)._addLast_((3));
  4224. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4225. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  4226. args: [],
  4227. 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)'.",
  4228. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4229. referencedClasses: ["Array"]
  4230. }),
  4231. smalltalk.ArrayTest);
  4232. smalltalk.addMethod(
  4233. smalltalk.method({
  4234. selector: "testRemove",
  4235. protocol: 'tests',
  4236. fn: function (){
  4237. var self=this;
  4238. var array;
  4239. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4240. return smalltalk.withContext(function($ctx1) {
  4241. array=[(1), (2), (3), (4), (5)];
  4242. _st(array)._remove_((3));
  4243. $ctx1.sendIdx["remove:"]=1;
  4244. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4245. self._should_raise_((function(){
  4246. return smalltalk.withContext(function($ctx2) {
  4247. return _st(array)._remove_((3));
  4248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4249. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  4250. args: [],
  4251. source: "testRemove \x0a\x09| array |\x0a\x09array := #(1 2 3 4 5). \x0a\x09array remove: 3.\x0a\x0a\x09self assert: array equals: #(1 2 4 5).\x0a\x09self should: [ array remove: 3 ] raise: Error",
  4252. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4253. referencedClasses: ["Error"]
  4254. }),
  4255. smalltalk.ArrayTest);
  4256. smalltalk.addMethod(
  4257. smalltalk.method({
  4258. selector: "testRemoveFromTo",
  4259. protocol: 'tests',
  4260. fn: function (){
  4261. var self=this;
  4262. return smalltalk.withContext(function($ctx1) {
  4263. var $1,$2;
  4264. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4265. $ctx1.sendIdx["removeFrom:to:"]=1;
  4266. self._assert_equals_($1,[(4)]);
  4267. $ctx1.sendIdx["assert:equals:"]=1;
  4268. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4269. $ctx1.sendIdx["removeFrom:to:"]=2;
  4270. self._assert_equals_($2,[(1), (4)]);
  4271. $ctx1.sendIdx["assert:equals:"]=2;
  4272. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4273. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  4274. args: [],
  4275. 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)",
  4276. messageSends: ["assert:equals:", "removeFrom:to:"],
  4277. referencedClasses: []
  4278. }),
  4279. smalltalk.ArrayTest);
  4280. smalltalk.addMethod(
  4281. smalltalk.method({
  4282. selector: "testRemoveIndex",
  4283. protocol: 'tests',
  4284. fn: function (){
  4285. var self=this;
  4286. return smalltalk.withContext(function($ctx1) {
  4287. var $1,$2;
  4288. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4289. $ctx1.sendIdx["removeIndex:"]=1;
  4290. self._assert_equals_($1,[(1), (3), (4)]);
  4291. $ctx1.sendIdx["assert:equals:"]=1;
  4292. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4293. $ctx1.sendIdx["removeIndex:"]=2;
  4294. self._assert_equals_($2,[(2), (3), (4)]);
  4295. $ctx1.sendIdx["assert:equals:"]=2;
  4296. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4297. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  4298. args: [],
  4299. 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: #()",
  4300. messageSends: ["assert:equals:", "removeIndex:"],
  4301. referencedClasses: []
  4302. }),
  4303. smalltalk.ArrayTest);
  4304. smalltalk.addMethod(
  4305. smalltalk.method({
  4306. selector: "testRemoveLast",
  4307. protocol: 'tests',
  4308. fn: function (){
  4309. var self=this;
  4310. var array;
  4311. return smalltalk.withContext(function($ctx1) {
  4312. array=[(1), (2)];
  4313. _st(array)._removeLast();
  4314. self._assert_equals_(_st(array)._last(),(1));
  4315. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  4316. args: [],
  4317. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4318. messageSends: ["removeLast", "assert:equals:", "last"],
  4319. referencedClasses: []
  4320. }),
  4321. smalltalk.ArrayTest);
  4322. smalltalk.addMethod(
  4323. smalltalk.method({
  4324. selector: "testReversed",
  4325. protocol: 'tests',
  4326. fn: function (){
  4327. var self=this;
  4328. var array;
  4329. return smalltalk.withContext(function($ctx1) {
  4330. array=[(5), (4), (3), (2), (1)];
  4331. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4332. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  4333. args: [],
  4334. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4335. messageSends: ["assert:equals:", "reversed"],
  4336. referencedClasses: []
  4337. }),
  4338. smalltalk.ArrayTest);
  4339. smalltalk.addMethod(
  4340. smalltalk.method({
  4341. selector: "testSort",
  4342. protocol: 'tests',
  4343. fn: function (){
  4344. var self=this;
  4345. var array;
  4346. return smalltalk.withContext(function($ctx1) {
  4347. array=[(3), (1), (4), (5), (2)];
  4348. _st(array)._sort();
  4349. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  4350. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  4351. args: [],
  4352. source: "testSort\x0a\x09| array |\x0a\x09array := #(3 1 4 5 2). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 2 3 4 5)",
  4353. messageSends: ["sort", "assert:equals:"],
  4354. referencedClasses: []
  4355. }),
  4356. smalltalk.ArrayTest);
  4357. smalltalk.addMethod(
  4358. smalltalk.method({
  4359. selector: "collectionClass",
  4360. protocol: 'fixture',
  4361. fn: function (){
  4362. var self=this;
  4363. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4364. return smalltalk.withContext(function($ctx1) {
  4365. return $Array();
  4366. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  4367. args: [],
  4368. source: "collectionClass\x0a\x09^ Array",
  4369. messageSends: [],
  4370. referencedClasses: ["Array"]
  4371. }),
  4372. smalltalk.ArrayTest.klass);
  4373. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  4374. smalltalk.addMethod(
  4375. smalltalk.method({
  4376. selector: "collection",
  4377. protocol: 'fixture',
  4378. fn: function (){
  4379. var self=this;
  4380. return smalltalk.withContext(function($ctx1) {
  4381. return "helLo";
  4382. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  4383. args: [],
  4384. source: "collection\x0a\x09^ 'helLo'",
  4385. messageSends: [],
  4386. referencedClasses: []
  4387. }),
  4388. smalltalk.StringTest);
  4389. smalltalk.addMethod(
  4390. smalltalk.method({
  4391. selector: "collectionFirst",
  4392. protocol: 'fixture',
  4393. fn: function (){
  4394. var self=this;
  4395. return smalltalk.withContext(function($ctx1) {
  4396. return "h";
  4397. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.StringTest)})},
  4398. args: [],
  4399. source: "collectionFirst\x0a\x09^ 'h'",
  4400. messageSends: [],
  4401. referencedClasses: []
  4402. }),
  4403. smalltalk.StringTest);
  4404. smalltalk.addMethod(
  4405. smalltalk.method({
  4406. selector: "collectionFirstTwo",
  4407. protocol: 'fixture',
  4408. fn: function (){
  4409. var self=this;
  4410. return smalltalk.withContext(function($ctx1) {
  4411. return "he";
  4412. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.StringTest)})},
  4413. args: [],
  4414. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4415. messageSends: [],
  4416. referencedClasses: []
  4417. }),
  4418. smalltalk.StringTest);
  4419. smalltalk.addMethod(
  4420. smalltalk.method({
  4421. selector: "collectionLast",
  4422. protocol: 'fixture',
  4423. fn: function (){
  4424. var self=this;
  4425. return smalltalk.withContext(function($ctx1) {
  4426. return "o";
  4427. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.StringTest)})},
  4428. args: [],
  4429. source: "collectionLast\x0a\x09^ 'o'",
  4430. messageSends: [],
  4431. referencedClasses: []
  4432. }),
  4433. smalltalk.StringTest);
  4434. smalltalk.addMethod(
  4435. smalltalk.method({
  4436. selector: "collectionLastTwo",
  4437. protocol: 'fixture',
  4438. fn: function (){
  4439. var self=this;
  4440. return smalltalk.withContext(function($ctx1) {
  4441. return "Lo";
  4442. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.StringTest)})},
  4443. args: [],
  4444. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4445. messageSends: [],
  4446. referencedClasses: []
  4447. }),
  4448. smalltalk.StringTest);
  4449. smalltalk.addMethod(
  4450. smalltalk.method({
  4451. selector: "collectionOfPrintStrings",
  4452. protocol: 'fixture',
  4453. fn: function (){
  4454. var self=this;
  4455. return smalltalk.withContext(function($ctx1) {
  4456. return "'h''e''l''L''o'";
  4457. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.StringTest)})},
  4458. args: [],
  4459. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4460. messageSends: [],
  4461. referencedClasses: []
  4462. }),
  4463. smalltalk.StringTest);
  4464. smalltalk.addMethod(
  4465. smalltalk.method({
  4466. selector: "collectionSize",
  4467. protocol: 'fixture',
  4468. fn: function (){
  4469. var self=this;
  4470. return smalltalk.withContext(function($ctx1) {
  4471. return (5);
  4472. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.StringTest)})},
  4473. args: [],
  4474. source: "collectionSize\x0a\x09^ 5",
  4475. messageSends: [],
  4476. referencedClasses: []
  4477. }),
  4478. smalltalk.StringTest);
  4479. smalltalk.addMethod(
  4480. smalltalk.method({
  4481. selector: "collectionWithDuplicates",
  4482. protocol: 'fixture',
  4483. fn: function (){
  4484. var self=this;
  4485. return smalltalk.withContext(function($ctx1) {
  4486. return "abbaerte";
  4487. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  4488. args: [],
  4489. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4490. messageSends: [],
  4491. referencedClasses: []
  4492. }),
  4493. smalltalk.StringTest);
  4494. smalltalk.addMethod(
  4495. smalltalk.method({
  4496. selector: "collectionWithNewValue",
  4497. protocol: 'fixture',
  4498. fn: function (){
  4499. var self=this;
  4500. return smalltalk.withContext(function($ctx1) {
  4501. return "helLoN";
  4502. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.StringTest)})},
  4503. args: [],
  4504. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4505. messageSends: [],
  4506. referencedClasses: []
  4507. }),
  4508. smalltalk.StringTest);
  4509. smalltalk.addMethod(
  4510. smalltalk.method({
  4511. selector: "sampleNewValueAsCollection",
  4512. protocol: 'fixture',
  4513. fn: function (){
  4514. var self=this;
  4515. return smalltalk.withContext(function($ctx1) {
  4516. return "N";
  4517. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.StringTest)})},
  4518. args: [],
  4519. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4520. messageSends: [],
  4521. referencedClasses: []
  4522. }),
  4523. smalltalk.StringTest);
  4524. smalltalk.addMethod(
  4525. smalltalk.method({
  4526. selector: "samplesDo:",
  4527. protocol: 'fixture',
  4528. fn: function (aBlock){
  4529. var self=this;
  4530. return smalltalk.withContext(function($ctx1) {
  4531. smalltalk.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4532. _st(aBlock)._value_value_((3),"l");
  4533. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.StringTest)})},
  4534. args: ["aBlock"],
  4535. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4536. messageSends: ["samplesDo:", "value:value:"],
  4537. referencedClasses: []
  4538. }),
  4539. smalltalk.StringTest);
  4540. smalltalk.addMethod(
  4541. smalltalk.method({
  4542. selector: "testAddAll",
  4543. protocol: 'tests',
  4544. fn: function (){
  4545. var self=this;
  4546. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4547. return smalltalk.withContext(function($ctx1) {
  4548. var $1;
  4549. self._should_raise_((function(){
  4550. return smalltalk.withContext(function($ctx2) {
  4551. $1=self._collection();
  4552. $ctx2.sendIdx["collection"]=1;
  4553. return _st($1)._addAll_(self._collection());
  4554. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4555. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.StringTest)})},
  4556. args: [],
  4557. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4558. messageSends: ["should:raise:", "addAll:", "collection"],
  4559. referencedClasses: ["Error"]
  4560. }),
  4561. smalltalk.StringTest);
  4562. smalltalk.addMethod(
  4563. smalltalk.method({
  4564. selector: "testAddRemove",
  4565. protocol: 'tests',
  4566. fn: function (){
  4567. var self=this;
  4568. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4569. return smalltalk.withContext(function($ctx1) {
  4570. self._should_raise_((function(){
  4571. return smalltalk.withContext(function($ctx2) {
  4572. return "hello"._add_("a");
  4573. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4574. $ctx1.sendIdx["should:raise:"]=1;
  4575. self._should_raise_((function(){
  4576. return smalltalk.withContext(function($ctx2) {
  4577. return "hello"._remove_("h");
  4578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4579. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  4580. args: [],
  4581. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4582. messageSends: ["should:raise:", "add:", "remove:"],
  4583. referencedClasses: ["Error"]
  4584. }),
  4585. smalltalk.StringTest);
  4586. smalltalk.addMethod(
  4587. smalltalk.method({
  4588. selector: "testAsArray",
  4589. protocol: 'tests',
  4590. fn: function (){
  4591. var self=this;
  4592. return smalltalk.withContext(function($ctx1) {
  4593. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4594. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  4595. args: [],
  4596. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4597. messageSends: ["assert:equals:", "asArray"],
  4598. referencedClasses: []
  4599. }),
  4600. smalltalk.StringTest);
  4601. smalltalk.addMethod(
  4602. smalltalk.method({
  4603. selector: "testAsLowerCase",
  4604. protocol: 'tests',
  4605. fn: function (){
  4606. var self=this;
  4607. return smalltalk.withContext(function($ctx1) {
  4608. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4609. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  4610. args: [],
  4611. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4612. messageSends: ["assert:equals:", "asLowercase"],
  4613. referencedClasses: []
  4614. }),
  4615. smalltalk.StringTest);
  4616. smalltalk.addMethod(
  4617. smalltalk.method({
  4618. selector: "testAsNumber",
  4619. protocol: 'tests',
  4620. fn: function (){
  4621. var self=this;
  4622. return smalltalk.withContext(function($ctx1) {
  4623. var $1,$2;
  4624. $1="3"._asNumber();
  4625. $ctx1.sendIdx["asNumber"]=1;
  4626. self._assert_equals_($1,(3));
  4627. $ctx1.sendIdx["assert:equals:"]=1;
  4628. $2="-3"._asNumber();
  4629. $ctx1.sendIdx["asNumber"]=2;
  4630. self._assert_equals_($2,(-3));
  4631. $ctx1.sendIdx["assert:equals:"]=2;
  4632. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4633. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  4634. args: [],
  4635. 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.",
  4636. messageSends: ["assert:equals:", "asNumber"],
  4637. referencedClasses: []
  4638. }),
  4639. smalltalk.StringTest);
  4640. smalltalk.addMethod(
  4641. smalltalk.method({
  4642. selector: "testAsUpperCase",
  4643. protocol: 'tests',
  4644. fn: function (){
  4645. var self=this;
  4646. return smalltalk.withContext(function($ctx1) {
  4647. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4648. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  4649. args: [],
  4650. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4651. messageSends: ["assert:equals:", "asUppercase"],
  4652. referencedClasses: []
  4653. }),
  4654. smalltalk.StringTest);
  4655. smalltalk.addMethod(
  4656. smalltalk.method({
  4657. selector: "testAsciiValue",
  4658. protocol: 'tests',
  4659. fn: function (){
  4660. var self=this;
  4661. var characterA,characterU;
  4662. return smalltalk.withContext(function($ctx1) {
  4663. var $1;
  4664. characterA="A";
  4665. characterU="U";
  4666. $1=_st(characterA)._asciiValue();
  4667. $ctx1.sendIdx["asciiValue"]=1;
  4668. self._assert_equals_($1,(65));
  4669. $ctx1.sendIdx["assert:equals:"]=1;
  4670. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4671. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  4672. args: [],
  4673. source: "testAsciiValue\x0a | characterA characterU |\x0a characterA := 'A'.\x0a characterU := 'U'.\x0a self assert: (characterA asciiValue) equals:65.\x0a self assert: (characterU asciiValue) equals:85",
  4674. messageSends: ["assert:equals:", "asciiValue"],
  4675. referencedClasses: []
  4676. }),
  4677. smalltalk.StringTest);
  4678. smalltalk.addMethod(
  4679. smalltalk.method({
  4680. selector: "testAtIfAbsentPut",
  4681. protocol: 'tests',
  4682. fn: function (){
  4683. var self=this;
  4684. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4685. return smalltalk.withContext(function($ctx1) {
  4686. self._should_raise_((function(){
  4687. return smalltalk.withContext(function($ctx2) {
  4688. return "hello"._at_ifAbsentPut_((6),(function(){
  4689. return smalltalk.withContext(function($ctx3) {
  4690. return "a";
  4691. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  4692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4693. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},smalltalk.StringTest)})},
  4694. args: [],
  4695. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4696. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4697. referencedClasses: ["Error"]
  4698. }),
  4699. smalltalk.StringTest);
  4700. smalltalk.addMethod(
  4701. smalltalk.method({
  4702. selector: "testAtPut",
  4703. protocol: 'tests',
  4704. fn: function (){
  4705. var self=this;
  4706. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4707. return smalltalk.withContext(function($ctx1) {
  4708. self._should_raise_((function(){
  4709. return smalltalk.withContext(function($ctx2) {
  4710. return "hello"._at_put_((1),"a");
  4711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4712. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  4713. args: [],
  4714. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4715. messageSends: ["should:raise:", "at:put:"],
  4716. referencedClasses: ["Error"]
  4717. }),
  4718. smalltalk.StringTest);
  4719. smalltalk.addMethod(
  4720. smalltalk.method({
  4721. selector: "testCapitalized",
  4722. protocol: 'tests',
  4723. fn: function (){
  4724. var self=this;
  4725. return smalltalk.withContext(function($ctx1) {
  4726. var $1,$2,$3;
  4727. $1="test"._capitalized();
  4728. $ctx1.sendIdx["capitalized"]=1;
  4729. self._assert_equals_($1,"Test");
  4730. $ctx1.sendIdx["assert:equals:"]=1;
  4731. $2="Test"._capitalized();
  4732. $ctx1.sendIdx["capitalized"]=2;
  4733. self._assert_equals_($2,"Test");
  4734. $ctx1.sendIdx["assert:equals:"]=2;
  4735. self._assert_equals_(""._capitalized(),"");
  4736. $ctx1.sendIdx["assert:equals:"]=3;
  4737. $3="Test"._isCapitalized();
  4738. $ctx1.sendIdx["isCapitalized"]=1;
  4739. self._assert_equals_($3,true);
  4740. $ctx1.sendIdx["assert:equals:"]=4;
  4741. self._assert_equals_("test"._isCapitalized(),false);
  4742. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  4743. args: [],
  4744. 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.",
  4745. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4746. referencedClasses: []
  4747. }),
  4748. smalltalk.StringTest);
  4749. smalltalk.addMethod(
  4750. smalltalk.method({
  4751. selector: "testCharCodeAt",
  4752. protocol: 'tests',
  4753. fn: function (){
  4754. var self=this;
  4755. return smalltalk.withContext(function($ctx1) {
  4756. var $1,$2,$3,$4,$5;
  4757. $1="jackie"._charCodeAt_((1));
  4758. $ctx1.sendIdx["charCodeAt:"]=1;
  4759. self._assert_equals_($1,(106));
  4760. $ctx1.sendIdx["assert:equals:"]=1;
  4761. $2="jackie"._charCodeAt_((2));
  4762. $ctx1.sendIdx["charCodeAt:"]=2;
  4763. self._assert_equals_($2,(97));
  4764. $ctx1.sendIdx["assert:equals:"]=2;
  4765. $3="jackie"._charCodeAt_((3));
  4766. $ctx1.sendIdx["charCodeAt:"]=3;
  4767. self._assert_equals_($3,(99));
  4768. $ctx1.sendIdx["assert:equals:"]=3;
  4769. $4="jackie"._charCodeAt_((4));
  4770. $ctx1.sendIdx["charCodeAt:"]=4;
  4771. self._assert_equals_($4,(107));
  4772. $ctx1.sendIdx["assert:equals:"]=4;
  4773. $5="jackie"._charCodeAt_((5));
  4774. $ctx1.sendIdx["charCodeAt:"]=5;
  4775. self._assert_equals_($5,(105));
  4776. $ctx1.sendIdx["assert:equals:"]=5;
  4777. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4778. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  4779. args: [],
  4780. source: "testCharCodeAt\x0a\x09self assert: ('jackie' charCodeAt:1) equals: 106.\x0a\x09self assert: ('jackie' charCodeAt:2) equals: 97.\x0a\x09self assert: ('jackie' charCodeAt:3) equals: 99.\x0a\x09self assert: ('jackie' charCodeAt:4) equals: 107.\x0a\x09self assert: ('jackie' charCodeAt:5) equals: 105.\x0a\x09self assert: ('jackie' charCodeAt:6) equals: 101",
  4781. messageSends: ["assert:equals:", "charCodeAt:"],
  4782. referencedClasses: []
  4783. }),
  4784. smalltalk.StringTest);
  4785. smalltalk.addMethod(
  4786. smalltalk.method({
  4787. selector: "testCopyFromTo",
  4788. protocol: 'tests',
  4789. fn: function (){
  4790. var self=this;
  4791. return smalltalk.withContext(function($ctx1) {
  4792. var $1;
  4793. $1="jackie"._copyFrom_to_((1),(3));
  4794. $ctx1.sendIdx["copyFrom:to:"]=1;
  4795. self._assert_equals_($1,"jac");
  4796. $ctx1.sendIdx["assert:equals:"]=1;
  4797. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4798. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  4799. args: [],
  4800. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4801. messageSends: ["assert:equals:", "copyFrom:to:"],
  4802. referencedClasses: []
  4803. }),
  4804. smalltalk.StringTest);
  4805. smalltalk.addMethod(
  4806. smalltalk.method({
  4807. selector: "testCopyWithoutAll",
  4808. protocol: 'tests',
  4809. fn: function (){
  4810. var self=this;
  4811. return smalltalk.withContext(function($ctx1) {
  4812. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4813. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  4814. args: [],
  4815. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4816. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4817. referencedClasses: []
  4818. }),
  4819. smalltalk.StringTest);
  4820. smalltalk.addMethod(
  4821. smalltalk.method({
  4822. selector: "testEquality",
  4823. protocol: 'tests',
  4824. fn: function (){
  4825. var self=this;
  4826. return smalltalk.withContext(function($ctx1) {
  4827. var $1,$2,$3;
  4828. self._assert_equals_("hello","hello");
  4829. $ctx1.sendIdx["assert:equals:"]=1;
  4830. $1="hello".__eq("world");
  4831. $ctx1.sendIdx["="]=1;
  4832. self._deny_($1);
  4833. $ctx1.sendIdx["deny:"]=1;
  4834. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4835. return smalltalk.withContext(function($ctx2) {
  4836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  4837. $ctx1.sendIdx["="]=2;
  4838. self._deny_($2);
  4839. $ctx1.sendIdx["deny:"]=2;
  4840. $3="hello"._yourself();
  4841. $ctx1.sendIdx["yourself"]=1;
  4842. self._assert_equals_("hello",$3);
  4843. $ctx1.sendIdx["assert:equals:"]=2;
  4844. self._assert_equals_("hello"._yourself(),"hello");
  4845. self._deny_("".__eq((0)));
  4846. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  4847. args: [],
  4848. 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",
  4849. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4850. referencedClasses: []
  4851. }),
  4852. smalltalk.StringTest);
  4853. smalltalk.addMethod(
  4854. smalltalk.method({
  4855. selector: "testIdentity",
  4856. protocol: 'tests',
  4857. fn: function (){
  4858. var self=this;
  4859. return smalltalk.withContext(function($ctx1) {
  4860. var $1,$2,$4,$3,$5;
  4861. $1="hello".__eq_eq("hello");
  4862. $ctx1.sendIdx["=="]=1;
  4863. self._assert_($1);
  4864. $ctx1.sendIdx["assert:"]=1;
  4865. $2="hello".__eq_eq("world");
  4866. $ctx1.sendIdx["=="]=2;
  4867. self._deny_($2);
  4868. $ctx1.sendIdx["deny:"]=1;
  4869. $4="hello"._yourself();
  4870. $ctx1.sendIdx["yourself"]=1;
  4871. $3="hello".__eq_eq($4);
  4872. $ctx1.sendIdx["=="]=3;
  4873. self._assert_($3);
  4874. $ctx1.sendIdx["assert:"]=2;
  4875. $5=_st("hello"._yourself()).__eq_eq("hello");
  4876. $ctx1.sendIdx["=="]=4;
  4877. self._assert_($5);
  4878. self._deny_("".__eq_eq((0)));
  4879. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  4880. args: [],
  4881. 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",
  4882. messageSends: ["assert:", "==", "deny:", "yourself"],
  4883. referencedClasses: []
  4884. }),
  4885. smalltalk.StringTest);
  4886. smalltalk.addMethod(
  4887. smalltalk.method({
  4888. selector: "testIdentityHash",
  4889. protocol: 'tests',
  4890. fn: function (){
  4891. var self=this;
  4892. return smalltalk.withContext(function($ctx1) {
  4893. var $1,$2,$4,$3;
  4894. $1="foo"._identityHash();
  4895. $ctx1.sendIdx["identityHash"]=1;
  4896. $2="foo"._identityHash();
  4897. $ctx1.sendIdx["identityHash"]=2;
  4898. self._assert_equals_($1,$2);
  4899. $4="foo"._identityHash();
  4900. $ctx1.sendIdx["identityHash"]=3;
  4901. $3=_st($4).__eq("bar"._identityHash());
  4902. self._deny_($3);
  4903. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  4904. args: [],
  4905. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4906. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4907. referencedClasses: []
  4908. }),
  4909. smalltalk.StringTest);
  4910. smalltalk.addMethod(
  4911. smalltalk.method({
  4912. selector: "testIncludesSubString",
  4913. protocol: 'tests',
  4914. fn: function (){
  4915. var self=this;
  4916. return smalltalk.withContext(function($ctx1) {
  4917. var $1;
  4918. $1="amber"._includesSubString_("ber");
  4919. $ctx1.sendIdx["includesSubString:"]=1;
  4920. self._assert_($1);
  4921. self._deny_("amber"._includesSubString_("zork"));
  4922. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  4923. args: [],
  4924. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4925. messageSends: ["assert:", "includesSubString:", "deny:"],
  4926. referencedClasses: []
  4927. }),
  4928. smalltalk.StringTest);
  4929. smalltalk.addMethod(
  4930. smalltalk.method({
  4931. selector: "testIndexOfStartingAtWithNull",
  4932. protocol: 'tests',
  4933. fn: function (){
  4934. var self=this;
  4935. return smalltalk.withContext(function($ctx1) {
  4936. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{},smalltalk.StringTest)})},
  4937. args: [],
  4938. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4939. messageSends: [],
  4940. referencedClasses: []
  4941. }),
  4942. smalltalk.StringTest);
  4943. smalltalk.addMethod(
  4944. smalltalk.method({
  4945. selector: "testIndexOfWithNull",
  4946. protocol: 'tests',
  4947. fn: function (){
  4948. var self=this;
  4949. return smalltalk.withContext(function($ctx1) {
  4950. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{},smalltalk.StringTest)})},
  4951. args: [],
  4952. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4953. messageSends: [],
  4954. referencedClasses: []
  4955. }),
  4956. smalltalk.StringTest);
  4957. smalltalk.addMethod(
  4958. smalltalk.method({
  4959. selector: "testIsVowel",
  4960. protocol: 'tests',
  4961. fn: function (){
  4962. var self=this;
  4963. var vowel,consonant;
  4964. return smalltalk.withContext(function($ctx1) {
  4965. var $1;
  4966. vowel="u";
  4967. consonant="z";
  4968. $1=_st(vowel)._isVowel();
  4969. $ctx1.sendIdx["isVowel"]=1;
  4970. self._assert_equals_($1,true);
  4971. $ctx1.sendIdx["assert:equals:"]=1;
  4972. self._assert_equals_(_st(consonant)._isVowel(),false);
  4973. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  4974. args: [],
  4975. source: "testIsVowel\x0a |vowel consonant|\x0a vowel := 'u'.\x0a consonant := 'z'.\x0a self assert: vowel isVowel equals: true.\x0a self assert: consonant isVowel equals: false",
  4976. messageSends: ["assert:equals:", "isVowel"],
  4977. referencedClasses: []
  4978. }),
  4979. smalltalk.StringTest);
  4980. smalltalk.addMethod(
  4981. smalltalk.method({
  4982. selector: "testJoin",
  4983. protocol: 'tests',
  4984. fn: function (){
  4985. var self=this;
  4986. return smalltalk.withContext(function($ctx1) {
  4987. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4988. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  4989. args: [],
  4990. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4991. messageSends: ["assert:equals:", "join:"],
  4992. referencedClasses: []
  4993. }),
  4994. smalltalk.StringTest);
  4995. smalltalk.addMethod(
  4996. smalltalk.method({
  4997. selector: "testRemoveAll",
  4998. protocol: 'tests',
  4999. fn: function (){
  5000. var self=this;
  5001. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5002. return smalltalk.withContext(function($ctx1) {
  5003. self._should_raise_((function(){
  5004. return smalltalk.withContext(function($ctx2) {
  5005. return _st(self._collection())._removeAll();
  5006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5007. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  5008. args: [],
  5009. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  5010. messageSends: ["should:raise:", "removeAll", "collection"],
  5011. referencedClasses: ["Error"]
  5012. }),
  5013. smalltalk.StringTest);
  5014. smalltalk.addMethod(
  5015. smalltalk.method({
  5016. selector: "testReversed",
  5017. protocol: 'tests',
  5018. fn: function (){
  5019. var self=this;
  5020. return smalltalk.withContext(function($ctx1) {
  5021. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  5022. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  5023. args: [],
  5024. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  5025. messageSends: ["assert:equals:", "reversed"],
  5026. referencedClasses: []
  5027. }),
  5028. smalltalk.StringTest);
  5029. smalltalk.addMethod(
  5030. smalltalk.method({
  5031. selector: "testStreamContents",
  5032. protocol: 'tests',
  5033. fn: function (){
  5034. var self=this;
  5035. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  5036. return smalltalk.withContext(function($ctx1) {
  5037. var $1;
  5038. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  5039. return smalltalk.withContext(function($ctx2) {
  5040. _st(aStream)._nextPutAll_("hello");
  5041. $ctx2.sendIdx["nextPutAll:"]=1;
  5042. _st(aStream)._space();
  5043. $1=_st(aStream)._nextPutAll_("world");
  5044. return $1;
  5045. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  5046. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  5047. args: [],
  5048. 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'",
  5049. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  5050. referencedClasses: ["String"]
  5051. }),
  5052. smalltalk.StringTest);
  5053. smalltalk.addMethod(
  5054. smalltalk.method({
  5055. selector: "testSubStrings",
  5056. protocol: 'tests',
  5057. fn: function (){
  5058. var self=this;
  5059. return smalltalk.withContext(function($ctx1) {
  5060. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  5061. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  5062. args: [],
  5063. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  5064. messageSends: ["assert:equals:", "subStrings:"],
  5065. referencedClasses: []
  5066. }),
  5067. smalltalk.StringTest);
  5068. smalltalk.addMethod(
  5069. smalltalk.method({
  5070. selector: "testTrim",
  5071. protocol: 'tests',
  5072. fn: function (){
  5073. var self=this;
  5074. return smalltalk.withContext(function($ctx1) {
  5075. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  5076. $ctx1.sendIdx["assert:equals:"]=1;
  5077. self._assert_equals_("jackie "._trimRight(),"jackie");
  5078. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  5079. args: [],
  5080. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  5081. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  5082. referencedClasses: []
  5083. }),
  5084. smalltalk.StringTest);
  5085. smalltalk.addMethod(
  5086. smalltalk.method({
  5087. selector: "collectionClass",
  5088. protocol: 'fixture',
  5089. fn: function (){
  5090. var self=this;
  5091. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  5092. return smalltalk.withContext(function($ctx1) {
  5093. return $String();
  5094. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  5095. args: [],
  5096. source: "collectionClass\x0a\x09^ String",
  5097. messageSends: [],
  5098. referencedClasses: ["String"]
  5099. }),
  5100. smalltalk.StringTest.klass);
  5101. smalltalk.addClass('SetTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  5102. smalltalk.addMethod(
  5103. smalltalk.method({
  5104. selector: "collection",
  5105. protocol: 'fixture',
  5106. fn: function (){
  5107. var self=this;
  5108. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5109. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5110. return smalltalk.withContext(function($ctx1) {
  5111. var $2,$3,$1;
  5112. $2=_st($Set())._new();
  5113. _st($2)._add_($Smalltalk());
  5114. $ctx1.sendIdx["add:"]=1;
  5115. _st($2)._add_(nil);
  5116. $ctx1.sendIdx["add:"]=2;
  5117. _st($2)._add_((3).__at((3)));
  5118. $ctx1.sendIdx["add:"]=3;
  5119. _st($2)._add_(false);
  5120. $3=_st($2)._yourself();
  5121. $1=$3;
  5122. return $1;
  5123. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.SetTest)})},
  5124. args: [],
  5125. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5126. messageSends: ["add:", "new", "@", "yourself"],
  5127. referencedClasses: ["Set", "Smalltalk"]
  5128. }),
  5129. smalltalk.SetTest);
  5130. smalltalk.addMethod(
  5131. smalltalk.method({
  5132. selector: "collectionOfPrintStrings",
  5133. protocol: 'fixture',
  5134. fn: function (){
  5135. var self=this;
  5136. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5137. return smalltalk.withContext(function($ctx1) {
  5138. var $2,$3,$1;
  5139. $2=_st($Set())._new();
  5140. _st($2)._add_("a SmalltalkImage");
  5141. $ctx1.sendIdx["add:"]=1;
  5142. _st($2)._add_("nil");
  5143. $ctx1.sendIdx["add:"]=2;
  5144. _st($2)._add_("3@3");
  5145. $ctx1.sendIdx["add:"]=3;
  5146. _st($2)._add_("false");
  5147. $3=_st($2)._yourself();
  5148. $1=$3;
  5149. return $1;
  5150. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.SetTest)})},
  5151. args: [],
  5152. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself",
  5153. messageSends: ["add:", "new", "yourself"],
  5154. referencedClasses: ["Set"]
  5155. }),
  5156. smalltalk.SetTest);
  5157. smalltalk.addMethod(
  5158. smalltalk.method({
  5159. selector: "collectionSize",
  5160. protocol: 'fixture',
  5161. fn: function (){
  5162. var self=this;
  5163. return smalltalk.withContext(function($ctx1) {
  5164. return (4);
  5165. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.SetTest)})},
  5166. args: [],
  5167. source: "collectionSize\x0a\x09^ 4",
  5168. messageSends: [],
  5169. referencedClasses: []
  5170. }),
  5171. smalltalk.SetTest);
  5172. smalltalk.addMethod(
  5173. smalltalk.method({
  5174. selector: "collectionWithDuplicates",
  5175. protocol: 'fixture',
  5176. fn: function (){
  5177. var self=this;
  5178. return smalltalk.withContext(function($ctx1) {
  5179. var $2,$3,$1;
  5180. $2=self._collection();
  5181. _st($2)._add_((0));
  5182. $3=_st($2)._yourself();
  5183. $1=$3;
  5184. return $1;
  5185. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.SetTest)})},
  5186. args: [],
  5187. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5188. messageSends: ["add:", "collection", "yourself"],
  5189. referencedClasses: []
  5190. }),
  5191. smalltalk.SetTest);
  5192. smalltalk.addMethod(
  5193. smalltalk.method({
  5194. selector: "collectionWithNewValue",
  5195. protocol: 'fixture',
  5196. fn: function (){
  5197. var self=this;
  5198. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5199. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5200. return smalltalk.withContext(function($ctx1) {
  5201. var $2,$3,$1;
  5202. $2=_st($Set())._new();
  5203. _st($2)._add_($Smalltalk());
  5204. $ctx1.sendIdx["add:"]=1;
  5205. _st($2)._add_(nil);
  5206. $ctx1.sendIdx["add:"]=2;
  5207. _st($2)._add_((3).__at((3)));
  5208. $ctx1.sendIdx["add:"]=3;
  5209. _st($2)._add_("N");
  5210. $ctx1.sendIdx["add:"]=4;
  5211. _st($2)._add_(false);
  5212. $3=_st($2)._yourself();
  5213. $1=$3;
  5214. return $1;
  5215. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.SetTest)})},
  5216. args: [],
  5217. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5218. messageSends: ["add:", "new", "@", "yourself"],
  5219. referencedClasses: ["Set", "Smalltalk"]
  5220. }),
  5221. smalltalk.SetTest);
  5222. smalltalk.addMethod(
  5223. smalltalk.method({
  5224. selector: "testAddAll",
  5225. protocol: 'tests',
  5226. fn: function (){
  5227. var self=this;
  5228. return smalltalk.withContext(function($ctx1) {
  5229. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5230. smalltalk.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  5231. $2=self._collection();
  5232. $ctx1.sendIdx["collection"]=1;
  5233. $3=$2;
  5234. $4=self._collection();
  5235. $ctx1.sendIdx["collection"]=2;
  5236. _st($3)._addAll_($4);
  5237. $ctx1.sendIdx["addAll:"]=1;
  5238. $5=_st($2)._yourself();
  5239. $ctx1.sendIdx["yourself"]=1;
  5240. $1=$5;
  5241. $6=self._collection();
  5242. $ctx1.sendIdx["collection"]=3;
  5243. self._assert_equals_($1,$6);
  5244. $ctx1.sendIdx["assert:equals:"]=1;
  5245. $8=self._collection();
  5246. $ctx1.sendIdx["collection"]=4;
  5247. $9=$8;
  5248. $10=self._collectionWithNewValue();
  5249. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5250. _st($9)._addAll_($10);
  5251. $ctx1.sendIdx["addAll:"]=2;
  5252. $11=_st($8)._yourself();
  5253. $ctx1.sendIdx["yourself"]=2;
  5254. $7=$11;
  5255. $12=self._collectionWithNewValue();
  5256. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5257. self._assert_equals_($7,$12);
  5258. $ctx1.sendIdx["assert:equals:"]=2;
  5259. $14=self._collectionWithNewValue();
  5260. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5261. _st($14)._addAll_(self._collection());
  5262. $15=_st($14)._yourself();
  5263. $13=$15;
  5264. self._assert_equals_($13,self._collectionWithNewValue());
  5265. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.SetTest)})},
  5266. args: [],
  5267. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  5268. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5269. referencedClasses: []
  5270. }),
  5271. smalltalk.SetTest);
  5272. smalltalk.addMethod(
  5273. smalltalk.method({
  5274. selector: "testAddRemove",
  5275. protocol: 'tests',
  5276. fn: function (){
  5277. var self=this;
  5278. var set;
  5279. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5280. return smalltalk.withContext(function($ctx1) {
  5281. var $1,$2;
  5282. set=_st($Set())._new();
  5283. self._assert_(_st(set)._isEmpty());
  5284. $ctx1.sendIdx["assert:"]=1;
  5285. _st(set)._add_((3));
  5286. $ctx1.sendIdx["add:"]=1;
  5287. $1=_st(set)._includes_((3));
  5288. $ctx1.sendIdx["includes:"]=1;
  5289. self._assert_($1);
  5290. $ctx1.sendIdx["assert:"]=2;
  5291. _st(set)._add_((5));
  5292. $2=_st(set)._includes_((5));
  5293. $ctx1.sendIdx["includes:"]=2;
  5294. self._assert_($2);
  5295. _st(set)._remove_((3));
  5296. self._deny_(_st(set)._includes_((3)));
  5297. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  5298. args: [],
  5299. 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)",
  5300. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5301. referencedClasses: ["Set"]
  5302. }),
  5303. smalltalk.SetTest);
  5304. smalltalk.addMethod(
  5305. smalltalk.method({
  5306. selector: "testAt",
  5307. protocol: 'tests',
  5308. fn: function (){
  5309. var self=this;
  5310. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5311. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5312. return smalltalk.withContext(function($ctx1) {
  5313. self._should_raise_((function(){
  5314. return smalltalk.withContext(function($ctx2) {
  5315. return _st(_st($Set())._new())._at_put_((1),(2));
  5316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5317. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  5318. args: [],
  5319. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5320. messageSends: ["should:raise:", "at:put:", "new"],
  5321. referencedClasses: ["Set", "Error"]
  5322. }),
  5323. smalltalk.SetTest);
  5324. smalltalk.addMethod(
  5325. smalltalk.method({
  5326. selector: "testCollect",
  5327. protocol: 'tests',
  5328. fn: function (){
  5329. var self=this;
  5330. return smalltalk.withContext(function($ctx1) {
  5331. var $2,$1;
  5332. smalltalk.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  5333. $2=[(5), (6), (8)]._asSet();
  5334. $ctx1.sendIdx["asSet"]=1;
  5335. $1=_st($2)._collect_((function(x){
  5336. return smalltalk.withContext(function($ctx2) {
  5337. return _st(x).__backslash_backslash((3));
  5338. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5339. self._assert_equals_($1,[(0), (2)]._asSet());
  5340. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  5341. args: [],
  5342. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5343. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5344. referencedClasses: []
  5345. }),
  5346. smalltalk.SetTest);
  5347. smalltalk.addMethod(
  5348. smalltalk.method({
  5349. selector: "testComma",
  5350. protocol: 'tests',
  5351. fn: function (){
  5352. var self=this;
  5353. return smalltalk.withContext(function($ctx1) {
  5354. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5355. smalltalk.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  5356. $2=self._collection();
  5357. $ctx1.sendIdx["collection"]=1;
  5358. $3=self._collection();
  5359. $ctx1.sendIdx["collection"]=2;
  5360. $1=_st($2).__comma($3);
  5361. $ctx1.sendIdx[","]=1;
  5362. $4=self._collection();
  5363. $ctx1.sendIdx["collection"]=3;
  5364. self._assert_equals_($1,$4);
  5365. $ctx1.sendIdx["assert:equals:"]=1;
  5366. $6=self._collection();
  5367. $ctx1.sendIdx["collection"]=4;
  5368. $7=self._collectionWithNewValue();
  5369. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5370. $5=_st($6).__comma($7);
  5371. $ctx1.sendIdx[","]=2;
  5372. $8=self._collectionWithNewValue();
  5373. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5374. self._assert_equals_($5,$8);
  5375. $ctx1.sendIdx["assert:equals:"]=2;
  5376. $10=self._collectionWithNewValue();
  5377. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5378. $9=_st($10).__comma(self._collection());
  5379. self._assert_equals_($9,self._collectionWithNewValue());
  5380. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.SetTest)})},
  5381. args: [],
  5382. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  5383. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5384. referencedClasses: []
  5385. }),
  5386. smalltalk.SetTest);
  5387. smalltalk.addMethod(
  5388. smalltalk.method({
  5389. selector: "testComparing",
  5390. protocol: 'tests',
  5391. fn: function (){
  5392. var self=this;
  5393. return smalltalk.withContext(function($ctx1) {
  5394. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5395. $1=[(0), (2)]._asSet();
  5396. $ctx1.sendIdx["asSet"]=1;
  5397. $2=[(0), (2)]._asSet();
  5398. $ctx1.sendIdx["asSet"]=2;
  5399. self._assert_equals_($1,$2);
  5400. $ctx1.sendIdx["assert:equals:"]=1;
  5401. $3=[(2), (0)]._asSet();
  5402. $ctx1.sendIdx["asSet"]=3;
  5403. $4=[(0), (2)]._asSet();
  5404. $ctx1.sendIdx["asSet"]=4;
  5405. self._assert_equals_($3,$4);
  5406. $6=[(0), (2), (3)]._asSet();
  5407. $ctx1.sendIdx["asSet"]=5;
  5408. $7=[(0), (2)]._asSet();
  5409. $ctx1.sendIdx["asSet"]=6;
  5410. $5=_st($6).__eq($7);
  5411. $ctx1.sendIdx["="]=1;
  5412. self._deny_($5);
  5413. $ctx1.sendIdx["deny:"]=1;
  5414. $9=[(1), (2)]._asSet();
  5415. $ctx1.sendIdx["asSet"]=7;
  5416. $8=_st($9).__eq([(0), (2)]._asSet());
  5417. self._deny_($8);
  5418. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  5419. args: [],
  5420. 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",
  5421. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5422. referencedClasses: []
  5423. }),
  5424. smalltalk.SetTest);
  5425. smalltalk.addMethod(
  5426. smalltalk.method({
  5427. selector: "testPrintString",
  5428. protocol: 'tests',
  5429. fn: function (){
  5430. var self=this;
  5431. var set;
  5432. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5433. return smalltalk.withContext(function($ctx1) {
  5434. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5435. set=_st($Set())._new();
  5436. $1=_st(set)._printString();
  5437. $ctx1.sendIdx["printString"]=1;
  5438. self._assert_equals_($1,"a Set ()");
  5439. $ctx1.sendIdx["assert:equals:"]=1;
  5440. $2=set;
  5441. _st($2)._add_((1));
  5442. $ctx1.sendIdx["add:"]=1;
  5443. $3=_st($2)._add_((3));
  5444. $ctx1.sendIdx["add:"]=2;
  5445. $4=_st(set)._printString();
  5446. $ctx1.sendIdx["printString"]=2;
  5447. self._assert_equals_($4,"a Set (1 3)");
  5448. $ctx1.sendIdx["assert:equals:"]=2;
  5449. _st(set)._add_("foo");
  5450. $ctx1.sendIdx["add:"]=3;
  5451. $5=_st(set)._printString();
  5452. $ctx1.sendIdx["printString"]=3;
  5453. self._assert_equals_($5,"a Set (1 3 'foo')");
  5454. $ctx1.sendIdx["assert:equals:"]=3;
  5455. $6=set;
  5456. _st($6)._remove_((1));
  5457. $ctx1.sendIdx["remove:"]=1;
  5458. $7=_st($6)._remove_((3));
  5459. $8=_st(set)._printString();
  5460. $ctx1.sendIdx["printString"]=4;
  5461. self._assert_equals_($8,"a Set ('foo')");
  5462. $ctx1.sendIdx["assert:equals:"]=4;
  5463. _st(set)._add_((3));
  5464. $ctx1.sendIdx["add:"]=4;
  5465. $9=_st(set)._printString();
  5466. $ctx1.sendIdx["printString"]=5;
  5467. self._assert_equals_($9,"a Set (3 'foo')");
  5468. $ctx1.sendIdx["assert:equals:"]=5;
  5469. _st(set)._add_((3));
  5470. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5471. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  5472. args: [],
  5473. 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 (3 ''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'",
  5474. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5475. referencedClasses: ["Set"]
  5476. }),
  5477. smalltalk.SetTest);
  5478. smalltalk.addMethod(
  5479. smalltalk.method({
  5480. selector: "testUnboxedObjects",
  5481. protocol: 'tests',
  5482. fn: function (){
  5483. var self=this;
  5484. return smalltalk.withContext(function($ctx1) {
  5485. var $4,$3,$2,$1;
  5486. $4="foo"._yourself();
  5487. $ctx1.sendIdx["yourself"]=1;
  5488. $3=[$4,"foo"._yourself()];
  5489. $2=_st($3)._asSet();
  5490. $1=_st($2)._asArray();
  5491. self._assert_equals_($1,["foo"]);
  5492. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  5493. args: [],
  5494. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5495. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5496. referencedClasses: []
  5497. }),
  5498. smalltalk.SetTest);
  5499. smalltalk.addMethod(
  5500. smalltalk.method({
  5501. selector: "testUnicity",
  5502. protocol: 'tests',
  5503. fn: function (){
  5504. var self=this;
  5505. var set;
  5506. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5507. return smalltalk.withContext(function($ctx1) {
  5508. var $1;
  5509. set=_st($Set())._new();
  5510. _st(set)._add_((21));
  5511. $ctx1.sendIdx["add:"]=1;
  5512. _st(set)._add_("hello");
  5513. $ctx1.sendIdx["add:"]=2;
  5514. _st(set)._add_((21));
  5515. $ctx1.sendIdx["add:"]=3;
  5516. $1=_st(set)._size();
  5517. $ctx1.sendIdx["size"]=1;
  5518. self._assert_equals_($1,(2));
  5519. $ctx1.sendIdx["assert:equals:"]=1;
  5520. _st(set)._add_("hello");
  5521. self._assert_equals_(_st(set)._size(),(2));
  5522. $ctx1.sendIdx["assert:equals:"]=2;
  5523. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5524. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  5525. args: [],
  5526. 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')",
  5527. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5528. referencedClasses: ["Set"]
  5529. }),
  5530. smalltalk.SetTest);
  5531. smalltalk.addMethod(
  5532. smalltalk.method({
  5533. selector: "collectionClass",
  5534. protocol: 'fixture',
  5535. fn: function (){
  5536. var self=this;
  5537. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5538. return smalltalk.withContext(function($ctx1) {
  5539. return $Set();
  5540. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.SetTest.klass)})},
  5541. args: [],
  5542. source: "collectionClass\x0a\x09^ Set",
  5543. messageSends: [],
  5544. referencedClasses: ["Set"]
  5545. }),
  5546. smalltalk.SetTest.klass);
  5547. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5548. smalltalk.addMethod(
  5549. smalltalk.method({
  5550. selector: "testShow",
  5551. protocol: 'tests',
  5552. fn: function (){
  5553. var self=this;
  5554. var originalTranscript;
  5555. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5556. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5557. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5558. return smalltalk.withContext(function($ctx1) {
  5559. originalTranscript=_st($Transcript())._current();
  5560. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5561. $ctx1.sendIdx["register:"]=1;
  5562. self._shouldnt_raise_((function(){
  5563. return smalltalk.withContext(function($ctx2) {
  5564. return _st($Transcript())._show_("Hello console!");
  5565. $ctx2.sendIdx["show:"]=1;
  5566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5567. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5568. self._shouldnt_raise_((function(){
  5569. return smalltalk.withContext(function($ctx2) {
  5570. return _st($Transcript())._show_(console);
  5571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5572. _st($Transcript())._register_(originalTranscript);
  5573. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  5574. args: [],
  5575. 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.",
  5576. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5577. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5578. }),
  5579. smalltalk.ConsoleTranscriptTest);
  5580. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5581. smalltalk.addMethod(
  5582. smalltalk.method({
  5583. selector: "jsObject",
  5584. protocol: 'accessing',
  5585. fn: function (){
  5586. var self=this;
  5587. return smalltalk.withContext(function($ctx1) {
  5588. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5589. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  5590. args: [],
  5591. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5592. messageSends: [],
  5593. referencedClasses: []
  5594. }),
  5595. smalltalk.JSObjectProxyTest);
  5596. smalltalk.addMethod(
  5597. smalltalk.method({
  5598. selector: "testAtIfAbsent",
  5599. protocol: 'tests',
  5600. fn: function (){
  5601. var self=this;
  5602. var testObject;
  5603. return smalltalk.withContext(function($ctx1) {
  5604. var $1,$2,$3;
  5605. testObject=self._jsObject();
  5606. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5607. return smalltalk.withContext(function($ctx2) {
  5608. return "Property does not exist";
  5609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5610. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5611. self._assert_equals_($1,"Property does not exist");
  5612. $ctx1.sendIdx["assert:equals:"]=1;
  5613. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5614. return smalltalk.withContext(function($ctx2) {
  5615. return "Property does not exist";
  5616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5617. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5618. self._assert_equals_($2,nil);
  5619. $ctx1.sendIdx["assert:equals:"]=2;
  5620. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5621. return smalltalk.withContext(function($ctx2) {
  5622. return "Property does not exist";
  5623. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  5624. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5625. self._assert_equals_($3,(1));
  5626. $ctx1.sendIdx["assert:equals:"]=3;
  5627. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5628. return smalltalk.withContext(function($ctx2) {
  5629. return "Property does not exist";
  5630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  5631. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5632. args: [],
  5633. 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.",
  5634. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5635. referencedClasses: []
  5636. }),
  5637. smalltalk.JSObjectProxyTest);
  5638. smalltalk.addMethod(
  5639. smalltalk.method({
  5640. selector: "testAtIfPresent",
  5641. protocol: 'tests',
  5642. fn: function (){
  5643. var self=this;
  5644. var testObject;
  5645. return smalltalk.withContext(function($ctx1) {
  5646. var $2,$1,$4,$3,$6,$5;
  5647. testObject=self._jsObject();
  5648. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5649. return smalltalk.withContext(function($ctx2) {
  5650. $2=_st(x)._asString();
  5651. $ctx2.sendIdx["asString"]=1;
  5652. return "hello ".__comma($2);
  5653. $ctx2.sendIdx[","]=1;
  5654. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5655. $ctx1.sendIdx["at:ifPresent:"]=1;
  5656. self._assert_equals_($1,nil);
  5657. $ctx1.sendIdx["assert:equals:"]=1;
  5658. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5659. return smalltalk.withContext(function($ctx2) {
  5660. $4=_st(x)._asString();
  5661. $ctx2.sendIdx["asString"]=2;
  5662. return "hello ".__comma($4);
  5663. $ctx2.sendIdx[","]=2;
  5664. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5665. $ctx1.sendIdx["at:ifPresent:"]=2;
  5666. self._assert_equals_($3,"hello nil");
  5667. $ctx1.sendIdx["assert:equals:"]=2;
  5668. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5669. return smalltalk.withContext(function($ctx2) {
  5670. $6=_st(x)._asString();
  5671. $ctx2.sendIdx["asString"]=3;
  5672. return "hello ".__comma($6);
  5673. $ctx2.sendIdx[","]=3;
  5674. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5675. $ctx1.sendIdx["at:ifPresent:"]=3;
  5676. self._assert_equals_($5,"hello 1");
  5677. $ctx1.sendIdx["assert:equals:"]=3;
  5678. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5679. return smalltalk.withContext(function($ctx2) {
  5680. return "hello ".__comma(_st(x)._asString());
  5681. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5682. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5683. args: [],
  5684. 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'.",
  5685. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5686. referencedClasses: []
  5687. }),
  5688. smalltalk.JSObjectProxyTest);
  5689. smalltalk.addMethod(
  5690. smalltalk.method({
  5691. selector: "testAtIfPresentIfAbsent",
  5692. protocol: 'tests',
  5693. fn: function (){
  5694. var self=this;
  5695. var testObject;
  5696. return smalltalk.withContext(function($ctx1) {
  5697. var $2,$1,$4,$3,$6,$5;
  5698. testObject=self._jsObject();
  5699. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5700. return smalltalk.withContext(function($ctx2) {
  5701. $2=_st(x)._asString();
  5702. $ctx2.sendIdx["asString"]=1;
  5703. return "hello ".__comma($2);
  5704. $ctx2.sendIdx[","]=1;
  5705. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5706. return smalltalk.withContext(function($ctx2) {
  5707. return "not present";
  5708. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5709. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5710. self._assert_equals_($1,"not present");
  5711. $ctx1.sendIdx["assert:equals:"]=1;
  5712. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5713. return smalltalk.withContext(function($ctx2) {
  5714. $4=_st(x)._asString();
  5715. $ctx2.sendIdx["asString"]=2;
  5716. return "hello ".__comma($4);
  5717. $ctx2.sendIdx[","]=2;
  5718. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5719. return smalltalk.withContext(function($ctx2) {
  5720. return "not present";
  5721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5722. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5723. self._assert_equals_($3,"hello nil");
  5724. $ctx1.sendIdx["assert:equals:"]=2;
  5725. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5726. return smalltalk.withContext(function($ctx2) {
  5727. $6=_st(x)._asString();
  5728. $ctx2.sendIdx["asString"]=3;
  5729. return "hello ".__comma($6);
  5730. $ctx2.sendIdx[","]=3;
  5731. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5732. return smalltalk.withContext(function($ctx2) {
  5733. return "not present";
  5734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5735. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5736. self._assert_equals_($5,"hello 1");
  5737. $ctx1.sendIdx["assert:equals:"]=3;
  5738. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5739. return smalltalk.withContext(function($ctx2) {
  5740. return "hello ".__comma(_st(x)._asString());
  5741. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5742. return smalltalk.withContext(function($ctx2) {
  5743. return "not present";
  5744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  5745. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5746. args: [],
  5747. 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'.",
  5748. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5749. referencedClasses: []
  5750. }),
  5751. smalltalk.JSObjectProxyTest);
  5752. smalltalk.addMethod(
  5753. smalltalk.method({
  5754. selector: "testAtPut",
  5755. protocol: 'tests',
  5756. fn: function (){
  5757. var self=this;
  5758. var testObject;
  5759. return smalltalk.withContext(function($ctx1) {
  5760. var $2,$1;
  5761. testObject=self._jsObject();
  5762. $2=_st(testObject)._at_("abc");
  5763. $ctx1.sendIdx["at:"]=1;
  5764. $1=_st($2).__tild_eq("xyz");
  5765. self._assert_($1);
  5766. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5767. $ctx1.sendIdx["assert:equals:"]=1;
  5768. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5769. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5770. args: [],
  5771. source: "testAtPut\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc') ~= 'xyz'.\x0a\x09self assert: (testObject at: 'abc' put: 'xyz') equals: 'xyz'.\x0a\x09self assert: (testObject at: 'abc') equals: 'xyz'",
  5772. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5773. referencedClasses: []
  5774. }),
  5775. smalltalk.JSObjectProxyTest);
  5776. smalltalk.addMethod(
  5777. smalltalk.method({
  5778. selector: "testComparison",
  5779. protocol: 'tests',
  5780. fn: function (){
  5781. var self=this;
  5782. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5783. return smalltalk.withContext(function($ctx1) {
  5784. var $1,$2;
  5785. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  5786. $1=_st(console).__eq(console);
  5787. $ctx1.sendIdx["="]=1;
  5788. self._assert_($1);
  5789. $2=_st(console).__eq(_st($Object())._new());
  5790. $ctx1.sendIdx["="]=2;
  5791. self._deny_($2);
  5792. $ctx1.sendIdx["deny:"]=1;
  5793. self._deny_(_st(console).__eq(self._jsObject()));
  5794. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.JSObjectProxyTest)})},
  5795. args: [],
  5796. source: "testComparison\x0a\x09self assert: ({ console. 2 } indexOf: console) equals: 1.\x0a\x09self assert: console = console.\x0a\x09self deny: console = Object new.\x0a\x09self deny: console = self jsObject",
  5797. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"],
  5798. referencedClasses: ["Object"]
  5799. }),
  5800. smalltalk.JSObjectProxyTest);
  5801. smalltalk.addMethod(
  5802. smalltalk.method({
  5803. selector: "testDNU",
  5804. protocol: 'tests',
  5805. fn: function (){
  5806. var self=this;
  5807. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5808. return smalltalk.withContext(function($ctx1) {
  5809. self._should_raise_((function(){
  5810. return smalltalk.withContext(function($ctx2) {
  5811. return _st(self._jsObject())._foo();
  5812. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5813. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  5814. args: [],
  5815. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5816. messageSends: ["should:raise:", "foo", "jsObject"],
  5817. referencedClasses: ["MessageNotUnderstood"]
  5818. }),
  5819. smalltalk.JSObjectProxyTest);
  5820. smalltalk.addMethod(
  5821. smalltalk.method({
  5822. selector: "testMessageSend",
  5823. protocol: 'tests',
  5824. fn: function (){
  5825. var self=this;
  5826. return smalltalk.withContext(function($ctx1) {
  5827. var $2,$1,$4,$3;
  5828. $2=self._jsObject();
  5829. $ctx1.sendIdx["jsObject"]=1;
  5830. $1=_st($2)._a();
  5831. self._assert_equals_($1,(1));
  5832. $ctx1.sendIdx["assert:equals:"]=1;
  5833. $4=self._jsObject();
  5834. $ctx1.sendIdx["jsObject"]=2;
  5835. $3=_st($4)._b();
  5836. self._assert_equals_($3,(2));
  5837. $ctx1.sendIdx["assert:equals:"]=2;
  5838. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5839. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  5840. args: [],
  5841. 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",
  5842. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5843. referencedClasses: []
  5844. }),
  5845. smalltalk.JSObjectProxyTest);
  5846. smalltalk.addMethod(
  5847. smalltalk.method({
  5848. selector: "testMethodWithArguments",
  5849. protocol: 'tests',
  5850. fn: function (){
  5851. var self=this;
  5852. return smalltalk.withContext(function($ctx1) {
  5853. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5854. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  5855. args: [],
  5856. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5857. messageSends: ["assert:equals:", "c:", "jsObject"],
  5858. referencedClasses: []
  5859. }),
  5860. smalltalk.JSObjectProxyTest);
  5861. smalltalk.addMethod(
  5862. smalltalk.method({
  5863. selector: "testPrinting",
  5864. protocol: 'tests',
  5865. fn: function (){
  5866. var self=this;
  5867. return smalltalk.withContext(function($ctx1) {
  5868. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5869. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  5870. args: [],
  5871. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5872. messageSends: ["assert:equals:", "printString", "jsObject"],
  5873. referencedClasses: []
  5874. }),
  5875. smalltalk.JSObjectProxyTest);
  5876. smalltalk.addMethod(
  5877. smalltalk.method({
  5878. selector: "testPropertyThatReturnsEmptyString",
  5879. protocol: 'tests',
  5880. fn: function (){
  5881. var self=this;
  5882. var object;
  5883. return smalltalk.withContext(function($ctx1) {
  5884. var $1;
  5885. object=self._jsObject();
  5886. $1=_st(object)._d();
  5887. $ctx1.sendIdx["d"]=1;
  5888. self._assert_equals_($1,"");
  5889. $ctx1.sendIdx["assert:equals:"]=1;
  5890. _st(object)._d_("hello");
  5891. self._assert_equals_(_st(object)._d(),"hello");
  5892. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  5893. args: [],
  5894. 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'",
  5895. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5896. referencedClasses: []
  5897. }),
  5898. smalltalk.JSObjectProxyTest);
  5899. smalltalk.addMethod(
  5900. smalltalk.method({
  5901. selector: "testPropertyThatReturnsUndefined",
  5902. protocol: 'tests',
  5903. fn: function (){
  5904. var self=this;
  5905. var object;
  5906. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5907. return smalltalk.withContext(function($ctx1) {
  5908. object=self._jsObject();
  5909. self._shouldnt_raise_((function(){
  5910. return smalltalk.withContext(function($ctx2) {
  5911. return _st(object)._e();
  5912. $ctx2.sendIdx["e"]=1;
  5913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5914. self._assert_(_st(_st(object)._e())._isNil());
  5915. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  5916. args: [],
  5917. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5918. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5919. referencedClasses: ["MessageNotUnderstood"]
  5920. }),
  5921. smalltalk.JSObjectProxyTest);
  5922. smalltalk.addMethod(
  5923. smalltalk.method({
  5924. selector: "testValue",
  5925. protocol: 'tests',
  5926. fn: function (){
  5927. var self=this;
  5928. var testObject;
  5929. return smalltalk.withContext(function($ctx1) {
  5930. testObject=self._jsObject();
  5931. _st(testObject)._at_put_("value","aValue");
  5932. self._assert_equals_(_st(testObject)._value(),"aValue");
  5933. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5934. args: [],
  5935. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5936. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5937. referencedClasses: []
  5938. }),
  5939. smalltalk.JSObjectProxyTest);
  5940. smalltalk.addMethod(
  5941. smalltalk.method({
  5942. selector: "testYourself",
  5943. protocol: 'tests',
  5944. fn: function (){
  5945. var self=this;
  5946. var object;
  5947. return smalltalk.withContext(function($ctx1) {
  5948. var $1,$2;
  5949. $1=self._jsObject();
  5950. _st($1)._d_("test");
  5951. $2=_st($1)._yourself();
  5952. object=$2;
  5953. self._assert_equals_(_st(object)._d(),"test");
  5954. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  5955. args: [],
  5956. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5957. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5958. referencedClasses: []
  5959. }),
  5960. smalltalk.JSObjectProxyTest);
  5961. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5962. smalltalk.addMethod(
  5963. smalltalk.method({
  5964. selector: "testCatchingException",
  5965. protocol: 'tests',
  5966. fn: function (){
  5967. var self=this;
  5968. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5969. return smalltalk.withContext(function($ctx1) {
  5970. _st((function(){
  5971. return smalltalk.withContext(function($ctx2) {
  5972. return self._throwException();
  5973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5974. return smalltalk.withContext(function($ctx2) {
  5975. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5976. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5977. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  5978. args: [],
  5979. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5980. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5981. referencedClasses: ["Error"]
  5982. }),
  5983. smalltalk.JavaScriptExceptionTest);
  5984. smalltalk.addMethod(
  5985. smalltalk.method({
  5986. selector: "testRaisingException",
  5987. protocol: 'tests',
  5988. fn: function (){
  5989. var self=this;
  5990. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5991. return smalltalk.withContext(function($ctx1) {
  5992. self._should_raise_((function(){
  5993. return smalltalk.withContext(function($ctx2) {
  5994. return self._throwException();
  5995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5996. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  5997. args: [],
  5998. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5999. messageSends: ["should:raise:", "throwException"],
  6000. referencedClasses: ["JavaScriptException"]
  6001. }),
  6002. smalltalk.JavaScriptExceptionTest);
  6003. smalltalk.addMethod(
  6004. smalltalk.method({
  6005. selector: "throwException",
  6006. protocol: 'helpers',
  6007. fn: function (){
  6008. var self=this;
  6009. return smalltalk.withContext(function($ctx1) {
  6010. throw 'test';
  6011. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  6012. args: [],
  6013. source: "throwException\x0a\x09<throw 'test'>",
  6014. messageSends: [],
  6015. referencedClasses: []
  6016. }),
  6017. smalltalk.JavaScriptExceptionTest);
  6018. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6019. smalltalk.addMethod(
  6020. smalltalk.method({
  6021. selector: "testValue",
  6022. protocol: 'tests',
  6023. fn: function (){
  6024. var self=this;
  6025. var messageSend;
  6026. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6027. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6028. return smalltalk.withContext(function($ctx1) {
  6029. var $1,$2;
  6030. $1=_st($MessageSend())._new();
  6031. $ctx1.sendIdx["new"]=1;
  6032. _st($1)._receiver_(_st($Object())._new());
  6033. _st($1)._selector_("asString");
  6034. $2=_st($1)._yourself();
  6035. messageSend=$2;
  6036. self._assert_equals_(_st(messageSend)._value(),"an Object");
  6037. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  6038. args: [],
  6039. 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'",
  6040. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  6041. referencedClasses: ["MessageSend", "Object"]
  6042. }),
  6043. smalltalk.MessageSendTest);
  6044. smalltalk.addMethod(
  6045. smalltalk.method({
  6046. selector: "testValueWithArguments",
  6047. protocol: 'tests',
  6048. fn: function (){
  6049. var self=this;
  6050. var messageSend;
  6051. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6052. return smalltalk.withContext(function($ctx1) {
  6053. var $1,$2;
  6054. $1=_st($MessageSend())._new();
  6055. _st($1)._receiver_((2));
  6056. _st($1)._selector_("+");
  6057. $2=_st($1)._yourself();
  6058. messageSend=$2;
  6059. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  6060. $ctx1.sendIdx["assert:equals:"]=1;
  6061. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  6062. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  6063. args: [],
  6064. 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",
  6065. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  6066. referencedClasses: ["MessageSend"]
  6067. }),
  6068. smalltalk.MessageSendTest);
  6069. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  6070. smalltalk.addMethod(
  6071. smalltalk.method({
  6072. selector: "codeGeneratorClass",
  6073. protocol: 'accessing',
  6074. fn: function (){
  6075. var self=this;
  6076. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  6077. return smalltalk.withContext(function($ctx1) {
  6078. return $CodeGenerator();
  6079. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  6080. args: [],
  6081. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  6082. messageSends: [],
  6083. referencedClasses: ["CodeGenerator"]
  6084. }),
  6085. smalltalk.MethodInheritanceTest);
  6086. smalltalk.addMethod(
  6087. smalltalk.method({
  6088. selector: "compiler",
  6089. protocol: 'factory',
  6090. fn: function (){
  6091. var self=this;
  6092. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6093. return smalltalk.withContext(function($ctx1) {
  6094. var $2,$3,$1;
  6095. $2=_st($Compiler())._new();
  6096. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  6097. $3=_st($2)._yourself();
  6098. $1=$3;
  6099. return $1;
  6100. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  6101. args: [],
  6102. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  6103. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  6104. referencedClasses: ["Compiler"]
  6105. }),
  6106. smalltalk.MethodInheritanceTest);
  6107. smalltalk.addMethod(
  6108. smalltalk.method({
  6109. selector: "deinstallBottom",
  6110. protocol: 'testing',
  6111. fn: function (){
  6112. var self=this;
  6113. return smalltalk.withContext(function($ctx1) {
  6114. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6115. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  6116. args: [],
  6117. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6118. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6119. referencedClasses: []
  6120. }),
  6121. smalltalk.MethodInheritanceTest);
  6122. smalltalk.addMethod(
  6123. smalltalk.method({
  6124. selector: "deinstallMiddle",
  6125. protocol: 'testing',
  6126. fn: function (){
  6127. var self=this;
  6128. return smalltalk.withContext(function($ctx1) {
  6129. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6130. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  6131. args: [],
  6132. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6133. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6134. referencedClasses: []
  6135. }),
  6136. smalltalk.MethodInheritanceTest);
  6137. smalltalk.addMethod(
  6138. smalltalk.method({
  6139. selector: "deinstallTop",
  6140. protocol: 'testing',
  6141. fn: function (){
  6142. var self=this;
  6143. return smalltalk.withContext(function($ctx1) {
  6144. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6145. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  6146. args: [],
  6147. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6148. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6149. referencedClasses: []
  6150. }),
  6151. smalltalk.MethodInheritanceTest);
  6152. smalltalk.addMethod(
  6153. smalltalk.method({
  6154. selector: "installBottom:",
  6155. protocol: 'testing',
  6156. fn: function (aString){
  6157. var self=this;
  6158. return smalltalk.withContext(function($ctx1) {
  6159. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6160. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6161. args: ["aString"],
  6162. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6163. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6164. referencedClasses: []
  6165. }),
  6166. smalltalk.MethodInheritanceTest);
  6167. smalltalk.addMethod(
  6168. smalltalk.method({
  6169. selector: "installMiddle:",
  6170. protocol: 'testing',
  6171. fn: function (aString){
  6172. var self=this;
  6173. return smalltalk.withContext(function($ctx1) {
  6174. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6175. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6176. args: ["aString"],
  6177. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6178. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6179. referencedClasses: []
  6180. }),
  6181. smalltalk.MethodInheritanceTest);
  6182. smalltalk.addMethod(
  6183. smalltalk.method({
  6184. selector: "installTop:",
  6185. protocol: 'testing',
  6186. fn: function (aString){
  6187. var self=this;
  6188. return smalltalk.withContext(function($ctx1) {
  6189. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6190. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6191. args: ["aString"],
  6192. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6193. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6194. referencedClasses: []
  6195. }),
  6196. smalltalk.MethodInheritanceTest);
  6197. smalltalk.addMethod(
  6198. smalltalk.method({
  6199. selector: "setUp",
  6200. protocol: 'initialization',
  6201. fn: function (){
  6202. var self=this;
  6203. return smalltalk.withContext(function($ctx1) {
  6204. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6205. $ctx1.sendIdx["new"]=1;
  6206. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6207. $ctx1.sendIdx["new"]=2;
  6208. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6209. self["@method"]=nil;
  6210. self["@performBlock"]=(function(){
  6211. return smalltalk.withContext(function($ctx2) {
  6212. return self._error_("performBlock not initialized");
  6213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6214. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  6215. args: [],
  6216. 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' ]",
  6217. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6218. referencedClasses: []
  6219. }),
  6220. smalltalk.MethodInheritanceTest);
  6221. smalltalk.addMethod(
  6222. smalltalk.method({
  6223. selector: "shouldMNU",
  6224. protocol: 'testing',
  6225. fn: function (){
  6226. var self=this;
  6227. return smalltalk.withContext(function($ctx1) {
  6228. self._shouldMNUTop();
  6229. self._shouldMNUMiddle();
  6230. self._shouldMNUBottom();
  6231. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  6232. args: [],
  6233. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6234. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6235. referencedClasses: []
  6236. }),
  6237. smalltalk.MethodInheritanceTest);
  6238. smalltalk.addMethod(
  6239. smalltalk.method({
  6240. selector: "shouldMNUBottom",
  6241. protocol: 'testing',
  6242. fn: function (){
  6243. var self=this;
  6244. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6245. return smalltalk.withContext(function($ctx1) {
  6246. self._should_raise_((function(){
  6247. return smalltalk.withContext(function($ctx2) {
  6248. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6250. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  6251. args: [],
  6252. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6253. messageSends: ["should:raise:", "value:"],
  6254. referencedClasses: ["MessageNotUnderstood"]
  6255. }),
  6256. smalltalk.MethodInheritanceTest);
  6257. smalltalk.addMethod(
  6258. smalltalk.method({
  6259. selector: "shouldMNUMiddle",
  6260. protocol: 'testing',
  6261. fn: function (){
  6262. var self=this;
  6263. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6264. return smalltalk.withContext(function($ctx1) {
  6265. self._should_raise_((function(){
  6266. return smalltalk.withContext(function($ctx2) {
  6267. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6269. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  6270. args: [],
  6271. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6272. messageSends: ["should:raise:", "value:"],
  6273. referencedClasses: ["MessageNotUnderstood"]
  6274. }),
  6275. smalltalk.MethodInheritanceTest);
  6276. smalltalk.addMethod(
  6277. smalltalk.method({
  6278. selector: "shouldMNUTop",
  6279. protocol: 'testing',
  6280. fn: function (){
  6281. var self=this;
  6282. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6283. return smalltalk.withContext(function($ctx1) {
  6284. self._should_raise_((function(){
  6285. return smalltalk.withContext(function($ctx2) {
  6286. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6287. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6288. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  6289. args: [],
  6290. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6291. messageSends: ["should:raise:", "value:"],
  6292. referencedClasses: ["MessageNotUnderstood"]
  6293. }),
  6294. smalltalk.MethodInheritanceTest);
  6295. smalltalk.addMethod(
  6296. smalltalk.method({
  6297. selector: "shouldReturn:",
  6298. protocol: 'testing',
  6299. fn: function (anObject){
  6300. var self=this;
  6301. var result;
  6302. return smalltalk.withContext(function($ctx1) {
  6303. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6304. $ctx1.sendIdx["value:"]=1;
  6305. self._assert_equals_(["top",anObject],["top",result]);
  6306. $ctx1.sendIdx["assert:equals:"]=1;
  6307. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6308. $ctx1.sendIdx["value:"]=2;
  6309. self._assert_equals_(["middle",anObject],["middle",result]);
  6310. $ctx1.sendIdx["assert:equals:"]=2;
  6311. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6312. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6313. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  6314. args: ["anObject"],
  6315. 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 }",
  6316. messageSends: ["value:", "assert:equals:"],
  6317. referencedClasses: []
  6318. }),
  6319. smalltalk.MethodInheritanceTest);
  6320. smalltalk.addMethod(
  6321. smalltalk.method({
  6322. selector: "shouldReturn:and:and:",
  6323. protocol: 'testing',
  6324. fn: function (anObject,anObject2,anObject3){
  6325. var self=this;
  6326. var result;
  6327. return smalltalk.withContext(function($ctx1) {
  6328. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6329. $ctx1.sendIdx["value:"]=1;
  6330. self._assert_equals_(["top",anObject],["top",result]);
  6331. $ctx1.sendIdx["assert:equals:"]=1;
  6332. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6333. $ctx1.sendIdx["value:"]=2;
  6334. self._assert_equals_(["middle",anObject2],["middle",result]);
  6335. $ctx1.sendIdx["assert:equals:"]=2;
  6336. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6337. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6338. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  6339. args: ["anObject", "anObject2", "anObject3"],
  6340. 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 }",
  6341. messageSends: ["value:", "assert:equals:"],
  6342. referencedClasses: []
  6343. }),
  6344. smalltalk.MethodInheritanceTest);
  6345. smalltalk.addMethod(
  6346. smalltalk.method({
  6347. selector: "targetClassBottom",
  6348. protocol: 'accessing',
  6349. fn: function (){
  6350. var self=this;
  6351. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6352. return smalltalk.withContext(function($ctx1) {
  6353. return $JavaScriptException();
  6354. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  6355. args: [],
  6356. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6357. messageSends: [],
  6358. referencedClasses: ["JavaScriptException"]
  6359. }),
  6360. smalltalk.MethodInheritanceTest);
  6361. smalltalk.addMethod(
  6362. smalltalk.method({
  6363. selector: "targetClassMiddle",
  6364. protocol: 'accessing',
  6365. fn: function (){
  6366. var self=this;
  6367. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6368. return smalltalk.withContext(function($ctx1) {
  6369. return $Error();
  6370. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  6371. args: [],
  6372. source: "targetClassMiddle\x0a\x09^ Error",
  6373. messageSends: [],
  6374. referencedClasses: ["Error"]
  6375. }),
  6376. smalltalk.MethodInheritanceTest);
  6377. smalltalk.addMethod(
  6378. smalltalk.method({
  6379. selector: "targetClassTop",
  6380. protocol: 'accessing',
  6381. fn: function (){
  6382. var self=this;
  6383. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6384. return smalltalk.withContext(function($ctx1) {
  6385. return $Object();
  6386. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  6387. args: [],
  6388. source: "targetClassTop\x0a\x09^ Object",
  6389. messageSends: [],
  6390. referencedClasses: ["Object"]
  6391. }),
  6392. smalltalk.MethodInheritanceTest);
  6393. smalltalk.addMethod(
  6394. smalltalk.method({
  6395. selector: "tearDown",
  6396. protocol: 'initialization',
  6397. fn: function (){
  6398. var self=this;
  6399. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6400. return smalltalk.withContext(function($ctx1) {
  6401. _st((function(){
  6402. return smalltalk.withContext(function($ctx2) {
  6403. return self._deinstallTop();
  6404. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6405. return smalltalk.withContext(function($ctx2) {
  6406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6407. $ctx1.sendIdx["on:do:"]=1;
  6408. _st((function(){
  6409. return smalltalk.withContext(function($ctx2) {
  6410. return self._deinstallMiddle();
  6411. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6412. return smalltalk.withContext(function($ctx2) {
  6413. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  6414. $ctx1.sendIdx["on:do:"]=2;
  6415. _st((function(){
  6416. return smalltalk.withContext(function($ctx2) {
  6417. return self._deinstallBottom();
  6418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6419. return smalltalk.withContext(function($ctx2) {
  6420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  6421. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  6422. args: [],
  6423. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6424. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6425. referencedClasses: ["Error"]
  6426. }),
  6427. smalltalk.MethodInheritanceTest);
  6428. smalltalk.addMethod(
  6429. smalltalk.method({
  6430. selector: "testMNU11",
  6431. protocol: 'tests',
  6432. fn: function (){
  6433. var self=this;
  6434. return smalltalk.withContext(function($ctx1) {
  6435. self["@performBlock"]=(function(x){
  6436. return smalltalk.withContext(function($ctx2) {
  6437. return _st(x)._foo();
  6438. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6439. self._shouldMNU();
  6440. $ctx1.sendIdx["shouldMNU"]=1;
  6441. self._installTop_("foo ^ false");
  6442. $ctx1.sendIdx["installTop:"]=1;
  6443. self._installTop_("foo ^ true");
  6444. self._deinstallTop();
  6445. self._shouldMNU();
  6446. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  6447. args: [],
  6448. 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",
  6449. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6450. referencedClasses: []
  6451. }),
  6452. smalltalk.MethodInheritanceTest);
  6453. smalltalk.addMethod(
  6454. smalltalk.method({
  6455. selector: "testMNU22",
  6456. protocol: 'tests',
  6457. fn: function (){
  6458. var self=this;
  6459. return smalltalk.withContext(function($ctx1) {
  6460. self["@performBlock"]=(function(x){
  6461. return smalltalk.withContext(function($ctx2) {
  6462. return _st(x)._foo();
  6463. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6464. self._shouldMNU();
  6465. $ctx1.sendIdx["shouldMNU"]=1;
  6466. self._installMiddle_("foo ^ false");
  6467. $ctx1.sendIdx["installMiddle:"]=1;
  6468. self._installMiddle_("foo ^ true");
  6469. self._deinstallMiddle();
  6470. self._shouldMNU();
  6471. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  6472. args: [],
  6473. 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",
  6474. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6475. referencedClasses: []
  6476. }),
  6477. smalltalk.MethodInheritanceTest);
  6478. smalltalk.addMethod(
  6479. smalltalk.method({
  6480. selector: "testReturns1",
  6481. protocol: 'tests',
  6482. fn: function (){
  6483. var self=this;
  6484. return smalltalk.withContext(function($ctx1) {
  6485. self["@performBlock"]=(function(x){
  6486. return smalltalk.withContext(function($ctx2) {
  6487. return _st(x)._foo();
  6488. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6489. self._installTop_("foo ^ false");
  6490. $ctx1.sendIdx["installTop:"]=1;
  6491. self._shouldReturn_(false);
  6492. $ctx1.sendIdx["shouldReturn:"]=1;
  6493. self._installTop_("foo ^ true");
  6494. self._shouldReturn_(true);
  6495. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  6496. args: [],
  6497. 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",
  6498. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6499. referencedClasses: []
  6500. }),
  6501. smalltalk.MethodInheritanceTest);
  6502. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6503. smalltalk.addMethod(
  6504. smalltalk.method({
  6505. selector: "testAbs",
  6506. protocol: 'tests',
  6507. fn: function (){
  6508. var self=this;
  6509. return smalltalk.withContext(function($ctx1) {
  6510. var $1;
  6511. $1=(4)._abs();
  6512. $ctx1.sendIdx["abs"]=1;
  6513. self._assert_equals_($1,(4));
  6514. $ctx1.sendIdx["assert:equals:"]=1;
  6515. self._assert_equals_((-4)._abs(),(4));
  6516. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  6517. args: [],
  6518. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6519. messageSends: ["assert:equals:", "abs"],
  6520. referencedClasses: []
  6521. }),
  6522. smalltalk.NumberTest);
  6523. smalltalk.addMethod(
  6524. smalltalk.method({
  6525. selector: "testArithmetic",
  6526. protocol: 'tests',
  6527. fn: function (){
  6528. var self=this;
  6529. return smalltalk.withContext(function($ctx1) {
  6530. var $1,$2,$3,$5,$4;
  6531. $1=(1.5).__plus((1));
  6532. $ctx1.sendIdx["+"]=1;
  6533. self._assert_equals_($1,(2.5));
  6534. $ctx1.sendIdx["assert:equals:"]=1;
  6535. $2=(2).__minus((1));
  6536. $ctx1.sendIdx["-"]=1;
  6537. self._assert_equals_($2,(1));
  6538. $ctx1.sendIdx["assert:equals:"]=2;
  6539. self._assert_equals_((-2).__minus((1)),(-3));
  6540. $ctx1.sendIdx["assert:equals:"]=3;
  6541. self._assert_equals_((12).__slash((2)),(6));
  6542. $ctx1.sendIdx["assert:equals:"]=4;
  6543. $3=(3).__star((4));
  6544. $ctx1.sendIdx["*"]=1;
  6545. self._assert_equals_($3,(12));
  6546. $ctx1.sendIdx["assert:equals:"]=5;
  6547. self._assert_equals_((7).__slash_slash((2)),(3));
  6548. $ctx1.sendIdx["assert:equals:"]=6;
  6549. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6550. $ctx1.sendIdx["assert:equals:"]=7;
  6551. $5=(1).__plus((2));
  6552. $ctx1.sendIdx["+"]=2;
  6553. $4=_st($5).__star((3));
  6554. $ctx1.sendIdx["*"]=2;
  6555. self._assert_equals_($4,(9));
  6556. $ctx1.sendIdx["assert:equals:"]=8;
  6557. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6558. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  6559. args: [],
  6560. 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",
  6561. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6562. referencedClasses: []
  6563. }),
  6564. smalltalk.NumberTest);
  6565. smalltalk.addMethod(
  6566. smalltalk.method({
  6567. selector: "testAsNumber",
  6568. protocol: 'tests',
  6569. fn: function (){
  6570. var self=this;
  6571. return smalltalk.withContext(function($ctx1) {
  6572. self._assert_equals_((3)._asNumber(),(3));
  6573. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  6574. args: [],
  6575. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6576. messageSends: ["assert:equals:", "asNumber"],
  6577. referencedClasses: []
  6578. }),
  6579. smalltalk.NumberTest);
  6580. smalltalk.addMethod(
  6581. smalltalk.method({
  6582. selector: "testCeiling",
  6583. protocol: 'tests',
  6584. fn: function (){
  6585. var self=this;
  6586. return smalltalk.withContext(function($ctx1) {
  6587. var $1,$2;
  6588. $1=(1.2)._ceiling();
  6589. $ctx1.sendIdx["ceiling"]=1;
  6590. self._assert_equals_($1,(2));
  6591. $ctx1.sendIdx["assert:equals:"]=1;
  6592. $2=(-1.2)._ceiling();
  6593. $ctx1.sendIdx["ceiling"]=2;
  6594. self._assert_equals_($2,(-1));
  6595. $ctx1.sendIdx["assert:equals:"]=2;
  6596. self._assert_equals_((1)._ceiling(),(1));
  6597. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  6598. args: [],
  6599. 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.",
  6600. messageSends: ["assert:equals:", "ceiling"],
  6601. referencedClasses: []
  6602. }),
  6603. smalltalk.NumberTest);
  6604. smalltalk.addMethod(
  6605. smalltalk.method({
  6606. selector: "testComparison",
  6607. protocol: 'tests',
  6608. fn: function (){
  6609. var self=this;
  6610. return smalltalk.withContext(function($ctx1) {
  6611. var $1,$2,$3,$4;
  6612. $1=(3).__gt((2));
  6613. $ctx1.sendIdx[">"]=1;
  6614. self._assert_($1);
  6615. $ctx1.sendIdx["assert:"]=1;
  6616. $2=(2).__lt((3));
  6617. $ctx1.sendIdx["<"]=1;
  6618. self._assert_($2);
  6619. $ctx1.sendIdx["assert:"]=2;
  6620. self._deny_((3).__lt((2)));
  6621. $ctx1.sendIdx["deny:"]=1;
  6622. self._deny_((2).__gt((3)));
  6623. $3=(3).__gt_eq((3));
  6624. $ctx1.sendIdx[">="]=1;
  6625. self._assert_($3);
  6626. $ctx1.sendIdx["assert:"]=3;
  6627. self._assert_((3.1).__gt_eq((3)));
  6628. $ctx1.sendIdx["assert:"]=4;
  6629. $4=(3).__lt_eq((3));
  6630. $ctx1.sendIdx["<="]=1;
  6631. self._assert_($4);
  6632. $ctx1.sendIdx["assert:"]=5;
  6633. self._assert_((3).__lt_eq((3.1)));
  6634. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  6635. args: [],
  6636. 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",
  6637. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6638. referencedClasses: []
  6639. }),
  6640. smalltalk.NumberTest);
  6641. smalltalk.addMethod(
  6642. smalltalk.method({
  6643. selector: "testCopying",
  6644. protocol: 'tests',
  6645. fn: function (){
  6646. var self=this;
  6647. return smalltalk.withContext(function($ctx1) {
  6648. var $1;
  6649. $1=_st((1)._copy()).__eq_eq((1));
  6650. $ctx1.sendIdx["=="]=1;
  6651. self._assert_($1);
  6652. $ctx1.sendIdx["assert:"]=1;
  6653. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6654. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  6655. args: [],
  6656. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6657. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6658. referencedClasses: []
  6659. }),
  6660. smalltalk.NumberTest);
  6661. smalltalk.addMethod(
  6662. smalltalk.method({
  6663. selector: "testEquality",
  6664. protocol: 'tests',
  6665. fn: function (){
  6666. var self=this;
  6667. return smalltalk.withContext(function($ctx1) {
  6668. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6669. $1=(1).__eq((1));
  6670. $ctx1.sendIdx["="]=1;
  6671. self._assert_($1);
  6672. $ctx1.sendIdx["assert:"]=1;
  6673. $2=(0).__eq((0));
  6674. $ctx1.sendIdx["="]=2;
  6675. self._assert_($2);
  6676. $ctx1.sendIdx["assert:"]=2;
  6677. $3=(1).__eq((0));
  6678. $ctx1.sendIdx["="]=3;
  6679. self._deny_($3);
  6680. $ctx1.sendIdx["deny:"]=1;
  6681. $5=(1)._yourself();
  6682. $ctx1.sendIdx["yourself"]=1;
  6683. $4=_st($5).__eq((1));
  6684. $ctx1.sendIdx["="]=4;
  6685. self._assert_($4);
  6686. $ctx1.sendIdx["assert:"]=3;
  6687. $7=(1)._yourself();
  6688. $ctx1.sendIdx["yourself"]=2;
  6689. $6=(1).__eq($7);
  6690. $ctx1.sendIdx["="]=5;
  6691. self._assert_($6);
  6692. $ctx1.sendIdx["assert:"]=4;
  6693. $9=(1)._yourself();
  6694. $ctx1.sendIdx["yourself"]=3;
  6695. $8=_st($9).__eq((1)._yourself());
  6696. $ctx1.sendIdx["="]=6;
  6697. self._assert_($8);
  6698. $10=(0).__eq(false);
  6699. $ctx1.sendIdx["="]=7;
  6700. self._deny_($10);
  6701. $ctx1.sendIdx["deny:"]=2;
  6702. $11=false.__eq((0));
  6703. $ctx1.sendIdx["="]=8;
  6704. self._deny_($11);
  6705. $ctx1.sendIdx["deny:"]=3;
  6706. $12="".__eq((0));
  6707. $ctx1.sendIdx["="]=9;
  6708. self._deny_($12);
  6709. $ctx1.sendIdx["deny:"]=4;
  6710. self._deny_((0).__eq(""));
  6711. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  6712. args: [],
  6713. 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 = ''",
  6714. messageSends: ["assert:", "=", "deny:", "yourself"],
  6715. referencedClasses: []
  6716. }),
  6717. smalltalk.NumberTest);
  6718. smalltalk.addMethod(
  6719. smalltalk.method({
  6720. selector: "testFloor",
  6721. protocol: 'tests',
  6722. fn: function (){
  6723. var self=this;
  6724. return smalltalk.withContext(function($ctx1) {
  6725. var $1,$2;
  6726. $1=(1.2)._floor();
  6727. $ctx1.sendIdx["floor"]=1;
  6728. self._assert_equals_($1,(1));
  6729. $ctx1.sendIdx["assert:equals:"]=1;
  6730. $2=(-1.2)._floor();
  6731. $ctx1.sendIdx["floor"]=2;
  6732. self._assert_equals_($2,(-2));
  6733. $ctx1.sendIdx["assert:equals:"]=2;
  6734. self._assert_equals_((1)._floor(),(1));
  6735. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  6736. args: [],
  6737. 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.",
  6738. messageSends: ["assert:equals:", "floor"],
  6739. referencedClasses: []
  6740. }),
  6741. smalltalk.NumberTest);
  6742. smalltalk.addMethod(
  6743. smalltalk.method({
  6744. selector: "testHexNumbers",
  6745. protocol: 'tests',
  6746. fn: function (){
  6747. var self=this;
  6748. return smalltalk.withContext(function($ctx1) {
  6749. var $1,$2,$3,$4,$5;
  6750. self._assert_equals_((9),(9));
  6751. $ctx1.sendIdx["assert:equals:"]=1;
  6752. $1=(10)._truncated();
  6753. $ctx1.sendIdx["truncated"]=1;
  6754. self._assert_equals_($1,(10));
  6755. $ctx1.sendIdx["assert:equals:"]=2;
  6756. $2=(11)._truncated();
  6757. $ctx1.sendIdx["truncated"]=2;
  6758. self._assert_equals_($2,(11));
  6759. $ctx1.sendIdx["assert:equals:"]=3;
  6760. $3=(12)._truncated();
  6761. $ctx1.sendIdx["truncated"]=3;
  6762. self._assert_equals_($3,(12));
  6763. $ctx1.sendIdx["assert:equals:"]=4;
  6764. $4=(13)._truncated();
  6765. $ctx1.sendIdx["truncated"]=4;
  6766. self._assert_equals_($4,(13));
  6767. $ctx1.sendIdx["assert:equals:"]=5;
  6768. $5=(14)._truncated();
  6769. $ctx1.sendIdx["truncated"]=5;
  6770. self._assert_equals_($5,(14));
  6771. $ctx1.sendIdx["assert:equals:"]=6;
  6772. self._assert_equals_((15)._truncated(),(15));
  6773. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  6774. args: [],
  6775. 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",
  6776. messageSends: ["assert:equals:", "truncated"],
  6777. referencedClasses: []
  6778. }),
  6779. smalltalk.NumberTest);
  6780. smalltalk.addMethod(
  6781. smalltalk.method({
  6782. selector: "testIdentity",
  6783. protocol: 'tests',
  6784. fn: function (){
  6785. var self=this;
  6786. return smalltalk.withContext(function($ctx1) {
  6787. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6788. $1=(1).__eq_eq((1));
  6789. $ctx1.sendIdx["=="]=1;
  6790. self._assert_($1);
  6791. $ctx1.sendIdx["assert:"]=1;
  6792. $2=(0).__eq_eq((0));
  6793. $ctx1.sendIdx["=="]=2;
  6794. self._assert_($2);
  6795. $ctx1.sendIdx["assert:"]=2;
  6796. $3=(1).__eq_eq((0));
  6797. $ctx1.sendIdx["=="]=3;
  6798. self._deny_($3);
  6799. $ctx1.sendIdx["deny:"]=1;
  6800. $5=(1)._yourself();
  6801. $ctx1.sendIdx["yourself"]=1;
  6802. $4=_st($5).__eq_eq((1));
  6803. $ctx1.sendIdx["=="]=4;
  6804. self._assert_($4);
  6805. $ctx1.sendIdx["assert:"]=3;
  6806. $7=(1)._yourself();
  6807. $ctx1.sendIdx["yourself"]=2;
  6808. $6=(1).__eq_eq($7);
  6809. $ctx1.sendIdx["=="]=5;
  6810. self._assert_($6);
  6811. $ctx1.sendIdx["assert:"]=4;
  6812. $9=(1)._yourself();
  6813. $ctx1.sendIdx["yourself"]=3;
  6814. $8=_st($9).__eq_eq((1)._yourself());
  6815. $ctx1.sendIdx["=="]=6;
  6816. self._assert_($8);
  6817. self._deny_((1).__eq_eq((2)));
  6818. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  6819. args: [],
  6820. 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",
  6821. messageSends: ["assert:", "==", "deny:", "yourself"],
  6822. referencedClasses: []
  6823. }),
  6824. smalltalk.NumberTest);
  6825. smalltalk.addMethod(
  6826. smalltalk.method({
  6827. selector: "testInvalidHexNumbers",
  6828. protocol: 'tests',
  6829. fn: function (){
  6830. var self=this;
  6831. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6832. return smalltalk.withContext(function($ctx1) {
  6833. self._should_raise_((function(){
  6834. return smalltalk.withContext(function($ctx2) {
  6835. return (16)._rG();
  6836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6837. $ctx1.sendIdx["should:raise:"]=1;
  6838. self._should_raise_((function(){
  6839. return smalltalk.withContext(function($ctx2) {
  6840. return (16)._rg();
  6841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6842. $ctx1.sendIdx["should:raise:"]=2;
  6843. self._should_raise_((function(){
  6844. return smalltalk.withContext(function($ctx2) {
  6845. return (16)._rH();
  6846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6847. $ctx1.sendIdx["should:raise:"]=3;
  6848. self._should_raise_((function(){
  6849. return smalltalk.withContext(function($ctx2) {
  6850. return (16)._rh();
  6851. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6852. $ctx1.sendIdx["should:raise:"]=4;
  6853. self._should_raise_((function(){
  6854. return smalltalk.withContext(function($ctx2) {
  6855. return (16)._rI();
  6856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6857. $ctx1.sendIdx["should:raise:"]=5;
  6858. self._should_raise_((function(){
  6859. return smalltalk.withContext(function($ctx2) {
  6860. return (16)._ri();
  6861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6862. $ctx1.sendIdx["should:raise:"]=6;
  6863. self._should_raise_((function(){
  6864. return smalltalk.withContext(function($ctx2) {
  6865. return (16)._rJ();
  6866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6867. $ctx1.sendIdx["should:raise:"]=7;
  6868. self._should_raise_((function(){
  6869. return smalltalk.withContext(function($ctx2) {
  6870. return (16)._rj();
  6871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6872. $ctx1.sendIdx["should:raise:"]=8;
  6873. self._should_raise_((function(){
  6874. return smalltalk.withContext(function($ctx2) {
  6875. return (16)._rK();
  6876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6877. $ctx1.sendIdx["should:raise:"]=9;
  6878. self._should_raise_((function(){
  6879. return smalltalk.withContext(function($ctx2) {
  6880. return (16)._rk();
  6881. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6882. $ctx1.sendIdx["should:raise:"]=10;
  6883. self._should_raise_((function(){
  6884. return smalltalk.withContext(function($ctx2) {
  6885. return (16)._rL();
  6886. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6887. $ctx1.sendIdx["should:raise:"]=11;
  6888. self._should_raise_((function(){
  6889. return smalltalk.withContext(function($ctx2) {
  6890. return (16)._rl();
  6891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6892. $ctx1.sendIdx["should:raise:"]=12;
  6893. self._should_raise_((function(){
  6894. return smalltalk.withContext(function($ctx2) {
  6895. return (16)._rM();
  6896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6897. $ctx1.sendIdx["should:raise:"]=13;
  6898. self._should_raise_((function(){
  6899. return smalltalk.withContext(function($ctx2) {
  6900. return (16)._rm();
  6901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6902. $ctx1.sendIdx["should:raise:"]=14;
  6903. self._should_raise_((function(){
  6904. return smalltalk.withContext(function($ctx2) {
  6905. return (16)._rN();
  6906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6907. $ctx1.sendIdx["should:raise:"]=15;
  6908. self._should_raise_((function(){
  6909. return smalltalk.withContext(function($ctx2) {
  6910. return (16)._rn();
  6911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6912. $ctx1.sendIdx["should:raise:"]=16;
  6913. self._should_raise_((function(){
  6914. return smalltalk.withContext(function($ctx2) {
  6915. return (16)._rO();
  6916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6917. $ctx1.sendIdx["should:raise:"]=17;
  6918. self._should_raise_((function(){
  6919. return smalltalk.withContext(function($ctx2) {
  6920. return (16)._ro();
  6921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6922. $ctx1.sendIdx["should:raise:"]=18;
  6923. self._should_raise_((function(){
  6924. return smalltalk.withContext(function($ctx2) {
  6925. return (16)._rP();
  6926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6927. $ctx1.sendIdx["should:raise:"]=19;
  6928. self._should_raise_((function(){
  6929. return smalltalk.withContext(function($ctx2) {
  6930. return (16)._rp();
  6931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6932. $ctx1.sendIdx["should:raise:"]=20;
  6933. self._should_raise_((function(){
  6934. return smalltalk.withContext(function($ctx2) {
  6935. return (16)._rQ();
  6936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6937. $ctx1.sendIdx["should:raise:"]=21;
  6938. self._should_raise_((function(){
  6939. return smalltalk.withContext(function($ctx2) {
  6940. return (16)._rq();
  6941. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6942. $ctx1.sendIdx["should:raise:"]=22;
  6943. self._should_raise_((function(){
  6944. return smalltalk.withContext(function($ctx2) {
  6945. return (16)._rR();
  6946. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6947. $ctx1.sendIdx["should:raise:"]=23;
  6948. self._should_raise_((function(){
  6949. return smalltalk.withContext(function($ctx2) {
  6950. return (16)._rr();
  6951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6952. $ctx1.sendIdx["should:raise:"]=24;
  6953. self._should_raise_((function(){
  6954. return smalltalk.withContext(function($ctx2) {
  6955. return (16)._rS();
  6956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6957. $ctx1.sendIdx["should:raise:"]=25;
  6958. self._should_raise_((function(){
  6959. return smalltalk.withContext(function($ctx2) {
  6960. return (16)._rs();
  6961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6962. $ctx1.sendIdx["should:raise:"]=26;
  6963. self._should_raise_((function(){
  6964. return smalltalk.withContext(function($ctx2) {
  6965. return (16)._rT();
  6966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6967. $ctx1.sendIdx["should:raise:"]=27;
  6968. self._should_raise_((function(){
  6969. return smalltalk.withContext(function($ctx2) {
  6970. return (16)._rt();
  6971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6972. $ctx1.sendIdx["should:raise:"]=28;
  6973. self._should_raise_((function(){
  6974. return smalltalk.withContext(function($ctx2) {
  6975. return (16)._rU();
  6976. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6977. $ctx1.sendIdx["should:raise:"]=29;
  6978. self._should_raise_((function(){
  6979. return smalltalk.withContext(function($ctx2) {
  6980. return (16)._ru();
  6981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6982. $ctx1.sendIdx["should:raise:"]=30;
  6983. self._should_raise_((function(){
  6984. return smalltalk.withContext(function($ctx2) {
  6985. return (16)._rV();
  6986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6987. $ctx1.sendIdx["should:raise:"]=31;
  6988. self._should_raise_((function(){
  6989. return smalltalk.withContext(function($ctx2) {
  6990. return (16)._rv();
  6991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6992. $ctx1.sendIdx["should:raise:"]=32;
  6993. self._should_raise_((function(){
  6994. return smalltalk.withContext(function($ctx2) {
  6995. return (16)._rW();
  6996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6997. $ctx1.sendIdx["should:raise:"]=33;
  6998. self._should_raise_((function(){
  6999. return smalltalk.withContext(function($ctx2) {
  7000. return (16)._rw();
  7001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  7002. $ctx1.sendIdx["should:raise:"]=34;
  7003. self._should_raise_((function(){
  7004. return smalltalk.withContext(function($ctx2) {
  7005. return (16)._rX();
  7006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  7007. $ctx1.sendIdx["should:raise:"]=35;
  7008. self._should_raise_((function(){
  7009. return smalltalk.withContext(function($ctx2) {
  7010. return (16)._rx();
  7011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  7012. $ctx1.sendIdx["should:raise:"]=36;
  7013. self._should_raise_((function(){
  7014. return smalltalk.withContext(function($ctx2) {
  7015. return (16)._rY();
  7016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  7017. $ctx1.sendIdx["should:raise:"]=37;
  7018. self._should_raise_((function(){
  7019. return smalltalk.withContext(function($ctx2) {
  7020. return (16)._ry();
  7021. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  7022. $ctx1.sendIdx["should:raise:"]=38;
  7023. self._should_raise_((function(){
  7024. return smalltalk.withContext(function($ctx2) {
  7025. return (16)._rZ();
  7026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  7027. $ctx1.sendIdx["should:raise:"]=39;
  7028. self._should_raise_((function(){
  7029. return smalltalk.withContext(function($ctx2) {
  7030. return (16)._rz();
  7031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  7032. $ctx1.sendIdx["should:raise:"]=40;
  7033. self._should_raise_((function(){
  7034. return smalltalk.withContext(function($ctx2) {
  7035. return (11259375)._Z();
  7036. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  7037. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  7038. args: [],
  7039. 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.",
  7040. 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"],
  7041. referencedClasses: ["MessageNotUnderstood"]
  7042. }),
  7043. smalltalk.NumberTest);
  7044. smalltalk.addMethod(
  7045. smalltalk.method({
  7046. selector: "testLog",
  7047. protocol: 'tests',
  7048. fn: function (){
  7049. var self=this;
  7050. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  7051. return smalltalk.withContext(function($ctx1) {
  7052. self._assert_equals_((10000)._log(),(4));
  7053. $ctx1.sendIdx["assert:equals:"]=1;
  7054. self._assert_equals_((512)._log_((2)),(9));
  7055. $ctx1.sendIdx["assert:equals:"]=2;
  7056. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  7057. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  7058. args: [],
  7059. 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.",
  7060. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  7061. referencedClasses: ["Number"]
  7062. }),
  7063. smalltalk.NumberTest);
  7064. smalltalk.addMethod(
  7065. smalltalk.method({
  7066. selector: "testMinMax",
  7067. protocol: 'tests',
  7068. fn: function (){
  7069. var self=this;
  7070. return smalltalk.withContext(function($ctx1) {
  7071. self._assert_equals_((2)._max_((5)),(5));
  7072. $ctx1.sendIdx["assert:equals:"]=1;
  7073. self._assert_equals_((2)._min_((5)),(2));
  7074. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  7075. args: [],
  7076. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  7077. messageSends: ["assert:equals:", "max:", "min:"],
  7078. referencedClasses: []
  7079. }),
  7080. smalltalk.NumberTest);
  7081. smalltalk.addMethod(
  7082. smalltalk.method({
  7083. selector: "testNegated",
  7084. protocol: 'tests',
  7085. fn: function (){
  7086. var self=this;
  7087. return smalltalk.withContext(function($ctx1) {
  7088. var $1;
  7089. $1=(3)._negated();
  7090. $ctx1.sendIdx["negated"]=1;
  7091. self._assert_equals_($1,(-3));
  7092. $ctx1.sendIdx["assert:equals:"]=1;
  7093. self._assert_equals_((-3)._negated(),(3));
  7094. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  7095. args: [],
  7096. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  7097. messageSends: ["assert:equals:", "negated"],
  7098. referencedClasses: []
  7099. }),
  7100. smalltalk.NumberTest);
  7101. smalltalk.addMethod(
  7102. smalltalk.method({
  7103. selector: "testPrintShowingDecimalPlaces",
  7104. protocol: 'tests',
  7105. fn: function (){
  7106. var self=this;
  7107. return smalltalk.withContext(function($ctx1) {
  7108. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  7109. $1=(23)._printShowingDecimalPlaces_((2));
  7110. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  7111. self._assert_equals_($1,"23.00");
  7112. $ctx1.sendIdx["assert:equals:"]=1;
  7113. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7114. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7115. self._assert_equals_($2,"23.57");
  7116. $ctx1.sendIdx["assert:equals:"]=2;
  7117. $4=(234.567)._negated();
  7118. $ctx1.sendIdx["negated"]=1;
  7119. $3=_st($4)._printShowingDecimalPlaces_((5));
  7120. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7121. self._assert_equals_($3,"-234.56700");
  7122. $ctx1.sendIdx["assert:equals:"]=3;
  7123. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7124. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7125. self._assert_equals_($5,"23");
  7126. $ctx1.sendIdx["assert:equals:"]=4;
  7127. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7128. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7129. self._assert_equals_($6,"24");
  7130. $ctx1.sendIdx["assert:equals:"]=5;
  7131. $8=(23.4567)._negated();
  7132. $ctx1.sendIdx["negated"]=2;
  7133. $7=_st($8)._printShowingDecimalPlaces_((0));
  7134. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7135. self._assert_equals_($7,"-23");
  7136. $ctx1.sendIdx["assert:equals:"]=6;
  7137. $10=(23.5567)._negated();
  7138. $ctx1.sendIdx["negated"]=3;
  7139. $9=_st($10)._printShowingDecimalPlaces_((0));
  7140. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7141. self._assert_equals_($9,"-24");
  7142. $ctx1.sendIdx["assert:equals:"]=7;
  7143. $11=(100000000)._printShowingDecimalPlaces_((1));
  7144. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7145. self._assert_equals_($11,"100000000.0");
  7146. $ctx1.sendIdx["assert:equals:"]=8;
  7147. $12=(0.98)._printShowingDecimalPlaces_((5));
  7148. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7149. self._assert_equals_($12,"0.98000");
  7150. $ctx1.sendIdx["assert:equals:"]=9;
  7151. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7152. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7153. self._assert_equals_($13,"-0.98");
  7154. $ctx1.sendIdx["assert:equals:"]=10;
  7155. $14=(2.567)._printShowingDecimalPlaces_((2));
  7156. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7157. self._assert_equals_($14,"2.57");
  7158. $ctx1.sendIdx["assert:equals:"]=11;
  7159. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7160. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7161. self._assert_equals_($15,"-2.57");
  7162. $ctx1.sendIdx["assert:equals:"]=12;
  7163. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7164. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  7165. args: [],
  7166. 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'.",
  7167. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7168. referencedClasses: []
  7169. }),
  7170. smalltalk.NumberTest);
  7171. smalltalk.addMethod(
  7172. smalltalk.method({
  7173. selector: "testRaisedTo",
  7174. protocol: 'tests',
  7175. fn: function (){
  7176. var self=this;
  7177. return smalltalk.withContext(function($ctx1) {
  7178. var $1,$2,$3;
  7179. $1=(2)._raisedTo_((4));
  7180. $ctx1.sendIdx["raisedTo:"]=1;
  7181. self._assert_equals_($1,(16));
  7182. $ctx1.sendIdx["assert:equals:"]=1;
  7183. $2=(2)._raisedTo_((0));
  7184. $ctx1.sendIdx["raisedTo:"]=2;
  7185. self._assert_equals_($2,(1));
  7186. $ctx1.sendIdx["assert:equals:"]=2;
  7187. $3=(2)._raisedTo_((-3));
  7188. $ctx1.sendIdx["raisedTo:"]=3;
  7189. self._assert_equals_($3,(0.125));
  7190. $ctx1.sendIdx["assert:equals:"]=3;
  7191. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7192. $ctx1.sendIdx["assert:equals:"]=4;
  7193. self._assert_equals_((2).__star_star((4)),(16));
  7194. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  7195. args: [],
  7196. 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.",
  7197. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7198. referencedClasses: []
  7199. }),
  7200. smalltalk.NumberTest);
  7201. smalltalk.addMethod(
  7202. smalltalk.method({
  7203. selector: "testRounded",
  7204. protocol: 'tests',
  7205. fn: function (){
  7206. var self=this;
  7207. return smalltalk.withContext(function($ctx1) {
  7208. var $1,$2;
  7209. $1=(3)._rounded();
  7210. $ctx1.sendIdx["rounded"]=1;
  7211. self._assert_equals_($1,(3));
  7212. $ctx1.sendIdx["assert:equals:"]=1;
  7213. $2=(3.212)._rounded();
  7214. $ctx1.sendIdx["rounded"]=2;
  7215. self._assert_equals_($2,(3));
  7216. $ctx1.sendIdx["assert:equals:"]=2;
  7217. self._assert_equals_((3.51)._rounded(),(4));
  7218. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  7219. args: [],
  7220. 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",
  7221. messageSends: ["assert:equals:", "rounded"],
  7222. referencedClasses: []
  7223. }),
  7224. smalltalk.NumberTest);
  7225. smalltalk.addMethod(
  7226. smalltalk.method({
  7227. selector: "testSign",
  7228. protocol: 'tests',
  7229. fn: function (){
  7230. var self=this;
  7231. return smalltalk.withContext(function($ctx1) {
  7232. var $1,$2;
  7233. $1=(5)._sign();
  7234. $ctx1.sendIdx["sign"]=1;
  7235. self._assert_equals_($1,(1));
  7236. $ctx1.sendIdx["assert:equals:"]=1;
  7237. $2=(0)._sign();
  7238. $ctx1.sendIdx["sign"]=2;
  7239. self._assert_equals_($2,(0));
  7240. $ctx1.sendIdx["assert:equals:"]=2;
  7241. self._assert_equals_((-1.4)._sign(),(-1));
  7242. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  7243. args: [],
  7244. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7245. messageSends: ["assert:equals:", "sign"],
  7246. referencedClasses: []
  7247. }),
  7248. smalltalk.NumberTest);
  7249. smalltalk.addMethod(
  7250. smalltalk.method({
  7251. selector: "testSqrt",
  7252. protocol: 'tests',
  7253. fn: function (){
  7254. var self=this;
  7255. return smalltalk.withContext(function($ctx1) {
  7256. var $1;
  7257. $1=(4)._sqrt();
  7258. $ctx1.sendIdx["sqrt"]=1;
  7259. self._assert_equals_($1,(2));
  7260. $ctx1.sendIdx["assert:equals:"]=1;
  7261. self._assert_equals_((16)._sqrt(),(4));
  7262. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  7263. args: [],
  7264. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7265. messageSends: ["assert:equals:", "sqrt"],
  7266. referencedClasses: []
  7267. }),
  7268. smalltalk.NumberTest);
  7269. smalltalk.addMethod(
  7270. smalltalk.method({
  7271. selector: "testSquared",
  7272. protocol: 'tests',
  7273. fn: function (){
  7274. var self=this;
  7275. return smalltalk.withContext(function($ctx1) {
  7276. self._assert_equals_((4)._squared(),(16));
  7277. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  7278. args: [],
  7279. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7280. messageSends: ["assert:equals:", "squared"],
  7281. referencedClasses: []
  7282. }),
  7283. smalltalk.NumberTest);
  7284. smalltalk.addMethod(
  7285. smalltalk.method({
  7286. selector: "testTimesRepeat",
  7287. protocol: 'tests',
  7288. fn: function (){
  7289. var self=this;
  7290. var i;
  7291. return smalltalk.withContext(function($ctx1) {
  7292. i=(0);
  7293. (0)._timesRepeat_((function(){
  7294. return smalltalk.withContext(function($ctx2) {
  7295. i=_st(i).__plus((1));
  7296. $ctx2.sendIdx["+"]=1;
  7297. return i;
  7298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7299. $ctx1.sendIdx["timesRepeat:"]=1;
  7300. self._assert_equals_(i,(0));
  7301. $ctx1.sendIdx["assert:equals:"]=1;
  7302. (5)._timesRepeat_((function(){
  7303. return smalltalk.withContext(function($ctx2) {
  7304. i=_st(i).__plus((1));
  7305. return i;
  7306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7307. self._assert_equals_(i,(5));
  7308. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  7309. args: [],
  7310. 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",
  7311. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7312. referencedClasses: []
  7313. }),
  7314. smalltalk.NumberTest);
  7315. smalltalk.addMethod(
  7316. smalltalk.method({
  7317. selector: "testTo",
  7318. protocol: 'tests',
  7319. fn: function (){
  7320. var self=this;
  7321. return smalltalk.withContext(function($ctx1) {
  7322. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7323. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  7324. args: [],
  7325. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7326. messageSends: ["assert:equals:", "to:"],
  7327. referencedClasses: []
  7328. }),
  7329. smalltalk.NumberTest);
  7330. smalltalk.addMethod(
  7331. smalltalk.method({
  7332. selector: "testToBy",
  7333. protocol: 'tests',
  7334. fn: function (){
  7335. var self=this;
  7336. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7337. return smalltalk.withContext(function($ctx1) {
  7338. var $1;
  7339. $1=(0)._to_by_((6),(2));
  7340. $ctx1.sendIdx["to:by:"]=1;
  7341. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7342. self._should_raise_((function(){
  7343. return smalltalk.withContext(function($ctx2) {
  7344. return (1)._to_by_((4),(0));
  7345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7346. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  7347. args: [],
  7348. 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",
  7349. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7350. referencedClasses: ["Error"]
  7351. }),
  7352. smalltalk.NumberTest);
  7353. smalltalk.addMethod(
  7354. smalltalk.method({
  7355. selector: "testTrigonometry",
  7356. protocol: 'tests',
  7357. fn: function (){
  7358. var self=this;
  7359. return smalltalk.withContext(function($ctx1) {
  7360. self._assert_equals_((0)._cos(),(1));
  7361. $ctx1.sendIdx["assert:equals:"]=1;
  7362. self._assert_equals_((0)._sin(),(0));
  7363. $ctx1.sendIdx["assert:equals:"]=2;
  7364. self._assert_equals_((0)._tan(),(0));
  7365. $ctx1.sendIdx["assert:equals:"]=3;
  7366. self._assert_equals_((1)._arcCos(),(0));
  7367. $ctx1.sendIdx["assert:equals:"]=4;
  7368. self._assert_equals_((0)._arcSin(),(0));
  7369. $ctx1.sendIdx["assert:equals:"]=5;
  7370. self._assert_equals_((0)._arcTan(),(0));
  7371. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  7372. args: [],
  7373. 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.",
  7374. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7375. referencedClasses: []
  7376. }),
  7377. smalltalk.NumberTest);
  7378. smalltalk.addMethod(
  7379. smalltalk.method({
  7380. selector: "testTruncated",
  7381. protocol: 'tests',
  7382. fn: function (){
  7383. var self=this;
  7384. return smalltalk.withContext(function($ctx1) {
  7385. var $1,$2;
  7386. $1=(3)._truncated();
  7387. $ctx1.sendIdx["truncated"]=1;
  7388. self._assert_equals_($1,(3));
  7389. $ctx1.sendIdx["assert:equals:"]=1;
  7390. $2=(3.212)._truncated();
  7391. $ctx1.sendIdx["truncated"]=2;
  7392. self._assert_equals_($2,(3));
  7393. $ctx1.sendIdx["assert:equals:"]=2;
  7394. self._assert_equals_((3.51)._truncated(),(3));
  7395. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  7396. args: [],
  7397. 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",
  7398. messageSends: ["assert:equals:", "truncated"],
  7399. referencedClasses: []
  7400. }),
  7401. smalltalk.NumberTest);
  7402. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  7403. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7404. smalltalk.addMethod(
  7405. smalltalk.method({
  7406. selector: "foo",
  7407. protocol: 'not yet classified',
  7408. fn: function (){
  7409. var self=this;
  7410. return smalltalk.withContext(function($ctx1) {
  7411. var $1;
  7412. $1=self["@foo"];
  7413. return $1;
  7414. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  7415. args: [],
  7416. source: "foo\x0a\x09^ foo",
  7417. messageSends: [],
  7418. referencedClasses: []
  7419. }),
  7420. smalltalk.ObjectMock);
  7421. smalltalk.addMethod(
  7422. smalltalk.method({
  7423. selector: "foo:",
  7424. protocol: 'not yet classified',
  7425. fn: function (anObject){
  7426. var self=this;
  7427. return smalltalk.withContext(function($ctx1) {
  7428. self["@foo"]=anObject;
  7429. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  7430. args: ["anObject"],
  7431. source: "foo: anObject\x0a\x09foo := anObject",
  7432. messageSends: [],
  7433. referencedClasses: []
  7434. }),
  7435. smalltalk.ObjectMock);
  7436. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7437. smalltalk.addMethod(
  7438. smalltalk.method({
  7439. selector: "notDefined",
  7440. protocol: 'tests',
  7441. fn: function (){
  7442. var self=this;
  7443. return smalltalk.withContext(function($ctx1) {
  7444. return void 0;;
  7445. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  7446. args: [],
  7447. source: "notDefined\x0a\x09<return void 0;>",
  7448. messageSends: [],
  7449. referencedClasses: []
  7450. }),
  7451. smalltalk.ObjectTest);
  7452. smalltalk.addMethod(
  7453. smalltalk.method({
  7454. selector: "testBasicAccess",
  7455. protocol: 'tests',
  7456. fn: function (){
  7457. var self=this;
  7458. var o;
  7459. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7460. return smalltalk.withContext(function($ctx1) {
  7461. var $1;
  7462. o=_st($Object())._new();
  7463. _st(o)._basicAt_put_("a",(1));
  7464. $1=_st(o)._basicAt_("a");
  7465. $ctx1.sendIdx["basicAt:"]=1;
  7466. self._assert_equals_($1,(1));
  7467. $ctx1.sendIdx["assert:equals:"]=1;
  7468. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7469. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  7470. args: [],
  7471. 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",
  7472. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7473. referencedClasses: ["Object"]
  7474. }),
  7475. smalltalk.ObjectTest);
  7476. smalltalk.addMethod(
  7477. smalltalk.method({
  7478. selector: "testBasicPerform",
  7479. protocol: 'tests',
  7480. fn: function (){
  7481. var self=this;
  7482. var o;
  7483. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7484. return smalltalk.withContext(function($ctx1) {
  7485. o=_st($Object())._new();
  7486. _st(o)._basicAt_put_("func",(function(){
  7487. return smalltalk.withContext(function($ctx2) {
  7488. return "hello";
  7489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7490. $ctx1.sendIdx["basicAt:put:"]=1;
  7491. _st(o)._basicAt_put_("func2",(function(a){
  7492. return smalltalk.withContext(function($ctx2) {
  7493. return _st(a).__plus((1));
  7494. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7495. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7496. $ctx1.sendIdx["assert:equals:"]=1;
  7497. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7498. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  7499. args: [],
  7500. 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",
  7501. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7502. referencedClasses: ["Object"]
  7503. }),
  7504. smalltalk.ObjectTest);
  7505. smalltalk.addMethod(
  7506. smalltalk.method({
  7507. selector: "testDNU",
  7508. protocol: 'tests',
  7509. fn: function (){
  7510. var self=this;
  7511. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7512. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7513. return smalltalk.withContext(function($ctx1) {
  7514. self._should_raise_((function(){
  7515. return smalltalk.withContext(function($ctx2) {
  7516. return _st(_st($Object())._new())._foo();
  7517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7518. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  7519. args: [],
  7520. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7521. messageSends: ["should:raise:", "foo", "new"],
  7522. referencedClasses: ["Object", "MessageNotUnderstood"]
  7523. }),
  7524. smalltalk.ObjectTest);
  7525. smalltalk.addMethod(
  7526. smalltalk.method({
  7527. selector: "testEquality",
  7528. protocol: 'tests',
  7529. fn: function (){
  7530. var self=this;
  7531. var o;
  7532. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7533. return smalltalk.withContext(function($ctx1) {
  7534. var $1,$2,$4,$3;
  7535. o=_st($Object())._new();
  7536. $ctx1.sendIdx["new"]=1;
  7537. $1=_st(o).__eq(_st($Object())._new());
  7538. $ctx1.sendIdx["="]=1;
  7539. self._deny_($1);
  7540. $2=_st(o).__eq(o);
  7541. $ctx1.sendIdx["="]=2;
  7542. self._assert_($2);
  7543. $ctx1.sendIdx["assert:"]=1;
  7544. $4=_st(o)._yourself();
  7545. $ctx1.sendIdx["yourself"]=1;
  7546. $3=_st($4).__eq(o);
  7547. $ctx1.sendIdx["="]=3;
  7548. self._assert_($3);
  7549. $ctx1.sendIdx["assert:"]=2;
  7550. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7551. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  7552. args: [],
  7553. 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)",
  7554. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7555. referencedClasses: ["Object"]
  7556. }),
  7557. smalltalk.ObjectTest);
  7558. smalltalk.addMethod(
  7559. smalltalk.method({
  7560. selector: "testHalt",
  7561. protocol: 'tests',
  7562. fn: function (){
  7563. var self=this;
  7564. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7565. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7566. return smalltalk.withContext(function($ctx1) {
  7567. self._should_raise_((function(){
  7568. return smalltalk.withContext(function($ctx2) {
  7569. return _st(_st($Object())._new())._halt();
  7570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7571. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  7572. args: [],
  7573. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7574. messageSends: ["should:raise:", "halt", "new"],
  7575. referencedClasses: ["Object", "Error"]
  7576. }),
  7577. smalltalk.ObjectTest);
  7578. smalltalk.addMethod(
  7579. smalltalk.method({
  7580. selector: "testIdentity",
  7581. protocol: 'tests',
  7582. fn: function (){
  7583. var self=this;
  7584. var o;
  7585. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7586. return smalltalk.withContext(function($ctx1) {
  7587. var $1,$2,$4,$3;
  7588. o=_st($Object())._new();
  7589. $ctx1.sendIdx["new"]=1;
  7590. $1=_st(o).__eq_eq(_st($Object())._new());
  7591. $ctx1.sendIdx["=="]=1;
  7592. self._deny_($1);
  7593. $2=_st(o).__eq_eq(o);
  7594. $ctx1.sendIdx["=="]=2;
  7595. self._assert_($2);
  7596. $ctx1.sendIdx["assert:"]=1;
  7597. $4=_st(o)._yourself();
  7598. $ctx1.sendIdx["yourself"]=1;
  7599. $3=_st($4).__eq_eq(o);
  7600. $ctx1.sendIdx["=="]=3;
  7601. self._assert_($3);
  7602. $ctx1.sendIdx["assert:"]=2;
  7603. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7604. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  7605. args: [],
  7606. 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",
  7607. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7608. referencedClasses: ["Object"]
  7609. }),
  7610. smalltalk.ObjectTest);
  7611. smalltalk.addMethod(
  7612. smalltalk.method({
  7613. selector: "testIfNil",
  7614. protocol: 'tests',
  7615. fn: function (){
  7616. var self=this;
  7617. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7618. return smalltalk.withContext(function($ctx1) {
  7619. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  7620. $2=_st($Object())._new();
  7621. $ctx1.sendIdx["new"]=1;
  7622. $1=_st($2)._isNil();
  7623. self._deny_($1);
  7624. $ctx1.sendIdx["deny:"]=1;
  7625. $5=_st($Object())._new();
  7626. $ctx1.sendIdx["new"]=2;
  7627. if(($receiver = $5) == nil || $receiver == null){
  7628. $4=true;
  7629. } else {
  7630. $4=$5;
  7631. };
  7632. $3=_st($4).__eq(true);
  7633. self._deny_($3);
  7634. $7=_st($Object())._new();
  7635. $ctx1.sendIdx["new"]=3;
  7636. if(($receiver = $7) == nil || $receiver == null){
  7637. $6=$7;
  7638. } else {
  7639. $6=true;
  7640. };
  7641. self._assert_equals_($6,true);
  7642. $ctx1.sendIdx["assert:equals:"]=1;
  7643. $9=_st($Object())._new();
  7644. $ctx1.sendIdx["new"]=4;
  7645. if(($receiver = $9) == nil || $receiver == null){
  7646. $8=false;
  7647. } else {
  7648. $8=true;
  7649. };
  7650. self._assert_equals_($8,true);
  7651. $ctx1.sendIdx["assert:equals:"]=2;
  7652. $11=_st($Object())._new();
  7653. if(($receiver = $11) == nil || $receiver == null){
  7654. $10=false;
  7655. } else {
  7656. $10=true;
  7657. };
  7658. self._assert_equals_($10,true);
  7659. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  7660. args: [],
  7661. 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",
  7662. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7663. referencedClasses: ["Object"]
  7664. }),
  7665. smalltalk.ObjectTest);
  7666. smalltalk.addMethod(
  7667. smalltalk.method({
  7668. selector: "testInstVars",
  7669. protocol: 'tests',
  7670. fn: function (){
  7671. var self=this;
  7672. var o;
  7673. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7674. return smalltalk.withContext(function($ctx1) {
  7675. var $1,$2;
  7676. o=_st($ObjectMock())._new();
  7677. $1=_st(o)._instVarAt_("foo");
  7678. $ctx1.sendIdx["instVarAt:"]=1;
  7679. self._assert_equals_($1,nil);
  7680. $ctx1.sendIdx["assert:equals:"]=1;
  7681. _st(o)._instVarAt_put_("foo",(1));
  7682. $2=_st(o)._instVarAt_("foo");
  7683. $ctx1.sendIdx["instVarAt:"]=2;
  7684. self._assert_equals_($2,(1));
  7685. $ctx1.sendIdx["assert:equals:"]=2;
  7686. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7687. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  7688. args: [],
  7689. 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",
  7690. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7691. referencedClasses: ["ObjectMock"]
  7692. }),
  7693. smalltalk.ObjectTest);
  7694. smalltalk.addMethod(
  7695. smalltalk.method({
  7696. selector: "testNilUndefined",
  7697. protocol: 'tests',
  7698. fn: function (){
  7699. var self=this;
  7700. return smalltalk.withContext(function($ctx1) {
  7701. self._assert_equals_(self._notDefined(),nil);
  7702. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  7703. args: [],
  7704. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7705. messageSends: ["assert:equals:", "notDefined"],
  7706. referencedClasses: []
  7707. }),
  7708. smalltalk.ObjectTest);
  7709. smalltalk.addMethod(
  7710. smalltalk.method({
  7711. selector: "testYourself",
  7712. protocol: 'tests',
  7713. fn: function (){
  7714. var self=this;
  7715. var o;
  7716. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7717. return smalltalk.withContext(function($ctx1) {
  7718. o=_st($ObjectMock())._new();
  7719. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7720. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  7721. args: [],
  7722. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7723. messageSends: ["new", "assert:", "==", "yourself"],
  7724. referencedClasses: ["ObjectMock"]
  7725. }),
  7726. smalltalk.ObjectTest);
  7727. smalltalk.addMethod(
  7728. smalltalk.method({
  7729. selector: "testidentityHash",
  7730. protocol: 'tests',
  7731. fn: function (){
  7732. var self=this;
  7733. var o1,o2;
  7734. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7735. return smalltalk.withContext(function($ctx1) {
  7736. var $2,$3,$1,$5,$4;
  7737. o1=_st($Object())._new();
  7738. $ctx1.sendIdx["new"]=1;
  7739. o2=_st($Object())._new();
  7740. $2=_st(o1)._identityHash();
  7741. $ctx1.sendIdx["identityHash"]=1;
  7742. $3=_st(o1)._identityHash();
  7743. $ctx1.sendIdx["identityHash"]=2;
  7744. $1=_st($2).__eq_eq($3);
  7745. $ctx1.sendIdx["=="]=1;
  7746. self._assert_($1);
  7747. $5=_st(o1)._identityHash();
  7748. $ctx1.sendIdx["identityHash"]=3;
  7749. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7750. self._deny_($4);
  7751. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  7752. args: [],
  7753. 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",
  7754. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7755. referencedClasses: ["Object"]
  7756. }),
  7757. smalltalk.ObjectTest);
  7758. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7759. smalltalk.addMethod(
  7760. smalltalk.method({
  7761. selector: "testAccessing",
  7762. protocol: 'tests',
  7763. fn: function (){
  7764. var self=this;
  7765. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7766. return smalltalk.withContext(function($ctx1) {
  7767. var $2,$1,$3,$6,$5,$4;
  7768. $2=_st($Point())._x_y_((3),(4));
  7769. $ctx1.sendIdx["x:y:"]=1;
  7770. $1=_st($2)._x();
  7771. $ctx1.sendIdx["x"]=1;
  7772. self._assert_equals_($1,(3));
  7773. $ctx1.sendIdx["assert:equals:"]=1;
  7774. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7775. $ctx1.sendIdx["y"]=1;
  7776. self._assert_equals_($3,(4));
  7777. $ctx1.sendIdx["assert:equals:"]=2;
  7778. $6=_st($Point())._new();
  7779. $ctx1.sendIdx["new"]=1;
  7780. $5=_st($6)._x_((3));
  7781. $4=_st($5)._x();
  7782. self._assert_equals_($4,(3));
  7783. $ctx1.sendIdx["assert:equals:"]=3;
  7784. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7785. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  7786. args: [],
  7787. 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",
  7788. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7789. referencedClasses: ["Point"]
  7790. }),
  7791. smalltalk.PointTest);
  7792. smalltalk.addMethod(
  7793. smalltalk.method({
  7794. selector: "testArithmetic",
  7795. protocol: 'tests',
  7796. fn: function (){
  7797. var self=this;
  7798. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7799. return smalltalk.withContext(function($ctx1) {
  7800. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7801. $2=(3).__at((4));
  7802. $ctx1.sendIdx["@"]=1;
  7803. $3=(3).__at((4));
  7804. $ctx1.sendIdx["@"]=2;
  7805. $1=_st($2).__star($3);
  7806. $4=_st($Point())._x_y_((9),(16));
  7807. $ctx1.sendIdx["x:y:"]=1;
  7808. self._assert_equals_($1,$4);
  7809. $ctx1.sendIdx["assert:equals:"]=1;
  7810. $6=(3).__at((4));
  7811. $ctx1.sendIdx["@"]=3;
  7812. $7=(3).__at((4));
  7813. $ctx1.sendIdx["@"]=4;
  7814. $5=_st($6).__plus($7);
  7815. $8=_st($Point())._x_y_((6),(8));
  7816. $ctx1.sendIdx["x:y:"]=2;
  7817. self._assert_equals_($5,$8);
  7818. $ctx1.sendIdx["assert:equals:"]=2;
  7819. $10=(3).__at((4));
  7820. $ctx1.sendIdx["@"]=5;
  7821. $11=(3).__at((4));
  7822. $ctx1.sendIdx["@"]=6;
  7823. $9=_st($10).__minus($11);
  7824. $12=_st($Point())._x_y_((0),(0));
  7825. $ctx1.sendIdx["x:y:"]=3;
  7826. self._assert_equals_($9,$12);
  7827. $ctx1.sendIdx["assert:equals:"]=3;
  7828. $14=(6).__at((8));
  7829. $ctx1.sendIdx["@"]=7;
  7830. $13=_st($14).__slash((3).__at((4)));
  7831. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7832. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  7833. args: [],
  7834. 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)",
  7835. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7836. referencedClasses: ["Point"]
  7837. }),
  7838. smalltalk.PointTest);
  7839. smalltalk.addMethod(
  7840. smalltalk.method({
  7841. selector: "testAt",
  7842. protocol: 'tests',
  7843. fn: function (){
  7844. var self=this;
  7845. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7846. return smalltalk.withContext(function($ctx1) {
  7847. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7848. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  7849. args: [],
  7850. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7851. messageSends: ["assert:equals:", "@", "x:y:"],
  7852. referencedClasses: ["Point"]
  7853. }),
  7854. smalltalk.PointTest);
  7855. smalltalk.addMethod(
  7856. smalltalk.method({
  7857. selector: "testEgality",
  7858. protocol: 'tests',
  7859. fn: function (){
  7860. var self=this;
  7861. return smalltalk.withContext(function($ctx1) {
  7862. var $2,$3,$1,$5,$4;
  7863. $2=(3).__at((4));
  7864. $ctx1.sendIdx["@"]=1;
  7865. $3=(3).__at((4));
  7866. $ctx1.sendIdx["@"]=2;
  7867. $1=_st($2).__eq($3);
  7868. $ctx1.sendIdx["="]=1;
  7869. self._assert_($1);
  7870. $5=(3).__at((5));
  7871. $ctx1.sendIdx["@"]=3;
  7872. $4=_st($5).__eq((3).__at((6)));
  7873. self._deny_($4);
  7874. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  7875. args: [],
  7876. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7877. messageSends: ["assert:", "=", "@", "deny:"],
  7878. referencedClasses: []
  7879. }),
  7880. smalltalk.PointTest);
  7881. smalltalk.addMethod(
  7882. smalltalk.method({
  7883. selector: "testNew",
  7884. protocol: 'tests',
  7885. fn: function (){
  7886. var self=this;
  7887. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7888. return smalltalk.withContext(function($ctx1) {
  7889. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7890. $3=_st($Point())._new();
  7891. $ctx1.sendIdx["new"]=1;
  7892. $2=_st($3)._x_((3));
  7893. $ctx1.sendIdx["x:"]=1;
  7894. $1=_st($2)._y();
  7895. $ctx1.sendIdx["y"]=1;
  7896. self._assert_equals_($1,nil);
  7897. $ctx1.sendIdx["assert:equals:"]=1;
  7898. $7=_st($Point())._new();
  7899. $ctx1.sendIdx["new"]=2;
  7900. $6=_st($7)._x_((3));
  7901. $5=_st($6)._x();
  7902. $ctx1.sendIdx["x"]=1;
  7903. $4=_st($5).__eq((0));
  7904. $ctx1.sendIdx["="]=1;
  7905. self._deny_($4);
  7906. $ctx1.sendIdx["deny:"]=1;
  7907. $10=_st($Point())._new();
  7908. $ctx1.sendIdx["new"]=3;
  7909. $9=_st($10)._y_((4));
  7910. $ctx1.sendIdx["y:"]=1;
  7911. $8=_st($9)._x();
  7912. self._assert_equals_($8,nil);
  7913. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7914. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  7915. args: [],
  7916. source: "testNew\x0a\x0a\x09self assert: (Point new x: 3) y equals: nil.\x0a\x09self deny: (Point new x: 3) x = 0.\x0a\x09self assert: (Point new y: 4) x equals: nil.\x0a\x09self deny: (Point new y: 4) y = 0",
  7917. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7918. referencedClasses: ["Point"]
  7919. }),
  7920. smalltalk.PointTest);
  7921. smalltalk.addMethod(
  7922. smalltalk.method({
  7923. selector: "testTranslateBy",
  7924. protocol: 'tests',
  7925. fn: function (){
  7926. var self=this;
  7927. return smalltalk.withContext(function($ctx1) {
  7928. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7929. $2=(3).__at((3));
  7930. $ctx1.sendIdx["@"]=1;
  7931. $3=(0).__at((1));
  7932. $ctx1.sendIdx["@"]=2;
  7933. $1=_st($2)._translateBy_($3);
  7934. $ctx1.sendIdx["translateBy:"]=1;
  7935. $4=(3).__at((4));
  7936. $ctx1.sendIdx["@"]=3;
  7937. self._assert_equals_($1,$4);
  7938. $ctx1.sendIdx["assert:equals:"]=1;
  7939. $6=(3).__at((3));
  7940. $ctx1.sendIdx["@"]=4;
  7941. $8=(1)._negated();
  7942. $ctx1.sendIdx["negated"]=1;
  7943. $7=(0).__at($8);
  7944. $ctx1.sendIdx["@"]=5;
  7945. $5=_st($6)._translateBy_($7);
  7946. $ctx1.sendIdx["translateBy:"]=2;
  7947. $9=(3).__at((2));
  7948. $ctx1.sendIdx["@"]=6;
  7949. self._assert_equals_($5,$9);
  7950. $ctx1.sendIdx["assert:equals:"]=2;
  7951. $11=(3).__at((3));
  7952. $ctx1.sendIdx["@"]=7;
  7953. $12=(2).__at((3));
  7954. $ctx1.sendIdx["@"]=8;
  7955. $10=_st($11)._translateBy_($12);
  7956. $ctx1.sendIdx["translateBy:"]=3;
  7957. $13=(5).__at((6));
  7958. $ctx1.sendIdx["@"]=9;
  7959. self._assert_equals_($10,$13);
  7960. $ctx1.sendIdx["assert:equals:"]=3;
  7961. $15=(3).__at((3));
  7962. $ctx1.sendIdx["@"]=10;
  7963. $16=_st((3)._negated()).__at((0));
  7964. $ctx1.sendIdx["@"]=11;
  7965. $14=_st($15)._translateBy_($16);
  7966. self._assert_equals_($14,(0).__at((3)));
  7967. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  7968. args: [],
  7969. 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.",
  7970. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7971. referencedClasses: []
  7972. }),
  7973. smalltalk.PointTest);
  7974. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7975. smalltalk.addMethod(
  7976. smalltalk.method({
  7977. selector: "testNextIfAbsent",
  7978. protocol: 'tests',
  7979. fn: function (){
  7980. var self=this;
  7981. var queue;
  7982. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7983. return smalltalk.withContext(function($ctx1) {
  7984. var $2,$1;
  7985. queue=_st($Queue())._new();
  7986. _st(queue)._nextPut_("index1");
  7987. $2=_st(queue)._nextIfAbsent_("empty");
  7988. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7989. $1=_st($2).__eq("index1");
  7990. $ctx1.sendIdx["="]=1;
  7991. self._assert_($1);
  7992. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7993. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  7994. args: [],
  7995. source: "testNextIfAbsent\x0a\x09| queue |\x0a\x09queue := Queue new.\x0a\x09queue nextPut: 'index1'. \x0a\x0a\x09self assert: (queue nextIfAbsent: 'empty') = 'index1'.\x0a\x09self deny: (queue nextIfAbsent: 'empty') = 'index1'",
  7996. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7997. referencedClasses: ["Queue"]
  7998. }),
  7999. smalltalk.QueueTest);
  8000. smalltalk.addMethod(
  8001. smalltalk.method({
  8002. selector: "testQueueNext",
  8003. protocol: 'tests',
  8004. fn: function (){
  8005. var self=this;
  8006. var queue;
  8007. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8008. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  8009. return smalltalk.withContext(function($ctx1) {
  8010. var $1,$2,$4,$3,$6,$5;
  8011. queue=_st($Queue())._new();
  8012. $1=queue;
  8013. _st($1)._nextPut_("index1");
  8014. $ctx1.sendIdx["nextPut:"]=1;
  8015. $2=_st($1)._nextPut_("index2");
  8016. $4=_st(queue)._next();
  8017. $ctx1.sendIdx["next"]=1;
  8018. $3=_st($4).__eq("index1");
  8019. $ctx1.sendIdx["="]=1;
  8020. self._assert_($3);
  8021. $6=_st(queue)._next();
  8022. $ctx1.sendIdx["next"]=2;
  8023. $5=_st($6).__eq("index");
  8024. self._deny_($5);
  8025. self._should_raise_((function(){
  8026. return smalltalk.withContext(function($ctx2) {
  8027. return _st(queue)._next();
  8028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  8029. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  8030. args: [],
  8031. source: "testQueueNext\x0a\x09| queue | \x0a\x09queue := Queue new.\x0a\x09queue \x0a\x09\x09nextPut: 'index1';\x0a\x09\x09nextPut: 'index2'.\x0a\x0a\x09self assert: queue next = 'index1'.\x0a\x09self deny: queue next = 'index'.\x0a\x09self should: [ queue next ] raise: Error",
  8032. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  8033. referencedClasses: ["Queue", "Error"]
  8034. }),
  8035. smalltalk.QueueTest);
  8036. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8037. smalltalk.addMethod(
  8038. smalltalk.method({
  8039. selector: "testAtRandomNumber",
  8040. protocol: 'tests',
  8041. fn: function (){
  8042. var self=this;
  8043. var val;
  8044. return smalltalk.withContext(function($ctx1) {
  8045. (100)._timesRepeat_((function(){
  8046. return smalltalk.withContext(function($ctx2) {
  8047. val=(10)._atRandom();
  8048. val;
  8049. self._assert_(_st(val).__gt((0)));
  8050. $ctx2.sendIdx["assert:"]=1;
  8051. return self._assert_(_st(val).__lt((11)));
  8052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8053. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  8054. args: [],
  8055. source: "testAtRandomNumber\x0a\x09|val|\x09\x0a\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 10 atRandom.\x09\x0a\x09\x09self assert: (val > 0).\x0a\x09\x09self assert: (val <11)\x0a\x09]",
  8056. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  8057. referencedClasses: []
  8058. }),
  8059. smalltalk.RandomTest);
  8060. smalltalk.addMethod(
  8061. smalltalk.method({
  8062. selector: "testAtRandomSequenceableCollection",
  8063. protocol: 'tests',
  8064. fn: function (){
  8065. var self=this;
  8066. var val;
  8067. return smalltalk.withContext(function($ctx1) {
  8068. var $3,$4,$2,$1;
  8069. (100)._timesRepeat_((function(){
  8070. return smalltalk.withContext(function($ctx2) {
  8071. val="abc"._atRandom();
  8072. val;
  8073. $3=_st(val).__eq("a");
  8074. $ctx2.sendIdx["="]=1;
  8075. $4=_st(val).__eq("b");
  8076. $ctx2.sendIdx["="]=2;
  8077. $2=_st($3).__or($4);
  8078. $1=_st($2).__or(_st(val).__eq("c"));
  8079. $ctx2.sendIdx["|"]=1;
  8080. return self._assert_($1);
  8081. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8082. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  8083. args: [],
  8084. source: "testAtRandomSequenceableCollection\x0a\x09|val|\x0a\x09\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 'abc' atRandom.\x0a\x09\x09self assert: ((val = 'a') | (val = 'b') | (val = 'c' )).\x0a\x09].",
  8085. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  8086. referencedClasses: []
  8087. }),
  8088. smalltalk.RandomTest);
  8089. smalltalk.addMethod(
  8090. smalltalk.method({
  8091. selector: "textNext",
  8092. protocol: 'tests',
  8093. fn: function (){
  8094. var self=this;
  8095. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  8096. return smalltalk.withContext(function($ctx1) {
  8097. var $1;
  8098. (10000)._timesRepeat_((function(){
  8099. var current,next;
  8100. return smalltalk.withContext(function($ctx2) {
  8101. next=_st(_st($Random())._new())._next();
  8102. next;
  8103. self._assert_(_st(next).__gt_eq((0)));
  8104. $ctx2.sendIdx["assert:"]=1;
  8105. self._assert_(_st(next).__lt((1)));
  8106. $1=_st(current).__eq(next);
  8107. $ctx2.sendIdx["="]=1;
  8108. self._deny_($1);
  8109. return _st(next).__eq(current);
  8110. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8111. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  8112. args: [],
  8113. 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 ]",
  8114. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8115. referencedClasses: ["Random"]
  8116. }),
  8117. smalltalk.RandomTest);
  8118. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8119. smalltalk.addMethod(
  8120. smalltalk.method({
  8121. selector: "collectionClass",
  8122. protocol: 'accessing',
  8123. fn: function (){
  8124. var self=this;
  8125. return smalltalk.withContext(function($ctx1) {
  8126. var $1;
  8127. $1=_st(self._class())._collectionClass();
  8128. return $1;
  8129. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  8130. args: [],
  8131. source: "collectionClass\x0a\x09^ self class collectionClass",
  8132. messageSends: ["collectionClass", "class"],
  8133. referencedClasses: []
  8134. }),
  8135. smalltalk.StreamTest);
  8136. smalltalk.addMethod(
  8137. smalltalk.method({
  8138. selector: "newCollection",
  8139. protocol: 'accessing',
  8140. fn: function (){
  8141. var self=this;
  8142. return smalltalk.withContext(function($ctx1) {
  8143. var $1;
  8144. $1=_st(self._collectionClass())._new();
  8145. return $1;
  8146. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  8147. args: [],
  8148. source: "newCollection\x0a\x09^ self collectionClass new",
  8149. messageSends: ["new", "collectionClass"],
  8150. referencedClasses: []
  8151. }),
  8152. smalltalk.StreamTest);
  8153. smalltalk.addMethod(
  8154. smalltalk.method({
  8155. selector: "newStream",
  8156. protocol: 'accessing',
  8157. fn: function (){
  8158. var self=this;
  8159. return smalltalk.withContext(function($ctx1) {
  8160. var $1;
  8161. $1=_st(_st(self._collectionClass())._new())._stream();
  8162. return $1;
  8163. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  8164. args: [],
  8165. source: "newStream\x0a\x09^ self collectionClass new stream",
  8166. messageSends: ["stream", "new", "collectionClass"],
  8167. referencedClasses: []
  8168. }),
  8169. smalltalk.StreamTest);
  8170. smalltalk.addMethod(
  8171. smalltalk.method({
  8172. selector: "testAtStartAtEnd",
  8173. protocol: 'tests',
  8174. fn: function (){
  8175. var self=this;
  8176. var stream;
  8177. return smalltalk.withContext(function($ctx1) {
  8178. var $1,$2,$3,$4;
  8179. stream=self._newStream();
  8180. $1=_st(stream)._atStart();
  8181. $ctx1.sendIdx["atStart"]=1;
  8182. self._assert_($1);
  8183. $ctx1.sendIdx["assert:"]=1;
  8184. $2=_st(stream)._atEnd();
  8185. $ctx1.sendIdx["atEnd"]=1;
  8186. self._assert_($2);
  8187. $ctx1.sendIdx["assert:"]=2;
  8188. _st(stream)._nextPutAll_(self._newCollection());
  8189. $3=_st(stream)._atEnd();
  8190. $ctx1.sendIdx["atEnd"]=2;
  8191. self._assert_($3);
  8192. $4=_st(stream)._atStart();
  8193. $ctx1.sendIdx["atStart"]=2;
  8194. self._deny_($4);
  8195. $ctx1.sendIdx["deny:"]=1;
  8196. _st(stream)._position_((1));
  8197. self._deny_(_st(stream)._atEnd());
  8198. $ctx1.sendIdx["deny:"]=2;
  8199. self._deny_(_st(stream)._atStart());
  8200. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  8201. args: [],
  8202. 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",
  8203. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8204. referencedClasses: []
  8205. }),
  8206. smalltalk.StreamTest);
  8207. smalltalk.addMethod(
  8208. smalltalk.method({
  8209. selector: "testContents",
  8210. protocol: 'tests',
  8211. fn: function (){
  8212. var self=this;
  8213. var stream;
  8214. return smalltalk.withContext(function($ctx1) {
  8215. var $1,$2;
  8216. stream=self._newStream();
  8217. $1=stream;
  8218. $2=self._newCollection();
  8219. $ctx1.sendIdx["newCollection"]=1;
  8220. _st($1)._nextPutAll_($2);
  8221. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8222. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  8223. args: [],
  8224. 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",
  8225. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8226. referencedClasses: []
  8227. }),
  8228. smalltalk.StreamTest);
  8229. smalltalk.addMethod(
  8230. smalltalk.method({
  8231. selector: "testIsEmpty",
  8232. protocol: 'tests',
  8233. fn: function (){
  8234. var self=this;
  8235. var stream;
  8236. return smalltalk.withContext(function($ctx1) {
  8237. var $1;
  8238. stream=self._newStream();
  8239. $1=_st(stream)._isEmpty();
  8240. $ctx1.sendIdx["isEmpty"]=1;
  8241. self._assert_($1);
  8242. _st(stream)._nextPutAll_(self._newCollection());
  8243. self._deny_(_st(stream)._isEmpty());
  8244. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  8245. args: [],
  8246. 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",
  8247. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8248. referencedClasses: []
  8249. }),
  8250. smalltalk.StreamTest);
  8251. smalltalk.addMethod(
  8252. smalltalk.method({
  8253. selector: "testPosition",
  8254. protocol: 'tests',
  8255. fn: function (){
  8256. var self=this;
  8257. var collection,stream;
  8258. return smalltalk.withContext(function($ctx1) {
  8259. var $1,$2,$3;
  8260. collection=self._newCollection();
  8261. stream=self._newStream();
  8262. _st(stream)._nextPutAll_(collection);
  8263. $1=_st(stream)._position();
  8264. $ctx1.sendIdx["position"]=1;
  8265. self._assert_equals_($1,_st(collection)._size());
  8266. $ctx1.sendIdx["assert:equals:"]=1;
  8267. _st(stream)._position_((0));
  8268. $2=_st(stream)._position();
  8269. $ctx1.sendIdx["position"]=2;
  8270. self._assert_equals_($2,(0));
  8271. $ctx1.sendIdx["assert:equals:"]=2;
  8272. _st(stream)._next();
  8273. $ctx1.sendIdx["next"]=1;
  8274. $3=_st(stream)._position();
  8275. $ctx1.sendIdx["position"]=3;
  8276. self._assert_equals_($3,(1));
  8277. $ctx1.sendIdx["assert:equals:"]=3;
  8278. _st(stream)._next();
  8279. self._assert_equals_(_st(stream)._position(),(2));
  8280. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  8281. args: [],
  8282. 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",
  8283. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8284. referencedClasses: []
  8285. }),
  8286. smalltalk.StreamTest);
  8287. smalltalk.addMethod(
  8288. smalltalk.method({
  8289. selector: "testReading",
  8290. protocol: 'tests',
  8291. fn: function (){
  8292. var self=this;
  8293. var stream,collection;
  8294. return smalltalk.withContext(function($ctx1) {
  8295. var $1,$2,$3;
  8296. collection=self._newCollection();
  8297. stream=self._newStream();
  8298. $1=stream;
  8299. _st($1)._nextPutAll_(collection);
  8300. $2=_st($1)._position_((0));
  8301. _st(collection)._do_((function(each){
  8302. return smalltalk.withContext(function($ctx2) {
  8303. $3=_st(stream)._next();
  8304. $ctx2.sendIdx["next"]=1;
  8305. return self._assert_equals_($3,each);
  8306. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8307. self._assert_(_st(_st(stream)._next())._isNil());
  8308. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8309. args: [],
  8310. 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",
  8311. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8312. referencedClasses: []
  8313. }),
  8314. smalltalk.StreamTest);
  8315. smalltalk.addMethod(
  8316. smalltalk.method({
  8317. selector: "testStreamContents",
  8318. protocol: 'tests',
  8319. fn: function (){
  8320. var self=this;
  8321. return smalltalk.withContext(function($ctx1) {
  8322. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  8323. args: [],
  8324. source: "testStreamContents",
  8325. messageSends: [],
  8326. referencedClasses: []
  8327. }),
  8328. smalltalk.StreamTest);
  8329. smalltalk.addMethod(
  8330. smalltalk.method({
  8331. selector: "testWrite",
  8332. protocol: 'tests',
  8333. fn: function (){
  8334. var self=this;
  8335. var stream,collection;
  8336. return smalltalk.withContext(function($ctx1) {
  8337. collection=self._newCollection();
  8338. stream=self._newStream();
  8339. _st(collection)._do_((function(each){
  8340. return smalltalk.withContext(function($ctx2) {
  8341. return _st(stream).__lt_lt(each);
  8342. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8343. self._assert_equals_(_st(stream)._contents(),collection);
  8344. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8345. args: [],
  8346. 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",
  8347. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8348. referencedClasses: []
  8349. }),
  8350. smalltalk.StreamTest);
  8351. smalltalk.addMethod(
  8352. smalltalk.method({
  8353. selector: "testWriting",
  8354. protocol: 'tests',
  8355. fn: function (){
  8356. var self=this;
  8357. var stream,collection;
  8358. return smalltalk.withContext(function($ctx1) {
  8359. var $1;
  8360. collection=self._newCollection();
  8361. stream=self._newStream();
  8362. $ctx1.sendIdx["newStream"]=1;
  8363. _st(collection)._do_((function(each){
  8364. return smalltalk.withContext(function($ctx2) {
  8365. return _st(stream)._nextPut_(each);
  8366. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8367. $1=_st(stream)._contents();
  8368. $ctx1.sendIdx["contents"]=1;
  8369. self._assert_equals_($1,collection);
  8370. $ctx1.sendIdx["assert:equals:"]=1;
  8371. stream=self._newStream();
  8372. _st(stream)._nextPutAll_(collection);
  8373. self._assert_equals_(_st(stream)._contents(),collection);
  8374. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8375. args: [],
  8376. 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",
  8377. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8378. referencedClasses: []
  8379. }),
  8380. smalltalk.StreamTest);
  8381. smalltalk.addMethod(
  8382. smalltalk.method({
  8383. selector: "collectionClass",
  8384. protocol: 'accessing',
  8385. fn: function (){
  8386. var self=this;
  8387. return smalltalk.withContext(function($ctx1) {
  8388. return nil;
  8389. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  8390. args: [],
  8391. source: "collectionClass\x0a\x09^ nil",
  8392. messageSends: [],
  8393. referencedClasses: []
  8394. }),
  8395. smalltalk.StreamTest.klass);
  8396. smalltalk.addMethod(
  8397. smalltalk.method({
  8398. selector: "isAbstract",
  8399. protocol: 'testing',
  8400. fn: function (){
  8401. var self=this;
  8402. return smalltalk.withContext(function($ctx1) {
  8403. var $1;
  8404. $1=_st(self._collectionClass())._isNil();
  8405. return $1;
  8406. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  8407. args: [],
  8408. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8409. messageSends: ["isNil", "collectionClass"],
  8410. referencedClasses: []
  8411. }),
  8412. smalltalk.StreamTest.klass);
  8413. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8414. smalltalk.addMethod(
  8415. smalltalk.method({
  8416. selector: "newCollection",
  8417. protocol: 'accessing',
  8418. fn: function (){
  8419. var self=this;
  8420. return smalltalk.withContext(function($ctx1) {
  8421. var $1;
  8422. $1=[true,(1),(3).__at((4)),"foo"];
  8423. return $1;
  8424. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  8425. args: [],
  8426. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8427. messageSends: ["@"],
  8428. referencedClasses: []
  8429. }),
  8430. smalltalk.ArrayStreamTest);
  8431. smalltalk.addMethod(
  8432. smalltalk.method({
  8433. selector: "collectionClass",
  8434. protocol: 'accessing',
  8435. fn: function (){
  8436. var self=this;
  8437. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  8438. return smalltalk.withContext(function($ctx1) {
  8439. return $Array();
  8440. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  8441. args: [],
  8442. source: "collectionClass\x0a\x09^ Array",
  8443. messageSends: [],
  8444. referencedClasses: ["Array"]
  8445. }),
  8446. smalltalk.ArrayStreamTest.klass);
  8447. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8448. smalltalk.addMethod(
  8449. smalltalk.method({
  8450. selector: "newCollection",
  8451. protocol: 'accessing',
  8452. fn: function (){
  8453. var self=this;
  8454. return smalltalk.withContext(function($ctx1) {
  8455. return "hello world";
  8456. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  8457. args: [],
  8458. source: "newCollection\x0a\x09^ 'hello world'",
  8459. messageSends: [],
  8460. referencedClasses: []
  8461. }),
  8462. smalltalk.StringStreamTest);
  8463. smalltalk.addMethod(
  8464. smalltalk.method({
  8465. selector: "collectionClass",
  8466. protocol: 'accessing',
  8467. fn: function (){
  8468. var self=this;
  8469. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  8470. return smalltalk.withContext(function($ctx1) {
  8471. return $String();
  8472. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  8473. args: [],
  8474. source: "collectionClass\x0a\x09^ String",
  8475. messageSends: [],
  8476. referencedClasses: ["String"]
  8477. }),
  8478. smalltalk.StringStreamTest.klass);
  8479. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8480. smalltalk.addMethod(
  8481. smalltalk.method({
  8482. selector: "testCopying",
  8483. protocol: 'tests',
  8484. fn: function (){
  8485. var self=this;
  8486. return smalltalk.withContext(function($ctx1) {
  8487. self._assert_equals_(nil._copy(),nil);
  8488. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  8489. args: [],
  8490. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8491. messageSends: ["assert:equals:", "copy"],
  8492. referencedClasses: []
  8493. }),
  8494. smalltalk.UndefinedTest);
  8495. smalltalk.addMethod(
  8496. smalltalk.method({
  8497. selector: "testDeepCopy",
  8498. protocol: 'tests',
  8499. fn: function (){
  8500. var self=this;
  8501. return smalltalk.withContext(function($ctx1) {
  8502. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8503. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  8504. args: [],
  8505. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8506. messageSends: ["assert:", "=", "deepCopy"],
  8507. referencedClasses: []
  8508. }),
  8509. smalltalk.UndefinedTest);
  8510. smalltalk.addMethod(
  8511. smalltalk.method({
  8512. selector: "testIfNil",
  8513. protocol: 'tests',
  8514. fn: function (){
  8515. var self=this;
  8516. return smalltalk.withContext(function($ctx1) {
  8517. var $1,$3,$2,$4,$6,$5;
  8518. if(($receiver = nil) == nil || $receiver == null){
  8519. $1=true;
  8520. } else {
  8521. $1=nil;
  8522. };
  8523. self._assert_equals_($1,true);
  8524. $ctx1.sendIdx["assert:equals:"]=1;
  8525. if(($receiver = nil) == nil || $receiver == null){
  8526. $3=nil;
  8527. } else {
  8528. $3=true;
  8529. };
  8530. $2=_st($3).__eq(true);
  8531. $ctx1.sendIdx["="]=1;
  8532. self._deny_($2);
  8533. $ctx1.sendIdx["deny:"]=1;
  8534. if(($receiver = nil) == nil || $receiver == null){
  8535. $4=true;
  8536. } else {
  8537. $4=false;
  8538. };
  8539. self._assert_equals_($4,true);
  8540. if(($receiver = nil) == nil || $receiver == null){
  8541. $6=false;
  8542. } else {
  8543. $6=true;
  8544. };
  8545. $5=_st($6).__eq(true);
  8546. self._deny_($5);
  8547. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  8548. args: [],
  8549. 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",
  8550. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8551. referencedClasses: []
  8552. }),
  8553. smalltalk.UndefinedTest);
  8554. smalltalk.addMethod(
  8555. smalltalk.method({
  8556. selector: "testIsNil",
  8557. protocol: 'tests',
  8558. fn: function (){
  8559. var self=this;
  8560. return smalltalk.withContext(function($ctx1) {
  8561. self._assert_(nil._isNil());
  8562. self._deny_(nil._notNil());
  8563. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  8564. args: [],
  8565. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8566. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8567. referencedClasses: []
  8568. }),
  8569. smalltalk.UndefinedTest);
  8570. });