Squash of 8 work commits (Sep 2–10):7b9ed2caichat: the assistant as an app — the panel owns the engine, the bus client, settings with the local-only locke0c6e74aichat: the progress bar and system lines use the theme's highlight colour8b46ce0aichat: the composer's hint is a dark grey Ask AI, not the typed colour b99a631 toml_parser, rust_tokenizer: rewrite both for the code analyser 3bbcea2 aichat: add Studio evaluation-feedback widget b61845f studio: Architecture view, the third workspace mode d7a76cf studio: add bounded code context and source APIs 524142a Split Studio into makepad director (public) and makepad scope (private) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
82 lines
2.9 KiB
Rust
82 lines
2.9 KiB
Rust
//! Real manifests from this repository, parsed and spot-checked.
|
|
use makepad_toml_parser::{parse_toml, Toml, TomlDocument};
|
|
|
|
fn parse(text: &str) -> TomlDocument {
|
|
parse_toml(text).unwrap_or_else(|e| panic!("manifest should parse: {e:?}"))
|
|
}
|
|
|
|
fn get_str<'a>(doc: &'a TomlDocument, path: &[&str]) -> Option<&'a str> {
|
|
doc.get_path(path).and_then(Toml::as_str)
|
|
}
|
|
|
|
#[test]
|
|
fn root_workspace_manifest() {
|
|
let doc = parse(include_str!("../../../Cargo.toml"));
|
|
let members = doc
|
|
.get_path(&["workspace", "members"])
|
|
.and_then(Toml::as_array)
|
|
.expect("workspace.members");
|
|
assert!(members.iter().any(|m| m.as_str() == Some("apps/director")));
|
|
assert!(members.iter().any(|m| m.as_str() == Some("apps/terminal")));
|
|
assert!(members.len() > 50);
|
|
}
|
|
|
|
#[test]
|
|
fn director_manifest_has_four_bins_and_a_lib() {
|
|
let doc = parse(include_str!("../../../apps/director/Cargo.toml"));
|
|
assert_eq!(get_str(&doc, &["package", "name"]), Some("makepad-director"));
|
|
assert_eq!(get_str(&doc, &["lib", "name"]), Some("makepad_director"));
|
|
let bins = doc
|
|
.get_path(&["bin"])
|
|
.and_then(Toml::as_array_of_tables)
|
|
.expect("[[bin]] entries");
|
|
let names: Vec<&str> = bins.iter().map(|b| b["name"].as_str().unwrap()).collect();
|
|
assert_eq!(
|
|
names,
|
|
["director", "director-git-guard", "director-rustc-guard", "director-flow"]
|
|
);
|
|
assert_eq!(bins[1]["test"].as_bool(), Some(false));
|
|
assert_eq!(bins[0]["path"].as_str(), Some("src/main.rs"));
|
|
assert_eq!(
|
|
get_str(&doc, &["dependencies", "makepad-widgets", "path"]),
|
|
Some("../../widgets")
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn terminal_manifest() {
|
|
let doc = parse(include_str!("../../../apps/terminal/Cargo.toml"));
|
|
assert_eq!(get_str(&doc, &["package", "name"]), Some("makepad-terminal"));
|
|
assert!(doc.get_path(&["dependencies"]).and_then(Toml::as_table).is_some());
|
|
}
|
|
|
|
#[test]
|
|
fn git_manifest() {
|
|
let doc = parse(include_str!("../../../libs/git/Cargo.toml"));
|
|
assert_eq!(get_str(&doc, &["package", "name"]), Some("makepad-git"));
|
|
assert_eq!(
|
|
get_str(&doc, &["dependencies", "makepad-fast-inflate", "path"]),
|
|
Some("../fast_inflate")
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn package_metadata_through_dotted_keys() {
|
|
let doc = parse(include_str!("../../../tools/cargo_makepad/Cargo.toml"));
|
|
assert_eq!(get_str(&doc, &["package", "name"]), Some("cargo-makepad"));
|
|
assert_eq!(
|
|
get_str(&doc, &["package", "metadata", "makepad-check-platform"]),
|
|
Some("desktop")
|
|
);
|
|
assert!(get_str(&doc, &["package", "metadata", "makepad-auto-version"]).is_some());
|
|
|
|
let doc = parse(include_str!("../../../libs/rust_tokenizer/Cargo.toml"));
|
|
assert_eq!(
|
|
get_str(&doc, &["package", "metadata", "makepad-auto-version"]),
|
|
Some("oD0L5c3G2VuWsqkFkpgKSat_PMo=")
|
|
);
|
|
assert_eq!(
|
|
get_str(&doc, &["dependencies", "makepad-live-id", "version"]),
|
|
Some("1.0.0")
|
|
);
|
|
}
|