diff options
Diffstat (limited to 'ruby/test/Ice/properties/Client.rb')
-rw-r--r-- | ruby/test/Ice/properties/Client.rb | 102 |
1 files changed, 50 insertions, 52 deletions
diff --git a/ruby/test/Ice/properties/Client.rb b/ruby/test/Ice/properties/Client.rb index 62c98f9e7ce..cb793b85fe5 100644 --- a/ruby/test/Ice/properties/Client.rb +++ b/ruby/test/Ice/properties/Client.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -# encoding: UTF-8 +# encoding: utf-8 # ********************************************************************** # # Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. @@ -11,13 +11,7 @@ require 'Ice' -def test(b) - if !b - raise RuntimeError, 'test assertion failed' - end -end - -class Client < Ice::Application +class App < Ice::Application def run(args) print "testing load properties from UTF-8 path using Ice::Application... " properties = Ice::Application::communicator().getProperties() @@ -31,53 +25,57 @@ class Client < Ice::Application end end -print "testing load properties from UTF-8 path... " -properties = Ice.createProperties(ARGV) -properties.load("./config/中国_client.config") -test(properties.getProperty("Ice.Trace.Network") == "1") -test(properties.getProperty("Ice.Trace.Protocol") == "1") -test(properties.getProperty("Config.Path").eql? "./config/中国_client.config") -test(properties.getProperty("Ice.ProgramName") == "PropertiesClient") -puts "ok" -app = Client.new() -app.main(ARGV, "./config/中国_client.config") +class Client < ::TestHelper + def run(args) -print "testing using Ice.Config with multiple config files... " -properties = Ice.createProperties(["--Ice.Config=config/config.1, config/config.2, config/config.3"]); -test(properties.getProperty("Config1") == "Config1"); -test(properties.getProperty("Config2") == "Config2"); -test(properties.getProperty("Config3") == "Config3"); -puts "ok" + print "testing load properties from UTF-8 path... " + properties = Ice.createProperties(args) + properties.load("./config/中国_client.config") + test(properties.getProperty("Ice.Trace.Network") == "1") + test(properties.getProperty("Ice.Trace.Protocol") == "1") + test(properties.getProperty("Config.Path").eql? "./config/中国_client.config") + test(properties.getProperty("Ice.ProgramName") == "PropertiesClient") + puts "ok" + + app = App.new() + app.main(args, "./config/中国_client.config") -print "testing configuration file escapes... " -properties = Ice.createProperties(["--Ice.Config=config/escapes.cfg"]) + print "testing using Ice.Config with multiple config files... " + properties = Ice.createProperties(["--Ice.Config=config/config.1, config/config.2, config/config.3"]); + test(properties.getProperty("Config1") == "Config1"); + test(properties.getProperty("Config2") == "Config2"); + test(properties.getProperty("Config3") == "Config3"); + puts "ok" -props = { "Foo\tBar" => "3", - "Foo\\tBar" => "4", - "Escape\\ Space" => "2", - "Prop1" => "1", - "Prop2" => "2", - "Prop3" => "3", - "My Prop1" => "1", - "My Prop2" => "2", - "My.Prop1" => "a property", - "My.Prop2" => "a property", - "My.Prop3" => " a property ", - "My.Prop4" => " a property ", - "My.Prop5" => "a \\ property", - "foo=bar" => "1", - "foo#bar" => "2", - "foo bar" => "3", - "A" => "1", - "B" => "2 3 4", - "C" => "5=#6", - "AServer" => "\\\\server\\dir", - "BServer" => "\\server\\dir" } + print "testing configuration file escapes... " + properties = Ice.createProperties(["--Ice.Config=config/escapes.cfg"]) -props.each do |key, value| - test(properties.getProperty(key) == value) -end -puts "ok" + props = { "Foo\tBar" => "3", + "Foo\\tBar" => "4", + "Escape\\ Space" => "2", + "Prop1" => "1", + "Prop2" => "2", + "Prop3" => "3", + "My Prop1" => "1", + "My Prop2" => "2", + "My.Prop1" => "a property", + "My.Prop2" => "a property", + "My.Prop3" => " a property ", + "My.Prop4" => " a property ", + "My.Prop5" => "a \\ property", + "foo=bar" => "1", + "foo#bar" => "2", + "foo bar" => "3", + "A" => "1", + "B" => "2 3 4", + "C" => "5=#6", + "AServer" => "\\\\server\\dir", + "BServer" => "\\server\\dir" } -exit(0) + props.each do |key, value| + test(properties.getProperty(key) == value) + end + puts "ok" + end +end |