Sha256: 92ba3be0ff6820d1db1e634e9e1f62e49ac0faf01153c43d51fdea2f36dc9df2

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

#!/usr/bin/env ruby
DIRNAME = File.expand_path File.dirname(__FILE__)
Dir.chdir(DIRNAME)

ETEST_TEST=true

require "etest-unit"
require "expectation"

# ---------------------------------------------------------------------

$etest_stats = Hash.new(0)

module String::Etest
  def test_underscore
    $etest_stats[:underscore] += 1

    assert_equal "x", "X".underscore
    assert_equal "xa_la_nder", "XaLaNder".underscore
  end

  def test_camelize
    $etest_stats[:camelize] += 1

    assert_equal "X", "x".camelize
    assert_equal "XaLaNder", "xa_la_nder".camelize
  end
end

module Fixnum::Etest
  def test_success
    $etest_stats[:success] += 1

    assert true
  end
end

begin
  String.etest
  Fixnum.etest
  expect! $etest_stats => { :underscore => 1, :camelize => 1, :success => 1 }

  Fixnum.etest
  expect! $etest_stats => { :underscore => 1, :camelize => 1, :success => 2 }

  String.etest :test_camelize, :test_underscore
  expect! $etest_stats => { :underscore => 2, :camelize => 2, :success => 2 }

  begin
    String.etest :test_camelize, :nosuchtest
    expect! false
  rescue EtestUnit::Error
  end

  expect! $etest_stats => { :underscore => 2, :camelize => 2, :success => 2 }
rescue ArgumentError
  STDERR.puts "#{$!}; in #{$!.backtrace.first}"
  exit 1
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
etest-unit-0.7.4 test/etest_test.rb
etest-unit-0.7.3 test/etest_test.rb