#!/bin/sh

. libtest.sh
. libgit.sh

export TEST_TIME_NOW=1441051553
export LINES=27

tigrc <<EOF
set vertical-split = no
set main-view-date-use-author = yes
EOF

steps '
	:save-display default-date.screen

	:toggle date-local
	:save-display local-date.screen
	:toggle date-local

	:toggle date
	:save-display relative-date.screen

	:toggle date
	:save-display relative-compact-date.screen

	:toggle date
	:set main-view-date-format = "%Y-%m-%d"
	:save-display custom-short-date.screen

	:set main-view-date-format = "%Y-%m-%d z=%z Z=%Z z=%z"
	:save-display custom-tz-date.screen

	:toggle date
	:save-display no-date.screen

	:set main-view-date = custom
	:set main-view-date-local = true
	:set main-view-date-format = "%F %R %Z"
	:save-display custom-date.screen
'

test_tig --pretty=raw < "$source_dir/$test.in"

assert_equals 'default-date.screen' <<EOF
2015-08-31 04:01 +0900 Kentaro Wada        Add zsh completion file for autoload
2015-08-23 18:32 -0400 Jonas Fonseca       Refactor DEFINE_ALLOCATOR to use help
2015-07-16 11:46 +0200 Sven Wegener        display: factor out separator functio
2015-08-22 16:20 -0400 Jonas Fonseca       Merge pull request #429 from ideal/ma
2015-08-18 15:24 +0800 ideal               check if mem is NULL in DEFINE_ALLOCA
2015-06-07 23:44 -0400 Jonas Fonseca       Use git_init to initialize the test/s
2015-04-06 20:34 -0400 Jonas Fonseca       Keep unstaged changes view open after
2015-03-30 07:43 -0400 Jonas Fonseca       When redrawing the readline prompt al
2015-02-02 21:53 -0500 Jonas Fonseca       Move script helper before usages in t
2015-01-29 10:44 -0500 Jonas Fonseca       Merge branch 'hashed-refs'
2014-12-04 11:22 -0500 Jonas Fonseca       hashed-refs: Use a hash table as the
2014-11-08 09:55 -0500 Jonas Fonseca       Unify option_info lookup for normal o
2014-10-06 21:22 -0400 Jonas Fonseca       Add option to turn off automatic enab
2014-09-23 12:54 +0200 Tom Greuter         Add option to install Tig with Homebr
2014-09-04 07:19 -0400 Jonas Fonseca       Fix diff context restoring for diff o
2013-12-15 09:55 +1100 Michael Barlow      Add mouse support
2012-09-30 22:43 -0400 Jonas Fonseca       Refactor stage view title formatting
2012-08-30 10:47 -0400 Jonas Fonseca       [GH #83] WIP: main view lazy navigati
2011-10-13 11:46 +0530 P. Sadik            Create and use dup() of STDIN_FILENO
2010-09-15 21:01 -0400 Jonathan Neuschäfer Don't show out-of-sight tildes
2010-06-28 10:26 +0200 Pierre Habouzit     Add an option to ignore unknown direc
2009-01-17 23:10 +0100 Jonas Fonseca       Fix another regression from the dirty
2007-09-29 23:23 +0200 Jonas Fonseca       tig-0.10.git
2006-09-12 00:22 +0200 Jonas Fonseca       Only split the tree view when the tre
2006-04-10 18:39 +0200 Jonas Fonseca       Initial commit
[main] 91912eb97da4f6907015dab41ef9bba315730854 - commit 1 of 25            100%
EOF

assert_equals 'local-date.screen' <<EOF
2015-08-30 19:01 Kentaro Wada        Add zsh completion file for autoload
2015-08-23 22:32 Jonas Fonseca       Refactor DEFINE_ALLOCATOR to use helper met
2015-07-16 09:46 Sven Wegener        display: factor out separator functions
2015-08-22 20:20 Jonas Fonseca       Merge pull request #429 from ideal/master
2015-08-18 07:24 ideal               check if mem is NULL in DEFINE_ALLOCATOR
2015-06-08 03:44 Jonas Fonseca       Use git_init to initialize the test/stage/g
2015-04-07 00:34 Jonas Fonseca       Keep unstaged changes view open after an st
2015-03-30 11:43 Jonas Fonseca       When redrawing the readline prompt also upd
2015-02-03 02:53 Jonas Fonseca       Move script helper before usages in the dis
2015-01-29 15:44 Jonas Fonseca       Merge branch 'hashed-refs'
2014-12-04 16:22 Jonas Fonseca       hashed-refs: Use a hash table as the main d
2014-11-08 14:55 Jonas Fonseca       Unify option_info lookup for normal options
2014-10-07 01:22 Jonas Fonseca       Add option to turn off automatic enabling o
2014-09-23 10:54 Tom Greuter         Add option to install Tig with Homebrew
2014-09-04 11:19 Jonas Fonseca       Fix diff context restoring for diff opened
2013-12-14 22:55 Michael Barlow      Add mouse support
2012-10-01 02:43 Jonas Fonseca       Refactor stage view title formatting
2012-08-30 14:47 Jonas Fonseca       [GH #83] WIP: main view lazy navigation mod
2011-10-13 06:16 P. Sadik            Create and use dup() of STDIN_FILENO instea
2010-09-16 01:01 Jonathan Neuschäfer Don't show out-of-sight tildes
2010-06-28 08:26 Pierre Habouzit     Add an option to ignore unknown directories
2009-01-17 22:10 Jonas Fonseca       Fix another regression from the dirty flag
2007-09-29 21:23 Jonas Fonseca       tig-0.10.git
2006-09-11 22:22 Jonas Fonseca       Only split the tree view when the tree view
2006-04-10 16:39 Jonas Fonseca       Initial commit
[main] 91912eb97da4f6907015dab41ef9bba315730854 - commit 1 of 25            100%
EOF

assert_equals 'relative-date.screen' <<EOF
 25 hours ago Kentaro Wada        Add zsh completion file for autoload
   7 days ago Jonas Fonseca       Refactor DEFINE_ALLOCATOR to use helper method
  1 month ago Sven Wegener        display: factor out separator functions
   8 days ago Jonas Fonseca       Merge pull request #429 from ideal/master
  13 days ago ideal               check if mem is NULL in DEFINE_ALLOCATOR
 2 months ago Jonas Fonseca       Use git_init to initialize the test/stage/gh-4
 4 months ago Jonas Fonseca       Keep unstaged changes view open after an stagi
 5 months ago Jonas Fonseca       When redrawing the readline prompt also update
 6 months ago Jonas Fonseca       Move script helper before usages in the displa
 7 months ago Jonas Fonseca       Merge branch 'hashed-refs'
 9 months ago Jonas Fonseca       hashed-refs: Use a hash table as the main data
 9 months ago Jonas Fonseca       Unify option_info lookup for normal options an
10 months ago Jonas Fonseca       Add option to turn off automatic enabling of t
11 months ago Tom Greuter         Add option to install Tig with Homebrew
12 months ago Jonas Fonseca       Fix diff context restoring for diff opened dir
   1 year ago Michael Barlow      Add mouse support
  2 years ago Jonas Fonseca       Refactor stage view title formatting
  3 years ago Jonas Fonseca       [GH #83] WIP: main view lazy navigation mode p
  3 years ago P. Sadik            Create and use dup() of STDIN_FILENO instead o
  4 years ago Jonathan Neuschäfer Don't show out-of-sight tildes
  5 years ago Pierre Habouzit     Add an option to ignore unknown directories co
  6 years ago Jonas Fonseca       Fix another regression from the dirty flag cha
  7 years ago Jonas Fonseca       tig-0.10.git
  8 years ago Jonas Fonseca       Only split the tree view when the tree view is
  9 years ago Jonas Fonseca       Initial commit
[main] 91912eb97da4f6907015dab41ef9bba315730854 - commit 1 of 25            100%
EOF

assert_equals 'relative-compact-date.screen' <<EOF
25h Kentaro Wada        Add zsh completion file for autoload
7D  Jonas Fonseca       Refactor DEFINE_ALLOCATOR to use helper method and asser
1M  Sven Wegener        display: factor out separator functions
8D  Jonas Fonseca       Merge pull request #429 from ideal/master
13D ideal               check if mem is NULL in DEFINE_ALLOCATOR
2M  Jonas Fonseca       Use git_init to initialize the test/stage/gh-410-test re
4M  Jonas Fonseca       Keep unstaged changes view open after an staging command
5M  Jonas Fonseca       When redrawing the readline prompt also update the curso
6M  Jonas Fonseca       Move script helper before usages in the display module
7M  Jonas Fonseca       Merge branch 'hashed-refs'
9M  Jonas Fonseca       hashed-refs: Use a hash table as the main data structure
9M  Jonas Fonseca       Unify option_info lookup for normal options and view col
10M Jonas Fonseca       Add option to turn off automatic enabling of topo-order
11M Tom Greuter         Add option to install Tig with Homebrew
12M Jonas Fonseca       Fix diff context restoring for diff opened directly via
1Y  Michael Barlow      Add mouse support
2Y  Jonas Fonseca       Refactor stage view title formatting
3Y  Jonas Fonseca       [GH #83] WIP: main view lazy navigation mode prototype
3Y  P. Sadik            Create and use dup() of STDIN_FILENO instead of STDIN_FI
4Y  Jonathan Neuschäfer Don't show out-of-sight tildes
5Y  Pierre Habouzit     Add an option to ignore unknown directories contents in
6Y  Jonas Fonseca       Fix another regression from the dirty flag changes causi
7Y  Jonas Fonseca       tig-0.10.git
8Y  Jonas Fonseca       Only split the tree view when the tree view is visible
9Y  Jonas Fonseca       Initial commit
[main] 91912eb97da4f6907015dab41ef9bba315730854 - commit 1 of 25            100%
EOF

assert_equals 'custom-short-date.screen' <<EOF
2015-08-31 Kentaro Wada        Add zsh completion file for autoload
2015-08-23 Jonas Fonseca       Refactor DEFINE_ALLOCATOR to use helper method an
2015-07-16 Sven Wegener        display: factor out separator functions
2015-08-22 Jonas Fonseca       Merge pull request #429 from ideal/master
2015-08-18 ideal               check if mem is NULL in DEFINE_ALLOCATOR
2015-06-07 Jonas Fonseca       Use git_init to initialize the test/stage/gh-410-
2015-04-06 Jonas Fonseca       Keep unstaged changes view open after an staging
2015-03-30 Jonas Fonseca       When redrawing the readline prompt also update th
2015-02-02 Jonas Fonseca       Move script helper before usages in the display m
2015-01-29 Jonas Fonseca       Merge branch 'hashed-refs'
2014-12-04 Jonas Fonseca       hashed-refs: Use a hash table as the main data st
2014-11-08 Jonas Fonseca       Unify option_info lookup for normal options and v
2014-10-06 Jonas Fonseca       Add option to turn off automatic enabling of topo
2014-09-23 Tom Greuter         Add option to install Tig with Homebrew
2014-09-04 Jonas Fonseca       Fix diff context restoring for diff opened direct
2013-12-15 Michael Barlow      Add mouse support
2012-09-30 Jonas Fonseca       Refactor stage view title formatting
2012-08-30 Jonas Fonseca       [GH #83] WIP: main view lazy navigation mode prot
2011-10-13 P. Sadik            Create and use dup() of STDIN_FILENO instead of S
2010-09-15 Jonathan Neuschäfer Don't show out-of-sight tildes
2010-06-28 Pierre Habouzit     Add an option to ignore unknown directories conte
2009-01-17 Jonas Fonseca       Fix another regression from the dirty flag change
2007-09-29 Jonas Fonseca       tig-0.10.git
2006-09-12 Jonas Fonseca       Only split the tree view when the tree view is vi
2006-04-10 Jonas Fonseca       Initial commit
[main] 91912eb97da4f6907015dab41ef9bba315730854 - commit 1 of 25            100%
EOF

assert_equals 'custom-tz-date.screen' <<EOF
2015-08-31 z=+0900 Z=+0900 z=+0900 Kentaro Wada        Add zsh completion file f
2015-08-23 z=-0400 Z=-0400 z=-0400 Jonas Fonseca       Refactor DEFINE_ALLOCATOR
2015-07-16 z=+0200 Z=+0200 z=+0200 Sven Wegener        display: factor out separ
2015-08-22 z=-0400 Z=-0400 z=-0400 Jonas Fonseca       Merge pull request #429 f
2015-08-18 z=+0800 Z=+0800 z=+0800 ideal               check if mem is NULL in D
2015-06-07 z=-0400 Z=-0400 z=-0400 Jonas Fonseca       Use git_init to initializ
2015-04-06 z=-0400 Z=-0400 z=-0400 Jonas Fonseca       Keep unstaged changes vie
2015-03-30 z=-0400 Z=-0400 z=-0400 Jonas Fonseca       When redrawing the readli
2015-02-02 z=-0500 Z=-0500 z=-0500 Jonas Fonseca       Move script helper before
2015-01-29 z=-0500 Z=-0500 z=-0500 Jonas Fonseca       Merge branch 'hashed-refs
2014-12-04 z=-0500 Z=-0500 z=-0500 Jonas Fonseca       hashed-refs: Use a hash t
2014-11-08 z=-0500 Z=-0500 z=-0500 Jonas Fonseca       Unify option_info lookup
2014-10-06 z=-0400 Z=-0400 z=-0400 Jonas Fonseca       Add option to turn off au
2014-09-23 z=+0200 Z=+0200 z=+0200 Tom Greuter         Add option to install Tig
2014-09-04 z=-0400 Z=-0400 z=-0400 Jonas Fonseca       Fix diff context restorin
2013-12-15 z=+1100 Z=+1100 z=+1100 Michael Barlow      Add mouse support
2012-09-30 z=-0400 Z=-0400 z=-0400 Jonas Fonseca       Refactor stage view title
2012-08-30 z=-0400 Z=-0400 z=-0400 Jonas Fonseca       [GH #83] WIP: main view l
2011-10-13 z=+0530 Z=+0530 z=+0530 P. Sadik            Create and use dup() of S
2010-09-15 z=-0400 Z=-0400 z=-0400 Jonathan Neuschäfer Don't show out-of-sight t
2010-06-28 z=+0200 Z=+0200 z=+0200 Pierre Habouzit     Add an option to ignore u
2009-01-17 z=+0100 Z=+0100 z=+0100 Jonas Fonseca       Fix another regression fr
2007-09-29 z=+0200 Z=+0200 z=+0200 Jonas Fonseca       tig-0.10.git
2006-09-12 z=+0200 Z=+0200 z=+0200 Jonas Fonseca       Only split the tree view
2006-04-10 z=+0200 Z=+0200 z=+0200 Jonas Fonseca       Initial commit
[main] 91912eb97da4f6907015dab41ef9bba315730854 - commit 1 of 25            100%
EOF

assert_equals 'no-date.screen' <<EOF
Kentaro Wada        Add zsh completion file for autoload
Jonas Fonseca       Refactor DEFINE_ALLOCATOR to use helper method and asserts
Sven Wegener        display: factor out separator functions
Jonas Fonseca       Merge pull request #429 from ideal/master
ideal               check if mem is NULL in DEFINE_ALLOCATOR
Jonas Fonseca       Use git_init to initialize the test/stage/gh-410-test repo
Jonas Fonseca       Keep unstaged changes view open after an staging command
Jonas Fonseca       When redrawing the readline prompt also update the cursor po
Jonas Fonseca       Move script helper before usages in the display module
Jonas Fonseca       Merge branch 'hashed-refs'
Jonas Fonseca       hashed-refs: Use a hash table as the main data structure for
Jonas Fonseca       Unify option_info lookup for normal options and view column
Jonas Fonseca       Add option to turn off automatic enabling of topo-order
Tom Greuter         Add option to install Tig with Homebrew
Jonas Fonseca       Fix diff context restoring for diff opened directly via 'tig
Michael Barlow      Add mouse support
Jonas Fonseca       Refactor stage view title formatting
Jonas Fonseca       [GH #83] WIP: main view lazy navigation mode prototype
P. Sadik            Create and use dup() of STDIN_FILENO instead of STDIN_FILENO
Jonathan Neuschäfer Don't show out-of-sight tildes
Pierre Habouzit     Add an option to ignore unknown directories contents in the
Jonas Fonseca       Fix another regression from the dirty flag changes causing f
Jonas Fonseca       tig-0.10.git
Jonas Fonseca       Only split the tree view when the tree view is visible
Jonas Fonseca       Initial commit
[main] 91912eb97da4f6907015dab41ef9bba315730854 - commit 1 of 25            100%
EOF

assert_equals 'custom-date.screen' <<EOF
2015-08-30 19:01 UTC Kentaro Wada        Add zsh completion file for autoload
2015-08-23 22:32 UTC Jonas Fonseca       Refactor DEFINE_ALLOCATOR to use helper
2015-07-16 09:46 UTC Sven Wegener        display: factor out separator functions
2015-08-22 20:20 UTC Jonas Fonseca       Merge pull request #429 from ideal/mast
2015-08-18 07:24 UTC ideal               check if mem is NULL in DEFINE_ALLOCATO
2015-06-08 03:44 UTC Jonas Fonseca       Use git_init to initialize the test/sta
2015-04-07 00:34 UTC Jonas Fonseca       Keep unstaged changes view open after a
2015-03-30 11:43 UTC Jonas Fonseca       When redrawing the readline prompt also
2015-02-03 02:53 UTC Jonas Fonseca       Move script helper before usages in the
2015-01-29 15:44 UTC Jonas Fonseca       Merge branch 'hashed-refs'
2014-12-04 16:22 UTC Jonas Fonseca       hashed-refs: Use a hash table as the ma
2014-11-08 14:55 UTC Jonas Fonseca       Unify option_info lookup for normal opt
2014-10-07 01:22 UTC Jonas Fonseca       Add option to turn off automatic enabli
2014-09-23 10:54 UTC Tom Greuter         Add option to install Tig with Homebrew
2014-09-04 11:19 UTC Jonas Fonseca       Fix diff context restoring for diff ope
2013-12-14 22:55 UTC Michael Barlow      Add mouse support
2012-10-01 02:43 UTC Jonas Fonseca       Refactor stage view title formatting
2012-08-30 14:47 UTC Jonas Fonseca       [GH #83] WIP: main view lazy navigation
2011-10-13 06:16 UTC P. Sadik            Create and use dup() of STDIN_FILENO in
2010-09-16 01:01 UTC Jonathan Neuschäfer Don't show out-of-sight tildes
2010-06-28 08:26 UTC Pierre Habouzit     Add an option to ignore unknown directo
2009-01-17 22:10 UTC Jonas Fonseca       Fix another regression from the dirty f
2007-09-29 21:23 UTC Jonas Fonseca       tig-0.10.git
2006-09-11 22:22 UTC Jonas Fonseca       Only split the tree view when the tree
2006-04-10 16:39 UTC Jonas Fonseca       Initial commit
[main] 91912eb97da4f6907015dab41ef9bba315730854 - commit 1 of 25            100%
EOF
