diff --git a/tests/p_valac/0-install_valac.sh b/tests/p_valac/0-install_valac.sh new file mode 100755 index 0000000..85db198 --- /dev/null +++ b/tests/p_valac/0-install_valac.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Lz <lz843723683@163.com> + +if [ "$centos_ver" -ne "7" ];then + t_Log "Package not included in CentOS $centos_ver => SKIP" + exit 0 +fi + +t_Log "$0 - installing valac" +t_InstallPackage vala + diff --git a/tests/p_valac/10-test_valac.sh b/tests/p_valac/10-test_valac.sh new file mode 100755 index 0000000..b38b498 --- /dev/null +++ b/tests/p_valac/10-test_valac.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Author: Lz <Lz843723683@163.com> + +if [ "$centos_ver" -ne "7" ];then + t_Log "Package not included in CentOS $centos_ver => SKIP" + exit 0 +fi + +t_Log "Running $0 - Testing valac by running it with a basic file" + +# creating source code +FILE='/var/tmp/valac-test.vala' +EXE='/var/tmp/valac-test' + +cat > $FILE <<EOF +class Demo.HelloWorld : GLib.Object { +public static int main(string[] args) +{ +stdout.printf("HelloWorld!\n"); +return 0; +} +} +EOF + + +# Executing valac +valac -o $EXE $FILE + +# run EXE +$EXE | grep -q 'HelloWorld' +t_CheckExitStatus $? + +# remove files +/bin/rm $FILE +/bin/rm $EXE