Sha256: 2f921d420cd1d78a0d7cc52aeb22b35c36d6558ba36c72e189fd9071cd89f843

Contents?: true

Size: 1.27 KB

Versions: 69

Compression:

Stored size: 1.27 KB

Contents

#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../test_helper'
require 'sass/util/normalized_map'

class NormalizedMapTest < MiniTest::Test
  extend PublicApiLinter

  lint_api Hash, Sass::Util::NormalizedMap

  def lint_instance
    Sass::Util::NormalizedMap.new
  end

  def test_normalized_map_errors_unless_explicitly_implemented
    assert Sass.tests_running
    assert_raise_message(ArgumentError, "The method invert must be implemented explicitly") do
      Sass::Util::NormalizedMap.new.invert
    end
  end

  def test_normalized_map_does_not_error_when_released
    Sass.tests_running = false
    assert_equal({}, Sass::Util::NormalizedMap.new.invert)
  ensure
    Sass.tests_running = true
  end

  def test_basic_lifecycle
    m = Sass::Util::NormalizedMap.new
    m["a-b"] = 1
    assert_equal ["a_b"], m.keys
    assert_equal 1, m["a_b"]
    assert_equal 1, m["a-b"]
    assert m.has_key?("a_b")
    assert m.has_key?("a-b")
    assert_equal({"a-b" => 1}, m.as_stored)
    assert_equal 1, m.delete("a-b")
    assert !m.has_key?("a-b")
    m["a_b"] = 2
    assert_equal({"a_b" => 2}, m.as_stored)
  end

  def test_dup
    m = Sass::Util::NormalizedMap.new
    m["a-b"] = 1
    m2 = m.dup
    m.delete("a-b")
    assert !m.has_key?("a-b")
    assert m2.has_key?("a-b")
  end
end

Version data entries

69 entries across 66 versions & 7 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/sass-3.4.25/test/sass/util/normalized_map_test.rb
brakeman-4.3.1 bundle/ruby/2.5.0/gems/sass-3.4.25/test/sass/util/normalized_map_test.rb
brakeman-4.3.0 bundle/ruby/2.5.0/gems/sass-3.4.25/test/sass/util/normalized_map_test.rb
brakeman-4.2.1 bundle/ruby/2.5.0/gems/sass-3.4.25/test/sass/util/normalized_map_test.rb
brakeman-4.2.0 bundle/ruby/2.3.0/gems/sass-3.4.25/test/sass/util/normalized_map_test.rb
brakeman-4.1.1 bundle/ruby/2.3.0/gems/sass-3.4.25/test/sass/util/normalized_map_test.rb
brakeman-4.1.0 bundle/ruby/2.3.0/gems/sass-3.4.25/test/sass/util/normalized_map_test.rb
brakeman-4.0.1 bundle/ruby/2.3.0/gems/sass-3.4.25/test/sass/util/normalized_map_test.rb
brakeman-4.0.1.pre1 bundle/ruby/2.3.0/gems/sass-3.4.25/test/sass/util/normalized_map_test.rb
brakeman-4.0.0 bundle/ruby/2.3.0/gems/sass-3.4.25/test/sass/util/normalized_map_test.rb
brakeman-3.7.2 bundle/ruby/2.3.0/gems/sass-3.4.25/test/sass/util/normalized_map_test.rb
brakeman-3.7.1 bundle/ruby/2.3.0/gems/sass-3.4.25/test/sass/util/normalized_map_test.rb
sass-3.4.25 test/sass/util/normalized_map_test.rb
brakeman-3.7.0 bundle/ruby/2.3.0/gems/sass-3.4.24/test/sass/util/normalized_map_test.rb
brakeman-3.6.2 bundle/ruby/2.3.0/gems/sass-3.4.24/test/sass/util/normalized_map_test.rb
sass-3.4.24 test/sass/util/normalized_map_test.rb
brakeman-3.6.1 bundle/ruby/2.3.0/gems/sass-3.4.23/test/sass/util/normalized_map_test.rb
brakeman-3.6.0 bundle/ruby/2.3.0/gems/sass-3.4.23/test/sass/util/normalized_map_test.rb
brakeman-3.5.0 bundle/ruby/2.3.0/gems/sass-3.4.23/test/sass/util/normalized_map_test.rb
arcabouco-0.2.13 vendor/bundle/gems/sass-3.4.22/test/sass/util/normalized_map_test.rb