Sha256: 122a1d41b5b8a786d075dc419436359b1ce9c9999a2a1065934d292a0e73157d
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
require_relative "../lib/unicode/name" require "minitest/autorun" describe Unicode::Name do describe ".name (alias .of)" do it "will return name for that character" do assert_equal "LATIN CAPITAL LETTER A", Unicode::Name.of("A") assert_equal "AERIAL TRAMWAY", Unicode::Name.of("🚡") assert_equal "REPLACEMENT CHARACTER", Unicode::Name.of("�") end it "will return nil for characters without name" do assert_equal nil, Unicode::Name.of("\u{10c50}") assert_equal nil, Unicode::Name.of("\0") end end describe ".correct" do it "usually just returns name" do assert_equal "LATIN CAPITAL LETTER A", Unicode::Name.correct("A") end it "will return corrected name, if one exists" do assert_equal "LATIN CAPITAL LETTER GHA", Unicode::Name.correct("Ƣ") end end describe ".aliases" do it "will return nil if no alias available" do assert_equal nil, Unicode::Name.aliases("A") end it "will always return a Hash" do assert_equal Hash, Unicode::Name.aliases("\0").class end it "will return aliases grouped by type" do assert_equal ["NULL"], Unicode::Name.aliases("\0")[:control] assert_equal ["NUL"], Unicode::Name.aliases("\0")[:abbreviation] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unicode-name-1.0.0 | spec/unicode_name_spec.rb |