[Pkg-ocaml-maint-commits] [ocamlmod] 01/07: Imported Upstream version 0.0.5
Stéphane Glondu
glondu at moszumanska.debian.org
Fri Jan 31 08:58:24 UTC 2014
This is an automated email from the git hooks/post-receive script.
glondu pushed a commit to branch master
in repository ocamlmod.
commit 23b54b18c8a4a7c333d29d74bc4fcf2bf7e24ffa
Author: Stephane Glondu <steph at glondu.net>
Date: Fri Jan 31 09:49:47 2014 +0100
Imported Upstream version 0.0.5
---
CHANGES.txt | 4 +++
INSTALL.txt | 4 +--
Makefile | 64 +++++++++++++++++++++++++++++++++++++++-----
_headache.config | 61 ++++++++++++++++++++++++++++--------------
_header | 3 ++-
_oasis | 6 ++---
ardivink.lua | 10 +++----
myocamlbuild.ml | 25 ++++++------------
setup.ml | 31 +++++++---------------
src/ocamlbuild-rules.ml | 25 ++++++++++++++++--
src/ocamlmod.ml | 43 +++++++++++++++---------------
test/data/A.ml | 23 +++++++++++++++-
test/data/B.ml | 21 +++++++++++++++
test/test.ml | 70 +++++++++++++++++++++++++++++++++++--------------
14 files changed, 270 insertions(+), 120 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
new file mode 100644
index 0000000..67cdd7e
--- /dev/null
+++ b/CHANGES.txt
@@ -0,0 +1,4 @@
+2013-11-11 Sylvain Le Gall <sylvain AT le-gall.net>
+
+ * Version 0.0.5
+ * Remove end of line blank in generated files when using odn.
diff --git a/INSTALL.txt b/INSTALL.txt
index 45f2945..540bf31 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -1,5 +1,5 @@
(* OASIS_START *)
-(* DO NOT EDIT (digest: 5746d0b7192731f871c643dee17dcd2b) *)
+(* DO NOT EDIT (digest: 8387d3ad6d512a486b940cf15e056ff7) *)
This is the INSTALL file for the ocamlmod distribution.
This package uses OASIS to generate its build system. See section OASIS for
@@ -11,7 +11,7 @@ Dependencies
In order to compile this package, you will need:
* ocaml for all, test main
* findlib
-* oUnit (>= 1.1.1) for executable test
+* oUnit (>= 2.0.0) for executable test
Installing
==========
diff --git a/Makefile b/Makefile
index e2cc69f..d6e1410 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,8 @@
################################################################################
-# ocamlmod: generate OCaml modules from source files #
+# ocamlmod: Generate OCaml modules from source files #
# #
# Copyright (C) 2011, OCamlCore SARL #
+# Copyright (C) 2013, Sylvain Le Gall #
# #
# This library is free software; you can redistribute it and/or modify it #
# under the terms of the GNU Lesser General Public License as published by #
@@ -62,15 +63,66 @@ setup.data:
# OASIS_STOP
+# Precommit target
+# Check style of code.
+PRECOMMIT_ARGS= \
+ --exclude myocamlbuild.ml \
+ --exclude setup.ml \
+ --exclude README.txt \
+ --exclude INSTALL.txt \
+ --exclude Makefile \
+ --exclude configure \
+ --exclude _tags
+
+precommit:
+ @if command -v OCamlPrecommit > /dev/null; then \
+ OCamlPrecommit $(PRECOMMIT_ARGS); \
+ else \
+ echo "Skipping precommit checks.";\
+ fi
+
+precommit-full:
+ OCamlPrecommit --full $(PRECOMMIT_ARGS)
+
+test: precommit
+
+.PHONY: precommit
+
+# Fix perms target
+# Fix missing permission for darcs VCS files.
+fix-perms:
+ # TODO: chmod +x doc-dist.sh
+
+.PHONY: fix-perms
+
+# Headache target
+# Fix license header of file.
+
headache:
- find ./ -name _darcs -prune -false -o -name _build -prune \
- -false -o -type f \
- | xargs headache -h _header -c _headache.config
+ find ./ \
+ -name _darcs -prune -false \
+ -o -name .git -prune -false \
+ -o -name .svn -prune -false \
+ -o -name _build -prune -false \
+ -o -name dist -prune -false \
+ -o -name '*[^~]' -type f \
+ | xargs headache -h _header -c _headache.config
.PHONY: headache
-deploy:
+# Deploy target
+# Deploy/release the software.
+
+deploy: headache fix-perms
+ # TODO: create a plugin to create documentation.
+ # oasis doc-dist
admin-gallu-deploy --verbose \
- --forge_upload --forge_group ocamlmod --forge_user gildor-admin
+ --forge_upload --forge_group ocamlmod --forge_user gildor-admin
+ # TODO: when oasis doc-dist will work, re-add.
+ # --forge_extra_file "dist/ocamlmod-doc-$(shell oasis query version).tar.gz"
+ # TODO: create a plugin to send announcement.
+ # oasis announce
+ admin-gallu-oasis-increment \
+ --setup_run --setup_args "-setup-update dynamic" --use_vcs
.PHONY: deploy
diff --git a/_headache.config b/_headache.config
index af99b4e..7d6f606 100644
--- a/_headache.config
+++ b/_headache.config
@@ -1,7 +1,8 @@
################################################################################
-# ocamlmod: generate OCaml modules from source files #
+# ocamlmod: Generate OCaml modules from source files #
# #
# Copyright (C) 2011, OCamlCore SARL #
+# Copyright (C) 2013, Sylvain Le Gall #
# #
# This library is free software; you can redistribute it and/or modify it #
# under the terms of the GNU Lesser General Public License as published by #
@@ -19,24 +20,46 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
################################################################################
-| ".*\\.txt" -> no
-| ".*\\.patch" -> no
+| "setup.ml" -> no
+| "myocamlbuild.ml" -> no
+| ".*\.txt" -> no
+| ".*\.txt-exp" -> no
+| ".*\.html" -> no
+| ".*\.patch" -> no
+| ".*\.mkd" -> no
+| ".*\.mod" -> no
+| ".*\.mlify" -> no
| "configure" -> no
-| ".*\\.sh" -> skip match:"#!.*"
-| ".*\\.sh" -> frame open:"#" line:"#" close:"#"
-| ".*\\.ml\\.ab" -> frame open:"(*" line:"*" close:"*)"
-| ".*\\.ml" -> skip match:"(\\*pp .* \\*)"
-| "_headache\\.config" -> frame open:"#" line:"#" close:"#"
-| "_header" -> no
-| ".*\\.gz" -> no
-| ".*\\.log" -> no
-| ".*\\.data" -> no
-| ".*\\.swp" -> no
+| ".*\.sh" -> skip match:"#!.*"
+| ".*\.sh" -> frame open:"#" line:"#" close:"#"
+| ".*\.ml\.ab" -> frame open:"(*" line:"*" close:"*)" margin:" "
+| ".*\.mli?" -> skip match:"(\*pp .* \*)"
+| ".*\.mli?" -> frame open:"(*" line:"*" close:"*)" margin:" "
+| "_headache\.config" -> frame open:"#" line:"#" close:"#"
| "META" -> frame open:"#" line:"#" close:"#"
-| ".*\\.mllib" -> frame open:"#" line:"#" close:"#"
-| ".*\\.odocl" -> frame open:"#" line:"#" close:"#"
-| "_tags" -> frame open:"#" line:"#" close:"#"
-| "installbuilder-license.xml" -> no
-| ".*\\.oasis" -> no
+| ".*\.js" -> frame open:"/*" line:"*" close:"*/" margin:" "
+| ".*\.css" -> frame open:"/*" line:"*" close:"*/" margin:" "
| "_oasis" -> no
-| "\\.boring" -> no
+| "_header" -> no
+| ".*\.swp" -> no
+| ".*\.po" -> no
+| ".*\.po.bak" -> no
+| ".*\.mo" -> no
+| "POTFILES" -> no
+| "LINGUAS" -> no
+| ".*\.pot" -> no
+| ".*\.png" -> no
+| ".*\.mllib" -> no
+| ".*\.itarget" -> no
+| ".*\.itarget.in" -> no
+| ".*\.odocl" -> no
+| "_tags" -> no
+| "\.boring" -> no
+| "\.gitignore" -> no
+| ".*\.pdf" -> no
+| "setup\.log" -> no
+| "setup\.data" -> no
+| ".*\.data" -> no
+| ".*\.tar\.gz" -> no
+| ".*\.tar\.gz\.asc" -> no
+| ".*\.lua" -> no
diff --git a/_header b/_header
index ed0aa0b..6aeb57d 100644
--- a/_header
+++ b/_header
@@ -1,6 +1,7 @@
-ocamlmod: generate OCaml modules from source files
+ocamlmod: Generate OCaml modules from source files
Copyright (C) 2011, OCamlCore SARL
+Copyright (C) 2013, Sylvain Le Gall
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
diff --git a/_oasis b/_oasis
index 9b74339..004b6c3 100644
--- a/_oasis
+++ b/_oasis
@@ -1,6 +1,6 @@
OASISFormat: 0.3
Name: ocamlmod
-Version: 0.0.4
+Version: 0.0.5
Synopsis: Generate OCaml modules from source files
Authors: Sylvain Le Gall
License: LGPL-2.1 with OCaml linking exception
@@ -15,9 +15,9 @@ Executable ocamlmod
Executable test
Path: test
MainIs: test.ml
- BuildDepends: oUnit (>= 1.1.1), str
+ BuildDepends: oUnit (>= 2.0.0), str
Install: false
Build$: flag(tests)
Test main
- Command: $test --ocamlmod $ocamlmod
+ Command: $test
diff --git a/ardivink.lua b/ardivink.lua
index d083733..e63654e 100644
--- a/ardivink.lua
+++ b/ardivink.lua
@@ -1,17 +1,15 @@
oasis = require("oasis")
-darcs = require("darcs")
ci = require("ci")
dist = require("dist")
ci.init()
oasis.init()
-darcs.init()
+dist.init()
ci.prependenv("PATH", "/usr/opt/godi/bin")
ci.prependenv("PATH", "/usr/opt/godi/sbin")
-ci.putenv("OUNIT_OUTPUT_HTML_DIR", dist.make_filename("ounit-log.html"))
-ci.putenv("OUNIT_OUTPUT_JUNIT_FILE", dist.make_filename("junit.xml"))
-ci.putenv("OUNIT_OUTPUT_FILE", dist.make_filename("ounit-log.txt"))
+ci.putenv("OUNIT_OUTPUT_HTML_DIR", dist.make_filename("ounit-log-$(suite_name).html"))
+ci.putenv("OUNIT_OUTPUT_JUNIT_FILE", dist.make_filename("junit-$(suite_name).xml"))
+ci.putenv("OUNIT_OUTPUT_FILE", dist.make_filename("ounit-log-$(suite_name)-$(shard_id).txt"))
oasis.std_process("--enable-tests")
-darcs.create_tag(oasis.package_version())
diff --git a/myocamlbuild.ml b/myocamlbuild.ml
index 805eb5d..06f64c6 100644
--- a/myocamlbuild.ml
+++ b/myocamlbuild.ml
@@ -1,5 +1,5 @@
(* OASIS_START *)
-(* DO NOT EDIT (digest: c731f09030552f20f1d702a3c5473c9c) *)
+(* DO NOT EDIT (digest: 1ac77e505f54af8ee5c70c6a589193cd) *)
module OASISGettext = struct
# 21 "/home/gildor/programmation/oasis/src/oasis/OASISGettext.ml"
@@ -289,20 +289,11 @@ module MyOCamlbuildFindlib = struct
* linking. *)
List.iter
begin fun pkg ->
- let base_args = [A"-package"; A pkg] in
- let syn_args = [A"-syntax"; A "camlp4o"] in
- let args =
- (* heuristic to identify syntax extensions:
- whether they end in ".syntax"; some might not *)
- if Filename.check_suffix pkg "syntax"
- then syn_args @ base_args
- else base_args
- in
- flag ["ocaml"; "compile"; "pkg_"^pkg] & S args;
- flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S args;
- flag ["ocaml"; "doc"; "pkg_"^pkg] & S args;
- flag ["ocaml"; "link"; "pkg_"^pkg] & S base_args;
- flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S args;
+ flag ["ocaml"; "compile"; "pkg_"^pkg] & S[A"-package"; A pkg];
+ flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S[A"-package"; A pkg];
+ flag ["ocaml"; "doc"; "pkg_"^pkg] & S[A"-package"; A pkg];
+ flag ["ocaml"; "link"; "pkg_"^pkg] & S[A"-package"; A pkg];
+ flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S[A"-package"; A pkg];
end
(find_packages ());
@@ -484,7 +475,7 @@ module MyOCamlbuildBase = struct
end
-# 487 "myocamlbuild.ml"
+# 478 "myocamlbuild.ml"
open Ocamlbuild_plugin;;
let package_default =
{MyOCamlbuildBase.lib_ocaml = []; lib_c = []; flags = []; includes = []; }
@@ -492,6 +483,6 @@ let package_default =
let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;;
-# 496 "myocamlbuild.ml"
+# 487 "myocamlbuild.ml"
(* OASIS_STOP *)
Ocamlbuild_plugin.dispatch dispatch_default;;
diff --git a/setup.ml b/setup.ml
index 2a4bbd2..1931f38 100644
--- a/setup.ml
+++ b/setup.ml
@@ -22,7 +22,7 @@
(* setup.ml generated for the first time by OASIS v0.2.0 *)
(* OASIS_START *)
-(* DO NOT EDIT (digest: a977409690504ea0a80d6d00adc79e24) *)
+(* DO NOT EDIT (digest: 58d4ac8003f206ccb444aac00782e620) *)
(*
Regenerated by OASIS v0.3.1
Visit http://oasis.forge.ocamlcore.org for more information and
@@ -5974,10 +5974,7 @@ let setup_t =
CustomPlugin.Test.main
{
CustomPlugin.cmd_main =
- [
- (OASISExpr.EBool true,
- ("$test", ["--ocamlmod"; "$ocamlmod"]))
- ];
+ [(OASISExpr.EBool true, ("$test", []))];
cmd_clean = [(OASISExpr.EBool true, None)];
cmd_distclean = [(OASISExpr.EBool true, None)];
})
@@ -5992,10 +5989,7 @@ let setup_t =
CustomPlugin.Test.clean
{
CustomPlugin.cmd_main =
- [
- (OASISExpr.EBool true,
- ("$test", ["--ocamlmod"; "$ocamlmod"]))
- ];
+ [(OASISExpr.EBool true, ("$test", []))];
cmd_clean = [(OASISExpr.EBool true, None)];
cmd_distclean = [(OASISExpr.EBool true, None)];
})
@@ -6008,10 +6002,7 @@ let setup_t =
CustomPlugin.Test.distclean
{
CustomPlugin.cmd_main =
- [
- (OASISExpr.EBool true,
- ("$test", ["--ocamlmod"; "$ocamlmod"]))
- ];
+ [(OASISExpr.EBool true, ("$test", []))];
cmd_clean = [(OASISExpr.EBool true, None)];
cmd_distclean = [(OASISExpr.EBool true, None)];
})
@@ -6023,7 +6014,7 @@ let setup_t =
ocaml_version = None;
findlib_version = None;
name = "ocamlmod";
- version = "0.0.4";
+ version = "0.0.5";
license =
OASISLicense.DEP5License
(OASISLicense.DEP5Unit
@@ -6118,7 +6109,7 @@ let setup_t =
[
FindlibPackage
("oUnit",
- Some (OASISVersion.VGreaterEqual "1.1.1"));
+ Some (OASISVersion.VGreaterEqual "2.0.0"));
FindlibPackage ("str", None)
];
bs_build_tools = [ExternalTool "ocamlbuild"];
@@ -6140,11 +6131,7 @@ let setup_t =
},
{
test_type = (`Test, "custom", Some "0.3");
- test_command =
- [
- (OASISExpr.EBool true,
- ("$test", ["--ocamlmod"; "$ocamlmod"]))
- ];
+ test_command = [(OASISExpr.EBool true, ("$test", []))];
test_custom =
{
pre_command = [(OASISExpr.EBool true, None)];
@@ -6170,7 +6157,7 @@ let setup_t =
};
oasis_fn = Some "_oasis";
oasis_version = "0.3.1";
- oasis_digest = Some "\182d\t5\2174\248\198q\002<>y?`\210";
+ oasis_digest = Some "bn\\\241-\026`\160\220)\237\214b\145\228\166";
oasis_exec = None;
oasis_setup_args = [];
setup_update = false;
@@ -6178,6 +6165,6 @@ let setup_t =
let setup () = BaseSetup.setup setup_t;;
-# 6161 "setup.ml"
+# 6148 "setup.ml"
(* OASIS_STOP *)
let () = setup ();;
diff --git a/src/ocamlbuild-rules.ml b/src/ocamlbuild-rules.ml
index ed336e0..fe83a03 100644
--- a/src/ocamlbuild-rules.ml
+++ b/src/ocamlbuild-rules.ml
@@ -1,3 +1,24 @@
+(******************************************************************************)
+(* ocamlmod: Generate OCaml modules from source files *)
+(* *)
+(* Copyright (C) 2011, OCamlCore SARL *)
+(* Copyright (C) 2013, Sylvain Le Gall *)
+(* *)
+(* This library is free software; you can redistribute it and/or modify it *)
+(* under the terms of the GNU Lesser General Public License as published by *)
+(* the Free Software Foundation; either version 2.1 of the License, or (at *)
+(* your option) any later version, with the OCaml static compilation *)
+(* exception. *)
+(* *)
+(* This library is distributed in the hope that it will be useful, but *)
+(* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
+(* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *)
+(* details. *)
+(* *)
+(* You should have received a copy of the GNU Lesser General Public License *)
+(* along with this library; if not, write to the Free Software Foundation, *)
+(* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *)
+(******************************************************************************)
let ocamlmod_str = "ocamlmod";;
let ocamlmod = A ocamlmod_str;;
@@ -13,8 +34,8 @@ rule "ocamlmod: %.mod -> %.ml"
let dirname =
Pathname.dirname modfn
in
- depends_from_file
- env
+ depends_from_file
+ env
build
~fmod:(fun fn -> dirname/fn)
modfn;
diff --git a/src/ocamlmod.ml b/src/ocamlmod.ml
index 2fb372b..60e106a 100644
--- a/src/ocamlmod.ml
+++ b/src/ocamlmod.ml
@@ -1,23 +1,24 @@
-(********************************************************************************)
-(* ocamlmod: generate OCaml modules from source files *)
-(* *)
-(* Copyright (C) 2011, OCamlCore SARL *)
-(* *)
-(* This library is free software; you can redistribute it and/or modify it *)
-(* under the terms of the GNU Lesser General Public License as published by *)
-(* the Free Software Foundation; either version 2.1 of the License, or (at *)
-(* your option) any later version, with the OCaml static compilation *)
-(* exception. *)
-(* *)
-(* This library is distributed in the hope that it will be useful, but *)
-(* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
-(* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *)
-(* details. *)
-(* *)
-(* You should have received a copy of the GNU Lesser General Public License *)
-(* along with this library; if not, write to the Free Software Foundation, *)
-(* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *)
-(********************************************************************************)
+(******************************************************************************)
+(* ocamlmod: Generate OCaml modules from source files *)
+(* *)
+(* Copyright (C) 2011, OCamlCore SARL *)
+(* Copyright (C) 2013, Sylvain Le Gall *)
+(* *)
+(* This library is free software; you can redistribute it and/or modify it *)
+(* under the terms of the GNU Lesser General Public License as published by *)
+(* the Free Software Foundation; either version 2.1 of the License, or (at *)
+(* your option) any later version, with the OCaml static compilation *)
+(* exception. *)
+(* *)
+(* This library is distributed in the hope that it will be useful, but *)
+(* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
+(* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *)
+(* details. *)
+(* *)
+(* You should have received a copy of the GNU Lesser General Public License *)
+(* along with this library; if not, write to the Free Software Foundation, *)
+(* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *)
+(******************************************************************************)
(** Tool to transform a source module into an OCaml module
@author Sylvain Le Gall
@@ -62,7 +63,7 @@ let dump_ml chn_out fn =
Str.string_match rgxp s 0
in
let with_odn =
- Str.regexp "with +odn\\($\\| \\)"
+ Str.regexp " +with +odn\\($\\| \\)"
in
let type_conv_path =
Str.regexp "TYPE_CONV_PATH +\"[^\"]*\""
diff --git a/test/data/A.ml b/test/data/A.ml
index 143580d..80d0246 100644
--- a/test/data/A.ml
+++ b/test/data/A.ml
@@ -1,5 +1,26 @@
+(******************************************************************************)
+(* ocamlmod: Generate OCaml modules from source files *)
+(* *)
+(* Copyright (C) 2011, OCamlCore SARL *)
+(* Copyright (C) 2013, Sylvain Le Gall *)
+(* *)
+(* This library is free software; you can redistribute it and/or modify it *)
+(* under the terms of the GNU Lesser General Public License as published by *)
+(* the Free Software Foundation; either version 2.1 of the License, or (at *)
+(* your option) any later version, with the OCaml static compilation *)
+(* exception. *)
+(* *)
+(* This library is distributed in the hope that it will be useful, but *)
+(* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
+(* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *)
+(* details. *)
+(* *)
+(* You should have received a copy of the GNU Lesser General Public License *)
+(* along with this library; if not, write to the Free Software Foundation, *)
+(* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *)
+(******************************************************************************)
-type t =
+type t =
{
arecord: int
} with odn
diff --git a/test/data/B.ml b/test/data/B.ml
index 45e985b..c40f1f0 100644
--- a/test/data/B.ml
+++ b/test/data/B.ml
@@ -1,2 +1,23 @@
+(******************************************************************************)
+(* ocamlmod: Generate OCaml modules from source files *)
+(* *)
+(* Copyright (C) 2011, OCamlCore SARL *)
+(* Copyright (C) 2013, Sylvain Le Gall *)
+(* *)
+(* This library is free software; you can redistribute it and/or modify it *)
+(* under the terms of the GNU Lesser General Public License as published by *)
+(* the Free Software Foundation; either version 2.1 of the License, or (at *)
+(* your option) any later version, with the OCaml static compilation *)
+(* exception. *)
+(* *)
+(* This library is distributed in the hope that it will be useful, but *)
+(* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
+(* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *)
+(* details. *)
+(* *)
+(* You should have received a copy of the GNU Lesser General Public License *)
+(* along with this library; if not, write to the Free Software Foundation, *)
+(* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *)
+(******************************************************************************)
(* Another file *)
diff --git a/test/test.ml b/test/test.ml
index a37a2ab..dfe36d2 100644
--- a/test/test.ml
+++ b/test/test.ml
@@ -1,44 +1,71 @@
-open OUnit
+(******************************************************************************)
+(* ocamlmod: Generate OCaml modules from source files *)
+(* *)
+(* Copyright (C) 2011, OCamlCore SARL *)
+(* Copyright (C) 2013, Sylvain Le Gall *)
+(* *)
+(* This library is free software; you can redistribute it and/or modify it *)
+(* under the terms of the GNU Lesser General Public License as published by *)
+(* the Free Software Foundation; either version 2.1 of the License, or (at *)
+(* your option) any later version, with the OCaml static compilation *)
+(* exception. *)
+(* *)
+(* This library is distributed in the hope that it will be useful, but *)
+(* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
+(* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *)
+(* details. *)
+(* *)
+(* You should have received a copy of the GNU Lesser General Public License *)
+(* along with this library; if not, write to the Free Software Foundation, *)
+(* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *)
+(******************************************************************************)
-let ocamlmod =
- ref "false"
+open OUnit2
-let _lst : test_result list =
+let ocamlmod = Conf.make_exec "ocamlmod"
+
+let () =
run_test_tt_main
- ~arg_specs:
- ["--ocamlmod",
- Arg.Set_string ocamlmod,
- "fn ocamlmod executable."]
("ocamlmod">::
- bracket_tmpfile
- (fun (fn, chn) ->
+ (fun test_ctxt ->
+ let fn, chn = bracket_tmpfile test_ctxt in
let () = close_out chn in
- let () =
- assert_command
- !ocamlmod ["test/data/test01.mod"; "-o"; fn]
+ let () =
+ assert_command ~ctxt:test_ctxt
+ (ocamlmod test_ctxt)
+ [(in_testdata_dir test_ctxt ["test01.mod"]);
+ "-o"; fn]
in
- let lst =
+ let lst =
let lst = ref [] in
let chn = open_in fn in
- let () =
+ let () =
try
- while true do
- lst := (input_line chn) :: !lst
+ while true do
+ lst := (input_line chn) :: !lst
done
with End_of_file ->
close_in chn
in
List.rev !lst
in
- let find_reg reg =
+ let find_reg reg =
let reg = Str.regexp reg in
List.exists
- (fun str -> Str.string_match reg str 0)
+ (fun str ->
+ if Str.string_match reg str 0 then begin
+ logf test_ctxt `Info "%S" str;
+ true
+ end else begin
+ false
+ end)
lst
in
+ List.iter
+ (fun line -> logf test_ctxt `Info "%S" line) lst;
ignore "(*";
- assert_bool
+ assert_bool
"Contains SHOULD BE THERE"
(find_reg " *(\\* SHOULD BE THERE \\*)");
ignore "(*";
@@ -48,4 +75,7 @@ let _lst : test_result list =
assert_bool
"Doesn't contain with odn"
(not (find_reg ".*with *odn"));
+ assert_bool
+ "No blank at end of line."
+ (not (find_reg ".* *$"));
()))
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/ocamlmod.git
More information about the Pkg-ocaml-maint-commits
mailing list