test/base/test_compiler_dsl.rb in nanoc-4.0.0b1 vs test/base/test_compiler_dsl.rb in nanoc-4.0.0b2

- old
+ new

@@ -175,14 +175,15 @@ end def test_passthrough_with_full_identifiers with_site do File.open('nanoc.yaml', 'w') do |io| + io << 'string_pattern_type: legacy' << "\n" io << 'data_sources:' << "\n" io << ' -' << "\n" io << ' type: filesystem_unified' << "\n" - io << ' identifier_style: full' << "\n" + io << ' identifier_type: full' << "\n" end # Create rules File.open('Rules', 'w') do |io| io << 'passthrough \'*\'' @@ -264,39 +265,41 @@ assert_equal ['output/foo'], Dir['output/*'] assert_equal ['output/foo/index.html'], Dir['output/foo/*'] end end - def test_create_pattern_with_string + def test_create_pattern_with_string_with_no_config compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, {}) - pattern = compiler_dsl.create_pattern('/foo/*') - assert pattern.match?('/foo/a/a/a/a') + err = assert_raises(Nanoc::Int::Errors::GenericTrivial) do + compiler_dsl.create_pattern('/foo/*') + end + assert_equal 'Invalid string_pattern_type: ', err.message end - def test_create_pattern_with_string_with_glob_pattern_syntax - compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, { pattern_syntax: 'glob' }) + def test_create_pattern_with_string_with_glob_string_pattern_type + compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, { string_pattern_type: 'glob' }) pattern = compiler_dsl.create_pattern('/foo/*') assert pattern.match?('/foo/aaaa') refute pattern.match?('/foo/aaaa/') refute pattern.match?('/foo/a/a/a/a') end def test_create_pattern_with_regex - compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, {}) + compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, { string_pattern_type: 'glob' }) pattern = compiler_dsl.create_pattern(%r<\A/foo/a*/>) assert pattern.match?('/foo/aaaa/') end - def test_create_pattern_with_string_with_unknown_pattern_syntax - compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, { pattern_syntax: 'donkey' }) + def test_create_pattern_with_string_with_unknown_string_pattern_type + compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, { string_pattern_type: 'donkey' }) err = assert_raises(Nanoc::Int::Errors::GenericTrivial) do compiler_dsl.create_pattern('/foo/*') end - assert_equal 'Invalid pattern_syntax: donkey', err.message + assert_equal 'Invalid string_pattern_type: donkey', err.message end def test_identifier_to_regex_without_wildcards # Create compiler DSL compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, {})