Skip to content

Commit 8206a22

Browse files
author
Hugo Heuzard
committed
add some test
1 parent 7009dae commit 8206a22

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/utf8.ml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
open Printf
2+
3+
let next_tok buf =
4+
let open Sedlexing.Utf8 in
5+
match%sedlex buf with
6+
| "a", Utf8 (Chars "+-×÷") -> sprintf "with Chars: %s" (lexeme buf)
7+
| "b", Utf8 ("+" | "-" | "×" | "÷") ->
8+
sprintf "with or_pattern: %s" (lexeme buf)
9+
| _ -> failwith (sprintf "Unexpected character: %s" (lexeme buf))
10+
11+
let%expect_test _ =
12+
Sedlexing.Utf8.from_string "a+" |> next_tok |> print_string;
13+
[%expect {| with Chars: a+ |}];
14+
Sedlexing.Utf8.from_string "" |> next_tok |> print_string;
15+
[%expect {| with Chars: a÷ |}];
16+
Sedlexing.Utf8.from_string "b+" |> next_tok |> print_string;
17+
[%expect {| with or_pattern: b+ |}];
18+
Sedlexing.Utf8.from_string "" |> next_tok |> print_string;
19+
[%expect {| with or_pattern: b÷ |}]

0 commit comments

Comments
 (0)