From 74fe249372da64659e722da534ff700e58fe6777 Mon Sep 17 00:00:00 2001 From: Don Stewart Date: Mon, 10 Mar 2008 19:25:57 +0100 Subject: add property for ensureTags behaviour on hidden workspaces darcs-hash:20080310182557-cba2c-9e539e452dbcb111fc47098dd762811c8334d4d8 --- tests/Properties.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') diff --git a/tests/Properties.hs b/tests/Properties.hs index f8f0684..6135792 100644 --- a/tests/Properties.hs +++ b/tests/Properties.hs @@ -622,9 +622,26 @@ prop_rename1 (x::T) o n = o `tagMember` x && not (n `tagMember` x) ==> let y = renameTag o n x in n `tagMember` y +-- | +-- Ensure that a given set of workspace tags is present by renaming +-- existing workspaces and\/or creating new hidden workspaces as +-- necessary. +-- prop_ensure (x :: T) l xs = let y = ensureTags l xs x in and [ n `tagMember` y | n <- xs ] +-- adding a tag should create a new hidden workspace +prop_ensure_append (x :: T) l n = + not (n `tagMember` x) + ==> + (hidden y /= hidden x -- doesn't append, renames + && + and [ isNothing (stack z) && layout z == l | z <- hidden y, tag z == n ] + ) + where + y = ensureTags l (n:ts) x + ts = [ tag z | z <- workspaces x ] + prop_mapWorkspaceId (x::T) = x == mapWorkspace id x prop_mapWorkspaceInverse (x::T) = x == mapWorkspace predTag (mapWorkspace succTag x) @@ -777,6 +794,7 @@ main = do ,("screens works", mytest prop_screens_works) ,("renaming works", mytest prop_rename1) ,("ensure works", mytest prop_ensure) + ,("ensure hidden semantics", mytest prop_ensure_append) ,("mapWorkspace id", mytest prop_mapWorkspaceId) ,("mapWorkspace inverse", mytest prop_mapWorkspaceInverse) -- cgit v1.2.3