mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 11:46:42 +01:00
parent
4a385b40ff
commit
cb8fd26922
8 changed files with 234 additions and 257 deletions
|
|
@ -189,109 +189,3 @@ impl ToTokens for ExposeType {
|
|||
self.0.to_tokens(out)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_expose_definition () {
|
||||
// TODO
|
||||
//let parsed: ExposeImpl = pq! {
|
||||
////#[tengri_proc::expose]
|
||||
//impl Something {
|
||||
//fn something () -> bool {}
|
||||
//}
|
||||
//};
|
||||
//// FIXME:
|
||||
////assert_eq!(
|
||||
////format!("{}", quote! { #parsed }),
|
||||
////format!("{}", quote! {
|
||||
////impl Something {
|
||||
////fn something () {}
|
||||
////}
|
||||
////impl ::tengri::Context<bool> for Something {
|
||||
////fn get (&self, dsl: &::tengri::Value) -> Option<bool> {
|
||||
////Some(match dsl {
|
||||
////::tengri::Value::Sym(":true") => true,
|
||||
////::tengri::Value::Sym(":false") => false,
|
||||
////::tengri::Value::Sym(":bool1") => true || false,
|
||||
////_ => return None
|
||||
////})
|
||||
////}
|
||||
////}
|
||||
////})
|
||||
////);
|
||||
|
||||
//let parsed: ExposeImpl = pq! {
|
||||
////#[tengri_proc::expose]
|
||||
//impl Something {
|
||||
//#[tengri::expose(bool)] {
|
||||
//":bool1" => true || false,
|
||||
//}
|
||||
//#[tengri::expose(u16)] {
|
||||
//":u161" => 0 + 1,
|
||||
//}
|
||||
//#[tengri::expose(usize)] {
|
||||
//":usize1" => 1 + 2,
|
||||
//}
|
||||
//#[tengri::expose(Arc<str>)] {
|
||||
//":arcstr1" => "foo".into(),
|
||||
//}
|
||||
//#[tengri::expose(Option<Arc<str>>)] {
|
||||
//":optarcstr1" => Some("bar".into()),
|
||||
//":optarcstr2" => Some("baz".into()),
|
||||
//}
|
||||
//fn something () {}
|
||||
//}
|
||||
//};
|
||||
//// FIXME:
|
||||
////assert_eq!(
|
||||
////format!("{}", quote! { #parsed }),
|
||||
////format!("{}", quote! {
|
||||
////impl Something {
|
||||
////fn something () {}
|
||||
////}
|
||||
////impl ::tengri::Context<Arc<str>> for Something {
|
||||
////fn get (&self, dsl: &::tengri::Value) -> Option<Arc<str>> {
|
||||
////Some(match dsl {
|
||||
////::tengri::Value::Sym(":arcstr1") => "foo".into(),
|
||||
////_ => return None
|
||||
////})
|
||||
////}
|
||||
////}
|
||||
////impl ::tengri::Context<Option<Arc<str>>> for Something {
|
||||
////fn get (&self, dsl: &::tengri::Value) -> Option<Option<Arc<str>>> {
|
||||
////Some(match dsl {
|
||||
////::tengri::Value::Sym(":optarcstr1") => Some("bar".into()),
|
||||
////::tengri::Value::Sym(":optarcstr2") => Some("baz".into()),
|
||||
////_ => return None
|
||||
////})
|
||||
////}
|
||||
////}
|
||||
////impl ::tengri::Context<bool> for Something {
|
||||
////fn get (&self, dsl: &::tengri::Value) -> Option<bool> {
|
||||
////Some(match dsl {
|
||||
////::tengri::Value::Sym(":true") => true,
|
||||
////::tengri::Value::Sym(":false") => false,
|
||||
////::tengri::Value::Sym(":bool1") => true || false,
|
||||
////_ => return None
|
||||
////})
|
||||
////}
|
||||
////}
|
||||
////impl ::tengri::Context<u16> for Something {
|
||||
////fn get (&self, dsl: &::tengri::Value) -> Option<u16> {
|
||||
////Some(match dsl {
|
||||
////::tengri::Value::Num(n) => *n as u16,
|
||||
////::tengri::Value::Sym(":u161") => 0 + 1,
|
||||
////_ => return None
|
||||
////})
|
||||
////}
|
||||
////}
|
||||
////impl ::tengri::Context<usize> for Something {
|
||||
////fn get (&self, dsl: &::tengri::Value) -> Option<usize> {
|
||||
////Some(match dsl {
|
||||
////::tengri::Value::Num(n) => *n as usize,
|
||||
////::tengri::Value::Sym(":usize1") => 1 + 2,
|
||||
////_ => return None
|
||||
////})
|
||||
////}
|
||||
////}
|
||||
////})
|
||||
////)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue