A testbed for module Buffer.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@8999 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
2c1693ee00
commit
5db36dd331
|
@ -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)
|
||||
;;
|
||||
|
Loading…
Reference in New Issue