cabal-version: 2.4
name: oughta
version: 0.1.0.0
author: Galois, Inc.
maintainer: grease@galois.com
copyright: Galois, Inc. 2025
license: BSD-3-Clause
license-file: LICENSE
synopsis: A library to test programs that output text.
description:
  A library to test programs that output text.

  See the README for details.
extra-doc-files:
  README.md
  CHANGELOG.md
extra-source-files:
  src/Oughta/oughta.lua
  test-data/**/*.txt
  test/test.lua
category: Testing

source-repository head
  type: git
  location: https://github.com/GaloisInc/oughta

common shared
  default-language: GHC2021
  build-depends: base >= 4.19 && < 5

  -- Specifying -Wall and -Werror can cause the project to fail to build on
  -- newer versions of GHC simply due to new warnings being added to -Wall. To
  -- prevent this from happening we manually list which warnings should be
  -- considered errors. We also list some warnings that are not in -Wall, though
  -- try to avoid "opinionated" warnings (though this judgement is clearly
  -- subjective).
  --
  -- Warnings are grouped by the GHC version that introduced them, and then
  -- alphabetically.
  --
  -- A list of warnings and the GHC version in which they were introduced is
  -- available here:
  -- https://ghc.gitlab.haskell.org/ghc/doc/users_guide/using-warnings.html

  -- Since GHC 9.6 or earlier:
  ghc-options:
    -Wall
    -Werror=ambiguous-fields
    -Werror=deferred-type-errors
    -Werror=deprecated-flags
    -Werror=deprecations
    -Werror=deriving-defaults
    -Werror=deriving-typeable
    -Werror=dodgy-foreign-imports
    -Werror=duplicate-exports
    -Werror=empty-enumerations
    -Werror=gadt-mono-local-binds
    -Werror=identities
    -Werror=inaccessible-code
    -Werror=incomplete-patterns
    -Werror=incomplete-record-updates
    -Werror=incomplete-uni-patterns
    -Werror=inline-rule-shadowing
    -Werror=misplaced-pragmas
    -Werror=missed-extra-shared-lib
    -Werror=missing-exported-signatures
    -Werror=missing-fields
    -Werror=missing-home-modules
    -Werror=missing-methods
    -Werror=missing-pattern-synonym-signatures
    -Werror=missing-signatures
    -Werror=name-shadowing
    -Werror=noncanonical-monad-instances
    -Werror=noncanonical-monoid-instances
    -Werror=operator-whitespace
    -Werror=operator-whitespace-ext-conflict
    -Werror=orphans
    -Werror=overflowed-literals
    -Werror=overlapping-patterns
    -Werror=partial-fields
    -Werror=partial-type-signatures
    -Werror=redundant-bang-patterns
    -Werror=redundant-record-wildcards
    -Werror=redundant-strictness-flags
    -Werror=simplifiable-class-constraints
    -Werror=star-binder
    -Werror=star-is-type
    -Werror=tabs
    -Werror=type-defaults
    -Werror=typed-holes
    -Werror=type-equality-out-of-scope
    -Werror=type-equality-requires-operators
    -Werror=unicode-bidirectional-format-characters
    -Werror=unrecognised-pragmas
    -Werror=unrecognised-warning-flags
    -Werror=unsupported-calling-conventions
    -Werror=unsupported-llvm-version
    -Werror=unticked-promoted-constructors
    -Werror=unused-do-bind
    -Werror=unused-imports
    -Werror=unused-record-wildcards
    -Werror=warnings-deprecations
    -Werror=wrong-do-bind

  if impl(ghc < 9.8)
    ghc-options:
      -Werror=forall-identifier

  if impl(ghc < 9.12)
    ghc-options:
      -Werror=compat-unqualified-imports

  if impl(ghc >= 9.8)
    ghc-options:
      -Werror=incomplete-export-warnings
      -Werror=inconsistent-flags
      -Werror=missing-poly-kind-signatures

  if impl(ghc >= 9.10)
    ghc-options:
      -Werror=badly-staged-types
      -Werror=data-kinds-tc
      -Werror=deprecated-type-abstractions
      -Werror=incomplete-record-selectors

  if impl(ghc >= 9.12)
    ghc-options:
      -Werror=view-pattern-signatures

library
  import: shared
  hs-source-dirs: src
  -- We do not provide bounds on "boot libraries", as they are bundled with GHC,
  -- and hence their version is implied by the version of `base`.
  build-depends:
    bytestring,
    containers,
    exceptions >= 0.10 && < 0.11,
    file-embed >= 0.0.16 && < 0.1,
    hslua >= 2.3 && < 2.4,
    text,

  exposed-modules:
    Oughta
  other-modules:
    Oughta.Exception
    Oughta.Extract
    Oughta.Lua
    Oughta.LuaApi
    Oughta.Pos
    Oughta.Result
    Oughta.Traceback

test-suite oughta-tests
  import: shared
  type: exitcode-stdio-1.0
  hs-source-dirs: test
  main-is: Test.hs
  build-depends:
    oughta
  build-depends:
    bytestring,
    directory,
    file-embed,
    filepath,
    tasty,
    tasty-hunit,
    text,