use flow_abi_testing::catalog as common;
use common::*;
use flow_abi::{Digest, Json, Limits, canonical, encode, parse};
use flow_types::Type;
use flow_value::{Value, equal};
#[test]
fn an_int_is_an_exact_number_of_any_size_with_no_fraction_or_exponent() {
let catalog = catalog();
let huge = "123456789012345678901234567890123456789012345678901234567890";
assert_eq!(enc(&catalog, &Type::Int, &int(huge)), huge);
assert_eq!(
enc(&catalog, &Type::Int, &int(&format!("-{huge}"))),
format!("-{huge}")
);
assert_eq!(enc(&catalog, &Type::Int, &int("1000")), "1000");
assert_eq!(enc(&catalog, &Type::Int, &int("0")), "0");
}
#[test]
fn a_decimal_is_an_exact_normalized_number() {
let catalog = catalog();
assert_eq!(enc(&catalog, &Type::Decimal, &dec("1.50")), "1.5");
assert_eq!(enc(&catalog, &Type::Decimal, &dec("-0.001")), "-0.001");
assert_eq!(enc(&catalog, &Type::Decimal, &dec("1000.000")), "1000");
assert_eq!(enc(&catalog, &Type::Decimal, &dec("0.0")), "0");
assert_eq!(
enc(
&catalog,
&Type::Decimal,
&dec("12345678901234567890.123456789012345678901")
),
"12345678901234567890.123456789012345678901"
);
}
#[test]
fn a_bool_is_true_or_false() {
let catalog = catalog();
assert_eq!(enc(&catalog, &Type::Bool, &Value::Bool(true)), "true");
assert_eq!(enc(&catalog, &Type::Bool, &Value::Bool(false)), "false");
}
#[test]
fn text_is_a_string() {
let catalog = catalog();
assert_eq!(enc(&catalog, &Type::Text, &text("hello")), "\"hello\"");
assert_eq!(enc(&catalog, &Type::Text, &text("")), "\"\"");
}
#[test]
fn bytes_are_standard_base64_with_padding() {
let catalog = catalog();
assert_eq!(
enc(&catalog, &Type::Bytes, &bytes(&[0, 1, 2, 255])),
"\"AAEC/w==\""
);
assert_eq!(enc(&catalog, &Type::Bytes, &bytes(b"ab")), "\"YWI=\"");
assert_eq!(enc(&catalog, &Type::Bytes, &bytes(b"a")), "\"YQ==\"");
assert_eq!(enc(&catalog, &Type::Bytes, &bytes(b"")), "\"\"");
}
#[test]
fn a_duration_is_iso_8601_seconds() {
let catalog = catalog();
assert_eq!(enc(&catalog, &Type::Duration, &duration("90")), "\"PT90S\"");
assert_eq!(
enc(&catalog, &Type::Duration, &duration("0.25")),
"\"PT0.25S\""
);
assert_eq!(enc(&catalog, &Type::Duration, &duration("-5")), "\"PT-5S\"");
assert_eq!(enc(&catalog, &Type::Duration, &duration("0")), "\"PT0S\"");
}
#[test]
fn an_instant_is_iso_8601_in_utc_with_the_fewest_exact_fraction_digits() {
let catalog = catalog();
let at = |seconds: &str| enc(&catalog, &Type::Instant, &instant(seconds));
assert_eq!(at("0"), "\"1970-01-01T00:00:00Z\"");
assert_eq!(at("1774085400.25"), "\"2026-03-21T09:30:00.25Z\"");
assert_eq!(at("1774085400.000001"), "\"2026-03-21T09:30:00.000001Z\"");
}
#[test]
fn an_instant_outside_years_0000_to_9999_carries_a_sign_and_four_digits() {
let catalog = catalog();
let at = |seconds: &str| enc(&catalog, &Type::Instant, &instant(seconds));
assert_eq!(at("253402300800"), "\"+10000-01-01T00:00:00Z\"");
assert_eq!(at("-62167305600"), "\"-0001-12-31T00:00:00Z\"");
assert_eq!(at("-62162121600"), "\"0000-02-29T00:00:00Z\"");
}
#[test]
fn a_list_is_an_array_in_list_order() {
let catalog = catalog();
let items = Value::list([int("3"), int("1"), int("2")]);
assert_eq!(enc(&catalog, &Type::list(Type::Int), &items), "[3,1,2]");
assert_eq!(
enc(&catalog, &Type::list(Type::Int), &Value::list([])),
"[]"
);
}
#[test]
fn a_set_is_an_array_in_ascending_order_with_no_duplicates() {
let catalog = catalog();
let items = set(vec![text("b"), text("a"), text("b")]);
assert_eq!(
enc(&catalog, &Type::set(Type::Text), &items),
r#"["a","b"]"#
);
}
#[test]
fn a_dict_keyed_by_text_is_an_object() {
let catalog = catalog();
let entries = dict(vec![(text("b"), int("2")), (text("a"), int("1"))]);
assert_eq!(
enc(&catalog, &Type::dict(Type::Text, Type::Int), &entries),
r#"{"a":1,"b":2}"#
);
assert_eq!(
enc(&catalog, &Type::dict(Type::Text, Type::Int), &dict(vec![])),
"{}"
);
}
#[test]
fn a_dict_with_other_keys_is_key_value_pairs_in_ascending_key_order() {
let catalog = catalog();
let entries = dict(vec![(int("10"), text("ten")), (int("-1"), text("minus"))]);
assert_eq!(
enc(&catalog, &Type::dict(Type::Int, Type::Text), &entries),
r#"[[-1,"minus"],[10,"ten"]]"#
);
assert_eq!(
enc(&catalog, &Type::dict(Type::Int, Type::Text), &dict(vec![])),
"[]"
);
}
#[test]
fn a_tuple_is_an_array_of_its_elements_and_unit_is_the_empty_array() {
let catalog = catalog();
let ty = Type::Tuple(vec![Type::Int, Type::Text, Type::Unit]);
let value = Value::tuple([int("1"), text("a"), Value::Unit]);
assert_eq!(enc(&catalog, &ty, &value), r#"[1,"a",[]]"#);
assert_eq!(enc(&catalog, &Type::Unit, &Value::Unit), "[]");
}
#[test]
fn a_record_is_an_object_keyed_by_field_name() {
let catalog = catalog();
let step = rec(&catalog, STEP, vec![text("ada"), Value::Bool(true)]);
assert_eq!(
enc(&catalog, &named(STEP), &step),
r#"{"done":true,"owner":"ada"}"#
);
}
#[test]
fn an_option_field_holding_none_is_left_out_and_some_holds_its_payload() {
let catalog = catalog();
let plan = |owner| rec(&catalog, PLAN, vec![Value::list([]), owner, text("t")]);
assert_eq!(
enc(&catalog, &named(PLAN), &plan(none())),
r#"{"steps":[],"title":"t"}"#
);
assert_eq!(
enc(&catalog, &named(PLAN), &plan(some(text("ada")))),
r#"{"owner":"ada","steps":[],"title":"t"}"#
);
}
#[test]
fn an_option_field_of_an_option_writes_the_inner_option_as_an_enum() {
let catalog = catalog();
let ty = Type::Named(BOXED, vec![Type::option(Type::option(Type::Int))]);
let boxed = |value| rec(&catalog, BOXED, vec![value]);
assert_eq!(enc(&catalog, &ty, &boxed(none())), "{}");
assert_eq!(
enc(&catalog, &ty, &boxed(some(none()))),
r#"{"value":"None"}"#
);
assert_eq!(
enc(&catalog, &ty, &boxed(some(some(int("1"))))),
r#"{"value":{"Some":1}}"#
);
}
#[test]
fn an_option_anywhere_else_is_an_ordinary_enum() {
let catalog = catalog();
let ty = Type::list(Type::option(Type::Int));
let items = Value::list([none(), some(int("1"))]);
assert_eq!(enc(&catalog, &ty, &items), r#"["None",{"Some":1}]"#);
}
#[test]
fn a_constructor_with_no_payload_is_its_name() {
let catalog = catalog();
assert_eq!(
enc(&catalog, &named(STATUS), &ctor(&catalog, STATUS, 0, vec![])),
r#""NotRun""#
);
}
#[test]
fn a_constructor_with_one_positional_value_keys_that_value() {
let catalog = catalog();
let failed = ctor(&catalog, STATUS, 1, vec![text("boom")]);
assert_eq!(
enc(&catalog, &named(STATUS), &failed),
r#"{"Failed":"boom"}"#
);
}
#[test]
fn a_constructor_with_several_positional_values_keys_an_array_of_them() {
let catalog = catalog();
let pair = ctor(&catalog, STATUS, 2, vec![int("1"), text("a")]);
assert_eq!(enc(&catalog, &named(STATUS), &pair), r#"{"Pair":[1,"a"]}"#);
}
#[test]
fn a_constructor_with_a_named_payload_keys_an_object_of_its_fields() {
let catalog = catalog();
let arrived = |reply| ctor(&catalog, STATUS, 3, vec![int("3"), reply]);
assert_eq!(
enc(&catalog, &named(STATUS), &arrived(some(text("ok")))),
r#"{"Arrived":{"index":3,"reply":"ok"}}"#
);
assert_eq!(
enc(&catalog, &named(STATUS), &arrived(none())),
r#"{"Arrived":{"index":3}}"#
);
}
#[test]
fn a_generic_declaration_encodes_at_its_arguments() {
let catalog = catalog();
let leaf = |value| ctor(&catalog, TREE, 0, vec![value]);
let node = ctor(
&catalog,
TREE,
1,
vec![Value::list([leaf(int("1")), leaf(int("2"))])],
);
assert_eq!(
enc(&catalog, &tree(Type::Int), &node),
r#"{"Node":[{"Leaf":1},{"Leaf":2}]}"#
);
let ok = ctor(&catalog, RESULT, 0, vec![Value::Unit]);
assert_eq!(
enc(&catalog, &result(Type::Unit, Type::Text), &ok),
r#"{"Ok":[]}"#
);
}
#[test]
fn a_json_value_encodes_as_the_json_value_it_stands_for() {
let catalog = catalog();
let value = raw(
5,
vec![dict(vec![
(text("n"), raw(0, vec![])),
(text("b"), raw(1, vec![Value::Bool(false)])),
(text("x"), raw(2, vec![dec("2.50")])),
(text("s"), raw(3, vec![text("hi")])),
(
text("l"),
raw(
4,
vec![Value::list([raw(0, vec![]), raw(2, vec![dec("1")])])],
),
),
])],
);
assert_eq!(
enc(&catalog, &Type::Json, &value),
r#"{"b":false,"l":[null,1],"n":null,"s":"hi","x":2.5}"#
);
}
#[test]
fn a_host_value_is_the_hosts_token() {
let catalog = catalog();
assert_eq!(enc(&catalog, &named(PAGE), &host("page-7")), r#""page-7""#);
}
#[test]
fn a_value_that_does_not_have_its_type_is_refused_with_where() {
let catalog = catalog();
let refused = |ty: &Type, value: &Value| {
let error = canonical(&catalog, ty, value).expect_err("a mismatch");
(error.path.to_string(), error.problem)
};
assert_eq!(
refused(&Type::Int, &text("1")),
(String::new(), "is not a value of Int".into())
);
let steps = Value::list([rec(&catalog, STEP, vec![text("a"), int("1")])]);
assert_eq!(
refused(&Type::list(named(STEP)), &steps),
("[0].done".into(), "is not a value of Bool".into())
);
assert_eq!(
refused(
&Type::Tuple(vec![Type::Int, Type::Int]),
&Value::tuple([int("1"), int("2"), int("3")])
)
.1,
"is not a value of (Int, Int)"
);
assert_eq!(
refused(
&Type::option(Type::Int),
&ctor(&catalog, STATUS, 1, vec![text("x")])
)
.1,
"is not a value of Option<Int>"
);
assert_eq!(
refused(&named(PLAN), &ctor(&catalog, STATUS, 0, vec![])).1,
"is not a value of github.com/acme/plans@v1.2.0/plans.Plan"
);
assert_eq!(
refused(
&Type::dict(Type::Text, Type::Int),
&dict(vec![(int("1"), int("2"))])
)
.1,
"is not a value of Dict<Text, Int>"
);
assert_eq!(
refused(&Type::Json, &text("x")).1,
"is not a value of json.Value"
);
assert_eq!(
refused(&Type::Json, &raw(1, vec![int("1")])).1,
"is not a value of json.Value"
);
assert_eq!(
refused(&named(PAGE), &text("x")).1,
"is not a value of github.com/acme/plans@v1.2.0/browser.Page"
);
}
#[test]
fn an_enum_value_of_another_declaration_is_not_a_json_value_or_an_option() {
let catalog = catalog();
let not_run = ctor(&catalog, STATUS, 0, vec![]);
assert!(canonical(&catalog, &Type::Json, ¬_run).is_err());
assert!(canonical(&catalog, &Type::option(Type::Int), ¬_run).is_err());
let plan = rec(&catalog, PLAN, vec![Value::list([]), not_run, text("t")]);
let error = canonical(&catalog, &named(PLAN), &plan).expect_err("a mismatch");
assert_eq!(
(error.path.to_string().as_str(), error.problem.as_str()),
("owner", "is not a value of Option<Text>")
);
}
#[test]
fn an_option_field_holding_something_else_is_refused() {
let catalog = catalog();
let plan = rec(
&catalog,
PLAN,
vec![Value::list([]), text("ada"), text("t")],
);
let error = canonical(&catalog, &named(PLAN), &plan).expect_err("a mismatch");
assert_eq!(
(error.path.to_string().as_str(), error.problem.as_str()),
("owner", "is not a value of Option<Text>")
);
}
#[test]
fn an_enum_value_of_another_shape_is_refused() {
let catalog = catalog();
let arrived = ctor(&catalog, STATUS, 3, vec![int("3"), none()]);
let error = canonical(&catalog, &tree(Type::Int), &arrived).expect_err("a mismatch");
assert_eq!(
error.problem,
"is not a value of github.com/acme/plans@v1.2.0/trees.Tree<Int>"
);
let failed = ctor(&catalog, STATUS, 1, vec![text("x")]);
let error = canonical(&catalog, &tree(Type::Int), &failed).expect_err("a mismatch");
assert_eq!(
error.problem,
"is not a value of github.com/acme/plans@v1.2.0/trees.Tree<Int>"
);
}
#[test]
fn a_payload_that_does_not_have_its_type_is_refused_with_its_constructor() {
let catalog = catalog();
let refused = |value: &Value| {
let error = canonical(&catalog, &named(STATUS), value).expect_err("a mismatch");
(error.path.to_string(), error.problem)
};
assert_eq!(
refused(&ctor(&catalog, STATUS, 1, vec![int("1")])),
("Failed".into(), "is not a value of Text".into())
);
assert_eq!(
refused(&ctor(&catalog, STATUS, 2, vec![int("1"), int("2")])),
("Pair[1]".into(), "is not a value of Text".into())
);
assert_eq!(
refused(&ctor(&catalog, STATUS, 3, vec![int("1"), some(int("2"))])),
("Arrived.reply".into(), "is not a value of Text".into())
);
let error =
canonical(&catalog, &Type::option(Type::Text), &some(int("1"))).expect_err("a mismatch");
assert_eq!(
(error.path.to_string().as_str(), error.problem.as_str()),
("Some", "is not a value of Text")
);
}
#[test]
fn a_record_of_another_declaration_with_as_many_fields_is_refused() {
let catalog = catalog();
let local = rec(&catalog, LOCAL_A, vec![int("1")]);
let error = canonical(&catalog, &named(LOCAL_B), &local).expect_err("a mismatch");
assert_eq!(error.problem, "is not a value of main.Local#2");
}
#[test]
fn a_type_with_no_encoding_is_refused() {
let catalog = catalog();
let error = canonical(
&catalog,
&named(CALLBACK),
&rec(&catalog, CALLBACK, vec![Value::Unit]),
)
.expect_err("no encoding");
assert_eq!(
(error.path.to_string().as_str(), error.problem.as_str()),
("run", "has a type with no encoding")
);
let error = canonical(&catalog, &Type::Param(0), &int("1")).expect_err("no encoding");
assert_eq!(error.problem, "has a type with no encoding");
assert_eq!(error.to_string(), "the value has a type with no encoding");
let error = canonical(&catalog, &Type::Never, &Value::Unit).expect_err("no values");
assert_eq!(error.to_string(), "the value is not a value of Never");
}
#[test]
fn an_encoding_error_names_its_place() {
let catalog = catalog();
let error = canonical(&catalog, &Type::list(Type::Int), &Value::list([text("x")]))
.expect_err("a mismatch");
assert_eq!(error.to_string(), "`[0]` is not a value of Int");
}
#[test]
fn the_canonical_form_has_no_whitespace_and_sorts_keys_by_code_point() {
let text = r#" { "é" : 1 , "b" : [ 1 , 2 ] , "Z" : null , "a" : { "y" : true , "x" : false } , "aa" : "" } "#;
assert_eq!(
json(text).canonical(),
r#"{"Z":null,"a":{"x":false,"y":true},"aa":"","b":[1,2],"é":1}"#
);
}
#[test]
fn keys_sort_by_code_point_not_by_utf16_unit() {
let text = r#"{"😀":1,"。":2}"#;
assert_eq!(json(text).canonical(), r#"{"。":2,"😀":1}"#);
}
#[test]
fn strings_escape_only_quote_backslash_and_control_characters() {
let catalog = catalog();
let all = "\"\\/\u{8}\u{c}\n\r\t\u{0}\u{1}\u{1f}\u{7f}é😀\u{2028}";
assert_eq!(
enc(&catalog, &Type::Text, &text(all)),
"\"\\\"\\\\/\\b\\f\\n\\r\\t\\u0000\\u0001\\u001f\u{7f}é😀\u{2028}\""
);
}
#[test]
fn numbers_are_written_in_plain_decimal_notation() {
let cases = [
("1e3", "1000"),
("1E-3", "0.001"),
("-0", "0"),
("-0.0e5", "0"),
("0.10", "0.1"),
("12.3400e1", "123.4"),
("5e+0", "5"),
("100e-2", "1"),
("-1.5e-1", "-0.15"),
];
for (written, canonical) in cases {
assert_eq!(json(written).canonical(), canonical, "{written}");
}
}
#[test]
fn equal_values_share_one_canonical_text_and_different_values_differ() {
let catalog = catalog();
let mut draw = Draw::new(11);
for ty in kinds() {
for _ in 0..60 {
let a = value(&catalog, &ty, &mut draw, 3);
let b = value(&catalog, &ty, &mut draw, 3);
let texts_equal = enc(&catalog, &ty, &a) == enc(&catalog, &ty, &b);
if let Ok(values_equal) = equal(&a, &b) {
assert_eq!(texts_equal, values_equal, "{ty:?}: {a:?} {b:?}");
}
assert_eq!(enc(&catalog, &ty, &a), enc(&catalog, &ty, &a.clone()));
}
}
}
#[test]
fn the_canonical_text_survives_any_reformatting_of_the_same_json() {
let catalog = catalog();
let mut draw = Draw::new(12);
for ty in kinds() {
for _ in 0..40 {
let original = value(&catalog, &ty, &mut draw, 3);
let canonical = enc(&catalog, &ty, &original);
let loose = loosen(&to_json(&catalog, &ty, &original));
assert_eq!(reread(&catalog, &ty, &loose), canonical, "{loose}");
}
}
}
fn loosen(json: &Json) -> String {
match json {
Json::Array(items) => format!(
"[ {} ]",
items.iter().map(loosen).collect::<Vec<_>>().join(" ,\n ")
),
Json::Object(members) => format!(
"{{\t{} }}",
members
.iter()
.rev()
.map(|(key, value)| format!(
"{} :\r\n{}",
Json::String(key.clone()).canonical(),
loosen(value)
))
.collect::<Vec<_>>()
.join(" , ")
),
Json::Number(number) => format!("{number}E+0"),
other => other.canonical(),
}
}
#[test]
fn loosening_a_number_keeps_its_value() {
for written in ["0", "12", "-3.5", "0.25", "100"] {
let number = json(written);
assert_eq!(json(&loosen(&number)), number, "{}", loosen(&number));
}
}
#[test]
fn encoding_within_a_bound_stops_soon_after_the_text_passes_it() {
let catalog = catalog();
let long = text(&"a".repeat(1 << 20));
let many = Value::list(std::iter::repeat_n(long, 100_000));
let ty = Type::list(Type::Text);
assert_eq!(
flow_abi::canonical_within(&catalog, &ty, &many, 4 << 20),
Ok(None)
);
let vast = Value::Decimal(flow_value::Decimal::new(1.into(), i64::MAX).unwrap());
assert_eq!(
flow_abi::canonical_within(&catalog, &Type::Decimal, &vast, 4 << 20),
Ok(None)
);
let vast_ones = Value::list([vast.clone(), vast.clone(), vast]);
let json = encode(&catalog, &Type::list(Type::Decimal), &vast_ones).expect("encodes");
assert!(matches!(&json, Json::Array(items) if items.len() == 3));
let error =
flow_abi::canonical_within(&catalog, &Type::Int, &text("x"), 100).expect_err("a mismatch");
assert_eq!(error.problem, "is not a value of Int");
}
#[test]
fn every_kind_of_value_decodes_from_its_encoding_to_the_same_value() {
let catalog = catalog();
let mut draw = Draw::new(13);
for ty in kinds() {
for _ in 0..80 {
let original = value(&catalog, &ty, &mut draw, 4);
let text = enc(&catalog, &ty, &original);
let back = dec_reply(&catalog, &ty, &text)
.unwrap_or_else(|refused| panic!("{text}: {refused:?}"));
assert!(same(&catalog, &ty, &original, &back), "{ty:?}: {text}");
let input = dec_input(&catalog, &ty, &text);
if ty == named(PAGE) || ty == Type::list(named(PAGE)) {
assert!(input.is_err(), "a host value is not input");
} else {
assert!(same(
&catalog,
&ty,
&original,
&input.expect("input decodes")
));
}
}
}
}
#[test]
fn an_encoding_decodes_from_its_tree_as_from_its_text() {
let catalog = catalog();
let mut draw = Draw::new(14);
for ty in kinds() {
let original = value(&catalog, &ty, &mut draw, 3);
let tree = encode(&catalog, &ty, &original).expect("encodes");
let back = dec_json(&catalog, &ty, &tree).expect("decodes");
assert!(same(&catalog, &ty, &original, &back));
}
}
#[test]
fn a_parsed_canonical_text_writes_itself_back() {
let catalog = catalog();
let mut draw = Draw::new(15);
for ty in kinds() {
for _ in 0..20 {
let text = enc(&catalog, &ty, &value(&catalog, &ty, &mut draw, 3));
let parsed = parse(&text, &Limits::LANGUAGE).expect("valid JSON");
assert_eq!(parsed.canonical(), text);
}
}
}
#[test]
fn a_digest_is_sha256_written_with_its_algorithm_in_lowercase_hex() {
assert_eq!(
Digest::of(b"").to_string(),
"sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
);
assert_eq!(
Digest::of(json("[ ]").canonical().as_bytes()).to_string(),
"sha256:4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945"
);
assert_eq!(
Digest::of(json(r#"{ "a" : 1.0 }"#).canonical().as_bytes()).to_string(),
"sha256:015abd7f5cc57a2dd94b7590f04ad8084273905ee33ec5cebeae62276a97f862"
);
}
#[test]
fn the_json_tree_names_its_kinds_and_finds_members() {
let object = json(r#"{"a": 1, "b": [null, true, "s", {}]}"#);
assert_eq!(object.get("a"), Some(&json("1")));
assert_eq!(object.get("c"), None);
assert_eq!(json("[]").get("a"), None);
let kinds: Vec<&str> = match object.get("b") {
Some(Json::Array(items)) => items.iter().map(Json::kind).collect(),
_ => panic!("an array"),
};
assert_eq!(kinds, ["null", "a boolean", "a string", "an object"]);
assert_eq!(json("1").kind(), "a number");
assert_eq!(json("[]").kind(), "an array");
}
#[test]
fn full_function_and_declared_nondata_have_no_actual_value_encoding() {
let catalog = phantom_catalog();
for ty in [
Type::Function {
params: vec![Type::Int],
result: Box::new(Type::Text),
},
Type::Named(flow_types::DeclId(0), vec![]),
] {
let error =
encode(&catalog, &ty, &int("7")).expect_err("no function or nondata value codec");
assert_eq!(error.to_string(), "the value has a type with no encoding");
}
}
#[test]
fn a_bounded_encoding_reserves_no_more_than_its_bound_however_long_the_list() {
let catalog = catalog();
let Value::List(mut list) = Value::list(std::iter::repeat_n(Value::Int(1.into()), 100_000))
else {
unreachable!("a list value holds a list")
};
for _ in 0..30 {
list = list.clone().concat(list);
}
let huge = Value::List(list);
assert_eq!(
flow_abi::canonical_within(&catalog, &Type::list(Type::Int), &huge, 100),
Ok(None)
);
}