Skip to content

Commit 6ecedf9

Browse files
lxsaahclaude
andcommitted
fix(data-contracts): compile linkable tests on no_std and add them to the test matrix
The #[cfg(test)] module in linkable.rs relied on the std prelude for String/Vec/ToString, so 'cargo test -p aimdb-data-contracts --no-default-features --features linkable' failed to compile (found by @thaodt in #155). Add the alloc imports. The gap went unnoticed because 'make check' never compiled that module: 'linkable' appeared only in build (no test code), clippy without --all-targets (tests not linted), and test-embedded (cargo check). Add 'linkable' to both data-contracts test matrix lines so the unit and derive tests actually run — under std and no_std + alloc. Refs #155 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent e45ffab commit 6ecedf9

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ build:
112112
test:
113113
@printf "$(GREEN)Running all tests (valid combinations)...$(NC)\n"
114114
@printf "$(YELLOW) → Testing aimdb-data-contracts (std)$(NC)\n"
115-
cargo test --package aimdb-data-contracts --features "std,simulatable,migratable,observable"
116-
@printf "$(YELLOW) → Testing aimdb-data-contracts (no_std + alloc + migratable)$(NC)\n"
117-
cargo test --package aimdb-data-contracts --no-default-features --features alloc,migratable
115+
cargo test --package aimdb-data-contracts --features "std,simulatable,migratable,observable,linkable"
116+
@printf "$(YELLOW) → Testing aimdb-data-contracts (no_std + alloc + linkable + migratable)$(NC)\n"
117+
cargo test --package aimdb-data-contracts --no-default-features --features alloc,linkable,migratable
118118
@printf "$(YELLOW) → Testing aimdb-core (no_std + alloc)$(NC)\n"
119119
cargo test --package aimdb-core --no-default-features --features alloc
120120
@printf "$(YELLOW) → Testing aimdb-core (std platform)$(NC)\n"

aimdb-data-contracts/src/linkable.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ where
4949

5050
#[cfg(test)]
5151
mod tests {
52+
use alloc::string::{String, ToString};
53+
use alloc::vec::Vec;
54+
5255
use crate::{Linkable, SchemaType};
5356
use serde::{Deserialize, Serialize};
5457

0 commit comments

Comments
 (0)