File: Windows.hs

package info (click to toggle)
haskell-system-fileio 0.3.16.4-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 156 kB
  • sloc: haskell: 1,327; ansic: 155; makefile: 2
file content (66 lines) | stat: -rw-r--r-- 1,631 bytes parent folder | download | duplicates (5)
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
55
56
57
58
59
60
61
62
63
64
65
66
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}

-- Copyright (C) 2011 John Millikin <jmillikin@gmail.com>
--
-- See license.txt for details
module FilesystemTests.Windows
	( suite_Windows
	) where

import           Control.Monad
import           Control.Monad.IO.Class (liftIO)
import           Test.Chell

import           Filesystem
import           Filesystem.Path.CurrentOS

import           FilesystemTests.Util (assertionsWithTemp, todo)

suite_Windows :: Suite
suite_Windows = suite "windows"
	[ todo "isFile"
	, todo "isDirectory"
	, todo "rename"
	, todo "canonicalizePath"
	, todo "createDirectory"
	, todo "createTree"
	, test_ListDirectory
	, todo "removeFile"
	, todo "removeDirectory"
	, todo "removeTree"
	, todo "getWorkingDirectory"
	, todo "setWorkingDirectory"
	, todo "getHomeDirectory"
	, todo "getDesktopDirectory"
	, todo "getDocumentsDirectory"
	, todo "getAppDataDirectory"
	, todo "getAppCacheDirectory"
	, todo "getAppConfigDirectory"
	, todo "copyFile"
	, todo "getModified"
	, todo "getSize"
	, todo "openFile"
	, todo "withFile"
	, todo "readFile"
	, todo "writeFile"
	, todo "appendFile"
	, todo "openTextFile"
	, todo "withTextFile"
	, todo "readTextFile"
	, todo "writeTextFile"
	, todo "appendTextFile"
	]

test_ListDirectory :: Test
test_ListDirectory = assertionsWithTemp "listDirectory" $ \dir -> do
	let paths =
		[ dir </> decode "test.txt"
		, dir </> decode "\12354\946\1076\119070.txt"
		, dir </> decode "\xA1\xA2\xA3.txt"
		]
	
	liftIO $ forM_ paths (\path -> writeTextFile path "")
	
	names <- liftIO $ Filesystem.listDirectory dir
	$expect $ sameItems paths names