diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-05-09 12:31:50 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-05-09 12:31:50 +0200 |
| commit | 02abc030a68cb2fdd2f21c96db830ec8cb9176ad (patch) | |
| tree | 0c2d67c94a3618639fc2cd29d8bc78820e41c254 /script/create_test.sh | |
| parent | b5124347359833fcde33452978c62133879c6c9e (diff) | |
| parent | 3a2d19df9e509d0b015c786eb02f8315ff0ad91c (diff) | |
| download | libft-02abc030a68cb2fdd2f21c96db830ec8cb9176ad.tar.gz libft-02abc030a68cb2fdd2f21c96db830ec8cb9176ad.tar.bz2 libft-02abc030a68cb2fdd2f21c96db830ec8cb9176ad.zip | |
Merge remote-tracking branch 'origin/minishell'
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 + |
