Working state

This commit is contained in:
DarkFeather 2019-04-15 15:58:35 -05:00
parent 4310ab7323
commit 151648f44f
15 changed files with 147 additions and 53 deletions

7
.gitignore vendored
View File

@ -1,4 +1,7 @@
helloworld HelloWorld
helloworld.class HelloWorld.class
HelloWorld.exe HelloWorld.exe
tests/__pycache__/* tests/__pycache__/*
*.tar.xz
pkg/
src/

9
helloworld.bash → HelloWorld.bash Normal file → Executable file
View File

@ -9,14 +9,17 @@
# #
# Author: DarkFeather <darkfeather@aninix.net> # Author: DarkFeather <darkfeather@aninix.net>
### <summary> ### String to print
export _helloWorld="Hello world!"
### Prints 'Hello world!' ### Prints 'Hello world!'
### </summary> ### </summary>
function main() { function main() {
printf "Hello world!\n" printf "$_helloWorld""\n"
} }
## MAIN ## MAIN
if [ `basename "$0"` == "helloworld.bash" ]; then if [ `basename "$0"` == "HelloWorld.bash" ]; then
main main
fi fi

View File

@ -13,13 +13,17 @@ using System;
namespace AniNIX { namespace AniNIX {
/// This class is used exemplify coding standard in C#.
public sealed class HelloWorld { public sealed class HelloWorld {
// String to print
private static String _helloWorld="Hello world!";
/// <summary> /// <summary>
/// Print 'Hello world!' /// Print 'Hello world!'
/// </summary> /// </summary>
public static void PrintHelloWorld() { public static void PrintHelloWorld() {
Console.WriteLine("Hello world!"); Console.WriteLine(_helloWorld);
} }
/// <summary> /// <summary>

32
HelloWorld.java Normal file
View File

@ -0,0 +1,32 @@
import java.lang.System;
/*
* File: helloworld.cs
*
* Description: This file exemplifies printing 'Hello world!' in C#.
*
* Package: AniNIX::Foundation/HelloWorld
* Copyright: WTFPL
*
* Author: DarkFeather <darkfeather@aninix.net>
*/
/// This class is used exemplify coding standard in C#.
public class HelloWorld {
// String to print
private static String _helloWorld = "Hello world!";
/// <summary>
/// Print 'Hello world!'
/// </summary>
public static void PrintHelloWorld() {
System.out.println(_helloWorld);
}
/// MAIN
public static void main(String[] args) {
PrintHelloWorld();
}
}

29
HelloWorld.php Normal file
View File

@ -0,0 +1,29 @@
<?php
# File: helloworld.php
#
# Description: This file exemplifies printing 'Hello world!' in PHP.
#
# Package: AniNIX::Foundation/HelloWorld
# Copyright: WTFPL
#
# Author: DarkFeather <darkfeather@aninix.net>
### String to print
$helloWorld="Hello world!";
### <summary>
### Prints 'Hello world!'
### </summary>
function PrintHelloWorld() {
global $helloWorld;
echo $helloWorld."\n";
}
### MAIN
if ( basename(__FILE__) == "HelloWorld.php") {
PrintHelloWorld();
}
?>

21
HelloWorld.pl Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/perl
# File: helloworld.pl
#
# Description: This file exemplifies printing 'Hello world!' in perl.
#
# Package: AniNIX::Foundation/HelloWorld
# Copyright: WTFPL
#
# Author: DarkFeather <darkfeather@aninix.net>
### <summary>
### Prints 'Hello world!'
### </summary>
sub PrintHelloWorld {
print "Hello world!\n"
}
### MAIN
my ($PROG) = ($0 =~ m|.*/(.*)|) =~ m/(.*)\..*$/;
PrintHelloWorld() if ($0 == "helloworld.pl")

23
HelloWorld.py Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env python3
# File: helloworld.bash
#
# Description: This file exemplifies printing 'Hello world!' in bash.
#
# Package: AniNIX::Foundation/HelloWorld
# Copyright: WTFPL
#
# Author: DarkFeather <darkfeather@aninix.net>
### String to print
_helloWorld='Hello world!'
### <summary>
### Prints 'Hello world!'
### </summary>
def PrintHelloWorld():
print(_helloWorld)
### Main
if __name__ == '__main__':
PrintHelloWorld()

View File

@ -3,7 +3,7 @@ pkgdirname != basename `git config remote.origin.url` | sed 's/.git$$//'
install: clean install: clean
mkdir -p ${pkgdir}/opt/aninix/${pkgdirname}/ mkdir -p ${pkgdir}/opt/aninix/${pkgdirname}/
rsync -avz --exclude=Makefile --exclude=LICENSE --exclude=.git* --exclude=README . * ${pkgdir}/opt/aninix/${pkgdirname}/ rsync -avzp HelloWorld* ${pkgdir}/opt/aninix/${pkgdirname}/
test: compile test: compile
python3 -m pytest python3 -m pytest
@ -20,26 +20,26 @@ reverse:
checkperm: checkperm:
@echo Nothing to do. @echo Nothing to do.
c: helloworld.c /usr/bin/gcc c: HelloWorld.c /usr/bin/gcc
gcc -o helloworld helloworld.c gcc -o HelloWorld HelloWorld.c
java: helloworld.java /usr/bin/java /usr/bin/javac java: HelloWorld.java /usr/bin/java /usr/bin/javac
javac helloworld.java javac HelloWorld.java
bash: helloworld.bash /usr/bin/bash bash: HelloWorld.bash /usr/bin/bash
#bash helloworld.bash #bash HelloWorld.bash
php: helloworld.php /usr/bin/php php: HelloWorld.php /usr/bin/php
#php helloworld.php #php HelloWorld.php
#hack: helloworld.php /usr/bin/hhvm #hack: HelloWorld.php /usr/bin/hhvm
#hhvm --php helloworld.php #hhvm --php HelloWorld.php
perl: helloworld.pl /usr/bin/perl perl: HelloWorld.pl /usr/bin/perl
#perl ./helloworld.pl #perl ./HelloWorld.pl
python: helloworld.py /usr/bin/python3 python: HelloWorld.py /usr/bin/python3
#python3 ./helloworld.py #python3 ./HelloWorld.py
cs: HelloWorld.cs /usr/bin/mono /usr/bin/mcs cs: HelloWorld.cs /usr/bin/mono /usr/bin/mcs
mcs HelloWorld.cs mcs HelloWorld.cs

View File

@ -1,6 +1,6 @@
# Maintainer: Shikoba Kage <darkfeather@aninix.net> # Maintainer: Shikoba Kage <darkfeather@aninix.net>
pkgname=aninix-helloworld pkgname=aninix-helloworld
pkgver=0.1.1 pkgver=0.1.4310ab732341ac3317c9aa706b3058b8e7162486
pkgver() { pkgver() {
printf "0.1.""$(git rev-parse HEAD)" printf "0.1.""$(git rev-parse HEAD)"
} }
@ -32,11 +32,13 @@ prepare() {
} }
build() { build() {
make -C .. git config remote.origin.url
} }
check() { check() {
make -C "${srcdir}/.." test cd "${srcdir}/.."
chmod a+r "${srcdir}/../pkg"
make test
} }
package() { package() {

View File

@ -1,7 +0,0 @@
import java.lang.System;
public class helloworld {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}

View File

@ -1,4 +0,0 @@
<?php
echo "Hello world!
";
?>

View File

@ -1,2 +0,0 @@
#!/usr/bin/perl
print "Hello world!\n"

View File

@ -1,3 +0,0 @@
#!/usr/bin/python3
print('Hello world!');

View File

@ -9,7 +9,7 @@ def CheckOutput(output):
def test_c(): def test_c():
print(os.getcwd()) print(os.getcwd())
fh = os.popen("make c &>/dev/null; ./helloworld", mode='r', buffering=-1) fh = os.popen("make c &>/dev/null; ./HelloWorld", mode='r', buffering=-1)
output = fh.read() output = fh.read()
retcode = fh.close() retcode = fh.close()
assert retcode == None and CheckOutput(output) assert retcode == None and CheckOutput(output)
@ -23,42 +23,35 @@ def test_cs():
def test_java(): def test_java():
print(os.getcwd()) print(os.getcwd())
fh = os.popen("make java &>/dev/null; java helloworld", mode='r', buffering=-1) fh = os.popen("make java &>/dev/null; java HelloWorld", mode='r', buffering=-1)
output = fh.read() output = fh.read()
retcode = fh.close() retcode = fh.close()
assert retcode == None and CheckOutput(output) assert retcode == None and CheckOutput(output)
def test_bash(): def test_bash():
print(os.getcwd()) print(os.getcwd())
fh = os.popen("bash ./helloworld.bash", mode='r', buffering=-1) fh = os.popen("./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() output = fh.read()
retcode = fh.close() retcode = fh.close()
assert retcode == None and CheckOutput(output) assert retcode == None and CheckOutput(output)
def test_perl(): def test_perl():
print(os.getcwd()) print(os.getcwd())
fh = os.popen("perl ./helloworld.pl", mode='r', buffering=-1) fh = os.popen("./HelloWorld.pl", mode='r', buffering=-1)
output = fh.read() output = fh.read()
retcode = fh.close() retcode = fh.close()
assert retcode == None and CheckOutput(output) assert retcode == None and CheckOutput(output)
def test_php(): def test_php():
print(os.getcwd()) print(os.getcwd())
fh = os.popen("php ./helloworld.php", mode='r', buffering=-1) fh = os.popen("php ./HelloWorld.php", mode='r', buffering=-1)
output = fh.read() output = fh.read()
retcode = fh.close() retcode = fh.close()
assert retcode == None and CheckOutput(output) assert retcode == None and CheckOutput(output)
def test_python(): def test_python():
print(os.getcwd()) print(os.getcwd())
fh = os.popen("python3 ./helloworld.py", mode='r', buffering=-1) fh = os.popen("./HelloWorld.py", mode='r', buffering=-1)
output = fh.read() output = fh.read()
retcode = fh.close() retcode = fh.close()
assert retcode == None and CheckOutput(output) assert retcode == None and CheckOutput(output)