Kernel-Tests.js 331 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804
  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: "testEquality",
  2505. protocol: 'tests',
  2506. fn: function (){
  2507. var self=this;
  2508. return smalltalk.withContext(function($ctx1) {
  2509. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2510. $2=self._collectionClass();
  2511. $ctx1.sendIdx["collectionClass"]=1;
  2512. $1=_st($2)._new();
  2513. $ctx1.sendIdx["new"]=1;
  2514. $4=self._collectionClass();
  2515. $ctx1.sendIdx["collectionClass"]=2;
  2516. $3=_st($4)._new();
  2517. $ctx1.sendIdx["new"]=2;
  2518. self._assert_equals_($1,$3);
  2519. $ctx1.sendIdx["assert:equals:"]=1;
  2520. $5=self._collection();
  2521. $ctx1.sendIdx["collection"]=1;
  2522. $6=self._collection();
  2523. $ctx1.sendIdx["collection"]=2;
  2524. self._assert_equals_($5,$6);
  2525. $ctx1.sendIdx["assert:equals:"]=2;
  2526. $7=self._collectionWithNewValue();
  2527. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2528. self._assert_equals_($7,self._collectionWithNewValue());
  2529. $10=self._collectionClass();
  2530. $ctx1.sendIdx["collectionClass"]=3;
  2531. $9=_st($10)._new();
  2532. $ctx1.sendIdx["new"]=3;
  2533. $11=self._collection();
  2534. $ctx1.sendIdx["collection"]=3;
  2535. $8=_st($9).__eq($11);
  2536. $ctx1.sendIdx["="]=1;
  2537. self._deny_($8);
  2538. $ctx1.sendIdx["deny:"]=1;
  2539. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2540. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.IndexableCollectionTest)})},
  2541. args: [],
  2542. source: "testEquality\x0a\x09self assert: self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection equals: self collection.\x0a\x09self assert: self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new = self collection.\x0a\x09self deny: self collection = self collectionClass new",
  2543. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2544. referencedClasses: []
  2545. }),
  2546. smalltalk.IndexableCollectionTest);
  2547. smalltalk.addMethod(
  2548. smalltalk.method({
  2549. selector: "testIndexOf",
  2550. protocol: 'tests',
  2551. fn: function (){
  2552. var self=this;
  2553. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2554. return smalltalk.withContext(function($ctx1) {
  2555. var $1;
  2556. self._should_raise_((function(){
  2557. return smalltalk.withContext(function($ctx2) {
  2558. $1=self._collection();
  2559. $ctx2.sendIdx["collection"]=1;
  2560. return _st($1)._indexOf_(self._sampleNewValue());
  2561. $ctx2.sendIdx["indexOf:"]=1;
  2562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2563. self._samplesDo_((function(index,value){
  2564. return smalltalk.withContext(function($ctx2) {
  2565. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2566. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2567. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  2568. args: [],
  2569. 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 ]",
  2570. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2571. referencedClasses: ["Error"]
  2572. }),
  2573. smalltalk.IndexableCollectionTest);
  2574. smalltalk.addMethod(
  2575. smalltalk.method({
  2576. selector: "testWithIndexDo",
  2577. protocol: 'tests',
  2578. fn: function (){
  2579. var self=this;
  2580. var collection;
  2581. return smalltalk.withContext(function($ctx1) {
  2582. collection=self._collection();
  2583. $ctx1.sendIdx["collection"]=1;
  2584. _st(self._collection())._withIndexDo_((function(each,index){
  2585. return smalltalk.withContext(function($ctx2) {
  2586. return self._assert_equals_(_st(collection)._at_(index),each);
  2587. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2588. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  2589. args: [],
  2590. 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 ]",
  2591. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2592. referencedClasses: []
  2593. }),
  2594. smalltalk.IndexableCollectionTest);
  2595. smalltalk.addClass('AssociativeCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2596. smalltalk.addMethod(
  2597. smalltalk.method({
  2598. selector: "collectionKeys",
  2599. protocol: 'fixture',
  2600. fn: function (){
  2601. var self=this;
  2602. return smalltalk.withContext(function($ctx1) {
  2603. self._subclassResponsibility();
  2604. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},smalltalk.AssociativeCollectionTest)})},
  2605. args: [],
  2606. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2607. messageSends: ["subclassResponsibility"],
  2608. referencedClasses: []
  2609. }),
  2610. smalltalk.AssociativeCollectionTest);
  2611. smalltalk.addMethod(
  2612. smalltalk.method({
  2613. selector: "collectionValues",
  2614. protocol: 'fixture',
  2615. fn: function (){
  2616. var self=this;
  2617. return smalltalk.withContext(function($ctx1) {
  2618. self._subclassResponsibility();
  2619. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},smalltalk.AssociativeCollectionTest)})},
  2620. args: [],
  2621. source: "collectionValues\x0a\x09self subclassResponsibility",
  2622. messageSends: ["subclassResponsibility"],
  2623. referencedClasses: []
  2624. }),
  2625. smalltalk.AssociativeCollectionTest);
  2626. smalltalk.addMethod(
  2627. smalltalk.method({
  2628. selector: "nonIndexesDo:",
  2629. protocol: 'fixture',
  2630. fn: function (aBlock){
  2631. var self=this;
  2632. return smalltalk.withContext(function($ctx1) {
  2633. _st(aBlock)._value_((5));
  2634. $ctx1.sendIdx["value:"]=1;
  2635. _st(aBlock)._value_("z");
  2636. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.AssociativeCollectionTest)})},
  2637. args: ["aBlock"],
  2638. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2639. messageSends: ["value:"],
  2640. referencedClasses: []
  2641. }),
  2642. smalltalk.AssociativeCollectionTest);
  2643. smalltalk.addMethod(
  2644. smalltalk.method({
  2645. selector: "sampleNewIndex",
  2646. protocol: 'fixture',
  2647. fn: function (){
  2648. var self=this;
  2649. return smalltalk.withContext(function($ctx1) {
  2650. return "new";
  2651. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.AssociativeCollectionTest)})},
  2652. args: [],
  2653. source: "sampleNewIndex\x0a\x09^ 'new'",
  2654. messageSends: [],
  2655. referencedClasses: []
  2656. }),
  2657. smalltalk.AssociativeCollectionTest);
  2658. smalltalk.addMethod(
  2659. smalltalk.method({
  2660. selector: "samplesDo:",
  2661. protocol: 'fixture',
  2662. fn: function (aBlock){
  2663. var self=this;
  2664. return smalltalk.withContext(function($ctx1) {
  2665. _st(aBlock)._value_value_("a",(2));
  2666. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.AssociativeCollectionTest)})},
  2667. args: ["aBlock"],
  2668. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2669. messageSends: ["value:value:"],
  2670. referencedClasses: []
  2671. }),
  2672. smalltalk.AssociativeCollectionTest);
  2673. smalltalk.addMethod(
  2674. smalltalk.method({
  2675. selector: "testAddAll",
  2676. protocol: 'tests',
  2677. fn: function (){
  2678. var self=this;
  2679. return smalltalk.withContext(function($ctx1) {
  2680. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2681. smalltalk.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2682. $2=self._collection();
  2683. $ctx1.sendIdx["collection"]=1;
  2684. $3=$2;
  2685. $4=self._collection();
  2686. $ctx1.sendIdx["collection"]=2;
  2687. _st($3)._addAll_($4);
  2688. $ctx1.sendIdx["addAll:"]=1;
  2689. $5=_st($2)._yourself();
  2690. $ctx1.sendIdx["yourself"]=1;
  2691. $1=$5;
  2692. $6=self._collection();
  2693. $ctx1.sendIdx["collection"]=3;
  2694. self._assert_equals_($1,$6);
  2695. $ctx1.sendIdx["assert:equals:"]=1;
  2696. $8=self._collection();
  2697. $ctx1.sendIdx["collection"]=4;
  2698. $9=$8;
  2699. $10=self._collectionWithNewValue();
  2700. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2701. _st($9)._addAll_($10);
  2702. $ctx1.sendIdx["addAll:"]=2;
  2703. $11=_st($8)._yourself();
  2704. $ctx1.sendIdx["yourself"]=2;
  2705. $7=$11;
  2706. $12=self._collectionWithNewValue();
  2707. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2708. self._assert_equals_($7,$12);
  2709. $ctx1.sendIdx["assert:equals:"]=2;
  2710. $14=self._collectionWithNewValue();
  2711. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2712. _st($14)._addAll_(self._collection());
  2713. $15=_st($14)._yourself();
  2714. $13=$15;
  2715. self._assert_equals_($13,self._collectionWithNewValue());
  2716. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.AssociativeCollectionTest)})},
  2717. args: [],
  2718. 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",
  2719. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2720. referencedClasses: []
  2721. }),
  2722. smalltalk.AssociativeCollectionTest);
  2723. smalltalk.addMethod(
  2724. smalltalk.method({
  2725. selector: "testAsDictionary",
  2726. protocol: 'tests',
  2727. fn: function (){
  2728. var self=this;
  2729. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2730. return smalltalk.withContext(function($ctx1) {
  2731. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2732. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.AssociativeCollectionTest)})},
  2733. args: [],
  2734. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2735. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2736. referencedClasses: ["Dictionary"]
  2737. }),
  2738. smalltalk.AssociativeCollectionTest);
  2739. smalltalk.addMethod(
  2740. smalltalk.method({
  2741. selector: "testAsHashedCollection",
  2742. protocol: 'tests',
  2743. fn: function (){
  2744. var self=this;
  2745. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2746. return smalltalk.withContext(function($ctx1) {
  2747. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2748. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.AssociativeCollectionTest)})},
  2749. args: [],
  2750. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2751. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2752. referencedClasses: ["HashedCollection"]
  2753. }),
  2754. smalltalk.AssociativeCollectionTest);
  2755. smalltalk.addMethod(
  2756. smalltalk.method({
  2757. selector: "testComma",
  2758. protocol: 'tests',
  2759. fn: function (){
  2760. var self=this;
  2761. return smalltalk.withContext(function($ctx1) {
  2762. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2763. smalltalk.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  2764. $2=self._collection();
  2765. $ctx1.sendIdx["collection"]=1;
  2766. $3=self._collection();
  2767. $ctx1.sendIdx["collection"]=2;
  2768. $1=_st($2).__comma($3);
  2769. $ctx1.sendIdx[","]=1;
  2770. $4=self._collection();
  2771. $ctx1.sendIdx["collection"]=3;
  2772. self._assert_equals_($1,$4);
  2773. $ctx1.sendIdx["assert:equals:"]=1;
  2774. $6=self._collection();
  2775. $ctx1.sendIdx["collection"]=4;
  2776. $7=self._collectionWithNewValue();
  2777. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2778. $5=_st($6).__comma($7);
  2779. $ctx1.sendIdx[","]=2;
  2780. $8=self._collectionWithNewValue();
  2781. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2782. self._assert_equals_($5,$8);
  2783. $ctx1.sendIdx["assert:equals:"]=2;
  2784. $10=self._collectionWithNewValue();
  2785. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2786. $9=_st($10).__comma(self._collection());
  2787. self._assert_equals_($9,self._collectionWithNewValue());
  2788. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.AssociativeCollectionTest)})},
  2789. args: [],
  2790. 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",
  2791. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2792. referencedClasses: []
  2793. }),
  2794. smalltalk.AssociativeCollectionTest);
  2795. smalltalk.addMethod(
  2796. smalltalk.method({
  2797. selector: "testFrom",
  2798. protocol: 'tests',
  2799. fn: function (){
  2800. var self=this;
  2801. var associations;
  2802. return smalltalk.withContext(function($ctx1) {
  2803. var $1,$2,$3,$5,$4;
  2804. $1="a".__minus_gt((1));
  2805. $ctx1.sendIdx["->"]=1;
  2806. $2="b".__minus_gt((2));
  2807. $ctx1.sendIdx["->"]=2;
  2808. associations=[$1,$2];
  2809. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2810. $5="a".__minus_gt((1));
  2811. $ctx1.sendIdx["->"]=3;
  2812. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2813. self._assertSameContents_as_($3,$4);
  2814. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.AssociativeCollectionTest)})},
  2815. args: [],
  2816. 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 }.",
  2817. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2818. referencedClasses: []
  2819. }),
  2820. smalltalk.AssociativeCollectionTest);
  2821. smalltalk.addMethod(
  2822. smalltalk.method({
  2823. selector: "testKeys",
  2824. protocol: 'tests',
  2825. fn: function (){
  2826. var self=this;
  2827. return smalltalk.withContext(function($ctx1) {
  2828. var $2,$1,$3,$4;
  2829. $2=_st(_st(self._collectionClass())._new())._keys();
  2830. $ctx1.sendIdx["keys"]=1;
  2831. $1=_st($2)._isEmpty();
  2832. self._assert_($1);
  2833. $3=_st(self._collection())._keys();
  2834. $ctx1.sendIdx["keys"]=2;
  2835. $4=self._collectionKeys();
  2836. $ctx1.sendIdx["collectionKeys"]=1;
  2837. self._assertSameContents_as_($3,$4);
  2838. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2839. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2840. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},smalltalk.AssociativeCollectionTest)})},
  2841. args: [],
  2842. source: "testKeys\x0a\x09self assert:self collectionClass new keys isEmpty.\x0a\x09self assertSameContents:self collection keys as: self collectionKeys.\x0a\x09self assertSameContents:self collectionWithNewValue keys as: self collectionKeys, { self sampleNewIndex }",
  2843. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2844. referencedClasses: []
  2845. }),
  2846. smalltalk.AssociativeCollectionTest);
  2847. smalltalk.addMethod(
  2848. smalltalk.method({
  2849. selector: "testNewFromPairs",
  2850. protocol: 'tests',
  2851. fn: function (){
  2852. var self=this;
  2853. var flattenedAssociations;
  2854. return smalltalk.withContext(function($ctx1) {
  2855. var $1,$3,$2;
  2856. flattenedAssociations=["a",(1),"b",(2)];
  2857. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2858. $3="a".__minus_gt((1));
  2859. $ctx1.sendIdx["->"]=1;
  2860. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2861. self._assertSameContents_as_($1,$2);
  2862. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.AssociativeCollectionTest)})},
  2863. args: [],
  2864. 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 }.",
  2865. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2866. referencedClasses: []
  2867. }),
  2868. smalltalk.AssociativeCollectionTest);
  2869. smalltalk.addMethod(
  2870. smalltalk.method({
  2871. selector: "testPrintString",
  2872. protocol: 'tests',
  2873. fn: function (){
  2874. var self=this;
  2875. return smalltalk.withContext(function($ctx1) {
  2876. var $3,$2,$4,$1,$5;
  2877. $3=self._collectionClass();
  2878. $ctx1.sendIdx["collectionClass"]=1;
  2879. $2=_st($3)._new();
  2880. _st($2)._at_put_("firstname","James");
  2881. $ctx1.sendIdx["at:put:"]=1;
  2882. _st($2)._at_put_("lastname","Bond");
  2883. $4=_st($2)._printString();
  2884. $1=$4;
  2885. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2886. $ctx1.sendIdx[","]=1;
  2887. self._assert_equals_($1,$5);
  2888. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.AssociativeCollectionTest)})},
  2889. args: [],
  2890. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (self collectionClass new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a ', self collectionClass name, ' (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  2891. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2892. referencedClasses: []
  2893. }),
  2894. smalltalk.AssociativeCollectionTest);
  2895. smalltalk.addMethod(
  2896. smalltalk.method({
  2897. selector: "testRemoveKey",
  2898. protocol: 'tests',
  2899. fn: function (){
  2900. var self=this;
  2901. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2902. return smalltalk.withContext(function($ctx1) {
  2903. var $1,$2,$3,$5,$6,$4,$7,$8;
  2904. self._nonIndexesDo_((function(each){
  2905. var collection;
  2906. return smalltalk.withContext(function($ctx2) {
  2907. collection=self._collection();
  2908. $ctx2.sendIdx["collection"]=1;
  2909. collection;
  2910. self._should_raise_((function(){
  2911. return smalltalk.withContext(function($ctx3) {
  2912. return _st(collection)._removeKey_(each);
  2913. $ctx3.sendIdx["removeKey:"]=1;
  2914. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2915. $1=collection;
  2916. $2=self._collection();
  2917. $ctx2.sendIdx["collection"]=2;
  2918. return self._assert_equals_($1,$2);
  2919. $ctx2.sendIdx["assert:equals:"]=1;
  2920. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2921. self._samplesDo_((function(index,value){
  2922. var collection;
  2923. return smalltalk.withContext(function($ctx2) {
  2924. collection=self._collection();
  2925. $ctx2.sendIdx["collection"]=3;
  2926. collection;
  2927. $3=_st(collection)._removeKey_(index);
  2928. $ctx2.sendIdx["removeKey:"]=2;
  2929. self._assert_equals_($3,value);
  2930. $ctx2.sendIdx["assert:equals:"]=2;
  2931. $5=collection;
  2932. $6=self._collection();
  2933. $ctx2.sendIdx["collection"]=4;
  2934. $4=_st($5).__eq($6);
  2935. return self._deny_($4);
  2936. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2937. $7=self._collectionWithNewValue();
  2938. _st($7)._removeKey_(self._sampleNewIndex());
  2939. $8=_st($7)._yourself();
  2940. self._assert_equals_($8,self._collection());
  2941. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},smalltalk.AssociativeCollectionTest)})},
  2942. args: [],
  2943. source: "testRemoveKey\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self should: [ collection removeKey: each ] raise: Error.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex; yourself)\x0a\x09\x09equals: self collection",
  2944. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  2945. referencedClasses: ["Error"]
  2946. }),
  2947. smalltalk.AssociativeCollectionTest);
  2948. smalltalk.addMethod(
  2949. smalltalk.method({
  2950. selector: "testRemoveKeyIfAbsent",
  2951. protocol: 'tests',
  2952. fn: function (){
  2953. var self=this;
  2954. return smalltalk.withContext(function($ctx1) {
  2955. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  2956. self._nonIndexesDo_((function(each){
  2957. var collection;
  2958. return smalltalk.withContext(function($ctx2) {
  2959. collection=self._collection();
  2960. $ctx2.sendIdx["collection"]=1;
  2961. collection;
  2962. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  2963. return smalltalk.withContext(function($ctx3) {
  2964. return self._sampleNewValue();
  2965. $ctx3.sendIdx["sampleNewValue"]=1;
  2966. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2967. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  2968. $2=self._sampleNewValue();
  2969. $ctx2.sendIdx["sampleNewValue"]=2;
  2970. self._assert_equals_($1,$2);
  2971. $ctx2.sendIdx["assert:equals:"]=1;
  2972. $3=collection;
  2973. $4=self._collection();
  2974. $ctx2.sendIdx["collection"]=2;
  2975. return self._assert_equals_($3,$4);
  2976. $ctx2.sendIdx["assert:equals:"]=2;
  2977. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2978. self._samplesDo_((function(index,value){
  2979. var collection;
  2980. return smalltalk.withContext(function($ctx2) {
  2981. collection=self._collection();
  2982. $ctx2.sendIdx["collection"]=3;
  2983. collection;
  2984. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  2985. return smalltalk.withContext(function($ctx3) {
  2986. return self._sampleNewValue();
  2987. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  2988. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  2989. self._assert_equals_($5,value);
  2990. $ctx2.sendIdx["assert:equals:"]=3;
  2991. $7=collection;
  2992. $8=self._collection();
  2993. $ctx2.sendIdx["collection"]=4;
  2994. $6=_st($7).__eq($8);
  2995. return self._deny_($6);
  2996. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2997. $9=self._collectionWithNewValue();
  2998. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  2999. return smalltalk.withContext(function($ctx2) {
  3000. return self._assert_(false);
  3001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  3002. $10=_st($9)._yourself();
  3003. self._assert_equals_($10,self._collection());
  3004. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},smalltalk.AssociativeCollectionTest)})},
  3005. args: [],
  3006. source: "testRemoveKeyIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index ifAbsent: [ self sampleNewValue ]) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex ifAbsent: [ self assert: false ]; yourself)\x0a\x09\x09equals: self collection",
  3007. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3008. referencedClasses: []
  3009. }),
  3010. smalltalk.AssociativeCollectionTest);
  3011. smalltalk.addMethod(
  3012. smalltalk.method({
  3013. selector: "testValues",
  3014. protocol: 'tests',
  3015. fn: function (){
  3016. var self=this;
  3017. return smalltalk.withContext(function($ctx1) {
  3018. var $2,$1,$3,$4;
  3019. $2=_st(_st(self._collectionClass())._new())._values();
  3020. $ctx1.sendIdx["values"]=1;
  3021. $1=_st($2)._isEmpty();
  3022. self._assert_($1);
  3023. $3=_st(self._collection())._values();
  3024. $ctx1.sendIdx["values"]=2;
  3025. $4=self._collectionValues();
  3026. $ctx1.sendIdx["collectionValues"]=1;
  3027. self._assertSameContents_as_($3,$4);
  3028. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3029. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3030. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},smalltalk.AssociativeCollectionTest)})},
  3031. args: [],
  3032. source: "testValues\x0a\x09self assert:self collectionClass new values isEmpty.\x0a\x09self assertSameContents:self collection values as: self collectionValues.\x0a\x09self assertSameContents:self collectionWithNewValue values as: self collectionValues, { self sampleNewValue }",
  3033. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3034. referencedClasses: []
  3035. }),
  3036. smalltalk.AssociativeCollectionTest);
  3037. smalltalk.addClass('DictionaryTest', smalltalk.AssociativeCollectionTest, [], 'Kernel-Tests');
  3038. smalltalk.addMethod(
  3039. smalltalk.method({
  3040. selector: "collection",
  3041. protocol: 'fixture',
  3042. fn: function (){
  3043. var self=this;
  3044. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3045. return smalltalk.withContext(function($ctx1) {
  3046. var $2,$3,$1;
  3047. $2=_st($Dictionary())._new();
  3048. _st($2)._at_put_((1),(1));
  3049. $ctx1.sendIdx["at:put:"]=1;
  3050. _st($2)._at_put_("a",(2));
  3051. $ctx1.sendIdx["at:put:"]=2;
  3052. _st($2)._at_put_(true,(3));
  3053. $ctx1.sendIdx["at:put:"]=3;
  3054. _st($2)._at_put_((1).__at((3)),(-4));
  3055. $3=_st($2)._yourself();
  3056. $1=$3;
  3057. return $1;
  3058. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  3059. args: [],
  3060. 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",
  3061. messageSends: ["at:put:", "new", "@", "yourself"],
  3062. referencedClasses: ["Dictionary"]
  3063. }),
  3064. smalltalk.DictionaryTest);
  3065. smalltalk.addMethod(
  3066. smalltalk.method({
  3067. selector: "collectionKeys",
  3068. protocol: 'fixture',
  3069. fn: function (){
  3070. var self=this;
  3071. return smalltalk.withContext(function($ctx1) {
  3072. var $1;
  3073. $1=[(1),"a",true,(1).__at((3))];
  3074. return $1;
  3075. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},smalltalk.DictionaryTest)})},
  3076. args: [],
  3077. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3078. messageSends: ["@"],
  3079. referencedClasses: []
  3080. }),
  3081. smalltalk.DictionaryTest);
  3082. smalltalk.addMethod(
  3083. smalltalk.method({
  3084. selector: "collectionOfPrintStrings",
  3085. protocol: 'fixture',
  3086. fn: function (){
  3087. var self=this;
  3088. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3089. return smalltalk.withContext(function($ctx1) {
  3090. var $2,$3,$1;
  3091. $2=_st($Dictionary())._new();
  3092. _st($2)._at_put_((1),"1");
  3093. $ctx1.sendIdx["at:put:"]=1;
  3094. _st($2)._at_put_("a","2");
  3095. $ctx1.sendIdx["at:put:"]=2;
  3096. _st($2)._at_put_(true,"3");
  3097. $ctx1.sendIdx["at:put:"]=3;
  3098. _st($2)._at_put_((1).__at((3)),"-4");
  3099. $3=_st($2)._yourself();
  3100. $1=$3;
  3101. return $1;
  3102. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.DictionaryTest)})},
  3103. args: [],
  3104. 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",
  3105. messageSends: ["at:put:", "new", "@", "yourself"],
  3106. referencedClasses: ["Dictionary"]
  3107. }),
  3108. smalltalk.DictionaryTest);
  3109. smalltalk.addMethod(
  3110. smalltalk.method({
  3111. selector: "collectionSize",
  3112. protocol: 'fixture',
  3113. fn: function (){
  3114. var self=this;
  3115. return smalltalk.withContext(function($ctx1) {
  3116. return (4);
  3117. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.DictionaryTest)})},
  3118. args: [],
  3119. source: "collectionSize\x0a\x09^ 4",
  3120. messageSends: [],
  3121. referencedClasses: []
  3122. }),
  3123. smalltalk.DictionaryTest);
  3124. smalltalk.addMethod(
  3125. smalltalk.method({
  3126. selector: "collectionValues",
  3127. protocol: 'fixture',
  3128. fn: function (){
  3129. var self=this;
  3130. return smalltalk.withContext(function($ctx1) {
  3131. var $1;
  3132. $1=[(1),(2),(3),(-4)];
  3133. return $1;
  3134. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},smalltalk.DictionaryTest)})},
  3135. args: [],
  3136. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3137. messageSends: [],
  3138. referencedClasses: []
  3139. }),
  3140. smalltalk.DictionaryTest);
  3141. smalltalk.addMethod(
  3142. smalltalk.method({
  3143. selector: "collectionWithDuplicates",
  3144. protocol: 'fixture',
  3145. fn: function (){
  3146. var self=this;
  3147. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3148. return smalltalk.withContext(function($ctx1) {
  3149. var $2,$3,$1;
  3150. $2=_st($Dictionary())._new();
  3151. _st($2)._at_put_((1),(1));
  3152. $ctx1.sendIdx["at:put:"]=1;
  3153. _st($2)._at_put_("a",(2));
  3154. $ctx1.sendIdx["at:put:"]=2;
  3155. _st($2)._at_put_(true,(3));
  3156. $ctx1.sendIdx["at:put:"]=3;
  3157. _st($2)._at_put_((4),(-4));
  3158. $ctx1.sendIdx["at:put:"]=4;
  3159. _st($2)._at_put_("b",(1));
  3160. $ctx1.sendIdx["at:put:"]=5;
  3161. _st($2)._at_put_((3),(3));
  3162. $ctx1.sendIdx["at:put:"]=6;
  3163. _st($2)._at_put_(false,(12));
  3164. $3=_st($2)._yourself();
  3165. $1=$3;
  3166. return $1;
  3167. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  3168. args: [],
  3169. 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",
  3170. messageSends: ["at:put:", "new", "yourself"],
  3171. referencedClasses: ["Dictionary"]
  3172. }),
  3173. smalltalk.DictionaryTest);
  3174. smalltalk.addMethod(
  3175. smalltalk.method({
  3176. selector: "collectionWithNewValue",
  3177. protocol: 'fixture',
  3178. fn: function (){
  3179. var self=this;
  3180. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3181. return smalltalk.withContext(function($ctx1) {
  3182. var $2,$3,$1;
  3183. $2=_st($Dictionary())._new();
  3184. _st($2)._at_put_((1),(1));
  3185. $ctx1.sendIdx["at:put:"]=1;
  3186. _st($2)._at_put_("a",(2));
  3187. $ctx1.sendIdx["at:put:"]=2;
  3188. _st($2)._at_put_(true,(3));
  3189. $ctx1.sendIdx["at:put:"]=3;
  3190. _st($2)._at_put_((1).__at((3)),(-4));
  3191. $ctx1.sendIdx["at:put:"]=4;
  3192. _st($2)._at_put_("new","N");
  3193. $3=_st($2)._yourself();
  3194. $1=$3;
  3195. return $1;
  3196. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.DictionaryTest)})},
  3197. args: [],
  3198. 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",
  3199. messageSends: ["at:put:", "new", "@", "yourself"],
  3200. referencedClasses: ["Dictionary"]
  3201. }),
  3202. smalltalk.DictionaryTest);
  3203. smalltalk.addMethod(
  3204. smalltalk.method({
  3205. selector: "sampleNewValueAsCollection",
  3206. protocol: 'fixture',
  3207. fn: function (){
  3208. var self=this;
  3209. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3210. return smalltalk.withContext(function($ctx1) {
  3211. var $2,$3,$1;
  3212. $2=_st($Dictionary())._new();
  3213. _st($2)._at_put_("new","N");
  3214. $3=_st($2)._yourself();
  3215. $1=$3;
  3216. return $1;
  3217. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.DictionaryTest)})},
  3218. args: [],
  3219. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3220. messageSends: ["at:put:", "new", "yourself"],
  3221. referencedClasses: ["Dictionary"]
  3222. }),
  3223. smalltalk.DictionaryTest);
  3224. smalltalk.addMethod(
  3225. smalltalk.method({
  3226. selector: "samplesDo:",
  3227. protocol: 'fixture',
  3228. fn: function (aBlock){
  3229. var self=this;
  3230. return smalltalk.withContext(function($ctx1) {
  3231. smalltalk.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3232. _st(aBlock)._value_value_(true,(3));
  3233. $ctx1.sendIdx["value:value:"]=1;
  3234. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3235. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.DictionaryTest)})},
  3236. args: ["aBlock"],
  3237. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3238. messageSends: ["samplesDo:", "value:value:", "@"],
  3239. referencedClasses: []
  3240. }),
  3241. smalltalk.DictionaryTest);
  3242. smalltalk.addMethod(
  3243. smalltalk.method({
  3244. selector: "testAccessing",
  3245. protocol: 'tests',
  3246. fn: function (){
  3247. var self=this;
  3248. var d;
  3249. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3250. return smalltalk.withContext(function($ctx1) {
  3251. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3252. d=_st($Dictionary())._new();
  3253. _st(d)._at_put_("hello","world");
  3254. $ctx1.sendIdx["at:put:"]=1;
  3255. $1=_st(d)._at_("hello");
  3256. $ctx1.sendIdx["at:"]=1;
  3257. self._assert_equals_($1,"world");
  3258. $ctx1.sendIdx["assert:equals:"]=1;
  3259. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3260. return smalltalk.withContext(function($ctx2) {
  3261. return nil;
  3262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3263. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3264. self._assert_equals_($2,"world");
  3265. $ctx1.sendIdx["assert:equals:"]=2;
  3266. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3267. return smalltalk.withContext(function($ctx2) {
  3268. return nil;
  3269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  3270. $ctx1.sendIdx["deny:"]=1;
  3271. $3=_st(d)._includesKey_("hello");
  3272. $ctx1.sendIdx["includesKey:"]=1;
  3273. self._assert_($3);
  3274. $ctx1.sendIdx["assert:"]=1;
  3275. $4=_st(d)._includesKey_("foo");
  3276. $ctx1.sendIdx["includesKey:"]=2;
  3277. self._deny_($4);
  3278. $ctx1.sendIdx["deny:"]=2;
  3279. _st(d)._at_put_((1),(2));
  3280. $ctx1.sendIdx["at:put:"]=2;
  3281. $5=_st(d)._at_((1));
  3282. $ctx1.sendIdx["at:"]=2;
  3283. self._assert_equals_($5,(2));
  3284. $ctx1.sendIdx["assert:equals:"]=3;
  3285. $6=d;
  3286. $7=(1).__at((3));
  3287. $ctx1.sendIdx["@"]=1;
  3288. _st($6)._at_put_($7,(3));
  3289. $9=d;
  3290. $10=(1).__at((3));
  3291. $ctx1.sendIdx["@"]=2;
  3292. $8=_st($9)._at_($10);
  3293. self._assert_equals_($8,(3));
  3294. $12=d;
  3295. $13=(1).__at((3));
  3296. $ctx1.sendIdx["@"]=3;
  3297. $11=_st($12)._includesKey_($13);
  3298. $ctx1.sendIdx["includesKey:"]=3;
  3299. self._assert_($11);
  3300. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3301. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  3302. args: [],
  3303. 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)",
  3304. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3305. referencedClasses: ["Dictionary"]
  3306. }),
  3307. smalltalk.DictionaryTest);
  3308. smalltalk.addMethod(
  3309. smalltalk.method({
  3310. selector: "testDynamicDictionaries",
  3311. protocol: 'tests',
  3312. fn: function (){
  3313. var self=this;
  3314. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3315. return smalltalk.withContext(function($ctx1) {
  3316. var $3,$2,$1;
  3317. $3="hello".__minus_gt((1));
  3318. $ctx1.sendIdx["->"]=1;
  3319. $2=smalltalk.HashedCollection._from_([$3]);
  3320. $1=_st($2)._asDictionary();
  3321. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  3322. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  3323. args: [],
  3324. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3325. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  3326. referencedClasses: ["Dictionary"]
  3327. }),
  3328. smalltalk.DictionaryTest);
  3329. smalltalk.addMethod(
  3330. smalltalk.method({
  3331. selector: "collectionClass",
  3332. protocol: 'fixture',
  3333. fn: function (){
  3334. var self=this;
  3335. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3336. return smalltalk.withContext(function($ctx1) {
  3337. return $Dictionary();
  3338. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  3339. args: [],
  3340. source: "collectionClass\x0a\x09^ Dictionary",
  3341. messageSends: [],
  3342. referencedClasses: ["Dictionary"]
  3343. }),
  3344. smalltalk.DictionaryTest.klass);
  3345. smalltalk.addClass('HashedCollectionTest', smalltalk.AssociativeCollectionTest, [], 'Kernel-Tests');
  3346. smalltalk.addMethod(
  3347. smalltalk.method({
  3348. selector: "collection",
  3349. protocol: 'fixture',
  3350. fn: function (){
  3351. var self=this;
  3352. return smalltalk.withContext(function($ctx1) {
  3353. var $2,$3,$4,$1;
  3354. $2="b".__minus_gt((1));
  3355. $ctx1.sendIdx["->"]=1;
  3356. $3="a".__minus_gt((2));
  3357. $ctx1.sendIdx["->"]=2;
  3358. $4="c".__minus_gt((3));
  3359. $ctx1.sendIdx["->"]=3;
  3360. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  3361. return $1;
  3362. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  3363. args: [],
  3364. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3365. messageSends: ["->"],
  3366. referencedClasses: []
  3367. }),
  3368. smalltalk.HashedCollectionTest);
  3369. smalltalk.addMethod(
  3370. smalltalk.method({
  3371. selector: "collectionKeys",
  3372. protocol: 'fixture',
  3373. fn: function (){
  3374. var self=this;
  3375. return smalltalk.withContext(function($ctx1) {
  3376. var $1;
  3377. $1=["b","a","c","d"];
  3378. return $1;
  3379. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},smalltalk.HashedCollectionTest)})},
  3380. args: [],
  3381. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3382. messageSends: [],
  3383. referencedClasses: []
  3384. }),
  3385. smalltalk.HashedCollectionTest);
  3386. smalltalk.addMethod(
  3387. smalltalk.method({
  3388. selector: "collectionOfPrintStrings",
  3389. protocol: 'fixture',
  3390. fn: function (){
  3391. var self=this;
  3392. return smalltalk.withContext(function($ctx1) {
  3393. var $2,$3,$4,$1;
  3394. $2="b".__minus_gt("1");
  3395. $ctx1.sendIdx["->"]=1;
  3396. $3="a".__minus_gt("2");
  3397. $ctx1.sendIdx["->"]=2;
  3398. $4="c".__minus_gt("3");
  3399. $ctx1.sendIdx["->"]=3;
  3400. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt("-4")]);
  3401. return $1;
  3402. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.HashedCollectionTest)})},
  3403. args: [],
  3404. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3405. messageSends: ["->"],
  3406. referencedClasses: []
  3407. }),
  3408. smalltalk.HashedCollectionTest);
  3409. smalltalk.addMethod(
  3410. smalltalk.method({
  3411. selector: "collectionSize",
  3412. protocol: 'fixture',
  3413. fn: function (){
  3414. var self=this;
  3415. return smalltalk.withContext(function($ctx1) {
  3416. return (4);
  3417. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.HashedCollectionTest)})},
  3418. args: [],
  3419. source: "collectionSize\x0a\x09^ 4",
  3420. messageSends: [],
  3421. referencedClasses: []
  3422. }),
  3423. smalltalk.HashedCollectionTest);
  3424. smalltalk.addMethod(
  3425. smalltalk.method({
  3426. selector: "collectionValues",
  3427. protocol: 'fixture',
  3428. fn: function (){
  3429. var self=this;
  3430. return smalltalk.withContext(function($ctx1) {
  3431. var $1;
  3432. $1=[(1),(2),(3),(-4)];
  3433. return $1;
  3434. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},smalltalk.HashedCollectionTest)})},
  3435. args: [],
  3436. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3437. messageSends: [],
  3438. referencedClasses: []
  3439. }),
  3440. smalltalk.HashedCollectionTest);
  3441. smalltalk.addMethod(
  3442. smalltalk.method({
  3443. selector: "collectionWithDuplicates",
  3444. protocol: 'fixture',
  3445. fn: function (){
  3446. var self=this;
  3447. return smalltalk.withContext(function($ctx1) {
  3448. var $2,$3,$4,$5,$6,$7,$1;
  3449. $2="b".__minus_gt((1));
  3450. $ctx1.sendIdx["->"]=1;
  3451. $3="a".__minus_gt((2));
  3452. $ctx1.sendIdx["->"]=2;
  3453. $4="c".__minus_gt((3));
  3454. $ctx1.sendIdx["->"]=3;
  3455. $5="d".__minus_gt((-4));
  3456. $ctx1.sendIdx["->"]=4;
  3457. $6="e".__minus_gt((1));
  3458. $ctx1.sendIdx["->"]=5;
  3459. $7="f".__minus_gt((2));
  3460. $ctx1.sendIdx["->"]=6;
  3461. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  3462. return $1;
  3463. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  3464. args: [],
  3465. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3466. messageSends: ["->"],
  3467. referencedClasses: []
  3468. }),
  3469. smalltalk.HashedCollectionTest);
  3470. smalltalk.addMethod(
  3471. smalltalk.method({
  3472. selector: "collectionWithNewValue",
  3473. protocol: 'fixture',
  3474. fn: function (){
  3475. var self=this;
  3476. return smalltalk.withContext(function($ctx1) {
  3477. var $2,$3,$4,$5,$1;
  3478. $2="b".__minus_gt((1));
  3479. $ctx1.sendIdx["->"]=1;
  3480. $3="a".__minus_gt((2));
  3481. $ctx1.sendIdx["->"]=2;
  3482. $4="c".__minus_gt((3));
  3483. $ctx1.sendIdx["->"]=3;
  3484. $5="d".__minus_gt((-4));
  3485. $ctx1.sendIdx["->"]=4;
  3486. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  3487. return $1;
  3488. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.HashedCollectionTest)})},
  3489. args: [],
  3490. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3491. messageSends: ["->"],
  3492. referencedClasses: []
  3493. }),
  3494. smalltalk.HashedCollectionTest);
  3495. smalltalk.addMethod(
  3496. smalltalk.method({
  3497. selector: "sampleNewValueAsCollection",
  3498. protocol: 'fixture',
  3499. fn: function (){
  3500. var self=this;
  3501. return smalltalk.withContext(function($ctx1) {
  3502. var $1;
  3503. $1=smalltalk.HashedCollection._from_(["new".__minus_gt("N")]);
  3504. return $1;
  3505. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.HashedCollectionTest)})},
  3506. args: [],
  3507. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3508. messageSends: ["->"],
  3509. referencedClasses: []
  3510. }),
  3511. smalltalk.HashedCollectionTest);
  3512. smalltalk.addMethod(
  3513. smalltalk.method({
  3514. selector: "testDynamicDictionaries",
  3515. protocol: 'tests',
  3516. fn: function (){
  3517. var self=this;
  3518. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3519. return smalltalk.withContext(function($ctx1) {
  3520. var $3,$2,$1;
  3521. $3="hello".__minus_gt((1));
  3522. $ctx1.sendIdx["->"]=1;
  3523. $2=smalltalk.HashedCollection._from_([$3]);
  3524. $1=_st($2)._asHashedCollection();
  3525. self._assert_equals_($1,_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3526. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.HashedCollectionTest)})},
  3527. args: [],
  3528. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3529. messageSends: ["assert:equals:", "asHashedCollection", "->", "with:"],
  3530. referencedClasses: ["HashedCollection"]
  3531. }),
  3532. smalltalk.HashedCollectionTest);
  3533. smalltalk.addMethod(
  3534. smalltalk.method({
  3535. selector: "collectionClass",
  3536. protocol: 'fixture',
  3537. fn: function (){
  3538. var self=this;
  3539. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3540. return smalltalk.withContext(function($ctx1) {
  3541. return $HashedCollection();
  3542. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  3543. args: [],
  3544. source: "collectionClass\x0a\x09^ HashedCollection",
  3545. messageSends: [],
  3546. referencedClasses: ["HashedCollection"]
  3547. }),
  3548. smalltalk.HashedCollectionTest.klass);
  3549. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  3550. smalltalk.addMethod(
  3551. smalltalk.method({
  3552. selector: "collectionFirst",
  3553. protocol: 'fixture',
  3554. fn: function (){
  3555. var self=this;
  3556. return smalltalk.withContext(function($ctx1) {
  3557. self._subclassResponsibility();
  3558. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.SequenceableCollectionTest)})},
  3559. args: [],
  3560. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3561. messageSends: ["subclassResponsibility"],
  3562. referencedClasses: []
  3563. }),
  3564. smalltalk.SequenceableCollectionTest);
  3565. smalltalk.addMethod(
  3566. smalltalk.method({
  3567. selector: "collectionFirstTwo",
  3568. protocol: 'fixture',
  3569. fn: function (){
  3570. var self=this;
  3571. return smalltalk.withContext(function($ctx1) {
  3572. self._subclassResponsibility();
  3573. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.SequenceableCollectionTest)})},
  3574. args: [],
  3575. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3576. messageSends: ["subclassResponsibility"],
  3577. referencedClasses: []
  3578. }),
  3579. smalltalk.SequenceableCollectionTest);
  3580. smalltalk.addMethod(
  3581. smalltalk.method({
  3582. selector: "collectionLast",
  3583. protocol: 'fixture',
  3584. fn: function (){
  3585. var self=this;
  3586. return smalltalk.withContext(function($ctx1) {
  3587. self._subclassResponsibility();
  3588. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.SequenceableCollectionTest)})},
  3589. args: [],
  3590. source: "collectionLast\x0a\x09self subclassResponsibility",
  3591. messageSends: ["subclassResponsibility"],
  3592. referencedClasses: []
  3593. }),
  3594. smalltalk.SequenceableCollectionTest);
  3595. smalltalk.addMethod(
  3596. smalltalk.method({
  3597. selector: "collectionLastTwo",
  3598. protocol: 'fixture',
  3599. fn: function (){
  3600. var self=this;
  3601. return smalltalk.withContext(function($ctx1) {
  3602. self._subclassResponsibility();
  3603. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.SequenceableCollectionTest)})},
  3604. args: [],
  3605. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3606. messageSends: ["subclassResponsibility"],
  3607. referencedClasses: []
  3608. }),
  3609. smalltalk.SequenceableCollectionTest);
  3610. smalltalk.addMethod(
  3611. smalltalk.method({
  3612. selector: "nonIndexesDo:",
  3613. protocol: 'fixture',
  3614. fn: function (aBlock){
  3615. var self=this;
  3616. return smalltalk.withContext(function($ctx1) {
  3617. _st(aBlock)._value_((0));
  3618. $ctx1.sendIdx["value:"]=1;
  3619. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3620. $ctx1.sendIdx["value:"]=2;
  3621. _st(aBlock)._value_("z");
  3622. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3623. args: ["aBlock"],
  3624. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3625. messageSends: ["value:", "+", "collectionSize"],
  3626. referencedClasses: []
  3627. }),
  3628. smalltalk.SequenceableCollectionTest);
  3629. smalltalk.addMethod(
  3630. smalltalk.method({
  3631. selector: "samplesDo:",
  3632. protocol: 'fixture',
  3633. fn: function (aBlock){
  3634. var self=this;
  3635. return smalltalk.withContext(function($ctx1) {
  3636. _st(aBlock)._value_value_((1),self._collectionFirst());
  3637. $ctx1.sendIdx["value:value:"]=1;
  3638. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3639. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3640. args: ["aBlock"],
  3641. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3642. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3643. referencedClasses: []
  3644. }),
  3645. smalltalk.SequenceableCollectionTest);
  3646. smalltalk.addMethod(
  3647. smalltalk.method({
  3648. selector: "testBeginsWith",
  3649. protocol: 'tests',
  3650. fn: function (){
  3651. var self=this;
  3652. return smalltalk.withContext(function($ctx1) {
  3653. var $2,$1,$4,$5,$3,$7,$6;
  3654. $2=self._collection();
  3655. $ctx1.sendIdx["collection"]=1;
  3656. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3657. $ctx1.sendIdx["beginsWith:"]=1;
  3658. self._assert_($1);
  3659. $ctx1.sendIdx["assert:"]=1;
  3660. $4=self._collection();
  3661. $ctx1.sendIdx["collection"]=2;
  3662. $5=self._collection();
  3663. $ctx1.sendIdx["collection"]=3;
  3664. $3=_st($4)._beginsWith_($5);
  3665. $ctx1.sendIdx["beginsWith:"]=2;
  3666. self._assert_($3);
  3667. $ctx1.sendIdx["assert:"]=2;
  3668. $7=self._collection();
  3669. $ctx1.sendIdx["collection"]=4;
  3670. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3671. $ctx1.sendIdx["beginsWith:"]=3;
  3672. self._assert_($6);
  3673. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3674. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  3675. args: [],
  3676. 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)",
  3677. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3678. referencedClasses: []
  3679. }),
  3680. smalltalk.SequenceableCollectionTest);
  3681. smalltalk.addMethod(
  3682. smalltalk.method({
  3683. selector: "testEndsWith",
  3684. protocol: 'tests',
  3685. fn: function (){
  3686. var self=this;
  3687. return smalltalk.withContext(function($ctx1) {
  3688. var $2,$1,$4,$5,$3,$7,$6;
  3689. $2=self._collection();
  3690. $ctx1.sendIdx["collection"]=1;
  3691. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3692. $ctx1.sendIdx["endsWith:"]=1;
  3693. self._assert_($1);
  3694. $ctx1.sendIdx["assert:"]=1;
  3695. $4=self._collection();
  3696. $ctx1.sendIdx["collection"]=2;
  3697. $5=self._collection();
  3698. $ctx1.sendIdx["collection"]=3;
  3699. $3=_st($4)._endsWith_($5);
  3700. $ctx1.sendIdx["endsWith:"]=2;
  3701. self._assert_($3);
  3702. $ctx1.sendIdx["assert:"]=2;
  3703. $7=self._collection();
  3704. $ctx1.sendIdx["collection"]=4;
  3705. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3706. $ctx1.sendIdx["endsWith:"]=3;
  3707. self._assert_($6);
  3708. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3709. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  3710. args: [],
  3711. 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)",
  3712. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3713. referencedClasses: []
  3714. }),
  3715. smalltalk.SequenceableCollectionTest);
  3716. smalltalk.addMethod(
  3717. smalltalk.method({
  3718. selector: "testFirst",
  3719. protocol: 'tests',
  3720. fn: function (){
  3721. var self=this;
  3722. return smalltalk.withContext(function($ctx1) {
  3723. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3724. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  3725. args: [],
  3726. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3727. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3728. referencedClasses: []
  3729. }),
  3730. smalltalk.SequenceableCollectionTest);
  3731. smalltalk.addMethod(
  3732. smalltalk.method({
  3733. selector: "testFirstN",
  3734. protocol: 'tests',
  3735. fn: function (){
  3736. var self=this;
  3737. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3738. return smalltalk.withContext(function($ctx1) {
  3739. var $2,$1,$4,$3,$6,$5,$7;
  3740. $2=self._collection();
  3741. $ctx1.sendIdx["collection"]=1;
  3742. $1=_st($2)._first_((2));
  3743. $ctx1.sendIdx["first:"]=1;
  3744. self._assert_equals_($1,self._collectionFirstTwo());
  3745. $ctx1.sendIdx["assert:equals:"]=1;
  3746. $4=self._collection();
  3747. $ctx1.sendIdx["collection"]=2;
  3748. $3=_st($4)._first_((0));
  3749. $ctx1.sendIdx["first:"]=2;
  3750. self._assert_equals_($3,_st(self._collectionClass())._new());
  3751. $ctx1.sendIdx["assert:equals:"]=2;
  3752. $6=self._collection();
  3753. $ctx1.sendIdx["collection"]=3;
  3754. $5=_st($6)._first_(self._collectionSize());
  3755. $ctx1.sendIdx["first:"]=3;
  3756. $7=self._collection();
  3757. $ctx1.sendIdx["collection"]=4;
  3758. self._assert_equals_($5,$7);
  3759. self._should_raise_((function(){
  3760. return smalltalk.withContext(function($ctx2) {
  3761. return _st(self._collection())._first_((33));
  3762. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3763. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  3764. args: [],
  3765. 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",
  3766. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3767. referencedClasses: ["Error"]
  3768. }),
  3769. smalltalk.SequenceableCollectionTest);
  3770. smalltalk.addMethod(
  3771. smalltalk.method({
  3772. selector: "testFourth",
  3773. protocol: 'tests',
  3774. fn: function (){
  3775. var self=this;
  3776. return smalltalk.withContext(function($ctx1) {
  3777. var $2,$1;
  3778. $2=self._collection();
  3779. $ctx1.sendIdx["collection"]=1;
  3780. $1=_st($2)._fourth();
  3781. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3782. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  3783. args: [],
  3784. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3785. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3786. referencedClasses: []
  3787. }),
  3788. smalltalk.SequenceableCollectionTest);
  3789. smalltalk.addMethod(
  3790. smalltalk.method({
  3791. selector: "testLast",
  3792. protocol: 'tests',
  3793. fn: function (){
  3794. var self=this;
  3795. return smalltalk.withContext(function($ctx1) {
  3796. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3797. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  3798. args: [],
  3799. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3800. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3801. referencedClasses: []
  3802. }),
  3803. smalltalk.SequenceableCollectionTest);
  3804. smalltalk.addMethod(
  3805. smalltalk.method({
  3806. selector: "testLastN",
  3807. protocol: 'tests',
  3808. fn: function (){
  3809. var self=this;
  3810. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3811. return smalltalk.withContext(function($ctx1) {
  3812. var $2,$1,$4,$3,$6,$5,$7;
  3813. $2=self._collection();
  3814. $ctx1.sendIdx["collection"]=1;
  3815. $1=_st($2)._last_((2));
  3816. $ctx1.sendIdx["last:"]=1;
  3817. self._assert_equals_($1,self._collectionLastTwo());
  3818. $ctx1.sendIdx["assert:equals:"]=1;
  3819. $4=self._collection();
  3820. $ctx1.sendIdx["collection"]=2;
  3821. $3=_st($4)._last_((0));
  3822. $ctx1.sendIdx["last:"]=2;
  3823. self._assert_equals_($3,_st(self._collectionClass())._new());
  3824. $ctx1.sendIdx["assert:equals:"]=2;
  3825. $6=self._collection();
  3826. $ctx1.sendIdx["collection"]=3;
  3827. $5=_st($6)._last_(self._collectionSize());
  3828. $ctx1.sendIdx["last:"]=3;
  3829. $7=self._collection();
  3830. $ctx1.sendIdx["collection"]=4;
  3831. self._assert_equals_($5,$7);
  3832. self._should_raise_((function(){
  3833. return smalltalk.withContext(function($ctx2) {
  3834. return _st(self._collection())._last_((33));
  3835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3836. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  3837. args: [],
  3838. 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",
  3839. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3840. referencedClasses: ["Error"]
  3841. }),
  3842. smalltalk.SequenceableCollectionTest);
  3843. smalltalk.addMethod(
  3844. smalltalk.method({
  3845. selector: "testSecond",
  3846. protocol: 'tests',
  3847. fn: function (){
  3848. var self=this;
  3849. return smalltalk.withContext(function($ctx1) {
  3850. var $2,$1;
  3851. $2=self._collection();
  3852. $ctx1.sendIdx["collection"]=1;
  3853. $1=_st($2)._second();
  3854. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3855. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  3856. args: [],
  3857. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3858. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3859. referencedClasses: []
  3860. }),
  3861. smalltalk.SequenceableCollectionTest);
  3862. smalltalk.addMethod(
  3863. smalltalk.method({
  3864. selector: "testThird",
  3865. protocol: 'tests',
  3866. fn: function (){
  3867. var self=this;
  3868. return smalltalk.withContext(function($ctx1) {
  3869. var $2,$1;
  3870. $2=self._collection();
  3871. $ctx1.sendIdx["collection"]=1;
  3872. $1=_st($2)._third();
  3873. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3874. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  3875. args: [],
  3876. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3877. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3878. referencedClasses: []
  3879. }),
  3880. smalltalk.SequenceableCollectionTest);
  3881. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3882. smalltalk.addMethod(
  3883. smalltalk.method({
  3884. selector: "collection",
  3885. protocol: 'fixture',
  3886. fn: function (){
  3887. var self=this;
  3888. return smalltalk.withContext(function($ctx1) {
  3889. var $1;
  3890. $1=[(1), (2), (3), (-4)];
  3891. return $1;
  3892. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  3893. args: [],
  3894. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3895. messageSends: [],
  3896. referencedClasses: []
  3897. }),
  3898. smalltalk.ArrayTest);
  3899. smalltalk.addMethod(
  3900. smalltalk.method({
  3901. selector: "collectionFirst",
  3902. protocol: 'fixture',
  3903. fn: function (){
  3904. var self=this;
  3905. return smalltalk.withContext(function($ctx1) {
  3906. return (1);
  3907. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.ArrayTest)})},
  3908. args: [],
  3909. source: "collectionFirst\x0a\x09^ 1",
  3910. messageSends: [],
  3911. referencedClasses: []
  3912. }),
  3913. smalltalk.ArrayTest);
  3914. smalltalk.addMethod(
  3915. smalltalk.method({
  3916. selector: "collectionFirstTwo",
  3917. protocol: 'fixture',
  3918. fn: function (){
  3919. var self=this;
  3920. return smalltalk.withContext(function($ctx1) {
  3921. var $1;
  3922. $1=[(1), (2)];
  3923. return $1;
  3924. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.ArrayTest)})},
  3925. args: [],
  3926. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3927. messageSends: [],
  3928. referencedClasses: []
  3929. }),
  3930. smalltalk.ArrayTest);
  3931. smalltalk.addMethod(
  3932. smalltalk.method({
  3933. selector: "collectionLast",
  3934. protocol: 'fixture',
  3935. fn: function (){
  3936. var self=this;
  3937. return smalltalk.withContext(function($ctx1) {
  3938. return (-4);
  3939. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.ArrayTest)})},
  3940. args: [],
  3941. source: "collectionLast\x0a\x09^ -4",
  3942. messageSends: [],
  3943. referencedClasses: []
  3944. }),
  3945. smalltalk.ArrayTest);
  3946. smalltalk.addMethod(
  3947. smalltalk.method({
  3948. selector: "collectionLastTwo",
  3949. protocol: 'fixture',
  3950. fn: function (){
  3951. var self=this;
  3952. return smalltalk.withContext(function($ctx1) {
  3953. var $1;
  3954. $1=[(3), (-4)];
  3955. return $1;
  3956. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.ArrayTest)})},
  3957. args: [],
  3958. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3959. messageSends: [],
  3960. referencedClasses: []
  3961. }),
  3962. smalltalk.ArrayTest);
  3963. smalltalk.addMethod(
  3964. smalltalk.method({
  3965. selector: "collectionOfPrintStrings",
  3966. protocol: 'fixture',
  3967. fn: function (){
  3968. var self=this;
  3969. return smalltalk.withContext(function($ctx1) {
  3970. var $1;
  3971. $1=["1", "2", "3", "-4"];
  3972. return $1;
  3973. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.ArrayTest)})},
  3974. args: [],
  3975. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  3976. messageSends: [],
  3977. referencedClasses: []
  3978. }),
  3979. smalltalk.ArrayTest);
  3980. smalltalk.addMethod(
  3981. smalltalk.method({
  3982. selector: "collectionSize",
  3983. protocol: 'fixture',
  3984. fn: function (){
  3985. var self=this;
  3986. return smalltalk.withContext(function($ctx1) {
  3987. return (4);
  3988. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.ArrayTest)})},
  3989. args: [],
  3990. source: "collectionSize\x0a\x09^ 4",
  3991. messageSends: [],
  3992. referencedClasses: []
  3993. }),
  3994. smalltalk.ArrayTest);
  3995. smalltalk.addMethod(
  3996. smalltalk.method({
  3997. selector: "collectionWithDuplicates",
  3998. protocol: 'fixture',
  3999. fn: function (){
  4000. var self=this;
  4001. return smalltalk.withContext(function($ctx1) {
  4002. var $1;
  4003. $1=["a", "b", "c", (1), (2), (1), "a"];
  4004. return $1;
  4005. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  4006. args: [],
  4007. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4008. messageSends: [],
  4009. referencedClasses: []
  4010. }),
  4011. smalltalk.ArrayTest);
  4012. smalltalk.addMethod(
  4013. smalltalk.method({
  4014. selector: "collectionWithNewValue",
  4015. protocol: 'fixture',
  4016. fn: function (){
  4017. var self=this;
  4018. return smalltalk.withContext(function($ctx1) {
  4019. var $1;
  4020. $1=[(1), (2), (3), (-4), "N"];
  4021. return $1;
  4022. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.ArrayTest)})},
  4023. args: [],
  4024. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4025. messageSends: [],
  4026. referencedClasses: []
  4027. }),
  4028. smalltalk.ArrayTest);
  4029. smalltalk.addMethod(
  4030. smalltalk.method({
  4031. selector: "sampleNewIndex",
  4032. protocol: 'fixture',
  4033. fn: function (){
  4034. var self=this;
  4035. return smalltalk.withContext(function($ctx1) {
  4036. return (5);
  4037. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.ArrayTest)})},
  4038. args: [],
  4039. source: "sampleNewIndex\x0a\x09^ 5",
  4040. messageSends: [],
  4041. referencedClasses: []
  4042. }),
  4043. smalltalk.ArrayTest);
  4044. smalltalk.addMethod(
  4045. smalltalk.method({
  4046. selector: "samplesDo:",
  4047. protocol: 'fixture',
  4048. fn: function (aBlock){
  4049. var self=this;
  4050. return smalltalk.withContext(function($ctx1) {
  4051. smalltalk.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4052. _st(aBlock)._value_value_((3),(3));
  4053. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.ArrayTest)})},
  4054. args: ["aBlock"],
  4055. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4056. messageSends: ["samplesDo:", "value:value:"],
  4057. referencedClasses: []
  4058. }),
  4059. smalltalk.ArrayTest);
  4060. smalltalk.addMethod(
  4061. smalltalk.method({
  4062. selector: "testAdd",
  4063. protocol: 'tests',
  4064. fn: function (){
  4065. var self=this;
  4066. var array;
  4067. return smalltalk.withContext(function($ctx1) {
  4068. array=self._collection();
  4069. _st(array)._add_((6));
  4070. self._assert_equals_(_st(array)._last(),(6));
  4071. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  4072. args: [],
  4073. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4074. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4075. referencedClasses: []
  4076. }),
  4077. smalltalk.ArrayTest);
  4078. smalltalk.addMethod(
  4079. smalltalk.method({
  4080. selector: "testAddFirst",
  4081. protocol: 'tests',
  4082. fn: function (){
  4083. var self=this;
  4084. return smalltalk.withContext(function($ctx1) {
  4085. var $1,$2;
  4086. $1=self._collection();
  4087. _st($1)._addFirst_((0));
  4088. $2=_st($1)._yourself();
  4089. self._assert_equals_(_st($2)._first(),(0));
  4090. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  4091. args: [],
  4092. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4093. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4094. referencedClasses: []
  4095. }),
  4096. smalltalk.ArrayTest);
  4097. smalltalk.addMethod(
  4098. smalltalk.method({
  4099. selector: "testPrintString",
  4100. protocol: 'tests',
  4101. fn: function (){
  4102. var self=this;
  4103. var array;
  4104. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4105. return smalltalk.withContext(function($ctx1) {
  4106. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4107. array=_st($Array())._new();
  4108. $1=_st(array)._printString();
  4109. $ctx1.sendIdx["printString"]=1;
  4110. self._assert_equals_($1,"an Array ()");
  4111. $ctx1.sendIdx["assert:equals:"]=1;
  4112. $2=array;
  4113. _st($2)._add_((1));
  4114. $ctx1.sendIdx["add:"]=1;
  4115. $3=_st($2)._add_((3));
  4116. $ctx1.sendIdx["add:"]=2;
  4117. $4=_st(array)._printString();
  4118. $ctx1.sendIdx["printString"]=2;
  4119. self._assert_equals_($4,"an Array (1 3)");
  4120. $ctx1.sendIdx["assert:equals:"]=2;
  4121. _st(array)._add_("foo");
  4122. $5=_st(array)._printString();
  4123. $ctx1.sendIdx["printString"]=3;
  4124. self._assert_equals_($5,"an Array (1 3 'foo')");
  4125. $ctx1.sendIdx["assert:equals:"]=3;
  4126. $6=array;
  4127. _st($6)._remove_((1));
  4128. $ctx1.sendIdx["remove:"]=1;
  4129. $7=_st($6)._remove_((3));
  4130. $8=_st(array)._printString();
  4131. $ctx1.sendIdx["printString"]=4;
  4132. self._assert_equals_($8,"an Array ('foo')");
  4133. $ctx1.sendIdx["assert:equals:"]=4;
  4134. _st(array)._addLast_((3));
  4135. $ctx1.sendIdx["addLast:"]=1;
  4136. $9=_st(array)._printString();
  4137. $ctx1.sendIdx["printString"]=5;
  4138. self._assert_equals_($9,"an Array ('foo' 3)");
  4139. $ctx1.sendIdx["assert:equals:"]=5;
  4140. _st(array)._addLast_((3));
  4141. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4142. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  4143. args: [],
  4144. 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)'.",
  4145. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4146. referencedClasses: ["Array"]
  4147. }),
  4148. smalltalk.ArrayTest);
  4149. smalltalk.addMethod(
  4150. smalltalk.method({
  4151. selector: "testRemove",
  4152. protocol: 'tests',
  4153. fn: function (){
  4154. var self=this;
  4155. var array;
  4156. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4157. return smalltalk.withContext(function($ctx1) {
  4158. array=[(1), (2), (3), (4), (5)];
  4159. _st(array)._remove_((3));
  4160. $ctx1.sendIdx["remove:"]=1;
  4161. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4162. self._should_raise_((function(){
  4163. return smalltalk.withContext(function($ctx2) {
  4164. return _st(array)._remove_((3));
  4165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4166. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  4167. args: [],
  4168. 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",
  4169. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4170. referencedClasses: ["Error"]
  4171. }),
  4172. smalltalk.ArrayTest);
  4173. smalltalk.addMethod(
  4174. smalltalk.method({
  4175. selector: "testRemoveFromTo",
  4176. protocol: 'tests',
  4177. fn: function (){
  4178. var self=this;
  4179. return smalltalk.withContext(function($ctx1) {
  4180. var $1,$2;
  4181. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4182. $ctx1.sendIdx["removeFrom:to:"]=1;
  4183. self._assert_equals_($1,[(4)]);
  4184. $ctx1.sendIdx["assert:equals:"]=1;
  4185. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4186. $ctx1.sendIdx["removeFrom:to:"]=2;
  4187. self._assert_equals_($2,[(1), (4)]);
  4188. $ctx1.sendIdx["assert:equals:"]=2;
  4189. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4190. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  4191. args: [],
  4192. 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)",
  4193. messageSends: ["assert:equals:", "removeFrom:to:"],
  4194. referencedClasses: []
  4195. }),
  4196. smalltalk.ArrayTest);
  4197. smalltalk.addMethod(
  4198. smalltalk.method({
  4199. selector: "testRemoveIndex",
  4200. protocol: 'tests',
  4201. fn: function (){
  4202. var self=this;
  4203. return smalltalk.withContext(function($ctx1) {
  4204. var $1,$2;
  4205. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4206. $ctx1.sendIdx["removeIndex:"]=1;
  4207. self._assert_equals_($1,[(1), (3), (4)]);
  4208. $ctx1.sendIdx["assert:equals:"]=1;
  4209. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4210. $ctx1.sendIdx["removeIndex:"]=2;
  4211. self._assert_equals_($2,[(2), (3), (4)]);
  4212. $ctx1.sendIdx["assert:equals:"]=2;
  4213. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4214. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  4215. args: [],
  4216. 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: #()",
  4217. messageSends: ["assert:equals:", "removeIndex:"],
  4218. referencedClasses: []
  4219. }),
  4220. smalltalk.ArrayTest);
  4221. smalltalk.addMethod(
  4222. smalltalk.method({
  4223. selector: "testRemoveLast",
  4224. protocol: 'tests',
  4225. fn: function (){
  4226. var self=this;
  4227. var array;
  4228. return smalltalk.withContext(function($ctx1) {
  4229. array=[(1), (2)];
  4230. _st(array)._removeLast();
  4231. self._assert_equals_(_st(array)._last(),(1));
  4232. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  4233. args: [],
  4234. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4235. messageSends: ["removeLast", "assert:equals:", "last"],
  4236. referencedClasses: []
  4237. }),
  4238. smalltalk.ArrayTest);
  4239. smalltalk.addMethod(
  4240. smalltalk.method({
  4241. selector: "testReversed",
  4242. protocol: 'tests',
  4243. fn: function (){
  4244. var self=this;
  4245. var array;
  4246. return smalltalk.withContext(function($ctx1) {
  4247. array=[(5), (4), (3), (2), (1)];
  4248. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4249. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  4250. args: [],
  4251. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4252. messageSends: ["assert:equals:", "reversed"],
  4253. referencedClasses: []
  4254. }),
  4255. smalltalk.ArrayTest);
  4256. smalltalk.addMethod(
  4257. smalltalk.method({
  4258. selector: "testSort",
  4259. protocol: 'tests',
  4260. fn: function (){
  4261. var self=this;
  4262. var array;
  4263. return smalltalk.withContext(function($ctx1) {
  4264. array=[(3), (1), (4), (5), (2)];
  4265. _st(array)._sort();
  4266. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  4267. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  4268. args: [],
  4269. 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)",
  4270. messageSends: ["sort", "assert:equals:"],
  4271. referencedClasses: []
  4272. }),
  4273. smalltalk.ArrayTest);
  4274. smalltalk.addMethod(
  4275. smalltalk.method({
  4276. selector: "collectionClass",
  4277. protocol: 'fixture',
  4278. fn: function (){
  4279. var self=this;
  4280. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4281. return smalltalk.withContext(function($ctx1) {
  4282. return $Array();
  4283. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  4284. args: [],
  4285. source: "collectionClass\x0a\x09^ Array",
  4286. messageSends: [],
  4287. referencedClasses: ["Array"]
  4288. }),
  4289. smalltalk.ArrayTest.klass);
  4290. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  4291. smalltalk.addMethod(
  4292. smalltalk.method({
  4293. selector: "collection",
  4294. protocol: 'fixture',
  4295. fn: function (){
  4296. var self=this;
  4297. return smalltalk.withContext(function($ctx1) {
  4298. return "hello";
  4299. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  4300. args: [],
  4301. source: "collection\x0a\x09^ 'hello'",
  4302. messageSends: [],
  4303. referencedClasses: []
  4304. }),
  4305. smalltalk.StringTest);
  4306. smalltalk.addMethod(
  4307. smalltalk.method({
  4308. selector: "collectionFirst",
  4309. protocol: 'fixture',
  4310. fn: function (){
  4311. var self=this;
  4312. return smalltalk.withContext(function($ctx1) {
  4313. return "h";
  4314. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.StringTest)})},
  4315. args: [],
  4316. source: "collectionFirst\x0a\x09^ 'h'",
  4317. messageSends: [],
  4318. referencedClasses: []
  4319. }),
  4320. smalltalk.StringTest);
  4321. smalltalk.addMethod(
  4322. smalltalk.method({
  4323. selector: "collectionFirstTwo",
  4324. protocol: 'fixture',
  4325. fn: function (){
  4326. var self=this;
  4327. return smalltalk.withContext(function($ctx1) {
  4328. return "he";
  4329. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.StringTest)})},
  4330. args: [],
  4331. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4332. messageSends: [],
  4333. referencedClasses: []
  4334. }),
  4335. smalltalk.StringTest);
  4336. smalltalk.addMethod(
  4337. smalltalk.method({
  4338. selector: "collectionLast",
  4339. protocol: 'fixture',
  4340. fn: function (){
  4341. var self=this;
  4342. return smalltalk.withContext(function($ctx1) {
  4343. return "o";
  4344. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.StringTest)})},
  4345. args: [],
  4346. source: "collectionLast\x0a\x09^ 'o'",
  4347. messageSends: [],
  4348. referencedClasses: []
  4349. }),
  4350. smalltalk.StringTest);
  4351. smalltalk.addMethod(
  4352. smalltalk.method({
  4353. selector: "collectionLastTwo",
  4354. protocol: 'fixture',
  4355. fn: function (){
  4356. var self=this;
  4357. return smalltalk.withContext(function($ctx1) {
  4358. return "lo";
  4359. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.StringTest)})},
  4360. args: [],
  4361. source: "collectionLastTwo\x0a\x09^ 'lo'",
  4362. messageSends: [],
  4363. referencedClasses: []
  4364. }),
  4365. smalltalk.StringTest);
  4366. smalltalk.addMethod(
  4367. smalltalk.method({
  4368. selector: "collectionOfPrintStrings",
  4369. protocol: 'fixture',
  4370. fn: function (){
  4371. var self=this;
  4372. return smalltalk.withContext(function($ctx1) {
  4373. return "'h''e''l''l''o'";
  4374. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.StringTest)})},
  4375. args: [],
  4376. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''l''''o'''",
  4377. messageSends: [],
  4378. referencedClasses: []
  4379. }),
  4380. smalltalk.StringTest);
  4381. smalltalk.addMethod(
  4382. smalltalk.method({
  4383. selector: "collectionSize",
  4384. protocol: 'fixture',
  4385. fn: function (){
  4386. var self=this;
  4387. return smalltalk.withContext(function($ctx1) {
  4388. return (5);
  4389. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.StringTest)})},
  4390. args: [],
  4391. source: "collectionSize\x0a\x09^ 5",
  4392. messageSends: [],
  4393. referencedClasses: []
  4394. }),
  4395. smalltalk.StringTest);
  4396. smalltalk.addMethod(
  4397. smalltalk.method({
  4398. selector: "collectionWithDuplicates",
  4399. protocol: 'fixture',
  4400. fn: function (){
  4401. var self=this;
  4402. return smalltalk.withContext(function($ctx1) {
  4403. return "abbaerte";
  4404. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  4405. args: [],
  4406. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4407. messageSends: [],
  4408. referencedClasses: []
  4409. }),
  4410. smalltalk.StringTest);
  4411. smalltalk.addMethod(
  4412. smalltalk.method({
  4413. selector: "collectionWithNewValue",
  4414. protocol: 'fixture',
  4415. fn: function (){
  4416. var self=this;
  4417. return smalltalk.withContext(function($ctx1) {
  4418. return "helloN";
  4419. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.StringTest)})},
  4420. args: [],
  4421. source: "collectionWithNewValue\x0a\x09^ 'helloN'",
  4422. messageSends: [],
  4423. referencedClasses: []
  4424. }),
  4425. smalltalk.StringTest);
  4426. smalltalk.addMethod(
  4427. smalltalk.method({
  4428. selector: "sampleNewValueAsCollection",
  4429. protocol: 'fixture',
  4430. fn: function (){
  4431. var self=this;
  4432. return smalltalk.withContext(function($ctx1) {
  4433. return "N";
  4434. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.StringTest)})},
  4435. args: [],
  4436. source: "sampleNewValueAsCollection\x0a\x09\x0a\x09^ 'N'",
  4437. messageSends: [],
  4438. referencedClasses: []
  4439. }),
  4440. smalltalk.StringTest);
  4441. smalltalk.addMethod(
  4442. smalltalk.method({
  4443. selector: "samplesDo:",
  4444. protocol: 'fixture',
  4445. fn: function (aBlock){
  4446. var self=this;
  4447. return smalltalk.withContext(function($ctx1) {
  4448. smalltalk.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4449. _st(aBlock)._value_value_((3),"l");
  4450. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.StringTest)})},
  4451. args: ["aBlock"],
  4452. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4453. messageSends: ["samplesDo:", "value:value:"],
  4454. referencedClasses: []
  4455. }),
  4456. smalltalk.StringTest);
  4457. smalltalk.addMethod(
  4458. smalltalk.method({
  4459. selector: "testAddAll",
  4460. protocol: 'tests',
  4461. fn: function (){
  4462. var self=this;
  4463. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4464. return smalltalk.withContext(function($ctx1) {
  4465. var $1;
  4466. self._should_raise_((function(){
  4467. return smalltalk.withContext(function($ctx2) {
  4468. $1=self._collection();
  4469. $ctx2.sendIdx["collection"]=1;
  4470. return _st($1)._addAll_(self._collection());
  4471. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4472. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.StringTest)})},
  4473. args: [],
  4474. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4475. messageSends: ["should:raise:", "addAll:", "collection"],
  4476. referencedClasses: ["Error"]
  4477. }),
  4478. smalltalk.StringTest);
  4479. smalltalk.addMethod(
  4480. smalltalk.method({
  4481. selector: "testAddRemove",
  4482. protocol: 'tests',
  4483. fn: function (){
  4484. var self=this;
  4485. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4486. return smalltalk.withContext(function($ctx1) {
  4487. self._should_raise_((function(){
  4488. return smalltalk.withContext(function($ctx2) {
  4489. return "hello"._add_("a");
  4490. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4491. $ctx1.sendIdx["should:raise:"]=1;
  4492. self._should_raise_((function(){
  4493. return smalltalk.withContext(function($ctx2) {
  4494. return "hello"._remove_("h");
  4495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4496. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  4497. args: [],
  4498. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4499. messageSends: ["should:raise:", "add:", "remove:"],
  4500. referencedClasses: ["Error"]
  4501. }),
  4502. smalltalk.StringTest);
  4503. smalltalk.addMethod(
  4504. smalltalk.method({
  4505. selector: "testAsArray",
  4506. protocol: 'tests',
  4507. fn: function (){
  4508. var self=this;
  4509. return smalltalk.withContext(function($ctx1) {
  4510. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4511. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  4512. args: [],
  4513. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4514. messageSends: ["assert:equals:", "asArray"],
  4515. referencedClasses: []
  4516. }),
  4517. smalltalk.StringTest);
  4518. smalltalk.addMethod(
  4519. smalltalk.method({
  4520. selector: "testAsLowerCase",
  4521. protocol: 'tests',
  4522. fn: function (){
  4523. var self=this;
  4524. return smalltalk.withContext(function($ctx1) {
  4525. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4526. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  4527. args: [],
  4528. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4529. messageSends: ["assert:equals:", "asLowercase"],
  4530. referencedClasses: []
  4531. }),
  4532. smalltalk.StringTest);
  4533. smalltalk.addMethod(
  4534. smalltalk.method({
  4535. selector: "testAsNumber",
  4536. protocol: 'tests',
  4537. fn: function (){
  4538. var self=this;
  4539. return smalltalk.withContext(function($ctx1) {
  4540. var $1,$2;
  4541. $1="3"._asNumber();
  4542. $ctx1.sendIdx["asNumber"]=1;
  4543. self._assert_equals_($1,(3));
  4544. $ctx1.sendIdx["assert:equals:"]=1;
  4545. $2="-3"._asNumber();
  4546. $ctx1.sendIdx["asNumber"]=2;
  4547. self._assert_equals_($2,(-3));
  4548. $ctx1.sendIdx["assert:equals:"]=2;
  4549. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4550. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  4551. args: [],
  4552. 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.",
  4553. messageSends: ["assert:equals:", "asNumber"],
  4554. referencedClasses: []
  4555. }),
  4556. smalltalk.StringTest);
  4557. smalltalk.addMethod(
  4558. smalltalk.method({
  4559. selector: "testAsUpperCase",
  4560. protocol: 'tests',
  4561. fn: function (){
  4562. var self=this;
  4563. return smalltalk.withContext(function($ctx1) {
  4564. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4565. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  4566. args: [],
  4567. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4568. messageSends: ["assert:equals:", "asUppercase"],
  4569. referencedClasses: []
  4570. }),
  4571. smalltalk.StringTest);
  4572. smalltalk.addMethod(
  4573. smalltalk.method({
  4574. selector: "testAsciiValue",
  4575. protocol: 'tests',
  4576. fn: function (){
  4577. var self=this;
  4578. var characterA,characterU;
  4579. return smalltalk.withContext(function($ctx1) {
  4580. var $1;
  4581. characterA="A";
  4582. characterU="U";
  4583. $1=_st(characterA)._asciiValue();
  4584. $ctx1.sendIdx["asciiValue"]=1;
  4585. self._assert_equals_($1,(65));
  4586. $ctx1.sendIdx["assert:equals:"]=1;
  4587. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4588. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  4589. args: [],
  4590. 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",
  4591. messageSends: ["assert:equals:", "asciiValue"],
  4592. referencedClasses: []
  4593. }),
  4594. smalltalk.StringTest);
  4595. smalltalk.addMethod(
  4596. smalltalk.method({
  4597. selector: "testAtIfAbsentPut",
  4598. protocol: 'tests',
  4599. fn: function (){
  4600. var self=this;
  4601. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4602. return smalltalk.withContext(function($ctx1) {
  4603. self._should_raise_((function(){
  4604. return smalltalk.withContext(function($ctx2) {
  4605. return "hello"._at_ifAbsentPut_((6),(function(){
  4606. return smalltalk.withContext(function($ctx3) {
  4607. return "a";
  4608. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  4609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4610. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},smalltalk.StringTest)})},
  4611. args: [],
  4612. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4613. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4614. referencedClasses: ["Error"]
  4615. }),
  4616. smalltalk.StringTest);
  4617. smalltalk.addMethod(
  4618. smalltalk.method({
  4619. selector: "testAtPut",
  4620. protocol: 'tests',
  4621. fn: function (){
  4622. var self=this;
  4623. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4624. return smalltalk.withContext(function($ctx1) {
  4625. self._should_raise_((function(){
  4626. return smalltalk.withContext(function($ctx2) {
  4627. return "hello"._at_put_((1),"a");
  4628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4629. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  4630. args: [],
  4631. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4632. messageSends: ["should:raise:", "at:put:"],
  4633. referencedClasses: ["Error"]
  4634. }),
  4635. smalltalk.StringTest);
  4636. smalltalk.addMethod(
  4637. smalltalk.method({
  4638. selector: "testCapitalized",
  4639. protocol: 'tests',
  4640. fn: function (){
  4641. var self=this;
  4642. return smalltalk.withContext(function($ctx1) {
  4643. var $1,$2,$3;
  4644. $1="test"._capitalized();
  4645. $ctx1.sendIdx["capitalized"]=1;
  4646. self._assert_equals_($1,"Test");
  4647. $ctx1.sendIdx["assert:equals:"]=1;
  4648. $2="Test"._capitalized();
  4649. $ctx1.sendIdx["capitalized"]=2;
  4650. self._assert_equals_($2,"Test");
  4651. $ctx1.sendIdx["assert:equals:"]=2;
  4652. self._assert_equals_(""._capitalized(),"");
  4653. $ctx1.sendIdx["assert:equals:"]=3;
  4654. $3="Test"._isCapitalized();
  4655. $ctx1.sendIdx["isCapitalized"]=1;
  4656. self._assert_equals_($3,true);
  4657. $ctx1.sendIdx["assert:equals:"]=4;
  4658. self._assert_equals_("test"._isCapitalized(),false);
  4659. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  4660. args: [],
  4661. 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.",
  4662. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4663. referencedClasses: []
  4664. }),
  4665. smalltalk.StringTest);
  4666. smalltalk.addMethod(
  4667. smalltalk.method({
  4668. selector: "testCharCodeAt",
  4669. protocol: 'tests',
  4670. fn: function (){
  4671. var self=this;
  4672. return smalltalk.withContext(function($ctx1) {
  4673. var $1,$2,$3,$4,$5;
  4674. $1="jackie"._charCodeAt_((1));
  4675. $ctx1.sendIdx["charCodeAt:"]=1;
  4676. self._assert_equals_($1,(106));
  4677. $ctx1.sendIdx["assert:equals:"]=1;
  4678. $2="jackie"._charCodeAt_((2));
  4679. $ctx1.sendIdx["charCodeAt:"]=2;
  4680. self._assert_equals_($2,(97));
  4681. $ctx1.sendIdx["assert:equals:"]=2;
  4682. $3="jackie"._charCodeAt_((3));
  4683. $ctx1.sendIdx["charCodeAt:"]=3;
  4684. self._assert_equals_($3,(99));
  4685. $ctx1.sendIdx["assert:equals:"]=3;
  4686. $4="jackie"._charCodeAt_((4));
  4687. $ctx1.sendIdx["charCodeAt:"]=4;
  4688. self._assert_equals_($4,(107));
  4689. $ctx1.sendIdx["assert:equals:"]=4;
  4690. $5="jackie"._charCodeAt_((5));
  4691. $ctx1.sendIdx["charCodeAt:"]=5;
  4692. self._assert_equals_($5,(105));
  4693. $ctx1.sendIdx["assert:equals:"]=5;
  4694. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4695. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  4696. args: [],
  4697. 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",
  4698. messageSends: ["assert:equals:", "charCodeAt:"],
  4699. referencedClasses: []
  4700. }),
  4701. smalltalk.StringTest);
  4702. smalltalk.addMethod(
  4703. smalltalk.method({
  4704. selector: "testCopyFromTo",
  4705. protocol: 'tests',
  4706. fn: function (){
  4707. var self=this;
  4708. return smalltalk.withContext(function($ctx1) {
  4709. var $1;
  4710. $1="jackie"._copyFrom_to_((1),(3));
  4711. $ctx1.sendIdx["copyFrom:to:"]=1;
  4712. self._assert_equals_($1,"jac");
  4713. $ctx1.sendIdx["assert:equals:"]=1;
  4714. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4715. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  4716. args: [],
  4717. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4718. messageSends: ["assert:equals:", "copyFrom:to:"],
  4719. referencedClasses: []
  4720. }),
  4721. smalltalk.StringTest);
  4722. smalltalk.addMethod(
  4723. smalltalk.method({
  4724. selector: "testCopyWithoutAll",
  4725. protocol: 'tests',
  4726. fn: function (){
  4727. var self=this;
  4728. return smalltalk.withContext(function($ctx1) {
  4729. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4730. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  4731. args: [],
  4732. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4733. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4734. referencedClasses: []
  4735. }),
  4736. smalltalk.StringTest);
  4737. smalltalk.addMethod(
  4738. smalltalk.method({
  4739. selector: "testEquality",
  4740. protocol: 'tests',
  4741. fn: function (){
  4742. var self=this;
  4743. return smalltalk.withContext(function($ctx1) {
  4744. var $1,$2,$3;
  4745. self._assert_equals_("hello","hello");
  4746. $ctx1.sendIdx["assert:equals:"]=1;
  4747. $1="hello".__eq("world");
  4748. $ctx1.sendIdx["="]=1;
  4749. self._deny_($1);
  4750. $ctx1.sendIdx["deny:"]=1;
  4751. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4752. return smalltalk.withContext(function($ctx2) {
  4753. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  4754. $ctx1.sendIdx["="]=2;
  4755. self._deny_($2);
  4756. $ctx1.sendIdx["deny:"]=2;
  4757. $3="hello"._yourself();
  4758. $ctx1.sendIdx["yourself"]=1;
  4759. self._assert_equals_("hello",$3);
  4760. $ctx1.sendIdx["assert:equals:"]=2;
  4761. self._assert_equals_("hello"._yourself(),"hello");
  4762. self._deny_("".__eq((0)));
  4763. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  4764. args: [],
  4765. 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",
  4766. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4767. referencedClasses: []
  4768. }),
  4769. smalltalk.StringTest);
  4770. smalltalk.addMethod(
  4771. smalltalk.method({
  4772. selector: "testIdentity",
  4773. protocol: 'tests',
  4774. fn: function (){
  4775. var self=this;
  4776. return smalltalk.withContext(function($ctx1) {
  4777. var $1,$2,$4,$3,$5;
  4778. $1="hello".__eq_eq("hello");
  4779. $ctx1.sendIdx["=="]=1;
  4780. self._assert_($1);
  4781. $ctx1.sendIdx["assert:"]=1;
  4782. $2="hello".__eq_eq("world");
  4783. $ctx1.sendIdx["=="]=2;
  4784. self._deny_($2);
  4785. $ctx1.sendIdx["deny:"]=1;
  4786. $4="hello"._yourself();
  4787. $ctx1.sendIdx["yourself"]=1;
  4788. $3="hello".__eq_eq($4);
  4789. $ctx1.sendIdx["=="]=3;
  4790. self._assert_($3);
  4791. $ctx1.sendIdx["assert:"]=2;
  4792. $5=_st("hello"._yourself()).__eq_eq("hello");
  4793. $ctx1.sendIdx["=="]=4;
  4794. self._assert_($5);
  4795. self._deny_("".__eq_eq((0)));
  4796. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  4797. args: [],
  4798. 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",
  4799. messageSends: ["assert:", "==", "deny:", "yourself"],
  4800. referencedClasses: []
  4801. }),
  4802. smalltalk.StringTest);
  4803. smalltalk.addMethod(
  4804. smalltalk.method({
  4805. selector: "testIdentityHash",
  4806. protocol: 'tests',
  4807. fn: function (){
  4808. var self=this;
  4809. return smalltalk.withContext(function($ctx1) {
  4810. var $1,$2,$4,$3;
  4811. $1="foo"._identityHash();
  4812. $ctx1.sendIdx["identityHash"]=1;
  4813. $2="foo"._identityHash();
  4814. $ctx1.sendIdx["identityHash"]=2;
  4815. self._assert_equals_($1,$2);
  4816. $4="foo"._identityHash();
  4817. $ctx1.sendIdx["identityHash"]=3;
  4818. $3=_st($4).__eq("bar"._identityHash());
  4819. self._deny_($3);
  4820. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  4821. args: [],
  4822. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4823. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4824. referencedClasses: []
  4825. }),
  4826. smalltalk.StringTest);
  4827. smalltalk.addMethod(
  4828. smalltalk.method({
  4829. selector: "testIncludesSubString",
  4830. protocol: 'tests',
  4831. fn: function (){
  4832. var self=this;
  4833. return smalltalk.withContext(function($ctx1) {
  4834. var $1;
  4835. $1="amber"._includesSubString_("ber");
  4836. $ctx1.sendIdx["includesSubString:"]=1;
  4837. self._assert_($1);
  4838. self._deny_("amber"._includesSubString_("zork"));
  4839. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  4840. args: [],
  4841. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4842. messageSends: ["assert:", "includesSubString:", "deny:"],
  4843. referencedClasses: []
  4844. }),
  4845. smalltalk.StringTest);
  4846. smalltalk.addMethod(
  4847. smalltalk.method({
  4848. selector: "testIsVowel",
  4849. protocol: 'tests',
  4850. fn: function (){
  4851. var self=this;
  4852. var vowel,consonant;
  4853. return smalltalk.withContext(function($ctx1) {
  4854. var $1;
  4855. vowel="u";
  4856. consonant="z";
  4857. $1=_st(vowel)._isVowel();
  4858. $ctx1.sendIdx["isVowel"]=1;
  4859. self._assert_equals_($1,true);
  4860. $ctx1.sendIdx["assert:equals:"]=1;
  4861. self._assert_equals_(_st(consonant)._isVowel(),false);
  4862. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  4863. args: [],
  4864. 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",
  4865. messageSends: ["assert:equals:", "isVowel"],
  4866. referencedClasses: []
  4867. }),
  4868. smalltalk.StringTest);
  4869. smalltalk.addMethod(
  4870. smalltalk.method({
  4871. selector: "testJoin",
  4872. protocol: 'tests',
  4873. fn: function (){
  4874. var self=this;
  4875. return smalltalk.withContext(function($ctx1) {
  4876. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4877. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  4878. args: [],
  4879. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4880. messageSends: ["assert:equals:", "join:"],
  4881. referencedClasses: []
  4882. }),
  4883. smalltalk.StringTest);
  4884. smalltalk.addMethod(
  4885. smalltalk.method({
  4886. selector: "testRemoveAll",
  4887. protocol: 'tests',
  4888. fn: function (){
  4889. var self=this;
  4890. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4891. return smalltalk.withContext(function($ctx1) {
  4892. self._should_raise_((function(){
  4893. return smalltalk.withContext(function($ctx2) {
  4894. return _st(self._collection())._removeAll();
  4895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4896. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  4897. args: [],
  4898. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4899. messageSends: ["should:raise:", "removeAll", "collection"],
  4900. referencedClasses: ["Error"]
  4901. }),
  4902. smalltalk.StringTest);
  4903. smalltalk.addMethod(
  4904. smalltalk.method({
  4905. selector: "testReversed",
  4906. protocol: 'tests',
  4907. fn: function (){
  4908. var self=this;
  4909. return smalltalk.withContext(function($ctx1) {
  4910. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4911. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  4912. args: [],
  4913. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4914. messageSends: ["assert:equals:", "reversed"],
  4915. referencedClasses: []
  4916. }),
  4917. smalltalk.StringTest);
  4918. smalltalk.addMethod(
  4919. smalltalk.method({
  4920. selector: "testStreamContents",
  4921. protocol: 'tests',
  4922. fn: function (){
  4923. var self=this;
  4924. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4925. return smalltalk.withContext(function($ctx1) {
  4926. var $1;
  4927. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4928. return smalltalk.withContext(function($ctx2) {
  4929. _st(aStream)._nextPutAll_("hello");
  4930. $ctx2.sendIdx["nextPutAll:"]=1;
  4931. _st(aStream)._space();
  4932. $1=_st(aStream)._nextPutAll_("world");
  4933. return $1;
  4934. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4935. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  4936. args: [],
  4937. 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'",
  4938. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4939. referencedClasses: ["String"]
  4940. }),
  4941. smalltalk.StringTest);
  4942. smalltalk.addMethod(
  4943. smalltalk.method({
  4944. selector: "testSubStrings",
  4945. protocol: 'tests',
  4946. fn: function (){
  4947. var self=this;
  4948. return smalltalk.withContext(function($ctx1) {
  4949. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4950. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  4951. args: [],
  4952. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4953. messageSends: ["assert:equals:", "subStrings:"],
  4954. referencedClasses: []
  4955. }),
  4956. smalltalk.StringTest);
  4957. smalltalk.addMethod(
  4958. smalltalk.method({
  4959. selector: "testTrim",
  4960. protocol: 'tests',
  4961. fn: function (){
  4962. var self=this;
  4963. return smalltalk.withContext(function($ctx1) {
  4964. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  4965. $ctx1.sendIdx["assert:equals:"]=1;
  4966. self._assert_equals_("jackie "._trimRight(),"jackie");
  4967. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  4968. args: [],
  4969. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  4970. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  4971. referencedClasses: []
  4972. }),
  4973. smalltalk.StringTest);
  4974. smalltalk.addMethod(
  4975. smalltalk.method({
  4976. selector: "collectionClass",
  4977. protocol: 'fixture',
  4978. fn: function (){
  4979. var self=this;
  4980. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4981. return smalltalk.withContext(function($ctx1) {
  4982. return $String();
  4983. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  4984. args: [],
  4985. source: "collectionClass\x0a\x09^ String",
  4986. messageSends: [],
  4987. referencedClasses: ["String"]
  4988. }),
  4989. smalltalk.StringTest.klass);
  4990. smalltalk.addClass('SetTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  4991. smalltalk.addMethod(
  4992. smalltalk.method({
  4993. selector: "collection",
  4994. protocol: 'fixture',
  4995. fn: function (){
  4996. var self=this;
  4997. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  4998. return smalltalk.withContext(function($ctx1) {
  4999. var $2,$3,$1;
  5000. $2=_st($Set())._new();
  5001. _st($2)._add_((1));
  5002. $ctx1.sendIdx["add:"]=1;
  5003. _st($2)._add_((2));
  5004. $ctx1.sendIdx["add:"]=2;
  5005. _st($2)._add_((3));
  5006. $ctx1.sendIdx["add:"]=3;
  5007. _st($2)._add_((-4));
  5008. $3=_st($2)._yourself();
  5009. $1=$3;
  5010. return $1;
  5011. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.SetTest)})},
  5012. args: [],
  5013. 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",
  5014. messageSends: ["add:", "new", "yourself"],
  5015. referencedClasses: ["Set"]
  5016. }),
  5017. smalltalk.SetTest);
  5018. smalltalk.addMethod(
  5019. smalltalk.method({
  5020. selector: "collectionOfPrintStrings",
  5021. protocol: 'fixture',
  5022. fn: function (){
  5023. var self=this;
  5024. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5025. return smalltalk.withContext(function($ctx1) {
  5026. var $2,$3,$1;
  5027. $2=_st($Set())._new();
  5028. _st($2)._add_("1");
  5029. $ctx1.sendIdx["add:"]=1;
  5030. _st($2)._add_("2");
  5031. $ctx1.sendIdx["add:"]=2;
  5032. _st($2)._add_("3");
  5033. $ctx1.sendIdx["add:"]=3;
  5034. _st($2)._add_("-4");
  5035. $3=_st($2)._yourself();
  5036. $1=$3;
  5037. return $1;
  5038. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.SetTest)})},
  5039. args: [],
  5040. 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",
  5041. messageSends: ["add:", "new", "yourself"],
  5042. referencedClasses: ["Set"]
  5043. }),
  5044. smalltalk.SetTest);
  5045. smalltalk.addMethod(
  5046. smalltalk.method({
  5047. selector: "collectionSize",
  5048. protocol: 'fixture',
  5049. fn: function (){
  5050. var self=this;
  5051. return smalltalk.withContext(function($ctx1) {
  5052. return (4);
  5053. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.SetTest)})},
  5054. args: [],
  5055. source: "collectionSize\x0a\x09^ 4",
  5056. messageSends: [],
  5057. referencedClasses: []
  5058. }),
  5059. smalltalk.SetTest);
  5060. smalltalk.addMethod(
  5061. smalltalk.method({
  5062. selector: "collectionWithDuplicates",
  5063. protocol: 'fixture',
  5064. fn: function (){
  5065. var self=this;
  5066. return smalltalk.withContext(function($ctx1) {
  5067. var $2,$3,$1;
  5068. $2=self._collection();
  5069. _st($2)._add_("yet another");
  5070. $3=_st($2)._yourself();
  5071. $1=$3;
  5072. return $1;
  5073. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.SetTest)})},
  5074. args: [],
  5075. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 'yet another'; yourself",
  5076. messageSends: ["add:", "collection", "yourself"],
  5077. referencedClasses: []
  5078. }),
  5079. smalltalk.SetTest);
  5080. smalltalk.addMethod(
  5081. smalltalk.method({
  5082. selector: "collectionWithNewValue",
  5083. protocol: 'fixture',
  5084. fn: function (){
  5085. var self=this;
  5086. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5087. return smalltalk.withContext(function($ctx1) {
  5088. var $2,$3,$1;
  5089. $2=_st($Set())._new();
  5090. _st($2)._add_((1));
  5091. $ctx1.sendIdx["add:"]=1;
  5092. _st($2)._add_((2));
  5093. $ctx1.sendIdx["add:"]=2;
  5094. _st($2)._add_((3));
  5095. $ctx1.sendIdx["add:"]=3;
  5096. _st($2)._add_("N");
  5097. $ctx1.sendIdx["add:"]=4;
  5098. _st($2)._add_((-4));
  5099. $3=_st($2)._yourself();
  5100. $1=$3;
  5101. return $1;
  5102. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.SetTest)})},
  5103. args: [],
  5104. 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",
  5105. messageSends: ["add:", "new", "yourself"],
  5106. referencedClasses: ["Set"]
  5107. }),
  5108. smalltalk.SetTest);
  5109. smalltalk.addMethod(
  5110. smalltalk.method({
  5111. selector: "testAddAll",
  5112. protocol: 'tests',
  5113. fn: function (){
  5114. var self=this;
  5115. return smalltalk.withContext(function($ctx1) {
  5116. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5117. smalltalk.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  5118. $2=self._collection();
  5119. $ctx1.sendIdx["collection"]=1;
  5120. $3=$2;
  5121. $4=self._collection();
  5122. $ctx1.sendIdx["collection"]=2;
  5123. _st($3)._addAll_($4);
  5124. $ctx1.sendIdx["addAll:"]=1;
  5125. $5=_st($2)._yourself();
  5126. $ctx1.sendIdx["yourself"]=1;
  5127. $1=$5;
  5128. $6=self._collection();
  5129. $ctx1.sendIdx["collection"]=3;
  5130. self._assert_equals_($1,$6);
  5131. $ctx1.sendIdx["assert:equals:"]=1;
  5132. $8=self._collection();
  5133. $ctx1.sendIdx["collection"]=4;
  5134. $9=$8;
  5135. $10=self._collectionWithNewValue();
  5136. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5137. _st($9)._addAll_($10);
  5138. $ctx1.sendIdx["addAll:"]=2;
  5139. $11=_st($8)._yourself();
  5140. $ctx1.sendIdx["yourself"]=2;
  5141. $7=$11;
  5142. $12=self._collectionWithNewValue();
  5143. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5144. self._assert_equals_($7,$12);
  5145. $ctx1.sendIdx["assert:equals:"]=2;
  5146. $14=self._collectionWithNewValue();
  5147. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5148. _st($14)._addAll_(self._collection());
  5149. $15=_st($14)._yourself();
  5150. $13=$15;
  5151. self._assert_equals_($13,self._collectionWithNewValue());
  5152. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.SetTest)})},
  5153. args: [],
  5154. 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",
  5155. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5156. referencedClasses: []
  5157. }),
  5158. smalltalk.SetTest);
  5159. smalltalk.addMethod(
  5160. smalltalk.method({
  5161. selector: "testAddRemove",
  5162. protocol: 'tests',
  5163. fn: function (){
  5164. var self=this;
  5165. var set;
  5166. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5167. return smalltalk.withContext(function($ctx1) {
  5168. var $1,$2;
  5169. set=_st($Set())._new();
  5170. self._assert_(_st(set)._isEmpty());
  5171. $ctx1.sendIdx["assert:"]=1;
  5172. _st(set)._add_((3));
  5173. $ctx1.sendIdx["add:"]=1;
  5174. $1=_st(set)._includes_((3));
  5175. $ctx1.sendIdx["includes:"]=1;
  5176. self._assert_($1);
  5177. $ctx1.sendIdx["assert:"]=2;
  5178. _st(set)._add_((5));
  5179. $2=_st(set)._includes_((5));
  5180. $ctx1.sendIdx["includes:"]=2;
  5181. self._assert_($2);
  5182. _st(set)._remove_((3));
  5183. self._deny_(_st(set)._includes_((3)));
  5184. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  5185. args: [],
  5186. 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)",
  5187. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5188. referencedClasses: ["Set"]
  5189. }),
  5190. smalltalk.SetTest);
  5191. smalltalk.addMethod(
  5192. smalltalk.method({
  5193. selector: "testAt",
  5194. protocol: 'tests',
  5195. fn: function (){
  5196. var self=this;
  5197. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5198. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5199. return smalltalk.withContext(function($ctx1) {
  5200. self._should_raise_((function(){
  5201. return smalltalk.withContext(function($ctx2) {
  5202. return _st(_st($Set())._new())._at_put_((1),(2));
  5203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5204. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  5205. args: [],
  5206. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5207. messageSends: ["should:raise:", "at:put:", "new"],
  5208. referencedClasses: ["Set", "Error"]
  5209. }),
  5210. smalltalk.SetTest);
  5211. smalltalk.addMethod(
  5212. smalltalk.method({
  5213. selector: "testCollect",
  5214. protocol: 'tests',
  5215. fn: function (){
  5216. var self=this;
  5217. return smalltalk.withContext(function($ctx1) {
  5218. var $2,$1;
  5219. smalltalk.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []);
  5220. $2=[(5), (6), (8)]._asSet();
  5221. $ctx1.sendIdx["asSet"]=1;
  5222. $1=_st($2)._collect_((function(x){
  5223. return smalltalk.withContext(function($ctx2) {
  5224. return _st(x).__backslash_backslash((3));
  5225. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5226. self._assert_equals_($1,[(0), (2)]._asSet());
  5227. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  5228. args: [],
  5229. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5230. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5231. referencedClasses: []
  5232. }),
  5233. smalltalk.SetTest);
  5234. smalltalk.addMethod(
  5235. smalltalk.method({
  5236. selector: "testComma",
  5237. protocol: 'tests',
  5238. fn: function (){
  5239. var self=this;
  5240. return smalltalk.withContext(function($ctx1) {
  5241. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5242. smalltalk.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []);
  5243. $2=self._collection();
  5244. $ctx1.sendIdx["collection"]=1;
  5245. $3=self._collection();
  5246. $ctx1.sendIdx["collection"]=2;
  5247. $1=_st($2).__comma($3);
  5248. $ctx1.sendIdx[","]=1;
  5249. $4=self._collection();
  5250. $ctx1.sendIdx["collection"]=3;
  5251. self._assert_equals_($1,$4);
  5252. $ctx1.sendIdx["assert:equals:"]=1;
  5253. $6=self._collection();
  5254. $ctx1.sendIdx["collection"]=4;
  5255. $7=self._collectionWithNewValue();
  5256. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5257. $5=_st($6).__comma($7);
  5258. $ctx1.sendIdx[","]=2;
  5259. $8=self._collectionWithNewValue();
  5260. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5261. self._assert_equals_($5,$8);
  5262. $ctx1.sendIdx["assert:equals:"]=2;
  5263. $10=self._collectionWithNewValue();
  5264. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5265. $9=_st($10).__comma(self._collection());
  5266. self._assert_equals_($9,self._collectionWithNewValue());
  5267. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.SetTest)})},
  5268. args: [],
  5269. 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",
  5270. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5271. referencedClasses: []
  5272. }),
  5273. smalltalk.SetTest);
  5274. smalltalk.addMethod(
  5275. smalltalk.method({
  5276. selector: "testComparing",
  5277. protocol: 'tests',
  5278. fn: function (){
  5279. var self=this;
  5280. return smalltalk.withContext(function($ctx1) {
  5281. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5282. $1=[(0), (2)]._asSet();
  5283. $ctx1.sendIdx["asSet"]=1;
  5284. $2=[(0), (2)]._asSet();
  5285. $ctx1.sendIdx["asSet"]=2;
  5286. self._assert_equals_($1,$2);
  5287. $ctx1.sendIdx["assert:equals:"]=1;
  5288. $3=[(2), (0)]._asSet();
  5289. $ctx1.sendIdx["asSet"]=3;
  5290. $4=[(0), (2)]._asSet();
  5291. $ctx1.sendIdx["asSet"]=4;
  5292. self._assert_equals_($3,$4);
  5293. $6=[(0), (2), (3)]._asSet();
  5294. $ctx1.sendIdx["asSet"]=5;
  5295. $7=[(0), (2)]._asSet();
  5296. $ctx1.sendIdx["asSet"]=6;
  5297. $5=_st($6).__eq($7);
  5298. $ctx1.sendIdx["="]=1;
  5299. self._deny_($5);
  5300. $ctx1.sendIdx["deny:"]=1;
  5301. $9=[(1), (2)]._asSet();
  5302. $ctx1.sendIdx["asSet"]=7;
  5303. $8=_st($9).__eq([(0), (2)]._asSet());
  5304. self._deny_($8);
  5305. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  5306. args: [],
  5307. 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",
  5308. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5309. referencedClasses: []
  5310. }),
  5311. smalltalk.SetTest);
  5312. smalltalk.addMethod(
  5313. smalltalk.method({
  5314. selector: "testPrintString",
  5315. protocol: 'tests',
  5316. fn: function (){
  5317. var self=this;
  5318. var set;
  5319. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5320. return smalltalk.withContext(function($ctx1) {
  5321. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5322. set=_st($Set())._new();
  5323. $1=_st(set)._printString();
  5324. $ctx1.sendIdx["printString"]=1;
  5325. self._assert_equals_($1,"a Set ()");
  5326. $ctx1.sendIdx["assert:equals:"]=1;
  5327. $2=set;
  5328. _st($2)._add_((1));
  5329. $ctx1.sendIdx["add:"]=1;
  5330. $3=_st($2)._add_((3));
  5331. $ctx1.sendIdx["add:"]=2;
  5332. $4=_st(set)._printString();
  5333. $ctx1.sendIdx["printString"]=2;
  5334. self._assert_equals_($4,"a Set (1 3)");
  5335. $ctx1.sendIdx["assert:equals:"]=2;
  5336. _st(set)._add_("foo");
  5337. $ctx1.sendIdx["add:"]=3;
  5338. $5=_st(set)._printString();
  5339. $ctx1.sendIdx["printString"]=3;
  5340. self._assert_equals_($5,"a Set (1 3 'foo')");
  5341. $ctx1.sendIdx["assert:equals:"]=3;
  5342. $6=set;
  5343. _st($6)._remove_((1));
  5344. $ctx1.sendIdx["remove:"]=1;
  5345. $7=_st($6)._remove_((3));
  5346. $8=_st(set)._printString();
  5347. $ctx1.sendIdx["printString"]=4;
  5348. self._assert_equals_($8,"a Set ('foo')");
  5349. $ctx1.sendIdx["assert:equals:"]=4;
  5350. _st(set)._add_((3));
  5351. $ctx1.sendIdx["add:"]=4;
  5352. $9=_st(set)._printString();
  5353. $ctx1.sendIdx["printString"]=5;
  5354. self._assert_equals_($9,"a Set ('foo' 3)");
  5355. $ctx1.sendIdx["assert:equals:"]=5;
  5356. _st(set)._add_((3));
  5357. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  5358. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  5359. args: [],
  5360. 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)'",
  5361. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5362. referencedClasses: ["Set"]
  5363. }),
  5364. smalltalk.SetTest);
  5365. smalltalk.addMethod(
  5366. smalltalk.method({
  5367. selector: "testUnboxedObjects",
  5368. protocol: 'tests',
  5369. fn: function (){
  5370. var self=this;
  5371. return smalltalk.withContext(function($ctx1) {
  5372. var $4,$3,$2,$1;
  5373. $4="foo"._yourself();
  5374. $ctx1.sendIdx["yourself"]=1;
  5375. $3=[$4,"foo"._yourself()];
  5376. $2=_st($3)._asSet();
  5377. $1=_st($2)._asArray();
  5378. self._assert_equals_($1,["foo"]);
  5379. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  5380. args: [],
  5381. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5382. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5383. referencedClasses: []
  5384. }),
  5385. smalltalk.SetTest);
  5386. smalltalk.addMethod(
  5387. smalltalk.method({
  5388. selector: "testUnicity",
  5389. protocol: 'tests',
  5390. fn: function (){
  5391. var self=this;
  5392. var set;
  5393. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5394. return smalltalk.withContext(function($ctx1) {
  5395. var $1;
  5396. set=_st($Set())._new();
  5397. _st(set)._add_((21));
  5398. $ctx1.sendIdx["add:"]=1;
  5399. _st(set)._add_("hello");
  5400. $ctx1.sendIdx["add:"]=2;
  5401. _st(set)._add_((21));
  5402. $ctx1.sendIdx["add:"]=3;
  5403. $1=_st(set)._size();
  5404. $ctx1.sendIdx["size"]=1;
  5405. self._assert_equals_($1,(2));
  5406. $ctx1.sendIdx["assert:equals:"]=1;
  5407. _st(set)._add_("hello");
  5408. self._assert_equals_(_st(set)._size(),(2));
  5409. $ctx1.sendIdx["assert:equals:"]=2;
  5410. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5411. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  5412. args: [],
  5413. 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')",
  5414. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5415. referencedClasses: ["Set"]
  5416. }),
  5417. smalltalk.SetTest);
  5418. smalltalk.addMethod(
  5419. smalltalk.method({
  5420. selector: "collectionClass",
  5421. protocol: 'fixture',
  5422. fn: function (){
  5423. var self=this;
  5424. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  5425. return smalltalk.withContext(function($ctx1) {
  5426. return $Set();
  5427. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.SetTest.klass)})},
  5428. args: [],
  5429. source: "collectionClass\x0a\x09^ Set",
  5430. messageSends: [],
  5431. referencedClasses: ["Set"]
  5432. }),
  5433. smalltalk.SetTest.klass);
  5434. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5435. smalltalk.addMethod(
  5436. smalltalk.method({
  5437. selector: "testShow",
  5438. protocol: 'tests',
  5439. fn: function (){
  5440. var self=this;
  5441. var originalTranscript;
  5442. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5443. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5444. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5445. return smalltalk.withContext(function($ctx1) {
  5446. originalTranscript=_st($Transcript())._current();
  5447. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5448. $ctx1.sendIdx["register:"]=1;
  5449. self._shouldnt_raise_((function(){
  5450. return smalltalk.withContext(function($ctx2) {
  5451. return _st($Transcript())._show_("Hello console!");
  5452. $ctx2.sendIdx["show:"]=1;
  5453. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5454. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5455. self._shouldnt_raise_((function(){
  5456. return smalltalk.withContext(function($ctx2) {
  5457. return _st($Transcript())._show_(console);
  5458. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5459. _st($Transcript())._register_(originalTranscript);
  5460. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  5461. args: [],
  5462. 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.",
  5463. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5464. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5465. }),
  5466. smalltalk.ConsoleTranscriptTest);
  5467. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5468. smalltalk.addMethod(
  5469. smalltalk.method({
  5470. selector: "jsObject",
  5471. protocol: 'accessing',
  5472. fn: function (){
  5473. var self=this;
  5474. return smalltalk.withContext(function($ctx1) {
  5475. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5476. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  5477. args: [],
  5478. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5479. messageSends: [],
  5480. referencedClasses: []
  5481. }),
  5482. smalltalk.JSObjectProxyTest);
  5483. smalltalk.addMethod(
  5484. smalltalk.method({
  5485. selector: "testAtIfAbsent",
  5486. protocol: 'tests',
  5487. fn: function (){
  5488. var self=this;
  5489. var testObject;
  5490. return smalltalk.withContext(function($ctx1) {
  5491. var $1,$2,$3;
  5492. testObject=self._jsObject();
  5493. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5494. return smalltalk.withContext(function($ctx2) {
  5495. return "Property does not exist";
  5496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5497. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5498. self._assert_equals_($1,"Property does not exist");
  5499. $ctx1.sendIdx["assert:equals:"]=1;
  5500. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5501. return smalltalk.withContext(function($ctx2) {
  5502. return "Property does not exist";
  5503. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5504. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5505. self._assert_equals_($2,nil);
  5506. $ctx1.sendIdx["assert:equals:"]=2;
  5507. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5508. return smalltalk.withContext(function($ctx2) {
  5509. return "Property does not exist";
  5510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  5511. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5512. self._assert_equals_($3,(1));
  5513. $ctx1.sendIdx["assert:equals:"]=3;
  5514. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5515. return smalltalk.withContext(function($ctx2) {
  5516. return "Property does not exist";
  5517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  5518. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5519. args: [],
  5520. 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.",
  5521. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5522. referencedClasses: []
  5523. }),
  5524. smalltalk.JSObjectProxyTest);
  5525. smalltalk.addMethod(
  5526. smalltalk.method({
  5527. selector: "testAtIfPresent",
  5528. protocol: 'tests',
  5529. fn: function (){
  5530. var self=this;
  5531. var testObject;
  5532. return smalltalk.withContext(function($ctx1) {
  5533. var $2,$1,$4,$3,$6,$5;
  5534. testObject=self._jsObject();
  5535. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5536. return smalltalk.withContext(function($ctx2) {
  5537. $2=_st(x)._asString();
  5538. $ctx2.sendIdx["asString"]=1;
  5539. return "hello ".__comma($2);
  5540. $ctx2.sendIdx[","]=1;
  5541. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5542. $ctx1.sendIdx["at:ifPresent:"]=1;
  5543. self._assert_equals_($1,nil);
  5544. $ctx1.sendIdx["assert:equals:"]=1;
  5545. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5546. return smalltalk.withContext(function($ctx2) {
  5547. $4=_st(x)._asString();
  5548. $ctx2.sendIdx["asString"]=2;
  5549. return "hello ".__comma($4);
  5550. $ctx2.sendIdx[","]=2;
  5551. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5552. $ctx1.sendIdx["at:ifPresent:"]=2;
  5553. self._assert_equals_($3,"hello nil");
  5554. $ctx1.sendIdx["assert:equals:"]=2;
  5555. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5556. return smalltalk.withContext(function($ctx2) {
  5557. $6=_st(x)._asString();
  5558. $ctx2.sendIdx["asString"]=3;
  5559. return "hello ".__comma($6);
  5560. $ctx2.sendIdx[","]=3;
  5561. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5562. $ctx1.sendIdx["at:ifPresent:"]=3;
  5563. self._assert_equals_($5,"hello 1");
  5564. $ctx1.sendIdx["assert:equals:"]=3;
  5565. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5566. return smalltalk.withContext(function($ctx2) {
  5567. return "hello ".__comma(_st(x)._asString());
  5568. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5569. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5570. args: [],
  5571. 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'.",
  5572. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5573. referencedClasses: []
  5574. }),
  5575. smalltalk.JSObjectProxyTest);
  5576. smalltalk.addMethod(
  5577. smalltalk.method({
  5578. selector: "testAtIfPresentIfAbsent",
  5579. protocol: 'tests',
  5580. fn: function (){
  5581. var self=this;
  5582. var testObject;
  5583. return smalltalk.withContext(function($ctx1) {
  5584. var $2,$1,$4,$3,$6,$5;
  5585. testObject=self._jsObject();
  5586. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5587. return smalltalk.withContext(function($ctx2) {
  5588. $2=_st(x)._asString();
  5589. $ctx2.sendIdx["asString"]=1;
  5590. return "hello ".__comma($2);
  5591. $ctx2.sendIdx[","]=1;
  5592. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5593. return smalltalk.withContext(function($ctx2) {
  5594. return "not present";
  5595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5596. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5597. self._assert_equals_($1,"not present");
  5598. $ctx1.sendIdx["assert:equals:"]=1;
  5599. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5600. return smalltalk.withContext(function($ctx2) {
  5601. $4=_st(x)._asString();
  5602. $ctx2.sendIdx["asString"]=2;
  5603. return "hello ".__comma($4);
  5604. $ctx2.sendIdx[","]=2;
  5605. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5606. return smalltalk.withContext(function($ctx2) {
  5607. return "not present";
  5608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5609. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5610. self._assert_equals_($3,"hello nil");
  5611. $ctx1.sendIdx["assert:equals:"]=2;
  5612. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5613. return smalltalk.withContext(function($ctx2) {
  5614. $6=_st(x)._asString();
  5615. $ctx2.sendIdx["asString"]=3;
  5616. return "hello ".__comma($6);
  5617. $ctx2.sendIdx[","]=3;
  5618. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5619. return smalltalk.withContext(function($ctx2) {
  5620. return "not present";
  5621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5622. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5623. self._assert_equals_($5,"hello 1");
  5624. $ctx1.sendIdx["assert:equals:"]=3;
  5625. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5626. return smalltalk.withContext(function($ctx2) {
  5627. return "hello ".__comma(_st(x)._asString());
  5628. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5629. return smalltalk.withContext(function($ctx2) {
  5630. return "not present";
  5631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  5632. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5633. args: [],
  5634. 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'.",
  5635. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5636. referencedClasses: []
  5637. }),
  5638. smalltalk.JSObjectProxyTest);
  5639. smalltalk.addMethod(
  5640. smalltalk.method({
  5641. selector: "testAtPut",
  5642. protocol: 'tests',
  5643. fn: function (){
  5644. var self=this;
  5645. var testObject;
  5646. return smalltalk.withContext(function($ctx1) {
  5647. var $2,$1;
  5648. testObject=self._jsObject();
  5649. $2=_st(testObject)._at_("abc");
  5650. $ctx1.sendIdx["at:"]=1;
  5651. $1=_st($2).__tild_eq("xyz");
  5652. self._assert_($1);
  5653. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5654. $ctx1.sendIdx["assert:equals:"]=1;
  5655. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5656. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5657. args: [],
  5658. 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'",
  5659. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5660. referencedClasses: []
  5661. }),
  5662. smalltalk.JSObjectProxyTest);
  5663. smalltalk.addMethod(
  5664. smalltalk.method({
  5665. selector: "testDNU",
  5666. protocol: 'tests',
  5667. fn: function (){
  5668. var self=this;
  5669. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5670. return smalltalk.withContext(function($ctx1) {
  5671. self._should_raise_((function(){
  5672. return smalltalk.withContext(function($ctx2) {
  5673. return _st(self._jsObject())._foo();
  5674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5675. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  5676. args: [],
  5677. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5678. messageSends: ["should:raise:", "foo", "jsObject"],
  5679. referencedClasses: ["MessageNotUnderstood"]
  5680. }),
  5681. smalltalk.JSObjectProxyTest);
  5682. smalltalk.addMethod(
  5683. smalltalk.method({
  5684. selector: "testMessageSend",
  5685. protocol: 'tests',
  5686. fn: function (){
  5687. var self=this;
  5688. return smalltalk.withContext(function($ctx1) {
  5689. var $2,$1,$4,$3;
  5690. $2=self._jsObject();
  5691. $ctx1.sendIdx["jsObject"]=1;
  5692. $1=_st($2)._a();
  5693. self._assert_equals_($1,(1));
  5694. $ctx1.sendIdx["assert:equals:"]=1;
  5695. $4=self._jsObject();
  5696. $ctx1.sendIdx["jsObject"]=2;
  5697. $3=_st($4)._b();
  5698. self._assert_equals_($3,(2));
  5699. $ctx1.sendIdx["assert:equals:"]=2;
  5700. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5701. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  5702. args: [],
  5703. 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",
  5704. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5705. referencedClasses: []
  5706. }),
  5707. smalltalk.JSObjectProxyTest);
  5708. smalltalk.addMethod(
  5709. smalltalk.method({
  5710. selector: "testMethodWithArguments",
  5711. protocol: 'tests',
  5712. fn: function (){
  5713. var self=this;
  5714. return smalltalk.withContext(function($ctx1) {
  5715. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5716. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  5717. args: [],
  5718. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5719. messageSends: ["assert:equals:", "c:", "jsObject"],
  5720. referencedClasses: []
  5721. }),
  5722. smalltalk.JSObjectProxyTest);
  5723. smalltalk.addMethod(
  5724. smalltalk.method({
  5725. selector: "testPrinting",
  5726. protocol: 'tests',
  5727. fn: function (){
  5728. var self=this;
  5729. return smalltalk.withContext(function($ctx1) {
  5730. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5731. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  5732. args: [],
  5733. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5734. messageSends: ["assert:equals:", "printString", "jsObject"],
  5735. referencedClasses: []
  5736. }),
  5737. smalltalk.JSObjectProxyTest);
  5738. smalltalk.addMethod(
  5739. smalltalk.method({
  5740. selector: "testPropertyThatReturnsEmptyString",
  5741. protocol: 'tests',
  5742. fn: function (){
  5743. var self=this;
  5744. var object;
  5745. return smalltalk.withContext(function($ctx1) {
  5746. var $1;
  5747. object=self._jsObject();
  5748. $1=_st(object)._d();
  5749. $ctx1.sendIdx["d"]=1;
  5750. self._assert_equals_($1,"");
  5751. $ctx1.sendIdx["assert:equals:"]=1;
  5752. _st(object)._d_("hello");
  5753. self._assert_equals_(_st(object)._d(),"hello");
  5754. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  5755. args: [],
  5756. 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'",
  5757. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5758. referencedClasses: []
  5759. }),
  5760. smalltalk.JSObjectProxyTest);
  5761. smalltalk.addMethod(
  5762. smalltalk.method({
  5763. selector: "testPropertyThatReturnsUndefined",
  5764. protocol: 'tests',
  5765. fn: function (){
  5766. var self=this;
  5767. var object;
  5768. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5769. return smalltalk.withContext(function($ctx1) {
  5770. object=self._jsObject();
  5771. self._shouldnt_raise_((function(){
  5772. return smalltalk.withContext(function($ctx2) {
  5773. return _st(object)._e();
  5774. $ctx2.sendIdx["e"]=1;
  5775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5776. self._assert_(_st(_st(object)._e())._isNil());
  5777. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  5778. args: [],
  5779. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5780. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5781. referencedClasses: ["MessageNotUnderstood"]
  5782. }),
  5783. smalltalk.JSObjectProxyTest);
  5784. smalltalk.addMethod(
  5785. smalltalk.method({
  5786. selector: "testValue",
  5787. protocol: 'tests',
  5788. fn: function (){
  5789. var self=this;
  5790. var testObject;
  5791. return smalltalk.withContext(function($ctx1) {
  5792. testObject=self._jsObject();
  5793. _st(testObject)._at_put_("value","aValue");
  5794. self._assert_equals_(_st(testObject)._value(),"aValue");
  5795. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5796. args: [],
  5797. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5798. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5799. referencedClasses: []
  5800. }),
  5801. smalltalk.JSObjectProxyTest);
  5802. smalltalk.addMethod(
  5803. smalltalk.method({
  5804. selector: "testYourself",
  5805. protocol: 'tests',
  5806. fn: function (){
  5807. var self=this;
  5808. var object;
  5809. return smalltalk.withContext(function($ctx1) {
  5810. var $1,$2;
  5811. $1=self._jsObject();
  5812. _st($1)._d_("test");
  5813. $2=_st($1)._yourself();
  5814. object=$2;
  5815. self._assert_equals_(_st(object)._d(),"test");
  5816. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  5817. args: [],
  5818. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5819. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5820. referencedClasses: []
  5821. }),
  5822. smalltalk.JSObjectProxyTest);
  5823. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5824. smalltalk.addMethod(
  5825. smalltalk.method({
  5826. selector: "testCatchingException",
  5827. protocol: 'tests',
  5828. fn: function (){
  5829. var self=this;
  5830. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5831. return smalltalk.withContext(function($ctx1) {
  5832. _st((function(){
  5833. return smalltalk.withContext(function($ctx2) {
  5834. return self._throwException();
  5835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5836. return smalltalk.withContext(function($ctx2) {
  5837. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5838. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5839. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  5840. args: [],
  5841. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5842. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5843. referencedClasses: ["Error"]
  5844. }),
  5845. smalltalk.JavaScriptExceptionTest);
  5846. smalltalk.addMethod(
  5847. smalltalk.method({
  5848. selector: "testRaisingException",
  5849. protocol: 'tests',
  5850. fn: function (){
  5851. var self=this;
  5852. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5853. return smalltalk.withContext(function($ctx1) {
  5854. self._should_raise_((function(){
  5855. return smalltalk.withContext(function($ctx2) {
  5856. return self._throwException();
  5857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5858. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  5859. args: [],
  5860. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5861. messageSends: ["should:raise:", "throwException"],
  5862. referencedClasses: ["JavaScriptException"]
  5863. }),
  5864. smalltalk.JavaScriptExceptionTest);
  5865. smalltalk.addMethod(
  5866. smalltalk.method({
  5867. selector: "throwException",
  5868. protocol: 'helpers',
  5869. fn: function (){
  5870. var self=this;
  5871. return smalltalk.withContext(function($ctx1) {
  5872. throw 'test';
  5873. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  5874. args: [],
  5875. source: "throwException\x0a\x09<throw 'test'>",
  5876. messageSends: [],
  5877. referencedClasses: []
  5878. }),
  5879. smalltalk.JavaScriptExceptionTest);
  5880. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5881. smalltalk.addMethod(
  5882. smalltalk.method({
  5883. selector: "testValue",
  5884. protocol: 'tests',
  5885. fn: function (){
  5886. var self=this;
  5887. var messageSend;
  5888. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5889. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5890. return smalltalk.withContext(function($ctx1) {
  5891. var $1,$2;
  5892. $1=_st($MessageSend())._new();
  5893. $ctx1.sendIdx["new"]=1;
  5894. _st($1)._receiver_(_st($Object())._new());
  5895. _st($1)._selector_("asString");
  5896. $2=_st($1)._yourself();
  5897. messageSend=$2;
  5898. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5899. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5900. args: [],
  5901. 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'",
  5902. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  5903. referencedClasses: ["MessageSend", "Object"]
  5904. }),
  5905. smalltalk.MessageSendTest);
  5906. smalltalk.addMethod(
  5907. smalltalk.method({
  5908. selector: "testValueWithArguments",
  5909. protocol: 'tests',
  5910. fn: function (){
  5911. var self=this;
  5912. var messageSend;
  5913. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5914. return smalltalk.withContext(function($ctx1) {
  5915. var $1,$2;
  5916. $1=_st($MessageSend())._new();
  5917. _st($1)._receiver_((2));
  5918. _st($1)._selector_("+");
  5919. $2=_st($1)._yourself();
  5920. messageSend=$2;
  5921. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  5922. $ctx1.sendIdx["assert:equals:"]=1;
  5923. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  5924. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5925. args: [],
  5926. 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",
  5927. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  5928. referencedClasses: ["MessageSend"]
  5929. }),
  5930. smalltalk.MessageSendTest);
  5931. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  5932. smalltalk.addMethod(
  5933. smalltalk.method({
  5934. selector: "codeGeneratorClass",
  5935. protocol: 'accessing',
  5936. fn: function (){
  5937. var self=this;
  5938. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  5939. return smalltalk.withContext(function($ctx1) {
  5940. return $CodeGenerator();
  5941. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  5942. args: [],
  5943. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  5944. messageSends: [],
  5945. referencedClasses: ["CodeGenerator"]
  5946. }),
  5947. smalltalk.MethodInheritanceTest);
  5948. smalltalk.addMethod(
  5949. smalltalk.method({
  5950. selector: "compiler",
  5951. protocol: 'factory',
  5952. fn: function (){
  5953. var self=this;
  5954. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5955. return smalltalk.withContext(function($ctx1) {
  5956. var $2,$3,$1;
  5957. $2=_st($Compiler())._new();
  5958. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  5959. $3=_st($2)._yourself();
  5960. $1=$3;
  5961. return $1;
  5962. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  5963. args: [],
  5964. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  5965. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  5966. referencedClasses: ["Compiler"]
  5967. }),
  5968. smalltalk.MethodInheritanceTest);
  5969. smalltalk.addMethod(
  5970. smalltalk.method({
  5971. selector: "deinstallBottom",
  5972. protocol: 'testing',
  5973. fn: function (){
  5974. var self=this;
  5975. return smalltalk.withContext(function($ctx1) {
  5976. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  5977. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  5978. args: [],
  5979. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  5980. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  5981. referencedClasses: []
  5982. }),
  5983. smalltalk.MethodInheritanceTest);
  5984. smalltalk.addMethod(
  5985. smalltalk.method({
  5986. selector: "deinstallMiddle",
  5987. protocol: 'testing',
  5988. fn: function (){
  5989. var self=this;
  5990. return smalltalk.withContext(function($ctx1) {
  5991. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  5992. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  5993. args: [],
  5994. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  5995. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  5996. referencedClasses: []
  5997. }),
  5998. smalltalk.MethodInheritanceTest);
  5999. smalltalk.addMethod(
  6000. smalltalk.method({
  6001. selector: "deinstallTop",
  6002. protocol: 'testing',
  6003. fn: function (){
  6004. var self=this;
  6005. return smalltalk.withContext(function($ctx1) {
  6006. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6007. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  6008. args: [],
  6009. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6010. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6011. referencedClasses: []
  6012. }),
  6013. smalltalk.MethodInheritanceTest);
  6014. smalltalk.addMethod(
  6015. smalltalk.method({
  6016. selector: "installBottom:",
  6017. protocol: 'testing',
  6018. fn: function (aString){
  6019. var self=this;
  6020. return smalltalk.withContext(function($ctx1) {
  6021. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6022. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6023. args: ["aString"],
  6024. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6025. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6026. referencedClasses: []
  6027. }),
  6028. smalltalk.MethodInheritanceTest);
  6029. smalltalk.addMethod(
  6030. smalltalk.method({
  6031. selector: "installMiddle:",
  6032. protocol: 'testing',
  6033. fn: function (aString){
  6034. var self=this;
  6035. return smalltalk.withContext(function($ctx1) {
  6036. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6037. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6038. args: ["aString"],
  6039. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6040. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6041. referencedClasses: []
  6042. }),
  6043. smalltalk.MethodInheritanceTest);
  6044. smalltalk.addMethod(
  6045. smalltalk.method({
  6046. selector: "installTop:",
  6047. protocol: 'testing',
  6048. fn: function (aString){
  6049. var self=this;
  6050. return smalltalk.withContext(function($ctx1) {
  6051. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6052. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  6053. args: ["aString"],
  6054. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6055. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6056. referencedClasses: []
  6057. }),
  6058. smalltalk.MethodInheritanceTest);
  6059. smalltalk.addMethod(
  6060. smalltalk.method({
  6061. selector: "setUp",
  6062. protocol: 'initialization',
  6063. fn: function (){
  6064. var self=this;
  6065. return smalltalk.withContext(function($ctx1) {
  6066. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6067. $ctx1.sendIdx["new"]=1;
  6068. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6069. $ctx1.sendIdx["new"]=2;
  6070. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6071. self["@method"]=nil;
  6072. self["@performBlock"]=(function(){
  6073. return smalltalk.withContext(function($ctx2) {
  6074. return self._error_("performBlock not initialized");
  6075. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6076. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  6077. args: [],
  6078. 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' ]",
  6079. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6080. referencedClasses: []
  6081. }),
  6082. smalltalk.MethodInheritanceTest);
  6083. smalltalk.addMethod(
  6084. smalltalk.method({
  6085. selector: "shouldMNU",
  6086. protocol: 'testing',
  6087. fn: function (){
  6088. var self=this;
  6089. return smalltalk.withContext(function($ctx1) {
  6090. self._shouldMNUTop();
  6091. self._shouldMNUMiddle();
  6092. self._shouldMNUBottom();
  6093. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  6094. args: [],
  6095. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6096. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6097. referencedClasses: []
  6098. }),
  6099. smalltalk.MethodInheritanceTest);
  6100. smalltalk.addMethod(
  6101. smalltalk.method({
  6102. selector: "shouldMNUBottom",
  6103. protocol: 'testing',
  6104. fn: function (){
  6105. var self=this;
  6106. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6107. return smalltalk.withContext(function($ctx1) {
  6108. self._should_raise_((function(){
  6109. return smalltalk.withContext(function($ctx2) {
  6110. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6112. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  6113. args: [],
  6114. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6115. messageSends: ["should:raise:", "value:"],
  6116. referencedClasses: ["MessageNotUnderstood"]
  6117. }),
  6118. smalltalk.MethodInheritanceTest);
  6119. smalltalk.addMethod(
  6120. smalltalk.method({
  6121. selector: "shouldMNUMiddle",
  6122. protocol: 'testing',
  6123. fn: function (){
  6124. var self=this;
  6125. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6126. return smalltalk.withContext(function($ctx1) {
  6127. self._should_raise_((function(){
  6128. return smalltalk.withContext(function($ctx2) {
  6129. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6131. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  6132. args: [],
  6133. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6134. messageSends: ["should:raise:", "value:"],
  6135. referencedClasses: ["MessageNotUnderstood"]
  6136. }),
  6137. smalltalk.MethodInheritanceTest);
  6138. smalltalk.addMethod(
  6139. smalltalk.method({
  6140. selector: "shouldMNUTop",
  6141. protocol: 'testing',
  6142. fn: function (){
  6143. var self=this;
  6144. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6145. return smalltalk.withContext(function($ctx1) {
  6146. self._should_raise_((function(){
  6147. return smalltalk.withContext(function($ctx2) {
  6148. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6150. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  6151. args: [],
  6152. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6153. messageSends: ["should:raise:", "value:"],
  6154. referencedClasses: ["MessageNotUnderstood"]
  6155. }),
  6156. smalltalk.MethodInheritanceTest);
  6157. smalltalk.addMethod(
  6158. smalltalk.method({
  6159. selector: "shouldReturn:",
  6160. protocol: 'testing',
  6161. fn: function (anObject){
  6162. var self=this;
  6163. var result;
  6164. return smalltalk.withContext(function($ctx1) {
  6165. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6166. $ctx1.sendIdx["value:"]=1;
  6167. self._assert_equals_(["top",anObject],["top",result]);
  6168. $ctx1.sendIdx["assert:equals:"]=1;
  6169. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6170. $ctx1.sendIdx["value:"]=2;
  6171. self._assert_equals_(["middle",anObject],["middle",result]);
  6172. $ctx1.sendIdx["assert:equals:"]=2;
  6173. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6174. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6175. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  6176. args: ["anObject"],
  6177. 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 }",
  6178. messageSends: ["value:", "assert:equals:"],
  6179. referencedClasses: []
  6180. }),
  6181. smalltalk.MethodInheritanceTest);
  6182. smalltalk.addMethod(
  6183. smalltalk.method({
  6184. selector: "shouldReturn:and:and:",
  6185. protocol: 'testing',
  6186. fn: function (anObject,anObject2,anObject3){
  6187. var self=this;
  6188. var result;
  6189. return smalltalk.withContext(function($ctx1) {
  6190. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6191. $ctx1.sendIdx["value:"]=1;
  6192. self._assert_equals_(["top",anObject],["top",result]);
  6193. $ctx1.sendIdx["assert:equals:"]=1;
  6194. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6195. $ctx1.sendIdx["value:"]=2;
  6196. self._assert_equals_(["middle",anObject2],["middle",result]);
  6197. $ctx1.sendIdx["assert:equals:"]=2;
  6198. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6199. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6200. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  6201. args: ["anObject", "anObject2", "anObject3"],
  6202. 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 }",
  6203. messageSends: ["value:", "assert:equals:"],
  6204. referencedClasses: []
  6205. }),
  6206. smalltalk.MethodInheritanceTest);
  6207. smalltalk.addMethod(
  6208. smalltalk.method({
  6209. selector: "targetClassBottom",
  6210. protocol: 'accessing',
  6211. fn: function (){
  6212. var self=this;
  6213. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6214. return smalltalk.withContext(function($ctx1) {
  6215. return $JavaScriptException();
  6216. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  6217. args: [],
  6218. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6219. messageSends: [],
  6220. referencedClasses: ["JavaScriptException"]
  6221. }),
  6222. smalltalk.MethodInheritanceTest);
  6223. smalltalk.addMethod(
  6224. smalltalk.method({
  6225. selector: "targetClassMiddle",
  6226. protocol: 'accessing',
  6227. fn: function (){
  6228. var self=this;
  6229. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6230. return smalltalk.withContext(function($ctx1) {
  6231. return $Error();
  6232. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  6233. args: [],
  6234. source: "targetClassMiddle\x0a\x09^ Error",
  6235. messageSends: [],
  6236. referencedClasses: ["Error"]
  6237. }),
  6238. smalltalk.MethodInheritanceTest);
  6239. smalltalk.addMethod(
  6240. smalltalk.method({
  6241. selector: "targetClassTop",
  6242. protocol: 'accessing',
  6243. fn: function (){
  6244. var self=this;
  6245. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6246. return smalltalk.withContext(function($ctx1) {
  6247. return $Object();
  6248. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  6249. args: [],
  6250. source: "targetClassTop\x0a\x09^ Object",
  6251. messageSends: [],
  6252. referencedClasses: ["Object"]
  6253. }),
  6254. smalltalk.MethodInheritanceTest);
  6255. smalltalk.addMethod(
  6256. smalltalk.method({
  6257. selector: "tearDown",
  6258. protocol: 'initialization',
  6259. fn: function (){
  6260. var self=this;
  6261. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6262. return smalltalk.withContext(function($ctx1) {
  6263. _st((function(){
  6264. return smalltalk.withContext(function($ctx2) {
  6265. return self._deinstallTop();
  6266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6267. return smalltalk.withContext(function($ctx2) {
  6268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6269. $ctx1.sendIdx["on:do:"]=1;
  6270. _st((function(){
  6271. return smalltalk.withContext(function($ctx2) {
  6272. return self._deinstallMiddle();
  6273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6274. return smalltalk.withContext(function($ctx2) {
  6275. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  6276. $ctx1.sendIdx["on:do:"]=2;
  6277. _st((function(){
  6278. return smalltalk.withContext(function($ctx2) {
  6279. return self._deinstallBottom();
  6280. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6281. return smalltalk.withContext(function($ctx2) {
  6282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  6283. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  6284. args: [],
  6285. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6286. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6287. referencedClasses: ["Error"]
  6288. }),
  6289. smalltalk.MethodInheritanceTest);
  6290. smalltalk.addMethod(
  6291. smalltalk.method({
  6292. selector: "testMNU11",
  6293. protocol: 'tests',
  6294. fn: function (){
  6295. var self=this;
  6296. return smalltalk.withContext(function($ctx1) {
  6297. self["@performBlock"]=(function(x){
  6298. return smalltalk.withContext(function($ctx2) {
  6299. return _st(x)._foo();
  6300. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6301. self._shouldMNU();
  6302. $ctx1.sendIdx["shouldMNU"]=1;
  6303. self._installTop_("foo ^ false");
  6304. $ctx1.sendIdx["installTop:"]=1;
  6305. self._installTop_("foo ^ true");
  6306. self._deinstallTop();
  6307. self._shouldMNU();
  6308. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  6309. args: [],
  6310. 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",
  6311. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6312. referencedClasses: []
  6313. }),
  6314. smalltalk.MethodInheritanceTest);
  6315. smalltalk.addMethod(
  6316. smalltalk.method({
  6317. selector: "testMNU22",
  6318. protocol: 'tests',
  6319. fn: function (){
  6320. var self=this;
  6321. return smalltalk.withContext(function($ctx1) {
  6322. self["@performBlock"]=(function(x){
  6323. return smalltalk.withContext(function($ctx2) {
  6324. return _st(x)._foo();
  6325. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6326. self._shouldMNU();
  6327. $ctx1.sendIdx["shouldMNU"]=1;
  6328. self._installMiddle_("foo ^ false");
  6329. $ctx1.sendIdx["installMiddle:"]=1;
  6330. self._installMiddle_("foo ^ true");
  6331. self._deinstallMiddle();
  6332. self._shouldMNU();
  6333. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  6334. args: [],
  6335. 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",
  6336. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6337. referencedClasses: []
  6338. }),
  6339. smalltalk.MethodInheritanceTest);
  6340. smalltalk.addMethod(
  6341. smalltalk.method({
  6342. selector: "testReturns1",
  6343. protocol: 'tests',
  6344. fn: function (){
  6345. var self=this;
  6346. return smalltalk.withContext(function($ctx1) {
  6347. self["@performBlock"]=(function(x){
  6348. return smalltalk.withContext(function($ctx2) {
  6349. return _st(x)._foo();
  6350. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6351. self._installTop_("foo ^ false");
  6352. $ctx1.sendIdx["installTop:"]=1;
  6353. self._shouldReturn_(false);
  6354. $ctx1.sendIdx["shouldReturn:"]=1;
  6355. self._installTop_("foo ^ true");
  6356. self._shouldReturn_(true);
  6357. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  6358. args: [],
  6359. 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",
  6360. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6361. referencedClasses: []
  6362. }),
  6363. smalltalk.MethodInheritanceTest);
  6364. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6365. smalltalk.addMethod(
  6366. smalltalk.method({
  6367. selector: "testAbs",
  6368. protocol: 'tests',
  6369. fn: function (){
  6370. var self=this;
  6371. return smalltalk.withContext(function($ctx1) {
  6372. var $1;
  6373. $1=(4)._abs();
  6374. $ctx1.sendIdx["abs"]=1;
  6375. self._assert_equals_($1,(4));
  6376. $ctx1.sendIdx["assert:equals:"]=1;
  6377. self._assert_equals_((-4)._abs(),(4));
  6378. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  6379. args: [],
  6380. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6381. messageSends: ["assert:equals:", "abs"],
  6382. referencedClasses: []
  6383. }),
  6384. smalltalk.NumberTest);
  6385. smalltalk.addMethod(
  6386. smalltalk.method({
  6387. selector: "testArithmetic",
  6388. protocol: 'tests',
  6389. fn: function (){
  6390. var self=this;
  6391. return smalltalk.withContext(function($ctx1) {
  6392. var $1,$2,$3,$5,$4;
  6393. $1=(1.5).__plus((1));
  6394. $ctx1.sendIdx["+"]=1;
  6395. self._assert_equals_($1,(2.5));
  6396. $ctx1.sendIdx["assert:equals:"]=1;
  6397. $2=(2).__minus((1));
  6398. $ctx1.sendIdx["-"]=1;
  6399. self._assert_equals_($2,(1));
  6400. $ctx1.sendIdx["assert:equals:"]=2;
  6401. self._assert_equals_((-2).__minus((1)),(-3));
  6402. $ctx1.sendIdx["assert:equals:"]=3;
  6403. self._assert_equals_((12).__slash((2)),(6));
  6404. $ctx1.sendIdx["assert:equals:"]=4;
  6405. $3=(3).__star((4));
  6406. $ctx1.sendIdx["*"]=1;
  6407. self._assert_equals_($3,(12));
  6408. $ctx1.sendIdx["assert:equals:"]=5;
  6409. self._assert_equals_((7).__slash_slash((2)),(3));
  6410. $ctx1.sendIdx["assert:equals:"]=6;
  6411. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6412. $ctx1.sendIdx["assert:equals:"]=7;
  6413. $5=(1).__plus((2));
  6414. $ctx1.sendIdx["+"]=2;
  6415. $4=_st($5).__star((3));
  6416. $ctx1.sendIdx["*"]=2;
  6417. self._assert_equals_($4,(9));
  6418. $ctx1.sendIdx["assert:equals:"]=8;
  6419. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6420. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  6421. args: [],
  6422. 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",
  6423. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6424. referencedClasses: []
  6425. }),
  6426. smalltalk.NumberTest);
  6427. smalltalk.addMethod(
  6428. smalltalk.method({
  6429. selector: "testAsNumber",
  6430. protocol: 'tests',
  6431. fn: function (){
  6432. var self=this;
  6433. return smalltalk.withContext(function($ctx1) {
  6434. self._assert_equals_((3)._asNumber(),(3));
  6435. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  6436. args: [],
  6437. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6438. messageSends: ["assert:equals:", "asNumber"],
  6439. referencedClasses: []
  6440. }),
  6441. smalltalk.NumberTest);
  6442. smalltalk.addMethod(
  6443. smalltalk.method({
  6444. selector: "testCeiling",
  6445. protocol: 'tests',
  6446. fn: function (){
  6447. var self=this;
  6448. return smalltalk.withContext(function($ctx1) {
  6449. var $1,$2;
  6450. $1=(1.2)._ceiling();
  6451. $ctx1.sendIdx["ceiling"]=1;
  6452. self._assert_equals_($1,(2));
  6453. $ctx1.sendIdx["assert:equals:"]=1;
  6454. $2=(-1.2)._ceiling();
  6455. $ctx1.sendIdx["ceiling"]=2;
  6456. self._assert_equals_($2,(-1));
  6457. $ctx1.sendIdx["assert:equals:"]=2;
  6458. self._assert_equals_((1)._ceiling(),(1));
  6459. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  6460. args: [],
  6461. 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.",
  6462. messageSends: ["assert:equals:", "ceiling"],
  6463. referencedClasses: []
  6464. }),
  6465. smalltalk.NumberTest);
  6466. smalltalk.addMethod(
  6467. smalltalk.method({
  6468. selector: "testComparison",
  6469. protocol: 'tests',
  6470. fn: function (){
  6471. var self=this;
  6472. return smalltalk.withContext(function($ctx1) {
  6473. var $1,$2,$3,$4;
  6474. $1=(3).__gt((2));
  6475. $ctx1.sendIdx[">"]=1;
  6476. self._assert_($1);
  6477. $ctx1.sendIdx["assert:"]=1;
  6478. $2=(2).__lt((3));
  6479. $ctx1.sendIdx["<"]=1;
  6480. self._assert_($2);
  6481. $ctx1.sendIdx["assert:"]=2;
  6482. self._deny_((3).__lt((2)));
  6483. $ctx1.sendIdx["deny:"]=1;
  6484. self._deny_((2).__gt((3)));
  6485. $3=(3).__gt_eq((3));
  6486. $ctx1.sendIdx[">="]=1;
  6487. self._assert_($3);
  6488. $ctx1.sendIdx["assert:"]=3;
  6489. self._assert_((3.1).__gt_eq((3)));
  6490. $ctx1.sendIdx["assert:"]=4;
  6491. $4=(3).__lt_eq((3));
  6492. $ctx1.sendIdx["<="]=1;
  6493. self._assert_($4);
  6494. $ctx1.sendIdx["assert:"]=5;
  6495. self._assert_((3).__lt_eq((3.1)));
  6496. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  6497. args: [],
  6498. 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",
  6499. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6500. referencedClasses: []
  6501. }),
  6502. smalltalk.NumberTest);
  6503. smalltalk.addMethod(
  6504. smalltalk.method({
  6505. selector: "testCopying",
  6506. protocol: 'tests',
  6507. fn: function (){
  6508. var self=this;
  6509. return smalltalk.withContext(function($ctx1) {
  6510. var $1;
  6511. $1=_st((1)._copy()).__eq_eq((1));
  6512. $ctx1.sendIdx["=="]=1;
  6513. self._assert_($1);
  6514. $ctx1.sendIdx["assert:"]=1;
  6515. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6516. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  6517. args: [],
  6518. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6519. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6520. referencedClasses: []
  6521. }),
  6522. smalltalk.NumberTest);
  6523. smalltalk.addMethod(
  6524. smalltalk.method({
  6525. selector: "testEquality",
  6526. protocol: 'tests',
  6527. fn: function (){
  6528. var self=this;
  6529. return smalltalk.withContext(function($ctx1) {
  6530. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6531. $1=(1).__eq((1));
  6532. $ctx1.sendIdx["="]=1;
  6533. self._assert_($1);
  6534. $ctx1.sendIdx["assert:"]=1;
  6535. $2=(0).__eq((0));
  6536. $ctx1.sendIdx["="]=2;
  6537. self._assert_($2);
  6538. $ctx1.sendIdx["assert:"]=2;
  6539. $3=(1).__eq((0));
  6540. $ctx1.sendIdx["="]=3;
  6541. self._deny_($3);
  6542. $ctx1.sendIdx["deny:"]=1;
  6543. $5=(1)._yourself();
  6544. $ctx1.sendIdx["yourself"]=1;
  6545. $4=_st($5).__eq((1));
  6546. $ctx1.sendIdx["="]=4;
  6547. self._assert_($4);
  6548. $ctx1.sendIdx["assert:"]=3;
  6549. $7=(1)._yourself();
  6550. $ctx1.sendIdx["yourself"]=2;
  6551. $6=(1).__eq($7);
  6552. $ctx1.sendIdx["="]=5;
  6553. self._assert_($6);
  6554. $ctx1.sendIdx["assert:"]=4;
  6555. $9=(1)._yourself();
  6556. $ctx1.sendIdx["yourself"]=3;
  6557. $8=_st($9).__eq((1)._yourself());
  6558. $ctx1.sendIdx["="]=6;
  6559. self._assert_($8);
  6560. $10=(0).__eq(false);
  6561. $ctx1.sendIdx["="]=7;
  6562. self._deny_($10);
  6563. $ctx1.sendIdx["deny:"]=2;
  6564. $11=false.__eq((0));
  6565. $ctx1.sendIdx["="]=8;
  6566. self._deny_($11);
  6567. $ctx1.sendIdx["deny:"]=3;
  6568. $12="".__eq((0));
  6569. $ctx1.sendIdx["="]=9;
  6570. self._deny_($12);
  6571. $ctx1.sendIdx["deny:"]=4;
  6572. self._deny_((0).__eq(""));
  6573. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  6574. args: [],
  6575. 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 = ''",
  6576. messageSends: ["assert:", "=", "deny:", "yourself"],
  6577. referencedClasses: []
  6578. }),
  6579. smalltalk.NumberTest);
  6580. smalltalk.addMethod(
  6581. smalltalk.method({
  6582. selector: "testFloor",
  6583. protocol: 'tests',
  6584. fn: function (){
  6585. var self=this;
  6586. return smalltalk.withContext(function($ctx1) {
  6587. var $1,$2;
  6588. $1=(1.2)._floor();
  6589. $ctx1.sendIdx["floor"]=1;
  6590. self._assert_equals_($1,(1));
  6591. $ctx1.sendIdx["assert:equals:"]=1;
  6592. $2=(-1.2)._floor();
  6593. $ctx1.sendIdx["floor"]=2;
  6594. self._assert_equals_($2,(-2));
  6595. $ctx1.sendIdx["assert:equals:"]=2;
  6596. self._assert_equals_((1)._floor(),(1));
  6597. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  6598. args: [],
  6599. 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.",
  6600. messageSends: ["assert:equals:", "floor"],
  6601. referencedClasses: []
  6602. }),
  6603. smalltalk.NumberTest);
  6604. smalltalk.addMethod(
  6605. smalltalk.method({
  6606. selector: "testHexNumbers",
  6607. protocol: 'tests',
  6608. fn: function (){
  6609. var self=this;
  6610. return smalltalk.withContext(function($ctx1) {
  6611. var $1,$2,$3,$4,$5;
  6612. self._assert_equals_((9),(9));
  6613. $ctx1.sendIdx["assert:equals:"]=1;
  6614. $1=(10)._truncated();
  6615. $ctx1.sendIdx["truncated"]=1;
  6616. self._assert_equals_($1,(10));
  6617. $ctx1.sendIdx["assert:equals:"]=2;
  6618. $2=(11)._truncated();
  6619. $ctx1.sendIdx["truncated"]=2;
  6620. self._assert_equals_($2,(11));
  6621. $ctx1.sendIdx["assert:equals:"]=3;
  6622. $3=(12)._truncated();
  6623. $ctx1.sendIdx["truncated"]=3;
  6624. self._assert_equals_($3,(12));
  6625. $ctx1.sendIdx["assert:equals:"]=4;
  6626. $4=(13)._truncated();
  6627. $ctx1.sendIdx["truncated"]=4;
  6628. self._assert_equals_($4,(13));
  6629. $ctx1.sendIdx["assert:equals:"]=5;
  6630. $5=(14)._truncated();
  6631. $ctx1.sendIdx["truncated"]=5;
  6632. self._assert_equals_($5,(14));
  6633. $ctx1.sendIdx["assert:equals:"]=6;
  6634. self._assert_equals_((15)._truncated(),(15));
  6635. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  6636. args: [],
  6637. 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",
  6638. messageSends: ["assert:equals:", "truncated"],
  6639. referencedClasses: []
  6640. }),
  6641. smalltalk.NumberTest);
  6642. smalltalk.addMethod(
  6643. smalltalk.method({
  6644. selector: "testIdentity",
  6645. protocol: 'tests',
  6646. fn: function (){
  6647. var self=this;
  6648. return smalltalk.withContext(function($ctx1) {
  6649. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6650. $1=(1).__eq_eq((1));
  6651. $ctx1.sendIdx["=="]=1;
  6652. self._assert_($1);
  6653. $ctx1.sendIdx["assert:"]=1;
  6654. $2=(0).__eq_eq((0));
  6655. $ctx1.sendIdx["=="]=2;
  6656. self._assert_($2);
  6657. $ctx1.sendIdx["assert:"]=2;
  6658. $3=(1).__eq_eq((0));
  6659. $ctx1.sendIdx["=="]=3;
  6660. self._deny_($3);
  6661. $ctx1.sendIdx["deny:"]=1;
  6662. $5=(1)._yourself();
  6663. $ctx1.sendIdx["yourself"]=1;
  6664. $4=_st($5).__eq_eq((1));
  6665. $ctx1.sendIdx["=="]=4;
  6666. self._assert_($4);
  6667. $ctx1.sendIdx["assert:"]=3;
  6668. $7=(1)._yourself();
  6669. $ctx1.sendIdx["yourself"]=2;
  6670. $6=(1).__eq_eq($7);
  6671. $ctx1.sendIdx["=="]=5;
  6672. self._assert_($6);
  6673. $ctx1.sendIdx["assert:"]=4;
  6674. $9=(1)._yourself();
  6675. $ctx1.sendIdx["yourself"]=3;
  6676. $8=_st($9).__eq_eq((1)._yourself());
  6677. $ctx1.sendIdx["=="]=6;
  6678. self._assert_($8);
  6679. self._deny_((1).__eq_eq((2)));
  6680. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  6681. args: [],
  6682. 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",
  6683. messageSends: ["assert:", "==", "deny:", "yourself"],
  6684. referencedClasses: []
  6685. }),
  6686. smalltalk.NumberTest);
  6687. smalltalk.addMethod(
  6688. smalltalk.method({
  6689. selector: "testInvalidHexNumbers",
  6690. protocol: 'tests',
  6691. fn: function (){
  6692. var self=this;
  6693. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6694. return smalltalk.withContext(function($ctx1) {
  6695. self._should_raise_((function(){
  6696. return smalltalk.withContext(function($ctx2) {
  6697. return (16)._rG();
  6698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6699. $ctx1.sendIdx["should:raise:"]=1;
  6700. self._should_raise_((function(){
  6701. return smalltalk.withContext(function($ctx2) {
  6702. return (16)._rg();
  6703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6704. $ctx1.sendIdx["should:raise:"]=2;
  6705. self._should_raise_((function(){
  6706. return smalltalk.withContext(function($ctx2) {
  6707. return (16)._rH();
  6708. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6709. $ctx1.sendIdx["should:raise:"]=3;
  6710. self._should_raise_((function(){
  6711. return smalltalk.withContext(function($ctx2) {
  6712. return (16)._rh();
  6713. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6714. $ctx1.sendIdx["should:raise:"]=4;
  6715. self._should_raise_((function(){
  6716. return smalltalk.withContext(function($ctx2) {
  6717. return (16)._rI();
  6718. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6719. $ctx1.sendIdx["should:raise:"]=5;
  6720. self._should_raise_((function(){
  6721. return smalltalk.withContext(function($ctx2) {
  6722. return (16)._ri();
  6723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6724. $ctx1.sendIdx["should:raise:"]=6;
  6725. self._should_raise_((function(){
  6726. return smalltalk.withContext(function($ctx2) {
  6727. return (16)._rJ();
  6728. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6729. $ctx1.sendIdx["should:raise:"]=7;
  6730. self._should_raise_((function(){
  6731. return smalltalk.withContext(function($ctx2) {
  6732. return (16)._rj();
  6733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6734. $ctx1.sendIdx["should:raise:"]=8;
  6735. self._should_raise_((function(){
  6736. return smalltalk.withContext(function($ctx2) {
  6737. return (16)._rK();
  6738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6739. $ctx1.sendIdx["should:raise:"]=9;
  6740. self._should_raise_((function(){
  6741. return smalltalk.withContext(function($ctx2) {
  6742. return (16)._rk();
  6743. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6744. $ctx1.sendIdx["should:raise:"]=10;
  6745. self._should_raise_((function(){
  6746. return smalltalk.withContext(function($ctx2) {
  6747. return (16)._rL();
  6748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6749. $ctx1.sendIdx["should:raise:"]=11;
  6750. self._should_raise_((function(){
  6751. return smalltalk.withContext(function($ctx2) {
  6752. return (16)._rl();
  6753. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6754. $ctx1.sendIdx["should:raise:"]=12;
  6755. self._should_raise_((function(){
  6756. return smalltalk.withContext(function($ctx2) {
  6757. return (16)._rM();
  6758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6759. $ctx1.sendIdx["should:raise:"]=13;
  6760. self._should_raise_((function(){
  6761. return smalltalk.withContext(function($ctx2) {
  6762. return (16)._rm();
  6763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6764. $ctx1.sendIdx["should:raise:"]=14;
  6765. self._should_raise_((function(){
  6766. return smalltalk.withContext(function($ctx2) {
  6767. return (16)._rN();
  6768. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6769. $ctx1.sendIdx["should:raise:"]=15;
  6770. self._should_raise_((function(){
  6771. return smalltalk.withContext(function($ctx2) {
  6772. return (16)._rn();
  6773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6774. $ctx1.sendIdx["should:raise:"]=16;
  6775. self._should_raise_((function(){
  6776. return smalltalk.withContext(function($ctx2) {
  6777. return (16)._rO();
  6778. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6779. $ctx1.sendIdx["should:raise:"]=17;
  6780. self._should_raise_((function(){
  6781. return smalltalk.withContext(function($ctx2) {
  6782. return (16)._ro();
  6783. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6784. $ctx1.sendIdx["should:raise:"]=18;
  6785. self._should_raise_((function(){
  6786. return smalltalk.withContext(function($ctx2) {
  6787. return (16)._rP();
  6788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6789. $ctx1.sendIdx["should:raise:"]=19;
  6790. self._should_raise_((function(){
  6791. return smalltalk.withContext(function($ctx2) {
  6792. return (16)._rp();
  6793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6794. $ctx1.sendIdx["should:raise:"]=20;
  6795. self._should_raise_((function(){
  6796. return smalltalk.withContext(function($ctx2) {
  6797. return (16)._rQ();
  6798. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6799. $ctx1.sendIdx["should:raise:"]=21;
  6800. self._should_raise_((function(){
  6801. return smalltalk.withContext(function($ctx2) {
  6802. return (16)._rq();
  6803. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6804. $ctx1.sendIdx["should:raise:"]=22;
  6805. self._should_raise_((function(){
  6806. return smalltalk.withContext(function($ctx2) {
  6807. return (16)._rR();
  6808. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6809. $ctx1.sendIdx["should:raise:"]=23;
  6810. self._should_raise_((function(){
  6811. return smalltalk.withContext(function($ctx2) {
  6812. return (16)._rr();
  6813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6814. $ctx1.sendIdx["should:raise:"]=24;
  6815. self._should_raise_((function(){
  6816. return smalltalk.withContext(function($ctx2) {
  6817. return (16)._rS();
  6818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6819. $ctx1.sendIdx["should:raise:"]=25;
  6820. self._should_raise_((function(){
  6821. return smalltalk.withContext(function($ctx2) {
  6822. return (16)._rs();
  6823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6824. $ctx1.sendIdx["should:raise:"]=26;
  6825. self._should_raise_((function(){
  6826. return smalltalk.withContext(function($ctx2) {
  6827. return (16)._rT();
  6828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6829. $ctx1.sendIdx["should:raise:"]=27;
  6830. self._should_raise_((function(){
  6831. return smalltalk.withContext(function($ctx2) {
  6832. return (16)._rt();
  6833. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6834. $ctx1.sendIdx["should:raise:"]=28;
  6835. self._should_raise_((function(){
  6836. return smalltalk.withContext(function($ctx2) {
  6837. return (16)._rU();
  6838. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6839. $ctx1.sendIdx["should:raise:"]=29;
  6840. self._should_raise_((function(){
  6841. return smalltalk.withContext(function($ctx2) {
  6842. return (16)._ru();
  6843. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6844. $ctx1.sendIdx["should:raise:"]=30;
  6845. self._should_raise_((function(){
  6846. return smalltalk.withContext(function($ctx2) {
  6847. return (16)._rV();
  6848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6849. $ctx1.sendIdx["should:raise:"]=31;
  6850. self._should_raise_((function(){
  6851. return smalltalk.withContext(function($ctx2) {
  6852. return (16)._rv();
  6853. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6854. $ctx1.sendIdx["should:raise:"]=32;
  6855. self._should_raise_((function(){
  6856. return smalltalk.withContext(function($ctx2) {
  6857. return (16)._rW();
  6858. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6859. $ctx1.sendIdx["should:raise:"]=33;
  6860. self._should_raise_((function(){
  6861. return smalltalk.withContext(function($ctx2) {
  6862. return (16)._rw();
  6863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6864. $ctx1.sendIdx["should:raise:"]=34;
  6865. self._should_raise_((function(){
  6866. return smalltalk.withContext(function($ctx2) {
  6867. return (16)._rX();
  6868. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6869. $ctx1.sendIdx["should:raise:"]=35;
  6870. self._should_raise_((function(){
  6871. return smalltalk.withContext(function($ctx2) {
  6872. return (16)._rx();
  6873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6874. $ctx1.sendIdx["should:raise:"]=36;
  6875. self._should_raise_((function(){
  6876. return smalltalk.withContext(function($ctx2) {
  6877. return (16)._rY();
  6878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6879. $ctx1.sendIdx["should:raise:"]=37;
  6880. self._should_raise_((function(){
  6881. return smalltalk.withContext(function($ctx2) {
  6882. return (16)._ry();
  6883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6884. $ctx1.sendIdx["should:raise:"]=38;
  6885. self._should_raise_((function(){
  6886. return smalltalk.withContext(function($ctx2) {
  6887. return (16)._rZ();
  6888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6889. $ctx1.sendIdx["should:raise:"]=39;
  6890. self._should_raise_((function(){
  6891. return smalltalk.withContext(function($ctx2) {
  6892. return (16)._rz();
  6893. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6894. $ctx1.sendIdx["should:raise:"]=40;
  6895. self._should_raise_((function(){
  6896. return smalltalk.withContext(function($ctx2) {
  6897. return (11259375)._Z();
  6898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6899. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  6900. args: [],
  6901. 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.",
  6902. 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"],
  6903. referencedClasses: ["MessageNotUnderstood"]
  6904. }),
  6905. smalltalk.NumberTest);
  6906. smalltalk.addMethod(
  6907. smalltalk.method({
  6908. selector: "testLog",
  6909. protocol: 'tests',
  6910. fn: function (){
  6911. var self=this;
  6912. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  6913. return smalltalk.withContext(function($ctx1) {
  6914. self._assert_equals_((10000)._log(),(4));
  6915. $ctx1.sendIdx["assert:equals:"]=1;
  6916. self._assert_equals_((512)._log_((2)),(9));
  6917. $ctx1.sendIdx["assert:equals:"]=2;
  6918. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  6919. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  6920. args: [],
  6921. 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.",
  6922. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  6923. referencedClasses: ["Number"]
  6924. }),
  6925. smalltalk.NumberTest);
  6926. smalltalk.addMethod(
  6927. smalltalk.method({
  6928. selector: "testMinMax",
  6929. protocol: 'tests',
  6930. fn: function (){
  6931. var self=this;
  6932. return smalltalk.withContext(function($ctx1) {
  6933. self._assert_equals_((2)._max_((5)),(5));
  6934. $ctx1.sendIdx["assert:equals:"]=1;
  6935. self._assert_equals_((2)._min_((5)),(2));
  6936. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  6937. args: [],
  6938. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  6939. messageSends: ["assert:equals:", "max:", "min:"],
  6940. referencedClasses: []
  6941. }),
  6942. smalltalk.NumberTest);
  6943. smalltalk.addMethod(
  6944. smalltalk.method({
  6945. selector: "testNegated",
  6946. protocol: 'tests',
  6947. fn: function (){
  6948. var self=this;
  6949. return smalltalk.withContext(function($ctx1) {
  6950. var $1;
  6951. $1=(3)._negated();
  6952. $ctx1.sendIdx["negated"]=1;
  6953. self._assert_equals_($1,(-3));
  6954. $ctx1.sendIdx["assert:equals:"]=1;
  6955. self._assert_equals_((-3)._negated(),(3));
  6956. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  6957. args: [],
  6958. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  6959. messageSends: ["assert:equals:", "negated"],
  6960. referencedClasses: []
  6961. }),
  6962. smalltalk.NumberTest);
  6963. smalltalk.addMethod(
  6964. smalltalk.method({
  6965. selector: "testPrintShowingDecimalPlaces",
  6966. protocol: 'tests',
  6967. fn: function (){
  6968. var self=this;
  6969. return smalltalk.withContext(function($ctx1) {
  6970. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  6971. $1=(23)._printShowingDecimalPlaces_((2));
  6972. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  6973. self._assert_equals_($1,"23.00");
  6974. $ctx1.sendIdx["assert:equals:"]=1;
  6975. $2=(23.5698)._printShowingDecimalPlaces_((2));
  6976. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  6977. self._assert_equals_($2,"23.57");
  6978. $ctx1.sendIdx["assert:equals:"]=2;
  6979. $4=(234.567)._negated();
  6980. $ctx1.sendIdx["negated"]=1;
  6981. $3=_st($4)._printShowingDecimalPlaces_((5));
  6982. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  6983. self._assert_equals_($3,"-234.56700");
  6984. $ctx1.sendIdx["assert:equals:"]=3;
  6985. $5=(23.4567)._printShowingDecimalPlaces_((0));
  6986. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  6987. self._assert_equals_($5,"23");
  6988. $ctx1.sendIdx["assert:equals:"]=4;
  6989. $6=(23.5567)._printShowingDecimalPlaces_((0));
  6990. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  6991. self._assert_equals_($6,"24");
  6992. $ctx1.sendIdx["assert:equals:"]=5;
  6993. $8=(23.4567)._negated();
  6994. $ctx1.sendIdx["negated"]=2;
  6995. $7=_st($8)._printShowingDecimalPlaces_((0));
  6996. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  6997. self._assert_equals_($7,"-23");
  6998. $ctx1.sendIdx["assert:equals:"]=6;
  6999. $10=(23.5567)._negated();
  7000. $ctx1.sendIdx["negated"]=3;
  7001. $9=_st($10)._printShowingDecimalPlaces_((0));
  7002. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7003. self._assert_equals_($9,"-24");
  7004. $ctx1.sendIdx["assert:equals:"]=7;
  7005. $11=(100000000)._printShowingDecimalPlaces_((1));
  7006. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7007. self._assert_equals_($11,"100000000.0");
  7008. $ctx1.sendIdx["assert:equals:"]=8;
  7009. $12=(0.98)._printShowingDecimalPlaces_((5));
  7010. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7011. self._assert_equals_($12,"0.98000");
  7012. $ctx1.sendIdx["assert:equals:"]=9;
  7013. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7014. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7015. self._assert_equals_($13,"-0.98");
  7016. $ctx1.sendIdx["assert:equals:"]=10;
  7017. $14=(2.567)._printShowingDecimalPlaces_((2));
  7018. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7019. self._assert_equals_($14,"2.57");
  7020. $ctx1.sendIdx["assert:equals:"]=11;
  7021. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7022. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7023. self._assert_equals_($15,"-2.57");
  7024. $ctx1.sendIdx["assert:equals:"]=12;
  7025. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7026. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  7027. args: [],
  7028. 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'.",
  7029. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7030. referencedClasses: []
  7031. }),
  7032. smalltalk.NumberTest);
  7033. smalltalk.addMethod(
  7034. smalltalk.method({
  7035. selector: "testRaisedTo",
  7036. protocol: 'tests',
  7037. fn: function (){
  7038. var self=this;
  7039. return smalltalk.withContext(function($ctx1) {
  7040. var $1,$2,$3;
  7041. $1=(2)._raisedTo_((4));
  7042. $ctx1.sendIdx["raisedTo:"]=1;
  7043. self._assert_equals_($1,(16));
  7044. $ctx1.sendIdx["assert:equals:"]=1;
  7045. $2=(2)._raisedTo_((0));
  7046. $ctx1.sendIdx["raisedTo:"]=2;
  7047. self._assert_equals_($2,(1));
  7048. $ctx1.sendIdx["assert:equals:"]=2;
  7049. $3=(2)._raisedTo_((-3));
  7050. $ctx1.sendIdx["raisedTo:"]=3;
  7051. self._assert_equals_($3,(0.125));
  7052. $ctx1.sendIdx["assert:equals:"]=3;
  7053. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7054. $ctx1.sendIdx["assert:equals:"]=4;
  7055. self._assert_equals_((2).__star_star((4)),(16));
  7056. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  7057. args: [],
  7058. 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.",
  7059. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7060. referencedClasses: []
  7061. }),
  7062. smalltalk.NumberTest);
  7063. smalltalk.addMethod(
  7064. smalltalk.method({
  7065. selector: "testRounded",
  7066. protocol: 'tests',
  7067. fn: function (){
  7068. var self=this;
  7069. return smalltalk.withContext(function($ctx1) {
  7070. var $1,$2;
  7071. $1=(3)._rounded();
  7072. $ctx1.sendIdx["rounded"]=1;
  7073. self._assert_equals_($1,(3));
  7074. $ctx1.sendIdx["assert:equals:"]=1;
  7075. $2=(3.212)._rounded();
  7076. $ctx1.sendIdx["rounded"]=2;
  7077. self._assert_equals_($2,(3));
  7078. $ctx1.sendIdx["assert:equals:"]=2;
  7079. self._assert_equals_((3.51)._rounded(),(4));
  7080. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  7081. args: [],
  7082. 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",
  7083. messageSends: ["assert:equals:", "rounded"],
  7084. referencedClasses: []
  7085. }),
  7086. smalltalk.NumberTest);
  7087. smalltalk.addMethod(
  7088. smalltalk.method({
  7089. selector: "testSign",
  7090. protocol: 'tests',
  7091. fn: function (){
  7092. var self=this;
  7093. return smalltalk.withContext(function($ctx1) {
  7094. var $1,$2;
  7095. $1=(5)._sign();
  7096. $ctx1.sendIdx["sign"]=1;
  7097. self._assert_equals_($1,(1));
  7098. $ctx1.sendIdx["assert:equals:"]=1;
  7099. $2=(0)._sign();
  7100. $ctx1.sendIdx["sign"]=2;
  7101. self._assert_equals_($2,(0));
  7102. $ctx1.sendIdx["assert:equals:"]=2;
  7103. self._assert_equals_((-1.4)._sign(),(-1));
  7104. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  7105. args: [],
  7106. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7107. messageSends: ["assert:equals:", "sign"],
  7108. referencedClasses: []
  7109. }),
  7110. smalltalk.NumberTest);
  7111. smalltalk.addMethod(
  7112. smalltalk.method({
  7113. selector: "testSqrt",
  7114. protocol: 'tests',
  7115. fn: function (){
  7116. var self=this;
  7117. return smalltalk.withContext(function($ctx1) {
  7118. var $1;
  7119. $1=(4)._sqrt();
  7120. $ctx1.sendIdx["sqrt"]=1;
  7121. self._assert_equals_($1,(2));
  7122. $ctx1.sendIdx["assert:equals:"]=1;
  7123. self._assert_equals_((16)._sqrt(),(4));
  7124. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  7125. args: [],
  7126. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7127. messageSends: ["assert:equals:", "sqrt"],
  7128. referencedClasses: []
  7129. }),
  7130. smalltalk.NumberTest);
  7131. smalltalk.addMethod(
  7132. smalltalk.method({
  7133. selector: "testSquared",
  7134. protocol: 'tests',
  7135. fn: function (){
  7136. var self=this;
  7137. return smalltalk.withContext(function($ctx1) {
  7138. self._assert_equals_((4)._squared(),(16));
  7139. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  7140. args: [],
  7141. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7142. messageSends: ["assert:equals:", "squared"],
  7143. referencedClasses: []
  7144. }),
  7145. smalltalk.NumberTest);
  7146. smalltalk.addMethod(
  7147. smalltalk.method({
  7148. selector: "testTimesRepeat",
  7149. protocol: 'tests',
  7150. fn: function (){
  7151. var self=this;
  7152. var i;
  7153. return smalltalk.withContext(function($ctx1) {
  7154. i=(0);
  7155. (0)._timesRepeat_((function(){
  7156. return smalltalk.withContext(function($ctx2) {
  7157. i=_st(i).__plus((1));
  7158. $ctx2.sendIdx["+"]=1;
  7159. return i;
  7160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7161. $ctx1.sendIdx["timesRepeat:"]=1;
  7162. self._assert_equals_(i,(0));
  7163. $ctx1.sendIdx["assert:equals:"]=1;
  7164. (5)._timesRepeat_((function(){
  7165. return smalltalk.withContext(function($ctx2) {
  7166. i=_st(i).__plus((1));
  7167. return i;
  7168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7169. self._assert_equals_(i,(5));
  7170. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  7171. args: [],
  7172. 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",
  7173. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7174. referencedClasses: []
  7175. }),
  7176. smalltalk.NumberTest);
  7177. smalltalk.addMethod(
  7178. smalltalk.method({
  7179. selector: "testTo",
  7180. protocol: 'tests',
  7181. fn: function (){
  7182. var self=this;
  7183. return smalltalk.withContext(function($ctx1) {
  7184. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7185. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  7186. args: [],
  7187. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7188. messageSends: ["assert:equals:", "to:"],
  7189. referencedClasses: []
  7190. }),
  7191. smalltalk.NumberTest);
  7192. smalltalk.addMethod(
  7193. smalltalk.method({
  7194. selector: "testToBy",
  7195. protocol: 'tests',
  7196. fn: function (){
  7197. var self=this;
  7198. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7199. return smalltalk.withContext(function($ctx1) {
  7200. var $1;
  7201. $1=(0)._to_by_((6),(2));
  7202. $ctx1.sendIdx["to:by:"]=1;
  7203. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7204. self._should_raise_((function(){
  7205. return smalltalk.withContext(function($ctx2) {
  7206. return (1)._to_by_((4),(0));
  7207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7208. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  7209. args: [],
  7210. 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",
  7211. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7212. referencedClasses: ["Error"]
  7213. }),
  7214. smalltalk.NumberTest);
  7215. smalltalk.addMethod(
  7216. smalltalk.method({
  7217. selector: "testTrigonometry",
  7218. protocol: 'tests',
  7219. fn: function (){
  7220. var self=this;
  7221. return smalltalk.withContext(function($ctx1) {
  7222. self._assert_equals_((0)._cos(),(1));
  7223. $ctx1.sendIdx["assert:equals:"]=1;
  7224. self._assert_equals_((0)._sin(),(0));
  7225. $ctx1.sendIdx["assert:equals:"]=2;
  7226. self._assert_equals_((0)._tan(),(0));
  7227. $ctx1.sendIdx["assert:equals:"]=3;
  7228. self._assert_equals_((1)._arcCos(),(0));
  7229. $ctx1.sendIdx["assert:equals:"]=4;
  7230. self._assert_equals_((0)._arcSin(),(0));
  7231. $ctx1.sendIdx["assert:equals:"]=5;
  7232. self._assert_equals_((0)._arcTan(),(0));
  7233. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  7234. args: [],
  7235. 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.",
  7236. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7237. referencedClasses: []
  7238. }),
  7239. smalltalk.NumberTest);
  7240. smalltalk.addMethod(
  7241. smalltalk.method({
  7242. selector: "testTruncated",
  7243. protocol: 'tests',
  7244. fn: function (){
  7245. var self=this;
  7246. return smalltalk.withContext(function($ctx1) {
  7247. var $1,$2;
  7248. $1=(3)._truncated();
  7249. $ctx1.sendIdx["truncated"]=1;
  7250. self._assert_equals_($1,(3));
  7251. $ctx1.sendIdx["assert:equals:"]=1;
  7252. $2=(3.212)._truncated();
  7253. $ctx1.sendIdx["truncated"]=2;
  7254. self._assert_equals_($2,(3));
  7255. $ctx1.sendIdx["assert:equals:"]=2;
  7256. self._assert_equals_((3.51)._truncated(),(3));
  7257. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  7258. args: [],
  7259. 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",
  7260. messageSends: ["assert:equals:", "truncated"],
  7261. referencedClasses: []
  7262. }),
  7263. smalltalk.NumberTest);
  7264. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  7265. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7266. smalltalk.addMethod(
  7267. smalltalk.method({
  7268. selector: "foo",
  7269. protocol: 'not yet classified',
  7270. fn: function (){
  7271. var self=this;
  7272. return smalltalk.withContext(function($ctx1) {
  7273. var $1;
  7274. $1=self["@foo"];
  7275. return $1;
  7276. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  7277. args: [],
  7278. source: "foo\x0a\x09^ foo",
  7279. messageSends: [],
  7280. referencedClasses: []
  7281. }),
  7282. smalltalk.ObjectMock);
  7283. smalltalk.addMethod(
  7284. smalltalk.method({
  7285. selector: "foo:",
  7286. protocol: 'not yet classified',
  7287. fn: function (anObject){
  7288. var self=this;
  7289. return smalltalk.withContext(function($ctx1) {
  7290. self["@foo"]=anObject;
  7291. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  7292. args: ["anObject"],
  7293. source: "foo: anObject\x0a\x09foo := anObject",
  7294. messageSends: [],
  7295. referencedClasses: []
  7296. }),
  7297. smalltalk.ObjectMock);
  7298. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7299. smalltalk.addMethod(
  7300. smalltalk.method({
  7301. selector: "notDefined",
  7302. protocol: 'tests',
  7303. fn: function (){
  7304. var self=this;
  7305. return smalltalk.withContext(function($ctx1) {
  7306. return void 0;;
  7307. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  7308. args: [],
  7309. source: "notDefined\x0a\x09<return void 0;>",
  7310. messageSends: [],
  7311. referencedClasses: []
  7312. }),
  7313. smalltalk.ObjectTest);
  7314. smalltalk.addMethod(
  7315. smalltalk.method({
  7316. selector: "testBasicAccess",
  7317. protocol: 'tests',
  7318. fn: function (){
  7319. var self=this;
  7320. var o;
  7321. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7322. return smalltalk.withContext(function($ctx1) {
  7323. var $1;
  7324. o=_st($Object())._new();
  7325. _st(o)._basicAt_put_("a",(1));
  7326. $1=_st(o)._basicAt_("a");
  7327. $ctx1.sendIdx["basicAt:"]=1;
  7328. self._assert_equals_($1,(1));
  7329. $ctx1.sendIdx["assert:equals:"]=1;
  7330. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7331. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  7332. args: [],
  7333. 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",
  7334. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7335. referencedClasses: ["Object"]
  7336. }),
  7337. smalltalk.ObjectTest);
  7338. smalltalk.addMethod(
  7339. smalltalk.method({
  7340. selector: "testBasicPerform",
  7341. protocol: 'tests',
  7342. fn: function (){
  7343. var self=this;
  7344. var o;
  7345. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7346. return smalltalk.withContext(function($ctx1) {
  7347. o=_st($Object())._new();
  7348. _st(o)._basicAt_put_("func",(function(){
  7349. return smalltalk.withContext(function($ctx2) {
  7350. return "hello";
  7351. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7352. $ctx1.sendIdx["basicAt:put:"]=1;
  7353. _st(o)._basicAt_put_("func2",(function(a){
  7354. return smalltalk.withContext(function($ctx2) {
  7355. return _st(a).__plus((1));
  7356. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7357. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7358. $ctx1.sendIdx["assert:equals:"]=1;
  7359. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7360. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  7361. args: [],
  7362. 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",
  7363. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7364. referencedClasses: ["Object"]
  7365. }),
  7366. smalltalk.ObjectTest);
  7367. smalltalk.addMethod(
  7368. smalltalk.method({
  7369. selector: "testDNU",
  7370. protocol: 'tests',
  7371. fn: function (){
  7372. var self=this;
  7373. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7374. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7375. return smalltalk.withContext(function($ctx1) {
  7376. self._should_raise_((function(){
  7377. return smalltalk.withContext(function($ctx2) {
  7378. return _st(_st($Object())._new())._foo();
  7379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7380. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  7381. args: [],
  7382. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7383. messageSends: ["should:raise:", "foo", "new"],
  7384. referencedClasses: ["Object", "MessageNotUnderstood"]
  7385. }),
  7386. smalltalk.ObjectTest);
  7387. smalltalk.addMethod(
  7388. smalltalk.method({
  7389. selector: "testEquality",
  7390. protocol: 'tests',
  7391. fn: function (){
  7392. var self=this;
  7393. var o;
  7394. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7395. return smalltalk.withContext(function($ctx1) {
  7396. var $1,$2,$4,$3;
  7397. o=_st($Object())._new();
  7398. $ctx1.sendIdx["new"]=1;
  7399. $1=_st(o).__eq(_st($Object())._new());
  7400. $ctx1.sendIdx["="]=1;
  7401. self._deny_($1);
  7402. $2=_st(o).__eq(o);
  7403. $ctx1.sendIdx["="]=2;
  7404. self._assert_($2);
  7405. $ctx1.sendIdx["assert:"]=1;
  7406. $4=_st(o)._yourself();
  7407. $ctx1.sendIdx["yourself"]=1;
  7408. $3=_st($4).__eq(o);
  7409. $ctx1.sendIdx["="]=3;
  7410. self._assert_($3);
  7411. $ctx1.sendIdx["assert:"]=2;
  7412. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7413. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  7414. args: [],
  7415. 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)",
  7416. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7417. referencedClasses: ["Object"]
  7418. }),
  7419. smalltalk.ObjectTest);
  7420. smalltalk.addMethod(
  7421. smalltalk.method({
  7422. selector: "testHalt",
  7423. protocol: 'tests',
  7424. fn: function (){
  7425. var self=this;
  7426. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7427. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7428. return smalltalk.withContext(function($ctx1) {
  7429. self._should_raise_((function(){
  7430. return smalltalk.withContext(function($ctx2) {
  7431. return _st(_st($Object())._new())._halt();
  7432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7433. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  7434. args: [],
  7435. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7436. messageSends: ["should:raise:", "halt", "new"],
  7437. referencedClasses: ["Object", "Error"]
  7438. }),
  7439. smalltalk.ObjectTest);
  7440. smalltalk.addMethod(
  7441. smalltalk.method({
  7442. selector: "testIdentity",
  7443. protocol: 'tests',
  7444. fn: function (){
  7445. var self=this;
  7446. var o;
  7447. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7448. return smalltalk.withContext(function($ctx1) {
  7449. var $1,$2,$4,$3;
  7450. o=_st($Object())._new();
  7451. $ctx1.sendIdx["new"]=1;
  7452. $1=_st(o).__eq_eq(_st($Object())._new());
  7453. $ctx1.sendIdx["=="]=1;
  7454. self._deny_($1);
  7455. $2=_st(o).__eq_eq(o);
  7456. $ctx1.sendIdx["=="]=2;
  7457. self._assert_($2);
  7458. $ctx1.sendIdx["assert:"]=1;
  7459. $4=_st(o)._yourself();
  7460. $ctx1.sendIdx["yourself"]=1;
  7461. $3=_st($4).__eq_eq(o);
  7462. $ctx1.sendIdx["=="]=3;
  7463. self._assert_($3);
  7464. $ctx1.sendIdx["assert:"]=2;
  7465. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7466. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  7467. args: [],
  7468. 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",
  7469. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7470. referencedClasses: ["Object"]
  7471. }),
  7472. smalltalk.ObjectTest);
  7473. smalltalk.addMethod(
  7474. smalltalk.method({
  7475. selector: "testIfNil",
  7476. protocol: 'tests',
  7477. fn: function (){
  7478. var self=this;
  7479. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7480. return smalltalk.withContext(function($ctx1) {
  7481. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  7482. $2=_st($Object())._new();
  7483. $ctx1.sendIdx["new"]=1;
  7484. $1=_st($2)._isNil();
  7485. self._deny_($1);
  7486. $ctx1.sendIdx["deny:"]=1;
  7487. $5=_st($Object())._new();
  7488. $ctx1.sendIdx["new"]=2;
  7489. if(($receiver = $5) == nil || $receiver == null){
  7490. $4=true;
  7491. } else {
  7492. $4=$5;
  7493. };
  7494. $3=_st($4).__eq(true);
  7495. self._deny_($3);
  7496. $7=_st($Object())._new();
  7497. $ctx1.sendIdx["new"]=3;
  7498. if(($receiver = $7) == nil || $receiver == null){
  7499. $6=$7;
  7500. } else {
  7501. $6=true;
  7502. };
  7503. self._assert_equals_($6,true);
  7504. $ctx1.sendIdx["assert:equals:"]=1;
  7505. $9=_st($Object())._new();
  7506. $ctx1.sendIdx["new"]=4;
  7507. if(($receiver = $9) == nil || $receiver == null){
  7508. $8=false;
  7509. } else {
  7510. $8=true;
  7511. };
  7512. self._assert_equals_($8,true);
  7513. $ctx1.sendIdx["assert:equals:"]=2;
  7514. $11=_st($Object())._new();
  7515. if(($receiver = $11) == nil || $receiver == null){
  7516. $10=false;
  7517. } else {
  7518. $10=true;
  7519. };
  7520. self._assert_equals_($10,true);
  7521. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  7522. args: [],
  7523. 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",
  7524. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7525. referencedClasses: ["Object"]
  7526. }),
  7527. smalltalk.ObjectTest);
  7528. smalltalk.addMethod(
  7529. smalltalk.method({
  7530. selector: "testInstVars",
  7531. protocol: 'tests',
  7532. fn: function (){
  7533. var self=this;
  7534. var o;
  7535. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7536. return smalltalk.withContext(function($ctx1) {
  7537. var $1,$2;
  7538. o=_st($ObjectMock())._new();
  7539. $1=_st(o)._instVarAt_("foo");
  7540. $ctx1.sendIdx["instVarAt:"]=1;
  7541. self._assert_equals_($1,nil);
  7542. $ctx1.sendIdx["assert:equals:"]=1;
  7543. _st(o)._instVarAt_put_("foo",(1));
  7544. $2=_st(o)._instVarAt_("foo");
  7545. $ctx1.sendIdx["instVarAt:"]=2;
  7546. self._assert_equals_($2,(1));
  7547. $ctx1.sendIdx["assert:equals:"]=2;
  7548. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7549. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  7550. args: [],
  7551. 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",
  7552. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7553. referencedClasses: ["ObjectMock"]
  7554. }),
  7555. smalltalk.ObjectTest);
  7556. smalltalk.addMethod(
  7557. smalltalk.method({
  7558. selector: "testNilUndefined",
  7559. protocol: 'tests',
  7560. fn: function (){
  7561. var self=this;
  7562. return smalltalk.withContext(function($ctx1) {
  7563. self._assert_equals_(self._notDefined(),nil);
  7564. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  7565. args: [],
  7566. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7567. messageSends: ["assert:equals:", "notDefined"],
  7568. referencedClasses: []
  7569. }),
  7570. smalltalk.ObjectTest);
  7571. smalltalk.addMethod(
  7572. smalltalk.method({
  7573. selector: "testYourself",
  7574. protocol: 'tests',
  7575. fn: function (){
  7576. var self=this;
  7577. var o;
  7578. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7579. return smalltalk.withContext(function($ctx1) {
  7580. o=_st($ObjectMock())._new();
  7581. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7582. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  7583. args: [],
  7584. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7585. messageSends: ["new", "assert:", "==", "yourself"],
  7586. referencedClasses: ["ObjectMock"]
  7587. }),
  7588. smalltalk.ObjectTest);
  7589. smalltalk.addMethod(
  7590. smalltalk.method({
  7591. selector: "testidentityHash",
  7592. protocol: 'tests',
  7593. fn: function (){
  7594. var self=this;
  7595. var o1,o2;
  7596. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7597. return smalltalk.withContext(function($ctx1) {
  7598. var $2,$3,$1,$5,$4;
  7599. o1=_st($Object())._new();
  7600. $ctx1.sendIdx["new"]=1;
  7601. o2=_st($Object())._new();
  7602. $2=_st(o1)._identityHash();
  7603. $ctx1.sendIdx["identityHash"]=1;
  7604. $3=_st(o1)._identityHash();
  7605. $ctx1.sendIdx["identityHash"]=2;
  7606. $1=_st($2).__eq_eq($3);
  7607. $ctx1.sendIdx["=="]=1;
  7608. self._assert_($1);
  7609. $5=_st(o1)._identityHash();
  7610. $ctx1.sendIdx["identityHash"]=3;
  7611. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7612. self._deny_($4);
  7613. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  7614. args: [],
  7615. 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",
  7616. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7617. referencedClasses: ["Object"]
  7618. }),
  7619. smalltalk.ObjectTest);
  7620. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7621. smalltalk.addMethod(
  7622. smalltalk.method({
  7623. selector: "testAccessing",
  7624. protocol: 'tests',
  7625. fn: function (){
  7626. var self=this;
  7627. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7628. return smalltalk.withContext(function($ctx1) {
  7629. var $2,$1,$3,$6,$5,$4;
  7630. $2=_st($Point())._x_y_((3),(4));
  7631. $ctx1.sendIdx["x:y:"]=1;
  7632. $1=_st($2)._x();
  7633. $ctx1.sendIdx["x"]=1;
  7634. self._assert_equals_($1,(3));
  7635. $ctx1.sendIdx["assert:equals:"]=1;
  7636. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7637. $ctx1.sendIdx["y"]=1;
  7638. self._assert_equals_($3,(4));
  7639. $ctx1.sendIdx["assert:equals:"]=2;
  7640. $6=_st($Point())._new();
  7641. $ctx1.sendIdx["new"]=1;
  7642. $5=_st($6)._x_((3));
  7643. $4=_st($5)._x();
  7644. self._assert_equals_($4,(3));
  7645. $ctx1.sendIdx["assert:equals:"]=3;
  7646. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7647. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  7648. args: [],
  7649. 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",
  7650. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7651. referencedClasses: ["Point"]
  7652. }),
  7653. smalltalk.PointTest);
  7654. smalltalk.addMethod(
  7655. smalltalk.method({
  7656. selector: "testArithmetic",
  7657. protocol: 'tests',
  7658. fn: function (){
  7659. var self=this;
  7660. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7661. return smalltalk.withContext(function($ctx1) {
  7662. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7663. $2=(3).__at((4));
  7664. $ctx1.sendIdx["@"]=1;
  7665. $3=(3).__at((4));
  7666. $ctx1.sendIdx["@"]=2;
  7667. $1=_st($2).__star($3);
  7668. $4=_st($Point())._x_y_((9),(16));
  7669. $ctx1.sendIdx["x:y:"]=1;
  7670. self._assert_equals_($1,$4);
  7671. $ctx1.sendIdx["assert:equals:"]=1;
  7672. $6=(3).__at((4));
  7673. $ctx1.sendIdx["@"]=3;
  7674. $7=(3).__at((4));
  7675. $ctx1.sendIdx["@"]=4;
  7676. $5=_st($6).__plus($7);
  7677. $8=_st($Point())._x_y_((6),(8));
  7678. $ctx1.sendIdx["x:y:"]=2;
  7679. self._assert_equals_($5,$8);
  7680. $ctx1.sendIdx["assert:equals:"]=2;
  7681. $10=(3).__at((4));
  7682. $ctx1.sendIdx["@"]=5;
  7683. $11=(3).__at((4));
  7684. $ctx1.sendIdx["@"]=6;
  7685. $9=_st($10).__minus($11);
  7686. $12=_st($Point())._x_y_((0),(0));
  7687. $ctx1.sendIdx["x:y:"]=3;
  7688. self._assert_equals_($9,$12);
  7689. $ctx1.sendIdx["assert:equals:"]=3;
  7690. $14=(6).__at((8));
  7691. $ctx1.sendIdx["@"]=7;
  7692. $13=_st($14).__slash((3).__at((4)));
  7693. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7694. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  7695. args: [],
  7696. 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)",
  7697. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7698. referencedClasses: ["Point"]
  7699. }),
  7700. smalltalk.PointTest);
  7701. smalltalk.addMethod(
  7702. smalltalk.method({
  7703. selector: "testAt",
  7704. protocol: 'tests',
  7705. fn: function (){
  7706. var self=this;
  7707. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7708. return smalltalk.withContext(function($ctx1) {
  7709. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7710. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  7711. args: [],
  7712. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7713. messageSends: ["assert:equals:", "@", "x:y:"],
  7714. referencedClasses: ["Point"]
  7715. }),
  7716. smalltalk.PointTest);
  7717. smalltalk.addMethod(
  7718. smalltalk.method({
  7719. selector: "testEgality",
  7720. protocol: 'tests',
  7721. fn: function (){
  7722. var self=this;
  7723. return smalltalk.withContext(function($ctx1) {
  7724. var $2,$3,$1,$5,$4;
  7725. $2=(3).__at((4));
  7726. $ctx1.sendIdx["@"]=1;
  7727. $3=(3).__at((4));
  7728. $ctx1.sendIdx["@"]=2;
  7729. $1=_st($2).__eq($3);
  7730. $ctx1.sendIdx["="]=1;
  7731. self._assert_($1);
  7732. $5=(3).__at((5));
  7733. $ctx1.sendIdx["@"]=3;
  7734. $4=_st($5).__eq((3).__at((6)));
  7735. self._deny_($4);
  7736. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  7737. args: [],
  7738. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7739. messageSends: ["assert:", "=", "@", "deny:"],
  7740. referencedClasses: []
  7741. }),
  7742. smalltalk.PointTest);
  7743. smalltalk.addMethod(
  7744. smalltalk.method({
  7745. selector: "testNew",
  7746. protocol: 'tests',
  7747. fn: function (){
  7748. var self=this;
  7749. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7750. return smalltalk.withContext(function($ctx1) {
  7751. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7752. $3=_st($Point())._new();
  7753. $ctx1.sendIdx["new"]=1;
  7754. $2=_st($3)._x_((3));
  7755. $ctx1.sendIdx["x:"]=1;
  7756. $1=_st($2)._y();
  7757. $ctx1.sendIdx["y"]=1;
  7758. self._assert_equals_($1,nil);
  7759. $ctx1.sendIdx["assert:equals:"]=1;
  7760. $7=_st($Point())._new();
  7761. $ctx1.sendIdx["new"]=2;
  7762. $6=_st($7)._x_((3));
  7763. $5=_st($6)._x();
  7764. $ctx1.sendIdx["x"]=1;
  7765. $4=_st($5).__eq((0));
  7766. $ctx1.sendIdx["="]=1;
  7767. self._deny_($4);
  7768. $ctx1.sendIdx["deny:"]=1;
  7769. $10=_st($Point())._new();
  7770. $ctx1.sendIdx["new"]=3;
  7771. $9=_st($10)._y_((4));
  7772. $ctx1.sendIdx["y:"]=1;
  7773. $8=_st($9)._x();
  7774. self._assert_equals_($8,nil);
  7775. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7776. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  7777. args: [],
  7778. 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",
  7779. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7780. referencedClasses: ["Point"]
  7781. }),
  7782. smalltalk.PointTest);
  7783. smalltalk.addMethod(
  7784. smalltalk.method({
  7785. selector: "testTranslateBy",
  7786. protocol: 'tests',
  7787. fn: function (){
  7788. var self=this;
  7789. return smalltalk.withContext(function($ctx1) {
  7790. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7791. $2=(3).__at((3));
  7792. $ctx1.sendIdx["@"]=1;
  7793. $3=(0).__at((1));
  7794. $ctx1.sendIdx["@"]=2;
  7795. $1=_st($2)._translateBy_($3);
  7796. $ctx1.sendIdx["translateBy:"]=1;
  7797. $4=(3).__at((4));
  7798. $ctx1.sendIdx["@"]=3;
  7799. self._assert_equals_($1,$4);
  7800. $ctx1.sendIdx["assert:equals:"]=1;
  7801. $6=(3).__at((3));
  7802. $ctx1.sendIdx["@"]=4;
  7803. $8=(1)._negated();
  7804. $ctx1.sendIdx["negated"]=1;
  7805. $7=(0).__at($8);
  7806. $ctx1.sendIdx["@"]=5;
  7807. $5=_st($6)._translateBy_($7);
  7808. $ctx1.sendIdx["translateBy:"]=2;
  7809. $9=(3).__at((2));
  7810. $ctx1.sendIdx["@"]=6;
  7811. self._assert_equals_($5,$9);
  7812. $ctx1.sendIdx["assert:equals:"]=2;
  7813. $11=(3).__at((3));
  7814. $ctx1.sendIdx["@"]=7;
  7815. $12=(2).__at((3));
  7816. $ctx1.sendIdx["@"]=8;
  7817. $10=_st($11)._translateBy_($12);
  7818. $ctx1.sendIdx["translateBy:"]=3;
  7819. $13=(5).__at((6));
  7820. $ctx1.sendIdx["@"]=9;
  7821. self._assert_equals_($10,$13);
  7822. $ctx1.sendIdx["assert:equals:"]=3;
  7823. $15=(3).__at((3));
  7824. $ctx1.sendIdx["@"]=10;
  7825. $16=_st((3)._negated()).__at((0));
  7826. $ctx1.sendIdx["@"]=11;
  7827. $14=_st($15)._translateBy_($16);
  7828. self._assert_equals_($14,(0).__at((3)));
  7829. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  7830. args: [],
  7831. 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.",
  7832. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7833. referencedClasses: []
  7834. }),
  7835. smalltalk.PointTest);
  7836. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7837. smalltalk.addMethod(
  7838. smalltalk.method({
  7839. selector: "testNextIfAbsent",
  7840. protocol: 'tests',
  7841. fn: function (){
  7842. var self=this;
  7843. var queue;
  7844. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7845. return smalltalk.withContext(function($ctx1) {
  7846. var $2,$1;
  7847. queue=_st($Queue())._new();
  7848. _st(queue)._nextPut_("index1");
  7849. $2=_st(queue)._nextIfAbsent_("empty");
  7850. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7851. $1=_st($2).__eq("index1");
  7852. $ctx1.sendIdx["="]=1;
  7853. self._assert_($1);
  7854. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7855. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  7856. args: [],
  7857. 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'",
  7858. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7859. referencedClasses: ["Queue"]
  7860. }),
  7861. smalltalk.QueueTest);
  7862. smalltalk.addMethod(
  7863. smalltalk.method({
  7864. selector: "testQueueNext",
  7865. protocol: 'tests',
  7866. fn: function (){
  7867. var self=this;
  7868. var queue;
  7869. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7870. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7871. return smalltalk.withContext(function($ctx1) {
  7872. var $1,$2,$4,$3,$6,$5;
  7873. queue=_st($Queue())._new();
  7874. $1=queue;
  7875. _st($1)._nextPut_("index1");
  7876. $ctx1.sendIdx["nextPut:"]=1;
  7877. $2=_st($1)._nextPut_("index2");
  7878. $4=_st(queue)._next();
  7879. $ctx1.sendIdx["next"]=1;
  7880. $3=_st($4).__eq("index1");
  7881. $ctx1.sendIdx["="]=1;
  7882. self._assert_($3);
  7883. $6=_st(queue)._next();
  7884. $ctx1.sendIdx["next"]=2;
  7885. $5=_st($6).__eq("index");
  7886. self._deny_($5);
  7887. self._should_raise_((function(){
  7888. return smalltalk.withContext(function($ctx2) {
  7889. return _st(queue)._next();
  7890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7891. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  7892. args: [],
  7893. 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",
  7894. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  7895. referencedClasses: ["Queue", "Error"]
  7896. }),
  7897. smalltalk.QueueTest);
  7898. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7899. smalltalk.addMethod(
  7900. smalltalk.method({
  7901. selector: "testAtRandomNumber",
  7902. protocol: 'tests',
  7903. fn: function (){
  7904. var self=this;
  7905. var val;
  7906. return smalltalk.withContext(function($ctx1) {
  7907. (100)._timesRepeat_((function(){
  7908. return smalltalk.withContext(function($ctx2) {
  7909. val=(10)._atRandom();
  7910. val;
  7911. self._assert_(_st(val).__gt((0)));
  7912. $ctx2.sendIdx["assert:"]=1;
  7913. return self._assert_(_st(val).__lt((11)));
  7914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7915. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  7916. args: [],
  7917. 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]",
  7918. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  7919. referencedClasses: []
  7920. }),
  7921. smalltalk.RandomTest);
  7922. smalltalk.addMethod(
  7923. smalltalk.method({
  7924. selector: "testAtRandomSequenceableCollection",
  7925. protocol: 'tests',
  7926. fn: function (){
  7927. var self=this;
  7928. var val;
  7929. return smalltalk.withContext(function($ctx1) {
  7930. var $3,$4,$2,$1;
  7931. (100)._timesRepeat_((function(){
  7932. return smalltalk.withContext(function($ctx2) {
  7933. val="abc"._atRandom();
  7934. val;
  7935. $3=_st(val).__eq("a");
  7936. $ctx2.sendIdx["="]=1;
  7937. $4=_st(val).__eq("b");
  7938. $ctx2.sendIdx["="]=2;
  7939. $2=_st($3).__or($4);
  7940. $1=_st($2).__or(_st(val).__eq("c"));
  7941. $ctx2.sendIdx["|"]=1;
  7942. return self._assert_($1);
  7943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7944. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  7945. args: [],
  7946. 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].",
  7947. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  7948. referencedClasses: []
  7949. }),
  7950. smalltalk.RandomTest);
  7951. smalltalk.addMethod(
  7952. smalltalk.method({
  7953. selector: "textNext",
  7954. protocol: 'tests',
  7955. fn: function (){
  7956. var self=this;
  7957. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  7958. return smalltalk.withContext(function($ctx1) {
  7959. var $1;
  7960. (10000)._timesRepeat_((function(){
  7961. var current,next;
  7962. return smalltalk.withContext(function($ctx2) {
  7963. next=_st(_st($Random())._new())._next();
  7964. next;
  7965. self._assert_(_st(next).__gt_eq((0)));
  7966. $ctx2.sendIdx["assert:"]=1;
  7967. self._assert_(_st(next).__lt((1)));
  7968. $1=_st(current).__eq(next);
  7969. $ctx2.sendIdx["="]=1;
  7970. self._deny_($1);
  7971. return _st(next).__eq(current);
  7972. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  7973. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  7974. args: [],
  7975. 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 ]",
  7976. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  7977. referencedClasses: ["Random"]
  7978. }),
  7979. smalltalk.RandomTest);
  7980. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7981. smalltalk.addMethod(
  7982. smalltalk.method({
  7983. selector: "collectionClass",
  7984. protocol: 'accessing',
  7985. fn: function (){
  7986. var self=this;
  7987. return smalltalk.withContext(function($ctx1) {
  7988. var $1;
  7989. $1=_st(self._class())._collectionClass();
  7990. return $1;
  7991. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  7992. args: [],
  7993. source: "collectionClass\x0a\x09^ self class collectionClass",
  7994. messageSends: ["collectionClass", "class"],
  7995. referencedClasses: []
  7996. }),
  7997. smalltalk.StreamTest);
  7998. smalltalk.addMethod(
  7999. smalltalk.method({
  8000. selector: "newCollection",
  8001. protocol: 'accessing',
  8002. fn: function (){
  8003. var self=this;
  8004. return smalltalk.withContext(function($ctx1) {
  8005. var $1;
  8006. $1=_st(self._collectionClass())._new();
  8007. return $1;
  8008. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  8009. args: [],
  8010. source: "newCollection\x0a\x09^ self collectionClass new",
  8011. messageSends: ["new", "collectionClass"],
  8012. referencedClasses: []
  8013. }),
  8014. smalltalk.StreamTest);
  8015. smalltalk.addMethod(
  8016. smalltalk.method({
  8017. selector: "newStream",
  8018. protocol: 'accessing',
  8019. fn: function (){
  8020. var self=this;
  8021. return smalltalk.withContext(function($ctx1) {
  8022. var $1;
  8023. $1=_st(_st(self._collectionClass())._new())._stream();
  8024. return $1;
  8025. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  8026. args: [],
  8027. source: "newStream\x0a\x09^ self collectionClass new stream",
  8028. messageSends: ["stream", "new", "collectionClass"],
  8029. referencedClasses: []
  8030. }),
  8031. smalltalk.StreamTest);
  8032. smalltalk.addMethod(
  8033. smalltalk.method({
  8034. selector: "testAtStartAtEnd",
  8035. protocol: 'tests',
  8036. fn: function (){
  8037. var self=this;
  8038. var stream;
  8039. return smalltalk.withContext(function($ctx1) {
  8040. var $1,$2,$3,$4;
  8041. stream=self._newStream();
  8042. $1=_st(stream)._atStart();
  8043. $ctx1.sendIdx["atStart"]=1;
  8044. self._assert_($1);
  8045. $ctx1.sendIdx["assert:"]=1;
  8046. $2=_st(stream)._atEnd();
  8047. $ctx1.sendIdx["atEnd"]=1;
  8048. self._assert_($2);
  8049. $ctx1.sendIdx["assert:"]=2;
  8050. _st(stream)._nextPutAll_(self._newCollection());
  8051. $3=_st(stream)._atEnd();
  8052. $ctx1.sendIdx["atEnd"]=2;
  8053. self._assert_($3);
  8054. $4=_st(stream)._atStart();
  8055. $ctx1.sendIdx["atStart"]=2;
  8056. self._deny_($4);
  8057. $ctx1.sendIdx["deny:"]=1;
  8058. _st(stream)._position_((1));
  8059. self._deny_(_st(stream)._atEnd());
  8060. $ctx1.sendIdx["deny:"]=2;
  8061. self._deny_(_st(stream)._atStart());
  8062. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  8063. args: [],
  8064. 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",
  8065. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8066. referencedClasses: []
  8067. }),
  8068. smalltalk.StreamTest);
  8069. smalltalk.addMethod(
  8070. smalltalk.method({
  8071. selector: "testContents",
  8072. protocol: 'tests',
  8073. fn: function (){
  8074. var self=this;
  8075. var stream;
  8076. return smalltalk.withContext(function($ctx1) {
  8077. var $1,$2;
  8078. stream=self._newStream();
  8079. $1=stream;
  8080. $2=self._newCollection();
  8081. $ctx1.sendIdx["newCollection"]=1;
  8082. _st($1)._nextPutAll_($2);
  8083. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8084. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  8085. args: [],
  8086. 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",
  8087. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8088. referencedClasses: []
  8089. }),
  8090. smalltalk.StreamTest);
  8091. smalltalk.addMethod(
  8092. smalltalk.method({
  8093. selector: "testIsEmpty",
  8094. protocol: 'tests',
  8095. fn: function (){
  8096. var self=this;
  8097. var stream;
  8098. return smalltalk.withContext(function($ctx1) {
  8099. var $1;
  8100. stream=self._newStream();
  8101. $1=_st(stream)._isEmpty();
  8102. $ctx1.sendIdx["isEmpty"]=1;
  8103. self._assert_($1);
  8104. _st(stream)._nextPutAll_(self._newCollection());
  8105. self._deny_(_st(stream)._isEmpty());
  8106. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  8107. args: [],
  8108. 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",
  8109. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8110. referencedClasses: []
  8111. }),
  8112. smalltalk.StreamTest);
  8113. smalltalk.addMethod(
  8114. smalltalk.method({
  8115. selector: "testPosition",
  8116. protocol: 'tests',
  8117. fn: function (){
  8118. var self=this;
  8119. var collection,stream;
  8120. return smalltalk.withContext(function($ctx1) {
  8121. var $1,$2,$3;
  8122. collection=self._newCollection();
  8123. stream=self._newStream();
  8124. _st(stream)._nextPutAll_(collection);
  8125. $1=_st(stream)._position();
  8126. $ctx1.sendIdx["position"]=1;
  8127. self._assert_equals_($1,_st(collection)._size());
  8128. $ctx1.sendIdx["assert:equals:"]=1;
  8129. _st(stream)._position_((0));
  8130. $2=_st(stream)._position();
  8131. $ctx1.sendIdx["position"]=2;
  8132. self._assert_equals_($2,(0));
  8133. $ctx1.sendIdx["assert:equals:"]=2;
  8134. _st(stream)._next();
  8135. $ctx1.sendIdx["next"]=1;
  8136. $3=_st(stream)._position();
  8137. $ctx1.sendIdx["position"]=3;
  8138. self._assert_equals_($3,(1));
  8139. $ctx1.sendIdx["assert:equals:"]=3;
  8140. _st(stream)._next();
  8141. self._assert_equals_(_st(stream)._position(),(2));
  8142. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  8143. args: [],
  8144. 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",
  8145. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8146. referencedClasses: []
  8147. }),
  8148. smalltalk.StreamTest);
  8149. smalltalk.addMethod(
  8150. smalltalk.method({
  8151. selector: "testReading",
  8152. protocol: 'tests',
  8153. fn: function (){
  8154. var self=this;
  8155. var stream,collection;
  8156. return smalltalk.withContext(function($ctx1) {
  8157. var $1,$2,$3;
  8158. collection=self._newCollection();
  8159. stream=self._newStream();
  8160. $1=stream;
  8161. _st($1)._nextPutAll_(collection);
  8162. $2=_st($1)._position_((0));
  8163. _st(collection)._do_((function(each){
  8164. return smalltalk.withContext(function($ctx2) {
  8165. $3=_st(stream)._next();
  8166. $ctx2.sendIdx["next"]=1;
  8167. return self._assert_equals_($3,each);
  8168. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8169. self._assert_(_st(_st(stream)._next())._isNil());
  8170. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8171. args: [],
  8172. 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",
  8173. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8174. referencedClasses: []
  8175. }),
  8176. smalltalk.StreamTest);
  8177. smalltalk.addMethod(
  8178. smalltalk.method({
  8179. selector: "testStreamContents",
  8180. protocol: 'tests',
  8181. fn: function (){
  8182. var self=this;
  8183. return smalltalk.withContext(function($ctx1) {
  8184. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  8185. args: [],
  8186. source: "testStreamContents",
  8187. messageSends: [],
  8188. referencedClasses: []
  8189. }),
  8190. smalltalk.StreamTest);
  8191. smalltalk.addMethod(
  8192. smalltalk.method({
  8193. selector: "testWrite",
  8194. protocol: 'tests',
  8195. fn: function (){
  8196. var self=this;
  8197. var stream,collection;
  8198. return smalltalk.withContext(function($ctx1) {
  8199. collection=self._newCollection();
  8200. stream=self._newStream();
  8201. _st(collection)._do_((function(each){
  8202. return smalltalk.withContext(function($ctx2) {
  8203. return _st(stream).__lt_lt(each);
  8204. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8205. self._assert_equals_(_st(stream)._contents(),collection);
  8206. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8207. args: [],
  8208. 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",
  8209. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8210. referencedClasses: []
  8211. }),
  8212. smalltalk.StreamTest);
  8213. smalltalk.addMethod(
  8214. smalltalk.method({
  8215. selector: "testWriting",
  8216. protocol: 'tests',
  8217. fn: function (){
  8218. var self=this;
  8219. var stream,collection;
  8220. return smalltalk.withContext(function($ctx1) {
  8221. var $1;
  8222. collection=self._newCollection();
  8223. stream=self._newStream();
  8224. $ctx1.sendIdx["newStream"]=1;
  8225. _st(collection)._do_((function(each){
  8226. return smalltalk.withContext(function($ctx2) {
  8227. return _st(stream)._nextPut_(each);
  8228. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8229. $1=_st(stream)._contents();
  8230. $ctx1.sendIdx["contents"]=1;
  8231. self._assert_equals_($1,collection);
  8232. $ctx1.sendIdx["assert:equals:"]=1;
  8233. stream=self._newStream();
  8234. _st(stream)._nextPutAll_(collection);
  8235. self._assert_equals_(_st(stream)._contents(),collection);
  8236. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  8237. args: [],
  8238. 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",
  8239. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8240. referencedClasses: []
  8241. }),
  8242. smalltalk.StreamTest);
  8243. smalltalk.addMethod(
  8244. smalltalk.method({
  8245. selector: "collectionClass",
  8246. protocol: 'accessing',
  8247. fn: function (){
  8248. var self=this;
  8249. return smalltalk.withContext(function($ctx1) {
  8250. return nil;
  8251. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  8252. args: [],
  8253. source: "collectionClass\x0a\x09^ nil",
  8254. messageSends: [],
  8255. referencedClasses: []
  8256. }),
  8257. smalltalk.StreamTest.klass);
  8258. smalltalk.addMethod(
  8259. smalltalk.method({
  8260. selector: "isAbstract",
  8261. protocol: 'testing',
  8262. fn: function (){
  8263. var self=this;
  8264. return smalltalk.withContext(function($ctx1) {
  8265. var $1;
  8266. $1=_st(self._collectionClass())._isNil();
  8267. return $1;
  8268. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  8269. args: [],
  8270. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8271. messageSends: ["isNil", "collectionClass"],
  8272. referencedClasses: []
  8273. }),
  8274. smalltalk.StreamTest.klass);
  8275. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8276. smalltalk.addMethod(
  8277. smalltalk.method({
  8278. selector: "newCollection",
  8279. protocol: 'accessing',
  8280. fn: function (){
  8281. var self=this;
  8282. return smalltalk.withContext(function($ctx1) {
  8283. var $1;
  8284. $1=[true,(1),(3).__at((4)),"foo"];
  8285. return $1;
  8286. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  8287. args: [],
  8288. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8289. messageSends: ["@"],
  8290. referencedClasses: []
  8291. }),
  8292. smalltalk.ArrayStreamTest);
  8293. smalltalk.addMethod(
  8294. smalltalk.method({
  8295. selector: "collectionClass",
  8296. protocol: 'accessing',
  8297. fn: function (){
  8298. var self=this;
  8299. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  8300. return smalltalk.withContext(function($ctx1) {
  8301. return $Array();
  8302. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  8303. args: [],
  8304. source: "collectionClass\x0a\x09^ Array",
  8305. messageSends: [],
  8306. referencedClasses: ["Array"]
  8307. }),
  8308. smalltalk.ArrayStreamTest.klass);
  8309. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  8310. smalltalk.addMethod(
  8311. smalltalk.method({
  8312. selector: "newCollection",
  8313. protocol: 'accessing',
  8314. fn: function (){
  8315. var self=this;
  8316. return smalltalk.withContext(function($ctx1) {
  8317. return "hello world";
  8318. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  8319. args: [],
  8320. source: "newCollection\x0a\x09^ 'hello world'",
  8321. messageSends: [],
  8322. referencedClasses: []
  8323. }),
  8324. smalltalk.StringStreamTest);
  8325. smalltalk.addMethod(
  8326. smalltalk.method({
  8327. selector: "collectionClass",
  8328. protocol: 'accessing',
  8329. fn: function (){
  8330. var self=this;
  8331. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  8332. return smalltalk.withContext(function($ctx1) {
  8333. return $String();
  8334. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  8335. args: [],
  8336. source: "collectionClass\x0a\x09^ String",
  8337. messageSends: [],
  8338. referencedClasses: ["String"]
  8339. }),
  8340. smalltalk.StringStreamTest.klass);
  8341. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  8342. smalltalk.addMethod(
  8343. smalltalk.method({
  8344. selector: "testCopying",
  8345. protocol: 'tests',
  8346. fn: function (){
  8347. var self=this;
  8348. return smalltalk.withContext(function($ctx1) {
  8349. self._assert_equals_(nil._copy(),nil);
  8350. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  8351. args: [],
  8352. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8353. messageSends: ["assert:equals:", "copy"],
  8354. referencedClasses: []
  8355. }),
  8356. smalltalk.UndefinedTest);
  8357. smalltalk.addMethod(
  8358. smalltalk.method({
  8359. selector: "testDeepCopy",
  8360. protocol: 'tests',
  8361. fn: function (){
  8362. var self=this;
  8363. return smalltalk.withContext(function($ctx1) {
  8364. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8365. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  8366. args: [],
  8367. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8368. messageSends: ["assert:", "=", "deepCopy"],
  8369. referencedClasses: []
  8370. }),
  8371. smalltalk.UndefinedTest);
  8372. smalltalk.addMethod(
  8373. smalltalk.method({
  8374. selector: "testIfNil",
  8375. protocol: 'tests',
  8376. fn: function (){
  8377. var self=this;
  8378. return smalltalk.withContext(function($ctx1) {
  8379. var $1,$3,$2,$4,$6,$5;
  8380. if(($receiver = nil) == nil || $receiver == null){
  8381. $1=true;
  8382. } else {
  8383. $1=nil;
  8384. };
  8385. self._assert_equals_($1,true);
  8386. $ctx1.sendIdx["assert:equals:"]=1;
  8387. if(($receiver = nil) == nil || $receiver == null){
  8388. $3=nil;
  8389. } else {
  8390. $3=true;
  8391. };
  8392. $2=_st($3).__eq(true);
  8393. $ctx1.sendIdx["="]=1;
  8394. self._deny_($2);
  8395. $ctx1.sendIdx["deny:"]=1;
  8396. if(($receiver = nil) == nil || $receiver == null){
  8397. $4=true;
  8398. } else {
  8399. $4=false;
  8400. };
  8401. self._assert_equals_($4,true);
  8402. if(($receiver = nil) == nil || $receiver == null){
  8403. $6=false;
  8404. } else {
  8405. $6=true;
  8406. };
  8407. $5=_st($6).__eq(true);
  8408. self._deny_($5);
  8409. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  8410. args: [],
  8411. 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",
  8412. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8413. referencedClasses: []
  8414. }),
  8415. smalltalk.UndefinedTest);
  8416. smalltalk.addMethod(
  8417. smalltalk.method({
  8418. selector: "testIsNil",
  8419. protocol: 'tests',
  8420. fn: function (){
  8421. var self=this;
  8422. return smalltalk.withContext(function($ctx1) {
  8423. self._assert_(nil._isNil());
  8424. self._deny_(nil._notNil());
  8425. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  8426. args: [],
  8427. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8428. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8429. referencedClasses: []
  8430. }),
  8431. smalltalk.UndefinedTest);
  8432. });