oxiforge 0.3.0

YAML-to-Rust code generator for oxivgl LVGL UIs
Documentation
// SPDX-License-Identifier: GPL-3.0-only
use oxiforge::parse::{parse_file, parse_str};

#[test]
fn parse_minimal_yaml() {
    let yaml = include_str!("fixtures/minimal.yaml");
    let doc = parse_str(yaml).unwrap();
    assert_eq!(doc.lvgl.pages.len(), 1);
    assert_eq!(doc.lvgl.pages[0].id, "main");
}

#[test]
fn parse_label_styles_yaml() {
    let yaml = include_str!("fixtures/label_styles.yaml");
    let doc = parse_str(yaml).unwrap();
    assert_eq!(doc.lvgl.spdx_license.as_deref(), Some("GPL-3.0-only"));
    assert_eq!(doc.lvgl.style_definitions.as_ref().unwrap().len(), 1);
    assert_eq!(doc.lvgl.pages[0].common.widgets.as_ref().unwrap().len(), 2);
}

#[test]
fn parse_file_works() {
    let path = std::path::Path::new("tests/fixtures/minimal.yaml");
    let doc = parse_file(path).unwrap();
    assert_eq!(doc.lvgl.pages[0].id, "main");
}

#[test]
fn spdx_not_present() {
    let yaml = include_str!("fixtures/minimal.yaml");
    let doc = parse_str(yaml).unwrap();
    assert!(doc.lvgl.spdx_license.is_none());
}