Codebase list ohcount / 85ef4224-9298-4dc6-8a5a-b1f66d4179b3/main test / unit / ruby / gestalt / csharp_using_rule_test.rb
85ef4224-9298-4dc6-8a5a-b1f66d4179b3/main

Tree @85ef4224-9298-4dc6-8a5a-b1f66d4179b3/main (Download .tar.gz)

csharp_using_rule_test.rb @85ef4224-9298-4dc6-8a5a-b1f66d4179b3/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