<commit_before># Copyright (c) 2011 Pluron, Inc.

require 'assert_value'

class AssertValueTest < ASSERT_VALUE_TEST_FRAMEWORK == :new_minitest ? Minitest::Test : Test::Unit::TestCase

    def test_basic_assert_value
        assert_value "foo", <<-END
            foo
        END
    end

    def test_assert_value_with_files
        assert_value "foo", :log => 'test/logs/assert_value_with_files.log.ref'
    end

    def test_assert_value_empty_string
        # These two calls are the same
        assert_value ""
        assert_value "", <<-END
        END
    end

    def test_assert_value_exception
        assert_value(<<-END) do
            Exception NoMethodError: undefined method `+' for nil:NilClass
        END
            nil + 1
        end
    end

    def test_assert_value_for_block_value
        assert_value(<<-END) do
            All Ok!
        END
            a = "All Ok!"
        end
    end

    def test_assert_value_exception_with_files
        assert_value(:log => 'test/logs/assert_value_exception_with_files.log.ref') do
            nil + 1
        end
    end

    def test_assert_value_block_alternative_syntax
        assert_value(<<-END) {
            Exception NoMethodError: undefined method `+' for nil:NilClass
        END
            nil + 1
        }
    end

    def test_assert_value_block_alternative_syntax_one_liner
        assert_value(<<-END) { nil + 1 }
            Exception NoMethodError: undefined method `+' for nil:NilClass
        END
    end

    def test_assert_value_for_empty_block
        # These calls are the same
        assert_value { }

        assert_value do end

        assert_value(<<-END) { }
        END

        assert_value(<<-END) do end
        END
    end

    def test_assert_value_for_nil_block_result
        # These calls are the same
        assert_value { nil }

        assert_value do nil end

        assert_value(<<-END) { nil }
        END

        assert_value(<<-END) do nil end
        END
    end

end
<commit_msg>Use correct TestCase class depending on test framework in assert_value_test.rb<commit_after># Copyright (c) 2011 Pluron, Inc.

require 'assert_value'

test_class = case ASSERT_VALUE_TEST_FRAMEWORK
    when :new_minitest then Minitest::Test
    when :old_minitest then MiniTest::Unit::TestCase
    when :test_unit then Test::Unit::TestCase
    else raise "Unknown test framework"
end

class AssertValueTest < test_class

    def test_basic_assert_value
        assert_value "foo", <<-END
            foo
        END
    end

    def test_assert_value_with_files
        assert_value "foo", :log => 'test/logs/assert_value_with_files.log.ref'
    end

    def test_assert_value_empty_string
        # These two calls are the same
        assert_value ""
        assert_value "", <<-END
        END
    end

    def test_assert_value_exception
        assert_value(<<-END) do
            Exception NoMethodError: undefined method `+' for nil:NilClass
        END
            nil + 1
        end
    end

    def test_assert_value_for_block_value
        assert_value(<<-END) do
            All Ok!
        END
            a = "All Ok!"
        end
    end

    def test_assert_value_exception_with_files
        assert_value(:log => 'test/logs/assert_value_exception_with_files.log.ref') do
            nil + 1
        end
    end

    def test_assert_value_block_alternative_syntax
        assert_value(<<-END) {
            Exception NoMethodError: undefined method `+' for nil:NilClass
        END
            nil + 1
        }
    end

    def test_assert_value_block_alternative_syntax_one_liner
        assert_value(<<-END) { nil + 1 }
            Exception NoMethodError: undefined method `+' for nil:NilClass
        END
    end

    def test_assert_value_for_empty_block
        # These calls are the same
        assert_value { }

        assert_value do end

        assert_value(<<-END) { }
        END

        assert_value(<<-END) do end
        END
    end

    def test_assert_value_for_nil_block_result
        # These calls are the same
        assert_value { nil }

        assert_value do nil end

        assert_value(<<-END) { nil }
        END

        assert_value(<<-END) do nil end
        END
    end

end

{'fraction_non_alphanumeric': 0.06657223796033994, 'fraction_numerical': 0.003777148253068933, 'mean_word_length': 2.0438218390804597, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2101615', 'n_tokens_mistral': 1293, 'n_tokens_neox': 1242, 'n_words': 317}