servant-foreign: add test for camelCase

This commit is contained in:
Matt Bray 2015-11-04 11:16:14 +00:00
parent 6c50beb0f8
commit aa2b56d08c
3 changed files with 31 additions and 0 deletions

View File

@ -33,3 +33,16 @@ library
hs-source-dirs: src
default-language: Haskell2010
ghc-options: -Wall
test-suite spec
type: exitcode-stdio-1.0
hs-source-dirs: test
ghc-options: -Wall
main-is: Spec.hs
other-modules:
Servant.ForeignSpec
build-depends: base
, hspec >= 2.1.8
, servant-foreign
default-language: Haskell2010

View File

@ -0,0 +1,17 @@
{-# LANGUAGE OverloadedStrings #-}
module Servant.ForeignSpec where
import Servant.Foreign (camelCase)
import Test.Hspec
spec :: Spec
spec = describe "Servant.Foreign" $ do
camelCaseSpec
camelCaseSpec :: Spec
camelCaseSpec = describe "camelCase" $ do
it "converts FunctionNames to camelCase" $ do
camelCase ["post", "counter", "inc"] `shouldBe` "postCounterInc"
camelCase ["get", "hyphen-ated", "counter"] `shouldBe` "getHyphenatedCounter"

View File

@ -0,0 +1 @@
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}