Sha256: 993b8d03e6aba9ac02950a74f9386200bd672f12b1b79dbcd35f4342ca1ec8d7

Contents?: true

Size: 444 Bytes

Versions: 1

Compression:

Stored size: 444 Bytes

Contents

# encoding: UTF-8
# frozen_string_literal: true

require 'test-unit'
require 'nil-if-zero'

class NilIfZeroTest < Test::Unit::TestCase
  def test_nil_if_zero
    assert_equal 1, 1.nil_if_zero
    assert_nil 0.nil_if_zero
    assert_raise(NoMethodError) { 1.0.nil_if_zero }
  end

  def test_nil_unless_zero
    assert_nil 1.nil_unless_zero
    assert_equal 0, 0.nil_unless_zero
    assert_raise(NoMethodError) { 1.0.nil_unless_zero }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nil-if-zero-1.0.0 test/test-nil-if-zero.rb