Skip to content

Commit

Permalink
Redact local file path from snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
Glyphack committed Oct 25, 2023
1 parent 52e16f9 commit 466af13
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion typechecker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ env_logger = "0.10.0"
tempfile = "3.8.0"

[dev-dependencies]
insta = { version = "1.28.0", features = ["yaml"] }
insta = { version = "1.28.0", features = ["yaml", "filters"] }
6 changes: 6 additions & 0 deletions typechecker/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,12 @@ mod tests {
let mut settings = insta::Settings::clone_current();
settings.set_snapshot_path("../testdata/output/");
settings.set_description(fs::read_to_string(path).unwrap());
settings.add_filter(
r"/.*/typechecker/test_data/inputs/symbol_table",
"[REDACTED]",
);
settings.add_filter(r"module_name: .*.typechecker.test_data.inputs.symbol_table.imports.py",
"module_name: [REDACTED]");
settings.bind(|| {
insta::assert_snapshot!(result);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Symbols:
- Declarations:
--: Alias {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.imports.py",
module_name: [REDACTED]",
node: Node {
start: 83,
end: 82,
Expand Down Expand Up @@ -50,10 +50,10 @@ Symbols:
is_stub_package: false,
import_type: Local,
resolved_paths: [
"/Users/glyphack/Programming/enderpy/typechecker/test_data/inputs/symbol_table/variables.py",
"[REDACTED]/variables.py",
],
search_path: Some(
"/Users/glyphack/Programming/enderpy/typechecker/test_data/inputs/symbol_table",
"[REDACTED]",
),
is_stub_file: false,
is_native_lib: false,
Expand All @@ -73,7 +73,7 @@ Symbols:
}
--: Alias {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.imports.py",
module_name: [REDACTED]",
node: Node {
start: 117,
end: 116,
Expand Down Expand Up @@ -133,7 +133,7 @@ a
- Declarations:
--: Alias {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.imports.py",
module_name: [REDACTED]",
node: Node {
start: 59,
end: 60,
Expand Down Expand Up @@ -172,10 +172,10 @@ a
is_stub_package: false,
import_type: Local,
resolved_paths: [
"/Users/glyphack/Programming/enderpy/typechecker/test_data/inputs/symbol_table/variables.py",
"[REDACTED]/variables.py",
],
search_path: Some(
"/Users/glyphack/Programming/enderpy/typechecker/test_data/inputs/symbol_table",
"[REDACTED]",
),
is_stub_file: false,
is_native_lib: false,
Expand All @@ -197,7 +197,7 @@ import_test
- Declarations:
--: Alias {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.imports.py",
module_name: [REDACTED]",
node: Node {
start: 24,
end: 35,
Expand Down Expand Up @@ -232,10 +232,10 @@ import_test
is_stub_package: false,
import_type: Local,
resolved_paths: [
"/Users/glyphack/Programming/enderpy/typechecker/test_data/inputs/symbol_table/import_test/__init__.py",
"[REDACTED]/import_test/__init__.py",
],
search_path: Some(
"/Users/glyphack/Programming/enderpy/typechecker/test_data/inputs/symbol_table",
"[REDACTED]",
),
is_stub_file: false,
is_native_lib: false,
Expand All @@ -251,15 +251,15 @@ import_test
non_stub_import_result: None,
py_typed_info: None,
package_directory: Some(
"/Users/glyphack/Programming/enderpy/typechecker/test_data/inputs/symbol_table/import_test",
"[REDACTED]/import_test",
),
},
}
join
- Declarations:
--: Alias {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.imports.py",
module_name: [REDACTED]",
node: Node {
start: 140,
end: 144,
Expand Down Expand Up @@ -319,7 +319,7 @@ os.path
- Declarations:
--: Alias {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.imports.py",
module_name: [REDACTED]",
node: Node {
start: 93,
end: 100,
Expand Down Expand Up @@ -375,7 +375,7 @@ variables
- Declarations:
--: Alias {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.imports.py",
module_name: [REDACTED]",
node: Node {
start: 7,
end: 16,
Expand Down Expand Up @@ -410,10 +410,10 @@ variables
is_stub_package: false,
import_type: Local,
resolved_paths: [
"/Users/glyphack/Programming/enderpy/typechecker/test_data/inputs/symbol_table/variables.py",
"[REDACTED]/variables.py",
],
search_path: Some(
"/Users/glyphack/Programming/enderpy/typechecker/test_data/inputs/symbol_table",
"[REDACTED]",
),
is_stub_file: false,
is_native_lib: false,
Expand Down

0 comments on commit 466af13

Please sign in to comment.