Kernel-Tests.js 313 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330
  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.\x22\x0a\x0a\x09self subclassResponsibility",
  1298. messageSends: ["subclassResponsibility"],
  1299. referencedClasses: []
  1300. }),
  1301. smalltalk.CollectionTest);
  1302. smalltalk.addMethod(
  1303. smalltalk.method({
  1304. selector: "isCollectionReadOnly",
  1305. protocol: 'testing',
  1306. fn: function (){
  1307. var self=this;
  1308. return smalltalk.withContext(function($ctx1) {
  1309. return false;
  1310. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1311. args: [],
  1312. source: "isCollectionReadOnly\x0a\x09^ false",
  1313. messageSends: [],
  1314. referencedClasses: []
  1315. }),
  1316. smalltalk.CollectionTest);
  1317. smalltalk.addMethod(
  1318. smalltalk.method({
  1319. selector: "sampleNewValue",
  1320. protocol: 'fixture',
  1321. fn: function (){
  1322. var self=this;
  1323. return smalltalk.withContext(function($ctx1) {
  1324. return "N";
  1325. }, function($ctx1) {$ctx1.fill(self,"sampleNewValue",{},smalltalk.CollectionTest)})},
  1326. args: [],
  1327. 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'",
  1328. messageSends: [],
  1329. referencedClasses: []
  1330. }),
  1331. smalltalk.CollectionTest);
  1332. smalltalk.addMethod(
  1333. smalltalk.method({
  1334. selector: "sampleNewValueAsCollection",
  1335. protocol: 'fixture',
  1336. fn: function (){
  1337. var self=this;
  1338. return smalltalk.withContext(function($ctx1) {
  1339. var $1;
  1340. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1341. return $1;
  1342. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.CollectionTest)})},
  1343. args: [],
  1344. source: "sampleNewValueAsCollection\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection,\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  1345. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1346. referencedClasses: []
  1347. }),
  1348. smalltalk.CollectionTest);
  1349. smalltalk.addMethod(
  1350. smalltalk.method({
  1351. selector: "testAddAll",
  1352. protocol: 'tests',
  1353. fn: function (){
  1354. var self=this;
  1355. return smalltalk.withContext(function($ctx1) {
  1356. 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;
  1357. $2=self._collection();
  1358. $ctx1.sendIdx["collection"]=1;
  1359. $3=$2;
  1360. $5=self._collectionClass();
  1361. $ctx1.sendIdx["collectionClass"]=1;
  1362. $4=_st($5)._new();
  1363. $ctx1.sendIdx["new"]=1;
  1364. _st($3)._addAll_($4);
  1365. $ctx1.sendIdx["addAll:"]=1;
  1366. $6=_st($2)._yourself();
  1367. $ctx1.sendIdx["yourself"]=1;
  1368. $1=$6;
  1369. $7=self._collection();
  1370. $ctx1.sendIdx["collection"]=2;
  1371. self._assert_equals_($1,$7);
  1372. $ctx1.sendIdx["assert:equals:"]=1;
  1373. $10=self._collectionClass();
  1374. $ctx1.sendIdx["collectionClass"]=2;
  1375. $9=_st($10)._new();
  1376. $ctx1.sendIdx["new"]=2;
  1377. $11=$9;
  1378. $12=self._collection();
  1379. $ctx1.sendIdx["collection"]=3;
  1380. _st($11)._addAll_($12);
  1381. $ctx1.sendIdx["addAll:"]=2;
  1382. $13=_st($9)._yourself();
  1383. $ctx1.sendIdx["yourself"]=2;
  1384. $8=$13;
  1385. $14=self._collection();
  1386. $ctx1.sendIdx["collection"]=4;
  1387. self._assert_equals_($8,$14);
  1388. $ctx1.sendIdx["assert:equals:"]=2;
  1389. $17=self._collectionClass();
  1390. $ctx1.sendIdx["collectionClass"]=3;
  1391. $16=_st($17)._new();
  1392. $ctx1.sendIdx["new"]=3;
  1393. $18=$16;
  1394. $20=self._collectionClass();
  1395. $ctx1.sendIdx["collectionClass"]=4;
  1396. $19=_st($20)._new();
  1397. $ctx1.sendIdx["new"]=4;
  1398. _st($18)._addAll_($19);
  1399. $ctx1.sendIdx["addAll:"]=3;
  1400. $21=_st($16)._yourself();
  1401. $ctx1.sendIdx["yourself"]=3;
  1402. $15=$21;
  1403. self._assert_equals_($15,_st(self._collectionClass())._new());
  1404. $ctx1.sendIdx["assert:equals:"]=3;
  1405. $23=self._collection();
  1406. $ctx1.sendIdx["collection"]=5;
  1407. $24=$23;
  1408. $25=self._sampleNewValueAsCollection();
  1409. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1410. _st($24)._addAll_($25);
  1411. $ctx1.sendIdx["addAll:"]=4;
  1412. $26=_st($23)._yourself();
  1413. $ctx1.sendIdx["yourself"]=4;
  1414. $22=$26;
  1415. $27=self._collectionWithNewValue();
  1416. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1417. self._assert_equals_($22,$27);
  1418. $28=self._sampleNewValueAsCollection();
  1419. _st($28)._addAll_(self._collection());
  1420. $29=_st($28)._yourself();
  1421. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1422. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.CollectionTest)})},
  1423. args: [],
  1424. 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",
  1425. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1426. referencedClasses: []
  1427. }),
  1428. smalltalk.CollectionTest);
  1429. smalltalk.addMethod(
  1430. smalltalk.method({
  1431. selector: "testAllSatisfy",
  1432. protocol: 'tests',
  1433. fn: function (){
  1434. var self=this;
  1435. var collection,anyOne;
  1436. return smalltalk.withContext(function($ctx1) {
  1437. var $1;
  1438. collection=self._collection();
  1439. anyOne=_st(collection)._anyOne();
  1440. $1=_st(collection)._allSatisfy_((function(each){
  1441. return smalltalk.withContext(function($ctx2) {
  1442. return _st(collection)._includes_(each);
  1443. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1444. $ctx1.sendIdx["allSatisfy:"]=1;
  1445. self._assert_($1);
  1446. self._deny_(_st(collection)._allSatisfy_((function(each){
  1447. return smalltalk.withContext(function($ctx2) {
  1448. return _st(each).__tild_eq(anyOne);
  1449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1450. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1451. args: [],
  1452. 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 ])",
  1453. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1454. referencedClasses: []
  1455. }),
  1456. smalltalk.CollectionTest);
  1457. smalltalk.addMethod(
  1458. smalltalk.method({
  1459. selector: "testAnyOne",
  1460. protocol: 'tests',
  1461. fn: function (){
  1462. var self=this;
  1463. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1464. return smalltalk.withContext(function($ctx1) {
  1465. var $2,$1;
  1466. self._should_raise_((function(){
  1467. return smalltalk.withContext(function($ctx2) {
  1468. return _st(_st(self._collectionClass())._new())._anyOne();
  1469. $ctx2.sendIdx["anyOne"]=1;
  1470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1471. $2=self._collection();
  1472. $ctx1.sendIdx["collection"]=1;
  1473. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1474. self._assert_($1);
  1475. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1476. args: [],
  1477. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1478. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1479. referencedClasses: ["Error"]
  1480. }),
  1481. smalltalk.CollectionTest);
  1482. smalltalk.addMethod(
  1483. smalltalk.method({
  1484. selector: "testAnySatisfy",
  1485. protocol: 'tests',
  1486. fn: function (){
  1487. var self=this;
  1488. var anyOne;
  1489. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1490. return smalltalk.withContext(function($ctx1) {
  1491. var $1,$3,$2;
  1492. $1=self._collection();
  1493. $ctx1.sendIdx["collection"]=1;
  1494. anyOne=_st($1)._anyOne();
  1495. $3=self._collection();
  1496. $ctx1.sendIdx["collection"]=2;
  1497. $2=_st($3)._anySatisfy_((function(each){
  1498. return smalltalk.withContext(function($ctx2) {
  1499. return _st(each).__eq(anyOne);
  1500. $ctx2.sendIdx["="]=1;
  1501. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1502. $ctx1.sendIdx["anySatisfy:"]=1;
  1503. self._assert_($2);
  1504. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1505. return smalltalk.withContext(function($ctx2) {
  1506. return _st(each).__eq(_st($Object())._new());
  1507. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1508. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1509. args: [],
  1510. 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 ])",
  1511. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1512. referencedClasses: ["Object"]
  1513. }),
  1514. smalltalk.CollectionTest);
  1515. smalltalk.addMethod(
  1516. smalltalk.method({
  1517. selector: "testAsArray",
  1518. protocol: 'tests',
  1519. fn: function (){
  1520. var self=this;
  1521. return smalltalk.withContext(function($ctx1) {
  1522. var $1;
  1523. $1=self._collection();
  1524. $ctx1.sendIdx["collection"]=1;
  1525. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1526. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1527. args: [],
  1528. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1529. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1530. referencedClasses: []
  1531. }),
  1532. smalltalk.CollectionTest);
  1533. smalltalk.addMethod(
  1534. smalltalk.method({
  1535. selector: "testAsOrderedCollection",
  1536. protocol: 'tests',
  1537. fn: function (){
  1538. var self=this;
  1539. return smalltalk.withContext(function($ctx1) {
  1540. var $1;
  1541. $1=self._collection();
  1542. $ctx1.sendIdx["collection"]=1;
  1543. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1544. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1545. args: [],
  1546. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1547. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1548. referencedClasses: []
  1549. }),
  1550. smalltalk.CollectionTest);
  1551. smalltalk.addMethod(
  1552. smalltalk.method({
  1553. selector: "testAsSet",
  1554. protocol: 'tests',
  1555. fn: function (){
  1556. var self=this;
  1557. var c,set;
  1558. return smalltalk.withContext(function($ctx1) {
  1559. c=self._collectionWithDuplicates();
  1560. set=_st(c)._asSet();
  1561. self._assert_equals_(_st(set)._size(),(5));
  1562. _st(c)._do_((function(each){
  1563. return smalltalk.withContext(function($ctx2) {
  1564. return self._assert_(_st(set)._includes_(each));
  1565. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1566. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1567. args: [],
  1568. 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) ]",
  1569. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1570. referencedClasses: []
  1571. }),
  1572. smalltalk.CollectionTest);
  1573. smalltalk.addMethod(
  1574. smalltalk.method({
  1575. selector: "testCollect",
  1576. protocol: 'tests',
  1577. fn: function (){
  1578. var self=this;
  1579. return smalltalk.withContext(function($ctx1) {
  1580. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1581. $2=self._collection();
  1582. $ctx1.sendIdx["collection"]=1;
  1583. $1=_st($2)._collect_((function(each){
  1584. return smalltalk.withContext(function($ctx2) {
  1585. return each;
  1586. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1587. $ctx1.sendIdx["collect:"]=1;
  1588. $3=self._collection();
  1589. $ctx1.sendIdx["collection"]=2;
  1590. self._assert_equals_($1,$3);
  1591. $ctx1.sendIdx["assert:equals:"]=1;
  1592. $5=self._collectionWithNewValue();
  1593. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1594. $4=_st($5)._collect_((function(each){
  1595. return smalltalk.withContext(function($ctx2) {
  1596. return each;
  1597. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1598. $ctx1.sendIdx["collect:"]=2;
  1599. self._assert_equals_($4,self._collectionWithNewValue());
  1600. $ctx1.sendIdx["assert:equals:"]=2;
  1601. $8=self._collectionClass();
  1602. $ctx1.sendIdx["collectionClass"]=1;
  1603. $7=_st($8)._new();
  1604. $ctx1.sendIdx["new"]=1;
  1605. $6=_st($7)._collect_((function(each){
  1606. return smalltalk.withContext(function($ctx2) {
  1607. return _st(each)._printString();
  1608. $ctx2.sendIdx["printString"]=1;
  1609. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1610. $ctx1.sendIdx["collect:"]=3;
  1611. self._assert_equals_($6,_st(self._collectionClass())._new());
  1612. $ctx1.sendIdx["assert:equals:"]=3;
  1613. $11=self._collection();
  1614. $ctx1.sendIdx["collection"]=3;
  1615. $10=_st($11)._collect_((function(){
  1616. return smalltalk.withContext(function($ctx2) {
  1617. return self._sampleNewValue();
  1618. $ctx2.sendIdx["sampleNewValue"]=1;
  1619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1620. $ctx1.sendIdx["collect:"]=4;
  1621. $9=_st($10)._detect_((function(){
  1622. return smalltalk.withContext(function($ctx2) {
  1623. return true;
  1624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1625. self._assert_equals_($9,self._sampleNewValue());
  1626. $ctx1.sendIdx["assert:equals:"]=4;
  1627. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1628. return smalltalk.withContext(function($ctx2) {
  1629. return _st(each)._printString();
  1630. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1631. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.CollectionTest)})},
  1632. args: [],
  1633. 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",
  1634. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1635. referencedClasses: []
  1636. }),
  1637. smalltalk.CollectionTest);
  1638. smalltalk.addMethod(
  1639. smalltalk.method({
  1640. selector: "testComma",
  1641. protocol: 'tests',
  1642. fn: function (){
  1643. var self=this;
  1644. return smalltalk.withContext(function($ctx1) {
  1645. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1646. $2=self._collection();
  1647. $ctx1.sendIdx["collection"]=1;
  1648. $4=self._collectionClass();
  1649. $ctx1.sendIdx["collectionClass"]=1;
  1650. $3=_st($4)._new();
  1651. $ctx1.sendIdx["new"]=1;
  1652. $1=_st($2).__comma($3);
  1653. $ctx1.sendIdx[","]=1;
  1654. $5=self._collection();
  1655. $ctx1.sendIdx["collection"]=2;
  1656. self._assert_equals_($1,$5);
  1657. $ctx1.sendIdx["assert:equals:"]=1;
  1658. $8=self._collectionClass();
  1659. $ctx1.sendIdx["collectionClass"]=2;
  1660. $7=_st($8)._new();
  1661. $ctx1.sendIdx["new"]=2;
  1662. $9=self._collection();
  1663. $ctx1.sendIdx["collection"]=3;
  1664. $6=_st($7).__comma($9);
  1665. $ctx1.sendIdx[","]=2;
  1666. $10=self._collection();
  1667. $ctx1.sendIdx["collection"]=4;
  1668. self._assert_equals_($6,$10);
  1669. $ctx1.sendIdx["assert:equals:"]=2;
  1670. $13=self._collectionClass();
  1671. $ctx1.sendIdx["collectionClass"]=3;
  1672. $12=_st($13)._new();
  1673. $ctx1.sendIdx["new"]=3;
  1674. $15=self._collectionClass();
  1675. $ctx1.sendIdx["collectionClass"]=4;
  1676. $14=_st($15)._new();
  1677. $ctx1.sendIdx["new"]=4;
  1678. $11=_st($12).__comma($14);
  1679. $ctx1.sendIdx[","]=3;
  1680. self._assert_equals_($11,_st(self._collectionClass())._new());
  1681. $ctx1.sendIdx["assert:equals:"]=3;
  1682. $17=self._collection();
  1683. $ctx1.sendIdx["collection"]=5;
  1684. $18=self._sampleNewValueAsCollection();
  1685. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1686. $16=_st($17).__comma($18);
  1687. $ctx1.sendIdx[","]=4;
  1688. $19=self._collectionWithNewValue();
  1689. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1690. self._assert_equals_($16,$19);
  1691. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1692. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.CollectionTest)})},
  1693. args: [],
  1694. 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",
  1695. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1696. referencedClasses: []
  1697. }),
  1698. smalltalk.CollectionTest);
  1699. smalltalk.addMethod(
  1700. smalltalk.method({
  1701. selector: "testDetect",
  1702. protocol: 'tests',
  1703. fn: function (){
  1704. var self=this;
  1705. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1706. return smalltalk.withContext(function($ctx1) {
  1707. var $1,$2,$3,$4,$6,$5,$7;
  1708. self._shouldnt_raise_((function(){
  1709. return smalltalk.withContext(function($ctx2) {
  1710. $1=self._collection();
  1711. $ctx2.sendIdx["collection"]=1;
  1712. return _st($1)._detect_((function(){
  1713. return smalltalk.withContext(function($ctx3) {
  1714. return true;
  1715. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1716. $ctx2.sendIdx["detect:"]=1;
  1717. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1718. self._should_raise_((function(){
  1719. return smalltalk.withContext(function($ctx2) {
  1720. $2=self._collection();
  1721. $ctx2.sendIdx["collection"]=2;
  1722. return _st($2)._detect_((function(){
  1723. return smalltalk.withContext(function($ctx3) {
  1724. return false;
  1725. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  1726. $ctx2.sendIdx["detect:"]=2;
  1727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1728. $ctx1.sendIdx["should:raise:"]=1;
  1729. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1730. return smalltalk.withContext(function($ctx2) {
  1731. return true;
  1732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1733. $ctx1.sendIdx["detect:"]=3;
  1734. $4=self._sampleNewValue();
  1735. $ctx1.sendIdx["sampleNewValue"]=1;
  1736. self._assert_equals_($3,$4);
  1737. $ctx1.sendIdx["assert:equals:"]=1;
  1738. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1739. return smalltalk.withContext(function($ctx2) {
  1740. $6=self._sampleNewValue();
  1741. $ctx2.sendIdx["sampleNewValue"]=2;
  1742. return _st(each).__eq($6);
  1743. $ctx2.sendIdx["="]=1;
  1744. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1745. $ctx1.sendIdx["detect:"]=4;
  1746. $7=self._sampleNewValue();
  1747. $ctx1.sendIdx["sampleNewValue"]=3;
  1748. self._assert_equals_($5,$7);
  1749. self._should_raise_((function(){
  1750. return smalltalk.withContext(function($ctx2) {
  1751. return _st(self._collection())._detect_((function(each){
  1752. return smalltalk.withContext(function($ctx3) {
  1753. return _st(each).__eq(self._sampleNewValue());
  1754. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1755. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1756. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1757. args: [],
  1758. 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",
  1759. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1760. referencedClasses: ["Error"]
  1761. }),
  1762. smalltalk.CollectionTest);
  1763. smalltalk.addMethod(
  1764. smalltalk.method({
  1765. selector: "testDo",
  1766. protocol: 'tests',
  1767. fn: function (){
  1768. var self=this;
  1769. var newCollection;
  1770. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1771. return smalltalk.withContext(function($ctx1) {
  1772. var $1,$2;
  1773. newCollection=_st($OrderedCollection())._new();
  1774. $ctx1.sendIdx["new"]=1;
  1775. $1=self._collection();
  1776. $ctx1.sendIdx["collection"]=1;
  1777. _st($1)._do_((function(each){
  1778. return smalltalk.withContext(function($ctx2) {
  1779. return _st(newCollection)._add_(each);
  1780. $ctx2.sendIdx["add:"]=1;
  1781. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1782. $ctx1.sendIdx["do:"]=1;
  1783. self._assertSameContents_as_(self._collection(),newCollection);
  1784. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1785. newCollection=_st($OrderedCollection())._new();
  1786. $2=self._collectionWithDuplicates();
  1787. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1788. _st($2)._do_((function(each){
  1789. return smalltalk.withContext(function($ctx2) {
  1790. return _st(newCollection)._add_(each);
  1791. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1792. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1793. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1794. args: [],
  1795. 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",
  1796. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1797. referencedClasses: ["OrderedCollection"]
  1798. }),
  1799. smalltalk.CollectionTest);
  1800. smalltalk.addMethod(
  1801. smalltalk.method({
  1802. selector: "testIfEmptyFamily",
  1803. protocol: 'tests',
  1804. fn: function (){
  1805. var self=this;
  1806. return smalltalk.withContext(function($ctx1) {
  1807. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1808. $3=self._collectionClass();
  1809. $ctx1.sendIdx["collectionClass"]=1;
  1810. $2=_st($3)._new();
  1811. $ctx1.sendIdx["new"]=1;
  1812. $1=_st($2)._ifEmpty_((function(){
  1813. return smalltalk.withContext(function($ctx2) {
  1814. return (42);
  1815. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1816. $ctx1.sendIdx["ifEmpty:"]=1;
  1817. self._assert_equals_($1,(42));
  1818. $ctx1.sendIdx["assert:equals:"]=1;
  1819. $5=self._collection();
  1820. $ctx1.sendIdx["collection"]=1;
  1821. $4=_st($5)._ifEmpty_((function(){
  1822. return smalltalk.withContext(function($ctx2) {
  1823. return (42);
  1824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1825. $6=self._collection();
  1826. $ctx1.sendIdx["collection"]=2;
  1827. self._assert_equals_($4,$6);
  1828. $ctx1.sendIdx["assert:equals:"]=2;
  1829. $9=self._collectionClass();
  1830. $ctx1.sendIdx["collectionClass"]=2;
  1831. $8=_st($9)._new();
  1832. $ctx1.sendIdx["new"]=2;
  1833. $7=_st($8)._ifNotEmpty_((function(){
  1834. return smalltalk.withContext(function($ctx2) {
  1835. return (42);
  1836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1837. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1838. $11=self._collectionClass();
  1839. $ctx1.sendIdx["collectionClass"]=3;
  1840. $10=_st($11)._new();
  1841. $ctx1.sendIdx["new"]=3;
  1842. self._assert_equals_($7,$10);
  1843. $ctx1.sendIdx["assert:equals:"]=3;
  1844. $13=self._collection();
  1845. $ctx1.sendIdx["collection"]=3;
  1846. $12=_st($13)._ifNotEmpty_((function(){
  1847. return smalltalk.withContext(function($ctx2) {
  1848. return (42);
  1849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1850. self._assert_equals_($12,(42));
  1851. $ctx1.sendIdx["assert:equals:"]=4;
  1852. $16=self._collectionClass();
  1853. $ctx1.sendIdx["collectionClass"]=4;
  1854. $15=_st($16)._new();
  1855. $ctx1.sendIdx["new"]=4;
  1856. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1857. return smalltalk.withContext(function($ctx2) {
  1858. return (42);
  1859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1860. return smalltalk.withContext(function($ctx2) {
  1861. return (999);
  1862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1863. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1864. self._assert_equals_($14,(42));
  1865. $ctx1.sendIdx["assert:equals:"]=5;
  1866. $18=self._collection();
  1867. $ctx1.sendIdx["collection"]=4;
  1868. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1869. return smalltalk.withContext(function($ctx2) {
  1870. return (42);
  1871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1872. return smalltalk.withContext(function($ctx2) {
  1873. return (999);
  1874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1875. self._assert_equals_($17,(999));
  1876. $ctx1.sendIdx["assert:equals:"]=6;
  1877. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1878. return smalltalk.withContext(function($ctx2) {
  1879. return (42);
  1880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1881. return smalltalk.withContext(function($ctx2) {
  1882. return (999);
  1883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1884. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1885. self._assert_equals_($19,(999));
  1886. $ctx1.sendIdx["assert:equals:"]=7;
  1887. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1888. return smalltalk.withContext(function($ctx2) {
  1889. return (42);
  1890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1891. return smalltalk.withContext(function($ctx2) {
  1892. return (999);
  1893. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1894. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1895. args: [],
  1896. 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",
  1897. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1898. referencedClasses: []
  1899. }),
  1900. smalltalk.CollectionTest);
  1901. smalltalk.addMethod(
  1902. smalltalk.method({
  1903. selector: "testIsEmpty",
  1904. protocol: 'tests',
  1905. fn: function (){
  1906. var self=this;
  1907. return smalltalk.withContext(function($ctx1) {
  1908. var $1;
  1909. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1910. $ctx1.sendIdx["isEmpty"]=1;
  1911. self._assert_($1);
  1912. self._deny_(_st(self._collection())._isEmpty());
  1913. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1914. args: [],
  1915. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1916. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1917. referencedClasses: []
  1918. }),
  1919. smalltalk.CollectionTest);
  1920. smalltalk.addMethod(
  1921. smalltalk.method({
  1922. selector: "testNoneSatisfy",
  1923. protocol: 'tests',
  1924. fn: function (){
  1925. var self=this;
  1926. var anyOne;
  1927. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1928. return smalltalk.withContext(function($ctx1) {
  1929. var $1,$3,$2;
  1930. $1=self._collection();
  1931. $ctx1.sendIdx["collection"]=1;
  1932. anyOne=_st($1)._anyOne();
  1933. $3=self._collection();
  1934. $ctx1.sendIdx["collection"]=2;
  1935. $2=_st($3)._noneSatisfy_((function(each){
  1936. return smalltalk.withContext(function($ctx2) {
  1937. return _st(each).__eq(anyOne);
  1938. $ctx2.sendIdx["="]=1;
  1939. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1940. $ctx1.sendIdx["noneSatisfy:"]=1;
  1941. self._deny_($2);
  1942. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  1943. return smalltalk.withContext(function($ctx2) {
  1944. return _st(each).__eq(_st($Object())._new());
  1945. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1946. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1947. args: [],
  1948. 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 ])",
  1949. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  1950. referencedClasses: ["Object"]
  1951. }),
  1952. smalltalk.CollectionTest);
  1953. smalltalk.addMethod(
  1954. smalltalk.method({
  1955. selector: "testRemoveAll",
  1956. protocol: 'tests',
  1957. fn: function (){
  1958. var self=this;
  1959. return smalltalk.withContext(function($ctx1) {
  1960. var $1,$2;
  1961. $1=self._collection();
  1962. _st($1)._removeAll();
  1963. $2=_st($1)._yourself();
  1964. self._assert_equals_($2,_st(self._collectionClass())._new());
  1965. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  1966. args: [],
  1967. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  1968. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  1969. referencedClasses: []
  1970. }),
  1971. smalltalk.CollectionTest);
  1972. smalltalk.addMethod(
  1973. smalltalk.method({
  1974. selector: "testSelect",
  1975. protocol: 'tests',
  1976. fn: function (){
  1977. var self=this;
  1978. return smalltalk.withContext(function($ctx1) {
  1979. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  1980. $2=self._collection();
  1981. $ctx1.sendIdx["collection"]=1;
  1982. $1=_st($2)._select_((function(){
  1983. return smalltalk.withContext(function($ctx2) {
  1984. return false;
  1985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1986. $ctx1.sendIdx["select:"]=1;
  1987. $4=self._collectionClass();
  1988. $ctx1.sendIdx["collectionClass"]=1;
  1989. $3=_st($4)._new();
  1990. $ctx1.sendIdx["new"]=1;
  1991. self._assert_equals_($1,$3);
  1992. $ctx1.sendIdx["assert:equals:"]=1;
  1993. $6=self._collection();
  1994. $ctx1.sendIdx["collection"]=2;
  1995. $5=_st($6)._select_((function(){
  1996. return smalltalk.withContext(function($ctx2) {
  1997. return true;
  1998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1999. $ctx1.sendIdx["select:"]=2;
  2000. $7=self._collection();
  2001. $ctx1.sendIdx["collection"]=3;
  2002. self._assert_equals_($5,$7);
  2003. $ctx1.sendIdx["assert:equals:"]=2;
  2004. $9=self._collectionWithNewValue();
  2005. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2006. $8=_st($9)._select_((function(each){
  2007. return smalltalk.withContext(function($ctx2) {
  2008. $10=self._sampleNewValue();
  2009. $ctx2.sendIdx["sampleNewValue"]=1;
  2010. return _st(each).__eq($10);
  2011. $ctx2.sendIdx["="]=1;
  2012. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2013. $ctx1.sendIdx["select:"]=3;
  2014. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2015. $ctx1.sendIdx["assert:equals:"]=3;
  2016. $12=self._collectionWithNewValue();
  2017. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2018. $11=_st($12)._select_((function(each){
  2019. return smalltalk.withContext(function($ctx2) {
  2020. $13=self._sampleNewValue();
  2021. $ctx2.sendIdx["sampleNewValue"]=2;
  2022. return _st(each).__tild_eq($13);
  2023. $ctx2.sendIdx["~="]=1;
  2024. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2025. $ctx1.sendIdx["select:"]=4;
  2026. $14=self._collection();
  2027. $ctx1.sendIdx["collection"]=4;
  2028. self._assert_equals_($11,$14);
  2029. $ctx1.sendIdx["assert:equals:"]=4;
  2030. $16=self._collection();
  2031. $ctx1.sendIdx["collection"]=5;
  2032. $15=_st($16)._select_((function(each){
  2033. return smalltalk.withContext(function($ctx2) {
  2034. $17=self._sampleNewValue();
  2035. $ctx2.sendIdx["sampleNewValue"]=3;
  2036. return _st(each).__eq($17);
  2037. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2038. $ctx1.sendIdx["select:"]=5;
  2039. self._assert_equals_($15,_st(self._collectionClass())._new());
  2040. $ctx1.sendIdx["assert:equals:"]=5;
  2041. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2042. return smalltalk.withContext(function($ctx2) {
  2043. return _st(each).__tild_eq(self._sampleNewValue());
  2044. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2045. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},smalltalk.CollectionTest)})},
  2046. args: [],
  2047. 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",
  2048. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2049. referencedClasses: []
  2050. }),
  2051. smalltalk.CollectionTest);
  2052. smalltalk.addMethod(
  2053. smalltalk.method({
  2054. selector: "testSize",
  2055. protocol: 'tests',
  2056. fn: function (){
  2057. var self=this;
  2058. return smalltalk.withContext(function($ctx1) {
  2059. var $1,$2;
  2060. $1=_st(_st(self._collectionClass())._new())._size();
  2061. $ctx1.sendIdx["size"]=1;
  2062. self._assert_equals_($1,(0));
  2063. $ctx1.sendIdx["assert:equals:"]=1;
  2064. $2=_st(self._sampleNewValueAsCollection())._size();
  2065. $ctx1.sendIdx["size"]=2;
  2066. self._assert_equals_($2,(1));
  2067. $ctx1.sendIdx["assert:equals:"]=2;
  2068. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2069. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  2070. args: [],
  2071. 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",
  2072. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2073. referencedClasses: []
  2074. }),
  2075. smalltalk.CollectionTest);
  2076. smalltalk.addMethod(
  2077. smalltalk.method({
  2078. selector: "collectionClass",
  2079. protocol: 'fixture',
  2080. fn: function (){
  2081. var self=this;
  2082. return smalltalk.withContext(function($ctx1) {
  2083. return nil;
  2084. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  2085. args: [],
  2086. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2087. messageSends: [],
  2088. referencedClasses: []
  2089. }),
  2090. smalltalk.CollectionTest.klass);
  2091. smalltalk.addMethod(
  2092. smalltalk.method({
  2093. selector: "isAbstract",
  2094. protocol: 'testing',
  2095. fn: function (){
  2096. var self=this;
  2097. return smalltalk.withContext(function($ctx1) {
  2098. var $1;
  2099. $1=_st(self._collectionClass())._isNil();
  2100. return $1;
  2101. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  2102. args: [],
  2103. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2104. messageSends: ["isNil", "collectionClass"],
  2105. referencedClasses: []
  2106. }),
  2107. smalltalk.CollectionTest.klass);
  2108. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  2109. smalltalk.addMethod(
  2110. smalltalk.method({
  2111. selector: "collectionWithNewValue",
  2112. protocol: 'fixture',
  2113. fn: function (){
  2114. var self=this;
  2115. return smalltalk.withContext(function($ctx1) {
  2116. self._subclassResponsibility();
  2117. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.IndexableCollectionTest)})},
  2118. args: [],
  2119. 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",
  2120. messageSends: ["subclassResponsibility"],
  2121. referencedClasses: []
  2122. }),
  2123. smalltalk.IndexableCollectionTest);
  2124. smalltalk.addMethod(
  2125. smalltalk.method({
  2126. selector: "sampleNewIndex",
  2127. protocol: 'fixture',
  2128. fn: function (){
  2129. var self=this;
  2130. return smalltalk.withContext(function($ctx1) {
  2131. self._subclassResponsibility();
  2132. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.IndexableCollectionTest)})},
  2133. args: [],
  2134. 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",
  2135. messageSends: ["subclassResponsibility"],
  2136. referencedClasses: []
  2137. }),
  2138. smalltalk.IndexableCollectionTest);
  2139. smalltalk.addMethod(
  2140. smalltalk.method({
  2141. selector: "sampleNonIndexesDo:",
  2142. protocol: 'fixture',
  2143. fn: function (aBlock){
  2144. var self=this;
  2145. return smalltalk.withContext(function($ctx1) {
  2146. self._subclassResponsibility();
  2147. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2148. args: ["aBlock"],
  2149. 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",
  2150. messageSends: ["subclassResponsibility"],
  2151. referencedClasses: []
  2152. }),
  2153. smalltalk.IndexableCollectionTest);
  2154. smalltalk.addMethod(
  2155. smalltalk.method({
  2156. selector: "samplesDo:",
  2157. protocol: 'fixture',
  2158. fn: function (aBlock){
  2159. var self=this;
  2160. return smalltalk.withContext(function($ctx1) {
  2161. self._subclassResponsibility();
  2162. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2163. args: ["aBlock"],
  2164. 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",
  2165. messageSends: ["subclassResponsibility"],
  2166. referencedClasses: []
  2167. }),
  2168. smalltalk.IndexableCollectionTest);
  2169. smalltalk.addMethod(
  2170. smalltalk.method({
  2171. selector: "testAt",
  2172. protocol: 'tests',
  2173. fn: function (){
  2174. var self=this;
  2175. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2176. return smalltalk.withContext(function($ctx1) {
  2177. var $1;
  2178. self._nonIndexesDo_((function(each){
  2179. return smalltalk.withContext(function($ctx2) {
  2180. return self._should_raise_((function(){
  2181. return smalltalk.withContext(function($ctx3) {
  2182. $1=self._collection();
  2183. $ctx3.sendIdx["collection"]=1;
  2184. return _st($1)._at_(each);
  2185. $ctx3.sendIdx["at:"]=1;
  2186. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2187. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2188. self._samplesDo_((function(index,value){
  2189. return smalltalk.withContext(function($ctx2) {
  2190. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2191. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2192. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  2193. args: [],
  2194. 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 ]",
  2195. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2196. referencedClasses: ["Error"]
  2197. }),
  2198. smalltalk.IndexableCollectionTest);
  2199. smalltalk.addMethod(
  2200. smalltalk.method({
  2201. selector: "testAtIfAbsent",
  2202. protocol: 'tests',
  2203. fn: function (){
  2204. var self=this;
  2205. return smalltalk.withContext(function($ctx1) {
  2206. var $2,$1,$3;
  2207. self._nonIndexesDo_((function(each){
  2208. return smalltalk.withContext(function($ctx2) {
  2209. $2=self._collection();
  2210. $ctx2.sendIdx["collection"]=1;
  2211. $1=_st($2)._at_ifAbsent_(each,(function(){
  2212. return smalltalk.withContext(function($ctx3) {
  2213. return self._sampleNewValue();
  2214. $ctx3.sendIdx["sampleNewValue"]=1;
  2215. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2216. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2217. $3=self._sampleNewValue();
  2218. $ctx2.sendIdx["sampleNewValue"]=2;
  2219. return self._assert_equals_($1,$3);
  2220. $ctx2.sendIdx["assert:equals:"]=1;
  2221. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2222. self._samplesDo_((function(index,value){
  2223. return smalltalk.withContext(function($ctx2) {
  2224. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2225. return smalltalk.withContext(function($ctx3) {
  2226. return self._sampleNewValue();
  2227. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2228. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2229. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  2230. args: [],
  2231. 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 ].",
  2232. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2233. referencedClasses: []
  2234. }),
  2235. smalltalk.IndexableCollectionTest);
  2236. smalltalk.addMethod(
  2237. smalltalk.method({
  2238. selector: "testAtIfPresent",
  2239. protocol: 'tests',
  2240. fn: function (){
  2241. var self=this;
  2242. var visited,sentinel;
  2243. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2244. return smalltalk.withContext(function($ctx1) {
  2245. var $2,$1,$4,$3;
  2246. sentinel=_st($Object())._new();
  2247. self._nonIndexesDo_((function(each){
  2248. return smalltalk.withContext(function($ctx2) {
  2249. visited=nil;
  2250. visited;
  2251. $2=self._collection();
  2252. $ctx2.sendIdx["collection"]=1;
  2253. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2254. return smalltalk.withContext(function($ctx3) {
  2255. visited=value1;
  2256. visited;
  2257. return sentinel;
  2258. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}));
  2259. $ctx2.sendIdx["at:ifPresent:"]=1;
  2260. self._assert_equals_($1,nil);
  2261. $ctx2.sendIdx["assert:equals:"]=1;
  2262. return self._assert_(_st(visited)._isNil());
  2263. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2264. self._samplesDo_((function(index,value){
  2265. return smalltalk.withContext(function($ctx2) {
  2266. visited=nil;
  2267. visited;
  2268. $4=self._collection();
  2269. $ctx2.sendIdx["collection"]=2;
  2270. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2271. return smalltalk.withContext(function($ctx3) {
  2272. visited=value2;
  2273. visited;
  2274. return sentinel;
  2275. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,4)})}));
  2276. self._assert_equals_($3,sentinel);
  2277. $ctx2.sendIdx["assert:equals:"]=2;
  2278. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2279. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2280. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2281. args: [],
  2282. 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) ]",
  2283. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2284. referencedClasses: ["Object"]
  2285. }),
  2286. smalltalk.IndexableCollectionTest);
  2287. smalltalk.addMethod(
  2288. smalltalk.method({
  2289. selector: "testAtIfPresentIfAbsent",
  2290. protocol: 'tests',
  2291. fn: function (){
  2292. var self=this;
  2293. var visited,sentinel;
  2294. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2295. return smalltalk.withContext(function($ctx1) {
  2296. var $2,$1,$3,$5,$4;
  2297. sentinel=_st($Object())._new();
  2298. self._nonIndexesDo_((function(each){
  2299. return smalltalk.withContext(function($ctx2) {
  2300. visited=nil;
  2301. visited;
  2302. $2=self._collection();
  2303. $ctx2.sendIdx["collection"]=1;
  2304. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2305. return smalltalk.withContext(function($ctx3) {
  2306. visited=value1;
  2307. visited;
  2308. return sentinel;
  2309. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}),(function(){
  2310. return smalltalk.withContext(function($ctx3) {
  2311. return self._sampleNewValue();
  2312. $ctx3.sendIdx["sampleNewValue"]=1;
  2313. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2314. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2315. $3=self._sampleNewValue();
  2316. $ctx2.sendIdx["sampleNewValue"]=2;
  2317. self._assert_equals_($1,$3);
  2318. $ctx2.sendIdx["assert:equals:"]=1;
  2319. return self._assert_(_st(visited)._isNil());
  2320. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2321. self._samplesDo_((function(index,value){
  2322. return smalltalk.withContext(function($ctx2) {
  2323. visited=nil;
  2324. visited;
  2325. $5=self._collection();
  2326. $ctx2.sendIdx["collection"]=2;
  2327. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2328. return smalltalk.withContext(function($ctx3) {
  2329. visited=value2;
  2330. visited;
  2331. return sentinel;
  2332. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,5)})}),(function(){
  2333. return smalltalk.withContext(function($ctx3) {
  2334. return self._sampleNewValue();
  2335. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2336. self._assert_equals_($4,sentinel);
  2337. $ctx2.sendIdx["assert:equals:"]=2;
  2338. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2339. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2340. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2341. args: [],
  2342. 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) ]",
  2343. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2344. referencedClasses: ["Object"]
  2345. }),
  2346. smalltalk.IndexableCollectionTest);
  2347. smalltalk.addMethod(
  2348. smalltalk.method({
  2349. selector: "testAtPut",
  2350. protocol: 'tests',
  2351. fn: function (){
  2352. var self=this;
  2353. var newCollection;
  2354. return smalltalk.withContext(function($ctx1) {
  2355. newCollection=self._collection();
  2356. $ctx1.sendIdx["collection"]=1;
  2357. self._samplesDo_((function(index,value){
  2358. return smalltalk.withContext(function($ctx2) {
  2359. return _st(newCollection)._at_put_(index,value);
  2360. $ctx2.sendIdx["at:put:"]=1;
  2361. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2362. self._assert_equals_(newCollection,self._collection());
  2363. $ctx1.sendIdx["assert:equals:"]=1;
  2364. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2365. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2366. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2367. args: [],
  2368. 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",
  2369. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2370. referencedClasses: []
  2371. }),
  2372. smalltalk.IndexableCollectionTest);
  2373. smalltalk.addMethod(
  2374. smalltalk.method({
  2375. selector: "testIndexOf",
  2376. protocol: 'tests',
  2377. fn: function (){
  2378. var self=this;
  2379. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2380. return smalltalk.withContext(function($ctx1) {
  2381. var $1;
  2382. self._should_raise_((function(){
  2383. return smalltalk.withContext(function($ctx2) {
  2384. $1=self._collection();
  2385. $ctx2.sendIdx["collection"]=1;
  2386. return _st($1)._indexOf_(self._sampleNewValue());
  2387. $ctx2.sendIdx["indexOf:"]=1;
  2388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2389. self._samplesDo_((function(index,value){
  2390. return smalltalk.withContext(function($ctx2) {
  2391. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2392. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2393. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  2394. args: [],
  2395. 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 ]",
  2396. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2397. referencedClasses: ["Error"]
  2398. }),
  2399. smalltalk.IndexableCollectionTest);
  2400. smalltalk.addMethod(
  2401. smalltalk.method({
  2402. selector: "testWithIndexDo",
  2403. protocol: 'tests',
  2404. fn: function (){
  2405. var self=this;
  2406. var collection;
  2407. return smalltalk.withContext(function($ctx1) {
  2408. collection=self._collection();
  2409. $ctx1.sendIdx["collection"]=1;
  2410. _st(self._collection())._withIndexDo_((function(each,index){
  2411. return smalltalk.withContext(function($ctx2) {
  2412. return self._assert_equals_(_st(collection)._at_(index),each);
  2413. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2414. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  2415. args: [],
  2416. 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 ]",
  2417. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2418. referencedClasses: []
  2419. }),
  2420. smalltalk.IndexableCollectionTest);
  2421. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2422. smalltalk.addMethod(
  2423. smalltalk.method({
  2424. selector: "collection",
  2425. protocol: 'fixture',
  2426. fn: function (){
  2427. var self=this;
  2428. return smalltalk.withContext(function($ctx1) {
  2429. var $2,$3,$4,$1;
  2430. $2="b".__minus_gt((1));
  2431. $ctx1.sendIdx["->"]=1;
  2432. $3="a".__minus_gt((2));
  2433. $ctx1.sendIdx["->"]=2;
  2434. $4="c".__minus_gt((3));
  2435. $ctx1.sendIdx["->"]=3;
  2436. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  2437. return $1;
  2438. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  2439. args: [],
  2440. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  2441. messageSends: ["->"],
  2442. referencedClasses: []
  2443. }),
  2444. smalltalk.HashedCollectionTest);
  2445. smalltalk.addMethod(
  2446. smalltalk.method({
  2447. selector: "collectionOfPrintStrings",
  2448. protocol: 'fixture',
  2449. fn: function (){
  2450. var self=this;
  2451. return smalltalk.withContext(function($ctx1) {
  2452. var $2,$3,$4,$1;
  2453. $2="b".__minus_gt("1");
  2454. $ctx1.sendIdx["->"]=1;
  2455. $3="a".__minus_gt("2");
  2456. $ctx1.sendIdx["->"]=2;
  2457. $4="c".__minus_gt("3");
  2458. $ctx1.sendIdx["->"]=3;
  2459. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt("-4")]);
  2460. return $1;
  2461. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.HashedCollectionTest)})},
  2462. args: [],
  2463. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  2464. messageSends: ["->"],
  2465. referencedClasses: []
  2466. }),
  2467. smalltalk.HashedCollectionTest);
  2468. smalltalk.addMethod(
  2469. smalltalk.method({
  2470. selector: "collectionSize",
  2471. protocol: 'fixture',
  2472. fn: function (){
  2473. var self=this;
  2474. return smalltalk.withContext(function($ctx1) {
  2475. return (4);
  2476. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.HashedCollectionTest)})},
  2477. args: [],
  2478. source: "collectionSize\x0a\x09^ 4",
  2479. messageSends: [],
  2480. referencedClasses: []
  2481. }),
  2482. smalltalk.HashedCollectionTest);
  2483. smalltalk.addMethod(
  2484. smalltalk.method({
  2485. selector: "collectionWithDuplicates",
  2486. protocol: 'fixture',
  2487. fn: function (){
  2488. var self=this;
  2489. return smalltalk.withContext(function($ctx1) {
  2490. var $2,$3,$4,$5,$6,$7,$1;
  2491. $2="b".__minus_gt((1));
  2492. $ctx1.sendIdx["->"]=1;
  2493. $3="a".__minus_gt((2));
  2494. $ctx1.sendIdx["->"]=2;
  2495. $4="c".__minus_gt((3));
  2496. $ctx1.sendIdx["->"]=3;
  2497. $5="d".__minus_gt((-4));
  2498. $ctx1.sendIdx["->"]=4;
  2499. $6="e".__minus_gt((1));
  2500. $ctx1.sendIdx["->"]=5;
  2501. $7="f".__minus_gt((2));
  2502. $ctx1.sendIdx["->"]=6;
  2503. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  2504. return $1;
  2505. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  2506. args: [],
  2507. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  2508. messageSends: ["->"],
  2509. referencedClasses: []
  2510. }),
  2511. smalltalk.HashedCollectionTest);
  2512. smalltalk.addMethod(
  2513. smalltalk.method({
  2514. selector: "collectionWithNewValue",
  2515. protocol: 'fixture',
  2516. fn: function (){
  2517. var self=this;
  2518. return smalltalk.withContext(function($ctx1) {
  2519. var $2,$3,$4,$5,$1;
  2520. $2="b".__minus_gt((1));
  2521. $ctx1.sendIdx["->"]=1;
  2522. $3="a".__minus_gt((2));
  2523. $ctx1.sendIdx["->"]=2;
  2524. $4="c".__minus_gt((3));
  2525. $ctx1.sendIdx["->"]=3;
  2526. $5="d".__minus_gt((-4));
  2527. $ctx1.sendIdx["->"]=4;
  2528. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  2529. return $1;
  2530. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.HashedCollectionTest)})},
  2531. args: [],
  2532. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  2533. messageSends: ["->"],
  2534. referencedClasses: []
  2535. }),
  2536. smalltalk.HashedCollectionTest);
  2537. smalltalk.addMethod(
  2538. smalltalk.method({
  2539. selector: "nonIndexesDo:",
  2540. protocol: 'fixture',
  2541. fn: function (aBlock){
  2542. var self=this;
  2543. return smalltalk.withContext(function($ctx1) {
  2544. _st(aBlock)._value_((5));
  2545. $ctx1.sendIdx["value:"]=1;
  2546. _st(aBlock)._value_("z");
  2547. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2548. args: ["aBlock"],
  2549. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2550. messageSends: ["value:"],
  2551. referencedClasses: []
  2552. }),
  2553. smalltalk.HashedCollectionTest);
  2554. smalltalk.addMethod(
  2555. smalltalk.method({
  2556. selector: "sampleNewIndex",
  2557. protocol: 'fixture',
  2558. fn: function (){
  2559. var self=this;
  2560. return smalltalk.withContext(function($ctx1) {
  2561. return "new";
  2562. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.HashedCollectionTest)})},
  2563. args: [],
  2564. source: "sampleNewIndex\x0a\x09^ 'new'",
  2565. messageSends: [],
  2566. referencedClasses: []
  2567. }),
  2568. smalltalk.HashedCollectionTest);
  2569. smalltalk.addMethod(
  2570. smalltalk.method({
  2571. selector: "sampleNewValueAsCollection",
  2572. protocol: 'fixture',
  2573. fn: function (){
  2574. var self=this;
  2575. return smalltalk.withContext(function($ctx1) {
  2576. var $1;
  2577. $1=smalltalk.HashedCollection._from_(["new".__minus_gt("N")]);
  2578. return $1;
  2579. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.HashedCollectionTest)})},
  2580. args: [],
  2581. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  2582. messageSends: ["->"],
  2583. referencedClasses: []
  2584. }),
  2585. smalltalk.HashedCollectionTest);
  2586. smalltalk.addMethod(
  2587. smalltalk.method({
  2588. selector: "samplesDo:",
  2589. protocol: 'fixture',
  2590. fn: function (aBlock){
  2591. var self=this;
  2592. return smalltalk.withContext(function($ctx1) {
  2593. _st(aBlock)._value_value_("a",(2));
  2594. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2595. args: ["aBlock"],
  2596. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2597. messageSends: ["value:value:"],
  2598. referencedClasses: []
  2599. }),
  2600. smalltalk.HashedCollectionTest);
  2601. smalltalk.addMethod(
  2602. smalltalk.method({
  2603. selector: "testAddAll",
  2604. protocol: 'tests',
  2605. fn: function (){
  2606. var self=this;
  2607. return smalltalk.withContext(function($ctx1) {
  2608. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2609. smalltalk.HashedCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2610. $2=self._collection();
  2611. $ctx1.sendIdx["collection"]=1;
  2612. $3=$2;
  2613. $4=self._collection();
  2614. $ctx1.sendIdx["collection"]=2;
  2615. _st($3)._addAll_($4);
  2616. $ctx1.sendIdx["addAll:"]=1;
  2617. $5=_st($2)._yourself();
  2618. $ctx1.sendIdx["yourself"]=1;
  2619. $1=$5;
  2620. $6=self._collection();
  2621. $ctx1.sendIdx["collection"]=3;
  2622. self._assert_equals_($1,$6);
  2623. $ctx1.sendIdx["assert:equals:"]=1;
  2624. $8=self._collection();
  2625. $ctx1.sendIdx["collection"]=4;
  2626. $9=$8;
  2627. $10=self._collectionWithNewValue();
  2628. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2629. _st($9)._addAll_($10);
  2630. $ctx1.sendIdx["addAll:"]=2;
  2631. $11=_st($8)._yourself();
  2632. $ctx1.sendIdx["yourself"]=2;
  2633. $7=$11;
  2634. $12=self._collectionWithNewValue();
  2635. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2636. self._assert_equals_($7,$12);
  2637. $ctx1.sendIdx["assert:equals:"]=2;
  2638. $14=self._collectionWithNewValue();
  2639. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2640. _st($14)._addAll_(self._collection());
  2641. $15=_st($14)._yourself();
  2642. $13=$15;
  2643. self._assert_equals_($13,self._collectionWithNewValue());
  2644. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.HashedCollectionTest)})},
  2645. args: [],
  2646. 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",
  2647. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2648. referencedClasses: []
  2649. }),
  2650. smalltalk.HashedCollectionTest);
  2651. smalltalk.addMethod(
  2652. smalltalk.method({
  2653. selector: "testAsDictionary",
  2654. protocol: 'tests',
  2655. fn: function (){
  2656. var self=this;
  2657. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2658. return smalltalk.withContext(function($ctx1) {
  2659. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2660. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  2661. args: [],
  2662. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2663. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2664. referencedClasses: ["Dictionary"]
  2665. }),
  2666. smalltalk.HashedCollectionTest);
  2667. smalltalk.addMethod(
  2668. smalltalk.method({
  2669. selector: "testComma",
  2670. protocol: 'tests',
  2671. fn: function (){
  2672. var self=this;
  2673. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2674. return smalltalk.withContext(function($ctx1) {
  2675. var $1;
  2676. self._should_raise_((function(){
  2677. return smalltalk.withContext(function($ctx2) {
  2678. $1=self._collection();
  2679. $ctx2.sendIdx["collection"]=1;
  2680. return _st($1).__comma(self._collection());
  2681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2682. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.HashedCollectionTest)})},
  2683. args: [],
  2684. source: "testComma\x0a\x09self should: [ self collection, self collection ] raise: Error",
  2685. messageSends: ["should:raise:", ",", "collection"],
  2686. referencedClasses: ["Error"]
  2687. }),
  2688. smalltalk.HashedCollectionTest);
  2689. smalltalk.addMethod(
  2690. smalltalk.method({
  2691. selector: "testFrom",
  2692. protocol: 'tests',
  2693. fn: function (){
  2694. var self=this;
  2695. var associations;
  2696. return smalltalk.withContext(function($ctx1) {
  2697. var $1,$2,$3,$5,$4;
  2698. $1="a".__minus_gt((1));
  2699. $ctx1.sendIdx["->"]=1;
  2700. $2="b".__minus_gt((2));
  2701. $ctx1.sendIdx["->"]=2;
  2702. associations=[$1,$2];
  2703. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2704. $5="a".__minus_gt((1));
  2705. $ctx1.sendIdx["->"]=3;
  2706. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2707. self._assertSameContents_as_($3,$4);
  2708. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  2709. args: [],
  2710. 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 }.",
  2711. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2712. referencedClasses: []
  2713. }),
  2714. smalltalk.HashedCollectionTest);
  2715. smalltalk.addMethod(
  2716. smalltalk.method({
  2717. selector: "testNewFromPairs",
  2718. protocol: 'tests',
  2719. fn: function (){
  2720. var self=this;
  2721. var flattenedAssociations;
  2722. return smalltalk.withContext(function($ctx1) {
  2723. var $1,$3,$2;
  2724. flattenedAssociations=["a",(1),"b",(2)];
  2725. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2726. $3="a".__minus_gt((1));
  2727. $ctx1.sendIdx["->"]=1;
  2728. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2729. self._assertSameContents_as_($1,$2);
  2730. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  2731. args: [],
  2732. 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 }.",
  2733. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2734. referencedClasses: []
  2735. }),
  2736. smalltalk.HashedCollectionTest);
  2737. smalltalk.addMethod(
  2738. smalltalk.method({
  2739. selector: "collectionClass",
  2740. protocol: 'fixture',
  2741. fn: function (){
  2742. var self=this;
  2743. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2744. return smalltalk.withContext(function($ctx1) {
  2745. return $HashedCollection();
  2746. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  2747. args: [],
  2748. source: "collectionClass\x0a\x09^ HashedCollection",
  2749. messageSends: [],
  2750. referencedClasses: ["HashedCollection"]
  2751. }),
  2752. smalltalk.HashedCollectionTest.klass);
  2753. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  2754. smalltalk.addMethod(
  2755. smalltalk.method({
  2756. selector: "collection",
  2757. protocol: 'fixture',
  2758. fn: function (){
  2759. var self=this;
  2760. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2761. return smalltalk.withContext(function($ctx1) {
  2762. var $2,$3,$1;
  2763. $2=_st($Dictionary())._new();
  2764. _st($2)._at_put_((1),(1));
  2765. $ctx1.sendIdx["at:put:"]=1;
  2766. _st($2)._at_put_("a",(2));
  2767. $ctx1.sendIdx["at:put:"]=2;
  2768. _st($2)._at_put_(true,(3));
  2769. $ctx1.sendIdx["at:put:"]=3;
  2770. _st($2)._at_put_((1).__at((3)),(-4));
  2771. $3=_st($2)._yourself();
  2772. $1=$3;
  2773. return $1;
  2774. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  2775. args: [],
  2776. 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",
  2777. messageSends: ["at:put:", "new", "@", "yourself"],
  2778. referencedClasses: ["Dictionary"]
  2779. }),
  2780. smalltalk.DictionaryTest);
  2781. smalltalk.addMethod(
  2782. smalltalk.method({
  2783. selector: "collectionOfPrintStrings",
  2784. protocol: 'fixture',
  2785. fn: function (){
  2786. var self=this;
  2787. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2788. return smalltalk.withContext(function($ctx1) {
  2789. var $2,$3,$1;
  2790. $2=_st($Dictionary())._new();
  2791. _st($2)._at_put_((1),"1");
  2792. $ctx1.sendIdx["at:put:"]=1;
  2793. _st($2)._at_put_("a","2");
  2794. $ctx1.sendIdx["at:put:"]=2;
  2795. _st($2)._at_put_(true,"3");
  2796. $ctx1.sendIdx["at:put:"]=3;
  2797. _st($2)._at_put_((1).__at((3)),"-4");
  2798. $3=_st($2)._yourself();
  2799. $1=$3;
  2800. return $1;
  2801. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.DictionaryTest)})},
  2802. args: [],
  2803. 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",
  2804. messageSends: ["at:put:", "new", "@", "yourself"],
  2805. referencedClasses: ["Dictionary"]
  2806. }),
  2807. smalltalk.DictionaryTest);
  2808. smalltalk.addMethod(
  2809. smalltalk.method({
  2810. selector: "collectionSize",
  2811. protocol: 'fixture',
  2812. fn: function (){
  2813. var self=this;
  2814. return smalltalk.withContext(function($ctx1) {
  2815. return (4);
  2816. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.DictionaryTest)})},
  2817. args: [],
  2818. source: "collectionSize\x0a\x09^ 4",
  2819. messageSends: [],
  2820. referencedClasses: []
  2821. }),
  2822. smalltalk.DictionaryTest);
  2823. smalltalk.addMethod(
  2824. smalltalk.method({
  2825. selector: "collectionWithDuplicates",
  2826. protocol: 'fixture',
  2827. fn: function (){
  2828. var self=this;
  2829. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2830. return smalltalk.withContext(function($ctx1) {
  2831. var $2,$3,$1;
  2832. $2=_st($Dictionary())._new();
  2833. _st($2)._at_put_((1),(1));
  2834. $ctx1.sendIdx["at:put:"]=1;
  2835. _st($2)._at_put_("a",(2));
  2836. $ctx1.sendIdx["at:put:"]=2;
  2837. _st($2)._at_put_(true,(3));
  2838. $ctx1.sendIdx["at:put:"]=3;
  2839. _st($2)._at_put_((4),(-4));
  2840. $ctx1.sendIdx["at:put:"]=4;
  2841. _st($2)._at_put_("b",(1));
  2842. $ctx1.sendIdx["at:put:"]=5;
  2843. _st($2)._at_put_((3),(3));
  2844. $ctx1.sendIdx["at:put:"]=6;
  2845. _st($2)._at_put_(false,(12));
  2846. $3=_st($2)._yourself();
  2847. $1=$3;
  2848. return $1;
  2849. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  2850. args: [],
  2851. 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",
  2852. messageSends: ["at:put:", "new", "yourself"],
  2853. referencedClasses: ["Dictionary"]
  2854. }),
  2855. smalltalk.DictionaryTest);
  2856. smalltalk.addMethod(
  2857. smalltalk.method({
  2858. selector: "collectionWithNewValue",
  2859. protocol: 'fixture',
  2860. fn: function (){
  2861. var self=this;
  2862. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2863. return smalltalk.withContext(function($ctx1) {
  2864. var $2,$3,$1;
  2865. $2=_st($Dictionary())._new();
  2866. _st($2)._at_put_((1),(1));
  2867. $ctx1.sendIdx["at:put:"]=1;
  2868. _st($2)._at_put_("a",(2));
  2869. $ctx1.sendIdx["at:put:"]=2;
  2870. _st($2)._at_put_(true,(3));
  2871. $ctx1.sendIdx["at:put:"]=3;
  2872. _st($2)._at_put_((1).__at((3)),(-4));
  2873. $ctx1.sendIdx["at:put:"]=4;
  2874. _st($2)._at_put_("new","N");
  2875. $3=_st($2)._yourself();
  2876. $1=$3;
  2877. return $1;
  2878. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.DictionaryTest)})},
  2879. args: [],
  2880. 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",
  2881. messageSends: ["at:put:", "new", "@", "yourself"],
  2882. referencedClasses: ["Dictionary"]
  2883. }),
  2884. smalltalk.DictionaryTest);
  2885. smalltalk.addMethod(
  2886. smalltalk.method({
  2887. selector: "sampleNewValueAsCollection",
  2888. protocol: 'fixture',
  2889. fn: function (){
  2890. var self=this;
  2891. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2892. return smalltalk.withContext(function($ctx1) {
  2893. var $2,$3,$1;
  2894. $2=_st($Dictionary())._new();
  2895. _st($2)._at_put_("new","N");
  2896. $3=_st($2)._yourself();
  2897. $1=$3;
  2898. return $1;
  2899. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.DictionaryTest)})},
  2900. args: [],
  2901. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  2902. messageSends: ["at:put:", "new", "yourself"],
  2903. referencedClasses: ["Dictionary"]
  2904. }),
  2905. smalltalk.DictionaryTest);
  2906. smalltalk.addMethod(
  2907. smalltalk.method({
  2908. selector: "samplesDo:",
  2909. protocol: 'fixture',
  2910. fn: function (aBlock){
  2911. var self=this;
  2912. return smalltalk.withContext(function($ctx1) {
  2913. smalltalk.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  2914. _st(aBlock)._value_value_(true,(3));
  2915. $ctx1.sendIdx["value:value:"]=1;
  2916. _st(aBlock)._value_value_((1).__at((3)),(-4));
  2917. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.DictionaryTest)})},
  2918. args: ["aBlock"],
  2919. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  2920. messageSends: ["samplesDo:", "value:value:", "@"],
  2921. referencedClasses: []
  2922. }),
  2923. smalltalk.DictionaryTest);
  2924. smalltalk.addMethod(
  2925. smalltalk.method({
  2926. selector: "testAccessing",
  2927. protocol: 'tests',
  2928. fn: function (){
  2929. var self=this;
  2930. var d;
  2931. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2932. return smalltalk.withContext(function($ctx1) {
  2933. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  2934. d=_st($Dictionary())._new();
  2935. _st(d)._at_put_("hello","world");
  2936. $ctx1.sendIdx["at:put:"]=1;
  2937. $1=_st(d)._at_("hello");
  2938. $ctx1.sendIdx["at:"]=1;
  2939. self._assert_equals_($1,"world");
  2940. $ctx1.sendIdx["assert:equals:"]=1;
  2941. $2=_st(d)._at_ifAbsent_("hello",(function(){
  2942. return smalltalk.withContext(function($ctx2) {
  2943. return nil;
  2944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2945. $ctx1.sendIdx["at:ifAbsent:"]=1;
  2946. self._assert_equals_($2,"world");
  2947. $ctx1.sendIdx["assert:equals:"]=2;
  2948. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  2949. return smalltalk.withContext(function($ctx2) {
  2950. return nil;
  2951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  2952. $ctx1.sendIdx["deny:"]=1;
  2953. $3=_st(d)._includesKey_("hello");
  2954. $ctx1.sendIdx["includesKey:"]=1;
  2955. self._assert_($3);
  2956. $ctx1.sendIdx["assert:"]=1;
  2957. $4=_st(d)._includesKey_("foo");
  2958. $ctx1.sendIdx["includesKey:"]=2;
  2959. self._deny_($4);
  2960. $ctx1.sendIdx["deny:"]=2;
  2961. _st(d)._at_put_((1),(2));
  2962. $ctx1.sendIdx["at:put:"]=2;
  2963. $5=_st(d)._at_((1));
  2964. $ctx1.sendIdx["at:"]=2;
  2965. self._assert_equals_($5,(2));
  2966. $ctx1.sendIdx["assert:equals:"]=3;
  2967. $6=d;
  2968. $7=(1).__at((3));
  2969. $ctx1.sendIdx["@"]=1;
  2970. _st($6)._at_put_($7,(3));
  2971. $9=d;
  2972. $10=(1).__at((3));
  2973. $ctx1.sendIdx["@"]=2;
  2974. $8=_st($9)._at_($10);
  2975. self._assert_equals_($8,(3));
  2976. $12=d;
  2977. $13=(1).__at((3));
  2978. $ctx1.sendIdx["@"]=3;
  2979. $11=_st($12)._includesKey_($13);
  2980. $ctx1.sendIdx["includesKey:"]=3;
  2981. self._assert_($11);
  2982. self._deny_(_st(d)._includesKey_((3).__at((1))));
  2983. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  2984. args: [],
  2985. 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)",
  2986. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  2987. referencedClasses: ["Dictionary"]
  2988. }),
  2989. smalltalk.DictionaryTest);
  2990. smalltalk.addMethod(
  2991. smalltalk.method({
  2992. selector: "testAsHashedCollection",
  2993. protocol: 'tests',
  2994. fn: function (){
  2995. var self=this;
  2996. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2997. return smalltalk.withContext(function($ctx1) {
  2998. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2999. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  3000. args: [],
  3001. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  3002. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  3003. referencedClasses: ["HashedCollection"]
  3004. }),
  3005. smalltalk.DictionaryTest);
  3006. smalltalk.addMethod(
  3007. smalltalk.method({
  3008. selector: "testDynamicDictionaries",
  3009. protocol: 'tests',
  3010. fn: function (){
  3011. var self=this;
  3012. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3013. return smalltalk.withContext(function($ctx1) {
  3014. var $3,$2,$1;
  3015. $3="hello".__minus_gt((1));
  3016. $ctx1.sendIdx["->"]=1;
  3017. $2=smalltalk.HashedCollection._from_([$3]);
  3018. $1=_st($2)._asDictionary();
  3019. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  3020. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  3021. args: [],
  3022. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3023. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  3024. referencedClasses: ["Dictionary"]
  3025. }),
  3026. smalltalk.DictionaryTest);
  3027. smalltalk.addMethod(
  3028. smalltalk.method({
  3029. selector: "testEquality",
  3030. protocol: 'tests',
  3031. fn: function (){
  3032. var self=this;
  3033. var d1,d2;
  3034. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3035. return smalltalk.withContext(function($ctx1) {
  3036. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  3037. $2=_st($Dictionary())._new();
  3038. $ctx1.sendIdx["new"]=1;
  3039. $3=_st($Dictionary())._new();
  3040. $ctx1.sendIdx["new"]=2;
  3041. $1=_st($2).__eq($3);
  3042. $ctx1.sendIdx["="]=1;
  3043. self._assert_($1);
  3044. $ctx1.sendIdx["assert:"]=1;
  3045. $4=_st($Dictionary())._new();
  3046. $ctx1.sendIdx["new"]=3;
  3047. _st($4)._at_put_((1),(2));
  3048. $ctx1.sendIdx["at:put:"]=1;
  3049. $5=_st($4)._yourself();
  3050. $ctx1.sendIdx["yourself"]=1;
  3051. d1=$5;
  3052. $6=_st($Dictionary())._new();
  3053. $ctx1.sendIdx["new"]=4;
  3054. _st($6)._at_put_((1),(2));
  3055. $ctx1.sendIdx["at:put:"]=2;
  3056. $7=_st($6)._yourself();
  3057. $ctx1.sendIdx["yourself"]=2;
  3058. d2=$7;
  3059. $8=_st(d1).__eq(d2);
  3060. $ctx1.sendIdx["="]=2;
  3061. self._assert_($8);
  3062. $9=_st($Dictionary())._new();
  3063. $ctx1.sendIdx["new"]=5;
  3064. _st($9)._at_put_((1),(3));
  3065. $ctx1.sendIdx["at:put:"]=3;
  3066. $10=_st($9)._yourself();
  3067. $ctx1.sendIdx["yourself"]=3;
  3068. d2=$10;
  3069. $11=_st(d1).__eq(d2);
  3070. $ctx1.sendIdx["="]=3;
  3071. self._deny_($11);
  3072. $ctx1.sendIdx["deny:"]=1;
  3073. $12=_st($Dictionary())._new();
  3074. $ctx1.sendIdx["new"]=6;
  3075. _st($12)._at_put_((2),(2));
  3076. $ctx1.sendIdx["at:put:"]=4;
  3077. $13=_st($12)._yourself();
  3078. $ctx1.sendIdx["yourself"]=4;
  3079. d2=$13;
  3080. $14=_st(d1).__eq(d2);
  3081. $ctx1.sendIdx["="]=4;
  3082. self._deny_($14);
  3083. $ctx1.sendIdx["deny:"]=2;
  3084. $15=_st($Dictionary())._new();
  3085. _st($15)._at_put_((1),(2));
  3086. $ctx1.sendIdx["at:put:"]=5;
  3087. _st($15)._at_put_((3),(4));
  3088. $16=_st($15)._yourself();
  3089. d2=$16;
  3090. self._deny_(_st(d1).__eq(d2));
  3091. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  3092. args: [],
  3093. source: "testEquality\x0a\x09| d1 d2 |\x0a\x0a\x09self assert: (Dictionary new = Dictionary new).\x0a\x09\x09\x0a\x09d1 := Dictionary new at: 1 put: 2; yourself.\x0a\x09d2 := Dictionary new at: 1 put: 2; yourself.\x0a\x09self assert: (d1 = d2).\x0a\x0a\x09d2 := Dictionary new at: 1 put: 3; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 2 put: 2; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 1 put: 2; at: 3 put: 4; yourself.\x0a\x09self deny: d1 = d2.",
  3094. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  3095. referencedClasses: ["Dictionary"]
  3096. }),
  3097. smalltalk.DictionaryTest);
  3098. smalltalk.addMethod(
  3099. smalltalk.method({
  3100. selector: "testKeys",
  3101. protocol: 'tests',
  3102. fn: function (){
  3103. var self=this;
  3104. var d;
  3105. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3106. return smalltalk.withContext(function($ctx1) {
  3107. d=_st($Dictionary())._new();
  3108. _st(d)._at_put_((1),(2));
  3109. $ctx1.sendIdx["at:put:"]=1;
  3110. _st(d)._at_put_((2),(3));
  3111. $ctx1.sendIdx["at:put:"]=2;
  3112. _st(d)._at_put_((3),(4));
  3113. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  3114. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  3115. args: [],
  3116. source: "testKeys\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d keys equals: #(1 2 3)",
  3117. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  3118. referencedClasses: ["Dictionary"]
  3119. }),
  3120. smalltalk.DictionaryTest);
  3121. smalltalk.addMethod(
  3122. smalltalk.method({
  3123. selector: "testPointKey",
  3124. protocol: 'tests',
  3125. fn: function (){
  3126. var self=this;
  3127. var d;
  3128. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3129. return smalltalk.withContext(function($ctx1) {
  3130. var $1,$2,$4,$5,$3,$6,$7,$9,$10,$8,$11,$12,$14,$15,$13;
  3131. d=_st($Dictionary())._new();
  3132. $1=d;
  3133. $2=(1).__at((1));
  3134. $ctx1.sendIdx["@"]=1;
  3135. _st($1)._at_put_($2,"foo");
  3136. $ctx1.sendIdx["at:put:"]=1;
  3137. $4=d;
  3138. $5=(1).__at((1));
  3139. $ctx1.sendIdx["@"]=2;
  3140. $3=_st($4)._at_($5);
  3141. $ctx1.sendIdx["at:"]=1;
  3142. self._assert_equals_($3,"foo");
  3143. $ctx1.sendIdx["assert:equals:"]=1;
  3144. $6=d;
  3145. $7=(1).__at((1));
  3146. $ctx1.sendIdx["@"]=3;
  3147. _st($6)._at_put_($7,"bar");
  3148. $9=d;
  3149. $10=(1).__at((1));
  3150. $ctx1.sendIdx["@"]=4;
  3151. $8=_st($9)._at_($10);
  3152. self._assert_equals_($8,"bar");
  3153. $ctx1.sendIdx["assert:equals:"]=2;
  3154. $11=d;
  3155. $12=(1).__at((1));
  3156. $ctx1.sendIdx["@"]=5;
  3157. _st($11)._removeKey_($12);
  3158. $14=d;
  3159. $15=(1).__at((1));
  3160. $ctx1.sendIdx["@"]=6;
  3161. $13=_st($14)._at_ifAbsent_($15,(function(){
  3162. return smalltalk.withContext(function($ctx2) {
  3163. return "baz";
  3164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3165. self._assert_equals_($13,"baz");
  3166. self._deny_(_st(d)._includesKey_((1).__at((1))));
  3167. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  3168. args: [],
  3169. source: "testPointKey\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09\x0a\x09d at: 1@1 put: 'foo'.\x0a\x09self assert: (d at: 1@1) equals: 'foo'.\x0a\x09d at: 1@1 put: 'bar'.\x0a\x09self assert: (d at: 1@1) equals: 'bar'.\x0a\x09d removeKey: 1@1.\x0a\x09self assert: (d at: 1@1 ifAbsent: [ 'baz' ]) equals: 'baz'.\x0a\x09self deny: (d includesKey: 1@1)",
  3170. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  3171. referencedClasses: ["Dictionary"]
  3172. }),
  3173. smalltalk.DictionaryTest);
  3174. smalltalk.addMethod(
  3175. smalltalk.method({
  3176. selector: "testPrintString",
  3177. protocol: 'tests',
  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_("firstname","James");
  3185. $ctx1.sendIdx["at:put:"]=1;
  3186. _st($2)._at_put_("lastname","Bond");
  3187. $3=_st($2)._printString();
  3188. $1=$3;
  3189. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  3190. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  3191. args: [],
  3192. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (Dictionary new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a Dictionary (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  3193. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  3194. referencedClasses: ["Dictionary"]
  3195. }),
  3196. smalltalk.DictionaryTest);
  3197. smalltalk.addMethod(
  3198. smalltalk.method({
  3199. selector: "testRemoveKey",
  3200. protocol: 'tests',
  3201. fn: function (){
  3202. var self=this;
  3203. var d,key;
  3204. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3205. return smalltalk.withContext(function($ctx1) {
  3206. var $1;
  3207. d=_st($Dictionary())._new();
  3208. _st(d)._at_put_((1),(2));
  3209. $ctx1.sendIdx["at:put:"]=1;
  3210. _st(d)._at_put_((2),(3));
  3211. $ctx1.sendIdx["at:put:"]=2;
  3212. _st(d)._at_put_((3),(4));
  3213. key=(2);
  3214. $1=_st(d)._keys();
  3215. $ctx1.sendIdx["keys"]=1;
  3216. self._assert_equals_($1,[(1), (2), (3)]);
  3217. $ctx1.sendIdx["assert:equals:"]=1;
  3218. _st(d)._removeKey_(key);
  3219. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  3220. $ctx1.sendIdx["assert:equals:"]=2;
  3221. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  3222. self._deny_(_st(d)._includesKey_((2)));
  3223. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  3224. args: [],
  3225. source: "testRemoveKey\x0a\x09| d key |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09key := 2.\x0a\x0a\x09self assert: d keys equals: #(1 2 3).\x0a\x0a\x09d removeKey: key.\x0a\x09self assert: d keys equals: #(1 3).\x0a\x09self assert: d values equals: #(2 4).\x0a\x09self deny: (d includesKey: 2)",
  3226. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  3227. referencedClasses: ["Dictionary"]
  3228. }),
  3229. smalltalk.DictionaryTest);
  3230. smalltalk.addMethod(
  3231. smalltalk.method({
  3232. selector: "testRemoveKeyIfAbsent",
  3233. protocol: 'tests',
  3234. fn: function (){
  3235. var self=this;
  3236. var d,key;
  3237. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3238. return smalltalk.withContext(function($ctx1) {
  3239. var $1;
  3240. d=_st($Dictionary())._new();
  3241. _st(d)._at_put_((1),(2));
  3242. $ctx1.sendIdx["at:put:"]=1;
  3243. _st(d)._at_put_((2),(3));
  3244. $ctx1.sendIdx["at:put:"]=2;
  3245. _st(d)._at_put_((3),(4));
  3246. key=(2);
  3247. self._assert_equals_(_st(d)._removeKey_(key),(3));
  3248. $ctx1.sendIdx["assert:equals:"]=1;
  3249. key=(3);
  3250. $1=_st(d)._removeKey_ifAbsent_(key,(function(){
  3251. return smalltalk.withContext(function($ctx2) {
  3252. return (42);
  3253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3254. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  3255. self._assert_equals_($1,(4));
  3256. $ctx1.sendIdx["assert:equals:"]=2;
  3257. key="why";
  3258. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  3259. return smalltalk.withContext(function($ctx2) {
  3260. return (42);
  3261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  3262. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  3263. args: [],
  3264. source: "testRemoveKeyIfAbsent\x0a\x09| d key |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09key := 2.\x0a\x09self assert: (d removeKey: key) equals: 3.\x0a\x0a\x09key := 3.\x0a\x09self assert: (d removeKey: key ifAbsent: [ 42 ]) equals: 4.\x0a\x0a\x09key := 'why'.\x0a\x09self assert: (d removeKey: key ifAbsent: [ 42 ] ) equals: 42.",
  3265. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  3266. referencedClasses: ["Dictionary"]
  3267. }),
  3268. smalltalk.DictionaryTest);
  3269. smalltalk.addMethod(
  3270. smalltalk.method({
  3271. selector: "testValues",
  3272. protocol: 'tests',
  3273. fn: function (){
  3274. var self=this;
  3275. var d;
  3276. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3277. return smalltalk.withContext(function($ctx1) {
  3278. d=_st($Dictionary())._new();
  3279. _st(d)._at_put_((1),(2));
  3280. $ctx1.sendIdx["at:put:"]=1;
  3281. _st(d)._at_put_((2),(3));
  3282. $ctx1.sendIdx["at:put:"]=2;
  3283. _st(d)._at_put_((3),(4));
  3284. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  3285. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  3286. args: [],
  3287. source: "testValues\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d values equals: #(2 3 4)",
  3288. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  3289. referencedClasses: ["Dictionary"]
  3290. }),
  3291. smalltalk.DictionaryTest);
  3292. smalltalk.addMethod(
  3293. smalltalk.method({
  3294. selector: "collectionClass",
  3295. protocol: 'fixture',
  3296. fn: function (){
  3297. var self=this;
  3298. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3299. return smalltalk.withContext(function($ctx1) {
  3300. return $Dictionary();
  3301. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  3302. args: [],
  3303. source: "collectionClass\x0a\x09^ Dictionary",
  3304. messageSends: [],
  3305. referencedClasses: ["Dictionary"]
  3306. }),
  3307. smalltalk.DictionaryTest.klass);
  3308. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  3309. smalltalk.addMethod(
  3310. smalltalk.method({
  3311. selector: "collectionFirst",
  3312. protocol: 'fixture',
  3313. fn: function (){
  3314. var self=this;
  3315. return smalltalk.withContext(function($ctx1) {
  3316. self._subclassResponsibility();
  3317. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.SequenceableCollectionTest)})},
  3318. args: [],
  3319. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3320. messageSends: ["subclassResponsibility"],
  3321. referencedClasses: []
  3322. }),
  3323. smalltalk.SequenceableCollectionTest);
  3324. smalltalk.addMethod(
  3325. smalltalk.method({
  3326. selector: "collectionFirstTwo",
  3327. protocol: 'fixture',
  3328. fn: function (){
  3329. var self=this;
  3330. return smalltalk.withContext(function($ctx1) {
  3331. self._subclassResponsibility();
  3332. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.SequenceableCollectionTest)})},
  3333. args: [],
  3334. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3335. messageSends: ["subclassResponsibility"],
  3336. referencedClasses: []
  3337. }),
  3338. smalltalk.SequenceableCollectionTest);
  3339. smalltalk.addMethod(
  3340. smalltalk.method({
  3341. selector: "collectionLast",
  3342. protocol: 'fixture',
  3343. fn: function (){
  3344. var self=this;
  3345. return smalltalk.withContext(function($ctx1) {
  3346. self._subclassResponsibility();
  3347. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.SequenceableCollectionTest)})},
  3348. args: [],
  3349. source: "collectionLast\x0a\x09self subclassResponsibility",
  3350. messageSends: ["subclassResponsibility"],
  3351. referencedClasses: []
  3352. }),
  3353. smalltalk.SequenceableCollectionTest);
  3354. smalltalk.addMethod(
  3355. smalltalk.method({
  3356. selector: "collectionLastTwo",
  3357. protocol: 'fixture',
  3358. fn: function (){
  3359. var self=this;
  3360. return smalltalk.withContext(function($ctx1) {
  3361. self._subclassResponsibility();
  3362. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.SequenceableCollectionTest)})},
  3363. args: [],
  3364. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3365. messageSends: ["subclassResponsibility"],
  3366. referencedClasses: []
  3367. }),
  3368. smalltalk.SequenceableCollectionTest);
  3369. smalltalk.addMethod(
  3370. smalltalk.method({
  3371. selector: "nonIndexesDo:",
  3372. protocol: 'fixture',
  3373. fn: function (aBlock){
  3374. var self=this;
  3375. return smalltalk.withContext(function($ctx1) {
  3376. _st(aBlock)._value_((0));
  3377. $ctx1.sendIdx["value:"]=1;
  3378. _st(aBlock)._value_(_st(_st(self._collection())._size()).__plus((1)));
  3379. $ctx1.sendIdx["value:"]=2;
  3380. _st(aBlock)._value_("z");
  3381. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3382. args: ["aBlock"],
  3383. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collection size + 1.\x0a\x09aBlock value: 'z'",
  3384. messageSends: ["value:", "+", "size", "collection"],
  3385. referencedClasses: []
  3386. }),
  3387. smalltalk.SequenceableCollectionTest);
  3388. smalltalk.addMethod(
  3389. smalltalk.method({
  3390. selector: "samplesDo:",
  3391. protocol: 'fixture',
  3392. fn: function (aBlock){
  3393. var self=this;
  3394. return smalltalk.withContext(function($ctx1) {
  3395. _st(aBlock)._value_value_((1),self._collectionFirst());
  3396. $ctx1.sendIdx["value:value:"]=1;
  3397. _st(aBlock)._value_value_(_st(self._collection())._size(),self._collectionLast());
  3398. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3399. args: ["aBlock"],
  3400. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collection size value: self collectionLast",
  3401. messageSends: ["value:value:", "collectionFirst", "size", "collection", "collectionLast"],
  3402. referencedClasses: []
  3403. }),
  3404. smalltalk.SequenceableCollectionTest);
  3405. smalltalk.addMethod(
  3406. smalltalk.method({
  3407. selector: "testBeginsWith",
  3408. protocol: 'tests',
  3409. fn: function (){
  3410. var self=this;
  3411. return smalltalk.withContext(function($ctx1) {
  3412. var $2,$1,$4,$5,$3,$7,$6;
  3413. $2=self._collection();
  3414. $ctx1.sendIdx["collection"]=1;
  3415. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3416. $ctx1.sendIdx["beginsWith:"]=1;
  3417. self._assert_($1);
  3418. $ctx1.sendIdx["assert:"]=1;
  3419. $4=self._collection();
  3420. $ctx1.sendIdx["collection"]=2;
  3421. $5=self._collection();
  3422. $ctx1.sendIdx["collection"]=3;
  3423. $3=_st($4)._beginsWith_($5);
  3424. $ctx1.sendIdx["beginsWith:"]=2;
  3425. self._assert_($3);
  3426. $ctx1.sendIdx["assert:"]=2;
  3427. $7=self._collection();
  3428. $ctx1.sendIdx["collection"]=4;
  3429. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3430. $ctx1.sendIdx["beginsWith:"]=3;
  3431. self._assert_($6);
  3432. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3433. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  3434. args: [],
  3435. 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)",
  3436. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3437. referencedClasses: []
  3438. }),
  3439. smalltalk.SequenceableCollectionTest);
  3440. smalltalk.addMethod(
  3441. smalltalk.method({
  3442. selector: "testEndsWith",
  3443. protocol: 'tests',
  3444. fn: function (){
  3445. var self=this;
  3446. return smalltalk.withContext(function($ctx1) {
  3447. var $2,$1,$4,$5,$3,$7,$6;
  3448. $2=self._collection();
  3449. $ctx1.sendIdx["collection"]=1;
  3450. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3451. $ctx1.sendIdx["endsWith:"]=1;
  3452. self._assert_($1);
  3453. $ctx1.sendIdx["assert:"]=1;
  3454. $4=self._collection();
  3455. $ctx1.sendIdx["collection"]=2;
  3456. $5=self._collection();
  3457. $ctx1.sendIdx["collection"]=3;
  3458. $3=_st($4)._endsWith_($5);
  3459. $ctx1.sendIdx["endsWith:"]=2;
  3460. self._assert_($3);
  3461. $ctx1.sendIdx["assert:"]=2;
  3462. $7=self._collection();
  3463. $ctx1.sendIdx["collection"]=4;
  3464. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3465. $ctx1.sendIdx["endsWith:"]=3;
  3466. self._assert_($6);
  3467. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3468. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  3469. args: [],
  3470. 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)",
  3471. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3472. referencedClasses: []
  3473. }),
  3474. smalltalk.SequenceableCollectionTest);
  3475. smalltalk.addMethod(
  3476. smalltalk.method({
  3477. selector: "testFirst",
  3478. protocol: 'tests',
  3479. fn: function (){
  3480. var self=this;
  3481. return smalltalk.withContext(function($ctx1) {
  3482. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3483. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  3484. args: [],
  3485. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3486. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3487. referencedClasses: []
  3488. }),
  3489. smalltalk.SequenceableCollectionTest);
  3490. smalltalk.addMethod(
  3491. smalltalk.method({
  3492. selector: "testFirstN",
  3493. protocol: 'tests',
  3494. fn: function (){
  3495. var self=this;
  3496. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3497. return smalltalk.withContext(function($ctx1) {
  3498. var $2,$1,$4,$3,$6,$8,$7,$5,$9;
  3499. $2=self._collection();
  3500. $ctx1.sendIdx["collection"]=1;
  3501. $1=_st($2)._first_((2));
  3502. $ctx1.sendIdx["first:"]=1;
  3503. self._assert_equals_($1,self._collectionFirstTwo());
  3504. $ctx1.sendIdx["assert:equals:"]=1;
  3505. $4=self._collection();
  3506. $ctx1.sendIdx["collection"]=2;
  3507. $3=_st($4)._first_((0));
  3508. $ctx1.sendIdx["first:"]=2;
  3509. self._assert_equals_($3,_st(self._collectionClass())._new());
  3510. $ctx1.sendIdx["assert:equals:"]=2;
  3511. $6=self._collection();
  3512. $ctx1.sendIdx["collection"]=3;
  3513. $8=self._collection();
  3514. $ctx1.sendIdx["collection"]=4;
  3515. $7=_st($8)._size();
  3516. $5=_st($6)._first_($7);
  3517. $ctx1.sendIdx["first:"]=3;
  3518. $9=self._collection();
  3519. $ctx1.sendIdx["collection"]=5;
  3520. self._assert_equals_($5,$9);
  3521. self._should_raise_((function(){
  3522. return smalltalk.withContext(function($ctx2) {
  3523. return _st(self._collection())._first_((33));
  3524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3525. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  3526. args: [],
  3527. 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 collection size)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  3528. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "size", "should:raise:"],
  3529. referencedClasses: ["Error"]
  3530. }),
  3531. smalltalk.SequenceableCollectionTest);
  3532. smalltalk.addMethod(
  3533. smalltalk.method({
  3534. selector: "testFourth",
  3535. protocol: 'tests',
  3536. fn: function (){
  3537. var self=this;
  3538. return smalltalk.withContext(function($ctx1) {
  3539. var $2,$1;
  3540. $2=self._collection();
  3541. $ctx1.sendIdx["collection"]=1;
  3542. $1=_st($2)._fourth();
  3543. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3544. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  3545. args: [],
  3546. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3547. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3548. referencedClasses: []
  3549. }),
  3550. smalltalk.SequenceableCollectionTest);
  3551. smalltalk.addMethod(
  3552. smalltalk.method({
  3553. selector: "testLast",
  3554. protocol: 'tests',
  3555. fn: function (){
  3556. var self=this;
  3557. return smalltalk.withContext(function($ctx1) {
  3558. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3559. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  3560. args: [],
  3561. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3562. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3563. referencedClasses: []
  3564. }),
  3565. smalltalk.SequenceableCollectionTest);
  3566. smalltalk.addMethod(
  3567. smalltalk.method({
  3568. selector: "testLastN",
  3569. protocol: 'tests',
  3570. fn: function (){
  3571. var self=this;
  3572. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3573. return smalltalk.withContext(function($ctx1) {
  3574. var $2,$1,$4,$3,$6,$8,$7,$5,$9;
  3575. $2=self._collection();
  3576. $ctx1.sendIdx["collection"]=1;
  3577. $1=_st($2)._last_((2));
  3578. $ctx1.sendIdx["last:"]=1;
  3579. self._assert_equals_($1,self._collectionLastTwo());
  3580. $ctx1.sendIdx["assert:equals:"]=1;
  3581. $4=self._collection();
  3582. $ctx1.sendIdx["collection"]=2;
  3583. $3=_st($4)._last_((0));
  3584. $ctx1.sendIdx["last:"]=2;
  3585. self._assert_equals_($3,_st(self._collectionClass())._new());
  3586. $ctx1.sendIdx["assert:equals:"]=2;
  3587. $6=self._collection();
  3588. $ctx1.sendIdx["collection"]=3;
  3589. $8=self._collection();
  3590. $ctx1.sendIdx["collection"]=4;
  3591. $7=_st($8)._size();
  3592. $5=_st($6)._last_($7);
  3593. $ctx1.sendIdx["last:"]=3;
  3594. $9=self._collection();
  3595. $ctx1.sendIdx["collection"]=5;
  3596. self._assert_equals_($5,$9);
  3597. self._should_raise_((function(){
  3598. return smalltalk.withContext(function($ctx2) {
  3599. return _st(self._collection())._last_((33));
  3600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3601. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  3602. args: [],
  3603. 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 collection size)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  3604. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "size", "should:raise:"],
  3605. referencedClasses: ["Error"]
  3606. }),
  3607. smalltalk.SequenceableCollectionTest);
  3608. smalltalk.addMethod(
  3609. smalltalk.method({
  3610. selector: "testSecond",
  3611. protocol: 'tests',
  3612. fn: function (){
  3613. var self=this;
  3614. return smalltalk.withContext(function($ctx1) {
  3615. var $2,$1;
  3616. $2=self._collection();
  3617. $ctx1.sendIdx["collection"]=1;
  3618. $1=_st($2)._second();
  3619. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3620. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  3621. args: [],
  3622. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3623. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3624. referencedClasses: []
  3625. }),
  3626. smalltalk.SequenceableCollectionTest);
  3627. smalltalk.addMethod(
  3628. smalltalk.method({
  3629. selector: "testThird",
  3630. protocol: 'tests',
  3631. fn: function (){
  3632. var self=this;
  3633. return smalltalk.withContext(function($ctx1) {
  3634. var $2,$1;
  3635. $2=self._collection();
  3636. $ctx1.sendIdx["collection"]=1;
  3637. $1=_st($2)._third();
  3638. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3639. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  3640. args: [],
  3641. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3642. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3643. referencedClasses: []
  3644. }),
  3645. smalltalk.SequenceableCollectionTest);
  3646. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3647. smalltalk.addMethod(
  3648. smalltalk.method({
  3649. selector: "collection",
  3650. protocol: 'fixture',
  3651. fn: function (){
  3652. var self=this;
  3653. return smalltalk.withContext(function($ctx1) {
  3654. var $1;
  3655. $1=[(1), (2), (3), (-4)];
  3656. return $1;
  3657. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  3658. args: [],
  3659. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3660. messageSends: [],
  3661. referencedClasses: []
  3662. }),
  3663. smalltalk.ArrayTest);
  3664. smalltalk.addMethod(
  3665. smalltalk.method({
  3666. selector: "collectionFirst",
  3667. protocol: 'fixture',
  3668. fn: function (){
  3669. var self=this;
  3670. return smalltalk.withContext(function($ctx1) {
  3671. return (1);
  3672. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.ArrayTest)})},
  3673. args: [],
  3674. source: "collectionFirst\x0a\x09^ 1",
  3675. messageSends: [],
  3676. referencedClasses: []
  3677. }),
  3678. smalltalk.ArrayTest);
  3679. smalltalk.addMethod(
  3680. smalltalk.method({
  3681. selector: "collectionFirstTwo",
  3682. protocol: 'fixture',
  3683. fn: function (){
  3684. var self=this;
  3685. return smalltalk.withContext(function($ctx1) {
  3686. var $1;
  3687. $1=[(1), (2)];
  3688. return $1;
  3689. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.ArrayTest)})},
  3690. args: [],
  3691. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3692. messageSends: [],
  3693. referencedClasses: []
  3694. }),
  3695. smalltalk.ArrayTest);
  3696. smalltalk.addMethod(
  3697. smalltalk.method({
  3698. selector: "collectionLast",
  3699. protocol: 'fixture',
  3700. fn: function (){
  3701. var self=this;
  3702. return smalltalk.withContext(function($ctx1) {
  3703. return (-4);
  3704. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.ArrayTest)})},
  3705. args: [],
  3706. source: "collectionLast\x0a\x09^ -4",
  3707. messageSends: [],
  3708. referencedClasses: []
  3709. }),
  3710. smalltalk.ArrayTest);
  3711. smalltalk.addMethod(
  3712. smalltalk.method({
  3713. selector: "collectionLastTwo",
  3714. protocol: 'fixture',
  3715. fn: function (){
  3716. var self=this;
  3717. return smalltalk.withContext(function($ctx1) {
  3718. var $1;
  3719. $1=[(3), (-4)];
  3720. return $1;
  3721. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.ArrayTest)})},
  3722. args: [],
  3723. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3724. messageSends: [],
  3725. referencedClasses: []
  3726. }),
  3727. smalltalk.ArrayTest);
  3728. smalltalk.addMethod(
  3729. smalltalk.method({
  3730. selector: "collectionOfPrintStrings",
  3731. protocol: 'fixture',
  3732. fn: function (){
  3733. var self=this;
  3734. return smalltalk.withContext(function($ctx1) {
  3735. var $1;
  3736. $1=["1", "2", "3", "-4"];
  3737. return $1;
  3738. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.ArrayTest)})},
  3739. args: [],
  3740. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  3741. messageSends: [],
  3742. referencedClasses: []
  3743. }),
  3744. smalltalk.ArrayTest);
  3745. smalltalk.addMethod(
  3746. smalltalk.method({
  3747. selector: "collectionSize",
  3748. protocol: 'fixture',
  3749. fn: function (){
  3750. var self=this;
  3751. return smalltalk.withContext(function($ctx1) {
  3752. return (4);
  3753. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.ArrayTest)})},
  3754. args: [],
  3755. source: "collectionSize\x0a\x09^ 4",
  3756. messageSends: [],
  3757. referencedClasses: []
  3758. }),
  3759. smalltalk.ArrayTest);
  3760. smalltalk.addMethod(
  3761. smalltalk.method({
  3762. selector: "collectionWithDuplicates",
  3763. protocol: 'fixture',
  3764. fn: function (){
  3765. var self=this;
  3766. return smalltalk.withContext(function($ctx1) {
  3767. var $1;
  3768. $1=["a", "b", "c", (1), (2), (1), "a"];
  3769. return $1;
  3770. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  3771. args: [],
  3772. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  3773. messageSends: [],
  3774. referencedClasses: []
  3775. }),
  3776. smalltalk.ArrayTest);
  3777. smalltalk.addMethod(
  3778. smalltalk.method({
  3779. selector: "collectionWithNewValue",
  3780. protocol: 'fixture',
  3781. fn: function (){
  3782. var self=this;
  3783. return smalltalk.withContext(function($ctx1) {
  3784. var $1;
  3785. $1=[(1), (2), (3), (-4), "N"];
  3786. return $1;
  3787. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.ArrayTest)})},
  3788. args: [],
  3789. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  3790. messageSends: [],
  3791. referencedClasses: []
  3792. }),
  3793. smalltalk.ArrayTest);
  3794. smalltalk.addMethod(
  3795. smalltalk.method({
  3796. selector: "sampleNewIndex",
  3797. protocol: 'fixture',
  3798. fn: function (){
  3799. var self=this;
  3800. return smalltalk.withContext(function($ctx1) {
  3801. return (5);
  3802. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.ArrayTest)})},
  3803. args: [],
  3804. source: "sampleNewIndex\x0a\x09^ 5",
  3805. messageSends: [],
  3806. referencedClasses: []
  3807. }),
  3808. smalltalk.ArrayTest);
  3809. smalltalk.addMethod(
  3810. smalltalk.method({
  3811. selector: "samplesDo:",
  3812. protocol: 'fixture',
  3813. fn: function (aBlock){
  3814. var self=this;
  3815. return smalltalk.withContext(function($ctx1) {
  3816. smalltalk.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3817. _st(aBlock)._value_value_((3),(3));
  3818. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.ArrayTest)})},
  3819. args: ["aBlock"],
  3820. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  3821. messageSends: ["samplesDo:", "value:value:"],
  3822. referencedClasses: []
  3823. }),
  3824. smalltalk.ArrayTest);
  3825. smalltalk.addMethod(
  3826. smalltalk.method({
  3827. selector: "testAdd",
  3828. protocol: 'tests',
  3829. fn: function (){
  3830. var self=this;
  3831. var array;
  3832. return smalltalk.withContext(function($ctx1) {
  3833. array=self._collection();
  3834. _st(array)._add_((6));
  3835. self._assert_equals_(_st(array)._last(),(6));
  3836. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  3837. args: [],
  3838. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  3839. messageSends: ["collection", "add:", "assert:equals:", "last"],
  3840. referencedClasses: []
  3841. }),
  3842. smalltalk.ArrayTest);
  3843. smalltalk.addMethod(
  3844. smalltalk.method({
  3845. selector: "testAddFirst",
  3846. protocol: 'tests',
  3847. fn: function (){
  3848. var self=this;
  3849. return smalltalk.withContext(function($ctx1) {
  3850. var $1,$2;
  3851. $1=self._collection();
  3852. _st($1)._addFirst_((0));
  3853. $2=_st($1)._yourself();
  3854. self._assert_equals_(_st($2)._first(),(0));
  3855. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  3856. args: [],
  3857. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  3858. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  3859. referencedClasses: []
  3860. }),
  3861. smalltalk.ArrayTest);
  3862. smalltalk.addMethod(
  3863. smalltalk.method({
  3864. selector: "testPrintString",
  3865. protocol: 'tests',
  3866. fn: function (){
  3867. var self=this;
  3868. var array;
  3869. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3870. return smalltalk.withContext(function($ctx1) {
  3871. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  3872. array=_st($Array())._new();
  3873. $1=_st(array)._printString();
  3874. $ctx1.sendIdx["printString"]=1;
  3875. self._assert_equals_($1,"an Array ()");
  3876. $ctx1.sendIdx["assert:equals:"]=1;
  3877. $2=array;
  3878. _st($2)._add_((1));
  3879. $ctx1.sendIdx["add:"]=1;
  3880. $3=_st($2)._add_((3));
  3881. $ctx1.sendIdx["add:"]=2;
  3882. $4=_st(array)._printString();
  3883. $ctx1.sendIdx["printString"]=2;
  3884. self._assert_equals_($4,"an Array (1 3)");
  3885. $ctx1.sendIdx["assert:equals:"]=2;
  3886. _st(array)._add_("foo");
  3887. $5=_st(array)._printString();
  3888. $ctx1.sendIdx["printString"]=3;
  3889. self._assert_equals_($5,"an Array (1 3 'foo')");
  3890. $ctx1.sendIdx["assert:equals:"]=3;
  3891. $6=array;
  3892. _st($6)._remove_((1));
  3893. $ctx1.sendIdx["remove:"]=1;
  3894. $7=_st($6)._remove_((3));
  3895. $8=_st(array)._printString();
  3896. $ctx1.sendIdx["printString"]=4;
  3897. self._assert_equals_($8,"an Array ('foo')");
  3898. $ctx1.sendIdx["assert:equals:"]=4;
  3899. _st(array)._addLast_((3));
  3900. $ctx1.sendIdx["addLast:"]=1;
  3901. $9=_st(array)._printString();
  3902. $ctx1.sendIdx["printString"]=5;
  3903. self._assert_equals_($9,"an Array ('foo' 3)");
  3904. $ctx1.sendIdx["assert:equals:"]=5;
  3905. _st(array)._addLast_((3));
  3906. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  3907. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  3908. args: [],
  3909. 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)'.",
  3910. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  3911. referencedClasses: ["Array"]
  3912. }),
  3913. smalltalk.ArrayTest);
  3914. smalltalk.addMethod(
  3915. smalltalk.method({
  3916. selector: "testRemove",
  3917. protocol: 'tests',
  3918. fn: function (){
  3919. var self=this;
  3920. var array;
  3921. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3922. return smalltalk.withContext(function($ctx1) {
  3923. array=[(1), (2), (3), (4), (5)];
  3924. _st(array)._remove_((3));
  3925. $ctx1.sendIdx["remove:"]=1;
  3926. self._assert_equals_(array,[(1), (2), (4), (5)]);
  3927. self._should_raise_((function(){
  3928. return smalltalk.withContext(function($ctx2) {
  3929. return _st(array)._remove_((3));
  3930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3931. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  3932. args: [],
  3933. 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",
  3934. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  3935. referencedClasses: ["Error"]
  3936. }),
  3937. smalltalk.ArrayTest);
  3938. smalltalk.addMethod(
  3939. smalltalk.method({
  3940. selector: "testRemoveFromTo",
  3941. protocol: 'tests',
  3942. fn: function (){
  3943. var self=this;
  3944. return smalltalk.withContext(function($ctx1) {
  3945. var $1,$2;
  3946. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  3947. $ctx1.sendIdx["removeFrom:to:"]=1;
  3948. self._assert_equals_($1,[(4)]);
  3949. $ctx1.sendIdx["assert:equals:"]=1;
  3950. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  3951. $ctx1.sendIdx["removeFrom:to:"]=2;
  3952. self._assert_equals_($2,[(1), (4)]);
  3953. $ctx1.sendIdx["assert:equals:"]=2;
  3954. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  3955. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  3956. args: [],
  3957. 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)",
  3958. messageSends: ["assert:equals:", "removeFrom:to:"],
  3959. referencedClasses: []
  3960. }),
  3961. smalltalk.ArrayTest);
  3962. smalltalk.addMethod(
  3963. smalltalk.method({
  3964. selector: "testRemoveIndex",
  3965. protocol: 'tests',
  3966. fn: function (){
  3967. var self=this;
  3968. return smalltalk.withContext(function($ctx1) {
  3969. var $1,$2;
  3970. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  3971. $ctx1.sendIdx["removeIndex:"]=1;
  3972. self._assert_equals_($1,[(1), (3), (4)]);
  3973. $ctx1.sendIdx["assert:equals:"]=1;
  3974. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  3975. $ctx1.sendIdx["removeIndex:"]=2;
  3976. self._assert_equals_($2,[(2), (3), (4)]);
  3977. $ctx1.sendIdx["assert:equals:"]=2;
  3978. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  3979. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  3980. args: [],
  3981. 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: #()",
  3982. messageSends: ["assert:equals:", "removeIndex:"],
  3983. referencedClasses: []
  3984. }),
  3985. smalltalk.ArrayTest);
  3986. smalltalk.addMethod(
  3987. smalltalk.method({
  3988. selector: "testRemoveLast",
  3989. protocol: 'tests',
  3990. fn: function (){
  3991. var self=this;
  3992. var array;
  3993. return smalltalk.withContext(function($ctx1) {
  3994. array=[(1), (2)];
  3995. _st(array)._removeLast();
  3996. self._assert_equals_(_st(array)._last(),(1));
  3997. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  3998. args: [],
  3999. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4000. messageSends: ["removeLast", "assert:equals:", "last"],
  4001. referencedClasses: []
  4002. }),
  4003. smalltalk.ArrayTest);
  4004. smalltalk.addMethod(
  4005. smalltalk.method({
  4006. selector: "testReversed",
  4007. protocol: 'tests',
  4008. fn: function (){
  4009. var self=this;
  4010. var array;
  4011. return smalltalk.withContext(function($ctx1) {
  4012. array=[(5), (4), (3), (2), (1)];
  4013. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4014. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  4015. args: [],
  4016. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4017. messageSends: ["assert:equals:", "reversed"],
  4018. referencedClasses: []
  4019. }),
  4020. smalltalk.ArrayTest);
  4021. smalltalk.addMethod(
  4022. smalltalk.method({
  4023. selector: "testSort",
  4024. protocol: 'tests',
  4025. fn: function (){
  4026. var self=this;
  4027. var array;
  4028. return smalltalk.withContext(function($ctx1) {
  4029. array=[(3), (1), (4), (5), (2)];
  4030. _st(array)._sort();
  4031. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  4032. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  4033. args: [],
  4034. 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)",
  4035. messageSends: ["sort", "assert:equals:"],
  4036. referencedClasses: []
  4037. }),
  4038. smalltalk.ArrayTest);
  4039. smalltalk.addMethod(
  4040. smalltalk.method({
  4041. selector: "collectionClass",
  4042. protocol: 'fixture',
  4043. fn: function (){
  4044. var self=this;
  4045. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4046. return smalltalk.withContext(function($ctx1) {
  4047. return $Array();
  4048. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  4049. args: [],
  4050. source: "collectionClass\x0a\x09^ Array",
  4051. messageSends: [],
  4052. referencedClasses: ["Array"]
  4053. }),
  4054. smalltalk.ArrayTest.klass);
  4055. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  4056. smalltalk.addMethod(
  4057. smalltalk.method({
  4058. selector: "collection",
  4059. protocol: 'fixture',
  4060. fn: function (){
  4061. var self=this;
  4062. return smalltalk.withContext(function($ctx1) {
  4063. return "hello";
  4064. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  4065. args: [],
  4066. source: "collection\x0a\x09^ 'hello'",
  4067. messageSends: [],
  4068. referencedClasses: []
  4069. }),
  4070. smalltalk.StringTest);
  4071. smalltalk.addMethod(
  4072. smalltalk.method({
  4073. selector: "collectionFirst",
  4074. protocol: 'fixture',
  4075. fn: function (){
  4076. var self=this;
  4077. return smalltalk.withContext(function($ctx1) {
  4078. return "h";
  4079. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.StringTest)})},
  4080. args: [],
  4081. source: "collectionFirst\x0a\x09^ 'h'",
  4082. messageSends: [],
  4083. referencedClasses: []
  4084. }),
  4085. smalltalk.StringTest);
  4086. smalltalk.addMethod(
  4087. smalltalk.method({
  4088. selector: "collectionFirstTwo",
  4089. protocol: 'fixture',
  4090. fn: function (){
  4091. var self=this;
  4092. return smalltalk.withContext(function($ctx1) {
  4093. return "he";
  4094. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.StringTest)})},
  4095. args: [],
  4096. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4097. messageSends: [],
  4098. referencedClasses: []
  4099. }),
  4100. smalltalk.StringTest);
  4101. smalltalk.addMethod(
  4102. smalltalk.method({
  4103. selector: "collectionLast",
  4104. protocol: 'fixture',
  4105. fn: function (){
  4106. var self=this;
  4107. return smalltalk.withContext(function($ctx1) {
  4108. return "o";
  4109. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.StringTest)})},
  4110. args: [],
  4111. source: "collectionLast\x0a\x09^ 'o'",
  4112. messageSends: [],
  4113. referencedClasses: []
  4114. }),
  4115. smalltalk.StringTest);
  4116. smalltalk.addMethod(
  4117. smalltalk.method({
  4118. selector: "collectionLastTwo",
  4119. protocol: 'fixture',
  4120. fn: function (){
  4121. var self=this;
  4122. return smalltalk.withContext(function($ctx1) {
  4123. return "lo";
  4124. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.StringTest)})},
  4125. args: [],
  4126. source: "collectionLastTwo\x0a\x09^ 'lo'",
  4127. messageSends: [],
  4128. referencedClasses: []
  4129. }),
  4130. smalltalk.StringTest);
  4131. smalltalk.addMethod(
  4132. smalltalk.method({
  4133. selector: "collectionOfPrintStrings",
  4134. protocol: 'fixture',
  4135. fn: function (){
  4136. var self=this;
  4137. return smalltalk.withContext(function($ctx1) {
  4138. return "'h''e''l''l''o'";
  4139. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.StringTest)})},
  4140. args: [],
  4141. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''l''''o'''",
  4142. messageSends: [],
  4143. referencedClasses: []
  4144. }),
  4145. smalltalk.StringTest);
  4146. smalltalk.addMethod(
  4147. smalltalk.method({
  4148. selector: "collectionSize",
  4149. protocol: 'fixture',
  4150. fn: function (){
  4151. var self=this;
  4152. return smalltalk.withContext(function($ctx1) {
  4153. return (5);
  4154. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.StringTest)})},
  4155. args: [],
  4156. source: "collectionSize\x0a\x09^ 5",
  4157. messageSends: [],
  4158. referencedClasses: []
  4159. }),
  4160. smalltalk.StringTest);
  4161. smalltalk.addMethod(
  4162. smalltalk.method({
  4163. selector: "collectionWithDuplicates",
  4164. protocol: 'fixture',
  4165. fn: function (){
  4166. var self=this;
  4167. return smalltalk.withContext(function($ctx1) {
  4168. return "abbaerte";
  4169. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  4170. args: [],
  4171. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4172. messageSends: [],
  4173. referencedClasses: []
  4174. }),
  4175. smalltalk.StringTest);
  4176. smalltalk.addMethod(
  4177. smalltalk.method({
  4178. selector: "collectionWithNewValue",
  4179. protocol: 'fixture',
  4180. fn: function (){
  4181. var self=this;
  4182. return smalltalk.withContext(function($ctx1) {
  4183. return "helloN";
  4184. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.StringTest)})},
  4185. args: [],
  4186. source: "collectionWithNewValue\x0a\x09^ 'helloN'",
  4187. messageSends: [],
  4188. referencedClasses: []
  4189. }),
  4190. smalltalk.StringTest);
  4191. smalltalk.addMethod(
  4192. smalltalk.method({
  4193. selector: "sampleNewValueAsCollection",
  4194. protocol: 'fixture',
  4195. fn: function (){
  4196. var self=this;
  4197. return smalltalk.withContext(function($ctx1) {
  4198. return "N";
  4199. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.StringTest)})},
  4200. args: [],
  4201. source: "sampleNewValueAsCollection\x0a\x09\x0a\x09^ 'N'",
  4202. messageSends: [],
  4203. referencedClasses: []
  4204. }),
  4205. smalltalk.StringTest);
  4206. smalltalk.addMethod(
  4207. smalltalk.method({
  4208. selector: "samplesDo:",
  4209. protocol: 'fixture',
  4210. fn: function (aBlock){
  4211. var self=this;
  4212. return smalltalk.withContext(function($ctx1) {
  4213. smalltalk.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  4214. _st(aBlock)._value_value_((3),"l");
  4215. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.StringTest)})},
  4216. args: ["aBlock"],
  4217. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4218. messageSends: ["samplesDo:", "value:value:"],
  4219. referencedClasses: []
  4220. }),
  4221. smalltalk.StringTest);
  4222. smalltalk.addMethod(
  4223. smalltalk.method({
  4224. selector: "testAddAll",
  4225. protocol: 'tests',
  4226. fn: function (){
  4227. var self=this;
  4228. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4229. return smalltalk.withContext(function($ctx1) {
  4230. var $1;
  4231. self._should_raise_((function(){
  4232. return smalltalk.withContext(function($ctx2) {
  4233. $1=self._collection();
  4234. $ctx2.sendIdx["collection"]=1;
  4235. return _st($1)._addAll_(self._collection());
  4236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4237. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.StringTest)})},
  4238. args: [],
  4239. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4240. messageSends: ["should:raise:", "addAll:", "collection"],
  4241. referencedClasses: ["Error"]
  4242. }),
  4243. smalltalk.StringTest);
  4244. smalltalk.addMethod(
  4245. smalltalk.method({
  4246. selector: "testAddRemove",
  4247. protocol: 'tests',
  4248. fn: function (){
  4249. var self=this;
  4250. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4251. return smalltalk.withContext(function($ctx1) {
  4252. self._should_raise_((function(){
  4253. return smalltalk.withContext(function($ctx2) {
  4254. return "hello"._add_("a");
  4255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4256. $ctx1.sendIdx["should:raise:"]=1;
  4257. self._should_raise_((function(){
  4258. return smalltalk.withContext(function($ctx2) {
  4259. return "hello"._remove_("h");
  4260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4261. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  4262. args: [],
  4263. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4264. messageSends: ["should:raise:", "add:", "remove:"],
  4265. referencedClasses: ["Error"]
  4266. }),
  4267. smalltalk.StringTest);
  4268. smalltalk.addMethod(
  4269. smalltalk.method({
  4270. selector: "testAsArray",
  4271. protocol: 'tests',
  4272. fn: function (){
  4273. var self=this;
  4274. return smalltalk.withContext(function($ctx1) {
  4275. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4276. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  4277. args: [],
  4278. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4279. messageSends: ["assert:equals:", "asArray"],
  4280. referencedClasses: []
  4281. }),
  4282. smalltalk.StringTest);
  4283. smalltalk.addMethod(
  4284. smalltalk.method({
  4285. selector: "testAsLowerCase",
  4286. protocol: 'tests',
  4287. fn: function (){
  4288. var self=this;
  4289. return smalltalk.withContext(function($ctx1) {
  4290. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4291. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  4292. args: [],
  4293. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4294. messageSends: ["assert:equals:", "asLowercase"],
  4295. referencedClasses: []
  4296. }),
  4297. smalltalk.StringTest);
  4298. smalltalk.addMethod(
  4299. smalltalk.method({
  4300. selector: "testAsNumber",
  4301. protocol: 'tests',
  4302. fn: function (){
  4303. var self=this;
  4304. return smalltalk.withContext(function($ctx1) {
  4305. var $1,$2;
  4306. $1="3"._asNumber();
  4307. $ctx1.sendIdx["asNumber"]=1;
  4308. self._assert_equals_($1,(3));
  4309. $ctx1.sendIdx["assert:equals:"]=1;
  4310. $2="-3"._asNumber();
  4311. $ctx1.sendIdx["asNumber"]=2;
  4312. self._assert_equals_($2,(-3));
  4313. $ctx1.sendIdx["assert:equals:"]=2;
  4314. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4315. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  4316. args: [],
  4317. 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.",
  4318. messageSends: ["assert:equals:", "asNumber"],
  4319. referencedClasses: []
  4320. }),
  4321. smalltalk.StringTest);
  4322. smalltalk.addMethod(
  4323. smalltalk.method({
  4324. selector: "testAsUpperCase",
  4325. protocol: 'tests',
  4326. fn: function (){
  4327. var self=this;
  4328. return smalltalk.withContext(function($ctx1) {
  4329. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4330. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  4331. args: [],
  4332. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4333. messageSends: ["assert:equals:", "asUppercase"],
  4334. referencedClasses: []
  4335. }),
  4336. smalltalk.StringTest);
  4337. smalltalk.addMethod(
  4338. smalltalk.method({
  4339. selector: "testAsciiValue",
  4340. protocol: 'tests',
  4341. fn: function (){
  4342. var self=this;
  4343. var characterA,characterU;
  4344. return smalltalk.withContext(function($ctx1) {
  4345. var $1;
  4346. characterA="A";
  4347. characterU="U";
  4348. $1=_st(characterA)._asciiValue();
  4349. $ctx1.sendIdx["asciiValue"]=1;
  4350. self._assert_equals_($1,(65));
  4351. $ctx1.sendIdx["assert:equals:"]=1;
  4352. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4353. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  4354. args: [],
  4355. 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",
  4356. messageSends: ["assert:equals:", "asciiValue"],
  4357. referencedClasses: []
  4358. }),
  4359. smalltalk.StringTest);
  4360. smalltalk.addMethod(
  4361. smalltalk.method({
  4362. selector: "testAtPut",
  4363. protocol: 'tests',
  4364. fn: function (){
  4365. var self=this;
  4366. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4367. return smalltalk.withContext(function($ctx1) {
  4368. self._should_raise_((function(){
  4369. return smalltalk.withContext(function($ctx2) {
  4370. return "hello"._at_put_((1),"a");
  4371. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4372. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  4373. args: [],
  4374. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4375. messageSends: ["should:raise:", "at:put:"],
  4376. referencedClasses: ["Error"]
  4377. }),
  4378. smalltalk.StringTest);
  4379. smalltalk.addMethod(
  4380. smalltalk.method({
  4381. selector: "testCapitalized",
  4382. protocol: 'tests',
  4383. fn: function (){
  4384. var self=this;
  4385. return smalltalk.withContext(function($ctx1) {
  4386. var $1,$2,$3;
  4387. $1="test"._capitalized();
  4388. $ctx1.sendIdx["capitalized"]=1;
  4389. self._assert_equals_($1,"Test");
  4390. $ctx1.sendIdx["assert:equals:"]=1;
  4391. $2="Test"._capitalized();
  4392. $ctx1.sendIdx["capitalized"]=2;
  4393. self._assert_equals_($2,"Test");
  4394. $ctx1.sendIdx["assert:equals:"]=2;
  4395. self._assert_equals_(""._capitalized(),"");
  4396. $ctx1.sendIdx["assert:equals:"]=3;
  4397. $3="Test"._isCapitalized();
  4398. $ctx1.sendIdx["isCapitalized"]=1;
  4399. self._assert_equals_($3,true);
  4400. $ctx1.sendIdx["assert:equals:"]=4;
  4401. self._assert_equals_("test"._isCapitalized(),false);
  4402. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  4403. args: [],
  4404. 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.",
  4405. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4406. referencedClasses: []
  4407. }),
  4408. smalltalk.StringTest);
  4409. smalltalk.addMethod(
  4410. smalltalk.method({
  4411. selector: "testCharCodeAt",
  4412. protocol: 'tests',
  4413. fn: function (){
  4414. var self=this;
  4415. return smalltalk.withContext(function($ctx1) {
  4416. var $1,$2,$3,$4,$5;
  4417. $1="jackie"._charCodeAt_((1));
  4418. $ctx1.sendIdx["charCodeAt:"]=1;
  4419. self._assert_equals_($1,(106));
  4420. $ctx1.sendIdx["assert:equals:"]=1;
  4421. $2="jackie"._charCodeAt_((2));
  4422. $ctx1.sendIdx["charCodeAt:"]=2;
  4423. self._assert_equals_($2,(97));
  4424. $ctx1.sendIdx["assert:equals:"]=2;
  4425. $3="jackie"._charCodeAt_((3));
  4426. $ctx1.sendIdx["charCodeAt:"]=3;
  4427. self._assert_equals_($3,(99));
  4428. $ctx1.sendIdx["assert:equals:"]=3;
  4429. $4="jackie"._charCodeAt_((4));
  4430. $ctx1.sendIdx["charCodeAt:"]=4;
  4431. self._assert_equals_($4,(107));
  4432. $ctx1.sendIdx["assert:equals:"]=4;
  4433. $5="jackie"._charCodeAt_((5));
  4434. $ctx1.sendIdx["charCodeAt:"]=5;
  4435. self._assert_equals_($5,(105));
  4436. $ctx1.sendIdx["assert:equals:"]=5;
  4437. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4438. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  4439. args: [],
  4440. 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",
  4441. messageSends: ["assert:equals:", "charCodeAt:"],
  4442. referencedClasses: []
  4443. }),
  4444. smalltalk.StringTest);
  4445. smalltalk.addMethod(
  4446. smalltalk.method({
  4447. selector: "testCopyFromTo",
  4448. protocol: 'tests',
  4449. fn: function (){
  4450. var self=this;
  4451. return smalltalk.withContext(function($ctx1) {
  4452. var $1;
  4453. $1="jackie"._copyFrom_to_((1),(3));
  4454. $ctx1.sendIdx["copyFrom:to:"]=1;
  4455. self._assert_equals_($1,"jac");
  4456. $ctx1.sendIdx["assert:equals:"]=1;
  4457. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4458. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  4459. args: [],
  4460. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4461. messageSends: ["assert:equals:", "copyFrom:to:"],
  4462. referencedClasses: []
  4463. }),
  4464. smalltalk.StringTest);
  4465. smalltalk.addMethod(
  4466. smalltalk.method({
  4467. selector: "testCopyWithoutAll",
  4468. protocol: 'tests',
  4469. fn: function (){
  4470. var self=this;
  4471. return smalltalk.withContext(function($ctx1) {
  4472. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4473. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  4474. args: [],
  4475. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4476. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4477. referencedClasses: []
  4478. }),
  4479. smalltalk.StringTest);
  4480. smalltalk.addMethod(
  4481. smalltalk.method({
  4482. selector: "testEquality",
  4483. protocol: 'tests',
  4484. fn: function (){
  4485. var self=this;
  4486. return smalltalk.withContext(function($ctx1) {
  4487. var $1,$2,$3;
  4488. self._assert_equals_("hello","hello");
  4489. $ctx1.sendIdx["assert:equals:"]=1;
  4490. $1="hello".__eq("world");
  4491. $ctx1.sendIdx["="]=1;
  4492. self._deny_($1);
  4493. $ctx1.sendIdx["deny:"]=1;
  4494. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4495. return smalltalk.withContext(function($ctx2) {
  4496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  4497. $ctx1.sendIdx["="]=2;
  4498. self._deny_($2);
  4499. $ctx1.sendIdx["deny:"]=2;
  4500. $3="hello"._yourself();
  4501. $ctx1.sendIdx["yourself"]=1;
  4502. self._assert_equals_("hello",$3);
  4503. $ctx1.sendIdx["assert:equals:"]=2;
  4504. self._assert_equals_("hello"._yourself(),"hello");
  4505. self._deny_("".__eq((0)));
  4506. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  4507. args: [],
  4508. 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",
  4509. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4510. referencedClasses: []
  4511. }),
  4512. smalltalk.StringTest);
  4513. smalltalk.addMethod(
  4514. smalltalk.method({
  4515. selector: "testIdentity",
  4516. protocol: 'tests',
  4517. fn: function (){
  4518. var self=this;
  4519. return smalltalk.withContext(function($ctx1) {
  4520. var $1,$2,$4,$3,$5;
  4521. $1="hello".__eq_eq("hello");
  4522. $ctx1.sendIdx["=="]=1;
  4523. self._assert_($1);
  4524. $ctx1.sendIdx["assert:"]=1;
  4525. $2="hello".__eq_eq("world");
  4526. $ctx1.sendIdx["=="]=2;
  4527. self._deny_($2);
  4528. $ctx1.sendIdx["deny:"]=1;
  4529. $4="hello"._yourself();
  4530. $ctx1.sendIdx["yourself"]=1;
  4531. $3="hello".__eq_eq($4);
  4532. $ctx1.sendIdx["=="]=3;
  4533. self._assert_($3);
  4534. $ctx1.sendIdx["assert:"]=2;
  4535. $5=_st("hello"._yourself()).__eq_eq("hello");
  4536. $ctx1.sendIdx["=="]=4;
  4537. self._assert_($5);
  4538. self._deny_("".__eq_eq((0)));
  4539. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  4540. args: [],
  4541. 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",
  4542. messageSends: ["assert:", "==", "deny:", "yourself"],
  4543. referencedClasses: []
  4544. }),
  4545. smalltalk.StringTest);
  4546. smalltalk.addMethod(
  4547. smalltalk.method({
  4548. selector: "testIdentityHash",
  4549. protocol: 'tests',
  4550. fn: function (){
  4551. var self=this;
  4552. return smalltalk.withContext(function($ctx1) {
  4553. var $1,$2,$4,$3;
  4554. $1="foo"._identityHash();
  4555. $ctx1.sendIdx["identityHash"]=1;
  4556. $2="foo"._identityHash();
  4557. $ctx1.sendIdx["identityHash"]=2;
  4558. self._assert_equals_($1,$2);
  4559. $4="foo"._identityHash();
  4560. $ctx1.sendIdx["identityHash"]=3;
  4561. $3=_st($4).__eq("bar"._identityHash());
  4562. self._deny_($3);
  4563. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  4564. args: [],
  4565. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4566. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4567. referencedClasses: []
  4568. }),
  4569. smalltalk.StringTest);
  4570. smalltalk.addMethod(
  4571. smalltalk.method({
  4572. selector: "testIncludesSubString",
  4573. protocol: 'tests',
  4574. fn: function (){
  4575. var self=this;
  4576. return smalltalk.withContext(function($ctx1) {
  4577. var $1;
  4578. $1="amber"._includesSubString_("ber");
  4579. $ctx1.sendIdx["includesSubString:"]=1;
  4580. self._assert_($1);
  4581. self._deny_("amber"._includesSubString_("zork"));
  4582. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  4583. args: [],
  4584. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4585. messageSends: ["assert:", "includesSubString:", "deny:"],
  4586. referencedClasses: []
  4587. }),
  4588. smalltalk.StringTest);
  4589. smalltalk.addMethod(
  4590. smalltalk.method({
  4591. selector: "testIsVowel",
  4592. protocol: 'tests',
  4593. fn: function (){
  4594. var self=this;
  4595. var vowel,consonant;
  4596. return smalltalk.withContext(function($ctx1) {
  4597. var $1;
  4598. vowel="u";
  4599. consonant="z";
  4600. $1=_st(vowel)._isVowel();
  4601. $ctx1.sendIdx["isVowel"]=1;
  4602. self._assert_equals_($1,true);
  4603. $ctx1.sendIdx["assert:equals:"]=1;
  4604. self._assert_equals_(_st(consonant)._isVowel(),false);
  4605. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  4606. args: [],
  4607. 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",
  4608. messageSends: ["assert:equals:", "isVowel"],
  4609. referencedClasses: []
  4610. }),
  4611. smalltalk.StringTest);
  4612. smalltalk.addMethod(
  4613. smalltalk.method({
  4614. selector: "testJoin",
  4615. protocol: 'tests',
  4616. fn: function (){
  4617. var self=this;
  4618. return smalltalk.withContext(function($ctx1) {
  4619. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4620. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  4621. args: [],
  4622. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4623. messageSends: ["assert:equals:", "join:"],
  4624. referencedClasses: []
  4625. }),
  4626. smalltalk.StringTest);
  4627. smalltalk.addMethod(
  4628. smalltalk.method({
  4629. selector: "testRemoveAll",
  4630. protocol: 'tests',
  4631. fn: function (){
  4632. var self=this;
  4633. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4634. return smalltalk.withContext(function($ctx1) {
  4635. self._should_raise_((function(){
  4636. return smalltalk.withContext(function($ctx2) {
  4637. return _st(self._collection())._removeAll();
  4638. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4639. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  4640. args: [],
  4641. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4642. messageSends: ["should:raise:", "removeAll", "collection"],
  4643. referencedClasses: ["Error"]
  4644. }),
  4645. smalltalk.StringTest);
  4646. smalltalk.addMethod(
  4647. smalltalk.method({
  4648. selector: "testReversed",
  4649. protocol: 'tests',
  4650. fn: function (){
  4651. var self=this;
  4652. return smalltalk.withContext(function($ctx1) {
  4653. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4654. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  4655. args: [],
  4656. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4657. messageSends: ["assert:equals:", "reversed"],
  4658. referencedClasses: []
  4659. }),
  4660. smalltalk.StringTest);
  4661. smalltalk.addMethod(
  4662. smalltalk.method({
  4663. selector: "testStreamContents",
  4664. protocol: 'tests',
  4665. fn: function (){
  4666. var self=this;
  4667. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4668. return smalltalk.withContext(function($ctx1) {
  4669. var $1;
  4670. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4671. return smalltalk.withContext(function($ctx2) {
  4672. _st(aStream)._nextPutAll_("hello");
  4673. $ctx2.sendIdx["nextPutAll:"]=1;
  4674. _st(aStream)._space();
  4675. $1=_st(aStream)._nextPutAll_("world");
  4676. return $1;
  4677. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4678. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  4679. args: [],
  4680. 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'",
  4681. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4682. referencedClasses: ["String"]
  4683. }),
  4684. smalltalk.StringTest);
  4685. smalltalk.addMethod(
  4686. smalltalk.method({
  4687. selector: "testSubStrings",
  4688. protocol: 'tests',
  4689. fn: function (){
  4690. var self=this;
  4691. return smalltalk.withContext(function($ctx1) {
  4692. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4693. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  4694. args: [],
  4695. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4696. messageSends: ["assert:equals:", "subStrings:"],
  4697. referencedClasses: []
  4698. }),
  4699. smalltalk.StringTest);
  4700. smalltalk.addMethod(
  4701. smalltalk.method({
  4702. selector: "testTrim",
  4703. protocol: 'tests',
  4704. fn: function (){
  4705. var self=this;
  4706. return smalltalk.withContext(function($ctx1) {
  4707. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  4708. $ctx1.sendIdx["assert:equals:"]=1;
  4709. self._assert_equals_("jackie "._trimRight(),"jackie");
  4710. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  4711. args: [],
  4712. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  4713. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  4714. referencedClasses: []
  4715. }),
  4716. smalltalk.StringTest);
  4717. smalltalk.addMethod(
  4718. smalltalk.method({
  4719. selector: "collectionClass",
  4720. protocol: 'fixture',
  4721. fn: function (){
  4722. var self=this;
  4723. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4724. return smalltalk.withContext(function($ctx1) {
  4725. return $String();
  4726. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  4727. args: [],
  4728. source: "collectionClass\x0a\x09^ String",
  4729. messageSends: [],
  4730. referencedClasses: ["String"]
  4731. }),
  4732. smalltalk.StringTest.klass);
  4733. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4734. smalltalk.addMethod(
  4735. smalltalk.method({
  4736. selector: "testShow",
  4737. protocol: 'tests',
  4738. fn: function (){
  4739. var self=this;
  4740. var originalTranscript;
  4741. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  4742. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  4743. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4744. return smalltalk.withContext(function($ctx1) {
  4745. originalTranscript=_st($Transcript())._current();
  4746. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  4747. $ctx1.sendIdx["register:"]=1;
  4748. self._shouldnt_raise_((function(){
  4749. return smalltalk.withContext(function($ctx2) {
  4750. return _st($Transcript())._show_("Hello console!");
  4751. $ctx2.sendIdx["show:"]=1;
  4752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4753. $ctx1.sendIdx["shouldnt:raise:"]=1;
  4754. self._shouldnt_raise_((function(){
  4755. return smalltalk.withContext(function($ctx2) {
  4756. return _st($Transcript())._show_(console);
  4757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4758. _st($Transcript())._register_(originalTranscript);
  4759. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  4760. args: [],
  4761. 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.",
  4762. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  4763. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  4764. }),
  4765. smalltalk.ConsoleTranscriptTest);
  4766. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4767. smalltalk.addMethod(
  4768. smalltalk.method({
  4769. selector: "jsObject",
  4770. protocol: 'accessing',
  4771. fn: function (){
  4772. var self=this;
  4773. return smalltalk.withContext(function($ctx1) {
  4774. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  4775. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  4776. args: [],
  4777. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  4778. messageSends: [],
  4779. referencedClasses: []
  4780. }),
  4781. smalltalk.JSObjectProxyTest);
  4782. smalltalk.addMethod(
  4783. smalltalk.method({
  4784. selector: "testAtIfAbsent",
  4785. protocol: 'tests',
  4786. fn: function (){
  4787. var self=this;
  4788. var testObject;
  4789. return smalltalk.withContext(function($ctx1) {
  4790. var $1,$2,$3;
  4791. testObject=self._jsObject();
  4792. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  4793. return smalltalk.withContext(function($ctx2) {
  4794. return "Property does not exist";
  4795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4796. $ctx1.sendIdx["at:ifAbsent:"]=1;
  4797. self._assert_equals_($1,"Property does not exist");
  4798. $ctx1.sendIdx["assert:equals:"]=1;
  4799. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  4800. return smalltalk.withContext(function($ctx2) {
  4801. return "Property does not exist";
  4802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4803. $ctx1.sendIdx["at:ifAbsent:"]=2;
  4804. self._assert_equals_($2,nil);
  4805. $ctx1.sendIdx["assert:equals:"]=2;
  4806. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  4807. return smalltalk.withContext(function($ctx2) {
  4808. return "Property does not exist";
  4809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  4810. $ctx1.sendIdx["at:ifAbsent:"]=3;
  4811. self._assert_equals_($3,(1));
  4812. $ctx1.sendIdx["assert:equals:"]=3;
  4813. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  4814. return smalltalk.withContext(function($ctx2) {
  4815. return "Property does not exist";
  4816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  4817. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4818. args: [],
  4819. 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.",
  4820. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  4821. referencedClasses: []
  4822. }),
  4823. smalltalk.JSObjectProxyTest);
  4824. smalltalk.addMethod(
  4825. smalltalk.method({
  4826. selector: "testAtIfPresent",
  4827. protocol: 'tests',
  4828. fn: function (){
  4829. var self=this;
  4830. var testObject;
  4831. return smalltalk.withContext(function($ctx1) {
  4832. var $2,$1,$4,$3,$6,$5;
  4833. testObject=self._jsObject();
  4834. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  4835. return smalltalk.withContext(function($ctx2) {
  4836. $2=_st(x)._asString();
  4837. $ctx2.sendIdx["asString"]=1;
  4838. return "hello ".__comma($2);
  4839. $ctx2.sendIdx[","]=1;
  4840. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  4841. $ctx1.sendIdx["at:ifPresent:"]=1;
  4842. self._assert_equals_($1,nil);
  4843. $ctx1.sendIdx["assert:equals:"]=1;
  4844. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  4845. return smalltalk.withContext(function($ctx2) {
  4846. $4=_st(x)._asString();
  4847. $ctx2.sendIdx["asString"]=2;
  4848. return "hello ".__comma($4);
  4849. $ctx2.sendIdx[","]=2;
  4850. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  4851. $ctx1.sendIdx["at:ifPresent:"]=2;
  4852. self._assert_equals_($3,"hello nil");
  4853. $ctx1.sendIdx["assert:equals:"]=2;
  4854. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  4855. return smalltalk.withContext(function($ctx2) {
  4856. $6=_st(x)._asString();
  4857. $ctx2.sendIdx["asString"]=3;
  4858. return "hello ".__comma($6);
  4859. $ctx2.sendIdx[","]=3;
  4860. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  4861. $ctx1.sendIdx["at:ifPresent:"]=3;
  4862. self._assert_equals_($5,"hello 1");
  4863. $ctx1.sendIdx["assert:equals:"]=3;
  4864. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  4865. return smalltalk.withContext(function($ctx2) {
  4866. return "hello ".__comma(_st(x)._asString());
  4867. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  4868. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4869. args: [],
  4870. 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'.",
  4871. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  4872. referencedClasses: []
  4873. }),
  4874. smalltalk.JSObjectProxyTest);
  4875. smalltalk.addMethod(
  4876. smalltalk.method({
  4877. selector: "testAtIfPresentIfAbsent",
  4878. protocol: 'tests',
  4879. fn: function (){
  4880. var self=this;
  4881. var testObject;
  4882. return smalltalk.withContext(function($ctx1) {
  4883. var $2,$1,$4,$3,$6,$5;
  4884. testObject=self._jsObject();
  4885. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  4886. return smalltalk.withContext(function($ctx2) {
  4887. $2=_st(x)._asString();
  4888. $ctx2.sendIdx["asString"]=1;
  4889. return "hello ".__comma($2);
  4890. $ctx2.sendIdx[","]=1;
  4891. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  4892. return smalltalk.withContext(function($ctx2) {
  4893. return "not present";
  4894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4895. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  4896. self._assert_equals_($1,"not present");
  4897. $ctx1.sendIdx["assert:equals:"]=1;
  4898. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  4899. return smalltalk.withContext(function($ctx2) {
  4900. $4=_st(x)._asString();
  4901. $ctx2.sendIdx["asString"]=2;
  4902. return "hello ".__comma($4);
  4903. $ctx2.sendIdx[","]=2;
  4904. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  4905. return smalltalk.withContext(function($ctx2) {
  4906. return "not present";
  4907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4908. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  4909. self._assert_equals_($3,"hello nil");
  4910. $ctx1.sendIdx["assert:equals:"]=2;
  4911. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  4912. return smalltalk.withContext(function($ctx2) {
  4913. $6=_st(x)._asString();
  4914. $ctx2.sendIdx["asString"]=3;
  4915. return "hello ".__comma($6);
  4916. $ctx2.sendIdx[","]=3;
  4917. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  4918. return smalltalk.withContext(function($ctx2) {
  4919. return "not present";
  4920. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  4921. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  4922. self._assert_equals_($5,"hello 1");
  4923. $ctx1.sendIdx["assert:equals:"]=3;
  4924. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  4925. return smalltalk.withContext(function($ctx2) {
  4926. return "hello ".__comma(_st(x)._asString());
  4927. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  4928. return smalltalk.withContext(function($ctx2) {
  4929. return "not present";
  4930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  4931. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4932. args: [],
  4933. 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'.",
  4934. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  4935. referencedClasses: []
  4936. }),
  4937. smalltalk.JSObjectProxyTest);
  4938. smalltalk.addMethod(
  4939. smalltalk.method({
  4940. selector: "testAtPut",
  4941. protocol: 'tests',
  4942. fn: function (){
  4943. var self=this;
  4944. var testObject;
  4945. return smalltalk.withContext(function($ctx1) {
  4946. var $2,$1;
  4947. testObject=self._jsObject();
  4948. $2=_st(testObject)._at_("abc");
  4949. $ctx1.sendIdx["at:"]=1;
  4950. $1=_st($2).__tild_eq("xyz");
  4951. self._assert_($1);
  4952. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  4953. $ctx1.sendIdx["assert:equals:"]=1;
  4954. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  4955. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4956. args: [],
  4957. 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'",
  4958. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  4959. referencedClasses: []
  4960. }),
  4961. smalltalk.JSObjectProxyTest);
  4962. smalltalk.addMethod(
  4963. smalltalk.method({
  4964. selector: "testDNU",
  4965. protocol: 'tests',
  4966. fn: function (){
  4967. var self=this;
  4968. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4969. return smalltalk.withContext(function($ctx1) {
  4970. self._should_raise_((function(){
  4971. return smalltalk.withContext(function($ctx2) {
  4972. return _st(self._jsObject())._foo();
  4973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4974. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  4975. args: [],
  4976. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  4977. messageSends: ["should:raise:", "foo", "jsObject"],
  4978. referencedClasses: ["MessageNotUnderstood"]
  4979. }),
  4980. smalltalk.JSObjectProxyTest);
  4981. smalltalk.addMethod(
  4982. smalltalk.method({
  4983. selector: "testMessageSend",
  4984. protocol: 'tests',
  4985. fn: function (){
  4986. var self=this;
  4987. return smalltalk.withContext(function($ctx1) {
  4988. var $2,$1,$4,$3;
  4989. $2=self._jsObject();
  4990. $ctx1.sendIdx["jsObject"]=1;
  4991. $1=_st($2)._a();
  4992. self._assert_equals_($1,(1));
  4993. $ctx1.sendIdx["assert:equals:"]=1;
  4994. $4=self._jsObject();
  4995. $ctx1.sendIdx["jsObject"]=2;
  4996. $3=_st($4)._b();
  4997. self._assert_equals_($3,(2));
  4998. $ctx1.sendIdx["assert:equals:"]=2;
  4999. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5000. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  5001. args: [],
  5002. 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",
  5003. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5004. referencedClasses: []
  5005. }),
  5006. smalltalk.JSObjectProxyTest);
  5007. smalltalk.addMethod(
  5008. smalltalk.method({
  5009. selector: "testMethodWithArguments",
  5010. protocol: 'tests',
  5011. fn: function (){
  5012. var self=this;
  5013. return smalltalk.withContext(function($ctx1) {
  5014. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5015. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  5016. args: [],
  5017. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5018. messageSends: ["assert:equals:", "c:", "jsObject"],
  5019. referencedClasses: []
  5020. }),
  5021. smalltalk.JSObjectProxyTest);
  5022. smalltalk.addMethod(
  5023. smalltalk.method({
  5024. selector: "testPrinting",
  5025. protocol: 'tests',
  5026. fn: function (){
  5027. var self=this;
  5028. return smalltalk.withContext(function($ctx1) {
  5029. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5030. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  5031. args: [],
  5032. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5033. messageSends: ["assert:equals:", "printString", "jsObject"],
  5034. referencedClasses: []
  5035. }),
  5036. smalltalk.JSObjectProxyTest);
  5037. smalltalk.addMethod(
  5038. smalltalk.method({
  5039. selector: "testPropertyThatReturnsEmptyString",
  5040. protocol: 'tests',
  5041. fn: function (){
  5042. var self=this;
  5043. var object;
  5044. return smalltalk.withContext(function($ctx1) {
  5045. var $1;
  5046. object=self._jsObject();
  5047. $1=_st(object)._d();
  5048. $ctx1.sendIdx["d"]=1;
  5049. self._assert_equals_($1,"");
  5050. $ctx1.sendIdx["assert:equals:"]=1;
  5051. _st(object)._d_("hello");
  5052. self._assert_equals_(_st(object)._d(),"hello");
  5053. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  5054. args: [],
  5055. 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'",
  5056. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5057. referencedClasses: []
  5058. }),
  5059. smalltalk.JSObjectProxyTest);
  5060. smalltalk.addMethod(
  5061. smalltalk.method({
  5062. selector: "testPropertyThatReturnsUndefined",
  5063. protocol: 'tests',
  5064. fn: function (){
  5065. var self=this;
  5066. var object;
  5067. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5068. return smalltalk.withContext(function($ctx1) {
  5069. object=self._jsObject();
  5070. self._shouldnt_raise_((function(){
  5071. return smalltalk.withContext(function($ctx2) {
  5072. return _st(object)._e();
  5073. $ctx2.sendIdx["e"]=1;
  5074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5075. self._assert_(_st(_st(object)._e())._isNil());
  5076. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  5077. args: [],
  5078. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5079. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5080. referencedClasses: ["MessageNotUnderstood"]
  5081. }),
  5082. smalltalk.JSObjectProxyTest);
  5083. smalltalk.addMethod(
  5084. smalltalk.method({
  5085. selector: "testValue",
  5086. protocol: 'tests',
  5087. fn: function (){
  5088. var self=this;
  5089. var testObject;
  5090. return smalltalk.withContext(function($ctx1) {
  5091. testObject=self._jsObject();
  5092. _st(testObject)._at_put_("value","aValue");
  5093. self._assert_equals_(_st(testObject)._value(),"aValue");
  5094. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  5095. args: [],
  5096. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5097. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5098. referencedClasses: []
  5099. }),
  5100. smalltalk.JSObjectProxyTest);
  5101. smalltalk.addMethod(
  5102. smalltalk.method({
  5103. selector: "testYourself",
  5104. protocol: 'tests',
  5105. fn: function (){
  5106. var self=this;
  5107. var object;
  5108. return smalltalk.withContext(function($ctx1) {
  5109. var $1,$2;
  5110. $1=self._jsObject();
  5111. _st($1)._d_("test");
  5112. $2=_st($1)._yourself();
  5113. object=$2;
  5114. self._assert_equals_(_st(object)._d(),"test");
  5115. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  5116. args: [],
  5117. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5118. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5119. referencedClasses: []
  5120. }),
  5121. smalltalk.JSObjectProxyTest);
  5122. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5123. smalltalk.addMethod(
  5124. smalltalk.method({
  5125. selector: "testCatchingException",
  5126. protocol: 'tests',
  5127. fn: function (){
  5128. var self=this;
  5129. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5130. return smalltalk.withContext(function($ctx1) {
  5131. _st((function(){
  5132. return smalltalk.withContext(function($ctx2) {
  5133. return self._throwException();
  5134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  5135. return smalltalk.withContext(function($ctx2) {
  5136. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  5137. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  5138. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  5139. args: [],
  5140. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  5141. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  5142. referencedClasses: ["Error"]
  5143. }),
  5144. smalltalk.JavaScriptExceptionTest);
  5145. smalltalk.addMethod(
  5146. smalltalk.method({
  5147. selector: "testRaisingException",
  5148. protocol: 'tests',
  5149. fn: function (){
  5150. var self=this;
  5151. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5152. return smalltalk.withContext(function($ctx1) {
  5153. self._should_raise_((function(){
  5154. return smalltalk.withContext(function($ctx2) {
  5155. return self._throwException();
  5156. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5157. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  5158. args: [],
  5159. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5160. messageSends: ["should:raise:", "throwException"],
  5161. referencedClasses: ["JavaScriptException"]
  5162. }),
  5163. smalltalk.JavaScriptExceptionTest);
  5164. smalltalk.addMethod(
  5165. smalltalk.method({
  5166. selector: "throwException",
  5167. protocol: 'helpers',
  5168. fn: function (){
  5169. var self=this;
  5170. return smalltalk.withContext(function($ctx1) {
  5171. throw 'test';
  5172. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  5173. args: [],
  5174. source: "throwException\x0a\x09<throw 'test'>",
  5175. messageSends: [],
  5176. referencedClasses: []
  5177. }),
  5178. smalltalk.JavaScriptExceptionTest);
  5179. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5180. smalltalk.addMethod(
  5181. smalltalk.method({
  5182. selector: "testValue",
  5183. protocol: 'tests',
  5184. fn: function (){
  5185. var self=this;
  5186. var messageSend;
  5187. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5188. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5189. return smalltalk.withContext(function($ctx1) {
  5190. var $1,$2;
  5191. $1=_st($MessageSend())._new();
  5192. $ctx1.sendIdx["new"]=1;
  5193. _st($1)._receiver_(_st($Object())._new());
  5194. _st($1)._selector_("asString");
  5195. $2=_st($1)._yourself();
  5196. messageSend=$2;
  5197. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5198. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5199. args: [],
  5200. 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'",
  5201. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  5202. referencedClasses: ["MessageSend", "Object"]
  5203. }),
  5204. smalltalk.MessageSendTest);
  5205. smalltalk.addMethod(
  5206. smalltalk.method({
  5207. selector: "testValueWithArguments",
  5208. protocol: 'tests',
  5209. fn: function (){
  5210. var self=this;
  5211. var messageSend;
  5212. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5213. return smalltalk.withContext(function($ctx1) {
  5214. var $1,$2;
  5215. $1=_st($MessageSend())._new();
  5216. _st($1)._receiver_((2));
  5217. _st($1)._selector_("+");
  5218. $2=_st($1)._yourself();
  5219. messageSend=$2;
  5220. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  5221. $ctx1.sendIdx["assert:equals:"]=1;
  5222. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  5223. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5224. args: [],
  5225. 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",
  5226. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  5227. referencedClasses: ["MessageSend"]
  5228. }),
  5229. smalltalk.MessageSendTest);
  5230. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  5231. smalltalk.addMethod(
  5232. smalltalk.method({
  5233. selector: "codeGeneratorClass",
  5234. protocol: 'accessing',
  5235. fn: function (){
  5236. var self=this;
  5237. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  5238. return smalltalk.withContext(function($ctx1) {
  5239. return $CodeGenerator();
  5240. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  5241. args: [],
  5242. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  5243. messageSends: [],
  5244. referencedClasses: ["CodeGenerator"]
  5245. }),
  5246. smalltalk.MethodInheritanceTest);
  5247. smalltalk.addMethod(
  5248. smalltalk.method({
  5249. selector: "compiler",
  5250. protocol: 'factory',
  5251. fn: function (){
  5252. var self=this;
  5253. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5254. return smalltalk.withContext(function($ctx1) {
  5255. var $2,$3,$1;
  5256. $2=_st($Compiler())._new();
  5257. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  5258. $3=_st($2)._yourself();
  5259. $1=$3;
  5260. return $1;
  5261. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  5262. args: [],
  5263. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  5264. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  5265. referencedClasses: ["Compiler"]
  5266. }),
  5267. smalltalk.MethodInheritanceTest);
  5268. smalltalk.addMethod(
  5269. smalltalk.method({
  5270. selector: "deinstallBottom",
  5271. protocol: 'testing',
  5272. fn: function (){
  5273. var self=this;
  5274. return smalltalk.withContext(function($ctx1) {
  5275. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  5276. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  5277. args: [],
  5278. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  5279. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  5280. referencedClasses: []
  5281. }),
  5282. smalltalk.MethodInheritanceTest);
  5283. smalltalk.addMethod(
  5284. smalltalk.method({
  5285. selector: "deinstallMiddle",
  5286. protocol: 'testing',
  5287. fn: function (){
  5288. var self=this;
  5289. return smalltalk.withContext(function($ctx1) {
  5290. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  5291. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  5292. args: [],
  5293. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  5294. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  5295. referencedClasses: []
  5296. }),
  5297. smalltalk.MethodInheritanceTest);
  5298. smalltalk.addMethod(
  5299. smalltalk.method({
  5300. selector: "deinstallTop",
  5301. protocol: 'testing',
  5302. fn: function (){
  5303. var self=this;
  5304. return smalltalk.withContext(function($ctx1) {
  5305. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  5306. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  5307. args: [],
  5308. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  5309. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  5310. referencedClasses: []
  5311. }),
  5312. smalltalk.MethodInheritanceTest);
  5313. smalltalk.addMethod(
  5314. smalltalk.method({
  5315. selector: "installBottom:",
  5316. protocol: 'testing',
  5317. fn: function (aString){
  5318. var self=this;
  5319. return smalltalk.withContext(function($ctx1) {
  5320. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  5321. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5322. args: ["aString"],
  5323. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  5324. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  5325. referencedClasses: []
  5326. }),
  5327. smalltalk.MethodInheritanceTest);
  5328. smalltalk.addMethod(
  5329. smalltalk.method({
  5330. selector: "installMiddle:",
  5331. protocol: 'testing',
  5332. fn: function (aString){
  5333. var self=this;
  5334. return smalltalk.withContext(function($ctx1) {
  5335. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  5336. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5337. args: ["aString"],
  5338. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  5339. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  5340. referencedClasses: []
  5341. }),
  5342. smalltalk.MethodInheritanceTest);
  5343. smalltalk.addMethod(
  5344. smalltalk.method({
  5345. selector: "installTop:",
  5346. protocol: 'testing',
  5347. fn: function (aString){
  5348. var self=this;
  5349. return smalltalk.withContext(function($ctx1) {
  5350. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  5351. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5352. args: ["aString"],
  5353. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  5354. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  5355. referencedClasses: []
  5356. }),
  5357. smalltalk.MethodInheritanceTest);
  5358. smalltalk.addMethod(
  5359. smalltalk.method({
  5360. selector: "setUp",
  5361. protocol: 'initialization',
  5362. fn: function (){
  5363. var self=this;
  5364. return smalltalk.withContext(function($ctx1) {
  5365. self["@receiverTop"]=_st(self._targetClassTop())._new();
  5366. $ctx1.sendIdx["new"]=1;
  5367. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  5368. $ctx1.sendIdx["new"]=2;
  5369. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  5370. self["@method"]=nil;
  5371. self["@performBlock"]=(function(){
  5372. return smalltalk.withContext(function($ctx2) {
  5373. return self._error_("performBlock not initialized");
  5374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  5375. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  5376. args: [],
  5377. 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' ]",
  5378. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  5379. referencedClasses: []
  5380. }),
  5381. smalltalk.MethodInheritanceTest);
  5382. smalltalk.addMethod(
  5383. smalltalk.method({
  5384. selector: "shouldMNU",
  5385. protocol: 'testing',
  5386. fn: function (){
  5387. var self=this;
  5388. return smalltalk.withContext(function($ctx1) {
  5389. self._shouldMNUTop();
  5390. self._shouldMNUMiddle();
  5391. self._shouldMNUBottom();
  5392. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  5393. args: [],
  5394. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  5395. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  5396. referencedClasses: []
  5397. }),
  5398. smalltalk.MethodInheritanceTest);
  5399. smalltalk.addMethod(
  5400. smalltalk.method({
  5401. selector: "shouldMNUBottom",
  5402. protocol: 'testing',
  5403. fn: function (){
  5404. var self=this;
  5405. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5406. return smalltalk.withContext(function($ctx1) {
  5407. self._should_raise_((function(){
  5408. return smalltalk.withContext(function($ctx2) {
  5409. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5410. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5411. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  5412. args: [],
  5413. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  5414. messageSends: ["should:raise:", "value:"],
  5415. referencedClasses: ["MessageNotUnderstood"]
  5416. }),
  5417. smalltalk.MethodInheritanceTest);
  5418. smalltalk.addMethod(
  5419. smalltalk.method({
  5420. selector: "shouldMNUMiddle",
  5421. protocol: 'testing',
  5422. fn: function (){
  5423. var self=this;
  5424. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5425. return smalltalk.withContext(function($ctx1) {
  5426. self._should_raise_((function(){
  5427. return smalltalk.withContext(function($ctx2) {
  5428. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5430. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  5431. args: [],
  5432. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  5433. messageSends: ["should:raise:", "value:"],
  5434. referencedClasses: ["MessageNotUnderstood"]
  5435. }),
  5436. smalltalk.MethodInheritanceTest);
  5437. smalltalk.addMethod(
  5438. smalltalk.method({
  5439. selector: "shouldMNUTop",
  5440. protocol: 'testing',
  5441. fn: function (){
  5442. var self=this;
  5443. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5444. return smalltalk.withContext(function($ctx1) {
  5445. self._should_raise_((function(){
  5446. return smalltalk.withContext(function($ctx2) {
  5447. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  5448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5449. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  5450. args: [],
  5451. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  5452. messageSends: ["should:raise:", "value:"],
  5453. referencedClasses: ["MessageNotUnderstood"]
  5454. }),
  5455. smalltalk.MethodInheritanceTest);
  5456. smalltalk.addMethod(
  5457. smalltalk.method({
  5458. selector: "shouldReturn:",
  5459. protocol: 'testing',
  5460. fn: function (anObject){
  5461. var self=this;
  5462. var result;
  5463. return smalltalk.withContext(function($ctx1) {
  5464. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  5465. $ctx1.sendIdx["value:"]=1;
  5466. self._assert_equals_(["top",anObject],["top",result]);
  5467. $ctx1.sendIdx["assert:equals:"]=1;
  5468. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5469. $ctx1.sendIdx["value:"]=2;
  5470. self._assert_equals_(["middle",anObject],["middle",result]);
  5471. $ctx1.sendIdx["assert:equals:"]=2;
  5472. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5473. self._assert_equals_(["bottom",anObject],["bottom",result]);
  5474. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  5475. args: ["anObject"],
  5476. 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 }",
  5477. messageSends: ["value:", "assert:equals:"],
  5478. referencedClasses: []
  5479. }),
  5480. smalltalk.MethodInheritanceTest);
  5481. smalltalk.addMethod(
  5482. smalltalk.method({
  5483. selector: "shouldReturn:and:and:",
  5484. protocol: 'testing',
  5485. fn: function (anObject,anObject2,anObject3){
  5486. var self=this;
  5487. var result;
  5488. return smalltalk.withContext(function($ctx1) {
  5489. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  5490. $ctx1.sendIdx["value:"]=1;
  5491. self._assert_equals_(["top",anObject],["top",result]);
  5492. $ctx1.sendIdx["assert:equals:"]=1;
  5493. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5494. $ctx1.sendIdx["value:"]=2;
  5495. self._assert_equals_(["middle",anObject2],["middle",result]);
  5496. $ctx1.sendIdx["assert:equals:"]=2;
  5497. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5498. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  5499. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  5500. args: ["anObject", "anObject2", "anObject3"],
  5501. 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 }",
  5502. messageSends: ["value:", "assert:equals:"],
  5503. referencedClasses: []
  5504. }),
  5505. smalltalk.MethodInheritanceTest);
  5506. smalltalk.addMethod(
  5507. smalltalk.method({
  5508. selector: "targetClassBottom",
  5509. protocol: 'accessing',
  5510. fn: function (){
  5511. var self=this;
  5512. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5513. return smalltalk.withContext(function($ctx1) {
  5514. return $JavaScriptException();
  5515. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  5516. args: [],
  5517. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  5518. messageSends: [],
  5519. referencedClasses: ["JavaScriptException"]
  5520. }),
  5521. smalltalk.MethodInheritanceTest);
  5522. smalltalk.addMethod(
  5523. smalltalk.method({
  5524. selector: "targetClassMiddle",
  5525. protocol: 'accessing',
  5526. fn: function (){
  5527. var self=this;
  5528. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5529. return smalltalk.withContext(function($ctx1) {
  5530. return $Error();
  5531. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  5532. args: [],
  5533. source: "targetClassMiddle\x0a\x09^ Error",
  5534. messageSends: [],
  5535. referencedClasses: ["Error"]
  5536. }),
  5537. smalltalk.MethodInheritanceTest);
  5538. smalltalk.addMethod(
  5539. smalltalk.method({
  5540. selector: "targetClassTop",
  5541. protocol: 'accessing',
  5542. fn: function (){
  5543. var self=this;
  5544. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5545. return smalltalk.withContext(function($ctx1) {
  5546. return $Object();
  5547. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  5548. args: [],
  5549. source: "targetClassTop\x0a\x09^ Object",
  5550. messageSends: [],
  5551. referencedClasses: ["Object"]
  5552. }),
  5553. smalltalk.MethodInheritanceTest);
  5554. smalltalk.addMethod(
  5555. smalltalk.method({
  5556. selector: "tearDown",
  5557. protocol: 'initialization',
  5558. fn: function (){
  5559. var self=this;
  5560. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5561. return smalltalk.withContext(function($ctx1) {
  5562. _st((function(){
  5563. return smalltalk.withContext(function($ctx2) {
  5564. return self._deinstallTop();
  5565. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  5566. return smalltalk.withContext(function($ctx2) {
  5567. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5568. $ctx1.sendIdx["on:do:"]=1;
  5569. _st((function(){
  5570. return smalltalk.withContext(function($ctx2) {
  5571. return self._deinstallMiddle();
  5572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  5573. return smalltalk.withContext(function($ctx2) {
  5574. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5575. $ctx1.sendIdx["on:do:"]=2;
  5576. _st((function(){
  5577. return smalltalk.withContext(function($ctx2) {
  5578. return self._deinstallBottom();
  5579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  5580. return smalltalk.withContext(function($ctx2) {
  5581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5582. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  5583. args: [],
  5584. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  5585. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  5586. referencedClasses: ["Error"]
  5587. }),
  5588. smalltalk.MethodInheritanceTest);
  5589. smalltalk.addMethod(
  5590. smalltalk.method({
  5591. selector: "testMNU11",
  5592. protocol: 'tests',
  5593. fn: function (){
  5594. var self=this;
  5595. return smalltalk.withContext(function($ctx1) {
  5596. self["@performBlock"]=(function(x){
  5597. return smalltalk.withContext(function($ctx2) {
  5598. return _st(x)._foo();
  5599. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  5600. self._shouldMNU();
  5601. $ctx1.sendIdx["shouldMNU"]=1;
  5602. self._installTop_("foo ^ false");
  5603. $ctx1.sendIdx["installTop:"]=1;
  5604. self._installTop_("foo ^ true");
  5605. self._deinstallTop();
  5606. self._shouldMNU();
  5607. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  5608. args: [],
  5609. 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",
  5610. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  5611. referencedClasses: []
  5612. }),
  5613. smalltalk.MethodInheritanceTest);
  5614. smalltalk.addMethod(
  5615. smalltalk.method({
  5616. selector: "testMNU22",
  5617. protocol: 'tests',
  5618. fn: function (){
  5619. var self=this;
  5620. return smalltalk.withContext(function($ctx1) {
  5621. self["@performBlock"]=(function(x){
  5622. return smalltalk.withContext(function($ctx2) {
  5623. return _st(x)._foo();
  5624. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  5625. self._shouldMNU();
  5626. $ctx1.sendIdx["shouldMNU"]=1;
  5627. self._installMiddle_("foo ^ false");
  5628. $ctx1.sendIdx["installMiddle:"]=1;
  5629. self._installMiddle_("foo ^ true");
  5630. self._deinstallMiddle();
  5631. self._shouldMNU();
  5632. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  5633. args: [],
  5634. 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",
  5635. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  5636. referencedClasses: []
  5637. }),
  5638. smalltalk.MethodInheritanceTest);
  5639. smalltalk.addMethod(
  5640. smalltalk.method({
  5641. selector: "testReturns1",
  5642. protocol: 'tests',
  5643. fn: function (){
  5644. var self=this;
  5645. return smalltalk.withContext(function($ctx1) {
  5646. self["@performBlock"]=(function(x){
  5647. return smalltalk.withContext(function($ctx2) {
  5648. return _st(x)._foo();
  5649. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  5650. self._installTop_("foo ^ false");
  5651. $ctx1.sendIdx["installTop:"]=1;
  5652. self._shouldReturn_(false);
  5653. $ctx1.sendIdx["shouldReturn:"]=1;
  5654. self._installTop_("foo ^ true");
  5655. self._shouldReturn_(true);
  5656. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  5657. args: [],
  5658. 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",
  5659. messageSends: ["foo", "installTop:", "shouldReturn:"],
  5660. referencedClasses: []
  5661. }),
  5662. smalltalk.MethodInheritanceTest);
  5663. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5664. smalltalk.addMethod(
  5665. smalltalk.method({
  5666. selector: "testAbs",
  5667. protocol: 'tests',
  5668. fn: function (){
  5669. var self=this;
  5670. return smalltalk.withContext(function($ctx1) {
  5671. var $1;
  5672. $1=(4)._abs();
  5673. $ctx1.sendIdx["abs"]=1;
  5674. self._assert_equals_($1,(4));
  5675. $ctx1.sendIdx["assert:equals:"]=1;
  5676. self._assert_equals_((-4)._abs(),(4));
  5677. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  5678. args: [],
  5679. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  5680. messageSends: ["assert:equals:", "abs"],
  5681. referencedClasses: []
  5682. }),
  5683. smalltalk.NumberTest);
  5684. smalltalk.addMethod(
  5685. smalltalk.method({
  5686. selector: "testArithmetic",
  5687. protocol: 'tests',
  5688. fn: function (){
  5689. var self=this;
  5690. return smalltalk.withContext(function($ctx1) {
  5691. var $1,$2,$3,$5,$4;
  5692. $1=(1.5).__plus((1));
  5693. $ctx1.sendIdx["+"]=1;
  5694. self._assert_equals_($1,(2.5));
  5695. $ctx1.sendIdx["assert:equals:"]=1;
  5696. $2=(2).__minus((1));
  5697. $ctx1.sendIdx["-"]=1;
  5698. self._assert_equals_($2,(1));
  5699. $ctx1.sendIdx["assert:equals:"]=2;
  5700. self._assert_equals_((-2).__minus((1)),(-3));
  5701. $ctx1.sendIdx["assert:equals:"]=3;
  5702. self._assert_equals_((12).__slash((2)),(6));
  5703. $ctx1.sendIdx["assert:equals:"]=4;
  5704. $3=(3).__star((4));
  5705. $ctx1.sendIdx["*"]=1;
  5706. self._assert_equals_($3,(12));
  5707. $ctx1.sendIdx["assert:equals:"]=5;
  5708. self._assert_equals_((7).__slash_slash((2)),(3));
  5709. $ctx1.sendIdx["assert:equals:"]=6;
  5710. self._assert_equals_((7).__backslash_backslash((2)),(1));
  5711. $ctx1.sendIdx["assert:equals:"]=7;
  5712. $5=(1).__plus((2));
  5713. $ctx1.sendIdx["+"]=2;
  5714. $4=_st($5).__star((3));
  5715. $ctx1.sendIdx["*"]=2;
  5716. self._assert_equals_($4,(9));
  5717. $ctx1.sendIdx["assert:equals:"]=8;
  5718. self._assert_equals_((1).__plus((2).__star((3))),(7));
  5719. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  5720. args: [],
  5721. 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",
  5722. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  5723. referencedClasses: []
  5724. }),
  5725. smalltalk.NumberTest);
  5726. smalltalk.addMethod(
  5727. smalltalk.method({
  5728. selector: "testAsNumber",
  5729. protocol: 'tests',
  5730. fn: function (){
  5731. var self=this;
  5732. return smalltalk.withContext(function($ctx1) {
  5733. self._assert_equals_((3)._asNumber(),(3));
  5734. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  5735. args: [],
  5736. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  5737. messageSends: ["assert:equals:", "asNumber"],
  5738. referencedClasses: []
  5739. }),
  5740. smalltalk.NumberTest);
  5741. smalltalk.addMethod(
  5742. smalltalk.method({
  5743. selector: "testCeiling",
  5744. protocol: 'tests',
  5745. fn: function (){
  5746. var self=this;
  5747. return smalltalk.withContext(function($ctx1) {
  5748. var $1,$2;
  5749. $1=(1.2)._ceiling();
  5750. $ctx1.sendIdx["ceiling"]=1;
  5751. self._assert_equals_($1,(2));
  5752. $ctx1.sendIdx["assert:equals:"]=1;
  5753. $2=(-1.2)._ceiling();
  5754. $ctx1.sendIdx["ceiling"]=2;
  5755. self._assert_equals_($2,(-1));
  5756. $ctx1.sendIdx["assert:equals:"]=2;
  5757. self._assert_equals_((1)._ceiling(),(1));
  5758. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  5759. args: [],
  5760. 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.",
  5761. messageSends: ["assert:equals:", "ceiling"],
  5762. referencedClasses: []
  5763. }),
  5764. smalltalk.NumberTest);
  5765. smalltalk.addMethod(
  5766. smalltalk.method({
  5767. selector: "testComparison",
  5768. protocol: 'tests',
  5769. fn: function (){
  5770. var self=this;
  5771. return smalltalk.withContext(function($ctx1) {
  5772. var $1,$2,$3,$4;
  5773. $1=(3).__gt((2));
  5774. $ctx1.sendIdx[">"]=1;
  5775. self._assert_($1);
  5776. $ctx1.sendIdx["assert:"]=1;
  5777. $2=(2).__lt((3));
  5778. $ctx1.sendIdx["<"]=1;
  5779. self._assert_($2);
  5780. $ctx1.sendIdx["assert:"]=2;
  5781. self._deny_((3).__lt((2)));
  5782. $ctx1.sendIdx["deny:"]=1;
  5783. self._deny_((2).__gt((3)));
  5784. $3=(3).__gt_eq((3));
  5785. $ctx1.sendIdx[">="]=1;
  5786. self._assert_($3);
  5787. $ctx1.sendIdx["assert:"]=3;
  5788. self._assert_((3.1).__gt_eq((3)));
  5789. $ctx1.sendIdx["assert:"]=4;
  5790. $4=(3).__lt_eq((3));
  5791. $ctx1.sendIdx["<="]=1;
  5792. self._assert_($4);
  5793. $ctx1.sendIdx["assert:"]=5;
  5794. self._assert_((3).__lt_eq((3.1)));
  5795. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  5796. args: [],
  5797. 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",
  5798. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  5799. referencedClasses: []
  5800. }),
  5801. smalltalk.NumberTest);
  5802. smalltalk.addMethod(
  5803. smalltalk.method({
  5804. selector: "testCopying",
  5805. protocol: 'tests',
  5806. fn: function (){
  5807. var self=this;
  5808. return smalltalk.withContext(function($ctx1) {
  5809. var $1;
  5810. $1=_st((1)._copy()).__eq_eq((1));
  5811. $ctx1.sendIdx["=="]=1;
  5812. self._assert_($1);
  5813. $ctx1.sendIdx["assert:"]=1;
  5814. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  5815. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  5816. args: [],
  5817. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  5818. messageSends: ["assert:", "==", "copy", "deepCopy"],
  5819. referencedClasses: []
  5820. }),
  5821. smalltalk.NumberTest);
  5822. smalltalk.addMethod(
  5823. smalltalk.method({
  5824. selector: "testEquality",
  5825. protocol: 'tests',
  5826. fn: function (){
  5827. var self=this;
  5828. return smalltalk.withContext(function($ctx1) {
  5829. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  5830. $1=(1).__eq((1));
  5831. $ctx1.sendIdx["="]=1;
  5832. self._assert_($1);
  5833. $ctx1.sendIdx["assert:"]=1;
  5834. $2=(0).__eq((0));
  5835. $ctx1.sendIdx["="]=2;
  5836. self._assert_($2);
  5837. $ctx1.sendIdx["assert:"]=2;
  5838. $3=(1).__eq((0));
  5839. $ctx1.sendIdx["="]=3;
  5840. self._deny_($3);
  5841. $ctx1.sendIdx["deny:"]=1;
  5842. $5=(1)._yourself();
  5843. $ctx1.sendIdx["yourself"]=1;
  5844. $4=_st($5).__eq((1));
  5845. $ctx1.sendIdx["="]=4;
  5846. self._assert_($4);
  5847. $ctx1.sendIdx["assert:"]=3;
  5848. $7=(1)._yourself();
  5849. $ctx1.sendIdx["yourself"]=2;
  5850. $6=(1).__eq($7);
  5851. $ctx1.sendIdx["="]=5;
  5852. self._assert_($6);
  5853. $ctx1.sendIdx["assert:"]=4;
  5854. $9=(1)._yourself();
  5855. $ctx1.sendIdx["yourself"]=3;
  5856. $8=_st($9).__eq((1)._yourself());
  5857. $ctx1.sendIdx["="]=6;
  5858. self._assert_($8);
  5859. $10=(0).__eq(false);
  5860. $ctx1.sendIdx["="]=7;
  5861. self._deny_($10);
  5862. $ctx1.sendIdx["deny:"]=2;
  5863. $11=false.__eq((0));
  5864. $ctx1.sendIdx["="]=8;
  5865. self._deny_($11);
  5866. $ctx1.sendIdx["deny:"]=3;
  5867. $12="".__eq((0));
  5868. $ctx1.sendIdx["="]=9;
  5869. self._deny_($12);
  5870. $ctx1.sendIdx["deny:"]=4;
  5871. self._deny_((0).__eq(""));
  5872. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  5873. args: [],
  5874. 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 = ''",
  5875. messageSends: ["assert:", "=", "deny:", "yourself"],
  5876. referencedClasses: []
  5877. }),
  5878. smalltalk.NumberTest);
  5879. smalltalk.addMethod(
  5880. smalltalk.method({
  5881. selector: "testFloor",
  5882. protocol: 'tests',
  5883. fn: function (){
  5884. var self=this;
  5885. return smalltalk.withContext(function($ctx1) {
  5886. var $1,$2;
  5887. $1=(1.2)._floor();
  5888. $ctx1.sendIdx["floor"]=1;
  5889. self._assert_equals_($1,(1));
  5890. $ctx1.sendIdx["assert:equals:"]=1;
  5891. $2=(-1.2)._floor();
  5892. $ctx1.sendIdx["floor"]=2;
  5893. self._assert_equals_($2,(-2));
  5894. $ctx1.sendIdx["assert:equals:"]=2;
  5895. self._assert_equals_((1)._floor(),(1));
  5896. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  5897. args: [],
  5898. 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.",
  5899. messageSends: ["assert:equals:", "floor"],
  5900. referencedClasses: []
  5901. }),
  5902. smalltalk.NumberTest);
  5903. smalltalk.addMethod(
  5904. smalltalk.method({
  5905. selector: "testHexNumbers",
  5906. protocol: 'tests',
  5907. fn: function (){
  5908. var self=this;
  5909. return smalltalk.withContext(function($ctx1) {
  5910. var $1,$2,$3,$4,$5;
  5911. self._assert_equals_((9),(9));
  5912. $ctx1.sendIdx["assert:equals:"]=1;
  5913. $1=(10)._truncated();
  5914. $ctx1.sendIdx["truncated"]=1;
  5915. self._assert_equals_($1,(10));
  5916. $ctx1.sendIdx["assert:equals:"]=2;
  5917. $2=(11)._truncated();
  5918. $ctx1.sendIdx["truncated"]=2;
  5919. self._assert_equals_($2,(11));
  5920. $ctx1.sendIdx["assert:equals:"]=3;
  5921. $3=(12)._truncated();
  5922. $ctx1.sendIdx["truncated"]=3;
  5923. self._assert_equals_($3,(12));
  5924. $ctx1.sendIdx["assert:equals:"]=4;
  5925. $4=(13)._truncated();
  5926. $ctx1.sendIdx["truncated"]=4;
  5927. self._assert_equals_($4,(13));
  5928. $ctx1.sendIdx["assert:equals:"]=5;
  5929. $5=(14)._truncated();
  5930. $ctx1.sendIdx["truncated"]=5;
  5931. self._assert_equals_($5,(14));
  5932. $ctx1.sendIdx["assert:equals:"]=6;
  5933. self._assert_equals_((15)._truncated(),(15));
  5934. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  5935. args: [],
  5936. 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",
  5937. messageSends: ["assert:equals:", "truncated"],
  5938. referencedClasses: []
  5939. }),
  5940. smalltalk.NumberTest);
  5941. smalltalk.addMethod(
  5942. smalltalk.method({
  5943. selector: "testIdentity",
  5944. protocol: 'tests',
  5945. fn: function (){
  5946. var self=this;
  5947. return smalltalk.withContext(function($ctx1) {
  5948. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  5949. $1=(1).__eq_eq((1));
  5950. $ctx1.sendIdx["=="]=1;
  5951. self._assert_($1);
  5952. $ctx1.sendIdx["assert:"]=1;
  5953. $2=(0).__eq_eq((0));
  5954. $ctx1.sendIdx["=="]=2;
  5955. self._assert_($2);
  5956. $ctx1.sendIdx["assert:"]=2;
  5957. $3=(1).__eq_eq((0));
  5958. $ctx1.sendIdx["=="]=3;
  5959. self._deny_($3);
  5960. $ctx1.sendIdx["deny:"]=1;
  5961. $5=(1)._yourself();
  5962. $ctx1.sendIdx["yourself"]=1;
  5963. $4=_st($5).__eq_eq((1));
  5964. $ctx1.sendIdx["=="]=4;
  5965. self._assert_($4);
  5966. $ctx1.sendIdx["assert:"]=3;
  5967. $7=(1)._yourself();
  5968. $ctx1.sendIdx["yourself"]=2;
  5969. $6=(1).__eq_eq($7);
  5970. $ctx1.sendIdx["=="]=5;
  5971. self._assert_($6);
  5972. $ctx1.sendIdx["assert:"]=4;
  5973. $9=(1)._yourself();
  5974. $ctx1.sendIdx["yourself"]=3;
  5975. $8=_st($9).__eq_eq((1)._yourself());
  5976. $ctx1.sendIdx["=="]=6;
  5977. self._assert_($8);
  5978. self._deny_((1).__eq_eq((2)));
  5979. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  5980. args: [],
  5981. 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",
  5982. messageSends: ["assert:", "==", "deny:", "yourself"],
  5983. referencedClasses: []
  5984. }),
  5985. smalltalk.NumberTest);
  5986. smalltalk.addMethod(
  5987. smalltalk.method({
  5988. selector: "testInvalidHexNumbers",
  5989. protocol: 'tests',
  5990. fn: function (){
  5991. var self=this;
  5992. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5993. return smalltalk.withContext(function($ctx1) {
  5994. self._should_raise_((function(){
  5995. return smalltalk.withContext(function($ctx2) {
  5996. return (16)._rG();
  5997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5998. $ctx1.sendIdx["should:raise:"]=1;
  5999. self._should_raise_((function(){
  6000. return smalltalk.withContext(function($ctx2) {
  6001. return (16)._rg();
  6002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6003. $ctx1.sendIdx["should:raise:"]=2;
  6004. self._should_raise_((function(){
  6005. return smalltalk.withContext(function($ctx2) {
  6006. return (16)._rH();
  6007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6008. $ctx1.sendIdx["should:raise:"]=3;
  6009. self._should_raise_((function(){
  6010. return smalltalk.withContext(function($ctx2) {
  6011. return (16)._rh();
  6012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6013. $ctx1.sendIdx["should:raise:"]=4;
  6014. self._should_raise_((function(){
  6015. return smalltalk.withContext(function($ctx2) {
  6016. return (16)._rI();
  6017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6018. $ctx1.sendIdx["should:raise:"]=5;
  6019. self._should_raise_((function(){
  6020. return smalltalk.withContext(function($ctx2) {
  6021. return (16)._ri();
  6022. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6023. $ctx1.sendIdx["should:raise:"]=6;
  6024. self._should_raise_((function(){
  6025. return smalltalk.withContext(function($ctx2) {
  6026. return (16)._rJ();
  6027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6028. $ctx1.sendIdx["should:raise:"]=7;
  6029. self._should_raise_((function(){
  6030. return smalltalk.withContext(function($ctx2) {
  6031. return (16)._rj();
  6032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6033. $ctx1.sendIdx["should:raise:"]=8;
  6034. self._should_raise_((function(){
  6035. return smalltalk.withContext(function($ctx2) {
  6036. return (16)._rK();
  6037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6038. $ctx1.sendIdx["should:raise:"]=9;
  6039. self._should_raise_((function(){
  6040. return smalltalk.withContext(function($ctx2) {
  6041. return (16)._rk();
  6042. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6043. $ctx1.sendIdx["should:raise:"]=10;
  6044. self._should_raise_((function(){
  6045. return smalltalk.withContext(function($ctx2) {
  6046. return (16)._rL();
  6047. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6048. $ctx1.sendIdx["should:raise:"]=11;
  6049. self._should_raise_((function(){
  6050. return smalltalk.withContext(function($ctx2) {
  6051. return (16)._rl();
  6052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6053. $ctx1.sendIdx["should:raise:"]=12;
  6054. self._should_raise_((function(){
  6055. return smalltalk.withContext(function($ctx2) {
  6056. return (16)._rM();
  6057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6058. $ctx1.sendIdx["should:raise:"]=13;
  6059. self._should_raise_((function(){
  6060. return smalltalk.withContext(function($ctx2) {
  6061. return (16)._rm();
  6062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6063. $ctx1.sendIdx["should:raise:"]=14;
  6064. self._should_raise_((function(){
  6065. return smalltalk.withContext(function($ctx2) {
  6066. return (16)._rN();
  6067. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6068. $ctx1.sendIdx["should:raise:"]=15;
  6069. self._should_raise_((function(){
  6070. return smalltalk.withContext(function($ctx2) {
  6071. return (16)._rn();
  6072. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6073. $ctx1.sendIdx["should:raise:"]=16;
  6074. self._should_raise_((function(){
  6075. return smalltalk.withContext(function($ctx2) {
  6076. return (16)._rO();
  6077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6078. $ctx1.sendIdx["should:raise:"]=17;
  6079. self._should_raise_((function(){
  6080. return smalltalk.withContext(function($ctx2) {
  6081. return (16)._ro();
  6082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6083. $ctx1.sendIdx["should:raise:"]=18;
  6084. self._should_raise_((function(){
  6085. return smalltalk.withContext(function($ctx2) {
  6086. return (16)._rP();
  6087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6088. $ctx1.sendIdx["should:raise:"]=19;
  6089. self._should_raise_((function(){
  6090. return smalltalk.withContext(function($ctx2) {
  6091. return (16)._rp();
  6092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6093. $ctx1.sendIdx["should:raise:"]=20;
  6094. self._should_raise_((function(){
  6095. return smalltalk.withContext(function($ctx2) {
  6096. return (16)._rQ();
  6097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6098. $ctx1.sendIdx["should:raise:"]=21;
  6099. self._should_raise_((function(){
  6100. return smalltalk.withContext(function($ctx2) {
  6101. return (16)._rq();
  6102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6103. $ctx1.sendIdx["should:raise:"]=22;
  6104. self._should_raise_((function(){
  6105. return smalltalk.withContext(function($ctx2) {
  6106. return (16)._rR();
  6107. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6108. $ctx1.sendIdx["should:raise:"]=23;
  6109. self._should_raise_((function(){
  6110. return smalltalk.withContext(function($ctx2) {
  6111. return (16)._rr();
  6112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6113. $ctx1.sendIdx["should:raise:"]=24;
  6114. self._should_raise_((function(){
  6115. return smalltalk.withContext(function($ctx2) {
  6116. return (16)._rS();
  6117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6118. $ctx1.sendIdx["should:raise:"]=25;
  6119. self._should_raise_((function(){
  6120. return smalltalk.withContext(function($ctx2) {
  6121. return (16)._rs();
  6122. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6123. $ctx1.sendIdx["should:raise:"]=26;
  6124. self._should_raise_((function(){
  6125. return smalltalk.withContext(function($ctx2) {
  6126. return (16)._rT();
  6127. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6128. $ctx1.sendIdx["should:raise:"]=27;
  6129. self._should_raise_((function(){
  6130. return smalltalk.withContext(function($ctx2) {
  6131. return (16)._rt();
  6132. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6133. $ctx1.sendIdx["should:raise:"]=28;
  6134. self._should_raise_((function(){
  6135. return smalltalk.withContext(function($ctx2) {
  6136. return (16)._rU();
  6137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  6138. $ctx1.sendIdx["should:raise:"]=29;
  6139. self._should_raise_((function(){
  6140. return smalltalk.withContext(function($ctx2) {
  6141. return (16)._ru();
  6142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  6143. $ctx1.sendIdx["should:raise:"]=30;
  6144. self._should_raise_((function(){
  6145. return smalltalk.withContext(function($ctx2) {
  6146. return (16)._rV();
  6147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6148. $ctx1.sendIdx["should:raise:"]=31;
  6149. self._should_raise_((function(){
  6150. return smalltalk.withContext(function($ctx2) {
  6151. return (16)._rv();
  6152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6153. $ctx1.sendIdx["should:raise:"]=32;
  6154. self._should_raise_((function(){
  6155. return smalltalk.withContext(function($ctx2) {
  6156. return (16)._rW();
  6157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6158. $ctx1.sendIdx["should:raise:"]=33;
  6159. self._should_raise_((function(){
  6160. return smalltalk.withContext(function($ctx2) {
  6161. return (16)._rw();
  6162. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6163. $ctx1.sendIdx["should:raise:"]=34;
  6164. self._should_raise_((function(){
  6165. return smalltalk.withContext(function($ctx2) {
  6166. return (16)._rX();
  6167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6168. $ctx1.sendIdx["should:raise:"]=35;
  6169. self._should_raise_((function(){
  6170. return smalltalk.withContext(function($ctx2) {
  6171. return (16)._rx();
  6172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6173. $ctx1.sendIdx["should:raise:"]=36;
  6174. self._should_raise_((function(){
  6175. return smalltalk.withContext(function($ctx2) {
  6176. return (16)._rY();
  6177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6178. $ctx1.sendIdx["should:raise:"]=37;
  6179. self._should_raise_((function(){
  6180. return smalltalk.withContext(function($ctx2) {
  6181. return (16)._ry();
  6182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6183. $ctx1.sendIdx["should:raise:"]=38;
  6184. self._should_raise_((function(){
  6185. return smalltalk.withContext(function($ctx2) {
  6186. return (16)._rZ();
  6187. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6188. $ctx1.sendIdx["should:raise:"]=39;
  6189. self._should_raise_((function(){
  6190. return smalltalk.withContext(function($ctx2) {
  6191. return (16)._rz();
  6192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6193. $ctx1.sendIdx["should:raise:"]=40;
  6194. self._should_raise_((function(){
  6195. return smalltalk.withContext(function($ctx2) {
  6196. return (11259375)._Z();
  6197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6198. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  6199. args: [],
  6200. 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.",
  6201. 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"],
  6202. referencedClasses: ["MessageNotUnderstood"]
  6203. }),
  6204. smalltalk.NumberTest);
  6205. smalltalk.addMethod(
  6206. smalltalk.method({
  6207. selector: "testLog",
  6208. protocol: 'tests',
  6209. fn: function (){
  6210. var self=this;
  6211. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  6212. return smalltalk.withContext(function($ctx1) {
  6213. self._assert_equals_((10000)._log(),(4));
  6214. $ctx1.sendIdx["assert:equals:"]=1;
  6215. self._assert_equals_((512)._log_((2)),(9));
  6216. $ctx1.sendIdx["assert:equals:"]=2;
  6217. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  6218. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  6219. args: [],
  6220. 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.",
  6221. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  6222. referencedClasses: ["Number"]
  6223. }),
  6224. smalltalk.NumberTest);
  6225. smalltalk.addMethod(
  6226. smalltalk.method({
  6227. selector: "testMinMax",
  6228. protocol: 'tests',
  6229. fn: function (){
  6230. var self=this;
  6231. return smalltalk.withContext(function($ctx1) {
  6232. self._assert_equals_((2)._max_((5)),(5));
  6233. $ctx1.sendIdx["assert:equals:"]=1;
  6234. self._assert_equals_((2)._min_((5)),(2));
  6235. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  6236. args: [],
  6237. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  6238. messageSends: ["assert:equals:", "max:", "min:"],
  6239. referencedClasses: []
  6240. }),
  6241. smalltalk.NumberTest);
  6242. smalltalk.addMethod(
  6243. smalltalk.method({
  6244. selector: "testNegated",
  6245. protocol: 'tests',
  6246. fn: function (){
  6247. var self=this;
  6248. return smalltalk.withContext(function($ctx1) {
  6249. var $1;
  6250. $1=(3)._negated();
  6251. $ctx1.sendIdx["negated"]=1;
  6252. self._assert_equals_($1,(-3));
  6253. $ctx1.sendIdx["assert:equals:"]=1;
  6254. self._assert_equals_((-3)._negated(),(3));
  6255. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  6256. args: [],
  6257. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  6258. messageSends: ["assert:equals:", "negated"],
  6259. referencedClasses: []
  6260. }),
  6261. smalltalk.NumberTest);
  6262. smalltalk.addMethod(
  6263. smalltalk.method({
  6264. selector: "testPrintShowingDecimalPlaces",
  6265. protocol: 'tests',
  6266. fn: function (){
  6267. var self=this;
  6268. return smalltalk.withContext(function($ctx1) {
  6269. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  6270. $1=(23)._printShowingDecimalPlaces_((2));
  6271. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  6272. self._assert_equals_($1,"23.00");
  6273. $ctx1.sendIdx["assert:equals:"]=1;
  6274. $2=(23.5698)._printShowingDecimalPlaces_((2));
  6275. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  6276. self._assert_equals_($2,"23.57");
  6277. $ctx1.sendIdx["assert:equals:"]=2;
  6278. $4=(234.567)._negated();
  6279. $ctx1.sendIdx["negated"]=1;
  6280. $3=_st($4)._printShowingDecimalPlaces_((5));
  6281. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  6282. self._assert_equals_($3,"-234.56700");
  6283. $ctx1.sendIdx["assert:equals:"]=3;
  6284. $5=(23.4567)._printShowingDecimalPlaces_((0));
  6285. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  6286. self._assert_equals_($5,"23");
  6287. $ctx1.sendIdx["assert:equals:"]=4;
  6288. $6=(23.5567)._printShowingDecimalPlaces_((0));
  6289. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  6290. self._assert_equals_($6,"24");
  6291. $ctx1.sendIdx["assert:equals:"]=5;
  6292. $8=(23.4567)._negated();
  6293. $ctx1.sendIdx["negated"]=2;
  6294. $7=_st($8)._printShowingDecimalPlaces_((0));
  6295. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  6296. self._assert_equals_($7,"-23");
  6297. $ctx1.sendIdx["assert:equals:"]=6;
  6298. $10=(23.5567)._negated();
  6299. $ctx1.sendIdx["negated"]=3;
  6300. $9=_st($10)._printShowingDecimalPlaces_((0));
  6301. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  6302. self._assert_equals_($9,"-24");
  6303. $ctx1.sendIdx["assert:equals:"]=7;
  6304. $11=(100000000)._printShowingDecimalPlaces_((1));
  6305. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  6306. self._assert_equals_($11,"100000000.0");
  6307. $ctx1.sendIdx["assert:equals:"]=8;
  6308. $12=(0.98)._printShowingDecimalPlaces_((5));
  6309. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  6310. self._assert_equals_($12,"0.98000");
  6311. $ctx1.sendIdx["assert:equals:"]=9;
  6312. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  6313. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  6314. self._assert_equals_($13,"-0.98");
  6315. $ctx1.sendIdx["assert:equals:"]=10;
  6316. $14=(2.567)._printShowingDecimalPlaces_((2));
  6317. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  6318. self._assert_equals_($14,"2.57");
  6319. $ctx1.sendIdx["assert:equals:"]=11;
  6320. $15=(-2.567)._printShowingDecimalPlaces_((2));
  6321. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  6322. self._assert_equals_($15,"-2.57");
  6323. $ctx1.sendIdx["assert:equals:"]=12;
  6324. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  6325. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  6326. args: [],
  6327. 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'.",
  6328. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  6329. referencedClasses: []
  6330. }),
  6331. smalltalk.NumberTest);
  6332. smalltalk.addMethod(
  6333. smalltalk.method({
  6334. selector: "testRaisedTo",
  6335. protocol: 'tests',
  6336. fn: function (){
  6337. var self=this;
  6338. return smalltalk.withContext(function($ctx1) {
  6339. var $1,$2,$3;
  6340. $1=(2)._raisedTo_((4));
  6341. $ctx1.sendIdx["raisedTo:"]=1;
  6342. self._assert_equals_($1,(16));
  6343. $ctx1.sendIdx["assert:equals:"]=1;
  6344. $2=(2)._raisedTo_((0));
  6345. $ctx1.sendIdx["raisedTo:"]=2;
  6346. self._assert_equals_($2,(1));
  6347. $ctx1.sendIdx["assert:equals:"]=2;
  6348. $3=(2)._raisedTo_((-3));
  6349. $ctx1.sendIdx["raisedTo:"]=3;
  6350. self._assert_equals_($3,(0.125));
  6351. $ctx1.sendIdx["assert:equals:"]=3;
  6352. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  6353. $ctx1.sendIdx["assert:equals:"]=4;
  6354. self._assert_equals_((2).__star_star((4)),(16));
  6355. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  6356. args: [],
  6357. 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.",
  6358. messageSends: ["assert:equals:", "raisedTo:", "**"],
  6359. referencedClasses: []
  6360. }),
  6361. smalltalk.NumberTest);
  6362. smalltalk.addMethod(
  6363. smalltalk.method({
  6364. selector: "testRounded",
  6365. protocol: 'tests',
  6366. fn: function (){
  6367. var self=this;
  6368. return smalltalk.withContext(function($ctx1) {
  6369. var $1,$2;
  6370. $1=(3)._rounded();
  6371. $ctx1.sendIdx["rounded"]=1;
  6372. self._assert_equals_($1,(3));
  6373. $ctx1.sendIdx["assert:equals:"]=1;
  6374. $2=(3.212)._rounded();
  6375. $ctx1.sendIdx["rounded"]=2;
  6376. self._assert_equals_($2,(3));
  6377. $ctx1.sendIdx["assert:equals:"]=2;
  6378. self._assert_equals_((3.51)._rounded(),(4));
  6379. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  6380. args: [],
  6381. 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",
  6382. messageSends: ["assert:equals:", "rounded"],
  6383. referencedClasses: []
  6384. }),
  6385. smalltalk.NumberTest);
  6386. smalltalk.addMethod(
  6387. smalltalk.method({
  6388. selector: "testSign",
  6389. protocol: 'tests',
  6390. fn: function (){
  6391. var self=this;
  6392. return smalltalk.withContext(function($ctx1) {
  6393. var $1,$2;
  6394. $1=(5)._sign();
  6395. $ctx1.sendIdx["sign"]=1;
  6396. self._assert_equals_($1,(1));
  6397. $ctx1.sendIdx["assert:equals:"]=1;
  6398. $2=(0)._sign();
  6399. $ctx1.sendIdx["sign"]=2;
  6400. self._assert_equals_($2,(0));
  6401. $ctx1.sendIdx["assert:equals:"]=2;
  6402. self._assert_equals_((-1.4)._sign(),(-1));
  6403. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  6404. args: [],
  6405. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  6406. messageSends: ["assert:equals:", "sign"],
  6407. referencedClasses: []
  6408. }),
  6409. smalltalk.NumberTest);
  6410. smalltalk.addMethod(
  6411. smalltalk.method({
  6412. selector: "testSqrt",
  6413. protocol: 'tests',
  6414. fn: function (){
  6415. var self=this;
  6416. return smalltalk.withContext(function($ctx1) {
  6417. var $1;
  6418. $1=(4)._sqrt();
  6419. $ctx1.sendIdx["sqrt"]=1;
  6420. self._assert_equals_($1,(2));
  6421. $ctx1.sendIdx["assert:equals:"]=1;
  6422. self._assert_equals_((16)._sqrt(),(4));
  6423. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  6424. args: [],
  6425. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  6426. messageSends: ["assert:equals:", "sqrt"],
  6427. referencedClasses: []
  6428. }),
  6429. smalltalk.NumberTest);
  6430. smalltalk.addMethod(
  6431. smalltalk.method({
  6432. selector: "testSquared",
  6433. protocol: 'tests',
  6434. fn: function (){
  6435. var self=this;
  6436. return smalltalk.withContext(function($ctx1) {
  6437. self._assert_equals_((4)._squared(),(16));
  6438. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  6439. args: [],
  6440. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  6441. messageSends: ["assert:equals:", "squared"],
  6442. referencedClasses: []
  6443. }),
  6444. smalltalk.NumberTest);
  6445. smalltalk.addMethod(
  6446. smalltalk.method({
  6447. selector: "testTimesRepeat",
  6448. protocol: 'tests',
  6449. fn: function (){
  6450. var self=this;
  6451. var i;
  6452. return smalltalk.withContext(function($ctx1) {
  6453. i=(0);
  6454. (0)._timesRepeat_((function(){
  6455. return smalltalk.withContext(function($ctx2) {
  6456. i=_st(i).__plus((1));
  6457. $ctx2.sendIdx["+"]=1;
  6458. return i;
  6459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6460. $ctx1.sendIdx["timesRepeat:"]=1;
  6461. self._assert_equals_(i,(0));
  6462. $ctx1.sendIdx["assert:equals:"]=1;
  6463. (5)._timesRepeat_((function(){
  6464. return smalltalk.withContext(function($ctx2) {
  6465. i=_st(i).__plus((1));
  6466. return i;
  6467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6468. self._assert_equals_(i,(5));
  6469. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  6470. args: [],
  6471. 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",
  6472. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  6473. referencedClasses: []
  6474. }),
  6475. smalltalk.NumberTest);
  6476. smalltalk.addMethod(
  6477. smalltalk.method({
  6478. selector: "testTo",
  6479. protocol: 'tests',
  6480. fn: function (){
  6481. var self=this;
  6482. return smalltalk.withContext(function($ctx1) {
  6483. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  6484. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  6485. args: [],
  6486. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  6487. messageSends: ["assert:equals:", "to:"],
  6488. referencedClasses: []
  6489. }),
  6490. smalltalk.NumberTest);
  6491. smalltalk.addMethod(
  6492. smalltalk.method({
  6493. selector: "testToBy",
  6494. protocol: 'tests',
  6495. fn: function (){
  6496. var self=this;
  6497. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6498. return smalltalk.withContext(function($ctx1) {
  6499. var $1;
  6500. $1=(0)._to_by_((6),(2));
  6501. $ctx1.sendIdx["to:by:"]=1;
  6502. self._assert_equals_($1,[(0), (2), (4), (6)]);
  6503. self._should_raise_((function(){
  6504. return smalltalk.withContext(function($ctx2) {
  6505. return (1)._to_by_((4),(0));
  6506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6507. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  6508. args: [],
  6509. 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",
  6510. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  6511. referencedClasses: ["Error"]
  6512. }),
  6513. smalltalk.NumberTest);
  6514. smalltalk.addMethod(
  6515. smalltalk.method({
  6516. selector: "testTrigonometry",
  6517. protocol: 'tests',
  6518. fn: function (){
  6519. var self=this;
  6520. return smalltalk.withContext(function($ctx1) {
  6521. self._assert_equals_((0)._cos(),(1));
  6522. $ctx1.sendIdx["assert:equals:"]=1;
  6523. self._assert_equals_((0)._sin(),(0));
  6524. $ctx1.sendIdx["assert:equals:"]=2;
  6525. self._assert_equals_((0)._tan(),(0));
  6526. $ctx1.sendIdx["assert:equals:"]=3;
  6527. self._assert_equals_((1)._arcCos(),(0));
  6528. $ctx1.sendIdx["assert:equals:"]=4;
  6529. self._assert_equals_((0)._arcSin(),(0));
  6530. $ctx1.sendIdx["assert:equals:"]=5;
  6531. self._assert_equals_((0)._arcTan(),(0));
  6532. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  6533. args: [],
  6534. 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.",
  6535. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  6536. referencedClasses: []
  6537. }),
  6538. smalltalk.NumberTest);
  6539. smalltalk.addMethod(
  6540. smalltalk.method({
  6541. selector: "testTruncated",
  6542. protocol: 'tests',
  6543. fn: function (){
  6544. var self=this;
  6545. return smalltalk.withContext(function($ctx1) {
  6546. var $1,$2;
  6547. $1=(3)._truncated();
  6548. $ctx1.sendIdx["truncated"]=1;
  6549. self._assert_equals_($1,(3));
  6550. $ctx1.sendIdx["assert:equals:"]=1;
  6551. $2=(3.212)._truncated();
  6552. $ctx1.sendIdx["truncated"]=2;
  6553. self._assert_equals_($2,(3));
  6554. $ctx1.sendIdx["assert:equals:"]=2;
  6555. self._assert_equals_((3.51)._truncated(),(3));
  6556. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  6557. args: [],
  6558. 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",
  6559. messageSends: ["assert:equals:", "truncated"],
  6560. referencedClasses: []
  6561. }),
  6562. smalltalk.NumberTest);
  6563. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  6564. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  6565. smalltalk.addMethod(
  6566. smalltalk.method({
  6567. selector: "foo",
  6568. protocol: 'not yet classified',
  6569. fn: function (){
  6570. var self=this;
  6571. return smalltalk.withContext(function($ctx1) {
  6572. var $1;
  6573. $1=self["@foo"];
  6574. return $1;
  6575. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  6576. args: [],
  6577. source: "foo\x0a\x09^ foo",
  6578. messageSends: [],
  6579. referencedClasses: []
  6580. }),
  6581. smalltalk.ObjectMock);
  6582. smalltalk.addMethod(
  6583. smalltalk.method({
  6584. selector: "foo:",
  6585. protocol: 'not yet classified',
  6586. fn: function (anObject){
  6587. var self=this;
  6588. return smalltalk.withContext(function($ctx1) {
  6589. self["@foo"]=anObject;
  6590. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  6591. args: ["anObject"],
  6592. source: "foo: anObject\x0a\x09foo := anObject",
  6593. messageSends: [],
  6594. referencedClasses: []
  6595. }),
  6596. smalltalk.ObjectMock);
  6597. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6598. smalltalk.addMethod(
  6599. smalltalk.method({
  6600. selector: "notDefined",
  6601. protocol: 'tests',
  6602. fn: function (){
  6603. var self=this;
  6604. return smalltalk.withContext(function($ctx1) {
  6605. return void 0;;
  6606. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  6607. args: [],
  6608. source: "notDefined\x0a\x09<return void 0;>",
  6609. messageSends: [],
  6610. referencedClasses: []
  6611. }),
  6612. smalltalk.ObjectTest);
  6613. smalltalk.addMethod(
  6614. smalltalk.method({
  6615. selector: "testBasicAccess",
  6616. protocol: 'tests',
  6617. fn: function (){
  6618. var self=this;
  6619. var o;
  6620. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6621. return smalltalk.withContext(function($ctx1) {
  6622. var $1;
  6623. o=_st($Object())._new();
  6624. _st(o)._basicAt_put_("a",(1));
  6625. $1=_st(o)._basicAt_("a");
  6626. $ctx1.sendIdx["basicAt:"]=1;
  6627. self._assert_equals_($1,(1));
  6628. $ctx1.sendIdx["assert:equals:"]=1;
  6629. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  6630. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  6631. args: [],
  6632. 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",
  6633. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  6634. referencedClasses: ["Object"]
  6635. }),
  6636. smalltalk.ObjectTest);
  6637. smalltalk.addMethod(
  6638. smalltalk.method({
  6639. selector: "testBasicPerform",
  6640. protocol: 'tests',
  6641. fn: function (){
  6642. var self=this;
  6643. var o;
  6644. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6645. return smalltalk.withContext(function($ctx1) {
  6646. o=_st($Object())._new();
  6647. _st(o)._basicAt_put_("func",(function(){
  6648. return smalltalk.withContext(function($ctx2) {
  6649. return "hello";
  6650. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6651. $ctx1.sendIdx["basicAt:put:"]=1;
  6652. _st(o)._basicAt_put_("func2",(function(a){
  6653. return smalltalk.withContext(function($ctx2) {
  6654. return _st(a).__plus((1));
  6655. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  6656. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  6657. $ctx1.sendIdx["assert:equals:"]=1;
  6658. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  6659. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  6660. args: [],
  6661. 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",
  6662. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  6663. referencedClasses: ["Object"]
  6664. }),
  6665. smalltalk.ObjectTest);
  6666. smalltalk.addMethod(
  6667. smalltalk.method({
  6668. selector: "testDNU",
  6669. protocol: 'tests',
  6670. fn: function (){
  6671. var self=this;
  6672. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6673. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6674. return smalltalk.withContext(function($ctx1) {
  6675. self._should_raise_((function(){
  6676. return smalltalk.withContext(function($ctx2) {
  6677. return _st(_st($Object())._new())._foo();
  6678. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6679. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  6680. args: [],
  6681. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  6682. messageSends: ["should:raise:", "foo", "new"],
  6683. referencedClasses: ["Object", "MessageNotUnderstood"]
  6684. }),
  6685. smalltalk.ObjectTest);
  6686. smalltalk.addMethod(
  6687. smalltalk.method({
  6688. selector: "testEquality",
  6689. protocol: 'tests',
  6690. fn: function (){
  6691. var self=this;
  6692. var o;
  6693. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6694. return smalltalk.withContext(function($ctx1) {
  6695. var $1,$2,$4,$3;
  6696. o=_st($Object())._new();
  6697. $ctx1.sendIdx["new"]=1;
  6698. $1=_st(o).__eq(_st($Object())._new());
  6699. $ctx1.sendIdx["="]=1;
  6700. self._deny_($1);
  6701. $2=_st(o).__eq(o);
  6702. $ctx1.sendIdx["="]=2;
  6703. self._assert_($2);
  6704. $ctx1.sendIdx["assert:"]=1;
  6705. $4=_st(o)._yourself();
  6706. $ctx1.sendIdx["yourself"]=1;
  6707. $3=_st($4).__eq(o);
  6708. $ctx1.sendIdx["="]=3;
  6709. self._assert_($3);
  6710. $ctx1.sendIdx["assert:"]=2;
  6711. self._assert_(_st(o).__eq(_st(o)._yourself()));
  6712. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  6713. args: [],
  6714. 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)",
  6715. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  6716. referencedClasses: ["Object"]
  6717. }),
  6718. smalltalk.ObjectTest);
  6719. smalltalk.addMethod(
  6720. smalltalk.method({
  6721. selector: "testHalt",
  6722. protocol: 'tests',
  6723. fn: function (){
  6724. var self=this;
  6725. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6726. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6727. return smalltalk.withContext(function($ctx1) {
  6728. self._should_raise_((function(){
  6729. return smalltalk.withContext(function($ctx2) {
  6730. return _st(_st($Object())._new())._halt();
  6731. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6732. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  6733. args: [],
  6734. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  6735. messageSends: ["should:raise:", "halt", "new"],
  6736. referencedClasses: ["Object", "Error"]
  6737. }),
  6738. smalltalk.ObjectTest);
  6739. smalltalk.addMethod(
  6740. smalltalk.method({
  6741. selector: "testIdentity",
  6742. protocol: 'tests',
  6743. fn: function (){
  6744. var self=this;
  6745. var o;
  6746. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6747. return smalltalk.withContext(function($ctx1) {
  6748. var $1,$2,$4,$3;
  6749. o=_st($Object())._new();
  6750. $ctx1.sendIdx["new"]=1;
  6751. $1=_st(o).__eq_eq(_st($Object())._new());
  6752. $ctx1.sendIdx["=="]=1;
  6753. self._deny_($1);
  6754. $2=_st(o).__eq_eq(o);
  6755. $ctx1.sendIdx["=="]=2;
  6756. self._assert_($2);
  6757. $ctx1.sendIdx["assert:"]=1;
  6758. $4=_st(o)._yourself();
  6759. $ctx1.sendIdx["yourself"]=1;
  6760. $3=_st($4).__eq_eq(o);
  6761. $ctx1.sendIdx["=="]=3;
  6762. self._assert_($3);
  6763. $ctx1.sendIdx["assert:"]=2;
  6764. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  6765. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  6766. args: [],
  6767. 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",
  6768. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  6769. referencedClasses: ["Object"]
  6770. }),
  6771. smalltalk.ObjectTest);
  6772. smalltalk.addMethod(
  6773. smalltalk.method({
  6774. selector: "testIfNil",
  6775. protocol: 'tests',
  6776. fn: function (){
  6777. var self=this;
  6778. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6779. return smalltalk.withContext(function($ctx1) {
  6780. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  6781. $2=_st($Object())._new();
  6782. $ctx1.sendIdx["new"]=1;
  6783. $1=_st($2)._isNil();
  6784. self._deny_($1);
  6785. $ctx1.sendIdx["deny:"]=1;
  6786. $5=_st($Object())._new();
  6787. $ctx1.sendIdx["new"]=2;
  6788. if(($receiver = $5) == nil || $receiver == null){
  6789. $4=true;
  6790. } else {
  6791. $4=$5;
  6792. };
  6793. $3=_st($4).__eq(true);
  6794. self._deny_($3);
  6795. $7=_st($Object())._new();
  6796. $ctx1.sendIdx["new"]=3;
  6797. if(($receiver = $7) == nil || $receiver == null){
  6798. $6=$7;
  6799. } else {
  6800. $6=true;
  6801. };
  6802. self._assert_equals_($6,true);
  6803. $ctx1.sendIdx["assert:equals:"]=1;
  6804. $9=_st($Object())._new();
  6805. $ctx1.sendIdx["new"]=4;
  6806. if(($receiver = $9) == nil || $receiver == null){
  6807. $8=false;
  6808. } else {
  6809. $8=true;
  6810. };
  6811. self._assert_equals_($8,true);
  6812. $ctx1.sendIdx["assert:equals:"]=2;
  6813. $11=_st($Object())._new();
  6814. if(($receiver = $11) == nil || $receiver == null){
  6815. $10=false;
  6816. } else {
  6817. $10=true;
  6818. };
  6819. self._assert_equals_($10,true);
  6820. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  6821. args: [],
  6822. 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",
  6823. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  6824. referencedClasses: ["Object"]
  6825. }),
  6826. smalltalk.ObjectTest);
  6827. smalltalk.addMethod(
  6828. smalltalk.method({
  6829. selector: "testInstVars",
  6830. protocol: 'tests',
  6831. fn: function (){
  6832. var self=this;
  6833. var o;
  6834. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  6835. return smalltalk.withContext(function($ctx1) {
  6836. var $1,$2;
  6837. o=_st($ObjectMock())._new();
  6838. $1=_st(o)._instVarAt_("foo");
  6839. $ctx1.sendIdx["instVarAt:"]=1;
  6840. self._assert_equals_($1,nil);
  6841. $ctx1.sendIdx["assert:equals:"]=1;
  6842. _st(o)._instVarAt_put_("foo",(1));
  6843. $2=_st(o)._instVarAt_("foo");
  6844. $ctx1.sendIdx["instVarAt:"]=2;
  6845. self._assert_equals_($2,(1));
  6846. $ctx1.sendIdx["assert:equals:"]=2;
  6847. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  6848. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  6849. args: [],
  6850. 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",
  6851. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  6852. referencedClasses: ["ObjectMock"]
  6853. }),
  6854. smalltalk.ObjectTest);
  6855. smalltalk.addMethod(
  6856. smalltalk.method({
  6857. selector: "testNilUndefined",
  6858. protocol: 'tests',
  6859. fn: function (){
  6860. var self=this;
  6861. return smalltalk.withContext(function($ctx1) {
  6862. self._assert_equals_(self._notDefined(),nil);
  6863. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  6864. args: [],
  6865. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  6866. messageSends: ["assert:equals:", "notDefined"],
  6867. referencedClasses: []
  6868. }),
  6869. smalltalk.ObjectTest);
  6870. smalltalk.addMethod(
  6871. smalltalk.method({
  6872. selector: "testYourself",
  6873. protocol: 'tests',
  6874. fn: function (){
  6875. var self=this;
  6876. var o;
  6877. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  6878. return smalltalk.withContext(function($ctx1) {
  6879. o=_st($ObjectMock())._new();
  6880. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  6881. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  6882. args: [],
  6883. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  6884. messageSends: ["new", "assert:", "==", "yourself"],
  6885. referencedClasses: ["ObjectMock"]
  6886. }),
  6887. smalltalk.ObjectTest);
  6888. smalltalk.addMethod(
  6889. smalltalk.method({
  6890. selector: "testidentityHash",
  6891. protocol: 'tests',
  6892. fn: function (){
  6893. var self=this;
  6894. var o1,o2;
  6895. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6896. return smalltalk.withContext(function($ctx1) {
  6897. var $2,$3,$1,$5,$4;
  6898. o1=_st($Object())._new();
  6899. $ctx1.sendIdx["new"]=1;
  6900. o2=_st($Object())._new();
  6901. $2=_st(o1)._identityHash();
  6902. $ctx1.sendIdx["identityHash"]=1;
  6903. $3=_st(o1)._identityHash();
  6904. $ctx1.sendIdx["identityHash"]=2;
  6905. $1=_st($2).__eq_eq($3);
  6906. $ctx1.sendIdx["=="]=1;
  6907. self._assert_($1);
  6908. $5=_st(o1)._identityHash();
  6909. $ctx1.sendIdx["identityHash"]=3;
  6910. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  6911. self._deny_($4);
  6912. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  6913. args: [],
  6914. 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",
  6915. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  6916. referencedClasses: ["Object"]
  6917. }),
  6918. smalltalk.ObjectTest);
  6919. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6920. smalltalk.addMethod(
  6921. smalltalk.method({
  6922. selector: "testAccessing",
  6923. protocol: 'tests',
  6924. fn: function (){
  6925. var self=this;
  6926. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6927. return smalltalk.withContext(function($ctx1) {
  6928. var $2,$1,$3,$6,$5,$4;
  6929. $2=_st($Point())._x_y_((3),(4));
  6930. $ctx1.sendIdx["x:y:"]=1;
  6931. $1=_st($2)._x();
  6932. $ctx1.sendIdx["x"]=1;
  6933. self._assert_equals_($1,(3));
  6934. $ctx1.sendIdx["assert:equals:"]=1;
  6935. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  6936. $ctx1.sendIdx["y"]=1;
  6937. self._assert_equals_($3,(4));
  6938. $ctx1.sendIdx["assert:equals:"]=2;
  6939. $6=_st($Point())._new();
  6940. $ctx1.sendIdx["new"]=1;
  6941. $5=_st($6)._x_((3));
  6942. $4=_st($5)._x();
  6943. self._assert_equals_($4,(3));
  6944. $ctx1.sendIdx["assert:equals:"]=3;
  6945. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  6946. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  6947. args: [],
  6948. 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",
  6949. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  6950. referencedClasses: ["Point"]
  6951. }),
  6952. smalltalk.PointTest);
  6953. smalltalk.addMethod(
  6954. smalltalk.method({
  6955. selector: "testArithmetic",
  6956. protocol: 'tests',
  6957. fn: function (){
  6958. var self=this;
  6959. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6960. return smalltalk.withContext(function($ctx1) {
  6961. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  6962. $2=(3).__at((4));
  6963. $ctx1.sendIdx["@"]=1;
  6964. $3=(3).__at((4));
  6965. $ctx1.sendIdx["@"]=2;
  6966. $1=_st($2).__star($3);
  6967. $4=_st($Point())._x_y_((9),(16));
  6968. $ctx1.sendIdx["x:y:"]=1;
  6969. self._assert_equals_($1,$4);
  6970. $ctx1.sendIdx["assert:equals:"]=1;
  6971. $6=(3).__at((4));
  6972. $ctx1.sendIdx["@"]=3;
  6973. $7=(3).__at((4));
  6974. $ctx1.sendIdx["@"]=4;
  6975. $5=_st($6).__plus($7);
  6976. $8=_st($Point())._x_y_((6),(8));
  6977. $ctx1.sendIdx["x:y:"]=2;
  6978. self._assert_equals_($5,$8);
  6979. $ctx1.sendIdx["assert:equals:"]=2;
  6980. $10=(3).__at((4));
  6981. $ctx1.sendIdx["@"]=5;
  6982. $11=(3).__at((4));
  6983. $ctx1.sendIdx["@"]=6;
  6984. $9=_st($10).__minus($11);
  6985. $12=_st($Point())._x_y_((0),(0));
  6986. $ctx1.sendIdx["x:y:"]=3;
  6987. self._assert_equals_($9,$12);
  6988. $ctx1.sendIdx["assert:equals:"]=3;
  6989. $14=(6).__at((8));
  6990. $ctx1.sendIdx["@"]=7;
  6991. $13=_st($14).__slash((3).__at((4)));
  6992. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  6993. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  6994. args: [],
  6995. 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)",
  6996. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  6997. referencedClasses: ["Point"]
  6998. }),
  6999. smalltalk.PointTest);
  7000. smalltalk.addMethod(
  7001. smalltalk.method({
  7002. selector: "testAt",
  7003. protocol: 'tests',
  7004. fn: function (){
  7005. var self=this;
  7006. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7007. return smalltalk.withContext(function($ctx1) {
  7008. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7009. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  7010. args: [],
  7011. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7012. messageSends: ["assert:equals:", "@", "x:y:"],
  7013. referencedClasses: ["Point"]
  7014. }),
  7015. smalltalk.PointTest);
  7016. smalltalk.addMethod(
  7017. smalltalk.method({
  7018. selector: "testEgality",
  7019. protocol: 'tests',
  7020. fn: function (){
  7021. var self=this;
  7022. return smalltalk.withContext(function($ctx1) {
  7023. var $2,$3,$1,$5,$4;
  7024. $2=(3).__at((4));
  7025. $ctx1.sendIdx["@"]=1;
  7026. $3=(3).__at((4));
  7027. $ctx1.sendIdx["@"]=2;
  7028. $1=_st($2).__eq($3);
  7029. $ctx1.sendIdx["="]=1;
  7030. self._assert_($1);
  7031. $5=(3).__at((5));
  7032. $ctx1.sendIdx["@"]=3;
  7033. $4=_st($5).__eq((3).__at((6)));
  7034. self._deny_($4);
  7035. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  7036. args: [],
  7037. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7038. messageSends: ["assert:", "=", "@", "deny:"],
  7039. referencedClasses: []
  7040. }),
  7041. smalltalk.PointTest);
  7042. smalltalk.addMethod(
  7043. smalltalk.method({
  7044. selector: "testNew",
  7045. protocol: 'tests',
  7046. fn: function (){
  7047. var self=this;
  7048. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  7049. return smalltalk.withContext(function($ctx1) {
  7050. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7051. $3=_st($Point())._new();
  7052. $ctx1.sendIdx["new"]=1;
  7053. $2=_st($3)._x_((3));
  7054. $ctx1.sendIdx["x:"]=1;
  7055. $1=_st($2)._y();
  7056. $ctx1.sendIdx["y"]=1;
  7057. self._assert_equals_($1,nil);
  7058. $ctx1.sendIdx["assert:equals:"]=1;
  7059. $7=_st($Point())._new();
  7060. $ctx1.sendIdx["new"]=2;
  7061. $6=_st($7)._x_((3));
  7062. $5=_st($6)._x();
  7063. $ctx1.sendIdx["x"]=1;
  7064. $4=_st($5).__eq((0));
  7065. $ctx1.sendIdx["="]=1;
  7066. self._deny_($4);
  7067. $ctx1.sendIdx["deny:"]=1;
  7068. $10=_st($Point())._new();
  7069. $ctx1.sendIdx["new"]=3;
  7070. $9=_st($10)._y_((4));
  7071. $ctx1.sendIdx["y:"]=1;
  7072. $8=_st($9)._x();
  7073. self._assert_equals_($8,nil);
  7074. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  7075. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  7076. args: [],
  7077. 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",
  7078. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  7079. referencedClasses: ["Point"]
  7080. }),
  7081. smalltalk.PointTest);
  7082. smalltalk.addMethod(
  7083. smalltalk.method({
  7084. selector: "testTranslateBy",
  7085. protocol: 'tests',
  7086. fn: function (){
  7087. var self=this;
  7088. return smalltalk.withContext(function($ctx1) {
  7089. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  7090. $2=(3).__at((3));
  7091. $ctx1.sendIdx["@"]=1;
  7092. $3=(0).__at((1));
  7093. $ctx1.sendIdx["@"]=2;
  7094. $1=_st($2)._translateBy_($3);
  7095. $ctx1.sendIdx["translateBy:"]=1;
  7096. $4=(3).__at((4));
  7097. $ctx1.sendIdx["@"]=3;
  7098. self._assert_equals_($1,$4);
  7099. $ctx1.sendIdx["assert:equals:"]=1;
  7100. $6=(3).__at((3));
  7101. $ctx1.sendIdx["@"]=4;
  7102. $8=(1)._negated();
  7103. $ctx1.sendIdx["negated"]=1;
  7104. $7=(0).__at($8);
  7105. $ctx1.sendIdx["@"]=5;
  7106. $5=_st($6)._translateBy_($7);
  7107. $ctx1.sendIdx["translateBy:"]=2;
  7108. $9=(3).__at((2));
  7109. $ctx1.sendIdx["@"]=6;
  7110. self._assert_equals_($5,$9);
  7111. $ctx1.sendIdx["assert:equals:"]=2;
  7112. $11=(3).__at((3));
  7113. $ctx1.sendIdx["@"]=7;
  7114. $12=(2).__at((3));
  7115. $ctx1.sendIdx["@"]=8;
  7116. $10=_st($11)._translateBy_($12);
  7117. $ctx1.sendIdx["translateBy:"]=3;
  7118. $13=(5).__at((6));
  7119. $ctx1.sendIdx["@"]=9;
  7120. self._assert_equals_($10,$13);
  7121. $ctx1.sendIdx["assert:equals:"]=3;
  7122. $15=(3).__at((3));
  7123. $ctx1.sendIdx["@"]=10;
  7124. $16=_st((3)._negated()).__at((0));
  7125. $ctx1.sendIdx["@"]=11;
  7126. $14=_st($15)._translateBy_($16);
  7127. self._assert_equals_($14,(0).__at((3)));
  7128. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  7129. args: [],
  7130. 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.",
  7131. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  7132. referencedClasses: []
  7133. }),
  7134. smalltalk.PointTest);
  7135. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7136. smalltalk.addMethod(
  7137. smalltalk.method({
  7138. selector: "testNextIfAbsent",
  7139. protocol: 'tests',
  7140. fn: function (){
  7141. var self=this;
  7142. var queue;
  7143. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7144. return smalltalk.withContext(function($ctx1) {
  7145. var $2,$1;
  7146. queue=_st($Queue())._new();
  7147. _st(queue)._nextPut_("index1");
  7148. $2=_st(queue)._nextIfAbsent_("empty");
  7149. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7150. $1=_st($2).__eq("index1");
  7151. $ctx1.sendIdx["="]=1;
  7152. self._assert_($1);
  7153. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7154. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  7155. args: [],
  7156. 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'",
  7157. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7158. referencedClasses: ["Queue"]
  7159. }),
  7160. smalltalk.QueueTest);
  7161. smalltalk.addMethod(
  7162. smalltalk.method({
  7163. selector: "testQueueNext",
  7164. protocol: 'tests',
  7165. fn: function (){
  7166. var self=this;
  7167. var queue;
  7168. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7169. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7170. return smalltalk.withContext(function($ctx1) {
  7171. var $1,$2,$4,$3,$6,$5;
  7172. queue=_st($Queue())._new();
  7173. $1=queue;
  7174. _st($1)._nextPut_("index1");
  7175. $ctx1.sendIdx["nextPut:"]=1;
  7176. $2=_st($1)._nextPut_("index2");
  7177. $4=_st(queue)._next();
  7178. $ctx1.sendIdx["next"]=1;
  7179. $3=_st($4).__eq("index1");
  7180. $ctx1.sendIdx["="]=1;
  7181. self._assert_($3);
  7182. $6=_st(queue)._next();
  7183. $ctx1.sendIdx["next"]=2;
  7184. $5=_st($6).__eq("index");
  7185. self._deny_($5);
  7186. self._should_raise_((function(){
  7187. return smalltalk.withContext(function($ctx2) {
  7188. return _st(queue)._next();
  7189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7190. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  7191. args: [],
  7192. 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",
  7193. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  7194. referencedClasses: ["Queue", "Error"]
  7195. }),
  7196. smalltalk.QueueTest);
  7197. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7198. smalltalk.addMethod(
  7199. smalltalk.method({
  7200. selector: "testAtRandomNumber",
  7201. protocol: 'tests',
  7202. fn: function (){
  7203. var self=this;
  7204. var val;
  7205. return smalltalk.withContext(function($ctx1) {
  7206. (100)._timesRepeat_((function(){
  7207. return smalltalk.withContext(function($ctx2) {
  7208. val=(10)._atRandom();
  7209. val;
  7210. self._assert_(_st(val).__gt((0)));
  7211. $ctx2.sendIdx["assert:"]=1;
  7212. return self._assert_(_st(val).__lt((11)));
  7213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7214. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  7215. args: [],
  7216. 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]",
  7217. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  7218. referencedClasses: []
  7219. }),
  7220. smalltalk.RandomTest);
  7221. smalltalk.addMethod(
  7222. smalltalk.method({
  7223. selector: "testAtRandomSequenceableCollection",
  7224. protocol: 'tests',
  7225. fn: function (){
  7226. var self=this;
  7227. var val;
  7228. return smalltalk.withContext(function($ctx1) {
  7229. var $3,$4,$2,$1;
  7230. (100)._timesRepeat_((function(){
  7231. return smalltalk.withContext(function($ctx2) {
  7232. val="abc"._atRandom();
  7233. val;
  7234. $3=_st(val).__eq("a");
  7235. $ctx2.sendIdx["="]=1;
  7236. $4=_st(val).__eq("b");
  7237. $ctx2.sendIdx["="]=2;
  7238. $2=_st($3).__or($4);
  7239. $1=_st($2).__or(_st(val).__eq("c"));
  7240. $ctx2.sendIdx["|"]=1;
  7241. return self._assert_($1);
  7242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7243. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  7244. args: [],
  7245. 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].",
  7246. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  7247. referencedClasses: []
  7248. }),
  7249. smalltalk.RandomTest);
  7250. smalltalk.addMethod(
  7251. smalltalk.method({
  7252. selector: "textNext",
  7253. protocol: 'tests',
  7254. fn: function (){
  7255. var self=this;
  7256. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  7257. return smalltalk.withContext(function($ctx1) {
  7258. var $1;
  7259. (10000)._timesRepeat_((function(){
  7260. var current,next;
  7261. return smalltalk.withContext(function($ctx2) {
  7262. next=_st(_st($Random())._new())._next();
  7263. next;
  7264. self._assert_(_st(next).__gt_eq((0)));
  7265. $ctx2.sendIdx["assert:"]=1;
  7266. self._assert_(_st(next).__lt((1)));
  7267. $1=_st(current).__eq(next);
  7268. $ctx2.sendIdx["="]=1;
  7269. self._deny_($1);
  7270. return _st(next).__eq(current);
  7271. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  7272. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  7273. args: [],
  7274. 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 ]",
  7275. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  7276. referencedClasses: ["Random"]
  7277. }),
  7278. smalltalk.RandomTest);
  7279. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7280. smalltalk.addMethod(
  7281. smalltalk.method({
  7282. selector: "testAddRemove",
  7283. protocol: 'tests',
  7284. fn: function (){
  7285. var self=this;
  7286. var set;
  7287. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  7288. return smalltalk.withContext(function($ctx1) {
  7289. var $1,$2;
  7290. set=_st($Set())._new();
  7291. self._assert_(_st(set)._isEmpty());
  7292. $ctx1.sendIdx["assert:"]=1;
  7293. _st(set)._add_((3));
  7294. $ctx1.sendIdx["add:"]=1;
  7295. $1=_st(set)._includes_((3));
  7296. $ctx1.sendIdx["includes:"]=1;
  7297. self._assert_($1);
  7298. $ctx1.sendIdx["assert:"]=2;
  7299. _st(set)._add_((5));
  7300. $2=_st(set)._includes_((5));
  7301. $ctx1.sendIdx["includes:"]=2;
  7302. self._assert_($2);
  7303. _st(set)._remove_((3));
  7304. self._deny_(_st(set)._includes_((3)));
  7305. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  7306. args: [],
  7307. 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)",
  7308. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  7309. referencedClasses: ["Set"]
  7310. }),
  7311. smalltalk.SetTest);
  7312. smalltalk.addMethod(
  7313. smalltalk.method({
  7314. selector: "testAt",
  7315. protocol: 'tests',
  7316. fn: function (){
  7317. var self=this;
  7318. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  7319. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7320. return smalltalk.withContext(function($ctx1) {
  7321. self._should_raise_((function(){
  7322. return smalltalk.withContext(function($ctx2) {
  7323. return _st(_st($Set())._new())._at_put_((1),(2));
  7324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7325. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  7326. args: [],
  7327. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  7328. messageSends: ["should:raise:", "at:put:", "new"],
  7329. referencedClasses: ["Set", "Error"]
  7330. }),
  7331. smalltalk.SetTest);
  7332. smalltalk.addMethod(
  7333. smalltalk.method({
  7334. selector: "testCollect",
  7335. protocol: 'tests',
  7336. fn: function (){
  7337. var self=this;
  7338. return smalltalk.withContext(function($ctx1) {
  7339. var $2,$1;
  7340. $2=[(5), (6), (8)]._asSet();
  7341. $ctx1.sendIdx["asSet"]=1;
  7342. $1=_st($2)._collect_((function(x){
  7343. return smalltalk.withContext(function($ctx2) {
  7344. return _st(x).__backslash_backslash((3));
  7345. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  7346. self._assert_equals_($1,[(0), (2)]._asSet());
  7347. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  7348. args: [],
  7349. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  7350. messageSends: ["assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  7351. referencedClasses: []
  7352. }),
  7353. smalltalk.SetTest);
  7354. smalltalk.addMethod(
  7355. smalltalk.method({
  7356. selector: "testComparing",
  7357. protocol: 'tests',
  7358. fn: function (){
  7359. var self=this;
  7360. return smalltalk.withContext(function($ctx1) {
  7361. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  7362. $1=[(0), (2)]._asSet();
  7363. $ctx1.sendIdx["asSet"]=1;
  7364. $2=[(0), (2)]._asSet();
  7365. $ctx1.sendIdx["asSet"]=2;
  7366. self._assert_equals_($1,$2);
  7367. $ctx1.sendIdx["assert:equals:"]=1;
  7368. $3=[(2), (0)]._asSet();
  7369. $ctx1.sendIdx["asSet"]=3;
  7370. $4=[(0), (2)]._asSet();
  7371. $ctx1.sendIdx["asSet"]=4;
  7372. self._assert_equals_($3,$4);
  7373. $6=[(0), (2), (3)]._asSet();
  7374. $ctx1.sendIdx["asSet"]=5;
  7375. $7=[(0), (2)]._asSet();
  7376. $ctx1.sendIdx["asSet"]=6;
  7377. $5=_st($6).__eq($7);
  7378. $ctx1.sendIdx["="]=1;
  7379. self._deny_($5);
  7380. $ctx1.sendIdx["deny:"]=1;
  7381. $9=[(1), (2)]._asSet();
  7382. $ctx1.sendIdx["asSet"]=7;
  7383. $8=_st($9).__eq([(0), (2)]._asSet());
  7384. self._deny_($8);
  7385. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  7386. args: [],
  7387. 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",
  7388. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  7389. referencedClasses: []
  7390. }),
  7391. smalltalk.SetTest);
  7392. smalltalk.addMethod(
  7393. smalltalk.method({
  7394. selector: "testPrintString",
  7395. protocol: 'tests',
  7396. fn: function (){
  7397. var self=this;
  7398. var set;
  7399. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  7400. return smalltalk.withContext(function($ctx1) {
  7401. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  7402. set=_st($Set())._new();
  7403. $1=_st(set)._printString();
  7404. $ctx1.sendIdx["printString"]=1;
  7405. self._assert_equals_($1,"a Set ()");
  7406. $ctx1.sendIdx["assert:equals:"]=1;
  7407. $2=set;
  7408. _st($2)._add_((1));
  7409. $ctx1.sendIdx["add:"]=1;
  7410. $3=_st($2)._add_((3));
  7411. $ctx1.sendIdx["add:"]=2;
  7412. $4=_st(set)._printString();
  7413. $ctx1.sendIdx["printString"]=2;
  7414. self._assert_equals_($4,"a Set (1 3)");
  7415. $ctx1.sendIdx["assert:equals:"]=2;
  7416. _st(set)._add_("foo");
  7417. $ctx1.sendIdx["add:"]=3;
  7418. $5=_st(set)._printString();
  7419. $ctx1.sendIdx["printString"]=3;
  7420. self._assert_equals_($5,"a Set (1 3 'foo')");
  7421. $ctx1.sendIdx["assert:equals:"]=3;
  7422. $6=set;
  7423. _st($6)._remove_((1));
  7424. $ctx1.sendIdx["remove:"]=1;
  7425. $7=_st($6)._remove_((3));
  7426. $8=_st(set)._printString();
  7427. $ctx1.sendIdx["printString"]=4;
  7428. self._assert_equals_($8,"a Set ('foo')");
  7429. $ctx1.sendIdx["assert:equals:"]=4;
  7430. _st(set)._add_((3));
  7431. $ctx1.sendIdx["add:"]=4;
  7432. $9=_st(set)._printString();
  7433. $ctx1.sendIdx["printString"]=5;
  7434. self._assert_equals_($9,"a Set ('foo' 3)");
  7435. $ctx1.sendIdx["assert:equals:"]=5;
  7436. _st(set)._add_((3));
  7437. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  7438. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  7439. args: [],
  7440. 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)'",
  7441. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  7442. referencedClasses: ["Set"]
  7443. }),
  7444. smalltalk.SetTest);
  7445. smalltalk.addMethod(
  7446. smalltalk.method({
  7447. selector: "testSize",
  7448. protocol: 'tests',
  7449. fn: function (){
  7450. var self=this;
  7451. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  7452. return smalltalk.withContext(function($ctx1) {
  7453. var $1,$3,$2;
  7454. $1=_st(_st($Set())._new())._size();
  7455. $ctx1.sendIdx["size"]=1;
  7456. self._assert_equals_($1,(0));
  7457. $ctx1.sendIdx["assert:equals:"]=1;
  7458. $3=_st($Set())._withAll_([(1), (2), (3), (4)]);
  7459. $ctx1.sendIdx["withAll:"]=1;
  7460. $2=_st($3)._size();
  7461. $ctx1.sendIdx["size"]=2;
  7462. self._assert_equals_($2,(4));
  7463. $ctx1.sendIdx["assert:equals:"]=2;
  7464. self._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  7465. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  7466. args: [],
  7467. source: "testSize\x0a\x09self assert: Set new size equals: 0.\x0a\x09self assert: (Set withAll: #(1 2 3 4)) size equals: 4.\x0a\x09self assert: (Set withAll: #(1 1 1 1)) size equals: 1",
  7468. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  7469. referencedClasses: ["Set"]
  7470. }),
  7471. smalltalk.SetTest);
  7472. smalltalk.addMethod(
  7473. smalltalk.method({
  7474. selector: "testUnboxedObjects",
  7475. protocol: 'tests',
  7476. fn: function (){
  7477. var self=this;
  7478. return smalltalk.withContext(function($ctx1) {
  7479. var $4,$3,$2,$1;
  7480. $4="foo"._yourself();
  7481. $ctx1.sendIdx["yourself"]=1;
  7482. $3=[$4,"foo"._yourself()];
  7483. $2=_st($3)._asSet();
  7484. $1=_st($2)._asArray();
  7485. self._assert_equals_($1,["foo"]);
  7486. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  7487. args: [],
  7488. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  7489. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  7490. referencedClasses: []
  7491. }),
  7492. smalltalk.SetTest);
  7493. smalltalk.addMethod(
  7494. smalltalk.method({
  7495. selector: "testUnicity",
  7496. protocol: 'tests',
  7497. fn: function (){
  7498. var self=this;
  7499. var set;
  7500. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  7501. return smalltalk.withContext(function($ctx1) {
  7502. var $1;
  7503. set=_st($Set())._new();
  7504. _st(set)._add_((21));
  7505. $ctx1.sendIdx["add:"]=1;
  7506. _st(set)._add_("hello");
  7507. $ctx1.sendIdx["add:"]=2;
  7508. _st(set)._add_((21));
  7509. $ctx1.sendIdx["add:"]=3;
  7510. $1=_st(set)._size();
  7511. $ctx1.sendIdx["size"]=1;
  7512. self._assert_equals_($1,(2));
  7513. $ctx1.sendIdx["assert:equals:"]=1;
  7514. _st(set)._add_("hello");
  7515. self._assert_equals_(_st(set)._size(),(2));
  7516. $ctx1.sendIdx["assert:equals:"]=2;
  7517. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  7518. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  7519. args: [],
  7520. 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')",
  7521. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  7522. referencedClasses: ["Set"]
  7523. }),
  7524. smalltalk.SetTest);
  7525. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7526. smalltalk.addMethod(
  7527. smalltalk.method({
  7528. selector: "collectionClass",
  7529. protocol: 'accessing',
  7530. fn: function (){
  7531. var self=this;
  7532. return smalltalk.withContext(function($ctx1) {
  7533. var $1;
  7534. $1=_st(self._class())._collectionClass();
  7535. return $1;
  7536. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  7537. args: [],
  7538. source: "collectionClass\x0a\x09^ self class collectionClass",
  7539. messageSends: ["collectionClass", "class"],
  7540. referencedClasses: []
  7541. }),
  7542. smalltalk.StreamTest);
  7543. smalltalk.addMethod(
  7544. smalltalk.method({
  7545. selector: "newCollection",
  7546. protocol: 'accessing',
  7547. fn: function (){
  7548. var self=this;
  7549. return smalltalk.withContext(function($ctx1) {
  7550. var $1;
  7551. $1=_st(self._collectionClass())._new();
  7552. return $1;
  7553. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  7554. args: [],
  7555. source: "newCollection\x0a\x09^ self collectionClass new",
  7556. messageSends: ["new", "collectionClass"],
  7557. referencedClasses: []
  7558. }),
  7559. smalltalk.StreamTest);
  7560. smalltalk.addMethod(
  7561. smalltalk.method({
  7562. selector: "newStream",
  7563. protocol: 'accessing',
  7564. fn: function (){
  7565. var self=this;
  7566. return smalltalk.withContext(function($ctx1) {
  7567. var $1;
  7568. $1=_st(_st(self._collectionClass())._new())._stream();
  7569. return $1;
  7570. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  7571. args: [],
  7572. source: "newStream\x0a\x09^ self collectionClass new stream",
  7573. messageSends: ["stream", "new", "collectionClass"],
  7574. referencedClasses: []
  7575. }),
  7576. smalltalk.StreamTest);
  7577. smalltalk.addMethod(
  7578. smalltalk.method({
  7579. selector: "testAtStartAtEnd",
  7580. protocol: 'tests',
  7581. fn: function (){
  7582. var self=this;
  7583. var stream;
  7584. return smalltalk.withContext(function($ctx1) {
  7585. var $1,$2,$3,$4;
  7586. stream=self._newStream();
  7587. $1=_st(stream)._atStart();
  7588. $ctx1.sendIdx["atStart"]=1;
  7589. self._assert_($1);
  7590. $ctx1.sendIdx["assert:"]=1;
  7591. $2=_st(stream)._atEnd();
  7592. $ctx1.sendIdx["atEnd"]=1;
  7593. self._assert_($2);
  7594. $ctx1.sendIdx["assert:"]=2;
  7595. _st(stream)._nextPutAll_(self._newCollection());
  7596. $3=_st(stream)._atEnd();
  7597. $ctx1.sendIdx["atEnd"]=2;
  7598. self._assert_($3);
  7599. $4=_st(stream)._atStart();
  7600. $ctx1.sendIdx["atStart"]=2;
  7601. self._deny_($4);
  7602. $ctx1.sendIdx["deny:"]=1;
  7603. _st(stream)._position_((1));
  7604. self._deny_(_st(stream)._atEnd());
  7605. $ctx1.sendIdx["deny:"]=2;
  7606. self._deny_(_st(stream)._atStart());
  7607. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  7608. args: [],
  7609. 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",
  7610. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  7611. referencedClasses: []
  7612. }),
  7613. smalltalk.StreamTest);
  7614. smalltalk.addMethod(
  7615. smalltalk.method({
  7616. selector: "testContents",
  7617. protocol: 'tests',
  7618. fn: function (){
  7619. var self=this;
  7620. var stream;
  7621. return smalltalk.withContext(function($ctx1) {
  7622. var $1,$2;
  7623. stream=self._newStream();
  7624. $1=stream;
  7625. $2=self._newCollection();
  7626. $ctx1.sendIdx["newCollection"]=1;
  7627. _st($1)._nextPutAll_($2);
  7628. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  7629. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  7630. args: [],
  7631. 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",
  7632. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  7633. referencedClasses: []
  7634. }),
  7635. smalltalk.StreamTest);
  7636. smalltalk.addMethod(
  7637. smalltalk.method({
  7638. selector: "testIsEmpty",
  7639. protocol: 'tests',
  7640. fn: function (){
  7641. var self=this;
  7642. var stream;
  7643. return smalltalk.withContext(function($ctx1) {
  7644. var $1;
  7645. stream=self._newStream();
  7646. $1=_st(stream)._isEmpty();
  7647. $ctx1.sendIdx["isEmpty"]=1;
  7648. self._assert_($1);
  7649. _st(stream)._nextPutAll_(self._newCollection());
  7650. self._deny_(_st(stream)._isEmpty());
  7651. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  7652. args: [],
  7653. 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",
  7654. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  7655. referencedClasses: []
  7656. }),
  7657. smalltalk.StreamTest);
  7658. smalltalk.addMethod(
  7659. smalltalk.method({
  7660. selector: "testPosition",
  7661. protocol: 'tests',
  7662. fn: function (){
  7663. var self=this;
  7664. var collection,stream;
  7665. return smalltalk.withContext(function($ctx1) {
  7666. var $1,$2,$3;
  7667. collection=self._newCollection();
  7668. stream=self._newStream();
  7669. _st(stream)._nextPutAll_(collection);
  7670. $1=_st(stream)._position();
  7671. $ctx1.sendIdx["position"]=1;
  7672. self._assert_equals_($1,_st(collection)._size());
  7673. $ctx1.sendIdx["assert:equals:"]=1;
  7674. _st(stream)._position_((0));
  7675. $2=_st(stream)._position();
  7676. $ctx1.sendIdx["position"]=2;
  7677. self._assert_equals_($2,(0));
  7678. $ctx1.sendIdx["assert:equals:"]=2;
  7679. _st(stream)._next();
  7680. $ctx1.sendIdx["next"]=1;
  7681. $3=_st(stream)._position();
  7682. $ctx1.sendIdx["position"]=3;
  7683. self._assert_equals_($3,(1));
  7684. $ctx1.sendIdx["assert:equals:"]=3;
  7685. _st(stream)._next();
  7686. self._assert_equals_(_st(stream)._position(),(2));
  7687. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  7688. args: [],
  7689. 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",
  7690. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  7691. referencedClasses: []
  7692. }),
  7693. smalltalk.StreamTest);
  7694. smalltalk.addMethod(
  7695. smalltalk.method({
  7696. selector: "testReading",
  7697. protocol: 'tests',
  7698. fn: function (){
  7699. var self=this;
  7700. var stream,collection;
  7701. return smalltalk.withContext(function($ctx1) {
  7702. var $1,$2,$3;
  7703. collection=self._newCollection();
  7704. stream=self._newStream();
  7705. $1=stream;
  7706. _st($1)._nextPutAll_(collection);
  7707. $2=_st($1)._position_((0));
  7708. _st(collection)._do_((function(each){
  7709. return smalltalk.withContext(function($ctx2) {
  7710. $3=_st(stream)._next();
  7711. $ctx2.sendIdx["next"]=1;
  7712. return self._assert_equals_($3,each);
  7713. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7714. self._assert_(_st(_st(stream)._next())._isNil());
  7715. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7716. args: [],
  7717. 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",
  7718. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  7719. referencedClasses: []
  7720. }),
  7721. smalltalk.StreamTest);
  7722. smalltalk.addMethod(
  7723. smalltalk.method({
  7724. selector: "testStreamContents",
  7725. protocol: 'tests',
  7726. fn: function (){
  7727. var self=this;
  7728. return smalltalk.withContext(function($ctx1) {
  7729. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  7730. args: [],
  7731. source: "testStreamContents",
  7732. messageSends: [],
  7733. referencedClasses: []
  7734. }),
  7735. smalltalk.StreamTest);
  7736. smalltalk.addMethod(
  7737. smalltalk.method({
  7738. selector: "testWrite",
  7739. protocol: 'tests',
  7740. fn: function (){
  7741. var self=this;
  7742. var stream,collection;
  7743. return smalltalk.withContext(function($ctx1) {
  7744. collection=self._newCollection();
  7745. stream=self._newStream();
  7746. _st(collection)._do_((function(each){
  7747. return smalltalk.withContext(function($ctx2) {
  7748. return _st(stream).__lt_lt(each);
  7749. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7750. self._assert_equals_(_st(stream)._contents(),collection);
  7751. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7752. args: [],
  7753. 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",
  7754. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  7755. referencedClasses: []
  7756. }),
  7757. smalltalk.StreamTest);
  7758. smalltalk.addMethod(
  7759. smalltalk.method({
  7760. selector: "testWriting",
  7761. protocol: 'tests',
  7762. fn: function (){
  7763. var self=this;
  7764. var stream,collection;
  7765. return smalltalk.withContext(function($ctx1) {
  7766. var $1;
  7767. collection=self._newCollection();
  7768. stream=self._newStream();
  7769. $ctx1.sendIdx["newStream"]=1;
  7770. _st(collection)._do_((function(each){
  7771. return smalltalk.withContext(function($ctx2) {
  7772. return _st(stream)._nextPut_(each);
  7773. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7774. $1=_st(stream)._contents();
  7775. $ctx1.sendIdx["contents"]=1;
  7776. self._assert_equals_($1,collection);
  7777. $ctx1.sendIdx["assert:equals:"]=1;
  7778. stream=self._newStream();
  7779. _st(stream)._nextPutAll_(collection);
  7780. self._assert_equals_(_st(stream)._contents(),collection);
  7781. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7782. args: [],
  7783. 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",
  7784. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  7785. referencedClasses: []
  7786. }),
  7787. smalltalk.StreamTest);
  7788. smalltalk.addMethod(
  7789. smalltalk.method({
  7790. selector: "collectionClass",
  7791. protocol: 'accessing',
  7792. fn: function (){
  7793. var self=this;
  7794. return smalltalk.withContext(function($ctx1) {
  7795. return nil;
  7796. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  7797. args: [],
  7798. source: "collectionClass\x0a\x09^ nil",
  7799. messageSends: [],
  7800. referencedClasses: []
  7801. }),
  7802. smalltalk.StreamTest.klass);
  7803. smalltalk.addMethod(
  7804. smalltalk.method({
  7805. selector: "isAbstract",
  7806. protocol: 'testing',
  7807. fn: function (){
  7808. var self=this;
  7809. return smalltalk.withContext(function($ctx1) {
  7810. var $1;
  7811. $1=_st(self._collectionClass())._isNil();
  7812. return $1;
  7813. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  7814. args: [],
  7815. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  7816. messageSends: ["isNil", "collectionClass"],
  7817. referencedClasses: []
  7818. }),
  7819. smalltalk.StreamTest.klass);
  7820. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  7821. smalltalk.addMethod(
  7822. smalltalk.method({
  7823. selector: "newCollection",
  7824. protocol: 'accessing',
  7825. fn: function (){
  7826. var self=this;
  7827. return smalltalk.withContext(function($ctx1) {
  7828. var $1;
  7829. $1=[true,(1),(3).__at((4)),"foo"];
  7830. return $1;
  7831. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  7832. args: [],
  7833. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  7834. messageSends: ["@"],
  7835. referencedClasses: []
  7836. }),
  7837. smalltalk.ArrayStreamTest);
  7838. smalltalk.addMethod(
  7839. smalltalk.method({
  7840. selector: "collectionClass",
  7841. protocol: 'accessing',
  7842. fn: function (){
  7843. var self=this;
  7844. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  7845. return smalltalk.withContext(function($ctx1) {
  7846. return $Array();
  7847. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  7848. args: [],
  7849. source: "collectionClass\x0a\x09^ Array",
  7850. messageSends: [],
  7851. referencedClasses: ["Array"]
  7852. }),
  7853. smalltalk.ArrayStreamTest.klass);
  7854. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  7855. smalltalk.addMethod(
  7856. smalltalk.method({
  7857. selector: "newCollection",
  7858. protocol: 'accessing',
  7859. fn: function (){
  7860. var self=this;
  7861. return smalltalk.withContext(function($ctx1) {
  7862. return "hello world";
  7863. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  7864. args: [],
  7865. source: "newCollection\x0a\x09^ 'hello world'",
  7866. messageSends: [],
  7867. referencedClasses: []
  7868. }),
  7869. smalltalk.StringStreamTest);
  7870. smalltalk.addMethod(
  7871. smalltalk.method({
  7872. selector: "collectionClass",
  7873. protocol: 'accessing',
  7874. fn: function (){
  7875. var self=this;
  7876. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  7877. return smalltalk.withContext(function($ctx1) {
  7878. return $String();
  7879. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  7880. args: [],
  7881. source: "collectionClass\x0a\x09^ String",
  7882. messageSends: [],
  7883. referencedClasses: ["String"]
  7884. }),
  7885. smalltalk.StringStreamTest.klass);
  7886. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7887. smalltalk.addMethod(
  7888. smalltalk.method({
  7889. selector: "testCopying",
  7890. protocol: 'tests',
  7891. fn: function (){
  7892. var self=this;
  7893. return smalltalk.withContext(function($ctx1) {
  7894. self._assert_equals_(nil._copy(),nil);
  7895. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  7896. args: [],
  7897. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  7898. messageSends: ["assert:equals:", "copy"],
  7899. referencedClasses: []
  7900. }),
  7901. smalltalk.UndefinedTest);
  7902. smalltalk.addMethod(
  7903. smalltalk.method({
  7904. selector: "testDeepCopy",
  7905. protocol: 'tests',
  7906. fn: function (){
  7907. var self=this;
  7908. return smalltalk.withContext(function($ctx1) {
  7909. self._assert_(_st(nil._deepCopy()).__eq(nil));
  7910. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  7911. args: [],
  7912. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  7913. messageSends: ["assert:", "=", "deepCopy"],
  7914. referencedClasses: []
  7915. }),
  7916. smalltalk.UndefinedTest);
  7917. smalltalk.addMethod(
  7918. smalltalk.method({
  7919. selector: "testIfNil",
  7920. protocol: 'tests',
  7921. fn: function (){
  7922. var self=this;
  7923. return smalltalk.withContext(function($ctx1) {
  7924. var $1,$3,$2,$4,$6,$5;
  7925. if(($receiver = nil) == nil || $receiver == null){
  7926. $1=true;
  7927. } else {
  7928. $1=nil;
  7929. };
  7930. self._assert_equals_($1,true);
  7931. $ctx1.sendIdx["assert:equals:"]=1;
  7932. if(($receiver = nil) == nil || $receiver == null){
  7933. $3=nil;
  7934. } else {
  7935. $3=true;
  7936. };
  7937. $2=_st($3).__eq(true);
  7938. $ctx1.sendIdx["="]=1;
  7939. self._deny_($2);
  7940. $ctx1.sendIdx["deny:"]=1;
  7941. if(($receiver = nil) == nil || $receiver == null){
  7942. $4=true;
  7943. } else {
  7944. $4=false;
  7945. };
  7946. self._assert_equals_($4,true);
  7947. if(($receiver = nil) == nil || $receiver == null){
  7948. $6=false;
  7949. } else {
  7950. $6=true;
  7951. };
  7952. $5=_st($6).__eq(true);
  7953. self._deny_($5);
  7954. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  7955. args: [],
  7956. 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",
  7957. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7958. referencedClasses: []
  7959. }),
  7960. smalltalk.UndefinedTest);
  7961. smalltalk.addMethod(
  7962. smalltalk.method({
  7963. selector: "testIsNil",
  7964. protocol: 'tests',
  7965. fn: function (){
  7966. var self=this;
  7967. return smalltalk.withContext(function($ctx1) {
  7968. self._assert_(nil._isNil());
  7969. self._deny_(nil._notNil());
  7970. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  7971. args: [],
  7972. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  7973. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  7974. referencedClasses: []
  7975. }),
  7976. smalltalk.UndefinedTest);
  7977. });