File: __driver__.lua

package info (click to toggle)
monotone 1.1-9
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 20,984 kB
  • ctags: 8,622
  • sloc: cpp: 86,450; sh: 6,906; perl: 924; makefile: 813; python: 517; lisp: 379; sql: 118; exp: 91; ansic: 52
file content (56 lines) | stat: -rw-r--r-- 1,699 bytes parent folder | download | duplicates (4)
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

mtn_setup()

--
-- check set_db_variable
--

check(mtn("automate", "set_db_variable", "domain1", "var", "value"), 0, false, false);
check(mtn("automate", "set_db_variable", "domain2", "var", "value"), 0, false, false);
-- too many arguments
check(mtn("automate", "set_db_variable", "domain1", "var", "new_value", "junk"), 1, false, false);
-- too few arguments
check(mtn("automate", "set_db_variable", "domain1", "other_var"), 1, false, false);



--
-- check get_db_variables
--

writefile("expected1",
	  'domain "database"\n' ..
          ' entry "known-workspaces" "' .. test.root:gsub('\\', '/') .. '\n"\n\n' ..
          'domain "domain1"\n' ..
          ' entry "other_var" "value"\n' ..
          ' entry "var" "value"\n\n' ..
          'domain "domain2"\n' ..
          ' entry "var" "value"\n')

writefile("expected2",
          'domain "domain2"\n' ..
          ' entry "var" "value"\n')

check(mtn("automate", "set_db_variable", "domain1", "other_var", "value"), 0, false, false);

check(mtn("automate", "get_db_variables"), 0, true, false)
check(samefile("expected1", "stdout"))

check(mtn("automate", "get_db_variables", "domain2"), 0, true, false)
check(samefile("expected2", "stdout"))

check(mtn("automate", "get_db_variables", "unknown_domain"), 1, false, false)


--
-- check drop_db_variables
--

check(mtn("automate", "drop_db_variables", "domain1", "var"), 0, false, false);
-- already dropped
check(mtn("automate", "drop_db_variables", "domain1", "var"), 1, false, false);
-- drops vars from domain2
check(mtn("automate", "drop_db_variables", "domain2"), 0, false, false);
-- otherwise unknown domain
check(mtn("automate", "drop_db_variables", "domain2"), 1, false, false);