Sha256: 5cbd47e9de063298749d158b168d756bd49b2ec24a3fad1bef084067f2374b86

Contents?: true

Size: 845 Bytes

Versions: 9

Compression:

Stored size: 845 Bytes

Contents

require 'tutil'
require 'rant/c/include'

$testCDir ||= File.expand_path(File.dirname(__FILE__))

class TestCParseIncludes < Test::Unit::TestCase
    C = Rant::C
    def setup
	Dir.chdir($testCDir)
    end
    def test_parse_source
	src = File.read "source.c"
	sc, lc = C::Include.parse_includes(src)
	assert_equal(%w(stdio.h file.h std), sc)
	assert_equal(
	    %w(util.h mylib.h custom custom2.h), lc)
    end
    def test_parse_empty
	sc, lc = C::Include.parse_includes("")
	assert(sc.empty?)
	assert(lc.empty?)
    end
    def test_parse_nil
	assert_raises(ArgumentError) {
	    C::Include.parse_includes(nil)
	}
    end
    def test_accepts_to_str
	obj = Object.new
	def obj.to_str
	    "//"
	end
	lc, sc = nil, nil
	assert_nothing_raised {
	    sc, lc = C::Include.parse_includes(obj)
	}
	assert(sc.empty?)
	assert(lc.empty?)
    end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rant-0.4.2 test/c/test_parse_includes.rb
rant-0.4.4 test/c/test_parse_includes.rb
rant-0.4.6 test/c/test_parse_includes.rb
rant-0.4.8 test/c/test_parse_includes.rb
rant-0.5.2 test/c/test_parse_includes.rb
rant-0.4.0 test/c/test_parse_includes.rb
rant-0.3.8 test/c/test_parse_includes.rb
rant-0.5.0 test/c/test_parse_includes.rb
rant-0.5.4 test/c/test_parse_includes.rb