Skip to content

Commit b9354a7

Browse files
committed
Create tests crate
1 parent 22f6c12 commit b9354a7

5 files changed

Lines changed: 70 additions & 2 deletions

File tree

.vscode/tasks.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
},
152152

153153
{
154-
"label": "Cargo: Install crates",
154+
"label": "Cargo: Install crates (impl crate)",
155155
"icon": {
156156
"id": "package",
157157
"color": "terminal.ansiYellow"
@@ -170,6 +170,26 @@
170170
"problemMatcher": []
171171
},
172172

173+
{
174+
"label": "Cargo: Install crates (tests crate)",
175+
"icon": {
176+
"id": "package",
177+
"color": "terminal.ansiYellow"
178+
},
179+
180+
"type": "shell",
181+
"command": "cargo add -p error-stack-macros2-tests ${input:crates}",
182+
183+
"isBackground": false,
184+
"presentation": {
185+
"echo": false,
186+
"panel": "dedicated",
187+
"showReuseMessage": false
188+
},
189+
190+
"problemMatcher": []
191+
},
192+
173193
{
174194
"label": "RustFMT: Format",
175195
"icon": {

Cargo.lock

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[workspace]
2-
members = ["impl"]
2+
members = ["impl", "tests"]
33
resolver = "3"

tests/Cargo.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[package]
2+
name = "error-stack-macros2-tests"
3+
version = "0.0.0-reserved"
4+
authors = ["LuisFerLCC"]
5+
edition = "2024"
6+
rust-version = "1.90.0"
7+
publish = false
8+
9+
10+
[dependencies]
11+
error-stack = "0.6.0"
12+
error-stack-macros2 = { path = "../impl" }
13+
14+
[lints.rust]
15+
single_use_lifetimes = "warn"
16+
unconditional_recursion = "deny"
17+
unit_bindings = "warn"
18+
unnameable_types = "warn"
19+
unreachable_pub = "warn"
20+
unsafe_code = "deny"
21+
unused_lifetimes = "warn"
22+
23+
[lints.clippy]
24+
unwrap_used = "warn"
25+
expect_used = "warn"
26+
panic = "warn"

tests/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
pub fn add(left: u64, right: u64) -> u64 {
2+
left + right
3+
}
4+
5+
#[cfg(test)]
6+
mod tests {
7+
use super::*;
8+
9+
#[test]
10+
fn it_works() {
11+
let result = add(2, 2);
12+
assert_eq!(result, 4);
13+
}
14+
}

0 commit comments

Comments
 (0)