Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4ec375902c07
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 27bf29d212de
Choose a head ref
  • 3 commits
  • 1 file changed
  • 2 contributors

Commits on Aug 22, 2016

  1. add specs for non-ASCII symbols

    phluid61 committed Aug 22, 2016
    Copy the full SHA
    12d85c1 View commit details
  2. Copy the full SHA
    48f2b21 View commit details

Commits on Jan 10, 2018

  1. Merge pull request #4099 from phluid61/feature/unicode-symbol-spec

    specs for Unicode symbols
    kares authored Jan 10, 2018
    Copy the full SHA
    27bf29d View commit details
Showing with 79 additions and 4 deletions.
  1. +79 −4 spec/regression/symbol_encoding_spec.rb
83 changes: 79 additions & 4 deletions spec/regression/symbol_encoding_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,86 @@
require 'rspec'

describe "symbol encoding" do
it "should be US-ASCII" do
expect(:foo.encoding.name).to eq("US-ASCII")
describe "for ASCII-compatible symbols" do
it "should be US-ASCII" do
expect(:foo.encoding.name).to eq("US-ASCII")
end

it "should be US-ASCII after converting to string" do
expect(:foo.to_s.encoding.name).to eq("US-ASCII")
end
end

describe "for bare symbols with ISO-8859-1 compatible non-ASCII codepoints" do
it "should be UTF-8" do
expect(.encoding.name).to eq("UTF-8")
end

it "should be UTF-8 after converting to string" do
expect(.to_s.encoding.name).to eq("UTF-8")
end

it "should preserve characters after converting to string" do
expect(.to_s).to eq("×")
end

it "should preserve characters when inspected" do
expect(.inspect).to eq(":×")
end
end

describe "for bare symbols with non-ISO-8859-1 codepoints" do
it "should be UTF-8" do
expect(.encoding.name).to eq("UTF-8")
end

it "should be UTF-8 after converting to string" do
expect(.to_s.encoding.name).to eq("UTF-8")
end

it "should preserve characters after converting to string" do
expect(.to_s).to eq("λ")
end

it "should preserve characters when inspected" do
expect(.inspect).to eq(":λ")
end
end

describe "for quoted symbols with ISO-8859-1 compatible non-ASCII codepoints" do
it "should be UTF-8" do
expect(:"×".encoding.name).to eq("UTF-8")
end

it "should be UTF-8 after converting to string" do
expect(:"×".to_s.encoding.name).to eq("UTF-8")
end

it "should preserve characters after converting to string" do
expect(:"×".to_s).to eq("×")
end

it "should preserve characters when inspected" do
expect(:"×".inspect).to eq(":×")
end
end

it "should be US-ASCII after converting to string" do
expect(:foo.to_s.encoding.name).to eq("US-ASCII")
describe "for quoted symbols with non-ISO-8859-1 codepoints" do
it "should be UTF-8" do
expect(:"λ".encoding.name).to eq("UTF-8")
end

it "should be UTF-8 after converting to string" do
expect(:"λ".to_s.encoding.name).to eq("UTF-8")
end

it "should preserve characters after converting to string" do
expect(:"λ".to_s).to eq("λ")
end

it "should preserve characters when inspected" do
expect(:"λ".inspect).to eq(":λ")
end
end

it "symbol with accents should preserve accents when converted to string" do
@@ -26,3 +100,4 @@
end

end