]> git.kianting.info Git - clo/blob - tests/index.ts
Update node.js.yml
[clo] / tests / index.ts
1 let assert = require("assert");
2 let cloMain = require("../src");
3
4 let a = cloMain.match1Char("我");
5
6 let example1 = a({matched: "", remained: "我的"});
7 assert(example1._tag == "Some");
8 assert(example1.value.matched == "我");
9 assert(example1.value.remained == "的");
10
11 let example2 = a({matched: "", remained: "妳的"});
12 assert(example2._tag == "None");
13
14
15
16 let thenDo = cloMain.thenDo;
17 // composed part x
18 let compPart1 = cloMain.match1Char("我");
19 let compPart2 = cloMain.match1Char("的");
20
21 let doThenTestee1 = {_tag : "Some",value : {matched: "", remained: "我的貓"}};
22 let doTestRes1 = thenDo(thenDo(doThenTestee1, compPart1), compPart2);
23 assert(doTestRes1._tag == "Some");
24 assert(doTestRes1.value.matched == "我的");
25 assert(doTestRes1.value.remained == "貓");
26
27
28 let doThenTestee2 = {_tag : "Some",value : {matched: "", remained: "我們"}};
29 let doTestRes2 = thenDo(thenDo(doThenTestee2, compPart1), compPart2);
30 assert(doTestRes2._tag == "None");
31
32
33 // harfbuzz test
34 let harfbuzz = require("../src/harfbuzz.js");
35 harfbuzz.harfbuzzTest("123.abc");
36
37 // pdf test
38 let pdfManipulate = require("../src/pdfManipulate.js");
39 pdfManipulate.pdfGenerate("123.abc");
40 console.log("/tmp/test.pdf產出ah");
41