#!/bin/sh

. libtest.sh
. libgit.sh

export LINES=12

steps '
	<Enter>
	:save-display split.screen
	:maximize
	:save-display maximized.screen
	:next
	:save-display maximized-after-next.screen
	:view-diff
	:save-display diff.screen
	:next
	:save-display diff-after-next.screen
'

tigrc <<EOF
set line-graphics = utf-8
set vertical-split = horizontal
EOF

in_work_dir create_repo_from_tgz "$base_dir/files/scala-js-benchmarks.tgz"

test_tig -n 3

assert_equals 'split.screen' <<EOF
2014-03-01 17:26 -0500 Jonas Fonseca ∙ [master] WIP: Upgrade to 0.4-SNAPSHOT and
2014-03-01 15:59 -0500 Jonas Fonseca ∙ Add type parameter for js.Dynamic
2014-01-16 22:51 -0500 Jonas Fonseca ∙ Move classes under org.scalajs.benchmark
[main] ee912870202200a0b9cf4fd86ba57243212d341e - commit 1 of 3             100%
commit ee912870202200a0b9cf4fd86ba57243212d341e
Refs: [master]
Author:     Jonas Fonseca <jonas.fonseca@gmail.com>
AuthorDate: Sat Mar 1 17:26:01 2014 -0500
Commit:     Jonas Fonseca <jonas.fonseca@gmail.com>
CommitDate: Sat Mar 1 17:26:01 2014 -0500
[diff] ee912870202200a0b9cf4fd86ba57243212d341e - line 1 of 367               1%
EOF

assert_equals 'maximized.screen' <<EOF
commit ee912870202200a0b9cf4fd86ba57243212d341e
Refs: [master]
Author:     Jonas Fonseca <jonas.fonseca@gmail.com>
AuthorDate: Sat Mar 1 17:26:01 2014 -0500
Commit:     Jonas Fonseca <jonas.fonseca@gmail.com>
CommitDate: Sat Mar 1 17:26:01 2014 -0500
 
    WIP: Upgrade to 0.4-SNAPSHOT and DCE
---
 common/benchmark-runner.sh                                  |  5 +++--
[diff] ee912870202200a0b9cf4fd86ba57243212d341e - line 1 of 367               2%
EOF

assert_equals 'maximized-after-next.screen' <<EOF
commit a1dcf1aaa11470978db1d5d8bcf9e16201eb70ff
Author:     Jonas Fonseca <jonas.fonseca@gmail.com>
AuthorDate: Sat Mar 1 15:59:02 2014 -0500
Commit:     Jonas Fonseca <jonas.fonseca@gmail.com>
CommitDate: Sat Mar 1 15:59:02 2014 -0500
 
    Add type parameter for js.Dynamic
---
 common/src/main/scala/org/scalajs/benchmark/Benchmark.scala | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
[diff] a1dcf1aaa11470978db1d5d8bcf9e16201eb70ff - line 1 of 24               41%
EOF

assert_equals 'diff.screen' <<EOF
commit a1dcf1aaa11470978db1d5d8bcf9e16201eb70ff
Author:     Jonas Fonseca <jonas.fonseca@gmail.com>
AuthorDate: Sat Mar 1 15:59:02 2014 -0500
Commit:     Jonas Fonseca <jonas.fonseca@gmail.com>
CommitDate: Sat Mar 1 15:59:02 2014 -0500
 
    Add type parameter for js.Dynamic
---
 common/src/main/scala/org/scalajs/benchmark/Benchmark.scala | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
[diff] a1dcf1aaa11470978db1d5d8bcf9e16201eb70ff - line 1 of 24               41%
EOF

assert_equals 'diff-after-next.screen' <<EOF
commit a1dcf1aaa11470978db1d5d8bcf9e16201eb70ff
Author:     Jonas Fonseca <jonas.fonseca@gmail.com>
AuthorDate: Sat Mar 1 15:59:02 2014 -0500
Commit:     Jonas Fonseca <jonas.fonseca@gmail.com>
CommitDate: Sat Mar 1 15:59:02 2014 -0500
 
    Add type parameter for js.Dynamic
---
 common/src/main/scala/org/scalajs/benchmark/Benchmark.scala | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
[diff] a1dcf1aaa11470978db1d5d8bcf9e16201eb70ff - line 2 of 24               41%
EOF
