@@ -23,6 +23,11 @@ import Data.Int
2323import qualified Data.Map as Map
2424#endif
2525
26+roundTripCaml :: String -> Bool
27+roundTripCaml s = s == (camlFrom '_' $ camlTo '_' s)
28+ where
29+ camlFrom :: Char -> String -> String
30+ camlFrom c = concatMap capitalize $ split c
2631
2732encodeDouble :: Double -> Double -> Bool
2833encodeDouble num denom
@@ -102,6 +107,10 @@ tests = [
102107 testProperty "encodeDouble" encodeDouble
103108 , testProperty "encodeInteger" encodeInteger
104109 ],
110+ testGroup "camlCase" [
111+ testProperty "camlTo" $ roundTripCaml "AnApiMethod"
112+ , testProperty "camlTo" $ roundTripCaml "anotherMethodType"
113+ ],
105114 testGroup "roundTrip" [
106115 testProperty "Bool" $ roundTripEq True
107116 , testProperty "Double" $ roundTripEq (1 :: Approx Double)