1pub const BYTES: &str = include_str!("bytes/lib.nova");
12pub const COLLECTIONS: &str = include_str!("collections/lib.nova");
14pub const CORE: &str = include_str!("core/lib.nova");
16pub const CRYPTO: &str = include_str!("crypto/lib.nova");
18pub const FMT: &str = include_str!("fmt/lib.nova");
20pub const FS: &str = include_str!("fs/lib.nova");
22pub const HTTP: &str = include_str!("http/lib.nova");
24pub const IO: &str = include_str!("io/lib.nova");
26pub const JSON: &str = include_str!("json/lib.nova");
28pub const LOG: &str = include_str!("log/lib.nova");
30pub const NET: &str = include_str!("net/lib.nova");
32pub const PROCESS: &str = include_str!("process/lib.nova");
34pub const STRINGS: &str = include_str!("strings/lib.nova");
36pub const SYNC: &str = include_str!("sync/lib.nova");
38pub const TASK: &str = include_str!("task/lib.nova");
40pub const TEST: &str = include_str!("test/lib.nova");
42pub const TIME: &str = include_str!("time/lib.nova");
44
45pub const ALL: [(&str, &str); 17] = [
47 ("bytes", BYTES),
48 ("collections", COLLECTIONS),
49 ("core", CORE),
50 ("crypto", CRYPTO),
51 ("fmt", FMT),
52 ("fs", FS),
53 ("http", HTTP),
54 ("io", IO),
55 ("json", JSON),
56 ("log", LOG),
57 ("net", NET),
58 ("process", PROCESS),
59 ("strings", STRINGS),
60 ("sync", SYNC),
61 ("task", TASK),
62 ("test", TEST),
63 ("time", TIME),
64];
65
66#[cfg(test)]
67mod tests {
68 use std::collections::BTreeSet;
69 use std::path::Path;
70
71 #[test]
73 fn every_std_module_is_embedded() {
74 let root = Path::new(env!("CARGO_MANIFEST_DIR"));
75 let on_disk: BTreeSet<String> = std::fs::read_dir(root)
76 .expect("read std/")
77 .map(|entry| entry.expect("read an entry of std/").path())
78 .filter(|path| path.join("lib.nova").is_file())
79 .map(|path| {
80 path.file_name()
81 .expect("a directory name")
82 .to_string_lossy()
83 .into_owned()
84 })
85 .collect();
86 let embedded: BTreeSet<String> = super::ALL
87 .iter()
88 .map(|(name, _)| name.to_string())
89 .collect();
90 assert_eq!(embedded, on_disk);
91 assert_eq!(on_disk.len(), 17);
92 }
93
94 #[test]
96 fn each_entry_is_its_own_file() {
97 let root = Path::new(env!("CARGO_MANIFEST_DIR"));
98 for (name, source) in super::ALL {
99 let on_disk = std::fs::read_to_string(root.join(name).join("lib.nova"))
100 .expect("read a std module");
101 assert_eq!(source, on_disk, "std/{name}/lib.nova");
102 }
103 }
104}