Sha256: 27bf652d4ae5373ef3855e06274a867f53c1ec603a09fb21501511d9ef3f1ee4

Contents?: true

Size: 791 Bytes

Versions: 23

Compression:

Stored size: 791 Bytes

Contents

require 'test/unit'
require 'nodejs'

class TestString < Test::Unit::TestCase
  def test_should_get_bytes
    assert_equal('foo'.bytesize, 3)
    assert_equal('foo'.each_byte.to_a, [102, 111, 111])
    assert_equal('foo'.bytes, [102, 111, 111])
    assert_equal('foo'.bytes, [102, 111, 111])
  end

  def test_frozen
    # Commented out examples somehow work in the strict mode,
    # but otherwise they don't. I have unfortunately no idea
    # on where it's mangled, but then I don't see it really
    # as a really harmful thing.

    #assert_equal((-'x').frozen?, true)
    assert_equal((+'x').frozen?, false)
    #assert_equal((-+-'x').frozen?, true)
    assert_equal((+-+'x').frozen?, false)
    #assert_equal((`'x'`).frozen?, true)
    assert_equal((+`'x'`).frozen?, false)
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
opal-1.7.4 test/nodejs/test_string.rb
opal-1.7.3 test/nodejs/test_string.rb
opal-1.7.2 test/nodejs/test_string.rb
opal-1.7.1 test/nodejs/test_string.rb
opal-1.7.0 test/nodejs/test_string.rb
opal-1.7.0.rc1 test/nodejs/test_string.rb
opal-1.6.1 test/nodejs/test_string.rb
opal-1.6.0 test/nodejs/test_string.rb
opal-1.6.0.rc1 test/nodejs/test_string.rb
opal-1.6.0.alpha1 test/nodejs/test_string.rb
opal-1.5.1 test/nodejs/test_string.rb
opal-1.5.0 test/nodejs/test_string.rb
opal-1.5.0.rc1 test/nodejs/test_string.rb
opal-1.4.1 test/nodejs/test_string.rb
opal-1.4.0 test/nodejs/test_string.rb
opal-1.4.0.alpha1 test/nodejs/test_string.rb
opal-1.3.2 test/nodejs/test_string.rb
opal-1.3.1 test/nodejs/test_string.rb
opal-1.3.0 test/nodejs/test_string.rb
opal-1.3.0.rc1 test/nodejs/test_string.rb