Skip to content

Commit f86aec4

Browse files
committed
transpile: tests: stop using insta::glob! for c_decls_snapshots, too
Since there's only a single `c_decls_snapshots`, I didn't add any extra code like `TranspileTest` for the transpile snapshots. Also, previously, the code wasn't accounting for needing a `dummy` and used the absolute path in the debug expression, which changes. Now both are fixed and a relative path is used.
1 parent 8634749 commit f86aec4

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

c2rust-transpile/tests/snapshots.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,6 @@ fn test_varargs() {
419419
.run();
420420
}
421421

422-
#[test]
423-
fn check_c_decl_map() {
424-
insta::glob!("c_decls_snapshots/*.c", transpile_with_c_decl_map_snapshot);
425-
}
426-
427422
fn transpile_with_c_decl_map_snapshot(c_path: &Path) {
428423
compile_and_transpile_file(c_path, config());
429424

@@ -434,3 +429,9 @@ fn transpile_with_c_decl_map_snapshot(c_path: &Path) {
434429
serde_json::from_str(&fs::read_to_string(&c_decls_path).unwrap()).unwrap();
435430
insta::assert_json_snapshot!(snapshot_name, json, &debug_expr);
436431
}
432+
433+
#[test]
434+
fn test_nh() {
435+
let c_path = Path::new("tests/c_decls_snapshots/nh.c");
436+
transpile_with_c_decl_map_snapshot(c_path);
437+
}

c2rust-transpile/tests/snapshots/snapshots__c_decls-nh.c.snap

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
source: c2rust-transpile/tests/snapshots.rs
3-
expression: cat /home/mod/immunant/c2rust/repo/c2rust-transpile/tests/c_decls_snapshots/nh.c_decls.json
4-
input_file: c2rust-transpile/tests/c_decls_snapshots/nh.c
3+
expression: cat tests/c_decls_snapshots/nh.c_decls.json
54
---
65
{
76
"FOO": "FOO 4000+50",

0 commit comments

Comments
 (0)