summaryrefslogtreecommitdiff
path: root/php/test
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2011-03-14 15:27:15 +0100
committerJose <jose@zeroc.com>2011-03-14 15:27:15 +0100
commit986249ba3b9cf5e9f75acf0a68ebdfce68201a0a (patch)
treefea8f1537438f037bd71609a4ddd0cb7188c7625 /php/test
parent4971 - BuiltinSequences.ice not compiled with --stream in .NET (diff)
downloadice-986249ba3b9cf5e9f75acf0a68ebdfce68201a0a.tar.bz2
ice-986249ba3b9cf5e9f75acf0a68ebdfce68201a0a.tar.xz
ice-986249ba3b9cf5e9f75acf0a68ebdfce68201a0a.zip
5030 - Patch for slice2cs with scoped constants
Diffstat (limited to 'php/test')
-rw-r--r--php/test/Ice/defaultValue/Client.php32
-rw-r--r--php/test/Ice/defaultValue/Test.ice43
2 files changed, 66 insertions, 9 deletions
diff --git a/php/test/Ice/defaultValue/Client.php b/php/test/Ice/defaultValue/Client.php
index a5178423fa0..b9d2261242c 100644
--- a/php/test/Ice/defaultValue/Client.php
+++ b/php/test/Ice/defaultValue/Client.php
@@ -37,6 +37,10 @@ function allTests()
$green = $NS ? constant("Test\\Color::green") : constant("Test_Color::green");
$blue = $NS ? constant("Test\\Color::blue") : constant("Test_Color::blue");
+ $nRed = $NS ? constant("Test\\Nested\\Color::red") : constant("Test_Nested_Color::red");
+ $nGreen = $NS ? constant("Test\\Nested\\Color::green") : constant("Test_Nested_Color::green");
+ $nBlue = $NS ? constant("Test\\Nested\\Color::blue") : constant("Test_Nested_Color::blue");
+
echo "testing default values... ";
flush();
@@ -51,7 +55,12 @@ function allTests()
test($v->f == 5.1);
test($v->d == 6.2);
test($v->str == "foo bar");
- test($v->c == $red);
+ test($v->c1 == $red);
+ test($v->c2 == $green);
+ test($v->c3 == $blue);
+ test($v->nc1 == $nRed);
+ test($v->nc2 == $nGreen);
+ test($v->nc3 == $nBlue);
test(strlen($v->noDefault) == 0);
}
@@ -65,7 +74,12 @@ function allTests()
test($v->f == constant($NS ? "Test\\ConstFloat" : "Test_ConstFloat"));
test($v->d == constant($NS ? "Test\\ConstDouble" : "Test_ConstDouble"));
test($v->str == constant($NS ? "Test\\ConstString" : "Test_ConstString"));
- test($v->c == constant($NS ? "Test\\ConstColor" : "Test_ConstColor"));
+ test($v->c1 == constant($NS ? "Test\\ConstColor1" : "Test_ConstColor1"));
+ test($v->c2 == constant($NS ? "Test\\ConstColor2" : "Test_ConstColor2"));
+ test($v->c3 == constant($NS ? "Test\\ConstColor3" : "Test_ConstColor3"));
+ test($v->nc1 == constant($NS ? "Test\\ConstNestedColor1" : "Test_ConstNestedColor1"));
+ test($v->nc2 == constant($NS ? "Test\\ConstNestedColor2" : "Test_ConstNestedColor2"));
+ test($v->nc3 == constant($NS ? "Test\\ConstNestedColor3" : "Test_ConstNestedColor3"));
}
{
@@ -94,7 +108,12 @@ function allTests()
test($v->d == 6.2);
test($v->str == "foo bar");
test(strlen($v->noDefault) == 0);
- test($v->c == $green);
+ test($v->c1 == $red);
+ test($v->c2 == $green);
+ test($v->c3 == $blue);
+ test($v->nc1 == $nRed);
+ test($v->nc2 == $nGreen);
+ test($v->nc3 == $nBlue);
}
{
@@ -123,7 +142,12 @@ function allTests()
test($v->d == 6.2);
test($v->str == "foo bar");
test(strlen($v->noDefault) == 0);
- test($v->c == $green);
+ test($v->c1 == $red);
+ test($v->c2 == $green);
+ test($v->c3 == $blue);
+ test($v->nc1 == $nRed);
+ test($v->nc2 == $nGreen);
+ test($v->nc3 == $nBlue);
}
echo "ok\n";
}
diff --git a/php/test/Ice/defaultValue/Test.ice b/php/test/Ice/defaultValue/Test.ice
index 945f8ff3cb8..ed52afbe47e 100644
--- a/php/test/Ice/defaultValue/Test.ice
+++ b/php/test/Ice/defaultValue/Test.ice
@@ -15,6 +15,13 @@ module Test
enum Color { red, green, blue };
+module Nested
+{
+
+enum Color { red, green, blue };
+
+};
+
struct Struct1
{
bool boolFalse = false;
@@ -26,7 +33,12 @@ struct Struct1
float f = 5.1;
double d = 6.2;
string str = "foo bar";
- Color c = red;
+ Color c1 = ::Test::red;
+ Color c2 = Test::green;
+ Color c3 = blue;
+ Nested::Color nc1 = ::Test::Nested::red;
+ Nested::Color nc2 = Nested::green;
+ Nested::Color nc3 = Nested::blue;
string noDefault;
};
@@ -38,7 +50,13 @@ const long ConstLong = 4;
const float ConstFloat = 5.1;
const double ConstDouble = 6.2;
const string ConstString = "foo bar";
-const Color ConstColor = red;
+const Color ConstColor1 = ::Test::red;
+const Color ConstColor2 = Test::green;
+const Color ConstColor3 = blue;
+const Nested::Color ConstNestedColor1 = ::Test::Nested::red;
+const Nested::Color ConstNestedColor2 = Test::Nested::green;
+const Nested::Color ConstNestedColor3 = Nested::blue;
+
struct Struct2
{
@@ -50,7 +68,12 @@ struct Struct2
float f = ConstFloat;
double d = ConstDouble;
string str = ConstString;
- Color c = ConstColor;
+ Color c1 = ConstColor1;
+ Color c2 = ConstColor2;
+ Color c3 = ConstColor3;
+ Nested::Color nc1 = ConstNestedColor1;
+ Nested::Color nc2 = ConstNestedColor2;
+ Nested::Color nc3 = ConstNestedColor3;
};
class Base
@@ -69,7 +92,12 @@ class Base
class Derived extends Base
{
- Color c = green;
+ Color c1 = ::Test::red;
+ Color c2 = Test::green;
+ Color c3 = blue;
+ Nested::Color nc1 = ::Test::Nested::red;
+ Nested::Color nc2 = Nested::green;
+ Nested::Color nc3 = Nested::blue;
};
exception BaseEx
@@ -88,7 +116,12 @@ exception BaseEx
exception DerivedEx extends BaseEx
{
- Color c = green;
+ Color c1 = ConstColor1;
+ Color c2 = ConstColor2;
+ Color c3 = ConstColor3;
+ Nested::Color nc1 = ConstNestedColor1;
+ Nested::Color nc2 = ConstNestedColor2;
+ Nested::Color nc3 = ConstNestedColor3;
};
};