File: __driver__.lua

package info (click to toggle)
monotone 1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 20,648 kB
  • sloc: cpp: 86,443; sh: 6,906; perl: 924; makefile: 838; python: 517; lisp: 379; sql: 118; exp: 91; ansic: 52
file content (70 lines) | stat: -rw-r--r-- 3,476 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
66
67
68
69
70
mtn_setup()
addfile("testfile", "floooooo")
check(mtn("commit", "--date=1999-12-31T13:00:00",
	  "--branch=B", "--message=blah-blah"), 0, false, false)
rev = base_revision()

function logdf(fmt)
   if fmt then
      return mtn("log", "--brief", "--no-graph", "--date-format="..fmt)
   else
      return mtn("log", "--brief", "--no-graph")
   end
end

function test_tz_fmt(tz, fmt, exp)
   if tz then
      set_env("TZ", tz)
   end
   check(logdf(fmt), 0, true, false)
   check(samelines("stdout", { rev .. " tester@test.net " .. exp .. " B" }))
end

test_tz_fmt(nil, nil,                 "1999-12-31T13:00:00")
test_tz_fmt(nil, "%Y-%m-%d %H:%M:%S", "1999-12-31 13:00:00")
test_tz_fmt(nil, "%Y-%m-%d %I:%M:%S", "1999-12-31 01:00:00")

-- check that --date-format=xxx and --no-format-dates override eachother
check(mtn("log", "--brief", "--no-graph", "--date-format=%Y", "--no-format-dates"),
      0, true, false)
check(samelines("stdout", { rev .. " tester@test.net 1999-12-31T13:00:00 B" }))
check(mtn("log", "--brief", "--no-graph", "--no-format-dates", "--date-format=%Y"),
      0, true, false)
check(samelines("stdout", { rev .. " tester@test.net 1999 B" }))


-- Windows' strftime() doesn't support %T, and MinGW uses the
-- version provided by Windows rather than having its own.
skip_if(ostype=="Windows")
test_tz_fmt(nil, "%a, %d %b %Y %T",   "Fri, 31 Dec 1999 13:00:00")

-- TZ env var doesn't work
--skip_if(ostype=="Windows") -- but we'll have already skipped

test_tz_fmt("ZZT+00:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 13:00 ZZT+0000")
test_tz_fmt("ZZT+01:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 12:00 ZZT-0100")
test_tz_fmt("ZZT+02:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 11:00 ZZT-0200")
test_tz_fmt("ZZT+03:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 10:00 ZZT-0300")
test_tz_fmt("ZZT+04:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 09:00 ZZT-0400")
test_tz_fmt("ZZT+05:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 08:00 ZZT-0500")
test_tz_fmt("ZZT+06:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 07:00 ZZT-0600")
test_tz_fmt("ZZT+07:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 06:00 ZZT-0700")
test_tz_fmt("ZZT+08:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 05:00 ZZT-0800")
test_tz_fmt("ZZT+09:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 04:00 ZZT-0900")
test_tz_fmt("ZZT+10:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 03:00 ZZT-1000")
test_tz_fmt("ZZT+11:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 02:00 ZZT-1100")
test_tz_fmt("ZZT+12:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 01:00 ZZT-1200")

test_tz_fmt("ZZT-00:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 13:00 ZZT+0000")
test_tz_fmt("ZZT-01:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 14:00 ZZT+0100")
test_tz_fmt("ZZT-02:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 15:00 ZZT+0200")
test_tz_fmt("ZZT-03:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 16:00 ZZT+0300")
test_tz_fmt("ZZT-04:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 17:00 ZZT+0400")
test_tz_fmt("ZZT-05:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 18:00 ZZT+0500")
test_tz_fmt("ZZT-06:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 19:00 ZZT+0600")
test_tz_fmt("ZZT-07:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 20:00 ZZT+0700")
test_tz_fmt("ZZT-08:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 21:00 ZZT+0800")
test_tz_fmt("ZZT-09:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 22:00 ZZT+0900")
test_tz_fmt("ZZT-10:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 23:00 ZZT+1000")
test_tz_fmt("ZZT-11:00", "%Y-%m-%d %H:%M %Z%z", "2000-01-01 00:00 ZZT+1100")
test_tz_fmt("ZZT-12:00", "%Y-%m-%d %H:%M %Z%z", "2000-01-01 01:00 ZZT+1200")