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 d436757
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 31 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"] }
8 changes: 8 additions & 0 deletions typechecker/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ mod tests {
let mut settings = insta::Settings::clone_current();
settings.set_snapshot_path("../testdata/output/");
settings.set_description(contents);
settings.add_filter(r"module_name: .*.typechecker.test_data.inputs.symbol_table..*.py",
"module_name: [REDACTED]");
settings.bind(|| {
insta::assert_snapshot!(result);
});
Expand Down Expand Up @@ -441,6 +443,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..*.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 @@ c
- Declarations:
--: Class {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.class_definition.py",
module_name: [REDACTED]",
node: Node {
start: 0,
end: 47,
Expand All @@ -28,7 +28,7 @@ a
- Declarations:
--: Variable {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.class_definition.py",
module_name: [REDACTED]",
node: Node {
start: 41,
end: 46,
Expand All @@ -53,7 +53,7 @@ self
- Declarations:
--: Paramter {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.class_definition.py",
module_name: [REDACTED]",
node: Node {
start: 26,
end: 30,
Expand All @@ -76,7 +76,7 @@ __init__
- Declarations:
--: Function {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.class_definition.py",
module_name: [REDACTED]",
node: Node {
start: 13,
end: 47,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func
- Declarations:
--: Function {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.function_definition.py",
module_name: [REDACTED]",
node: Node {
start: 0,
end: 37,
Expand Down Expand Up @@ -108,7 +108,7 @@ a
- Declarations:
--: Paramter {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.function_definition.py",
module_name: [REDACTED]",
node: Node {
start: 9,
end: 10,
Expand All @@ -129,7 +129,7 @@ b
- Declarations:
--: Paramter {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.function_definition.py",
module_name: [REDACTED]",
node: Node {
start: 12,
end: 13,
Expand All @@ -150,7 +150,7 @@ c
- Declarations:
--: Paramter {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.function_definition.py",
module_name: [REDACTED]",
node: Node {
start: 19,
end: 24,
Expand Down Expand Up @@ -181,7 +181,7 @@ e
- Declarations:
--: Paramter {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.function_definition.py",
module_name: [REDACTED]",
node: Node {
start: 28,
end: 29,
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ a
- Declarations:
--: Variable {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.simple_var_assignment.py",
module_name: [REDACTED]",
node: Node {
start: 0,
end: 17,
Expand All @@ -36,7 +36,7 @@ b
- Declarations:
--: Variable {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.simple_var_assignment.py",
module_name: [REDACTED]",
node: Node {
start: 18,
end: 29,
Expand Down Expand Up @@ -79,7 +79,7 @@ c
- Declarations:
--: Variable {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.simple_var_assignment.py",
module_name: [REDACTED]",
node: Node {
start: 31,
end: 41,
Expand Down Expand Up @@ -114,7 +114,7 @@ f
- Declarations:
--: Variable {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.simple_var_assignment.py",
module_name: [REDACTED]",
node: Node {
start: 43,
end: 59,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ a
- Declarations:
--: Variable {
declaration_path: DeclarationPath {
module_name: ".Users.glyphack.Programming.enderpy.typechecker.test_data.inputs.symbol_table.variables.py",
module_name: [REDACTED]",
node: Node {
start: 0,
end: 5,
Expand Down

0 comments on commit d436757

Please sign in to comment.