diff --git a/.gitignore b/.gitignore index d5c9366..2d7e745 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ -./helloworld -./helloworld.class -./helloworld.exe +helloworld +helloworld.class +HelloWorld.exe +tests/__pycache__/* diff --git a/helloworld.cs b/HelloWorld.cs similarity index 82% rename from helloworld.cs rename to HelloWorld.cs index 42a8e3a..a64f72d 100644 --- a/helloworld.cs +++ b/HelloWorld.cs @@ -18,11 +18,13 @@ namespace AniNIX { /// /// Print 'Hello world!' /// - public static void PrintHelloWorld() { + public static void PrintHelloWorld() { Console.WriteLine("Hello world!"); } - // Main + /// + /// Code entry point + /// public static void Main(string[] args) { HelloWorld.PrintHelloWorld(); return; diff --git a/Makefile b/Makefile index 793e7f6..6de841a 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ compile: c cs java bash php perl python +pkgdirname != basename `git config remote.origin.url` | sed 's/.git$$//' -install: compile - @echo This project cannot be installed. +install: clean + mkdir -p ${pkgdir}/opt/aninix/${pkgdirname}/ + rsync -avz --exclude=Makefile --exclude=LICENSE --exclude=.git* --exclude=README . * ${pkgdir}/opt/aninix/${pkgdirname}/ test: compile python3 -m pytest @@ -39,5 +41,5 @@ perl: helloworld.pl /usr/bin/perl python: helloworld.py /usr/bin/python3 #python3 ./helloworld.py -cs: helloworld.cs /usr/bin/mono /usr/bin/mcs - mcs helloworld.cs +cs: HelloWorld.cs /usr/bin/mono /usr/bin/mcs + mcs HelloWorld.cs diff --git a/PKGBUILD b/PKGBUILD index 2876458..cde05d8 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,21 +1,21 @@ # Maintainer: Shikoba Kage -pkgname=cryptoworkbench -pkgver=0.1.ac4a8cb406377081eb1c1de2a3abe482508d6f57 +pkgname=aninix-helloworld +pkgver=0.1.1 pkgver() { printf "0.1.""$(git rev-parse HEAD)" } pkgrel=1 epoch= -pkgdesc="AniNIX::CryptoWorkbench \\\\ Simple Cryptography Utility" +pkgdesc="AniNIX::HelloWorld \\\\ Sample HelloWorld Source" arch=("x86_64") -url="https://aninix.net/foundation/CryptoWorkbench" +url="https://aninix.net/foundation/HelloWorld" license=('custom') groups=() -depends=('mono>=5.0.0' 'curl' 'grep' 'bash>=4.4' 'git>=2.13') -makedepends=('make>=4.2') +depends=('bash>=4.4') +makedepends=('make>=4.2' 'mono>5.0.0' 'php' 'perl' 'java-environment' 'python>=3.7' 'gcc') checkdepends=() optdepends=() -provides=('cryptoworkbench') +provides=('aninix-helloworld') conflicts=() replaces=() backup=() @@ -36,7 +36,7 @@ build() { } check() { - printf 'quit\n\n' | make -C "${srcdir}/.." test + make -C "${srcdir}/.." test } package() { diff --git a/helloworld.bash b/helloworld.bash index 8dc340f..0de648e 100644 --- a/helloworld.bash +++ b/helloworld.bash @@ -12,11 +12,11 @@ ### ### Prints 'Hello world!' ### -function helloWorld() { +function main() { printf "Hello world!\n" } ## MAIN -if [ `echo "$0" | egrep '(^|/)helloworld.bash'` ]; then - helloWorld +if [ `basename "$0"` == "helloworld.bash" ]; then + main fi diff --git a/helloworld.py b/helloworld.py index 2449cad..945cb23 100644 --- a/helloworld.py +++ b/helloworld.py @@ -1,3 +1,3 @@ #!/usr/bin/python3 -print('Hello World!\n'); +print('Hello world!'); diff --git a/tests/__pycache__/test_unit.cpython-37-PYTEST.pyc b/tests/__pycache__/test_unit.cpython-37-PYTEST.pyc deleted file mode 100644 index 627b2d6..0000000 Binary files a/tests/__pycache__/test_unit.cpython-37-PYTEST.pyc and /dev/null differ diff --git a/tests/test_unit.py b/tests/test_unit.py index bc28811..9b47cb9 100644 --- a/tests/test_unit.py +++ b/tests/test_unit.py @@ -2,14 +2,64 @@ import os import re import shutil -def checkOutput(output): - for line in output.split('\n'): - if line == 'Hello world!': return True - return False +# c cs java bash php perl python + +def CheckOutput(output): + return output == 'Hello world!\n' def test_c(): print(os.getcwd()) - fh = os.popen("./helloworld", mode='r', buffering=-1) + fh = os.popen("make c &>/dev/null; ./helloworld", mode='r', buffering=-1) output = fh.read() retcode = fh.close() - assert retcode == None and checkOutput(output) + assert retcode == None and CheckOutput(output) + +def test_cs(): + print(os.getcwd()) + fh = os.popen("make cs &>/dev/null; mono ./HelloWorld.exe", mode='r', buffering=-1) + output = fh.read() + retcode = fh.close() + assert retcode == None and CheckOutput(output) + +def test_java(): + print(os.getcwd()) + fh = os.popen("make java &>/dev/null; java helloworld", mode='r', buffering=-1) + output = fh.read() + retcode = fh.close() + assert retcode == None and CheckOutput(output) + +def test_bash(): + print(os.getcwd()) + fh = os.popen("bash ./helloworld.bash", mode='r', buffering=-1) + output = fh.read() + retcode = fh.close() + assert retcode == None and CheckOutput(output) + +def test_bash(): + print(os.getcwd()) + fh = os.popen("bash ./helloworld.bash", mode='r', buffering=-1) + output = fh.read() + retcode = fh.close() + assert retcode == None and CheckOutput(output) + +def test_perl(): + print(os.getcwd()) + fh = os.popen("perl ./helloworld.pl", mode='r', buffering=-1) + output = fh.read() + retcode = fh.close() + assert retcode == None and CheckOutput(output) + +def test_php(): + print(os.getcwd()) + fh = os.popen("php ./helloworld.php", mode='r', buffering=-1) + output = fh.read() + retcode = fh.close() + assert retcode == None and CheckOutput(output) + +def test_python(): + print(os.getcwd()) + fh = os.popen("python3 ./helloworld.py", mode='r', buffering=-1) + output = fh.read() + retcode = fh.close() + assert retcode == None and CheckOutput(output) +