Skip to content

Commit

Permalink
Return string literal from the String#to_sym method. (#1835)
Browse files Browse the repository at this point in the history
  • Loading branch information
iliabylich committed Jun 1, 2018
1 parent 3bd7e24 commit a7f2efc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion opal/corelib/string.rb
Expand Up @@ -647,7 +647,7 @@ def inspect
end

def intern
self
`self.toString()`
end

def lines(separator = $/, &block)
Expand Down
9 changes: 9 additions & 0 deletions spec/opal/core/string/to_sym_spec.rb
@@ -0,0 +1,9 @@
require 'spec_helper'

describe 'String#to_sym' do
it 'returns a string literal' do
str = "string"
sym = str.to_sym
`typeof(sym)`.should == 'string'
end
end

0 comments on commit a7f2efc

Please sign in to comment.