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.class
HelloWorld
HelloWorld.class
HelloWorld.exe
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>
### <summary>
### String to print
export _helloWorld="Hello world!"
### Prints 'Hello world!'
### </summary>
function main() {
printf "Hello world!\n"
printf "$_helloWorld""\n"
}
## MAIN
if [ `basename "$0"` == "helloworld.bash" ]; then
if [ `basename "$0"` == "HelloWorld.bash" ]; then
main
fi

View File

@ -13,13 +13,17 @@ using System;
namespace AniNIX {
/// This class is used exemplify coding standard in C#.
public sealed class HelloWorld {
// String to print
private static String _helloWorld="Hello world!";
/// <summary>
/// Print 'Hello world!'
/// </summary>
public static void PrintHelloWorld() {
Console.WriteLine("Hello world!");
Console.WriteLine(_helloWorld);
}
/// <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
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
python3 -m pytest
@ -20,26 +20,26 @@ reverse:
checkperm:
@echo Nothing to do.
c: helloworld.c /usr/bin/gcc
gcc -o helloworld helloworld.c
c: HelloWorld.c /usr/bin/gcc
gcc -o HelloWorld HelloWorld.c
java: helloworld.java /usr/bin/java /usr/bin/javac
javac helloworld.java
java: HelloWorld.java /usr/bin/java /usr/bin/javac
javac HelloWorld.java
bash: helloworld.bash /usr/bin/bash
#bash helloworld.bash
bash: HelloWorld.bash /usr/bin/bash
#bash HelloWorld.bash
php: helloworld.php /usr/bin/php
#php helloworld.php
php: HelloWorld.php /usr/bin/php
#php HelloWorld.php
#hack: helloworld.php /usr/bin/hhvm
#hhvm --php helloworld.php
#hack: HelloWorld.php /usr/bin/hhvm
#hhvm --php HelloWorld.php
perl: helloworld.pl /usr/bin/perl
#perl ./helloworld.pl
perl: HelloWorld.pl /usr/bin/perl
#perl ./HelloWorld.pl
python: helloworld.py /usr/bin/python3
#python3 ./helloworld.py
python: HelloWorld.py /usr/bin/python3
#python3 ./HelloWorld.py
cs: HelloWorld.cs /usr/bin/mono /usr/bin/mcs
mcs HelloWorld.cs

View File

@ -1,6 +1,6 @@
# Maintainer: Shikoba Kage <darkfeather@aninix.net>
pkgname=aninix-helloworld
pkgver=0.1.1
pkgver=0.1.4310ab732341ac3317c9aa706b3058b8e7162486
pkgver() {
printf "0.1.""$(git rev-parse HEAD)"
}
@ -32,11 +32,13 @@ prepare() {
}
build() {
make -C ..
git config remote.origin.url
}
check() {
make -C "${srcdir}/.." test
cd "${srcdir}/.."
chmod a+r "${srcdir}/../pkg"
make test
}
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():
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()
retcode = fh.close()
assert retcode == None and CheckOutput(output)
@ -23,42 +23,35 @@ def test_cs():
def test_java():
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()
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)
fh = os.popen("./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)
fh = os.popen("./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)
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)
fh = os.popen("./HelloWorld.py", mode='r', buffering=-1)
output = fh.read()
retcode = fh.close()
assert retcode == None and CheckOutput(output)