servant-foreign: add test for camelCase
This commit is contained in:
parent
6c50beb0f8
commit
aa2b56d08c
3 changed files with 31 additions and 0 deletions
|
@ -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
|
17
servant-foreign/test/Servant/ForeignSpec.hs
Normal file
17
servant-foreign/test/Servant/ForeignSpec.hs
Normal 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"
|
1
servant-foreign/test/Spec.hs
Normal file
1
servant-foreign/test/Spec.hs
Normal file
|
@ -0,0 +1 @@
|
|||
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
|
Loading…
Reference in a new issue