Kernel-Tests.js 330 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', globals.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 globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return globals.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},globals.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. globals.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', globals.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 globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return globals.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},globals.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. globals.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 globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return globals.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},globals.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. globals.AnnouncerTest);
  110. smalltalk.addClass('BlockClosureTest', globals.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 globals.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",{},globals.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. globals.BlockClosureTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testCanClearTimeout",
  136. protocol: 'tests',
  137. fn: function (){
  138. var self=this;
  139. function $Error(){return globals.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",{},globals.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. globals.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",{},globals.BlockClosureTest)})},
  167. args: [],
  168. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  169. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  170. referencedClasses: []
  171. }),
  172. globals.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 globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  181. function $Array(){return globals.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},globals.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. globals.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",{},globals.BlockClosureTest)})},
  218. args: [],
  219. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  220. messageSends: ["assert:equals:", "ensure:"],
  221. referencedClasses: []
  222. }),
  223. globals.BlockClosureTest);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "testEnsureRaises",
  227. protocol: 'tests',
  228. fn: function (){
  229. var self=this;
  230. function $Error(){return globals.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",{},globals.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. globals.BlockClosureTest);
  249. smalltalk.addMethod(
  250. smalltalk.method({
  251. selector: "testExceptionSemantics",
  252. protocol: 'tests',
  253. fn: function (){
  254. var self=this;
  255. function $Error(){return globals.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",{},globals.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. globals.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), globals.Error);;
  295. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},globals.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), globals.Error);\x0a>",
  298. messageSends: [],
  299. referencedClasses: []
  300. }),
  301. globals.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",{},globals.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. globals.BlockClosureTest);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "testOnDo",
  329. protocol: 'tests',
  330. fn: function (){
  331. var self=this;
  332. function $Error(){return globals.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",{},globals.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. globals.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",{},globals.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. globals.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",{},globals.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. globals.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},globals.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. globals.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},globals.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. globals.BlockClosureTest);
  491. smalltalk.addClass('BooleanTest', globals.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",{},globals.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. globals.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",{},globals.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. globals.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",{},globals.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. globals.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",{},globals.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. globals.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",{},globals.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. globals.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",{},globals.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. globals.BooleanTest);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "testNonBooleanError",
  947. protocol: 'tests',
  948. fn: function (){
  949. var self=this;
  950. function $NonBooleanReceiver(){return globals.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",{},globals.BooleanTest)})},
  959. args: [],
  960. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  961. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  962. referencedClasses: ["NonBooleanReceiver"]
  963. }),
  964. globals.BooleanTest);
  965. smalltalk.addClass('ClassBuilderTest', globals.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 globals.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",{},globals.ClassBuilderTest)})},
  976. args: [],
  977. source: "setUp\x0a\x09builder := ClassBuilder new",
  978. messageSends: ["new"],
  979. referencedClasses: ["ClassBuilder"]
  980. }),
  981. globals.ClassBuilderTest);
  982. smalltalk.addMethod(
  983. smalltalk.method({
  984. selector: "tearDown",
  985. protocol: 'running',
  986. fn: function (){
  987. var self=this;
  988. function $Smalltalk(){return globals.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",{},globals.ClassBuilderTest)})},
  1000. args: [],
  1001. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  1002. messageSends: ["ifNotNil:", "removeClass:"],
  1003. referencedClasses: ["Smalltalk"]
  1004. }),
  1005. globals.ClassBuilderTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "testClassCopy",
  1009. protocol: 'tests',
  1010. fn: function (){
  1011. var self=this;
  1012. function $ObjectMock(){return globals.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",{},globals.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. globals.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 globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1054. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1055. function $ObjectMock2(){return globals.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},globals.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. globals.ClassBuilderTest);
  1103. smalltalk.addMethod(
  1104. smalltalk.method({
  1105. selector: "testClassMigrationWithClassInstanceVariables",
  1106. protocol: 'tests',
  1107. fn: function (){
  1108. var self=this;
  1109. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1110. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1111. function $Smalltalk(){return globals.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",{},globals.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. globals.ClassBuilderTest);
  1128. smalltalk.addMethod(
  1129. smalltalk.method({
  1130. selector: "testClassMigrationWithSubclasses",
  1131. protocol: 'tests',
  1132. fn: function (){
  1133. var self=this;
  1134. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1135. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1136. function $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1137. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1138. function $ObjectMock4(){return globals.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",{},globals.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. globals.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",{},globals.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. globals.ClassBuilderTest);
  1186. smalltalk.addClass('CollectionTest', globals.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},globals.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. globals.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",{},globals.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. globals.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",{},globals.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. globals.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",{},globals.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. globals.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",{},globals.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. globals.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",{},globals.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. globals.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",{},globals.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. globals.CollectionTest);
  1307. smalltalk.addMethod(
  1308. smalltalk.method({
  1309. selector: "isCollectionReadOnly",
  1310. protocol: 'testing',
  1311. fn: function (){
  1312. var self=this;
  1313. return false;
  1314. },
  1315. args: [],
  1316. source: "isCollectionReadOnly\x0a\x09^ false",
  1317. messageSends: [],
  1318. referencedClasses: []
  1319. }),
  1320. globals.CollectionTest);
  1321. smalltalk.addMethod(
  1322. smalltalk.method({
  1323. selector: "sampleNewValue",
  1324. protocol: 'fixture',
  1325. fn: function (){
  1326. var self=this;
  1327. return "N";
  1328. },
  1329. args: [],
  1330. 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'",
  1331. messageSends: [],
  1332. referencedClasses: []
  1333. }),
  1334. globals.CollectionTest);
  1335. smalltalk.addMethod(
  1336. smalltalk.method({
  1337. selector: "sampleNewValueAsCollection",
  1338. protocol: 'fixture',
  1339. fn: function (){
  1340. var self=this;
  1341. return smalltalk.withContext(function($ctx1) {
  1342. var $1;
  1343. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1344. return $1;
  1345. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)})},
  1346. args: [],
  1347. 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",
  1348. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1349. referencedClasses: []
  1350. }),
  1351. globals.CollectionTest);
  1352. smalltalk.addMethod(
  1353. smalltalk.method({
  1354. selector: "testAddAll",
  1355. protocol: 'tests',
  1356. fn: function (){
  1357. var self=this;
  1358. return smalltalk.withContext(function($ctx1) {
  1359. 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;
  1360. $2=self._collection();
  1361. $ctx1.sendIdx["collection"]=1;
  1362. $3=$2;
  1363. $5=self._collectionClass();
  1364. $ctx1.sendIdx["collectionClass"]=1;
  1365. $4=_st($5)._new();
  1366. $ctx1.sendIdx["new"]=1;
  1367. _st($3)._addAll_($4);
  1368. $ctx1.sendIdx["addAll:"]=1;
  1369. $6=_st($2)._yourself();
  1370. $ctx1.sendIdx["yourself"]=1;
  1371. $1=$6;
  1372. $7=self._collection();
  1373. $ctx1.sendIdx["collection"]=2;
  1374. self._assert_equals_($1,$7);
  1375. $ctx1.sendIdx["assert:equals:"]=1;
  1376. $10=self._collectionClass();
  1377. $ctx1.sendIdx["collectionClass"]=2;
  1378. $9=_st($10)._new();
  1379. $ctx1.sendIdx["new"]=2;
  1380. $11=$9;
  1381. $12=self._collection();
  1382. $ctx1.sendIdx["collection"]=3;
  1383. _st($11)._addAll_($12);
  1384. $ctx1.sendIdx["addAll:"]=2;
  1385. $13=_st($9)._yourself();
  1386. $ctx1.sendIdx["yourself"]=2;
  1387. $8=$13;
  1388. $14=self._collection();
  1389. $ctx1.sendIdx["collection"]=4;
  1390. self._assert_equals_($8,$14);
  1391. $ctx1.sendIdx["assert:equals:"]=2;
  1392. $17=self._collectionClass();
  1393. $ctx1.sendIdx["collectionClass"]=3;
  1394. $16=_st($17)._new();
  1395. $ctx1.sendIdx["new"]=3;
  1396. $18=$16;
  1397. $20=self._collectionClass();
  1398. $ctx1.sendIdx["collectionClass"]=4;
  1399. $19=_st($20)._new();
  1400. $ctx1.sendIdx["new"]=4;
  1401. _st($18)._addAll_($19);
  1402. $ctx1.sendIdx["addAll:"]=3;
  1403. $21=_st($16)._yourself();
  1404. $ctx1.sendIdx["yourself"]=3;
  1405. $15=$21;
  1406. self._assert_equals_($15,_st(self._collectionClass())._new());
  1407. $ctx1.sendIdx["assert:equals:"]=3;
  1408. $23=self._collection();
  1409. $ctx1.sendIdx["collection"]=5;
  1410. $24=$23;
  1411. $25=self._sampleNewValueAsCollection();
  1412. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1413. _st($24)._addAll_($25);
  1414. $ctx1.sendIdx["addAll:"]=4;
  1415. $26=_st($23)._yourself();
  1416. $ctx1.sendIdx["yourself"]=4;
  1417. $22=$26;
  1418. $27=self._collectionWithNewValue();
  1419. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1420. self._assert_equals_($22,$27);
  1421. $28=self._sampleNewValueAsCollection();
  1422. _st($28)._addAll_(self._collection());
  1423. $29=_st($28)._yourself();
  1424. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1425. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)})},
  1426. args: [],
  1427. 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",
  1428. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1429. referencedClasses: []
  1430. }),
  1431. globals.CollectionTest);
  1432. smalltalk.addMethod(
  1433. smalltalk.method({
  1434. selector: "testAllSatisfy",
  1435. protocol: 'tests',
  1436. fn: function (){
  1437. var self=this;
  1438. var collection,anyOne;
  1439. return smalltalk.withContext(function($ctx1) {
  1440. var $1;
  1441. collection=self._collection();
  1442. anyOne=_st(collection)._anyOne();
  1443. $1=_st(collection)._allSatisfy_((function(each){
  1444. return smalltalk.withContext(function($ctx2) {
  1445. return _st(collection)._includes_(each);
  1446. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1447. $ctx1.sendIdx["allSatisfy:"]=1;
  1448. self._assert_($1);
  1449. self._deny_(_st(collection)._allSatisfy_((function(each){
  1450. return smalltalk.withContext(function($ctx2) {
  1451. return _st(each).__tild_eq(anyOne);
  1452. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1453. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)})},
  1454. args: [],
  1455. 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 ])",
  1456. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1457. referencedClasses: []
  1458. }),
  1459. globals.CollectionTest);
  1460. smalltalk.addMethod(
  1461. smalltalk.method({
  1462. selector: "testAnyOne",
  1463. protocol: 'tests',
  1464. fn: function (){
  1465. var self=this;
  1466. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1467. return smalltalk.withContext(function($ctx1) {
  1468. var $2,$1;
  1469. self._should_raise_((function(){
  1470. return smalltalk.withContext(function($ctx2) {
  1471. return _st(_st(self._collectionClass())._new())._anyOne();
  1472. $ctx2.sendIdx["anyOne"]=1;
  1473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1474. $2=self._collection();
  1475. $ctx1.sendIdx["collection"]=1;
  1476. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1477. self._assert_($1);
  1478. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)})},
  1479. args: [],
  1480. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1481. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1482. referencedClasses: ["Error"]
  1483. }),
  1484. globals.CollectionTest);
  1485. smalltalk.addMethod(
  1486. smalltalk.method({
  1487. selector: "testAnySatisfy",
  1488. protocol: 'tests',
  1489. fn: function (){
  1490. var self=this;
  1491. var anyOne;
  1492. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1493. return smalltalk.withContext(function($ctx1) {
  1494. var $1,$3,$2;
  1495. $1=self._collection();
  1496. $ctx1.sendIdx["collection"]=1;
  1497. anyOne=_st($1)._anyOne();
  1498. $3=self._collection();
  1499. $ctx1.sendIdx["collection"]=2;
  1500. $2=_st($3)._anySatisfy_((function(each){
  1501. return smalltalk.withContext(function($ctx2) {
  1502. return _st(each).__eq(anyOne);
  1503. $ctx2.sendIdx["="]=1;
  1504. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1505. $ctx1.sendIdx["anySatisfy:"]=1;
  1506. self._assert_($2);
  1507. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1508. return smalltalk.withContext(function($ctx2) {
  1509. return _st(each).__eq(_st($Object())._new());
  1510. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1511. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  1512. args: [],
  1513. 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 ])",
  1514. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1515. referencedClasses: ["Object"]
  1516. }),
  1517. globals.CollectionTest);
  1518. smalltalk.addMethod(
  1519. smalltalk.method({
  1520. selector: "testAsArray",
  1521. protocol: 'tests',
  1522. fn: function (){
  1523. var self=this;
  1524. return smalltalk.withContext(function($ctx1) {
  1525. var $1;
  1526. $1=self._collection();
  1527. $ctx1.sendIdx["collection"]=1;
  1528. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1529. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)})},
  1530. args: [],
  1531. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1532. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1533. referencedClasses: []
  1534. }),
  1535. globals.CollectionTest);
  1536. smalltalk.addMethod(
  1537. smalltalk.method({
  1538. selector: "testAsOrderedCollection",
  1539. protocol: 'tests',
  1540. fn: function (){
  1541. var self=this;
  1542. return smalltalk.withContext(function($ctx1) {
  1543. var $1;
  1544. $1=self._collection();
  1545. $ctx1.sendIdx["collection"]=1;
  1546. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1547. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)})},
  1548. args: [],
  1549. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1550. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1551. referencedClasses: []
  1552. }),
  1553. globals.CollectionTest);
  1554. smalltalk.addMethod(
  1555. smalltalk.method({
  1556. selector: "testAsSet",
  1557. protocol: 'tests',
  1558. fn: function (){
  1559. var self=this;
  1560. var c,set;
  1561. return smalltalk.withContext(function($ctx1) {
  1562. c=self._collectionWithDuplicates();
  1563. set=_st(c)._asSet();
  1564. self._assert_equals_(_st(set)._size(),(5));
  1565. _st(c)._do_((function(each){
  1566. return smalltalk.withContext(function($ctx2) {
  1567. return self._assert_(_st(set)._includes_(each));
  1568. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1569. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)})},
  1570. args: [],
  1571. 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) ]",
  1572. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1573. referencedClasses: []
  1574. }),
  1575. globals.CollectionTest);
  1576. smalltalk.addMethod(
  1577. smalltalk.method({
  1578. selector: "testCollect",
  1579. protocol: 'tests',
  1580. fn: function (){
  1581. var self=this;
  1582. return smalltalk.withContext(function($ctx1) {
  1583. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1584. $2=self._collection();
  1585. $ctx1.sendIdx["collection"]=1;
  1586. $1=_st($2)._collect_((function(each){
  1587. return smalltalk.withContext(function($ctx2) {
  1588. return each;
  1589. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1590. $ctx1.sendIdx["collect:"]=1;
  1591. $3=self._collection();
  1592. $ctx1.sendIdx["collection"]=2;
  1593. self._assert_equals_($1,$3);
  1594. $ctx1.sendIdx["assert:equals:"]=1;
  1595. $5=self._collectionWithNewValue();
  1596. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1597. $4=_st($5)._collect_((function(each){
  1598. return smalltalk.withContext(function($ctx2) {
  1599. return each;
  1600. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1601. $ctx1.sendIdx["collect:"]=2;
  1602. self._assert_equals_($4,self._collectionWithNewValue());
  1603. $ctx1.sendIdx["assert:equals:"]=2;
  1604. $8=self._collectionClass();
  1605. $ctx1.sendIdx["collectionClass"]=1;
  1606. $7=_st($8)._new();
  1607. $ctx1.sendIdx["new"]=1;
  1608. $6=_st($7)._collect_((function(each){
  1609. return smalltalk.withContext(function($ctx2) {
  1610. return _st(each)._printString();
  1611. $ctx2.sendIdx["printString"]=1;
  1612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1613. $ctx1.sendIdx["collect:"]=3;
  1614. self._assert_equals_($6,_st(self._collectionClass())._new());
  1615. $ctx1.sendIdx["assert:equals:"]=3;
  1616. $11=self._collection();
  1617. $ctx1.sendIdx["collection"]=3;
  1618. $10=_st($11)._collect_((function(){
  1619. return smalltalk.withContext(function($ctx2) {
  1620. return self._sampleNewValue();
  1621. $ctx2.sendIdx["sampleNewValue"]=1;
  1622. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1623. $ctx1.sendIdx["collect:"]=4;
  1624. $9=_st($10)._detect_((function(){
  1625. return smalltalk.withContext(function($ctx2) {
  1626. return true;
  1627. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1628. self._assert_equals_($9,self._sampleNewValue());
  1629. $ctx1.sendIdx["assert:equals:"]=4;
  1630. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1631. return smalltalk.withContext(function($ctx2) {
  1632. return _st(each)._printString();
  1633. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1634. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)})},
  1635. args: [],
  1636. 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",
  1637. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1638. referencedClasses: []
  1639. }),
  1640. globals.CollectionTest);
  1641. smalltalk.addMethod(
  1642. smalltalk.method({
  1643. selector: "testComma",
  1644. protocol: 'tests',
  1645. fn: function (){
  1646. var self=this;
  1647. return smalltalk.withContext(function($ctx1) {
  1648. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1649. $2=self._collection();
  1650. $ctx1.sendIdx["collection"]=1;
  1651. $4=self._collectionClass();
  1652. $ctx1.sendIdx["collectionClass"]=1;
  1653. $3=_st($4)._new();
  1654. $ctx1.sendIdx["new"]=1;
  1655. $1=_st($2).__comma($3);
  1656. $ctx1.sendIdx[","]=1;
  1657. $5=self._collection();
  1658. $ctx1.sendIdx["collection"]=2;
  1659. self._assert_equals_($1,$5);
  1660. $ctx1.sendIdx["assert:equals:"]=1;
  1661. $8=self._collectionClass();
  1662. $ctx1.sendIdx["collectionClass"]=2;
  1663. $7=_st($8)._new();
  1664. $ctx1.sendIdx["new"]=2;
  1665. $9=self._collection();
  1666. $ctx1.sendIdx["collection"]=3;
  1667. $6=_st($7).__comma($9);
  1668. $ctx1.sendIdx[","]=2;
  1669. $10=self._collection();
  1670. $ctx1.sendIdx["collection"]=4;
  1671. self._assert_equals_($6,$10);
  1672. $ctx1.sendIdx["assert:equals:"]=2;
  1673. $13=self._collectionClass();
  1674. $ctx1.sendIdx["collectionClass"]=3;
  1675. $12=_st($13)._new();
  1676. $ctx1.sendIdx["new"]=3;
  1677. $15=self._collectionClass();
  1678. $ctx1.sendIdx["collectionClass"]=4;
  1679. $14=_st($15)._new();
  1680. $ctx1.sendIdx["new"]=4;
  1681. $11=_st($12).__comma($14);
  1682. $ctx1.sendIdx[","]=3;
  1683. self._assert_equals_($11,_st(self._collectionClass())._new());
  1684. $ctx1.sendIdx["assert:equals:"]=3;
  1685. $17=self._collection();
  1686. $ctx1.sendIdx["collection"]=5;
  1687. $18=self._sampleNewValueAsCollection();
  1688. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1689. $16=_st($17).__comma($18);
  1690. $ctx1.sendIdx[","]=4;
  1691. $19=self._collectionWithNewValue();
  1692. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1693. self._assert_equals_($16,$19);
  1694. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1695. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)})},
  1696. args: [],
  1697. 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",
  1698. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1699. referencedClasses: []
  1700. }),
  1701. globals.CollectionTest);
  1702. smalltalk.addMethod(
  1703. smalltalk.method({
  1704. selector: "testDetect",
  1705. protocol: 'tests',
  1706. fn: function (){
  1707. var self=this;
  1708. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1709. return smalltalk.withContext(function($ctx1) {
  1710. var $1,$2,$3,$4,$6,$5,$7;
  1711. self._shouldnt_raise_((function(){
  1712. return smalltalk.withContext(function($ctx2) {
  1713. $1=self._collection();
  1714. $ctx2.sendIdx["collection"]=1;
  1715. return _st($1)._detect_((function(){
  1716. return smalltalk.withContext(function($ctx3) {
  1717. return true;
  1718. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1719. $ctx2.sendIdx["detect:"]=1;
  1720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1721. self._should_raise_((function(){
  1722. return smalltalk.withContext(function($ctx2) {
  1723. $2=self._collection();
  1724. $ctx2.sendIdx["collection"]=2;
  1725. return _st($2)._detect_((function(){
  1726. return smalltalk.withContext(function($ctx3) {
  1727. return false;
  1728. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  1729. $ctx2.sendIdx["detect:"]=2;
  1730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1731. $ctx1.sendIdx["should:raise:"]=1;
  1732. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1733. return smalltalk.withContext(function($ctx2) {
  1734. return true;
  1735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1736. $ctx1.sendIdx["detect:"]=3;
  1737. $4=self._sampleNewValue();
  1738. $ctx1.sendIdx["sampleNewValue"]=1;
  1739. self._assert_equals_($3,$4);
  1740. $ctx1.sendIdx["assert:equals:"]=1;
  1741. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1742. return smalltalk.withContext(function($ctx2) {
  1743. $6=self._sampleNewValue();
  1744. $ctx2.sendIdx["sampleNewValue"]=2;
  1745. return _st(each).__eq($6);
  1746. $ctx2.sendIdx["="]=1;
  1747. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1748. $ctx1.sendIdx["detect:"]=4;
  1749. $7=self._sampleNewValue();
  1750. $ctx1.sendIdx["sampleNewValue"]=3;
  1751. self._assert_equals_($5,$7);
  1752. self._should_raise_((function(){
  1753. return smalltalk.withContext(function($ctx2) {
  1754. return _st(self._collection())._detect_((function(each){
  1755. return smalltalk.withContext(function($ctx3) {
  1756. return _st(each).__eq(self._sampleNewValue());
  1757. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1759. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)})},
  1760. args: [],
  1761. 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",
  1762. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1763. referencedClasses: ["Error"]
  1764. }),
  1765. globals.CollectionTest);
  1766. smalltalk.addMethod(
  1767. smalltalk.method({
  1768. selector: "testDetectIfNone",
  1769. protocol: 'tests',
  1770. fn: function (){
  1771. var self=this;
  1772. var sentinel;
  1773. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1774. return smalltalk.withContext(function($ctx1) {
  1775. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1776. sentinel=_st($Object())._new();
  1777. $3=self._collection();
  1778. $ctx1.sendIdx["collection"]=1;
  1779. $2=_st($3)._detect_ifNone_((function(){
  1780. return smalltalk.withContext(function($ctx2) {
  1781. return true;
  1782. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  1783. return smalltalk.withContext(function($ctx2) {
  1784. return sentinel;
  1785. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1786. $ctx1.sendIdx["detect:ifNone:"]=1;
  1787. $1=_st($2).__tild_eq(sentinel);
  1788. self._assert_($1);
  1789. $5=self._collection();
  1790. $ctx1.sendIdx["collection"]=2;
  1791. $4=_st($5)._detect_ifNone_((function(){
  1792. return smalltalk.withContext(function($ctx2) {
  1793. return false;
  1794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),(function(){
  1795. return smalltalk.withContext(function($ctx2) {
  1796. return sentinel;
  1797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1798. $ctx1.sendIdx["detect:ifNone:"]=2;
  1799. self._assert_equals_($4,sentinel);
  1800. $ctx1.sendIdx["assert:equals:"]=1;
  1801. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1802. return smalltalk.withContext(function($ctx2) {
  1803. return true;
  1804. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1805. return smalltalk.withContext(function($ctx2) {
  1806. return sentinel;
  1807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1808. $ctx1.sendIdx["detect:ifNone:"]=3;
  1809. $7=self._sampleNewValue();
  1810. $ctx1.sendIdx["sampleNewValue"]=1;
  1811. self._assert_equals_($6,$7);
  1812. $ctx1.sendIdx["assert:equals:"]=2;
  1813. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1814. return smalltalk.withContext(function($ctx2) {
  1815. $9=self._sampleNewValue();
  1816. $ctx2.sendIdx["sampleNewValue"]=2;
  1817. return _st(each).__eq($9);
  1818. $ctx2.sendIdx["="]=1;
  1819. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1820. return smalltalk.withContext(function($ctx2) {
  1821. return sentinel;
  1822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1823. $ctx1.sendIdx["detect:ifNone:"]=4;
  1824. $10=self._sampleNewValue();
  1825. $ctx1.sendIdx["sampleNewValue"]=3;
  1826. self._assert_equals_($8,$10);
  1827. $ctx1.sendIdx["assert:equals:"]=3;
  1828. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1829. return smalltalk.withContext(function($ctx2) {
  1830. return _st(each).__eq(self._sampleNewValue());
  1831. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1832. return smalltalk.withContext(function($ctx2) {
  1833. return sentinel;
  1834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})})),sentinel);
  1835. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)})},
  1836. args: [],
  1837. 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",
  1838. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1839. referencedClasses: ["Object"]
  1840. }),
  1841. globals.CollectionTest);
  1842. smalltalk.addMethod(
  1843. smalltalk.method({
  1844. selector: "testDo",
  1845. protocol: 'tests',
  1846. fn: function (){
  1847. var self=this;
  1848. var newCollection;
  1849. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1850. return smalltalk.withContext(function($ctx1) {
  1851. var $1,$2;
  1852. newCollection=_st($OrderedCollection())._new();
  1853. $ctx1.sendIdx["new"]=1;
  1854. $1=self._collection();
  1855. $ctx1.sendIdx["collection"]=1;
  1856. _st($1)._do_((function(each){
  1857. return smalltalk.withContext(function($ctx2) {
  1858. return _st(newCollection)._add_(each);
  1859. $ctx2.sendIdx["add:"]=1;
  1860. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1861. $ctx1.sendIdx["do:"]=1;
  1862. self._assertSameContents_as_(self._collection(),newCollection);
  1863. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1864. newCollection=_st($OrderedCollection())._new();
  1865. $2=self._collectionWithDuplicates();
  1866. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1867. _st($2)._do_((function(each){
  1868. return smalltalk.withContext(function($ctx2) {
  1869. return _st(newCollection)._add_(each);
  1870. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1871. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1872. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)})},
  1873. args: [],
  1874. 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",
  1875. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1876. referencedClasses: ["OrderedCollection"]
  1877. }),
  1878. globals.CollectionTest);
  1879. smalltalk.addMethod(
  1880. smalltalk.method({
  1881. selector: "testIfEmptyFamily",
  1882. protocol: 'tests',
  1883. fn: function (){
  1884. var self=this;
  1885. return smalltalk.withContext(function($ctx1) {
  1886. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1887. $3=self._collectionClass();
  1888. $ctx1.sendIdx["collectionClass"]=1;
  1889. $2=_st($3)._new();
  1890. $ctx1.sendIdx["new"]=1;
  1891. $1=_st($2)._ifEmpty_((function(){
  1892. return smalltalk.withContext(function($ctx2) {
  1893. return (42);
  1894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1895. $ctx1.sendIdx["ifEmpty:"]=1;
  1896. self._assert_equals_($1,(42));
  1897. $ctx1.sendIdx["assert:equals:"]=1;
  1898. $5=self._collection();
  1899. $ctx1.sendIdx["collection"]=1;
  1900. $4=_st($5)._ifEmpty_((function(){
  1901. return smalltalk.withContext(function($ctx2) {
  1902. return (42);
  1903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1904. $6=self._collection();
  1905. $ctx1.sendIdx["collection"]=2;
  1906. self._assert_equals_($4,$6);
  1907. $ctx1.sendIdx["assert:equals:"]=2;
  1908. $9=self._collectionClass();
  1909. $ctx1.sendIdx["collectionClass"]=2;
  1910. $8=_st($9)._new();
  1911. $ctx1.sendIdx["new"]=2;
  1912. $7=_st($8)._ifNotEmpty_((function(){
  1913. return smalltalk.withContext(function($ctx2) {
  1914. return (42);
  1915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1916. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1917. $11=self._collectionClass();
  1918. $ctx1.sendIdx["collectionClass"]=3;
  1919. $10=_st($11)._new();
  1920. $ctx1.sendIdx["new"]=3;
  1921. self._assert_equals_($7,$10);
  1922. $ctx1.sendIdx["assert:equals:"]=3;
  1923. $13=self._collection();
  1924. $ctx1.sendIdx["collection"]=3;
  1925. $12=_st($13)._ifNotEmpty_((function(){
  1926. return smalltalk.withContext(function($ctx2) {
  1927. return (42);
  1928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1929. self._assert_equals_($12,(42));
  1930. $ctx1.sendIdx["assert:equals:"]=4;
  1931. $16=self._collectionClass();
  1932. $ctx1.sendIdx["collectionClass"]=4;
  1933. $15=_st($16)._new();
  1934. $ctx1.sendIdx["new"]=4;
  1935. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1936. return smalltalk.withContext(function($ctx2) {
  1937. return (42);
  1938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1939. return smalltalk.withContext(function($ctx2) {
  1940. return (999);
  1941. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1942. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1943. self._assert_equals_($14,(42));
  1944. $ctx1.sendIdx["assert:equals:"]=5;
  1945. $18=self._collection();
  1946. $ctx1.sendIdx["collection"]=4;
  1947. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1948. return smalltalk.withContext(function($ctx2) {
  1949. return (42);
  1950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1951. return smalltalk.withContext(function($ctx2) {
  1952. return (999);
  1953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1954. self._assert_equals_($17,(999));
  1955. $ctx1.sendIdx["assert:equals:"]=6;
  1956. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1957. return smalltalk.withContext(function($ctx2) {
  1958. return (42);
  1959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1960. return smalltalk.withContext(function($ctx2) {
  1961. return (999);
  1962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1963. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1964. self._assert_equals_($19,(999));
  1965. $ctx1.sendIdx["assert:equals:"]=7;
  1966. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1967. return smalltalk.withContext(function($ctx2) {
  1968. return (42);
  1969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1970. return smalltalk.withContext(function($ctx2) {
  1971. return (999);
  1972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1973. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)})},
  1974. args: [],
  1975. 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",
  1976. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1977. referencedClasses: []
  1978. }),
  1979. globals.CollectionTest);
  1980. smalltalk.addMethod(
  1981. smalltalk.method({
  1982. selector: "testIsEmpty",
  1983. protocol: 'tests',
  1984. fn: function (){
  1985. var self=this;
  1986. return smalltalk.withContext(function($ctx1) {
  1987. var $1;
  1988. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1989. $ctx1.sendIdx["isEmpty"]=1;
  1990. self._assert_($1);
  1991. self._deny_(_st(self._collection())._isEmpty());
  1992. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)})},
  1993. args: [],
  1994. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1995. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1996. referencedClasses: []
  1997. }),
  1998. globals.CollectionTest);
  1999. smalltalk.addMethod(
  2000. smalltalk.method({
  2001. selector: "testNoneSatisfy",
  2002. protocol: 'tests',
  2003. fn: function (){
  2004. var self=this;
  2005. var anyOne;
  2006. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2007. return smalltalk.withContext(function($ctx1) {
  2008. var $1,$3,$2;
  2009. $1=self._collection();
  2010. $ctx1.sendIdx["collection"]=1;
  2011. anyOne=_st($1)._anyOne();
  2012. $3=self._collection();
  2013. $ctx1.sendIdx["collection"]=2;
  2014. $2=_st($3)._noneSatisfy_((function(each){
  2015. return smalltalk.withContext(function($ctx2) {
  2016. return _st(each).__eq(anyOne);
  2017. $ctx2.sendIdx["="]=1;
  2018. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2019. $ctx1.sendIdx["noneSatisfy:"]=1;
  2020. self._deny_($2);
  2021. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2022. return smalltalk.withContext(function($ctx2) {
  2023. return _st(each).__eq(_st($Object())._new());
  2024. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2025. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  2026. args: [],
  2027. 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 ])",
  2028. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2029. referencedClasses: ["Object"]
  2030. }),
  2031. globals.CollectionTest);
  2032. smalltalk.addMethod(
  2033. smalltalk.method({
  2034. selector: "testRemoveAll",
  2035. protocol: 'tests',
  2036. fn: function (){
  2037. var self=this;
  2038. return smalltalk.withContext(function($ctx1) {
  2039. var $1,$2;
  2040. $1=self._collection();
  2041. _st($1)._removeAll();
  2042. $2=_st($1)._yourself();
  2043. self._assert_equals_($2,_st(self._collectionClass())._new());
  2044. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)})},
  2045. args: [],
  2046. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2047. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2048. referencedClasses: []
  2049. }),
  2050. globals.CollectionTest);
  2051. smalltalk.addMethod(
  2052. smalltalk.method({
  2053. selector: "testSelect",
  2054. protocol: 'tests',
  2055. fn: function (){
  2056. var self=this;
  2057. return smalltalk.withContext(function($ctx1) {
  2058. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2059. $2=self._collection();
  2060. $ctx1.sendIdx["collection"]=1;
  2061. $1=_st($2)._select_((function(){
  2062. return smalltalk.withContext(function($ctx2) {
  2063. return false;
  2064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2065. $ctx1.sendIdx["select:"]=1;
  2066. $4=self._collectionClass();
  2067. $ctx1.sendIdx["collectionClass"]=1;
  2068. $3=_st($4)._new();
  2069. $ctx1.sendIdx["new"]=1;
  2070. self._assert_equals_($1,$3);
  2071. $ctx1.sendIdx["assert:equals:"]=1;
  2072. $6=self._collection();
  2073. $ctx1.sendIdx["collection"]=2;
  2074. $5=_st($6)._select_((function(){
  2075. return smalltalk.withContext(function($ctx2) {
  2076. return true;
  2077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2078. $ctx1.sendIdx["select:"]=2;
  2079. $7=self._collection();
  2080. $ctx1.sendIdx["collection"]=3;
  2081. self._assert_equals_($5,$7);
  2082. $ctx1.sendIdx["assert:equals:"]=2;
  2083. $9=self._collectionWithNewValue();
  2084. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2085. $8=_st($9)._select_((function(each){
  2086. return smalltalk.withContext(function($ctx2) {
  2087. $10=self._sampleNewValue();
  2088. $ctx2.sendIdx["sampleNewValue"]=1;
  2089. return _st(each).__eq($10);
  2090. $ctx2.sendIdx["="]=1;
  2091. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2092. $ctx1.sendIdx["select:"]=3;
  2093. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2094. $ctx1.sendIdx["assert:equals:"]=3;
  2095. $12=self._collectionWithNewValue();
  2096. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2097. $11=_st($12)._select_((function(each){
  2098. return smalltalk.withContext(function($ctx2) {
  2099. $13=self._sampleNewValue();
  2100. $ctx2.sendIdx["sampleNewValue"]=2;
  2101. return _st(each).__tild_eq($13);
  2102. $ctx2.sendIdx["~="]=1;
  2103. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2104. $ctx1.sendIdx["select:"]=4;
  2105. $14=self._collection();
  2106. $ctx1.sendIdx["collection"]=4;
  2107. self._assert_equals_($11,$14);
  2108. $ctx1.sendIdx["assert:equals:"]=4;
  2109. $16=self._collection();
  2110. $ctx1.sendIdx["collection"]=5;
  2111. $15=_st($16)._select_((function(each){
  2112. return smalltalk.withContext(function($ctx2) {
  2113. $17=self._sampleNewValue();
  2114. $ctx2.sendIdx["sampleNewValue"]=3;
  2115. return _st(each).__eq($17);
  2116. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2117. $ctx1.sendIdx["select:"]=5;
  2118. self._assert_equals_($15,_st(self._collectionClass())._new());
  2119. $ctx1.sendIdx["assert:equals:"]=5;
  2120. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2121. return smalltalk.withContext(function($ctx2) {
  2122. return _st(each).__tild_eq(self._sampleNewValue());
  2123. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2124. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)})},
  2125. args: [],
  2126. 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",
  2127. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2128. referencedClasses: []
  2129. }),
  2130. globals.CollectionTest);
  2131. smalltalk.addMethod(
  2132. smalltalk.method({
  2133. selector: "testSize",
  2134. protocol: 'tests',
  2135. fn: function (){
  2136. var self=this;
  2137. return smalltalk.withContext(function($ctx1) {
  2138. var $1,$2;
  2139. $1=_st(_st(self._collectionClass())._new())._size();
  2140. $ctx1.sendIdx["size"]=1;
  2141. self._assert_equals_($1,(0));
  2142. $ctx1.sendIdx["assert:equals:"]=1;
  2143. $2=_st(self._sampleNewValueAsCollection())._size();
  2144. $ctx1.sendIdx["size"]=2;
  2145. self._assert_equals_($2,(1));
  2146. $ctx1.sendIdx["assert:equals:"]=2;
  2147. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2148. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)})},
  2149. args: [],
  2150. 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",
  2151. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2152. referencedClasses: []
  2153. }),
  2154. globals.CollectionTest);
  2155. smalltalk.addMethod(
  2156. smalltalk.method({
  2157. selector: "collectionClass",
  2158. protocol: 'fixture',
  2159. fn: function (){
  2160. var self=this;
  2161. return nil;
  2162. },
  2163. args: [],
  2164. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2165. messageSends: [],
  2166. referencedClasses: []
  2167. }),
  2168. globals.CollectionTest.klass);
  2169. smalltalk.addMethod(
  2170. smalltalk.method({
  2171. selector: "isAbstract",
  2172. protocol: 'testing',
  2173. fn: function (){
  2174. var self=this;
  2175. return smalltalk.withContext(function($ctx1) {
  2176. var $1;
  2177. $1=_st(self._collectionClass())._isNil();
  2178. return $1;
  2179. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)})},
  2180. args: [],
  2181. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2182. messageSends: ["isNil", "collectionClass"],
  2183. referencedClasses: []
  2184. }),
  2185. globals.CollectionTest.klass);
  2186. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  2187. smalltalk.addMethod(
  2188. smalltalk.method({
  2189. selector: "collectionWithNewValue",
  2190. protocol: 'fixture',
  2191. fn: function (){
  2192. var self=this;
  2193. return smalltalk.withContext(function($ctx1) {
  2194. self._subclassResponsibility();
  2195. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)})},
  2196. args: [],
  2197. 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",
  2198. messageSends: ["subclassResponsibility"],
  2199. referencedClasses: []
  2200. }),
  2201. globals.IndexableCollectionTest);
  2202. smalltalk.addMethod(
  2203. smalltalk.method({
  2204. selector: "sampleNewIndex",
  2205. protocol: 'fixture',
  2206. fn: function (){
  2207. var self=this;
  2208. return smalltalk.withContext(function($ctx1) {
  2209. self._subclassResponsibility();
  2210. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)})},
  2211. args: [],
  2212. 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",
  2213. messageSends: ["subclassResponsibility"],
  2214. referencedClasses: []
  2215. }),
  2216. globals.IndexableCollectionTest);
  2217. smalltalk.addMethod(
  2218. smalltalk.method({
  2219. selector: "sampleNonIndexesDo:",
  2220. protocol: 'fixture',
  2221. fn: function (aBlock){
  2222. var self=this;
  2223. return smalltalk.withContext(function($ctx1) {
  2224. self._subclassResponsibility();
  2225. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2226. args: ["aBlock"],
  2227. 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",
  2228. messageSends: ["subclassResponsibility"],
  2229. referencedClasses: []
  2230. }),
  2231. globals.IndexableCollectionTest);
  2232. smalltalk.addMethod(
  2233. smalltalk.method({
  2234. selector: "samplesDo:",
  2235. protocol: 'fixture',
  2236. fn: function (aBlock){
  2237. var self=this;
  2238. return smalltalk.withContext(function($ctx1) {
  2239. self._subclassResponsibility();
  2240. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2241. args: ["aBlock"],
  2242. 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",
  2243. messageSends: ["subclassResponsibility"],
  2244. referencedClasses: []
  2245. }),
  2246. globals.IndexableCollectionTest);
  2247. smalltalk.addMethod(
  2248. smalltalk.method({
  2249. selector: "testAt",
  2250. protocol: 'tests',
  2251. fn: function (){
  2252. var self=this;
  2253. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2254. return smalltalk.withContext(function($ctx1) {
  2255. var $1;
  2256. self._nonIndexesDo_((function(each){
  2257. return smalltalk.withContext(function($ctx2) {
  2258. return self._should_raise_((function(){
  2259. return smalltalk.withContext(function($ctx3) {
  2260. $1=self._collection();
  2261. $ctx3.sendIdx["collection"]=1;
  2262. return _st($1)._at_(each);
  2263. $ctx3.sendIdx["at:"]=1;
  2264. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2265. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2266. self._samplesDo_((function(index,value){
  2267. return smalltalk.withContext(function($ctx2) {
  2268. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2269. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2270. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)})},
  2271. args: [],
  2272. 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 ]",
  2273. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2274. referencedClasses: ["Error"]
  2275. }),
  2276. globals.IndexableCollectionTest);
  2277. smalltalk.addMethod(
  2278. smalltalk.method({
  2279. selector: "testAtIfAbsent",
  2280. protocol: 'tests',
  2281. fn: function (){
  2282. var self=this;
  2283. return smalltalk.withContext(function($ctx1) {
  2284. var $2,$1,$3;
  2285. self._nonIndexesDo_((function(each){
  2286. return smalltalk.withContext(function($ctx2) {
  2287. $2=self._collection();
  2288. $ctx2.sendIdx["collection"]=1;
  2289. $1=_st($2)._at_ifAbsent_(each,(function(){
  2290. return smalltalk.withContext(function($ctx3) {
  2291. return self._sampleNewValue();
  2292. $ctx3.sendIdx["sampleNewValue"]=1;
  2293. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2294. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2295. $3=self._sampleNewValue();
  2296. $ctx2.sendIdx["sampleNewValue"]=2;
  2297. return self._assert_equals_($1,$3);
  2298. $ctx2.sendIdx["assert:equals:"]=1;
  2299. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2300. self._samplesDo_((function(index,value){
  2301. return smalltalk.withContext(function($ctx2) {
  2302. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2303. return smalltalk.withContext(function($ctx3) {
  2304. return self._sampleNewValue();
  2305. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2306. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2307. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)})},
  2308. args: [],
  2309. 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 ].",
  2310. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2311. referencedClasses: []
  2312. }),
  2313. globals.IndexableCollectionTest);
  2314. smalltalk.addMethod(
  2315. smalltalk.method({
  2316. selector: "testAtIfAbsentPut",
  2317. protocol: 'tests',
  2318. fn: function (){
  2319. var self=this;
  2320. var newCollection;
  2321. return smalltalk.withContext(function($ctx1) {
  2322. var $1;
  2323. newCollection=self._collection();
  2324. $ctx1.sendIdx["collection"]=1;
  2325. self._samplesDo_((function(index,value){
  2326. return smalltalk.withContext(function($ctx2) {
  2327. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2328. return smalltalk.withContext(function($ctx3) {
  2329. return self._sampleNewValue();
  2330. $ctx3.sendIdx["sampleNewValue"]=1;
  2331. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2332. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2333. return self._assert_equals_($1,value);
  2334. $ctx2.sendIdx["assert:equals:"]=1;
  2335. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2336. self._assert_equals_(newCollection,self._collection());
  2337. $ctx1.sendIdx["assert:equals:"]=2;
  2338. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2339. return smalltalk.withContext(function($ctx2) {
  2340. return self._sampleNewValue();
  2341. $ctx2.sendIdx["sampleNewValue"]=2;
  2342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2343. $ctx1.sendIdx["assert:equals:"]=3;
  2344. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2345. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2346. args: [],
  2347. 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",
  2348. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2349. referencedClasses: []
  2350. }),
  2351. globals.IndexableCollectionTest);
  2352. smalltalk.addMethod(
  2353. smalltalk.method({
  2354. selector: "testAtIfPresent",
  2355. protocol: 'tests',
  2356. fn: function (){
  2357. var self=this;
  2358. var visited,sentinel;
  2359. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2360. return smalltalk.withContext(function($ctx1) {
  2361. var $2,$1,$4,$3;
  2362. sentinel=_st($Object())._new();
  2363. self._nonIndexesDo_((function(each){
  2364. return smalltalk.withContext(function($ctx2) {
  2365. visited=nil;
  2366. visited;
  2367. $2=self._collection();
  2368. $ctx2.sendIdx["collection"]=1;
  2369. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2370. return smalltalk.withContext(function($ctx3) {
  2371. visited=value1;
  2372. visited;
  2373. return sentinel;
  2374. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}));
  2375. $ctx2.sendIdx["at:ifPresent:"]=1;
  2376. self._assert_equals_($1,nil);
  2377. $ctx2.sendIdx["assert:equals:"]=1;
  2378. return self._assert_(_st(visited)._isNil());
  2379. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2380. self._samplesDo_((function(index,value){
  2381. return smalltalk.withContext(function($ctx2) {
  2382. visited=nil;
  2383. visited;
  2384. $4=self._collection();
  2385. $ctx2.sendIdx["collection"]=2;
  2386. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2387. return smalltalk.withContext(function($ctx3) {
  2388. visited=value2;
  2389. visited;
  2390. return sentinel;
  2391. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,4)})}));
  2392. self._assert_equals_($3,sentinel);
  2393. $ctx2.sendIdx["assert:equals:"]=2;
  2394. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2395. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2396. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2397. args: [],
  2398. 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) ]",
  2399. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2400. referencedClasses: ["Object"]
  2401. }),
  2402. globals.IndexableCollectionTest);
  2403. smalltalk.addMethod(
  2404. smalltalk.method({
  2405. selector: "testAtIfPresentIfAbsent",
  2406. protocol: 'tests',
  2407. fn: function (){
  2408. var self=this;
  2409. var visited,sentinel;
  2410. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2411. return smalltalk.withContext(function($ctx1) {
  2412. var $2,$1,$3,$5,$4;
  2413. sentinel=_st($Object())._new();
  2414. self._nonIndexesDo_((function(each){
  2415. return smalltalk.withContext(function($ctx2) {
  2416. visited=nil;
  2417. visited;
  2418. $2=self._collection();
  2419. $ctx2.sendIdx["collection"]=1;
  2420. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2421. return smalltalk.withContext(function($ctx3) {
  2422. visited=value1;
  2423. visited;
  2424. return sentinel;
  2425. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}),(function(){
  2426. return smalltalk.withContext(function($ctx3) {
  2427. return self._sampleNewValue();
  2428. $ctx3.sendIdx["sampleNewValue"]=1;
  2429. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2430. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2431. $3=self._sampleNewValue();
  2432. $ctx2.sendIdx["sampleNewValue"]=2;
  2433. self._assert_equals_($1,$3);
  2434. $ctx2.sendIdx["assert:equals:"]=1;
  2435. return self._assert_(_st(visited)._isNil());
  2436. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2437. self._samplesDo_((function(index,value){
  2438. return smalltalk.withContext(function($ctx2) {
  2439. visited=nil;
  2440. visited;
  2441. $5=self._collection();
  2442. $ctx2.sendIdx["collection"]=2;
  2443. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2444. return smalltalk.withContext(function($ctx3) {
  2445. visited=value2;
  2446. visited;
  2447. return sentinel;
  2448. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,5)})}),(function(){
  2449. return smalltalk.withContext(function($ctx3) {
  2450. return self._sampleNewValue();
  2451. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2452. self._assert_equals_($4,sentinel);
  2453. $ctx2.sendIdx["assert:equals:"]=2;
  2454. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2455. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2456. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2457. args: [],
  2458. 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) ]",
  2459. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2460. referencedClasses: ["Object"]
  2461. }),
  2462. globals.IndexableCollectionTest);
  2463. smalltalk.addMethod(
  2464. smalltalk.method({
  2465. selector: "testAtPut",
  2466. protocol: 'tests',
  2467. fn: function (){
  2468. var self=this;
  2469. var newCollection;
  2470. return smalltalk.withContext(function($ctx1) {
  2471. newCollection=self._collection();
  2472. $ctx1.sendIdx["collection"]=1;
  2473. self._samplesDo_((function(index,value){
  2474. return smalltalk.withContext(function($ctx2) {
  2475. return _st(newCollection)._at_put_(index,value);
  2476. $ctx2.sendIdx["at:put:"]=1;
  2477. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2478. self._assert_equals_(newCollection,self._collection());
  2479. $ctx1.sendIdx["assert:equals:"]=1;
  2480. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2481. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2482. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2483. args: [],
  2484. 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",
  2485. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2486. referencedClasses: []
  2487. }),
  2488. globals.IndexableCollectionTest);
  2489. smalltalk.addMethod(
  2490. smalltalk.method({
  2491. selector: "testEquality",
  2492. protocol: 'tests',
  2493. fn: function (){
  2494. var self=this;
  2495. return smalltalk.withContext(function($ctx1) {
  2496. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2497. $2=self._collectionClass();
  2498. $ctx1.sendIdx["collectionClass"]=1;
  2499. $1=_st($2)._new();
  2500. $ctx1.sendIdx["new"]=1;
  2501. $4=self._collectionClass();
  2502. $ctx1.sendIdx["collectionClass"]=2;
  2503. $3=_st($4)._new();
  2504. $ctx1.sendIdx["new"]=2;
  2505. self._assert_equals_($1,$3);
  2506. $ctx1.sendIdx["assert:equals:"]=1;
  2507. $5=self._collection();
  2508. $ctx1.sendIdx["collection"]=1;
  2509. $6=self._collection();
  2510. $ctx1.sendIdx["collection"]=2;
  2511. self._assert_equals_($5,$6);
  2512. $ctx1.sendIdx["assert:equals:"]=2;
  2513. $7=self._collectionWithNewValue();
  2514. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2515. self._assert_equals_($7,self._collectionWithNewValue());
  2516. $10=self._collectionClass();
  2517. $ctx1.sendIdx["collectionClass"]=3;
  2518. $9=_st($10)._new();
  2519. $ctx1.sendIdx["new"]=3;
  2520. $11=self._collection();
  2521. $ctx1.sendIdx["collection"]=3;
  2522. $8=_st($9).__eq($11);
  2523. $ctx1.sendIdx["="]=1;
  2524. self._deny_($8);
  2525. $ctx1.sendIdx["deny:"]=1;
  2526. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2527. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)})},
  2528. args: [],
  2529. 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",
  2530. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2531. referencedClasses: []
  2532. }),
  2533. globals.IndexableCollectionTest);
  2534. smalltalk.addMethod(
  2535. smalltalk.method({
  2536. selector: "testIndexOf",
  2537. protocol: 'tests',
  2538. fn: function (){
  2539. var self=this;
  2540. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2541. return smalltalk.withContext(function($ctx1) {
  2542. var $1;
  2543. self._should_raise_((function(){
  2544. return smalltalk.withContext(function($ctx2) {
  2545. $1=self._collection();
  2546. $ctx2.sendIdx["collection"]=1;
  2547. return _st($1)._indexOf_(self._sampleNewValue());
  2548. $ctx2.sendIdx["indexOf:"]=1;
  2549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2550. self._samplesDo_((function(index,value){
  2551. return smalltalk.withContext(function($ctx2) {
  2552. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2553. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2554. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)})},
  2555. args: [],
  2556. 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 ]",
  2557. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2558. referencedClasses: ["Error"]
  2559. }),
  2560. globals.IndexableCollectionTest);
  2561. smalltalk.addMethod(
  2562. smalltalk.method({
  2563. selector: "testIndexOfWithNull",
  2564. protocol: 'tests',
  2565. fn: function (){
  2566. var self=this;
  2567. var jsNull;
  2568. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2569. return smalltalk.withContext(function($ctx1) {
  2570. var $1,$2;
  2571. jsNull=_st($JSON())._parse_("null");
  2572. self._samplesDo_((function(index,value){
  2573. return smalltalk.withContext(function($ctx2) {
  2574. $1=self._collection();
  2575. _st($1)._at_put_(index,jsNull);
  2576. $2=_st($1)._indexOf_(jsNull);
  2577. return self._assert_equals_($2,index);
  2578. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2579. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)})},
  2580. args: [],
  2581. 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 ]",
  2582. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2583. referencedClasses: ["JSON"]
  2584. }),
  2585. globals.IndexableCollectionTest);
  2586. smalltalk.addMethod(
  2587. smalltalk.method({
  2588. selector: "testWithIndexDo",
  2589. protocol: 'tests',
  2590. fn: function (){
  2591. var self=this;
  2592. var collection;
  2593. return smalltalk.withContext(function($ctx1) {
  2594. collection=self._collection();
  2595. $ctx1.sendIdx["collection"]=1;
  2596. _st(self._collection())._withIndexDo_((function(each,index){
  2597. return smalltalk.withContext(function($ctx2) {
  2598. return self._assert_equals_(_st(collection)._at_(index),each);
  2599. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2600. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)})},
  2601. args: [],
  2602. 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 ]",
  2603. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2604. referencedClasses: []
  2605. }),
  2606. globals.IndexableCollectionTest);
  2607. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  2608. smalltalk.addMethod(
  2609. smalltalk.method({
  2610. selector: "collectionKeys",
  2611. protocol: 'fixture',
  2612. fn: function (){
  2613. var self=this;
  2614. return smalltalk.withContext(function($ctx1) {
  2615. self._subclassResponsibility();
  2616. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)})},
  2617. args: [],
  2618. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2619. messageSends: ["subclassResponsibility"],
  2620. referencedClasses: []
  2621. }),
  2622. globals.AssociativeCollectionTest);
  2623. smalltalk.addMethod(
  2624. smalltalk.method({
  2625. selector: "collectionValues",
  2626. protocol: 'fixture',
  2627. fn: function (){
  2628. var self=this;
  2629. return smalltalk.withContext(function($ctx1) {
  2630. self._subclassResponsibility();
  2631. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)})},
  2632. args: [],
  2633. source: "collectionValues\x0a\x09self subclassResponsibility",
  2634. messageSends: ["subclassResponsibility"],
  2635. referencedClasses: []
  2636. }),
  2637. globals.AssociativeCollectionTest);
  2638. smalltalk.addMethod(
  2639. smalltalk.method({
  2640. selector: "nonIndexesDo:",
  2641. protocol: 'fixture',
  2642. fn: function (aBlock){
  2643. var self=this;
  2644. return smalltalk.withContext(function($ctx1) {
  2645. _st(aBlock)._value_((5));
  2646. $ctx1.sendIdx["value:"]=1;
  2647. _st(aBlock)._value_("z");
  2648. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2649. args: ["aBlock"],
  2650. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2651. messageSends: ["value:"],
  2652. referencedClasses: []
  2653. }),
  2654. globals.AssociativeCollectionTest);
  2655. smalltalk.addMethod(
  2656. smalltalk.method({
  2657. selector: "sampleNewIndex",
  2658. protocol: 'fixture',
  2659. fn: function (){
  2660. var self=this;
  2661. return "new";
  2662. },
  2663. args: [],
  2664. source: "sampleNewIndex\x0a\x09^ 'new'",
  2665. messageSends: [],
  2666. referencedClasses: []
  2667. }),
  2668. globals.AssociativeCollectionTest);
  2669. smalltalk.addMethod(
  2670. smalltalk.method({
  2671. selector: "samplesDo:",
  2672. protocol: 'fixture',
  2673. fn: function (aBlock){
  2674. var self=this;
  2675. return smalltalk.withContext(function($ctx1) {
  2676. _st(aBlock)._value_value_("a",(2));
  2677. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2678. args: ["aBlock"],
  2679. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2680. messageSends: ["value:value:"],
  2681. referencedClasses: []
  2682. }),
  2683. globals.AssociativeCollectionTest);
  2684. smalltalk.addMethod(
  2685. smalltalk.method({
  2686. selector: "testAddAll",
  2687. protocol: 'tests',
  2688. fn: function (){
  2689. var self=this;
  2690. return smalltalk.withContext(function($ctx1) {
  2691. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2692. globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2693. $2=self._collection();
  2694. $ctx1.sendIdx["collection"]=1;
  2695. $3=$2;
  2696. $4=self._collection();
  2697. $ctx1.sendIdx["collection"]=2;
  2698. _st($3)._addAll_($4);
  2699. $ctx1.sendIdx["addAll:"]=1;
  2700. $5=_st($2)._yourself();
  2701. $ctx1.sendIdx["yourself"]=1;
  2702. $1=$5;
  2703. $6=self._collection();
  2704. $ctx1.sendIdx["collection"]=3;
  2705. self._assert_equals_($1,$6);
  2706. $ctx1.sendIdx["assert:equals:"]=1;
  2707. $8=self._collection();
  2708. $ctx1.sendIdx["collection"]=4;
  2709. $9=$8;
  2710. $10=self._collectionWithNewValue();
  2711. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2712. _st($9)._addAll_($10);
  2713. $ctx1.sendIdx["addAll:"]=2;
  2714. $11=_st($8)._yourself();
  2715. $ctx1.sendIdx["yourself"]=2;
  2716. $7=$11;
  2717. $12=self._collectionWithNewValue();
  2718. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2719. self._assert_equals_($7,$12);
  2720. $ctx1.sendIdx["assert:equals:"]=2;
  2721. $14=self._collectionWithNewValue();
  2722. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2723. _st($14)._addAll_(self._collection());
  2724. $15=_st($14)._yourself();
  2725. $13=$15;
  2726. self._assert_equals_($13,self._collectionWithNewValue());
  2727. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)})},
  2728. args: [],
  2729. 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",
  2730. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2731. referencedClasses: []
  2732. }),
  2733. globals.AssociativeCollectionTest);
  2734. smalltalk.addMethod(
  2735. smalltalk.method({
  2736. selector: "testAsDictionary",
  2737. protocol: 'tests',
  2738. fn: function (){
  2739. var self=this;
  2740. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2741. return smalltalk.withContext(function($ctx1) {
  2742. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2743. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)})},
  2744. args: [],
  2745. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2746. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2747. referencedClasses: ["Dictionary"]
  2748. }),
  2749. globals.AssociativeCollectionTest);
  2750. smalltalk.addMethod(
  2751. smalltalk.method({
  2752. selector: "testAsHashedCollection",
  2753. protocol: 'tests',
  2754. fn: function (){
  2755. var self=this;
  2756. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2757. return smalltalk.withContext(function($ctx1) {
  2758. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2759. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)})},
  2760. args: [],
  2761. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2762. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2763. referencedClasses: ["HashedCollection"]
  2764. }),
  2765. globals.AssociativeCollectionTest);
  2766. smalltalk.addMethod(
  2767. smalltalk.method({
  2768. selector: "testComma",
  2769. protocol: 'tests',
  2770. fn: function (){
  2771. var self=this;
  2772. return smalltalk.withContext(function($ctx1) {
  2773. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2774. globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  2775. $2=self._collection();
  2776. $ctx1.sendIdx["collection"]=1;
  2777. $3=self._collection();
  2778. $ctx1.sendIdx["collection"]=2;
  2779. $1=_st($2).__comma($3);
  2780. $ctx1.sendIdx[","]=1;
  2781. $4=self._collection();
  2782. $ctx1.sendIdx["collection"]=3;
  2783. self._assert_equals_($1,$4);
  2784. $ctx1.sendIdx["assert:equals:"]=1;
  2785. $6=self._collection();
  2786. $ctx1.sendIdx["collection"]=4;
  2787. $7=self._collectionWithNewValue();
  2788. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2789. $5=_st($6).__comma($7);
  2790. $ctx1.sendIdx[","]=2;
  2791. $8=self._collectionWithNewValue();
  2792. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2793. self._assert_equals_($5,$8);
  2794. $ctx1.sendIdx["assert:equals:"]=2;
  2795. $10=self._collectionWithNewValue();
  2796. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2797. $9=_st($10).__comma(self._collection());
  2798. self._assert_equals_($9,self._collectionWithNewValue());
  2799. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)})},
  2800. args: [],
  2801. 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",
  2802. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2803. referencedClasses: []
  2804. }),
  2805. globals.AssociativeCollectionTest);
  2806. smalltalk.addMethod(
  2807. smalltalk.method({
  2808. selector: "testFrom",
  2809. protocol: 'tests',
  2810. fn: function (){
  2811. var self=this;
  2812. var associations;
  2813. return smalltalk.withContext(function($ctx1) {
  2814. var $1,$2,$3,$5,$4;
  2815. $1="a".__minus_gt((1));
  2816. $ctx1.sendIdx["->"]=1;
  2817. $2="b".__minus_gt((2));
  2818. $ctx1.sendIdx["->"]=2;
  2819. associations=[$1,$2];
  2820. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2821. $5="a".__minus_gt((1));
  2822. $ctx1.sendIdx["->"]=3;
  2823. $4=globals.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2824. self._assertSameContents_as_($3,$4);
  2825. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)})},
  2826. args: [],
  2827. 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 }.",
  2828. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2829. referencedClasses: []
  2830. }),
  2831. globals.AssociativeCollectionTest);
  2832. smalltalk.addMethod(
  2833. smalltalk.method({
  2834. selector: "testKeys",
  2835. protocol: 'tests',
  2836. fn: function (){
  2837. var self=this;
  2838. return smalltalk.withContext(function($ctx1) {
  2839. var $2,$1,$3,$4;
  2840. $2=_st(_st(self._collectionClass())._new())._keys();
  2841. $ctx1.sendIdx["keys"]=1;
  2842. $1=_st($2)._isEmpty();
  2843. self._assert_($1);
  2844. $3=_st(self._collection())._keys();
  2845. $ctx1.sendIdx["keys"]=2;
  2846. $4=self._collectionKeys();
  2847. $ctx1.sendIdx["collectionKeys"]=1;
  2848. self._assertSameContents_as_($3,$4);
  2849. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2850. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2851. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)})},
  2852. args: [],
  2853. 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 }",
  2854. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2855. referencedClasses: []
  2856. }),
  2857. globals.AssociativeCollectionTest);
  2858. smalltalk.addMethod(
  2859. smalltalk.method({
  2860. selector: "testNewFromPairs",
  2861. protocol: 'tests',
  2862. fn: function (){
  2863. var self=this;
  2864. var flattenedAssociations;
  2865. return smalltalk.withContext(function($ctx1) {
  2866. var $1,$3,$2;
  2867. flattenedAssociations=["a",(1),"b",(2)];
  2868. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2869. $3="a".__minus_gt((1));
  2870. $ctx1.sendIdx["->"]=1;
  2871. $2=globals.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2872. self._assertSameContents_as_($1,$2);
  2873. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)})},
  2874. args: [],
  2875. 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 }.",
  2876. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2877. referencedClasses: []
  2878. }),
  2879. globals.AssociativeCollectionTest);
  2880. smalltalk.addMethod(
  2881. smalltalk.method({
  2882. selector: "testPrintString",
  2883. protocol: 'tests',
  2884. fn: function (){
  2885. var self=this;
  2886. return smalltalk.withContext(function($ctx1) {
  2887. var $3,$2,$4,$1,$5;
  2888. $3=self._collectionClass();
  2889. $ctx1.sendIdx["collectionClass"]=1;
  2890. $2=_st($3)._new();
  2891. _st($2)._at_put_("firstname","James");
  2892. $ctx1.sendIdx["at:put:"]=1;
  2893. _st($2)._at_put_("lastname","Bond");
  2894. $4=_st($2)._printString();
  2895. $1=$4;
  2896. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2897. $ctx1.sendIdx[","]=1;
  2898. self._assert_equals_($1,$5);
  2899. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)})},
  2900. args: [],
  2901. 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'')'",
  2902. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2903. referencedClasses: []
  2904. }),
  2905. globals.AssociativeCollectionTest);
  2906. smalltalk.addMethod(
  2907. smalltalk.method({
  2908. selector: "testRemoveKey",
  2909. protocol: 'tests',
  2910. fn: function (){
  2911. var self=this;
  2912. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2913. return smalltalk.withContext(function($ctx1) {
  2914. var $1,$2,$3,$5,$6,$4,$7,$8;
  2915. self._nonIndexesDo_((function(each){
  2916. var collection;
  2917. return smalltalk.withContext(function($ctx2) {
  2918. collection=self._collection();
  2919. $ctx2.sendIdx["collection"]=1;
  2920. collection;
  2921. self._should_raise_((function(){
  2922. return smalltalk.withContext(function($ctx3) {
  2923. return _st(collection)._removeKey_(each);
  2924. $ctx3.sendIdx["removeKey:"]=1;
  2925. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2926. $1=collection;
  2927. $2=self._collection();
  2928. $ctx2.sendIdx["collection"]=2;
  2929. return self._assert_equals_($1,$2);
  2930. $ctx2.sendIdx["assert:equals:"]=1;
  2931. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2932. self._samplesDo_((function(index,value){
  2933. var collection;
  2934. return smalltalk.withContext(function($ctx2) {
  2935. collection=self._collection();
  2936. $ctx2.sendIdx["collection"]=3;
  2937. collection;
  2938. $3=_st(collection)._removeKey_(index);
  2939. $ctx2.sendIdx["removeKey:"]=2;
  2940. self._assert_equals_($3,value);
  2941. $ctx2.sendIdx["assert:equals:"]=2;
  2942. $5=collection;
  2943. $6=self._collection();
  2944. $ctx2.sendIdx["collection"]=4;
  2945. $4=_st($5).__eq($6);
  2946. return self._deny_($4);
  2947. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2948. $7=self._collectionWithNewValue();
  2949. _st($7)._removeKey_(self._sampleNewIndex());
  2950. $8=_st($7)._yourself();
  2951. self._assert_equals_($8,self._collection());
  2952. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)})},
  2953. args: [],
  2954. 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",
  2955. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  2956. referencedClasses: ["Error"]
  2957. }),
  2958. globals.AssociativeCollectionTest);
  2959. smalltalk.addMethod(
  2960. smalltalk.method({
  2961. selector: "testRemoveKeyIfAbsent",
  2962. protocol: 'tests',
  2963. fn: function (){
  2964. var self=this;
  2965. return smalltalk.withContext(function($ctx1) {
  2966. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  2967. self._nonIndexesDo_((function(each){
  2968. var collection;
  2969. return smalltalk.withContext(function($ctx2) {
  2970. collection=self._collection();
  2971. $ctx2.sendIdx["collection"]=1;
  2972. collection;
  2973. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  2974. return smalltalk.withContext(function($ctx3) {
  2975. return self._sampleNewValue();
  2976. $ctx3.sendIdx["sampleNewValue"]=1;
  2977. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2978. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  2979. $2=self._sampleNewValue();
  2980. $ctx2.sendIdx["sampleNewValue"]=2;
  2981. self._assert_equals_($1,$2);
  2982. $ctx2.sendIdx["assert:equals:"]=1;
  2983. $3=collection;
  2984. $4=self._collection();
  2985. $ctx2.sendIdx["collection"]=2;
  2986. return self._assert_equals_($3,$4);
  2987. $ctx2.sendIdx["assert:equals:"]=2;
  2988. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2989. self._samplesDo_((function(index,value){
  2990. var collection;
  2991. return smalltalk.withContext(function($ctx2) {
  2992. collection=self._collection();
  2993. $ctx2.sendIdx["collection"]=3;
  2994. collection;
  2995. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  2996. return smalltalk.withContext(function($ctx3) {
  2997. return self._sampleNewValue();
  2998. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  2999. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  3000. self._assert_equals_($5,value);
  3001. $ctx2.sendIdx["assert:equals:"]=3;
  3002. $7=collection;
  3003. $8=self._collection();
  3004. $ctx2.sendIdx["collection"]=4;
  3005. $6=_st($7).__eq($8);
  3006. return self._deny_($6);
  3007. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3008. $9=self._collectionWithNewValue();
  3009. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  3010. return smalltalk.withContext(function($ctx2) {
  3011. return self._assert_(false);
  3012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  3013. $10=_st($9)._yourself();
  3014. self._assert_equals_($10,self._collection());
  3015. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)})},
  3016. args: [],
  3017. 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",
  3018. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3019. referencedClasses: []
  3020. }),
  3021. globals.AssociativeCollectionTest);
  3022. smalltalk.addMethod(
  3023. smalltalk.method({
  3024. selector: "testValues",
  3025. protocol: 'tests',
  3026. fn: function (){
  3027. var self=this;
  3028. return smalltalk.withContext(function($ctx1) {
  3029. var $2,$1,$3,$4;
  3030. $2=_st(_st(self._collectionClass())._new())._values();
  3031. $ctx1.sendIdx["values"]=1;
  3032. $1=_st($2)._isEmpty();
  3033. self._assert_($1);
  3034. $3=_st(self._collection())._values();
  3035. $ctx1.sendIdx["values"]=2;
  3036. $4=self._collectionValues();
  3037. $ctx1.sendIdx["collectionValues"]=1;
  3038. self._assertSameContents_as_($3,$4);
  3039. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3040. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3041. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)})},
  3042. args: [],
  3043. 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 }",
  3044. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3045. referencedClasses: []
  3046. }),
  3047. globals.AssociativeCollectionTest);
  3048. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3049. smalltalk.addMethod(
  3050. smalltalk.method({
  3051. selector: "collection",
  3052. protocol: 'fixture',
  3053. fn: function (){
  3054. var self=this;
  3055. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3056. return smalltalk.withContext(function($ctx1) {
  3057. var $2,$3,$1;
  3058. $2=_st($Dictionary())._new();
  3059. _st($2)._at_put_((1),(1));
  3060. $ctx1.sendIdx["at:put:"]=1;
  3061. _st($2)._at_put_("a",(2));
  3062. $ctx1.sendIdx["at:put:"]=2;
  3063. _st($2)._at_put_(true,(3));
  3064. $ctx1.sendIdx["at:put:"]=3;
  3065. _st($2)._at_put_((1).__at((3)),(-4));
  3066. $3=_st($2)._yourself();
  3067. $1=$3;
  3068. return $1;
  3069. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)})},
  3070. args: [],
  3071. 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",
  3072. messageSends: ["at:put:", "new", "@", "yourself"],
  3073. referencedClasses: ["Dictionary"]
  3074. }),
  3075. globals.DictionaryTest);
  3076. smalltalk.addMethod(
  3077. smalltalk.method({
  3078. selector: "collectionKeys",
  3079. protocol: 'fixture',
  3080. fn: function (){
  3081. var self=this;
  3082. return smalltalk.withContext(function($ctx1) {
  3083. var $1;
  3084. $1=[(1),"a",true,(1).__at((3))];
  3085. return $1;
  3086. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)})},
  3087. args: [],
  3088. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3089. messageSends: ["@"],
  3090. referencedClasses: []
  3091. }),
  3092. globals.DictionaryTest);
  3093. smalltalk.addMethod(
  3094. smalltalk.method({
  3095. selector: "collectionOfPrintStrings",
  3096. protocol: 'fixture',
  3097. fn: function (){
  3098. var self=this;
  3099. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3100. return smalltalk.withContext(function($ctx1) {
  3101. var $2,$3,$1;
  3102. $2=_st($Dictionary())._new();
  3103. _st($2)._at_put_((1),"1");
  3104. $ctx1.sendIdx["at:put:"]=1;
  3105. _st($2)._at_put_("a","2");
  3106. $ctx1.sendIdx["at:put:"]=2;
  3107. _st($2)._at_put_(true,"3");
  3108. $ctx1.sendIdx["at:put:"]=3;
  3109. _st($2)._at_put_((1).__at((3)),"-4");
  3110. $3=_st($2)._yourself();
  3111. $1=$3;
  3112. return $1;
  3113. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)})},
  3114. args: [],
  3115. 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",
  3116. messageSends: ["at:put:", "new", "@", "yourself"],
  3117. referencedClasses: ["Dictionary"]
  3118. }),
  3119. globals.DictionaryTest);
  3120. smalltalk.addMethod(
  3121. smalltalk.method({
  3122. selector: "collectionSize",
  3123. protocol: 'fixture',
  3124. fn: function (){
  3125. var self=this;
  3126. return (4);
  3127. },
  3128. args: [],
  3129. source: "collectionSize\x0a\x09^ 4",
  3130. messageSends: [],
  3131. referencedClasses: []
  3132. }),
  3133. globals.DictionaryTest);
  3134. smalltalk.addMethod(
  3135. smalltalk.method({
  3136. selector: "collectionValues",
  3137. protocol: 'fixture',
  3138. fn: function (){
  3139. var self=this;
  3140. var $1;
  3141. $1=[(1),(2),(3),(-4)];
  3142. return $1;
  3143. },
  3144. args: [],
  3145. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3146. messageSends: [],
  3147. referencedClasses: []
  3148. }),
  3149. globals.DictionaryTest);
  3150. smalltalk.addMethod(
  3151. smalltalk.method({
  3152. selector: "collectionWithDuplicates",
  3153. protocol: 'fixture',
  3154. fn: function (){
  3155. var self=this;
  3156. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3157. return smalltalk.withContext(function($ctx1) {
  3158. var $2,$3,$1;
  3159. $2=_st($Dictionary())._new();
  3160. _st($2)._at_put_((1),(1));
  3161. $ctx1.sendIdx["at:put:"]=1;
  3162. _st($2)._at_put_("a",(2));
  3163. $ctx1.sendIdx["at:put:"]=2;
  3164. _st($2)._at_put_(true,(3));
  3165. $ctx1.sendIdx["at:put:"]=3;
  3166. _st($2)._at_put_((4),(-4));
  3167. $ctx1.sendIdx["at:put:"]=4;
  3168. _st($2)._at_put_("b",(1));
  3169. $ctx1.sendIdx["at:put:"]=5;
  3170. _st($2)._at_put_((3),(3));
  3171. $ctx1.sendIdx["at:put:"]=6;
  3172. _st($2)._at_put_(false,(12));
  3173. $3=_st($2)._yourself();
  3174. $1=$3;
  3175. return $1;
  3176. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)})},
  3177. args: [],
  3178. 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",
  3179. messageSends: ["at:put:", "new", "yourself"],
  3180. referencedClasses: ["Dictionary"]
  3181. }),
  3182. globals.DictionaryTest);
  3183. smalltalk.addMethod(
  3184. smalltalk.method({
  3185. selector: "collectionWithNewValue",
  3186. protocol: 'fixture',
  3187. fn: function (){
  3188. var self=this;
  3189. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3190. return smalltalk.withContext(function($ctx1) {
  3191. var $2,$3,$1;
  3192. $2=_st($Dictionary())._new();
  3193. _st($2)._at_put_((1),(1));
  3194. $ctx1.sendIdx["at:put:"]=1;
  3195. _st($2)._at_put_("a",(2));
  3196. $ctx1.sendIdx["at:put:"]=2;
  3197. _st($2)._at_put_(true,(3));
  3198. $ctx1.sendIdx["at:put:"]=3;
  3199. _st($2)._at_put_((1).__at((3)),(-4));
  3200. $ctx1.sendIdx["at:put:"]=4;
  3201. _st($2)._at_put_("new","N");
  3202. $3=_st($2)._yourself();
  3203. $1=$3;
  3204. return $1;
  3205. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)})},
  3206. args: [],
  3207. 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",
  3208. messageSends: ["at:put:", "new", "@", "yourself"],
  3209. referencedClasses: ["Dictionary"]
  3210. }),
  3211. globals.DictionaryTest);
  3212. smalltalk.addMethod(
  3213. smalltalk.method({
  3214. selector: "sampleNewValueAsCollection",
  3215. protocol: 'fixture',
  3216. fn: function (){
  3217. var self=this;
  3218. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3219. return smalltalk.withContext(function($ctx1) {
  3220. var $2,$3,$1;
  3221. $2=_st($Dictionary())._new();
  3222. _st($2)._at_put_("new","N");
  3223. $3=_st($2)._yourself();
  3224. $1=$3;
  3225. return $1;
  3226. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)})},
  3227. args: [],
  3228. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3229. messageSends: ["at:put:", "new", "yourself"],
  3230. referencedClasses: ["Dictionary"]
  3231. }),
  3232. globals.DictionaryTest);
  3233. smalltalk.addMethod(
  3234. smalltalk.method({
  3235. selector: "samplesDo:",
  3236. protocol: 'fixture',
  3237. fn: function (aBlock){
  3238. var self=this;
  3239. return smalltalk.withContext(function($ctx1) {
  3240. globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3241. _st(aBlock)._value_value_(true,(3));
  3242. $ctx1.sendIdx["value:value:"]=1;
  3243. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3244. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)})},
  3245. args: ["aBlock"],
  3246. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3247. messageSends: ["samplesDo:", "value:value:", "@"],
  3248. referencedClasses: []
  3249. }),
  3250. globals.DictionaryTest);
  3251. smalltalk.addMethod(
  3252. smalltalk.method({
  3253. selector: "testAccessing",
  3254. protocol: 'tests',
  3255. fn: function (){
  3256. var self=this;
  3257. var d;
  3258. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3259. return smalltalk.withContext(function($ctx1) {
  3260. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3261. d=_st($Dictionary())._new();
  3262. _st(d)._at_put_("hello","world");
  3263. $ctx1.sendIdx["at:put:"]=1;
  3264. $1=_st(d)._at_("hello");
  3265. $ctx1.sendIdx["at:"]=1;
  3266. self._assert_equals_($1,"world");
  3267. $ctx1.sendIdx["assert:equals:"]=1;
  3268. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3269. return smalltalk.withContext(function($ctx2) {
  3270. return nil;
  3271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3272. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3273. self._assert_equals_($2,"world");
  3274. $ctx1.sendIdx["assert:equals:"]=2;
  3275. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3276. return smalltalk.withContext(function($ctx2) {
  3277. return nil;
  3278. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  3279. $ctx1.sendIdx["deny:"]=1;
  3280. $3=_st(d)._includesKey_("hello");
  3281. $ctx1.sendIdx["includesKey:"]=1;
  3282. self._assert_($3);
  3283. $ctx1.sendIdx["assert:"]=1;
  3284. $4=_st(d)._includesKey_("foo");
  3285. $ctx1.sendIdx["includesKey:"]=2;
  3286. self._deny_($4);
  3287. $ctx1.sendIdx["deny:"]=2;
  3288. _st(d)._at_put_((1),(2));
  3289. $ctx1.sendIdx["at:put:"]=2;
  3290. $5=_st(d)._at_((1));
  3291. $ctx1.sendIdx["at:"]=2;
  3292. self._assert_equals_($5,(2));
  3293. $ctx1.sendIdx["assert:equals:"]=3;
  3294. $6=d;
  3295. $7=(1).__at((3));
  3296. $ctx1.sendIdx["@"]=1;
  3297. _st($6)._at_put_($7,(3));
  3298. $9=d;
  3299. $10=(1).__at((3));
  3300. $ctx1.sendIdx["@"]=2;
  3301. $8=_st($9)._at_($10);
  3302. self._assert_equals_($8,(3));
  3303. $12=d;
  3304. $13=(1).__at((3));
  3305. $ctx1.sendIdx["@"]=3;
  3306. $11=_st($12)._includesKey_($13);
  3307. $ctx1.sendIdx["includesKey:"]=3;
  3308. self._assert_($11);
  3309. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3310. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)})},
  3311. args: [],
  3312. 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)",
  3313. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3314. referencedClasses: ["Dictionary"]
  3315. }),
  3316. globals.DictionaryTest);
  3317. smalltalk.addMethod(
  3318. smalltalk.method({
  3319. selector: "testDynamicDictionaries",
  3320. protocol: 'tests',
  3321. fn: function (){
  3322. var self=this;
  3323. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3324. return smalltalk.withContext(function($ctx1) {
  3325. var $3,$2,$1;
  3326. $3="hello".__minus_gt((1));
  3327. $ctx1.sendIdx["->"]=1;
  3328. $2=globals.HashedCollection._from_([$3]);
  3329. $1=_st($2)._asDictionary();
  3330. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  3331. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)})},
  3332. args: [],
  3333. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3334. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  3335. referencedClasses: ["Dictionary"]
  3336. }),
  3337. globals.DictionaryTest);
  3338. smalltalk.addMethod(
  3339. smalltalk.method({
  3340. selector: "collectionClass",
  3341. protocol: 'fixture',
  3342. fn: function (){
  3343. var self=this;
  3344. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3345. return $Dictionary();
  3346. },
  3347. args: [],
  3348. source: "collectionClass\x0a\x09^ Dictionary",
  3349. messageSends: [],
  3350. referencedClasses: ["Dictionary"]
  3351. }),
  3352. globals.DictionaryTest.klass);
  3353. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3354. smalltalk.addMethod(
  3355. smalltalk.method({
  3356. selector: "collection",
  3357. protocol: 'fixture',
  3358. fn: function (){
  3359. var self=this;
  3360. return smalltalk.withContext(function($ctx1) {
  3361. var $2,$3,$4,$1;
  3362. $2="b".__minus_gt((1));
  3363. $ctx1.sendIdx["->"]=1;
  3364. $3="a".__minus_gt((2));
  3365. $ctx1.sendIdx["->"]=2;
  3366. $4="c".__minus_gt((3));
  3367. $ctx1.sendIdx["->"]=3;
  3368. $1=globals.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  3369. return $1;
  3370. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.HashedCollectionTest)})},
  3371. args: [],
  3372. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3373. messageSends: ["->"],
  3374. referencedClasses: []
  3375. }),
  3376. globals.HashedCollectionTest);
  3377. smalltalk.addMethod(
  3378. smalltalk.method({
  3379. selector: "collectionKeys",
  3380. protocol: 'fixture',
  3381. fn: function (){
  3382. var self=this;
  3383. var $1;
  3384. $1=["b","a","c","d"];
  3385. return $1;
  3386. },
  3387. args: [],
  3388. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3389. messageSends: [],
  3390. referencedClasses: []
  3391. }),
  3392. globals.HashedCollectionTest);
  3393. smalltalk.addMethod(
  3394. smalltalk.method({
  3395. selector: "collectionOfPrintStrings",
  3396. protocol: 'fixture',
  3397. fn: function (){
  3398. var self=this;
  3399. return smalltalk.withContext(function($ctx1) {
  3400. var $2,$3,$4,$1;
  3401. $2="b".__minus_gt("1");
  3402. $ctx1.sendIdx["->"]=1;
  3403. $3="a".__minus_gt("2");
  3404. $ctx1.sendIdx["->"]=2;
  3405. $4="c".__minus_gt("3");
  3406. $ctx1.sendIdx["->"]=3;
  3407. $1=globals.HashedCollection._from_([$2,$3,$4,"d".__minus_gt("-4")]);
  3408. return $1;
  3409. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.HashedCollectionTest)})},
  3410. args: [],
  3411. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3412. messageSends: ["->"],
  3413. referencedClasses: []
  3414. }),
  3415. globals.HashedCollectionTest);
  3416. smalltalk.addMethod(
  3417. smalltalk.method({
  3418. selector: "collectionSize",
  3419. protocol: 'fixture',
  3420. fn: function (){
  3421. var self=this;
  3422. return (4);
  3423. },
  3424. args: [],
  3425. source: "collectionSize\x0a\x09^ 4",
  3426. messageSends: [],
  3427. referencedClasses: []
  3428. }),
  3429. globals.HashedCollectionTest);
  3430. smalltalk.addMethod(
  3431. smalltalk.method({
  3432. selector: "collectionValues",
  3433. protocol: 'fixture',
  3434. fn: function (){
  3435. var self=this;
  3436. var $1;
  3437. $1=[(1),(2),(3),(-4)];
  3438. return $1;
  3439. },
  3440. args: [],
  3441. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3442. messageSends: [],
  3443. referencedClasses: []
  3444. }),
  3445. globals.HashedCollectionTest);
  3446. smalltalk.addMethod(
  3447. smalltalk.method({
  3448. selector: "collectionWithDuplicates",
  3449. protocol: 'fixture',
  3450. fn: function (){
  3451. var self=this;
  3452. return smalltalk.withContext(function($ctx1) {
  3453. var $2,$3,$4,$5,$6,$7,$1;
  3454. $2="b".__minus_gt((1));
  3455. $ctx1.sendIdx["->"]=1;
  3456. $3="a".__minus_gt((2));
  3457. $ctx1.sendIdx["->"]=2;
  3458. $4="c".__minus_gt((3));
  3459. $ctx1.sendIdx["->"]=3;
  3460. $5="d".__minus_gt((-4));
  3461. $ctx1.sendIdx["->"]=4;
  3462. $6="e".__minus_gt((1));
  3463. $ctx1.sendIdx["->"]=5;
  3464. $7="f".__minus_gt((2));
  3465. $ctx1.sendIdx["->"]=6;
  3466. $1=globals.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  3467. return $1;
  3468. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.HashedCollectionTest)})},
  3469. args: [],
  3470. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3471. messageSends: ["->"],
  3472. referencedClasses: []
  3473. }),
  3474. globals.HashedCollectionTest);
  3475. smalltalk.addMethod(
  3476. smalltalk.method({
  3477. selector: "collectionWithNewValue",
  3478. protocol: 'fixture',
  3479. fn: function (){
  3480. var self=this;
  3481. return smalltalk.withContext(function($ctx1) {
  3482. var $2,$3,$4,$5,$1;
  3483. $2="b".__minus_gt((1));
  3484. $ctx1.sendIdx["->"]=1;
  3485. $3="a".__minus_gt((2));
  3486. $ctx1.sendIdx["->"]=2;
  3487. $4="c".__minus_gt((3));
  3488. $ctx1.sendIdx["->"]=3;
  3489. $5="d".__minus_gt((-4));
  3490. $ctx1.sendIdx["->"]=4;
  3491. $1=globals.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  3492. return $1;
  3493. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.HashedCollectionTest)})},
  3494. args: [],
  3495. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3496. messageSends: ["->"],
  3497. referencedClasses: []
  3498. }),
  3499. globals.HashedCollectionTest);
  3500. smalltalk.addMethod(
  3501. smalltalk.method({
  3502. selector: "sampleNewValueAsCollection",
  3503. protocol: 'fixture',
  3504. fn: function (){
  3505. var self=this;
  3506. return smalltalk.withContext(function($ctx1) {
  3507. var $1;
  3508. $1=globals.HashedCollection._from_(["new".__minus_gt("N")]);
  3509. return $1;
  3510. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.HashedCollectionTest)})},
  3511. args: [],
  3512. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3513. messageSends: ["->"],
  3514. referencedClasses: []
  3515. }),
  3516. globals.HashedCollectionTest);
  3517. smalltalk.addMethod(
  3518. smalltalk.method({
  3519. selector: "testDynamicDictionaries",
  3520. protocol: 'tests',
  3521. fn: function (){
  3522. var self=this;
  3523. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3524. return smalltalk.withContext(function($ctx1) {
  3525. var $3,$2,$1;
  3526. $3="hello".__minus_gt((1));
  3527. $ctx1.sendIdx["->"]=1;
  3528. $2=globals.HashedCollection._from_([$3]);
  3529. $1=_st($2)._asHashedCollection();
  3530. self._assert_equals_($1,_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3531. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)})},
  3532. args: [],
  3533. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3534. messageSends: ["assert:equals:", "asHashedCollection", "->", "with:"],
  3535. referencedClasses: ["HashedCollection"]
  3536. }),
  3537. globals.HashedCollectionTest);
  3538. smalltalk.addMethod(
  3539. smalltalk.method({
  3540. selector: "collectionClass",
  3541. protocol: 'fixture',
  3542. fn: function (){
  3543. var self=this;
  3544. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3545. return $HashedCollection();
  3546. },
  3547. args: [],
  3548. source: "collectionClass\x0a\x09^ HashedCollection",
  3549. messageSends: [],
  3550. referencedClasses: ["HashedCollection"]
  3551. }),
  3552. globals.HashedCollectionTest.klass);
  3553. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  3554. smalltalk.addMethod(
  3555. smalltalk.method({
  3556. selector: "collectionFirst",
  3557. protocol: 'fixture',
  3558. fn: function (){
  3559. var self=this;
  3560. return smalltalk.withContext(function($ctx1) {
  3561. self._subclassResponsibility();
  3562. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)})},
  3563. args: [],
  3564. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3565. messageSends: ["subclassResponsibility"],
  3566. referencedClasses: []
  3567. }),
  3568. globals.SequenceableCollectionTest);
  3569. smalltalk.addMethod(
  3570. smalltalk.method({
  3571. selector: "collectionFirstTwo",
  3572. protocol: 'fixture',
  3573. fn: function (){
  3574. var self=this;
  3575. return smalltalk.withContext(function($ctx1) {
  3576. self._subclassResponsibility();
  3577. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)})},
  3578. args: [],
  3579. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3580. messageSends: ["subclassResponsibility"],
  3581. referencedClasses: []
  3582. }),
  3583. globals.SequenceableCollectionTest);
  3584. smalltalk.addMethod(
  3585. smalltalk.method({
  3586. selector: "collectionLast",
  3587. protocol: 'fixture',
  3588. fn: function (){
  3589. var self=this;
  3590. return smalltalk.withContext(function($ctx1) {
  3591. self._subclassResponsibility();
  3592. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)})},
  3593. args: [],
  3594. source: "collectionLast\x0a\x09self subclassResponsibility",
  3595. messageSends: ["subclassResponsibility"],
  3596. referencedClasses: []
  3597. }),
  3598. globals.SequenceableCollectionTest);
  3599. smalltalk.addMethod(
  3600. smalltalk.method({
  3601. selector: "collectionLastTwo",
  3602. protocol: 'fixture',
  3603. fn: function (){
  3604. var self=this;
  3605. return smalltalk.withContext(function($ctx1) {
  3606. self._subclassResponsibility();
  3607. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)})},
  3608. args: [],
  3609. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3610. messageSends: ["subclassResponsibility"],
  3611. referencedClasses: []
  3612. }),
  3613. globals.SequenceableCollectionTest);
  3614. smalltalk.addMethod(
  3615. smalltalk.method({
  3616. selector: "nonIndexesDo:",
  3617. protocol: 'fixture',
  3618. fn: function (aBlock){
  3619. var self=this;
  3620. return smalltalk.withContext(function($ctx1) {
  3621. _st(aBlock)._value_((0));
  3622. $ctx1.sendIdx["value:"]=1;
  3623. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3624. $ctx1.sendIdx["value:"]=2;
  3625. _st(aBlock)._value_("z");
  3626. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3627. args: ["aBlock"],
  3628. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3629. messageSends: ["value:", "+", "collectionSize"],
  3630. referencedClasses: []
  3631. }),
  3632. globals.SequenceableCollectionTest);
  3633. smalltalk.addMethod(
  3634. smalltalk.method({
  3635. selector: "samplesDo:",
  3636. protocol: 'fixture',
  3637. fn: function (aBlock){
  3638. var self=this;
  3639. return smalltalk.withContext(function($ctx1) {
  3640. _st(aBlock)._value_value_((1),self._collectionFirst());
  3641. $ctx1.sendIdx["value:value:"]=1;
  3642. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3643. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3644. args: ["aBlock"],
  3645. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3646. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3647. referencedClasses: []
  3648. }),
  3649. globals.SequenceableCollectionTest);
  3650. smalltalk.addMethod(
  3651. smalltalk.method({
  3652. selector: "testBeginsWith",
  3653. protocol: 'tests',
  3654. fn: function (){
  3655. var self=this;
  3656. return smalltalk.withContext(function($ctx1) {
  3657. var $2,$1,$4,$5,$3,$7,$6;
  3658. $2=self._collection();
  3659. $ctx1.sendIdx["collection"]=1;
  3660. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3661. $ctx1.sendIdx["beginsWith:"]=1;
  3662. self._assert_($1);
  3663. $ctx1.sendIdx["assert:"]=1;
  3664. $4=self._collection();
  3665. $ctx1.sendIdx["collection"]=2;
  3666. $5=self._collection();
  3667. $ctx1.sendIdx["collection"]=3;
  3668. $3=_st($4)._beginsWith_($5);
  3669. $ctx1.sendIdx["beginsWith:"]=2;
  3670. self._assert_($3);
  3671. $ctx1.sendIdx["assert:"]=2;
  3672. $7=self._collection();
  3673. $ctx1.sendIdx["collection"]=4;
  3674. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3675. $ctx1.sendIdx["beginsWith:"]=3;
  3676. self._assert_($6);
  3677. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3678. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)})},
  3679. args: [],
  3680. 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)",
  3681. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3682. referencedClasses: []
  3683. }),
  3684. globals.SequenceableCollectionTest);
  3685. smalltalk.addMethod(
  3686. smalltalk.method({
  3687. selector: "testEndsWith",
  3688. protocol: 'tests',
  3689. fn: function (){
  3690. var self=this;
  3691. return smalltalk.withContext(function($ctx1) {
  3692. var $2,$1,$4,$5,$3,$7,$6;
  3693. $2=self._collection();
  3694. $ctx1.sendIdx["collection"]=1;
  3695. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3696. $ctx1.sendIdx["endsWith:"]=1;
  3697. self._assert_($1);
  3698. $ctx1.sendIdx["assert:"]=1;
  3699. $4=self._collection();
  3700. $ctx1.sendIdx["collection"]=2;
  3701. $5=self._collection();
  3702. $ctx1.sendIdx["collection"]=3;
  3703. $3=_st($4)._endsWith_($5);
  3704. $ctx1.sendIdx["endsWith:"]=2;
  3705. self._assert_($3);
  3706. $ctx1.sendIdx["assert:"]=2;
  3707. $7=self._collection();
  3708. $ctx1.sendIdx["collection"]=4;
  3709. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3710. $ctx1.sendIdx["endsWith:"]=3;
  3711. self._assert_($6);
  3712. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3713. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)})},
  3714. args: [],
  3715. 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)",
  3716. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3717. referencedClasses: []
  3718. }),
  3719. globals.SequenceableCollectionTest);
  3720. smalltalk.addMethod(
  3721. smalltalk.method({
  3722. selector: "testFirst",
  3723. protocol: 'tests',
  3724. fn: function (){
  3725. var self=this;
  3726. return smalltalk.withContext(function($ctx1) {
  3727. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3728. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)})},
  3729. args: [],
  3730. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3731. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3732. referencedClasses: []
  3733. }),
  3734. globals.SequenceableCollectionTest);
  3735. smalltalk.addMethod(
  3736. smalltalk.method({
  3737. selector: "testFirstN",
  3738. protocol: 'tests',
  3739. fn: function (){
  3740. var self=this;
  3741. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3742. return smalltalk.withContext(function($ctx1) {
  3743. var $2,$1,$4,$3,$6,$5,$7;
  3744. $2=self._collection();
  3745. $ctx1.sendIdx["collection"]=1;
  3746. $1=_st($2)._first_((2));
  3747. $ctx1.sendIdx["first:"]=1;
  3748. self._assert_equals_($1,self._collectionFirstTwo());
  3749. $ctx1.sendIdx["assert:equals:"]=1;
  3750. $4=self._collection();
  3751. $ctx1.sendIdx["collection"]=2;
  3752. $3=_st($4)._first_((0));
  3753. $ctx1.sendIdx["first:"]=2;
  3754. self._assert_equals_($3,_st(self._collectionClass())._new());
  3755. $ctx1.sendIdx["assert:equals:"]=2;
  3756. $6=self._collection();
  3757. $ctx1.sendIdx["collection"]=3;
  3758. $5=_st($6)._first_(self._collectionSize());
  3759. $ctx1.sendIdx["first:"]=3;
  3760. $7=self._collection();
  3761. $ctx1.sendIdx["collection"]=4;
  3762. self._assert_equals_($5,$7);
  3763. self._should_raise_((function(){
  3764. return smalltalk.withContext(function($ctx2) {
  3765. return _st(self._collection())._first_((33));
  3766. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3767. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)})},
  3768. args: [],
  3769. 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",
  3770. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3771. referencedClasses: ["Error"]
  3772. }),
  3773. globals.SequenceableCollectionTest);
  3774. smalltalk.addMethod(
  3775. smalltalk.method({
  3776. selector: "testFourth",
  3777. protocol: 'tests',
  3778. fn: function (){
  3779. var self=this;
  3780. return smalltalk.withContext(function($ctx1) {
  3781. var $2,$1;
  3782. $2=self._collection();
  3783. $ctx1.sendIdx["collection"]=1;
  3784. $1=_st($2)._fourth();
  3785. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3786. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)})},
  3787. args: [],
  3788. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3789. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3790. referencedClasses: []
  3791. }),
  3792. globals.SequenceableCollectionTest);
  3793. smalltalk.addMethod(
  3794. smalltalk.method({
  3795. selector: "testIndexOfStartingAt",
  3796. protocol: 'tests',
  3797. fn: function (){
  3798. var self=this;
  3799. var jsNull;
  3800. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3801. return smalltalk.withContext(function($ctx1) {
  3802. var $2,$1,$4,$3;
  3803. jsNull=_st($JSON())._parse_("null");
  3804. self._samplesDo_((function(index,value){
  3805. return smalltalk.withContext(function($ctx2) {
  3806. $2=self._collection();
  3807. $ctx2.sendIdx["collection"]=1;
  3808. $1=_st($2)._indexOf_startingAt_(value,(1));
  3809. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3810. self._assert_equals_($1,index);
  3811. $ctx2.sendIdx["assert:equals:"]=1;
  3812. $4=self._collection();
  3813. $ctx2.sendIdx["collection"]=2;
  3814. $3=_st($4)._indexOf_startingAt_(value,index);
  3815. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3816. self._assert_equals_($3,index);
  3817. $ctx2.sendIdx["assert:equals:"]=2;
  3818. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3819. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3820. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3821. args: [],
  3822. 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 ]",
  3823. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3824. referencedClasses: ["JSON"]
  3825. }),
  3826. globals.SequenceableCollectionTest);
  3827. smalltalk.addMethod(
  3828. smalltalk.method({
  3829. selector: "testIndexOfStartingAtWithNull",
  3830. protocol: 'tests',
  3831. fn: function (){
  3832. var self=this;
  3833. var jsNull;
  3834. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3835. return smalltalk.withContext(function($ctx1) {
  3836. var $1,$2;
  3837. jsNull=_st($JSON())._parse_("null");
  3838. self._samplesDo_((function(index,value){
  3839. var collection;
  3840. return smalltalk.withContext(function($ctx2) {
  3841. collection=self._collection();
  3842. collection;
  3843. _st(collection)._at_put_(index,jsNull);
  3844. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3845. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3846. self._assert_equals_($1,index);
  3847. $ctx2.sendIdx["assert:equals:"]=1;
  3848. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3849. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3850. self._assert_equals_($2,index);
  3851. $ctx2.sendIdx["assert:equals:"]=2;
  3852. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3853. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3854. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3855. args: [],
  3856. 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 ]",
  3857. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3858. referencedClasses: ["JSON"]
  3859. }),
  3860. globals.SequenceableCollectionTest);
  3861. smalltalk.addMethod(
  3862. smalltalk.method({
  3863. selector: "testLast",
  3864. protocol: 'tests',
  3865. fn: function (){
  3866. var self=this;
  3867. return smalltalk.withContext(function($ctx1) {
  3868. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3869. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)})},
  3870. args: [],
  3871. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3872. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3873. referencedClasses: []
  3874. }),
  3875. globals.SequenceableCollectionTest);
  3876. smalltalk.addMethod(
  3877. smalltalk.method({
  3878. selector: "testLastN",
  3879. protocol: 'tests',
  3880. fn: function (){
  3881. var self=this;
  3882. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3883. return smalltalk.withContext(function($ctx1) {
  3884. var $2,$1,$4,$3,$6,$5,$7;
  3885. $2=self._collection();
  3886. $ctx1.sendIdx["collection"]=1;
  3887. $1=_st($2)._last_((2));
  3888. $ctx1.sendIdx["last:"]=1;
  3889. self._assert_equals_($1,self._collectionLastTwo());
  3890. $ctx1.sendIdx["assert:equals:"]=1;
  3891. $4=self._collection();
  3892. $ctx1.sendIdx["collection"]=2;
  3893. $3=_st($4)._last_((0));
  3894. $ctx1.sendIdx["last:"]=2;
  3895. self._assert_equals_($3,_st(self._collectionClass())._new());
  3896. $ctx1.sendIdx["assert:equals:"]=2;
  3897. $6=self._collection();
  3898. $ctx1.sendIdx["collection"]=3;
  3899. $5=_st($6)._last_(self._collectionSize());
  3900. $ctx1.sendIdx["last:"]=3;
  3901. $7=self._collection();
  3902. $ctx1.sendIdx["collection"]=4;
  3903. self._assert_equals_($5,$7);
  3904. self._should_raise_((function(){
  3905. return smalltalk.withContext(function($ctx2) {
  3906. return _st(self._collection())._last_((33));
  3907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3908. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)})},
  3909. args: [],
  3910. 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",
  3911. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3912. referencedClasses: ["Error"]
  3913. }),
  3914. globals.SequenceableCollectionTest);
  3915. smalltalk.addMethod(
  3916. smalltalk.method({
  3917. selector: "testSecond",
  3918. protocol: 'tests',
  3919. fn: function (){
  3920. var self=this;
  3921. return smalltalk.withContext(function($ctx1) {
  3922. var $2,$1;
  3923. $2=self._collection();
  3924. $ctx1.sendIdx["collection"]=1;
  3925. $1=_st($2)._second();
  3926. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3927. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)})},
  3928. args: [],
  3929. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3930. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3931. referencedClasses: []
  3932. }),
  3933. globals.SequenceableCollectionTest);
  3934. smalltalk.addMethod(
  3935. smalltalk.method({
  3936. selector: "testThird",
  3937. protocol: 'tests',
  3938. fn: function (){
  3939. var self=this;
  3940. return smalltalk.withContext(function($ctx1) {
  3941. var $2,$1;
  3942. $2=self._collection();
  3943. $ctx1.sendIdx["collection"]=1;
  3944. $1=_st($2)._third();
  3945. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3946. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)})},
  3947. args: [],
  3948. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3949. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3950. referencedClasses: []
  3951. }),
  3952. globals.SequenceableCollectionTest);
  3953. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  3954. smalltalk.addMethod(
  3955. smalltalk.method({
  3956. selector: "collection",
  3957. protocol: 'fixture',
  3958. fn: function (){
  3959. var self=this;
  3960. var $1;
  3961. $1=[(1), (2), (3), (-4)];
  3962. return $1;
  3963. },
  3964. args: [],
  3965. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3966. messageSends: [],
  3967. referencedClasses: []
  3968. }),
  3969. globals.ArrayTest);
  3970. smalltalk.addMethod(
  3971. smalltalk.method({
  3972. selector: "collectionFirst",
  3973. protocol: 'fixture',
  3974. fn: function (){
  3975. var self=this;
  3976. return (1);
  3977. },
  3978. args: [],
  3979. source: "collectionFirst\x0a\x09^ 1",
  3980. messageSends: [],
  3981. referencedClasses: []
  3982. }),
  3983. globals.ArrayTest);
  3984. smalltalk.addMethod(
  3985. smalltalk.method({
  3986. selector: "collectionFirstTwo",
  3987. protocol: 'fixture',
  3988. fn: function (){
  3989. var self=this;
  3990. var $1;
  3991. $1=[(1), (2)];
  3992. return $1;
  3993. },
  3994. args: [],
  3995. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3996. messageSends: [],
  3997. referencedClasses: []
  3998. }),
  3999. globals.ArrayTest);
  4000. smalltalk.addMethod(
  4001. smalltalk.method({
  4002. selector: "collectionLast",
  4003. protocol: 'fixture',
  4004. fn: function (){
  4005. var self=this;
  4006. return (-4);
  4007. },
  4008. args: [],
  4009. source: "collectionLast\x0a\x09^ -4",
  4010. messageSends: [],
  4011. referencedClasses: []
  4012. }),
  4013. globals.ArrayTest);
  4014. smalltalk.addMethod(
  4015. smalltalk.method({
  4016. selector: "collectionLastTwo",
  4017. protocol: 'fixture',
  4018. fn: function (){
  4019. var self=this;
  4020. var $1;
  4021. $1=[(3), (-4)];
  4022. return $1;
  4023. },
  4024. args: [],
  4025. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  4026. messageSends: [],
  4027. referencedClasses: []
  4028. }),
  4029. globals.ArrayTest);
  4030. smalltalk.addMethod(
  4031. smalltalk.method({
  4032. selector: "collectionOfPrintStrings",
  4033. protocol: 'fixture',
  4034. fn: function (){
  4035. var self=this;
  4036. var $1;
  4037. $1=["1", "2", "3", "-4"];
  4038. return $1;
  4039. },
  4040. args: [],
  4041. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  4042. messageSends: [],
  4043. referencedClasses: []
  4044. }),
  4045. globals.ArrayTest);
  4046. smalltalk.addMethod(
  4047. smalltalk.method({
  4048. selector: "collectionSize",
  4049. protocol: 'fixture',
  4050. fn: function (){
  4051. var self=this;
  4052. return (4);
  4053. },
  4054. args: [],
  4055. source: "collectionSize\x0a\x09^ 4",
  4056. messageSends: [],
  4057. referencedClasses: []
  4058. }),
  4059. globals.ArrayTest);
  4060. smalltalk.addMethod(
  4061. smalltalk.method({
  4062. selector: "collectionWithDuplicates",
  4063. protocol: 'fixture',
  4064. fn: function (){
  4065. var self=this;
  4066. var $1;
  4067. $1=["a", "b", "c", (1), (2), (1), "a"];
  4068. return $1;
  4069. },
  4070. args: [],
  4071. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4072. messageSends: [],
  4073. referencedClasses: []
  4074. }),
  4075. globals.ArrayTest);
  4076. smalltalk.addMethod(
  4077. smalltalk.method({
  4078. selector: "collectionWithNewValue",
  4079. protocol: 'fixture',
  4080. fn: function (){
  4081. var self=this;
  4082. var $1;
  4083. $1=[(1), (2), (3), (-4), "N"];
  4084. return $1;
  4085. },
  4086. args: [],
  4087. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4088. messageSends: [],
  4089. referencedClasses: []
  4090. }),
  4091. globals.ArrayTest);
  4092. smalltalk.addMethod(
  4093. smalltalk.method({
  4094. selector: "sampleNewIndex",
  4095. protocol: 'fixture',
  4096. fn: function (){
  4097. var self=this;
  4098. return (5);
  4099. },
  4100. args: [],
  4101. source: "sampleNewIndex\x0a\x09^ 5",
  4102. messageSends: [],
  4103. referencedClasses: []
  4104. }),
  4105. globals.ArrayTest);
  4106. smalltalk.addMethod(
  4107. smalltalk.method({
  4108. selector: "samplesDo:",
  4109. protocol: 'fixture',
  4110. fn: function (aBlock){
  4111. var self=this;
  4112. return smalltalk.withContext(function($ctx1) {
  4113. globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4114. _st(aBlock)._value_value_((3),(3));
  4115. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)})},
  4116. args: ["aBlock"],
  4117. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4118. messageSends: ["samplesDo:", "value:value:"],
  4119. referencedClasses: []
  4120. }),
  4121. globals.ArrayTest);
  4122. smalltalk.addMethod(
  4123. smalltalk.method({
  4124. selector: "testAdd",
  4125. protocol: 'tests',
  4126. fn: function (){
  4127. var self=this;
  4128. var array;
  4129. return smalltalk.withContext(function($ctx1) {
  4130. array=self._collection();
  4131. _st(array)._add_((6));
  4132. self._assert_equals_(_st(array)._last(),(6));
  4133. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)})},
  4134. args: [],
  4135. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4136. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4137. referencedClasses: []
  4138. }),
  4139. globals.ArrayTest);
  4140. smalltalk.addMethod(
  4141. smalltalk.method({
  4142. selector: "testAddFirst",
  4143. protocol: 'tests',
  4144. fn: function (){
  4145. var self=this;
  4146. return smalltalk.withContext(function($ctx1) {
  4147. var $1,$2;
  4148. $1=self._collection();
  4149. _st($1)._addFirst_((0));
  4150. $2=_st($1)._yourself();
  4151. self._assert_equals_(_st($2)._first(),(0));
  4152. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)})},
  4153. args: [],
  4154. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4155. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4156. referencedClasses: []
  4157. }),
  4158. globals.ArrayTest);
  4159. smalltalk.addMethod(
  4160. smalltalk.method({
  4161. selector: "testPrintString",
  4162. protocol: 'tests',
  4163. fn: function (){
  4164. var self=this;
  4165. var array;
  4166. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4167. return smalltalk.withContext(function($ctx1) {
  4168. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4169. array=_st($Array())._new();
  4170. $1=_st(array)._printString();
  4171. $ctx1.sendIdx["printString"]=1;
  4172. self._assert_equals_($1,"an Array ()");
  4173. $ctx1.sendIdx["assert:equals:"]=1;
  4174. $2=array;
  4175. _st($2)._add_((1));
  4176. $ctx1.sendIdx["add:"]=1;
  4177. $3=_st($2)._add_((3));
  4178. $ctx1.sendIdx["add:"]=2;
  4179. $4=_st(array)._printString();
  4180. $ctx1.sendIdx["printString"]=2;
  4181. self._assert_equals_($4,"an Array (1 3)");
  4182. $ctx1.sendIdx["assert:equals:"]=2;
  4183. _st(array)._add_("foo");
  4184. $5=_st(array)._printString();
  4185. $ctx1.sendIdx["printString"]=3;
  4186. self._assert_equals_($5,"an Array (1 3 'foo')");
  4187. $ctx1.sendIdx["assert:equals:"]=3;
  4188. $6=array;
  4189. _st($6)._remove_((1));
  4190. $ctx1.sendIdx["remove:"]=1;
  4191. $7=_st($6)._remove_((3));
  4192. $8=_st(array)._printString();
  4193. $ctx1.sendIdx["printString"]=4;
  4194. self._assert_equals_($8,"an Array ('foo')");
  4195. $ctx1.sendIdx["assert:equals:"]=4;
  4196. _st(array)._addLast_((3));
  4197. $ctx1.sendIdx["addLast:"]=1;
  4198. $9=_st(array)._printString();
  4199. $ctx1.sendIdx["printString"]=5;
  4200. self._assert_equals_($9,"an Array ('foo' 3)");
  4201. $ctx1.sendIdx["assert:equals:"]=5;
  4202. _st(array)._addLast_((3));
  4203. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4204. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)})},
  4205. args: [],
  4206. 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)'.",
  4207. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4208. referencedClasses: ["Array"]
  4209. }),
  4210. globals.ArrayTest);
  4211. smalltalk.addMethod(
  4212. smalltalk.method({
  4213. selector: "testRemove",
  4214. protocol: 'tests',
  4215. fn: function (){
  4216. var self=this;
  4217. var array;
  4218. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4219. return smalltalk.withContext(function($ctx1) {
  4220. array=[(1), (2), (3), (4), (5)];
  4221. _st(array)._remove_((3));
  4222. $ctx1.sendIdx["remove:"]=1;
  4223. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4224. self._should_raise_((function(){
  4225. return smalltalk.withContext(function($ctx2) {
  4226. return _st(array)._remove_((3));
  4227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4228. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)})},
  4229. args: [],
  4230. 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",
  4231. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4232. referencedClasses: ["Error"]
  4233. }),
  4234. globals.ArrayTest);
  4235. smalltalk.addMethod(
  4236. smalltalk.method({
  4237. selector: "testRemoveFromTo",
  4238. protocol: 'tests',
  4239. fn: function (){
  4240. var self=this;
  4241. return smalltalk.withContext(function($ctx1) {
  4242. var $1,$2;
  4243. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4244. $ctx1.sendIdx["removeFrom:to:"]=1;
  4245. self._assert_equals_($1,[(4)]);
  4246. $ctx1.sendIdx["assert:equals:"]=1;
  4247. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4248. $ctx1.sendIdx["removeFrom:to:"]=2;
  4249. self._assert_equals_($2,[(1), (4)]);
  4250. $ctx1.sendIdx["assert:equals:"]=2;
  4251. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4252. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)})},
  4253. args: [],
  4254. 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)",
  4255. messageSends: ["assert:equals:", "removeFrom:to:"],
  4256. referencedClasses: []
  4257. }),
  4258. globals.ArrayTest);
  4259. smalltalk.addMethod(
  4260. smalltalk.method({
  4261. selector: "testRemoveIndex",
  4262. protocol: 'tests',
  4263. fn: function (){
  4264. var self=this;
  4265. return smalltalk.withContext(function($ctx1) {
  4266. var $1,$2;
  4267. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4268. $ctx1.sendIdx["removeIndex:"]=1;
  4269. self._assert_equals_($1,[(1), (3), (4)]);
  4270. $ctx1.sendIdx["assert:equals:"]=1;
  4271. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4272. $ctx1.sendIdx["removeIndex:"]=2;
  4273. self._assert_equals_($2,[(2), (3), (4)]);
  4274. $ctx1.sendIdx["assert:equals:"]=2;
  4275. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4276. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)})},
  4277. args: [],
  4278. 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: #()",
  4279. messageSends: ["assert:equals:", "removeIndex:"],
  4280. referencedClasses: []
  4281. }),
  4282. globals.ArrayTest);
  4283. smalltalk.addMethod(
  4284. smalltalk.method({
  4285. selector: "testRemoveLast",
  4286. protocol: 'tests',
  4287. fn: function (){
  4288. var self=this;
  4289. var array;
  4290. return smalltalk.withContext(function($ctx1) {
  4291. array=[(1), (2)];
  4292. _st(array)._removeLast();
  4293. self._assert_equals_(_st(array)._last(),(1));
  4294. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)})},
  4295. args: [],
  4296. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4297. messageSends: ["removeLast", "assert:equals:", "last"],
  4298. referencedClasses: []
  4299. }),
  4300. globals.ArrayTest);
  4301. smalltalk.addMethod(
  4302. smalltalk.method({
  4303. selector: "testReversed",
  4304. protocol: 'tests',
  4305. fn: function (){
  4306. var self=this;
  4307. var array;
  4308. return smalltalk.withContext(function($ctx1) {
  4309. array=[(5), (4), (3), (2), (1)];
  4310. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4311. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)})},
  4312. args: [],
  4313. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4314. messageSends: ["assert:equals:", "reversed"],
  4315. referencedClasses: []
  4316. }),
  4317. globals.ArrayTest);
  4318. smalltalk.addMethod(
  4319. smalltalk.method({
  4320. selector: "testSort",
  4321. protocol: 'tests',
  4322. fn: function (){
  4323. var self=this;
  4324. var array;
  4325. return smalltalk.withContext(function($ctx1) {
  4326. array=[(3), (1), (4), (5), (2)];
  4327. _st(array)._sort();
  4328. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  4329. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)})},
  4330. args: [],
  4331. 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)",
  4332. messageSends: ["sort", "assert:equals:"],
  4333. referencedClasses: []
  4334. }),
  4335. globals.ArrayTest);
  4336. smalltalk.addMethod(
  4337. smalltalk.method({
  4338. selector: "collectionClass",
  4339. protocol: 'fixture',
  4340. fn: function (){
  4341. var self=this;
  4342. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4343. return $Array();
  4344. },
  4345. args: [],
  4346. source: "collectionClass\x0a\x09^ Array",
  4347. messageSends: [],
  4348. referencedClasses: ["Array"]
  4349. }),
  4350. globals.ArrayTest.klass);
  4351. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  4352. smalltalk.addMethod(
  4353. smalltalk.method({
  4354. selector: "collection",
  4355. protocol: 'fixture',
  4356. fn: function (){
  4357. var self=this;
  4358. return "helLo";
  4359. },
  4360. args: [],
  4361. source: "collection\x0a\x09^ 'helLo'",
  4362. messageSends: [],
  4363. referencedClasses: []
  4364. }),
  4365. globals.StringTest);
  4366. smalltalk.addMethod(
  4367. smalltalk.method({
  4368. selector: "collectionFirst",
  4369. protocol: 'fixture',
  4370. fn: function (){
  4371. var self=this;
  4372. return "h";
  4373. },
  4374. args: [],
  4375. source: "collectionFirst\x0a\x09^ 'h'",
  4376. messageSends: [],
  4377. referencedClasses: []
  4378. }),
  4379. globals.StringTest);
  4380. smalltalk.addMethod(
  4381. smalltalk.method({
  4382. selector: "collectionFirstTwo",
  4383. protocol: 'fixture',
  4384. fn: function (){
  4385. var self=this;
  4386. return "he";
  4387. },
  4388. args: [],
  4389. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4390. messageSends: [],
  4391. referencedClasses: []
  4392. }),
  4393. globals.StringTest);
  4394. smalltalk.addMethod(
  4395. smalltalk.method({
  4396. selector: "collectionLast",
  4397. protocol: 'fixture',
  4398. fn: function (){
  4399. var self=this;
  4400. return "o";
  4401. },
  4402. args: [],
  4403. source: "collectionLast\x0a\x09^ 'o'",
  4404. messageSends: [],
  4405. referencedClasses: []
  4406. }),
  4407. globals.StringTest);
  4408. smalltalk.addMethod(
  4409. smalltalk.method({
  4410. selector: "collectionLastTwo",
  4411. protocol: 'fixture',
  4412. fn: function (){
  4413. var self=this;
  4414. return "Lo";
  4415. },
  4416. args: [],
  4417. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4418. messageSends: [],
  4419. referencedClasses: []
  4420. }),
  4421. globals.StringTest);
  4422. smalltalk.addMethod(
  4423. smalltalk.method({
  4424. selector: "collectionOfPrintStrings",
  4425. protocol: 'fixture',
  4426. fn: function (){
  4427. var self=this;
  4428. return "'h''e''l''L''o'";
  4429. },
  4430. args: [],
  4431. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4432. messageSends: [],
  4433. referencedClasses: []
  4434. }),
  4435. globals.StringTest);
  4436. smalltalk.addMethod(
  4437. smalltalk.method({
  4438. selector: "collectionSize",
  4439. protocol: 'fixture',
  4440. fn: function (){
  4441. var self=this;
  4442. return (5);
  4443. },
  4444. args: [],
  4445. source: "collectionSize\x0a\x09^ 5",
  4446. messageSends: [],
  4447. referencedClasses: []
  4448. }),
  4449. globals.StringTest);
  4450. smalltalk.addMethod(
  4451. smalltalk.method({
  4452. selector: "collectionWithDuplicates",
  4453. protocol: 'fixture',
  4454. fn: function (){
  4455. var self=this;
  4456. return "abbaerte";
  4457. },
  4458. args: [],
  4459. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4460. messageSends: [],
  4461. referencedClasses: []
  4462. }),
  4463. globals.StringTest);
  4464. smalltalk.addMethod(
  4465. smalltalk.method({
  4466. selector: "collectionWithNewValue",
  4467. protocol: 'fixture',
  4468. fn: function (){
  4469. var self=this;
  4470. return "helLoN";
  4471. },
  4472. args: [],
  4473. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4474. messageSends: [],
  4475. referencedClasses: []
  4476. }),
  4477. globals.StringTest);
  4478. smalltalk.addMethod(
  4479. smalltalk.method({
  4480. selector: "sampleNewValueAsCollection",
  4481. protocol: 'fixture',
  4482. fn: function (){
  4483. var self=this;
  4484. return "N";
  4485. },
  4486. args: [],
  4487. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4488. messageSends: [],
  4489. referencedClasses: []
  4490. }),
  4491. globals.StringTest);
  4492. smalltalk.addMethod(
  4493. smalltalk.method({
  4494. selector: "samplesDo:",
  4495. protocol: 'fixture',
  4496. fn: function (aBlock){
  4497. var self=this;
  4498. return smalltalk.withContext(function($ctx1) {
  4499. globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4500. _st(aBlock)._value_value_((3),"l");
  4501. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)})},
  4502. args: ["aBlock"],
  4503. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4504. messageSends: ["samplesDo:", "value:value:"],
  4505. referencedClasses: []
  4506. }),
  4507. globals.StringTest);
  4508. smalltalk.addMethod(
  4509. smalltalk.method({
  4510. selector: "testAddAll",
  4511. protocol: 'tests',
  4512. fn: function (){
  4513. var self=this;
  4514. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4515. return smalltalk.withContext(function($ctx1) {
  4516. var $1;
  4517. self._should_raise_((function(){
  4518. return smalltalk.withContext(function($ctx2) {
  4519. $1=self._collection();
  4520. $ctx2.sendIdx["collection"]=1;
  4521. return _st($1)._addAll_(self._collection());
  4522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4523. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)})},
  4524. args: [],
  4525. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4526. messageSends: ["should:raise:", "addAll:", "collection"],
  4527. referencedClasses: ["Error"]
  4528. }),
  4529. globals.StringTest);
  4530. smalltalk.addMethod(
  4531. smalltalk.method({
  4532. selector: "testAddRemove",
  4533. protocol: 'tests',
  4534. fn: function (){
  4535. var self=this;
  4536. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4537. return smalltalk.withContext(function($ctx1) {
  4538. self._should_raise_((function(){
  4539. return smalltalk.withContext(function($ctx2) {
  4540. return "hello"._add_("a");
  4541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4542. $ctx1.sendIdx["should:raise:"]=1;
  4543. self._should_raise_((function(){
  4544. return smalltalk.withContext(function($ctx2) {
  4545. return "hello"._remove_("h");
  4546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4547. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)})},
  4548. args: [],
  4549. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4550. messageSends: ["should:raise:", "add:", "remove:"],
  4551. referencedClasses: ["Error"]
  4552. }),
  4553. globals.StringTest);
  4554. smalltalk.addMethod(
  4555. smalltalk.method({
  4556. selector: "testAsArray",
  4557. protocol: 'tests',
  4558. fn: function (){
  4559. var self=this;
  4560. return smalltalk.withContext(function($ctx1) {
  4561. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4562. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)})},
  4563. args: [],
  4564. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4565. messageSends: ["assert:equals:", "asArray"],
  4566. referencedClasses: []
  4567. }),
  4568. globals.StringTest);
  4569. smalltalk.addMethod(
  4570. smalltalk.method({
  4571. selector: "testAsLowerCase",
  4572. protocol: 'tests',
  4573. fn: function (){
  4574. var self=this;
  4575. return smalltalk.withContext(function($ctx1) {
  4576. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4577. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)})},
  4578. args: [],
  4579. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4580. messageSends: ["assert:equals:", "asLowercase"],
  4581. referencedClasses: []
  4582. }),
  4583. globals.StringTest);
  4584. smalltalk.addMethod(
  4585. smalltalk.method({
  4586. selector: "testAsNumber",
  4587. protocol: 'tests',
  4588. fn: function (){
  4589. var self=this;
  4590. return smalltalk.withContext(function($ctx1) {
  4591. var $1,$2;
  4592. $1="3"._asNumber();
  4593. $ctx1.sendIdx["asNumber"]=1;
  4594. self._assert_equals_($1,(3));
  4595. $ctx1.sendIdx["assert:equals:"]=1;
  4596. $2="-3"._asNumber();
  4597. $ctx1.sendIdx["asNumber"]=2;
  4598. self._assert_equals_($2,(-3));
  4599. $ctx1.sendIdx["assert:equals:"]=2;
  4600. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4601. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)})},
  4602. args: [],
  4603. 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.",
  4604. messageSends: ["assert:equals:", "asNumber"],
  4605. referencedClasses: []
  4606. }),
  4607. globals.StringTest);
  4608. smalltalk.addMethod(
  4609. smalltalk.method({
  4610. selector: "testAsUpperCase",
  4611. protocol: 'tests',
  4612. fn: function (){
  4613. var self=this;
  4614. return smalltalk.withContext(function($ctx1) {
  4615. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4616. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)})},
  4617. args: [],
  4618. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4619. messageSends: ["assert:equals:", "asUppercase"],
  4620. referencedClasses: []
  4621. }),
  4622. globals.StringTest);
  4623. smalltalk.addMethod(
  4624. smalltalk.method({
  4625. selector: "testAsciiValue",
  4626. protocol: 'tests',
  4627. fn: function (){
  4628. var self=this;
  4629. var characterA,characterU;
  4630. return smalltalk.withContext(function($ctx1) {
  4631. var $1;
  4632. characterA="A";
  4633. characterU="U";
  4634. $1=_st(characterA)._asciiValue();
  4635. $ctx1.sendIdx["asciiValue"]=1;
  4636. self._assert_equals_($1,(65));
  4637. $ctx1.sendIdx["assert:equals:"]=1;
  4638. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4639. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)})},
  4640. args: [],
  4641. 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",
  4642. messageSends: ["assert:equals:", "asciiValue"],
  4643. referencedClasses: []
  4644. }),
  4645. globals.StringTest);
  4646. smalltalk.addMethod(
  4647. smalltalk.method({
  4648. selector: "testAtIfAbsentPut",
  4649. protocol: 'tests',
  4650. fn: function (){
  4651. var self=this;
  4652. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4653. return smalltalk.withContext(function($ctx1) {
  4654. self._should_raise_((function(){
  4655. return smalltalk.withContext(function($ctx2) {
  4656. return "hello"._at_ifAbsentPut_((6),(function(){
  4657. return smalltalk.withContext(function($ctx3) {
  4658. return "a";
  4659. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  4660. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4661. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)})},
  4662. args: [],
  4663. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4664. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4665. referencedClasses: ["Error"]
  4666. }),
  4667. globals.StringTest);
  4668. smalltalk.addMethod(
  4669. smalltalk.method({
  4670. selector: "testAtPut",
  4671. protocol: 'tests',
  4672. fn: function (){
  4673. var self=this;
  4674. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4675. return smalltalk.withContext(function($ctx1) {
  4676. self._should_raise_((function(){
  4677. return smalltalk.withContext(function($ctx2) {
  4678. return "hello"._at_put_((1),"a");
  4679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4680. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)})},
  4681. args: [],
  4682. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4683. messageSends: ["should:raise:", "at:put:"],
  4684. referencedClasses: ["Error"]
  4685. }),
  4686. globals.StringTest);
  4687. smalltalk.addMethod(
  4688. smalltalk.method({
  4689. selector: "testCapitalized",
  4690. protocol: 'tests',
  4691. fn: function (){
  4692. var self=this;
  4693. return smalltalk.withContext(function($ctx1) {
  4694. var $1,$2,$3;
  4695. $1="test"._capitalized();
  4696. $ctx1.sendIdx["capitalized"]=1;
  4697. self._assert_equals_($1,"Test");
  4698. $ctx1.sendIdx["assert:equals:"]=1;
  4699. $2="Test"._capitalized();
  4700. $ctx1.sendIdx["capitalized"]=2;
  4701. self._assert_equals_($2,"Test");
  4702. $ctx1.sendIdx["assert:equals:"]=2;
  4703. self._assert_equals_(""._capitalized(),"");
  4704. $ctx1.sendIdx["assert:equals:"]=3;
  4705. $3="Test"._isCapitalized();
  4706. $ctx1.sendIdx["isCapitalized"]=1;
  4707. self._assert_equals_($3,true);
  4708. $ctx1.sendIdx["assert:equals:"]=4;
  4709. self._assert_equals_("test"._isCapitalized(),false);
  4710. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)})},
  4711. args: [],
  4712. 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.",
  4713. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4714. referencedClasses: []
  4715. }),
  4716. globals.StringTest);
  4717. smalltalk.addMethod(
  4718. smalltalk.method({
  4719. selector: "testCharCodeAt",
  4720. protocol: 'tests',
  4721. fn: function (){
  4722. var self=this;
  4723. return smalltalk.withContext(function($ctx1) {
  4724. var $1,$2,$3,$4,$5;
  4725. $1="jackie"._charCodeAt_((1));
  4726. $ctx1.sendIdx["charCodeAt:"]=1;
  4727. self._assert_equals_($1,(106));
  4728. $ctx1.sendIdx["assert:equals:"]=1;
  4729. $2="jackie"._charCodeAt_((2));
  4730. $ctx1.sendIdx["charCodeAt:"]=2;
  4731. self._assert_equals_($2,(97));
  4732. $ctx1.sendIdx["assert:equals:"]=2;
  4733. $3="jackie"._charCodeAt_((3));
  4734. $ctx1.sendIdx["charCodeAt:"]=3;
  4735. self._assert_equals_($3,(99));
  4736. $ctx1.sendIdx["assert:equals:"]=3;
  4737. $4="jackie"._charCodeAt_((4));
  4738. $ctx1.sendIdx["charCodeAt:"]=4;
  4739. self._assert_equals_($4,(107));
  4740. $ctx1.sendIdx["assert:equals:"]=4;
  4741. $5="jackie"._charCodeAt_((5));
  4742. $ctx1.sendIdx["charCodeAt:"]=5;
  4743. self._assert_equals_($5,(105));
  4744. $ctx1.sendIdx["assert:equals:"]=5;
  4745. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4746. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)})},
  4747. args: [],
  4748. 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",
  4749. messageSends: ["assert:equals:", "charCodeAt:"],
  4750. referencedClasses: []
  4751. }),
  4752. globals.StringTest);
  4753. smalltalk.addMethod(
  4754. smalltalk.method({
  4755. selector: "testCopyFromTo",
  4756. protocol: 'tests',
  4757. fn: function (){
  4758. var self=this;
  4759. return smalltalk.withContext(function($ctx1) {
  4760. var $1;
  4761. $1="jackie"._copyFrom_to_((1),(3));
  4762. $ctx1.sendIdx["copyFrom:to:"]=1;
  4763. self._assert_equals_($1,"jac");
  4764. $ctx1.sendIdx["assert:equals:"]=1;
  4765. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4766. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)})},
  4767. args: [],
  4768. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4769. messageSends: ["assert:equals:", "copyFrom:to:"],
  4770. referencedClasses: []
  4771. }),
  4772. globals.StringTest);
  4773. smalltalk.addMethod(
  4774. smalltalk.method({
  4775. selector: "testCopyWithoutAll",
  4776. protocol: 'tests',
  4777. fn: function (){
  4778. var self=this;
  4779. return smalltalk.withContext(function($ctx1) {
  4780. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4781. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)})},
  4782. args: [],
  4783. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4784. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4785. referencedClasses: []
  4786. }),
  4787. globals.StringTest);
  4788. smalltalk.addMethod(
  4789. smalltalk.method({
  4790. selector: "testEquality",
  4791. protocol: 'tests',
  4792. fn: function (){
  4793. var self=this;
  4794. return smalltalk.withContext(function($ctx1) {
  4795. var $1,$2,$3;
  4796. self._assert_equals_("hello","hello");
  4797. $ctx1.sendIdx["assert:equals:"]=1;
  4798. $1="hello".__eq("world");
  4799. $ctx1.sendIdx["="]=1;
  4800. self._deny_($1);
  4801. $ctx1.sendIdx["deny:"]=1;
  4802. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4803. return smalltalk.withContext(function($ctx2) {
  4804. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  4805. $ctx1.sendIdx["="]=2;
  4806. self._deny_($2);
  4807. $ctx1.sendIdx["deny:"]=2;
  4808. $3="hello"._yourself();
  4809. $ctx1.sendIdx["yourself"]=1;
  4810. self._assert_equals_("hello",$3);
  4811. $ctx1.sendIdx["assert:equals:"]=2;
  4812. self._assert_equals_("hello"._yourself(),"hello");
  4813. self._deny_("".__eq((0)));
  4814. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)})},
  4815. args: [],
  4816. 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",
  4817. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4818. referencedClasses: []
  4819. }),
  4820. globals.StringTest);
  4821. smalltalk.addMethod(
  4822. smalltalk.method({
  4823. selector: "testIdentity",
  4824. protocol: 'tests',
  4825. fn: function (){
  4826. var self=this;
  4827. return smalltalk.withContext(function($ctx1) {
  4828. var $1,$2,$4,$3,$5;
  4829. $1="hello".__eq_eq("hello");
  4830. $ctx1.sendIdx["=="]=1;
  4831. self._assert_($1);
  4832. $ctx1.sendIdx["assert:"]=1;
  4833. $2="hello".__eq_eq("world");
  4834. $ctx1.sendIdx["=="]=2;
  4835. self._deny_($2);
  4836. $ctx1.sendIdx["deny:"]=1;
  4837. $4="hello"._yourself();
  4838. $ctx1.sendIdx["yourself"]=1;
  4839. $3="hello".__eq_eq($4);
  4840. $ctx1.sendIdx["=="]=3;
  4841. self._assert_($3);
  4842. $ctx1.sendIdx["assert:"]=2;
  4843. $5=_st("hello"._yourself()).__eq_eq("hello");
  4844. $ctx1.sendIdx["=="]=4;
  4845. self._assert_($5);
  4846. self._deny_("".__eq_eq((0)));
  4847. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)})},
  4848. args: [],
  4849. 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",
  4850. messageSends: ["assert:", "==", "deny:", "yourself"],
  4851. referencedClasses: []
  4852. }),
  4853. globals.StringTest);
  4854. smalltalk.addMethod(
  4855. smalltalk.method({
  4856. selector: "testIdentityHash",
  4857. protocol: 'tests',
  4858. fn: function (){
  4859. var self=this;
  4860. return smalltalk.withContext(function($ctx1) {
  4861. var $1,$2,$4,$3;
  4862. $1="foo"._identityHash();
  4863. $ctx1.sendIdx["identityHash"]=1;
  4864. $2="foo"._identityHash();
  4865. $ctx1.sendIdx["identityHash"]=2;
  4866. self._assert_equals_($1,$2);
  4867. $4="foo"._identityHash();
  4868. $ctx1.sendIdx["identityHash"]=3;
  4869. $3=_st($4).__eq("bar"._identityHash());
  4870. self._deny_($3);
  4871. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)})},
  4872. args: [],
  4873. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4874. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4875. referencedClasses: []
  4876. }),
  4877. globals.StringTest);
  4878. smalltalk.addMethod(
  4879. smalltalk.method({
  4880. selector: "testIncludesSubString",
  4881. protocol: 'tests',
  4882. fn: function (){
  4883. var self=this;
  4884. return smalltalk.withContext(function($ctx1) {
  4885. var $1;
  4886. $1="amber"._includesSubString_("ber");
  4887. $ctx1.sendIdx["includesSubString:"]=1;
  4888. self._assert_($1);
  4889. self._deny_("amber"._includesSubString_("zork"));
  4890. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)})},
  4891. args: [],
  4892. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4893. messageSends: ["assert:", "includesSubString:", "deny:"],
  4894. referencedClasses: []
  4895. }),
  4896. globals.StringTest);
  4897. smalltalk.addMethod(
  4898. smalltalk.method({
  4899. selector: "testIndexOfStartingAtWithNull",
  4900. protocol: 'tests',
  4901. fn: function (){
  4902. var self=this;
  4903. return self},
  4904. args: [],
  4905. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4906. messageSends: [],
  4907. referencedClasses: []
  4908. }),
  4909. globals.StringTest);
  4910. smalltalk.addMethod(
  4911. smalltalk.method({
  4912. selector: "testIndexOfWithNull",
  4913. protocol: 'tests',
  4914. fn: function (){
  4915. var self=this;
  4916. return self},
  4917. args: [],
  4918. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4919. messageSends: [],
  4920. referencedClasses: []
  4921. }),
  4922. globals.StringTest);
  4923. smalltalk.addMethod(
  4924. smalltalk.method({
  4925. selector: "testIsVowel",
  4926. protocol: 'tests',
  4927. fn: function (){
  4928. var self=this;
  4929. var vowel,consonant;
  4930. return smalltalk.withContext(function($ctx1) {
  4931. var $1;
  4932. vowel="u";
  4933. consonant="z";
  4934. $1=_st(vowel)._isVowel();
  4935. $ctx1.sendIdx["isVowel"]=1;
  4936. self._assert_equals_($1,true);
  4937. $ctx1.sendIdx["assert:equals:"]=1;
  4938. self._assert_equals_(_st(consonant)._isVowel(),false);
  4939. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)})},
  4940. args: [],
  4941. 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",
  4942. messageSends: ["assert:equals:", "isVowel"],
  4943. referencedClasses: []
  4944. }),
  4945. globals.StringTest);
  4946. smalltalk.addMethod(
  4947. smalltalk.method({
  4948. selector: "testJoin",
  4949. protocol: 'tests',
  4950. fn: function (){
  4951. var self=this;
  4952. return smalltalk.withContext(function($ctx1) {
  4953. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4954. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)})},
  4955. args: [],
  4956. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4957. messageSends: ["assert:equals:", "join:"],
  4958. referencedClasses: []
  4959. }),
  4960. globals.StringTest);
  4961. smalltalk.addMethod(
  4962. smalltalk.method({
  4963. selector: "testRemoveAll",
  4964. protocol: 'tests',
  4965. fn: function (){
  4966. var self=this;
  4967. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4968. return smalltalk.withContext(function($ctx1) {
  4969. self._should_raise_((function(){
  4970. return smalltalk.withContext(function($ctx2) {
  4971. return _st(self._collection())._removeAll();
  4972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4973. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)})},
  4974. args: [],
  4975. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4976. messageSends: ["should:raise:", "removeAll", "collection"],
  4977. referencedClasses: ["Error"]
  4978. }),
  4979. globals.StringTest);
  4980. smalltalk.addMethod(
  4981. smalltalk.method({
  4982. selector: "testReversed",
  4983. protocol: 'tests',
  4984. fn: function (){
  4985. var self=this;
  4986. return smalltalk.withContext(function($ctx1) {
  4987. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4988. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)})},
  4989. args: [],
  4990. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4991. messageSends: ["assert:equals:", "reversed"],
  4992. referencedClasses: []
  4993. }),
  4994. globals.StringTest);
  4995. smalltalk.addMethod(
  4996. smalltalk.method({
  4997. selector: "testStreamContents",
  4998. protocol: 'tests',
  4999. fn: function (){
  5000. var self=this;
  5001. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5002. return smalltalk.withContext(function($ctx1) {
  5003. var $1;
  5004. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  5005. return smalltalk.withContext(function($ctx2) {
  5006. _st(aStream)._nextPutAll_("hello");
  5007. $ctx2.sendIdx["nextPutAll:"]=1;
  5008. _st(aStream)._space();
  5009. $1=_st(aStream)._nextPutAll_("world");
  5010. return $1;
  5011. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  5012. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)})},
  5013. args: [],
  5014. 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'",
  5015. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  5016. referencedClasses: ["String"]
  5017. }),
  5018. globals.StringTest);
  5019. smalltalk.addMethod(
  5020. smalltalk.method({
  5021. selector: "testSubStrings",
  5022. protocol: 'tests',
  5023. fn: function (){
  5024. var self=this;
  5025. return smalltalk.withContext(function($ctx1) {
  5026. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  5027. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)})},
  5028. args: [],
  5029. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  5030. messageSends: ["assert:equals:", "subStrings:"],
  5031. referencedClasses: []
  5032. }),
  5033. globals.StringTest);
  5034. smalltalk.addMethod(
  5035. smalltalk.method({
  5036. selector: "testTrim",
  5037. protocol: 'tests',
  5038. fn: function (){
  5039. var self=this;
  5040. return smalltalk.withContext(function($ctx1) {
  5041. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  5042. $ctx1.sendIdx["assert:equals:"]=1;
  5043. self._assert_equals_("jackie "._trimRight(),"jackie");
  5044. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)})},
  5045. args: [],
  5046. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  5047. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  5048. referencedClasses: []
  5049. }),
  5050. globals.StringTest);
  5051. smalltalk.addMethod(
  5052. smalltalk.method({
  5053. selector: "collectionClass",
  5054. protocol: 'fixture',
  5055. fn: function (){
  5056. var self=this;
  5057. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5058. return $String();
  5059. },
  5060. args: [],
  5061. source: "collectionClass\x0a\x09^ String",
  5062. messageSends: [],
  5063. referencedClasses: ["String"]
  5064. }),
  5065. globals.StringTest.klass);
  5066. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  5067. smalltalk.addMethod(
  5068. smalltalk.method({
  5069. selector: "collection",
  5070. protocol: 'fixture',
  5071. fn: function (){
  5072. var self=this;
  5073. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5074. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5075. return smalltalk.withContext(function($ctx1) {
  5076. var $2,$3,$1;
  5077. $2=_st($Set())._new();
  5078. _st($2)._add_($Smalltalk());
  5079. $ctx1.sendIdx["add:"]=1;
  5080. _st($2)._add_(nil);
  5081. $ctx1.sendIdx["add:"]=2;
  5082. _st($2)._add_((3).__at((3)));
  5083. $ctx1.sendIdx["add:"]=3;
  5084. _st($2)._add_(false);
  5085. $3=_st($2)._yourself();
  5086. $1=$3;
  5087. return $1;
  5088. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)})},
  5089. args: [],
  5090. 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",
  5091. messageSends: ["add:", "new", "@", "yourself"],
  5092. referencedClasses: ["Set", "Smalltalk"]
  5093. }),
  5094. globals.SetTest);
  5095. smalltalk.addMethod(
  5096. smalltalk.method({
  5097. selector: "collectionOfPrintStrings",
  5098. protocol: 'fixture',
  5099. fn: function (){
  5100. var self=this;
  5101. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5102. return smalltalk.withContext(function($ctx1) {
  5103. var $2,$3,$1;
  5104. $2=_st($Set())._new();
  5105. _st($2)._add_("a SmalltalkImage");
  5106. $ctx1.sendIdx["add:"]=1;
  5107. _st($2)._add_("nil");
  5108. $ctx1.sendIdx["add:"]=2;
  5109. _st($2)._add_("3@3");
  5110. $ctx1.sendIdx["add:"]=3;
  5111. _st($2)._add_("false");
  5112. $3=_st($2)._yourself();
  5113. $1=$3;
  5114. return $1;
  5115. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)})},
  5116. args: [],
  5117. 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",
  5118. messageSends: ["add:", "new", "yourself"],
  5119. referencedClasses: ["Set"]
  5120. }),
  5121. globals.SetTest);
  5122. smalltalk.addMethod(
  5123. smalltalk.method({
  5124. selector: "collectionSize",
  5125. protocol: 'fixture',
  5126. fn: function (){
  5127. var self=this;
  5128. return (4);
  5129. },
  5130. args: [],
  5131. source: "collectionSize\x0a\x09^ 4",
  5132. messageSends: [],
  5133. referencedClasses: []
  5134. }),
  5135. globals.SetTest);
  5136. smalltalk.addMethod(
  5137. smalltalk.method({
  5138. selector: "collectionWithDuplicates",
  5139. protocol: 'fixture',
  5140. fn: function (){
  5141. var self=this;
  5142. return smalltalk.withContext(function($ctx1) {
  5143. var $2,$3,$1;
  5144. $2=self._collection();
  5145. _st($2)._add_((0));
  5146. $3=_st($2)._yourself();
  5147. $1=$3;
  5148. return $1;
  5149. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)})},
  5150. args: [],
  5151. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5152. messageSends: ["add:", "collection", "yourself"],
  5153. referencedClasses: []
  5154. }),
  5155. globals.SetTest);
  5156. smalltalk.addMethod(
  5157. smalltalk.method({
  5158. selector: "collectionWithNewValue",
  5159. protocol: 'fixture',
  5160. fn: function (){
  5161. var self=this;
  5162. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5163. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5164. return smalltalk.withContext(function($ctx1) {
  5165. var $2,$3,$1;
  5166. $2=_st($Set())._new();
  5167. _st($2)._add_($Smalltalk());
  5168. $ctx1.sendIdx["add:"]=1;
  5169. _st($2)._add_(nil);
  5170. $ctx1.sendIdx["add:"]=2;
  5171. _st($2)._add_((3).__at((3)));
  5172. $ctx1.sendIdx["add:"]=3;
  5173. _st($2)._add_("N");
  5174. $ctx1.sendIdx["add:"]=4;
  5175. _st($2)._add_(false);
  5176. $3=_st($2)._yourself();
  5177. $1=$3;
  5178. return $1;
  5179. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)})},
  5180. args: [],
  5181. 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",
  5182. messageSends: ["add:", "new", "@", "yourself"],
  5183. referencedClasses: ["Set", "Smalltalk"]
  5184. }),
  5185. globals.SetTest);
  5186. smalltalk.addMethod(
  5187. smalltalk.method({
  5188. selector: "testAddAll",
  5189. protocol: 'tests',
  5190. fn: function (){
  5191. var self=this;
  5192. return smalltalk.withContext(function($ctx1) {
  5193. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5194. globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  5195. $2=self._collection();
  5196. $ctx1.sendIdx["collection"]=1;
  5197. $3=$2;
  5198. $4=self._collection();
  5199. $ctx1.sendIdx["collection"]=2;
  5200. _st($3)._addAll_($4);
  5201. $ctx1.sendIdx["addAll:"]=1;
  5202. $5=_st($2)._yourself();
  5203. $ctx1.sendIdx["yourself"]=1;
  5204. $1=$5;
  5205. $6=self._collection();
  5206. $ctx1.sendIdx["collection"]=3;
  5207. self._assert_equals_($1,$6);
  5208. $ctx1.sendIdx["assert:equals:"]=1;
  5209. $8=self._collection();
  5210. $ctx1.sendIdx["collection"]=4;
  5211. $9=$8;
  5212. $10=self._collectionWithNewValue();
  5213. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5214. _st($9)._addAll_($10);
  5215. $ctx1.sendIdx["addAll:"]=2;
  5216. $11=_st($8)._yourself();
  5217. $ctx1.sendIdx["yourself"]=2;
  5218. $7=$11;
  5219. $12=self._collectionWithNewValue();
  5220. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5221. self._assert_equals_($7,$12);
  5222. $ctx1.sendIdx["assert:equals:"]=2;
  5223. $14=self._collectionWithNewValue();
  5224. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5225. _st($14)._addAll_(self._collection());
  5226. $15=_st($14)._yourself();
  5227. $13=$15;
  5228. self._assert_equals_($13,self._collectionWithNewValue());
  5229. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)})},
  5230. args: [],
  5231. 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",
  5232. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5233. referencedClasses: []
  5234. }),
  5235. globals.SetTest);
  5236. smalltalk.addMethod(
  5237. smalltalk.method({
  5238. selector: "testAddRemove",
  5239. protocol: 'tests',
  5240. fn: function (){
  5241. var self=this;
  5242. var set;
  5243. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5244. return smalltalk.withContext(function($ctx1) {
  5245. var $1,$2;
  5246. set=_st($Set())._new();
  5247. self._assert_(_st(set)._isEmpty());
  5248. $ctx1.sendIdx["assert:"]=1;
  5249. _st(set)._add_((3));
  5250. $ctx1.sendIdx["add:"]=1;
  5251. $1=_st(set)._includes_((3));
  5252. $ctx1.sendIdx["includes:"]=1;
  5253. self._assert_($1);
  5254. $ctx1.sendIdx["assert:"]=2;
  5255. _st(set)._add_((5));
  5256. $2=_st(set)._includes_((5));
  5257. $ctx1.sendIdx["includes:"]=2;
  5258. self._assert_($2);
  5259. _st(set)._remove_((3));
  5260. self._deny_(_st(set)._includes_((3)));
  5261. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)})},
  5262. args: [],
  5263. 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)",
  5264. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5265. referencedClasses: ["Set"]
  5266. }),
  5267. globals.SetTest);
  5268. smalltalk.addMethod(
  5269. smalltalk.method({
  5270. selector: "testAt",
  5271. protocol: 'tests',
  5272. fn: function (){
  5273. var self=this;
  5274. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5275. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5276. return smalltalk.withContext(function($ctx1) {
  5277. self._should_raise_((function(){
  5278. return smalltalk.withContext(function($ctx2) {
  5279. return _st(_st($Set())._new())._at_put_((1),(2));
  5280. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5281. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)})},
  5282. args: [],
  5283. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5284. messageSends: ["should:raise:", "at:put:", "new"],
  5285. referencedClasses: ["Set", "Error"]
  5286. }),
  5287. globals.SetTest);
  5288. smalltalk.addMethod(
  5289. smalltalk.method({
  5290. selector: "testCollect",
  5291. protocol: 'tests',
  5292. fn: function (){
  5293. var self=this;
  5294. return smalltalk.withContext(function($ctx1) {
  5295. var $2,$1;
  5296. globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  5297. $2=[(5), (6), (8)]._asSet();
  5298. $ctx1.sendIdx["asSet"]=1;
  5299. $1=_st($2)._collect_((function(x){
  5300. return smalltalk.withContext(function($ctx2) {
  5301. return _st(x).__backslash_backslash((3));
  5302. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5303. self._assert_equals_($1,[(0), (2)]._asSet());
  5304. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)})},
  5305. args: [],
  5306. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5307. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5308. referencedClasses: []
  5309. }),
  5310. globals.SetTest);
  5311. smalltalk.addMethod(
  5312. smalltalk.method({
  5313. selector: "testComma",
  5314. protocol: 'tests',
  5315. fn: function (){
  5316. var self=this;
  5317. return smalltalk.withContext(function($ctx1) {
  5318. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5319. globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  5320. $2=self._collection();
  5321. $ctx1.sendIdx["collection"]=1;
  5322. $3=self._collection();
  5323. $ctx1.sendIdx["collection"]=2;
  5324. $1=_st($2).__comma($3);
  5325. $ctx1.sendIdx[","]=1;
  5326. $4=self._collection();
  5327. $ctx1.sendIdx["collection"]=3;
  5328. self._assert_equals_($1,$4);
  5329. $ctx1.sendIdx["assert:equals:"]=1;
  5330. $6=self._collection();
  5331. $ctx1.sendIdx["collection"]=4;
  5332. $7=self._collectionWithNewValue();
  5333. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5334. $5=_st($6).__comma($7);
  5335. $ctx1.sendIdx[","]=2;
  5336. $8=self._collectionWithNewValue();
  5337. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5338. self._assert_equals_($5,$8);
  5339. $ctx1.sendIdx["assert:equals:"]=2;
  5340. $10=self._collectionWithNewValue();
  5341. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5342. $9=_st($10).__comma(self._collection());
  5343. self._assert_equals_($9,self._collectionWithNewValue());
  5344. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)})},
  5345. args: [],
  5346. 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",
  5347. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5348. referencedClasses: []
  5349. }),
  5350. globals.SetTest);
  5351. smalltalk.addMethod(
  5352. smalltalk.method({
  5353. selector: "testComparing",
  5354. protocol: 'tests',
  5355. fn: function (){
  5356. var self=this;
  5357. return smalltalk.withContext(function($ctx1) {
  5358. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5359. $1=[(0), (2)]._asSet();
  5360. $ctx1.sendIdx["asSet"]=1;
  5361. $2=[(0), (2)]._asSet();
  5362. $ctx1.sendIdx["asSet"]=2;
  5363. self._assert_equals_($1,$2);
  5364. $ctx1.sendIdx["assert:equals:"]=1;
  5365. $3=[(2), (0)]._asSet();
  5366. $ctx1.sendIdx["asSet"]=3;
  5367. $4=[(0), (2)]._asSet();
  5368. $ctx1.sendIdx["asSet"]=4;
  5369. self._assert_equals_($3,$4);
  5370. $6=[(0), (2), (3)]._asSet();
  5371. $ctx1.sendIdx["asSet"]=5;
  5372. $7=[(0), (2)]._asSet();
  5373. $ctx1.sendIdx["asSet"]=6;
  5374. $5=_st($6).__eq($7);
  5375. $ctx1.sendIdx["="]=1;
  5376. self._deny_($5);
  5377. $ctx1.sendIdx["deny:"]=1;
  5378. $9=[(1), (2)]._asSet();
  5379. $ctx1.sendIdx["asSet"]=7;
  5380. $8=_st($9).__eq([(0), (2)]._asSet());
  5381. self._deny_($8);
  5382. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)})},
  5383. args: [],
  5384. 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",
  5385. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5386. referencedClasses: []
  5387. }),
  5388. globals.SetTest);
  5389. smalltalk.addMethod(
  5390. smalltalk.method({
  5391. selector: "testPrintString",
  5392. protocol: 'tests',
  5393. fn: function (){
  5394. var self=this;
  5395. var set;
  5396. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5397. return smalltalk.withContext(function($ctx1) {
  5398. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5399. set=_st($Set())._new();
  5400. $1=_st(set)._printString();
  5401. $ctx1.sendIdx["printString"]=1;
  5402. self._assert_equals_($1,"a Set ()");
  5403. $ctx1.sendIdx["assert:equals:"]=1;
  5404. $2=set;
  5405. _st($2)._add_((1));
  5406. $ctx1.sendIdx["add:"]=1;
  5407. $3=_st($2)._add_((3));
  5408. $ctx1.sendIdx["add:"]=2;
  5409. $4=_st(set)._printString();
  5410. $ctx1.sendIdx["printString"]=2;
  5411. self._assert_equals_($4,"a Set (1 3)");
  5412. $ctx1.sendIdx["assert:equals:"]=2;
  5413. _st(set)._add_("foo");
  5414. $ctx1.sendIdx["add:"]=3;
  5415. $5=_st(set)._printString();
  5416. $ctx1.sendIdx["printString"]=3;
  5417. self._assert_equals_($5,"a Set (1 3 'foo')");
  5418. $ctx1.sendIdx["assert:equals:"]=3;
  5419. $6=set;
  5420. _st($6)._remove_((1));
  5421. $ctx1.sendIdx["remove:"]=1;
  5422. $7=_st($6)._remove_((3));
  5423. $8=_st(set)._printString();
  5424. $ctx1.sendIdx["printString"]=4;
  5425. self._assert_equals_($8,"a Set ('foo')");
  5426. $ctx1.sendIdx["assert:equals:"]=4;
  5427. _st(set)._add_((3));
  5428. $ctx1.sendIdx["add:"]=4;
  5429. $9=_st(set)._printString();
  5430. $ctx1.sendIdx["printString"]=5;
  5431. self._assert_equals_($9,"a Set (3 'foo')");
  5432. $ctx1.sendIdx["assert:equals:"]=5;
  5433. _st(set)._add_((3));
  5434. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5435. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)})},
  5436. args: [],
  5437. 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'')'",
  5438. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5439. referencedClasses: ["Set"]
  5440. }),
  5441. globals.SetTest);
  5442. smalltalk.addMethod(
  5443. smalltalk.method({
  5444. selector: "testUnboxedObjects",
  5445. protocol: 'tests',
  5446. fn: function (){
  5447. var self=this;
  5448. return smalltalk.withContext(function($ctx1) {
  5449. var $4,$3,$2,$1;
  5450. $4="foo"._yourself();
  5451. $ctx1.sendIdx["yourself"]=1;
  5452. $3=[$4,"foo"._yourself()];
  5453. $2=_st($3)._asSet();
  5454. $1=_st($2)._asArray();
  5455. self._assert_equals_($1,["foo"]);
  5456. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)})},
  5457. args: [],
  5458. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5459. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5460. referencedClasses: []
  5461. }),
  5462. globals.SetTest);
  5463. smalltalk.addMethod(
  5464. smalltalk.method({
  5465. selector: "testUnicity",
  5466. protocol: 'tests',
  5467. fn: function (){
  5468. var self=this;
  5469. var set;
  5470. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5471. return smalltalk.withContext(function($ctx1) {
  5472. var $1;
  5473. set=_st($Set())._new();
  5474. _st(set)._add_((21));
  5475. $ctx1.sendIdx["add:"]=1;
  5476. _st(set)._add_("hello");
  5477. $ctx1.sendIdx["add:"]=2;
  5478. _st(set)._add_((21));
  5479. $ctx1.sendIdx["add:"]=3;
  5480. $1=_st(set)._size();
  5481. $ctx1.sendIdx["size"]=1;
  5482. self._assert_equals_($1,(2));
  5483. $ctx1.sendIdx["assert:equals:"]=1;
  5484. _st(set)._add_("hello");
  5485. self._assert_equals_(_st(set)._size(),(2));
  5486. $ctx1.sendIdx["assert:equals:"]=2;
  5487. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5488. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)})},
  5489. args: [],
  5490. 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')",
  5491. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5492. referencedClasses: ["Set"]
  5493. }),
  5494. globals.SetTest);
  5495. smalltalk.addMethod(
  5496. smalltalk.method({
  5497. selector: "collectionClass",
  5498. protocol: 'fixture',
  5499. fn: function (){
  5500. var self=this;
  5501. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5502. return $Set();
  5503. },
  5504. args: [],
  5505. source: "collectionClass\x0a\x09^ Set",
  5506. messageSends: [],
  5507. referencedClasses: ["Set"]
  5508. }),
  5509. globals.SetTest.klass);
  5510. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  5511. smalltalk.addMethod(
  5512. smalltalk.method({
  5513. selector: "testShow",
  5514. protocol: 'tests',
  5515. fn: function (){
  5516. var self=this;
  5517. var originalTranscript;
  5518. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5519. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5520. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5521. return smalltalk.withContext(function($ctx1) {
  5522. originalTranscript=_st($Transcript())._current();
  5523. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5524. $ctx1.sendIdx["register:"]=1;
  5525. self._shouldnt_raise_((function(){
  5526. return smalltalk.withContext(function($ctx2) {
  5527. return _st($Transcript())._show_("Hello console!");
  5528. $ctx2.sendIdx["show:"]=1;
  5529. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5530. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5531. self._shouldnt_raise_((function(){
  5532. return smalltalk.withContext(function($ctx2) {
  5533. return _st($Transcript())._show_(console);
  5534. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5535. _st($Transcript())._register_(originalTranscript);
  5536. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)})},
  5537. args: [],
  5538. 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.",
  5539. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5540. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5541. }),
  5542. globals.ConsoleTranscriptTest);
  5543. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  5544. smalltalk.addMethod(
  5545. smalltalk.method({
  5546. selector: "jsObject",
  5547. protocol: 'accessing',
  5548. fn: function (){
  5549. var self=this;
  5550. return smalltalk.withContext(function($ctx1) {
  5551. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5552. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},globals.JSObjectProxyTest)})},
  5553. args: [],
  5554. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5555. messageSends: [],
  5556. referencedClasses: []
  5557. }),
  5558. globals.JSObjectProxyTest);
  5559. smalltalk.addMethod(
  5560. smalltalk.method({
  5561. selector: "testAtIfAbsent",
  5562. protocol: 'tests',
  5563. fn: function (){
  5564. var self=this;
  5565. var testObject;
  5566. return smalltalk.withContext(function($ctx1) {
  5567. var $1,$2,$3;
  5568. testObject=self._jsObject();
  5569. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5570. return smalltalk.withContext(function($ctx2) {
  5571. return "Property does not exist";
  5572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5573. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5574. self._assert_equals_($1,"Property does not exist");
  5575. $ctx1.sendIdx["assert:equals:"]=1;
  5576. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5577. return smalltalk.withContext(function($ctx2) {
  5578. return "Property does not exist";
  5579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5580. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5581. self._assert_equals_($2,nil);
  5582. $ctx1.sendIdx["assert:equals:"]=2;
  5583. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5584. return smalltalk.withContext(function($ctx2) {
  5585. return "Property does not exist";
  5586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  5587. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5588. self._assert_equals_($3,(1));
  5589. $ctx1.sendIdx["assert:equals:"]=3;
  5590. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5591. return smalltalk.withContext(function($ctx2) {
  5592. return "Property does not exist";
  5593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  5594. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5595. args: [],
  5596. 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.",
  5597. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5598. referencedClasses: []
  5599. }),
  5600. globals.JSObjectProxyTest);
  5601. smalltalk.addMethod(
  5602. smalltalk.method({
  5603. selector: "testAtIfPresent",
  5604. protocol: 'tests',
  5605. fn: function (){
  5606. var self=this;
  5607. var testObject;
  5608. return smalltalk.withContext(function($ctx1) {
  5609. var $2,$1,$4,$3,$6,$5;
  5610. testObject=self._jsObject();
  5611. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5612. return smalltalk.withContext(function($ctx2) {
  5613. $2=_st(x)._asString();
  5614. $ctx2.sendIdx["asString"]=1;
  5615. return "hello ".__comma($2);
  5616. $ctx2.sendIdx[","]=1;
  5617. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5618. $ctx1.sendIdx["at:ifPresent:"]=1;
  5619. self._assert_equals_($1,nil);
  5620. $ctx1.sendIdx["assert:equals:"]=1;
  5621. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5622. return smalltalk.withContext(function($ctx2) {
  5623. $4=_st(x)._asString();
  5624. $ctx2.sendIdx["asString"]=2;
  5625. return "hello ".__comma($4);
  5626. $ctx2.sendIdx[","]=2;
  5627. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5628. $ctx1.sendIdx["at:ifPresent:"]=2;
  5629. self._assert_equals_($3,"hello nil");
  5630. $ctx1.sendIdx["assert:equals:"]=2;
  5631. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5632. return smalltalk.withContext(function($ctx2) {
  5633. $6=_st(x)._asString();
  5634. $ctx2.sendIdx["asString"]=3;
  5635. return "hello ".__comma($6);
  5636. $ctx2.sendIdx[","]=3;
  5637. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5638. $ctx1.sendIdx["at:ifPresent:"]=3;
  5639. self._assert_equals_($5,"hello 1");
  5640. $ctx1.sendIdx["assert:equals:"]=3;
  5641. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5642. return smalltalk.withContext(function($ctx2) {
  5643. return "hello ".__comma(_st(x)._asString());
  5644. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5645. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5646. args: [],
  5647. 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'.",
  5648. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5649. referencedClasses: []
  5650. }),
  5651. globals.JSObjectProxyTest);
  5652. smalltalk.addMethod(
  5653. smalltalk.method({
  5654. selector: "testAtIfPresentIfAbsent",
  5655. protocol: 'tests',
  5656. fn: function (){
  5657. var self=this;
  5658. var testObject;
  5659. return smalltalk.withContext(function($ctx1) {
  5660. var $2,$1,$4,$3,$6,$5;
  5661. testObject=self._jsObject();
  5662. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5663. return smalltalk.withContext(function($ctx2) {
  5664. $2=_st(x)._asString();
  5665. $ctx2.sendIdx["asString"]=1;
  5666. return "hello ".__comma($2);
  5667. $ctx2.sendIdx[","]=1;
  5668. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5669. return smalltalk.withContext(function($ctx2) {
  5670. return "not present";
  5671. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5672. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5673. self._assert_equals_($1,"not present");
  5674. $ctx1.sendIdx["assert:equals:"]=1;
  5675. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5676. return smalltalk.withContext(function($ctx2) {
  5677. $4=_st(x)._asString();
  5678. $ctx2.sendIdx["asString"]=2;
  5679. return "hello ".__comma($4);
  5680. $ctx2.sendIdx[","]=2;
  5681. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5682. return smalltalk.withContext(function($ctx2) {
  5683. return "not present";
  5684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5685. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5686. self._assert_equals_($3,"hello nil");
  5687. $ctx1.sendIdx["assert:equals:"]=2;
  5688. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5689. return smalltalk.withContext(function($ctx2) {
  5690. $6=_st(x)._asString();
  5691. $ctx2.sendIdx["asString"]=3;
  5692. return "hello ".__comma($6);
  5693. $ctx2.sendIdx[","]=3;
  5694. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5695. return smalltalk.withContext(function($ctx2) {
  5696. return "not present";
  5697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5698. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5699. self._assert_equals_($5,"hello 1");
  5700. $ctx1.sendIdx["assert:equals:"]=3;
  5701. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5702. return smalltalk.withContext(function($ctx2) {
  5703. return "hello ".__comma(_st(x)._asString());
  5704. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5705. return smalltalk.withContext(function($ctx2) {
  5706. return "not present";
  5707. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  5708. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5709. args: [],
  5710. 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'.",
  5711. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5712. referencedClasses: []
  5713. }),
  5714. globals.JSObjectProxyTest);
  5715. smalltalk.addMethod(
  5716. smalltalk.method({
  5717. selector: "testAtPut",
  5718. protocol: 'tests',
  5719. fn: function (){
  5720. var self=this;
  5721. var testObject;
  5722. return smalltalk.withContext(function($ctx1) {
  5723. var $2,$1;
  5724. testObject=self._jsObject();
  5725. $2=_st(testObject)._at_("abc");
  5726. $ctx1.sendIdx["at:"]=1;
  5727. $1=_st($2).__tild_eq("xyz");
  5728. self._assert_($1);
  5729. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5730. $ctx1.sendIdx["assert:equals:"]=1;
  5731. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5732. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)})},
  5733. args: [],
  5734. 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'",
  5735. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5736. referencedClasses: []
  5737. }),
  5738. globals.JSObjectProxyTest);
  5739. smalltalk.addMethod(
  5740. smalltalk.method({
  5741. selector: "testComparison",
  5742. protocol: 'tests',
  5743. fn: function (){
  5744. var self=this;
  5745. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5746. return smalltalk.withContext(function($ctx1) {
  5747. var $1,$2;
  5748. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  5749. $1=_st(console).__eq(console);
  5750. $ctx1.sendIdx["="]=1;
  5751. self._assert_($1);
  5752. $2=_st(console).__eq(_st($Object())._new());
  5753. $ctx1.sendIdx["="]=2;
  5754. self._deny_($2);
  5755. $ctx1.sendIdx["deny:"]=1;
  5756. self._deny_(_st(console).__eq(self._jsObject()));
  5757. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)})},
  5758. args: [],
  5759. 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",
  5760. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"],
  5761. referencedClasses: ["Object"]
  5762. }),
  5763. globals.JSObjectProxyTest);
  5764. smalltalk.addMethod(
  5765. smalltalk.method({
  5766. selector: "testDNU",
  5767. protocol: 'tests',
  5768. fn: function (){
  5769. var self=this;
  5770. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5771. return smalltalk.withContext(function($ctx1) {
  5772. self._should_raise_((function(){
  5773. return smalltalk.withContext(function($ctx2) {
  5774. return _st(self._jsObject())._foo();
  5775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5776. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)})},
  5777. args: [],
  5778. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5779. messageSends: ["should:raise:", "foo", "jsObject"],
  5780. referencedClasses: ["MessageNotUnderstood"]
  5781. }),
  5782. globals.JSObjectProxyTest);
  5783. smalltalk.addMethod(
  5784. smalltalk.method({
  5785. selector: "testMessageSend",
  5786. protocol: 'tests',
  5787. fn: function (){
  5788. var self=this;
  5789. return smalltalk.withContext(function($ctx1) {
  5790. var $2,$1,$4,$3;
  5791. $2=self._jsObject();
  5792. $ctx1.sendIdx["jsObject"]=1;
  5793. $1=_st($2)._a();
  5794. self._assert_equals_($1,(1));
  5795. $ctx1.sendIdx["assert:equals:"]=1;
  5796. $4=self._jsObject();
  5797. $ctx1.sendIdx["jsObject"]=2;
  5798. $3=_st($4)._b();
  5799. self._assert_equals_($3,(2));
  5800. $ctx1.sendIdx["assert:equals:"]=2;
  5801. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5802. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)})},
  5803. args: [],
  5804. 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",
  5805. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5806. referencedClasses: []
  5807. }),
  5808. globals.JSObjectProxyTest);
  5809. smalltalk.addMethod(
  5810. smalltalk.method({
  5811. selector: "testMethodWithArguments",
  5812. protocol: 'tests',
  5813. fn: function (){
  5814. var self=this;
  5815. return smalltalk.withContext(function($ctx1) {
  5816. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5817. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)})},
  5818. args: [],
  5819. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5820. messageSends: ["assert:equals:", "c:", "jsObject"],
  5821. referencedClasses: []
  5822. }),
  5823. globals.JSObjectProxyTest);
  5824. smalltalk.addMethod(
  5825. smalltalk.method({
  5826. selector: "testPrinting",
  5827. protocol: 'tests',
  5828. fn: function (){
  5829. var self=this;
  5830. return smalltalk.withContext(function($ctx1) {
  5831. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5832. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)})},
  5833. args: [],
  5834. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5835. messageSends: ["assert:equals:", "printString", "jsObject"],
  5836. referencedClasses: []
  5837. }),
  5838. globals.JSObjectProxyTest);
  5839. smalltalk.addMethod(
  5840. smalltalk.method({
  5841. selector: "testPropertyThatReturnsEmptyString",
  5842. protocol: 'tests',
  5843. fn: function (){
  5844. var self=this;
  5845. var object;
  5846. return smalltalk.withContext(function($ctx1) {
  5847. var $1;
  5848. object=self._jsObject();
  5849. $1=_st(object)._d();
  5850. $ctx1.sendIdx["d"]=1;
  5851. self._assert_equals_($1,"");
  5852. $ctx1.sendIdx["assert:equals:"]=1;
  5853. _st(object)._d_("hello");
  5854. self._assert_equals_(_st(object)._d(),"hello");
  5855. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)})},
  5856. args: [],
  5857. 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'",
  5858. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5859. referencedClasses: []
  5860. }),
  5861. globals.JSObjectProxyTest);
  5862. smalltalk.addMethod(
  5863. smalltalk.method({
  5864. selector: "testPropertyThatReturnsUndefined",
  5865. protocol: 'tests',
  5866. fn: function (){
  5867. var self=this;
  5868. var object;
  5869. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5870. return smalltalk.withContext(function($ctx1) {
  5871. object=self._jsObject();
  5872. self._shouldnt_raise_((function(){
  5873. return smalltalk.withContext(function($ctx2) {
  5874. return _st(object)._e();
  5875. $ctx2.sendIdx["e"]=1;
  5876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5877. self._assert_(_st(_st(object)._e())._isNil());
  5878. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)})},
  5879. args: [],
  5880. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5881. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5882. referencedClasses: ["MessageNotUnderstood"]
  5883. }),
  5884. globals.JSObjectProxyTest);
  5885. smalltalk.addMethod(
  5886. smalltalk.method({
  5887. selector: "testValue",
  5888. protocol: 'tests',
  5889. fn: function (){
  5890. var self=this;
  5891. var testObject;
  5892. return smalltalk.withContext(function($ctx1) {
  5893. testObject=self._jsObject();
  5894. _st(testObject)._at_put_("value","aValue");
  5895. self._assert_equals_(_st(testObject)._value(),"aValue");
  5896. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)})},
  5897. args: [],
  5898. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5899. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5900. referencedClasses: []
  5901. }),
  5902. globals.JSObjectProxyTest);
  5903. smalltalk.addMethod(
  5904. smalltalk.method({
  5905. selector: "testYourself",
  5906. protocol: 'tests',
  5907. fn: function (){
  5908. var self=this;
  5909. var object;
  5910. return smalltalk.withContext(function($ctx1) {
  5911. var $1,$2;
  5912. $1=self._jsObject();
  5913. _st($1)._d_("test");
  5914. $2=_st($1)._yourself();
  5915. object=$2;
  5916. self._assert_equals_(_st(object)._d(),"test");
  5917. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)})},
  5918. args: [],
  5919. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5920. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5921. referencedClasses: []
  5922. }),
  5923. globals.JSObjectProxyTest);
  5924. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  5925. smalltalk.addMethod(
  5926. smalltalk.method({
  5927. selector: "testCatchingException",
  5928. protocol: 'tests',
  5929. fn: function (){
  5930. var self=this;
  5931. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5932. return smalltalk.withContext(function($ctx1) {
  5933. _st((function(){
  5934. return smalltalk.withContext(function($ctx2) {
  5935. return self._throwException();
  5936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5937. return smalltalk.withContext(function($ctx2) {
  5938. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5939. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5940. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)})},
  5941. args: [],
  5942. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5943. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5944. referencedClasses: ["Error"]
  5945. }),
  5946. globals.JavaScriptExceptionTest);
  5947. smalltalk.addMethod(
  5948. smalltalk.method({
  5949. selector: "testRaisingException",
  5950. protocol: 'tests',
  5951. fn: function (){
  5952. var self=this;
  5953. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5954. return smalltalk.withContext(function($ctx1) {
  5955. self._should_raise_((function(){
  5956. return smalltalk.withContext(function($ctx2) {
  5957. return self._throwException();
  5958. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5959. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)})},
  5960. args: [],
  5961. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5962. messageSends: ["should:raise:", "throwException"],
  5963. referencedClasses: ["JavaScriptException"]
  5964. }),
  5965. globals.JavaScriptExceptionTest);
  5966. smalltalk.addMethod(
  5967. smalltalk.method({
  5968. selector: "throwException",
  5969. protocol: 'helpers',
  5970. fn: function (){
  5971. var self=this;
  5972. return smalltalk.withContext(function($ctx1) {
  5973. throw 'test';
  5974. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},globals.JavaScriptExceptionTest)})},
  5975. args: [],
  5976. source: "throwException\x0a\x09<throw 'test'>",
  5977. messageSends: [],
  5978. referencedClasses: []
  5979. }),
  5980. globals.JavaScriptExceptionTest);
  5981. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  5982. smalltalk.addMethod(
  5983. smalltalk.method({
  5984. selector: "testValue",
  5985. protocol: 'tests',
  5986. fn: function (){
  5987. var self=this;
  5988. var messageSend;
  5989. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5990. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5991. return smalltalk.withContext(function($ctx1) {
  5992. var $1,$2;
  5993. $1=_st($MessageSend())._new();
  5994. $ctx1.sendIdx["new"]=1;
  5995. _st($1)._receiver_(_st($Object())._new());
  5996. _st($1)._selector_("asString");
  5997. $2=_st($1)._yourself();
  5998. messageSend=$2;
  5999. self._assert_equals_(_st(messageSend)._value(),"an Object");
  6000. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)})},
  6001. args: [],
  6002. 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'",
  6003. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  6004. referencedClasses: ["MessageSend", "Object"]
  6005. }),
  6006. globals.MessageSendTest);
  6007. smalltalk.addMethod(
  6008. smalltalk.method({
  6009. selector: "testValueWithArguments",
  6010. protocol: 'tests',
  6011. fn: function (){
  6012. var self=this;
  6013. var messageSend;
  6014. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6015. return smalltalk.withContext(function($ctx1) {
  6016. var $1,$2;
  6017. $1=_st($MessageSend())._new();
  6018. _st($1)._receiver_((2));
  6019. _st($1)._selector_("+");
  6020. $2=_st($1)._yourself();
  6021. messageSend=$2;
  6022. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  6023. $ctx1.sendIdx["assert:equals:"]=1;
  6024. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  6025. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)})},
  6026. args: [],
  6027. 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",
  6028. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  6029. referencedClasses: ["MessageSend"]
  6030. }),
  6031. globals.MessageSendTest);
  6032. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  6033. smalltalk.addMethod(
  6034. smalltalk.method({
  6035. selector: "codeGeneratorClass",
  6036. protocol: 'accessing',
  6037. fn: function (){
  6038. var self=this;
  6039. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  6040. return $CodeGenerator();
  6041. },
  6042. args: [],
  6043. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  6044. messageSends: [],
  6045. referencedClasses: ["CodeGenerator"]
  6046. }),
  6047. globals.MethodInheritanceTest);
  6048. smalltalk.addMethod(
  6049. smalltalk.method({
  6050. selector: "compiler",
  6051. protocol: 'factory',
  6052. fn: function (){
  6053. var self=this;
  6054. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6055. return smalltalk.withContext(function($ctx1) {
  6056. var $2,$3,$1;
  6057. $2=_st($Compiler())._new();
  6058. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  6059. $3=_st($2)._yourself();
  6060. $1=$3;
  6061. return $1;
  6062. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)})},
  6063. args: [],
  6064. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  6065. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  6066. referencedClasses: ["Compiler"]
  6067. }),
  6068. globals.MethodInheritanceTest);
  6069. smalltalk.addMethod(
  6070. smalltalk.method({
  6071. selector: "deinstallBottom",
  6072. protocol: 'testing',
  6073. fn: function (){
  6074. var self=this;
  6075. return smalltalk.withContext(function($ctx1) {
  6076. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6077. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)})},
  6078. args: [],
  6079. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6080. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6081. referencedClasses: []
  6082. }),
  6083. globals.MethodInheritanceTest);
  6084. smalltalk.addMethod(
  6085. smalltalk.method({
  6086. selector: "deinstallMiddle",
  6087. protocol: 'testing',
  6088. fn: function (){
  6089. var self=this;
  6090. return smalltalk.withContext(function($ctx1) {
  6091. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6092. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)})},
  6093. args: [],
  6094. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6095. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6096. referencedClasses: []
  6097. }),
  6098. globals.MethodInheritanceTest);
  6099. smalltalk.addMethod(
  6100. smalltalk.method({
  6101. selector: "deinstallTop",
  6102. protocol: 'testing',
  6103. fn: function (){
  6104. var self=this;
  6105. return smalltalk.withContext(function($ctx1) {
  6106. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6107. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)})},
  6108. args: [],
  6109. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6110. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6111. referencedClasses: []
  6112. }),
  6113. globals.MethodInheritanceTest);
  6114. smalltalk.addMethod(
  6115. smalltalk.method({
  6116. selector: "installBottom:",
  6117. protocol: 'testing',
  6118. fn: function (aString){
  6119. var self=this;
  6120. return smalltalk.withContext(function($ctx1) {
  6121. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6122. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)})},
  6123. args: ["aString"],
  6124. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6125. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6126. referencedClasses: []
  6127. }),
  6128. globals.MethodInheritanceTest);
  6129. smalltalk.addMethod(
  6130. smalltalk.method({
  6131. selector: "installMiddle:",
  6132. protocol: 'testing',
  6133. fn: function (aString){
  6134. var self=this;
  6135. return smalltalk.withContext(function($ctx1) {
  6136. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6137. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)})},
  6138. args: ["aString"],
  6139. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6140. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6141. referencedClasses: []
  6142. }),
  6143. globals.MethodInheritanceTest);
  6144. smalltalk.addMethod(
  6145. smalltalk.method({
  6146. selector: "installTop:",
  6147. protocol: 'testing',
  6148. fn: function (aString){
  6149. var self=this;
  6150. return smalltalk.withContext(function($ctx1) {
  6151. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6152. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)})},
  6153. args: ["aString"],
  6154. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6155. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6156. referencedClasses: []
  6157. }),
  6158. globals.MethodInheritanceTest);
  6159. smalltalk.addMethod(
  6160. smalltalk.method({
  6161. selector: "setUp",
  6162. protocol: 'initialization',
  6163. fn: function (){
  6164. var self=this;
  6165. return smalltalk.withContext(function($ctx1) {
  6166. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6167. $ctx1.sendIdx["new"]=1;
  6168. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6169. $ctx1.sendIdx["new"]=2;
  6170. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6171. self["@method"]=nil;
  6172. self["@performBlock"]=(function(){
  6173. return smalltalk.withContext(function($ctx2) {
  6174. return self._error_("performBlock not initialized");
  6175. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6176. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)})},
  6177. args: [],
  6178. 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' ]",
  6179. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6180. referencedClasses: []
  6181. }),
  6182. globals.MethodInheritanceTest);
  6183. smalltalk.addMethod(
  6184. smalltalk.method({
  6185. selector: "shouldMNU",
  6186. protocol: 'testing',
  6187. fn: function (){
  6188. var self=this;
  6189. return smalltalk.withContext(function($ctx1) {
  6190. self._shouldMNUTop();
  6191. self._shouldMNUMiddle();
  6192. self._shouldMNUBottom();
  6193. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)})},
  6194. args: [],
  6195. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6196. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6197. referencedClasses: []
  6198. }),
  6199. globals.MethodInheritanceTest);
  6200. smalltalk.addMethod(
  6201. smalltalk.method({
  6202. selector: "shouldMNUBottom",
  6203. protocol: 'testing',
  6204. fn: function (){
  6205. var self=this;
  6206. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6207. return smalltalk.withContext(function($ctx1) {
  6208. self._should_raise_((function(){
  6209. return smalltalk.withContext(function($ctx2) {
  6210. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6212. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)})},
  6213. args: [],
  6214. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6215. messageSends: ["should:raise:", "value:"],
  6216. referencedClasses: ["MessageNotUnderstood"]
  6217. }),
  6218. globals.MethodInheritanceTest);
  6219. smalltalk.addMethod(
  6220. smalltalk.method({
  6221. selector: "shouldMNUMiddle",
  6222. protocol: 'testing',
  6223. fn: function (){
  6224. var self=this;
  6225. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6226. return smalltalk.withContext(function($ctx1) {
  6227. self._should_raise_((function(){
  6228. return smalltalk.withContext(function($ctx2) {
  6229. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6230. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6231. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)})},
  6232. args: [],
  6233. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6234. messageSends: ["should:raise:", "value:"],
  6235. referencedClasses: ["MessageNotUnderstood"]
  6236. }),
  6237. globals.MethodInheritanceTest);
  6238. smalltalk.addMethod(
  6239. smalltalk.method({
  6240. selector: "shouldMNUTop",
  6241. protocol: 'testing',
  6242. fn: function (){
  6243. var self=this;
  6244. function $MessageNotUnderstood(){return globals.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["@receiverTop"]);
  6249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6250. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)})},
  6251. args: [],
  6252. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6253. messageSends: ["should:raise:", "value:"],
  6254. referencedClasses: ["MessageNotUnderstood"]
  6255. }),
  6256. globals.MethodInheritanceTest);
  6257. smalltalk.addMethod(
  6258. smalltalk.method({
  6259. selector: "shouldReturn:",
  6260. protocol: 'testing',
  6261. fn: function (anObject){
  6262. var self=this;
  6263. var result;
  6264. return smalltalk.withContext(function($ctx1) {
  6265. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6266. $ctx1.sendIdx["value:"]=1;
  6267. self._assert_equals_(["top",anObject],["top",result]);
  6268. $ctx1.sendIdx["assert:equals:"]=1;
  6269. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6270. $ctx1.sendIdx["value:"]=2;
  6271. self._assert_equals_(["middle",anObject],["middle",result]);
  6272. $ctx1.sendIdx["assert:equals:"]=2;
  6273. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6274. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6275. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)})},
  6276. args: ["anObject"],
  6277. 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 }",
  6278. messageSends: ["value:", "assert:equals:"],
  6279. referencedClasses: []
  6280. }),
  6281. globals.MethodInheritanceTest);
  6282. smalltalk.addMethod(
  6283. smalltalk.method({
  6284. selector: "shouldReturn:and:and:",
  6285. protocol: 'testing',
  6286. fn: function (anObject,anObject2,anObject3){
  6287. var self=this;
  6288. var result;
  6289. return smalltalk.withContext(function($ctx1) {
  6290. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6291. $ctx1.sendIdx["value:"]=1;
  6292. self._assert_equals_(["top",anObject],["top",result]);
  6293. $ctx1.sendIdx["assert:equals:"]=1;
  6294. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6295. $ctx1.sendIdx["value:"]=2;
  6296. self._assert_equals_(["middle",anObject2],["middle",result]);
  6297. $ctx1.sendIdx["assert:equals:"]=2;
  6298. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6299. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6300. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)})},
  6301. args: ["anObject", "anObject2", "anObject3"],
  6302. 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 }",
  6303. messageSends: ["value:", "assert:equals:"],
  6304. referencedClasses: []
  6305. }),
  6306. globals.MethodInheritanceTest);
  6307. smalltalk.addMethod(
  6308. smalltalk.method({
  6309. selector: "targetClassBottom",
  6310. protocol: 'accessing',
  6311. fn: function (){
  6312. var self=this;
  6313. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6314. return $JavaScriptException();
  6315. },
  6316. args: [],
  6317. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6318. messageSends: [],
  6319. referencedClasses: ["JavaScriptException"]
  6320. }),
  6321. globals.MethodInheritanceTest);
  6322. smalltalk.addMethod(
  6323. smalltalk.method({
  6324. selector: "targetClassMiddle",
  6325. protocol: 'accessing',
  6326. fn: function (){
  6327. var self=this;
  6328. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6329. return $Error();
  6330. },
  6331. args: [],
  6332. source: "targetClassMiddle\x0a\x09^ Error",
  6333. messageSends: [],
  6334. referencedClasses: ["Error"]
  6335. }),
  6336. globals.MethodInheritanceTest);
  6337. smalltalk.addMethod(
  6338. smalltalk.method({
  6339. selector: "targetClassTop",
  6340. protocol: 'accessing',
  6341. fn: function (){
  6342. var self=this;
  6343. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6344. return $Object();
  6345. },
  6346. args: [],
  6347. source: "targetClassTop\x0a\x09^ Object",
  6348. messageSends: [],
  6349. referencedClasses: ["Object"]
  6350. }),
  6351. globals.MethodInheritanceTest);
  6352. smalltalk.addMethod(
  6353. smalltalk.method({
  6354. selector: "tearDown",
  6355. protocol: 'initialization',
  6356. fn: function (){
  6357. var self=this;
  6358. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6359. return smalltalk.withContext(function($ctx1) {
  6360. _st((function(){
  6361. return smalltalk.withContext(function($ctx2) {
  6362. return self._deinstallTop();
  6363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6364. return smalltalk.withContext(function($ctx2) {
  6365. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6366. $ctx1.sendIdx["on:do:"]=1;
  6367. _st((function(){
  6368. return smalltalk.withContext(function($ctx2) {
  6369. return self._deinstallMiddle();
  6370. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6371. return smalltalk.withContext(function($ctx2) {
  6372. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  6373. $ctx1.sendIdx["on:do:"]=2;
  6374. _st((function(){
  6375. return smalltalk.withContext(function($ctx2) {
  6376. return self._deinstallBottom();
  6377. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6378. return smalltalk.withContext(function($ctx2) {
  6379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  6380. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)})},
  6381. args: [],
  6382. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6383. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6384. referencedClasses: ["Error"]
  6385. }),
  6386. globals.MethodInheritanceTest);
  6387. smalltalk.addMethod(
  6388. smalltalk.method({
  6389. selector: "testMNU11",
  6390. protocol: 'tests',
  6391. fn: function (){
  6392. var self=this;
  6393. return smalltalk.withContext(function($ctx1) {
  6394. self["@performBlock"]=(function(x){
  6395. return smalltalk.withContext(function($ctx2) {
  6396. return _st(x)._foo();
  6397. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6398. self._shouldMNU();
  6399. $ctx1.sendIdx["shouldMNU"]=1;
  6400. self._installTop_("foo ^ false");
  6401. $ctx1.sendIdx["installTop:"]=1;
  6402. self._installTop_("foo ^ true");
  6403. self._deinstallTop();
  6404. self._shouldMNU();
  6405. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)})},
  6406. args: [],
  6407. 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",
  6408. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6409. referencedClasses: []
  6410. }),
  6411. globals.MethodInheritanceTest);
  6412. smalltalk.addMethod(
  6413. smalltalk.method({
  6414. selector: "testMNU22",
  6415. protocol: 'tests',
  6416. fn: function (){
  6417. var self=this;
  6418. return smalltalk.withContext(function($ctx1) {
  6419. self["@performBlock"]=(function(x){
  6420. return smalltalk.withContext(function($ctx2) {
  6421. return _st(x)._foo();
  6422. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6423. self._shouldMNU();
  6424. $ctx1.sendIdx["shouldMNU"]=1;
  6425. self._installMiddle_("foo ^ false");
  6426. $ctx1.sendIdx["installMiddle:"]=1;
  6427. self._installMiddle_("foo ^ true");
  6428. self._deinstallMiddle();
  6429. self._shouldMNU();
  6430. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)})},
  6431. args: [],
  6432. 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",
  6433. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6434. referencedClasses: []
  6435. }),
  6436. globals.MethodInheritanceTest);
  6437. smalltalk.addMethod(
  6438. smalltalk.method({
  6439. selector: "testReturns1",
  6440. protocol: 'tests',
  6441. fn: function (){
  6442. var self=this;
  6443. return smalltalk.withContext(function($ctx1) {
  6444. self["@performBlock"]=(function(x){
  6445. return smalltalk.withContext(function($ctx2) {
  6446. return _st(x)._foo();
  6447. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6448. self._installTop_("foo ^ false");
  6449. $ctx1.sendIdx["installTop:"]=1;
  6450. self._shouldReturn_(false);
  6451. $ctx1.sendIdx["shouldReturn:"]=1;
  6452. self._installTop_("foo ^ true");
  6453. self._shouldReturn_(true);
  6454. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)})},
  6455. args: [],
  6456. 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",
  6457. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6458. referencedClasses: []
  6459. }),
  6460. globals.MethodInheritanceTest);
  6461. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  6462. smalltalk.addMethod(
  6463. smalltalk.method({
  6464. selector: "testAbs",
  6465. protocol: 'tests',
  6466. fn: function (){
  6467. var self=this;
  6468. return smalltalk.withContext(function($ctx1) {
  6469. var $1;
  6470. $1=(4)._abs();
  6471. $ctx1.sendIdx["abs"]=1;
  6472. self._assert_equals_($1,(4));
  6473. $ctx1.sendIdx["assert:equals:"]=1;
  6474. self._assert_equals_((-4)._abs(),(4));
  6475. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)})},
  6476. args: [],
  6477. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6478. messageSends: ["assert:equals:", "abs"],
  6479. referencedClasses: []
  6480. }),
  6481. globals.NumberTest);
  6482. smalltalk.addMethod(
  6483. smalltalk.method({
  6484. selector: "testArithmetic",
  6485. protocol: 'tests',
  6486. fn: function (){
  6487. var self=this;
  6488. return smalltalk.withContext(function($ctx1) {
  6489. var $1,$2,$3,$5,$4;
  6490. $1=(1.5).__plus((1));
  6491. $ctx1.sendIdx["+"]=1;
  6492. self._assert_equals_($1,(2.5));
  6493. $ctx1.sendIdx["assert:equals:"]=1;
  6494. $2=(2).__minus((1));
  6495. $ctx1.sendIdx["-"]=1;
  6496. self._assert_equals_($2,(1));
  6497. $ctx1.sendIdx["assert:equals:"]=2;
  6498. self._assert_equals_((-2).__minus((1)),(-3));
  6499. $ctx1.sendIdx["assert:equals:"]=3;
  6500. self._assert_equals_((12).__slash((2)),(6));
  6501. $ctx1.sendIdx["assert:equals:"]=4;
  6502. $3=(3).__star((4));
  6503. $ctx1.sendIdx["*"]=1;
  6504. self._assert_equals_($3,(12));
  6505. $ctx1.sendIdx["assert:equals:"]=5;
  6506. self._assert_equals_((7).__slash_slash((2)),(3));
  6507. $ctx1.sendIdx["assert:equals:"]=6;
  6508. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6509. $ctx1.sendIdx["assert:equals:"]=7;
  6510. $5=(1).__plus((2));
  6511. $ctx1.sendIdx["+"]=2;
  6512. $4=_st($5).__star((3));
  6513. $ctx1.sendIdx["*"]=2;
  6514. self._assert_equals_($4,(9));
  6515. $ctx1.sendIdx["assert:equals:"]=8;
  6516. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6517. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)})},
  6518. args: [],
  6519. 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",
  6520. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6521. referencedClasses: []
  6522. }),
  6523. globals.NumberTest);
  6524. smalltalk.addMethod(
  6525. smalltalk.method({
  6526. selector: "testAsNumber",
  6527. protocol: 'tests',
  6528. fn: function (){
  6529. var self=this;
  6530. return smalltalk.withContext(function($ctx1) {
  6531. self._assert_equals_((3)._asNumber(),(3));
  6532. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)})},
  6533. args: [],
  6534. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6535. messageSends: ["assert:equals:", "asNumber"],
  6536. referencedClasses: []
  6537. }),
  6538. globals.NumberTest);
  6539. smalltalk.addMethod(
  6540. smalltalk.method({
  6541. selector: "testCeiling",
  6542. protocol: 'tests',
  6543. fn: function (){
  6544. var self=this;
  6545. return smalltalk.withContext(function($ctx1) {
  6546. var $1,$2;
  6547. $1=(1.2)._ceiling();
  6548. $ctx1.sendIdx["ceiling"]=1;
  6549. self._assert_equals_($1,(2));
  6550. $ctx1.sendIdx["assert:equals:"]=1;
  6551. $2=(-1.2)._ceiling();
  6552. $ctx1.sendIdx["ceiling"]=2;
  6553. self._assert_equals_($2,(-1));
  6554. $ctx1.sendIdx["assert:equals:"]=2;
  6555. self._assert_equals_((1)._ceiling(),(1));
  6556. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)})},
  6557. args: [],
  6558. 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.",
  6559. messageSends: ["assert:equals:", "ceiling"],
  6560. referencedClasses: []
  6561. }),
  6562. globals.NumberTest);
  6563. smalltalk.addMethod(
  6564. smalltalk.method({
  6565. selector: "testComparison",
  6566. protocol: 'tests',
  6567. fn: function (){
  6568. var self=this;
  6569. return smalltalk.withContext(function($ctx1) {
  6570. var $1,$2,$3,$4;
  6571. $1=(3).__gt((2));
  6572. $ctx1.sendIdx[">"]=1;
  6573. self._assert_($1);
  6574. $ctx1.sendIdx["assert:"]=1;
  6575. $2=(2).__lt((3));
  6576. $ctx1.sendIdx["<"]=1;
  6577. self._assert_($2);
  6578. $ctx1.sendIdx["assert:"]=2;
  6579. self._deny_((3).__lt((2)));
  6580. $ctx1.sendIdx["deny:"]=1;
  6581. self._deny_((2).__gt((3)));
  6582. $3=(3).__gt_eq((3));
  6583. $ctx1.sendIdx[">="]=1;
  6584. self._assert_($3);
  6585. $ctx1.sendIdx["assert:"]=3;
  6586. self._assert_((3.1).__gt_eq((3)));
  6587. $ctx1.sendIdx["assert:"]=4;
  6588. $4=(3).__lt_eq((3));
  6589. $ctx1.sendIdx["<="]=1;
  6590. self._assert_($4);
  6591. $ctx1.sendIdx["assert:"]=5;
  6592. self._assert_((3).__lt_eq((3.1)));
  6593. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)})},
  6594. args: [],
  6595. 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",
  6596. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6597. referencedClasses: []
  6598. }),
  6599. globals.NumberTest);
  6600. smalltalk.addMethod(
  6601. smalltalk.method({
  6602. selector: "testCopying",
  6603. protocol: 'tests',
  6604. fn: function (){
  6605. var self=this;
  6606. return smalltalk.withContext(function($ctx1) {
  6607. var $1;
  6608. $1=_st((1)._copy()).__eq_eq((1));
  6609. $ctx1.sendIdx["=="]=1;
  6610. self._assert_($1);
  6611. $ctx1.sendIdx["assert:"]=1;
  6612. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6613. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)})},
  6614. args: [],
  6615. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6616. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6617. referencedClasses: []
  6618. }),
  6619. globals.NumberTest);
  6620. smalltalk.addMethod(
  6621. smalltalk.method({
  6622. selector: "testEquality",
  6623. protocol: 'tests',
  6624. fn: function (){
  6625. var self=this;
  6626. return smalltalk.withContext(function($ctx1) {
  6627. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6628. $1=(1).__eq((1));
  6629. $ctx1.sendIdx["="]=1;
  6630. self._assert_($1);
  6631. $ctx1.sendIdx["assert:"]=1;
  6632. $2=(0).__eq((0));
  6633. $ctx1.sendIdx["="]=2;
  6634. self._assert_($2);
  6635. $ctx1.sendIdx["assert:"]=2;
  6636. $3=(1).__eq((0));
  6637. $ctx1.sendIdx["="]=3;
  6638. self._deny_($3);
  6639. $ctx1.sendIdx["deny:"]=1;
  6640. $5=(1)._yourself();
  6641. $ctx1.sendIdx["yourself"]=1;
  6642. $4=_st($5).__eq((1));
  6643. $ctx1.sendIdx["="]=4;
  6644. self._assert_($4);
  6645. $ctx1.sendIdx["assert:"]=3;
  6646. $7=(1)._yourself();
  6647. $ctx1.sendIdx["yourself"]=2;
  6648. $6=(1).__eq($7);
  6649. $ctx1.sendIdx["="]=5;
  6650. self._assert_($6);
  6651. $ctx1.sendIdx["assert:"]=4;
  6652. $9=(1)._yourself();
  6653. $ctx1.sendIdx["yourself"]=3;
  6654. $8=_st($9).__eq((1)._yourself());
  6655. $ctx1.sendIdx["="]=6;
  6656. self._assert_($8);
  6657. $10=(0).__eq(false);
  6658. $ctx1.sendIdx["="]=7;
  6659. self._deny_($10);
  6660. $ctx1.sendIdx["deny:"]=2;
  6661. $11=false.__eq((0));
  6662. $ctx1.sendIdx["="]=8;
  6663. self._deny_($11);
  6664. $ctx1.sendIdx["deny:"]=3;
  6665. $12="".__eq((0));
  6666. $ctx1.sendIdx["="]=9;
  6667. self._deny_($12);
  6668. $ctx1.sendIdx["deny:"]=4;
  6669. self._deny_((0).__eq(""));
  6670. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)})},
  6671. args: [],
  6672. 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 = ''",
  6673. messageSends: ["assert:", "=", "deny:", "yourself"],
  6674. referencedClasses: []
  6675. }),
  6676. globals.NumberTest);
  6677. smalltalk.addMethod(
  6678. smalltalk.method({
  6679. selector: "testFloor",
  6680. protocol: 'tests',
  6681. fn: function (){
  6682. var self=this;
  6683. return smalltalk.withContext(function($ctx1) {
  6684. var $1,$2;
  6685. $1=(1.2)._floor();
  6686. $ctx1.sendIdx["floor"]=1;
  6687. self._assert_equals_($1,(1));
  6688. $ctx1.sendIdx["assert:equals:"]=1;
  6689. $2=(-1.2)._floor();
  6690. $ctx1.sendIdx["floor"]=2;
  6691. self._assert_equals_($2,(-2));
  6692. $ctx1.sendIdx["assert:equals:"]=2;
  6693. self._assert_equals_((1)._floor(),(1));
  6694. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)})},
  6695. args: [],
  6696. 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.",
  6697. messageSends: ["assert:equals:", "floor"],
  6698. referencedClasses: []
  6699. }),
  6700. globals.NumberTest);
  6701. smalltalk.addMethod(
  6702. smalltalk.method({
  6703. selector: "testHexNumbers",
  6704. protocol: 'tests',
  6705. fn: function (){
  6706. var self=this;
  6707. return smalltalk.withContext(function($ctx1) {
  6708. var $1,$2,$3,$4,$5;
  6709. self._assert_equals_((9),(9));
  6710. $ctx1.sendIdx["assert:equals:"]=1;
  6711. $1=(10)._truncated();
  6712. $ctx1.sendIdx["truncated"]=1;
  6713. self._assert_equals_($1,(10));
  6714. $ctx1.sendIdx["assert:equals:"]=2;
  6715. $2=(11)._truncated();
  6716. $ctx1.sendIdx["truncated"]=2;
  6717. self._assert_equals_($2,(11));
  6718. $ctx1.sendIdx["assert:equals:"]=3;
  6719. $3=(12)._truncated();
  6720. $ctx1.sendIdx["truncated"]=3;
  6721. self._assert_equals_($3,(12));
  6722. $ctx1.sendIdx["assert:equals:"]=4;
  6723. $4=(13)._truncated();
  6724. $ctx1.sendIdx["truncated"]=4;
  6725. self._assert_equals_($4,(13));
  6726. $ctx1.sendIdx["assert:equals:"]=5;
  6727. $5=(14)._truncated();
  6728. $ctx1.sendIdx["truncated"]=5;
  6729. self._assert_equals_($5,(14));
  6730. $ctx1.sendIdx["assert:equals:"]=6;
  6731. self._assert_equals_((15)._truncated(),(15));
  6732. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)})},
  6733. args: [],
  6734. 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",
  6735. messageSends: ["assert:equals:", "truncated"],
  6736. referencedClasses: []
  6737. }),
  6738. globals.NumberTest);
  6739. smalltalk.addMethod(
  6740. smalltalk.method({
  6741. selector: "testIdentity",
  6742. protocol: 'tests',
  6743. fn: function (){
  6744. var self=this;
  6745. return smalltalk.withContext(function($ctx1) {
  6746. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6747. $1=(1).__eq_eq((1));
  6748. $ctx1.sendIdx["=="]=1;
  6749. self._assert_($1);
  6750. $ctx1.sendIdx["assert:"]=1;
  6751. $2=(0).__eq_eq((0));
  6752. $ctx1.sendIdx["=="]=2;
  6753. self._assert_($2);
  6754. $ctx1.sendIdx["assert:"]=2;
  6755. $3=(1).__eq_eq((0));
  6756. $ctx1.sendIdx["=="]=3;
  6757. self._deny_($3);
  6758. $ctx1.sendIdx["deny:"]=1;
  6759. $5=(1)._yourself();
  6760. $ctx1.sendIdx["yourself"]=1;
  6761. $4=_st($5).__eq_eq((1));
  6762. $ctx1.sendIdx["=="]=4;
  6763. self._assert_($4);
  6764. $ctx1.sendIdx["assert:"]=3;
  6765. $7=(1)._yourself();
  6766. $ctx1.sendIdx["yourself"]=2;
  6767. $6=(1).__eq_eq($7);
  6768. $ctx1.sendIdx["=="]=5;
  6769. self._assert_($6);
  6770. $ctx1.sendIdx["assert:"]=4;
  6771. $9=(1)._yourself();
  6772. $ctx1.sendIdx["yourself"]=3;
  6773. $8=_st($9).__eq_eq((1)._yourself());
  6774. $ctx1.sendIdx["=="]=6;
  6775. self._assert_($8);
  6776. self._deny_((1).__eq_eq((2)));
  6777. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)})},
  6778. args: [],
  6779. 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",
  6780. messageSends: ["assert:", "==", "deny:", "yourself"],
  6781. referencedClasses: []
  6782. }),
  6783. globals.NumberTest);
  6784. smalltalk.addMethod(
  6785. smalltalk.method({
  6786. selector: "testInvalidHexNumbers",
  6787. protocol: 'tests',
  6788. fn: function (){
  6789. var self=this;
  6790. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6791. return smalltalk.withContext(function($ctx1) {
  6792. self._should_raise_((function(){
  6793. return smalltalk.withContext(function($ctx2) {
  6794. return (16)._rG();
  6795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6796. $ctx1.sendIdx["should:raise:"]=1;
  6797. self._should_raise_((function(){
  6798. return smalltalk.withContext(function($ctx2) {
  6799. return (16)._rg();
  6800. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6801. $ctx1.sendIdx["should:raise:"]=2;
  6802. self._should_raise_((function(){
  6803. return smalltalk.withContext(function($ctx2) {
  6804. return (16)._rH();
  6805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6806. $ctx1.sendIdx["should:raise:"]=3;
  6807. self._should_raise_((function(){
  6808. return smalltalk.withContext(function($ctx2) {
  6809. return (16)._rh();
  6810. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6811. $ctx1.sendIdx["should:raise:"]=4;
  6812. self._should_raise_((function(){
  6813. return smalltalk.withContext(function($ctx2) {
  6814. return (16)._rI();
  6815. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6816. $ctx1.sendIdx["should:raise:"]=5;
  6817. self._should_raise_((function(){
  6818. return smalltalk.withContext(function($ctx2) {
  6819. return (16)._ri();
  6820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6821. $ctx1.sendIdx["should:raise:"]=6;
  6822. self._should_raise_((function(){
  6823. return smalltalk.withContext(function($ctx2) {
  6824. return (16)._rJ();
  6825. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6826. $ctx1.sendIdx["should:raise:"]=7;
  6827. self._should_raise_((function(){
  6828. return smalltalk.withContext(function($ctx2) {
  6829. return (16)._rj();
  6830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6831. $ctx1.sendIdx["should:raise:"]=8;
  6832. self._should_raise_((function(){
  6833. return smalltalk.withContext(function($ctx2) {
  6834. return (16)._rK();
  6835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6836. $ctx1.sendIdx["should:raise:"]=9;
  6837. self._should_raise_((function(){
  6838. return smalltalk.withContext(function($ctx2) {
  6839. return (16)._rk();
  6840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6841. $ctx1.sendIdx["should:raise:"]=10;
  6842. self._should_raise_((function(){
  6843. return smalltalk.withContext(function($ctx2) {
  6844. return (16)._rL();
  6845. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6846. $ctx1.sendIdx["should:raise:"]=11;
  6847. self._should_raise_((function(){
  6848. return smalltalk.withContext(function($ctx2) {
  6849. return (16)._rl();
  6850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6851. $ctx1.sendIdx["should:raise:"]=12;
  6852. self._should_raise_((function(){
  6853. return smalltalk.withContext(function($ctx2) {
  6854. return (16)._rM();
  6855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6856. $ctx1.sendIdx["should:raise:"]=13;
  6857. self._should_raise_((function(){
  6858. return smalltalk.withContext(function($ctx2) {
  6859. return (16)._rm();
  6860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6861. $ctx1.sendIdx["should:raise:"]=14;
  6862. self._should_raise_((function(){
  6863. return smalltalk.withContext(function($ctx2) {
  6864. return (16)._rN();
  6865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6866. $ctx1.sendIdx["should:raise:"]=15;
  6867. self._should_raise_((function(){
  6868. return smalltalk.withContext(function($ctx2) {
  6869. return (16)._rn();
  6870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6871. $ctx1.sendIdx["should:raise:"]=16;
  6872. self._should_raise_((function(){
  6873. return smalltalk.withContext(function($ctx2) {
  6874. return (16)._rO();
  6875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6876. $ctx1.sendIdx["should:raise:"]=17;
  6877. self._should_raise_((function(){
  6878. return smalltalk.withContext(function($ctx2) {
  6879. return (16)._ro();
  6880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6881. $ctx1.sendIdx["should:raise:"]=18;
  6882. self._should_raise_((function(){
  6883. return smalltalk.withContext(function($ctx2) {
  6884. return (16)._rP();
  6885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6886. $ctx1.sendIdx["should:raise:"]=19;
  6887. self._should_raise_((function(){
  6888. return smalltalk.withContext(function($ctx2) {
  6889. return (16)._rp();
  6890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6891. $ctx1.sendIdx["should:raise:"]=20;
  6892. self._should_raise_((function(){
  6893. return smalltalk.withContext(function($ctx2) {
  6894. return (16)._rQ();
  6895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6896. $ctx1.sendIdx["should:raise:"]=21;
  6897. self._should_raise_((function(){
  6898. return smalltalk.withContext(function($ctx2) {
  6899. return (16)._rq();
  6900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6901. $ctx1.sendIdx["should:raise:"]=22;
  6902. self._should_raise_((function(){
  6903. return smalltalk.withContext(function($ctx2) {
  6904. return (16)._rR();
  6905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6906. $ctx1.sendIdx["should:raise:"]=23;
  6907. self._should_raise_((function(){
  6908. return smalltalk.withContext(function($ctx2) {
  6909. return (16)._rr();
  6910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6911. $ctx1.sendIdx["should:raise:"]=24;
  6912. self._should_raise_((function(){
  6913. return smalltalk.withContext(function($ctx2) {
  6914. return (16)._rS();
  6915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6916. $ctx1.sendIdx["should:raise:"]=25;
  6917. self._should_raise_((function(){
  6918. return smalltalk.withContext(function($ctx2) {
  6919. return (16)._rs();
  6920. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6921. $ctx1.sendIdx["should:raise:"]=26;
  6922. self._should_raise_((function(){
  6923. return smalltalk.withContext(function($ctx2) {
  6924. return (16)._rT();
  6925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6926. $ctx1.sendIdx["should:raise:"]=27;
  6927. self._should_raise_((function(){
  6928. return smalltalk.withContext(function($ctx2) {
  6929. return (16)._rt();
  6930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6931. $ctx1.sendIdx["should:raise:"]=28;
  6932. self._should_raise_((function(){
  6933. return smalltalk.withContext(function($ctx2) {
  6934. return (16)._rU();
  6935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6936. $ctx1.sendIdx["should:raise:"]=29;
  6937. self._should_raise_((function(){
  6938. return smalltalk.withContext(function($ctx2) {
  6939. return (16)._ru();
  6940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6941. $ctx1.sendIdx["should:raise:"]=30;
  6942. self._should_raise_((function(){
  6943. return smalltalk.withContext(function($ctx2) {
  6944. return (16)._rV();
  6945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6946. $ctx1.sendIdx["should:raise:"]=31;
  6947. self._should_raise_((function(){
  6948. return smalltalk.withContext(function($ctx2) {
  6949. return (16)._rv();
  6950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6951. $ctx1.sendIdx["should:raise:"]=32;
  6952. self._should_raise_((function(){
  6953. return smalltalk.withContext(function($ctx2) {
  6954. return (16)._rW();
  6955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6956. $ctx1.sendIdx["should:raise:"]=33;
  6957. self._should_raise_((function(){
  6958. return smalltalk.withContext(function($ctx2) {
  6959. return (16)._rw();
  6960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6961. $ctx1.sendIdx["should:raise:"]=34;
  6962. self._should_raise_((function(){
  6963. return smalltalk.withContext(function($ctx2) {
  6964. return (16)._rX();
  6965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6966. $ctx1.sendIdx["should:raise:"]=35;
  6967. self._should_raise_((function(){
  6968. return smalltalk.withContext(function($ctx2) {
  6969. return (16)._rx();
  6970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6971. $ctx1.sendIdx["should:raise:"]=36;
  6972. self._should_raise_((function(){
  6973. return smalltalk.withContext(function($ctx2) {
  6974. return (16)._rY();
  6975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6976. $ctx1.sendIdx["should:raise:"]=37;
  6977. self._should_raise_((function(){
  6978. return smalltalk.withContext(function($ctx2) {
  6979. return (16)._ry();
  6980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6981. $ctx1.sendIdx["should:raise:"]=38;
  6982. self._should_raise_((function(){
  6983. return smalltalk.withContext(function($ctx2) {
  6984. return (16)._rZ();
  6985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6986. $ctx1.sendIdx["should:raise:"]=39;
  6987. self._should_raise_((function(){
  6988. return smalltalk.withContext(function($ctx2) {
  6989. return (16)._rz();
  6990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6991. $ctx1.sendIdx["should:raise:"]=40;
  6992. self._should_raise_((function(){
  6993. return smalltalk.withContext(function($ctx2) {
  6994. return (11259375)._Z();
  6995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6996. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)})},
  6997. args: [],
  6998. 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.",
  6999. 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"],
  7000. referencedClasses: ["MessageNotUnderstood"]
  7001. }),
  7002. globals.NumberTest);
  7003. smalltalk.addMethod(
  7004. smalltalk.method({
  7005. selector: "testLog",
  7006. protocol: 'tests',
  7007. fn: function (){
  7008. var self=this;
  7009. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  7010. return smalltalk.withContext(function($ctx1) {
  7011. self._assert_equals_((10000)._log(),(4));
  7012. $ctx1.sendIdx["assert:equals:"]=1;
  7013. self._assert_equals_((512)._log_((2)),(9));
  7014. $ctx1.sendIdx["assert:equals:"]=2;
  7015. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  7016. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)})},
  7017. args: [],
  7018. 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.",
  7019. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  7020. referencedClasses: ["Number"]
  7021. }),
  7022. globals.NumberTest);
  7023. smalltalk.addMethod(
  7024. smalltalk.method({
  7025. selector: "testMinMax",
  7026. protocol: 'tests',
  7027. fn: function (){
  7028. var self=this;
  7029. return smalltalk.withContext(function($ctx1) {
  7030. self._assert_equals_((2)._max_((5)),(5));
  7031. $ctx1.sendIdx["assert:equals:"]=1;
  7032. self._assert_equals_((2)._min_((5)),(2));
  7033. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)})},
  7034. args: [],
  7035. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  7036. messageSends: ["assert:equals:", "max:", "min:"],
  7037. referencedClasses: []
  7038. }),
  7039. globals.NumberTest);
  7040. smalltalk.addMethod(
  7041. smalltalk.method({
  7042. selector: "testNegated",
  7043. protocol: 'tests',
  7044. fn: function (){
  7045. var self=this;
  7046. return smalltalk.withContext(function($ctx1) {
  7047. var $1;
  7048. $1=(3)._negated();
  7049. $ctx1.sendIdx["negated"]=1;
  7050. self._assert_equals_($1,(-3));
  7051. $ctx1.sendIdx["assert:equals:"]=1;
  7052. self._assert_equals_((-3)._negated(),(3));
  7053. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)})},
  7054. args: [],
  7055. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  7056. messageSends: ["assert:equals:", "negated"],
  7057. referencedClasses: []
  7058. }),
  7059. globals.NumberTest);
  7060. smalltalk.addMethod(
  7061. smalltalk.method({
  7062. selector: "testPrintShowingDecimalPlaces",
  7063. protocol: 'tests',
  7064. fn: function (){
  7065. var self=this;
  7066. return smalltalk.withContext(function($ctx1) {
  7067. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  7068. $1=(23)._printShowingDecimalPlaces_((2));
  7069. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  7070. self._assert_equals_($1,"23.00");
  7071. $ctx1.sendIdx["assert:equals:"]=1;
  7072. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7073. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7074. self._assert_equals_($2,"23.57");
  7075. $ctx1.sendIdx["assert:equals:"]=2;
  7076. $4=(234.567)._negated();
  7077. $ctx1.sendIdx["negated"]=1;
  7078. $3=_st($4)._printShowingDecimalPlaces_((5));
  7079. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7080. self._assert_equals_($3,"-234.56700");
  7081. $ctx1.sendIdx["assert:equals:"]=3;
  7082. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7083. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7084. self._assert_equals_($5,"23");
  7085. $ctx1.sendIdx["assert:equals:"]=4;
  7086. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7087. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7088. self._assert_equals_($6,"24");
  7089. $ctx1.sendIdx["assert:equals:"]=5;
  7090. $8=(23.4567)._negated();
  7091. $ctx1.sendIdx["negated"]=2;
  7092. $7=_st($8)._printShowingDecimalPlaces_((0));
  7093. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7094. self._assert_equals_($7,"-23");
  7095. $ctx1.sendIdx["assert:equals:"]=6;
  7096. $10=(23.5567)._negated();
  7097. $ctx1.sendIdx["negated"]=3;
  7098. $9=_st($10)._printShowingDecimalPlaces_((0));
  7099. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7100. self._assert_equals_($9,"-24");
  7101. $ctx1.sendIdx["assert:equals:"]=7;
  7102. $11=(100000000)._printShowingDecimalPlaces_((1));
  7103. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7104. self._assert_equals_($11,"100000000.0");
  7105. $ctx1.sendIdx["assert:equals:"]=8;
  7106. $12=(0.98)._printShowingDecimalPlaces_((5));
  7107. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7108. self._assert_equals_($12,"0.98000");
  7109. $ctx1.sendIdx["assert:equals:"]=9;
  7110. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7111. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7112. self._assert_equals_($13,"-0.98");
  7113. $ctx1.sendIdx["assert:equals:"]=10;
  7114. $14=(2.567)._printShowingDecimalPlaces_((2));
  7115. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7116. self._assert_equals_($14,"2.57");
  7117. $ctx1.sendIdx["assert:equals:"]=11;
  7118. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7119. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7120. self._assert_equals_($15,"-2.57");
  7121. $ctx1.sendIdx["assert:equals:"]=12;
  7122. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7123. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)})},
  7124. args: [],
  7125. 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'.",
  7126. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7127. referencedClasses: []
  7128. }),
  7129. globals.NumberTest);
  7130. smalltalk.addMethod(
  7131. smalltalk.method({
  7132. selector: "testRaisedTo",
  7133. protocol: 'tests',
  7134. fn: function (){
  7135. var self=this;
  7136. return smalltalk.withContext(function($ctx1) {
  7137. var $1,$2,$3;
  7138. $1=(2)._raisedTo_((4));
  7139. $ctx1.sendIdx["raisedTo:"]=1;
  7140. self._assert_equals_($1,(16));
  7141. $ctx1.sendIdx["assert:equals:"]=1;
  7142. $2=(2)._raisedTo_((0));
  7143. $ctx1.sendIdx["raisedTo:"]=2;
  7144. self._assert_equals_($2,(1));
  7145. $ctx1.sendIdx["assert:equals:"]=2;
  7146. $3=(2)._raisedTo_((-3));
  7147. $ctx1.sendIdx["raisedTo:"]=3;
  7148. self._assert_equals_($3,(0.125));
  7149. $ctx1.sendIdx["assert:equals:"]=3;
  7150. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7151. $ctx1.sendIdx["assert:equals:"]=4;
  7152. self._assert_equals_((2).__star_star((4)),(16));
  7153. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)})},
  7154. args: [],
  7155. 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.",
  7156. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7157. referencedClasses: []
  7158. }),
  7159. globals.NumberTest);
  7160. smalltalk.addMethod(
  7161. smalltalk.method({
  7162. selector: "testRounded",
  7163. protocol: 'tests',
  7164. fn: function (){
  7165. var self=this;
  7166. return smalltalk.withContext(function($ctx1) {
  7167. var $1,$2;
  7168. $1=(3)._rounded();
  7169. $ctx1.sendIdx["rounded"]=1;
  7170. self._assert_equals_($1,(3));
  7171. $ctx1.sendIdx["assert:equals:"]=1;
  7172. $2=(3.212)._rounded();
  7173. $ctx1.sendIdx["rounded"]=2;
  7174. self._assert_equals_($2,(3));
  7175. $ctx1.sendIdx["assert:equals:"]=2;
  7176. self._assert_equals_((3.51)._rounded(),(4));
  7177. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)})},
  7178. args: [],
  7179. 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",
  7180. messageSends: ["assert:equals:", "rounded"],
  7181. referencedClasses: []
  7182. }),
  7183. globals.NumberTest);
  7184. smalltalk.addMethod(
  7185. smalltalk.method({
  7186. selector: "testSign",
  7187. protocol: 'tests',
  7188. fn: function (){
  7189. var self=this;
  7190. return smalltalk.withContext(function($ctx1) {
  7191. var $1,$2;
  7192. $1=(5)._sign();
  7193. $ctx1.sendIdx["sign"]=1;
  7194. self._assert_equals_($1,(1));
  7195. $ctx1.sendIdx["assert:equals:"]=1;
  7196. $2=(0)._sign();
  7197. $ctx1.sendIdx["sign"]=2;
  7198. self._assert_equals_($2,(0));
  7199. $ctx1.sendIdx["assert:equals:"]=2;
  7200. self._assert_equals_((-1.4)._sign(),(-1));
  7201. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)})},
  7202. args: [],
  7203. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7204. messageSends: ["assert:equals:", "sign"],
  7205. referencedClasses: []
  7206. }),
  7207. globals.NumberTest);
  7208. smalltalk.addMethod(
  7209. smalltalk.method({
  7210. selector: "testSqrt",
  7211. protocol: 'tests',
  7212. fn: function (){
  7213. var self=this;
  7214. return smalltalk.withContext(function($ctx1) {
  7215. var $1;
  7216. $1=(4)._sqrt();
  7217. $ctx1.sendIdx["sqrt"]=1;
  7218. self._assert_equals_($1,(2));
  7219. $ctx1.sendIdx["assert:equals:"]=1;
  7220. self._assert_equals_((16)._sqrt(),(4));
  7221. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)})},
  7222. args: [],
  7223. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7224. messageSends: ["assert:equals:", "sqrt"],
  7225. referencedClasses: []
  7226. }),
  7227. globals.NumberTest);
  7228. smalltalk.addMethod(
  7229. smalltalk.method({
  7230. selector: "testSquared",
  7231. protocol: 'tests',
  7232. fn: function (){
  7233. var self=this;
  7234. return smalltalk.withContext(function($ctx1) {
  7235. self._assert_equals_((4)._squared(),(16));
  7236. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)})},
  7237. args: [],
  7238. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7239. messageSends: ["assert:equals:", "squared"],
  7240. referencedClasses: []
  7241. }),
  7242. globals.NumberTest);
  7243. smalltalk.addMethod(
  7244. smalltalk.method({
  7245. selector: "testTimesRepeat",
  7246. protocol: 'tests',
  7247. fn: function (){
  7248. var self=this;
  7249. var i;
  7250. return smalltalk.withContext(function($ctx1) {
  7251. i=(0);
  7252. (0)._timesRepeat_((function(){
  7253. return smalltalk.withContext(function($ctx2) {
  7254. i=_st(i).__plus((1));
  7255. $ctx2.sendIdx["+"]=1;
  7256. return i;
  7257. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7258. $ctx1.sendIdx["timesRepeat:"]=1;
  7259. self._assert_equals_(i,(0));
  7260. $ctx1.sendIdx["assert:equals:"]=1;
  7261. (5)._timesRepeat_((function(){
  7262. return smalltalk.withContext(function($ctx2) {
  7263. i=_st(i).__plus((1));
  7264. return i;
  7265. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7266. self._assert_equals_(i,(5));
  7267. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)})},
  7268. args: [],
  7269. 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",
  7270. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7271. referencedClasses: []
  7272. }),
  7273. globals.NumberTest);
  7274. smalltalk.addMethod(
  7275. smalltalk.method({
  7276. selector: "testTo",
  7277. protocol: 'tests',
  7278. fn: function (){
  7279. var self=this;
  7280. return smalltalk.withContext(function($ctx1) {
  7281. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7282. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)})},
  7283. args: [],
  7284. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7285. messageSends: ["assert:equals:", "to:"],
  7286. referencedClasses: []
  7287. }),
  7288. globals.NumberTest);
  7289. smalltalk.addMethod(
  7290. smalltalk.method({
  7291. selector: "testToBy",
  7292. protocol: 'tests',
  7293. fn: function (){
  7294. var self=this;
  7295. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7296. return smalltalk.withContext(function($ctx1) {
  7297. var $1;
  7298. $1=(0)._to_by_((6),(2));
  7299. $ctx1.sendIdx["to:by:"]=1;
  7300. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7301. self._should_raise_((function(){
  7302. return smalltalk.withContext(function($ctx2) {
  7303. return (1)._to_by_((4),(0));
  7304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7305. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)})},
  7306. args: [],
  7307. 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",
  7308. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7309. referencedClasses: ["Error"]
  7310. }),
  7311. globals.NumberTest);
  7312. smalltalk.addMethod(
  7313. smalltalk.method({
  7314. selector: "testTrigonometry",
  7315. protocol: 'tests',
  7316. fn: function (){
  7317. var self=this;
  7318. return smalltalk.withContext(function($ctx1) {
  7319. self._assert_equals_((0)._cos(),(1));
  7320. $ctx1.sendIdx["assert:equals:"]=1;
  7321. self._assert_equals_((0)._sin(),(0));
  7322. $ctx1.sendIdx["assert:equals:"]=2;
  7323. self._assert_equals_((0)._tan(),(0));
  7324. $ctx1.sendIdx["assert:equals:"]=3;
  7325. self._assert_equals_((1)._arcCos(),(0));
  7326. $ctx1.sendIdx["assert:equals:"]=4;
  7327. self._assert_equals_((0)._arcSin(),(0));
  7328. $ctx1.sendIdx["assert:equals:"]=5;
  7329. self._assert_equals_((0)._arcTan(),(0));
  7330. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)})},
  7331. args: [],
  7332. 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.",
  7333. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7334. referencedClasses: []
  7335. }),
  7336. globals.NumberTest);
  7337. smalltalk.addMethod(
  7338. smalltalk.method({
  7339. selector: "testTruncated",
  7340. protocol: 'tests',
  7341. fn: function (){
  7342. var self=this;
  7343. return smalltalk.withContext(function($ctx1) {
  7344. var $1,$2;
  7345. $1=(3)._truncated();
  7346. $ctx1.sendIdx["truncated"]=1;
  7347. self._assert_equals_($1,(3));
  7348. $ctx1.sendIdx["assert:equals:"]=1;
  7349. $2=(3.212)._truncated();
  7350. $ctx1.sendIdx["truncated"]=2;
  7351. self._assert_equals_($2,(3));
  7352. $ctx1.sendIdx["assert:equals:"]=2;
  7353. self._assert_equals_((3.51)._truncated(),(3));
  7354. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)})},
  7355. args: [],
  7356. 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",
  7357. messageSends: ["assert:equals:", "truncated"],
  7358. referencedClasses: []
  7359. }),
  7360. globals.NumberTest);
  7361. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  7362. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7363. smalltalk.addMethod(
  7364. smalltalk.method({
  7365. selector: "foo",
  7366. protocol: 'not yet classified',
  7367. fn: function (){
  7368. var self=this;
  7369. var $1;
  7370. $1=self["@foo"];
  7371. return $1;
  7372. },
  7373. args: [],
  7374. source: "foo\x0a\x09^ foo",
  7375. messageSends: [],
  7376. referencedClasses: []
  7377. }),
  7378. globals.ObjectMock);
  7379. smalltalk.addMethod(
  7380. smalltalk.method({
  7381. selector: "foo:",
  7382. protocol: 'not yet classified',
  7383. fn: function (anObject){
  7384. var self=this;
  7385. self["@foo"]=anObject;
  7386. return self},
  7387. args: ["anObject"],
  7388. source: "foo: anObject\x0a\x09foo := anObject",
  7389. messageSends: [],
  7390. referencedClasses: []
  7391. }),
  7392. globals.ObjectMock);
  7393. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  7394. smalltalk.addMethod(
  7395. smalltalk.method({
  7396. selector: "notDefined",
  7397. protocol: 'tests',
  7398. fn: function (){
  7399. var self=this;
  7400. return smalltalk.withContext(function($ctx1) {
  7401. return void 0;;
  7402. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},globals.ObjectTest)})},
  7403. args: [],
  7404. source: "notDefined\x0a\x09<return void 0;>",
  7405. messageSends: [],
  7406. referencedClasses: []
  7407. }),
  7408. globals.ObjectTest);
  7409. smalltalk.addMethod(
  7410. smalltalk.method({
  7411. selector: "testBasicAccess",
  7412. protocol: 'tests',
  7413. fn: function (){
  7414. var self=this;
  7415. var o;
  7416. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7417. return smalltalk.withContext(function($ctx1) {
  7418. var $1;
  7419. o=_st($Object())._new();
  7420. _st(o)._basicAt_put_("a",(1));
  7421. $1=_st(o)._basicAt_("a");
  7422. $ctx1.sendIdx["basicAt:"]=1;
  7423. self._assert_equals_($1,(1));
  7424. $ctx1.sendIdx["assert:equals:"]=1;
  7425. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7426. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)})},
  7427. args: [],
  7428. 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",
  7429. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7430. referencedClasses: ["Object"]
  7431. }),
  7432. globals.ObjectTest);
  7433. smalltalk.addMethod(
  7434. smalltalk.method({
  7435. selector: "testBasicPerform",
  7436. protocol: 'tests',
  7437. fn: function (){
  7438. var self=this;
  7439. var o;
  7440. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7441. return smalltalk.withContext(function($ctx1) {
  7442. o=_st($Object())._new();
  7443. _st(o)._basicAt_put_("func",(function(){
  7444. return smalltalk.withContext(function($ctx2) {
  7445. return "hello";
  7446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7447. $ctx1.sendIdx["basicAt:put:"]=1;
  7448. _st(o)._basicAt_put_("func2",(function(a){
  7449. return smalltalk.withContext(function($ctx2) {
  7450. return _st(a).__plus((1));
  7451. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7452. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7453. $ctx1.sendIdx["assert:equals:"]=1;
  7454. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7455. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)})},
  7456. args: [],
  7457. 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",
  7458. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7459. referencedClasses: ["Object"]
  7460. }),
  7461. globals.ObjectTest);
  7462. smalltalk.addMethod(
  7463. smalltalk.method({
  7464. selector: "testDNU",
  7465. protocol: 'tests',
  7466. fn: function (){
  7467. var self=this;
  7468. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7469. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7470. return smalltalk.withContext(function($ctx1) {
  7471. self._should_raise_((function(){
  7472. return smalltalk.withContext(function($ctx2) {
  7473. return _st(_st($Object())._new())._foo();
  7474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7475. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)})},
  7476. args: [],
  7477. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7478. messageSends: ["should:raise:", "foo", "new"],
  7479. referencedClasses: ["Object", "MessageNotUnderstood"]
  7480. }),
  7481. globals.ObjectTest);
  7482. smalltalk.addMethod(
  7483. smalltalk.method({
  7484. selector: "testEquality",
  7485. protocol: 'tests',
  7486. fn: function (){
  7487. var self=this;
  7488. var o;
  7489. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7490. return smalltalk.withContext(function($ctx1) {
  7491. var $1,$2,$4,$3;
  7492. o=_st($Object())._new();
  7493. $ctx1.sendIdx["new"]=1;
  7494. $1=_st(o).__eq(_st($Object())._new());
  7495. $ctx1.sendIdx["="]=1;
  7496. self._deny_($1);
  7497. $2=_st(o).__eq(o);
  7498. $ctx1.sendIdx["="]=2;
  7499. self._assert_($2);
  7500. $ctx1.sendIdx["assert:"]=1;
  7501. $4=_st(o)._yourself();
  7502. $ctx1.sendIdx["yourself"]=1;
  7503. $3=_st($4).__eq(o);
  7504. $ctx1.sendIdx["="]=3;
  7505. self._assert_($3);
  7506. $ctx1.sendIdx["assert:"]=2;
  7507. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7508. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)})},
  7509. args: [],
  7510. 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)",
  7511. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7512. referencedClasses: ["Object"]
  7513. }),
  7514. globals.ObjectTest);
  7515. smalltalk.addMethod(
  7516. smalltalk.method({
  7517. selector: "testHalt",
  7518. protocol: 'tests',
  7519. fn: function (){
  7520. var self=this;
  7521. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7522. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7523. return smalltalk.withContext(function($ctx1) {
  7524. self._should_raise_((function(){
  7525. return smalltalk.withContext(function($ctx2) {
  7526. return _st(_st($Object())._new())._halt();
  7527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7528. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)})},
  7529. args: [],
  7530. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7531. messageSends: ["should:raise:", "halt", "new"],
  7532. referencedClasses: ["Object", "Error"]
  7533. }),
  7534. globals.ObjectTest);
  7535. smalltalk.addMethod(
  7536. smalltalk.method({
  7537. selector: "testIdentity",
  7538. protocol: 'tests',
  7539. fn: function (){
  7540. var self=this;
  7541. var o;
  7542. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7543. return smalltalk.withContext(function($ctx1) {
  7544. var $1,$2,$4,$3;
  7545. o=_st($Object())._new();
  7546. $ctx1.sendIdx["new"]=1;
  7547. $1=_st(o).__eq_eq(_st($Object())._new());
  7548. $ctx1.sendIdx["=="]=1;
  7549. self._deny_($1);
  7550. $2=_st(o).__eq_eq(o);
  7551. $ctx1.sendIdx["=="]=2;
  7552. self._assert_($2);
  7553. $ctx1.sendIdx["assert:"]=1;
  7554. $4=_st(o)._yourself();
  7555. $ctx1.sendIdx["yourself"]=1;
  7556. $3=_st($4).__eq_eq(o);
  7557. $ctx1.sendIdx["=="]=3;
  7558. self._assert_($3);
  7559. $ctx1.sendIdx["assert:"]=2;
  7560. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7561. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)})},
  7562. args: [],
  7563. 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",
  7564. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7565. referencedClasses: ["Object"]
  7566. }),
  7567. globals.ObjectTest);
  7568. smalltalk.addMethod(
  7569. smalltalk.method({
  7570. selector: "testIfNil",
  7571. protocol: 'tests',
  7572. fn: function (){
  7573. var self=this;
  7574. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7575. return smalltalk.withContext(function($ctx1) {
  7576. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  7577. $2=_st($Object())._new();
  7578. $ctx1.sendIdx["new"]=1;
  7579. $1=_st($2)._isNil();
  7580. self._deny_($1);
  7581. $ctx1.sendIdx["deny:"]=1;
  7582. $5=_st($Object())._new();
  7583. $ctx1.sendIdx["new"]=2;
  7584. if(($receiver = $5) == nil || $receiver == null){
  7585. $4=true;
  7586. } else {
  7587. $4=$5;
  7588. };
  7589. $3=_st($4).__eq(true);
  7590. self._deny_($3);
  7591. $7=_st($Object())._new();
  7592. $ctx1.sendIdx["new"]=3;
  7593. if(($receiver = $7) == nil || $receiver == null){
  7594. $6=$7;
  7595. } else {
  7596. $6=true;
  7597. };
  7598. self._assert_equals_($6,true);
  7599. $ctx1.sendIdx["assert:equals:"]=1;
  7600. $9=_st($Object())._new();
  7601. $ctx1.sendIdx["new"]=4;
  7602. if(($receiver = $9) == nil || $receiver == null){
  7603. $8=false;
  7604. } else {
  7605. $8=true;
  7606. };
  7607. self._assert_equals_($8,true);
  7608. $ctx1.sendIdx["assert:equals:"]=2;
  7609. $11=_st($Object())._new();
  7610. if(($receiver = $11) == nil || $receiver == null){
  7611. $10=false;
  7612. } else {
  7613. $10=true;
  7614. };
  7615. self._assert_equals_($10,true);
  7616. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)})},
  7617. args: [],
  7618. 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",
  7619. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7620. referencedClasses: ["Object"]
  7621. }),
  7622. globals.ObjectTest);
  7623. smalltalk.addMethod(
  7624. smalltalk.method({
  7625. selector: "testInstVars",
  7626. protocol: 'tests',
  7627. fn: function (){
  7628. var self=this;
  7629. var o;
  7630. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7631. return smalltalk.withContext(function($ctx1) {
  7632. var $1,$2;
  7633. o=_st($ObjectMock())._new();
  7634. $1=_st(o)._instVarAt_("foo");
  7635. $ctx1.sendIdx["instVarAt:"]=1;
  7636. self._assert_equals_($1,nil);
  7637. $ctx1.sendIdx["assert:equals:"]=1;
  7638. _st(o)._instVarAt_put_("foo",(1));
  7639. $2=_st(o)._instVarAt_("foo");
  7640. $ctx1.sendIdx["instVarAt:"]=2;
  7641. self._assert_equals_($2,(1));
  7642. $ctx1.sendIdx["assert:equals:"]=2;
  7643. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7644. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)})},
  7645. args: [],
  7646. 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",
  7647. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7648. referencedClasses: ["ObjectMock"]
  7649. }),
  7650. globals.ObjectTest);
  7651. smalltalk.addMethod(
  7652. smalltalk.method({
  7653. selector: "testNilUndefined",
  7654. protocol: 'tests',
  7655. fn: function (){
  7656. var self=this;
  7657. return smalltalk.withContext(function($ctx1) {
  7658. self._assert_equals_(self._notDefined(),nil);
  7659. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)})},
  7660. args: [],
  7661. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7662. messageSends: ["assert:equals:", "notDefined"],
  7663. referencedClasses: []
  7664. }),
  7665. globals.ObjectTest);
  7666. smalltalk.addMethod(
  7667. smalltalk.method({
  7668. selector: "testYourself",
  7669. protocol: 'tests',
  7670. fn: function (){
  7671. var self=this;
  7672. var o;
  7673. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7674. return smalltalk.withContext(function($ctx1) {
  7675. o=_st($ObjectMock())._new();
  7676. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7677. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)})},
  7678. args: [],
  7679. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7680. messageSends: ["new", "assert:", "==", "yourself"],
  7681. referencedClasses: ["ObjectMock"]
  7682. }),
  7683. globals.ObjectTest);
  7684. smalltalk.addMethod(
  7685. smalltalk.method({
  7686. selector: "testidentityHash",
  7687. protocol: 'tests',
  7688. fn: function (){
  7689. var self=this;
  7690. var o1,o2;
  7691. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7692. return smalltalk.withContext(function($ctx1) {
  7693. var $2,$3,$1,$5,$4;
  7694. o1=_st($Object())._new();
  7695. $ctx1.sendIdx["new"]=1;
  7696. o2=_st($Object())._new();
  7697. $2=_st(o1)._identityHash();
  7698. $ctx1.sendIdx["identityHash"]=1;
  7699. $3=_st(o1)._identityHash();
  7700. $ctx1.sendIdx["identityHash"]=2;
  7701. $1=_st($2).__eq_eq($3);
  7702. $ctx1.sendIdx["=="]=1;
  7703. self._assert_($1);
  7704. $5=_st(o1)._identityHash();
  7705. $ctx1.sendIdx["identityHash"]=3;
  7706. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7707. self._deny_($4);
  7708. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)})},
  7709. args: [],
  7710. 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",
  7711. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7712. referencedClasses: ["Object"]
  7713. }),
  7714. globals.ObjectTest);
  7715. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  7716. smalltalk.addMethod(
  7717. smalltalk.method({
  7718. selector: "testAccessing",
  7719. protocol: 'tests',
  7720. fn: function (){
  7721. var self=this;
  7722. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7723. return smalltalk.withContext(function($ctx1) {
  7724. var $2,$1,$3,$6,$5,$4;
  7725. $2=_st($Point())._x_y_((3),(4));
  7726. $ctx1.sendIdx["x:y:"]=1;
  7727. $1=_st($2)._x();
  7728. $ctx1.sendIdx["x"]=1;
  7729. self._assert_equals_($1,(3));
  7730. $ctx1.sendIdx["assert:equals:"]=1;
  7731. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7732. $ctx1.sendIdx["y"]=1;
  7733. self._assert_equals_($3,(4));
  7734. $ctx1.sendIdx["assert:equals:"]=2;
  7735. $6=_st($Point())._new();
  7736. $ctx1.sendIdx["new"]=1;
  7737. $5=_st($6)._x_((3));
  7738. $4=_st($5)._x();
  7739. self._assert_equals_($4,(3));
  7740. $ctx1.sendIdx["assert:equals:"]=3;
  7741. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7742. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)})},
  7743. args: [],
  7744. 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",
  7745. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7746. referencedClasses: ["Point"]
  7747. }),
  7748. globals.PointTest);
  7749. smalltalk.addMethod(
  7750. smalltalk.method({
  7751. selector: "testArithmetic",
  7752. protocol: 'tests',
  7753. fn: function (){
  7754. var self=this;
  7755. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7756. return smalltalk.withContext(function($ctx1) {
  7757. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7758. $2=(3).__at((4));
  7759. $ctx1.sendIdx["@"]=1;
  7760. $3=(3).__at((4));
  7761. $ctx1.sendIdx["@"]=2;
  7762. $1=_st($2).__star($3);
  7763. $4=_st($Point())._x_y_((9),(16));
  7764. $ctx1.sendIdx["x:y:"]=1;
  7765. self._assert_equals_($1,$4);
  7766. $ctx1.sendIdx["assert:equals:"]=1;
  7767. $6=(3).__at((4));
  7768. $ctx1.sendIdx["@"]=3;
  7769. $7=(3).__at((4));
  7770. $ctx1.sendIdx["@"]=4;
  7771. $5=_st($6).__plus($7);
  7772. $8=_st($Point())._x_y_((6),(8));
  7773. $ctx1.sendIdx["x:y:"]=2;
  7774. self._assert_equals_($5,$8);
  7775. $ctx1.sendIdx["assert:equals:"]=2;
  7776. $10=(3).__at((4));
  7777. $ctx1.sendIdx["@"]=5;
  7778. $11=(3).__at((4));
  7779. $ctx1.sendIdx["@"]=6;
  7780. $9=_st($10).__minus($11);
  7781. $12=_st($Point())._x_y_((0),(0));
  7782. $ctx1.sendIdx["x:y:"]=3;
  7783. self._assert_equals_($9,$12);
  7784. $ctx1.sendIdx["assert:equals:"]=3;
  7785. $14=(6).__at((8));
  7786. $ctx1.sendIdx["@"]=7;
  7787. $13=_st($14).__slash((3).__at((4)));
  7788. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7789. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)})},
  7790. args: [],
  7791. 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)",
  7792. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7793. referencedClasses: ["Point"]
  7794. }),
  7795. globals.PointTest);
  7796. smalltalk.addMethod(
  7797. smalltalk.method({
  7798. selector: "testAt",
  7799. protocol: 'tests',
  7800. fn: function (){
  7801. var self=this;
  7802. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7803. return smalltalk.withContext(function($ctx1) {
  7804. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7805. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)})},
  7806. args: [],
  7807. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7808. messageSends: ["assert:equals:", "@", "x:y:"],
  7809. referencedClasses: ["Point"]
  7810. }),
  7811. globals.PointTest);
  7812. smalltalk.addMethod(
  7813. smalltalk.method({
  7814. selector: "testEgality",
  7815. protocol: 'tests',
  7816. fn: function (){
  7817. var self=this;
  7818. return smalltalk.withContext(function($ctx1) {
  7819. var $2,$3,$1,$5,$4;
  7820. $2=(3).__at((4));
  7821. $ctx1.sendIdx["@"]=1;
  7822. $3=(3).__at((4));
  7823. $ctx1.sendIdx["@"]=2;
  7824. $1=_st($2).__eq($3);
  7825. $ctx1.sendIdx["="]=1;
  7826. self._assert_($1);
  7827. $5=(3).__at((5));
  7828. $ctx1.sendIdx["@"]=3;
  7829. $4=_st($5).__eq((3).__at((6)));
  7830. self._deny_($4);
  7831. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)})},
  7832. args: [],
  7833. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7834. messageSends: ["assert:", "=", "@", "deny:"],
  7835. referencedClasses: []
  7836. }),
  7837. globals.PointTest);
  7838. smalltalk.addMethod(
  7839. smalltalk.method({
  7840. selector: "testNew",
  7841. protocol: 'tests',
  7842. fn: function (){
  7843. var self=this;
  7844. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7845. return smalltalk.withContext(function($ctx1) {
  7846. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7847. $3=_st($Point())._new();
  7848. $ctx1.sendIdx["new"]=1;
  7849. $2=_st($3)._x_((3));
  7850. $ctx1.sendIdx["x:"]=1;
  7851. $1=_st($2)._y();
  7852. $ctx1.sendIdx["y"]=1;
  7853. self._assert_equals_($1,nil);
  7854. $ctx1.sendIdx["assert:equals:"]=1;
  7855. $7=_st($Point())._new();
  7856. $ctx1.sendIdx["new"]=2;
  7857. $6=_st($7)._x_((3));
  7858. $5=_st($6)._x();
  7859. $ctx1.sendIdx["x"]=1;
  7860. $4=_st($5).__eq((0));
  7861. $ctx1.sendIdx["="]=1;
  7862. self._deny_($4);
  7863. $ctx1.sendIdx["deny:"]=1;
  7864. $10=_st($Point())._new();
  7865. $ctx1.sendIdx["new"]=3;
  7866. $9=_st($10)._y_((4));
  7867. $ctx1.sendIdx["y:"]=1;
  7868. $8=_st($9)._x();
  7869. self._assert_equals_($8,nil);
  7870. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7871. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)})},
  7872. args: [],
  7873. 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",
  7874. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7875. referencedClasses: ["Point"]
  7876. }),
  7877. globals.PointTest);
  7878. smalltalk.addMethod(
  7879. smalltalk.method({
  7880. selector: "testTranslateBy",
  7881. protocol: 'tests',
  7882. fn: function (){
  7883. var self=this;
  7884. return smalltalk.withContext(function($ctx1) {
  7885. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7886. $2=(3).__at((3));
  7887. $ctx1.sendIdx["@"]=1;
  7888. $3=(0).__at((1));
  7889. $ctx1.sendIdx["@"]=2;
  7890. $1=_st($2)._translateBy_($3);
  7891. $ctx1.sendIdx["translateBy:"]=1;
  7892. $4=(3).__at((4));
  7893. $ctx1.sendIdx["@"]=3;
  7894. self._assert_equals_($1,$4);
  7895. $ctx1.sendIdx["assert:equals:"]=1;
  7896. $6=(3).__at((3));
  7897. $ctx1.sendIdx["@"]=4;
  7898. $8=(1)._negated();
  7899. $ctx1.sendIdx["negated"]=1;
  7900. $7=(0).__at($8);
  7901. $ctx1.sendIdx["@"]=5;
  7902. $5=_st($6)._translateBy_($7);
  7903. $ctx1.sendIdx["translateBy:"]=2;
  7904. $9=(3).__at((2));
  7905. $ctx1.sendIdx["@"]=6;
  7906. self._assert_equals_($5,$9);
  7907. $ctx1.sendIdx["assert:equals:"]=2;
  7908. $11=(3).__at((3));
  7909. $ctx1.sendIdx["@"]=7;
  7910. $12=(2).__at((3));
  7911. $ctx1.sendIdx["@"]=8;
  7912. $10=_st($11)._translateBy_($12);
  7913. $ctx1.sendIdx["translateBy:"]=3;
  7914. $13=(5).__at((6));
  7915. $ctx1.sendIdx["@"]=9;
  7916. self._assert_equals_($10,$13);
  7917. $ctx1.sendIdx["assert:equals:"]=3;
  7918. $15=(3).__at((3));
  7919. $ctx1.sendIdx["@"]=10;
  7920. $16=_st((3)._negated()).__at((0));
  7921. $ctx1.sendIdx["@"]=11;
  7922. $14=_st($15)._translateBy_($16);
  7923. self._assert_equals_($14,(0).__at((3)));
  7924. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)})},
  7925. args: [],
  7926. 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.",
  7927. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7928. referencedClasses: []
  7929. }),
  7930. globals.PointTest);
  7931. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  7932. smalltalk.addMethod(
  7933. smalltalk.method({
  7934. selector: "testNextIfAbsent",
  7935. protocol: 'tests',
  7936. fn: function (){
  7937. var self=this;
  7938. var queue;
  7939. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7940. return smalltalk.withContext(function($ctx1) {
  7941. var $2,$1;
  7942. queue=_st($Queue())._new();
  7943. _st(queue)._nextPut_("index1");
  7944. $2=_st(queue)._nextIfAbsent_("empty");
  7945. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7946. $1=_st($2).__eq("index1");
  7947. $ctx1.sendIdx["="]=1;
  7948. self._assert_($1);
  7949. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7950. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)})},
  7951. args: [],
  7952. 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'",
  7953. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7954. referencedClasses: ["Queue"]
  7955. }),
  7956. globals.QueueTest);
  7957. smalltalk.addMethod(
  7958. smalltalk.method({
  7959. selector: "testQueueNext",
  7960. protocol: 'tests',
  7961. fn: function (){
  7962. var self=this;
  7963. var queue;
  7964. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7965. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7966. return smalltalk.withContext(function($ctx1) {
  7967. var $1,$2,$4,$3,$6,$5;
  7968. queue=_st($Queue())._new();
  7969. $1=queue;
  7970. _st($1)._nextPut_("index1");
  7971. $ctx1.sendIdx["nextPut:"]=1;
  7972. $2=_st($1)._nextPut_("index2");
  7973. $4=_st(queue)._next();
  7974. $ctx1.sendIdx["next"]=1;
  7975. $3=_st($4).__eq("index1");
  7976. $ctx1.sendIdx["="]=1;
  7977. self._assert_($3);
  7978. $6=_st(queue)._next();
  7979. $ctx1.sendIdx["next"]=2;
  7980. $5=_st($6).__eq("index");
  7981. self._deny_($5);
  7982. self._should_raise_((function(){
  7983. return smalltalk.withContext(function($ctx2) {
  7984. return _st(queue)._next();
  7985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7986. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)})},
  7987. args: [],
  7988. 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",
  7989. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  7990. referencedClasses: ["Queue", "Error"]
  7991. }),
  7992. globals.QueueTest);
  7993. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  7994. smalltalk.addMethod(
  7995. smalltalk.method({
  7996. selector: "testAtRandomNumber",
  7997. protocol: 'tests',
  7998. fn: function (){
  7999. var self=this;
  8000. var val;
  8001. return smalltalk.withContext(function($ctx1) {
  8002. (100)._timesRepeat_((function(){
  8003. return smalltalk.withContext(function($ctx2) {
  8004. val=(10)._atRandom();
  8005. val;
  8006. self._assert_(_st(val).__gt((0)));
  8007. $ctx2.sendIdx["assert:"]=1;
  8008. return self._assert_(_st(val).__lt((11)));
  8009. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8010. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)})},
  8011. args: [],
  8012. 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]",
  8013. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  8014. referencedClasses: []
  8015. }),
  8016. globals.RandomTest);
  8017. smalltalk.addMethod(
  8018. smalltalk.method({
  8019. selector: "testAtRandomSequenceableCollection",
  8020. protocol: 'tests',
  8021. fn: function (){
  8022. var self=this;
  8023. var val;
  8024. return smalltalk.withContext(function($ctx1) {
  8025. var $3,$4,$2,$1;
  8026. (100)._timesRepeat_((function(){
  8027. return smalltalk.withContext(function($ctx2) {
  8028. val="abc"._atRandom();
  8029. val;
  8030. $3=_st(val).__eq("a");
  8031. $ctx2.sendIdx["="]=1;
  8032. $4=_st(val).__eq("b");
  8033. $ctx2.sendIdx["="]=2;
  8034. $2=_st($3).__or($4);
  8035. $1=_st($2).__or(_st(val).__eq("c"));
  8036. $ctx2.sendIdx["|"]=1;
  8037. return self._assert_($1);
  8038. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8039. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)})},
  8040. args: [],
  8041. 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].",
  8042. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  8043. referencedClasses: []
  8044. }),
  8045. globals.RandomTest);
  8046. smalltalk.addMethod(
  8047. smalltalk.method({
  8048. selector: "textNext",
  8049. protocol: 'tests',
  8050. fn: function (){
  8051. var self=this;
  8052. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  8053. return smalltalk.withContext(function($ctx1) {
  8054. var $1;
  8055. (10000)._timesRepeat_((function(){
  8056. var current,next;
  8057. return smalltalk.withContext(function($ctx2) {
  8058. next=_st(_st($Random())._new())._next();
  8059. next;
  8060. self._assert_(_st(next).__gt_eq((0)));
  8061. $ctx2.sendIdx["assert:"]=1;
  8062. self._assert_(_st(next).__lt((1)));
  8063. $1=_st(current).__eq(next);
  8064. $ctx2.sendIdx["="]=1;
  8065. self._deny_($1);
  8066. return _st(next).__eq(current);
  8067. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8068. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)})},
  8069. args: [],
  8070. 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 ]",
  8071. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8072. referencedClasses: ["Random"]
  8073. }),
  8074. globals.RandomTest);
  8075. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  8076. smalltalk.addMethod(
  8077. smalltalk.method({
  8078. selector: "collectionClass",
  8079. protocol: 'accessing',
  8080. fn: function (){
  8081. var self=this;
  8082. return smalltalk.withContext(function($ctx1) {
  8083. var $1;
  8084. $1=_st(self._class())._collectionClass();
  8085. return $1;
  8086. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)})},
  8087. args: [],
  8088. source: "collectionClass\x0a\x09^ self class collectionClass",
  8089. messageSends: ["collectionClass", "class"],
  8090. referencedClasses: []
  8091. }),
  8092. globals.StreamTest);
  8093. smalltalk.addMethod(
  8094. smalltalk.method({
  8095. selector: "newCollection",
  8096. protocol: 'accessing',
  8097. fn: function (){
  8098. var self=this;
  8099. return smalltalk.withContext(function($ctx1) {
  8100. var $1;
  8101. $1=_st(self._collectionClass())._new();
  8102. return $1;
  8103. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)})},
  8104. args: [],
  8105. source: "newCollection\x0a\x09^ self collectionClass new",
  8106. messageSends: ["new", "collectionClass"],
  8107. referencedClasses: []
  8108. }),
  8109. globals.StreamTest);
  8110. smalltalk.addMethod(
  8111. smalltalk.method({
  8112. selector: "newStream",
  8113. protocol: 'accessing',
  8114. fn: function (){
  8115. var self=this;
  8116. return smalltalk.withContext(function($ctx1) {
  8117. var $1;
  8118. $1=_st(_st(self._collectionClass())._new())._stream();
  8119. return $1;
  8120. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)})},
  8121. args: [],
  8122. source: "newStream\x0a\x09^ self collectionClass new stream",
  8123. messageSends: ["stream", "new", "collectionClass"],
  8124. referencedClasses: []
  8125. }),
  8126. globals.StreamTest);
  8127. smalltalk.addMethod(
  8128. smalltalk.method({
  8129. selector: "testAtStartAtEnd",
  8130. protocol: 'tests',
  8131. fn: function (){
  8132. var self=this;
  8133. var stream;
  8134. return smalltalk.withContext(function($ctx1) {
  8135. var $1,$2,$3,$4;
  8136. stream=self._newStream();
  8137. $1=_st(stream)._atStart();
  8138. $ctx1.sendIdx["atStart"]=1;
  8139. self._assert_($1);
  8140. $ctx1.sendIdx["assert:"]=1;
  8141. $2=_st(stream)._atEnd();
  8142. $ctx1.sendIdx["atEnd"]=1;
  8143. self._assert_($2);
  8144. $ctx1.sendIdx["assert:"]=2;
  8145. _st(stream)._nextPutAll_(self._newCollection());
  8146. $3=_st(stream)._atEnd();
  8147. $ctx1.sendIdx["atEnd"]=2;
  8148. self._assert_($3);
  8149. $4=_st(stream)._atStart();
  8150. $ctx1.sendIdx["atStart"]=2;
  8151. self._deny_($4);
  8152. $ctx1.sendIdx["deny:"]=1;
  8153. _st(stream)._position_((1));
  8154. self._deny_(_st(stream)._atEnd());
  8155. $ctx1.sendIdx["deny:"]=2;
  8156. self._deny_(_st(stream)._atStart());
  8157. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)})},
  8158. args: [],
  8159. 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",
  8160. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8161. referencedClasses: []
  8162. }),
  8163. globals.StreamTest);
  8164. smalltalk.addMethod(
  8165. smalltalk.method({
  8166. selector: "testContents",
  8167. protocol: 'tests',
  8168. fn: function (){
  8169. var self=this;
  8170. var stream;
  8171. return smalltalk.withContext(function($ctx1) {
  8172. var $1,$2;
  8173. stream=self._newStream();
  8174. $1=stream;
  8175. $2=self._newCollection();
  8176. $ctx1.sendIdx["newCollection"]=1;
  8177. _st($1)._nextPutAll_($2);
  8178. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8179. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)})},
  8180. args: [],
  8181. 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",
  8182. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8183. referencedClasses: []
  8184. }),
  8185. globals.StreamTest);
  8186. smalltalk.addMethod(
  8187. smalltalk.method({
  8188. selector: "testIsEmpty",
  8189. protocol: 'tests',
  8190. fn: function (){
  8191. var self=this;
  8192. var stream;
  8193. return smalltalk.withContext(function($ctx1) {
  8194. var $1;
  8195. stream=self._newStream();
  8196. $1=_st(stream)._isEmpty();
  8197. $ctx1.sendIdx["isEmpty"]=1;
  8198. self._assert_($1);
  8199. _st(stream)._nextPutAll_(self._newCollection());
  8200. self._deny_(_st(stream)._isEmpty());
  8201. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)})},
  8202. args: [],
  8203. 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",
  8204. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8205. referencedClasses: []
  8206. }),
  8207. globals.StreamTest);
  8208. smalltalk.addMethod(
  8209. smalltalk.method({
  8210. selector: "testPosition",
  8211. protocol: 'tests',
  8212. fn: function (){
  8213. var self=this;
  8214. var collection,stream;
  8215. return smalltalk.withContext(function($ctx1) {
  8216. var $1,$2,$3;
  8217. collection=self._newCollection();
  8218. stream=self._newStream();
  8219. _st(stream)._nextPutAll_(collection);
  8220. $1=_st(stream)._position();
  8221. $ctx1.sendIdx["position"]=1;
  8222. self._assert_equals_($1,_st(collection)._size());
  8223. $ctx1.sendIdx["assert:equals:"]=1;
  8224. _st(stream)._position_((0));
  8225. $2=_st(stream)._position();
  8226. $ctx1.sendIdx["position"]=2;
  8227. self._assert_equals_($2,(0));
  8228. $ctx1.sendIdx["assert:equals:"]=2;
  8229. _st(stream)._next();
  8230. $ctx1.sendIdx["next"]=1;
  8231. $3=_st(stream)._position();
  8232. $ctx1.sendIdx["position"]=3;
  8233. self._assert_equals_($3,(1));
  8234. $ctx1.sendIdx["assert:equals:"]=3;
  8235. _st(stream)._next();
  8236. self._assert_equals_(_st(stream)._position(),(2));
  8237. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)})},
  8238. args: [],
  8239. 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",
  8240. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8241. referencedClasses: []
  8242. }),
  8243. globals.StreamTest);
  8244. smalltalk.addMethod(
  8245. smalltalk.method({
  8246. selector: "testReading",
  8247. protocol: 'tests',
  8248. fn: function (){
  8249. var self=this;
  8250. var stream,collection;
  8251. return smalltalk.withContext(function($ctx1) {
  8252. var $1,$2,$3;
  8253. collection=self._newCollection();
  8254. stream=self._newStream();
  8255. $1=stream;
  8256. _st($1)._nextPutAll_(collection);
  8257. $2=_st($1)._position_((0));
  8258. _st(collection)._do_((function(each){
  8259. return smalltalk.withContext(function($ctx2) {
  8260. $3=_st(stream)._next();
  8261. $ctx2.sendIdx["next"]=1;
  8262. return self._assert_equals_($3,each);
  8263. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8264. self._assert_(_st(_st(stream)._next())._isNil());
  8265. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)})},
  8266. args: [],
  8267. 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",
  8268. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8269. referencedClasses: []
  8270. }),
  8271. globals.StreamTest);
  8272. smalltalk.addMethod(
  8273. smalltalk.method({
  8274. selector: "testStreamContents",
  8275. protocol: 'tests',
  8276. fn: function (){
  8277. var self=this;
  8278. return self},
  8279. args: [],
  8280. source: "testStreamContents",
  8281. messageSends: [],
  8282. referencedClasses: []
  8283. }),
  8284. globals.StreamTest);
  8285. smalltalk.addMethod(
  8286. smalltalk.method({
  8287. selector: "testWrite",
  8288. protocol: 'tests',
  8289. fn: function (){
  8290. var self=this;
  8291. var stream,collection;
  8292. return smalltalk.withContext(function($ctx1) {
  8293. collection=self._newCollection();
  8294. stream=self._newStream();
  8295. _st(collection)._do_((function(each){
  8296. return smalltalk.withContext(function($ctx2) {
  8297. return _st(stream).__lt_lt(each);
  8298. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8299. self._assert_equals_(_st(stream)._contents(),collection);
  8300. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)})},
  8301. args: [],
  8302. 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",
  8303. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8304. referencedClasses: []
  8305. }),
  8306. globals.StreamTest);
  8307. smalltalk.addMethod(
  8308. smalltalk.method({
  8309. selector: "testWriting",
  8310. protocol: 'tests',
  8311. fn: function (){
  8312. var self=this;
  8313. var stream,collection;
  8314. return smalltalk.withContext(function($ctx1) {
  8315. var $1;
  8316. collection=self._newCollection();
  8317. stream=self._newStream();
  8318. $ctx1.sendIdx["newStream"]=1;
  8319. _st(collection)._do_((function(each){
  8320. return smalltalk.withContext(function($ctx2) {
  8321. return _st(stream)._nextPut_(each);
  8322. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8323. $1=_st(stream)._contents();
  8324. $ctx1.sendIdx["contents"]=1;
  8325. self._assert_equals_($1,collection);
  8326. $ctx1.sendIdx["assert:equals:"]=1;
  8327. stream=self._newStream();
  8328. _st(stream)._nextPutAll_(collection);
  8329. self._assert_equals_(_st(stream)._contents(),collection);
  8330. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)})},
  8331. args: [],
  8332. 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",
  8333. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8334. referencedClasses: []
  8335. }),
  8336. globals.StreamTest);
  8337. smalltalk.addMethod(
  8338. smalltalk.method({
  8339. selector: "collectionClass",
  8340. protocol: 'accessing',
  8341. fn: function (){
  8342. var self=this;
  8343. return nil;
  8344. },
  8345. args: [],
  8346. source: "collectionClass\x0a\x09^ nil",
  8347. messageSends: [],
  8348. referencedClasses: []
  8349. }),
  8350. globals.StreamTest.klass);
  8351. smalltalk.addMethod(
  8352. smalltalk.method({
  8353. selector: "isAbstract",
  8354. protocol: 'testing',
  8355. fn: function (){
  8356. var self=this;
  8357. return smalltalk.withContext(function($ctx1) {
  8358. var $1;
  8359. $1=_st(self._collectionClass())._isNil();
  8360. return $1;
  8361. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)})},
  8362. args: [],
  8363. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8364. messageSends: ["isNil", "collectionClass"],
  8365. referencedClasses: []
  8366. }),
  8367. globals.StreamTest.klass);
  8368. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8369. smalltalk.addMethod(
  8370. smalltalk.method({
  8371. selector: "newCollection",
  8372. protocol: 'accessing',
  8373. fn: function (){
  8374. var self=this;
  8375. return smalltalk.withContext(function($ctx1) {
  8376. var $1;
  8377. $1=[true,(1),(3).__at((4)),"foo"];
  8378. return $1;
  8379. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)})},
  8380. args: [],
  8381. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8382. messageSends: ["@"],
  8383. referencedClasses: []
  8384. }),
  8385. globals.ArrayStreamTest);
  8386. smalltalk.addMethod(
  8387. smalltalk.method({
  8388. selector: "collectionClass",
  8389. protocol: 'accessing',
  8390. fn: function (){
  8391. var self=this;
  8392. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8393. return $Array();
  8394. },
  8395. args: [],
  8396. source: "collectionClass\x0a\x09^ Array",
  8397. messageSends: [],
  8398. referencedClasses: ["Array"]
  8399. }),
  8400. globals.ArrayStreamTest.klass);
  8401. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8402. smalltalk.addMethod(
  8403. smalltalk.method({
  8404. selector: "newCollection",
  8405. protocol: 'accessing',
  8406. fn: function (){
  8407. var self=this;
  8408. return "hello world";
  8409. },
  8410. args: [],
  8411. source: "newCollection\x0a\x09^ 'hello world'",
  8412. messageSends: [],
  8413. referencedClasses: []
  8414. }),
  8415. globals.StringStreamTest);
  8416. smalltalk.addMethod(
  8417. smalltalk.method({
  8418. selector: "collectionClass",
  8419. protocol: 'accessing',
  8420. fn: function (){
  8421. var self=this;
  8422. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8423. return $String();
  8424. },
  8425. args: [],
  8426. source: "collectionClass\x0a\x09^ String",
  8427. messageSends: [],
  8428. referencedClasses: ["String"]
  8429. }),
  8430. globals.StringStreamTest.klass);
  8431. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  8432. smalltalk.addMethod(
  8433. smalltalk.method({
  8434. selector: "testCopying",
  8435. protocol: 'tests',
  8436. fn: function (){
  8437. var self=this;
  8438. return smalltalk.withContext(function($ctx1) {
  8439. self._assert_equals_(nil._copy(),nil);
  8440. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)})},
  8441. args: [],
  8442. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8443. messageSends: ["assert:equals:", "copy"],
  8444. referencedClasses: []
  8445. }),
  8446. globals.UndefinedTest);
  8447. smalltalk.addMethod(
  8448. smalltalk.method({
  8449. selector: "testDeepCopy",
  8450. protocol: 'tests',
  8451. fn: function (){
  8452. var self=this;
  8453. return smalltalk.withContext(function($ctx1) {
  8454. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8455. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)})},
  8456. args: [],
  8457. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8458. messageSends: ["assert:", "=", "deepCopy"],
  8459. referencedClasses: []
  8460. }),
  8461. globals.UndefinedTest);
  8462. smalltalk.addMethod(
  8463. smalltalk.method({
  8464. selector: "testIfNil",
  8465. protocol: 'tests',
  8466. fn: function (){
  8467. var self=this;
  8468. return smalltalk.withContext(function($ctx1) {
  8469. var $1,$3,$2,$4,$6,$5;
  8470. if(($receiver = nil) == nil || $receiver == null){
  8471. $1=true;
  8472. } else {
  8473. $1=nil;
  8474. };
  8475. self._assert_equals_($1,true);
  8476. $ctx1.sendIdx["assert:equals:"]=1;
  8477. if(($receiver = nil) == nil || $receiver == null){
  8478. $3=nil;
  8479. } else {
  8480. $3=true;
  8481. };
  8482. $2=_st($3).__eq(true);
  8483. $ctx1.sendIdx["="]=1;
  8484. self._deny_($2);
  8485. $ctx1.sendIdx["deny:"]=1;
  8486. if(($receiver = nil) == nil || $receiver == null){
  8487. $4=true;
  8488. } else {
  8489. $4=false;
  8490. };
  8491. self._assert_equals_($4,true);
  8492. if(($receiver = nil) == nil || $receiver == null){
  8493. $6=false;
  8494. } else {
  8495. $6=true;
  8496. };
  8497. $5=_st($6).__eq(true);
  8498. self._deny_($5);
  8499. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)})},
  8500. args: [],
  8501. 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",
  8502. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8503. referencedClasses: []
  8504. }),
  8505. globals.UndefinedTest);
  8506. smalltalk.addMethod(
  8507. smalltalk.method({
  8508. selector: "testIsNil",
  8509. protocol: 'tests',
  8510. fn: function (){
  8511. var self=this;
  8512. return smalltalk.withContext(function($ctx1) {
  8513. self._assert_(nil._isNil());
  8514. self._deny_(nil._notNil());
  8515. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)})},
  8516. args: [],
  8517. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8518. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8519. referencedClasses: []
  8520. }),
  8521. globals.UndefinedTest);
  8522. });