#!/bin/sh

. libtest.sh
. libgit.sh

export LINES=22

tigrc <<EOF
set vertical-split = no
EOF

test_setup_work_dir() {
	create_dirty_workdir
	mkdir dir-a dir-b dir-c
	for i in $(seq 1 5); do
		touch "root.$i"
	done
	for i in $(seq 1 3); do
		touch "dir-a/aa.$i"
	done
	for i in $(seq 1 1); do
		touch "dir-b/bb.$i"
	done
}

test_case 'initial' \
	--args='status' \
<<EXPECTED_SCREEN
On branch master                                                                
Changes to be committed:                                                        
  (no files)                                                                    
Changed but not updated:                                                        
M .j                                                                            
M a                                                                             
M b.c                                                                           
M e/f                                                                           
M g h                                                                           
Untracked files:                                                                
? dir-a/aa.1                                                                    
? dir-a/aa.2                                                                    
? dir-a/aa.3                                                                    
? dir-b/bb.1                                                                    
? root.1                                                                        
? root.2                                                                        
? root.3                                                                        
? root.4                                                                        
? root.5                                                                        
                                                                                
[status] Nothing to update                                                  100%
EXPECTED_SCREEN

test_case 'inside-dir-a' \
	--args='status' \
	--cwd='dir-a' \
<<EXPECTED_SCREEN
On branch master                                                                
Changes to be committed:                                                        
  (no files)                                                                    
Changed but not updated:                                                        
M .j                                                                            
M a                                                                             
M b.c                                                                           
M e/f                                                                           
M g h                                                                           
Untracked files:                                                                
? dir-a/aa.1                                                                    
? dir-a/aa.2                                                                    
? dir-a/aa.3                                                                    
? dir-b/bb.1                                                                    
? root.1                                                                        
? root.2                                                                        
? root.3                                                                        
? root.4                                                                        
? root.5                                                                        
                                                                                
[status] Nothing to update                                                  100%
EXPECTED_SCREEN

run_test_cases
