File: test-hangul.rb

package info (click to toggle)
libhangul 0.1.0%2Bgit20191003-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 11,356 kB
  • sloc: ansic: 8,391; python: 631; xml: 402; makefile: 164; ruby: 24; sh: 19
file content (23 lines) | stat: -rw-r--r-- 563 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'test/unit'
require 'hangul'

class TestHangulInputContext < Test::Unit::TestCase
  def setup
    @hic = Hangul::InputContext.new(Hangul::KEYBOARD_2)
  end
  def test_2bul_string
    input = "fnql gksrmf fkdlqmfjfl xptmxm"
    expected = "루비 한글 라이브러리 테스트"
    buffer = ''
    input.each_byte do |c|
      ret = @hic.filter(c)
      buffer << @hic.commit_string.to_s
      buffer << c.chr unless ret
    end
    @hic.flush
    buffer << @hic.commit_string.to_s
    assert_equal expected, buffer
  end
end

# vim: set sts=2 sw=2 et: