added trybuild

This commit is contained in:
Robin Müller 2022-11-27 17:05:30 +01:00
parent 76245cb55f
commit 7062c12ef0
No known key found for this signature in database
GPG Key ID: BE6480244DFE612C
5 changed files with 93 additions and 3 deletions

64
Cargo.lock generated
View File

@ -278,6 +278,12 @@ dependencies = [
"syn",
]
[[package]]
name = "dissimilar"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c97b9233581d84b8e1e689cdd3a47b6f69770084fc246e86a7f78b0d9c1d4a5"
[[package]]
name = "downcast-rs"
version = "1.2.0"
@ -312,6 +318,12 @@ dependencies = [
"void",
]
[[package]]
name = "glob"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]]
name = "hash32"
version = "0.2.1"
@ -377,6 +389,12 @@ dependencies = [
"cxx-build",
]
[[package]]
name = "itoa"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc"
[[package]]
name = "js-sys"
version = "0.3.60"
@ -595,6 +613,12 @@ dependencies = [
"semver 1.0.14",
]
[[package]]
name = "ryu"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
[[package]]
name = "satrs-core"
version = "0.1.0"
@ -628,12 +652,14 @@ dependencies = [
]
[[package]]
name = "satrs-macro"
name = "satrs-macros"
version = "0.1.0"
dependencies = [
"proc-macro2",
"quote",
"satrs-core",
"syn",
"trybuild",
]
[[package]]
@ -689,6 +715,17 @@ dependencies = [
"syn",
]
[[package]]
name = "serde_json"
version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db"
dependencies = [
"itoa",
"ryu",
"serde",
]
[[package]]
name = "smallvec"
version = "1.10.0"
@ -743,6 +780,31 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "toml"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
dependencies = [
"serde",
]
[[package]]
name = "trybuild"
version = "1.0.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea496675d71016e9bc76aa42d87f16aefd95447cc5818e671e12b2d7e269075d"
dependencies = [
"dissimilar",
"glob",
"once_cell",
"serde",
"serde_derive",
"serde_json",
"termcolor",
"toml",
]
[[package]]
name = "unicode-ident"
version = "1.0.5"

View File

@ -1,5 +1,5 @@
[package]
name = "satrs-macro"
name = "satrs-macros"
version = "0.1.0"
edition = "2021"
@ -7,10 +7,20 @@ edition = "2021"
[lib]
proc-macro = true
[[test]]
name = "tests"
path = "tests/tests.rs"
[dependencies]
quote = "1.0"
proc-macro2 = "1.0"
[dependencies.satrs-core]
path = "../satrs-core"
[dev-dependencies]
trybuild = { version = "1.0", features = ["diff"] }
[dependencies.syn]
version = "1.0"
features = ["extra-traits"]

View File

@ -1 +1,7 @@
#[proc_macro_attribute]
pub fn result(
_attr: proc_macro::TokenStream,
item: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
item
}

View File

@ -0,0 +1,7 @@
use satrs_core::resultcode::ResultU16;
use satrs_macros::*;
#[result]
const TEST_RESULT: ResultU16 = ResultU16::const_new(0, 1);
fn main() {}

View File

@ -0,0 +1,5 @@
#[test]
fn tests() {
let t = trybuild::TestCases::new();
t.pass("tests/basic.rs");
}