2
0

Kernel-Tests.js 274 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244
  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. testObject=self._jsObject();
  4049. _st(testObject)._at_put_("value","aValue");
  4050. self._assert_equals_(_st(testObject)._value(),"aValue");
  4051. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4052. args: [],
  4053. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  4054. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  4055. referencedClasses: []
  4056. }),
  4057. smalltalk.JSObjectProxyTest);
  4058. smalltalk.addMethod(
  4059. smalltalk.method({
  4060. selector: "testYourself",
  4061. category: 'tests',
  4062. fn: function (){
  4063. var self=this;
  4064. var object;
  4065. return smalltalk.withContext(function($ctx1) {
  4066. var $1,$2;
  4067. $1=self._jsObject();
  4068. _st($1)._d_("test");
  4069. $2=_st($1)._yourself();
  4070. object=$2;
  4071. self._assert_equals_(_st(object)._d(),"test");
  4072. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  4073. args: [],
  4074. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  4075. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  4076. referencedClasses: []
  4077. }),
  4078. smalltalk.JSObjectProxyTest);
  4079. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4080. smalltalk.addMethod(
  4081. smalltalk.method({
  4082. selector: "testCatchingException",
  4083. category: 'tests',
  4084. fn: function (){
  4085. var self=this;
  4086. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4087. return smalltalk.withContext(function($ctx1) {
  4088. _st((function(){
  4089. return smalltalk.withContext(function($ctx2) {
  4090. return self._throwException();
  4091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  4092. return smalltalk.withContext(function($ctx2) {
  4093. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  4094. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  4095. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  4096. args: [],
  4097. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  4098. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  4099. referencedClasses: ["Error"]
  4100. }),
  4101. smalltalk.JavaScriptExceptionTest);
  4102. smalltalk.addMethod(
  4103. smalltalk.method({
  4104. selector: "testRaisingException",
  4105. category: 'tests',
  4106. fn: function (){
  4107. var self=this;
  4108. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  4109. return smalltalk.withContext(function($ctx1) {
  4110. self._should_raise_((function(){
  4111. return smalltalk.withContext(function($ctx2) {
  4112. return self._throwException();
  4113. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  4114. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  4115. args: [],
  4116. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  4117. messageSends: ["should:raise:", "throwException"],
  4118. referencedClasses: ["JavaScriptException"]
  4119. }),
  4120. smalltalk.JavaScriptExceptionTest);
  4121. smalltalk.addMethod(
  4122. smalltalk.method({
  4123. selector: "throwException",
  4124. category: 'helpers',
  4125. fn: function (){
  4126. var self=this;
  4127. return smalltalk.withContext(function($ctx1) {
  4128. throw 'test';
  4129. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  4130. args: [],
  4131. source: "throwException\x0a\x09<throw 'test'>",
  4132. messageSends: [],
  4133. referencedClasses: []
  4134. }),
  4135. smalltalk.JavaScriptExceptionTest);
  4136. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4137. smalltalk.addMethod(
  4138. smalltalk.method({
  4139. selector: "testValue",
  4140. category: 'tests',
  4141. fn: function (){
  4142. var self=this;
  4143. var messageSend;
  4144. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4145. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4146. return smalltalk.withContext(function($ctx1) {
  4147. var $1,$2;
  4148. $1=_st($MessageSend())._new();
  4149. $ctx1.sendIdx["new"]=1;
  4150. _st($1)._receiver_(_st($Object())._new());
  4151. _st($1)._selector_("asString");
  4152. $2=_st($1)._yourself();
  4153. messageSend=$2;
  4154. self._assert_equals_(_st(messageSend)._value(),"an Object");
  4155. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4156. args: [],
  4157. 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'",
  4158. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  4159. referencedClasses: ["MessageSend", "Object"]
  4160. }),
  4161. smalltalk.MessageSendTest);
  4162. smalltalk.addMethod(
  4163. smalltalk.method({
  4164. selector: "testValueWithArguments",
  4165. category: 'tests',
  4166. fn: function (){
  4167. var self=this;
  4168. var messageSend;
  4169. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  4170. return smalltalk.withContext(function($ctx1) {
  4171. var $1,$2;
  4172. $1=_st($MessageSend())._new();
  4173. _st($1)._receiver_((2));
  4174. _st($1)._selector_("+");
  4175. $2=_st($1)._yourself();
  4176. messageSend=$2;
  4177. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  4178. $ctx1.sendIdx["assert:equals:"]=1;
  4179. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  4180. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  4181. args: [],
  4182. 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",
  4183. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  4184. referencedClasses: ["MessageSend"]
  4185. }),
  4186. smalltalk.MessageSendTest);
  4187. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  4188. smalltalk.addMethod(
  4189. smalltalk.method({
  4190. selector: "codeGeneratorClass",
  4191. category: 'accessing',
  4192. fn: function (){
  4193. var self=this;
  4194. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  4195. return smalltalk.withContext(function($ctx1) {
  4196. return $CodeGenerator();
  4197. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  4198. args: [],
  4199. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  4200. messageSends: [],
  4201. referencedClasses: ["CodeGenerator"]
  4202. }),
  4203. smalltalk.MethodInheritanceTest);
  4204. smalltalk.addMethod(
  4205. smalltalk.method({
  4206. selector: "compiler",
  4207. category: 'factory',
  4208. fn: function (){
  4209. var self=this;
  4210. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  4211. return smalltalk.withContext(function($ctx1) {
  4212. var $2,$3,$1;
  4213. $2=_st($Compiler())._new();
  4214. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  4215. $3=_st($2)._yourself();
  4216. $1=$3;
  4217. return $1;
  4218. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  4219. args: [],
  4220. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  4221. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  4222. referencedClasses: ["Compiler"]
  4223. }),
  4224. smalltalk.MethodInheritanceTest);
  4225. smalltalk.addMethod(
  4226. smalltalk.method({
  4227. selector: "deinstallBottom",
  4228. category: 'testing',
  4229. fn: function (){
  4230. var self=this;
  4231. return smalltalk.withContext(function($ctx1) {
  4232. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  4233. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  4234. args: [],
  4235. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  4236. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  4237. referencedClasses: []
  4238. }),
  4239. smalltalk.MethodInheritanceTest);
  4240. smalltalk.addMethod(
  4241. smalltalk.method({
  4242. selector: "deinstallMiddle",
  4243. category: 'testing',
  4244. fn: function (){
  4245. var self=this;
  4246. return smalltalk.withContext(function($ctx1) {
  4247. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  4248. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  4249. args: [],
  4250. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  4251. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  4252. referencedClasses: []
  4253. }),
  4254. smalltalk.MethodInheritanceTest);
  4255. smalltalk.addMethod(
  4256. smalltalk.method({
  4257. selector: "deinstallTop",
  4258. category: 'testing',
  4259. fn: function (){
  4260. var self=this;
  4261. return smalltalk.withContext(function($ctx1) {
  4262. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  4263. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  4264. args: [],
  4265. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  4266. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  4267. referencedClasses: []
  4268. }),
  4269. smalltalk.MethodInheritanceTest);
  4270. smalltalk.addMethod(
  4271. smalltalk.method({
  4272. selector: "installBottom:",
  4273. category: 'testing',
  4274. fn: function (aString){
  4275. var self=this;
  4276. return smalltalk.withContext(function($ctx1) {
  4277. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassBottom(),"tests");
  4278. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4279. args: ["aString"],
  4280. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom category: 'tests'",
  4281. messageSends: ["install:forClass:category:", "compiler", "targetClassBottom"],
  4282. referencedClasses: []
  4283. }),
  4284. smalltalk.MethodInheritanceTest);
  4285. smalltalk.addMethod(
  4286. smalltalk.method({
  4287. selector: "installMiddle:",
  4288. category: 'testing',
  4289. fn: function (aString){
  4290. var self=this;
  4291. return smalltalk.withContext(function($ctx1) {
  4292. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassMiddle(),"tests");
  4293. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4294. args: ["aString"],
  4295. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle category: 'tests'",
  4296. messageSends: ["install:forClass:category:", "compiler", "targetClassMiddle"],
  4297. referencedClasses: []
  4298. }),
  4299. smalltalk.MethodInheritanceTest);
  4300. smalltalk.addMethod(
  4301. smalltalk.method({
  4302. selector: "installTop:",
  4303. category: 'testing',
  4304. fn: function (aString){
  4305. var self=this;
  4306. return smalltalk.withContext(function($ctx1) {
  4307. self["@method"]=_st(self._compiler())._install_forClass_category_(aString,self._targetClassTop(),"tests");
  4308. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  4309. args: ["aString"],
  4310. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop category: 'tests'",
  4311. messageSends: ["install:forClass:category:", "compiler", "targetClassTop"],
  4312. referencedClasses: []
  4313. }),
  4314. smalltalk.MethodInheritanceTest);
  4315. smalltalk.addMethod(
  4316. smalltalk.method({
  4317. selector: "setUp",
  4318. category: 'initialization',
  4319. fn: function (){
  4320. var self=this;
  4321. return smalltalk.withContext(function($ctx1) {
  4322. self["@receiverTop"]=_st(self._targetClassTop())._new();
  4323. $ctx1.sendIdx["new"]=1;
  4324. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  4325. $ctx1.sendIdx["new"]=2;
  4326. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  4327. self["@method"]=nil;
  4328. self["@performBlock"]=(function(){
  4329. return smalltalk.withContext(function($ctx2) {
  4330. return self._error_("performBlock not initialized");
  4331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  4332. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  4333. args: [],
  4334. 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' ]",
  4335. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  4336. referencedClasses: []
  4337. }),
  4338. smalltalk.MethodInheritanceTest);
  4339. smalltalk.addMethod(
  4340. smalltalk.method({
  4341. selector: "shouldMNU",
  4342. category: 'testing',
  4343. fn: function (){
  4344. var self=this;
  4345. return smalltalk.withContext(function($ctx1) {
  4346. self._shouldMNUTop();
  4347. self._shouldMNUMiddle();
  4348. self._shouldMNUBottom();
  4349. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  4350. args: [],
  4351. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  4352. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  4353. referencedClasses: []
  4354. }),
  4355. smalltalk.MethodInheritanceTest);
  4356. smalltalk.addMethod(
  4357. smalltalk.method({
  4358. selector: "shouldMNUBottom",
  4359. category: 'testing',
  4360. fn: function (){
  4361. var self=this;
  4362. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4363. return smalltalk.withContext(function($ctx1) {
  4364. self._should_raise_((function(){
  4365. return smalltalk.withContext(function($ctx2) {
  4366. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4367. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4368. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  4369. args: [],
  4370. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  4371. messageSends: ["should:raise:", "value:"],
  4372. referencedClasses: ["MessageNotUnderstood"]
  4373. }),
  4374. smalltalk.MethodInheritanceTest);
  4375. smalltalk.addMethod(
  4376. smalltalk.method({
  4377. selector: "shouldMNUMiddle",
  4378. category: 'testing',
  4379. fn: function (){
  4380. var self=this;
  4381. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4382. return smalltalk.withContext(function($ctx1) {
  4383. self._should_raise_((function(){
  4384. return smalltalk.withContext(function($ctx2) {
  4385. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4387. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  4388. args: [],
  4389. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  4390. messageSends: ["should:raise:", "value:"],
  4391. referencedClasses: ["MessageNotUnderstood"]
  4392. }),
  4393. smalltalk.MethodInheritanceTest);
  4394. smalltalk.addMethod(
  4395. smalltalk.method({
  4396. selector: "shouldMNUTop",
  4397. category: 'testing',
  4398. fn: function (){
  4399. var self=this;
  4400. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4401. return smalltalk.withContext(function($ctx1) {
  4402. self._should_raise_((function(){
  4403. return smalltalk.withContext(function($ctx2) {
  4404. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  4405. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4406. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  4407. args: [],
  4408. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  4409. messageSends: ["should:raise:", "value:"],
  4410. referencedClasses: ["MessageNotUnderstood"]
  4411. }),
  4412. smalltalk.MethodInheritanceTest);
  4413. smalltalk.addMethod(
  4414. smalltalk.method({
  4415. selector: "shouldReturn:",
  4416. category: 'testing',
  4417. fn: function (anObject){
  4418. var self=this;
  4419. var result;
  4420. return smalltalk.withContext(function($ctx1) {
  4421. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4422. $ctx1.sendIdx["value:"]=1;
  4423. self._assert_equals_(["top",anObject],["top",result]);
  4424. $ctx1.sendIdx["assert:equals:"]=1;
  4425. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4426. $ctx1.sendIdx["value:"]=2;
  4427. self._assert_equals_(["middle",anObject],["middle",result]);
  4428. $ctx1.sendIdx["assert:equals:"]=2;
  4429. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4430. self._assert_equals_(["bottom",anObject],["bottom",result]);
  4431. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  4432. args: ["anObject"],
  4433. 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 }",
  4434. messageSends: ["value:", "assert:equals:"],
  4435. referencedClasses: []
  4436. }),
  4437. smalltalk.MethodInheritanceTest);
  4438. smalltalk.addMethod(
  4439. smalltalk.method({
  4440. selector: "shouldReturn:and:and:",
  4441. category: 'testing',
  4442. fn: function (anObject,anObject2,anObject3){
  4443. var self=this;
  4444. var result;
  4445. return smalltalk.withContext(function($ctx1) {
  4446. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  4447. $ctx1.sendIdx["value:"]=1;
  4448. self._assert_equals_(["top",anObject],["top",result]);
  4449. $ctx1.sendIdx["assert:equals:"]=1;
  4450. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  4451. $ctx1.sendIdx["value:"]=2;
  4452. self._assert_equals_(["middle",anObject2],["middle",result]);
  4453. $ctx1.sendIdx["assert:equals:"]=2;
  4454. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  4455. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  4456. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  4457. args: ["anObject", "anObject2", "anObject3"],
  4458. 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 }",
  4459. messageSends: ["value:", "assert:equals:"],
  4460. referencedClasses: []
  4461. }),
  4462. smalltalk.MethodInheritanceTest);
  4463. smalltalk.addMethod(
  4464. smalltalk.method({
  4465. selector: "targetClassBottom",
  4466. category: 'accessing',
  4467. fn: function (){
  4468. var self=this;
  4469. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  4470. return smalltalk.withContext(function($ctx1) {
  4471. return $JavaScriptException();
  4472. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  4473. args: [],
  4474. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  4475. messageSends: [],
  4476. referencedClasses: ["JavaScriptException"]
  4477. }),
  4478. smalltalk.MethodInheritanceTest);
  4479. smalltalk.addMethod(
  4480. smalltalk.method({
  4481. selector: "targetClassMiddle",
  4482. category: 'accessing',
  4483. fn: function (){
  4484. var self=this;
  4485. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4486. return smalltalk.withContext(function($ctx1) {
  4487. return $Error();
  4488. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  4489. args: [],
  4490. source: "targetClassMiddle\x0a\x09^ Error",
  4491. messageSends: [],
  4492. referencedClasses: ["Error"]
  4493. }),
  4494. smalltalk.MethodInheritanceTest);
  4495. smalltalk.addMethod(
  4496. smalltalk.method({
  4497. selector: "targetClassTop",
  4498. category: 'accessing',
  4499. fn: function (){
  4500. var self=this;
  4501. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  4502. return smalltalk.withContext(function($ctx1) {
  4503. return $Object();
  4504. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  4505. args: [],
  4506. source: "targetClassTop\x0a\x09^ Object",
  4507. messageSends: [],
  4508. referencedClasses: ["Object"]
  4509. }),
  4510. smalltalk.MethodInheritanceTest);
  4511. smalltalk.addMethod(
  4512. smalltalk.method({
  4513. selector: "tearDown",
  4514. category: 'initialization',
  4515. fn: function (){
  4516. var self=this;
  4517. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4518. return smalltalk.withContext(function($ctx1) {
  4519. _st((function(){
  4520. return smalltalk.withContext(function($ctx2) {
  4521. return self._deinstallTop();
  4522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  4523. return smalltalk.withContext(function($ctx2) {
  4524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4525. $ctx1.sendIdx["on:do:"]=1;
  4526. _st((function(){
  4527. return smalltalk.withContext(function($ctx2) {
  4528. return self._deinstallMiddle();
  4529. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  4530. return smalltalk.withContext(function($ctx2) {
  4531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4532. $ctx1.sendIdx["on:do:"]=2;
  4533. _st((function(){
  4534. return smalltalk.withContext(function($ctx2) {
  4535. return self._deinstallBottom();
  4536. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  4537. return smalltalk.withContext(function($ctx2) {
  4538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  4539. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  4540. args: [],
  4541. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  4542. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  4543. referencedClasses: ["Error"]
  4544. }),
  4545. smalltalk.MethodInheritanceTest);
  4546. smalltalk.addMethod(
  4547. smalltalk.method({
  4548. selector: "testMNU11",
  4549. category: 'tests',
  4550. fn: function (){
  4551. var self=this;
  4552. return smalltalk.withContext(function($ctx1) {
  4553. self["@performBlock"]=(function(x){
  4554. return smalltalk.withContext(function($ctx2) {
  4555. return _st(x)._foo();
  4556. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4557. self._shouldMNU();
  4558. $ctx1.sendIdx["shouldMNU"]=1;
  4559. self._installTop_("foo ^ false");
  4560. $ctx1.sendIdx["installTop:"]=1;
  4561. self._installTop_("foo ^ true");
  4562. self._deinstallTop();
  4563. self._shouldMNU();
  4564. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  4565. args: [],
  4566. 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",
  4567. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  4568. referencedClasses: []
  4569. }),
  4570. smalltalk.MethodInheritanceTest);
  4571. smalltalk.addMethod(
  4572. smalltalk.method({
  4573. selector: "testMNU22",
  4574. category: 'tests',
  4575. fn: function (){
  4576. var self=this;
  4577. return smalltalk.withContext(function($ctx1) {
  4578. self["@performBlock"]=(function(x){
  4579. return smalltalk.withContext(function($ctx2) {
  4580. return _st(x)._foo();
  4581. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4582. self._shouldMNU();
  4583. $ctx1.sendIdx["shouldMNU"]=1;
  4584. self._installMiddle_("foo ^ false");
  4585. $ctx1.sendIdx["installMiddle:"]=1;
  4586. self._installMiddle_("foo ^ true");
  4587. self._deinstallMiddle();
  4588. self._shouldMNU();
  4589. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  4590. args: [],
  4591. 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",
  4592. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  4593. referencedClasses: []
  4594. }),
  4595. smalltalk.MethodInheritanceTest);
  4596. smalltalk.addMethod(
  4597. smalltalk.method({
  4598. selector: "testReturns1",
  4599. category: 'tests',
  4600. fn: function (){
  4601. var self=this;
  4602. return smalltalk.withContext(function($ctx1) {
  4603. self["@performBlock"]=(function(x){
  4604. return smalltalk.withContext(function($ctx2) {
  4605. return _st(x)._foo();
  4606. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  4607. self._installTop_("foo ^ false");
  4608. $ctx1.sendIdx["installTop:"]=1;
  4609. self._shouldReturn_(false);
  4610. $ctx1.sendIdx["shouldReturn:"]=1;
  4611. self._installTop_("foo ^ true");
  4612. self._shouldReturn_(true);
  4613. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  4614. args: [],
  4615. 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",
  4616. messageSends: ["foo", "installTop:", "shouldReturn:"],
  4617. referencedClasses: []
  4618. }),
  4619. smalltalk.MethodInheritanceTest);
  4620. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4621. smalltalk.addMethod(
  4622. smalltalk.method({
  4623. selector: "testAbs",
  4624. category: 'tests',
  4625. fn: function (){
  4626. var self=this;
  4627. return smalltalk.withContext(function($ctx1) {
  4628. var $1;
  4629. $1=(4)._abs();
  4630. $ctx1.sendIdx["abs"]=1;
  4631. self._assert_equals_($1,(4));
  4632. $ctx1.sendIdx["assert:equals:"]=1;
  4633. self._assert_equals_((-4)._abs(),(4));
  4634. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  4635. args: [],
  4636. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  4637. messageSends: ["assert:equals:", "abs"],
  4638. referencedClasses: []
  4639. }),
  4640. smalltalk.NumberTest);
  4641. smalltalk.addMethod(
  4642. smalltalk.method({
  4643. selector: "testArithmetic",
  4644. category: 'tests',
  4645. fn: function (){
  4646. var self=this;
  4647. return smalltalk.withContext(function($ctx1) {
  4648. var $1,$2,$3,$5,$4;
  4649. $1=(1.5).__plus((1));
  4650. $ctx1.sendIdx["+"]=1;
  4651. self._assert_equals_($1,(2.5));
  4652. $ctx1.sendIdx["assert:equals:"]=1;
  4653. $2=(2).__minus((1));
  4654. $ctx1.sendIdx["-"]=1;
  4655. self._assert_equals_($2,(1));
  4656. $ctx1.sendIdx["assert:equals:"]=2;
  4657. self._assert_equals_((-2).__minus((1)),(-3));
  4658. $ctx1.sendIdx["assert:equals:"]=3;
  4659. self._assert_equals_((12).__slash((2)),(6));
  4660. $ctx1.sendIdx["assert:equals:"]=4;
  4661. $3=(3).__star((4));
  4662. $ctx1.sendIdx["*"]=1;
  4663. self._assert_equals_($3,(12));
  4664. $ctx1.sendIdx["assert:equals:"]=5;
  4665. self._assert_equals_((7).__slash_slash((2)),(3));
  4666. $ctx1.sendIdx["assert:equals:"]=6;
  4667. self._assert_equals_((7).__backslash_backslash((2)),(1));
  4668. $ctx1.sendIdx["assert:equals:"]=7;
  4669. $5=(1).__plus((2));
  4670. $ctx1.sendIdx["+"]=2;
  4671. $4=_st($5).__star((3));
  4672. $ctx1.sendIdx["*"]=2;
  4673. self._assert_equals_($4,(9));
  4674. $ctx1.sendIdx["assert:equals:"]=8;
  4675. self._assert_equals_((1).__plus((2).__star((3))),(7));
  4676. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  4677. args: [],
  4678. 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",
  4679. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  4680. referencedClasses: []
  4681. }),
  4682. smalltalk.NumberTest);
  4683. smalltalk.addMethod(
  4684. smalltalk.method({
  4685. selector: "testAsNumber",
  4686. category: 'tests',
  4687. fn: function (){
  4688. var self=this;
  4689. return smalltalk.withContext(function($ctx1) {
  4690. self._assert_equals_((3)._asNumber(),(3));
  4691. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  4692. args: [],
  4693. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  4694. messageSends: ["assert:equals:", "asNumber"],
  4695. referencedClasses: []
  4696. }),
  4697. smalltalk.NumberTest);
  4698. smalltalk.addMethod(
  4699. smalltalk.method({
  4700. selector: "testCeiling",
  4701. category: 'tests',
  4702. fn: function (){
  4703. var self=this;
  4704. return smalltalk.withContext(function($ctx1) {
  4705. var $1,$2;
  4706. $1=(1.2)._ceiling();
  4707. $ctx1.sendIdx["ceiling"]=1;
  4708. self._assert_equals_($1,(2));
  4709. $ctx1.sendIdx["assert:equals:"]=1;
  4710. $2=(-1.2)._ceiling();
  4711. $ctx1.sendIdx["ceiling"]=2;
  4712. self._assert_equals_($2,(-1));
  4713. $ctx1.sendIdx["assert:equals:"]=2;
  4714. self._assert_equals_((1)._ceiling(),(1));
  4715. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  4716. args: [],
  4717. 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.",
  4718. messageSends: ["assert:equals:", "ceiling"],
  4719. referencedClasses: []
  4720. }),
  4721. smalltalk.NumberTest);
  4722. smalltalk.addMethod(
  4723. smalltalk.method({
  4724. selector: "testComparison",
  4725. category: 'tests',
  4726. fn: function (){
  4727. var self=this;
  4728. return smalltalk.withContext(function($ctx1) {
  4729. var $1,$2,$3,$4;
  4730. $1=(3).__gt((2));
  4731. $ctx1.sendIdx[">"]=1;
  4732. self._assert_($1);
  4733. $ctx1.sendIdx["assert:"]=1;
  4734. $2=(2).__lt((3));
  4735. $ctx1.sendIdx["<"]=1;
  4736. self._assert_($2);
  4737. $ctx1.sendIdx["assert:"]=2;
  4738. self._deny_((3).__lt((2)));
  4739. $ctx1.sendIdx["deny:"]=1;
  4740. self._deny_((2).__gt((3)));
  4741. $3=(3).__gt_eq((3));
  4742. $ctx1.sendIdx[">="]=1;
  4743. self._assert_($3);
  4744. $ctx1.sendIdx["assert:"]=3;
  4745. self._assert_((3.1).__gt_eq((3)));
  4746. $ctx1.sendIdx["assert:"]=4;
  4747. $4=(3).__lt_eq((3));
  4748. $ctx1.sendIdx["<="]=1;
  4749. self._assert_($4);
  4750. $ctx1.sendIdx["assert:"]=5;
  4751. self._assert_((3).__lt_eq((3.1)));
  4752. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  4753. args: [],
  4754. 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",
  4755. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  4756. referencedClasses: []
  4757. }),
  4758. smalltalk.NumberTest);
  4759. smalltalk.addMethod(
  4760. smalltalk.method({
  4761. selector: "testCopying",
  4762. category: 'tests',
  4763. fn: function (){
  4764. var self=this;
  4765. return smalltalk.withContext(function($ctx1) {
  4766. var $1;
  4767. $1=_st((1)._copy()).__eq_eq((1));
  4768. $ctx1.sendIdx["=="]=1;
  4769. self._assert_($1);
  4770. $ctx1.sendIdx["assert:"]=1;
  4771. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  4772. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  4773. args: [],
  4774. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  4775. messageSends: ["assert:", "==", "copy", "deepCopy"],
  4776. referencedClasses: []
  4777. }),
  4778. smalltalk.NumberTest);
  4779. smalltalk.addMethod(
  4780. smalltalk.method({
  4781. selector: "testEquality",
  4782. category: 'tests',
  4783. fn: function (){
  4784. var self=this;
  4785. return smalltalk.withContext(function($ctx1) {
  4786. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  4787. $1=(1).__eq((1));
  4788. $ctx1.sendIdx["="]=1;
  4789. self._assert_($1);
  4790. $ctx1.sendIdx["assert:"]=1;
  4791. $2=(0).__eq((0));
  4792. $ctx1.sendIdx["="]=2;
  4793. self._assert_($2);
  4794. $ctx1.sendIdx["assert:"]=2;
  4795. $3=(1).__eq((0));
  4796. $ctx1.sendIdx["="]=3;
  4797. self._deny_($3);
  4798. $ctx1.sendIdx["deny:"]=1;
  4799. $5=(1)._yourself();
  4800. $ctx1.sendIdx["yourself"]=1;
  4801. $4=_st($5).__eq((1));
  4802. $ctx1.sendIdx["="]=4;
  4803. self._assert_($4);
  4804. $ctx1.sendIdx["assert:"]=3;
  4805. $7=(1)._yourself();
  4806. $ctx1.sendIdx["yourself"]=2;
  4807. $6=(1).__eq($7);
  4808. $ctx1.sendIdx["="]=5;
  4809. self._assert_($6);
  4810. $ctx1.sendIdx["assert:"]=4;
  4811. $9=(1)._yourself();
  4812. $ctx1.sendIdx["yourself"]=3;
  4813. $8=_st($9).__eq((1)._yourself());
  4814. $ctx1.sendIdx["="]=6;
  4815. self._assert_($8);
  4816. $10=(0).__eq(false);
  4817. $ctx1.sendIdx["="]=7;
  4818. self._deny_($10);
  4819. $ctx1.sendIdx["deny:"]=2;
  4820. $11=false.__eq((0));
  4821. $ctx1.sendIdx["="]=8;
  4822. self._deny_($11);
  4823. $ctx1.sendIdx["deny:"]=3;
  4824. $12="".__eq((0));
  4825. $ctx1.sendIdx["="]=9;
  4826. self._deny_($12);
  4827. $ctx1.sendIdx["deny:"]=4;
  4828. self._deny_((0).__eq(""));
  4829. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  4830. args: [],
  4831. 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 = ''",
  4832. messageSends: ["assert:", "=", "deny:", "yourself"],
  4833. referencedClasses: []
  4834. }),
  4835. smalltalk.NumberTest);
  4836. smalltalk.addMethod(
  4837. smalltalk.method({
  4838. selector: "testFloor",
  4839. category: 'tests',
  4840. fn: function (){
  4841. var self=this;
  4842. return smalltalk.withContext(function($ctx1) {
  4843. var $1,$2;
  4844. $1=(1.2)._floor();
  4845. $ctx1.sendIdx["floor"]=1;
  4846. self._assert_equals_($1,(1));
  4847. $ctx1.sendIdx["assert:equals:"]=1;
  4848. $2=(-1.2)._floor();
  4849. $ctx1.sendIdx["floor"]=2;
  4850. self._assert_equals_($2,(-2));
  4851. $ctx1.sendIdx["assert:equals:"]=2;
  4852. self._assert_equals_((1)._floor(),(1));
  4853. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  4854. args: [],
  4855. 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.",
  4856. messageSends: ["assert:equals:", "floor"],
  4857. referencedClasses: []
  4858. }),
  4859. smalltalk.NumberTest);
  4860. smalltalk.addMethod(
  4861. smalltalk.method({
  4862. selector: "testHexNumbers",
  4863. category: 'tests',
  4864. fn: function (){
  4865. var self=this;
  4866. return smalltalk.withContext(function($ctx1) {
  4867. var $1,$2,$3,$4,$5;
  4868. self._assert_equals_((9),(9));
  4869. $ctx1.sendIdx["assert:equals:"]=1;
  4870. $1=(10)._truncated();
  4871. $ctx1.sendIdx["truncated"]=1;
  4872. self._assert_equals_($1,(10));
  4873. $ctx1.sendIdx["assert:equals:"]=2;
  4874. $2=(11)._truncated();
  4875. $ctx1.sendIdx["truncated"]=2;
  4876. self._assert_equals_($2,(11));
  4877. $ctx1.sendIdx["assert:equals:"]=3;
  4878. $3=(12)._truncated();
  4879. $ctx1.sendIdx["truncated"]=3;
  4880. self._assert_equals_($3,(12));
  4881. $ctx1.sendIdx["assert:equals:"]=4;
  4882. $4=(13)._truncated();
  4883. $ctx1.sendIdx["truncated"]=4;
  4884. self._assert_equals_($4,(13));
  4885. $ctx1.sendIdx["assert:equals:"]=5;
  4886. $5=(14)._truncated();
  4887. $ctx1.sendIdx["truncated"]=5;
  4888. self._assert_equals_($5,(14));
  4889. $ctx1.sendIdx["assert:equals:"]=6;
  4890. self._assert_equals_((15)._truncated(),(15));
  4891. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  4892. args: [],
  4893. 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",
  4894. messageSends: ["assert:equals:", "truncated"],
  4895. referencedClasses: []
  4896. }),
  4897. smalltalk.NumberTest);
  4898. smalltalk.addMethod(
  4899. smalltalk.method({
  4900. selector: "testIdentity",
  4901. category: 'tests',
  4902. fn: function (){
  4903. var self=this;
  4904. return smalltalk.withContext(function($ctx1) {
  4905. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  4906. $1=(1).__eq_eq((1));
  4907. $ctx1.sendIdx["=="]=1;
  4908. self._assert_($1);
  4909. $ctx1.sendIdx["assert:"]=1;
  4910. $2=(0).__eq_eq((0));
  4911. $ctx1.sendIdx["=="]=2;
  4912. self._assert_($2);
  4913. $ctx1.sendIdx["assert:"]=2;
  4914. $3=(1).__eq_eq((0));
  4915. $ctx1.sendIdx["=="]=3;
  4916. self._deny_($3);
  4917. $ctx1.sendIdx["deny:"]=1;
  4918. $5=(1)._yourself();
  4919. $ctx1.sendIdx["yourself"]=1;
  4920. $4=_st($5).__eq_eq((1));
  4921. $ctx1.sendIdx["=="]=4;
  4922. self._assert_($4);
  4923. $ctx1.sendIdx["assert:"]=3;
  4924. $7=(1)._yourself();
  4925. $ctx1.sendIdx["yourself"]=2;
  4926. $6=(1).__eq_eq($7);
  4927. $ctx1.sendIdx["=="]=5;
  4928. self._assert_($6);
  4929. $ctx1.sendIdx["assert:"]=4;
  4930. $9=(1)._yourself();
  4931. $ctx1.sendIdx["yourself"]=3;
  4932. $8=_st($9).__eq_eq((1)._yourself());
  4933. $ctx1.sendIdx["=="]=6;
  4934. self._assert_($8);
  4935. self._deny_((1).__eq_eq((2)));
  4936. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  4937. args: [],
  4938. 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",
  4939. messageSends: ["assert:", "==", "deny:", "yourself"],
  4940. referencedClasses: []
  4941. }),
  4942. smalltalk.NumberTest);
  4943. smalltalk.addMethod(
  4944. smalltalk.method({
  4945. selector: "testInvalidHexNumbers",
  4946. category: 'tests',
  4947. fn: function (){
  4948. var self=this;
  4949. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4950. return smalltalk.withContext(function($ctx1) {
  4951. self._should_raise_((function(){
  4952. return smalltalk.withContext(function($ctx2) {
  4953. return (16)._rG();
  4954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4955. $ctx1.sendIdx["should:raise:"]=1;
  4956. self._should_raise_((function(){
  4957. return smalltalk.withContext(function($ctx2) {
  4958. return (16)._rg();
  4959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  4960. $ctx1.sendIdx["should:raise:"]=2;
  4961. self._should_raise_((function(){
  4962. return smalltalk.withContext(function($ctx2) {
  4963. return (16)._rH();
  4964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  4965. $ctx1.sendIdx["should:raise:"]=3;
  4966. self._should_raise_((function(){
  4967. return smalltalk.withContext(function($ctx2) {
  4968. return (16)._rh();
  4969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  4970. $ctx1.sendIdx["should:raise:"]=4;
  4971. self._should_raise_((function(){
  4972. return smalltalk.withContext(function($ctx2) {
  4973. return (16)._rI();
  4974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  4975. $ctx1.sendIdx["should:raise:"]=5;
  4976. self._should_raise_((function(){
  4977. return smalltalk.withContext(function($ctx2) {
  4978. return (16)._ri();
  4979. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  4980. $ctx1.sendIdx["should:raise:"]=6;
  4981. self._should_raise_((function(){
  4982. return smalltalk.withContext(function($ctx2) {
  4983. return (16)._rJ();
  4984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  4985. $ctx1.sendIdx["should:raise:"]=7;
  4986. self._should_raise_((function(){
  4987. return smalltalk.withContext(function($ctx2) {
  4988. return (16)._rj();
  4989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  4990. $ctx1.sendIdx["should:raise:"]=8;
  4991. self._should_raise_((function(){
  4992. return smalltalk.withContext(function($ctx2) {
  4993. return (16)._rK();
  4994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  4995. $ctx1.sendIdx["should:raise:"]=9;
  4996. self._should_raise_((function(){
  4997. return smalltalk.withContext(function($ctx2) {
  4998. return (16)._rk();
  4999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  5000. $ctx1.sendIdx["should:raise:"]=10;
  5001. self._should_raise_((function(){
  5002. return smalltalk.withContext(function($ctx2) {
  5003. return (16)._rL();
  5004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  5005. $ctx1.sendIdx["should:raise:"]=11;
  5006. self._should_raise_((function(){
  5007. return smalltalk.withContext(function($ctx2) {
  5008. return (16)._rl();
  5009. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  5010. $ctx1.sendIdx["should:raise:"]=12;
  5011. self._should_raise_((function(){
  5012. return smalltalk.withContext(function($ctx2) {
  5013. return (16)._rM();
  5014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  5015. $ctx1.sendIdx["should:raise:"]=13;
  5016. self._should_raise_((function(){
  5017. return smalltalk.withContext(function($ctx2) {
  5018. return (16)._rm();
  5019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  5020. $ctx1.sendIdx["should:raise:"]=14;
  5021. self._should_raise_((function(){
  5022. return smalltalk.withContext(function($ctx2) {
  5023. return (16)._rN();
  5024. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  5025. $ctx1.sendIdx["should:raise:"]=15;
  5026. self._should_raise_((function(){
  5027. return smalltalk.withContext(function($ctx2) {
  5028. return (16)._rn();
  5029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  5030. $ctx1.sendIdx["should:raise:"]=16;
  5031. self._should_raise_((function(){
  5032. return smalltalk.withContext(function($ctx2) {
  5033. return (16)._rO();
  5034. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  5035. $ctx1.sendIdx["should:raise:"]=17;
  5036. self._should_raise_((function(){
  5037. return smalltalk.withContext(function($ctx2) {
  5038. return (16)._ro();
  5039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  5040. $ctx1.sendIdx["should:raise:"]=18;
  5041. self._should_raise_((function(){
  5042. return smalltalk.withContext(function($ctx2) {
  5043. return (16)._rP();
  5044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  5045. $ctx1.sendIdx["should:raise:"]=19;
  5046. self._should_raise_((function(){
  5047. return smalltalk.withContext(function($ctx2) {
  5048. return (16)._rp();
  5049. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  5050. $ctx1.sendIdx["should:raise:"]=20;
  5051. self._should_raise_((function(){
  5052. return smalltalk.withContext(function($ctx2) {
  5053. return (16)._rQ();
  5054. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  5055. $ctx1.sendIdx["should:raise:"]=21;
  5056. self._should_raise_((function(){
  5057. return smalltalk.withContext(function($ctx2) {
  5058. return (16)._rq();
  5059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  5060. $ctx1.sendIdx["should:raise:"]=22;
  5061. self._should_raise_((function(){
  5062. return smalltalk.withContext(function($ctx2) {
  5063. return (16)._rR();
  5064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  5065. $ctx1.sendIdx["should:raise:"]=23;
  5066. self._should_raise_((function(){
  5067. return smalltalk.withContext(function($ctx2) {
  5068. return (16)._rr();
  5069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  5070. $ctx1.sendIdx["should:raise:"]=24;
  5071. self._should_raise_((function(){
  5072. return smalltalk.withContext(function($ctx2) {
  5073. return (16)._rS();
  5074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  5075. $ctx1.sendIdx["should:raise:"]=25;
  5076. self._should_raise_((function(){
  5077. return smalltalk.withContext(function($ctx2) {
  5078. return (16)._rs();
  5079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  5080. $ctx1.sendIdx["should:raise:"]=26;
  5081. self._should_raise_((function(){
  5082. return smalltalk.withContext(function($ctx2) {
  5083. return (16)._rT();
  5084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  5085. $ctx1.sendIdx["should:raise:"]=27;
  5086. self._should_raise_((function(){
  5087. return smalltalk.withContext(function($ctx2) {
  5088. return (16)._rt();
  5089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  5090. $ctx1.sendIdx["should:raise:"]=28;
  5091. self._should_raise_((function(){
  5092. return smalltalk.withContext(function($ctx2) {
  5093. return (16)._rU();
  5094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  5095. $ctx1.sendIdx["should:raise:"]=29;
  5096. self._should_raise_((function(){
  5097. return smalltalk.withContext(function($ctx2) {
  5098. return (16)._ru();
  5099. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  5100. $ctx1.sendIdx["should:raise:"]=30;
  5101. self._should_raise_((function(){
  5102. return smalltalk.withContext(function($ctx2) {
  5103. return (16)._rV();
  5104. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  5105. $ctx1.sendIdx["should:raise:"]=31;
  5106. self._should_raise_((function(){
  5107. return smalltalk.withContext(function($ctx2) {
  5108. return (16)._rv();
  5109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  5110. $ctx1.sendIdx["should:raise:"]=32;
  5111. self._should_raise_((function(){
  5112. return smalltalk.withContext(function($ctx2) {
  5113. return (16)._rW();
  5114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  5115. $ctx1.sendIdx["should:raise:"]=33;
  5116. self._should_raise_((function(){
  5117. return smalltalk.withContext(function($ctx2) {
  5118. return (16)._rw();
  5119. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  5120. $ctx1.sendIdx["should:raise:"]=34;
  5121. self._should_raise_((function(){
  5122. return smalltalk.withContext(function($ctx2) {
  5123. return (16)._rX();
  5124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  5125. $ctx1.sendIdx["should:raise:"]=35;
  5126. self._should_raise_((function(){
  5127. return smalltalk.withContext(function($ctx2) {
  5128. return (16)._rx();
  5129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  5130. $ctx1.sendIdx["should:raise:"]=36;
  5131. self._should_raise_((function(){
  5132. return smalltalk.withContext(function($ctx2) {
  5133. return (16)._rY();
  5134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  5135. $ctx1.sendIdx["should:raise:"]=37;
  5136. self._should_raise_((function(){
  5137. return smalltalk.withContext(function($ctx2) {
  5138. return (16)._ry();
  5139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  5140. $ctx1.sendIdx["should:raise:"]=38;
  5141. self._should_raise_((function(){
  5142. return smalltalk.withContext(function($ctx2) {
  5143. return (16)._rZ();
  5144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  5145. $ctx1.sendIdx["should:raise:"]=39;
  5146. self._should_raise_((function(){
  5147. return smalltalk.withContext(function($ctx2) {
  5148. return (16)._rz();
  5149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  5150. $ctx1.sendIdx["should:raise:"]=40;
  5151. self._should_raise_((function(){
  5152. return smalltalk.withContext(function($ctx2) {
  5153. return (11259375)._Z();
  5154. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  5155. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  5156. args: [],
  5157. 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.",
  5158. 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"],
  5159. referencedClasses: ["MessageNotUnderstood"]
  5160. }),
  5161. smalltalk.NumberTest);
  5162. smalltalk.addMethod(
  5163. smalltalk.method({
  5164. selector: "testLog",
  5165. category: 'tests',
  5166. fn: function (){
  5167. var self=this;
  5168. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  5169. return smalltalk.withContext(function($ctx1) {
  5170. self._assert_equals_((10000)._log(),(4));
  5171. $ctx1.sendIdx["assert:equals:"]=1;
  5172. self._assert_equals_((512)._log_((2)),(9));
  5173. $ctx1.sendIdx["assert:equals:"]=2;
  5174. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  5175. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  5176. args: [],
  5177. 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.",
  5178. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  5179. referencedClasses: ["Number"]
  5180. }),
  5181. smalltalk.NumberTest);
  5182. smalltalk.addMethod(
  5183. smalltalk.method({
  5184. selector: "testMinMax",
  5185. category: 'tests',
  5186. fn: function (){
  5187. var self=this;
  5188. return smalltalk.withContext(function($ctx1) {
  5189. self._assert_equals_((2)._max_((5)),(5));
  5190. $ctx1.sendIdx["assert:equals:"]=1;
  5191. self._assert_equals_((2)._min_((5)),(2));
  5192. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  5193. args: [],
  5194. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  5195. messageSends: ["assert:equals:", "max:", "min:"],
  5196. referencedClasses: []
  5197. }),
  5198. smalltalk.NumberTest);
  5199. smalltalk.addMethod(
  5200. smalltalk.method({
  5201. selector: "testNegated",
  5202. category: 'tests',
  5203. fn: function (){
  5204. var self=this;
  5205. return smalltalk.withContext(function($ctx1) {
  5206. var $1;
  5207. $1=(3)._negated();
  5208. $ctx1.sendIdx["negated"]=1;
  5209. self._assert_equals_($1,(-3));
  5210. $ctx1.sendIdx["assert:equals:"]=1;
  5211. self._assert_equals_((-3)._negated(),(3));
  5212. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  5213. args: [],
  5214. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  5215. messageSends: ["assert:equals:", "negated"],
  5216. referencedClasses: []
  5217. }),
  5218. smalltalk.NumberTest);
  5219. smalltalk.addMethod(
  5220. smalltalk.method({
  5221. selector: "testPrintShowingDecimalPlaces",
  5222. category: 'tests',
  5223. fn: function (){
  5224. var self=this;
  5225. return smalltalk.withContext(function($ctx1) {
  5226. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  5227. $1=(23)._printShowingDecimalPlaces_((2));
  5228. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  5229. self._assert_equals_($1,"23.00");
  5230. $ctx1.sendIdx["assert:equals:"]=1;
  5231. $2=(23.5698)._printShowingDecimalPlaces_((2));
  5232. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  5233. self._assert_equals_($2,"23.57");
  5234. $ctx1.sendIdx["assert:equals:"]=2;
  5235. $4=(234.567)._negated();
  5236. $ctx1.sendIdx["negated"]=1;
  5237. $3=_st($4)._printShowingDecimalPlaces_((5));
  5238. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  5239. self._assert_equals_($3,"-234.56700");
  5240. $ctx1.sendIdx["assert:equals:"]=3;
  5241. $5=(23.4567)._printShowingDecimalPlaces_((0));
  5242. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  5243. self._assert_equals_($5,"23");
  5244. $ctx1.sendIdx["assert:equals:"]=4;
  5245. $6=(23.5567)._printShowingDecimalPlaces_((0));
  5246. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  5247. self._assert_equals_($6,"24");
  5248. $ctx1.sendIdx["assert:equals:"]=5;
  5249. $8=(23.4567)._negated();
  5250. $ctx1.sendIdx["negated"]=2;
  5251. $7=_st($8)._printShowingDecimalPlaces_((0));
  5252. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  5253. self._assert_equals_($7,"-23");
  5254. $ctx1.sendIdx["assert:equals:"]=6;
  5255. $10=(23.5567)._negated();
  5256. $ctx1.sendIdx["negated"]=3;
  5257. $9=_st($10)._printShowingDecimalPlaces_((0));
  5258. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  5259. self._assert_equals_($9,"-24");
  5260. $ctx1.sendIdx["assert:equals:"]=7;
  5261. $11=(100000000)._printShowingDecimalPlaces_((1));
  5262. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  5263. self._assert_equals_($11,"100000000.0");
  5264. $ctx1.sendIdx["assert:equals:"]=8;
  5265. $12=(0.98)._printShowingDecimalPlaces_((5));
  5266. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  5267. self._assert_equals_($12,"0.98000");
  5268. $ctx1.sendIdx["assert:equals:"]=9;
  5269. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  5270. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  5271. self._assert_equals_($13,"-0.98");
  5272. $ctx1.sendIdx["assert:equals:"]=10;
  5273. $14=(2.567)._printShowingDecimalPlaces_((2));
  5274. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  5275. self._assert_equals_($14,"2.57");
  5276. $ctx1.sendIdx["assert:equals:"]=11;
  5277. $15=(-2.567)._printShowingDecimalPlaces_((2));
  5278. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  5279. self._assert_equals_($15,"-2.57");
  5280. $ctx1.sendIdx["assert:equals:"]=12;
  5281. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  5282. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  5283. args: [],
  5284. 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'.",
  5285. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  5286. referencedClasses: []
  5287. }),
  5288. smalltalk.NumberTest);
  5289. smalltalk.addMethod(
  5290. smalltalk.method({
  5291. selector: "testRaisedTo",
  5292. category: 'tests',
  5293. fn: function (){
  5294. var self=this;
  5295. return smalltalk.withContext(function($ctx1) {
  5296. var $1,$2,$3;
  5297. $1=(2)._raisedTo_((4));
  5298. $ctx1.sendIdx["raisedTo:"]=1;
  5299. self._assert_equals_($1,(16));
  5300. $ctx1.sendIdx["assert:equals:"]=1;
  5301. $2=(2)._raisedTo_((0));
  5302. $ctx1.sendIdx["raisedTo:"]=2;
  5303. self._assert_equals_($2,(1));
  5304. $ctx1.sendIdx["assert:equals:"]=2;
  5305. $3=(2)._raisedTo_((-3));
  5306. $ctx1.sendIdx["raisedTo:"]=3;
  5307. self._assert_equals_($3,(0.125));
  5308. $ctx1.sendIdx["assert:equals:"]=3;
  5309. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  5310. $ctx1.sendIdx["assert:equals:"]=4;
  5311. self._assert_equals_((2).__star_star((4)),(16));
  5312. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  5313. args: [],
  5314. 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.",
  5315. messageSends: ["assert:equals:", "raisedTo:", "**"],
  5316. referencedClasses: []
  5317. }),
  5318. smalltalk.NumberTest);
  5319. smalltalk.addMethod(
  5320. smalltalk.method({
  5321. selector: "testRounded",
  5322. category: 'tests',
  5323. fn: function (){
  5324. var self=this;
  5325. return smalltalk.withContext(function($ctx1) {
  5326. var $1,$2;
  5327. $1=(3)._rounded();
  5328. $ctx1.sendIdx["rounded"]=1;
  5329. self._assert_equals_($1,(3));
  5330. $ctx1.sendIdx["assert:equals:"]=1;
  5331. $2=(3.212)._rounded();
  5332. $ctx1.sendIdx["rounded"]=2;
  5333. self._assert_equals_($2,(3));
  5334. $ctx1.sendIdx["assert:equals:"]=2;
  5335. self._assert_equals_((3.51)._rounded(),(4));
  5336. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  5337. args: [],
  5338. 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",
  5339. messageSends: ["assert:equals:", "rounded"],
  5340. referencedClasses: []
  5341. }),
  5342. smalltalk.NumberTest);
  5343. smalltalk.addMethod(
  5344. smalltalk.method({
  5345. selector: "testSign",
  5346. category: 'tests',
  5347. fn: function (){
  5348. var self=this;
  5349. return smalltalk.withContext(function($ctx1) {
  5350. var $1,$2;
  5351. $1=(5)._sign();
  5352. $ctx1.sendIdx["sign"]=1;
  5353. self._assert_equals_($1,(1));
  5354. $ctx1.sendIdx["assert:equals:"]=1;
  5355. $2=(0)._sign();
  5356. $ctx1.sendIdx["sign"]=2;
  5357. self._assert_equals_($2,(0));
  5358. $ctx1.sendIdx["assert:equals:"]=2;
  5359. self._assert_equals_((-1.4)._sign(),(-1));
  5360. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  5361. args: [],
  5362. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  5363. messageSends: ["assert:equals:", "sign"],
  5364. referencedClasses: []
  5365. }),
  5366. smalltalk.NumberTest);
  5367. smalltalk.addMethod(
  5368. smalltalk.method({
  5369. selector: "testSqrt",
  5370. category: 'tests',
  5371. fn: function (){
  5372. var self=this;
  5373. return smalltalk.withContext(function($ctx1) {
  5374. var $1;
  5375. $1=(4)._sqrt();
  5376. $ctx1.sendIdx["sqrt"]=1;
  5377. self._assert_equals_($1,(2));
  5378. $ctx1.sendIdx["assert:equals:"]=1;
  5379. self._assert_equals_((16)._sqrt(),(4));
  5380. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  5381. args: [],
  5382. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  5383. messageSends: ["assert:equals:", "sqrt"],
  5384. referencedClasses: []
  5385. }),
  5386. smalltalk.NumberTest);
  5387. smalltalk.addMethod(
  5388. smalltalk.method({
  5389. selector: "testSquared",
  5390. category: 'tests',
  5391. fn: function (){
  5392. var self=this;
  5393. return smalltalk.withContext(function($ctx1) {
  5394. self._assert_equals_((4)._squared(),(16));
  5395. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  5396. args: [],
  5397. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  5398. messageSends: ["assert:equals:", "squared"],
  5399. referencedClasses: []
  5400. }),
  5401. smalltalk.NumberTest);
  5402. smalltalk.addMethod(
  5403. smalltalk.method({
  5404. selector: "testTimesRepeat",
  5405. category: 'tests',
  5406. fn: function (){
  5407. var self=this;
  5408. var i;
  5409. return smalltalk.withContext(function($ctx1) {
  5410. i=(0);
  5411. (0)._timesRepeat_((function(){
  5412. return smalltalk.withContext(function($ctx2) {
  5413. i=_st(i).__plus((1));
  5414. $ctx2.sendIdx["+"]=1;
  5415. return i;
  5416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5417. $ctx1.sendIdx["timesRepeat:"]=1;
  5418. self._assert_equals_(i,(0));
  5419. $ctx1.sendIdx["assert:equals:"]=1;
  5420. (5)._timesRepeat_((function(){
  5421. return smalltalk.withContext(function($ctx2) {
  5422. i=_st(i).__plus((1));
  5423. return i;
  5424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5425. self._assert_equals_(i,(5));
  5426. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  5427. args: [],
  5428. 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",
  5429. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  5430. referencedClasses: []
  5431. }),
  5432. smalltalk.NumberTest);
  5433. smalltalk.addMethod(
  5434. smalltalk.method({
  5435. selector: "testTo",
  5436. category: 'tests',
  5437. fn: function (){
  5438. var self=this;
  5439. return smalltalk.withContext(function($ctx1) {
  5440. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  5441. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  5442. args: [],
  5443. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  5444. messageSends: ["assert:equals:", "to:"],
  5445. referencedClasses: []
  5446. }),
  5447. smalltalk.NumberTest);
  5448. smalltalk.addMethod(
  5449. smalltalk.method({
  5450. selector: "testToBy",
  5451. category: 'tests',
  5452. fn: function (){
  5453. var self=this;
  5454. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5455. return smalltalk.withContext(function($ctx1) {
  5456. var $1;
  5457. $1=(0)._to_by_((6),(2));
  5458. $ctx1.sendIdx["to:by:"]=1;
  5459. self._assert_equals_($1,[(0), (2), (4), (6)]);
  5460. self._should_raise_((function(){
  5461. return smalltalk.withContext(function($ctx2) {
  5462. return (1)._to_by_((4),(0));
  5463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5464. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  5465. args: [],
  5466. 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",
  5467. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  5468. referencedClasses: ["Error"]
  5469. }),
  5470. smalltalk.NumberTest);
  5471. smalltalk.addMethod(
  5472. smalltalk.method({
  5473. selector: "testTrigonometry",
  5474. category: 'tests',
  5475. fn: function (){
  5476. var self=this;
  5477. return smalltalk.withContext(function($ctx1) {
  5478. self._assert_equals_((0)._cos(),(1));
  5479. $ctx1.sendIdx["assert:equals:"]=1;
  5480. self._assert_equals_((0)._sin(),(0));
  5481. $ctx1.sendIdx["assert:equals:"]=2;
  5482. self._assert_equals_((0)._tan(),(0));
  5483. $ctx1.sendIdx["assert:equals:"]=3;
  5484. self._assert_equals_((1)._arcCos(),(0));
  5485. $ctx1.sendIdx["assert:equals:"]=4;
  5486. self._assert_equals_((0)._arcSin(),(0));
  5487. $ctx1.sendIdx["assert:equals:"]=5;
  5488. self._assert_equals_((0)._arcTan(),(0));
  5489. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  5490. args: [],
  5491. 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.",
  5492. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  5493. referencedClasses: []
  5494. }),
  5495. smalltalk.NumberTest);
  5496. smalltalk.addMethod(
  5497. smalltalk.method({
  5498. selector: "testTruncated",
  5499. category: 'tests',
  5500. fn: function (){
  5501. var self=this;
  5502. return smalltalk.withContext(function($ctx1) {
  5503. var $1,$2;
  5504. $1=(3)._truncated();
  5505. $ctx1.sendIdx["truncated"]=1;
  5506. self._assert_equals_($1,(3));
  5507. $ctx1.sendIdx["assert:equals:"]=1;
  5508. $2=(3.212)._truncated();
  5509. $ctx1.sendIdx["truncated"]=2;
  5510. self._assert_equals_($2,(3));
  5511. $ctx1.sendIdx["assert:equals:"]=2;
  5512. self._assert_equals_((3.51)._truncated(),(3));
  5513. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  5514. args: [],
  5515. 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",
  5516. messageSends: ["assert:equals:", "truncated"],
  5517. referencedClasses: []
  5518. }),
  5519. smalltalk.NumberTest);
  5520. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  5521. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  5522. smalltalk.addMethod(
  5523. smalltalk.method({
  5524. selector: "foo",
  5525. category: 'not yet classified',
  5526. fn: function (){
  5527. var self=this;
  5528. return smalltalk.withContext(function($ctx1) {
  5529. var $1;
  5530. $1=self["@foo"];
  5531. return $1;
  5532. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  5533. args: [],
  5534. source: "foo\x0a\x09^ foo",
  5535. messageSends: [],
  5536. referencedClasses: []
  5537. }),
  5538. smalltalk.ObjectMock);
  5539. smalltalk.addMethod(
  5540. smalltalk.method({
  5541. selector: "foo:",
  5542. category: 'not yet classified',
  5543. fn: function (anObject){
  5544. var self=this;
  5545. return smalltalk.withContext(function($ctx1) {
  5546. self["@foo"]=anObject;
  5547. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  5548. args: ["anObject"],
  5549. source: "foo: anObject\x0a\x09foo := anObject",
  5550. messageSends: [],
  5551. referencedClasses: []
  5552. }),
  5553. smalltalk.ObjectMock);
  5554. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5555. smalltalk.addMethod(
  5556. smalltalk.method({
  5557. selector: "notDefined",
  5558. category: 'tests',
  5559. fn: function (){
  5560. var self=this;
  5561. return smalltalk.withContext(function($ctx1) {
  5562. return void 0;;
  5563. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  5564. args: [],
  5565. source: "notDefined\x0a\x09<return void 0;>",
  5566. messageSends: [],
  5567. referencedClasses: []
  5568. }),
  5569. smalltalk.ObjectTest);
  5570. smalltalk.addMethod(
  5571. smalltalk.method({
  5572. selector: "testBasicAccess",
  5573. category: 'tests',
  5574. fn: function (){
  5575. var self=this;
  5576. var o;
  5577. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5578. return smalltalk.withContext(function($ctx1) {
  5579. var $1;
  5580. o=_st($Object())._new();
  5581. _st(o)._basicAt_put_("a",(1));
  5582. $1=_st(o)._basicAt_("a");
  5583. $ctx1.sendIdx["basicAt:"]=1;
  5584. self._assert_equals_($1,(1));
  5585. $ctx1.sendIdx["assert:equals:"]=1;
  5586. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  5587. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  5588. args: [],
  5589. 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",
  5590. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  5591. referencedClasses: ["Object"]
  5592. }),
  5593. smalltalk.ObjectTest);
  5594. smalltalk.addMethod(
  5595. smalltalk.method({
  5596. selector: "testBasicPerform",
  5597. category: 'tests',
  5598. fn: function (){
  5599. var self=this;
  5600. var o;
  5601. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5602. return smalltalk.withContext(function($ctx1) {
  5603. o=_st($Object())._new();
  5604. _st(o)._basicAt_put_("func",(function(){
  5605. return smalltalk.withContext(function($ctx2) {
  5606. return "hello";
  5607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5608. $ctx1.sendIdx["basicAt:put:"]=1;
  5609. _st(o)._basicAt_put_("func2",(function(a){
  5610. return smalltalk.withContext(function($ctx2) {
  5611. return _st(a).__plus((1));
  5612. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  5613. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  5614. $ctx1.sendIdx["assert:equals:"]=1;
  5615. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  5616. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  5617. args: [],
  5618. 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",
  5619. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  5620. referencedClasses: ["Object"]
  5621. }),
  5622. smalltalk.ObjectTest);
  5623. smalltalk.addMethod(
  5624. smalltalk.method({
  5625. selector: "testDNU",
  5626. category: 'tests',
  5627. fn: function (){
  5628. var self=this;
  5629. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5630. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5631. return smalltalk.withContext(function($ctx1) {
  5632. self._should_raise_((function(){
  5633. return smalltalk.withContext(function($ctx2) {
  5634. return _st(_st($Object())._new())._foo();
  5635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5636. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  5637. args: [],
  5638. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  5639. messageSends: ["should:raise:", "foo", "new"],
  5640. referencedClasses: ["Object", "MessageNotUnderstood"]
  5641. }),
  5642. smalltalk.ObjectTest);
  5643. smalltalk.addMethod(
  5644. smalltalk.method({
  5645. selector: "testEquality",
  5646. category: 'tests',
  5647. fn: function (){
  5648. var self=this;
  5649. var o;
  5650. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5651. return smalltalk.withContext(function($ctx1) {
  5652. var $1,$2,$4,$3;
  5653. o=_st($Object())._new();
  5654. $ctx1.sendIdx["new"]=1;
  5655. $1=_st(o).__eq(_st($Object())._new());
  5656. $ctx1.sendIdx["="]=1;
  5657. self._deny_($1);
  5658. $2=_st(o).__eq(o);
  5659. $ctx1.sendIdx["="]=2;
  5660. self._assert_($2);
  5661. $ctx1.sendIdx["assert:"]=1;
  5662. $4=_st(o)._yourself();
  5663. $ctx1.sendIdx["yourself"]=1;
  5664. $3=_st($4).__eq(o);
  5665. $ctx1.sendIdx["="]=3;
  5666. self._assert_($3);
  5667. $ctx1.sendIdx["assert:"]=2;
  5668. self._assert_(_st(o).__eq(_st(o)._yourself()));
  5669. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  5670. args: [],
  5671. 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)",
  5672. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  5673. referencedClasses: ["Object"]
  5674. }),
  5675. smalltalk.ObjectTest);
  5676. smalltalk.addMethod(
  5677. smalltalk.method({
  5678. selector: "testHalt",
  5679. category: 'tests',
  5680. fn: function (){
  5681. var self=this;
  5682. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5683. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5684. return smalltalk.withContext(function($ctx1) {
  5685. self._should_raise_((function(){
  5686. return smalltalk.withContext(function($ctx2) {
  5687. return _st(_st($Object())._new())._halt();
  5688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5689. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  5690. args: [],
  5691. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  5692. messageSends: ["should:raise:", "halt", "new"],
  5693. referencedClasses: ["Object", "Error"]
  5694. }),
  5695. smalltalk.ObjectTest);
  5696. smalltalk.addMethod(
  5697. smalltalk.method({
  5698. selector: "testIdentity",
  5699. category: 'tests',
  5700. fn: function (){
  5701. var self=this;
  5702. var o;
  5703. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5704. return smalltalk.withContext(function($ctx1) {
  5705. var $1,$2,$4,$3;
  5706. o=_st($Object())._new();
  5707. $ctx1.sendIdx["new"]=1;
  5708. $1=_st(o).__eq_eq(_st($Object())._new());
  5709. $ctx1.sendIdx["=="]=1;
  5710. self._deny_($1);
  5711. $2=_st(o).__eq_eq(o);
  5712. $ctx1.sendIdx["=="]=2;
  5713. self._assert_($2);
  5714. $ctx1.sendIdx["assert:"]=1;
  5715. $4=_st(o)._yourself();
  5716. $ctx1.sendIdx["yourself"]=1;
  5717. $3=_st($4).__eq_eq(o);
  5718. $ctx1.sendIdx["=="]=3;
  5719. self._assert_($3);
  5720. $ctx1.sendIdx["assert:"]=2;
  5721. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  5722. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  5723. args: [],
  5724. 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",
  5725. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  5726. referencedClasses: ["Object"]
  5727. }),
  5728. smalltalk.ObjectTest);
  5729. smalltalk.addMethod(
  5730. smalltalk.method({
  5731. selector: "testIfNil",
  5732. category: 'tests',
  5733. fn: function (){
  5734. var self=this;
  5735. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5736. return smalltalk.withContext(function($ctx1) {
  5737. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  5738. $2=_st($Object())._new();
  5739. $ctx1.sendIdx["new"]=1;
  5740. $1=_st($2)._isNil();
  5741. self._deny_($1);
  5742. $ctx1.sendIdx["deny:"]=1;
  5743. $5=_st($Object())._new();
  5744. $ctx1.sendIdx["new"]=2;
  5745. if(($receiver = $5) == nil || $receiver == null){
  5746. $4=true;
  5747. } else {
  5748. $4=$5;
  5749. };
  5750. $3=_st($4).__eq(true);
  5751. self._deny_($3);
  5752. $7=_st($Object())._new();
  5753. $ctx1.sendIdx["new"]=3;
  5754. if(($receiver = $7) == nil || $receiver == null){
  5755. $6=$7;
  5756. } else {
  5757. $6=true;
  5758. };
  5759. self._assert_equals_($6,true);
  5760. $ctx1.sendIdx["assert:equals:"]=1;
  5761. $9=_st($Object())._new();
  5762. $ctx1.sendIdx["new"]=4;
  5763. if(($receiver = $9) == nil || $receiver == null){
  5764. $8=false;
  5765. } else {
  5766. $8=true;
  5767. };
  5768. self._assert_equals_($8,true);
  5769. $ctx1.sendIdx["assert:equals:"]=2;
  5770. $11=_st($Object())._new();
  5771. if(($receiver = $11) == nil || $receiver == null){
  5772. $10=false;
  5773. } else {
  5774. $10=true;
  5775. };
  5776. self._assert_equals_($10,true);
  5777. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  5778. args: [],
  5779. 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",
  5780. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  5781. referencedClasses: ["Object"]
  5782. }),
  5783. smalltalk.ObjectTest);
  5784. smalltalk.addMethod(
  5785. smalltalk.method({
  5786. selector: "testInstVars",
  5787. category: 'tests',
  5788. fn: function (){
  5789. var self=this;
  5790. var o;
  5791. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5792. return smalltalk.withContext(function($ctx1) {
  5793. var $1,$2;
  5794. o=_st($ObjectMock())._new();
  5795. $1=_st(o)._instVarAt_("foo");
  5796. $ctx1.sendIdx["instVarAt:"]=1;
  5797. self._assert_equals_($1,nil);
  5798. $ctx1.sendIdx["assert:equals:"]=1;
  5799. _st(o)._instVarAt_put_("foo",(1));
  5800. $2=_st(o)._instVarAt_("foo");
  5801. $ctx1.sendIdx["instVarAt:"]=2;
  5802. self._assert_equals_($2,(1));
  5803. $ctx1.sendIdx["assert:equals:"]=2;
  5804. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  5805. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  5806. args: [],
  5807. 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",
  5808. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  5809. referencedClasses: ["ObjectMock"]
  5810. }),
  5811. smalltalk.ObjectTest);
  5812. smalltalk.addMethod(
  5813. smalltalk.method({
  5814. selector: "testNilUndefined",
  5815. category: 'tests',
  5816. fn: function (){
  5817. var self=this;
  5818. return smalltalk.withContext(function($ctx1) {
  5819. self._assert_equals_(self._notDefined(),nil);
  5820. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  5821. args: [],
  5822. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  5823. messageSends: ["assert:equals:", "notDefined"],
  5824. referencedClasses: []
  5825. }),
  5826. smalltalk.ObjectTest);
  5827. smalltalk.addMethod(
  5828. smalltalk.method({
  5829. selector: "testYourself",
  5830. category: 'tests',
  5831. fn: function (){
  5832. var self=this;
  5833. var o;
  5834. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  5835. return smalltalk.withContext(function($ctx1) {
  5836. o=_st($ObjectMock())._new();
  5837. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  5838. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  5839. args: [],
  5840. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  5841. messageSends: ["new", "assert:", "==", "yourself"],
  5842. referencedClasses: ["ObjectMock"]
  5843. }),
  5844. smalltalk.ObjectTest);
  5845. smalltalk.addMethod(
  5846. smalltalk.method({
  5847. selector: "testidentityHash",
  5848. category: 'tests',
  5849. fn: function (){
  5850. var self=this;
  5851. var o1,o2;
  5852. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5853. return smalltalk.withContext(function($ctx1) {
  5854. var $2,$3,$1,$5,$4;
  5855. o1=_st($Object())._new();
  5856. $ctx1.sendIdx["new"]=1;
  5857. o2=_st($Object())._new();
  5858. $2=_st(o1)._identityHash();
  5859. $ctx1.sendIdx["identityHash"]=1;
  5860. $3=_st(o1)._identityHash();
  5861. $ctx1.sendIdx["identityHash"]=2;
  5862. $1=_st($2).__eq_eq($3);
  5863. $ctx1.sendIdx["=="]=1;
  5864. self._assert_($1);
  5865. $5=_st(o1)._identityHash();
  5866. $ctx1.sendIdx["identityHash"]=3;
  5867. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  5868. self._deny_($4);
  5869. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  5870. args: [],
  5871. 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",
  5872. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  5873. referencedClasses: ["Object"]
  5874. }),
  5875. smalltalk.ObjectTest);
  5876. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5877. smalltalk.addMethod(
  5878. smalltalk.method({
  5879. selector: "testAccessing",
  5880. category: 'tests',
  5881. fn: function (){
  5882. var self=this;
  5883. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5884. return smalltalk.withContext(function($ctx1) {
  5885. var $2,$1,$3,$6,$5,$4;
  5886. $2=_st($Point())._x_y_((3),(4));
  5887. $ctx1.sendIdx["x:y:"]=1;
  5888. $1=_st($2)._x();
  5889. $ctx1.sendIdx["x"]=1;
  5890. self._assert_equals_($1,(3));
  5891. $ctx1.sendIdx["assert:equals:"]=1;
  5892. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  5893. $ctx1.sendIdx["y"]=1;
  5894. self._assert_equals_($3,(4));
  5895. $ctx1.sendIdx["assert:equals:"]=2;
  5896. $6=_st($Point())._new();
  5897. $ctx1.sendIdx["new"]=1;
  5898. $5=_st($6)._x_((3));
  5899. $4=_st($5)._x();
  5900. self._assert_equals_($4,(3));
  5901. $ctx1.sendIdx["assert:equals:"]=3;
  5902. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  5903. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  5904. args: [],
  5905. 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",
  5906. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  5907. referencedClasses: ["Point"]
  5908. }),
  5909. smalltalk.PointTest);
  5910. smalltalk.addMethod(
  5911. smalltalk.method({
  5912. selector: "testArithmetic",
  5913. category: 'tests',
  5914. fn: function (){
  5915. var self=this;
  5916. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5917. return smalltalk.withContext(function($ctx1) {
  5918. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  5919. $2=(3).__at((4));
  5920. $ctx1.sendIdx["@"]=1;
  5921. $3=(3).__at((4));
  5922. $ctx1.sendIdx["@"]=2;
  5923. $1=_st($2).__star($3);
  5924. $4=_st($Point())._x_y_((9),(16));
  5925. $ctx1.sendIdx["x:y:"]=1;
  5926. self._assert_equals_($1,$4);
  5927. $ctx1.sendIdx["assert:equals:"]=1;
  5928. $6=(3).__at((4));
  5929. $ctx1.sendIdx["@"]=3;
  5930. $7=(3).__at((4));
  5931. $ctx1.sendIdx["@"]=4;
  5932. $5=_st($6).__plus($7);
  5933. $8=_st($Point())._x_y_((6),(8));
  5934. $ctx1.sendIdx["x:y:"]=2;
  5935. self._assert_equals_($5,$8);
  5936. $ctx1.sendIdx["assert:equals:"]=2;
  5937. $10=(3).__at((4));
  5938. $ctx1.sendIdx["@"]=5;
  5939. $11=(3).__at((4));
  5940. $ctx1.sendIdx["@"]=6;
  5941. $9=_st($10).__minus($11);
  5942. $12=_st($Point())._x_y_((0),(0));
  5943. $ctx1.sendIdx["x:y:"]=3;
  5944. self._assert_equals_($9,$12);
  5945. $ctx1.sendIdx["assert:equals:"]=3;
  5946. $14=(6).__at((8));
  5947. $ctx1.sendIdx["@"]=7;
  5948. $13=_st($14).__slash((3).__at((4)));
  5949. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  5950. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  5951. args: [],
  5952. 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)",
  5953. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  5954. referencedClasses: ["Point"]
  5955. }),
  5956. smalltalk.PointTest);
  5957. smalltalk.addMethod(
  5958. smalltalk.method({
  5959. selector: "testAt",
  5960. category: 'tests',
  5961. fn: function (){
  5962. var self=this;
  5963. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5964. return smalltalk.withContext(function($ctx1) {
  5965. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  5966. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  5967. args: [],
  5968. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  5969. messageSends: ["assert:equals:", "@", "x:y:"],
  5970. referencedClasses: ["Point"]
  5971. }),
  5972. smalltalk.PointTest);
  5973. smalltalk.addMethod(
  5974. smalltalk.method({
  5975. selector: "testEgality",
  5976. category: 'tests',
  5977. fn: function (){
  5978. var self=this;
  5979. return smalltalk.withContext(function($ctx1) {
  5980. var $2,$3,$1,$5,$4;
  5981. $2=(3).__at((4));
  5982. $ctx1.sendIdx["@"]=1;
  5983. $3=(3).__at((4));
  5984. $ctx1.sendIdx["@"]=2;
  5985. $1=_st($2).__eq($3);
  5986. $ctx1.sendIdx["="]=1;
  5987. self._assert_($1);
  5988. $5=(3).__at((5));
  5989. $ctx1.sendIdx["@"]=3;
  5990. $4=_st($5).__eq((3).__at((6)));
  5991. self._deny_($4);
  5992. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  5993. args: [],
  5994. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  5995. messageSends: ["assert:", "=", "@", "deny:"],
  5996. referencedClasses: []
  5997. }),
  5998. smalltalk.PointTest);
  5999. smalltalk.addMethod(
  6000. smalltalk.method({
  6001. selector: "testNew",
  6002. category: 'tests',
  6003. fn: function (){
  6004. var self=this;
  6005. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6006. return smalltalk.withContext(function($ctx1) {
  6007. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  6008. $3=_st($Point())._new();
  6009. $ctx1.sendIdx["new"]=1;
  6010. $2=_st($3)._x_((3));
  6011. $ctx1.sendIdx["x:"]=1;
  6012. $1=_st($2)._y();
  6013. $ctx1.sendIdx["y"]=1;
  6014. self._assert_equals_($1,nil);
  6015. $ctx1.sendIdx["assert:equals:"]=1;
  6016. $7=_st($Point())._new();
  6017. $ctx1.sendIdx["new"]=2;
  6018. $6=_st($7)._x_((3));
  6019. $5=_st($6)._x();
  6020. $ctx1.sendIdx["x"]=1;
  6021. $4=_st($5).__eq((0));
  6022. $ctx1.sendIdx["="]=1;
  6023. self._deny_($4);
  6024. $ctx1.sendIdx["deny:"]=1;
  6025. $10=_st($Point())._new();
  6026. $ctx1.sendIdx["new"]=3;
  6027. $9=_st($10)._y_((4));
  6028. $ctx1.sendIdx["y:"]=1;
  6029. $8=_st($9)._x();
  6030. self._assert_equals_($8,nil);
  6031. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  6032. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  6033. args: [],
  6034. 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",
  6035. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  6036. referencedClasses: ["Point"]
  6037. }),
  6038. smalltalk.PointTest);
  6039. smalltalk.addMethod(
  6040. smalltalk.method({
  6041. selector: "testTranslateBy",
  6042. category: 'tests',
  6043. fn: function (){
  6044. var self=this;
  6045. return smalltalk.withContext(function($ctx1) {
  6046. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  6047. $2=(3).__at((3));
  6048. $ctx1.sendIdx["@"]=1;
  6049. $3=(0).__at((1));
  6050. $ctx1.sendIdx["@"]=2;
  6051. $1=_st($2)._translateBy_($3);
  6052. $ctx1.sendIdx["translateBy:"]=1;
  6053. $4=(3).__at((4));
  6054. $ctx1.sendIdx["@"]=3;
  6055. self._assert_equals_($1,$4);
  6056. $ctx1.sendIdx["assert:equals:"]=1;
  6057. $6=(3).__at((3));
  6058. $ctx1.sendIdx["@"]=4;
  6059. $8=(1)._negated();
  6060. $ctx1.sendIdx["negated"]=1;
  6061. $7=(0).__at($8);
  6062. $ctx1.sendIdx["@"]=5;
  6063. $5=_st($6)._translateBy_($7);
  6064. $ctx1.sendIdx["translateBy:"]=2;
  6065. $9=(3).__at((2));
  6066. $ctx1.sendIdx["@"]=6;
  6067. self._assert_equals_($5,$9);
  6068. $ctx1.sendIdx["assert:equals:"]=2;
  6069. $11=(3).__at((3));
  6070. $ctx1.sendIdx["@"]=7;
  6071. $12=(2).__at((3));
  6072. $ctx1.sendIdx["@"]=8;
  6073. $10=_st($11)._translateBy_($12);
  6074. $ctx1.sendIdx["translateBy:"]=3;
  6075. $13=(5).__at((6));
  6076. $ctx1.sendIdx["@"]=9;
  6077. self._assert_equals_($10,$13);
  6078. $ctx1.sendIdx["assert:equals:"]=3;
  6079. $15=(3).__at((3));
  6080. $ctx1.sendIdx["@"]=10;
  6081. $16=_st((3)._negated()).__at((0));
  6082. $ctx1.sendIdx["@"]=11;
  6083. $14=_st($15)._translateBy_($16);
  6084. self._assert_equals_($14,(0).__at((3)));
  6085. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  6086. args: [],
  6087. 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.",
  6088. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  6089. referencedClasses: []
  6090. }),
  6091. smalltalk.PointTest);
  6092. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6093. smalltalk.addMethod(
  6094. smalltalk.method({
  6095. selector: "testNextIfAbsent",
  6096. category: 'tests',
  6097. fn: function (){
  6098. var self=this;
  6099. var queue;
  6100. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6101. return smalltalk.withContext(function($ctx1) {
  6102. var $2,$1;
  6103. queue=_st($Queue())._new();
  6104. _st(queue)._nextPut_("index1");
  6105. $2=_st(queue)._nextIfAbsent_("empty");
  6106. $ctx1.sendIdx["nextIfAbsent:"]=1;
  6107. $1=_st($2).__eq("index1");
  6108. $ctx1.sendIdx["="]=1;
  6109. self._assert_($1);
  6110. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  6111. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  6112. args: [],
  6113. 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'",
  6114. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  6115. referencedClasses: ["Queue"]
  6116. }),
  6117. smalltalk.QueueTest);
  6118. smalltalk.addMethod(
  6119. smalltalk.method({
  6120. selector: "testQueueNext",
  6121. category: 'tests',
  6122. fn: function (){
  6123. var self=this;
  6124. var queue;
  6125. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6126. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6127. return smalltalk.withContext(function($ctx1) {
  6128. var $1,$2,$4,$3,$6,$5;
  6129. queue=_st($Queue())._new();
  6130. $1=queue;
  6131. _st($1)._nextPut_("index1");
  6132. $ctx1.sendIdx["nextPut:"]=1;
  6133. $2=_st($1)._nextPut_("index2");
  6134. $4=_st(queue)._next();
  6135. $ctx1.sendIdx["next"]=1;
  6136. $3=_st($4).__eq("index1");
  6137. $ctx1.sendIdx["="]=1;
  6138. self._assert_($3);
  6139. $6=_st(queue)._next();
  6140. $ctx1.sendIdx["next"]=2;
  6141. $5=_st($6).__eq("index");
  6142. self._deny_($5);
  6143. self._should_raise_((function(){
  6144. return smalltalk.withContext(function($ctx2) {
  6145. return _st(queue)._next();
  6146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6147. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  6148. args: [],
  6149. 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",
  6150. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  6151. referencedClasses: ["Queue", "Error"]
  6152. }),
  6153. smalltalk.QueueTest);
  6154. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6155. smalltalk.addMethod(
  6156. smalltalk.method({
  6157. selector: "testAtRandomNumber",
  6158. category: 'tests',
  6159. fn: function (){
  6160. var self=this;
  6161. var val;
  6162. return smalltalk.withContext(function($ctx1) {
  6163. (100)._timesRepeat_((function(){
  6164. return smalltalk.withContext(function($ctx2) {
  6165. val=(10)._atRandom();
  6166. val;
  6167. self._assert_(_st(val).__gt((0)));
  6168. $ctx2.sendIdx["assert:"]=1;
  6169. return self._assert_(_st(val).__lt((11)));
  6170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6171. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  6172. args: [],
  6173. 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]",
  6174. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  6175. referencedClasses: []
  6176. }),
  6177. smalltalk.RandomTest);
  6178. smalltalk.addMethod(
  6179. smalltalk.method({
  6180. selector: "testAtRandomSequenceableCollection",
  6181. category: 'tests',
  6182. fn: function (){
  6183. var self=this;
  6184. var val;
  6185. return smalltalk.withContext(function($ctx1) {
  6186. var $3,$4,$2,$1;
  6187. (100)._timesRepeat_((function(){
  6188. return smalltalk.withContext(function($ctx2) {
  6189. val="abc"._atRandom();
  6190. val;
  6191. $3=_st(val).__eq("a");
  6192. $ctx2.sendIdx["="]=1;
  6193. $4=_st(val).__eq("b");
  6194. $ctx2.sendIdx["="]=2;
  6195. $2=_st($3).__or($4);
  6196. $1=_st($2).__or(_st(val).__eq("c"));
  6197. $ctx2.sendIdx["|"]=1;
  6198. return self._assert_($1);
  6199. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6200. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  6201. args: [],
  6202. 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].",
  6203. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  6204. referencedClasses: []
  6205. }),
  6206. smalltalk.RandomTest);
  6207. smalltalk.addMethod(
  6208. smalltalk.method({
  6209. selector: "textNext",
  6210. category: 'tests',
  6211. fn: function (){
  6212. var self=this;
  6213. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  6214. return smalltalk.withContext(function($ctx1) {
  6215. var $1;
  6216. (10000)._timesRepeat_((function(){
  6217. var current,next;
  6218. return smalltalk.withContext(function($ctx2) {
  6219. next=_st(_st($Random())._new())._next();
  6220. next;
  6221. self._assert_(_st(next).__gt_eq((0)));
  6222. $ctx2.sendIdx["assert:"]=1;
  6223. self._assert_(_st(next).__lt((1)));
  6224. $1=_st(current).__eq(next);
  6225. $ctx2.sendIdx["="]=1;
  6226. self._deny_($1);
  6227. return _st(next).__eq(current);
  6228. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  6229. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  6230. args: [],
  6231. 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 ]",
  6232. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  6233. referencedClasses: ["Random"]
  6234. }),
  6235. smalltalk.RandomTest);
  6236. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6237. smalltalk.addMethod(
  6238. smalltalk.method({
  6239. selector: "testAddRemove",
  6240. category: 'tests',
  6241. fn: function (){
  6242. var self=this;
  6243. var set;
  6244. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6245. return smalltalk.withContext(function($ctx1) {
  6246. var $1,$2;
  6247. set=_st($Set())._new();
  6248. self._assert_(_st(set)._isEmpty());
  6249. $ctx1.sendIdx["assert:"]=1;
  6250. _st(set)._add_((3));
  6251. $ctx1.sendIdx["add:"]=1;
  6252. $1=_st(set)._includes_((3));
  6253. $ctx1.sendIdx["includes:"]=1;
  6254. self._assert_($1);
  6255. $ctx1.sendIdx["assert:"]=2;
  6256. _st(set)._add_((5));
  6257. $2=_st(set)._includes_((5));
  6258. $ctx1.sendIdx["includes:"]=2;
  6259. self._assert_($2);
  6260. _st(set)._remove_((3));
  6261. self._deny_(_st(set)._includes_((3)));
  6262. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  6263. args: [],
  6264. 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)",
  6265. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  6266. referencedClasses: ["Set"]
  6267. }),
  6268. smalltalk.SetTest);
  6269. smalltalk.addMethod(
  6270. smalltalk.method({
  6271. selector: "testAt",
  6272. category: 'tests',
  6273. fn: function (){
  6274. var self=this;
  6275. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6276. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6277. return smalltalk.withContext(function($ctx1) {
  6278. self._should_raise_((function(){
  6279. return smalltalk.withContext(function($ctx2) {
  6280. return _st(_st($Set())._new())._at_put_((1),(2));
  6281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6282. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  6283. args: [],
  6284. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  6285. messageSends: ["should:raise:", "at:put:", "new"],
  6286. referencedClasses: ["Set", "Error"]
  6287. }),
  6288. smalltalk.SetTest);
  6289. smalltalk.addMethod(
  6290. smalltalk.method({
  6291. selector: "testCollect",
  6292. category: 'tests',
  6293. fn: function (){
  6294. var self=this;
  6295. return smalltalk.withContext(function($ctx1) {
  6296. var $2,$1;
  6297. $2=[(5), (6), (8)]._asSet();
  6298. $ctx1.sendIdx["asSet"]=1;
  6299. $1=_st($2)._collect_((function(x){
  6300. return smalltalk.withContext(function($ctx2) {
  6301. return _st(x).__backslash_backslash((3));
  6302. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  6303. self._assert_equals_($1,[(0), (2)]._asSet());
  6304. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  6305. args: [],
  6306. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  6307. messageSends: ["assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  6308. referencedClasses: []
  6309. }),
  6310. smalltalk.SetTest);
  6311. smalltalk.addMethod(
  6312. smalltalk.method({
  6313. selector: "testComparing",
  6314. category: 'tests',
  6315. fn: function (){
  6316. var self=this;
  6317. return smalltalk.withContext(function($ctx1) {
  6318. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  6319. $1=[(0), (2)]._asSet();
  6320. $ctx1.sendIdx["asSet"]=1;
  6321. $2=[(0), (2)]._asSet();
  6322. $ctx1.sendIdx["asSet"]=2;
  6323. self._assert_equals_($1,$2);
  6324. $ctx1.sendIdx["assert:equals:"]=1;
  6325. $3=[(2), (0)]._asSet();
  6326. $ctx1.sendIdx["asSet"]=3;
  6327. $4=[(0), (2)]._asSet();
  6328. $ctx1.sendIdx["asSet"]=4;
  6329. self._assert_equals_($3,$4);
  6330. $6=[(0), (2), (3)]._asSet();
  6331. $ctx1.sendIdx["asSet"]=5;
  6332. $7=[(0), (2)]._asSet();
  6333. $ctx1.sendIdx["asSet"]=6;
  6334. $5=_st($6).__eq($7);
  6335. $ctx1.sendIdx["="]=1;
  6336. self._deny_($5);
  6337. $ctx1.sendIdx["deny:"]=1;
  6338. $9=[(1), (2)]._asSet();
  6339. $ctx1.sendIdx["asSet"]=7;
  6340. $8=_st($9).__eq([(0), (2)]._asSet());
  6341. self._deny_($8);
  6342. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  6343. args: [],
  6344. 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",
  6345. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  6346. referencedClasses: []
  6347. }),
  6348. smalltalk.SetTest);
  6349. smalltalk.addMethod(
  6350. smalltalk.method({
  6351. selector: "testPrintString",
  6352. category: 'tests',
  6353. fn: function (){
  6354. var self=this;
  6355. var set;
  6356. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6357. return smalltalk.withContext(function($ctx1) {
  6358. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  6359. set=_st($Set())._new();
  6360. $1=_st(set)._printString();
  6361. $ctx1.sendIdx["printString"]=1;
  6362. self._assert_equals_($1,"a Set ()");
  6363. $ctx1.sendIdx["assert:equals:"]=1;
  6364. $2=set;
  6365. _st($2)._add_((1));
  6366. $ctx1.sendIdx["add:"]=1;
  6367. $3=_st($2)._add_((3));
  6368. $ctx1.sendIdx["add:"]=2;
  6369. $4=_st(set)._printString();
  6370. $ctx1.sendIdx["printString"]=2;
  6371. self._assert_equals_($4,"a Set (1 3)");
  6372. $ctx1.sendIdx["assert:equals:"]=2;
  6373. _st(set)._add_("foo");
  6374. $ctx1.sendIdx["add:"]=3;
  6375. $5=_st(set)._printString();
  6376. $ctx1.sendIdx["printString"]=3;
  6377. self._assert_equals_($5,"a Set (1 3 'foo')");
  6378. $ctx1.sendIdx["assert:equals:"]=3;
  6379. $6=set;
  6380. _st($6)._remove_((1));
  6381. $ctx1.sendIdx["remove:"]=1;
  6382. $7=_st($6)._remove_((3));
  6383. $8=_st(set)._printString();
  6384. $ctx1.sendIdx["printString"]=4;
  6385. self._assert_equals_($8,"a Set ('foo')");
  6386. $ctx1.sendIdx["assert:equals:"]=4;
  6387. _st(set)._add_((3));
  6388. $ctx1.sendIdx["add:"]=4;
  6389. $9=_st(set)._printString();
  6390. $ctx1.sendIdx["printString"]=5;
  6391. self._assert_equals_($9,"a Set ('foo' 3)");
  6392. $ctx1.sendIdx["assert:equals:"]=5;
  6393. _st(set)._add_((3));
  6394. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  6395. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  6396. args: [],
  6397. 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)'",
  6398. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  6399. referencedClasses: ["Set"]
  6400. }),
  6401. smalltalk.SetTest);
  6402. smalltalk.addMethod(
  6403. smalltalk.method({
  6404. selector: "testSize",
  6405. category: 'tests',
  6406. fn: function (){
  6407. var self=this;
  6408. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6409. return smalltalk.withContext(function($ctx1) {
  6410. var $1,$3,$2;
  6411. $1=_st(_st($Set())._new())._size();
  6412. $ctx1.sendIdx["size"]=1;
  6413. self._assert_equals_($1,(0));
  6414. $ctx1.sendIdx["assert:equals:"]=1;
  6415. $3=_st($Set())._withAll_([(1), (2), (3), (4)]);
  6416. $ctx1.sendIdx["withAll:"]=1;
  6417. $2=_st($3)._size();
  6418. $ctx1.sendIdx["size"]=2;
  6419. self._assert_equals_($2,(4));
  6420. $ctx1.sendIdx["assert:equals:"]=2;
  6421. self._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  6422. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  6423. args: [],
  6424. 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",
  6425. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  6426. referencedClasses: ["Set"]
  6427. }),
  6428. smalltalk.SetTest);
  6429. smalltalk.addMethod(
  6430. smalltalk.method({
  6431. selector: "testUnboxedObjects",
  6432. category: 'tests',
  6433. fn: function (){
  6434. var self=this;
  6435. return smalltalk.withContext(function($ctx1) {
  6436. var $4,$3,$2,$1;
  6437. $4="foo"._yourself();
  6438. $ctx1.sendIdx["yourself"]=1;
  6439. $3=[$4,"foo"._yourself()];
  6440. $2=_st($3)._asSet();
  6441. $1=_st($2)._asArray();
  6442. self._assert_equals_($1,["foo"]);
  6443. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  6444. args: [],
  6445. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  6446. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  6447. referencedClasses: []
  6448. }),
  6449. smalltalk.SetTest);
  6450. smalltalk.addMethod(
  6451. smalltalk.method({
  6452. selector: "testUnicity",
  6453. category: 'tests',
  6454. fn: function (){
  6455. var self=this;
  6456. var set;
  6457. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  6458. return smalltalk.withContext(function($ctx1) {
  6459. var $1;
  6460. set=_st($Set())._new();
  6461. _st(set)._add_((21));
  6462. $ctx1.sendIdx["add:"]=1;
  6463. _st(set)._add_("hello");
  6464. $ctx1.sendIdx["add:"]=2;
  6465. _st(set)._add_((21));
  6466. $ctx1.sendIdx["add:"]=3;
  6467. $1=_st(set)._size();
  6468. $ctx1.sendIdx["size"]=1;
  6469. self._assert_equals_($1,(2));
  6470. $ctx1.sendIdx["assert:equals:"]=1;
  6471. _st(set)._add_("hello");
  6472. self._assert_equals_(_st(set)._size(),(2));
  6473. $ctx1.sendIdx["assert:equals:"]=2;
  6474. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  6475. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  6476. args: [],
  6477. 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')",
  6478. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  6479. referencedClasses: ["Set"]
  6480. }),
  6481. smalltalk.SetTest);
  6482. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6483. smalltalk.addMethod(
  6484. smalltalk.method({
  6485. selector: "collectionClass",
  6486. category: 'accessing',
  6487. fn: function (){
  6488. var self=this;
  6489. return smalltalk.withContext(function($ctx1) {
  6490. var $1;
  6491. $1=_st(self._class())._collectionClass();
  6492. return $1;
  6493. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  6494. args: [],
  6495. source: "collectionClass\x0a\x09^ self class collectionClass",
  6496. messageSends: ["collectionClass", "class"],
  6497. referencedClasses: []
  6498. }),
  6499. smalltalk.StreamTest);
  6500. smalltalk.addMethod(
  6501. smalltalk.method({
  6502. selector: "newCollection",
  6503. category: 'accessing',
  6504. fn: function (){
  6505. var self=this;
  6506. return smalltalk.withContext(function($ctx1) {
  6507. var $1;
  6508. $1=_st(self._collectionClass())._new();
  6509. return $1;
  6510. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  6511. args: [],
  6512. source: "newCollection\x0a\x09^ self collectionClass new",
  6513. messageSends: ["new", "collectionClass"],
  6514. referencedClasses: []
  6515. }),
  6516. smalltalk.StreamTest);
  6517. smalltalk.addMethod(
  6518. smalltalk.method({
  6519. selector: "newStream",
  6520. category: 'accessing',
  6521. fn: function (){
  6522. var self=this;
  6523. return smalltalk.withContext(function($ctx1) {
  6524. var $1;
  6525. $1=_st(_st(self._collectionClass())._new())._stream();
  6526. return $1;
  6527. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  6528. args: [],
  6529. source: "newStream\x0a\x09^ self collectionClass new stream",
  6530. messageSends: ["stream", "new", "collectionClass"],
  6531. referencedClasses: []
  6532. }),
  6533. smalltalk.StreamTest);
  6534. smalltalk.addMethod(
  6535. smalltalk.method({
  6536. selector: "testAtStartAtEnd",
  6537. category: 'tests',
  6538. fn: function (){
  6539. var self=this;
  6540. var stream;
  6541. return smalltalk.withContext(function($ctx1) {
  6542. var $1,$2,$3,$4;
  6543. stream=self._newStream();
  6544. $1=_st(stream)._atStart();
  6545. $ctx1.sendIdx["atStart"]=1;
  6546. self._assert_($1);
  6547. $ctx1.sendIdx["assert:"]=1;
  6548. $2=_st(stream)._atEnd();
  6549. $ctx1.sendIdx["atEnd"]=1;
  6550. self._assert_($2);
  6551. $ctx1.sendIdx["assert:"]=2;
  6552. _st(stream)._nextPutAll_(self._newCollection());
  6553. $3=_st(stream)._atEnd();
  6554. $ctx1.sendIdx["atEnd"]=2;
  6555. self._assert_($3);
  6556. $4=_st(stream)._atStart();
  6557. $ctx1.sendIdx["atStart"]=2;
  6558. self._deny_($4);
  6559. $ctx1.sendIdx["deny:"]=1;
  6560. _st(stream)._position_((1));
  6561. self._deny_(_st(stream)._atEnd());
  6562. $ctx1.sendIdx["deny:"]=2;
  6563. self._deny_(_st(stream)._atStart());
  6564. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  6565. args: [],
  6566. 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",
  6567. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  6568. referencedClasses: []
  6569. }),
  6570. smalltalk.StreamTest);
  6571. smalltalk.addMethod(
  6572. smalltalk.method({
  6573. selector: "testContents",
  6574. category: 'tests',
  6575. fn: function (){
  6576. var self=this;
  6577. var stream;
  6578. return smalltalk.withContext(function($ctx1) {
  6579. var $1,$2;
  6580. stream=self._newStream();
  6581. $1=stream;
  6582. $2=self._newCollection();
  6583. $ctx1.sendIdx["newCollection"]=1;
  6584. _st($1)._nextPutAll_($2);
  6585. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  6586. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  6587. args: [],
  6588. 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",
  6589. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  6590. referencedClasses: []
  6591. }),
  6592. smalltalk.StreamTest);
  6593. smalltalk.addMethod(
  6594. smalltalk.method({
  6595. selector: "testIsEmpty",
  6596. category: 'tests',
  6597. fn: function (){
  6598. var self=this;
  6599. var stream;
  6600. return smalltalk.withContext(function($ctx1) {
  6601. var $1;
  6602. stream=self._newStream();
  6603. $1=_st(stream)._isEmpty();
  6604. $ctx1.sendIdx["isEmpty"]=1;
  6605. self._assert_($1);
  6606. _st(stream)._nextPutAll_(self._newCollection());
  6607. self._deny_(_st(stream)._isEmpty());
  6608. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  6609. args: [],
  6610. 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",
  6611. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  6612. referencedClasses: []
  6613. }),
  6614. smalltalk.StreamTest);
  6615. smalltalk.addMethod(
  6616. smalltalk.method({
  6617. selector: "testPosition",
  6618. category: 'tests',
  6619. fn: function (){
  6620. var self=this;
  6621. var collection,stream;
  6622. return smalltalk.withContext(function($ctx1) {
  6623. var $1,$2,$3;
  6624. collection=self._newCollection();
  6625. stream=self._newStream();
  6626. _st(stream)._nextPutAll_(collection);
  6627. $1=_st(stream)._position();
  6628. $ctx1.sendIdx["position"]=1;
  6629. self._assert_equals_($1,_st(collection)._size());
  6630. $ctx1.sendIdx["assert:equals:"]=1;
  6631. _st(stream)._position_((0));
  6632. $2=_st(stream)._position();
  6633. $ctx1.sendIdx["position"]=2;
  6634. self._assert_equals_($2,(0));
  6635. $ctx1.sendIdx["assert:equals:"]=2;
  6636. _st(stream)._next();
  6637. $ctx1.sendIdx["next"]=1;
  6638. $3=_st(stream)._position();
  6639. $ctx1.sendIdx["position"]=3;
  6640. self._assert_equals_($3,(1));
  6641. $ctx1.sendIdx["assert:equals:"]=3;
  6642. _st(stream)._next();
  6643. self._assert_equals_(_st(stream)._position(),(2));
  6644. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  6645. args: [],
  6646. 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",
  6647. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  6648. referencedClasses: []
  6649. }),
  6650. smalltalk.StreamTest);
  6651. smalltalk.addMethod(
  6652. smalltalk.method({
  6653. selector: "testReading",
  6654. category: 'tests',
  6655. fn: function (){
  6656. var self=this;
  6657. var stream,collection;
  6658. return smalltalk.withContext(function($ctx1) {
  6659. var $1,$2,$3;
  6660. collection=self._newCollection();
  6661. stream=self._newStream();
  6662. $1=stream;
  6663. _st($1)._nextPutAll_(collection);
  6664. $2=_st($1)._position_((0));
  6665. _st(collection)._do_((function(each){
  6666. return smalltalk.withContext(function($ctx2) {
  6667. $3=_st(stream)._next();
  6668. $ctx2.sendIdx["next"]=1;
  6669. return self._assert_equals_($3,each);
  6670. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6671. self._assert_(_st(_st(stream)._next())._isNil());
  6672. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6673. args: [],
  6674. 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",
  6675. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  6676. referencedClasses: []
  6677. }),
  6678. smalltalk.StreamTest);
  6679. smalltalk.addMethod(
  6680. smalltalk.method({
  6681. selector: "testStreamContents",
  6682. category: 'tests',
  6683. fn: function (){
  6684. var self=this;
  6685. return smalltalk.withContext(function($ctx1) {
  6686. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  6687. args: [],
  6688. source: "testStreamContents",
  6689. messageSends: [],
  6690. referencedClasses: []
  6691. }),
  6692. smalltalk.StreamTest);
  6693. smalltalk.addMethod(
  6694. smalltalk.method({
  6695. selector: "testWrite",
  6696. category: 'tests',
  6697. fn: function (){
  6698. var self=this;
  6699. var stream,collection;
  6700. return smalltalk.withContext(function($ctx1) {
  6701. collection=self._newCollection();
  6702. stream=self._newStream();
  6703. _st(collection)._do_((function(each){
  6704. return smalltalk.withContext(function($ctx2) {
  6705. return _st(stream).__lt_lt(each);
  6706. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6707. self._assert_equals_(_st(stream)._contents(),collection);
  6708. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6709. args: [],
  6710. 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",
  6711. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  6712. referencedClasses: []
  6713. }),
  6714. smalltalk.StreamTest);
  6715. smalltalk.addMethod(
  6716. smalltalk.method({
  6717. selector: "testWriting",
  6718. category: 'tests',
  6719. fn: function (){
  6720. var self=this;
  6721. var stream,collection;
  6722. return smalltalk.withContext(function($ctx1) {
  6723. var $1;
  6724. collection=self._newCollection();
  6725. stream=self._newStream();
  6726. $ctx1.sendIdx["newStream"]=1;
  6727. _st(collection)._do_((function(each){
  6728. return smalltalk.withContext(function($ctx2) {
  6729. return _st(stream)._nextPut_(each);
  6730. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6731. $1=_st(stream)._contents();
  6732. $ctx1.sendIdx["contents"]=1;
  6733. self._assert_equals_($1,collection);
  6734. $ctx1.sendIdx["assert:equals:"]=1;
  6735. stream=self._newStream();
  6736. _st(stream)._nextPutAll_(collection);
  6737. self._assert_equals_(_st(stream)._contents(),collection);
  6738. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  6739. args: [],
  6740. 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",
  6741. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  6742. referencedClasses: []
  6743. }),
  6744. smalltalk.StreamTest);
  6745. smalltalk.addMethod(
  6746. smalltalk.method({
  6747. selector: "collectionClass",
  6748. category: 'accessing',
  6749. fn: function (){
  6750. var self=this;
  6751. return smalltalk.withContext(function($ctx1) {
  6752. return nil;
  6753. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  6754. args: [],
  6755. source: "collectionClass\x0a\x09^ nil",
  6756. messageSends: [],
  6757. referencedClasses: []
  6758. }),
  6759. smalltalk.StreamTest.klass);
  6760. smalltalk.addMethod(
  6761. smalltalk.method({
  6762. selector: "isAbstract",
  6763. category: 'testing',
  6764. fn: function (){
  6765. var self=this;
  6766. return smalltalk.withContext(function($ctx1) {
  6767. var $1;
  6768. $1=_st(self._collectionClass())._isNil();
  6769. return $1;
  6770. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  6771. args: [],
  6772. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  6773. messageSends: ["isNil", "collectionClass"],
  6774. referencedClasses: []
  6775. }),
  6776. smalltalk.StreamTest.klass);
  6777. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6778. smalltalk.addMethod(
  6779. smalltalk.method({
  6780. selector: "newCollection",
  6781. category: 'accessing',
  6782. fn: function (){
  6783. var self=this;
  6784. return smalltalk.withContext(function($ctx1) {
  6785. var $1;
  6786. $1=[true,(1),(3).__at((4)),"foo"];
  6787. return $1;
  6788. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  6789. args: [],
  6790. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  6791. messageSends: ["@"],
  6792. referencedClasses: []
  6793. }),
  6794. smalltalk.ArrayStreamTest);
  6795. smalltalk.addMethod(
  6796. smalltalk.method({
  6797. selector: "collectionClass",
  6798. category: 'accessing',
  6799. fn: function (){
  6800. var self=this;
  6801. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  6802. return smalltalk.withContext(function($ctx1) {
  6803. return $Array();
  6804. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  6805. args: [],
  6806. source: "collectionClass\x0a\x09^ Array",
  6807. messageSends: [],
  6808. referencedClasses: ["Array"]
  6809. }),
  6810. smalltalk.ArrayStreamTest.klass);
  6811. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  6812. smalltalk.addMethod(
  6813. smalltalk.method({
  6814. selector: "newCollection",
  6815. category: 'accessing',
  6816. fn: function (){
  6817. var self=this;
  6818. return smalltalk.withContext(function($ctx1) {
  6819. return "hello world";
  6820. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  6821. args: [],
  6822. source: "newCollection\x0a\x09^ 'hello world'",
  6823. messageSends: [],
  6824. referencedClasses: []
  6825. }),
  6826. smalltalk.StringStreamTest);
  6827. smalltalk.addMethod(
  6828. smalltalk.method({
  6829. selector: "collectionClass",
  6830. category: 'accessing',
  6831. fn: function (){
  6832. var self=this;
  6833. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  6834. return smalltalk.withContext(function($ctx1) {
  6835. return $String();
  6836. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  6837. args: [],
  6838. source: "collectionClass\x0a\x09^ String",
  6839. messageSends: [],
  6840. referencedClasses: ["String"]
  6841. }),
  6842. smalltalk.StringStreamTest.klass);
  6843. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6844. smalltalk.addMethod(
  6845. smalltalk.method({
  6846. selector: "testCopying",
  6847. category: 'tests',
  6848. fn: function (){
  6849. var self=this;
  6850. return smalltalk.withContext(function($ctx1) {
  6851. self._assert_equals_(nil._copy(),nil);
  6852. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  6853. args: [],
  6854. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  6855. messageSends: ["assert:equals:", "copy"],
  6856. referencedClasses: []
  6857. }),
  6858. smalltalk.UndefinedTest);
  6859. smalltalk.addMethod(
  6860. smalltalk.method({
  6861. selector: "testDeepCopy",
  6862. category: 'tests',
  6863. fn: function (){
  6864. var self=this;
  6865. return smalltalk.withContext(function($ctx1) {
  6866. self._assert_(_st(nil._deepCopy()).__eq(nil));
  6867. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  6868. args: [],
  6869. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  6870. messageSends: ["assert:", "=", "deepCopy"],
  6871. referencedClasses: []
  6872. }),
  6873. smalltalk.UndefinedTest);
  6874. smalltalk.addMethod(
  6875. smalltalk.method({
  6876. selector: "testIfNil",
  6877. category: 'tests',
  6878. fn: function (){
  6879. var self=this;
  6880. return smalltalk.withContext(function($ctx1) {
  6881. var $1,$3,$2,$4,$6,$5;
  6882. if(($receiver = nil) == nil || $receiver == null){
  6883. $1=true;
  6884. } else {
  6885. $1=nil;
  6886. };
  6887. self._assert_equals_($1,true);
  6888. $ctx1.sendIdx["assert:equals:"]=1;
  6889. if(($receiver = nil) == nil || $receiver == null){
  6890. $3=nil;
  6891. } else {
  6892. $3=true;
  6893. };
  6894. $2=_st($3).__eq(true);
  6895. $ctx1.sendIdx["="]=1;
  6896. self._deny_($2);
  6897. $ctx1.sendIdx["deny:"]=1;
  6898. if(($receiver = nil) == nil || $receiver == null){
  6899. $4=true;
  6900. } else {
  6901. $4=false;
  6902. };
  6903. self._assert_equals_($4,true);
  6904. if(($receiver = nil) == nil || $receiver == null){
  6905. $6=false;
  6906. } else {
  6907. $6=true;
  6908. };
  6909. $5=_st($6).__eq(true);
  6910. self._deny_($5);
  6911. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  6912. args: [],
  6913. 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",
  6914. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  6915. referencedClasses: []
  6916. }),
  6917. smalltalk.UndefinedTest);
  6918. smalltalk.addMethod(
  6919. smalltalk.method({
  6920. selector: "testIsNil",
  6921. category: 'tests',
  6922. fn: function (){
  6923. var self=this;
  6924. return smalltalk.withContext(function($ctx1) {
  6925. self._assert_(nil._isNil());
  6926. self._deny_(nil._notNil());
  6927. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  6928. args: [],
  6929. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  6930. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  6931. referencedClasses: []
  6932. }),
  6933. smalltalk.UndefinedTest);
  6934. });