File: test_utils_inventory.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 (65 lines) | stat: -rw-r--r-- 2,209 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
57
58
59
60
61
62
63
64
65
-- Functions useful in tests/automate_inventory*
-- uses basic_io.lua

function xfail_inventory (parsed, parsed_index, stanza)
   return check_inventory(parsed, parsed_index, stanza, true)
end

function check_inventory (parsed, parsed_index, stanza, xfail)
-- 'stanza' is a table for one stanza
-- 'parsed_index' gives the first index for this stanza in 'parsed'
-- (which should be the output of parse_basic_io).
-- Compare 'stanza' to 'parsed'; fail if different.
-- Returns parsed_index incremented to the next index to check.

   -- we assume that any test failure is not an expected failure if not
   -- otherwise given
   if xfail == nil then xfail = false end

   check_basic_io_line (parsed_index, parsed[parsed_index], "path", stanza.path, xfail)
   parsed_index = parsed_index + 1

   if stanza.old_type then
      check_basic_io_line (parsed_index, parsed[parsed_index], "old_type", stanza.old_type, xfail)
      parsed_index = parsed_index + 1
   end

   if stanza.new_path then
      check_basic_io_line (parsed_index, parsed[parsed_index], "new_path", stanza.new_path, xfail)
      parsed_index = parsed_index + 1
   end

   if stanza.new_type then
      check_basic_io_line (parsed_index, parsed[parsed_index], "new_type", stanza.new_type, xfail)
      parsed_index = parsed_index + 1
   end

   if stanza.old_path then
      check_basic_io_line (parsed_index, parsed[parsed_index], "old_path", stanza.old_path, xfail)
      parsed_index = parsed_index + 1
   end

   if stanza.fs_type then
      check_basic_io_line (parsed_index, parsed[parsed_index], "fs_type", stanza.fs_type, xfail)
      parsed_index = parsed_index + 1
   end

   if stanza.birth then
      check_basic_io_line (parsed_index, parsed[parsed_index], "birth", stanza.birth, xfail)
      parsed_index = parsed_index + 1
   end

   if stanza.status then
      check_basic_io_line (parsed_index, parsed[parsed_index], "status", stanza.status, xfail)
      parsed_index = parsed_index + 1
   end

   if stanza.changes then
      check_basic_io_line (parsed_index, parsed[parsed_index], "changes", stanza.changes, xfail)
      parsed_index = parsed_index + 1
   end

   return parsed_index
end -- check_inventory

-- end of file