diff options
Diffstat (limited to 'idlc/test')
-rw-r--r-- | idlc/test/const.idl | 50 | ||||
-rw-r--r-- | idlc/test/enum.idl | 24 | ||||
-rw-r--r-- | idlc/test/exception.idl | 20 | ||||
-rw-r--r-- | idlc/test/identifiers.idl | 22 | ||||
-rw-r--r-- | idlc/test/interface.idl | 51 | ||||
-rw-r--r-- | idlc/test/parser/attribute.tests | 223 | ||||
-rw-r--r-- | idlc/test/parser/constant.tests | 295 | ||||
-rw-r--r-- | idlc/test/parser/constructor.tests | 199 | ||||
-rw-r--r-- | idlc/test/parser/interfaceinheritance.tests | 280 | ||||
-rw-r--r-- | idlc/test/parser/makefile.mk | 55 | ||||
-rw-r--r-- | idlc/test/parser/methodoverload.tests | 124 | ||||
-rw-r--r-- | idlc/test/parser/polystruct.tests | 255 | ||||
-rw-r--r-- | idlc/test/parser/published.tests | 708 | ||||
-rw-r--r-- | idlc/test/parser/struct.tests | 55 | ||||
-rw-r--r-- | idlc/test/parser/typedef.tests | 67 | ||||
-rw-r--r-- | idlc/test/service.idl | 44 | ||||
-rw-r--r-- | idlc/test/singleton.idl | 41 | ||||
-rw-r--r-- | idlc/test/struct.idl | 107 | ||||
-rw-r--r-- | idlc/test/typelookup.idl | 63 | ||||
-rw-r--r-- | idlc/test/union.idl | 35 |
20 files changed, 2718 insertions, 0 deletions
diff --git a/idlc/test/const.idl b/idlc/test/const.idl new file mode 100644 index 000000000000..76b3d2a02e6b --- /dev/null +++ b/idlc/test/const.idl @@ -0,0 +1,50 @@ +module idlc +{ +module test +{ + const long l = 1; + const long add = 1 + 2; + const long sub = 3 - 2; + const hyper h = 123456789; + const float f7 = 3.4123; + const float f2 = 3.4123 + 10e-12; + const boolean bt = True; + const boolean bf = False; + const boolean and = bt & bf; + + /// SHORT_MAX + 1; + const short shortMax = -0x8000; + /// LONG_MAX + 1; + const unsigned long longMax = 0x80000000; + + +constants USER +{ + /// = 1 + const long FLAG1 = 0x00000001; + /// = 2 + const long FLAG2 = 0x00000002; + /// = 4 + const long FLAG3 = 0x00000004; + /// = 8 + const long FLAG4 = 0x00000008; + /// = 16 + const long FLAG5 = 0x00000010; + /// = 0 + const long FLAG6 = FLAG1 & FLAG2; + /// = 3 + const long FLAG7 = FLAG1 | FLAG2; + /// = 2 + const long FLAG8 = (FLAG1 | FLAG2) & FLAG2; + /// = 4 + const long FLAG9 = FLAG1 << 2; + /// = 32 + const long FLAG10 = (FLAG5 >> 1) << 2; + /// = 1 + const long FLAG11 = 33 % 4; + /// = 4 + const long FLAG12 = FLAG10 / 8; +}; + +}; +}; diff --git a/idlc/test/enum.idl b/idlc/test/enum.idl new file mode 100644 index 000000000000..2920d7fe6a0f --- /dev/null +++ b/idlc/test/enum.idl @@ -0,0 +1,24 @@ +module idlc +{ +module test +{ + +enum Error +{ + NONE, + FATAL, + SYSTEM, + RUNTIME +}; + +enum Warning +{ + NO, + USER = 2, + WRONGPASSWORD = 4, + IDFAILURE +}; + + +}; +}; diff --git a/idlc/test/exception.idl b/idlc/test/exception.idl new file mode 100644 index 000000000000..b53d1dbe74fd --- /dev/null +++ b/idlc/test/exception.idl @@ -0,0 +1,20 @@ +module idlc +{ +module test +{ + +exception BaseException +{ + string Description; +}; + +exception RuntimeException : BaseException +{ + long Id; + type Context; +}; + + +}; +}; + diff --git a/idlc/test/identifiers.idl b/idlc/test/identifiers.idl new file mode 100644 index 000000000000..d7af48867cf3 --- /dev/null +++ b/idlc/test/identifiers.idl @@ -0,0 +1,22 @@ +struct Identifiers +{ + long onlysmallalphas; + long smallMixedAlphas; + long CapMixedAlphas; + long ONLYCAPS; + long CAPS_WITH_UNDERSCORE; + long CAPS_WITH_UNDERSCORE_11; + long CAPS_WITH_UNDERSCORE11_11TEST; + long CapMixed_Alphas_11; + long m_CapMixedAlphas_11; // should be not allowed with -cid + long small_get; //should be not allowed with -cid + long small_11; //should be not allowed with -cid + long small_11small; //should be not allowed with -cid + long mixedAlphas_11CAPS; // should be not allowed with -cid + long mixedAlphas_11mixedAlphas; // should be not allowed with -cid + long _mixedAlphas; // should be not allowed with -cid +// long _mixedAlphas_; // should be not allowed +// long CapsMixedAlphas_; // should be not allowed +// long _CapsMixedAlphas_; // should be not allowed + +}; diff --git a/idlc/test/interface.idl b/idlc/test/interface.idl new file mode 100644 index 000000000000..18116bf963db --- /dev/null +++ b/idlc/test/interface.idl @@ -0,0 +1,51 @@ +#include <enum.idl> +#include <struct.idl> + +module idlc +{ + +module test +{ + +interface XBase +{ + [readonly, attribute] string description; + + string getDescription(); +}; + +interface XTestBaseTypes : XBase +{ + void voidFunc(); + [oneway] void onewayFunc(); + + short shortFunc( [in] short inparam, [out] short outparam, [inout] short inoutparam); + unsigned short uShortFunc( [in] unsigned short inparam, [out] unsigned short outparam, [inout] unsigned short inoutparam); + + long longFunc( [in] long inparam, [out] long outparam, [inout] long inoutparam); + unsigned long ulongFunc( [in] unsigned long inparam, [out] unsigned long outparam, [inout] unsigned long inoutparam); + + hyper hyperFunc( [in] hyper inparam, [out] hyper outparam, [inout] hyper inoutparam); + unsigned hyper uHyperFunc( [in] unsigned hyper inparam, [out] unsigned hyper outparam, [inout] unsigned hyper inoutparam); + + float floatFunc( [in] float inparam, [out] float outparam, [inout] float inoutparam); + double doubleFunc( [in] double inparam, [out] double outparam, [inout] double inoutparam); + char charFunc( [in] char inparam, [out] char outparam, [inout] char inoutparam); + string stringFunc( [in] string inparam, [out] string outparam, [inout] string inoutparam); + byte byteFunc( [in] byte inparam, [out] byte outparam, [inout] byte inoutparam); + + type typeFunc( [in] type inparam, [out] type outparam, [inout] type inoutparam); + any anyFunc( [in] any inparam, [out] any outparam, [inout] any inoutparam); +}; + + +interface XTestComplexTypes : XBase +{ + Error enumFunc( [in] Error inparam, [out] Error outparam, [inout] Error inoutparam); + + BaseStruct structFunc( [in] ::idlc::test::BaseStruct inparam, [out] idlc::test::BaseStruct outparam, [inout] BaseStruct inoutparam); +}; + +}; + +}; diff --git a/idlc/test/parser/attribute.tests b/idlc/test/parser/attribute.tests new file mode 100644 index 000000000000..2d12bd85bbb7 --- /dev/null +++ b/idlc/test/parser/attribute.tests @@ -0,0 +1,223 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXPECT SUCCESS "attribute.tests 1": +interface I1 { + [attribute] long a; +}; + + +EXPECT SUCCESS "attribute.tests 2": +interface I1 { + [attribute] long a {}; +}; + + +EXPECT FAILURE "attribute.tests 3": +interface I1 { + [attribute] long a { + get raises (); + }; +}; + + +EXPECT SUCCESS "attribute.tests 4": +exception E1 {}; +interface I1 { + [attribute] long a { + get raises (E1); + }; +}; + + +EXPECT SUCCESS "attribute.tests 5": +exception E1 {}; +interface I1 { + [attribute] long a { + set raises (E1); + }; +}; + + +EXPECT SUCCESS "attribute.tests 6": +exception E1 {}; +interface I1 { + [attribute] long a { + get raises (E1); + set raises (E1); + }; +}; + + +EXPECT SUCCESS "attribute.tests 7": +exception E1 {}; +interface I1 { + [attribute] long a { + set raises (E1); + get raises (E1); + }; +}; + + +EXPECT FAILURE "attribute.tests 8": +exception E1 {}; +interface I1 { + [attribute] long a { + get raises (E1); + get raises (E1); + }; +}; + + +EXPECT FAILURE "attribute.tests 9": +exception E1 {}; +interface I1 { + void E1(); + [attribute] long a { + get raises (E1); + }; +}; + + +EXPECT FAILURE "attribute.tests 10": +exception E1 {}; +interface I1 { + [attribute] long E1 { + get raises (E1); + }; +}; + + +EXPECT SUCCESS "attribute.tests 11": +exception E1 {}; +interface I1 { + [attribute] long a { + get raises (E1,E1); + }; +}; + + +EXPECT SUCCESS "attribute.tests 12": +exception E1 {}; +interface I1 { + [attribute, readonly] long a { + get raises (E1); + }; +}; + + +EXPECT FAILURE "attribute.tests 13": +exception E1 {}; +interface I1 { + [attribute, readonly] long a { + set raises (E1); + }; +}; + + +EXPECT FAILURE "attribute.tests 14": +interface I1 { + [] long a; +}; + + +EXPECT SUCCESS "attribute.tests 15": +interface I1 { + [attribute] long a; +}; + + +EXPECT FAILURE "attribute.tests 16": +interface I1 { + [attribute, property] long a; +}; + + +EXPECT FAILURE "attribute.tests 17": +interface I1 { + [attribute, optional] long a; +}; + + +EXPECT FAILURE "attribute.tests 18": +interface I1 { + [attribute, maybevoid] long a; +}; + + +EXPECT FAILURE "attribute.tests 19": +interface I1 { + [attribute, constrained] long a; +}; + + +EXPECT FAILURE "attribute.tests 20": +interface I1 { + [attribute, transient] long a; +}; + + +EXPECT FAILURE "attribute.tests 21": +interface I1 { + [attribute, maybeambigious] long a; +}; + + +EXPECT FAILURE "attribute.tests 22": +interface I1 { + [attribute, maybedefault] long a; +}; + + +EXPECT FAILURE "attribute.tests 23": +interface I1 { + [attribute, removeable] long a; +}; + + +EXPECT SUCCESS "attribute.tests 24": +interface I1 { + [attribute, bound] long a; +}; + + +EXPECT SUCCESS "attribute.tests 25": +interface I1 { + [bound, attribute] long a; +}; + + +EXPECT SUCCESS "attribute.tests 26": +interface I1 { + [attribute, readonly] long a; +}; + + +EXPECT SUCCESS "attribute.tests 27": +interface I1 { + [attribute, bound, readonly] long a; +}; diff --git a/idlc/test/parser/constant.tests b/idlc/test/parser/constant.tests new file mode 100644 index 000000000000..2a0d19b03090 --- /dev/null +++ b/idlc/test/parser/constant.tests @@ -0,0 +1,295 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXPECT SUCCESS "constant.tests 1": +constants C { + const boolean C1 = FALSE; + const byte C2 = 0; + const short C3 = 0; + const unsigned short C4 = 0; + const long C5 = 0; + const unsigned long C6 = 0; + const hyper C7 = 0; + const unsigned hyper C8 = 0; + const float C9 = 0.0; + const double C10 = 0.0; +}; + + +EXPECT SUCCESS "constant.tests 2": +module m { + const boolean C1 = FALSE; + const byte C2 = 0; + const short C3 = 0; + const unsigned short C4 = 0; + const long C5 = 0; + const unsigned long C6 = 0; + const hyper C7 = 0; + const unsigned hyper C8 = 0; + const float C9 = 0.0; + const double C10 = 0.0; +}; + + +EXPECT FAILURE "constant.tests 3": +constants C { + const char C1 = 'A'; +}; + + +EXPECT FAILURE "constant.tests 4": +module m { + const char C1 = 'A'; +}; + + +EXPECT FAILURE "constant.tests 5": +constants C { + const string C1 = ""; +}; + + +EXPECT FAILURE "constant.tests 6": +module m { + const string C1 = ""; +}; + + +EXPECT SUCCESS "constant.tests 7": +constants C {}; + + +EXPECT SUCCESS "constant.tests 8": +module m { + const byte C1 = -128; + const byte C2 = -0200; + const byte C3 = -0x80; + const byte C4 = 255; + const byte C5 = 0377; + const byte C6 = 0xFF; + const short C7 = -32768; + const short C8 = -0100000; + const short C9 = -0x8000; + const short C10 = 32767; + const short C11 = 077777; + const short C12 = 0x7FFF; + const unsigned short C13 = 0; + const unsigned short C14 = 0x0; + const unsigned short C15 = 65535; + const unsigned short C16 = 0177777; + const unsigned short C17 = 0xFFFF; + const long C18 = -2147483648; + const long C19 = -020000000000; + const long C20 = -0x80000000; + const long C21 = 2147483647; + const long C22 = 017777777777; + const long C23 = 0x7FFFFFFF; + const unsigned long C24 = 0; + const unsigned long C25 = 0x0; + const unsigned long C26 = 4294967295; + const unsigned long C27 = 037777777777; + const unsigned long C28 = 0xFFFFFFFF; + const hyper C29 = -9223372036854775808; + const hyper C30 = -01000000000000000000000; + const hyper C31 = -0x8000000000000000; + const hyper C32 = 9223372036854775807; + const hyper C33 = 0777777777777777777777; + const hyper C34 = 0x7FFFFFFFFFFFFFFF; + const unsigned hyper C35 = 0; + const unsigned hyper C36 = 0x0; + const unsigned hyper C37 = 18446744073709551615; + const unsigned hyper C38 = 01777777777777777777777; + const unsigned hyper C39 = 0xFFFFFFFFFFFFFFFF; +}; + + +EXPECT FAILURE "constant.tests 9": +module m { const byte C = -129; }; + + +EXPECT FAILURE "constant.tests 10": +module m { const byte C = -0201; }; + + +EXPECT FAILURE "constant.tests 11": +module m { const byte C = -0x81; }; + + +EXPECT FAILURE "constant.tests 12": +module m { const byte C = 256; }; + + +EXPECT FAILURE "constant.tests 13": +module m { const byte C = 0400; }; + + +EXPECT FAILURE "constant.tests 14": +module m { const byte C = 0x100; }; + + +EXPECT FAILURE "constant.tests 15": +module m { const short C = -32769; }; + + +EXPECT FAILURE "constant.tests 16": +module m { const short C = -0100001; }; + + +EXPECT FAILURE "constant.tests 17": +module m { const short C = -0x8001; }; + + +EXPECT FAILURE "constant.tests 18": +module m { const short C = 32768; }; + + +EXPECT FAILURE "constant.tests 19": +module m { const short C = 0100000; }; + + +EXPECT FAILURE "constant.tests 20": +module m { const short C = 0x8000; }; + + +EXPECT FAILURE "constant.tests 21": +module m { const unsigned short C = -1; }; + + +EXPECT FAILURE "constant.tests 22": +module m { const unsigned short C = -01; }; + + +EXPECT FAILURE "constant.tests 23": +module m { const unsigned short C = -0x1; }; + + +EXPECT FAILURE "constant.tests 24": +module m { const unsigned short C = 65536; }; + + +EXPECT FAILURE "constant.tests 25": +module m { const unsigned short C = 0200000; }; + + +EXPECT FAILURE "constant.tests 26": +module m { const unsigned short C = 0x10000; }; + + +EXPECT FAILURE "constant.tests 27": +module m { const long C = -2147483649; }; + + +EXPECT FAILURE "constant.tests 28": +module m { const long C = -020000000001; }; + + +EXPECT FAILURE "constant.tests 29": +module m { const long C = -0x80000001; }; + + +EXPECT FAILURE "constant.tests 30": +module m { const long C = 2147483648; }; + + +EXPECT FAILURE "constant.tests 31": +module m { const long C = 020000000000; }; + + +EXPECT FAILURE "constant.tests 32": +module m { const long C = 0x80000000; }; + + +EXPECT FAILURE "constant.tests 33": +module m { const unsigned long C = -1; }; + + +EXPECT FAILURE "constant.tests 34": +module m { const unsigned long C = -01; }; + + +EXPECT FAILURE "constant.tests 35": +module m { const unsigned long C = -0x1; }; + + +EXPECT FAILURE "constant.tests 36": +module m { const unsigned long C = 4294967296; }; + + +EXPECT FAILURE "constant.tests 37": +module m { const unsigned long C = 040000000000; }; + + +EXPECT FAILURE "constant.tests 38": +module m { const unsigned long C = 0x100000000; }; + + +EXPECT FAILURE "constant.tests 39": +module m { const hyper C = -9223372036854775809; }; + + +EXPECT FAILURE "constant.tests 40": +module m { const hyper C = -01000000000000000000001; }; + + +EXPECT FAILURE "constant.tests 41": +module m { const hyper C = -0x8000000000000001; }; + + +EXPECT FAILURE "constant.tests 42": +module m { const hyper C = 9223372036854775808; }; + + +EXPECT FAILURE "constant.tests 43": +module m { const hyper C = 01000000000000000000000; }; + + +EXPECT FAILURE "constant.tests 44": +module m { const hyper C = 0x8000000000000000; }; + + +EXPECT FAILURE "constant.tests 45": +module m { const unsigned hyper C = -1; }; + + +EXPECT FAILURE "constant.tests 46": +module m { const unsigned hyper C = -01; }; + + +EXPECT FAILURE "constant.tests 47": +module m { const unsigned hyper C = -0x1; }; + + +EXPECT FAILURE "constant.tests 48": +module m { const unsigned hyper C = 18446744073709551616; }; + + +EXPECT FAILURE "constant.tests 49": +module m { const unsigned hyper C = 02000000000000000000000; }; + + +EXPECT FAILURE "constant.tests 50": +module m { const unsigned hyper C = 0x10000000000000000; }; diff --git a/idlc/test/parser/constructor.tests b/idlc/test/parser/constructor.tests new file mode 100644 index 000000000000..7270fe99aabb --- /dev/null +++ b/idlc/test/parser/constructor.tests @@ -0,0 +1,199 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXPECT SUCCESS "constructor.tests 1": +interface X {}; +service S: X; + + +EXPECT SUCCESS "constructor.tests 2": +interface X {}; +service S: X {}; + + +EXPECT SUCCESS "constructor.tests 3": +interface X {}; +service S: X { + f(); +}; + + +EXPECT FAILURE "constructor.tests 4": +interface X {}; +service S: X { + f(); + f(); +}; + + +EXPECT FAILURE "constructor.tests 5": +interface X { + void f([in] any... p); +}; + + +EXPECT FAILURE "constructor.tests 6": +interface X { + void f([out] any... p); +}; + + +EXPECT SUCCESS "constructor.tests 7": +interface X {}; +service S: X { + f([in] any... p); +}; + + +EXPECT SUCCESS "constructor.tests 8": +interface X {}; +typedef any some; +service S: X { + f([in] some... p); +}; + + +EXPECT FAILURE "constructor.tests 9": +interface X {}; +service S: X { + f([in] long p1, [in] any... p2); +}; + + +EXPECT FAILURE "constructor.tests 10": +interface X {}; +service S: X { + f([in] any... p2, [in] long p1); +}; + + +EXPECT FAILURE "constructor.tests 11": +interface X {}; +service S: X { + f([in] long p1, [in] long... p2); +}; + + +EXPECT FAILURE "constructor.tests 12": +interface X {}; +service S: X { + f([out] long p); +}; + + +EXPECT FAILURE "constructor.tests 13": +interface X {}; +service S: X { + f([out] any... p); +}; + + +EXPECT FAILURE "constructor.tests 14": +interface X {}; +singleton S: X { + f(); +}; + + +EXPECT FAILURE "constructor.tests 15": +module com { module sun { module star { module test { + interface X {}; +service S: com::sun::star::test::X { + c1([in] long a, [in] com::sun::star::test::X b); + c2([in] long c, [in] X d); +}; +}; }; }; }; + + +EXPECT FAILURE "constructor.tests 16": +module com { module sun { module star { module test { + interface X {}; +}; }; }; }; +typedef long T; +service S: com::sun::star::test::X { + c1([in] sequence<long> a); + c2([in] sequence<T> b); +}; + + +EXPECT FAILURE "constructor.tests 17": +module com { module sun { module star { module test { + interface X {}; +}; }; }; }; +service S: com::sun::star::test::X { + c1([in] any... a); + c2([in] any... b); +}; + + +EXPECT SUCCESS "constructor.tests 18": +module com { module sun { module star { module test { + interface X {}; +}; }; }; }; +service S: com::sun::star::test::X { + c1([in] any... a); + c2([in] sequence<any> b); +}; + + +EXPECT SUCCESS "constructor.tests 19": +module com { module sun { module star { module test { + interface X { void m(); }; +}; }; }; }; +service S: com::sun::star::test::X { + c([in] any... a); +}; + + +EXPECT SUCCESS "constructor.tests 20": +module com { module sun { module star { module uno { + interface XInterface { void m(); }; +}; }; }; }; +service S: com::sun::star::uno::XInterface { + c1([in] long a, [in] long b); + c2([in] long a); +}; + + +EXPECT SUCCESS "constructor.tests 21": +module com { module sun { module star { module uno { + interface XInterface { void m(); }; +}; }; }; }; +service S: com::sun::star::uno::XInterface { + c1([in] long a); + c2([in] long a, [in] long b); +}; + + +EXPECT SUCCESS "constructor.tests 22": +module com { module sun { module star { module uno { + interface XInterface { void m(); }; +}; }; }; }; +service S: com::sun::star::uno::XInterface { + c1([in] long a, [in] short b); + c2([in] long a, [in] long b); +}; diff --git a/idlc/test/parser/interfaceinheritance.tests b/idlc/test/parser/interfaceinheritance.tests new file mode 100644 index 000000000000..85fd7f1de07c --- /dev/null +++ b/idlc/test/parser/interfaceinheritance.tests @@ -0,0 +1,280 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXPECT FAILURE "interfaceinheritance.tests 1": +interface Base {}; +interface Derived { + interface Base; + interface Base; +}; + + +EXPECT FAILURE "interfaceinheritance.tests 2": +interface Base {}; +interface Derived { + interface Base; + [optional] interface Base; +}; + + +EXPECT FAILURE "interfaceinheritance.tests 3": +interface Base {}; +interface Derived { + [optional] interface Base; + interface Base; +}; + + +EXPECT FAILURE "interfaceinheritance.tests 4": +interface Base {}; +interface Derived { + [optional] interface Base; + [optional] interface Base; +}; + + +EXPECT FAILURE "interfaceinheritance.tests 5": +interface Base1 {}; +interface Base2: Base1 {}; +interface Derived { + interface Base1; + interface Base2; +}; + + +EXPECT FAILURE "interfaceinheritance.tests 6": +interface Base1 {}; +interface Base2: Base1 {}; +interface Derived { + interface Base2; + interface Base1; +}; + + +EXPECT FAILURE "interfaceinheritance.tests 7": +interface Base1 {}; +interface Base2: Base1 {}; +interface Derived { + [optional] interface Base1; + interface Base2; +}; + + +EXPECT FAILURE "interfaceinheritance.tests 8": +interface Base1 {}; +interface Base2: Base1 {}; +interface Derived { + interface Base2; + [optional] interface Base1; +}; + + +EXPECT SUCCESS "interfaceinheritance.tests 9": +interface Base1 {}; +interface Base2: Base1 {}; +interface Derived { + interface Base1; + [optional] interface Base2; +}; + + +EXPECT SUCCESS "interfaceinheritance.tests 10": +interface Base1 {}; +interface Base2: Base1 {}; +interface Derived { + [optional] interface Base2; + interface Base1; +}; + + +EXPECT SUCCESS "interfaceinheritance.tests 11": +interface Base1 {}; +interface Base2: Base1 {}; +interface Derived { + [optional] interface Base1; + [optional] interface Base2; +}; + + +EXPECT SUCCESS "interfaceinheritance.tests 12": +interface Base1 {}; +interface Base2: Base1 {}; +interface Derived { + [optional] interface Base2; + [optional] interface Base1; +}; + + +EXPECT SUCCESS "interfaceinheritance.tests 13": +interface Base1 {}; +interface Base2 { [optional] interface Base1; }; +interface Derived { + interface Base1; + interface Base2; +}; + + +EXPECT SUCCESS "interfaceinheritance.tests 14": +interface Base1 {}; +interface Base2 { [optional] interface Base1; }; +interface Derived { + interface Base2; + interface Base1; +}; + + +EXPECT FAILURE "interfaceinheritance.tests 15": +interface Base1 {}; +interface Base2 { [optional] interface Base1; }; +interface Derived { + [optional] interface Base1; + interface Base2; +}; + + +EXPECT FAILURE "interfaceinheritance.tests 16": +interface Base1 {}; +interface Base2 { [optional] interface Base1; }; +interface Derived { + interface Base2; + [optional] interface Base1; +}; + + +EXPECT SUCCESS "interfaceinheritance.tests 17": +interface Base1 {}; +interface Base2 { [optional] interface Base1; }; +interface Derived { + interface Base1; + [optional] interface Base2; +}; + + +EXPECT SUCCESS "interfaceinheritance.tests 18": +interface Base1 {}; +interface Base2 { [optional] interface Base1; }; +interface Derived { + [optional] interface Base2; + interface Base1; +}; + + +EXPECT SUCCESS "interfaceinheritance.tests 19": +interface Base1 {}; +interface Base2 { [optional] interface Base1; }; +interface Derived { + [optional] interface Base1; + [optional] interface Base2; +}; + + +EXPECT SUCCESS "interfaceinheritance.tests 20": +interface Base1 {}; +interface Base2 { [optional] interface Base1; }; +interface Derived { + [optional] interface Base2; + [optional] interface Base1; +}; + + +EXPECT SUCCESS "interfaceinheritance.tests 21": +interface Base1 {}; +interface Base2: Base1 {}; +interface Base3: Base1 {}; +interface Derived { + interface Base2; + interface Base3; +}; + + +EXPECT SUCCESS "interfaceinheritance.tests 22": +interface Base1 {}; +interface Base2: Base1 {}; +interface Base3: Base1 {}; +interface Derived { + [optional] interface Base2; + interface Base3; +}; + + +EXPECT SUCCESS "interfaceinheritance.tests 23": +interface Base1 {}; +interface Base2: Base1 {}; +interface Base3: Base1 {}; +interface Derived { + interface Base2; + [optional] interface Base3; +}; + + +EXPECT SUCCESS "interfaceinheritance.tests 24": +interface Base1 {}; +interface Base2: Base1 {}; +interface Base3: Base1 {}; +interface Derived { + [optional] interface Base2; + [optional] interface Base3; +}; + + +EXPECT SUCCESS "interfaceinheritance.tests 25": +interface Base {}; +interface Derived { + [optional] interface Base; +}; + + +EXPECT FAILURE "interfaceinheritance.tests 26": +interface Base; +interface Derived { + interface Base; +}; + + +EXPECT FAILURE "interfaceinheritance.tests 27": +interface Base; +interface Derived { + [optional] interface Base; +}; + + +EXPECT FAILURE "interfaceinheritance.tests 28": +interface Base {}; +typedef Base Hidden; +interface Derived { + interface Base; + interface Hidden; +}; + + +EXPECT FAILURE "interfaceinheritance.tests 29": +interface Base {}; +typedef Base Hidden; +interface Derived { + interface Hidden; + interface Base; +}; diff --git a/idlc/test/parser/makefile.mk b/idlc/test/parser/makefile.mk new file mode 100644 index 000000000000..ae924e9ed7f9 --- /dev/null +++ b/idlc/test/parser/makefile.mk @@ -0,0 +1,55 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ := ..$/.. +PRJNAME := idlc +TARGET := test_parser + +.INCLUDE: settings.mk +.INCLUDE: target.mk + +ALLTAR: test + +test .PHONY: + $(EXECTEST) attribute.tests $(BIN)/idlc$(EXECPOST) \ + -O $(MISC)/$(TARGET) -stdin + $(EXECTEST) constant.tests $(BIN)/idlc$(EXECPOST) \ + -O $(MISC)/$(TARGET) -stdin + $(EXECTEST) constructor.tests $(BIN)/idlc$(EXECPOST) \ + -O $(MISC)/$(TARGET) -stdin + $(EXECTEST) interfaceinheritance.tests $(BIN)/idlc$(EXECPOST) \ + -O $(MISC)/$(TARGET) -stdin + $(EXECTEST) methodoverload.tests $(BIN)/idlc$(EXECPOST) \ + -O $(MISC)/$(TARGET) -stdin + $(EXECTEST) polystruct.tests $(BIN)/idlc$(EXECPOST) \ + -O $(MISC)/$(TARGET) -stdin + $(EXECTEST) published.tests $(BIN)/idlc$(EXECPOST) \ + -O $(MISC)/$(TARGET) -stdin + $(EXECTEST) struct.tests $(BIN)/idlc$(EXECPOST) \ + -O $(MISC)/$(TARGET) -stdin + $(EXECTEST) typedef.tests $(BIN)/idlc$(EXECPOST) \ + -O $(MISC)/$(TARGET) -stdin diff --git a/idlc/test/parser/methodoverload.tests b/idlc/test/parser/methodoverload.tests new file mode 100644 index 000000000000..33c2c438ba17 --- /dev/null +++ b/idlc/test/parser/methodoverload.tests @@ -0,0 +1,124 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXPECT FAILURE "methodoverload.tests 1": +interface Derived { + void f(); + void f(); +}; + + +EXPECT FAILURE "methodoverload.tests 2": +interface Base { + void f(); +}; +interface Derived { + interface Base; + void f(); +}; + + +EXPECT FAILURE "methodoverload.tests 3": +interface Base { + void f(); +}; +interface Derived { + void f(); + interface Base; +}; + + +EXPECT FAILURE "methodoverload.tests 4": +interface Base { + void f(); +}; +interface Derived { + [optional] interface Base; + void f(); +}; + + +EXPECT FAILURE "methodoverload.tests 5": +interface Base { + void f(); +}; +interface Derived { + void f(); + [optional] interface Base; +}; + + +EXPECT FAILURE "methodoverload.tests 6": +interface Base1 { + void f(); +}; +interface Base2 { + void f(); +}; +interface Derived { + interface Base1; + interface Base2; +}; + + +EXPECT FAILURE "methodoverload.tests 7": +interface Base1 { + void f(); +}; +interface Base2 { + void f(); +}; +interface Derived { + [optional] interface Base1; + interface Base2; +}; + + +EXPECT FAILURE "methodoverload.tests 8": +interface Base1 { + void f(); +}; +interface Base2 { + void f(); +}; +interface Derived { + interface Base1; + [optional] interface Base2; +}; + + +EXPECT SUCCESS "methodoverload.tests 9": +interface Base1 { + void f(); +}; +interface Base2 { + void f(); +}; +interface Derived { + [optional] interface Base1; + [optional] interface Base2; +}; diff --git a/idlc/test/parser/polystruct.tests b/idlc/test/parser/polystruct.tests new file mode 100644 index 000000000000..b5661cab6428 --- /dev/null +++ b/idlc/test/parser/polystruct.tests @@ -0,0 +1,255 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXPECT SUCCESS "polystruct.tests 1": +struct Struct<T> { T member; }; + + +EXPECT FAILURE "polystruct.tests 2": +struct Struct<T,U,T,V> { long member; }; + + +EXPECT FAILURE "polystruct.tests 3": +struct Struct<T> { long member; }; +typedef Struct Typedef; + + +EXPECT FAILURE "polystruct.tests 4": +struct Struct<T> { long member; }; +typedef Struct<long> Typedef; + + +EXPECT SUCCESS "polystruct.tests 5": +struct Struct<T> { long member; }; + + +EXPECT SUCCESS "polystruct.tests 6": +struct Struct1<T> { T member; }; +struct Struct2 { Struct1<long> member; }; + + +EXPECT SUCCESS "polystruct.tests 7": +struct Struct1<T> { T member; }; +struct Struct2 { Struct1<Struct1<string> > member; }; + + +EXPECT FAILURE "polystruct.tests 8": +struct Struct1<T> { T member; }; +struct Struct2 { Struct1<int> member; }; + + +EXPECT FAILURE "polystruct.tests 9": +struct Struct1<T> { T member; }; +struct Struct2 { Struct1<long,long> member; }; + + +EXPECT FAILURE "polystruct.tests 10": +struct Struct2 { Struct1<long> member; }; + + +EXPECT FAILURE "polystruct.tests 11": +struct Struct1<T> { T member; }; +struct Struct2 { Struct1<> member; }; + + +EXPECT FAILURE "polystruct.tests 12": +struct Struct1<T> { T member; }; +struct Struct2 { Struct1<void> member; }; + + +EXPECT FAILURE "polystruct.tests 13": +exception Exception {}; +struct Struct1<T> { T member; }; +struct Struct2 { Struct1<Exception> member; }; + + +EXPECT SUCCESS "polystruct.tests 14": +struct Struct<T> { T T; }; + + +EXPECT SUCCESS "polystruct.tests 15": +struct Struct<Struct> { Struct member; }; + + +EXPECT FAILURE "polystruct.tests 16": +struct Struct<Struct> { Struct<long> member; }; + + +EXPECT FAILURE "polystruct.tests 17": +struct Struct<Struct> { ::Struct member; }; + + +EXPECT FAILURE "polystruct.tests 18": +struct Struct<Struct> { ::Struct<long> member; }; + + +EXPECT SUCCESS "polystruct.tests 19": +struct Struct1<T> { T member; }; +struct Struct2<Struct1> { Struct1 member; }; + + +EXPECT SUCCESS "polystruct.tests 20": +struct Struct1<T> { T member; }; +struct Struct2<Struct1> { Struct1<long> member; }; + + +EXPECT SUCCESS "polystruct.tests 21": +struct Struct1<T> { T member; }; +struct Struct2<Struct1> { ::Struct1<long> member; }; + + +EXPECT FAILURE "polystruct.tests 22": +struct Struct1 { long member1; }; +struct Struct2<T>: Struct1 { long member2; }; + + +EXPECT FAILURE "polystruct.tests 23": +struct Struct1<T> { long member1; }; +struct Struct2: Struct1<long> { long member2; }; + + +EXPECT FAILURE "polystruct.tests 24": +struct Struct1<T> { long member1; }; +struct Struct2<T>: Struct1<long> { long member2; }; + + +EXPECT FAILURE "polystruct.tests 25": +struct Struct1<T> { long member; }; +struct Struct2 { Struct1<Struct2> member; }; + + +EXPECT FAILURE "polystruct.tests 26": +struct Struct1<T> { long member; }; +struct Struct2<T> { long member; }; +struct Struct3 { Struct1<Struct2<Struct3> > member; }; + + +EXPECT SUCCESS "polystruct.tests 27": +struct Struct1<T> { long member; }; +struct Struct2 { Struct1<sequence<Struct2> > member; }; + + +EXPECT SUCCESS "polystruct.tests 28": +struct Struct1<T> { long member; }; +struct Struct2 { Struct1<sequence<sequence<Struct2> > > member; }; + + +EXPECT SUCCESS "polystruct.tests 29": +struct Struct1<T> { long member; }; +struct Struct2 { sequence<Struct1<Struct2> > member; }; + + +EXPECT SUCCESS "polystruct.tests 30": +struct Struct1<T> { long member; }; +struct Struct2 { sequence<Struct1<sequence<Struct2> > > member; }; + + +EXPECT SUCCESS "polystruct.tests 31": +struct Struct1<T> { long member; }; +struct Struct2 { sequence<sequence<Struct1<Struct2> > > member; }; + + +EXPECT FAILURE "polystruct.tests 32": +struct Struct<T> { Struct member; }; + + +EXPECT FAILURE "polystruct.tests 33": +struct Struct<T> { Struct<long> member; }; + + +EXPECT FAILURE "polystruct.tests 34": +struct Struct<T> { Struct<Struct> member; }; + + +EXPECT FAILURE "polystruct.tests 35": +struct Struct<T> { Struct<Struct<long> > member; }; + + +EXPECT FAILURE "polystruct.tests 36": +struct Struct1<T> { long member; }; +struct Struct2<T> { Struct1<Struct2> member; }; + + +EXPECT FAILURE "polystruct.tests 37": +struct Struct1<T> { long member; }; +struct Struct2<T> { long member; }; +struct Struct3<T> { Struct1<Struct2<Struct3> > member; }; + + +EXPECT FAILURE "polystruct.tests 38": +struct Struct1<T> { long member; }; +struct Struct2<T> { Struct1<Struct2<long> > member; }; + + +EXPECT FAILURE "polystruct.tests 39": +struct Struct1<T> { long member; }; +struct Struct2<T> { long member; }; +struct Struct3<T> { Struct1<Struct2<Struct3<long> > > member; }; + + +EXPECT FAILURE "polystruct.tests 40": +struct Struct1<T> { long member; }; +struct Struct2 { Struct1<unsigned short> member; }; + + +EXPECT FAILURE "polystruct.tests 41": +struct Struct1<T, U> { long member; }; +struct Struct2<T> { long member; }; +struct Struct3 { Struct2<Struct1<long, unsigned long> > member; }; + + +EXPECT FAILURE "polystruct.tests 42": +struct Struct<T> { long member; }; +interface X { void f([in] Struct<unsigned hyper> p); }; + + +EXPECT FAILURE "polystruct.tests 43": +struct Struct1<T> { long member; }; +struct Struct2 { Struct1<sequence<unsigned short> > member; }; + + +EXPECT SUCCESS "polystruct.tests 44": +struct Struct1<T> { long member; }; +struct Struct2 { Struct1<sequence<char> > member; }; + + +EXPECT FAILURE "polystruct.tests 45": +struct Struct1<T> { long member; }; +typedef unsigned short td; +struct Struct2 { Struct1<td> member; }; + + +EXPECT FAILURE "polystruct.tests 46": +struct Struct1<T> { long member; }; +typedef sequence<unsigned short> td; +struct Struct2 { Struct1<td> member; }; + + +EXPECT FAILURE "polystruct.tests 47": +struct Struct1<T> { long member; }; +typedef unsigned short td; +struct Struct2 { Struct1<sequence<td> > member; }; diff --git a/idlc/test/parser/published.tests b/idlc/test/parser/published.tests new file mode 100644 index 000000000000..c3999e58ba88 --- /dev/null +++ b/idlc/test/parser/published.tests @@ -0,0 +1,708 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXPECT SUCCESS "published.tests 1": +published enum Enum { VALUE }; +published struct Struct1 { long member; }; +published struct Struct2<T> { T member; }; +published exception E1 {}; +published interface I1 {}; +published typedef long Typedef; +published const long Constant = 1; +published constants Constants { const long Constant = 1; }; +published service Service1: I1 {}; +published service Service2 { interface I1; }; +published singleton Singleton1: I1; +published singleton Singleton2 { service Service2; }; + + +EXPECT FAILURE "published.tests 2": +constants Constants { published const long C = 1; }; + + +EXPECT FAILURE "published.tests 3": +published constants Constants { published const long C = 1; }; + + +EXPECT FAILURE "published.tests 4": +published module m {}; + + +EXPECT SUCCESS "published.tests 5": +interface I1; +interface I1 {}; + + +EXPECT SUCCESS "published.tests 6": +interface I1; +published interface I1 {}; + + +EXPECT FAILURE "published.tests 7": +published interface I1; +interface I1 {}; + + +EXPECT SUCCESS "published.tests 8": +published interface I1; +published interface I1 {}; + + +EXPECT SUCCESS "published.tests 9": +struct S1 { long m1; }; +struct S2: S1 { long m2; }; + + +EXPECT FAILURE "published.tests 10": +struct S1 { long m1; }; +published struct S2: S1 { long m2; }; + + +EXPECT SUCCESS "published.tests 11": +published struct S1 { long m1; }; +struct S2: S1 { long m2; }; + + +EXPECT SUCCESS "published.tests 12": +published struct S1 { long m1; }; +published struct S2: S1 { long m2; }; + + +EXPECT SUCCESS "published.tests 13": +enum E { V }; +struct S1<T> { T m1; }; +struct S2 { S1<E> m2; }; + + +EXPECT FAILURE "published.tests 14": +enum E { V }; +struct S1<T> { T m1; }; +published struct S2 { S1<E> m2; }; + + +EXPECT SUCCESS "published.tests 15": +enum E { V }; +published struct S1<T> { T m1; }; +struct S2 { S1<E> m2; }; + + +EXPECT FAILURE "published.tests 16": +enum E { V }; +published struct S1<T> { T m1; }; +published struct S2 { S1<E> m2; }; + + +EXPECT SUCCESS "published.tests 17": +published enum E { V }; +struct S1<T> { T m1; }; +struct S2 { S1<E> m2; }; + + +EXPECT FAILURE "published.tests 18": +published enum E { V }; +struct S1<T> { T m1; }; +published struct S2 { S1<E> m2; }; + + +EXPECT SUCCESS "published.tests 19": +published enum E { V }; +published struct S1<T> { T m1; }; +struct S2 { S1<E> m2; }; + + +EXPECT SUCCESS "published.tests 20": +published enum E { V }; +published struct S1<T> { T m1; }; +published struct S2 { S1<E> m2; }; + + +EXPECT SUCCESS "published.tests 21": +module com { module sun { module star { module uno { +exception Exception {}; +exception E2: Exception {}; +}; }; }; }; + + +EXPECT FAILURE "published.tests 22": +module com { module sun { module star { module uno { +exception Exception {}; +published exception E2: Exception {}; +}; }; }; }; + + +EXPECT SUCCESS "published.tests 23": +module com { module sun { module star { module uno { +published exception Exception {}; +exception E2: Exception {}; +}; }; }; }; + + +EXPECT SUCCESS "published.tests 24": +module com { module sun { module star { module uno { +published exception Exception {}; +published exception E2: Exception {}; +}; }; }; }; + + +EXPECT SUCCESS "published.tests 25": +enum E { V }; +module com { module sun { module star { module uno { +exception Exception { E m; }; +}; }; }; }; + + +EXPECT FAILURE "published.tests 26": +enum E { V }; +module com { module sun { module star { module uno { +published exception Exception { E m; }; +}; }; }; }; + + +EXPECT SUCCESS "published.tests 27": +published enum E { V }; +module com { module sun { module star { module uno { +exception Exception { E m; }; +}; }; }; }; + + +EXPECT SUCCESS "published.tests 28": +published enum E { V }; +module com { module sun { module star { module uno { +published exception Exception { E m; }; +}; }; }; }; + + +EXPECT SUCCESS "published.tests 29": +interface I1 {}; +interface I2: I1 {}; + + +EXPECT FAILURE "published.tests 30": +interface I1 {}; +published interface I2: I1 {}; + + +EXPECT SUCCESS "published.tests 31": +published interface I1 {}; +interface I2: I1 {}; + + +EXPECT SUCCESS "published.tests 32": +published interface I1 {}; +published interface I2: I1 {}; + + +EXPECT SUCCESS "published.tests 33": +enum E { V }; +interface I1 { [attribute] E m; }; + + +EXPECT FAILURE "published.tests 34": +enum E { V }; +published interface I1 { [attribute] E m; }; + + +EXPECT SUCCESS "published.tests 35": +published enum E { V }; +interface I1 { [attribute] E m; }; + + +EXPECT SUCCESS "published.tests 36": +published enum E { V }; +published interface I1 { [attribute] E m; }; + + +EXPECT SUCCESS "published.tests 36a.1": +module com { module sun { module star { module uno { +exception Exception {}; +interface I1 { [attribute] long m { get raises (Exception); }; }; +}; }; }; }; + + +EXPECT FAILURE "published.tests 36a.2": +module com { module sun { module star { module uno { +exception Exception {}; +published interface I1 { + [attribute] long m { get raises (Exception); }; }; +}; }; }; }; + + +EXPECT SUCCESS "published.tests 36a.3": +module com { module sun { module star { module uno { +published exception Exception {}; +interface I1 { [attribute] long m { get raises (Exception); }; }; +}; }; }; }; + + +EXPECT SUCCESS "published.tests 36a.4": +module com { module sun { module star { module uno { +published exception Exception {}; +published interface I1 { + [attribute] long m { get raises (Exception); }; }; +}; }; }; }; + + +EXPECT SUCCESS "published.tests 37": +enum E { V }; +interface I1 { E f(); }; + + +EXPECT FAILURE "published.tests 38": +enum E { V }; +published interface I1 { E f(); }; + + +EXPECT SUCCESS "published.tests 39": +published enum E { V }; +interface I1 { E f(); }; + + +EXPECT SUCCESS "published.tests 40": +published enum E { V }; +published interface I1 { E f(); }; + + +EXPECT SUCCESS "published.tests 41": +enum E { V }; +interface I1 { void f([in] E p); }; + + +EXPECT FAILURE "published.tests 42": +enum E { V }; +published interface I1 { void f([in] E p); }; + + +EXPECT SUCCESS "published.tests 43": +published enum E { V }; +interface I1 { void f([in] E p); }; + + +EXPECT SUCCESS "published.tests 44": +published enum E { V }; +published interface I1 { void f([in] E p); }; + + +EXPECT SUCCESS "published.tests 45": +module com { module sun { module star { module uno { +exception Exception {}; +interface I1 { void f() raises (Exception); }; +}; }; }; }; + + +EXPECT FAILURE "published.tests 46": +module com { module sun { module star { module uno { +exception Exception {}; +published interface I1 { void f() raises (Exception); }; +}; }; }; }; + + +EXPECT SUCCESS "published.tests 47": +module com { module sun { module star { module uno { +published exception Exception {}; +interface I1 { void f() raises (Exception); }; +}; }; }; }; + + +EXPECT SUCCESS "published.tests 48": +module com { module sun { module star { module uno { +published exception Exception {}; +published interface I1 { void f() raises (Exception); }; +}; }; }; }; + + +EXPECT SUCCESS "published.tests 49": +interface I1 {}; +interface I2 { interface I1; }; + + +EXPECT FAILURE "published.tests 50": +interface I1 {}; +published interface I2 { interface I1; }; + + +EXPECT SUCCESS "published.tests 51": +published interface I1 {}; +interface I2 { interface I1; }; + + +EXPECT SUCCESS "published.tests 52": +published interface I1 {}; +published interface I2 { interface I1; }; + + +EXPECT SUCCESS "published.tests 57": +enum E { V }; +typedef E T; + + +EXPECT FAILURE "published.tests 58": +enum E { V }; +published typedef E T; + + +EXPECT SUCCESS "published.tests 59": +published enum E { V }; +typedef E T; + + +EXPECT SUCCESS "published.tests 60": +published enum E { V }; +published typedef E T; + + +EXPECT SUCCESS "published.tests 61": +enum E { V }; +typedef E T; +struct S { T m; }; + + +EXPECT FAILURE "published.tests 62": +enum E { V }; +typedef E T; +published struct S { T m; }; + + +EXPECT FAILURE "published.tests 63": +enum E { V }; +published typedef E T; +struct S { T m; }; + + +EXPECT FAILURE "published.tests 64": +enum E { V }; +published typedef E T; +published struct S { T m; }; + + +EXPECT SUCCESS "published.tests 65": +published enum E { V }; +typedef E T; +struct S { T m; }; + + +EXPECT FAILURE "published.tests 66": +published enum E { V }; +typedef E T; +published struct S { T m; }; + + +EXPECT SUCCESS "published.tests 67": +published enum E { V }; +published typedef E T; +struct S { T m; }; + + +EXPECT SUCCESS "published.tests 68": +published enum E { V }; +published typedef E T; +published struct S { T m; }; + + +EXPECT SUCCESS "published.tests 69": +const long C1 = 1; +const long C2 = C1 + 1; + + +EXPECT FAILURE "published.tests 70": +const long C1 = 1; +published const long C2 = C1 + 1; + + +EXPECT SUCCESS "published.tests 71": +published const long C1 = 1; +const long C2 = C1 + 1; + + +EXPECT SUCCESS "published.tests 72": +published const long C1 = 1; +published const long C2 = C1 + 1; + + +EXPECT SUCCESS "published.tests 73": +constants Cs { + const long C1 = 1; + const long C2 = C1 + 1; +}; + + +EXPECT SUCCESS "published.tests 74": +published constants Cs { + const long C1 = 1; + const long C2 = C1 + 1; +}; + + +EXPECT SUCCESS "published.tests 75": +constants Cs { const long C1 = 1; }; +const long C2 = Cs::C1 + 1; + + +EXPECT FAILURE "published.tests 76": +constants Cs { const long C1 = 1; }; +published const long C2 = Cs::C1 + 1; + + +EXPECT SUCCESS "published.tests 77": +published constants Cs { const long C1 = 1; }; +const long C2 = Cs::C1 + 1; + + +EXPECT SUCCESS "published.tests 78": +published constants Cs { const long C1 = 1; }; +published const long C2 = Cs::C1 + 1; + + +EXPECT SUCCESS "published.tests 79": +const long C1 = 1; +constants Cs { const long C2 = C1 + 1; }; + + +EXPECT FAILURE "published.tests 80": +const long C1 = 1; +published constants Cs { const long C2 = C1 + 1; }; + + +EXPECT SUCCESS "published.tests 81": +published const long C1 = 1; +constants Cs { const long C2 = C1 + 1; }; + + +EXPECT SUCCESS "published.tests 82": +published const long C1 = 1; +published constants Cs { const long C2 = C1 + 1; }; + + +EXPECT SUCCESS "published.tests 83": +constants Cs1 { const long C1 = 1; }; +constants Cs2 { const long C2 = Cs1::C1 + 1; }; + + +EXPECT FAILURE "published.tests 84": +constants Cs1 { const long C1 = 1; }; +published constants Cs2 { const long C2 = Cs1::C1 + 1; }; + + +EXPECT SUCCESS "published.tests 85": +published constants Cs1 { const long C1 = 1; }; +constants Cs2 { const long C2 = Cs1::C1 + 1; }; + + +EXPECT SUCCESS "published.tests 86": +published constants Cs1 { const long C1 = 1; }; +published constants Cs2 { const long C2 = Cs1::C1 + 1; }; + + +EXPECT SUCCESS "published.tests 87": +typedef long T; +const T C = 1; + + +EXPECT FAILURE "published.tests 88": +typedef long T; +published const T C = 1; + + +EXPECT SUCCESS "published.tests 89": +published typedef long T; +const T C = 1; + + +EXPECT SUCCESS "published.tests 90": +published typedef long T; +published const T C = 1; + + +EXPECT SUCCESS "published.tests 91": +service S1 {}; +service S2 { service S1; }; + + +EXPECT FAILURE "published.tests 92": +service S1 {}; +published service S2 { service S1; }; + + +EXPECT SUCCESS "published.tests 93": +published service S1 {}; +service S2 { service S1; }; + + +EXPECT SUCCESS "published.tests 94": +published service S1 {}; +published service S2 { service S1; }; + + +EXPECT SUCCESS "published.tests 95": +interface I1 {}; +service S { interface I1; }; + + +EXPECT FAILURE "published.tests 96": +interface I1 {}; +published service S { interface I1; }; + + +EXPECT SUCCESS "published.tests 97": +published interface I1 {}; +service S { interface I1; }; + + +EXPECT SUCCESS "published.tests 98": +published interface I1 {}; +published service S { interface I1; }; + + +EXPECT SUCCESS "published.tests 99": +interface I1 {}; +service S: I1; + + +EXPECT FAILURE "published.tests 100": +interface I1 {}; +published service S: I1; + + +EXPECT SUCCESS "published.tests 101": +published interface I1 {}; +service S: I1; + + +EXPECT SUCCESS "published.tests 102": +published interface I1 {}; +published service S: I1; + + +EXPECT SUCCESS "published.tests 103": +enum E { V }; +interface I1 {}; +service S: I1 { + f([in] E p); +}; + + +EXPECT FAILURE "published.tests 104": +enum E { V }; +published interface I1 {}; +published service S: I1 { + f([in] E p); +}; + + +EXPECT SUCCESS "published.tests 105": +published enum E { V }; +interface I1 {}; +service S: I1 { + f([in] E p); +}; + + +EXPECT SUCCESS "published.tests 106": +published enum E { V }; +published interface I1 {}; +published service S: I1 { + f([in] E p); +}; + + +EXPECT SUCCESS "published.tests 107": +module com { module sun { module star { module uno { +exception Exception {}; +interface I1 {}; +service S: I1 { + f() raises (Exception); +}; +}; }; }; }; + + +EXPECT FAILURE "published.tests 108": +module com { module sun { module star { module uno { +exception Exception {}; +published interface I1 {}; +published service S: I1 { + f() raises (Exception); +}; +}; }; }; }; + + +EXPECT SUCCESS "published.tests 109": +module com { module sun { module star { module uno { +published exception Exception {}; +interface I1 {}; +service S: I1 { + f() raises (Exception); +}; +}; }; }; }; + + +EXPECT SUCCESS "published.tests 110": +module com { module sun { module star { module uno { +published exception Exception {}; +published interface I1 {}; +published service S: I1 { + f() raises (Exception); +}; +}; }; }; }; + + +EXPECT SUCCESS "published.tests 111": +service S1 {}; +singleton S2 { service S1; }; + + +EXPECT FAILURE "published.tests 112": +service S1 {}; +published singleton S2 { service S1; }; + + +EXPECT SUCCESS "published.tests 113": +published service S1 {}; +singleton S2 { service S1; }; + + +EXPECT SUCCESS "published.tests 114": +published service S1 {}; +published singleton S2 { service S1; }; + + +EXPECT SUCCESS "published.tests 115": +interface I1 {}; +singleton S: I1; + + +EXPECT FAILURE "published.tests 116": +interface I1 {}; +published singleton S: I1; + + +EXPECT SUCCESS "published.tests 117": +published interface I1 {}; +singleton S: I1; + + +EXPECT SUCCESS "published.tests 118": +published interface I1 {}; +published singleton S: I1; diff --git a/idlc/test/parser/struct.tests b/idlc/test/parser/struct.tests new file mode 100644 index 000000000000..2ddcc7db5cb2 --- /dev/null +++ b/idlc/test/parser/struct.tests @@ -0,0 +1,55 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXPECT FAILURE "struct.tests 1": +struct S { void m; }; + + +EXPECT FAILURE "struct.tests 2": +struct S { sequence<void> m; }; + + +EXPECT FAILURE "struct.tests 3": +exception E {}; +struct S { E m; }; + + +EXPECT FAILURE "struct.tests 4": +exception E {}; +struct S { sequence<E> m; }; + + +EXPECT FAILURE "struct.tests 5": +struct S { S m; }; + + +EXPECT SUCCESS "struct.tests 6": +struct S { sequence<S> m; }; + + +EXPECT SUCCESS "struct.tests 7": +struct S { sequence<sequence<S> > m; }; diff --git a/idlc/test/parser/typedef.tests b/idlc/test/parser/typedef.tests new file mode 100644 index 000000000000..f7d2e63f5933 --- /dev/null +++ b/idlc/test/parser/typedef.tests @@ -0,0 +1,67 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXPECT SUCCESS "typedef.tests 1": +struct Struct1 { long member1; }; +typedef Struct1 T1; +typedef T1 T2; +struct Struct2: T2 { long member2; }; + + +EXPECT FAILURE "typedef.tests 2": +typedef long T1; +typedef T1 T2; +struct Struct: T2 { long member2; }; + + +EXPECT SUCCESS "typedef.tests 3": +interface Interface1 {}; +typedef Interface1 T1; +typedef T1 T2; +interface Interface2: T2 {}; + + +EXPECT FAILURE "typedef.tests 4": +interface Interface1; +typedef Interface1 T1; +typedef T1 T2; +interface Interface2: T2 {}; + + +EXPECT FAILURE "typedef.tests 5": +typedef long T1; +typedef T1 T2; +interface Interface: T2 {}; + + +EXPECT FAILURE "typedef.tests 6": +typedef void T; + + +EXPECT FAILURE "typedef.tests 7": +exception E {}; +typedef E T; diff --git a/idlc/test/service.idl b/idlc/test/service.idl new file mode 100644 index 000000000000..5a962d8fe948 --- /dev/null +++ b/idlc/test/service.idl @@ -0,0 +1,44 @@ +#include <interface.idl> + +module idlc +{ +module test +{ + +exception bla +{ +}; + +service IdlTest +{ +// [property] bla p0; + [property] short p1; + [optional, property] unsigned short p2; + + [maybevoid, property] long p3; + [bound, property] unsigned long p4; + + [constrained, property] hyper p5; + [transient, property] unsigned hyper p6; + + [maybeambiguous, property] string p7; + [maybedefault, property] type p8; + [removable, property] any p9; + + [readonly, optional, removable, property] ::idlc::test::BaseStruct p10; + + interface XTestBaseTypes; + [optional] interface ::idlc::test::XTestComplexTypes; +}; + +service BetterIdlTest +{ + service IdlTest; + + interface XTestBaseTypes; + [optional] interface ::idlc::test::XTestComplexTypes; +}; + +}; +}; + diff --git a/idlc/test/singleton.idl b/idlc/test/singleton.idl new file mode 100644 index 000000000000..a4b2590c726a --- /dev/null +++ b/idlc/test/singleton.idl @@ -0,0 +1,41 @@ +#include <interface.idl> + +module idlc +{ +module test +{ + +exception bla +{ +}; + +service IdlTest +{ +// [property] bla p0; + [property] short p1; + [optional, property] unsigned short p2; + + [maybevoid, property] long p3; + [bound, property] unsigned long p4; + + [constrained, property] hyper p5; + [transient, property] unsigned hyper p6; + + [maybeambiguous, property] string p7; + [maybedefault, property] type p8; + [removable, property] any p9; + + [readonly, optional, removable, property] ::idlc::test::BaseStruct p10; + + interface XTestBaseTypes; + [optional] interface ::idlc::test::XTestComplexTypes; +}; + +singleton SingletonTest +{ + service IdlTest; +}; + +}; +}; + diff --git a/idlc/test/struct.idl b/idlc/test/struct.idl new file mode 100644 index 000000000000..887b45c7859b --- /dev/null +++ b/idlc/test/struct.idl @@ -0,0 +1,107 @@ +/* In this file the idl struct will be tested. + bla + */ + +/// idlc defines a test module +module idlc +{ + +/// test defines a test module +module test +{ + +typedef sequence< long > Id; +//struct Bla +//{ +// long bla; +//}; + +/** bla + BaseStruct defines an * intial struct + */ +struct BaseStruct +{ + Id Id; + + /// a short member + short m1; + + /// a unsigned short member + unsigned short m2; + + /// a long member + long m3; + + /// a unsigned long member + unsigned long m4; + + /// a hyper member + hyper m5; + + /// a unsigned hyper member + unsigned hyper m6; + + /// a string member + string m7; + + /// a byte member + byte m8; + + /// a type member + type m9; + + /// a float member + float m10; + + /// a double member + double m11; + + /// a char member + char m12; + + /// a boolean member + boolean m13; + + /// a any member + any m14; +}; + +interface XTestBaseTypes; + +typedef sequence< long > LongSeq; + +typedef sequence< LongSeq > LongSeqSeq; + +/** TestStruct deinfes a struct which inherits + from the base strcut type BaseStruct. +*/ +struct TestStruct : BaseStruct +{ + /// a sequence< long > member + sequence< long > ms1; + + /// a sequence< sequence< long > > member + sequence< sequence< long > > ms2; + + /// a long array member with dimesion 5,10 +// long ms3[5][10]; + + /// a string array member with dimension 4,8 +// long[5][10] ms4; + + /// an interface member + XTestBaseTypes ms5; + + /// a typedef member + LongSeq ms6; + + /// a further typedef member + LongSeqSeq ms7; + + /// a sequence typedef member + sequence<LongSeq> ms8; + +}; + +}; }; + diff --git a/idlc/test/typelookup.idl b/idlc/test/typelookup.idl new file mode 100644 index 000000000000..ba1b6f29e8f3 --- /dev/null +++ b/idlc/test/typelookup.idl @@ -0,0 +1,63 @@ +/* In this file the idl struct will be tested. + bla + */ + +#include <enum.idl> + +typedef short Error; + +/// idlc defines a test module +module idlc +{ + +typedef long Error; + +/// test defines a test module +module test +{ + +/** bla + BaseStruct defines an * intial struct + */ +struct BaseStruct +{ + /// a long member + long m1; + /// a string member + string m2; + /// a byte member + byte m3; + /// a type member + type m4; + /// a enum member, Error in moudle idlc::test + Error m5; + /// a typedef member, global Error (typedef short) + ::Error m6; + /// a typedef member, Error in moudle idlc (typedef long) + ::idlc::Error m7; + /// a typedef member, Error in moudle idlc (typedef long) + idlc::Error m8; + /// a enum member, Error in moudle idlc::test + test::Error m9; +}; + +/** TestStruct deinfes a struct which inherits + from the base strcut type BaseStruct. +*/ +struct TestStruct : BaseStruct +{ + /// a short member + short ms1; + /// a hyper member + hyper ms2; + /// a sequence<long> member + sequence< long > ms3; + /// a long array member with dimesion 5,10 + long ms4[5][10]; + /// a string array member with dimension 4,8 + long[5][10] ms5; +}; + +}; // test + +}; // idlc diff --git a/idlc/test/union.idl b/idlc/test/union.idl new file mode 100644 index 000000000000..8e9b5c5dedf8 --- /dev/null +++ b/idlc/test/union.idl @@ -0,0 +1,35 @@ +module idlc +{ +module test +{ + +union UnionTest switch (long) { + case 1: long x; + case 2: byte y; + case 3: string z; + case 4: + case 5: short w; + case 6: long array[ 10 ][ 20 ]; + case 7: sequence<long> seq; + default: any a; +}; + +typedef enum E { + A, + B +} EAlias; + +// Union with no default label +union U2 switch(EAlias) { + case E::A : long x; + case E::B : short y; +}; + +union U3 switch(char) { + case 2 : long x; + case 4 : short y; +}; + +}; +}; + |