[cairo-commit] rcairo/test test_pkg_config.rb,1.1,1.2
Kouhei Sutou
commit at pdx.freedesktop.org
Thu Apr 3 05:19:52 PDT 2008
Committed by: kou
Update of /cvs/cairo/rcairo/test
In directory kemper:/tmp/cvs-serv19391/test
Modified Files:
test_pkg_config.rb
Log Message:
* pkg-config.rb, test/test_pkg_config.rb: support
--with-override-variables extconf.rb option.
Index: test_pkg_config.rb
===================================================================
RCS file: /cvs/cairo/rcairo/test/test_pkg_config.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test_pkg_config.rb 24 Feb 2008 07:42:58 -0000 1.1
+++ test_pkg_config.rb 3 Apr 2008 12:23:56 -0000 1.2
@@ -59,6 +59,28 @@
assert_pkg_config("cairo", ["--modversion"], @cairo.version)
end
+ def test_parse_override_variables
+ assert_override_variables({}, nil)
+ assert_override_variables({"prefix" => "c:\\\\gtk-dev"},
+ "prefix=c:\\\\gtk-dev")
+ assert_override_variables({
+ "prefix" => "c:\\\\gtk-dev",
+ "includdir" => "d:\\\\gtk\\include"
+ },
+ ["prefix=c:\\\\gtk-dev",
+ "includdir=d:\\\\gtk\\include"].join(","))
+ end
+
+ def test_override_variables
+ overridden_prefix = "c:\\\\gtk-dev"
+ original_prefix = @cairo.variable("prefix")
+ assert_not_equal(overridden_prefix, original_prefix)
+ with_override_variables("prefix=#{overridden_prefix}") do
+ cairo = PackageConfig.new("cairo")
+ assert_equal(overridden_prefix, cairo.variable("prefix"))
+ end
+ end
+
private
def pkg_config(package, *args)
args = args.collect {|arg| arg.dump}.join(' ')
@@ -70,4 +92,30 @@
result = nil if result.empty?
assert_equal(result, actual)
end
+
+ def assert_override_variables(expected, override_variables)
+ with_override_variables(override_variables) do
+ cairo = PackageConfig.new("cairo")
+ assert_equal(expected, cairo.instance_variable_get("@override_variables"))
+ end
+ end
+
+ def with_override_variables(override_variables)
+ if override_variables.nil?
+ args = {}
+ else
+ args = {"--with-override-variables" => override_variables}
+ end
+ configure_args(args) do
+ yield
+ end
+ end
+
+ def configure_args(args)
+ original_configure_args = $configure_args
+ $configure_args = $configure_args.merge(args)
+ yield
+ ensure
+ $configure_args = original_configure_args
+ end
end
More information about the cairo-commit
mailing list