/target
-/test/build/
+files/site/build
criterion = "0.4"
[[bench]]
-name = "build_site"
+name = "build_metafile"
+harness = false
+
+[[bench]]
+name = "map_dir"
harness = false
c.bench_function("build benchmark file", |b| {
b.iter(|| {
- let string = std::fs::read_to_string(black_box(&source)).unwrap();
- let file = metaforge::parse_file(string, black_box(&opts)).unwrap();
- let mut path = opts
- .build
- .join(source.strip_prefix(black_box(&opts.source)).unwrap());
+ let string = std::fs::read_to_string(black_box(&source)).expect("read file");
+ let file = metaforge::parse_file(string, black_box(&opts)).expect("parse file");
+ let mut path = opts.build.join(
+ source
+ .strip_prefix(black_box(&opts.source))
+ .expect("strip path"),
+ );
path.set_extension("html");
- std::fs::write(path, metaforge::build_metafile(&file).unwrap()).unwrap();
+ std::fs::write(path, metaforge::build_metafile(&file).expect("build file"))
+ .expect("write file");
})
});
}
+++ /dev/null
-<html>
-
-<header>HEADER</header>
-<body>
-<h1 id="list">LIST</h1>
-This is to test using arrays as lists.
-<ul>
-<li>
-A
-</li>
-<li>
-Single
-</li>
-<li>
-Word
-</li>
-<li>
-Per
-</li>
-<li>
-Item
-</li>
-</ul>
-
-</body>
-<footer>FOOTER</footer>
-
-</html>
+++ /dev/null
-
-<h1 id="simple-substitution">SIMPLE SUBSTITUTION</h1>
-<p>variable: GOOD</p>
-
-
+++ /dev/null
-<html>
-<body>
-GOOD
-</body>
-</html>
+++ /dev/null
-<html>
-
-<header>HEADER</header>
-<body>
-<h1 id="links">LINKS</h1>
-<p>This should create a group of bold links <a href="
-a.com
-"><b> A Website </b></a><a href="
-b.net
-"><b> B Place </b></a><a href="
-c.org
-"><b> C Dest </b></a></p>
-
-</body>
-<footer>FOOTER</footer>
-
-</html>
+++ /dev/null
-<html>
-
-
-<body>
-<h1 id="blank">BLANK</h1>
-<p>This should have no header or footer</p>
-
-</body>
-
-
-</html>
+++ /dev/null
-<html>
-
-<header>HEADER</header>
-<body>
-<h1 id="header-list">HEADER LIST</h1>
-<p>This should have a list in the header</p>
-
-</body>
-<footer>FOOTER</footer>
-
-</html>
+++ /dev/null
-
-<h1 id="markdown">MARKDOWN</h1>
-<h2 id="header">Header</h2>
-<p>This is a test for how various markdown elements translate</p>
-<h3 id="small-header">Small Header</h3>
-<ul>
-<li>Lists</li>
-<li>With</li>
-<li>Items</li>
-</ul>
-<h4 id="tiny-header">tiny header</h4>
-<p><em>Fancy</em> <strong>Text</strong> <strong>With</strong>
-<em>Adornments</em></p>
-<p>
-Inline HTML
-</p>
-<p><a href="https://example.org">a link</a></p>
-
-
+++ /dev/null
-<html>
-
-<header>HEADER</header>
-<body>
-<h1 id="root">ROOT</h1>
-<p>This is to test that the default base works without any
-defintions.</p>
-
-</body>
-<footer>FOOTER</footer>
-
-</html>
-# ROOT
-This is to test that the default base works without any defintions.
+&{ base = 'text' }
+TEST
}
#[test]
- fn test_build_metafile() -> Result<()> {
+ fn test_metafile_to_string() -> Result<()> {
let opts = build_options()?;
let path = opts.source.join("dir1/sub_dir1/deep2/deep.meta");
- let expanded = "<html>\n<body>\nGOOD\n</body>\n</html>\n";
- build_metafile(&MetaFile::build(path, &opts)?)?;
- assert_eq!(
- std::fs::read_to_string(opts.build.join("dir1/sub_dir1/deep2/deep.html"))?,
- expanded
- );
+ let expanded = "<html><body>GOOD</body></html>";
+ assert_eq!(build_metafile(&MetaFile::build(path, &opts)?)?, expanded);
Ok(())
}
--- /dev/null
+use color_eyre::Result;
+
+#[test]
+fn build_dir() -> Result<()> {}