File: TerminalTest.hs

package info (click to toggle)
haskell-hunit 1.3.1.2-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 176 kB
  • ctags: 1
  • sloc: haskell: 721; makefile: 3
file content (23 lines) | stat: -rw-r--r-- 711 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- TerminalTest.hs

module TerminalTest (terminalTests) where

import Test.HUnit.Terminal
import Test.HUnit

try :: String -> String -> String -> Test
try lab inp exp' = lab ~: terminalAppearance inp ~?= exp'

terminalTests :: Test
terminalTests = test [
    try "empty" "" "",
    try "end in \\n" "abc\ndef\n" "abc\ndef\n",
    try "not end in \\n" "abc\ndef" "abc\ndef",
    try "return 1" "abc\ndefgh\rxyz" "abc\nxyzgh",
    try "return 2" "\nabcdefgh\rijklm\rxy\n" "\nxyklmfgh\n",
    try "return 3" "\r\rabc\r\rdef\r\r\r\nghi\r\r\n" "def\nghi\n",
    try "back 1" "abc\bdef\b\bgh\b" "abdgh",
    try "back 2" "abc\b\b\bdef\b\bxy\b\b\n" "dxy\n"
    -- \b at beginning of line
    -- nonprinting char
    ]