Skip to content

Commit

Permalink
Formatting and tweaks following pull #35
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Dec 23, 2022
1 parent ba5d998 commit cc1545e
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 27 deletions.
2 changes: 1 addition & 1 deletion aeson-typescript.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ test-suite aeson-typescript-tests
other-modules:
Basic
ClosedTypeFamilies
Data.Aeson.TypeScript.LegalNameSpec
Formatting
Generic
HigherKind
LegalNameSpec
NoOmitNothingFields
ObjectWithSingleFieldNoTagSingleConstructors
ObjectWithSingleFieldTagSingleConstructors
Expand Down
10 changes: 5 additions & 5 deletions src/Data/Aeson/TypeScript/LegalName.hs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
-- | This module defines functions which are useful for determining if
-- a given name is a legal JavaScript name according to <https://stackoverflow.com/questions/1661197/what-characters-are-valid-for-javascript-variable-names this post>.
-- a given name is a legal JavaScript name according to
-- <https://stackoverflow.com/questions/1661197/what-characters-are-valid-for-javascript-variable-names this post>.
module Data.Aeson.TypeScript.LegalName where

import qualified Data.Set as Set
import Language.Haskell.TH
import Data.Char
import Data.List.NonEmpty (NonEmpty (..))
import qualified Data.List.NonEmpty as NonEmpty
import Data.Char
import Data.Foldable
import qualified Data.Set as Set


-- | The return type is the illegal characters that are in the name. If the
-- input has no illegal characters, then you have 'Nothing'.
Expand Down
4 changes: 2 additions & 2 deletions src/Data/Aeson/TypeScript/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

module Data.Aeson.TypeScript.Types where

import qualified Data.List.NonEmpty as NonEmpty
import qualified Data.Aeson as A
import Data.Aeson.TypeScript.LegalName
import qualified Data.List.NonEmpty as NonEmpty
import Data.Proxy
import Data.String
import Data.Typeable
import Language.Haskell.TH
import Data.Aeson.TypeScript.LegalName

-- | The typeclass that defines how a type is turned into TypeScript.
--
Expand Down
6 changes: 1 addition & 5 deletions test/Formatting.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,18 @@ module Formatting (tests) where
import Control.Exception
import Data.Aeson (defaultOptions)
import Data.Aeson.TypeScript.TH
import Data.Aeson.TypeScript.Types
import Data.Proxy
import Data.String.Interpolate
import Test.Hspec

data D = S | F deriving (Eq, Show)

data D = S | F deriving (Eq, Show)
$(deriveTypeScript defaultOptions ''D)

data PrimeInType' = PrimeInType

$(deriveTypeScript defaultOptions ''PrimeInType')

data PrimeInConstr = PrimeInConstr'

$(deriveTypeScript defaultOptions ''PrimeInConstr)

tests :: Spec
Expand Down Expand Up @@ -52,4 +49,3 @@ tests = do
evaluate (formatTSDeclarations' defaultFormattingOptions (getTypeScriptDeclarations @PrimeInConstr Proxy))
`shouldThrow`
anyErrorCall

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module Data.Aeson.TypeScript.LegalNameSpec where
module LegalNameSpec where

import Test.Hspec
import Data.List.NonEmpty (NonEmpty (..))
import Data.Aeson.TypeScript.LegalName
import Data.List.NonEmpty (NonEmpty (..))
import Test.Hspec

tests :: Spec
tests = describe "Data.Aeson.TypeScript.LegalName" $ do
Expand Down
22 changes: 11 additions & 11 deletions test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,36 @@ import qualified Generic
import qualified HigherKind
import qualified ClosedTypeFamilies

import qualified LegalNameSpec
import qualified NoOmitNothingFields
import qualified ObjectWithSingleFieldNoTagSingleConstructors
import qualified ObjectWithSingleFieldTagSingleConstructors
import qualified OmitNothingFields
import qualified TaggedObjectNoTagSingleConstructors
import qualified TaggedObjectTagSingleConstructors
import qualified TwoElemArrayNoTagSingleConstructors
import qualified TwoElemArrayTagSingleConstructors
import qualified UntaggedNoTagSingleConstructors
import qualified UntaggedTagSingleConstructors
import qualified OmitNothingFields
import qualified NoOmitNothingFields
import qualified UnwrapUnaryRecords
import qualified Data.Aeson.TypeScript.LegalNameSpec as LegalNameSpec


main :: IO ()
main = hspec $ parallel $ do
ClosedTypeFamilies.tests
Formatting.tests
Generic.tests
HigherKind.tests
ClosedTypeFamilies.tests
LegalNameSpec.tests

ObjectWithSingleFieldTagSingleConstructors.tests
LegalNameSpec.tests
NoOmitNothingFields.allTests
ObjectWithSingleFieldNoTagSingleConstructors.tests
TaggedObjectTagSingleConstructors.tests
ObjectWithSingleFieldTagSingleConstructors.tests
OmitNothingFields.tests
TaggedObjectNoTagSingleConstructors.tests
TwoElemArrayTagSingleConstructors.tests
TaggedObjectTagSingleConstructors.tests
TwoElemArrayNoTagSingleConstructors.tests
UntaggedTagSingleConstructors.tests
TwoElemArrayTagSingleConstructors.tests
UntaggedNoTagSingleConstructors.tests
OmitNothingFields.tests
NoOmitNothingFields.allTests
UntaggedTagSingleConstructors.tests
UnwrapUnaryRecords.allTests

0 comments on commit cc1545e

Please sign in to comment.