mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 12:46:42 +01:00
wip: more edn rendering setup
This commit is contained in:
parent
174a7ee614
commit
f1b3fc0040
10 changed files with 85 additions and 47 deletions
|
|
@ -4,40 +4,42 @@
|
|||
pub(crate) use std::{
|
||||
fmt::{Debug, Formatter, Error as FormatError}
|
||||
};
|
||||
pub use ::tek_layout;
|
||||
pub(crate) use ::tek_layout::{
|
||||
*,
|
||||
tek_engine::{Usually, Content, Render, Engine, Thunk}
|
||||
};
|
||||
|
||||
mod edn_error; pub use self::edn_error::*;
|
||||
mod edn_item; pub use self::edn_item::*;
|
||||
mod edn_token; pub use self::edn_token::*;
|
||||
mod edn_view; pub use self::edn_view::*;
|
||||
mod edn_error; pub use self::edn_error::*;
|
||||
mod edn_item; pub use self::edn_item::*;
|
||||
mod edn_token; pub use self::edn_token::*;
|
||||
mod edn_view; pub use self::edn_view::*;
|
||||
mod edn_main; pub use self::edn_main::*;
|
||||
|
||||
#[cfg(test)] #[test] fn test_edn () -> Result<(), ParseError> {
|
||||
use EdnItem::*;
|
||||
assert_eq!(EdnItem::read_all("")?,
|
||||
assert_eq!(EdnItem::<String>::read_all("")?,
|
||||
vec![]);
|
||||
assert_eq!(EdnItem::read_all(" ")?,
|
||||
assert_eq!(EdnItem::<String>::read_all(" ")?,
|
||||
vec![]);
|
||||
assert_eq!(EdnItem::read_all("1234")?,
|
||||
assert_eq!(EdnItem::<String>::read_all("1234")?,
|
||||
vec![Num(1234)]);
|
||||
assert_eq!(EdnItem::read_all("1234 5 67")?,
|
||||
assert_eq!(EdnItem::<String>::read_all("1234 5 67")?,
|
||||
vec![Num(1234), Num(5), Num(67)]);
|
||||
assert_eq!(EdnItem::read_all("foo/bar")?,
|
||||
assert_eq!(EdnItem::<String>::read_all("foo/bar")?,
|
||||
vec![Key("foo/bar".into())]);
|
||||
assert_eq!(EdnItem::read_all(":symbol")?,
|
||||
assert_eq!(EdnItem::<String>::read_all(":symbol")?,
|
||||
vec![Sym(":symbol".into())]);
|
||||
assert_eq!(EdnItem::read_all(" foo/bar :baz 456")?,
|
||||
assert_eq!(EdnItem::<String>::read_all(" foo/bar :baz 456")?,
|
||||
vec![Key("foo/bar".into()), Sym(":baz".into()), Num(456)]);
|
||||
assert_eq!(EdnItem::read_all(" (foo/bar :baz 456) ")?,
|
||||
assert_eq!(EdnItem::<String>::read_all(" (foo/bar :baz 456) ")?,
|
||||
vec![Exp(vec![Key("foo/bar".into()), Sym(":baz".into()), Num(456)])]);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_edn_layout () -> Result<(), ParseError> {
|
||||
let source = include_str!("example.edn");
|
||||
let layout = EdnItem::read_all(source)?;
|
||||
EdnItem::<String>::read_all(include_str!("../examples/edn01.edn"))?;
|
||||
EdnItem::<String>::read_all(include_str!("../examples/edn02.edn"))?;
|
||||
//panic!("{layout:?}");
|
||||
//let content = <dyn EdnLayout<::tek_engine::tui::Tui>>::from(&layout);
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue