File: regex.svtest

package info (click to toggle)
dovecot 1%3A1.2.15-7%2Bdeb6u1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-lts
  • size: 30,340 kB
  • ctags: 20,012
  • sloc: ansic: 191,443; sh: 21,091; makefile: 3,330; cpp: 526; perl: 108; xml: 44
file content (34 lines) | stat: -rw-r--r-- 934 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
require "vnd.dovecot.testsuite";

require "regex";
require "variables";

# Test overwriting only on match
test "RFC - values overwrite" {
	set "sentence1" "the cat jumps off the table";
	set "sentence2" "the dog barks at the cat in the alley";

	if not string :regex "${sentence1}" "the (.*) jumps off the (.*)" {
		test_fail "failed to match first sentence";
	}

	if not string :is "${1}:${2}" "cat:table" {
		test_fail "invalid match values";
	}

	if string :regex "${sentence2}" "the (.*) barks at the (.*) in the store" {
		test_fail "should not have matched second sentence";
	}

	if not string :is "${1}:${2}" "cat:table" {
		test_fail "should have preserved match values";
	}

	if not string :regex "${sentence2}" "the (.*) barks at the (.*) in the alley" {
		test_fail "failed to match the second sentence (second time)";
	}

	if not string :is "${1}:${2}" "dog:cat" {
		test_fail "should have overwritten match values";
	}
}