Skip to content

Commit 0a0db02

Browse files
committed
fix: treat INTEGER and INT as one spelling in tree comparison
1 parent 7cc3a21 commit 0a0db02

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

‎crates/sqlquack-core/src/comparison/constants.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ pub const SPELLING_ONLY_FIELDS: &[SpellingOnlyField] = &[
4949
matching: FieldMatch::Exact,
5050
reason: "the node kind fixes the function; this keeps only the alias it was written with",
5151
},
52+
SpellingOnlyField {
53+
name: "integer_spelling",
54+
matching: FieldMatch::Exact,
55+
reason: "`INTEGER` and `INT` are the same type",
56+
},
5257
];
5358

5459
/// Values rewritten to one spelling in both trees before comparison.

‎crates/sqlquack-core/src/comparison/tests/test_compare_trees.rs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ fn given_spellings_differing_only_in_a_declared_field_when_comparing_then_trees_
8484
expected_field_present: true,
8585
expected_difference_path: None,
8686
},
87+
SpellingTestCase {
88+
description: "INTEGER and INT",
89+
field: "integer_spelling",
90+
left: "SELECT quantity::INTEGER FROM inventory",
91+
right: "SELECT quantity::INT FROM inventory",
92+
expected_raw_trees_equal: false,
93+
expected_field_present: true,
94+
expected_difference_path: None,
95+
},
8796
SpellingTestCase {
8897
description: "the letter case of a generic function name",
8998
field: "name",
@@ -142,6 +151,7 @@ fn given_declared_spelling_only_fields_when_listing_tests_then_each_field_has_on
142151
"use_inner_keyword",
143152
"use_outer_keyword",
144153
"original_name",
154+
"integer_spelling",
145155
],
146156
expected_untested_fields: Vec::new(),
147157
}];

0 commit comments

Comments
 (0)