Sha256: 23527168b9602a1abceb5c8d64f65a2ffdfaa72ee761ea6ca6b952f595ffdbea

Contents?: true

Size: 1.28 KB

Versions: 20

Compression:

Stored size: 1.28 KB

Contents

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

class NormalizedMapTest < Test::Unit::TestCase
  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

20 entries across 20 versions & 1 rubygems

Version Path
sass-3.3.14 test/sass/util/normalized_map_test.rb
sass-3.3.13 test/sass/util/normalized_map_test.rb
sass-3.3.12 test/sass/util/normalized_map_test.rb
sass-3.3.11 test/sass/util/normalized_map_test.rb
sass-3.3.10 test/sass/util/normalized_map_test.rb
sass-3.3.9 test/sass/util/normalized_map_test.rb
sass-3.3.8 test/sass/util/normalized_map_test.rb
sass-3.3.7 test/sass/util/normalized_map_test.rb
sass-3.3.6 test/sass/util/normalized_map_test.rb
sass-3.3.5 test/sass/util/normalized_map_test.rb
sass-3.3.4 test/sass/util/normalized_map_test.rb
sass-3.3.3 test/sass/util/normalized_map_test.rb
sass-3.3.2 test/sass/util/normalized_map_test.rb
sass-3.3.1 test/sass/util/normalized_map_test.rb
sass-3.3.0 test/sass/util/normalized_map_test.rb
sass-3.3.0.rc.6 test/sass/util/normalized_map_test.rb
sass-3.3.0.rc.5 test/sass/util/normalized_map_test.rb
sass-3.3.0.rc.4 test/sass/util/normalized_map_test.rb
sass-3.3.0.rc.3 test/sass/util/normalized_map_test.rb
sass-3.3.0.rc.2 test/sass/util/normalized_map_test.rb