Add xtests for existing Git implementation

This commit is contained in:
Benjamin Sago 2017-05-17 09:17:12 +01:00
parent ff5896aad2
commit e10c4b3eb9
4 changed files with 42 additions and 0 deletions

31
Vagrantfile vendored
View File

@ -339,6 +339,37 @@ Vagrant.configure(2) do |config|
EOF
# A sample Git repository
# This uses cd because it's easier than telling Git where to go each time
config.vm.provision :shell, privileged: false, inline: <<-EOF
set -xe
mkdir "#{test_dir}/git"
cd "#{test_dir}/git"
git init
mkdir edits additions moves
echo "original content" | tee edits/{staged,unstaged,both}
echo "this file gets moved" > moves/hither
git add edits moves
git commit -m "Automated test commit"
echo "modifications!" | tee edits/{staged,both}
touch additions/{staged,edited}
mv moves/{hither,thither}
git add edits moves additions
echo "more modifications!" | tee edits/unstaged edits/both additions/edited
touch additions/unstaged
touch -t #{some_date} "#{test_dir}/git/"*/*
sudo chown #{user}:#{user} -R "#{test_dir}/git"
EOF
# Install kcov for test coverage
# This doesnt run coverage over the xtests so its less useful for now
if ENV.key?('INSTALL_KCOV')

3
xtests/git_additions Normal file
View File

@ -0,0 +1,3 @@
.rw-rw-r-- 20 cassowary  1 Jan 12:34 NM edited
.rw-rw-r-- 0 cassowary  1 Jan 12:34 N- staged
.rw-rw-r-- 0 cassowary  1 Jan 12:34 -N unstaged

3
xtests/git_edits Normal file
View File

@ -0,0 +1,3 @@
.rw-rw-r-- 20 cassowary  1 Jan 12:34 MM both
.rw-rw-r-- 15 cassowary  1 Jan 12:34 M- staged
.rw-rw-r-- 20 cassowary  1 Jan 12:34 -M unstaged

View File

@ -101,4 +101,9 @@ COLUMNS=80 $exa $testcases/links 2>&1 | diff -q - $results/links || ex
$exa $testcases/links/* -1 | diff -q - $results/links_1_files || exit 1
# Git
$exa $testcases/git/additions -l --git 2>&1 | diff -q - $results/git_additions || exit 1
$exa $testcases/git/edits -l --git 2>&1 | diff -q - $results/git_edits || exit 1
echo "All the tests passed!"