Sha256: 65f488d26f75c7a94064bb3f534a3b1d63c932659cd120addc427570bb6d4803

Contents?: true

Size: 1.7 KB

Versions: 110

Compression:

Stored size: 1.7 KB

Contents

{-# LANGUAGE RecordWildCards #-}

import Data.Foldable     (for_)
import Test.Hspec        (Spec, describe, it, shouldBe)
import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)

import Acronym (abbreviate)

main :: IO ()
main = hspecWith defaultConfig {configFastFail = True} specs

specs :: Spec
specs = describe "abbreviate" $ for_ cases test
  where
    test Case {..} = it description $ abbreviate input `shouldBe` expected

data Case = Case { description :: String
                 , input       :: String
                 , expected    :: String
                 }

cases :: [Case]
cases = [ Case { description = "basic"
               , input       = "Portable Network Graphics"
               , expected    = "PNG"
               }
        , Case { description = "lowercase words"
               , input       = "Ruby on Rails"
               , expected    = "ROR"
               }
        , Case { description = "camelcase"
               , input       = "HyperText Markup Language"
               , expected    = "HTML"
               }
        , Case { description = "punctuation"
               , input       = "First In, First Out"
               , expected    = "FIFO"
               }
        , Case { description = "all caps words"
               , input       = "PHP: Hypertext Preprocessor"
               , expected    = "PHP"
               }
        , Case { description = "non-acronym all caps word"
               , input       = "GNU Image Manipulation Program"
               , expected    = "GIMP"
               }
        , Case { description = "hyphenated"
               , input       = "Complementary metal-oxide semiconductor"
               , expected    = "CMOS"
               }
        ]

Version data entries

110 entries across 110 versions & 1 rubygems

Version Path
trackler-2.2.1.59 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.58 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.57 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.56 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.55 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.54 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.53 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.52 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.51 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.50 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.49 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.48 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.47 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.46 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.45 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.44 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.43 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.42 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.41 tracks/haskell/exercises/acronym/test/Tests.hs
trackler-2.2.1.40 tracks/haskell/exercises/acronym/test/Tests.hs