Fossil SCM

fossil-scm / test / contains-selector.test
Blame History Raw 56 lines
1
#
2
# Copyright (c) 2015 D. Richard Hipp
3
#
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the Simplified BSD License (also
6
# known as the "2-Clause License" or "FreeBSD License".)
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but without any warranty; without even the implied warranty of
10
# merchantability or fitness for a particular purpose.
11
#
12
# Author contact information:
13
# [email protected]
14
# http://www.hwaci.com/drh/
15
#
16
############################################################################
17
#
18
# Test containsSelector() function in src/style.c
19
#
20
21
test_setup ""
22
23
proc contains-selector {testId css selectorResultMap} {
24
set css [string trim $css]
25
set filename [file join $::tempPath compare-selector.css]
26
set fh [open $filename w]
27
puts -nonewline $fh $css
28
close $fh
29
foreach {selector found} $selectorResultMap {
30
set expected "$selector [expr {$found ? "found" : "not found"}]"
31
set result [fossil test-contains-selector $filename $selector]
32
test "contains-selector $testId $selector" {$result eq $expected}
33
}
34
file delete $filename
35
}
36
37
contains-selector 1 {
38
.a.b {}
39
.c .de {}
40
/* comment */
41
.c .d, .e /* comment */ {}
42
} {
43
.a 0
44
.b 0
45
.a.b 1
46
.c 0
47
.d 0
48
{.c.d} 0
49
{.c .d} 1
50
.e 1
51
}
52
53
###############################################################################
54
55
test_cleanup
56

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button