require 'test_helper' setup_database() require 'build-tool/cfg/parser' class TestParserSvn < ActiveSupport::TestCase def setup @configuration = BuildTool::Configuration.new() @configuration.truncate() @parser = BuildTool::Cfg::Parser.new( @configuration ) end test "Parses a valid svn repository declation." do @configuration.add_server( BuildTool::Server.new( 'svn.kde.org', 'svn://anonsvn.kde.org/home/kde' ) ) @configuration.add_repository( BuildTool::Repository.new( 'kde' ) ) @configuration.repository( 'kde' ).server = @configuration.server( 'svn.kde.org' ) assert_nothing_raised() { @parser.parse_string <<-EOF } module "oxygen-icons" vcs svn remote-path "kdesupport/oxygen" use repository "kde" end # vcs end # module EOF # Now check the parsed configuration assert_not_nil( @configuration.module('oxygen-icons') ) assert_attributes( @configuration.module('oxygen-icons'), { :vcs => { :name => 'svn', :config => { :repository => { :name => 'kde', :url => 'svn://anonsvn.kde.org/home/kde' }, :remote_path => "kdesupport/oxygen" } } } ) end test "SVN Repository inheritance works." do @configuration.add_server( BuildTool::Server.new( 'svn.kde.org', 'svn://anonsvn.kde.org/home/kde' ) ) @configuration.add_repository( BuildTool::Repository.new( 'kde' ) ) @configuration.repository( 'kde' ).server = @configuration.server( 'svn.kde.org' ) assert_nothing_raised() { @parser.parse_string <<-EOF } module "oxygen-icons" vcs svn remote-path "kdesupport/oxygen" use repository "kde" end # vcs end # module module "oxygen-icons" vcs svn < remote-path "kdesupport/oxygen-neu" end # vcs end # module EOF # Now check the parsed configuration assert_not_nil( @configuration.module('oxygen-icons') ) assert_attributes( @configuration.module('oxygen-icons'), { :vcs => { :name => 'svn', :config => { :repository => { :name => 'kde', :url => 'svn://anonsvn.kde.org/home/kde' }, :remote_path => "kdesupport/oxygen-neu" } } } ) end end