spec/symbolify_spec.rb in symbolify-1.0.0 vs spec/symbolify_spec.rb in symbolify-1.1.0

- old
+ new

@@ -4,10 +4,14 @@ describe Symbolify do describe ".symbolify" do it "will show replacement character for invalid characters" do assert_equal "�", Symbolify.symbolify("\x80") end + + it "will only return first character" do + assert_equal "a", Symbolify.symbolify("ab") + end end describe ".unicode" do it "works with normal characters" do assert_equal "A", Symbolify.symbolify("A") @@ -35,11 +39,25 @@ it "prepends enclosing marks with a space" do assert_equal " \u{20E3}", Symbolify.symbolify("\u{20E3}") end + it "replaces uncommon newline characters" do + assert_equal "⏎", Symbolify.symbolify("\u{2028}") + assert_equal "⏎", Symbolify.symbolify("\u{2029}") + end + it "wraps blanks" do assert_equal "] [", Symbolify.symbolify(" ") + end + + it "replaces annotation characters" do + assert_equal "IAA", Symbolify.symbolify("\u{FFF9}") + assert_equal "IAS", Symbolify.symbolify("\u{FFFA}") + end + + it "replaces object replacement character" do + assert_equal "OBJ", Symbolify.symbolify("\u{FFFC}") end it "replaces tags" do assert_equal "TAG ␠", Symbolify.symbolify("\u{E0020}") end