Codebase list ohcount / 85d5c3b4-c1f3-4d55-a24f-4c231b8d4c21/main test / unit / ruby / gestalt / csharp_using_rule_test.rb
85d5c3b4-c1f3-4d55-a24f-4c231b8d4c21/main

Tree @85d5c3b4-c1f3-4d55-a24f-4c231b8d4c21/main (Download .tar.gz)

csharp_using_rule_test.rb @85d5c3b4-c1f3-4d55-a24f-4c231b8d4c21/mainraw · history · blame

require File.dirname(__FILE__) + '/../../test_helper'

class CSharpUsingRuleTest < Test::Unit::TestCase
  include Ohcount::Gestalt


  def test_sample
		cs = SourceFile.new("hello.cs", :contents => <<-INLINE
using System;
using System.Foo;
using NUnit.Framework;

namespace Hello
{
	/// Hi there
}
		INLINE
		)

		r = CSharpUsingRule.new(/System/)
		r.process_source_file(cs)
		assert_equal 2, r.count

		r = CSharpUsingRule.new(/^System$/)
		r.process_source_file(cs)
		assert_equal 1, r.count

		r = CSharpUsingRule.new(/.+/)
		r.process_source_file(cs)
		assert_equal 3, r.count

  end
end