2
0

Kernel-Tests.js 274 KB

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