added some simple tests
This commit is contained in:
parent
4217b71413
commit
b7a62b8c57
10 changed files with 69 additions and 1 deletions
|
@ -8,4 +8,4 @@ Contact
|
|||
|
||||
Author: Michael Zhang
|
||||
|
||||
License: MIT/Apache Dual License
|
||||
License: MIT/Apache-2.0 Dual License
|
||||
|
|
|
@ -3,6 +3,7 @@ name = "async-git"
|
|||
version = "0.1.0"
|
||||
authors = ["Michael Zhang <iptq@protonmail.com>"]
|
||||
edition = "2018"
|
||||
license = "MIT/Apache-2.0"
|
||||
|
||||
[[bin]]
|
||||
name = "git"
|
||||
|
|
18
async-git/README.md
Normal file
18
async-git/README.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
async-git
|
||||
=========
|
||||
|
||||
Pure-rust async implementation of Git. Built on tokio.
|
||||
|
||||
Tests
|
||||
-----
|
||||
|
||||
Tests are written in bash. Run `run-tests.sh` to invoke them.
|
||||
|
||||
Set the `GIT_PATH` environment variable to a different path to test a different Git implementation.
|
||||
|
||||
Contact
|
||||
-------
|
||||
|
||||
Author: Michael Zhang
|
||||
|
||||
License: MIT/Apache-2.0 Dual License
|
11
async-git/run-tests.sh
Executable file
11
async-git/run-tests.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
# get the directory where this script lives
|
||||
DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)"
|
||||
export GIT_PATH=${GIT_PATH:-$DIR/../target/debug/git}
|
||||
export TESTS_DIR=${TESTS_DIR:-$DIR/tests}
|
||||
|
||||
for script in $(ls $TESTS_DIR/test-*.sh);
|
||||
do
|
||||
(cd $TESTS_DIR; bash $script)
|
||||
done
|
16
async-git/tests/helper.sh
Executable file
16
async-git/tests/helper.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
function get_temp_name {
|
||||
temp_dir=$(mktemp -u -d -t $1-XXXXXXXX)
|
||||
}
|
||||
|
||||
function error {
|
||||
echo $* > /dev/stderr
|
||||
false
|
||||
}
|
||||
|
||||
function file_exists {
|
||||
[[ -f $1 ]] || error "file $1 doesn't exist"
|
||||
}
|
||||
|
||||
function dir_exists {
|
||||
[[ -d $1 ]] || error "directory $1 doesn't exist"
|
||||
}
|
19
async-git/tests/test-0001-init.sh
Executable file
19
async-git/tests/test-0001-init.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
set -e
|
||||
|
||||
. helper.sh
|
||||
TEST_NAME=test-0001-init
|
||||
|
||||
function check_initial_layout {
|
||||
# does it actually create the required directories?
|
||||
file_exists "$1/HEAD"
|
||||
dir_exists "$1/refs"
|
||||
}
|
||||
|
||||
# does git init work without failing?
|
||||
get_temp_name $TEST_NAME
|
||||
$GIT_PATH init $temp_dir
|
||||
if [ ! $? ]; then
|
||||
error "git init failed"
|
||||
fi
|
||||
|
||||
check_initial_layout "$temp_dir/.git"
|
|
@ -3,6 +3,7 @@ name = "async-zlib"
|
|||
version = "0.1.0"
|
||||
authors = ["Michael Zhang <iptq@protonmail.com>"]
|
||||
edition = "2018"
|
||||
license = "MIT/Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
tokio = { version = "0.2.18", default-features = false, features = ["fs", "macros"] }
|
||||
|
|
0
async-zlib/src/deflate/deflate.rs
Normal file
0
async-zlib/src/deflate/deflate.rs
Normal file
1
async-zlib/src/deflate/mod.rs
Normal file
1
async-zlib/src/deflate/mod.rs
Normal file
|
@ -0,0 +1 @@
|
|||
mod deflate;
|
|
@ -1,4 +1,5 @@
|
|||
mod decoder;
|
||||
mod deflate;
|
||||
mod encoder;
|
||||
|
||||
pub use crate::decoder::ZlibDecoder;
|
||||
|
|
Loading…
Reference in a new issue