Skip to content

Commit b10ab3b

Browse files
committed
fix: lets try it with unicde normalisaation
1 parent 6fae651 commit b10ab3b

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/pg_typecheck/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ tree_sitter_sql.workspace = true
2525

2626
[dev-dependencies]
2727
pg_test_utils.workspace = true
28+
unicode-normalization = "0.1.24"
2829

2930
[lib]
3031
doctest = false

crates/pg_typecheck/tests/diagnostics.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use pg_diagnostics::PrintDiagnostic;
66
use pg_test_utils::test_database::get_new_test_db;
77
use pg_typecheck::{check_sql, TypecheckParams};
88
use sqlx::Executor;
9+
use unicode_normalization::UnicodeNormalization;
910

1011
async fn test(name: &str, query: &str, setup: &str) {
1112
let test_db = get_new_test_db().await;
@@ -43,16 +44,13 @@ async fn test(name: &str, query: &str, setup: &str) {
4344

4445
let content = String::from_utf8(content).unwrap();
4546

46-
// Normalize line endings
47-
let normalized_content = content.replace("\r\n", "\n");
48-
49-
// Replace Windows-style path separators with forward slashes
50-
let normalized_content = normalized_content.replace("\\", "/");
47+
// Normalize Unicode characters
48+
let normalized = content.nfkd().collect::<String>();
5149

5250
insta::with_settings!({
5351
prepend_module_to_snapshot => false,
5452
}, {
55-
insta::assert_snapshot!(name, normalized_content);
53+
insta::assert_snapshot!(name, normalized);
5654
});
5755
}
5856

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: crates/pg_typecheck/tests/diagnostics.rs
3-
expression: content
3+
expression: normalized
44
snapshot_kind: text
55
---
66
typecheck ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -9,4 +9,4 @@ typecheck ━━━━━━━━━━━━━━━━━━━━━━━
99

1010
<strong><span style="color: Tomato;">✖</span></strong> <span style="color: Tomato;">Error Code: </span><span style="color: Tomato;"><strong>42703</strong></span>
1111

12-
<strong><span style="color: lightgreen;"></span></strong> <span style="color: lightgreen;">Source: </span><span style="color: lightgreen;">parse_relation.c</span><span style="color: lightgreen;">:</span><span style="color: lightgreen;">3716</span><span style="color: lightgreen;"> in </span><span style="color: lightgreen;">errorMissingColumn</span>
12+
<strong><span style="color: lightgreen;">i</span></strong> <span style="color: lightgreen;">Source: </span><span style="color: lightgreen;">parse_relation.c</span><span style="color: lightgreen;">:</span><span style="color: lightgreen;">3716</span><span style="color: lightgreen;"> in </span><span style="color: lightgreen;">errorMissingColumn</span>

0 commit comments

Comments
 (0)