-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The object is printed by main and has a default port of 6667. In order to create a server with a new port you must do the following: ```haskell myServer = server{ port = 6665 } ``` issue #3 Amos & Dave
- Loading branch information
Showing
4 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module ServerSpec ( spec ) where | ||
import Helper | ||
import Server | ||
|
||
spec :: Spec | ||
spec = do | ||
describe "The Server" $ do | ||
describe "default port" $ do | ||
it "is 6667" $ do | ||
let testObject = server | ||
(port testObject) `shouldBe` 6667 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import Helper | ||
import qualified SimpleSpec | ||
import qualified ServerSpec | ||
|
||
main :: IO () | ||
main = hspec $ do | ||
SimpleSpec.spec | ||
ServerSpec.spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Main(main) where | ||
|
||
import Server | ||
|
||
main :: IO () | ||
main = do | ||
let myServer = server | ||
print $ show myServer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
main :: IO () | ||
main = putStrLn "Hello, World!" | ||
module Server ( Server, port, server ) where | ||
|
||
type Port = Int | ||
|
||
defaultPort :: Port | ||
defaultPort = 6667 | ||
|
||
data Server = Server { | ||
port :: Port | ||
} deriving ( Show ) | ||
|
||
server :: Server | ||
server = Server{ port=defaultPort } |