Skip to content

Commit

Permalink
Remove full path from diagnostic messages in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Glyphack committed Oct 1, 2023
1 parent 8429113 commit 57d7432
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions parser/src/parser/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3686,7 +3686,7 @@ class a: pass",
fn test_complete() {
glob!("../../test_data", "inputs/*.py", |path| {
let test_case = fs::read_to_string(path).unwrap();
let mut parser = Parser::new(test_case.clone(), String::from(path.to_str().unwrap_or("")));
let mut parser = Parser::new(test_case.clone(), String::from(path.file_name().unwrap().to_str().unwrap()));
let program = parser.parse();

insta::with_settings!({
Expand All @@ -3712,7 +3712,7 @@ class a: pass",
glob!("../../test_data", "inputs/one_liners/*.py", |path| {
let input = fs::read_to_string(path).unwrap();
for test_case in input.split("\n\n") {
let mut parser = Parser::new(test_case.to_string(), String::from(path.to_str().unwrap_or("")));
let mut parser = Parser::new(test_case.to_string(), String::from(path.file_name().unwrap().to_str().unwrap()));
let program = parser.parse();

insta::with_settings!({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ input_file: parser/test_data/inputs/separate_statements.py
---
[
InvalidSyntax {
path: "/Users/glyphack/Programming/enderpy/parser/test_data/inputs/separate_statements.py",
path: "separate_statements.py",
msg: "Statement does not end in new line or semicolon",
line: 8,
input: " x = 1",
Expand All @@ -16,7 +16,7 @@ input_file: parser/test_data/inputs/separate_statements.py
),
},
InvalidSyntax {
path: "/Users/glyphack/Programming/enderpy/parser/test_data/inputs/separate_statements.py",
path: "separate_statements.py",
msg: "Statement does not end in new line or semicolon",
line: 11,
input: "a = 1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ input_file: parser/test_data/inputs/one_liners/from_import.py
---
[
InvalidSyntax {
path: "/Users/glyphack/Programming/enderpy/parser/test_data/inputs/one_liners/from_import.py",
path: "from_import.py",
msg: "Expected one of \"Identifier, Mul, \" but found Eof",
line: 16,
input: "",
Expand Down

0 comments on commit 57d7432

Please sign in to comment.