Add 'exported_data' test and revert 413a056

This commit is contained in:
KtorZ 2023-03-02 16:09:08 +01:00
parent 413a056c08
commit 70cdf3cb26
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
2 changed files with 31 additions and 11 deletions

View File

@ -296,17 +296,6 @@ impl Annotated<Schema> {
description,
annotated: data,
}),
Annotated {
title: Some(title),
description,
annotated: Schema::Data(None),
} if title == "Data" => Ok(Annotated {
title: Some(title),
description,
annotated: Data::AnyOf(vec![]),
}),
_ => Err(Error::new(ErrorContext::ExpectedData, type_info)),
}
}

View File

@ -635,4 +635,35 @@ mod test {
),
);
}
#[test]
fn exported_data() {
assert_validator(
r#"
pub type Foo {
foo: Data
}
validator spend {
fn(datum: Data, redeemer: Int, ctx: Void) {
True
}
}
"#,
json!(
{
"title": "test_module.spend",
"hash": "a3dbab684d90d19e6bab3a0b00a7290ff59fe637d14428859bf74376",
"datum": {
"title": "Data",
"description": "Any Plutus data.",
},
"redeemer": {
"dataType": "integer",
},
"compiledCode": "5840010000323232323232322232253330074a22930b1bad0013001001222533300600214984cc014c004c01c008ccc00c00cc0200080055cd2b9b5573eae855d101"
}
),
);
}
}