[teyjus] r1168 committed - Add new directory for IO tests....

1 view
Skip to first unread message

tey...@googlecode.com

unread,
Jan 16, 2015, 12:32:10 PM1/16/15
to teyju...@googlegroups.com
Revision: 1168
Author: fafo...@gmail.com
Date: Fri Jan 16 17:31:53 2015 UTC
Log: Add new directory for IO tests.

All functionalities for IO need to be tested.
So far, we can only test that Teyjus returned an error but we cannot
check which one. This has to be fixed.



https://code.google.com/p/teyjus/source/detail?r=1168

Added:
/branches/ocaml-builtins/source/test/io_tests
/branches/ocaml-builtins/source/test/io_tests/OMakefile
/branches/ocaml-builtins/source/test/io_tests/harness
/branches/ocaml-builtins/source/test/io_tests/open_in
/branches/ocaml-builtins/source/test/io_tests/open_in/bar
/branches/ocaml-builtins/source/test/io_tests/open_in/open_in.mod
/branches/ocaml-builtins/source/test/io_tests/open_in/open_in.sig
/branches/ocaml-builtins/source/test/io_tests/open_in/open_in.t
Modified:
/branches/ocaml-builtins/TODO_IO
/branches/ocaml-builtins/source/OMakefile
/branches/ocaml-builtins/source/README
/branches/ocaml-builtins/source/test/OMakefile

=======================================
--- /dev/null
+++ /branches/ocaml-builtins/source/test/io_tests/OMakefile Fri Jan 16
17:31:53 2015 UTC
@@ -0,0 +1,20 @@
+SUBDIRS = $(glob D, *)
+
+.PHONY: io-test
+io-test: $(TJSIM)
+ perl harness
+
+.SUBDIRS: $(SUBDIRS)
+ # The default main file is the name of the test directory
+ MAIN = $(basename $(absname $(CWD)))
+
+ # The default root file can be overriden if the test directory contains
+ # a file named root.om with a line "MAIN = xxxx"
+ if $(file-exists main.om)
+ include main.om
+ export
+
+ FILES = $(rootname $(glob *.mod))
+
+ LPProgram($(MAIN), $(FILES))
+ io-test: $(MAIN).lp
=======================================
--- /dev/null
+++ /branches/ocaml-builtins/source/test/io_tests/harness Fri Jan 16
17:31:53 2015 UTC
@@ -0,0 +1,6 @@
+use lib '../lib';
+use Test::Harness;
+
+# Pass in a list of tests to run on the command line, else run all the
tests.
+my @tests = @ARGV ? @ARGV : glob( "*/*.t" );
+runtests(@tests);
=======================================
--- /dev/null
+++ /branches/ocaml-builtins/source/test/io_tests/open_in/open_in.mod Fri
Jan 16 17:31:53 2015 UTC
@@ -0,0 +1,4 @@
+module open_in.
+
+test1 X :- open_in "open_in/foo" X.
+test2 X :- open_in "open_in/bar" X.
=======================================
--- /dev/null
+++ /branches/ocaml-builtins/source/test/io_tests/open_in/open_in.sig Fri
Jan 16 17:31:53 2015 UTC
@@ -0,0 +1,4 @@
+sig open_in.
+
+type test1 in_stream -> o.
+type test2 in_stream -> o.
=======================================
--- /dev/null
+++ /branches/ocaml-builtins/source/test/io_tests/open_in/open_in.t Fri Jan
16 17:31:53 2015 UTC
@@ -0,0 +1,35 @@
+use lib '../lib';
+use strict;
+use Test::More tests => 2;
+
+my $TJSIM = "../../tjsim";
+my $PATH = "-p open_in/";
+my $MODULE = "open_in";
+my $code;
+my $ans;
+
+############################################
+# In the following test: we should test that we have the following on
stderr:
+# Error: open_in: Cannot open stream from `open_in/foo'.
+############################################
+$code = <<'CODE';
+test1 X.
+CODE
+$ans = <<'ANS';
+
+The answer substitution:
+ANS
+same_answers( `$TJSIM -b $PATH --solve "$code" $MODULE\n`, $ans,"open_in");
+
+############################################
+############################################
+$code = <<'CODE';
+test2 X.
+CODE
+$ans = <<'ANS';
+
+The answer substitution:
+X = <stream -- "open_in/bar">
+
+ANS
+same_answers( `$TJSIM -b $PATH --solve "$code" $MODULE\n`, $ans,"open_in");
=======================================
--- /branches/ocaml-builtins/TODO_IO Thu Jan 8 13:35:44 2015 UTC
+++ /branches/ocaml-builtins/TODO_IO Fri Jan 16 17:31:53 2015 UTC
@@ -6,6 +6,9 @@
- The minimum number of characters to be read with the input predicate is
now 1


+Have a way to test errors displayed on stderr.
+Is Perl's Test the best solution in our case?
+
open_in
-> behavior OK when:
* opening a correct file
=======================================
--- /branches/ocaml-builtins/source/OMakefile Tue Jan 6 18:16:51 2015 UTC
+++ /branches/ocaml-builtins/source/OMakefile Fri Jan 16 17:31:53 2015 UTC
@@ -312,4 +312,4 @@
.SUBDIRS: $(TST)

.PHONY: test
-test: compiler-test compiler-negative-test linker-test system-test
+test: compiler-test compiler-negative-test linker-test io-test system-test
=======================================
--- /branches/ocaml-builtins/source/README Tue Oct 6 16:54:37 2009 UTC
+++ /branches/ocaml-builtins/source/README Fri Jan 16 17:31:53 2015 UTC
@@ -230,11 +230,17 @@

use "omake system-test" under teyjus/source/test

+ 4. io test:
+
+ use "omake io-test" under teyjus/source/test
+

- 4. all the above tests:
+ 5. all the above tests:

use "omake test" under teyjus/source/test

+ To run all tests (even if some fail, use "omake -k test" under
teyjus/source/test)
+

---Windows: Microsoft Visual Studio 2008---

=======================================
--- /branches/ocaml-builtins/source/test/OMakefile Thu Nov 28 10:02:15 2013
UTC
+++ /branches/ocaml-builtins/source/test/OMakefile Fri Jan 16 17:31:53 2015
UTC
@@ -25,5 +25,4 @@
# Subdirectories
#

-.SUBDIRS: linker_tests compiler_tests compiler_negative_tests system_tests
-
+.SUBDIRS: linker_tests compiler_tests compiler_negative_tests system_tests
io_tests
Reply all
Reply to author
Forward
0 new messages