This is an automated email from the git hooks/post-receive script.

glondu pushed a commit to branch master
in repository ocaml-csv.

commit 8cf4d7275fd3762621600b0b4871f5766a6f9f39
Author: Stephane Glondu <st...@glondu.net>
Date:   Tue Jan 26 15:04:30 2016 +0100

    Imported Upstream version 1.4.1
---
 .travis-ci.sh       | 22 ++++++++++++++++++++++
 .travis.yml         | 20 ++++++++++++++++++++
 README.md           |  2 ++
 _oasis              | 18 +++++++++++++++++-
 src/csv.ml          |  2 +-
 src/csv.mli         |  2 ++
 tests/test.ml       |  2 +-
 tests/test_write.ml | 16 ++++++++++++++++
 8 files changed, 81 insertions(+), 3 deletions(-)

diff --git a/.travis-ci.sh b/.travis-ci.sh
new file mode 100644
index 0000000..55445b8
--- /dev/null
+++ b/.travis-ci.sh
@@ -0,0 +1,22 @@
+
+OPAM_PKGS="oasis base-bytes"
+
+export OPAMYES=1
+
+if [ -f "$HOME/.opam/config" ]; then
+    opam update
+    opam upgrade
+else
+    opam init
+fi
+
+if [ -n "${OPAM_SWITCH}" ]; then
+    opam switch ${OPAM_SWITCH}
+fi
+eval `opam config env`
+
+opam install $OPAM_PKGS
+
+export OCAMLRUNPARAM=b
+make
+make test
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..5ff98b8
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,20 @@
+language: c
+sudo: false
+addons:
+  apt:
+    sources:
+    - avsm
+    packages:
+    - ocaml
+    - ocaml-native-compilers
+    - opam
+
+script: bash -ex .travis-ci.sh
+env:
+  - OPAM_SWITCH=system
+  - OPAM_SWITCH=3.12.1
+  - OPAM_SWITCH=4.01.0
+  - OPAM_SWITCH=4.02.2
+cache:
+  directories:
+  - $HOME/.opam
diff --git a/README.md b/README.md
index 3a44169..9951dd0 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
+[![Build 
Status](https://travis-ci.org/Chris00/ocaml-csv.svg?branch=master)](https://travis-ci.org/Chris00/ocaml-csv)
+
 OCaml CSV
 =========
 
diff --git a/_oasis b/_oasis
index b6ec839..7ca476f 100644
--- a/_oasis
+++ b/_oasis
@@ -1,7 +1,7 @@
 #                                                              -*-conf-*-
 OASISFormat: 0.4
 Name:        csv
-Version:     1.4
+Version:     1.4.1
 Synopsis:    A pure OCaml library to read and write CSV files.
 Description: This is a pure OCaml library to read and write CSV files, 
   including all extensions used by Excel — e.g. quotes, newlines, 
@@ -39,6 +39,7 @@ Executable csvtool
   Install:        true
 
 Executable example
+  Build$:         flag(tests)
   Path:           examples/
   MainIs:         example.ml
   BuildDepends:   csv
@@ -48,6 +49,7 @@ Executable example
 
 # Testing
 Executable test
+  Build$:         flag(tests)
   Path:           tests/
   MainIs:         test.ml
   BuildDepends:   csv
@@ -72,6 +74,20 @@ Test header
   Command: $test_header
   Run: true
 
+Executable test_write
+  Build$:         flag(tests)
+  Path:           tests/
+  MainIs:         test_write.ml
+  BuildDepends:   csv
+  CompiledObject: best
+  BuildTools:     ocamlbuild
+  Install:        false
+
+Test write
+  WorkingDirectory: tests/
+  Command: $test_write
+  Run: true
+
 
 SourceRepository master
   Type:       git
diff --git a/src/csv.ml b/src/csv.ml
index 6119155..dfe70ed 100644
--- a/src/csv.ml
+++ b/src/csv.ml
@@ -795,7 +795,7 @@ let write_escaped oc field =
       really_output oc (Bytes.unsafe_of_string field) 0 len
     else (
       let field =
-        if n = 0 then Bytes.unsafe_of_string field
+        if n <= 0 then Bytes.unsafe_of_string field
         else (* There are some quotes to escape *)
           let s = Bytes.create (len + n) in
           let j = ref 0 in
diff --git a/src/csv.mli b/src/csv.mli
index d80af98..e98b08d 100644
--- a/src/csv.mli
+++ b/src/csv.mli
@@ -49,6 +49,7 @@ object
         to read, the number 0 will be returned.
 
         @raise End_of_file when there are no more bytes to read. *)
+
   method close_in : unit -> unit
     (** Closes the channel for input. *)
 end
@@ -61,6 +62,7 @@ object
         [s.[ofs .. ofs+len-1]].  Return the number of bytes actually
         written.  When the channel is non-blocking, and there are
         currently no bytes to write, the number 0 must be returned.  *)
+
   method close_out : unit -> unit
     (** Flushes the buffer, if any, and closes the channel for output. *)
 end
diff --git a/tests/test.ml b/tests/test.ml
index 1e30af2..91228dd 100644
--- a/tests/test.ml
+++ b/tests/test.ml
@@ -106,4 +106,4 @@ let () =
 
 
 let () =
-  print_endline "All tests succeeded."
+  print_endline "All conformity tests succeeded."
diff --git a/tests/test_write.ml b/tests/test_write.ml
new file mode 100644
index 0000000..ef57fb1
--- /dev/null
+++ b/tests/test_write.ml
@@ -0,0 +1,16 @@
+open Printf
+
+let roundtrip ?excel_tricks csv =
+  let buf = Buffer.create 128 in
+  Csv.output_all (Csv.to_buffer buf ?excel_tricks) csv;
+  let csv' = Csv.input_all (Csv.of_string (Buffer.contents buf)) in
+  if Csv.compare csv csv' <> 0 then (
+    printf "Csv roundtrip:\n";
+    Csv.print csv';
+    printf "Expected:\n";
+    Csv.print csv;
+    failwith "failed!"
+  )
+
+let () =
+  roundtrip [ [ "01234567" ] ] ~excel_tricks:true

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-ocaml-maint/packages/ocaml-csv.git

_______________________________________________
Pkg-ocaml-maint-commits mailing list
Pkg-ocaml-maint-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ocaml-maint-commits

Reply via email to