File: test-wildcards.py

package info (click to toggle)
libfiu 1.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 768 kB
  • sloc: ansic: 2,633; python: 973; makefile: 599; sh: 309
file content (46 lines) | stat: -rw-r--r-- 795 bytes parent folder | download | duplicates (2)
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
"""
Test the behaviour of the wildcard failure points.
"""

import fiu

fiu.enable("a:b:c")
assert fiu.fail("a:b:c")

fiu.enable("a:b:*")
assert fiu.fail("a:b:c")
assert fiu.fail("a:b:x")
assert fiu.fail("a:b:c:d")

fiu.enable("a:b:*")  # Test repeated enabling of a wildcard.

fiu.enable("a:b:c:d")
assert fiu.fail("a:b:c:d")

fiu.disable("a:b:c")
assert fiu.fail("a:b:c")

fiu.disable("a:b:*")
assert not fiu.fail("a:b:c")
assert not fiu.fail("a:b:x")
assert fiu.fail("a:b:c:d")

fiu.disable("a:b:c:d")
assert not fiu.fail("a:b:c:d")


s = "x"
for i in range(200):
    fiu.enable(s + "/*")
    s += "/x"

s = "x"
for i in range(200):
    assert fiu.fail(s + "/asdf")
    fiu.disable(s + "/*")
    s += "/x"

fiu.enable("*")
assert fiu.fail("asdf")
fiu.disable("*")
assert not fiu.fail("asdf")