A testbed for module Buffer.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@8999 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Pierre Weis 2008-09-09 06:38:51 +00:00
parent 2c1693ee00
commit 5db36dd331
1 changed files with 27 additions and 0 deletions

27
test/Moretest/tbuffer.ml Normal file
View File

@ -0,0 +1,27 @@
(* Dummy substitute function. *)
open Testing;;
open Buffer;;
let identity s = s;;
let b = Buffer.create 100;;
(* Pattern with a '\\' character in it. *)
let pat0 = "\\\\a" in
let n0 = String.length pat0 in
Buffer.add_substitute b identity pat0;
test (String.length (Buffer.contents b) = n0)
;;
(* Pattern with a '\\' character at the end. *)
let pat1 = "b\\" in
let n1 = String.length pat1 in
Buffer.clear b;
Buffer.add_substitute b identity pat1;
test (String.length (Buffer.contents b) = n1)
;;