···13131414 (* Test scale validation *)
1515 test "scale validation - valid range" (fun () ->
1616- let _ = Textsize.v ~scale:1 () in
1717- let _ = Textsize.v ~scale:7 () in
1616+ let _ = Termext.Textsize.v ~scale:1 () in
1717+ let _ = Termext.Textsize.v ~scale:7 () in
1818 ()
1919 );
20202121 test "scale validation - rejects invalid" (fun () ->
2222 try
2323- let _ = Textsize.v ~scale:0 () in
2323+ let _ = Termext.Textsize.v ~scale:0 () in
2424 failwith "Should have raised Invalid_argument"
2525 with Invalid_argument _ -> ()
2626 );
27272828 (* Test width validation *)
2929 test "width validation - valid range" (fun () ->
3030- let _ = Textsize.v ~width:0 () in
3131- let _ = Textsize.v ~width:7 () in
3030+ let _ = Termext.Textsize.v ~width:0 () in
3131+ let _ = Termext.Textsize.v ~width:7 () in
3232 ()
3333 );
34343535 (* Test escape sequence generation *)
3636 test "double escape sequence" (fun () ->
3737- let result = Textsize.double "test" in
3737+ let result = Termext.Textsize.double "test" in
3838 assert (String.length result > 0);
3939 assert (result = "\x1b]66;s=2;test\x07")
4040 );
41414242 test "triple escape sequence" (fun () ->
4343- let result = Textsize.triple "hello" in
4343+ let result = Termext.Textsize.triple "hello" in
4444 assert (result = "\x1b]66;s=3;hello\x07")
4545 );
46464747 test "half escape sequence" (fun () ->
4848- let result = Textsize.half "tiny" in
4848+ let result = Termext.Textsize.half "tiny" in
4949 assert (result = "\x1b]66;n=1:d=2;tiny\x07")
5050 );
51515252 test "superscript escape sequence" (fun () ->
5353- let result = Textsize.superscript "2" in
5353+ let result = Termext.Textsize.superscript "2" in
5454 assert (result = "\x1b]66;n=1:d=2:v=2;2\x07")
5555 );
56565757 test "subscript escape sequence" (fun () ->
5858- let result = Textsize.subscript "2" in
5858+ let result = Termext.Textsize.subscript "2" in
5959 assert (result = "\x1b]66;n=1:d=2:v=0;2\x07")
6060 );
61616262 (* Test custom metadata *)
6363 test "custom metadata - scale and width" (fun () ->
6464- let metadata = Textsize.v ~scale:3 ~width:5 () in
6565- let result = Textsize.render metadata "custom" in
6464+ let metadata = Termext.Textsize.v ~scale:3 ~width:5 () in
6565+ let result = Termext.Textsize.render metadata "custom" in
6666 assert (result = "\x1b]66;s=3:w=5;custom\x07")
6767 );
68686969 test "custom metadata - fractional" (fun () ->
7070- let metadata = Textsize.v ~fraction:(2, 3) () in
7171- let result = Textsize.render metadata "frac" in
7070+ let metadata = Termext.Textsize.v ~fraction:(2, 3) () in
7171+ let result = Termext.Textsize.render metadata "frac" in
7272 assert (result = "\x1b]66;n=2:d=3;frac\x07")
7373 );
74747575 test "empty metadata" (fun () ->
7676- let result = Textsize.render (Textsize.v ()) "plain" in
7676+ let result = Termext.Textsize.render (Termext.Textsize.v ()) "plain" in
7777 assert (result = "\x1b]66;;plain\x07")
7878 );
79798080 (* Test text length validation *)
8181 test "text length validation - accepts valid" (fun () ->
8282 let text = String.make 4096 'a' in
8383- let _ = Textsize.double text in
8383+ let _ = Termext.Textsize.double text in
8484 ()
8585 );
86868787 test "text length validation - rejects oversized" (fun () ->
8888 let text = String.make 4097 'a' in
8989 try
9090- let _ = Textsize.double text in
9090+ let _ = Termext.Textsize.double text in
9191 failwith "Should have raised Invalid_argument"
9292 with Invalid_argument _ -> ()
9393 );
-31
tgp/textsize.opam
···11-# This file is generated by dune, edit dune-project instead
22-opam-version: "2.0"
33-version: "0.1.0"
44-synopsis: "OCaml implementation of the Kitty text sizing protocol"
55-description:
66- "A clean, standalone library for generating escape sequences to render text in different sizes using the Kitty terminal's text sizing protocol."
77-maintainer: ["Anonymous"]
88-authors: ["Anonymous"]
99-license: "MIT"
1010-homepage: "https://github.com/username/textsize"
1111-bug-reports: "https://github.com/username/textsize/issues"
1212-depends: [
1313- "ocaml" {>= "4.14"}
1414- "dune" {>= "3.0"}
1515- "odoc" {with-doc}
1616-]
1717-build: [
1818- ["dune" "subst"] {dev}
1919- [
2020- "dune"
2121- "build"
2222- "-p"
2323- name
2424- "-j"
2525- jobs
2626- "@install"
2727- "@runtest" {with-test}
2828- "@doc" {with-doc}
2929- ]
3030-]
3131-dev-repo: "git+https://github.com/username/textsize.git"