@@ -24,19 +24,29 @@ test_that("case conversions preserve names", {
2424
2525test_that(" to_camel can control case of first argument" , {
2626 expect_equal(str_to_camel(" my_variable" ), " myVariable" )
27+ expect_equal(str_to_camel(" my$variable" ), " myVariable" )
28+ expect_equal(str_to_camel(" my variable " ), " myVariable" )
2729 expect_equal(str_to_camel(" my_variable" , first_upper = TRUE ), " MyVariable" )
2830})
2931
3032test_that(" to_kebab converts to kebab case" , {
3133 expect_equal(str_to_kebab(" myVariable" ), " my-variable" )
3234 expect_equal(str_to_kebab(" MyVariable" ), " my-variable" )
33- expect_equal(str_to_kebab(" MyVariable1" ), " my-variable-1" )
35+ expect_equal(str_to_kebab(" 1MyVariable1" ), " 1-my-variable-1" )
36+ expect_equal(str_to_kebab(" My$Variable" ), " my-variable" )
37+ expect_equal(str_to_kebab(" My Variable " ), " my-variable" )
38+ expect_equal(str_to_kebab(" testABCTest" ), " test-abc-test" )
39+ expect_equal(str_to_kebab(" IlÉtaitUneFois" ), " il-était-une-fois" )
3440})
3541
3642test_that(" to_snake converts to snake case" , {
3743 expect_equal(str_to_snake(" myVariable" ), " my_variable" )
3844 expect_equal(str_to_snake(" MyVariable" ), " my_variable" )
39- expect_equal(str_to_snake(" MyVariable1" ), " my_variable_1" )
45+ expect_equal(str_to_snake(" 1MyVariable1" ), " 1_my_variable_1" )
46+ expect_equal(str_to_snake(" My$Variable" ), " my_variable" )
47+ expect_equal(str_to_snake(" My Variable " ), " my_variable" )
48+ expect_equal(str_to_snake(" testABCTest" ), " test_abc_test" )
49+ expect_equal(str_to_snake(" IlÉtaitUneFois" ), " il_était_une_fois" )
4050})
4151
4252test_that(" to_words handles common compound cases" , {
0 commit comments