Skip to content

Commit 8976d22

Browse files
committed
chore: add insta snapshot example
1 parent cdaf15f commit 8976d22

File tree

16 files changed

+1056
-0
lines changed

16 files changed

+1056
-0
lines changed

.bazelci/presubmit.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,18 @@ tasks:
850850
run_targets:
851851
- "//pkg_a:pkg_a_binary"
852852
- "//pkg_b:pkg_b_binary"
853+
854+
example_snapshot_test:
855+
name: Snapshot test example
856+
platform: ubuntu2204
857+
working_directory: examples/snapshot_test
858+
build_targets:
859+
- "//..."
860+
test_targets:
861+
- "//..."
862+
run_targets:
863+
- "//:test_update_snapshots"
864+
853865
ubuntu2204_bzlmod_bcr:
854866
name: bzlmod BCR presubmit
855867
platform: ubuntu2204

examples/snapshot_test/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bazel-*

examples/snapshot_test/BUILD.bazel

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
load("//:defs.bzl", "rust_snapshot_test")
2+
3+
rust_snapshot_test(
4+
name = "test",
5+
srcs = ["test.rs"],
6+
crate_root = "test.rs",
7+
snapshots_dir = "snapshots",
8+
deps = [
9+
"@crate_index//:insta",
10+
],
11+
)

examples/snapshot_test/Cargo.lock

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

examples/snapshot_test/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "snapshot_test"
3+
version = "0.0.0"
4+
edition = "2021"
5+
publish = false
6+
7+
[[test]]
8+
name = "test"
9+
path = "test.rs"
10+
11+
[dependencies]
12+
insta = "1.44.3"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""bazelbuild/rules_rust - bzlmod example"""
2+
3+
module(
4+
name = "snapshot_test_example",
5+
version = "0.0.0",
6+
)
7+
8+
bazel_dep(name = "rules_rust", version = "0.0.0")
9+
local_path_override(
10+
module_name = "rules_rust",
11+
path = "../..",
12+
)
13+
14+
bazel_dep(name = "rules_shell", version = "0.6.1")
15+
16+
crate = use_extension(
17+
"@rules_rust//crate_universe:extensions.bzl",
18+
"crate",
19+
)
20+
crate.from_cargo(
21+
name = "crate_index",
22+
cargo_lockfile = "//:Cargo.lock",
23+
manifests = ["//:Cargo.toml"],
24+
)
25+
use_repo(crate, "crate_index")

0 commit comments

Comments
 (0)