make spec infra more ergonomic

Signed-off-by: Onur Özkan <work@onurozkan.dev>
This commit is contained in:
Onur Özkan committed 2026-07-18 13:28:01 +03:00
1 parent b0a7a9bb03
commit 85559bd2d5
20 files changed
+74 -123

No files matched your search

@@ -0,0 +1,5 @@
use kaptan_spec::no_spec;
no_spec!(" ");
fn main() {}
@@ -0,0 +1,7 @@
error: no-spec explanation must not be empty; use no_spec!("reason");
--> tests/ui/fail_empty_explanation.rs:3:1
|
3 | no_spec!(" ");
| ^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `no_spec` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -1,6 +0,0 @@
use kaptan_spec::spec;
#[spec("flight_core_contract.md")]
struct InvalidSuffix;
fn main() {}
@@ -1,7 +0,0 @@
error: spec path must end in `.spec.md`; use #[spec("file.spec.md")]
--> tests/ui/fail_invalid_suffix.rs:3:1
|
3 | #[spec("flight_core_contract.md")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `spec` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -1,6 +0,0 @@
use kaptan_spec::spec;
#[spec(path = "flight_core_contract.spec.md")]
struct LegacyNamedArgument;
fn main() {}
@@ -1,7 +0,0 @@
error: invalid spec attribute; use #[spec("file.spec.md")]
--> tests/ui/fail_legacy_named_argument.rs:3:1
|
3 | #[spec(path = "flight_core_contract.spec.md")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `spec` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -1,6 +1,5 @@
use kaptan_spec::spec;
use kaptan_spec::no_spec;
#[spec]
struct MissingArgument;
no_spec!();
fn main() {}
@@ -1,7 +1,7 @@
error: missing spec path; use #[spec("file.spec.md")]
error: missing no-spec explanation; use no_spec!("reason");
--> tests/ui/fail_missing_argument.rs:3:1
|
3 | #[spec]
| ^^^^^^^
3 | no_spec!();
| ^^^^^^^^^^
|
= note: this error originates in the attribute macro `spec` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the macro `no_spec` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -1,7 +0,0 @@
use kaptan_spec::spec;
#[spec("fail_missing_sidecar.spec.md")]
mod missing_spec {}
fn main() {
}
@@ -1,5 +0,0 @@
error: couldn't read `$DIR/tests/ui/fail_missing_sidecar.spec.md`: No such file or directory (os error 2)
--> tests/ui/fail_missing_sidecar.rs:3:1
|
3 | #[spec("fail_missing_sidecar.spec.md")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1,6 +0,0 @@
use kaptan_spec::spec;
#[spec("flight_core_contract.spec.md")]
struct FlightCore;
fn main() {}
@@ -1,7 +0,0 @@
error: `#[spec]` may only be applied to a module
--> tests/ui/fail_non_module_item.rs:3:1
|
3 | #[spec("flight_core_contract.spec.md")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `spec` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -1,6 +1,5 @@
use kaptan_spec::spec;
use kaptan_spec::no_spec;
#[spec(42)]
struct NonStringArgument;
no_spec!(42);
fn main() {}
@@ -1,7 +1,7 @@
error: invalid spec attribute; use #[spec("file.spec.md")]
error: invalid no-spec invocation; use no_spec!("reason");
--> tests/ui/fail_non_string_argument.rs:3:1
|
3 | #[spec(42)]
| ^^^^^^^^^^^
3 | no_spec!(42);
| ^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `spec` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the macro `no_spec` (in Nightly builds, run with -Z macro-backtrace for more info)
+1 -2
View File
@@ -1,7 +1,6 @@
use kaptan_spec::spec;
#[spec("flight_core_contract.spec.md")]
mod flight_core {}
spec!("flight_core_contract.spec.md");
fn main() {
assert_eq!(core::mem::size_of::<()>(), 0);
+5
View File
@@ -0,0 +1,5 @@
use kaptan_spec::no_spec;
no_spec!("This fixture has no governed runtime behavior.");
fn main() {}