Kernel-Tests.js 327 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "testHandlesAnnouncement",
  8. protocol: 'tests',
  9. fn: function (){
  10. var self=this;
  11. var subscription,announcementClass1,announcementClass2,classBuilder;
  12. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  16. return smalltalk.withContext(function($ctx1) {
  17. var $1,$2;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  22. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  23. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  24. self._assert_equals_($1,true);
  25. $ctx1.sendIdx["assert:equals:"]=1;
  26. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  27. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  28. self._assert_equals_($2,true);
  29. $ctx1.sendIdx["assert:equals:"]=2;
  30. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  31. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  32. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},smalltalk.AnnouncementSubscriptionTest)})},
  33. args: [],
  34. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  35. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  36. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  37. }),
  38. smalltalk.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', smalltalk.TestCase, [], 'Kernel-Tests');
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "testOnDo",
  43. protocol: 'not yet classified',
  44. fn: function (){
  45. var self=this;
  46. var counter,announcer;
  47. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  49. return smalltalk.withContext(function($ctx1) {
  50. var $1,$2;
  51. counter=(0);
  52. announcer=_st($Announcer())._new();
  53. $ctx1.sendIdx["new"]=1;
  54. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  55. return smalltalk.withContext(function($ctx2) {
  56. counter=_st(counter).__plus((1));
  57. return counter;
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  59. $1=announcer;
  60. $2=_st($SystemAnnouncement())._new();
  61. $ctx1.sendIdx["new"]=2;
  62. _st($1)._announce_($2);
  63. $ctx1.sendIdx["announce:"]=1;
  64. self._assert_equals_(counter,(1));
  65. $ctx1.sendIdx["assert:equals:"]=1;
  66. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  67. self._assert_equals_(counter,(2));
  68. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  69. args: [],
  70. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  71. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  72. referencedClasses: ["Announcer", "SystemAnnouncement"]
  73. }),
  74. smalltalk.AnnouncerTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testOnDoOnce",
  78. protocol: 'not yet classified',
  79. fn: function (){
  80. var self=this;
  81. var counter,announcer;
  82. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  84. return smalltalk.withContext(function($ctx1) {
  85. var $1,$2;
  86. counter=(0);
  87. announcer=_st($Announcer())._new();
  88. $ctx1.sendIdx["new"]=1;
  89. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  90. return smalltalk.withContext(function($ctx2) {
  91. counter=_st(counter).__plus((1));
  92. return counter;
  93. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  94. $1=announcer;
  95. $2=_st($SystemAnnouncement())._new();
  96. $ctx1.sendIdx["new"]=2;
  97. _st($1)._announce_($2);
  98. $ctx1.sendIdx["announce:"]=1;
  99. self._assert_equals_(counter,(1));
  100. $ctx1.sendIdx["assert:equals:"]=1;
  101. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  102. self._assert_equals_(counter,(1));
  103. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  104. args: [],
  105. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  106. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  107. referencedClasses: ["Announcer", "SystemAnnouncement"]
  108. }),
  109. smalltalk.AnnouncerTest);
  110. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testCanClearInterval",
  114. protocol: 'tests',
  115. fn: function (){
  116. var self=this;
  117. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  118. return smalltalk.withContext(function($ctx1) {
  119. self._shouldnt_raise_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. return _st(_st((function(){
  122. return smalltalk.withContext(function($ctx3) {
  123. return _st(_st($Error())._new())._signal();
  124. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  126. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  127. args: [],
  128. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  129. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  130. referencedClasses: ["Error"]
  131. }),
  132. smalltalk.BlockClosureTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testCanClearTimeout",
  136. protocol: 'tests',
  137. fn: function (){
  138. var self=this;
  139. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  140. return smalltalk.withContext(function($ctx1) {
  141. self._shouldnt_raise_((function(){
  142. return smalltalk.withContext(function($ctx2) {
  143. return _st(_st((function(){
  144. return smalltalk.withContext(function($ctx3) {
  145. return _st(_st($Error())._new())._signal();
  146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  148. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  149. args: [],
  150. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  151. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  152. referencedClasses: ["Error"]
  153. }),
  154. smalltalk.BlockClosureTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testCompiledSource",
  158. protocol: 'tests',
  159. fn: function (){
  160. var self=this;
  161. return smalltalk.withContext(function($ctx1) {
  162. self._assert_(_st(_st((function(){
  163. return smalltalk.withContext(function($ctx2) {
  164. return (1).__plus((1));
  165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  166. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  167. args: [],
  168. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  169. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  170. referencedClasses: []
  171. }),
  172. smalltalk.BlockClosureTest);
  173. smalltalk.addMethod(
  174. smalltalk.method({
  175. selector: "testCurrySelf",
  176. protocol: 'tests',
  177. fn: function (){
  178. var self=this;
  179. var curriedMethod,array;
  180. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  181. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  182. return smalltalk.withContext(function($ctx1) {
  183. curriedMethod=_st(_st((function(selfarg,x){
  184. return smalltalk.withContext(function($ctx2) {
  185. return _st(selfarg)._at_(x);
  186. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  187. array=[(3), (1), (4)];
  188. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  189. _st((function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return self._assert_equals_(_st(array)._foo_((2)),(1));
  192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  193. return smalltalk.withContext(function($ctx2) {
  194. return _st($Array())._removeCompiledMethod_(curriedMethod);
  195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  196. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  197. args: [],
  198. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  199. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  200. referencedClasses: ["ClassBuilder", "Array"]
  201. }),
  202. smalltalk.BlockClosureTest);
  203. smalltalk.addMethod(
  204. smalltalk.method({
  205. selector: "testEnsure",
  206. protocol: 'tests',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. self._assert_equals_(_st((function(){
  211. return smalltalk.withContext(function($ctx2) {
  212. return (3);
  213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  214. return smalltalk.withContext(function($ctx2) {
  215. return (4);
  216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  217. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  218. args: [],
  219. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  220. messageSends: ["assert:equals:", "ensure:"],
  221. referencedClasses: []
  222. }),
  223. smalltalk.BlockClosureTest);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "testEnsureRaises",
  227. protocol: 'tests',
  228. fn: function (){
  229. var self=this;
  230. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  231. return smalltalk.withContext(function($ctx1) {
  232. self._should_raise_((function(){
  233. return smalltalk.withContext(function($ctx2) {
  234. return _st((function(){
  235. return smalltalk.withContext(function($ctx3) {
  236. return _st(_st($Error())._new())._signal();
  237. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  238. return smalltalk.withContext(function($ctx3) {
  239. return true;
  240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  242. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  243. args: [],
  244. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  245. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  246. referencedClasses: ["Error"]
  247. }),
  248. smalltalk.BlockClosureTest);
  249. smalltalk.addMethod(
  250. smalltalk.method({
  251. selector: "testExceptionSemantics",
  252. protocol: 'tests',
  253. fn: function (){
  254. var self=this;
  255. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  256. return smalltalk.withContext(function($ctx1) {
  257. self._timeout_((100));
  258. _st(self._async_((function(){
  259. return smalltalk.withContext(function($ctx2) {
  260. return _st((function(){
  261. return smalltalk.withContext(function($ctx3) {
  262. self._assert_(true);
  263. _st($Error())._signal();
  264. self._deny_(true);
  265. return self._finished();
  266. $ctx3.sendIdx["finished"]=1;
  267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  268. return smalltalk.withContext(function($ctx3) {
  269. return self._finished();
  270. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  272. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  273. args: [],
  274. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  275. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  276. referencedClasses: ["Error"]
  277. }),
  278. smalltalk.BlockClosureTest);
  279. smalltalk.addMethod(
  280. smalltalk.method({
  281. selector: "testNewWithValues",
  282. protocol: 'tests',
  283. fn: function (){
  284. var self=this;
  285. return smalltalk.withContext(function($ctx1) {
  286. function theTestPrototype() {this.name = "theTestPrototype";}
  287. function theTestConstructor(arg1, arg2, arg3) {}
  288. theTestConstructor.prototype = new theTestPrototype;
  289. var theWrappedConstructor = _st(theTestConstructor);
  290. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);
  291. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  292. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  293. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  294. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  295. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  296. args: [],
  297. source: "testNewWithValues\x0a<\x0a\x09function theTestPrototype() {this.name = \x22theTestPrototype\x22;}\x0a\x09function theTestConstructor(arg1, arg2, arg3) {}\x0a\x09theTestConstructor.prototype = new theTestPrototype;\x0a\x0a\x09var theWrappedConstructor = _st(theTestConstructor);\x0a\x09var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}\x0a\x09self._should_raise_(_st(constructionShouldFail), smalltalk.Error);\x0a>",
  298. messageSends: [],
  299. referencedClasses: []
  300. }),
  301. smalltalk.BlockClosureTest);
  302. smalltalk.addMethod(
  303. smalltalk.method({
  304. selector: "testNumArgs",
  305. protocol: 'tests',
  306. fn: function (){
  307. var self=this;
  308. return smalltalk.withContext(function($ctx1) {
  309. var $1;
  310. $1=_st((function(){
  311. return smalltalk.withContext(function($ctx2) {
  312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  313. $ctx1.sendIdx["numArgs"]=1;
  314. self._assert_equals_($1,(0));
  315. $ctx1.sendIdx["assert:equals:"]=1;
  316. self._assert_equals_(_st((function(a,b){
  317. return smalltalk.withContext(function($ctx2) {
  318. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs(),(2));
  319. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  320. args: [],
  321. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  322. messageSends: ["assert:equals:", "numArgs"],
  323. referencedClasses: []
  324. }),
  325. smalltalk.BlockClosureTest);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "testOnDo",
  329. protocol: 'tests',
  330. fn: function (){
  331. var self=this;
  332. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  333. return smalltalk.withContext(function($ctx1) {
  334. self._assert_(_st((function(){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st(_st($Error())._new())._signal();
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  338. return smalltalk.withContext(function($ctx2) {
  339. return true;
  340. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  341. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  342. args: [],
  343. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  344. messageSends: ["assert:", "on:do:", "signal", "new"],
  345. referencedClasses: ["Error"]
  346. }),
  347. smalltalk.BlockClosureTest);
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "testValue",
  351. protocol: 'tests',
  352. fn: function (){
  353. var self=this;
  354. return smalltalk.withContext(function($ctx1) {
  355. var $1;
  356. $1=_st((function(){
  357. return smalltalk.withContext(function($ctx2) {
  358. return (1).__plus((1));
  359. $ctx2.sendIdx["+"]=1;
  360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  361. $ctx1.sendIdx["value"]=1;
  362. self._assert_equals_($1,(2));
  363. $ctx1.sendIdx["assert:equals:"]=1;
  364. self._assert_equals_(_st((function(x){
  365. return smalltalk.withContext(function($ctx2) {
  366. return _st(x).__plus((1));
  367. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  368. $ctx1.sendIdx["assert:equals:"]=2;
  369. self._assert_equals_(_st((function(x,y){
  370. return smalltalk.withContext(function($ctx2) {
  371. return _st(x).__star(y);
  372. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  373. $ctx1.sendIdx["assert:equals:"]=3;
  374. self._assert_equals_(_st((function(a,b,c){
  375. return smalltalk.withContext(function($ctx2) {
  376. return (1);
  377. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value(),(1));
  378. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  379. args: [],
  380. source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1",
  381. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  382. referencedClasses: []
  383. }),
  384. smalltalk.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testValueWithPossibleArguments",
  388. protocol: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1,$2;
  393. $1=_st((function(){
  394. return smalltalk.withContext(function($ctx2) {
  395. return (1);
  396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  397. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  398. self._assert_equals_($1,(1));
  399. $ctx1.sendIdx["assert:equals:"]=1;
  400. $2=_st((function(a){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(a).__plus((4));
  403. $ctx2.sendIdx["+"]=1;
  404. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  405. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  406. self._assert_equals_($2,(7));
  407. $ctx1.sendIdx["assert:equals:"]=2;
  408. self._assert_equals_(_st((function(a,b){
  409. return smalltalk.withContext(function($ctx2) {
  410. return _st(a).__plus(b);
  411. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  412. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  413. args: [],
  414. source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  415. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  416. referencedClasses: []
  417. }),
  418. smalltalk.BlockClosureTest);
  419. smalltalk.addMethod(
  420. smalltalk.method({
  421. selector: "testWhileFalse",
  422. protocol: 'tests',
  423. fn: function (){
  424. var self=this;
  425. var i;
  426. return smalltalk.withContext(function($ctx1) {
  427. i=(0);
  428. _st((function(){
  429. return smalltalk.withContext(function($ctx2) {
  430. return _st(i).__gt((5));
  431. $ctx2.sendIdx[">"]=1;
  432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  433. return smalltalk.withContext(function($ctx2) {
  434. i=_st(i).__plus((1));
  435. $ctx2.sendIdx["+"]=1;
  436. return i;
  437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  438. self._assert_equals_(i,(6));
  439. $ctx1.sendIdx["assert:equals:"]=1;
  440. i=(0);
  441. _st((function(){
  442. return smalltalk.withContext(function($ctx2) {
  443. i=_st(i).__plus((1));
  444. i;
  445. return _st(i).__gt((5));
  446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  447. self._assert_equals_(i,(6));
  448. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  449. args: [],
  450. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6",
  451. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  452. referencedClasses: []
  453. }),
  454. smalltalk.BlockClosureTest);
  455. smalltalk.addMethod(
  456. smalltalk.method({
  457. selector: "testWhileTrue",
  458. protocol: 'tests',
  459. fn: function (){
  460. var self=this;
  461. var i;
  462. return smalltalk.withContext(function($ctx1) {
  463. i=(0);
  464. _st((function(){
  465. return smalltalk.withContext(function($ctx2) {
  466. return _st(i).__lt((5));
  467. $ctx2.sendIdx["<"]=1;
  468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  469. return smalltalk.withContext(function($ctx2) {
  470. i=_st(i).__plus((1));
  471. $ctx2.sendIdx["+"]=1;
  472. return i;
  473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  474. self._assert_equals_(i,(5));
  475. $ctx1.sendIdx["assert:equals:"]=1;
  476. i=(0);
  477. _st((function(){
  478. return smalltalk.withContext(function($ctx2) {
  479. i=_st(i).__plus((1));
  480. i;
  481. return _st(i).__lt((5));
  482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  483. self._assert_equals_(i,(5));
  484. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  485. args: [],
  486. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5",
  487. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  488. referencedClasses: []
  489. }),
  490. smalltalk.BlockClosureTest);
  491. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "testEquality",
  495. protocol: 'tests',
  496. fn: function (){
  497. var self=this;
  498. return smalltalk.withContext(function($ctx1) {
  499. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  500. $1=(0).__eq(false);
  501. $ctx1.sendIdx["="]=1;
  502. self._deny_($1);
  503. $ctx1.sendIdx["deny:"]=1;
  504. $2=false.__eq((0));
  505. $ctx1.sendIdx["="]=2;
  506. self._deny_($2);
  507. $ctx1.sendIdx["deny:"]=2;
  508. $3="".__eq(false);
  509. $ctx1.sendIdx["="]=3;
  510. self._deny_($3);
  511. $ctx1.sendIdx["deny:"]=3;
  512. $4=false.__eq("");
  513. $ctx1.sendIdx["="]=4;
  514. self._deny_($4);
  515. $ctx1.sendIdx["deny:"]=4;
  516. $5=true.__eq(true);
  517. $ctx1.sendIdx["="]=5;
  518. self._assert_($5);
  519. $ctx1.sendIdx["assert:"]=1;
  520. $6=false.__eq(true);
  521. $ctx1.sendIdx["="]=6;
  522. self._deny_($6);
  523. $ctx1.sendIdx["deny:"]=5;
  524. $7=true.__eq(false);
  525. $ctx1.sendIdx["="]=7;
  526. self._deny_($7);
  527. $8=false.__eq(false);
  528. $ctx1.sendIdx["="]=8;
  529. self._assert_($8);
  530. $ctx1.sendIdx["assert:"]=2;
  531. $10=true._yourself();
  532. $ctx1.sendIdx["yourself"]=1;
  533. $9=_st($10).__eq(true);
  534. $ctx1.sendIdx["="]=9;
  535. self._assert_($9);
  536. $ctx1.sendIdx["assert:"]=3;
  537. $12=true._yourself();
  538. $ctx1.sendIdx["yourself"]=2;
  539. $11=_st($12).__eq(true._yourself());
  540. self._assert_($11);
  541. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  542. args: [],
  543. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)",
  544. messageSends: ["deny:", "=", "assert:", "yourself"],
  545. referencedClasses: []
  546. }),
  547. smalltalk.BooleanTest);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "testIdentity",
  551. protocol: 'tests',
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) {
  555. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  556. $1=(0).__eq_eq(false);
  557. $ctx1.sendIdx["=="]=1;
  558. self._deny_($1);
  559. $ctx1.sendIdx["deny:"]=1;
  560. $2=false.__eq_eq((0));
  561. $ctx1.sendIdx["=="]=2;
  562. self._deny_($2);
  563. $ctx1.sendIdx["deny:"]=2;
  564. $3="".__eq_eq(false);
  565. $ctx1.sendIdx["=="]=3;
  566. self._deny_($3);
  567. $ctx1.sendIdx["deny:"]=3;
  568. $4=false.__eq_eq("");
  569. $ctx1.sendIdx["=="]=4;
  570. self._deny_($4);
  571. $ctx1.sendIdx["deny:"]=4;
  572. $5=true.__eq_eq(true);
  573. $ctx1.sendIdx["=="]=5;
  574. self._assert_($5);
  575. $ctx1.sendIdx["assert:"]=1;
  576. $6=false.__eq_eq(true);
  577. $ctx1.sendIdx["=="]=6;
  578. self._deny_($6);
  579. $ctx1.sendIdx["deny:"]=5;
  580. $7=true.__eq_eq(false);
  581. $ctx1.sendIdx["=="]=7;
  582. self._deny_($7);
  583. $8=false.__eq_eq(false);
  584. $ctx1.sendIdx["=="]=8;
  585. self._assert_($8);
  586. $ctx1.sendIdx["assert:"]=2;
  587. $10=true._yourself();
  588. $ctx1.sendIdx["yourself"]=1;
  589. $9=_st($10).__eq_eq(true);
  590. $ctx1.sendIdx["=="]=9;
  591. self._assert_($9);
  592. $ctx1.sendIdx["assert:"]=3;
  593. $12=true._yourself();
  594. $ctx1.sendIdx["yourself"]=2;
  595. $11=_st($12).__eq_eq(true._yourself());
  596. self._assert_($11);
  597. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  598. args: [],
  599. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  600. messageSends: ["deny:", "==", "assert:", "yourself"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.BooleanTest);
  604. smalltalk.addMethod(
  605. smalltalk.method({
  606. selector: "testIfTrueIfFalse",
  607. protocol: 'tests',
  608. fn: function (){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) {
  611. var $1,$2,$3,$4,$5,$6,$7,$8;
  612. if(smalltalk.assert(true)){
  613. $1="alternative block";
  614. };
  615. self._assert_equals_($1,"alternative block");
  616. $ctx1.sendIdx["assert:equals:"]=1;
  617. if(! smalltalk.assert(true)){
  618. $2="alternative block";
  619. };
  620. self._assert_equals_($2,nil);
  621. $ctx1.sendIdx["assert:equals:"]=2;
  622. if(smalltalk.assert(false)){
  623. $3="alternative block";
  624. };
  625. self._assert_equals_($3,nil);
  626. $ctx1.sendIdx["assert:equals:"]=3;
  627. if(! smalltalk.assert(false)){
  628. $4="alternative block";
  629. };
  630. self._assert_equals_($4,"alternative block");
  631. $ctx1.sendIdx["assert:equals:"]=4;
  632. if(smalltalk.assert(false)){
  633. $5="alternative block";
  634. } else {
  635. $5="alternative block2";
  636. };
  637. self._assert_equals_($5,"alternative block2");
  638. $ctx1.sendIdx["assert:equals:"]=5;
  639. if(smalltalk.assert(false)){
  640. $6="alternative block2";
  641. } else {
  642. $6="alternative block";
  643. };
  644. self._assert_equals_($6,"alternative block");
  645. $ctx1.sendIdx["assert:equals:"]=6;
  646. if(smalltalk.assert(true)){
  647. $7="alternative block";
  648. } else {
  649. $7="alternative block2";
  650. };
  651. self._assert_equals_($7,"alternative block");
  652. $ctx1.sendIdx["assert:equals:"]=7;
  653. if(smalltalk.assert(true)){
  654. $8="alternative block2";
  655. } else {
  656. $8="alternative block";
  657. };
  658. self._assert_equals_($8,"alternative block2");
  659. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  660. args: [],
  661. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  662. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  663. referencedClasses: []
  664. }),
  665. smalltalk.BooleanTest);
  666. smalltalk.addMethod(
  667. smalltalk.method({
  668. selector: "testIfTrueIfFalseWithBoxing",
  669. protocol: 'tests',
  670. fn: function (){
  671. var self=this;
  672. return smalltalk.withContext(function($ctx1) {
  673. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  674. $2=true._yourself();
  675. $ctx1.sendIdx["yourself"]=1;
  676. if(smalltalk.assert($2)){
  677. $1="alternative block";
  678. };
  679. self._assert_equals_($1,"alternative block");
  680. $ctx1.sendIdx["assert:equals:"]=1;
  681. $4=true._yourself();
  682. $ctx1.sendIdx["yourself"]=2;
  683. if(! smalltalk.assert($4)){
  684. $3="alternative block";
  685. };
  686. self._assert_equals_($3,nil);
  687. $ctx1.sendIdx["assert:equals:"]=2;
  688. $6=false._yourself();
  689. $ctx1.sendIdx["yourself"]=3;
  690. if(smalltalk.assert($6)){
  691. $5="alternative block";
  692. };
  693. self._assert_equals_($5,nil);
  694. $ctx1.sendIdx["assert:equals:"]=3;
  695. $8=false._yourself();
  696. $ctx1.sendIdx["yourself"]=4;
  697. if(! smalltalk.assert($8)){
  698. $7="alternative block";
  699. };
  700. self._assert_equals_($7,"alternative block");
  701. $ctx1.sendIdx["assert:equals:"]=4;
  702. $10=false._yourself();
  703. $ctx1.sendIdx["yourself"]=5;
  704. if(smalltalk.assert($10)){
  705. $9="alternative block";
  706. } else {
  707. $9="alternative block2";
  708. };
  709. self._assert_equals_($9,"alternative block2");
  710. $ctx1.sendIdx["assert:equals:"]=5;
  711. $12=false._yourself();
  712. $ctx1.sendIdx["yourself"]=6;
  713. if(smalltalk.assert($12)){
  714. $11="alternative block2";
  715. } else {
  716. $11="alternative block";
  717. };
  718. self._assert_equals_($11,"alternative block");
  719. $ctx1.sendIdx["assert:equals:"]=6;
  720. $14=true._yourself();
  721. $ctx1.sendIdx["yourself"]=7;
  722. if(smalltalk.assert($14)){
  723. $13="alternative block";
  724. } else {
  725. $13="alternative block2";
  726. };
  727. self._assert_equals_($13,"alternative block");
  728. $ctx1.sendIdx["assert:equals:"]=7;
  729. $16=true._yourself();
  730. if(smalltalk.assert($16)){
  731. $15="alternative block2";
  732. } else {
  733. $15="alternative block";
  734. };
  735. self._assert_equals_($15,"alternative block2");
  736. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  737. args: [],
  738. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  739. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  740. referencedClasses: []
  741. }),
  742. smalltalk.BooleanTest);
  743. smalltalk.addMethod(
  744. smalltalk.method({
  745. selector: "testLogic",
  746. protocol: 'tests',
  747. fn: function (){
  748. var self=this;
  749. return smalltalk.withContext(function($ctx1) {
  750. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  751. $1=true.__and(true);
  752. $ctx1.sendIdx["&"]=1;
  753. self._assert_($1);
  754. $ctx1.sendIdx["assert:"]=1;
  755. $2=true.__and(false);
  756. $ctx1.sendIdx["&"]=2;
  757. self._deny_($2);
  758. $ctx1.sendIdx["deny:"]=1;
  759. $3=false.__and(true);
  760. $ctx1.sendIdx["&"]=3;
  761. self._deny_($3);
  762. $ctx1.sendIdx["deny:"]=2;
  763. $5=false.__and(false);
  764. $ctx1.sendIdx["&"]=4;
  765. $4=self._deny_($5);
  766. $ctx1.sendIdx["deny:"]=3;
  767. $6=true.__or(true);
  768. $ctx1.sendIdx["|"]=1;
  769. self._assert_($6);
  770. $ctx1.sendIdx["assert:"]=2;
  771. $7=true.__or(false);
  772. $ctx1.sendIdx["|"]=2;
  773. self._assert_($7);
  774. $ctx1.sendIdx["assert:"]=3;
  775. $8=false.__or(true);
  776. $ctx1.sendIdx["|"]=3;
  777. self._assert_($8);
  778. $ctx1.sendIdx["assert:"]=4;
  779. $10=false.__or(false);
  780. $ctx1.sendIdx["|"]=4;
  781. $9=self._deny_($10);
  782. $ctx1.sendIdx["deny:"]=4;
  783. $12=(1).__gt((0));
  784. $ctx1.sendIdx[">"]=1;
  785. $11=true.__and($12);
  786. $ctx1.sendIdx["&"]=5;
  787. self._assert_($11);
  788. $ctx1.sendIdx["assert:"]=5;
  789. $14=(1).__gt((0));
  790. $ctx1.sendIdx[">"]=2;
  791. $13=_st($14).__and(false);
  792. $ctx1.sendIdx["&"]=6;
  793. self._deny_($13);
  794. $ctx1.sendIdx["deny:"]=5;
  795. $17=(1).__gt((0));
  796. $ctx1.sendIdx[">"]=3;
  797. $18=(1).__gt((2));
  798. $ctx1.sendIdx[">"]=4;
  799. $16=_st($17).__and($18);
  800. $15=self._deny_($16);
  801. $20=(1).__gt((0));
  802. $ctx1.sendIdx[">"]=5;
  803. $19=false.__or($20);
  804. $ctx1.sendIdx["|"]=5;
  805. self._assert_($19);
  806. $ctx1.sendIdx["assert:"]=6;
  807. $22=(1).__gt((0));
  808. $ctx1.sendIdx[">"]=6;
  809. $21=_st($22).__or(false);
  810. $ctx1.sendIdx["|"]=6;
  811. self._assert_($21);
  812. $ctx1.sendIdx["assert:"]=7;
  813. $25=(1).__gt((0));
  814. $ctx1.sendIdx[">"]=7;
  815. $24=_st($25).__or((1).__gt((2)));
  816. $23=self._assert_($24);
  817. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  818. args: [],
  819. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  820. messageSends: ["assert:", "&", "deny:", "|", ">"],
  821. referencedClasses: []
  822. }),
  823. smalltalk.BooleanTest);
  824. smalltalk.addMethod(
  825. smalltalk.method({
  826. selector: "testLogicKeywords",
  827. protocol: 'tests',
  828. fn: function (){
  829. var self=this;
  830. return smalltalk.withContext(function($ctx1) {
  831. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  832. $1=true._and_((function(){
  833. return smalltalk.withContext(function($ctx2) {
  834. return true;
  835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  836. $ctx1.sendIdx["and:"]=1;
  837. self._assert_($1);
  838. $ctx1.sendIdx["assert:"]=1;
  839. $2=true._and_((function(){
  840. return smalltalk.withContext(function($ctx2) {
  841. return false;
  842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  843. $ctx1.sendIdx["and:"]=2;
  844. self._deny_($2);
  845. $ctx1.sendIdx["deny:"]=1;
  846. $3=false._and_((function(){
  847. return smalltalk.withContext(function($ctx2) {
  848. return true;
  849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  850. $ctx1.sendIdx["and:"]=3;
  851. self._deny_($3);
  852. $ctx1.sendIdx["deny:"]=2;
  853. $5=false._and_((function(){
  854. return smalltalk.withContext(function($ctx2) {
  855. return false;
  856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  857. $ctx1.sendIdx["and:"]=4;
  858. $4=self._deny_($5);
  859. $ctx1.sendIdx["deny:"]=3;
  860. $6=true._or_((function(){
  861. return smalltalk.withContext(function($ctx2) {
  862. return true;
  863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  864. $ctx1.sendIdx["or:"]=1;
  865. self._assert_($6);
  866. $ctx1.sendIdx["assert:"]=2;
  867. $7=true._or_((function(){
  868. return smalltalk.withContext(function($ctx2) {
  869. return false;
  870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  871. $ctx1.sendIdx["or:"]=2;
  872. self._assert_($7);
  873. $ctx1.sendIdx["assert:"]=3;
  874. $8=false._or_((function(){
  875. return smalltalk.withContext(function($ctx2) {
  876. return true;
  877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  878. $ctx1.sendIdx["or:"]=3;
  879. self._assert_($8);
  880. $ctx1.sendIdx["assert:"]=4;
  881. $10=false._or_((function(){
  882. return smalltalk.withContext(function($ctx2) {
  883. return false;
  884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  885. $ctx1.sendIdx["or:"]=4;
  886. $9=self._deny_($10);
  887. $ctx1.sendIdx["deny:"]=4;
  888. $11=true._and_((function(){
  889. return smalltalk.withContext(function($ctx2) {
  890. return (1).__gt((0));
  891. $ctx2.sendIdx[">"]=1;
  892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  893. $ctx1.sendIdx["and:"]=5;
  894. self._assert_($11);
  895. $ctx1.sendIdx["assert:"]=5;
  896. $13=(1).__gt((0));
  897. $ctx1.sendIdx[">"]=2;
  898. $12=_st($13)._and_((function(){
  899. return smalltalk.withContext(function($ctx2) {
  900. return false;
  901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  902. $ctx1.sendIdx["and:"]=6;
  903. self._deny_($12);
  904. $ctx1.sendIdx["deny:"]=5;
  905. $16=(1).__gt((0));
  906. $ctx1.sendIdx[">"]=3;
  907. $15=_st($16)._and_((function(){
  908. return smalltalk.withContext(function($ctx2) {
  909. return (1).__gt((2));
  910. $ctx2.sendIdx[">"]=4;
  911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  912. $14=self._deny_($15);
  913. $17=false._or_((function(){
  914. return smalltalk.withContext(function($ctx2) {
  915. return (1).__gt((0));
  916. $ctx2.sendIdx[">"]=5;
  917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  918. $ctx1.sendIdx["or:"]=5;
  919. self._assert_($17);
  920. $ctx1.sendIdx["assert:"]=6;
  921. $19=(1).__gt((0));
  922. $ctx1.sendIdx[">"]=6;
  923. $18=_st($19)._or_((function(){
  924. return smalltalk.withContext(function($ctx2) {
  925. return false;
  926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  927. $ctx1.sendIdx["or:"]=6;
  928. self._assert_($18);
  929. $ctx1.sendIdx["assert:"]=7;
  930. $22=(1).__gt((0));
  931. $ctx1.sendIdx[">"]=7;
  932. $21=_st($22)._or_((function(){
  933. return smalltalk.withContext(function($ctx2) {
  934. return (1).__gt((2));
  935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  936. $20=self._assert_($21);
  937. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  938. args: [],
  939. source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  940. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  941. referencedClasses: []
  942. }),
  943. smalltalk.BooleanTest);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "testNonBooleanError",
  947. protocol: 'tests',
  948. fn: function (){
  949. var self=this;
  950. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  951. return smalltalk.withContext(function($ctx1) {
  952. self._should_raise_((function(){
  953. return smalltalk.withContext(function($ctx2) {
  954. if(smalltalk.assert("")){
  955. } else {
  956. };
  957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  958. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  959. args: [],
  960. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  961. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  962. referencedClasses: ["NonBooleanReceiver"]
  963. }),
  964. smalltalk.BooleanTest);
  965. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "setUp",
  969. protocol: 'running',
  970. fn: function (){
  971. var self=this;
  972. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  973. return smalltalk.withContext(function($ctx1) {
  974. self["@builder"]=_st($ClassBuilder())._new();
  975. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  976. args: [],
  977. source: "setUp\x0a\x09builder := ClassBuilder new",
  978. messageSends: ["new"],
  979. referencedClasses: ["ClassBuilder"]
  980. }),
  981. smalltalk.ClassBuilderTest);
  982. smalltalk.addMethod(
  983. smalltalk.method({
  984. selector: "tearDown",
  985. protocol: 'running',
  986. fn: function (){
  987. var self=this;
  988. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  989. return smalltalk.withContext(function($ctx1) {
  990. var $1;
  991. $1=self["@theClass"];
  992. if(($receiver = $1) == nil || $receiver == null){
  993. $1;
  994. } else {
  995. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  996. self["@theClass"]=nil;
  997. self["@theClass"];
  998. };
  999. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  1000. args: [],
  1001. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk current removeClass: theClass. theClass := nil ]",
  1002. messageSends: ["ifNotNil:", "removeClass:", "current"],
  1003. referencedClasses: ["Smalltalk"]
  1004. }),
  1005. smalltalk.ClassBuilderTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "testClassCopy",
  1009. protocol: 'tests',
  1010. fn: function (){
  1011. var self=this;
  1012. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1013. return smalltalk.withContext(function($ctx1) {
  1014. var $2,$1,$4,$3,$6,$5,$8,$7;
  1015. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1016. $2=_st(self["@theClass"])._superclass();
  1017. $ctx1.sendIdx["superclass"]=1;
  1018. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1019. $ctx1.sendIdx["=="]=1;
  1020. self._assert_($1);
  1021. $ctx1.sendIdx["assert:"]=1;
  1022. $4=_st(self["@theClass"])._instanceVariableNames();
  1023. $ctx1.sendIdx["instanceVariableNames"]=1;
  1024. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1025. $ctx1.sendIdx["=="]=2;
  1026. self._assert_($3);
  1027. $ctx1.sendIdx["assert:"]=2;
  1028. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1029. $ctx1.sendIdx["assert:equals:"]=1;
  1030. $6=_st(self["@theClass"])._package();
  1031. $ctx1.sendIdx["package"]=1;
  1032. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1033. self._assert_($5);
  1034. $8=_st(self["@theClass"])._methodDictionary();
  1035. $ctx1.sendIdx["methodDictionary"]=1;
  1036. $7=_st($8)._keys();
  1037. $ctx1.sendIdx["keys"]=1;
  1038. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1039. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  1040. args: [],
  1041. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  1042. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1043. referencedClasses: ["ObjectMock"]
  1044. }),
  1045. smalltalk.ClassBuilderTest);
  1046. smalltalk.addMethod(
  1047. smalltalk.method({
  1048. selector: "testClassMigration",
  1049. protocol: 'tests',
  1050. fn: function (){
  1051. var self=this;
  1052. var instance,oldClass;
  1053. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1054. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1055. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1056. return smalltalk.withContext(function($ctx1) {
  1057. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10,$14,$13,$12;
  1058. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1059. $2=_st($Smalltalk())._current();
  1060. $ctx1.sendIdx["current"]=1;
  1061. $1=_st($2)._at_("ObjectMock2");
  1062. $ctx1.sendIdx["at:"]=1;
  1063. instance=_st($1)._new();
  1064. $4=_st($Smalltalk())._current();
  1065. $ctx1.sendIdx["current"]=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. $14=_st($Smalltalk())._current();
  1095. $ctx1.sendIdx["current"]=3;
  1096. $13=_st($14)._at_(_st(_st(instance)._class())._name());
  1097. $12=_st($13)._isNil();
  1098. self._assert_($12);
  1099. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1100. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  1101. args: [],
  1102. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk current at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk current at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1103. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1104. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1105. }),
  1106. smalltalk.ClassBuilderTest);
  1107. smalltalk.addMethod(
  1108. smalltalk.method({
  1109. selector: "testClassMigrationWithClassInstanceVariables",
  1110. protocol: 'tests',
  1111. fn: function (){
  1112. var self=this;
  1113. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1114. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1115. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1116. return smalltalk.withContext(function($ctx1) {
  1117. var $1,$3,$2;
  1118. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1119. $1=_st($ObjectMock2())._class();
  1120. $ctx1.sendIdx["class"]=1;
  1121. _st($1)._instanceVariableNames_("foo bar");
  1122. $3=_st($Smalltalk())._current();
  1123. $ctx1.sendIdx["current"]=1;
  1124. $2=_st($3)._at_("ObjectMock2");
  1125. _st($ObjectMock())._subclass_instanceVariableNames_package_($2,"","Kernel-Tests");
  1126. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1127. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1128. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  1129. args: [],
  1130. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1131. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1132. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1133. }),
  1134. smalltalk.ClassBuilderTest);
  1135. smalltalk.addMethod(
  1136. smalltalk.method({
  1137. selector: "testClassMigrationWithSubclasses",
  1138. protocol: 'tests',
  1139. fn: function (){
  1140. var self=this;
  1141. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1142. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1143. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1144. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1145. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1146. return smalltalk.withContext(function($ctx1) {
  1147. var $2,$1,$4,$3,$6,$5;
  1148. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1149. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1150. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1151. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1152. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1153. $2=_st($Smalltalk())._current();
  1154. $ctx1.sendIdx["current"]=1;
  1155. $1=_st($2)._at_("ObjectMock2");
  1156. _st($ObjectMock())._subclass_instanceVariableNames_package_($1,"","Kernel-Tests");
  1157. $4=_st($ObjectMock())._subclasses();
  1158. $ctx1.sendIdx["subclasses"]=1;
  1159. $3=_st($4)._includes_($ObjectMock2());
  1160. $ctx1.sendIdx["includes:"]=1;
  1161. self._assert_($3);
  1162. $ctx1.sendIdx["assert:"]=1;
  1163. $6=_st($ObjectMock2())._subclasses();
  1164. $ctx1.sendIdx["subclasses"]=2;
  1165. $5=_st($6)._includes_($ObjectMock3());
  1166. $ctx1.sendIdx["includes:"]=2;
  1167. self._assert_($5);
  1168. $ctx1.sendIdx["assert:"]=2;
  1169. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1170. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1171. return smalltalk.withContext(function($ctx2) {
  1172. return _st(_st($Smalltalk())._current())._removeClass_(each);
  1173. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1174. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  1175. args: [],
  1176. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]",
  1177. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1178. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1179. }),
  1180. smalltalk.ClassBuilderTest);
  1181. smalltalk.addMethod(
  1182. smalltalk.method({
  1183. selector: "testInstanceVariableNames",
  1184. protocol: 'tests',
  1185. fn: function (){
  1186. var self=this;
  1187. return smalltalk.withContext(function($ctx1) {
  1188. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  1190. args: [],
  1191. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1192. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1193. referencedClasses: []
  1194. }),
  1195. smalltalk.ClassBuilderTest);
  1196. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1197. smalltalk.addMethod(
  1198. smalltalk.method({
  1199. selector: "assertSameContents:as:",
  1200. protocol: 'convenience',
  1201. fn: function (aCollection,anotherCollection){
  1202. var self=this;
  1203. return smalltalk.withContext(function($ctx1) {
  1204. var $2,$1,$4,$3;
  1205. $2=_st(aCollection)._size();
  1206. $ctx1.sendIdx["size"]=1;
  1207. $1=_st($2).__eq(_st(anotherCollection)._size());
  1208. $ctx1.sendIdx["="]=1;
  1209. self._assert_($1);
  1210. $ctx1.sendIdx["assert:"]=1;
  1211. _st(aCollection)._do_((function(each){
  1212. return smalltalk.withContext(function($ctx2) {
  1213. $4=_st(aCollection)._occurrencesOf_(each);
  1214. $ctx2.sendIdx["occurrencesOf:"]=1;
  1215. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1216. return self._assert_($3);
  1217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1218. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  1219. args: ["aCollection", "anotherCollection"],
  1220. 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)) ]",
  1221. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1222. referencedClasses: []
  1223. }),
  1224. smalltalk.CollectionTest);
  1225. smalltalk.addMethod(
  1226. smalltalk.method({
  1227. selector: "collection",
  1228. protocol: 'fixture',
  1229. fn: function (){
  1230. var self=this;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. self._subclassResponsibility();
  1233. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  1234. args: [],
  1235. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1236. messageSends: ["subclassResponsibility"],
  1237. referencedClasses: []
  1238. }),
  1239. smalltalk.CollectionTest);
  1240. smalltalk.addMethod(
  1241. smalltalk.method({
  1242. selector: "collectionClass",
  1243. protocol: 'fixture',
  1244. fn: function (){
  1245. var self=this;
  1246. return smalltalk.withContext(function($ctx1) {
  1247. var $1;
  1248. $1=_st(self._class())._collectionClass();
  1249. return $1;
  1250. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  1251. args: [],
  1252. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1253. messageSends: ["collectionClass", "class"],
  1254. referencedClasses: []
  1255. }),
  1256. smalltalk.CollectionTest);
  1257. smalltalk.addMethod(
  1258. smalltalk.method({
  1259. selector: "collectionOfPrintStrings",
  1260. protocol: 'fixture',
  1261. fn: function (){
  1262. var self=this;
  1263. return smalltalk.withContext(function($ctx1) {
  1264. self._subclassResponsibility();
  1265. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.CollectionTest)})},
  1266. args: [],
  1267. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1268. messageSends: ["subclassResponsibility"],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.CollectionTest);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "collectionSize",
  1275. protocol: 'fixture',
  1276. fn: function (){
  1277. var self=this;
  1278. return smalltalk.withContext(function($ctx1) {
  1279. self._subclassResponsibility();
  1280. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.CollectionTest)})},
  1281. args: [],
  1282. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1283. messageSends: ["subclassResponsibility"],
  1284. referencedClasses: []
  1285. }),
  1286. smalltalk.CollectionTest);
  1287. smalltalk.addMethod(
  1288. smalltalk.method({
  1289. selector: "collectionWithDuplicates",
  1290. protocol: 'fixture',
  1291. fn: function (){
  1292. var self=this;
  1293. return smalltalk.withContext(function($ctx1) {
  1294. self._subclassResponsibility();
  1295. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1296. args: [],
  1297. 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",
  1298. messageSends: ["subclassResponsibility"],
  1299. referencedClasses: []
  1300. }),
  1301. smalltalk.CollectionTest);
  1302. smalltalk.addMethod(
  1303. smalltalk.method({
  1304. selector: "collectionWithNewValue",
  1305. protocol: 'fixture',
  1306. fn: function (){
  1307. var self=this;
  1308. return smalltalk.withContext(function($ctx1) {
  1309. self._subclassResponsibility();
  1310. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.CollectionTest)})},
  1311. args: [],
  1312. 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",
  1313. messageSends: ["subclassResponsibility"],
  1314. referencedClasses: []
  1315. }),
  1316. smalltalk.CollectionTest);
  1317. smalltalk.addMethod(
  1318. smalltalk.method({
  1319. selector: "isCollectionReadOnly",
  1320. protocol: 'testing',
  1321. fn: function (){
  1322. var self=this;
  1323. return smalltalk.withContext(function($ctx1) {
  1324. return false;
  1325. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1326. args: [],
  1327. source: "isCollectionReadOnly\x0a\x09^ false",
  1328. messageSends: [],
  1329. referencedClasses: []
  1330. }),
  1331. smalltalk.CollectionTest);
  1332. smalltalk.addMethod(
  1333. smalltalk.method({
  1334. selector: "sampleNewValue",
  1335. protocol: 'fixture',
  1336. fn: function (){
  1337. var self=this;
  1338. return smalltalk.withContext(function($ctx1) {
  1339. return "N";
  1340. }, function($ctx1) {$ctx1.fill(self,"sampleNewValue",{},smalltalk.CollectionTest)})},
  1341. args: [],
  1342. 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'",
  1343. messageSends: [],
  1344. referencedClasses: []
  1345. }),
  1346. smalltalk.CollectionTest);
  1347. smalltalk.addMethod(
  1348. smalltalk.method({
  1349. selector: "sampleNewValueAsCollection",
  1350. protocol: 'fixture',
  1351. fn: function (){
  1352. var self=this;
  1353. return smalltalk.withContext(function($ctx1) {
  1354. var $1;
  1355. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1356. return $1;
  1357. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.CollectionTest)})},
  1358. args: [],
  1359. 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",
  1360. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1361. referencedClasses: []
  1362. }),
  1363. smalltalk.CollectionTest);
  1364. smalltalk.addMethod(
  1365. smalltalk.method({
  1366. selector: "testAddAll",
  1367. protocol: 'tests',
  1368. fn: function (){
  1369. var self=this;
  1370. return smalltalk.withContext(function($ctx1) {
  1371. 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;
  1372. $2=self._collection();
  1373. $ctx1.sendIdx["collection"]=1;
  1374. $3=$2;
  1375. $5=self._collectionClass();
  1376. $ctx1.sendIdx["collectionClass"]=1;
  1377. $4=_st($5)._new();
  1378. $ctx1.sendIdx["new"]=1;
  1379. _st($3)._addAll_($4);
  1380. $ctx1.sendIdx["addAll:"]=1;
  1381. $6=_st($2)._yourself();
  1382. $ctx1.sendIdx["yourself"]=1;
  1383. $1=$6;
  1384. $7=self._collection();
  1385. $ctx1.sendIdx["collection"]=2;
  1386. self._assert_equals_($1,$7);
  1387. $ctx1.sendIdx["assert:equals:"]=1;
  1388. $10=self._collectionClass();
  1389. $ctx1.sendIdx["collectionClass"]=2;
  1390. $9=_st($10)._new();
  1391. $ctx1.sendIdx["new"]=2;
  1392. $11=$9;
  1393. $12=self._collection();
  1394. $ctx1.sendIdx["collection"]=3;
  1395. _st($11)._addAll_($12);
  1396. $ctx1.sendIdx["addAll:"]=2;
  1397. $13=_st($9)._yourself();
  1398. $ctx1.sendIdx["yourself"]=2;
  1399. $8=$13;
  1400. $14=self._collection();
  1401. $ctx1.sendIdx["collection"]=4;
  1402. self._assert_equals_($8,$14);
  1403. $ctx1.sendIdx["assert:equals:"]=2;
  1404. $17=self._collectionClass();
  1405. $ctx1.sendIdx["collectionClass"]=3;
  1406. $16=_st($17)._new();
  1407. $ctx1.sendIdx["new"]=3;
  1408. $18=$16;
  1409. $20=self._collectionClass();
  1410. $ctx1.sendIdx["collectionClass"]=4;
  1411. $19=_st($20)._new();
  1412. $ctx1.sendIdx["new"]=4;
  1413. _st($18)._addAll_($19);
  1414. $ctx1.sendIdx["addAll:"]=3;
  1415. $21=_st($16)._yourself();
  1416. $ctx1.sendIdx["yourself"]=3;
  1417. $15=$21;
  1418. self._assert_equals_($15,_st(self._collectionClass())._new());
  1419. $ctx1.sendIdx["assert:equals:"]=3;
  1420. $23=self._collection();
  1421. $ctx1.sendIdx["collection"]=5;
  1422. $24=$23;
  1423. $25=self._sampleNewValueAsCollection();
  1424. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1425. _st($24)._addAll_($25);
  1426. $ctx1.sendIdx["addAll:"]=4;
  1427. $26=_st($23)._yourself();
  1428. $ctx1.sendIdx["yourself"]=4;
  1429. $22=$26;
  1430. $27=self._collectionWithNewValue();
  1431. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1432. self._assert_equals_($22,$27);
  1433. $28=self._sampleNewValueAsCollection();
  1434. _st($28)._addAll_(self._collection());
  1435. $29=_st($28)._yourself();
  1436. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1437. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.CollectionTest)})},
  1438. args: [],
  1439. 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",
  1440. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1441. referencedClasses: []
  1442. }),
  1443. smalltalk.CollectionTest);
  1444. smalltalk.addMethod(
  1445. smalltalk.method({
  1446. selector: "testAllSatisfy",
  1447. protocol: 'tests',
  1448. fn: function (){
  1449. var self=this;
  1450. var collection,anyOne;
  1451. return smalltalk.withContext(function($ctx1) {
  1452. var $1;
  1453. collection=self._collection();
  1454. anyOne=_st(collection)._anyOne();
  1455. $1=_st(collection)._allSatisfy_((function(each){
  1456. return smalltalk.withContext(function($ctx2) {
  1457. return _st(collection)._includes_(each);
  1458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1459. $ctx1.sendIdx["allSatisfy:"]=1;
  1460. self._assert_($1);
  1461. self._deny_(_st(collection)._allSatisfy_((function(each){
  1462. return smalltalk.withContext(function($ctx2) {
  1463. return _st(each).__tild_eq(anyOne);
  1464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1465. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1466. args: [],
  1467. 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 ])",
  1468. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1469. referencedClasses: []
  1470. }),
  1471. smalltalk.CollectionTest);
  1472. smalltalk.addMethod(
  1473. smalltalk.method({
  1474. selector: "testAnyOne",
  1475. protocol: 'tests',
  1476. fn: function (){
  1477. var self=this;
  1478. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1479. return smalltalk.withContext(function($ctx1) {
  1480. var $2,$1;
  1481. self._should_raise_((function(){
  1482. return smalltalk.withContext(function($ctx2) {
  1483. return _st(_st(self._collectionClass())._new())._anyOne();
  1484. $ctx2.sendIdx["anyOne"]=1;
  1485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1486. $2=self._collection();
  1487. $ctx1.sendIdx["collection"]=1;
  1488. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1489. self._assert_($1);
  1490. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1491. args: [],
  1492. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1493. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1494. referencedClasses: ["Error"]
  1495. }),
  1496. smalltalk.CollectionTest);
  1497. smalltalk.addMethod(
  1498. smalltalk.method({
  1499. selector: "testAnySatisfy",
  1500. protocol: 'tests',
  1501. fn: function (){
  1502. var self=this;
  1503. var anyOne;
  1504. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1505. return smalltalk.withContext(function($ctx1) {
  1506. var $1,$3,$2;
  1507. $1=self._collection();
  1508. $ctx1.sendIdx["collection"]=1;
  1509. anyOne=_st($1)._anyOne();
  1510. $3=self._collection();
  1511. $ctx1.sendIdx["collection"]=2;
  1512. $2=_st($3)._anySatisfy_((function(each){
  1513. return smalltalk.withContext(function($ctx2) {
  1514. return _st(each).__eq(anyOne);
  1515. $ctx2.sendIdx["="]=1;
  1516. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1517. $ctx1.sendIdx["anySatisfy:"]=1;
  1518. self._assert_($2);
  1519. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1520. return smalltalk.withContext(function($ctx2) {
  1521. return _st(each).__eq(_st($Object())._new());
  1522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1523. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1524. args: [],
  1525. 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 ])",
  1526. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1527. referencedClasses: ["Object"]
  1528. }),
  1529. smalltalk.CollectionTest);
  1530. smalltalk.addMethod(
  1531. smalltalk.method({
  1532. selector: "testAsArray",
  1533. protocol: 'tests',
  1534. fn: function (){
  1535. var self=this;
  1536. return smalltalk.withContext(function($ctx1) {
  1537. var $1;
  1538. $1=self._collection();
  1539. $ctx1.sendIdx["collection"]=1;
  1540. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1541. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1542. args: [],
  1543. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1544. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1545. referencedClasses: []
  1546. }),
  1547. smalltalk.CollectionTest);
  1548. smalltalk.addMethod(
  1549. smalltalk.method({
  1550. selector: "testAsOrderedCollection",
  1551. protocol: 'tests',
  1552. fn: function (){
  1553. var self=this;
  1554. return smalltalk.withContext(function($ctx1) {
  1555. var $1;
  1556. $1=self._collection();
  1557. $ctx1.sendIdx["collection"]=1;
  1558. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1559. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1560. args: [],
  1561. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1562. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1563. referencedClasses: []
  1564. }),
  1565. smalltalk.CollectionTest);
  1566. smalltalk.addMethod(
  1567. smalltalk.method({
  1568. selector: "testAsSet",
  1569. protocol: 'tests',
  1570. fn: function (){
  1571. var self=this;
  1572. var c,set;
  1573. return smalltalk.withContext(function($ctx1) {
  1574. c=self._collectionWithDuplicates();
  1575. set=_st(c)._asSet();
  1576. self._assert_equals_(_st(set)._size(),(5));
  1577. _st(c)._do_((function(each){
  1578. return smalltalk.withContext(function($ctx2) {
  1579. return self._assert_(_st(set)._includes_(each));
  1580. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1581. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1582. args: [],
  1583. 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) ]",
  1584. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1585. referencedClasses: []
  1586. }),
  1587. smalltalk.CollectionTest);
  1588. smalltalk.addMethod(
  1589. smalltalk.method({
  1590. selector: "testCollect",
  1591. protocol: 'tests',
  1592. fn: function (){
  1593. var self=this;
  1594. return smalltalk.withContext(function($ctx1) {
  1595. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1596. $2=self._collection();
  1597. $ctx1.sendIdx["collection"]=1;
  1598. $1=_st($2)._collect_((function(each){
  1599. return smalltalk.withContext(function($ctx2) {
  1600. return each;
  1601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1602. $ctx1.sendIdx["collect:"]=1;
  1603. $3=self._collection();
  1604. $ctx1.sendIdx["collection"]=2;
  1605. self._assert_equals_($1,$3);
  1606. $ctx1.sendIdx["assert:equals:"]=1;
  1607. $5=self._collectionWithNewValue();
  1608. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1609. $4=_st($5)._collect_((function(each){
  1610. return smalltalk.withContext(function($ctx2) {
  1611. return each;
  1612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1613. $ctx1.sendIdx["collect:"]=2;
  1614. self._assert_equals_($4,self._collectionWithNewValue());
  1615. $ctx1.sendIdx["assert:equals:"]=2;
  1616. $8=self._collectionClass();
  1617. $ctx1.sendIdx["collectionClass"]=1;
  1618. $7=_st($8)._new();
  1619. $ctx1.sendIdx["new"]=1;
  1620. $6=_st($7)._collect_((function(each){
  1621. return smalltalk.withContext(function($ctx2) {
  1622. return _st(each)._printString();
  1623. $ctx2.sendIdx["printString"]=1;
  1624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1625. $ctx1.sendIdx["collect:"]=3;
  1626. self._assert_equals_($6,_st(self._collectionClass())._new());
  1627. $ctx1.sendIdx["assert:equals:"]=3;
  1628. $11=self._collection();
  1629. $ctx1.sendIdx["collection"]=3;
  1630. $10=_st($11)._collect_((function(){
  1631. return smalltalk.withContext(function($ctx2) {
  1632. return self._sampleNewValue();
  1633. $ctx2.sendIdx["sampleNewValue"]=1;
  1634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1635. $ctx1.sendIdx["collect:"]=4;
  1636. $9=_st($10)._detect_((function(){
  1637. return smalltalk.withContext(function($ctx2) {
  1638. return true;
  1639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1640. self._assert_equals_($9,self._sampleNewValue());
  1641. $ctx1.sendIdx["assert:equals:"]=4;
  1642. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1643. return smalltalk.withContext(function($ctx2) {
  1644. return _st(each)._printString();
  1645. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1646. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.CollectionTest)})},
  1647. args: [],
  1648. 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",
  1649. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1650. referencedClasses: []
  1651. }),
  1652. smalltalk.CollectionTest);
  1653. smalltalk.addMethod(
  1654. smalltalk.method({
  1655. selector: "testComma",
  1656. protocol: 'tests',
  1657. fn: function (){
  1658. var self=this;
  1659. return smalltalk.withContext(function($ctx1) {
  1660. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1661. $2=self._collection();
  1662. $ctx1.sendIdx["collection"]=1;
  1663. $4=self._collectionClass();
  1664. $ctx1.sendIdx["collectionClass"]=1;
  1665. $3=_st($4)._new();
  1666. $ctx1.sendIdx["new"]=1;
  1667. $1=_st($2).__comma($3);
  1668. $ctx1.sendIdx[","]=1;
  1669. $5=self._collection();
  1670. $ctx1.sendIdx["collection"]=2;
  1671. self._assert_equals_($1,$5);
  1672. $ctx1.sendIdx["assert:equals:"]=1;
  1673. $8=self._collectionClass();
  1674. $ctx1.sendIdx["collectionClass"]=2;
  1675. $7=_st($8)._new();
  1676. $ctx1.sendIdx["new"]=2;
  1677. $9=self._collection();
  1678. $ctx1.sendIdx["collection"]=3;
  1679. $6=_st($7).__comma($9);
  1680. $ctx1.sendIdx[","]=2;
  1681. $10=self._collection();
  1682. $ctx1.sendIdx["collection"]=4;
  1683. self._assert_equals_($6,$10);
  1684. $ctx1.sendIdx["assert:equals:"]=2;
  1685. $13=self._collectionClass();
  1686. $ctx1.sendIdx["collectionClass"]=3;
  1687. $12=_st($13)._new();
  1688. $ctx1.sendIdx["new"]=3;
  1689. $15=self._collectionClass();
  1690. $ctx1.sendIdx["collectionClass"]=4;
  1691. $14=_st($15)._new();
  1692. $ctx1.sendIdx["new"]=4;
  1693. $11=_st($12).__comma($14);
  1694. $ctx1.sendIdx[","]=3;
  1695. self._assert_equals_($11,_st(self._collectionClass())._new());
  1696. $ctx1.sendIdx["assert:equals:"]=3;
  1697. $17=self._collection();
  1698. $ctx1.sendIdx["collection"]=5;
  1699. $18=self._sampleNewValueAsCollection();
  1700. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1701. $16=_st($17).__comma($18);
  1702. $ctx1.sendIdx[","]=4;
  1703. $19=self._collectionWithNewValue();
  1704. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1705. self._assert_equals_($16,$19);
  1706. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1707. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.CollectionTest)})},
  1708. args: [],
  1709. 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",
  1710. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1711. referencedClasses: []
  1712. }),
  1713. smalltalk.CollectionTest);
  1714. smalltalk.addMethod(
  1715. smalltalk.method({
  1716. selector: "testDetect",
  1717. protocol: 'tests',
  1718. fn: function (){
  1719. var self=this;
  1720. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1721. return smalltalk.withContext(function($ctx1) {
  1722. var $1,$2,$3,$4,$6,$5,$7;
  1723. self._shouldnt_raise_((function(){
  1724. return smalltalk.withContext(function($ctx2) {
  1725. $1=self._collection();
  1726. $ctx2.sendIdx["collection"]=1;
  1727. return _st($1)._detect_((function(){
  1728. return smalltalk.withContext(function($ctx3) {
  1729. return true;
  1730. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1731. $ctx2.sendIdx["detect:"]=1;
  1732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1733. self._should_raise_((function(){
  1734. return smalltalk.withContext(function($ctx2) {
  1735. $2=self._collection();
  1736. $ctx2.sendIdx["collection"]=2;
  1737. return _st($2)._detect_((function(){
  1738. return smalltalk.withContext(function($ctx3) {
  1739. return false;
  1740. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  1741. $ctx2.sendIdx["detect:"]=2;
  1742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1743. $ctx1.sendIdx["should:raise:"]=1;
  1744. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1745. return smalltalk.withContext(function($ctx2) {
  1746. return true;
  1747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1748. $ctx1.sendIdx["detect:"]=3;
  1749. $4=self._sampleNewValue();
  1750. $ctx1.sendIdx["sampleNewValue"]=1;
  1751. self._assert_equals_($3,$4);
  1752. $ctx1.sendIdx["assert:equals:"]=1;
  1753. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1754. return smalltalk.withContext(function($ctx2) {
  1755. $6=self._sampleNewValue();
  1756. $ctx2.sendIdx["sampleNewValue"]=2;
  1757. return _st(each).__eq($6);
  1758. $ctx2.sendIdx["="]=1;
  1759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1760. $ctx1.sendIdx["detect:"]=4;
  1761. $7=self._sampleNewValue();
  1762. $ctx1.sendIdx["sampleNewValue"]=3;
  1763. self._assert_equals_($5,$7);
  1764. self._should_raise_((function(){
  1765. return smalltalk.withContext(function($ctx2) {
  1766. return _st(self._collection())._detect_((function(each){
  1767. return smalltalk.withContext(function($ctx3) {
  1768. return _st(each).__eq(self._sampleNewValue());
  1769. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1771. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1772. args: [],
  1773. 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",
  1774. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1775. referencedClasses: ["Error"]
  1776. }),
  1777. smalltalk.CollectionTest);
  1778. smalltalk.addMethod(
  1779. smalltalk.method({
  1780. selector: "testDetectIfNone",
  1781. protocol: 'tests',
  1782. fn: function (){
  1783. var self=this;
  1784. var sentinel;
  1785. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1786. return smalltalk.withContext(function($ctx1) {
  1787. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1788. sentinel=_st($Object())._new();
  1789. $3=self._collection();
  1790. $ctx1.sendIdx["collection"]=1;
  1791. $2=_st($3)._detect_ifNone_((function(){
  1792. return smalltalk.withContext(function($ctx2) {
  1793. return true;
  1794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  1795. return smalltalk.withContext(function($ctx2) {
  1796. return sentinel;
  1797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1798. $ctx1.sendIdx["detect:ifNone:"]=1;
  1799. $1=_st($2).__tild_eq(sentinel);
  1800. self._assert_($1);
  1801. $5=self._collection();
  1802. $ctx1.sendIdx["collection"]=2;
  1803. $4=_st($5)._detect_ifNone_((function(){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. return false;
  1806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),(function(){
  1807. return smalltalk.withContext(function($ctx2) {
  1808. return sentinel;
  1809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1810. $ctx1.sendIdx["detect:ifNone:"]=2;
  1811. self._assert_equals_($4,sentinel);
  1812. $ctx1.sendIdx["assert:equals:"]=1;
  1813. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1814. return smalltalk.withContext(function($ctx2) {
  1815. return true;
  1816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1817. return smalltalk.withContext(function($ctx2) {
  1818. return sentinel;
  1819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1820. $ctx1.sendIdx["detect:ifNone:"]=3;
  1821. $7=self._sampleNewValue();
  1822. $ctx1.sendIdx["sampleNewValue"]=1;
  1823. self._assert_equals_($6,$7);
  1824. $ctx1.sendIdx["assert:equals:"]=2;
  1825. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1826. return smalltalk.withContext(function($ctx2) {
  1827. $9=self._sampleNewValue();
  1828. $ctx2.sendIdx["sampleNewValue"]=2;
  1829. return _st(each).__eq($9);
  1830. $ctx2.sendIdx["="]=1;
  1831. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1832. return smalltalk.withContext(function($ctx2) {
  1833. return sentinel;
  1834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1835. $ctx1.sendIdx["detect:ifNone:"]=4;
  1836. $10=self._sampleNewValue();
  1837. $ctx1.sendIdx["sampleNewValue"]=3;
  1838. self._assert_equals_($8,$10);
  1839. $ctx1.sendIdx["assert:equals:"]=3;
  1840. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1841. return smalltalk.withContext(function($ctx2) {
  1842. return _st(each).__eq(self._sampleNewValue());
  1843. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1844. return smalltalk.withContext(function($ctx2) {
  1845. return sentinel;
  1846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})})),sentinel);
  1847. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},smalltalk.CollectionTest)})},
  1848. args: [],
  1849. 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",
  1850. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1851. referencedClasses: ["Object"]
  1852. }),
  1853. smalltalk.CollectionTest);
  1854. smalltalk.addMethod(
  1855. smalltalk.method({
  1856. selector: "testDo",
  1857. protocol: 'tests',
  1858. fn: function (){
  1859. var self=this;
  1860. var newCollection;
  1861. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1862. return smalltalk.withContext(function($ctx1) {
  1863. var $1,$2;
  1864. newCollection=_st($OrderedCollection())._new();
  1865. $ctx1.sendIdx["new"]=1;
  1866. $1=self._collection();
  1867. $ctx1.sendIdx["collection"]=1;
  1868. _st($1)._do_((function(each){
  1869. return smalltalk.withContext(function($ctx2) {
  1870. return _st(newCollection)._add_(each);
  1871. $ctx2.sendIdx["add:"]=1;
  1872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1873. $ctx1.sendIdx["do:"]=1;
  1874. self._assertSameContents_as_(self._collection(),newCollection);
  1875. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1876. newCollection=_st($OrderedCollection())._new();
  1877. $2=self._collectionWithDuplicates();
  1878. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1879. _st($2)._do_((function(each){
  1880. return smalltalk.withContext(function($ctx2) {
  1881. return _st(newCollection)._add_(each);
  1882. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1883. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1884. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1885. args: [],
  1886. 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",
  1887. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1888. referencedClasses: ["OrderedCollection"]
  1889. }),
  1890. smalltalk.CollectionTest);
  1891. smalltalk.addMethod(
  1892. smalltalk.method({
  1893. selector: "testIfEmptyFamily",
  1894. protocol: 'tests',
  1895. fn: function (){
  1896. var self=this;
  1897. return smalltalk.withContext(function($ctx1) {
  1898. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1899. $3=self._collectionClass();
  1900. $ctx1.sendIdx["collectionClass"]=1;
  1901. $2=_st($3)._new();
  1902. $ctx1.sendIdx["new"]=1;
  1903. $1=_st($2)._ifEmpty_((function(){
  1904. return smalltalk.withContext(function($ctx2) {
  1905. return (42);
  1906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1907. $ctx1.sendIdx["ifEmpty:"]=1;
  1908. self._assert_equals_($1,(42));
  1909. $ctx1.sendIdx["assert:equals:"]=1;
  1910. $5=self._collection();
  1911. $ctx1.sendIdx["collection"]=1;
  1912. $4=_st($5)._ifEmpty_((function(){
  1913. return smalltalk.withContext(function($ctx2) {
  1914. return (42);
  1915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1916. $6=self._collection();
  1917. $ctx1.sendIdx["collection"]=2;
  1918. self._assert_equals_($4,$6);
  1919. $ctx1.sendIdx["assert:equals:"]=2;
  1920. $9=self._collectionClass();
  1921. $ctx1.sendIdx["collectionClass"]=2;
  1922. $8=_st($9)._new();
  1923. $ctx1.sendIdx["new"]=2;
  1924. $7=_st($8)._ifNotEmpty_((function(){
  1925. return smalltalk.withContext(function($ctx2) {
  1926. return (42);
  1927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1928. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1929. $11=self._collectionClass();
  1930. $ctx1.sendIdx["collectionClass"]=3;
  1931. $10=_st($11)._new();
  1932. $ctx1.sendIdx["new"]=3;
  1933. self._assert_equals_($7,$10);
  1934. $ctx1.sendIdx["assert:equals:"]=3;
  1935. $13=self._collection();
  1936. $ctx1.sendIdx["collection"]=3;
  1937. $12=_st($13)._ifNotEmpty_((function(){
  1938. return smalltalk.withContext(function($ctx2) {
  1939. return (42);
  1940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1941. self._assert_equals_($12,(42));
  1942. $ctx1.sendIdx["assert:equals:"]=4;
  1943. $16=self._collectionClass();
  1944. $ctx1.sendIdx["collectionClass"]=4;
  1945. $15=_st($16)._new();
  1946. $ctx1.sendIdx["new"]=4;
  1947. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1948. return smalltalk.withContext(function($ctx2) {
  1949. return (42);
  1950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1951. return smalltalk.withContext(function($ctx2) {
  1952. return (999);
  1953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1954. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1955. self._assert_equals_($14,(42));
  1956. $ctx1.sendIdx["assert:equals:"]=5;
  1957. $18=self._collection();
  1958. $ctx1.sendIdx["collection"]=4;
  1959. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1960. return smalltalk.withContext(function($ctx2) {
  1961. return (42);
  1962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1963. return smalltalk.withContext(function($ctx2) {
  1964. return (999);
  1965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1966. self._assert_equals_($17,(999));
  1967. $ctx1.sendIdx["assert:equals:"]=6;
  1968. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1969. return smalltalk.withContext(function($ctx2) {
  1970. return (42);
  1971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1972. return smalltalk.withContext(function($ctx2) {
  1973. return (999);
  1974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1975. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1976. self._assert_equals_($19,(999));
  1977. $ctx1.sendIdx["assert:equals:"]=7;
  1978. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1979. return smalltalk.withContext(function($ctx2) {
  1980. return (42);
  1981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1982. return smalltalk.withContext(function($ctx2) {
  1983. return (999);
  1984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1985. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1986. args: [],
  1987. 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",
  1988. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1989. referencedClasses: []
  1990. }),
  1991. smalltalk.CollectionTest);
  1992. smalltalk.addMethod(
  1993. smalltalk.method({
  1994. selector: "testIsEmpty",
  1995. protocol: 'tests',
  1996. fn: function (){
  1997. var self=this;
  1998. return smalltalk.withContext(function($ctx1) {
  1999. var $1;
  2000. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  2001. $ctx1.sendIdx["isEmpty"]=1;
  2002. self._assert_($1);
  2003. self._deny_(_st(self._collection())._isEmpty());
  2004. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  2005. args: [],
  2006. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  2007. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  2008. referencedClasses: []
  2009. }),
  2010. smalltalk.CollectionTest);
  2011. smalltalk.addMethod(
  2012. smalltalk.method({
  2013. selector: "testNoneSatisfy",
  2014. protocol: 'tests',
  2015. fn: function (){
  2016. var self=this;
  2017. var anyOne;
  2018. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2019. return smalltalk.withContext(function($ctx1) {
  2020. var $1,$3,$2;
  2021. $1=self._collection();
  2022. $ctx1.sendIdx["collection"]=1;
  2023. anyOne=_st($1)._anyOne();
  2024. $3=self._collection();
  2025. $ctx1.sendIdx["collection"]=2;
  2026. $2=_st($3)._noneSatisfy_((function(each){
  2027. return smalltalk.withContext(function($ctx2) {
  2028. return _st(each).__eq(anyOne);
  2029. $ctx2.sendIdx["="]=1;
  2030. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2031. $ctx1.sendIdx["noneSatisfy:"]=1;
  2032. self._deny_($2);
  2033. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2034. return smalltalk.withContext(function($ctx2) {
  2035. return _st(each).__eq(_st($Object())._new());
  2036. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2037. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  2038. args: [],
  2039. 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 ])",
  2040. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2041. referencedClasses: ["Object"]
  2042. }),
  2043. smalltalk.CollectionTest);
  2044. smalltalk.addMethod(
  2045. smalltalk.method({
  2046. selector: "testRemoveAll",
  2047. protocol: 'tests',
  2048. fn: function (){
  2049. var self=this;
  2050. return smalltalk.withContext(function($ctx1) {
  2051. var $1,$2;
  2052. $1=self._collection();
  2053. _st($1)._removeAll();
  2054. $2=_st($1)._yourself();
  2055. self._assert_equals_($2,_st(self._collectionClass())._new());
  2056. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  2057. args: [],
  2058. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2059. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2060. referencedClasses: []
  2061. }),
  2062. smalltalk.CollectionTest);
  2063. smalltalk.addMethod(
  2064. smalltalk.method({
  2065. selector: "testSelect",
  2066. protocol: 'tests',
  2067. fn: function (){
  2068. var self=this;
  2069. return smalltalk.withContext(function($ctx1) {
  2070. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2071. $2=self._collection();
  2072. $ctx1.sendIdx["collection"]=1;
  2073. $1=_st($2)._select_((function(){
  2074. return smalltalk.withContext(function($ctx2) {
  2075. return false;
  2076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2077. $ctx1.sendIdx["select:"]=1;
  2078. $4=self._collectionClass();
  2079. $ctx1.sendIdx["collectionClass"]=1;
  2080. $3=_st($4)._new();
  2081. $ctx1.sendIdx["new"]=1;
  2082. self._assert_equals_($1,$3);
  2083. $ctx1.sendIdx["assert:equals:"]=1;
  2084. $6=self._collection();
  2085. $ctx1.sendIdx["collection"]=2;
  2086. $5=_st($6)._select_((function(){
  2087. return smalltalk.withContext(function($ctx2) {
  2088. return true;
  2089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2090. $ctx1.sendIdx["select:"]=2;
  2091. $7=self._collection();
  2092. $ctx1.sendIdx["collection"]=3;
  2093. self._assert_equals_($5,$7);
  2094. $ctx1.sendIdx["assert:equals:"]=2;
  2095. $9=self._collectionWithNewValue();
  2096. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2097. $8=_st($9)._select_((function(each){
  2098. return smalltalk.withContext(function($ctx2) {
  2099. $10=self._sampleNewValue();
  2100. $ctx2.sendIdx["sampleNewValue"]=1;
  2101. return _st(each).__eq($10);
  2102. $ctx2.sendIdx["="]=1;
  2103. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2104. $ctx1.sendIdx["select:"]=3;
  2105. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2106. $ctx1.sendIdx["assert:equals:"]=3;
  2107. $12=self._collectionWithNewValue();
  2108. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2109. $11=_st($12)._select_((function(each){
  2110. return smalltalk.withContext(function($ctx2) {
  2111. $13=self._sampleNewValue();
  2112. $ctx2.sendIdx["sampleNewValue"]=2;
  2113. return _st(each).__tild_eq($13);
  2114. $ctx2.sendIdx["~="]=1;
  2115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2116. $ctx1.sendIdx["select:"]=4;
  2117. $14=self._collection();
  2118. $ctx1.sendIdx["collection"]=4;
  2119. self._assert_equals_($11,$14);
  2120. $ctx1.sendIdx["assert:equals:"]=4;
  2121. $16=self._collection();
  2122. $ctx1.sendIdx["collection"]=5;
  2123. $15=_st($16)._select_((function(each){
  2124. return smalltalk.withContext(function($ctx2) {
  2125. $17=self._sampleNewValue();
  2126. $ctx2.sendIdx["sampleNewValue"]=3;
  2127. return _st(each).__eq($17);
  2128. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2129. $ctx1.sendIdx["select:"]=5;
  2130. self._assert_equals_($15,_st(self._collectionClass())._new());
  2131. $ctx1.sendIdx["assert:equals:"]=5;
  2132. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2133. return smalltalk.withContext(function($ctx2) {
  2134. return _st(each).__tild_eq(self._sampleNewValue());
  2135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2136. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},smalltalk.CollectionTest)})},
  2137. args: [],
  2138. 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",
  2139. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2140. referencedClasses: []
  2141. }),
  2142. smalltalk.CollectionTest);
  2143. smalltalk.addMethod(
  2144. smalltalk.method({
  2145. selector: "testSize",
  2146. protocol: 'tests',
  2147. fn: function (){
  2148. var self=this;
  2149. return smalltalk.withContext(function($ctx1) {
  2150. var $1,$2;
  2151. $1=_st(_st(self._collectionClass())._new())._size();
  2152. $ctx1.sendIdx["size"]=1;
  2153. self._assert_equals_($1,(0));
  2154. $ctx1.sendIdx["assert:equals:"]=1;
  2155. $2=_st(self._sampleNewValueAsCollection())._size();
  2156. $ctx1.sendIdx["size"]=2;
  2157. self._assert_equals_($2,(1));
  2158. $ctx1.sendIdx["assert:equals:"]=2;
  2159. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2160. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  2161. args: [],
  2162. 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",
  2163. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2164. referencedClasses: []
  2165. }),
  2166. smalltalk.CollectionTest);
  2167. smalltalk.addMethod(
  2168. smalltalk.method({
  2169. selector: "collectionClass",
  2170. protocol: 'fixture',
  2171. fn: function (){
  2172. var self=this;
  2173. return smalltalk.withContext(function($ctx1) {
  2174. return nil;
  2175. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  2176. args: [],
  2177. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2178. messageSends: [],
  2179. referencedClasses: []
  2180. }),
  2181. smalltalk.CollectionTest.klass);
  2182. smalltalk.addMethod(
  2183. smalltalk.method({
  2184. selector: "isAbstract",
  2185. protocol: 'testing',
  2186. fn: function (){
  2187. var self=this;
  2188. return smalltalk.withContext(function($ctx1) {
  2189. var $1;
  2190. $1=_st(self._collectionClass())._isNil();
  2191. return $1;
  2192. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  2193. args: [],
  2194. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2195. messageSends: ["isNil", "collectionClass"],
  2196. referencedClasses: []
  2197. }),
  2198. smalltalk.CollectionTest.klass);
  2199. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  2200. smalltalk.addMethod(
  2201. smalltalk.method({
  2202. selector: "collectionWithNewValue",
  2203. protocol: 'fixture',
  2204. fn: function (){
  2205. var self=this;
  2206. return smalltalk.withContext(function($ctx1) {
  2207. self._subclassResponsibility();
  2208. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.IndexableCollectionTest)})},
  2209. args: [],
  2210. 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",
  2211. messageSends: ["subclassResponsibility"],
  2212. referencedClasses: []
  2213. }),
  2214. smalltalk.IndexableCollectionTest);
  2215. smalltalk.addMethod(
  2216. smalltalk.method({
  2217. selector: "sampleNewIndex",
  2218. protocol: 'fixture',
  2219. fn: function (){
  2220. var self=this;
  2221. return smalltalk.withContext(function($ctx1) {
  2222. self._subclassResponsibility();
  2223. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.IndexableCollectionTest)})},
  2224. args: [],
  2225. 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",
  2226. messageSends: ["subclassResponsibility"],
  2227. referencedClasses: []
  2228. }),
  2229. smalltalk.IndexableCollectionTest);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: "sampleNonIndexesDo:",
  2233. protocol: 'fixture',
  2234. fn: function (aBlock){
  2235. var self=this;
  2236. return smalltalk.withContext(function($ctx1) {
  2237. self._subclassResponsibility();
  2238. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2239. args: ["aBlock"],
  2240. 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",
  2241. messageSends: ["subclassResponsibility"],
  2242. referencedClasses: []
  2243. }),
  2244. smalltalk.IndexableCollectionTest);
  2245. smalltalk.addMethod(
  2246. smalltalk.method({
  2247. selector: "samplesDo:",
  2248. protocol: 'fixture',
  2249. fn: function (aBlock){
  2250. var self=this;
  2251. return smalltalk.withContext(function($ctx1) {
  2252. self._subclassResponsibility();
  2253. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2254. args: ["aBlock"],
  2255. 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",
  2256. messageSends: ["subclassResponsibility"],
  2257. referencedClasses: []
  2258. }),
  2259. smalltalk.IndexableCollectionTest);
  2260. smalltalk.addMethod(
  2261. smalltalk.method({
  2262. selector: "testAt",
  2263. protocol: 'tests',
  2264. fn: function (){
  2265. var self=this;
  2266. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2267. return smalltalk.withContext(function($ctx1) {
  2268. var $1;
  2269. self._nonIndexesDo_((function(each){
  2270. return smalltalk.withContext(function($ctx2) {
  2271. return self._should_raise_((function(){
  2272. return smalltalk.withContext(function($ctx3) {
  2273. $1=self._collection();
  2274. $ctx3.sendIdx["collection"]=1;
  2275. return _st($1)._at_(each);
  2276. $ctx3.sendIdx["at:"]=1;
  2277. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2279. self._samplesDo_((function(index,value){
  2280. return smalltalk.withContext(function($ctx2) {
  2281. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2282. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2283. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  2284. args: [],
  2285. 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 ]",
  2286. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2287. referencedClasses: ["Error"]
  2288. }),
  2289. smalltalk.IndexableCollectionTest);
  2290. smalltalk.addMethod(
  2291. smalltalk.method({
  2292. selector: "testAtIfAbsent",
  2293. protocol: 'tests',
  2294. fn: function (){
  2295. var self=this;
  2296. return smalltalk.withContext(function($ctx1) {
  2297. var $2,$1,$3;
  2298. self._nonIndexesDo_((function(each){
  2299. return smalltalk.withContext(function($ctx2) {
  2300. $2=self._collection();
  2301. $ctx2.sendIdx["collection"]=1;
  2302. $1=_st($2)._at_ifAbsent_(each,(function(){
  2303. return smalltalk.withContext(function($ctx3) {
  2304. return self._sampleNewValue();
  2305. $ctx3.sendIdx["sampleNewValue"]=1;
  2306. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2307. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2308. $3=self._sampleNewValue();
  2309. $ctx2.sendIdx["sampleNewValue"]=2;
  2310. return self._assert_equals_($1,$3);
  2311. $ctx2.sendIdx["assert:equals:"]=1;
  2312. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2313. self._samplesDo_((function(index,value){
  2314. return smalltalk.withContext(function($ctx2) {
  2315. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2316. return smalltalk.withContext(function($ctx3) {
  2317. return self._sampleNewValue();
  2318. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2319. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2320. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  2321. args: [],
  2322. 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 ].",
  2323. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2324. referencedClasses: []
  2325. }),
  2326. smalltalk.IndexableCollectionTest);
  2327. smalltalk.addMethod(
  2328. smalltalk.method({
  2329. selector: "testAtIfAbsentPut",
  2330. protocol: 'tests',
  2331. fn: function (){
  2332. var self=this;
  2333. var newCollection;
  2334. return smalltalk.withContext(function($ctx1) {
  2335. var $1;
  2336. newCollection=self._collection();
  2337. $ctx1.sendIdx["collection"]=1;
  2338. self._samplesDo_((function(index,value){
  2339. return smalltalk.withContext(function($ctx2) {
  2340. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2341. return smalltalk.withContext(function($ctx3) {
  2342. return self._sampleNewValue();
  2343. $ctx3.sendIdx["sampleNewValue"]=1;
  2344. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2345. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2346. return self._assert_equals_($1,value);
  2347. $ctx2.sendIdx["assert:equals:"]=1;
  2348. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2349. self._assert_equals_(newCollection,self._collection());
  2350. $ctx1.sendIdx["assert:equals:"]=2;
  2351. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2352. return smalltalk.withContext(function($ctx2) {
  2353. return self._sampleNewValue();
  2354. $ctx2.sendIdx["sampleNewValue"]=2;
  2355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2356. $ctx1.sendIdx["assert:equals:"]=3;
  2357. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2358. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2359. args: [],
  2360. 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",
  2361. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2362. referencedClasses: []
  2363. }),
  2364. smalltalk.IndexableCollectionTest);
  2365. smalltalk.addMethod(
  2366. smalltalk.method({
  2367. selector: "testAtIfPresent",
  2368. protocol: 'tests',
  2369. fn: function (){
  2370. var self=this;
  2371. var visited,sentinel;
  2372. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2373. return smalltalk.withContext(function($ctx1) {
  2374. var $2,$1,$4,$3;
  2375. sentinel=_st($Object())._new();
  2376. self._nonIndexesDo_((function(each){
  2377. return smalltalk.withContext(function($ctx2) {
  2378. visited=nil;
  2379. visited;
  2380. $2=self._collection();
  2381. $ctx2.sendIdx["collection"]=1;
  2382. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2383. return smalltalk.withContext(function($ctx3) {
  2384. visited=value1;
  2385. visited;
  2386. return sentinel;
  2387. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}));
  2388. $ctx2.sendIdx["at:ifPresent:"]=1;
  2389. self._assert_equals_($1,nil);
  2390. $ctx2.sendIdx["assert:equals:"]=1;
  2391. return self._assert_(_st(visited)._isNil());
  2392. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2393. self._samplesDo_((function(index,value){
  2394. return smalltalk.withContext(function($ctx2) {
  2395. visited=nil;
  2396. visited;
  2397. $4=self._collection();
  2398. $ctx2.sendIdx["collection"]=2;
  2399. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2400. return smalltalk.withContext(function($ctx3) {
  2401. visited=value2;
  2402. visited;
  2403. return sentinel;
  2404. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,4)})}));
  2405. self._assert_equals_($3,sentinel);
  2406. $ctx2.sendIdx["assert:equals:"]=2;
  2407. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2408. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2409. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2410. args: [],
  2411. 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) ]",
  2412. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2413. referencedClasses: ["Object"]
  2414. }),
  2415. smalltalk.IndexableCollectionTest);
  2416. smalltalk.addMethod(
  2417. smalltalk.method({
  2418. selector: "testAtIfPresentIfAbsent",
  2419. protocol: 'tests',
  2420. fn: function (){
  2421. var self=this;
  2422. var visited,sentinel;
  2423. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2424. return smalltalk.withContext(function($ctx1) {
  2425. var $2,$1,$3,$5,$4;
  2426. sentinel=_st($Object())._new();
  2427. self._nonIndexesDo_((function(each){
  2428. return smalltalk.withContext(function($ctx2) {
  2429. visited=nil;
  2430. visited;
  2431. $2=self._collection();
  2432. $ctx2.sendIdx["collection"]=1;
  2433. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2434. return smalltalk.withContext(function($ctx3) {
  2435. visited=value1;
  2436. visited;
  2437. return sentinel;
  2438. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}),(function(){
  2439. return smalltalk.withContext(function($ctx3) {
  2440. return self._sampleNewValue();
  2441. $ctx3.sendIdx["sampleNewValue"]=1;
  2442. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2443. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2444. $3=self._sampleNewValue();
  2445. $ctx2.sendIdx["sampleNewValue"]=2;
  2446. self._assert_equals_($1,$3);
  2447. $ctx2.sendIdx["assert:equals:"]=1;
  2448. return self._assert_(_st(visited)._isNil());
  2449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2450. self._samplesDo_((function(index,value){
  2451. return smalltalk.withContext(function($ctx2) {
  2452. visited=nil;
  2453. visited;
  2454. $5=self._collection();
  2455. $ctx2.sendIdx["collection"]=2;
  2456. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2457. return smalltalk.withContext(function($ctx3) {
  2458. visited=value2;
  2459. visited;
  2460. return sentinel;
  2461. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,5)})}),(function(){
  2462. return smalltalk.withContext(function($ctx3) {
  2463. return self._sampleNewValue();
  2464. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2465. self._assert_equals_($4,sentinel);
  2466. $ctx2.sendIdx["assert:equals:"]=2;
  2467. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2468. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2469. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2470. args: [],
  2471. 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) ]",
  2472. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2473. referencedClasses: ["Object"]
  2474. }),
  2475. smalltalk.IndexableCollectionTest);
  2476. smalltalk.addMethod(
  2477. smalltalk.method({
  2478. selector: "testAtPut",
  2479. protocol: 'tests',
  2480. fn: function (){
  2481. var self=this;
  2482. var newCollection;
  2483. return smalltalk.withContext(function($ctx1) {
  2484. newCollection=self._collection();
  2485. $ctx1.sendIdx["collection"]=1;
  2486. self._samplesDo_((function(index,value){
  2487. return smalltalk.withContext(function($ctx2) {
  2488. return _st(newCollection)._at_put_(index,value);
  2489. $ctx2.sendIdx["at:put:"]=1;
  2490. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2491. self._assert_equals_(newCollection,self._collection());
  2492. $ctx1.sendIdx["assert:equals:"]=1;
  2493. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2494. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2495. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2496. args: [],
  2497. 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",
  2498. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2499. referencedClasses: []
  2500. }),
  2501. smalltalk.IndexableCollectionTest);
  2502. smalltalk.addMethod(
  2503. smalltalk.method({
  2504. selector: "testIndexOf",
  2505. protocol: 'tests',
  2506. fn: function (){
  2507. var self=this;
  2508. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2509. return smalltalk.withContext(function($ctx1) {
  2510. var $1;
  2511. self._should_raise_((function(){
  2512. return smalltalk.withContext(function($ctx2) {
  2513. $1=self._collection();
  2514. $ctx2.sendIdx["collection"]=1;
  2515. return _st($1)._indexOf_(self._sampleNewValue());
  2516. $ctx2.sendIdx["indexOf:"]=1;
  2517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2518. self._samplesDo_((function(index,value){
  2519. return smalltalk.withContext(function($ctx2) {
  2520. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2521. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2522. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  2523. args: [],
  2524. 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 ]",
  2525. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2526. referencedClasses: ["Error"]
  2527. }),
  2528. smalltalk.IndexableCollectionTest);
  2529. smalltalk.addMethod(
  2530. smalltalk.method({
  2531. selector: "testWithIndexDo",
  2532. protocol: 'tests',
  2533. fn: function (){
  2534. var self=this;
  2535. var collection;
  2536. return smalltalk.withContext(function($ctx1) {
  2537. collection=self._collection();
  2538. $ctx1.sendIdx["collection"]=1;
  2539. _st(self._collection())._withIndexDo_((function(each,index){
  2540. return smalltalk.withContext(function($ctx2) {
  2541. return self._assert_equals_(_st(collection)._at_(index),each);
  2542. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2543. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  2544. args: [],
  2545. 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 ]",
  2546. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2547. referencedClasses: []
  2548. }),
  2549. smalltalk.IndexableCollectionTest);
  2550. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2551. smalltalk.addMethod(
  2552. smalltalk.method({
  2553. selector: "collection",
  2554. protocol: 'fixture',
  2555. fn: function (){
  2556. var self=this;
  2557. return smalltalk.withContext(function($ctx1) {
  2558. var $2,$3,$4,$1;
  2559. $2="b".__minus_gt((1));
  2560. $ctx1.sendIdx["->"]=1;
  2561. $3="a".__minus_gt((2));
  2562. $ctx1.sendIdx["->"]=2;
  2563. $4="c".__minus_gt((3));
  2564. $ctx1.sendIdx["->"]=3;
  2565. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  2566. return $1;
  2567. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  2568. args: [],
  2569. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  2570. messageSends: ["->"],
  2571. referencedClasses: []
  2572. }),
  2573. smalltalk.HashedCollectionTest);
  2574. smalltalk.addMethod(
  2575. smalltalk.method({
  2576. selector: "collectionOfPrintStrings",
  2577. protocol: 'fixture',
  2578. fn: function (){
  2579. var self=this;
  2580. return smalltalk.withContext(function($ctx1) {
  2581. var $2,$3,$4,$1;
  2582. $2="b".__minus_gt("1");
  2583. $ctx1.sendIdx["->"]=1;
  2584. $3="a".__minus_gt("2");
  2585. $ctx1.sendIdx["->"]=2;
  2586. $4="c".__minus_gt("3");
  2587. $ctx1.sendIdx["->"]=3;
  2588. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt("-4")]);
  2589. return $1;
  2590. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.HashedCollectionTest)})},
  2591. args: [],
  2592. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  2593. messageSends: ["->"],
  2594. referencedClasses: []
  2595. }),
  2596. smalltalk.HashedCollectionTest);
  2597. smalltalk.addMethod(
  2598. smalltalk.method({
  2599. selector: "collectionSize",
  2600. protocol: 'fixture',
  2601. fn: function (){
  2602. var self=this;
  2603. return smalltalk.withContext(function($ctx1) {
  2604. return (4);
  2605. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.HashedCollectionTest)})},
  2606. args: [],
  2607. source: "collectionSize\x0a\x09^ 4",
  2608. messageSends: [],
  2609. referencedClasses: []
  2610. }),
  2611. smalltalk.HashedCollectionTest);
  2612. smalltalk.addMethod(
  2613. smalltalk.method({
  2614. selector: "collectionWithDuplicates",
  2615. protocol: 'fixture',
  2616. fn: function (){
  2617. var self=this;
  2618. return smalltalk.withContext(function($ctx1) {
  2619. var $2,$3,$4,$5,$6,$7,$1;
  2620. $2="b".__minus_gt((1));
  2621. $ctx1.sendIdx["->"]=1;
  2622. $3="a".__minus_gt((2));
  2623. $ctx1.sendIdx["->"]=2;
  2624. $4="c".__minus_gt((3));
  2625. $ctx1.sendIdx["->"]=3;
  2626. $5="d".__minus_gt((-4));
  2627. $ctx1.sendIdx["->"]=4;
  2628. $6="e".__minus_gt((1));
  2629. $ctx1.sendIdx["->"]=5;
  2630. $7="f".__minus_gt((2));
  2631. $ctx1.sendIdx["->"]=6;
  2632. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  2633. return $1;
  2634. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  2635. args: [],
  2636. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  2637. messageSends: ["->"],
  2638. referencedClasses: []
  2639. }),
  2640. smalltalk.HashedCollectionTest);
  2641. smalltalk.addMethod(
  2642. smalltalk.method({
  2643. selector: "collectionWithNewValue",
  2644. protocol: 'fixture',
  2645. fn: function (){
  2646. var self=this;
  2647. return smalltalk.withContext(function($ctx1) {
  2648. var $2,$3,$4,$5,$1;
  2649. $2="b".__minus_gt((1));
  2650. $ctx1.sendIdx["->"]=1;
  2651. $3="a".__minus_gt((2));
  2652. $ctx1.sendIdx["->"]=2;
  2653. $4="c".__minus_gt((3));
  2654. $ctx1.sendIdx["->"]=3;
  2655. $5="d".__minus_gt((-4));
  2656. $ctx1.sendIdx["->"]=4;
  2657. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  2658. return $1;
  2659. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.HashedCollectionTest)})},
  2660. args: [],
  2661. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  2662. messageSends: ["->"],
  2663. referencedClasses: []
  2664. }),
  2665. smalltalk.HashedCollectionTest);
  2666. smalltalk.addMethod(
  2667. smalltalk.method({
  2668. selector: "nonIndexesDo:",
  2669. protocol: 'fixture',
  2670. fn: function (aBlock){
  2671. var self=this;
  2672. return smalltalk.withContext(function($ctx1) {
  2673. _st(aBlock)._value_((5));
  2674. $ctx1.sendIdx["value:"]=1;
  2675. _st(aBlock)._value_("z");
  2676. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2677. args: ["aBlock"],
  2678. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2679. messageSends: ["value:"],
  2680. referencedClasses: []
  2681. }),
  2682. smalltalk.HashedCollectionTest);
  2683. smalltalk.addMethod(
  2684. smalltalk.method({
  2685. selector: "sampleNewIndex",
  2686. protocol: 'fixture',
  2687. fn: function (){
  2688. var self=this;
  2689. return smalltalk.withContext(function($ctx1) {
  2690. return "new";
  2691. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.HashedCollectionTest)})},
  2692. args: [],
  2693. source: "sampleNewIndex\x0a\x09^ 'new'",
  2694. messageSends: [],
  2695. referencedClasses: []
  2696. }),
  2697. smalltalk.HashedCollectionTest);
  2698. smalltalk.addMethod(
  2699. smalltalk.method({
  2700. selector: "sampleNewValueAsCollection",
  2701. protocol: 'fixture',
  2702. fn: function (){
  2703. var self=this;
  2704. return smalltalk.withContext(function($ctx1) {
  2705. var $1;
  2706. $1=smalltalk.HashedCollection._from_(["new".__minus_gt("N")]);
  2707. return $1;
  2708. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.HashedCollectionTest)})},
  2709. args: [],
  2710. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  2711. messageSends: ["->"],
  2712. referencedClasses: []
  2713. }),
  2714. smalltalk.HashedCollectionTest);
  2715. smalltalk.addMethod(
  2716. smalltalk.method({
  2717. selector: "samplesDo:",
  2718. protocol: 'fixture',
  2719. fn: function (aBlock){
  2720. var self=this;
  2721. return smalltalk.withContext(function($ctx1) {
  2722. _st(aBlock)._value_value_("a",(2));
  2723. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2724. args: ["aBlock"],
  2725. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2726. messageSends: ["value:value:"],
  2727. referencedClasses: []
  2728. }),
  2729. smalltalk.HashedCollectionTest);
  2730. smalltalk.addMethod(
  2731. smalltalk.method({
  2732. selector: "testAddAll",
  2733. protocol: 'tests',
  2734. fn: function (){
  2735. var self=this;
  2736. return smalltalk.withContext(function($ctx1) {
  2737. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2738. smalltalk.HashedCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2739. $2=self._collection();
  2740. $ctx1.sendIdx["collection"]=1;
  2741. $3=$2;
  2742. $4=self._collection();
  2743. $ctx1.sendIdx["collection"]=2;
  2744. _st($3)._addAll_($4);
  2745. $ctx1.sendIdx["addAll:"]=1;
  2746. $5=_st($2)._yourself();
  2747. $ctx1.sendIdx["yourself"]=1;
  2748. $1=$5;
  2749. $6=self._collection();
  2750. $ctx1.sendIdx["collection"]=3;
  2751. self._assert_equals_($1,$6);
  2752. $ctx1.sendIdx["assert:equals:"]=1;
  2753. $8=self._collection();
  2754. $ctx1.sendIdx["collection"]=4;
  2755. $9=$8;
  2756. $10=self._collectionWithNewValue();
  2757. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2758. _st($9)._addAll_($10);
  2759. $ctx1.sendIdx["addAll:"]=2;
  2760. $11=_st($8)._yourself();
  2761. $ctx1.sendIdx["yourself"]=2;
  2762. $7=$11;
  2763. $12=self._collectionWithNewValue();
  2764. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2765. self._assert_equals_($7,$12);
  2766. $ctx1.sendIdx["assert:equals:"]=2;
  2767. $14=self._collectionWithNewValue();
  2768. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2769. _st($14)._addAll_(self._collection());
  2770. $15=_st($14)._yourself();
  2771. $13=$15;
  2772. self._assert_equals_($13,self._collectionWithNewValue());
  2773. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.HashedCollectionTest)})},
  2774. args: [],
  2775. 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",
  2776. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2777. referencedClasses: []
  2778. }),
  2779. smalltalk.HashedCollectionTest);
  2780. smalltalk.addMethod(
  2781. smalltalk.method({
  2782. selector: "testAsDictionary",
  2783. protocol: 'tests',
  2784. fn: function (){
  2785. var self=this;
  2786. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2787. return smalltalk.withContext(function($ctx1) {
  2788. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2789. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  2790. args: [],
  2791. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2792. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2793. referencedClasses: ["Dictionary"]
  2794. }),
  2795. smalltalk.HashedCollectionTest);
  2796. smalltalk.addMethod(
  2797. smalltalk.method({
  2798. selector: "testComma",
  2799. protocol: 'tests',
  2800. fn: function (){
  2801. var self=this;
  2802. return smalltalk.withContext(function($ctx1) {
  2803. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2804. smalltalk.HashedCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  2805. $2=self._collection();
  2806. $ctx1.sendIdx["collection"]=1;
  2807. $3=self._collection();
  2808. $ctx1.sendIdx["collection"]=2;
  2809. $1=_st($2).__comma($3);
  2810. $ctx1.sendIdx[","]=1;
  2811. $4=self._collection();
  2812. $ctx1.sendIdx["collection"]=3;
  2813. self._assert_equals_($1,$4);
  2814. $ctx1.sendIdx["assert:equals:"]=1;
  2815. $6=self._collection();
  2816. $ctx1.sendIdx["collection"]=4;
  2817. $7=self._collectionWithNewValue();
  2818. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2819. $5=_st($6).__comma($7);
  2820. $ctx1.sendIdx[","]=2;
  2821. $8=self._collectionWithNewValue();
  2822. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2823. self._assert_equals_($5,$8);
  2824. $ctx1.sendIdx["assert:equals:"]=2;
  2825. $10=self._collectionWithNewValue();
  2826. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2827. $9=_st($10).__comma(self._collection());
  2828. self._assert_equals_($9,self._collectionWithNewValue());
  2829. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.HashedCollectionTest)})},
  2830. args: [],
  2831. 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",
  2832. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2833. referencedClasses: []
  2834. }),
  2835. smalltalk.HashedCollectionTest);
  2836. smalltalk.addMethod(
  2837. smalltalk.method({
  2838. selector: "testFrom",
  2839. protocol: 'tests',
  2840. fn: function (){
  2841. var self=this;
  2842. var associations;
  2843. return smalltalk.withContext(function($ctx1) {
  2844. var $1,$2,$3,$5,$4;
  2845. $1="a".__minus_gt((1));
  2846. $ctx1.sendIdx["->"]=1;
  2847. $2="b".__minus_gt((2));
  2848. $ctx1.sendIdx["->"]=2;
  2849. associations=[$1,$2];
  2850. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2851. $5="a".__minus_gt((1));
  2852. $ctx1.sendIdx["->"]=3;
  2853. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2854. self._assertSameContents_as_($3,$4);
  2855. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  2856. args: [],
  2857. 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 }.",
  2858. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2859. referencedClasses: []
  2860. }),
  2861. smalltalk.HashedCollectionTest);
  2862. smalltalk.addMethod(
  2863. smalltalk.method({
  2864. selector: "testNewFromPairs",
  2865. protocol: 'tests',
  2866. fn: function (){
  2867. var self=this;
  2868. var flattenedAssociations;
  2869. return smalltalk.withContext(function($ctx1) {
  2870. var $1,$3,$2;
  2871. flattenedAssociations=["a",(1),"b",(2)];
  2872. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2873. $3="a".__minus_gt((1));
  2874. $ctx1.sendIdx["->"]=1;
  2875. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2876. self._assertSameContents_as_($1,$2);
  2877. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  2878. args: [],
  2879. source: "testNewFromPairs\x0a\x22Accept an array in which all odd indexes are keys and evens are values.\x22\x0a| flattenedAssociations |\x0aflattenedAssociations := { 'a'. 1. 'b'. 2 }.\x0aself assertSameContents: ( self class collectionClass newFromPairs: flattenedAssociations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  2880. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2881. referencedClasses: []
  2882. }),
  2883. smalltalk.HashedCollectionTest);
  2884. smalltalk.addMethod(
  2885. smalltalk.method({
  2886. selector: "collectionClass",
  2887. protocol: 'fixture',
  2888. fn: function (){
  2889. var self=this;
  2890. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2891. return smalltalk.withContext(function($ctx1) {
  2892. return $HashedCollection();
  2893. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  2894. args: [],
  2895. source: "collectionClass\x0a\x09^ HashedCollection",
  2896. messageSends: [],
  2897. referencedClasses: ["HashedCollection"]
  2898. }),
  2899. smalltalk.HashedCollectionTest.klass);
  2900. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  2901. smalltalk.addMethod(
  2902. smalltalk.method({
  2903. selector: "collection",
  2904. protocol: 'fixture',
  2905. fn: function (){
  2906. var self=this;
  2907. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2908. return smalltalk.withContext(function($ctx1) {
  2909. var $2,$3,$1;
  2910. $2=_st($Dictionary())._new();
  2911. _st($2)._at_put_((1),(1));
  2912. $ctx1.sendIdx["at:put:"]=1;
  2913. _st($2)._at_put_("a",(2));
  2914. $ctx1.sendIdx["at:put:"]=2;
  2915. _st($2)._at_put_(true,(3));
  2916. $ctx1.sendIdx["at:put:"]=3;
  2917. _st($2)._at_put_((1).__at((3)),(-4));
  2918. $3=_st($2)._yourself();
  2919. $1=$3;
  2920. return $1;
  2921. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  2922. args: [],
  2923. 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",
  2924. messageSends: ["at:put:", "new", "@", "yourself"],
  2925. referencedClasses: ["Dictionary"]
  2926. }),
  2927. smalltalk.DictionaryTest);
  2928. smalltalk.addMethod(
  2929. smalltalk.method({
  2930. selector: "collectionOfPrintStrings",
  2931. protocol: 'fixture',
  2932. fn: function (){
  2933. var self=this;
  2934. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2935. return smalltalk.withContext(function($ctx1) {
  2936. var $2,$3,$1;
  2937. $2=_st($Dictionary())._new();
  2938. _st($2)._at_put_((1),"1");
  2939. $ctx1.sendIdx["at:put:"]=1;
  2940. _st($2)._at_put_("a","2");
  2941. $ctx1.sendIdx["at:put:"]=2;
  2942. _st($2)._at_put_(true,"3");
  2943. $ctx1.sendIdx["at:put:"]=3;
  2944. _st($2)._at_put_((1).__at((3)),"-4");
  2945. $3=_st($2)._yourself();
  2946. $1=$3;
  2947. return $1;
  2948. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.DictionaryTest)})},
  2949. args: [],
  2950. 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",
  2951. messageSends: ["at:put:", "new", "@", "yourself"],
  2952. referencedClasses: ["Dictionary"]
  2953. }),
  2954. smalltalk.DictionaryTest);
  2955. smalltalk.addMethod(
  2956. smalltalk.method({
  2957. selector: "collectionSize",
  2958. protocol: 'fixture',
  2959. fn: function (){
  2960. var self=this;
  2961. return smalltalk.withContext(function($ctx1) {
  2962. return (4);
  2963. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.DictionaryTest)})},
  2964. args: [],
  2965. source: "collectionSize\x0a\x09^ 4",
  2966. messageSends: [],
  2967. referencedClasses: []
  2968. }),
  2969. smalltalk.DictionaryTest);
  2970. smalltalk.addMethod(
  2971. smalltalk.method({
  2972. selector: "collectionWithDuplicates",
  2973. protocol: 'fixture',
  2974. fn: function (){
  2975. var self=this;
  2976. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2977. return smalltalk.withContext(function($ctx1) {
  2978. var $2,$3,$1;
  2979. $2=_st($Dictionary())._new();
  2980. _st($2)._at_put_((1),(1));
  2981. $ctx1.sendIdx["at:put:"]=1;
  2982. _st($2)._at_put_("a",(2));
  2983. $ctx1.sendIdx["at:put:"]=2;
  2984. _st($2)._at_put_(true,(3));
  2985. $ctx1.sendIdx["at:put:"]=3;
  2986. _st($2)._at_put_((4),(-4));
  2987. $ctx1.sendIdx["at:put:"]=4;
  2988. _st($2)._at_put_("b",(1));
  2989. $ctx1.sendIdx["at:put:"]=5;
  2990. _st($2)._at_put_((3),(3));
  2991. $ctx1.sendIdx["at:put:"]=6;
  2992. _st($2)._at_put_(false,(12));
  2993. $3=_st($2)._yourself();
  2994. $1=$3;
  2995. return $1;
  2996. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  2997. args: [],
  2998. 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",
  2999. messageSends: ["at:put:", "new", "yourself"],
  3000. referencedClasses: ["Dictionary"]
  3001. }),
  3002. smalltalk.DictionaryTest);
  3003. smalltalk.addMethod(
  3004. smalltalk.method({
  3005. selector: "collectionWithNewValue",
  3006. protocol: 'fixture',
  3007. fn: function (){
  3008. var self=this;
  3009. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3010. return smalltalk.withContext(function($ctx1) {
  3011. var $2,$3,$1;
  3012. $2=_st($Dictionary())._new();
  3013. _st($2)._at_put_((1),(1));
  3014. $ctx1.sendIdx["at:put:"]=1;
  3015. _st($2)._at_put_("a",(2));
  3016. $ctx1.sendIdx["at:put:"]=2;
  3017. _st($2)._at_put_(true,(3));
  3018. $ctx1.sendIdx["at:put:"]=3;
  3019. _st($2)._at_put_((1).__at((3)),(-4));
  3020. $ctx1.sendIdx["at:put:"]=4;
  3021. _st($2)._at_put_("new","N");
  3022. $3=_st($2)._yourself();
  3023. $1=$3;
  3024. return $1;
  3025. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.DictionaryTest)})},
  3026. args: [],
  3027. 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",
  3028. messageSends: ["at:put:", "new", "@", "yourself"],
  3029. referencedClasses: ["Dictionary"]
  3030. }),
  3031. smalltalk.DictionaryTest);
  3032. smalltalk.addMethod(
  3033. smalltalk.method({
  3034. selector: "sampleNewValueAsCollection",
  3035. protocol: 'fixture',
  3036. fn: function (){
  3037. var self=this;
  3038. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3039. return smalltalk.withContext(function($ctx1) {
  3040. var $2,$3,$1;
  3041. $2=_st($Dictionary())._new();
  3042. _st($2)._at_put_("new","N");
  3043. $3=_st($2)._yourself();
  3044. $1=$3;
  3045. return $1;
  3046. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.DictionaryTest)})},
  3047. args: [],
  3048. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3049. messageSends: ["at:put:", "new", "yourself"],
  3050. referencedClasses: ["Dictionary"]
  3051. }),
  3052. smalltalk.DictionaryTest);
  3053. smalltalk.addMethod(
  3054. smalltalk.method({
  3055. selector: "samplesDo:",
  3056. protocol: 'fixture',
  3057. fn: function (aBlock){
  3058. var self=this;
  3059. return smalltalk.withContext(function($ctx1) {
  3060. smalltalk.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3061. _st(aBlock)._value_value_(true,(3));
  3062. $ctx1.sendIdx["value:value:"]=1;
  3063. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3064. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.DictionaryTest)})},
  3065. args: ["aBlock"],
  3066. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3067. messageSends: ["samplesDo:", "value:value:", "@"],
  3068. referencedClasses: []
  3069. }),
  3070. smalltalk.DictionaryTest);
  3071. smalltalk.addMethod(
  3072. smalltalk.method({
  3073. selector: "testAccessing",
  3074. protocol: 'tests',
  3075. fn: function (){
  3076. var self=this;
  3077. var d;
  3078. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3079. return smalltalk.withContext(function($ctx1) {
  3080. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3081. d=_st($Dictionary())._new();
  3082. _st(d)._at_put_("hello","world");
  3083. $ctx1.sendIdx["at:put:"]=1;
  3084. $1=_st(d)._at_("hello");
  3085. $ctx1.sendIdx["at:"]=1;
  3086. self._assert_equals_($1,"world");
  3087. $ctx1.sendIdx["assert:equals:"]=1;
  3088. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3089. return smalltalk.withContext(function($ctx2) {
  3090. return nil;
  3091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3092. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3093. self._assert_equals_($2,"world");
  3094. $ctx1.sendIdx["assert:equals:"]=2;
  3095. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3096. return smalltalk.withContext(function($ctx2) {
  3097. return nil;
  3098. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  3099. $ctx1.sendIdx["deny:"]=1;
  3100. $3=_st(d)._includesKey_("hello");
  3101. $ctx1.sendIdx["includesKey:"]=1;
  3102. self._assert_($3);
  3103. $ctx1.sendIdx["assert:"]=1;
  3104. $4=_st(d)._includesKey_("foo");
  3105. $ctx1.sendIdx["includesKey:"]=2;
  3106. self._deny_($4);
  3107. $ctx1.sendIdx["deny:"]=2;
  3108. _st(d)._at_put_((1),(2));
  3109. $ctx1.sendIdx["at:put:"]=2;
  3110. $5=_st(d)._at_((1));
  3111. $ctx1.sendIdx["at:"]=2;
  3112. self._assert_equals_($5,(2));
  3113. $ctx1.sendIdx["assert:equals:"]=3;
  3114. $6=d;
  3115. $7=(1).__at((3));
  3116. $ctx1.sendIdx["@"]=1;
  3117. _st($6)._at_put_($7,(3));
  3118. $9=d;
  3119. $10=(1).__at((3));
  3120. $ctx1.sendIdx["@"]=2;
  3121. $8=_st($9)._at_($10);
  3122. self._assert_equals_($8,(3));
  3123. $12=d;
  3124. $13=(1).__at((3));
  3125. $ctx1.sendIdx["@"]=3;
  3126. $11=_st($12)._includesKey_($13);
  3127. $ctx1.sendIdx["includesKey:"]=3;
  3128. self._assert_($11);
  3129. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3130. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  3131. args: [],
  3132. 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)",
  3133. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3134. referencedClasses: ["Dictionary"]
  3135. }),
  3136. smalltalk.DictionaryTest);
  3137. smalltalk.addMethod(
  3138. smalltalk.method({
  3139. selector: "testAsHashedCollection",
  3140. protocol: 'tests',
  3141. fn: function (){
  3142. var self=this;
  3143. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3144. return smalltalk.withContext(function($ctx1) {
  3145. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  3146. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  3147. args: [],
  3148. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  3149. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  3150. referencedClasses: ["HashedCollection"]
  3151. }),
  3152. smalltalk.DictionaryTest);
  3153. smalltalk.addMethod(
  3154. smalltalk.method({
  3155. selector: "testDynamicDictionaries",
  3156. protocol: 'tests',
  3157. fn: function (){
  3158. var self=this;
  3159. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3160. return smalltalk.withContext(function($ctx1) {
  3161. var $3,$2,$1;
  3162. $3="hello".__minus_gt((1));
  3163. $ctx1.sendIdx["->"]=1;
  3164. $2=smalltalk.HashedCollection._from_([$3]);
  3165. $1=_st($2)._asDictionary();
  3166. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  3167. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  3168. args: [],
  3169. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3170. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  3171. referencedClasses: ["Dictionary"]
  3172. }),
  3173. smalltalk.DictionaryTest);
  3174. smalltalk.addMethod(
  3175. smalltalk.method({
  3176. selector: "testEquality",
  3177. protocol: 'tests',
  3178. fn: function (){
  3179. var self=this;
  3180. var d1,d2;
  3181. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3182. return smalltalk.withContext(function($ctx1) {
  3183. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  3184. $2=_st($Dictionary())._new();
  3185. $ctx1.sendIdx["new"]=1;
  3186. $3=_st($Dictionary())._new();
  3187. $ctx1.sendIdx["new"]=2;
  3188. $1=_st($2).__eq($3);
  3189. $ctx1.sendIdx["="]=1;
  3190. self._assert_($1);
  3191. $ctx1.sendIdx["assert:"]=1;
  3192. $4=_st($Dictionary())._new();
  3193. $ctx1.sendIdx["new"]=3;
  3194. _st($4)._at_put_((1),(2));
  3195. $ctx1.sendIdx["at:put:"]=1;
  3196. $5=_st($4)._yourself();
  3197. $ctx1.sendIdx["yourself"]=1;
  3198. d1=$5;
  3199. $6=_st($Dictionary())._new();
  3200. $ctx1.sendIdx["new"]=4;
  3201. _st($6)._at_put_((1),(2));
  3202. $ctx1.sendIdx["at:put:"]=2;
  3203. $7=_st($6)._yourself();
  3204. $ctx1.sendIdx["yourself"]=2;
  3205. d2=$7;
  3206. $8=_st(d1).__eq(d2);
  3207. $ctx1.sendIdx["="]=2;
  3208. self._assert_($8);
  3209. $9=_st($Dictionary())._new();
  3210. $ctx1.sendIdx["new"]=5;
  3211. _st($9)._at_put_((1),(3));
  3212. $ctx1.sendIdx["at:put:"]=3;
  3213. $10=_st($9)._yourself();
  3214. $ctx1.sendIdx["yourself"]=3;
  3215. d2=$10;
  3216. $11=_st(d1).__eq(d2);
  3217. $ctx1.sendIdx["="]=3;
  3218. self._deny_($11);
  3219. $ctx1.sendIdx["deny:"]=1;
  3220. $12=_st($Dictionary())._new();
  3221. $ctx1.sendIdx["new"]=6;
  3222. _st($12)._at_put_((2),(2));
  3223. $ctx1.sendIdx["at:put:"]=4;
  3224. $13=_st($12)._yourself();
  3225. $ctx1.sendIdx["yourself"]=4;
  3226. d2=$13;
  3227. $14=_st(d1).__eq(d2);
  3228. $ctx1.sendIdx["="]=4;
  3229. self._deny_($14);
  3230. $ctx1.sendIdx["deny:"]=2;
  3231. $15=_st($Dictionary())._new();
  3232. _st($15)._at_put_((1),(2));
  3233. $ctx1.sendIdx["at:put:"]=5;
  3234. _st($15)._at_put_((3),(4));
  3235. $16=_st($15)._yourself();
  3236. d2=$16;
  3237. self._deny_(_st(d1).__eq(d2));
  3238. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  3239. args: [],
  3240. source: "testEquality\x0a\x09| d1 d2 |\x0a\x0a\x09self assert: (Dictionary new = Dictionary new).\x0a\x09\x09\x0a\x09d1 := Dictionary new at: 1 put: 2; yourself.\x0a\x09d2 := Dictionary new at: 1 put: 2; yourself.\x0a\x09self assert: (d1 = d2).\x0a\x0a\x09d2 := Dictionary new at: 1 put: 3; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 2 put: 2; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 1 put: 2; at: 3 put: 4; yourself.\x0a\x09self deny: d1 = d2.",
  3241. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  3242. referencedClasses: ["Dictionary"]
  3243. }),
  3244. smalltalk.DictionaryTest);
  3245. smalltalk.addMethod(
  3246. smalltalk.method({
  3247. selector: "testKeys",
  3248. protocol: 'tests',
  3249. fn: function (){
  3250. var self=this;
  3251. var d;
  3252. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3253. return smalltalk.withContext(function($ctx1) {
  3254. d=_st($Dictionary())._new();
  3255. _st(d)._at_put_((1),(2));
  3256. $ctx1.sendIdx["at:put:"]=1;
  3257. _st(d)._at_put_((2),(3));
  3258. $ctx1.sendIdx["at:put:"]=2;
  3259. _st(d)._at_put_((3),(4));
  3260. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  3261. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  3262. args: [],
  3263. source: "testKeys\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d keys equals: #(1 2 3)",
  3264. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  3265. referencedClasses: ["Dictionary"]
  3266. }),
  3267. smalltalk.DictionaryTest);
  3268. smalltalk.addMethod(
  3269. smalltalk.method({
  3270. selector: "testPointKey",
  3271. protocol: 'tests',
  3272. fn: function (){
  3273. var self=this;
  3274. var d;
  3275. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3276. return smalltalk.withContext(function($ctx1) {
  3277. var $1,$2,$4,$5,$3,$6,$7,$9,$10,$8,$11,$12,$14,$15,$13;
  3278. d=_st($Dictionary())._new();
  3279. $1=d;
  3280. $2=(1).__at((1));
  3281. $ctx1.sendIdx["@"]=1;
  3282. _st($1)._at_put_($2,"foo");
  3283. $ctx1.sendIdx["at:put:"]=1;
  3284. $4=d;
  3285. $5=(1).__at((1));
  3286. $ctx1.sendIdx["@"]=2;
  3287. $3=_st($4)._at_($5);
  3288. $ctx1.sendIdx["at:"]=1;
  3289. self._assert_equals_($3,"foo");
  3290. $ctx1.sendIdx["assert:equals:"]=1;
  3291. $6=d;
  3292. $7=(1).__at((1));
  3293. $ctx1.sendIdx["@"]=3;
  3294. _st($6)._at_put_($7,"bar");
  3295. $9=d;
  3296. $10=(1).__at((1));
  3297. $ctx1.sendIdx["@"]=4;
  3298. $8=_st($9)._at_($10);
  3299. self._assert_equals_($8,"bar");
  3300. $ctx1.sendIdx["assert:equals:"]=2;
  3301. $11=d;
  3302. $12=(1).__at((1));
  3303. $ctx1.sendIdx["@"]=5;
  3304. _st($11)._removeKey_($12);
  3305. $14=d;
  3306. $15=(1).__at((1));
  3307. $ctx1.sendIdx["@"]=6;
  3308. $13=_st($14)._at_ifAbsent_($15,(function(){
  3309. return smalltalk.withContext(function($ctx2) {
  3310. return "baz";
  3311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3312. self._assert_equals_($13,"baz");
  3313. self._deny_(_st(d)._includesKey_((1).__at((1))));
  3314. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  3315. args: [],
  3316. source: "testPointKey\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09\x0a\x09d at: 1@1 put: 'foo'.\x0a\x09self assert: (d at: 1@1) equals: 'foo'.\x0a\x09d at: 1@1 put: 'bar'.\x0a\x09self assert: (d at: 1@1) equals: 'bar'.\x0a\x09d removeKey: 1@1.\x0a\x09self assert: (d at: 1@1 ifAbsent: [ 'baz' ]) equals: 'baz'.\x0a\x09self deny: (d includesKey: 1@1)",
  3317. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  3318. referencedClasses: ["Dictionary"]
  3319. }),
  3320. smalltalk.DictionaryTest);
  3321. smalltalk.addMethod(
  3322. smalltalk.method({
  3323. selector: "testPrintString",
  3324. protocol: 'tests',
  3325. fn: function (){
  3326. var self=this;
  3327. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3328. return smalltalk.withContext(function($ctx1) {
  3329. var $2,$3,$1;
  3330. $2=_st($Dictionary())._new();
  3331. _st($2)._at_put_("firstname","James");
  3332. $ctx1.sendIdx["at:put:"]=1;
  3333. _st($2)._at_put_("lastname","Bond");
  3334. $3=_st($2)._printString();
  3335. $1=$3;
  3336. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  3337. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  3338. args: [],
  3339. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (Dictionary new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a Dictionary (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  3340. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  3341. referencedClasses: ["Dictionary"]
  3342. }),
  3343. smalltalk.DictionaryTest);
  3344. smalltalk.addMethod(
  3345. smalltalk.method({
  3346. selector: "testRemoveKey",
  3347. protocol: 'tests',
  3348. fn: function (){
  3349. var self=this;
  3350. var d,key;
  3351. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3352. return smalltalk.withContext(function($ctx1) {
  3353. var $1;
  3354. d=_st($Dictionary())._new();
  3355. _st(d)._at_put_((1),(2));
  3356. $ctx1.sendIdx["at:put:"]=1;
  3357. _st(d)._at_put_((2),(3));
  3358. $ctx1.sendIdx["at:put:"]=2;
  3359. _st(d)._at_put_((3),(4));
  3360. key=(2);
  3361. $1=_st(d)._keys();
  3362. $ctx1.sendIdx["keys"]=1;
  3363. self._assert_equals_($1,[(1), (2), (3)]);
  3364. $ctx1.sendIdx["assert:equals:"]=1;
  3365. _st(d)._removeKey_(key);
  3366. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  3367. $ctx1.sendIdx["assert:equals:"]=2;
  3368. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  3369. self._deny_(_st(d)._includesKey_((2)));
  3370. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  3371. args: [],
  3372. source: "testRemoveKey\x0a\x09| d key |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09key := 2.\x0a\x0a\x09self assert: d keys equals: #(1 2 3).\x0a\x0a\x09d removeKey: key.\x0a\x09self assert: d keys equals: #(1 3).\x0a\x09self assert: d values equals: #(2 4).\x0a\x09self deny: (d includesKey: 2)",
  3373. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  3374. referencedClasses: ["Dictionary"]
  3375. }),
  3376. smalltalk.DictionaryTest);
  3377. smalltalk.addMethod(
  3378. smalltalk.method({
  3379. selector: "testRemoveKeyIfAbsent",
  3380. protocol: 'tests',
  3381. fn: function (){
  3382. var self=this;
  3383. var d,key;
  3384. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3385. return smalltalk.withContext(function($ctx1) {
  3386. var $1;
  3387. d=_st($Dictionary())._new();
  3388. _st(d)._at_put_((1),(2));
  3389. $ctx1.sendIdx["at:put:"]=1;
  3390. _st(d)._at_put_((2),(3));
  3391. $ctx1.sendIdx["at:put:"]=2;
  3392. _st(d)._at_put_((3),(4));
  3393. key=(2);
  3394. self._assert_equals_(_st(d)._removeKey_(key),(3));
  3395. $ctx1.sendIdx["assert:equals:"]=1;
  3396. key=(3);
  3397. $1=_st(d)._removeKey_ifAbsent_(key,(function(){
  3398. return smalltalk.withContext(function($ctx2) {
  3399. return (42);
  3400. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3401. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  3402. self._assert_equals_($1,(4));
  3403. $ctx1.sendIdx["assert:equals:"]=2;
  3404. key="why";
  3405. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  3406. return smalltalk.withContext(function($ctx2) {
  3407. return (42);
  3408. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  3409. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  3410. args: [],
  3411. source: "testRemoveKeyIfAbsent\x0a\x09| d key |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09key := 2.\x0a\x09self assert: (d removeKey: key) equals: 3.\x0a\x0a\x09key := 3.\x0a\x09self assert: (d removeKey: key ifAbsent: [ 42 ]) equals: 4.\x0a\x0a\x09key := 'why'.\x0a\x09self assert: (d removeKey: key ifAbsent: [ 42 ] ) equals: 42.",
  3412. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  3413. referencedClasses: ["Dictionary"]
  3414. }),
  3415. smalltalk.DictionaryTest);
  3416. smalltalk.addMethod(
  3417. smalltalk.method({
  3418. selector: "testValues",
  3419. protocol: 'tests',
  3420. fn: function (){
  3421. var self=this;
  3422. var d;
  3423. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3424. return smalltalk.withContext(function($ctx1) {
  3425. d=_st($Dictionary())._new();
  3426. _st(d)._at_put_((1),(2));
  3427. $ctx1.sendIdx["at:put:"]=1;
  3428. _st(d)._at_put_((2),(3));
  3429. $ctx1.sendIdx["at:put:"]=2;
  3430. _st(d)._at_put_((3),(4));
  3431. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  3432. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  3433. args: [],
  3434. source: "testValues\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d values equals: #(2 3 4)",
  3435. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  3436. referencedClasses: ["Dictionary"]
  3437. }),
  3438. smalltalk.DictionaryTest);
  3439. smalltalk.addMethod(
  3440. smalltalk.method({
  3441. selector: "collectionClass",
  3442. protocol: 'fixture',
  3443. fn: function (){
  3444. var self=this;
  3445. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3446. return smalltalk.withContext(function($ctx1) {
  3447. return $Dictionary();
  3448. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  3449. args: [],
  3450. source: "collectionClass\x0a\x09^ Dictionary",
  3451. messageSends: [],
  3452. referencedClasses: ["Dictionary"]
  3453. }),
  3454. smalltalk.DictionaryTest.klass);
  3455. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  3456. smalltalk.addMethod(
  3457. smalltalk.method({
  3458. selector: "collectionFirst",
  3459. protocol: 'fixture',
  3460. fn: function (){
  3461. var self=this;
  3462. return smalltalk.withContext(function($ctx1) {
  3463. self._subclassResponsibility();
  3464. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.SequenceableCollectionTest)})},
  3465. args: [],
  3466. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3467. messageSends: ["subclassResponsibility"],
  3468. referencedClasses: []
  3469. }),
  3470. smalltalk.SequenceableCollectionTest);
  3471. smalltalk.addMethod(
  3472. smalltalk.method({
  3473. selector: "collectionFirstTwo",
  3474. protocol: 'fixture',
  3475. fn: function (){
  3476. var self=this;
  3477. return smalltalk.withContext(function($ctx1) {
  3478. self._subclassResponsibility();
  3479. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.SequenceableCollectionTest)})},
  3480. args: [],
  3481. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3482. messageSends: ["subclassResponsibility"],
  3483. referencedClasses: []
  3484. }),
  3485. smalltalk.SequenceableCollectionTest);
  3486. smalltalk.addMethod(
  3487. smalltalk.method({
  3488. selector: "collectionLast",
  3489. protocol: 'fixture',
  3490. fn: function (){
  3491. var self=this;
  3492. return smalltalk.withContext(function($ctx1) {
  3493. self._subclassResponsibility();
  3494. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.SequenceableCollectionTest)})},
  3495. args: [],
  3496. source: "collectionLast\x0a\x09self subclassResponsibility",
  3497. messageSends: ["subclassResponsibility"],
  3498. referencedClasses: []
  3499. }),
  3500. smalltalk.SequenceableCollectionTest);
  3501. smalltalk.addMethod(
  3502. smalltalk.method({
  3503. selector: "collectionLastTwo",
  3504. protocol: 'fixture',
  3505. fn: function (){
  3506. var self=this;
  3507. return smalltalk.withContext(function($ctx1) {
  3508. self._subclassResponsibility();
  3509. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.SequenceableCollectionTest)})},
  3510. args: [],
  3511. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3512. messageSends: ["subclassResponsibility"],
  3513. referencedClasses: []
  3514. }),
  3515. smalltalk.SequenceableCollectionTest);
  3516. smalltalk.addMethod(
  3517. smalltalk.method({
  3518. selector: "nonIndexesDo:",
  3519. protocol: 'fixture',
  3520. fn: function (aBlock){
  3521. var self=this;
  3522. return smalltalk.withContext(function($ctx1) {
  3523. _st(aBlock)._value_((0));
  3524. $ctx1.sendIdx["value:"]=1;
  3525. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3526. $ctx1.sendIdx["value:"]=2;
  3527. _st(aBlock)._value_("z");
  3528. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3529. args: ["aBlock"],
  3530. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3531. messageSends: ["value:", "+", "collectionSize"],
  3532. referencedClasses: []
  3533. }),
  3534. smalltalk.SequenceableCollectionTest);
  3535. smalltalk.addMethod(
  3536. smalltalk.method({
  3537. selector: "samplesDo:",
  3538. protocol: 'fixture',
  3539. fn: function (aBlock){
  3540. var self=this;
  3541. return smalltalk.withContext(function($ctx1) {
  3542. _st(aBlock)._value_value_((1),self._collectionFirst());
  3543. $ctx1.sendIdx["value:value:"]=1;
  3544. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3545. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3546. args: ["aBlock"],
  3547. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3548. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3549. referencedClasses: []
  3550. }),
  3551. smalltalk.SequenceableCollectionTest);
  3552. smalltalk.addMethod(
  3553. smalltalk.method({
  3554. selector: "testBeginsWith",
  3555. protocol: 'tests',
  3556. fn: function (){
  3557. var self=this;
  3558. return smalltalk.withContext(function($ctx1) {
  3559. var $2,$1,$4,$5,$3,$7,$6;
  3560. $2=self._collection();
  3561. $ctx1.sendIdx["collection"]=1;
  3562. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3563. $ctx1.sendIdx["beginsWith:"]=1;
  3564. self._assert_($1);
  3565. $ctx1.sendIdx["assert:"]=1;
  3566. $4=self._collection();
  3567. $ctx1.sendIdx["collection"]=2;
  3568. $5=self._collection();
  3569. $ctx1.sendIdx["collection"]=3;
  3570. $3=_st($4)._beginsWith_($5);
  3571. $ctx1.sendIdx["beginsWith:"]=2;
  3572. self._assert_($3);
  3573. $ctx1.sendIdx["assert:"]=2;
  3574. $7=self._collection();
  3575. $ctx1.sendIdx["collection"]=4;
  3576. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3577. $ctx1.sendIdx["beginsWith:"]=3;
  3578. self._assert_($6);
  3579. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3580. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  3581. args: [],
  3582. 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)",
  3583. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3584. referencedClasses: []
  3585. }),
  3586. smalltalk.SequenceableCollectionTest);
  3587. smalltalk.addMethod(
  3588. smalltalk.method({
  3589. selector: "testEndsWith",
  3590. protocol: 'tests',
  3591. fn: function (){
  3592. var self=this;
  3593. return smalltalk.withContext(function($ctx1) {
  3594. var $2,$1,$4,$5,$3,$7,$6;
  3595. $2=self._collection();
  3596. $ctx1.sendIdx["collection"]=1;
  3597. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3598. $ctx1.sendIdx["endsWith:"]=1;
  3599. self._assert_($1);
  3600. $ctx1.sendIdx["assert:"]=1;
  3601. $4=self._collection();
  3602. $ctx1.sendIdx["collection"]=2;
  3603. $5=self._collection();
  3604. $ctx1.sendIdx["collection"]=3;
  3605. $3=_st($4)._endsWith_($5);
  3606. $ctx1.sendIdx["endsWith:"]=2;
  3607. self._assert_($3);
  3608. $ctx1.sendIdx["assert:"]=2;
  3609. $7=self._collection();
  3610. $ctx1.sendIdx["collection"]=4;
  3611. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3612. $ctx1.sendIdx["endsWith:"]=3;
  3613. self._assert_($6);
  3614. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3615. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  3616. args: [],
  3617. 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)",
  3618. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3619. referencedClasses: []
  3620. }),
  3621. smalltalk.SequenceableCollectionTest);
  3622. smalltalk.addMethod(
  3623. smalltalk.method({
  3624. selector: "testFirst",
  3625. protocol: 'tests',
  3626. fn: function (){
  3627. var self=this;
  3628. return smalltalk.withContext(function($ctx1) {
  3629. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3630. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  3631. args: [],
  3632. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3633. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3634. referencedClasses: []
  3635. }),
  3636. smalltalk.SequenceableCollectionTest);
  3637. smalltalk.addMethod(
  3638. smalltalk.method({
  3639. selector: "testFirstN",
  3640. protocol: 'tests',
  3641. fn: function (){
  3642. var self=this;
  3643. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3644. return smalltalk.withContext(function($ctx1) {
  3645. var $2,$1,$4,$3,$6,$5,$7;
  3646. $2=self._collection();
  3647. $ctx1.sendIdx["collection"]=1;
  3648. $1=_st($2)._first_((2));
  3649. $ctx1.sendIdx["first:"]=1;
  3650. self._assert_equals_($1,self._collectionFirstTwo());
  3651. $ctx1.sendIdx["assert:equals:"]=1;
  3652. $4=self._collection();
  3653. $ctx1.sendIdx["collection"]=2;
  3654. $3=_st($4)._first_((0));
  3655. $ctx1.sendIdx["first:"]=2;
  3656. self._assert_equals_($3,_st(self._collectionClass())._new());
  3657. $ctx1.sendIdx["assert:equals:"]=2;
  3658. $6=self._collection();
  3659. $ctx1.sendIdx["collection"]=3;
  3660. $5=_st($6)._first_(self._collectionSize());
  3661. $ctx1.sendIdx["first:"]=3;
  3662. $7=self._collection();
  3663. $ctx1.sendIdx["collection"]=4;
  3664. self._assert_equals_($5,$7);
  3665. self._should_raise_((function(){
  3666. return smalltalk.withContext(function($ctx2) {
  3667. return _st(self._collection())._first_((33));
  3668. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3669. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  3670. args: [],
  3671. 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",
  3672. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3673. referencedClasses: ["Error"]
  3674. }),
  3675. smalltalk.SequenceableCollectionTest);
  3676. smalltalk.addMethod(
  3677. smalltalk.method({
  3678. selector: "testFourth",
  3679. protocol: 'tests',
  3680. fn: function (){
  3681. var self=this;
  3682. return smalltalk.withContext(function($ctx1) {
  3683. var $2,$1;
  3684. $2=self._collection();
  3685. $ctx1.sendIdx["collection"]=1;
  3686. $1=_st($2)._fourth();
  3687. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3688. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  3689. args: [],
  3690. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3691. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3692. referencedClasses: []
  3693. }),
  3694. smalltalk.SequenceableCollectionTest);
  3695. smalltalk.addMethod(
  3696. smalltalk.method({
  3697. selector: "testLast",
  3698. protocol: 'tests',
  3699. fn: function (){
  3700. var self=this;
  3701. return smalltalk.withContext(function($ctx1) {
  3702. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3703. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  3704. args: [],
  3705. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3706. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3707. referencedClasses: []
  3708. }),
  3709. smalltalk.SequenceableCollectionTest);
  3710. smalltalk.addMethod(
  3711. smalltalk.method({
  3712. selector: "testLastN",
  3713. protocol: 'tests',
  3714. fn: function (){
  3715. var self=this;
  3716. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3717. return smalltalk.withContext(function($ctx1) {
  3718. var $2,$1,$4,$3,$6,$5,$7;
  3719. $2=self._collection();
  3720. $ctx1.sendIdx["collection"]=1;
  3721. $1=_st($2)._last_((2));
  3722. $ctx1.sendIdx["last:"]=1;
  3723. self._assert_equals_($1,self._collectionLastTwo());
  3724. $ctx1.sendIdx["assert:equals:"]=1;
  3725. $4=self._collection();
  3726. $ctx1.sendIdx["collection"]=2;
  3727. $3=_st($4)._last_((0));
  3728. $ctx1.sendIdx["last:"]=2;
  3729. self._assert_equals_($3,_st(self._collectionClass())._new());
  3730. $ctx1.sendIdx["assert:equals:"]=2;
  3731. $6=self._collection();
  3732. $ctx1.sendIdx["collection"]=3;
  3733. $5=_st($6)._last_(self._collectionSize());
  3734. $ctx1.sendIdx["last:"]=3;
  3735. $7=self._collection();
  3736. $ctx1.sendIdx["collection"]=4;
  3737. self._assert_equals_($5,$7);
  3738. self._should_raise_((function(){
  3739. return smalltalk.withContext(function($ctx2) {
  3740. return _st(self._collection())._last_((33));
  3741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3742. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  3743. args: [],
  3744. 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",
  3745. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3746. referencedClasses: ["Error"]
  3747. }),
  3748. smalltalk.SequenceableCollectionTest);
  3749. smalltalk.addMethod(
  3750. smalltalk.method({
  3751. selector: "testSecond",
  3752. protocol: 'tests',
  3753. fn: function (){
  3754. var self=this;
  3755. return smalltalk.withContext(function($ctx1) {
  3756. var $2,$1;
  3757. $2=self._collection();
  3758. $ctx1.sendIdx["collection"]=1;
  3759. $1=_st($2)._second();
  3760. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3761. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  3762. args: [],
  3763. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3764. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3765. referencedClasses: []
  3766. }),
  3767. smalltalk.SequenceableCollectionTest);
  3768. smalltalk.addMethod(
  3769. smalltalk.method({
  3770. selector: "testThird",
  3771. protocol: 'tests',
  3772. fn: function (){
  3773. var self=this;
  3774. return smalltalk.withContext(function($ctx1) {
  3775. var $2,$1;
  3776. $2=self._collection();
  3777. $ctx1.sendIdx["collection"]=1;
  3778. $1=_st($2)._third();
  3779. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3780. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  3781. args: [],
  3782. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3783. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3784. referencedClasses: []
  3785. }),
  3786. smalltalk.SequenceableCollectionTest);
  3787. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3788. smalltalk.addMethod(
  3789. smalltalk.method({
  3790. selector: "collection",
  3791. protocol: 'fixture',
  3792. fn: function (){
  3793. var self=this;
  3794. return smalltalk.withContext(function($ctx1) {
  3795. var $1;
  3796. $1=[(1), (2), (3), (-4)];
  3797. return $1;
  3798. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  3799. args: [],
  3800. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3801. messageSends: [],
  3802. referencedClasses: []
  3803. }),
  3804. smalltalk.ArrayTest);
  3805. smalltalk.addMethod(
  3806. smalltalk.method({
  3807. selector: "collectionFirst",
  3808. protocol: 'fixture',
  3809. fn: function (){
  3810. var self=this;
  3811. return smalltalk.withContext(function($ctx1) {
  3812. return (1);
  3813. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.ArrayTest)})},
  3814. args: [],
  3815. source: "collectionFirst\x0a\x09^ 1",
  3816. messageSends: [],
  3817. referencedClasses: []
  3818. }),
  3819. smalltalk.ArrayTest);
  3820. smalltalk.addMethod(
  3821. smalltalk.method({
  3822. selector: "collectionFirstTwo",
  3823. protocol: 'fixture',
  3824. fn: function (){
  3825. var self=this;
  3826. return smalltalk.withContext(function($ctx1) {
  3827. var $1;
  3828. $1=[(1), (2)];
  3829. return $1;
  3830. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.ArrayTest)})},
  3831. args: [],
  3832. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3833. messageSends: [],
  3834. referencedClasses: []
  3835. }),
  3836. smalltalk.ArrayTest);
  3837. smalltalk.addMethod(
  3838. smalltalk.method({
  3839. selector: "collectionLast",
  3840. protocol: 'fixture',
  3841. fn: function (){
  3842. var self=this;
  3843. return smalltalk.withContext(function($ctx1) {
  3844. return (-4);
  3845. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.ArrayTest)})},
  3846. args: [],
  3847. source: "collectionLast\x0a\x09^ -4",
  3848. messageSends: [],
  3849. referencedClasses: []
  3850. }),
  3851. smalltalk.ArrayTest);
  3852. smalltalk.addMethod(
  3853. smalltalk.method({
  3854. selector: "collectionLastTwo",
  3855. protocol: 'fixture',
  3856. fn: function (){
  3857. var self=this;
  3858. return smalltalk.withContext(function($ctx1) {
  3859. var $1;
  3860. $1=[(3), (-4)];
  3861. return $1;
  3862. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.ArrayTest)})},
  3863. args: [],
  3864. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3865. messageSends: [],
  3866. referencedClasses: []
  3867. }),
  3868. smalltalk.ArrayTest);
  3869. smalltalk.addMethod(
  3870. smalltalk.method({
  3871. selector: "collectionOfPrintStrings",
  3872. protocol: 'fixture',
  3873. fn: function (){
  3874. var self=this;
  3875. return smalltalk.withContext(function($ctx1) {
  3876. var $1;
  3877. $1=["1", "2", "3", "-4"];
  3878. return $1;
  3879. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.ArrayTest)})},
  3880. args: [],
  3881. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  3882. messageSends: [],
  3883. referencedClasses: []
  3884. }),
  3885. smalltalk.ArrayTest);
  3886. smalltalk.addMethod(
  3887. smalltalk.method({
  3888. selector: "collectionSize",
  3889. protocol: 'fixture',
  3890. fn: function (){
  3891. var self=this;
  3892. return smalltalk.withContext(function($ctx1) {
  3893. return (4);
  3894. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.ArrayTest)})},
  3895. args: [],
  3896. source: "collectionSize\x0a\x09^ 4",
  3897. messageSends: [],
  3898. referencedClasses: []
  3899. }),
  3900. smalltalk.ArrayTest);
  3901. smalltalk.addMethod(
  3902. smalltalk.method({
  3903. selector: "collectionWithDuplicates",
  3904. protocol: 'fixture',
  3905. fn: function (){
  3906. var self=this;
  3907. return smalltalk.withContext(function($ctx1) {
  3908. var $1;
  3909. $1=["a", "b", "c", (1), (2), (1), "a"];
  3910. return $1;
  3911. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  3912. args: [],
  3913. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  3914. messageSends: [],
  3915. referencedClasses: []
  3916. }),
  3917. smalltalk.ArrayTest);
  3918. smalltalk.addMethod(
  3919. smalltalk.method({
  3920. selector: "collectionWithNewValue",
  3921. protocol: 'fixture',
  3922. fn: function (){
  3923. var self=this;
  3924. return smalltalk.withContext(function($ctx1) {
  3925. var $1;
  3926. $1=[(1), (2), (3), (-4), "N"];
  3927. return $1;
  3928. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.ArrayTest)})},
  3929. args: [],
  3930. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  3931. messageSends: [],
  3932. referencedClasses: []
  3933. }),
  3934. smalltalk.ArrayTest);
  3935. smalltalk.addMethod(
  3936. smalltalk.method({
  3937. selector: "sampleNewIndex",
  3938. protocol: 'fixture',
  3939. fn: function (){
  3940. var self=this;
  3941. return smalltalk.withContext(function($ctx1) {
  3942. return (5);
  3943. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.ArrayTest)})},
  3944. args: [],
  3945. source: "sampleNewIndex\x0a\x09^ 5",
  3946. messageSends: [],
  3947. referencedClasses: []
  3948. }),
  3949. smalltalk.ArrayTest);
  3950. smalltalk.addMethod(
  3951. smalltalk.method({
  3952. selector: "samplesDo:",
  3953. protocol: 'fixture',
  3954. fn: function (aBlock){
  3955. var self=this;
  3956. return smalltalk.withContext(function($ctx1) {
  3957. smalltalk.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3958. _st(aBlock)._value_value_((3),(3));
  3959. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.ArrayTest)})},
  3960. args: ["aBlock"],
  3961. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  3962. messageSends: ["samplesDo:", "value:value:"],
  3963. referencedClasses: []
  3964. }),
  3965. smalltalk.ArrayTest);
  3966. smalltalk.addMethod(
  3967. smalltalk.method({
  3968. selector: "testAdd",
  3969. protocol: 'tests',
  3970. fn: function (){
  3971. var self=this;
  3972. var array;
  3973. return smalltalk.withContext(function($ctx1) {
  3974. array=self._collection();
  3975. _st(array)._add_((6));
  3976. self._assert_equals_(_st(array)._last(),(6));
  3977. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  3978. args: [],
  3979. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  3980. messageSends: ["collection", "add:", "assert:equals:", "last"],
  3981. referencedClasses: []
  3982. }),
  3983. smalltalk.ArrayTest);
  3984. smalltalk.addMethod(
  3985. smalltalk.method({
  3986. selector: "testAddFirst",
  3987. protocol: 'tests',
  3988. fn: function (){
  3989. var self=this;
  3990. return smalltalk.withContext(function($ctx1) {
  3991. var $1,$2;
  3992. $1=self._collection();
  3993. _st($1)._addFirst_((0));
  3994. $2=_st($1)._yourself();
  3995. self._assert_equals_(_st($2)._first(),(0));
  3996. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  3997. args: [],
  3998. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  3999. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4000. referencedClasses: []
  4001. }),
  4002. smalltalk.ArrayTest);
  4003. smalltalk.addMethod(
  4004. smalltalk.method({
  4005. selector: "testPrintString",
  4006. protocol: 'tests',
  4007. fn: function (){
  4008. var self=this;
  4009. var array;
  4010. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4011. return smalltalk.withContext(function($ctx1) {
  4012. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4013. array=_st($Array())._new();
  4014. $1=_st(array)._printString();
  4015. $ctx1.sendIdx["printString"]=1;
  4016. self._assert_equals_($1,"an Array ()");
  4017. $ctx1.sendIdx["assert:equals:"]=1;
  4018. $2=array;
  4019. _st($2)._add_((1));
  4020. $ctx1.sendIdx["add:"]=1;
  4021. $3=_st($2)._add_((3));
  4022. $ctx1.sendIdx["add:"]=2;
  4023. $4=_st(array)._printString();
  4024. $ctx1.sendIdx["printString"]=2;
  4025. self._assert_equals_($4,"an Array (1 3)");
  4026. $ctx1.sendIdx["assert:equals:"]=2;
  4027. _st(array)._add_("foo");
  4028. $5=_st(array)._printString();
  4029. $ctx1.sendIdx["printString"]=3;
  4030. self._assert_equals_($5,"an Array (1 3 'foo')");
  4031. $ctx1.sendIdx["assert:equals:"]=3;
  4032. $6=array;
  4033. _st($6)._remove_((1));
  4034. $ctx1.sendIdx["remove:"]=1;
  4035. $7=_st($6)._remove_((3));
  4036. $8=_st(array)._printString();
  4037. $ctx1.sendIdx["printString"]=4;
  4038. self._assert_equals_($8,"an Array ('foo')");
  4039. $ctx1.sendIdx["assert:equals:"]=4;
  4040. _st(array)._addLast_((3));
  4041. $ctx1.sendIdx["addLast:"]=1;
  4042. $9=_st(array)._printString();
  4043. $ctx1.sendIdx["printString"]=5;
  4044. self._assert_equals_($9,"an Array ('foo' 3)");
  4045. $ctx1.sendIdx["assert:equals:"]=5;
  4046. _st(array)._addLast_((3));
  4047. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4048. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  4049. args: [],
  4050. 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)'.",
  4051. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4052. referencedClasses: ["Array"]
  4053. }),
  4054. smalltalk.ArrayTest);
  4055. smalltalk.addMethod(
  4056. smalltalk.method({
  4057. selector: "testRemove",
  4058. protocol: 'tests',
  4059. fn: function (){
  4060. var self=this;
  4061. var array;
  4062. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4063. return smalltalk.withContext(function($ctx1) {
  4064. array=[(1), (2), (3), (4), (5)];
  4065. _st(array)._remove_((3));
  4066. $ctx1.sendIdx["remove:"]=1;
  4067. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4068. self._should_raise_((function(){
  4069. return smalltalk.withContext(function($ctx2) {
  4070. return _st(array)._remove_((3));
  4071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4072. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  4073. args: [],
  4074. 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",
  4075. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4076. referencedClasses: ["Error"]
  4077. }),
  4078. smalltalk.ArrayTest);
  4079. smalltalk.addMethod(
  4080. smalltalk.method({
  4081. selector: "testRemoveFromTo",
  4082. protocol: 'tests',
  4083. fn: function (){
  4084. var self=this;
  4085. return smalltalk.withContext(function($ctx1) {
  4086. var $1,$2;
  4087. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4088. $ctx1.sendIdx["removeFrom:to:"]=1;
  4089. self._assert_equals_($1,[(4)]);
  4090. $ctx1.sendIdx["assert:equals:"]=1;
  4091. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4092. $ctx1.sendIdx["removeFrom:to:"]=2;
  4093. self._assert_equals_($2,[(1), (4)]);
  4094. $ctx1.sendIdx["assert:equals:"]=2;
  4095. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4096. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  4097. args: [],
  4098. 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)",
  4099. messageSends: ["assert:equals:", "removeFrom:to:"],
  4100. referencedClasses: []
  4101. }),
  4102. smalltalk.ArrayTest);
  4103. smalltalk.addMethod(
  4104. smalltalk.method({
  4105. selector: "testRemoveIndex",
  4106. protocol: 'tests',
  4107. fn: function (){
  4108. var self=this;
  4109. return smalltalk.withContext(function($ctx1) {
  4110. var $1,$2;
  4111. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4112. $ctx1.sendIdx["removeIndex:"]=1;
  4113. self._assert_equals_($1,[(1), (3), (4)]);
  4114. $ctx1.sendIdx["assert:equals:"]=1;
  4115. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4116. $ctx1.sendIdx["removeIndex:"]=2;
  4117. self._assert_equals_($2,[(2), (3), (4)]);
  4118. $ctx1.sendIdx["assert:equals:"]=2;
  4119. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4120. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  4121. args: [],
  4122. 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: #()",
  4123. messageSends: ["assert:equals:", "removeIndex:"],
  4124. referencedClasses: []
  4125. }),
  4126. smalltalk.ArrayTest);
  4127. smalltalk.addMethod(
  4128. smalltalk.method({
  4129. selector: "testRemoveLast",
  4130. protocol: 'tests',
  4131. fn: function (){
  4132. var self=this;
  4133. var array;
  4134. return smalltalk.withContext(function($ctx1) {
  4135. array=[(1), (2)];
  4136. _st(array)._removeLast();
  4137. self._assert_equals_(_st(array)._last(),(1));
  4138. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  4139. args: [],
  4140. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4141. messageSends: ["removeLast", "assert:equals:", "last"],
  4142. referencedClasses: []
  4143. }),
  4144. smalltalk.ArrayTest);
  4145. smalltalk.addMethod(
  4146. smalltalk.method({
  4147. selector: "testReversed",
  4148. protocol: 'tests',
  4149. fn: function (){
  4150. var self=this;
  4151. var array;
  4152. return smalltalk.withContext(function($ctx1) {
  4153. array=[(5), (4), (3), (2), (1)];
  4154. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4155. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  4156. args: [],
  4157. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4158. messageSends: ["assert:equals:", "reversed"],
  4159. referencedClasses: []
  4160. }),
  4161. smalltalk.ArrayTest);
  4162. smalltalk.addMethod(
  4163. smalltalk.method({
  4164. selector: "testSort",
  4165. protocol: 'tests',
  4166. fn: function (){
  4167. var self=this;
  4168. var array;
  4169. return smalltalk.withContext(function($ctx1) {
  4170. array=[(3), (1), (4), (5), (2)];
  4171. _st(array)._sort();
  4172. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  4173. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  4174. args: [],
  4175. 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)",
  4176. messageSends: ["sort", "assert:equals:"],
  4177. referencedClasses: []
  4178. }),
  4179. smalltalk.ArrayTest);
  4180. smalltalk.addMethod(
  4181. smalltalk.method({
  4182. selector: "collectionClass",
  4183. protocol: 'fixture',
  4184. fn: function (){
  4185. var self=this;
  4186. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4187. return smalltalk.withContext(function($ctx1) {
  4188. return $Array();
  4189. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  4190. args: [],
  4191. source: "collectionClass\x0a\x09^ Array",
  4192. messageSends: [],
  4193. referencedClasses: ["Array"]
  4194. }),
  4195. smalltalk.ArrayTest.klass);
  4196. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  4197. smalltalk.addMethod(
  4198. smalltalk.method({
  4199. selector: "collection",
  4200. protocol: 'fixture',
  4201. fn: function (){
  4202. var self=this;
  4203. return smalltalk.withContext(function($ctx1) {
  4204. return "hello";
  4205. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  4206. args: [],
  4207. source: "collection\x0a\x09^ 'hello'",
  4208. messageSends: [],
  4209. referencedClasses: []
  4210. }),
  4211. smalltalk.StringTest);
  4212. smalltalk.addMethod(
  4213. smalltalk.method({
  4214. selector: "collectionFirst",
  4215. protocol: 'fixture',
  4216. fn: function (){
  4217. var self=this;
  4218. return smalltalk.withContext(function($ctx1) {
  4219. return "h";
  4220. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.StringTest)})},
  4221. args: [],
  4222. source: "collectionFirst\x0a\x09^ 'h'",
  4223. messageSends: [],
  4224. referencedClasses: []
  4225. }),
  4226. smalltalk.StringTest);
  4227. smalltalk.addMethod(
  4228. smalltalk.method({
  4229. selector: "collectionFirstTwo",
  4230. protocol: 'fixture',
  4231. fn: function (){
  4232. var self=this;
  4233. return smalltalk.withContext(function($ctx1) {
  4234. return "he";
  4235. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.StringTest)})},
  4236. args: [],
  4237. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4238. messageSends: [],
  4239. referencedClasses: []
  4240. }),
  4241. smalltalk.StringTest);
  4242. smalltalk.addMethod(
  4243. smalltalk.method({
  4244. selector: "collectionLast",
  4245. protocol: 'fixture',
  4246. fn: function (){
  4247. var self=this;
  4248. return smalltalk.withContext(function($ctx1) {
  4249. return "o";
  4250. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.StringTest)})},
  4251. args: [],
  4252. source: "collectionLast\x0a\x09^ 'o'",
  4253. messageSends: [],
  4254. referencedClasses: []
  4255. }),
  4256. smalltalk.StringTest);
  4257. smalltalk.addMethod(
  4258. smalltalk.method({
  4259. selector: "collectionLastTwo",
  4260. protocol: 'fixture',
  4261. fn: function (){
  4262. var self=this;
  4263. return smalltalk.withContext(function($ctx1) {
  4264. return "lo";
  4265. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.StringTest)})},
  4266. args: [],
  4267. source: "collectionLastTwo\x0a\x09^ 'lo'",
  4268. messageSends: [],
  4269. referencedClasses: []
  4270. }),
  4271. smalltalk.StringTest);
  4272. smalltalk.addMethod(
  4273. smalltalk.method({
  4274. selector: "collectionOfPrintStrings",
  4275. protocol: 'fixture',
  4276. fn: function (){
  4277. var self=this;
  4278. return smalltalk.withContext(function($ctx1) {
  4279. return "'h''e''l''l''o'";
  4280. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.StringTest)})},
  4281. args: [],
  4282. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''l''''o'''",
  4283. messageSends: [],
  4284. referencedClasses: []
  4285. }),
  4286. smalltalk.StringTest);
  4287. smalltalk.addMethod(
  4288. smalltalk.method({
  4289. selector: "collectionSize",
  4290. protocol: 'fixture',
  4291. fn: function (){
  4292. var self=this;
  4293. return smalltalk.withContext(function($ctx1) {
  4294. return (5);
  4295. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.StringTest)})},
  4296. args: [],
  4297. source: "collectionSize\x0a\x09^ 5",
  4298. messageSends: [],
  4299. referencedClasses: []
  4300. }),
  4301. smalltalk.StringTest);
  4302. smalltalk.addMethod(
  4303. smalltalk.method({
  4304. selector: "collectionWithDuplicates",
  4305. protocol: 'fixture',
  4306. fn: function (){
  4307. var self=this;
  4308. return smalltalk.withContext(function($ctx1) {
  4309. return "abbaerte";
  4310. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  4311. args: [],
  4312. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4313. messageSends: [],
  4314. referencedClasses: []
  4315. }),
  4316. smalltalk.StringTest);
  4317. smalltalk.addMethod(
  4318. smalltalk.method({
  4319. selector: "collectionWithNewValue",
  4320. protocol: 'fixture',
  4321. fn: function (){
  4322. var self=this;
  4323. return smalltalk.withContext(function($ctx1) {
  4324. return "helloN";
  4325. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.StringTest)})},
  4326. args: [],
  4327. source: "collectionWithNewValue\x0a\x09^ 'helloN'",
  4328. messageSends: [],
  4329. referencedClasses: []
  4330. }),
  4331. smalltalk.StringTest);
  4332. smalltalk.addMethod(
  4333. smalltalk.method({
  4334. selector: "sampleNewValueAsCollection",
  4335. protocol: 'fixture',
  4336. fn: function (){
  4337. var self=this;
  4338. return smalltalk.withContext(function($ctx1) {
  4339. return "N";
  4340. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.StringTest)})},
  4341. args: [],
  4342. source: "sampleNewValueAsCollection\x0a\x09\x0a\x09^ 'N'",
  4343. messageSends: [],
  4344. referencedClasses: []
  4345. }),
  4346. smalltalk.StringTest);
  4347. smalltalk.addMethod(
  4348. smalltalk.method({
  4349. selector: "samplesDo:",
  4350. protocol: 'fixture',
  4351. fn: function (aBlock){
  4352. var self=this;
  4353. return smalltalk.withContext(function($ctx1) {
  4354. smalltalk.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4355. _st(aBlock)._value_value_((3),"l");
  4356. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.StringTest)})},
  4357. args: ["aBlock"],
  4358. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4359. messageSends: ["samplesDo:", "value:value:"],
  4360. referencedClasses: []
  4361. }),
  4362. smalltalk.StringTest);
  4363. smalltalk.addMethod(
  4364. smalltalk.method({
  4365. selector: "testAddAll",
  4366. protocol: 'tests',
  4367. fn: function (){
  4368. var self=this;
  4369. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4370. return smalltalk.withContext(function($ctx1) {
  4371. var $1;
  4372. self._should_raise_((function(){
  4373. return smalltalk.withContext(function($ctx2) {
  4374. $1=self._collection();
  4375. $ctx2.sendIdx["collection"]=1;
  4376. return _st($1)._addAll_(self._collection());
  4377. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4378. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.StringTest)})},
  4379. args: [],
  4380. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4381. messageSends: ["should:raise:", "addAll:", "collection"],
  4382. referencedClasses: ["Error"]
  4383. }),
  4384. smalltalk.StringTest);
  4385. smalltalk.addMethod(
  4386. smalltalk.method({
  4387. selector: "testAddRemove",
  4388. protocol: 'tests',
  4389. fn: function (){
  4390. var self=this;
  4391. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4392. return smalltalk.withContext(function($ctx1) {
  4393. self._should_raise_((function(){
  4394. return smalltalk.withContext(function($ctx2) {
  4395. return "hello"._add_("a");
  4396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4397. $ctx1.sendIdx["should:raise:"]=1;
  4398. self._should_raise_((function(){
  4399. return smalltalk.withContext(function($ctx2) {
  4400. return "hello"._remove_("h");
  4401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4402. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  4403. args: [],
  4404. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4405. messageSends: ["should:raise:", "add:", "remove:"],
  4406. referencedClasses: ["Error"]
  4407. }),
  4408. smalltalk.StringTest);
  4409. smalltalk.addMethod(
  4410. smalltalk.method({
  4411. selector: "testAsArray",
  4412. protocol: 'tests',
  4413. fn: function (){
  4414. var self=this;
  4415. return smalltalk.withContext(function($ctx1) {
  4416. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4417. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  4418. args: [],
  4419. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4420. messageSends: ["assert:equals:", "asArray"],
  4421. referencedClasses: []
  4422. }),
  4423. smalltalk.StringTest);
  4424. smalltalk.addMethod(
  4425. smalltalk.method({
  4426. selector: "testAsLowerCase",
  4427. protocol: 'tests',
  4428. fn: function (){
  4429. var self=this;
  4430. return smalltalk.withContext(function($ctx1) {
  4431. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4432. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  4433. args: [],
  4434. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4435. messageSends: ["assert:equals:", "asLowercase"],
  4436. referencedClasses: []
  4437. }),
  4438. smalltalk.StringTest);
  4439. smalltalk.addMethod(
  4440. smalltalk.method({
  4441. selector: "testAsNumber",
  4442. protocol: 'tests',
  4443. fn: function (){
  4444. var self=this;
  4445. return smalltalk.withContext(function($ctx1) {
  4446. var $1,$2;
  4447. $1="3"._asNumber();
  4448. $ctx1.sendIdx["asNumber"]=1;
  4449. self._assert_equals_($1,(3));
  4450. $ctx1.sendIdx["assert:equals:"]=1;
  4451. $2="-3"._asNumber();
  4452. $ctx1.sendIdx["asNumber"]=2;
  4453. self._assert_equals_($2,(-3));
  4454. $ctx1.sendIdx["assert:equals:"]=2;
  4455. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4456. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  4457. args: [],
  4458. 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.",
  4459. messageSends: ["assert:equals:", "asNumber"],
  4460. referencedClasses: []
  4461. }),
  4462. smalltalk.StringTest);
  4463. smalltalk.addMethod(
  4464. smalltalk.method({
  4465. selector: "testAsUpperCase",
  4466. protocol: 'tests',
  4467. fn: function (){
  4468. var self=this;
  4469. return smalltalk.withContext(function($ctx1) {
  4470. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4471. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  4472. args: [],
  4473. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4474. messageSends: ["assert:equals:", "asUppercase"],
  4475. referencedClasses: []
  4476. }),
  4477. smalltalk.StringTest);
  4478. smalltalk.addMethod(
  4479. smalltalk.method({
  4480. selector: "testAsciiValue",
  4481. protocol: 'tests',
  4482. fn: function (){
  4483. var self=this;
  4484. var characterA,characterU;
  4485. return smalltalk.withContext(function($ctx1) {
  4486. var $1;
  4487. characterA="A";
  4488. characterU="U";
  4489. $1=_st(characterA)._asciiValue();
  4490. $ctx1.sendIdx["asciiValue"]=1;
  4491. self._assert_equals_($1,(65));
  4492. $ctx1.sendIdx["assert:equals:"]=1;
  4493. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4494. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  4495. args: [],
  4496. 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",
  4497. messageSends: ["assert:equals:", "asciiValue"],
  4498. referencedClasses: []
  4499. }),
  4500. smalltalk.StringTest);
  4501. smalltalk.addMethod(
  4502. smalltalk.method({
  4503. selector: "testAtIfAbsentPut",
  4504. protocol: 'tests',
  4505. fn: function (){
  4506. var self=this;
  4507. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4508. return smalltalk.withContext(function($ctx1) {
  4509. self._should_raise_((function(){
  4510. return smalltalk.withContext(function($ctx2) {
  4511. return "hello"._at_ifAbsentPut_((6),(function(){
  4512. return smalltalk.withContext(function($ctx3) {
  4513. return "a";
  4514. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  4515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4516. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},smalltalk.StringTest)})},
  4517. args: [],
  4518. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4519. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4520. referencedClasses: ["Error"]
  4521. }),
  4522. smalltalk.StringTest);
  4523. smalltalk.addMethod(
  4524. smalltalk.method({
  4525. selector: "testAtPut",
  4526. protocol: 'tests',
  4527. fn: function (){
  4528. var self=this;
  4529. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4530. return smalltalk.withContext(function($ctx1) {
  4531. self._should_raise_((function(){
  4532. return smalltalk.withContext(function($ctx2) {
  4533. return "hello"._at_put_((1),"a");
  4534. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4535. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  4536. args: [],
  4537. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4538. messageSends: ["should:raise:", "at:put:"],
  4539. referencedClasses: ["Error"]
  4540. }),
  4541. smalltalk.StringTest);
  4542. smalltalk.addMethod(
  4543. smalltalk.method({
  4544. selector: "testCapitalized",
  4545. protocol: 'tests',
  4546. fn: function (){
  4547. var self=this;
  4548. return smalltalk.withContext(function($ctx1) {
  4549. var $1,$2,$3;
  4550. $1="test"._capitalized();
  4551. $ctx1.sendIdx["capitalized"]=1;
  4552. self._assert_equals_($1,"Test");
  4553. $ctx1.sendIdx["assert:equals:"]=1;
  4554. $2="Test"._capitalized();
  4555. $ctx1.sendIdx["capitalized"]=2;
  4556. self._assert_equals_($2,"Test");
  4557. $ctx1.sendIdx["assert:equals:"]=2;
  4558. self._assert_equals_(""._capitalized(),"");
  4559. $ctx1.sendIdx["assert:equals:"]=3;
  4560. $3="Test"._isCapitalized();
  4561. $ctx1.sendIdx["isCapitalized"]=1;
  4562. self._assert_equals_($3,true);
  4563. $ctx1.sendIdx["assert:equals:"]=4;
  4564. self._assert_equals_("test"._isCapitalized(),false);
  4565. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  4566. args: [],
  4567. 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.",
  4568. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4569. referencedClasses: []
  4570. }),
  4571. smalltalk.StringTest);
  4572. smalltalk.addMethod(
  4573. smalltalk.method({
  4574. selector: "testCharCodeAt",
  4575. protocol: 'tests',
  4576. fn: function (){
  4577. var self=this;
  4578. return smalltalk.withContext(function($ctx1) {
  4579. var $1,$2,$3,$4,$5;
  4580. $1="jackie"._charCodeAt_((1));
  4581. $ctx1.sendIdx["charCodeAt:"]=1;
  4582. self._assert_equals_($1,(106));
  4583. $ctx1.sendIdx["assert:equals:"]=1;
  4584. $2="jackie"._charCodeAt_((2));
  4585. $ctx1.sendIdx["charCodeAt:"]=2;
  4586. self._assert_equals_($2,(97));
  4587. $ctx1.sendIdx["assert:equals:"]=2;
  4588. $3="jackie"._charCodeAt_((3));
  4589. $ctx1.sendIdx["charCodeAt:"]=3;
  4590. self._assert_equals_($3,(99));
  4591. $ctx1.sendIdx["assert:equals:"]=3;
  4592. $4="jackie"._charCodeAt_((4));
  4593. $ctx1.sendIdx["charCodeAt:"]=4;
  4594. self._assert_equals_($4,(107));
  4595. $ctx1.sendIdx["assert:equals:"]=4;
  4596. $5="jackie"._charCodeAt_((5));
  4597. $ctx1.sendIdx["charCodeAt:"]=5;
  4598. self._assert_equals_($5,(105));
  4599. $ctx1.sendIdx["assert:equals:"]=5;
  4600. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4601. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  4602. args: [],
  4603. 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",
  4604. messageSends: ["assert:equals:", "charCodeAt:"],
  4605. referencedClasses: []
  4606. }),
  4607. smalltalk.StringTest);
  4608. smalltalk.addMethod(
  4609. smalltalk.method({
  4610. selector: "testCopyFromTo",
  4611. protocol: 'tests',
  4612. fn: function (){
  4613. var self=this;
  4614. return smalltalk.withContext(function($ctx1) {
  4615. var $1;
  4616. $1="jackie"._copyFrom_to_((1),(3));
  4617. $ctx1.sendIdx["copyFrom:to:"]=1;
  4618. self._assert_equals_($1,"jac");
  4619. $ctx1.sendIdx["assert:equals:"]=1;
  4620. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4621. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  4622. args: [],
  4623. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4624. messageSends: ["assert:equals:", "copyFrom:to:"],
  4625. referencedClasses: []
  4626. }),
  4627. smalltalk.StringTest);
  4628. smalltalk.addMethod(
  4629. smalltalk.method({
  4630. selector: "testCopyWithoutAll",
  4631. protocol: 'tests',
  4632. fn: function (){
  4633. var self=this;
  4634. return smalltalk.withContext(function($ctx1) {
  4635. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4636. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  4637. args: [],
  4638. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4639. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4640. referencedClasses: []
  4641. }),
  4642. smalltalk.StringTest);
  4643. smalltalk.addMethod(
  4644. smalltalk.method({
  4645. selector: "testEquality",
  4646. protocol: 'tests',
  4647. fn: function (){
  4648. var self=this;
  4649. return smalltalk.withContext(function($ctx1) {
  4650. var $1,$2,$3;
  4651. self._assert_equals_("hello","hello");
  4652. $ctx1.sendIdx["assert:equals:"]=1;
  4653. $1="hello".__eq("world");
  4654. $ctx1.sendIdx["="]=1;
  4655. self._deny_($1);
  4656. $ctx1.sendIdx["deny:"]=1;
  4657. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4658. return smalltalk.withContext(function($ctx2) {
  4659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  4660. $ctx1.sendIdx["="]=2;
  4661. self._deny_($2);
  4662. $ctx1.sendIdx["deny:"]=2;
  4663. $3="hello"._yourself();
  4664. $ctx1.sendIdx["yourself"]=1;
  4665. self._assert_equals_("hello",$3);
  4666. $ctx1.sendIdx["assert:equals:"]=2;
  4667. self._assert_equals_("hello"._yourself(),"hello");
  4668. self._deny_("".__eq((0)));
  4669. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  4670. args: [],
  4671. 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",
  4672. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4673. referencedClasses: []
  4674. }),
  4675. smalltalk.StringTest);
  4676. smalltalk.addMethod(
  4677. smalltalk.method({
  4678. selector: "testIdentity",
  4679. protocol: 'tests',
  4680. fn: function (){
  4681. var self=this;
  4682. return smalltalk.withContext(function($ctx1) {
  4683. var $1,$2,$4,$3,$5;
  4684. $1="hello".__eq_eq("hello");
  4685. $ctx1.sendIdx["=="]=1;
  4686. self._assert_($1);
  4687. $ctx1.sendIdx["assert:"]=1;
  4688. $2="hello".__eq_eq("world");
  4689. $ctx1.sendIdx["=="]=2;
  4690. self._deny_($2);
  4691. $ctx1.sendIdx["deny:"]=1;
  4692. $4="hello"._yourself();
  4693. $ctx1.sendIdx["yourself"]=1;
  4694. $3="hello".__eq_eq($4);
  4695. $ctx1.sendIdx["=="]=3;
  4696. self._assert_($3);
  4697. $ctx1.sendIdx["assert:"]=2;
  4698. $5=_st("hello"._yourself()).__eq_eq("hello");
  4699. $ctx1.sendIdx["=="]=4;
  4700. self._assert_($5);
  4701. self._deny_("".__eq_eq((0)));
  4702. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  4703. args: [],
  4704. 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",
  4705. messageSends: ["assert:", "==", "deny:", "yourself"],
  4706. referencedClasses: []
  4707. }),
  4708. smalltalk.StringTest);
  4709. smalltalk.addMethod(
  4710. smalltalk.method({
  4711. selector: "testIdentityHash",
  4712. protocol: 'tests',
  4713. fn: function (){
  4714. var self=this;
  4715. return smalltalk.withContext(function($ctx1) {
  4716. var $1,$2,$4,$3;
  4717. $1="foo"._identityHash();
  4718. $ctx1.sendIdx["identityHash"]=1;
  4719. $2="foo"._identityHash();
  4720. $ctx1.sendIdx["identityHash"]=2;
  4721. self._assert_equals_($1,$2);
  4722. $4="foo"._identityHash();
  4723. $ctx1.sendIdx["identityHash"]=3;
  4724. $3=_st($4).__eq("bar"._identityHash());
  4725. self._deny_($3);
  4726. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  4727. args: [],
  4728. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4729. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4730. referencedClasses: []
  4731. }),
  4732. smalltalk.StringTest);
  4733. smalltalk.addMethod(
  4734. smalltalk.method({
  4735. selector: "testIncludesSubString",
  4736. protocol: 'tests',
  4737. fn: function (){
  4738. var self=this;
  4739. return smalltalk.withContext(function($ctx1) {
  4740. var $1;
  4741. $1="amber"._includesSubString_("ber");
  4742. $ctx1.sendIdx["includesSubString:"]=1;
  4743. self._assert_($1);
  4744. self._deny_("amber"._includesSubString_("zork"));
  4745. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  4746. args: [],
  4747. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4748. messageSends: ["assert:", "includesSubString:", "deny:"],
  4749. referencedClasses: []
  4750. }),
  4751. smalltalk.StringTest);
  4752. smalltalk.addMethod(
  4753. smalltalk.method({
  4754. selector: "testIsVowel",
  4755. protocol: 'tests',
  4756. fn: function (){
  4757. var self=this;
  4758. var vowel,consonant;
  4759. return smalltalk.withContext(function($ctx1) {
  4760. var $1;
  4761. vowel="u";
  4762. consonant="z";
  4763. $1=_st(vowel)._isVowel();
  4764. $ctx1.sendIdx["isVowel"]=1;
  4765. self._assert_equals_($1,true);
  4766. $ctx1.sendIdx["assert:equals:"]=1;
  4767. self._assert_equals_(_st(consonant)._isVowel(),false);
  4768. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  4769. args: [],
  4770. 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",
  4771. messageSends: ["assert:equals:", "isVowel"],
  4772. referencedClasses: []
  4773. }),
  4774. smalltalk.StringTest);
  4775. smalltalk.addMethod(
  4776. smalltalk.method({
  4777. selector: "testJoin",
  4778. protocol: 'tests',
  4779. fn: function (){
  4780. var self=this;
  4781. return smalltalk.withContext(function($ctx1) {
  4782. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4783. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  4784. args: [],
  4785. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4786. messageSends: ["assert:equals:", "join:"],
  4787. referencedClasses: []
  4788. }),
  4789. smalltalk.StringTest);
  4790. smalltalk.addMethod(
  4791. smalltalk.method({
  4792. selector: "testRemoveAll",
  4793. protocol: 'tests',
  4794. fn: function (){
  4795. var self=this;
  4796. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4797. return smalltalk.withContext(function($ctx1) {
  4798. self._should_raise_((function(){
  4799. return smalltalk.withContext(function($ctx2) {
  4800. return _st(self._collection())._removeAll();
  4801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4802. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  4803. args: [],
  4804. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4805. messageSends: ["should:raise:", "removeAll", "collection"],
  4806. referencedClasses: ["Error"]
  4807. }),
  4808. smalltalk.StringTest);
  4809. smalltalk.addMethod(
  4810. smalltalk.method({
  4811. selector: "testReversed",
  4812. protocol: 'tests',
  4813. fn: function (){
  4814. var self=this;
  4815. return smalltalk.withContext(function($ctx1) {
  4816. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4817. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  4818. args: [],
  4819. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4820. messageSends: ["assert:equals:", "reversed"],
  4821. referencedClasses: []
  4822. }),
  4823. smalltalk.StringTest);
  4824. smalltalk.addMethod(
  4825. smalltalk.method({
  4826. selector: "testStreamContents",
  4827. protocol: 'tests',
  4828. fn: function (){
  4829. var self=this;
  4830. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4831. return smalltalk.withContext(function($ctx1) {
  4832. var $1;
  4833. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4834. return smalltalk.withContext(function($ctx2) {
  4835. _st(aStream)._nextPutAll_("hello");
  4836. $ctx2.sendIdx["nextPutAll:"]=1;
  4837. _st(aStream)._space();
  4838. $1=_st(aStream)._nextPutAll_("world");
  4839. return $1;
  4840. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4841. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  4842. args: [],
  4843. 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'",
  4844. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4845. referencedClasses: ["String"]
  4846. }),
  4847. smalltalk.StringTest);
  4848. smalltalk.addMethod(
  4849. smalltalk.method({
  4850. selector: "testSubStrings",
  4851. protocol: 'tests',
  4852. fn: function (){
  4853. var self=this;
  4854. return smalltalk.withContext(function($ctx1) {
  4855. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4856. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  4857. args: [],
  4858. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4859. messageSends: ["assert:equals:", "subStrings:"],
  4860. referencedClasses: []
  4861. }),
  4862. smalltalk.StringTest);
  4863. smalltalk.addMethod(
  4864. smalltalk.method({
  4865. selector: "testTrim",
  4866. protocol: 'tests',
  4867. fn: function (){
  4868. var self=this;
  4869. return smalltalk.withContext(function($ctx1) {
  4870. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  4871. $ctx1.sendIdx["assert:equals:"]=1;
  4872. self._assert_equals_("jackie "._trimRight(),"jackie");
  4873. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  4874. args: [],
  4875. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  4876. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  4877. referencedClasses: []
  4878. }),
  4879. smalltalk.StringTest);
  4880. smalltalk.addMethod(
  4881. smalltalk.method({
  4882. selector: "collectionClass",
  4883. protocol: 'fixture',
  4884. fn: function (){
  4885. var self=this;
  4886. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4887. return smalltalk.withContext(function($ctx1) {
  4888. return $String();
  4889. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  4890. args: [],
  4891. source: "collectionClass\x0a\x09^ String",
  4892. messageSends: [],
  4893. referencedClasses: ["String"]
  4894. }),
  4895. smalltalk.StringTest.klass);
  4896. smalltalk.addClass('SetTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  4897. smalltalk.addMethod(
  4898. smalltalk.method({
  4899. selector: "collection",
  4900. protocol: 'fixture',
  4901. fn: function (){
  4902. var self=this;
  4903. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4904. return smalltalk.withContext(function($ctx1) {
  4905. var $2,$3,$1;
  4906. $2=_st($Set())._new();
  4907. _st($2)._add_((1));
  4908. $ctx1.sendIdx["add:"]=1;
  4909. _st($2)._add_((2));
  4910. $ctx1.sendIdx["add:"]=2;
  4911. _st($2)._add_((3));
  4912. $ctx1.sendIdx["add:"]=3;
  4913. _st($2)._add_((-4));
  4914. $3=_st($2)._yourself();
  4915. $1=$3;
  4916. return $1;
  4917. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.SetTest)})},
  4918. args: [],
  4919. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: 1;\x0a\x09\x09add: 2;\x0a\x09\x09add: 3;\x0a\x09\x09add: -4;\x0a\x09\x09yourself",
  4920. messageSends: ["add:", "new", "yourself"],
  4921. referencedClasses: ["Set"]
  4922. }),
  4923. smalltalk.SetTest);
  4924. smalltalk.addMethod(
  4925. smalltalk.method({
  4926. selector: "collectionOfPrintStrings",
  4927. protocol: 'fixture',
  4928. fn: function (){
  4929. var self=this;
  4930. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4931. return smalltalk.withContext(function($ctx1) {
  4932. var $2,$3,$1;
  4933. $2=_st($Set())._new();
  4934. _st($2)._add_("1");
  4935. $ctx1.sendIdx["add:"]=1;
  4936. _st($2)._add_("2");
  4937. $ctx1.sendIdx["add:"]=2;
  4938. _st($2)._add_("3");
  4939. $ctx1.sendIdx["add:"]=3;
  4940. _st($2)._add_("-4");
  4941. $3=_st($2)._yourself();
  4942. $1=$3;
  4943. return $1;
  4944. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.SetTest)})},
  4945. args: [],
  4946. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: '1';\x0a\x09\x09add: '2';\x0a\x09\x09add: '3';\x0a\x09\x09add: '-4';\x0a\x09\x09yourself",
  4947. messageSends: ["add:", "new", "yourself"],
  4948. referencedClasses: ["Set"]
  4949. }),
  4950. smalltalk.SetTest);
  4951. smalltalk.addMethod(
  4952. smalltalk.method({
  4953. selector: "collectionSize",
  4954. protocol: 'fixture',
  4955. fn: function (){
  4956. var self=this;
  4957. return smalltalk.withContext(function($ctx1) {
  4958. return (4);
  4959. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.SetTest)})},
  4960. args: [],
  4961. source: "collectionSize\x0a\x09^ 4",
  4962. messageSends: [],
  4963. referencedClasses: []
  4964. }),
  4965. smalltalk.SetTest);
  4966. smalltalk.addMethod(
  4967. smalltalk.method({
  4968. selector: "collectionWithDuplicates",
  4969. protocol: 'fixture',
  4970. fn: function (){
  4971. var self=this;
  4972. return smalltalk.withContext(function($ctx1) {
  4973. var $2,$3,$1;
  4974. $2=self._collection();
  4975. _st($2)._add_("yet another");
  4976. $3=_st($2)._yourself();
  4977. $1=$3;
  4978. return $1;
  4979. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.SetTest)})},
  4980. args: [],
  4981. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 'yet another'; yourself",
  4982. messageSends: ["add:", "collection", "yourself"],
  4983. referencedClasses: []
  4984. }),
  4985. smalltalk.SetTest);
  4986. smalltalk.addMethod(
  4987. smalltalk.method({
  4988. selector: "collectionWithNewValue",
  4989. protocol: 'fixture',
  4990. fn: function (){
  4991. var self=this;
  4992. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4993. return smalltalk.withContext(function($ctx1) {
  4994. var $2,$3,$1;
  4995. $2=_st($Set())._new();
  4996. _st($2)._add_((1));
  4997. $ctx1.sendIdx["add:"]=1;
  4998. _st($2)._add_((2));
  4999. $ctx1.sendIdx["add:"]=2;
  5000. _st($2)._add_((3));
  5001. $ctx1.sendIdx["add:"]=3;
  5002. _st($2)._add_("N");
  5003. $ctx1.sendIdx["add:"]=4;
  5004. _st($2)._add_((-4));
  5005. $3=_st($2)._yourself();
  5006. $1=$3;
  5007. return $1;
  5008. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.SetTest)})},
  5009. args: [],
  5010. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: 1;\x0a\x09\x09add: 2;\x0a\x09\x09add: 3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: -4;\x0a\x09\x09yourself",
  5011. messageSends: ["add:", "new", "yourself"],
  5012. referencedClasses: ["Set"]
  5013. }),
  5014. smalltalk.SetTest);
  5015. smalltalk.addMethod(
  5016. smalltalk.method({
  5017. selector: "testAddAll",
  5018. protocol: 'tests',
  5019. fn: function (){
  5020. var self=this;
  5021. return smalltalk.withContext(function($ctx1) {
  5022. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5023. smalltalk.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  5024. $2=self._collection();
  5025. $ctx1.sendIdx["collection"]=1;
  5026. $3=$2;
  5027. $4=self._collection();
  5028. $ctx1.sendIdx["collection"]=2;
  5029. _st($3)._addAll_($4);
  5030. $ctx1.sendIdx["addAll:"]=1;
  5031. $5=_st($2)._yourself();
  5032. $ctx1.sendIdx["yourself"]=1;
  5033. $1=$5;
  5034. $6=self._collection();
  5035. $ctx1.sendIdx["collection"]=3;
  5036. self._assert_equals_($1,$6);
  5037. $ctx1.sendIdx["assert:equals:"]=1;
  5038. $8=self._collection();
  5039. $ctx1.sendIdx["collection"]=4;
  5040. $9=$8;
  5041. $10=self._collectionWithNewValue();
  5042. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5043. _st($9)._addAll_($10);
  5044. $ctx1.sendIdx["addAll:"]=2;
  5045. $11=_st($8)._yourself();
  5046. $ctx1.sendIdx["yourself"]=2;
  5047. $7=$11;
  5048. $12=self._collectionWithNewValue();
  5049. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5050. self._assert_equals_($7,$12);
  5051. $ctx1.sendIdx["assert:equals:"]=2;
  5052. $14=self._collectionWithNewValue();
  5053. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5054. _st($14)._addAll_(self._collection());
  5055. $15=_st($14)._yourself();
  5056. $13=$15;
  5057. self._assert_equals_($13,self._collectionWithNewValue());
  5058. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.SetTest)})},
  5059. args: [],
  5060. 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",
  5061. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5062. referencedClasses: []
  5063. }),
  5064. smalltalk.SetTest);
  5065. smalltalk.addMethod(
  5066. smalltalk.method({
  5067. selector: "testAddRemove",
  5068. protocol: 'tests',
  5069. fn: function (){
  5070. var self=this;
  5071. var set;
  5072. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5073. return smalltalk.withContext(function($ctx1) {
  5074. var $1,$2;
  5075. set=_st($Set())._new();
  5076. self._assert_(_st(set)._isEmpty());
  5077. $ctx1.sendIdx["assert:"]=1;
  5078. _st(set)._add_((3));
  5079. $ctx1.sendIdx["add:"]=1;
  5080. $1=_st(set)._includes_((3));
  5081. $ctx1.sendIdx["includes:"]=1;
  5082. self._assert_($1);
  5083. $ctx1.sendIdx["assert:"]=2;
  5084. _st(set)._add_((5));
  5085. $2=_st(set)._includes_((5));
  5086. $ctx1.sendIdx["includes:"]=2;
  5087. self._assert_($2);
  5088. _st(set)._remove_((3));
  5089. self._deny_(_st(set)._includes_((3)));
  5090. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  5091. args: [],
  5092. 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)",
  5093. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5094. referencedClasses: ["Set"]
  5095. }),
  5096. smalltalk.SetTest);
  5097. smalltalk.addMethod(
  5098. smalltalk.method({
  5099. selector: "testAt",
  5100. protocol: 'tests',
  5101. fn: function (){
  5102. var self=this;
  5103. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5104. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5105. return smalltalk.withContext(function($ctx1) {
  5106. self._should_raise_((function(){
  5107. return smalltalk.withContext(function($ctx2) {
  5108. return _st(_st($Set())._new())._at_put_((1),(2));
  5109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5110. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  5111. args: [],
  5112. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5113. messageSends: ["should:raise:", "at:put:", "new"],
  5114. referencedClasses: ["Set", "Error"]
  5115. }),
  5116. smalltalk.SetTest);
  5117. smalltalk.addMethod(
  5118. smalltalk.method({
  5119. selector: "testCollect",
  5120. protocol: 'tests',
  5121. fn: function (){
  5122. var self=this;
  5123. return smalltalk.withContext(function($ctx1) {
  5124. var $2,$1;
  5125. smalltalk.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  5126. $2=[(5), (6), (8)]._asSet();
  5127. $ctx1.sendIdx["asSet"]=1;
  5128. $1=_st($2)._collect_((function(x){
  5129. return smalltalk.withContext(function($ctx2) {
  5130. return _st(x).__backslash_backslash((3));
  5131. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5132. self._assert_equals_($1,[(0), (2)]._asSet());
  5133. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  5134. args: [],
  5135. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5136. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5137. referencedClasses: []
  5138. }),
  5139. smalltalk.SetTest);
  5140. smalltalk.addMethod(
  5141. smalltalk.method({
  5142. selector: "testComma",
  5143. protocol: 'tests',
  5144. fn: function (){
  5145. var self=this;
  5146. return smalltalk.withContext(function($ctx1) {
  5147. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5148. smalltalk.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  5149. $2=self._collection();
  5150. $ctx1.sendIdx["collection"]=1;
  5151. $3=self._collection();
  5152. $ctx1.sendIdx["collection"]=2;
  5153. $1=_st($2).__comma($3);
  5154. $ctx1.sendIdx[","]=1;
  5155. $4=self._collection();
  5156. $ctx1.sendIdx["collection"]=3;
  5157. self._assert_equals_($1,$4);
  5158. $ctx1.sendIdx["assert:equals:"]=1;
  5159. $6=self._collection();
  5160. $ctx1.sendIdx["collection"]=4;
  5161. $7=self._collectionWithNewValue();
  5162. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5163. $5=_st($6).__comma($7);
  5164. $ctx1.sendIdx[","]=2;
  5165. $8=self._collectionWithNewValue();
  5166. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5167. self._assert_equals_($5,$8);
  5168. $ctx1.sendIdx["assert:equals:"]=2;
  5169. $10=self._collectionWithNewValue();
  5170. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5171. $9=_st($10).__comma(self._collection());
  5172. self._assert_equals_($9,self._collectionWithNewValue());
  5173. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.SetTest)})},
  5174. args: [],
  5175. 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",
  5176. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5177. referencedClasses: []
  5178. }),
  5179. smalltalk.SetTest);
  5180. smalltalk.addMethod(
  5181. smalltalk.method({
  5182. selector: "testComparing",
  5183. protocol: 'tests',
  5184. fn: function (){
  5185. var self=this;
  5186. return smalltalk.withContext(function($ctx1) {
  5187. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5188. $1=[(0), (2)]._asSet();
  5189. $ctx1.sendIdx["asSet"]=1;
  5190. $2=[(0), (2)]._asSet();
  5191. $ctx1.sendIdx["asSet"]=2;
  5192. self._assert_equals_($1,$2);
  5193. $ctx1.sendIdx["assert:equals:"]=1;
  5194. $3=[(2), (0)]._asSet();
  5195. $ctx1.sendIdx["asSet"]=3;
  5196. $4=[(0), (2)]._asSet();
  5197. $ctx1.sendIdx["asSet"]=4;
  5198. self._assert_equals_($3,$4);
  5199. $6=[(0), (2), (3)]._asSet();
  5200. $ctx1.sendIdx["asSet"]=5;
  5201. $7=[(0), (2)]._asSet();
  5202. $ctx1.sendIdx["asSet"]=6;
  5203. $5=_st($6).__eq($7);
  5204. $ctx1.sendIdx["="]=1;
  5205. self._deny_($5);
  5206. $ctx1.sendIdx["deny:"]=1;
  5207. $9=[(1), (2)]._asSet();
  5208. $ctx1.sendIdx["asSet"]=7;
  5209. $8=_st($9).__eq([(0), (2)]._asSet());
  5210. self._deny_($8);
  5211. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  5212. args: [],
  5213. 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",
  5214. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5215. referencedClasses: []
  5216. }),
  5217. smalltalk.SetTest);
  5218. smalltalk.addMethod(
  5219. smalltalk.method({
  5220. selector: "testPrintString",
  5221. protocol: 'tests',
  5222. fn: function (){
  5223. var self=this;
  5224. var set;
  5225. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5226. return smalltalk.withContext(function($ctx1) {
  5227. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5228. set=_st($Set())._new();
  5229. $1=_st(set)._printString();
  5230. $ctx1.sendIdx["printString"]=1;
  5231. self._assert_equals_($1,"a Set ()");
  5232. $ctx1.sendIdx["assert:equals:"]=1;
  5233. $2=set;
  5234. _st($2)._add_((1));
  5235. $ctx1.sendIdx["add:"]=1;
  5236. $3=_st($2)._add_((3));
  5237. $ctx1.sendIdx["add:"]=2;
  5238. $4=_st(set)._printString();
  5239. $ctx1.sendIdx["printString"]=2;
  5240. self._assert_equals_($4,"a Set (1 3)");
  5241. $ctx1.sendIdx["assert:equals:"]=2;
  5242. _st(set)._add_("foo");
  5243. $ctx1.sendIdx["add:"]=3;
  5244. $5=_st(set)._printString();
  5245. $ctx1.sendIdx["printString"]=3;
  5246. self._assert_equals_($5,"a Set (1 3 'foo')");
  5247. $ctx1.sendIdx["assert:equals:"]=3;
  5248. $6=set;
  5249. _st($6)._remove_((1));
  5250. $ctx1.sendIdx["remove:"]=1;
  5251. $7=_st($6)._remove_((3));
  5252. $8=_st(set)._printString();
  5253. $ctx1.sendIdx["printString"]=4;
  5254. self._assert_equals_($8,"a Set ('foo')");
  5255. $ctx1.sendIdx["assert:equals:"]=4;
  5256. _st(set)._add_((3));
  5257. $ctx1.sendIdx["add:"]=4;
  5258. $9=_st(set)._printString();
  5259. $ctx1.sendIdx["printString"]=5;
  5260. self._assert_equals_($9,"a Set ('foo' 3)");
  5261. $ctx1.sendIdx["assert:equals:"]=5;
  5262. _st(set)._add_((3));
  5263. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  5264. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  5265. args: [],
  5266. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'",
  5267. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5268. referencedClasses: ["Set"]
  5269. }),
  5270. smalltalk.SetTest);
  5271. smalltalk.addMethod(
  5272. smalltalk.method({
  5273. selector: "testUnboxedObjects",
  5274. protocol: 'tests',
  5275. fn: function (){
  5276. var self=this;
  5277. return smalltalk.withContext(function($ctx1) {
  5278. var $4,$3,$2,$1;
  5279. $4="foo"._yourself();
  5280. $ctx1.sendIdx["yourself"]=1;
  5281. $3=[$4,"foo"._yourself()];
  5282. $2=_st($3)._asSet();
  5283. $1=_st($2)._asArray();
  5284. self._assert_equals_($1,["foo"]);
  5285. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  5286. args: [],
  5287. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5288. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5289. referencedClasses: []
  5290. }),
  5291. smalltalk.SetTest);
  5292. smalltalk.addMethod(
  5293. smalltalk.method({
  5294. selector: "testUnicity",
  5295. protocol: 'tests',
  5296. fn: function (){
  5297. var self=this;
  5298. var set;
  5299. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5300. return smalltalk.withContext(function($ctx1) {
  5301. var $1;
  5302. set=_st($Set())._new();
  5303. _st(set)._add_((21));
  5304. $ctx1.sendIdx["add:"]=1;
  5305. _st(set)._add_("hello");
  5306. $ctx1.sendIdx["add:"]=2;
  5307. _st(set)._add_((21));
  5308. $ctx1.sendIdx["add:"]=3;
  5309. $1=_st(set)._size();
  5310. $ctx1.sendIdx["size"]=1;
  5311. self._assert_equals_($1,(2));
  5312. $ctx1.sendIdx["assert:equals:"]=1;
  5313. _st(set)._add_("hello");
  5314. self._assert_equals_(_st(set)._size(),(2));
  5315. $ctx1.sendIdx["assert:equals:"]=2;
  5316. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5317. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  5318. args: [],
  5319. 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')",
  5320. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5321. referencedClasses: ["Set"]
  5322. }),
  5323. smalltalk.SetTest);
  5324. smalltalk.addMethod(
  5325. smalltalk.method({
  5326. selector: "collectionClass",
  5327. protocol: 'fixture',
  5328. fn: function (){
  5329. var self=this;
  5330. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5331. return smalltalk.withContext(function($ctx1) {
  5332. return $Set();
  5333. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.SetTest.klass)})},
  5334. args: [],
  5335. source: "collectionClass\x0a\x09^ Set",
  5336. messageSends: [],
  5337. referencedClasses: ["Set"]
  5338. }),
  5339. smalltalk.SetTest.klass);
  5340. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5341. smalltalk.addMethod(
  5342. smalltalk.method({
  5343. selector: "testShow",
  5344. protocol: 'tests',
  5345. fn: function (){
  5346. var self=this;
  5347. var originalTranscript;
  5348. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5349. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5350. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5351. return smalltalk.withContext(function($ctx1) {
  5352. originalTranscript=_st($Transcript())._current();
  5353. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5354. $ctx1.sendIdx["register:"]=1;
  5355. self._shouldnt_raise_((function(){
  5356. return smalltalk.withContext(function($ctx2) {
  5357. return _st($Transcript())._show_("Hello console!");
  5358. $ctx2.sendIdx["show:"]=1;
  5359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5360. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5361. self._shouldnt_raise_((function(){
  5362. return smalltalk.withContext(function($ctx2) {
  5363. return _st($Transcript())._show_(console);
  5364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5365. _st($Transcript())._register_(originalTranscript);
  5366. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  5367. args: [],
  5368. 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.",
  5369. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5370. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5371. }),
  5372. smalltalk.ConsoleTranscriptTest);
  5373. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5374. smalltalk.addMethod(
  5375. smalltalk.method({
  5376. selector: "jsObject",
  5377. protocol: 'accessing',
  5378. fn: function (){
  5379. var self=this;
  5380. return smalltalk.withContext(function($ctx1) {
  5381. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5382. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  5383. args: [],
  5384. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5385. messageSends: [],
  5386. referencedClasses: []
  5387. }),
  5388. smalltalk.JSObjectProxyTest);
  5389. smalltalk.addMethod(
  5390. smalltalk.method({
  5391. selector: "testAtIfAbsent",
  5392. protocol: 'tests',
  5393. fn: function (){
  5394. var self=this;
  5395. var testObject;
  5396. return smalltalk.withContext(function($ctx1) {
  5397. var $1,$2,$3;
  5398. testObject=self._jsObject();
  5399. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5400. return smalltalk.withContext(function($ctx2) {
  5401. return "Property does not exist";
  5402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5403. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5404. self._assert_equals_($1,"Property does not exist");
  5405. $ctx1.sendIdx["assert:equals:"]=1;
  5406. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5407. return smalltalk.withContext(function($ctx2) {
  5408. return "Property does not exist";
  5409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5410. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5411. self._assert_equals_($2,nil);
  5412. $ctx1.sendIdx["assert:equals:"]=2;
  5413. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5414. return smalltalk.withContext(function($ctx2) {
  5415. return "Property does not exist";
  5416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  5417. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5418. self._assert_equals_($3,(1));
  5419. $ctx1.sendIdx["assert:equals:"]=3;
  5420. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5421. return smalltalk.withContext(function($ctx2) {
  5422. return "Property does not exist";
  5423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  5424. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5425. args: [],
  5426. 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.",
  5427. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5428. referencedClasses: []
  5429. }),
  5430. smalltalk.JSObjectProxyTest);
  5431. smalltalk.addMethod(
  5432. smalltalk.method({
  5433. selector: "testAtIfPresent",
  5434. protocol: 'tests',
  5435. fn: function (){
  5436. var self=this;
  5437. var testObject;
  5438. return smalltalk.withContext(function($ctx1) {
  5439. var $2,$1,$4,$3,$6,$5;
  5440. testObject=self._jsObject();
  5441. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5442. return smalltalk.withContext(function($ctx2) {
  5443. $2=_st(x)._asString();
  5444. $ctx2.sendIdx["asString"]=1;
  5445. return "hello ".__comma($2);
  5446. $ctx2.sendIdx[","]=1;
  5447. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5448. $ctx1.sendIdx["at:ifPresent:"]=1;
  5449. self._assert_equals_($1,nil);
  5450. $ctx1.sendIdx["assert:equals:"]=1;
  5451. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5452. return smalltalk.withContext(function($ctx2) {
  5453. $4=_st(x)._asString();
  5454. $ctx2.sendIdx["asString"]=2;
  5455. return "hello ".__comma($4);
  5456. $ctx2.sendIdx[","]=2;
  5457. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5458. $ctx1.sendIdx["at:ifPresent:"]=2;
  5459. self._assert_equals_($3,"hello nil");
  5460. $ctx1.sendIdx["assert:equals:"]=2;
  5461. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5462. return smalltalk.withContext(function($ctx2) {
  5463. $6=_st(x)._asString();
  5464. $ctx2.sendIdx["asString"]=3;
  5465. return "hello ".__comma($6);
  5466. $ctx2.sendIdx[","]=3;
  5467. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5468. $ctx1.sendIdx["at:ifPresent:"]=3;
  5469. self._assert_equals_($5,"hello 1");
  5470. $ctx1.sendIdx["assert:equals:"]=3;
  5471. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5472. return smalltalk.withContext(function($ctx2) {
  5473. return "hello ".__comma(_st(x)._asString());
  5474. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5475. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5476. args: [],
  5477. 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'.",
  5478. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5479. referencedClasses: []
  5480. }),
  5481. smalltalk.JSObjectProxyTest);
  5482. smalltalk.addMethod(
  5483. smalltalk.method({
  5484. selector: "testAtIfPresentIfAbsent",
  5485. protocol: 'tests',
  5486. fn: function (){
  5487. var self=this;
  5488. var testObject;
  5489. return smalltalk.withContext(function($ctx1) {
  5490. var $2,$1,$4,$3,$6,$5;
  5491. testObject=self._jsObject();
  5492. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5493. return smalltalk.withContext(function($ctx2) {
  5494. $2=_st(x)._asString();
  5495. $ctx2.sendIdx["asString"]=1;
  5496. return "hello ".__comma($2);
  5497. $ctx2.sendIdx[","]=1;
  5498. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5499. return smalltalk.withContext(function($ctx2) {
  5500. return "not present";
  5501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5502. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5503. self._assert_equals_($1,"not present");
  5504. $ctx1.sendIdx["assert:equals:"]=1;
  5505. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5506. return smalltalk.withContext(function($ctx2) {
  5507. $4=_st(x)._asString();
  5508. $ctx2.sendIdx["asString"]=2;
  5509. return "hello ".__comma($4);
  5510. $ctx2.sendIdx[","]=2;
  5511. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5512. return smalltalk.withContext(function($ctx2) {
  5513. return "not present";
  5514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5515. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5516. self._assert_equals_($3,"hello nil");
  5517. $ctx1.sendIdx["assert:equals:"]=2;
  5518. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5519. return smalltalk.withContext(function($ctx2) {
  5520. $6=_st(x)._asString();
  5521. $ctx2.sendIdx["asString"]=3;
  5522. return "hello ".__comma($6);
  5523. $ctx2.sendIdx[","]=3;
  5524. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5525. return smalltalk.withContext(function($ctx2) {
  5526. return "not present";
  5527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5528. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5529. self._assert_equals_($5,"hello 1");
  5530. $ctx1.sendIdx["assert:equals:"]=3;
  5531. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5532. return smalltalk.withContext(function($ctx2) {
  5533. return "hello ".__comma(_st(x)._asString());
  5534. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5535. return smalltalk.withContext(function($ctx2) {
  5536. return "not present";
  5537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  5538. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5539. args: [],
  5540. 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'.",
  5541. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5542. referencedClasses: []
  5543. }),
  5544. smalltalk.JSObjectProxyTest);
  5545. smalltalk.addMethod(
  5546. smalltalk.method({
  5547. selector: "testAtPut",
  5548. protocol: 'tests',
  5549. fn: function (){
  5550. var self=this;
  5551. var testObject;
  5552. return smalltalk.withContext(function($ctx1) {
  5553. var $2,$1;
  5554. testObject=self._jsObject();
  5555. $2=_st(testObject)._at_("abc");
  5556. $ctx1.sendIdx["at:"]=1;
  5557. $1=_st($2).__tild_eq("xyz");
  5558. self._assert_($1);
  5559. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5560. $ctx1.sendIdx["assert:equals:"]=1;
  5561. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5562. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5563. args: [],
  5564. 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'",
  5565. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5566. referencedClasses: []
  5567. }),
  5568. smalltalk.JSObjectProxyTest);
  5569. smalltalk.addMethod(
  5570. smalltalk.method({
  5571. selector: "testDNU",
  5572. protocol: 'tests',
  5573. fn: function (){
  5574. var self=this;
  5575. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5576. return smalltalk.withContext(function($ctx1) {
  5577. self._should_raise_((function(){
  5578. return smalltalk.withContext(function($ctx2) {
  5579. return _st(self._jsObject())._foo();
  5580. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5581. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  5582. args: [],
  5583. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5584. messageSends: ["should:raise:", "foo", "jsObject"],
  5585. referencedClasses: ["MessageNotUnderstood"]
  5586. }),
  5587. smalltalk.JSObjectProxyTest);
  5588. smalltalk.addMethod(
  5589. smalltalk.method({
  5590. selector: "testMessageSend",
  5591. protocol: 'tests',
  5592. fn: function (){
  5593. var self=this;
  5594. return smalltalk.withContext(function($ctx1) {
  5595. var $2,$1,$4,$3;
  5596. $2=self._jsObject();
  5597. $ctx1.sendIdx["jsObject"]=1;
  5598. $1=_st($2)._a();
  5599. self._assert_equals_($1,(1));
  5600. $ctx1.sendIdx["assert:equals:"]=1;
  5601. $4=self._jsObject();
  5602. $ctx1.sendIdx["jsObject"]=2;
  5603. $3=_st($4)._b();
  5604. self._assert_equals_($3,(2));
  5605. $ctx1.sendIdx["assert:equals:"]=2;
  5606. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5607. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  5608. args: [],
  5609. 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",
  5610. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5611. referencedClasses: []
  5612. }),
  5613. smalltalk.JSObjectProxyTest);
  5614. smalltalk.addMethod(
  5615. smalltalk.method({
  5616. selector: "testMethodWithArguments",
  5617. protocol: 'tests',
  5618. fn: function (){
  5619. var self=this;
  5620. return smalltalk.withContext(function($ctx1) {
  5621. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5622. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  5623. args: [],
  5624. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5625. messageSends: ["assert:equals:", "c:", "jsObject"],
  5626. referencedClasses: []
  5627. }),
  5628. smalltalk.JSObjectProxyTest);
  5629. smalltalk.addMethod(
  5630. smalltalk.method({
  5631. selector: "testPrinting",
  5632. protocol: 'tests',
  5633. fn: function (){
  5634. var self=this;
  5635. return smalltalk.withContext(function($ctx1) {
  5636. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5637. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  5638. args: [],
  5639. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5640. messageSends: ["assert:equals:", "printString", "jsObject"],
  5641. referencedClasses: []
  5642. }),
  5643. smalltalk.JSObjectProxyTest);
  5644. smalltalk.addMethod(
  5645. smalltalk.method({
  5646. selector: "testPropertyThatReturnsEmptyString",
  5647. protocol: 'tests',
  5648. fn: function (){
  5649. var self=this;
  5650. var object;
  5651. return smalltalk.withContext(function($ctx1) {
  5652. var $1;
  5653. object=self._jsObject();
  5654. $1=_st(object)._d();
  5655. $ctx1.sendIdx["d"]=1;
  5656. self._assert_equals_($1,"");
  5657. $ctx1.sendIdx["assert:equals:"]=1;
  5658. _st(object)._d_("hello");
  5659. self._assert_equals_(_st(object)._d(),"hello");
  5660. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  5661. args: [],
  5662. 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'",
  5663. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5664. referencedClasses: []
  5665. }),
  5666. smalltalk.JSObjectProxyTest);
  5667. smalltalk.addMethod(
  5668. smalltalk.method({
  5669. selector: "testPropertyThatReturnsUndefined",
  5670. protocol: 'tests',
  5671. fn: function (){
  5672. var self=this;
  5673. var object;
  5674. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5675. return smalltalk.withContext(function($ctx1) {
  5676. object=self._jsObject();
  5677. self._shouldnt_raise_((function(){
  5678. return smalltalk.withContext(function($ctx2) {
  5679. return _st(object)._e();
  5680. $ctx2.sendIdx["e"]=1;
  5681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5682. self._assert_(_st(_st(object)._e())._isNil());
  5683. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  5684. args: [],
  5685. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5686. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5687. referencedClasses: ["MessageNotUnderstood"]
  5688. }),
  5689. smalltalk.JSObjectProxyTest);
  5690. smalltalk.addMethod(
  5691. smalltalk.method({
  5692. selector: "testValue",
  5693. protocol: 'tests',
  5694. fn: function (){
  5695. var self=this;
  5696. var testObject;
  5697. return smalltalk.withContext(function($ctx1) {
  5698. testObject=self._jsObject();
  5699. _st(testObject)._at_put_("value","aValue");
  5700. self._assert_equals_(_st(testObject)._value(),"aValue");
  5701. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5702. args: [],
  5703. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5704. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5705. referencedClasses: []
  5706. }),
  5707. smalltalk.JSObjectProxyTest);
  5708. smalltalk.addMethod(
  5709. smalltalk.method({
  5710. selector: "testYourself",
  5711. protocol: 'tests',
  5712. fn: function (){
  5713. var self=this;
  5714. var object;
  5715. return smalltalk.withContext(function($ctx1) {
  5716. var $1,$2;
  5717. $1=self._jsObject();
  5718. _st($1)._d_("test");
  5719. $2=_st($1)._yourself();
  5720. object=$2;
  5721. self._assert_equals_(_st(object)._d(),"test");
  5722. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  5723. args: [],
  5724. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5725. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5726. referencedClasses: []
  5727. }),
  5728. smalltalk.JSObjectProxyTest);
  5729. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5730. smalltalk.addMethod(
  5731. smalltalk.method({
  5732. selector: "testCatchingException",
  5733. protocol: 'tests',
  5734. fn: function (){
  5735. var self=this;
  5736. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5737. return smalltalk.withContext(function($ctx1) {
  5738. _st((function(){
  5739. return smalltalk.withContext(function($ctx2) {
  5740. return self._throwException();
  5741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5742. return smalltalk.withContext(function($ctx2) {
  5743. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5744. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5745. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  5746. args: [],
  5747. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5748. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5749. referencedClasses: ["Error"]
  5750. }),
  5751. smalltalk.JavaScriptExceptionTest);
  5752. smalltalk.addMethod(
  5753. smalltalk.method({
  5754. selector: "testRaisingException",
  5755. protocol: 'tests',
  5756. fn: function (){
  5757. var self=this;
  5758. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5759. return smalltalk.withContext(function($ctx1) {
  5760. self._should_raise_((function(){
  5761. return smalltalk.withContext(function($ctx2) {
  5762. return self._throwException();
  5763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5764. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  5765. args: [],
  5766. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5767. messageSends: ["should:raise:", "throwException"],
  5768. referencedClasses: ["JavaScriptException"]
  5769. }),
  5770. smalltalk.JavaScriptExceptionTest);
  5771. smalltalk.addMethod(
  5772. smalltalk.method({
  5773. selector: "throwException",
  5774. protocol: 'helpers',
  5775. fn: function (){
  5776. var self=this;
  5777. return smalltalk.withContext(function($ctx1) {
  5778. throw 'test';
  5779. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  5780. args: [],
  5781. source: "throwException\x0a\x09<throw 'test'>",
  5782. messageSends: [],
  5783. referencedClasses: []
  5784. }),
  5785. smalltalk.JavaScriptExceptionTest);
  5786. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5787. smalltalk.addMethod(
  5788. smalltalk.method({
  5789. selector: "testValue",
  5790. protocol: 'tests',
  5791. fn: function (){
  5792. var self=this;
  5793. var messageSend;
  5794. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5795. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5796. return smalltalk.withContext(function($ctx1) {
  5797. var $1,$2;
  5798. $1=_st($MessageSend())._new();
  5799. $ctx1.sendIdx["new"]=1;
  5800. _st($1)._receiver_(_st($Object())._new());
  5801. _st($1)._selector_("asString");
  5802. $2=_st($1)._yourself();
  5803. messageSend=$2;
  5804. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5805. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5806. args: [],
  5807. 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'",
  5808. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  5809. referencedClasses: ["MessageSend", "Object"]
  5810. }),
  5811. smalltalk.MessageSendTest);
  5812. smalltalk.addMethod(
  5813. smalltalk.method({
  5814. selector: "testValueWithArguments",
  5815. protocol: 'tests',
  5816. fn: function (){
  5817. var self=this;
  5818. var messageSend;
  5819. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5820. return smalltalk.withContext(function($ctx1) {
  5821. var $1,$2;
  5822. $1=_st($MessageSend())._new();
  5823. _st($1)._receiver_((2));
  5824. _st($1)._selector_("+");
  5825. $2=_st($1)._yourself();
  5826. messageSend=$2;
  5827. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  5828. $ctx1.sendIdx["assert:equals:"]=1;
  5829. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  5830. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5831. args: [],
  5832. 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",
  5833. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  5834. referencedClasses: ["MessageSend"]
  5835. }),
  5836. smalltalk.MessageSendTest);
  5837. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  5838. smalltalk.addMethod(
  5839. smalltalk.method({
  5840. selector: "codeGeneratorClass",
  5841. protocol: 'accessing',
  5842. fn: function (){
  5843. var self=this;
  5844. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  5845. return smalltalk.withContext(function($ctx1) {
  5846. return $CodeGenerator();
  5847. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  5848. args: [],
  5849. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  5850. messageSends: [],
  5851. referencedClasses: ["CodeGenerator"]
  5852. }),
  5853. smalltalk.MethodInheritanceTest);
  5854. smalltalk.addMethod(
  5855. smalltalk.method({
  5856. selector: "compiler",
  5857. protocol: 'factory',
  5858. fn: function (){
  5859. var self=this;
  5860. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5861. return smalltalk.withContext(function($ctx1) {
  5862. var $2,$3,$1;
  5863. $2=_st($Compiler())._new();
  5864. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  5865. $3=_st($2)._yourself();
  5866. $1=$3;
  5867. return $1;
  5868. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  5869. args: [],
  5870. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  5871. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  5872. referencedClasses: ["Compiler"]
  5873. }),
  5874. smalltalk.MethodInheritanceTest);
  5875. smalltalk.addMethod(
  5876. smalltalk.method({
  5877. selector: "deinstallBottom",
  5878. protocol: 'testing',
  5879. fn: function (){
  5880. var self=this;
  5881. return smalltalk.withContext(function($ctx1) {
  5882. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  5883. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  5884. args: [],
  5885. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  5886. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  5887. referencedClasses: []
  5888. }),
  5889. smalltalk.MethodInheritanceTest);
  5890. smalltalk.addMethod(
  5891. smalltalk.method({
  5892. selector: "deinstallMiddle",
  5893. protocol: 'testing',
  5894. fn: function (){
  5895. var self=this;
  5896. return smalltalk.withContext(function($ctx1) {
  5897. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  5898. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  5899. args: [],
  5900. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  5901. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  5902. referencedClasses: []
  5903. }),
  5904. smalltalk.MethodInheritanceTest);
  5905. smalltalk.addMethod(
  5906. smalltalk.method({
  5907. selector: "deinstallTop",
  5908. protocol: 'testing',
  5909. fn: function (){
  5910. var self=this;
  5911. return smalltalk.withContext(function($ctx1) {
  5912. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  5913. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  5914. args: [],
  5915. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  5916. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  5917. referencedClasses: []
  5918. }),
  5919. smalltalk.MethodInheritanceTest);
  5920. smalltalk.addMethod(
  5921. smalltalk.method({
  5922. selector: "installBottom:",
  5923. protocol: 'testing',
  5924. fn: function (aString){
  5925. var self=this;
  5926. return smalltalk.withContext(function($ctx1) {
  5927. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  5928. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5929. args: ["aString"],
  5930. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  5931. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  5932. referencedClasses: []
  5933. }),
  5934. smalltalk.MethodInheritanceTest);
  5935. smalltalk.addMethod(
  5936. smalltalk.method({
  5937. selector: "installMiddle:",
  5938. protocol: 'testing',
  5939. fn: function (aString){
  5940. var self=this;
  5941. return smalltalk.withContext(function($ctx1) {
  5942. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  5943. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5944. args: ["aString"],
  5945. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  5946. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  5947. referencedClasses: []
  5948. }),
  5949. smalltalk.MethodInheritanceTest);
  5950. smalltalk.addMethod(
  5951. smalltalk.method({
  5952. selector: "installTop:",
  5953. protocol: 'testing',
  5954. fn: function (aString){
  5955. var self=this;
  5956. return smalltalk.withContext(function($ctx1) {
  5957. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  5958. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5959. args: ["aString"],
  5960. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  5961. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  5962. referencedClasses: []
  5963. }),
  5964. smalltalk.MethodInheritanceTest);
  5965. smalltalk.addMethod(
  5966. smalltalk.method({
  5967. selector: "setUp",
  5968. protocol: 'initialization',
  5969. fn: function (){
  5970. var self=this;
  5971. return smalltalk.withContext(function($ctx1) {
  5972. self["@receiverTop"]=_st(self._targetClassTop())._new();
  5973. $ctx1.sendIdx["new"]=1;
  5974. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  5975. $ctx1.sendIdx["new"]=2;
  5976. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  5977. self["@method"]=nil;
  5978. self["@performBlock"]=(function(){
  5979. return smalltalk.withContext(function($ctx2) {
  5980. return self._error_("performBlock not initialized");
  5981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  5982. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  5983. args: [],
  5984. 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' ]",
  5985. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  5986. referencedClasses: []
  5987. }),
  5988. smalltalk.MethodInheritanceTest);
  5989. smalltalk.addMethod(
  5990. smalltalk.method({
  5991. selector: "shouldMNU",
  5992. protocol: 'testing',
  5993. fn: function (){
  5994. var self=this;
  5995. return smalltalk.withContext(function($ctx1) {
  5996. self._shouldMNUTop();
  5997. self._shouldMNUMiddle();
  5998. self._shouldMNUBottom();
  5999. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  6000. args: [],
  6001. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6002. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6003. referencedClasses: []
  6004. }),
  6005. smalltalk.MethodInheritanceTest);
  6006. smalltalk.addMethod(
  6007. smalltalk.method({
  6008. selector: "shouldMNUBottom",
  6009. protocol: 'testing',
  6010. fn: function (){
  6011. var self=this;
  6012. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6013. return smalltalk.withContext(function($ctx1) {
  6014. self._should_raise_((function(){
  6015. return smalltalk.withContext(function($ctx2) {
  6016. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6018. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  6019. args: [],
  6020. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6021. messageSends: ["should:raise:", "value:"],
  6022. referencedClasses: ["MessageNotUnderstood"]
  6023. }),
  6024. smalltalk.MethodInheritanceTest);
  6025. smalltalk.addMethod(
  6026. smalltalk.method({
  6027. selector: "shouldMNUMiddle",
  6028. protocol: 'testing',
  6029. fn: function (){
  6030. var self=this;
  6031. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6032. return smalltalk.withContext(function($ctx1) {
  6033. self._should_raise_((function(){
  6034. return smalltalk.withContext(function($ctx2) {
  6035. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6036. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6037. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  6038. args: [],
  6039. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6040. messageSends: ["should:raise:", "value:"],
  6041. referencedClasses: ["MessageNotUnderstood"]
  6042. }),
  6043. smalltalk.MethodInheritanceTest);
  6044. smalltalk.addMethod(
  6045. smalltalk.method({
  6046. selector: "shouldMNUTop",
  6047. protocol: 'testing',
  6048. fn: function (){
  6049. var self=this;
  6050. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6051. return smalltalk.withContext(function($ctx1) {
  6052. self._should_raise_((function(){
  6053. return smalltalk.withContext(function($ctx2) {
  6054. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6056. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  6057. args: [],
  6058. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6059. messageSends: ["should:raise:", "value:"],
  6060. referencedClasses: ["MessageNotUnderstood"]
  6061. }),
  6062. smalltalk.MethodInheritanceTest);
  6063. smalltalk.addMethod(
  6064. smalltalk.method({
  6065. selector: "shouldReturn:",
  6066. protocol: 'testing',
  6067. fn: function (anObject){
  6068. var self=this;
  6069. var result;
  6070. return smalltalk.withContext(function($ctx1) {
  6071. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6072. $ctx1.sendIdx["value:"]=1;
  6073. self._assert_equals_(["top",anObject],["top",result]);
  6074. $ctx1.sendIdx["assert:equals:"]=1;
  6075. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6076. $ctx1.sendIdx["value:"]=2;
  6077. self._assert_equals_(["middle",anObject],["middle",result]);
  6078. $ctx1.sendIdx["assert:equals:"]=2;
  6079. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6080. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6081. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  6082. args: ["anObject"],
  6083. 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 }",
  6084. messageSends: ["value:", "assert:equals:"],
  6085. referencedClasses: []
  6086. }),
  6087. smalltalk.MethodInheritanceTest);
  6088. smalltalk.addMethod(
  6089. smalltalk.method({
  6090. selector: "shouldReturn:and:and:",
  6091. protocol: 'testing',
  6092. fn: function (anObject,anObject2,anObject3){
  6093. var self=this;
  6094. var result;
  6095. return smalltalk.withContext(function($ctx1) {
  6096. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6097. $ctx1.sendIdx["value:"]=1;
  6098. self._assert_equals_(["top",anObject],["top",result]);
  6099. $ctx1.sendIdx["assert:equals:"]=1;
  6100. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6101. $ctx1.sendIdx["value:"]=2;
  6102. self._assert_equals_(["middle",anObject2],["middle",result]);
  6103. $ctx1.sendIdx["assert:equals:"]=2;
  6104. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6105. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6106. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  6107. args: ["anObject", "anObject2", "anObject3"],
  6108. 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 }",
  6109. messageSends: ["value:", "assert:equals:"],
  6110. referencedClasses: []
  6111. }),
  6112. smalltalk.MethodInheritanceTest);
  6113. smalltalk.addMethod(
  6114. smalltalk.method({
  6115. selector: "targetClassBottom",
  6116. protocol: 'accessing',
  6117. fn: function (){
  6118. var self=this;
  6119. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6120. return smalltalk.withContext(function($ctx1) {
  6121. return $JavaScriptException();
  6122. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  6123. args: [],
  6124. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6125. messageSends: [],
  6126. referencedClasses: ["JavaScriptException"]
  6127. }),
  6128. smalltalk.MethodInheritanceTest);
  6129. smalltalk.addMethod(
  6130. smalltalk.method({
  6131. selector: "targetClassMiddle",
  6132. protocol: 'accessing',
  6133. fn: function (){
  6134. var self=this;
  6135. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6136. return smalltalk.withContext(function($ctx1) {
  6137. return $Error();
  6138. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  6139. args: [],
  6140. source: "targetClassMiddle\x0a\x09^ Error",
  6141. messageSends: [],
  6142. referencedClasses: ["Error"]
  6143. }),
  6144. smalltalk.MethodInheritanceTest);
  6145. smalltalk.addMethod(
  6146. smalltalk.method({
  6147. selector: "targetClassTop",
  6148. protocol: 'accessing',
  6149. fn: function (){
  6150. var self=this;
  6151. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6152. return smalltalk.withContext(function($ctx1) {
  6153. return $Object();
  6154. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  6155. args: [],
  6156. source: "targetClassTop\x0a\x09^ Object",
  6157. messageSends: [],
  6158. referencedClasses: ["Object"]
  6159. }),
  6160. smalltalk.MethodInheritanceTest);
  6161. smalltalk.addMethod(
  6162. smalltalk.method({
  6163. selector: "tearDown",
  6164. protocol: 'initialization',
  6165. fn: function (){
  6166. var self=this;
  6167. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6168. return smalltalk.withContext(function($ctx1) {
  6169. _st((function(){
  6170. return smalltalk.withContext(function($ctx2) {
  6171. return self._deinstallTop();
  6172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6173. return smalltalk.withContext(function($ctx2) {
  6174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6175. $ctx1.sendIdx["on:do:"]=1;
  6176. _st((function(){
  6177. return smalltalk.withContext(function($ctx2) {
  6178. return self._deinstallMiddle();
  6179. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6180. return smalltalk.withContext(function($ctx2) {
  6181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  6182. $ctx1.sendIdx["on:do:"]=2;
  6183. _st((function(){
  6184. return smalltalk.withContext(function($ctx2) {
  6185. return self._deinstallBottom();
  6186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6187. return smalltalk.withContext(function($ctx2) {
  6188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  6189. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  6190. args: [],
  6191. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6192. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6193. referencedClasses: ["Error"]
  6194. }),
  6195. smalltalk.MethodInheritanceTest);
  6196. smalltalk.addMethod(
  6197. smalltalk.method({
  6198. selector: "testMNU11",
  6199. protocol: 'tests',
  6200. fn: function (){
  6201. var self=this;
  6202. return smalltalk.withContext(function($ctx1) {
  6203. self["@performBlock"]=(function(x){
  6204. return smalltalk.withContext(function($ctx2) {
  6205. return _st(x)._foo();
  6206. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6207. self._shouldMNU();
  6208. $ctx1.sendIdx["shouldMNU"]=1;
  6209. self._installTop_("foo ^ false");
  6210. $ctx1.sendIdx["installTop:"]=1;
  6211. self._installTop_("foo ^ true");
  6212. self._deinstallTop();
  6213. self._shouldMNU();
  6214. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  6215. args: [],
  6216. 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",
  6217. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6218. referencedClasses: []
  6219. }),
  6220. smalltalk.MethodInheritanceTest);
  6221. smalltalk.addMethod(
  6222. smalltalk.method({
  6223. selector: "testMNU22",
  6224. protocol: 'tests',
  6225. fn: function (){
  6226. var self=this;
  6227. return smalltalk.withContext(function($ctx1) {
  6228. self["@performBlock"]=(function(x){
  6229. return smalltalk.withContext(function($ctx2) {
  6230. return _st(x)._foo();
  6231. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6232. self._shouldMNU();
  6233. $ctx1.sendIdx["shouldMNU"]=1;
  6234. self._installMiddle_("foo ^ false");
  6235. $ctx1.sendIdx["installMiddle:"]=1;
  6236. self._installMiddle_("foo ^ true");
  6237. self._deinstallMiddle();
  6238. self._shouldMNU();
  6239. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  6240. args: [],
  6241. 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",
  6242. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6243. referencedClasses: []
  6244. }),
  6245. smalltalk.MethodInheritanceTest);
  6246. smalltalk.addMethod(
  6247. smalltalk.method({
  6248. selector: "testReturns1",
  6249. protocol: 'tests',
  6250. fn: function (){
  6251. var self=this;
  6252. return smalltalk.withContext(function($ctx1) {
  6253. self["@performBlock"]=(function(x){
  6254. return smalltalk.withContext(function($ctx2) {
  6255. return _st(x)._foo();
  6256. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6257. self._installTop_("foo ^ false");
  6258. $ctx1.sendIdx["installTop:"]=1;
  6259. self._shouldReturn_(false);
  6260. $ctx1.sendIdx["shouldReturn:"]=1;
  6261. self._installTop_("foo ^ true");
  6262. self._shouldReturn_(true);
  6263. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  6264. args: [],
  6265. 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",
  6266. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6267. referencedClasses: []
  6268. }),
  6269. smalltalk.MethodInheritanceTest);
  6270. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6271. smalltalk.addMethod(
  6272. smalltalk.method({
  6273. selector: "testAbs",
  6274. protocol: 'tests',
  6275. fn: function (){
  6276. var self=this;
  6277. return smalltalk.withContext(function($ctx1) {
  6278. var $1;
  6279. $1=(4)._abs();
  6280. $ctx1.sendIdx["abs"]=1;
  6281. self._assert_equals_($1,(4));
  6282. $ctx1.sendIdx["assert:equals:"]=1;
  6283. self._assert_equals_((-4)._abs(),(4));
  6284. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  6285. args: [],
  6286. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6287. messageSends: ["assert:equals:", "abs"],
  6288. referencedClasses: []
  6289. }),
  6290. smalltalk.NumberTest);
  6291. smalltalk.addMethod(
  6292. smalltalk.method({
  6293. selector: "testArithmetic",
  6294. protocol: 'tests',
  6295. fn: function (){
  6296. var self=this;
  6297. return smalltalk.withContext(function($ctx1) {
  6298. var $1,$2,$3,$5,$4;
  6299. $1=(1.5).__plus((1));
  6300. $ctx1.sendIdx["+"]=1;
  6301. self._assert_equals_($1,(2.5));
  6302. $ctx1.sendIdx["assert:equals:"]=1;
  6303. $2=(2).__minus((1));
  6304. $ctx1.sendIdx["-"]=1;
  6305. self._assert_equals_($2,(1));
  6306. $ctx1.sendIdx["assert:equals:"]=2;
  6307. self._assert_equals_((-2).__minus((1)),(-3));
  6308. $ctx1.sendIdx["assert:equals:"]=3;
  6309. self._assert_equals_((12).__slash((2)),(6));
  6310. $ctx1.sendIdx["assert:equals:"]=4;
  6311. $3=(3).__star((4));
  6312. $ctx1.sendIdx["*"]=1;
  6313. self._assert_equals_($3,(12));
  6314. $ctx1.sendIdx["assert:equals:"]=5;
  6315. self._assert_equals_((7).__slash_slash((2)),(3));
  6316. $ctx1.sendIdx["assert:equals:"]=6;
  6317. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6318. $ctx1.sendIdx["assert:equals:"]=7;
  6319. $5=(1).__plus((2));
  6320. $ctx1.sendIdx["+"]=2;
  6321. $4=_st($5).__star((3));
  6322. $ctx1.sendIdx["*"]=2;
  6323. self._assert_equals_($4,(9));
  6324. $ctx1.sendIdx["assert:equals:"]=8;
  6325. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6326. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  6327. args: [],
  6328. 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",
  6329. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6330. referencedClasses: []
  6331. }),
  6332. smalltalk.NumberTest);
  6333. smalltalk.addMethod(
  6334. smalltalk.method({
  6335. selector: "testAsNumber",
  6336. protocol: 'tests',
  6337. fn: function (){
  6338. var self=this;
  6339. return smalltalk.withContext(function($ctx1) {
  6340. self._assert_equals_((3)._asNumber(),(3));
  6341. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  6342. args: [],
  6343. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6344. messageSends: ["assert:equals:", "asNumber"],
  6345. referencedClasses: []
  6346. }),
  6347. smalltalk.NumberTest);
  6348. smalltalk.addMethod(
  6349. smalltalk.method({
  6350. selector: "testCeiling",
  6351. protocol: 'tests',
  6352. fn: function (){
  6353. var self=this;
  6354. return smalltalk.withContext(function($ctx1) {
  6355. var $1,$2;
  6356. $1=(1.2)._ceiling();
  6357. $ctx1.sendIdx["ceiling"]=1;
  6358. self._assert_equals_($1,(2));
  6359. $ctx1.sendIdx["assert:equals:"]=1;
  6360. $2=(-1.2)._ceiling();
  6361. $ctx1.sendIdx["ceiling"]=2;
  6362. self._assert_equals_($2,(-1));
  6363. $ctx1.sendIdx["assert:equals:"]=2;
  6364. self._assert_equals_((1)._ceiling(),(1));
  6365. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  6366. args: [],
  6367. 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.",
  6368. messageSends: ["assert:equals:", "ceiling"],
  6369. referencedClasses: []
  6370. }),
  6371. smalltalk.NumberTest);
  6372. smalltalk.addMethod(
  6373. smalltalk.method({
  6374. selector: "testComparison",
  6375. protocol: 'tests',
  6376. fn: function (){
  6377. var self=this;
  6378. return smalltalk.withContext(function($ctx1) {
  6379. var $1,$2,$3,$4;
  6380. $1=(3).__gt((2));
  6381. $ctx1.sendIdx[">"]=1;
  6382. self._assert_($1);
  6383. $ctx1.sendIdx["assert:"]=1;
  6384. $2=(2).__lt((3));
  6385. $ctx1.sendIdx["<"]=1;
  6386. self._assert_($2);
  6387. $ctx1.sendIdx["assert:"]=2;
  6388. self._deny_((3).__lt((2)));
  6389. $ctx1.sendIdx["deny:"]=1;
  6390. self._deny_((2).__gt((3)));
  6391. $3=(3).__gt_eq((3));
  6392. $ctx1.sendIdx[">="]=1;
  6393. self._assert_($3);
  6394. $ctx1.sendIdx["assert:"]=3;
  6395. self._assert_((3.1).__gt_eq((3)));
  6396. $ctx1.sendIdx["assert:"]=4;
  6397. $4=(3).__lt_eq((3));
  6398. $ctx1.sendIdx["<="]=1;
  6399. self._assert_($4);
  6400. $ctx1.sendIdx["assert:"]=5;
  6401. self._assert_((3).__lt_eq((3.1)));
  6402. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  6403. args: [],
  6404. 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",
  6405. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6406. referencedClasses: []
  6407. }),
  6408. smalltalk.NumberTest);
  6409. smalltalk.addMethod(
  6410. smalltalk.method({
  6411. selector: "testCopying",
  6412. protocol: 'tests',
  6413. fn: function (){
  6414. var self=this;
  6415. return smalltalk.withContext(function($ctx1) {
  6416. var $1;
  6417. $1=_st((1)._copy()).__eq_eq((1));
  6418. $ctx1.sendIdx["=="]=1;
  6419. self._assert_($1);
  6420. $ctx1.sendIdx["assert:"]=1;
  6421. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6422. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  6423. args: [],
  6424. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6425. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6426. referencedClasses: []
  6427. }),
  6428. smalltalk.NumberTest);
  6429. smalltalk.addMethod(
  6430. smalltalk.method({
  6431. selector: "testEquality",
  6432. protocol: 'tests',
  6433. fn: function (){
  6434. var self=this;
  6435. return smalltalk.withContext(function($ctx1) {
  6436. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6437. $1=(1).__eq((1));
  6438. $ctx1.sendIdx["="]=1;
  6439. self._assert_($1);
  6440. $ctx1.sendIdx["assert:"]=1;
  6441. $2=(0).__eq((0));
  6442. $ctx1.sendIdx["="]=2;
  6443. self._assert_($2);
  6444. $ctx1.sendIdx["assert:"]=2;
  6445. $3=(1).__eq((0));
  6446. $ctx1.sendIdx["="]=3;
  6447. self._deny_($3);
  6448. $ctx1.sendIdx["deny:"]=1;
  6449. $5=(1)._yourself();
  6450. $ctx1.sendIdx["yourself"]=1;
  6451. $4=_st($5).__eq((1));
  6452. $ctx1.sendIdx["="]=4;
  6453. self._assert_($4);
  6454. $ctx1.sendIdx["assert:"]=3;
  6455. $7=(1)._yourself();
  6456. $ctx1.sendIdx["yourself"]=2;
  6457. $6=(1).__eq($7);
  6458. $ctx1.sendIdx["="]=5;
  6459. self._assert_($6);
  6460. $ctx1.sendIdx["assert:"]=4;
  6461. $9=(1)._yourself();
  6462. $ctx1.sendIdx["yourself"]=3;
  6463. $8=_st($9).__eq((1)._yourself());
  6464. $ctx1.sendIdx["="]=6;
  6465. self._assert_($8);
  6466. $10=(0).__eq(false);
  6467. $ctx1.sendIdx["="]=7;
  6468. self._deny_($10);
  6469. $ctx1.sendIdx["deny:"]=2;
  6470. $11=false.__eq((0));
  6471. $ctx1.sendIdx["="]=8;
  6472. self._deny_($11);
  6473. $ctx1.sendIdx["deny:"]=3;
  6474. $12="".__eq((0));
  6475. $ctx1.sendIdx["="]=9;
  6476. self._deny_($12);
  6477. $ctx1.sendIdx["deny:"]=4;
  6478. self._deny_((0).__eq(""));
  6479. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  6480. args: [],
  6481. 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 = ''",
  6482. messageSends: ["assert:", "=", "deny:", "yourself"],
  6483. referencedClasses: []
  6484. }),
  6485. smalltalk.NumberTest);
  6486. smalltalk.addMethod(
  6487. smalltalk.method({
  6488. selector: "testFloor",
  6489. protocol: 'tests',
  6490. fn: function (){
  6491. var self=this;
  6492. return smalltalk.withContext(function($ctx1) {
  6493. var $1,$2;
  6494. $1=(1.2)._floor();
  6495. $ctx1.sendIdx["floor"]=1;
  6496. self._assert_equals_($1,(1));
  6497. $ctx1.sendIdx["assert:equals:"]=1;
  6498. $2=(-1.2)._floor();
  6499. $ctx1.sendIdx["floor"]=2;
  6500. self._assert_equals_($2,(-2));
  6501. $ctx1.sendIdx["assert:equals:"]=2;
  6502. self._assert_equals_((1)._floor(),(1));
  6503. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  6504. args: [],
  6505. 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.",
  6506. messageSends: ["assert:equals:", "floor"],
  6507. referencedClasses: []
  6508. }),
  6509. smalltalk.NumberTest);
  6510. smalltalk.addMethod(
  6511. smalltalk.method({
  6512. selector: "testHexNumbers",
  6513. protocol: 'tests',
  6514. fn: function (){
  6515. var self=this;
  6516. return smalltalk.withContext(function($ctx1) {
  6517. var $1,$2,$3,$4,$5;
  6518. self._assert_equals_((9),(9));
  6519. $ctx1.sendIdx["assert:equals:"]=1;
  6520. $1=(10)._truncated();
  6521. $ctx1.sendIdx["truncated"]=1;
  6522. self._assert_equals_($1,(10));
  6523. $ctx1.sendIdx["assert:equals:"]=2;
  6524. $2=(11)._truncated();
  6525. $ctx1.sendIdx["truncated"]=2;
  6526. self._assert_equals_($2,(11));
  6527. $ctx1.sendIdx["assert:equals:"]=3;
  6528. $3=(12)._truncated();
  6529. $ctx1.sendIdx["truncated"]=3;
  6530. self._assert_equals_($3,(12));
  6531. $ctx1.sendIdx["assert:equals:"]=4;
  6532. $4=(13)._truncated();
  6533. $ctx1.sendIdx["truncated"]=4;
  6534. self._assert_equals_($4,(13));
  6535. $ctx1.sendIdx["assert:equals:"]=5;
  6536. $5=(14)._truncated();
  6537. $ctx1.sendIdx["truncated"]=5;
  6538. self._assert_equals_($5,(14));
  6539. $ctx1.sendIdx["assert:equals:"]=6;
  6540. self._assert_equals_((15)._truncated(),(15));
  6541. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  6542. args: [],
  6543. 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",
  6544. messageSends: ["assert:equals:", "truncated"],
  6545. referencedClasses: []
  6546. }),
  6547. smalltalk.NumberTest);
  6548. smalltalk.addMethod(
  6549. smalltalk.method({
  6550. selector: "testIdentity",
  6551. protocol: 'tests',
  6552. fn: function (){
  6553. var self=this;
  6554. return smalltalk.withContext(function($ctx1) {
  6555. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6556. $1=(1).__eq_eq((1));
  6557. $ctx1.sendIdx["=="]=1;
  6558. self._assert_($1);
  6559. $ctx1.sendIdx["assert:"]=1;
  6560. $2=(0).__eq_eq((0));
  6561. $ctx1.sendIdx["=="]=2;
  6562. self._assert_($2);
  6563. $ctx1.sendIdx["assert:"]=2;
  6564. $3=(1).__eq_eq((0));
  6565. $ctx1.sendIdx["=="]=3;
  6566. self._deny_($3);
  6567. $ctx1.sendIdx["deny:"]=1;
  6568. $5=(1)._yourself();
  6569. $ctx1.sendIdx["yourself"]=1;
  6570. $4=_st($5).__eq_eq((1));
  6571. $ctx1.sendIdx["=="]=4;
  6572. self._assert_($4);
  6573. $ctx1.sendIdx["assert:"]=3;
  6574. $7=(1)._yourself();
  6575. $ctx1.sendIdx["yourself"]=2;
  6576. $6=(1).__eq_eq($7);
  6577. $ctx1.sendIdx["=="]=5;
  6578. self._assert_($6);
  6579. $ctx1.sendIdx["assert:"]=4;
  6580. $9=(1)._yourself();
  6581. $ctx1.sendIdx["yourself"]=3;
  6582. $8=_st($9).__eq_eq((1)._yourself());
  6583. $ctx1.sendIdx["=="]=6;
  6584. self._assert_($8);
  6585. self._deny_((1).__eq_eq((2)));
  6586. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  6587. args: [],
  6588. 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",
  6589. messageSends: ["assert:", "==", "deny:", "yourself"],
  6590. referencedClasses: []
  6591. }),
  6592. smalltalk.NumberTest);
  6593. smalltalk.addMethod(
  6594. smalltalk.method({
  6595. selector: "testInvalidHexNumbers",
  6596. protocol: 'tests',
  6597. fn: function (){
  6598. var self=this;
  6599. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6600. return smalltalk.withContext(function($ctx1) {
  6601. self._should_raise_((function(){
  6602. return smalltalk.withContext(function($ctx2) {
  6603. return (16)._rG();
  6604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6605. $ctx1.sendIdx["should:raise:"]=1;
  6606. self._should_raise_((function(){
  6607. return smalltalk.withContext(function($ctx2) {
  6608. return (16)._rg();
  6609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6610. $ctx1.sendIdx["should:raise:"]=2;
  6611. self._should_raise_((function(){
  6612. return smalltalk.withContext(function($ctx2) {
  6613. return (16)._rH();
  6614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6615. $ctx1.sendIdx["should:raise:"]=3;
  6616. self._should_raise_((function(){
  6617. return smalltalk.withContext(function($ctx2) {
  6618. return (16)._rh();
  6619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6620. $ctx1.sendIdx["should:raise:"]=4;
  6621. self._should_raise_((function(){
  6622. return smalltalk.withContext(function($ctx2) {
  6623. return (16)._rI();
  6624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6625. $ctx1.sendIdx["should:raise:"]=5;
  6626. self._should_raise_((function(){
  6627. return smalltalk.withContext(function($ctx2) {
  6628. return (16)._ri();
  6629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6630. $ctx1.sendIdx["should:raise:"]=6;
  6631. self._should_raise_((function(){
  6632. return smalltalk.withContext(function($ctx2) {
  6633. return (16)._rJ();
  6634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6635. $ctx1.sendIdx["should:raise:"]=7;
  6636. self._should_raise_((function(){
  6637. return smalltalk.withContext(function($ctx2) {
  6638. return (16)._rj();
  6639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6640. $ctx1.sendIdx["should:raise:"]=8;
  6641. self._should_raise_((function(){
  6642. return smalltalk.withContext(function($ctx2) {
  6643. return (16)._rK();
  6644. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6645. $ctx1.sendIdx["should:raise:"]=9;
  6646. self._should_raise_((function(){
  6647. return smalltalk.withContext(function($ctx2) {
  6648. return (16)._rk();
  6649. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6650. $ctx1.sendIdx["should:raise:"]=10;
  6651. self._should_raise_((function(){
  6652. return smalltalk.withContext(function($ctx2) {
  6653. return (16)._rL();
  6654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6655. $ctx1.sendIdx["should:raise:"]=11;
  6656. self._should_raise_((function(){
  6657. return smalltalk.withContext(function($ctx2) {
  6658. return (16)._rl();
  6659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6660. $ctx1.sendIdx["should:raise:"]=12;
  6661. self._should_raise_((function(){
  6662. return smalltalk.withContext(function($ctx2) {
  6663. return (16)._rM();
  6664. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6665. $ctx1.sendIdx["should:raise:"]=13;
  6666. self._should_raise_((function(){
  6667. return smalltalk.withContext(function($ctx2) {
  6668. return (16)._rm();
  6669. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6670. $ctx1.sendIdx["should:raise:"]=14;
  6671. self._should_raise_((function(){
  6672. return smalltalk.withContext(function($ctx2) {
  6673. return (16)._rN();
  6674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6675. $ctx1.sendIdx["should:raise:"]=15;
  6676. self._should_raise_((function(){
  6677. return smalltalk.withContext(function($ctx2) {
  6678. return (16)._rn();
  6679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6680. $ctx1.sendIdx["should:raise:"]=16;
  6681. self._should_raise_((function(){
  6682. return smalltalk.withContext(function($ctx2) {
  6683. return (16)._rO();
  6684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6685. $ctx1.sendIdx["should:raise:"]=17;
  6686. self._should_raise_((function(){
  6687. return smalltalk.withContext(function($ctx2) {
  6688. return (16)._ro();
  6689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6690. $ctx1.sendIdx["should:raise:"]=18;
  6691. self._should_raise_((function(){
  6692. return smalltalk.withContext(function($ctx2) {
  6693. return (16)._rP();
  6694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6695. $ctx1.sendIdx["should:raise:"]=19;
  6696. self._should_raise_((function(){
  6697. return smalltalk.withContext(function($ctx2) {
  6698. return (16)._rp();
  6699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6700. $ctx1.sendIdx["should:raise:"]=20;
  6701. self._should_raise_((function(){
  6702. return smalltalk.withContext(function($ctx2) {
  6703. return (16)._rQ();
  6704. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6705. $ctx1.sendIdx["should:raise:"]=21;
  6706. self._should_raise_((function(){
  6707. return smalltalk.withContext(function($ctx2) {
  6708. return (16)._rq();
  6709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6710. $ctx1.sendIdx["should:raise:"]=22;
  6711. self._should_raise_((function(){
  6712. return smalltalk.withContext(function($ctx2) {
  6713. return (16)._rR();
  6714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6715. $ctx1.sendIdx["should:raise:"]=23;
  6716. self._should_raise_((function(){
  6717. return smalltalk.withContext(function($ctx2) {
  6718. return (16)._rr();
  6719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6720. $ctx1.sendIdx["should:raise:"]=24;
  6721. self._should_raise_((function(){
  6722. return smalltalk.withContext(function($ctx2) {
  6723. return (16)._rS();
  6724. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6725. $ctx1.sendIdx["should:raise:"]=25;
  6726. self._should_raise_((function(){
  6727. return smalltalk.withContext(function($ctx2) {
  6728. return (16)._rs();
  6729. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6730. $ctx1.sendIdx["should:raise:"]=26;
  6731. self._should_raise_((function(){
  6732. return smalltalk.withContext(function($ctx2) {
  6733. return (16)._rT();
  6734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6735. $ctx1.sendIdx["should:raise:"]=27;
  6736. self._should_raise_((function(){
  6737. return smalltalk.withContext(function($ctx2) {
  6738. return (16)._rt();
  6739. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6740. $ctx1.sendIdx["should:raise:"]=28;
  6741. self._should_raise_((function(){
  6742. return smalltalk.withContext(function($ctx2) {
  6743. return (16)._rU();
  6744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6745. $ctx1.sendIdx["should:raise:"]=29;
  6746. self._should_raise_((function(){
  6747. return smalltalk.withContext(function($ctx2) {
  6748. return (16)._ru();
  6749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6750. $ctx1.sendIdx["should:raise:"]=30;
  6751. self._should_raise_((function(){
  6752. return smalltalk.withContext(function($ctx2) {
  6753. return (16)._rV();
  6754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6755. $ctx1.sendIdx["should:raise:"]=31;
  6756. self._should_raise_((function(){
  6757. return smalltalk.withContext(function($ctx2) {
  6758. return (16)._rv();
  6759. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6760. $ctx1.sendIdx["should:raise:"]=32;
  6761. self._should_raise_((function(){
  6762. return smalltalk.withContext(function($ctx2) {
  6763. return (16)._rW();
  6764. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6765. $ctx1.sendIdx["should:raise:"]=33;
  6766. self._should_raise_((function(){
  6767. return smalltalk.withContext(function($ctx2) {
  6768. return (16)._rw();
  6769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6770. $ctx1.sendIdx["should:raise:"]=34;
  6771. self._should_raise_((function(){
  6772. return smalltalk.withContext(function($ctx2) {
  6773. return (16)._rX();
  6774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6775. $ctx1.sendIdx["should:raise:"]=35;
  6776. self._should_raise_((function(){
  6777. return smalltalk.withContext(function($ctx2) {
  6778. return (16)._rx();
  6779. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6780. $ctx1.sendIdx["should:raise:"]=36;
  6781. self._should_raise_((function(){
  6782. return smalltalk.withContext(function($ctx2) {
  6783. return (16)._rY();
  6784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6785. $ctx1.sendIdx["should:raise:"]=37;
  6786. self._should_raise_((function(){
  6787. return smalltalk.withContext(function($ctx2) {
  6788. return (16)._ry();
  6789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6790. $ctx1.sendIdx["should:raise:"]=38;
  6791. self._should_raise_((function(){
  6792. return smalltalk.withContext(function($ctx2) {
  6793. return (16)._rZ();
  6794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6795. $ctx1.sendIdx["should:raise:"]=39;
  6796. self._should_raise_((function(){
  6797. return smalltalk.withContext(function($ctx2) {
  6798. return (16)._rz();
  6799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6800. $ctx1.sendIdx["should:raise:"]=40;
  6801. self._should_raise_((function(){
  6802. return smalltalk.withContext(function($ctx2) {
  6803. return (11259375)._Z();
  6804. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6805. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  6806. args: [],
  6807. 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.",
  6808. 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"],
  6809. referencedClasses: ["MessageNotUnderstood"]
  6810. }),
  6811. smalltalk.NumberTest);
  6812. smalltalk.addMethod(
  6813. smalltalk.method({
  6814. selector: "testLog",
  6815. protocol: 'tests',
  6816. fn: function (){
  6817. var self=this;
  6818. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  6819. return smalltalk.withContext(function($ctx1) {
  6820. self._assert_equals_((10000)._log(),(4));
  6821. $ctx1.sendIdx["assert:equals:"]=1;
  6822. self._assert_equals_((512)._log_((2)),(9));
  6823. $ctx1.sendIdx["assert:equals:"]=2;
  6824. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  6825. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  6826. args: [],
  6827. 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.",
  6828. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  6829. referencedClasses: ["Number"]
  6830. }),
  6831. smalltalk.NumberTest);
  6832. smalltalk.addMethod(
  6833. smalltalk.method({
  6834. selector: "testMinMax",
  6835. protocol: 'tests',
  6836. fn: function (){
  6837. var self=this;
  6838. return smalltalk.withContext(function($ctx1) {
  6839. self._assert_equals_((2)._max_((5)),(5));
  6840. $ctx1.sendIdx["assert:equals:"]=1;
  6841. self._assert_equals_((2)._min_((5)),(2));
  6842. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  6843. args: [],
  6844. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  6845. messageSends: ["assert:equals:", "max:", "min:"],
  6846. referencedClasses: []
  6847. }),
  6848. smalltalk.NumberTest);
  6849. smalltalk.addMethod(
  6850. smalltalk.method({
  6851. selector: "testNegated",
  6852. protocol: 'tests',
  6853. fn: function (){
  6854. var self=this;
  6855. return smalltalk.withContext(function($ctx1) {
  6856. var $1;
  6857. $1=(3)._negated();
  6858. $ctx1.sendIdx["negated"]=1;
  6859. self._assert_equals_($1,(-3));
  6860. $ctx1.sendIdx["assert:equals:"]=1;
  6861. self._assert_equals_((-3)._negated(),(3));
  6862. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  6863. args: [],
  6864. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  6865. messageSends: ["assert:equals:", "negated"],
  6866. referencedClasses: []
  6867. }),
  6868. smalltalk.NumberTest);
  6869. smalltalk.addMethod(
  6870. smalltalk.method({
  6871. selector: "testPrintShowingDecimalPlaces",
  6872. protocol: 'tests',
  6873. fn: function (){
  6874. var self=this;
  6875. return smalltalk.withContext(function($ctx1) {
  6876. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  6877. $1=(23)._printShowingDecimalPlaces_((2));
  6878. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  6879. self._assert_equals_($1,"23.00");
  6880. $ctx1.sendIdx["assert:equals:"]=1;
  6881. $2=(23.5698)._printShowingDecimalPlaces_((2));
  6882. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  6883. self._assert_equals_($2,"23.57");
  6884. $ctx1.sendIdx["assert:equals:"]=2;
  6885. $4=(234.567)._negated();
  6886. $ctx1.sendIdx["negated"]=1;
  6887. $3=_st($4)._printShowingDecimalPlaces_((5));
  6888. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  6889. self._assert_equals_($3,"-234.56700");
  6890. $ctx1.sendIdx["assert:equals:"]=3;
  6891. $5=(23.4567)._printShowingDecimalPlaces_((0));
  6892. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  6893. self._assert_equals_($5,"23");
  6894. $ctx1.sendIdx["assert:equals:"]=4;
  6895. $6=(23.5567)._printShowingDecimalPlaces_((0));
  6896. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  6897. self._assert_equals_($6,"24");
  6898. $ctx1.sendIdx["assert:equals:"]=5;
  6899. $8=(23.4567)._negated();
  6900. $ctx1.sendIdx["negated"]=2;
  6901. $7=_st($8)._printShowingDecimalPlaces_((0));
  6902. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  6903. self._assert_equals_($7,"-23");
  6904. $ctx1.sendIdx["assert:equals:"]=6;
  6905. $10=(23.5567)._negated();
  6906. $ctx1.sendIdx["negated"]=3;
  6907. $9=_st($10)._printShowingDecimalPlaces_((0));
  6908. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  6909. self._assert_equals_($9,"-24");
  6910. $ctx1.sendIdx["assert:equals:"]=7;
  6911. $11=(100000000)._printShowingDecimalPlaces_((1));
  6912. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  6913. self._assert_equals_($11,"100000000.0");
  6914. $ctx1.sendIdx["assert:equals:"]=8;
  6915. $12=(0.98)._printShowingDecimalPlaces_((5));
  6916. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  6917. self._assert_equals_($12,"0.98000");
  6918. $ctx1.sendIdx["assert:equals:"]=9;
  6919. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  6920. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  6921. self._assert_equals_($13,"-0.98");
  6922. $ctx1.sendIdx["assert:equals:"]=10;
  6923. $14=(2.567)._printShowingDecimalPlaces_((2));
  6924. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  6925. self._assert_equals_($14,"2.57");
  6926. $ctx1.sendIdx["assert:equals:"]=11;
  6927. $15=(-2.567)._printShowingDecimalPlaces_((2));
  6928. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  6929. self._assert_equals_($15,"-2.57");
  6930. $ctx1.sendIdx["assert:equals:"]=12;
  6931. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  6932. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  6933. args: [],
  6934. 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'.",
  6935. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  6936. referencedClasses: []
  6937. }),
  6938. smalltalk.NumberTest);
  6939. smalltalk.addMethod(
  6940. smalltalk.method({
  6941. selector: "testRaisedTo",
  6942. protocol: 'tests',
  6943. fn: function (){
  6944. var self=this;
  6945. return smalltalk.withContext(function($ctx1) {
  6946. var $1,$2,$3;
  6947. $1=(2)._raisedTo_((4));
  6948. $ctx1.sendIdx["raisedTo:"]=1;
  6949. self._assert_equals_($1,(16));
  6950. $ctx1.sendIdx["assert:equals:"]=1;
  6951. $2=(2)._raisedTo_((0));
  6952. $ctx1.sendIdx["raisedTo:"]=2;
  6953. self._assert_equals_($2,(1));
  6954. $ctx1.sendIdx["assert:equals:"]=2;
  6955. $3=(2)._raisedTo_((-3));
  6956. $ctx1.sendIdx["raisedTo:"]=3;
  6957. self._assert_equals_($3,(0.125));
  6958. $ctx1.sendIdx["assert:equals:"]=3;
  6959. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  6960. $ctx1.sendIdx["assert:equals:"]=4;
  6961. self._assert_equals_((2).__star_star((4)),(16));
  6962. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  6963. args: [],
  6964. 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.",
  6965. messageSends: ["assert:equals:", "raisedTo:", "**"],
  6966. referencedClasses: []
  6967. }),
  6968. smalltalk.NumberTest);
  6969. smalltalk.addMethod(
  6970. smalltalk.method({
  6971. selector: "testRounded",
  6972. protocol: 'tests',
  6973. fn: function (){
  6974. var self=this;
  6975. return smalltalk.withContext(function($ctx1) {
  6976. var $1,$2;
  6977. $1=(3)._rounded();
  6978. $ctx1.sendIdx["rounded"]=1;
  6979. self._assert_equals_($1,(3));
  6980. $ctx1.sendIdx["assert:equals:"]=1;
  6981. $2=(3.212)._rounded();
  6982. $ctx1.sendIdx["rounded"]=2;
  6983. self._assert_equals_($2,(3));
  6984. $ctx1.sendIdx["assert:equals:"]=2;
  6985. self._assert_equals_((3.51)._rounded(),(4));
  6986. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  6987. args: [],
  6988. 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",
  6989. messageSends: ["assert:equals:", "rounded"],
  6990. referencedClasses: []
  6991. }),
  6992. smalltalk.NumberTest);
  6993. smalltalk.addMethod(
  6994. smalltalk.method({
  6995. selector: "testSign",
  6996. protocol: 'tests',
  6997. fn: function (){
  6998. var self=this;
  6999. return smalltalk.withContext(function($ctx1) {
  7000. var $1,$2;
  7001. $1=(5)._sign();
  7002. $ctx1.sendIdx["sign"]=1;
  7003. self._assert_equals_($1,(1));
  7004. $ctx1.sendIdx["assert:equals:"]=1;
  7005. $2=(0)._sign();
  7006. $ctx1.sendIdx["sign"]=2;
  7007. self._assert_equals_($2,(0));
  7008. $ctx1.sendIdx["assert:equals:"]=2;
  7009. self._assert_equals_((-1.4)._sign(),(-1));
  7010. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  7011. args: [],
  7012. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7013. messageSends: ["assert:equals:", "sign"],
  7014. referencedClasses: []
  7015. }),
  7016. smalltalk.NumberTest);
  7017. smalltalk.addMethod(
  7018. smalltalk.method({
  7019. selector: "testSqrt",
  7020. protocol: 'tests',
  7021. fn: function (){
  7022. var self=this;
  7023. return smalltalk.withContext(function($ctx1) {
  7024. var $1;
  7025. $1=(4)._sqrt();
  7026. $ctx1.sendIdx["sqrt"]=1;
  7027. self._assert_equals_($1,(2));
  7028. $ctx1.sendIdx["assert:equals:"]=1;
  7029. self._assert_equals_((16)._sqrt(),(4));
  7030. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  7031. args: [],
  7032. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7033. messageSends: ["assert:equals:", "sqrt"],
  7034. referencedClasses: []
  7035. }),
  7036. smalltalk.NumberTest);
  7037. smalltalk.addMethod(
  7038. smalltalk.method({
  7039. selector: "testSquared",
  7040. protocol: 'tests',
  7041. fn: function (){
  7042. var self=this;
  7043. return smalltalk.withContext(function($ctx1) {
  7044. self._assert_equals_((4)._squared(),(16));
  7045. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  7046. args: [],
  7047. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7048. messageSends: ["assert:equals:", "squared"],
  7049. referencedClasses: []
  7050. }),
  7051. smalltalk.NumberTest);
  7052. smalltalk.addMethod(
  7053. smalltalk.method({
  7054. selector: "testTimesRepeat",
  7055. protocol: 'tests',
  7056. fn: function (){
  7057. var self=this;
  7058. var i;
  7059. return smalltalk.withContext(function($ctx1) {
  7060. i=(0);
  7061. (0)._timesRepeat_((function(){
  7062. return smalltalk.withContext(function($ctx2) {
  7063. i=_st(i).__plus((1));
  7064. $ctx2.sendIdx["+"]=1;
  7065. return i;
  7066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7067. $ctx1.sendIdx["timesRepeat:"]=1;
  7068. self._assert_equals_(i,(0));
  7069. $ctx1.sendIdx["assert:equals:"]=1;
  7070. (5)._timesRepeat_((function(){
  7071. return smalltalk.withContext(function($ctx2) {
  7072. i=_st(i).__plus((1));
  7073. return i;
  7074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7075. self._assert_equals_(i,(5));
  7076. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  7077. args: [],
  7078. 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",
  7079. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7080. referencedClasses: []
  7081. }),
  7082. smalltalk.NumberTest);
  7083. smalltalk.addMethod(
  7084. smalltalk.method({
  7085. selector: "testTo",
  7086. protocol: 'tests',
  7087. fn: function (){
  7088. var self=this;
  7089. return smalltalk.withContext(function($ctx1) {
  7090. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7091. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  7092. args: [],
  7093. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7094. messageSends: ["assert:equals:", "to:"],
  7095. referencedClasses: []
  7096. }),
  7097. smalltalk.NumberTest);
  7098. smalltalk.addMethod(
  7099. smalltalk.method({
  7100. selector: "testToBy",
  7101. protocol: 'tests',
  7102. fn: function (){
  7103. var self=this;
  7104. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7105. return smalltalk.withContext(function($ctx1) {
  7106. var $1;
  7107. $1=(0)._to_by_((6),(2));
  7108. $ctx1.sendIdx["to:by:"]=1;
  7109. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7110. self._should_raise_((function(){
  7111. return smalltalk.withContext(function($ctx2) {
  7112. return (1)._to_by_((4),(0));
  7113. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7114. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  7115. args: [],
  7116. 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",
  7117. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7118. referencedClasses: ["Error"]
  7119. }),
  7120. smalltalk.NumberTest);
  7121. smalltalk.addMethod(
  7122. smalltalk.method({
  7123. selector: "testTrigonometry",
  7124. protocol: 'tests',
  7125. fn: function (){
  7126. var self=this;
  7127. return smalltalk.withContext(function($ctx1) {
  7128. self._assert_equals_((0)._cos(),(1));
  7129. $ctx1.sendIdx["assert:equals:"]=1;
  7130. self._assert_equals_((0)._sin(),(0));
  7131. $ctx1.sendIdx["assert:equals:"]=2;
  7132. self._assert_equals_((0)._tan(),(0));
  7133. $ctx1.sendIdx["assert:equals:"]=3;
  7134. self._assert_equals_((1)._arcCos(),(0));
  7135. $ctx1.sendIdx["assert:equals:"]=4;
  7136. self._assert_equals_((0)._arcSin(),(0));
  7137. $ctx1.sendIdx["assert:equals:"]=5;
  7138. self._assert_equals_((0)._arcTan(),(0));
  7139. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  7140. args: [],
  7141. 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.",
  7142. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7143. referencedClasses: []
  7144. }),
  7145. smalltalk.NumberTest);
  7146. smalltalk.addMethod(
  7147. smalltalk.method({
  7148. selector: "testTruncated",
  7149. protocol: 'tests',
  7150. fn: function (){
  7151. var self=this;
  7152. return smalltalk.withContext(function($ctx1) {
  7153. var $1,$2;
  7154. $1=(3)._truncated();
  7155. $ctx1.sendIdx["truncated"]=1;
  7156. self._assert_equals_($1,(3));
  7157. $ctx1.sendIdx["assert:equals:"]=1;
  7158. $2=(3.212)._truncated();
  7159. $ctx1.sendIdx["truncated"]=2;
  7160. self._assert_equals_($2,(3));
  7161. $ctx1.sendIdx["assert:equals:"]=2;
  7162. self._assert_equals_((3.51)._truncated(),(3));
  7163. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  7164. args: [],
  7165. 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",
  7166. messageSends: ["assert:equals:", "truncated"],
  7167. referencedClasses: []
  7168. }),
  7169. smalltalk.NumberTest);
  7170. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  7171. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7172. smalltalk.addMethod(
  7173. smalltalk.method({
  7174. selector: "foo",
  7175. protocol: 'not yet classified',
  7176. fn: function (){
  7177. var self=this;
  7178. return smalltalk.withContext(function($ctx1) {
  7179. var $1;
  7180. $1=self["@foo"];
  7181. return $1;
  7182. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  7183. args: [],
  7184. source: "foo\x0a\x09^ foo",
  7185. messageSends: [],
  7186. referencedClasses: []
  7187. }),
  7188. smalltalk.ObjectMock);
  7189. smalltalk.addMethod(
  7190. smalltalk.method({
  7191. selector: "foo:",
  7192. protocol: 'not yet classified',
  7193. fn: function (anObject){
  7194. var self=this;
  7195. return smalltalk.withContext(function($ctx1) {
  7196. self["@foo"]=anObject;
  7197. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  7198. args: ["anObject"],
  7199. source: "foo: anObject\x0a\x09foo := anObject",
  7200. messageSends: [],
  7201. referencedClasses: []
  7202. }),
  7203. smalltalk.ObjectMock);
  7204. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7205. smalltalk.addMethod(
  7206. smalltalk.method({
  7207. selector: "notDefined",
  7208. protocol: 'tests',
  7209. fn: function (){
  7210. var self=this;
  7211. return smalltalk.withContext(function($ctx1) {
  7212. return void 0;;
  7213. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  7214. args: [],
  7215. source: "notDefined\x0a\x09<return void 0;>",
  7216. messageSends: [],
  7217. referencedClasses: []
  7218. }),
  7219. smalltalk.ObjectTest);
  7220. smalltalk.addMethod(
  7221. smalltalk.method({
  7222. selector: "testBasicAccess",
  7223. protocol: 'tests',
  7224. fn: function (){
  7225. var self=this;
  7226. var o;
  7227. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7228. return smalltalk.withContext(function($ctx1) {
  7229. var $1;
  7230. o=_st($Object())._new();
  7231. _st(o)._basicAt_put_("a",(1));
  7232. $1=_st(o)._basicAt_("a");
  7233. $ctx1.sendIdx["basicAt:"]=1;
  7234. self._assert_equals_($1,(1));
  7235. $ctx1.sendIdx["assert:equals:"]=1;
  7236. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7237. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  7238. args: [],
  7239. 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",
  7240. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7241. referencedClasses: ["Object"]
  7242. }),
  7243. smalltalk.ObjectTest);
  7244. smalltalk.addMethod(
  7245. smalltalk.method({
  7246. selector: "testBasicPerform",
  7247. protocol: 'tests',
  7248. fn: function (){
  7249. var self=this;
  7250. var o;
  7251. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7252. return smalltalk.withContext(function($ctx1) {
  7253. o=_st($Object())._new();
  7254. _st(o)._basicAt_put_("func",(function(){
  7255. return smalltalk.withContext(function($ctx2) {
  7256. return "hello";
  7257. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7258. $ctx1.sendIdx["basicAt:put:"]=1;
  7259. _st(o)._basicAt_put_("func2",(function(a){
  7260. return smalltalk.withContext(function($ctx2) {
  7261. return _st(a).__plus((1));
  7262. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7263. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7264. $ctx1.sendIdx["assert:equals:"]=1;
  7265. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7266. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  7267. args: [],
  7268. 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",
  7269. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7270. referencedClasses: ["Object"]
  7271. }),
  7272. smalltalk.ObjectTest);
  7273. smalltalk.addMethod(
  7274. smalltalk.method({
  7275. selector: "testDNU",
  7276. protocol: 'tests',
  7277. fn: function (){
  7278. var self=this;
  7279. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7280. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7281. return smalltalk.withContext(function($ctx1) {
  7282. self._should_raise_((function(){
  7283. return smalltalk.withContext(function($ctx2) {
  7284. return _st(_st($Object())._new())._foo();
  7285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7286. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  7287. args: [],
  7288. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7289. messageSends: ["should:raise:", "foo", "new"],
  7290. referencedClasses: ["Object", "MessageNotUnderstood"]
  7291. }),
  7292. smalltalk.ObjectTest);
  7293. smalltalk.addMethod(
  7294. smalltalk.method({
  7295. selector: "testEquality",
  7296. protocol: 'tests',
  7297. fn: function (){
  7298. var self=this;
  7299. var o;
  7300. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7301. return smalltalk.withContext(function($ctx1) {
  7302. var $1,$2,$4,$3;
  7303. o=_st($Object())._new();
  7304. $ctx1.sendIdx["new"]=1;
  7305. $1=_st(o).__eq(_st($Object())._new());
  7306. $ctx1.sendIdx["="]=1;
  7307. self._deny_($1);
  7308. $2=_st(o).__eq(o);
  7309. $ctx1.sendIdx["="]=2;
  7310. self._assert_($2);
  7311. $ctx1.sendIdx["assert:"]=1;
  7312. $4=_st(o)._yourself();
  7313. $ctx1.sendIdx["yourself"]=1;
  7314. $3=_st($4).__eq(o);
  7315. $ctx1.sendIdx["="]=3;
  7316. self._assert_($3);
  7317. $ctx1.sendIdx["assert:"]=2;
  7318. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7319. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  7320. args: [],
  7321. 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)",
  7322. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7323. referencedClasses: ["Object"]
  7324. }),
  7325. smalltalk.ObjectTest);
  7326. smalltalk.addMethod(
  7327. smalltalk.method({
  7328. selector: "testHalt",
  7329. protocol: 'tests',
  7330. fn: function (){
  7331. var self=this;
  7332. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7333. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7334. return smalltalk.withContext(function($ctx1) {
  7335. self._should_raise_((function(){
  7336. return smalltalk.withContext(function($ctx2) {
  7337. return _st(_st($Object())._new())._halt();
  7338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7339. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  7340. args: [],
  7341. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7342. messageSends: ["should:raise:", "halt", "new"],
  7343. referencedClasses: ["Object", "Error"]
  7344. }),
  7345. smalltalk.ObjectTest);
  7346. smalltalk.addMethod(
  7347. smalltalk.method({
  7348. selector: "testIdentity",
  7349. protocol: 'tests',
  7350. fn: function (){
  7351. var self=this;
  7352. var o;
  7353. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7354. return smalltalk.withContext(function($ctx1) {
  7355. var $1,$2,$4,$3;
  7356. o=_st($Object())._new();
  7357. $ctx1.sendIdx["new"]=1;
  7358. $1=_st(o).__eq_eq(_st($Object())._new());
  7359. $ctx1.sendIdx["=="]=1;
  7360. self._deny_($1);
  7361. $2=_st(o).__eq_eq(o);
  7362. $ctx1.sendIdx["=="]=2;
  7363. self._assert_($2);
  7364. $ctx1.sendIdx["assert:"]=1;
  7365. $4=_st(o)._yourself();
  7366. $ctx1.sendIdx["yourself"]=1;
  7367. $3=_st($4).__eq_eq(o);
  7368. $ctx1.sendIdx["=="]=3;
  7369. self._assert_($3);
  7370. $ctx1.sendIdx["assert:"]=2;
  7371. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7372. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  7373. args: [],
  7374. 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",
  7375. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7376. referencedClasses: ["Object"]
  7377. }),
  7378. smalltalk.ObjectTest);
  7379. smalltalk.addMethod(
  7380. smalltalk.method({
  7381. selector: "testIfNil",
  7382. protocol: 'tests',
  7383. fn: function (){
  7384. var self=this;
  7385. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7386. return smalltalk.withContext(function($ctx1) {
  7387. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  7388. $2=_st($Object())._new();
  7389. $ctx1.sendIdx["new"]=1;
  7390. $1=_st($2)._isNil();
  7391. self._deny_($1);
  7392. $ctx1.sendIdx["deny:"]=1;
  7393. $5=_st($Object())._new();
  7394. $ctx1.sendIdx["new"]=2;
  7395. if(($receiver = $5) == nil || $receiver == null){
  7396. $4=true;
  7397. } else {
  7398. $4=$5;
  7399. };
  7400. $3=_st($4).__eq(true);
  7401. self._deny_($3);
  7402. $7=_st($Object())._new();
  7403. $ctx1.sendIdx["new"]=3;
  7404. if(($receiver = $7) == nil || $receiver == null){
  7405. $6=$7;
  7406. } else {
  7407. $6=true;
  7408. };
  7409. self._assert_equals_($6,true);
  7410. $ctx1.sendIdx["assert:equals:"]=1;
  7411. $9=_st($Object())._new();
  7412. $ctx1.sendIdx["new"]=4;
  7413. if(($receiver = $9) == nil || $receiver == null){
  7414. $8=false;
  7415. } else {
  7416. $8=true;
  7417. };
  7418. self._assert_equals_($8,true);
  7419. $ctx1.sendIdx["assert:equals:"]=2;
  7420. $11=_st($Object())._new();
  7421. if(($receiver = $11) == nil || $receiver == null){
  7422. $10=false;
  7423. } else {
  7424. $10=true;
  7425. };
  7426. self._assert_equals_($10,true);
  7427. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  7428. args: [],
  7429. 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",
  7430. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7431. referencedClasses: ["Object"]
  7432. }),
  7433. smalltalk.ObjectTest);
  7434. smalltalk.addMethod(
  7435. smalltalk.method({
  7436. selector: "testInstVars",
  7437. protocol: 'tests',
  7438. fn: function (){
  7439. var self=this;
  7440. var o;
  7441. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7442. return smalltalk.withContext(function($ctx1) {
  7443. var $1,$2;
  7444. o=_st($ObjectMock())._new();
  7445. $1=_st(o)._instVarAt_("foo");
  7446. $ctx1.sendIdx["instVarAt:"]=1;
  7447. self._assert_equals_($1,nil);
  7448. $ctx1.sendIdx["assert:equals:"]=1;
  7449. _st(o)._instVarAt_put_("foo",(1));
  7450. $2=_st(o)._instVarAt_("foo");
  7451. $ctx1.sendIdx["instVarAt:"]=2;
  7452. self._assert_equals_($2,(1));
  7453. $ctx1.sendIdx["assert:equals:"]=2;
  7454. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7455. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  7456. args: [],
  7457. 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",
  7458. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7459. referencedClasses: ["ObjectMock"]
  7460. }),
  7461. smalltalk.ObjectTest);
  7462. smalltalk.addMethod(
  7463. smalltalk.method({
  7464. selector: "testNilUndefined",
  7465. protocol: 'tests',
  7466. fn: function (){
  7467. var self=this;
  7468. return smalltalk.withContext(function($ctx1) {
  7469. self._assert_equals_(self._notDefined(),nil);
  7470. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  7471. args: [],
  7472. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7473. messageSends: ["assert:equals:", "notDefined"],
  7474. referencedClasses: []
  7475. }),
  7476. smalltalk.ObjectTest);
  7477. smalltalk.addMethod(
  7478. smalltalk.method({
  7479. selector: "testYourself",
  7480. protocol: 'tests',
  7481. fn: function (){
  7482. var self=this;
  7483. var o;
  7484. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7485. return smalltalk.withContext(function($ctx1) {
  7486. o=_st($ObjectMock())._new();
  7487. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7488. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  7489. args: [],
  7490. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7491. messageSends: ["new", "assert:", "==", "yourself"],
  7492. referencedClasses: ["ObjectMock"]
  7493. }),
  7494. smalltalk.ObjectTest);
  7495. smalltalk.addMethod(
  7496. smalltalk.method({
  7497. selector: "testidentityHash",
  7498. protocol: 'tests',
  7499. fn: function (){
  7500. var self=this;
  7501. var o1,o2;
  7502. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7503. return smalltalk.withContext(function($ctx1) {
  7504. var $2,$3,$1,$5,$4;
  7505. o1=_st($Object())._new();
  7506. $ctx1.sendIdx["new"]=1;
  7507. o2=_st($Object())._new();
  7508. $2=_st(o1)._identityHash();
  7509. $ctx1.sendIdx["identityHash"]=1;
  7510. $3=_st(o1)._identityHash();
  7511. $ctx1.sendIdx["identityHash"]=2;
  7512. $1=_st($2).__eq_eq($3);
  7513. $ctx1.sendIdx["=="]=1;
  7514. self._assert_($1);
  7515. $5=_st(o1)._identityHash();
  7516. $ctx1.sendIdx["identityHash"]=3;
  7517. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7518. self._deny_($4);
  7519. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  7520. args: [],
  7521. 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",
  7522. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7523. referencedClasses: ["Object"]
  7524. }),
  7525. smalltalk.ObjectTest);
  7526. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7527. smalltalk.addMethod(
  7528. smalltalk.method({
  7529. selector: "testAccessing",
  7530. protocol: 'tests',
  7531. fn: function (){
  7532. var self=this;
  7533. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7534. return smalltalk.withContext(function($ctx1) {
  7535. var $2,$1,$3,$6,$5,$4;
  7536. $2=_st($Point())._x_y_((3),(4));
  7537. $ctx1.sendIdx["x:y:"]=1;
  7538. $1=_st($2)._x();
  7539. $ctx1.sendIdx["x"]=1;
  7540. self._assert_equals_($1,(3));
  7541. $ctx1.sendIdx["assert:equals:"]=1;
  7542. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7543. $ctx1.sendIdx["y"]=1;
  7544. self._assert_equals_($3,(4));
  7545. $ctx1.sendIdx["assert:equals:"]=2;
  7546. $6=_st($Point())._new();
  7547. $ctx1.sendIdx["new"]=1;
  7548. $5=_st($6)._x_((3));
  7549. $4=_st($5)._x();
  7550. self._assert_equals_($4,(3));
  7551. $ctx1.sendIdx["assert:equals:"]=3;
  7552. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7553. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  7554. args: [],
  7555. 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",
  7556. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7557. referencedClasses: ["Point"]
  7558. }),
  7559. smalltalk.PointTest);
  7560. smalltalk.addMethod(
  7561. smalltalk.method({
  7562. selector: "testArithmetic",
  7563. protocol: 'tests',
  7564. fn: function (){
  7565. var self=this;
  7566. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7567. return smalltalk.withContext(function($ctx1) {
  7568. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7569. $2=(3).__at((4));
  7570. $ctx1.sendIdx["@"]=1;
  7571. $3=(3).__at((4));
  7572. $ctx1.sendIdx["@"]=2;
  7573. $1=_st($2).__star($3);
  7574. $4=_st($Point())._x_y_((9),(16));
  7575. $ctx1.sendIdx["x:y:"]=1;
  7576. self._assert_equals_($1,$4);
  7577. $ctx1.sendIdx["assert:equals:"]=1;
  7578. $6=(3).__at((4));
  7579. $ctx1.sendIdx["@"]=3;
  7580. $7=(3).__at((4));
  7581. $ctx1.sendIdx["@"]=4;
  7582. $5=_st($6).__plus($7);
  7583. $8=_st($Point())._x_y_((6),(8));
  7584. $ctx1.sendIdx["x:y:"]=2;
  7585. self._assert_equals_($5,$8);
  7586. $ctx1.sendIdx["assert:equals:"]=2;
  7587. $10=(3).__at((4));
  7588. $ctx1.sendIdx["@"]=5;
  7589. $11=(3).__at((4));
  7590. $ctx1.sendIdx["@"]=6;
  7591. $9=_st($10).__minus($11);
  7592. $12=_st($Point())._x_y_((0),(0));
  7593. $ctx1.sendIdx["x:y:"]=3;
  7594. self._assert_equals_($9,$12);
  7595. $ctx1.sendIdx["assert:equals:"]=3;
  7596. $14=(6).__at((8));
  7597. $ctx1.sendIdx["@"]=7;
  7598. $13=_st($14).__slash((3).__at((4)));
  7599. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7600. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  7601. args: [],
  7602. 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)",
  7603. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7604. referencedClasses: ["Point"]
  7605. }),
  7606. smalltalk.PointTest);
  7607. smalltalk.addMethod(
  7608. smalltalk.method({
  7609. selector: "testAt",
  7610. protocol: 'tests',
  7611. fn: function (){
  7612. var self=this;
  7613. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7614. return smalltalk.withContext(function($ctx1) {
  7615. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7616. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  7617. args: [],
  7618. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7619. messageSends: ["assert:equals:", "@", "x:y:"],
  7620. referencedClasses: ["Point"]
  7621. }),
  7622. smalltalk.PointTest);
  7623. smalltalk.addMethod(
  7624. smalltalk.method({
  7625. selector: "testEgality",
  7626. protocol: 'tests',
  7627. fn: function (){
  7628. var self=this;
  7629. return smalltalk.withContext(function($ctx1) {
  7630. var $2,$3,$1,$5,$4;
  7631. $2=(3).__at((4));
  7632. $ctx1.sendIdx["@"]=1;
  7633. $3=(3).__at((4));
  7634. $ctx1.sendIdx["@"]=2;
  7635. $1=_st($2).__eq($3);
  7636. $ctx1.sendIdx["="]=1;
  7637. self._assert_($1);
  7638. $5=(3).__at((5));
  7639. $ctx1.sendIdx["@"]=3;
  7640. $4=_st($5).__eq((3).__at((6)));
  7641. self._deny_($4);
  7642. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  7643. args: [],
  7644. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7645. messageSends: ["assert:", "=", "@", "deny:"],
  7646. referencedClasses: []
  7647. }),
  7648. smalltalk.PointTest);
  7649. smalltalk.addMethod(
  7650. smalltalk.method({
  7651. selector: "testNew",
  7652. protocol: 'tests',
  7653. fn: function (){
  7654. var self=this;
  7655. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7656. return smalltalk.withContext(function($ctx1) {
  7657. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7658. $3=_st($Point())._new();
  7659. $ctx1.sendIdx["new"]=1;
  7660. $2=_st($3)._x_((3));
  7661. $ctx1.sendIdx["x:"]=1;
  7662. $1=_st($2)._y();
  7663. $ctx1.sendIdx["y"]=1;
  7664. self._assert_equals_($1,nil);
  7665. $ctx1.sendIdx["assert:equals:"]=1;
  7666. $7=_st($Point())._new();
  7667. $ctx1.sendIdx["new"]=2;
  7668. $6=_st($7)._x_((3));
  7669. $5=_st($6)._x();
  7670. $ctx1.sendIdx["x"]=1;
  7671. $4=_st($5).__eq((0));
  7672. $ctx1.sendIdx["="]=1;
  7673. self._deny_($4);
  7674. $ctx1.sendIdx["deny:"]=1;
  7675. $10=_st($Point())._new();
  7676. $ctx1.sendIdx["new"]=3;
  7677. $9=_st($10)._y_((4));
  7678. $ctx1.sendIdx["y:"]=1;
  7679. $8=_st($9)._x();
  7680. self._assert_equals_($8,nil);
  7681. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7682. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  7683. args: [],
  7684. 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",
  7685. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7686. referencedClasses: ["Point"]
  7687. }),
  7688. smalltalk.PointTest);
  7689. smalltalk.addMethod(
  7690. smalltalk.method({
  7691. selector: "testTranslateBy",
  7692. protocol: 'tests',
  7693. fn: function (){
  7694. var self=this;
  7695. return smalltalk.withContext(function($ctx1) {
  7696. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7697. $2=(3).__at((3));
  7698. $ctx1.sendIdx["@"]=1;
  7699. $3=(0).__at((1));
  7700. $ctx1.sendIdx["@"]=2;
  7701. $1=_st($2)._translateBy_($3);
  7702. $ctx1.sendIdx["translateBy:"]=1;
  7703. $4=(3).__at((4));
  7704. $ctx1.sendIdx["@"]=3;
  7705. self._assert_equals_($1,$4);
  7706. $ctx1.sendIdx["assert:equals:"]=1;
  7707. $6=(3).__at((3));
  7708. $ctx1.sendIdx["@"]=4;
  7709. $8=(1)._negated();
  7710. $ctx1.sendIdx["negated"]=1;
  7711. $7=(0).__at($8);
  7712. $ctx1.sendIdx["@"]=5;
  7713. $5=_st($6)._translateBy_($7);
  7714. $ctx1.sendIdx["translateBy:"]=2;
  7715. $9=(3).__at((2));
  7716. $ctx1.sendIdx["@"]=6;
  7717. self._assert_equals_($5,$9);
  7718. $ctx1.sendIdx["assert:equals:"]=2;
  7719. $11=(3).__at((3));
  7720. $ctx1.sendIdx["@"]=7;
  7721. $12=(2).__at((3));
  7722. $ctx1.sendIdx["@"]=8;
  7723. $10=_st($11)._translateBy_($12);
  7724. $ctx1.sendIdx["translateBy:"]=3;
  7725. $13=(5).__at((6));
  7726. $ctx1.sendIdx["@"]=9;
  7727. self._assert_equals_($10,$13);
  7728. $ctx1.sendIdx["assert:equals:"]=3;
  7729. $15=(3).__at((3));
  7730. $ctx1.sendIdx["@"]=10;
  7731. $16=_st((3)._negated()).__at((0));
  7732. $ctx1.sendIdx["@"]=11;
  7733. $14=_st($15)._translateBy_($16);
  7734. self._assert_equals_($14,(0).__at((3)));
  7735. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  7736. args: [],
  7737. 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.",
  7738. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7739. referencedClasses: []
  7740. }),
  7741. smalltalk.PointTest);
  7742. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7743. smalltalk.addMethod(
  7744. smalltalk.method({
  7745. selector: "testNextIfAbsent",
  7746. protocol: 'tests',
  7747. fn: function (){
  7748. var self=this;
  7749. var queue;
  7750. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7751. return smalltalk.withContext(function($ctx1) {
  7752. var $2,$1;
  7753. queue=_st($Queue())._new();
  7754. _st(queue)._nextPut_("index1");
  7755. $2=_st(queue)._nextIfAbsent_("empty");
  7756. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7757. $1=_st($2).__eq("index1");
  7758. $ctx1.sendIdx["="]=1;
  7759. self._assert_($1);
  7760. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7761. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  7762. args: [],
  7763. 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'",
  7764. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7765. referencedClasses: ["Queue"]
  7766. }),
  7767. smalltalk.QueueTest);
  7768. smalltalk.addMethod(
  7769. smalltalk.method({
  7770. selector: "testQueueNext",
  7771. protocol: 'tests',
  7772. fn: function (){
  7773. var self=this;
  7774. var queue;
  7775. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7776. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7777. return smalltalk.withContext(function($ctx1) {
  7778. var $1,$2,$4,$3,$6,$5;
  7779. queue=_st($Queue())._new();
  7780. $1=queue;
  7781. _st($1)._nextPut_("index1");
  7782. $ctx1.sendIdx["nextPut:"]=1;
  7783. $2=_st($1)._nextPut_("index2");
  7784. $4=_st(queue)._next();
  7785. $ctx1.sendIdx["next"]=1;
  7786. $3=_st($4).__eq("index1");
  7787. $ctx1.sendIdx["="]=1;
  7788. self._assert_($3);
  7789. $6=_st(queue)._next();
  7790. $ctx1.sendIdx["next"]=2;
  7791. $5=_st($6).__eq("index");
  7792. self._deny_($5);
  7793. self._should_raise_((function(){
  7794. return smalltalk.withContext(function($ctx2) {
  7795. return _st(queue)._next();
  7796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7797. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  7798. args: [],
  7799. 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",
  7800. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  7801. referencedClasses: ["Queue", "Error"]
  7802. }),
  7803. smalltalk.QueueTest);
  7804. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7805. smalltalk.addMethod(
  7806. smalltalk.method({
  7807. selector: "testAtRandomNumber",
  7808. protocol: 'tests',
  7809. fn: function (){
  7810. var self=this;
  7811. var val;
  7812. return smalltalk.withContext(function($ctx1) {
  7813. (100)._timesRepeat_((function(){
  7814. return smalltalk.withContext(function($ctx2) {
  7815. val=(10)._atRandom();
  7816. val;
  7817. self._assert_(_st(val).__gt((0)));
  7818. $ctx2.sendIdx["assert:"]=1;
  7819. return self._assert_(_st(val).__lt((11)));
  7820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7821. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  7822. args: [],
  7823. 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]",
  7824. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  7825. referencedClasses: []
  7826. }),
  7827. smalltalk.RandomTest);
  7828. smalltalk.addMethod(
  7829. smalltalk.method({
  7830. selector: "testAtRandomSequenceableCollection",
  7831. protocol: 'tests',
  7832. fn: function (){
  7833. var self=this;
  7834. var val;
  7835. return smalltalk.withContext(function($ctx1) {
  7836. var $3,$4,$2,$1;
  7837. (100)._timesRepeat_((function(){
  7838. return smalltalk.withContext(function($ctx2) {
  7839. val="abc"._atRandom();
  7840. val;
  7841. $3=_st(val).__eq("a");
  7842. $ctx2.sendIdx["="]=1;
  7843. $4=_st(val).__eq("b");
  7844. $ctx2.sendIdx["="]=2;
  7845. $2=_st($3).__or($4);
  7846. $1=_st($2).__or(_st(val).__eq("c"));
  7847. $ctx2.sendIdx["|"]=1;
  7848. return self._assert_($1);
  7849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7850. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  7851. args: [],
  7852. 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].",
  7853. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  7854. referencedClasses: []
  7855. }),
  7856. smalltalk.RandomTest);
  7857. smalltalk.addMethod(
  7858. smalltalk.method({
  7859. selector: "textNext",
  7860. protocol: 'tests',
  7861. fn: function (){
  7862. var self=this;
  7863. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  7864. return smalltalk.withContext(function($ctx1) {
  7865. var $1;
  7866. (10000)._timesRepeat_((function(){
  7867. var current,next;
  7868. return smalltalk.withContext(function($ctx2) {
  7869. next=_st(_st($Random())._new())._next();
  7870. next;
  7871. self._assert_(_st(next).__gt_eq((0)));
  7872. $ctx2.sendIdx["assert:"]=1;
  7873. self._assert_(_st(next).__lt((1)));
  7874. $1=_st(current).__eq(next);
  7875. $ctx2.sendIdx["="]=1;
  7876. self._deny_($1);
  7877. return _st(next).__eq(current);
  7878. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  7879. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  7880. args: [],
  7881. 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 ]",
  7882. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  7883. referencedClasses: ["Random"]
  7884. }),
  7885. smalltalk.RandomTest);
  7886. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7887. smalltalk.addMethod(
  7888. smalltalk.method({
  7889. selector: "collectionClass",
  7890. protocol: 'accessing',
  7891. fn: function (){
  7892. var self=this;
  7893. return smalltalk.withContext(function($ctx1) {
  7894. var $1;
  7895. $1=_st(self._class())._collectionClass();
  7896. return $1;
  7897. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  7898. args: [],
  7899. source: "collectionClass\x0a\x09^ self class collectionClass",
  7900. messageSends: ["collectionClass", "class"],
  7901. referencedClasses: []
  7902. }),
  7903. smalltalk.StreamTest);
  7904. smalltalk.addMethod(
  7905. smalltalk.method({
  7906. selector: "newCollection",
  7907. protocol: 'accessing',
  7908. fn: function (){
  7909. var self=this;
  7910. return smalltalk.withContext(function($ctx1) {
  7911. var $1;
  7912. $1=_st(self._collectionClass())._new();
  7913. return $1;
  7914. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  7915. args: [],
  7916. source: "newCollection\x0a\x09^ self collectionClass new",
  7917. messageSends: ["new", "collectionClass"],
  7918. referencedClasses: []
  7919. }),
  7920. smalltalk.StreamTest);
  7921. smalltalk.addMethod(
  7922. smalltalk.method({
  7923. selector: "newStream",
  7924. protocol: 'accessing',
  7925. fn: function (){
  7926. var self=this;
  7927. return smalltalk.withContext(function($ctx1) {
  7928. var $1;
  7929. $1=_st(_st(self._collectionClass())._new())._stream();
  7930. return $1;
  7931. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  7932. args: [],
  7933. source: "newStream\x0a\x09^ self collectionClass new stream",
  7934. messageSends: ["stream", "new", "collectionClass"],
  7935. referencedClasses: []
  7936. }),
  7937. smalltalk.StreamTest);
  7938. smalltalk.addMethod(
  7939. smalltalk.method({
  7940. selector: "testAtStartAtEnd",
  7941. protocol: 'tests',
  7942. fn: function (){
  7943. var self=this;
  7944. var stream;
  7945. return smalltalk.withContext(function($ctx1) {
  7946. var $1,$2,$3,$4;
  7947. stream=self._newStream();
  7948. $1=_st(stream)._atStart();
  7949. $ctx1.sendIdx["atStart"]=1;
  7950. self._assert_($1);
  7951. $ctx1.sendIdx["assert:"]=1;
  7952. $2=_st(stream)._atEnd();
  7953. $ctx1.sendIdx["atEnd"]=1;
  7954. self._assert_($2);
  7955. $ctx1.sendIdx["assert:"]=2;
  7956. _st(stream)._nextPutAll_(self._newCollection());
  7957. $3=_st(stream)._atEnd();
  7958. $ctx1.sendIdx["atEnd"]=2;
  7959. self._assert_($3);
  7960. $4=_st(stream)._atStart();
  7961. $ctx1.sendIdx["atStart"]=2;
  7962. self._deny_($4);
  7963. $ctx1.sendIdx["deny:"]=1;
  7964. _st(stream)._position_((1));
  7965. self._deny_(_st(stream)._atEnd());
  7966. $ctx1.sendIdx["deny:"]=2;
  7967. self._deny_(_st(stream)._atStart());
  7968. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  7969. args: [],
  7970. 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",
  7971. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  7972. referencedClasses: []
  7973. }),
  7974. smalltalk.StreamTest);
  7975. smalltalk.addMethod(
  7976. smalltalk.method({
  7977. selector: "testContents",
  7978. protocol: 'tests',
  7979. fn: function (){
  7980. var self=this;
  7981. var stream;
  7982. return smalltalk.withContext(function($ctx1) {
  7983. var $1,$2;
  7984. stream=self._newStream();
  7985. $1=stream;
  7986. $2=self._newCollection();
  7987. $ctx1.sendIdx["newCollection"]=1;
  7988. _st($1)._nextPutAll_($2);
  7989. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  7990. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  7991. args: [],
  7992. 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",
  7993. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  7994. referencedClasses: []
  7995. }),
  7996. smalltalk.StreamTest);
  7997. smalltalk.addMethod(
  7998. smalltalk.method({
  7999. selector: "testIsEmpty",
  8000. protocol: 'tests',
  8001. fn: function (){
  8002. var self=this;
  8003. var stream;
  8004. return smalltalk.withContext(function($ctx1) {
  8005. var $1;
  8006. stream=self._newStream();
  8007. $1=_st(stream)._isEmpty();
  8008. $ctx1.sendIdx["isEmpty"]=1;
  8009. self._assert_($1);
  8010. _st(stream)._nextPutAll_(self._newCollection());
  8011. self._deny_(_st(stream)._isEmpty());
  8012. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  8013. args: [],
  8014. 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",
  8015. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8016. referencedClasses: []
  8017. }),
  8018. smalltalk.StreamTest);
  8019. smalltalk.addMethod(
  8020. smalltalk.method({
  8021. selector: "testPosition",
  8022. protocol: 'tests',
  8023. fn: function (){
  8024. var self=this;
  8025. var collection,stream;
  8026. return smalltalk.withContext(function($ctx1) {
  8027. var $1,$2,$3;
  8028. collection=self._newCollection();
  8029. stream=self._newStream();
  8030. _st(stream)._nextPutAll_(collection);
  8031. $1=_st(stream)._position();
  8032. $ctx1.sendIdx["position"]=1;
  8033. self._assert_equals_($1,_st(collection)._size());
  8034. $ctx1.sendIdx["assert:equals:"]=1;
  8035. _st(stream)._position_((0));
  8036. $2=_st(stream)._position();
  8037. $ctx1.sendIdx["position"]=2;
  8038. self._assert_equals_($2,(0));
  8039. $ctx1.sendIdx["assert:equals:"]=2;
  8040. _st(stream)._next();
  8041. $ctx1.sendIdx["next"]=1;
  8042. $3=_st(stream)._position();
  8043. $ctx1.sendIdx["position"]=3;
  8044. self._assert_equals_($3,(1));
  8045. $ctx1.sendIdx["assert:equals:"]=3;
  8046. _st(stream)._next();
  8047. self._assert_equals_(_st(stream)._position(),(2));
  8048. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  8049. args: [],
  8050. 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",
  8051. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8052. referencedClasses: []
  8053. }),
  8054. smalltalk.StreamTest);
  8055. smalltalk.addMethod(
  8056. smalltalk.method({
  8057. selector: "testReading",
  8058. protocol: 'tests',
  8059. fn: function (){
  8060. var self=this;
  8061. var stream,collection;
  8062. return smalltalk.withContext(function($ctx1) {
  8063. var $1,$2,$3;
  8064. collection=self._newCollection();
  8065. stream=self._newStream();
  8066. $1=stream;
  8067. _st($1)._nextPutAll_(collection);
  8068. $2=_st($1)._position_((0));
  8069. _st(collection)._do_((function(each){
  8070. return smalltalk.withContext(function($ctx2) {
  8071. $3=_st(stream)._next();
  8072. $ctx2.sendIdx["next"]=1;
  8073. return self._assert_equals_($3,each);
  8074. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8075. self._assert_(_st(_st(stream)._next())._isNil());
  8076. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8077. args: [],
  8078. 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",
  8079. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8080. referencedClasses: []
  8081. }),
  8082. smalltalk.StreamTest);
  8083. smalltalk.addMethod(
  8084. smalltalk.method({
  8085. selector: "testStreamContents",
  8086. protocol: 'tests',
  8087. fn: function (){
  8088. var self=this;
  8089. return smalltalk.withContext(function($ctx1) {
  8090. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  8091. args: [],
  8092. source: "testStreamContents",
  8093. messageSends: [],
  8094. referencedClasses: []
  8095. }),
  8096. smalltalk.StreamTest);
  8097. smalltalk.addMethod(
  8098. smalltalk.method({
  8099. selector: "testWrite",
  8100. protocol: 'tests',
  8101. fn: function (){
  8102. var self=this;
  8103. var stream,collection;
  8104. return smalltalk.withContext(function($ctx1) {
  8105. collection=self._newCollection();
  8106. stream=self._newStream();
  8107. _st(collection)._do_((function(each){
  8108. return smalltalk.withContext(function($ctx2) {
  8109. return _st(stream).__lt_lt(each);
  8110. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8111. self._assert_equals_(_st(stream)._contents(),collection);
  8112. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8113. args: [],
  8114. 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",
  8115. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8116. referencedClasses: []
  8117. }),
  8118. smalltalk.StreamTest);
  8119. smalltalk.addMethod(
  8120. smalltalk.method({
  8121. selector: "testWriting",
  8122. protocol: 'tests',
  8123. fn: function (){
  8124. var self=this;
  8125. var stream,collection;
  8126. return smalltalk.withContext(function($ctx1) {
  8127. var $1;
  8128. collection=self._newCollection();
  8129. stream=self._newStream();
  8130. $ctx1.sendIdx["newStream"]=1;
  8131. _st(collection)._do_((function(each){
  8132. return smalltalk.withContext(function($ctx2) {
  8133. return _st(stream)._nextPut_(each);
  8134. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8135. $1=_st(stream)._contents();
  8136. $ctx1.sendIdx["contents"]=1;
  8137. self._assert_equals_($1,collection);
  8138. $ctx1.sendIdx["assert:equals:"]=1;
  8139. stream=self._newStream();
  8140. _st(stream)._nextPutAll_(collection);
  8141. self._assert_equals_(_st(stream)._contents(),collection);
  8142. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8143. args: [],
  8144. 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",
  8145. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8146. referencedClasses: []
  8147. }),
  8148. smalltalk.StreamTest);
  8149. smalltalk.addMethod(
  8150. smalltalk.method({
  8151. selector: "collectionClass",
  8152. protocol: 'accessing',
  8153. fn: function (){
  8154. var self=this;
  8155. return smalltalk.withContext(function($ctx1) {
  8156. return nil;
  8157. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  8158. args: [],
  8159. source: "collectionClass\x0a\x09^ nil",
  8160. messageSends: [],
  8161. referencedClasses: []
  8162. }),
  8163. smalltalk.StreamTest.klass);
  8164. smalltalk.addMethod(
  8165. smalltalk.method({
  8166. selector: "isAbstract",
  8167. protocol: 'testing',
  8168. fn: function (){
  8169. var self=this;
  8170. return smalltalk.withContext(function($ctx1) {
  8171. var $1;
  8172. $1=_st(self._collectionClass())._isNil();
  8173. return $1;
  8174. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  8175. args: [],
  8176. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8177. messageSends: ["isNil", "collectionClass"],
  8178. referencedClasses: []
  8179. }),
  8180. smalltalk.StreamTest.klass);
  8181. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8182. smalltalk.addMethod(
  8183. smalltalk.method({
  8184. selector: "newCollection",
  8185. protocol: 'accessing',
  8186. fn: function (){
  8187. var self=this;
  8188. return smalltalk.withContext(function($ctx1) {
  8189. var $1;
  8190. $1=[true,(1),(3).__at((4)),"foo"];
  8191. return $1;
  8192. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  8193. args: [],
  8194. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8195. messageSends: ["@"],
  8196. referencedClasses: []
  8197. }),
  8198. smalltalk.ArrayStreamTest);
  8199. smalltalk.addMethod(
  8200. smalltalk.method({
  8201. selector: "collectionClass",
  8202. protocol: 'accessing',
  8203. fn: function (){
  8204. var self=this;
  8205. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  8206. return smalltalk.withContext(function($ctx1) {
  8207. return $Array();
  8208. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  8209. args: [],
  8210. source: "collectionClass\x0a\x09^ Array",
  8211. messageSends: [],
  8212. referencedClasses: ["Array"]
  8213. }),
  8214. smalltalk.ArrayStreamTest.klass);
  8215. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8216. smalltalk.addMethod(
  8217. smalltalk.method({
  8218. selector: "newCollection",
  8219. protocol: 'accessing',
  8220. fn: function (){
  8221. var self=this;
  8222. return smalltalk.withContext(function($ctx1) {
  8223. return "hello world";
  8224. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  8225. args: [],
  8226. source: "newCollection\x0a\x09^ 'hello world'",
  8227. messageSends: [],
  8228. referencedClasses: []
  8229. }),
  8230. smalltalk.StringStreamTest);
  8231. smalltalk.addMethod(
  8232. smalltalk.method({
  8233. selector: "collectionClass",
  8234. protocol: 'accessing',
  8235. fn: function (){
  8236. var self=this;
  8237. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  8238. return smalltalk.withContext(function($ctx1) {
  8239. return $String();
  8240. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  8241. args: [],
  8242. source: "collectionClass\x0a\x09^ String",
  8243. messageSends: [],
  8244. referencedClasses: ["String"]
  8245. }),
  8246. smalltalk.StringStreamTest.klass);
  8247. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8248. smalltalk.addMethod(
  8249. smalltalk.method({
  8250. selector: "testCopying",
  8251. protocol: 'tests',
  8252. fn: function (){
  8253. var self=this;
  8254. return smalltalk.withContext(function($ctx1) {
  8255. self._assert_equals_(nil._copy(),nil);
  8256. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  8257. args: [],
  8258. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8259. messageSends: ["assert:equals:", "copy"],
  8260. referencedClasses: []
  8261. }),
  8262. smalltalk.UndefinedTest);
  8263. smalltalk.addMethod(
  8264. smalltalk.method({
  8265. selector: "testDeepCopy",
  8266. protocol: 'tests',
  8267. fn: function (){
  8268. var self=this;
  8269. return smalltalk.withContext(function($ctx1) {
  8270. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8271. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  8272. args: [],
  8273. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8274. messageSends: ["assert:", "=", "deepCopy"],
  8275. referencedClasses: []
  8276. }),
  8277. smalltalk.UndefinedTest);
  8278. smalltalk.addMethod(
  8279. smalltalk.method({
  8280. selector: "testIfNil",
  8281. protocol: 'tests',
  8282. fn: function (){
  8283. var self=this;
  8284. return smalltalk.withContext(function($ctx1) {
  8285. var $1,$3,$2,$4,$6,$5;
  8286. if(($receiver = nil) == nil || $receiver == null){
  8287. $1=true;
  8288. } else {
  8289. $1=nil;
  8290. };
  8291. self._assert_equals_($1,true);
  8292. $ctx1.sendIdx["assert:equals:"]=1;
  8293. if(($receiver = nil) == nil || $receiver == null){
  8294. $3=nil;
  8295. } else {
  8296. $3=true;
  8297. };
  8298. $2=_st($3).__eq(true);
  8299. $ctx1.sendIdx["="]=1;
  8300. self._deny_($2);
  8301. $ctx1.sendIdx["deny:"]=1;
  8302. if(($receiver = nil) == nil || $receiver == null){
  8303. $4=true;
  8304. } else {
  8305. $4=false;
  8306. };
  8307. self._assert_equals_($4,true);
  8308. if(($receiver = nil) == nil || $receiver == null){
  8309. $6=false;
  8310. } else {
  8311. $6=true;
  8312. };
  8313. $5=_st($6).__eq(true);
  8314. self._deny_($5);
  8315. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  8316. args: [],
  8317. 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",
  8318. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8319. referencedClasses: []
  8320. }),
  8321. smalltalk.UndefinedTest);
  8322. smalltalk.addMethod(
  8323. smalltalk.method({
  8324. selector: "testIsNil",
  8325. protocol: 'tests',
  8326. fn: function (){
  8327. var self=this;
  8328. return smalltalk.withContext(function($ctx1) {
  8329. self._assert_(nil._isNil());
  8330. self._deny_(nil._notNil());
  8331. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  8332. args: [],
  8333. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8334. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8335. referencedClasses: []
  8336. }),
  8337. smalltalk.UndefinedTest);
  8338. });