@@ -570,6 +570,60 @@ func TestExamples(t *testing.T) {
570570 "complete" : intVal (1 ),
571571 }),
572572 },
573+ {
574+ name : "arrays/chunk_values" ,
575+ file : "arrays/extras.vibe" ,
576+ function : "chunk_values" ,
577+ args : []Value {
578+ arrayVal (intVal (1 ), intVal (2 ), intVal (3 ), intVal (4 ), intVal (5 )),
579+ intVal (2 ),
580+ },
581+ want : arrayVal (
582+ arrayVal (intVal (1 ), intVal (2 )),
583+ arrayVal (intVal (3 ), intVal (4 )),
584+ arrayVal (intVal (5 )),
585+ ),
586+ },
587+ {
588+ name : "arrays/window_values" ,
589+ file : "arrays/extras.vibe" ,
590+ function : "window_values" ,
591+ args : []Value {
592+ arrayVal (intVal (1 ), intVal (2 ), intVal (3 ), intVal (4 )),
593+ intVal (3 ),
594+ },
595+ want : arrayVal (
596+ arrayVal (intVal (1 ), intVal (2 ), intVal (3 )),
597+ arrayVal (intVal (2 ), intVal (3 ), intVal (4 )),
598+ ),
599+ },
600+ {
601+ name : "arrays/group_by_stable_status" ,
602+ file : "arrays/extras.vibe" ,
603+ function : "group_by_stable_status" ,
604+ args : []Value {
605+ arrayVal (
606+ hashVal (map [string ]Value {"id" : strVal ("p1" ), "status" : strVal ("active" )}),
607+ hashVal (map [string ]Value {"id" : strVal ("p2" ), "status" : strVal ("complete" )}),
608+ hashVal (map [string ]Value {"id" : strVal ("p3" ), "status" : strVal ("active" )}),
609+ ),
610+ },
611+ want : arrayVal (
612+ arrayVal (
613+ strVal ("active" ),
614+ arrayVal (
615+ hashVal (map [string ]Value {"id" : strVal ("p1" ), "status" : strVal ("active" )}),
616+ hashVal (map [string ]Value {"id" : strVal ("p3" ), "status" : strVal ("active" )}),
617+ ),
618+ ),
619+ arrayVal (
620+ strVal ("complete" ),
621+ arrayVal (
622+ hashVal (map [string ]Value {"id" : strVal ("p2" ), "status" : strVal ("complete" )}),
623+ ),
624+ ),
625+ ),
626+ },
573627 {
574628 name : "collections/make_player" ,
575629 file : "collections/hashes.vibe" ,
@@ -1321,6 +1375,52 @@ func TestExamples(t *testing.T) {
13211375 "d" : intVal (3 ),
13221376 }),
13231377 },
1378+ {
1379+ name : "hashes/remap_profile" ,
1380+ file : "hashes/transformations.vibe" ,
1381+ function : "remap_profile" ,
1382+ args : []Value {
1383+ hashVal (map [string ]Value {
1384+ "first_name" : strVal ("Alex" ),
1385+ "total_raised" : intVal (12 ),
1386+ "team" : strVal ("north" ),
1387+ }),
1388+ },
1389+ want : hashVal (map [string ]Value {
1390+ "name" : strVal ("Alex" ),
1391+ "raised" : intVal (12 ),
1392+ "team" : strVal ("north" ),
1393+ }),
1394+ },
1395+ {
1396+ name : "hashes/deep_transform_profile" ,
1397+ file : "hashes/transformations.vibe" ,
1398+ function : "deep_transform_profile" ,
1399+ args : []Value {
1400+ hashVal (map [string ]Value {
1401+ "player_id" : intVal (7 ),
1402+ "profile" : hashVal (map [string ]Value {
1403+ "total_raised" : intVal (10 ),
1404+ }),
1405+ "events" : arrayVal (
1406+ hashVal (map [string ]Value {
1407+ "amount_cents" : intVal (300 ),
1408+ }),
1409+ ),
1410+ }),
1411+ },
1412+ want : hashVal (map [string ]Value {
1413+ "playerId" : intVal (7 ),
1414+ "profile" : hashVal (map [string ]Value {
1415+ "totalRaised" : intVal (10 ),
1416+ }),
1417+ "events" : arrayVal (
1418+ hashVal (map [string ]Value {
1419+ "amountCents" : intVal (300 ),
1420+ }),
1421+ ),
1422+ }),
1423+ },
13241424 {
13251425 name : "blocks/total_raised_by_currency" ,
13261426 file : "blocks/enumerable_reports.vibe" ,
@@ -1860,6 +1960,10 @@ func TestExamples(t *testing.T) {
18601960 "scan" : arrayVal (strVal ("ID-12" ), strVal ("ID-34" )),
18611961 "strip_bang" : strVal ("hello" ),
18621962 "strip_bang_nochange" : nilVal (),
1963+ "squish" : strVal ("hello world" ),
1964+ "squish_bang" : strVal ("hello world" ),
1965+ "template" : strVal ("Player Alex scored 42" ),
1966+ "template_missing" : strVal ("Hello {{missing}}" ),
18631967 "immutable_after" : strVal (" hello " ),
18641968 "clear" : strVal ("" ),
18651969 "concat" : strVal ("hello!" ),
@@ -1888,6 +1992,25 @@ func TestExamples(t *testing.T) {
18881992 "length" : intVal (5 ),
18891993 }),
18901994 },
1995+ {
1996+ name : "stdlib/core_utilities_run" ,
1997+ file : "stdlib/core_utilities.vibe" ,
1998+ function : "run" ,
1999+ want : hashVal (map [string ]Value {
2000+ "json_id" : strVal ("p-1" ),
2001+ "json_score" : intVal (10 ),
2002+ "json_encoded" : strVal ("{\" id\" :\" p-1\" ,\" score\" :10}" ),
2003+ "regex_match" : strVal ("ID-12" ),
2004+ "regex_replace" : strVal ("X ID-34" ),
2005+ "regex_replace_all" : strVal ("X X" ),
2006+ "uuid_length" : intVal (36 ),
2007+ "uuid_has_dash" : boolVal (true ),
2008+ "random_length" : intVal (8 ),
2009+ "to_int" : intVal (42 ),
2010+ "to_float" : floatVal (1.25 ),
2011+ "parsed_time" : strVal ("2024-05-01T10:30:00Z" ),
2012+ }),
2013+ },
18912014 }
18922015
18932016 for _ , tc := range cases {
0 commit comments