File: ConfigSpec.hs

package info (click to toggle)
mighttpd2 4.0.9-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 192 kB
  • sloc: haskell: 1,382; makefile: 4; sh: 3
file content (54 lines) | stat: -rw-r--r-- 1,631 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}

module ConfigSpec where

import Program.Mighty
import Test.Hspec

spec :: Spec
spec = do
    describe "parseConfig" $ do
        it "parses example.conf correctly" $ do
            res <- parseOption "conf/example.conf"
            res{opt_server_name = "foo"} `shouldBe` ans

#ifdef DHALL
    describe "parseDhall" $ do
        it "parses example.dhall correctly" $ do
            res <- parseOptionDhall "./conf/example.dhall"
            res { opt_server_name = "foo" } `shouldBe` ans
#endif

ans :: Option
ans =
    Option
        { opt_port = 80
        , opt_host = "*"
        , opt_debug_mode = True
        , opt_user = "root"
        , opt_group = "root"
        , opt_pid_file = "/var/run/mighty.pid"
        , opt_report_file = "/tmp/mighty_report"
        , opt_logging = True
        , opt_log_file = "/var/log/mighty"
        , opt_log_file_size = 16777216
        , opt_log_backup_number = 10
        , opt_index_file = "index.html"
        , opt_index_cgi = "index.cgi"
        , opt_status_file_dir = "/usr/local/share/mighty/status"
        , opt_connection_timeout = 30
        , opt_proxy_timeout = 0
        , opt_fd_cache_duration = 10
        , opt_service = 0
        , opt_tls_port = 443
        , opt_tls_cert_file = "cert.pem"
        , opt_tls_chain_files = "chain.pem"
        , opt_tls_key_file = "privkey.pem"
        , opt_quic_addr = ["0.0.0.0", "::"]
        , opt_quic_port = 443
        , opt_quic_debug_dir = Nothing
        , opt_quic_qlog_dir = Nothing
        , opt_server_name = "foo"
        , opt_routing_file = Nothing
        }