Sha256: 5669332791f5c4eeba2b6cd5d512f3e6b188c03557981f580ff29a5d9d2cf4bf

Contents?: true

Size: 1001 Bytes

Versions: 9

Compression:

Stored size: 1001 Bytes

Contents

# coding: utf-8

require 'spec_helper'

RSpec.describe TTY::Table, 'unicode support' do
  it "measures utf characters correctly for :basic" do
    table = TTY::Table[['こんにちは', 'a2'], ['b1','選択']]
    expect(table.render(:basic)).to eq unindent(<<-EOS)
      こんにちは a2  
      b1         選択
    EOS
  end

  it "measure utf characters correctly for :ascii" do
    table = TTY::Table[['こんにちは', 'a2'], ['b1','選択']]
    expect(table.render(:ascii)).to eq unindent(<<-EOS)
     +----------+----+
     |こんにちは|a2  |
     |b1        |選択|
     +----------+----+
    EOS
  end

  it "measure utf characters correctly for :unicode" do
    table = TTY::Table[['こんにちは', 'a2'], ['b1','選択']]
    expect(table.render(:unicode)).to eq unindent(<<-EOS)
     ┌──────────┬────┐
     │こんにちは│a2  │
     │b1        │選択│
     └──────────┴────┘
    EOS
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
tty-table-0.10.0 spec/unit/utf_spec.rb
tty-table-0.9.0 spec/unit/utf_spec.rb
tty-table-0.8.0 spec/unit/utf_spec.rb
tty-table-0.7.0 spec/unit/utf_spec.rb
tty-table-0.6.0 spec/unit/utf_spec.rb
tty-table-0.5.0 spec/unit/utf_spec.rb
tty-table-0.4.0 spec/unit/utf_spec.rb
tty-table-0.3.0 spec/unit/utf_spec.rb
tty-table-0.2.0 spec/unit/utf_spec.rb