git.iko.soy/typeable/servant
on master help sign in
servant-foreign: add test for camelCase
commitaa2b56d08c982f713820ecaad3658b949ea9c48b authorMatt Bray <mattjbray@gmail.com> dateWed 4 Nov 2015, 11:16 (11 years ago) parent6c50beb
3 files changed+31
servant-foreign/servant-foreign.cabal+13 servant-foreign/test/Servant/ForeignSpec.hs+17 servant-foreign/test/Spec.hs+1
servant-foreign/servant-foreign.cabal+13
@@ -33,3 +33,16 @@ library
3333 hs-source-dirs: src
3434 default-language: Haskell2010
3535 ghc-options: -Wall
36+
37+
38+test-suite spec
39+ type: exitcode-stdio-1.0
40+ hs-source-dirs: test
41+ ghc-options: -Wall
42+ main-is: Spec.hs
43+ other-modules:
44+ Servant.ForeignSpec
45+ build-depends: base
46+ , hspec >= 2.1.8
47+ , servant-foreign
48+ default-language: Haskell2010
servant-foreign/test/Servant/ForeignSpec.hsnew file+17
@@ -0,0 +1,17 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+
3+module Servant.ForeignSpec where
4+
5+import Servant.Foreign (camelCase)
6+
7+import Test.Hspec
8+
9+spec :: Spec
10+spec = describe "Servant.Foreign" $ do
11+ camelCaseSpec
12+
13+camelCaseSpec :: Spec
14+camelCaseSpec = describe "camelCase" $ do
15+ it "converts FunctionNames to camelCase" $ do
16+ camelCase ["post", "counter", "inc"] `shouldBe` "postCounterInc"
17+ camelCase ["get", "hyphen-ated", "counter"] `shouldBe` "getHyphenatedCounter"
servant-foreign/test/Spec.hsnew file+1
@@ -0,0 +1 @@
1+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}