diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-04-04 21:28:21 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-04-04 21:28:21 +0200 |
| commit | 42316d8393d32bd88fb8e0cba6825185f78dacd0 (patch) | |
| tree | e9adbd7e5701f70ecba520bbee41d4b21852a1cb /script/create_test.sh | |
| parent | 51b845a6a202b50966f50e166cfb11bcbdccbe33 (diff) | |
| download | libft-42316d8393d32bd88fb8e0cba6825185f78dacd0.tar.gz libft-42316d8393d32bd88fb8e0cba6825185f78dacd0.tar.bz2 libft-42316d8393d32bd88fb8e0cba6825185f78dacd0.zip | |
Added test and doc for dynamic string
Diffstat (limited to 'script/create_test.sh')
| -rwxr-xr-x | script/create_test.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/script/create_test.sh b/script/create_test.sh new file mode 100755 index 0000000..a0c9773 --- /dev/null +++ b/script/create_test.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +[ $# -eq 0 ] && echo "Usage $0 src_file_path+" && exit 1 + +for src_file_path in $@ +do + src_file_dir=`dirname $src_file_path` + src_file_name=`basename $src_file_path` + src_file_name_no_ext=`echo $src_file_name | sed 's/\.c//'` + template='script/test.template.c' + + test_file_path="test/$src_file_dir/test_$src_file_name" + + [ -f $test_file_path ] && + echo "Cannot create test $test_file_path already exists" && + continue + + mkdir -p "test/$src_file_dir" + sed "s/<funcname>/$src_file_name_no_ext/" $template > $test_file_path + echo "Created new test file at $test_file_path" +done + |
