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: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dd4d8a34dfd1
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e408a1aec50a
Choose a head ref
  • 2 commits
  • 4 files changed
  • 2 contributors

Commits on May 5, 2015

  1. Copy the full SHA
    7451e1b View commit details
  2. Merge pull request #833 from vais/string-initialize

    String#initialize with an argument is not supported
    elia committed May 5, 2015
    Copy the full SHA
    e408a1a View commit details
Showing with 23 additions and 14 deletions.
  1. +9 −0 opal/corelib/string.rb
  2. +0 −14 spec/filters/bugs/string.rb
  3. +12 −0 spec/filters/unsupported/mutable_strings.rb
  4. +2 −0 spec/filters/unsupported/private_methods.rb
9 changes: 9 additions & 0 deletions opal/corelib/string.rb
Original file line number Diff line number Diff line change
@@ -19,6 +19,15 @@ def self.new(str = '')
`new String(str)`
end

def initialize(str = undefined)
%x{
if (str === undefined) {
return self;
}
}
raise NotImplementedError, 'Mutable strings are not supported in Opal.'
end

def %(data)
if Array === data
format(self, *data)
14 changes: 0 additions & 14 deletions spec/filters/bugs/string.rb
Original file line number Diff line number Diff line change
@@ -58,20 +58,6 @@
fails "String#each_byte keeps iterating from the old position (to new string end) when self changes"
fails "String#each_byte passes each byte in self to the given block"

fails "String#initialize with an argument raises a RuntimeError on a frozen instance when self-replacing"
fails "String#initialize with an argument raises a RuntimeError on a frozen instance that is modified"
fails "String#initialize with an argument raises a TypeError if other can't be converted to string"
fails "String#initialize with an argument tries to convert other to string using to_str"
fails "String#initialize with an argument replaces the encoding of self with that of other"
fails "String#initialize with an argument does not trust self if other is trusted"
fails "String#initialize with an argument untrusts self if other is untrusted"
fails "String#initialize with an argument does not untaint self if other is untainted"
fails "String#initialize with an argument taints self if other is tainted"
fails "String#initialize with an argument replaces the content of self with other"
fails "String#initialize with an argument returns self"
fails "String#initialize with no arguments does not raise an exception when frozen"
fails "String#initialize is a private method"

fails "String#to_c returns a Complex object"
fails "String#to_c understands integers"
fails "String#to_c understands negative integers"
12 changes: 12 additions & 0 deletions spec/filters/unsupported/mutable_strings.rb
Original file line number Diff line number Diff line change
@@ -383,4 +383,16 @@

fails "String#each_line does not care if the string is modified while substituting"
fails "String#lines does not care if the string is modified while substituting"

fails "String#initialize with an argument raises a RuntimeError on a frozen instance when self-replacing"
fails "String#initialize with an argument raises a RuntimeError on a frozen instance that is modified"
fails "String#initialize with an argument raises a TypeError if other can't be converted to string"
fails "String#initialize with an argument tries to convert other to string using to_str"
fails "String#initialize with an argument replaces the encoding of self with that of other"
fails "String#initialize with an argument does not trust self if other is trusted"
fails "String#initialize with an argument untrusts self if other is untrusted"
fails "String#initialize with an argument does not untaint self if other is untainted"
fails "String#initialize with an argument taints self if other is tainted"
fails "String#initialize with an argument replaces the content of self with other"
fails "String#initialize with an argument returns self"
end
2 changes: 2 additions & 0 deletions spec/filters/unsupported/private_methods.rb
Original file line number Diff line number Diff line change
@@ -50,4 +50,6 @@
fails "Kernel#warn is a private method"

fails "Module#instance_methods makes a private Object instance method public in Kernel"

fails "String#initialize is a private method"
end