Skip to content

Commit

Permalink
Lowercase before snake-casing for conformance test string escaping.
Browse files Browse the repository at this point in the history
Replace names like: strict_example_7_nu_l_l_and_missin_g_coercion_1
              with: strict_example_7_null_and_missing_coercion_1
  • Loading branch information
jpschorr committed Oct 22, 2024
1 parent 3f9d17f commit c650920
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions partiql-conformance-test-generator/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ fn escape_str(s: &str) -> String {
match s.chars().next() {
None => "_".to_string(),
Some(c) => {
let snake_case = s.to_lowercase().to_snake_case();
if c.is_numeric() {
format!("_{}", s.to_snake_case())
format!("_{}", snake_case)
} else {
s.to_snake_case()
snake_case
}
}
}
Expand Down Expand Up @@ -86,4 +87,12 @@ mod test {
"r#a_b_c_1_2_3_e_f_g"
);
}

#[test]
fn snake_case_uppercase_names() {
assert_eq!(
"Example 7 — NULL and MISSING Coercion - 1".escape_path(),
"example_7_null_and_missing_coercion_1"
);
}
}

0 comments on commit c650920

Please sign in to comment.