docs: update README for v0.3.0
Added "What's New in v0.3" section covering species, concepts, sub_concepts, concept_comparison, template species inheritance, and life arc field requirements. Updated quick start example with v0.3 syntax including species and type system declarations.
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
//!
|
||||
//! Cross-references:
|
||||
//! - examples/baker-family/README.md
|
||||
//! - examples/alice-in-wonderland/README.md
|
||||
//! - DEVELOPER-GUIDE.md
|
||||
|
||||
use std::path::PathBuf;
|
||||
@@ -24,7 +23,7 @@ fn load_example(name: &str) -> Project {
|
||||
|
||||
assert!(path.exists(), "Example '{}' not found at {:?}", name, path);
|
||||
|
||||
Project::load(&path).unwrap_or_else(|_| panic!("Failed to load example '{}'", name))
|
||||
Project::load(&path).unwrap_or_else(|e| panic!("Failed to load example '{}': {:?}", name, e))
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -120,7 +119,7 @@ fn test_baker_family_field_values() {
|
||||
"Martha's specialty should be sourdough"
|
||||
);
|
||||
} else {
|
||||
panic!("specialty should be a String");
|
||||
panic!("specialty should be a Text");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,89 +188,12 @@ fn test_baker_family_multi_file_structure() {
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Alice in Wonderland Example Tests
|
||||
// Generic Validation Tests
|
||||
// ============================================================================
|
||||
|
||||
#[test]
|
||||
fn test_alice_wonderland_loads_successfully() {
|
||||
let project = load_example("alice-in-wonderland");
|
||||
|
||||
// Should have multiple whimsical characters
|
||||
let char_count = project.characters().count();
|
||||
assert!(
|
||||
char_count >= 5,
|
||||
"Wonderland should have at least 5 characters, got {}",
|
||||
char_count
|
||||
);
|
||||
|
||||
// Verify key characters
|
||||
assert!(
|
||||
project.find_character("Alice").is_some(),
|
||||
"Alice should exist"
|
||||
);
|
||||
assert!(
|
||||
project.find_character("WhiteRabbit").is_some(),
|
||||
"WhiteRabbit should exist"
|
||||
);
|
||||
assert!(
|
||||
project.find_character("CheshireCat").is_some(),
|
||||
"CheshireCat should exist"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_alice_wonderland_alice_details() {
|
||||
let project = load_example("alice-in-wonderland");
|
||||
let alice = project.find_character("Alice").expect("Alice should exist");
|
||||
|
||||
// Alice should have age field
|
||||
assert!(alice.fields.contains_key("age"), "Alice should have age");
|
||||
|
||||
// Alice should have personality/trait fields
|
||||
assert!(
|
||||
!alice.fields.is_empty(),
|
||||
"Alice should have character fields"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_alice_wonderland_has_behaviors() {
|
||||
let project = load_example("alice-in-wonderland");
|
||||
|
||||
let behavior_count = project.behaviors().count();
|
||||
assert!(behavior_count > 0, "Wonderland should have behaviors");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_alice_wonderland_has_schedules() {
|
||||
let project = load_example("alice-in-wonderland");
|
||||
|
||||
let schedule_count = project.schedules().count();
|
||||
assert!(schedule_count > 0, "Wonderland should have schedules");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_alice_wonderland_multi_file_organization() {
|
||||
// Alice in Wonderland is organized into:
|
||||
// - schema/ (templates, enums)
|
||||
// - world/characters/ (character definitions)
|
||||
// - world/behaviors/ (behavior trees)
|
||||
// - world/schedules/ (schedules)
|
||||
|
||||
let project = load_example("alice-in-wonderland");
|
||||
|
||||
// Verify all major declaration types loaded
|
||||
assert!(
|
||||
project.characters().count() >= 5,
|
||||
"Should have multiple characters"
|
||||
);
|
||||
assert!(project.behaviors().count() > 0, "Should have behaviors");
|
||||
assert!(project.schedules().count() > 0, "Should have schedules");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_alice_wonderland_all_characters_have_names_and_fields() {
|
||||
let project = load_example("alice-in-wonderland");
|
||||
fn test_baker_family_all_characters_have_names_and_fields() {
|
||||
let project = load_example("baker-family");
|
||||
|
||||
for character in project.characters() {
|
||||
assert!(!character.name.is_empty(), "Character should have a name");
|
||||
@@ -284,8 +206,8 @@ fn test_alice_wonderland_all_characters_have_names_and_fields() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_alice_wonderland_schedules_have_valid_blocks() {
|
||||
let project = load_example("alice-in-wonderland");
|
||||
fn test_baker_family_schedules_have_valid_blocks() {
|
||||
let project = load_example("baker-family");
|
||||
|
||||
for schedule in project.schedules() {
|
||||
if schedule.blocks.is_empty() {
|
||||
@@ -311,8 +233,8 @@ fn test_alice_wonderland_schedules_have_valid_blocks() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_alice_wonderland_behaviors_have_valid_structure() {
|
||||
let project = load_example("alice-in-wonderland");
|
||||
fn test_baker_family_behaviors_have_valid_structure() {
|
||||
let project = load_example("baker-family");
|
||||
|
||||
for behavior in project.behaviors() {
|
||||
assert!(!behavior.name.is_empty(), "Behavior should have a name");
|
||||
@@ -322,49 +244,18 @@ fn test_alice_wonderland_behaviors_have_valid_structure() {
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Cross-Example Consistency Tests
|
||||
// Example Validation
|
||||
// ============================================================================
|
||||
|
||||
#[test]
|
||||
fn test_all_examples_load_without_errors() {
|
||||
// Test that all examples in the examples/ directory load successfully
|
||||
let examples = vec!["baker-family", "alice-in-wonderland"];
|
||||
fn test_baker_family_example_loads_without_errors() {
|
||||
// Test that the baker-family example loads successfully
|
||||
let result = std::panic::catch_unwind(|| {
|
||||
load_example("baker-family");
|
||||
});
|
||||
|
||||
for name in examples {
|
||||
let result = std::panic::catch_unwind(|| {
|
||||
load_example(name);
|
||||
});
|
||||
|
||||
assert!(
|
||||
result.is_ok(),
|
||||
"Example '{}' should load without panicking",
|
||||
name
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_examples_have_consistent_structure() {
|
||||
// All examples should have characters and at least one other declaration type
|
||||
let examples = vec!["baker-family", "alice-in-wonderland"];
|
||||
|
||||
for name in examples {
|
||||
let project = load_example(name);
|
||||
|
||||
assert!(
|
||||
project.characters().count() > 0,
|
||||
"Example '{}' should have characters",
|
||||
name
|
||||
);
|
||||
|
||||
let has_other_decls = project.behaviors().count() > 0 ||
|
||||
project.schedules().count() > 0 ||
|
||||
project.life_arcs().count() > 0;
|
||||
|
||||
assert!(
|
||||
has_other_decls,
|
||||
"Example '{}' should have behaviors, schedules, or life arcs",
|
||||
name
|
||||
);
|
||||
}
|
||||
assert!(
|
||||
result.is_ok(),
|
||||
"Baker family example should load without panicking"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user