DRY builtins types creation to ensure proper consistency.
This commit is contained in:
@@ -153,7 +153,7 @@ impl From<&Config> for Preamble {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use aiken_lang::builtins;
|
||||
use aiken_lang::tipo::Type;
|
||||
use schema::{Data, Declaration, Items, Schema};
|
||||
use serde_json::{self, json};
|
||||
use std::collections::HashMap;
|
||||
@@ -225,17 +225,17 @@ mod tests {
|
||||
fn serialize_with_definitions() {
|
||||
let mut definitions = Definitions::new();
|
||||
definitions
|
||||
.register::<_, Error>(&builtins::int(), &HashMap::new(), |_| {
|
||||
.register::<_, Error>(&Type::int(), &HashMap::new(), |_| {
|
||||
Ok(Schema::Data(Data::Integer).into())
|
||||
})
|
||||
.unwrap();
|
||||
definitions
|
||||
.register::<_, Error>(
|
||||
&builtins::list(builtins::byte_array()),
|
||||
&Type::list(Type::byte_array()),
|
||||
&HashMap::new(),
|
||||
|definitions| {
|
||||
let ref_bytes = definitions.register::<_, Error>(
|
||||
&builtins::byte_array(),
|
||||
&Type::byte_array(),
|
||||
&HashMap::new(),
|
||||
|_| Ok(Schema::Data(Data::Bytes).into()),
|
||||
)?;
|
||||
|
||||
@@ -4,7 +4,6 @@ use crate::{
|
||||
};
|
||||
use aiken_lang::{
|
||||
ast::{Definition, TypedDataType, TypedDefinition},
|
||||
builtins::wrapped_redeemer,
|
||||
tipo::{pretty, Type, TypeVar},
|
||||
};
|
||||
use owo_colors::{OwoColorize, Stream::Stdout};
|
||||
@@ -142,7 +141,7 @@ impl Annotated<Schema> {
|
||||
) -> Reference {
|
||||
definitions
|
||||
.register(
|
||||
&wrapped_redeemer(type_info),
|
||||
&Type::wrapped_redeemer(type_info),
|
||||
&HashMap::new(),
|
||||
|_| {
|
||||
Ok::<_, Error>(Annotated {
|
||||
|
||||
@@ -272,7 +272,7 @@ mod tests {
|
||||
use aiken_lang::{
|
||||
self,
|
||||
ast::{TraceLevel, Tracing},
|
||||
builtins,
|
||||
tipo::Type,
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
use uplc::ast as uplc_ast;
|
||||
@@ -336,7 +336,7 @@ mod tests {
|
||||
// "dataType": "integer"
|
||||
// }
|
||||
definitions
|
||||
.register::<_, Error>(&builtins::int(), &HashMap::new(), |_| {
|
||||
.register::<_, Error>(&Type::int(), &HashMap::new(), |_| {
|
||||
Ok(Schema::Data(Data::Integer).into())
|
||||
})
|
||||
.unwrap();
|
||||
@@ -347,7 +347,7 @@ mod tests {
|
||||
// "dataType": "bytes"
|
||||
// }
|
||||
definitions
|
||||
.register::<_, Error>(&builtins::byte_array(), &HashMap::new(), |_| {
|
||||
.register::<_, Error>(&Type::byte_array(), &HashMap::new(), |_| {
|
||||
Ok(Schema::Data(Data::Bytes).into())
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user