diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index abade7a..97ce41f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,7 @@ jobs: os: [macos-latest] env: MACOSX_DEPLOYMENT_TARGET: 10.12 + RIMEV: 943b8c6 steps: - uses: actions/checkout@v3 @@ -28,9 +29,9 @@ jobs: run: | brew install luajit brew install luarocks - wget https://github.com/rime/librime/releases/download/latest/rime-de12d6a-macOS.tar.bz2 + wget https://github.com/rime/librime/releases/download/latest/rime-$RIMEV-macOS.tar.bz2 luarocks --lua-dir=/usr/local/opt/luajit install busted - tar xjvf rime-de12d6a-macOS.tar.bz2 + tar xjvf rime-$RIMEV-macOS.tar.bz2 ln -s dist/lib git clone https://github.com/zhaozg/rime_simp.git var diff --git a/spec/base_spec.lua b/spec/base_spec.lua index 264ea62..9a7ad81 100644 --- a/spec/base_spec.lua +++ b/spec/base_spec.lua @@ -48,16 +48,14 @@ expose("an exposed test", function() end) it("pinyin ascii_mode", function() - rime.utils.printInfo(session) schema = session:Schema() - print('current:',schema) session:Schema(schema) assert(schema==session:Schema()) rime:deploy_schema('luna_pinyin') --change schema local schema_list = rime:Schemas() - rime.utils.print_r(schema_list) + -- rime.utils.print_r(schema_list) local schemaid = schema_list[#schema_list].id assert(schemaid) @@ -72,17 +70,16 @@ expose("an exposed test", function() --disable ascii_mode session:Option('ascii_mode', false) local list = session:Candidates() - rime.utils.print_r(list,'list') + -- rime.utils.print_r(list,'list') assert(session:simulate('abcd')==true) - rime.utils.printInfo(session) + -- rime.utils.printInfo(session) list = session:Candidates() assert(type(list)=='table') assert(#list > 0) - --rime.utils.print_r(list,'list of abcd') assert(session:Select(1)) - print(session:Commit()) - rime.utils.printInfo(session) + local commit = session:Commit() + assert(commit=='啊不错的' or '安部彻的') end) it("pinyin ime", function() @@ -91,66 +88,68 @@ expose("an exposed test", function() session:Option('ascii_mode', false) local list - rime.utils.printInfo(session) assert(session:simulate('xiguanjiuhaole')==true) - rime.utils.printInfo(session) + -- rime.utils.printInfo(session) list = session:Candidates() assert(#list > 0) --rime.utils.print_r(list, "习惯就好了") assert(session:Select(1)) - print(session:Commit()) + assert.equal("习惯就好了", session:Commit()) assert(session:simulate('burejinsiji')==true) - rime.utils.printInfo(session) + -- rime.utils.printInfo(session) list = session:Candidates() assert(#list > 0) --rime.utils.print_r(list, "布热津斯基") assert(session:Select(1)) - print(session:Commit()) + assert.equal("布热津斯基", session:Commit()) assert(session:simulate('shurufangshizhuanhuanjian')==true) - rime.utils.printInfo(session) + --rime.utils.printInfo(session) list = session:Candidates() assert(session:Select(1)) - print(session:Commit()) + assert.equal('输入方式转换键', session:Commit()) assert(session:simulate('chujiangkongwan')==true) - rime.utils.printInfo(session) + --rime.utils.printInfo(session) list = session:Candidates() assert(session:Select(1)) - print(session:Commit()) + assert.equal('楚江空晚', session:Commit()) - local seq = "yitiaodahebolangkuanfengchuidaohuaxiangliang'an" + local seq = "qiushuigongchangtianyise" for i=1,#seq do local keycode = seq:byte(i) session:process(keycode) --rime.utils.printInfo(session) end assert(session:Select(1)) - print(session:Commit()) + assert(session:commit()) + assert.equal('秋水共长天一色', session:Commit()) end) it("pinyin_fluency ime", function() --disable ascii_mode assert(session:Schema('luna_pinyin_fluency')) session:Option('ascii_mode', false) + session:Option('simplification', true) assert(session:simulate('xiguanjiuhaole')==true) - rime.utils.printInfo(session) - local list = session:Candidates() - assert(#list > 0) - --rime.utils.print_r(list, "习惯就好了") + --rime.utils.printInfo(session) + --local list = session:Candidates() + --assert(#list > 0) assert(session:Select(1)) - print(session:Commit()) + assert(session:commit()) + assert.equal('习惯就好了', session:Commit()) - local seq = "yitiaodahebolangkuanfengchuidaohuaxiangliang'an" + local seq = "yitiaodahebolang" for i=1,#seq do local keycode = seq:byte(i) session:process(keycode) end - rime.utils.printInfo(session) assert(session:Select(1)) - print(session:Commit()) + assert(session:commit()) + --rime.utils.printInfo(session) + assert.equal('一条大河波浪', session:Commit()) end) it("double_pinyin ime", function() @@ -159,12 +158,14 @@ expose("an exposed test", function() session:Option('ascii_mode', false) assert(session:simulate('duguqqbl')==true) - rime.utils.printInfo(session) + --rime.utils.printInfo(session) local list = session:Candidates() assert(#list > 0) --rime.utils.print_r(list, "习惯就好了") assert(session:Select(1)) - print(session:Commit()) + assert(session:commit()) + local commit = assert(session:Commit()) + assert.equal("独孤求败", commit) end) end) diff --git a/spec/double_pinyin_spec.lua b/spec/double_pinyin_spec.lua index fecb7c1..4a5ba97 100644 --- a/spec/double_pinyin_spec.lua +++ b/spec/double_pinyin_spec.lua @@ -91,21 +91,14 @@ expose("an exposed test", function() commit = session:Commit() assert.equal("楚江空晚", commit) - local seq = "yitcdahebolhkrfgivdkhwxdldan" + local seq = "yitcdahe,mghvivjclmyy" for i=1,#seq do local keycode = seq:byte(i) session:process(keycode) end + assert(session:Select(1)) - local status = session:Status() - local selected = {2, 2, 4, 2, 2, 1} - while(status.composing) do - local idx = assert(table.remove(selected, 1)) - assert(session:Select(idx)) - status = session:Status() - end - - assert.equal('一条大河波浪宽风吹稻花香两岸', session:Commit()) + assert.equal('一条大河,梦回吹角连营', session:Commit()) end) end) end) diff --git a/spec/pinyin_fluency_spec.lua b/spec/pinyin_fluency_spec.lua index bd8ffe7..b7314e8 100644 --- a/spec/pinyin_fluency_spec.lua +++ b/spec/pinyin_fluency_spec.lua @@ -121,23 +121,16 @@ expose("an exposed test", function() commit = session:Commit() assert.equal("楚江空晚", commit) - local seq = "yitiaodahebolangkuanfengchuidaohuaxiangliang'an" + local seq = "yitiaodahebolang" for i=1,#seq do local keycode = seq:byte(i) session:process(keycode) end - - local selected = {2, 2, 4, 2, 2, 1} - repeat - local idx = table.remove(selected, 1) - if idx then - --rime.utils.printInfo(session) - assert(session:Select(idx)) - end - until not idx + list = session:Candidates() + assert(session:Select(1)) assert(session:commit()) - assert.equal('一条大河波浪宽风吹稻花香两岸', session:Commit()) + assert.equal('一条大河波浪', session:Commit()) end) end) end) diff --git a/spec/pinyin_spec.lua b/spec/pinyin_spec.lua index b4ed450..53a87a8 100644 --- a/spec/pinyin_spec.lua +++ b/spec/pinyin_spec.lua @@ -78,7 +78,6 @@ expose("an exposed test", function() list = session:Candidates() assert(type(list)=='table') assert(#list > 0) - --rime.utils.print_r(list,'list of abcd') assert(session:Select(1)) local commit = session:Commit() assert.equal("电子计算机发烫", commit) @@ -98,6 +97,7 @@ expose("an exposed test", function() assert(#list > 0) --rime.utils.print_r(list, "习惯就好了") assert(session:Select(1)) + assert(session:commit()) local commit = session:Commit() assert.equal("习惯就好了", commit) @@ -107,6 +107,7 @@ expose("an exposed test", function() assert(#list > 0) --rime.utils.print_r(list, "布热津斯基") assert(session:Select(1)) + assert(session:commit()) commit = session:Commit() assert.equal("布热津斯基", commit) @@ -114,6 +115,7 @@ expose("an exposed test", function() --rime.utils.printInfo(session) list = session:Candidates() assert(session:Select(1)) + assert(session:commit()) commit = session:Commit() assert.equal("输入方式转换键", commit) @@ -121,24 +123,20 @@ expose("an exposed test", function() --rime.utils.printInfo(session) list = session:Candidates() assert(session:Select(1)) + assert(session:commit()) commit = session:Commit() assert.equal("楚江空晚", commit) - local seq = "yitiaodahebolangkuanfengchuidaohuaxiangliang'an" + local seq = "yitiaodahebolang" for i=1,#seq do local keycode = seq:byte(i) session:process(keycode) end - local status = session:Status() - local selected = {2, 2, 4, 2, 2, 1} - while(status.composing) do - local idx = assert(table.remove(selected, 1)) - assert(session:Select(idx)) - status = session:Status() - end + assert(session:Select(1)) + assert(session:commit()) - assert.equal('一条大河波浪宽风吹稻花香两岸', session:Commit()) + assert.equal('一条大河波浪', session:Commit()) end) end) end)