Skip to content

testReadingLine doesn't work #8

Open
@danpalmer

Description

@danpalmer

Either that, or I'm just getting it completely wrong.

I fill out the getChar koan, then the prompt asks me for "a", which I give it, but then it fails immediately even once I've filled out the getLine koan. I assume that once the first is passing, it should be prompting me to enter "burrito", but instead it just fails.

testReadingChar :: Spec
testReadingChar = it "getChar" $ do
  putStrLn "Write: \"a\" to pass this test: "
  -- NOTE: replace 'failIO' with the actual function
  result <- getChar
  assertEqual ""
              'a'
              result

testReadingLine :: Spec
testReadingLine = it "getLine" $ do
    -- NOTE: replace 'failIO' with the actual function
    result <- getLine
    assertEqual "Write: \"burrito\" to pass this test"
                "burrito"
                result

That's my solution, the output from the console is:

BasicIO
Write: "a" to pass this test: 
a
  - getChar
  - getLine FAILED [1]

1) BasicIO getLine
Write: "burrito" to pass this test
expected: "burrito"
 but got: ""

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions