Kernel-Tests.js 295 KB

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