From 57d743287707b3b69a25897ca68c11a50417204a Mon Sep 17 00:00:00 2001 From: Glyphack Date: Sun, 1 Oct 2023 23:22:01 +0200 Subject: [PATCH] Remove full path from diagnostic messages in tests --- parser/src/parser/parser.rs | 4 ++-- ...ser__parser__tests__complete@separate_statements.py-2.snap | 4 ++-- ...r__parser__parser__tests__one_liners@from_import.py-2.snap | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/parser/src/parser/parser.rs b/parser/src/parser/parser.rs index 4aaf0187..e3d1514e 100644 --- a/parser/src/parser/parser.rs +++ b/parser/src/parser/parser.rs @@ -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!({ @@ -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!({ diff --git a/parser/src/parser/snapshots/enderpy_python_parser__parser__parser__tests__complete@separate_statements.py-2.snap b/parser/src/parser/snapshots/enderpy_python_parser__parser__parser__tests__complete@separate_statements.py-2.snap index ef246509..1fb4aed7 100644 --- a/parser/src/parser/snapshots/enderpy_python_parser__parser__parser__tests__complete@separate_statements.py-2.snap +++ b/parser/src/parser/snapshots/enderpy_python_parser__parser__parser__tests__complete@separate_statements.py-2.snap @@ -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", @@ -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", diff --git a/parser/src/parser/snapshots/enderpy_python_parser__parser__parser__tests__one_liners@from_import.py-2.snap b/parser/src/parser/snapshots/enderpy_python_parser__parser__parser__tests__one_liners@from_import.py-2.snap index e0a564b0..31f103a4 100644 --- a/parser/src/parser/snapshots/enderpy_python_parser__parser__parser__tests__one_liners@from_import.py-2.snap +++ b/parser/src/parser/snapshots/enderpy_python_parser__parser__parser__tests__one_liners@from_import.py-2.snap @@ -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: "",