Codebase list ohcount / e0259188-7180-4bbc-a711-b2cd8983feeb/main test / unit / ruby / gestalt / csharp_using_rule_test.rb
e0259188-7180-4bbc-a711-b2cd8983feeb/main

Tree @e0259188-7180-4bbc-a711-b2cd8983feeb/main (Download .tar.gz)

csharp_using_rule_test.rb @e0259188-7180-4bbc-a711-b2cd8983feeb/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