diff options
Diffstat (limited to 'idlc/test')
-rw-r--r-- | idlc/test/const.idl | 71 | ||||
-rw-r--r-- | idlc/test/enum.idl | 45 | ||||
-rw-r--r-- | idlc/test/exception.idl | 40 | ||||
-rw-r--r-- | idlc/test/identifiers.idl | 43 | ||||
-rw-r--r-- | idlc/test/interface.idl | 71 | ||||
-rw-r--r-- | idlc/test/parser/attribute.tests | 232 | ||||
-rw-r--r-- | idlc/test/parser/constant.tests | 294 | ||||
-rw-r--r-- | idlc/test/parser/constructor.tests | 190 | ||||
-rw-r--r-- | idlc/test/parser/conversion.tests | 79 | ||||
-rw-r--r-- | idlc/test/parser/interfaceinheritance.tests | 279 | ||||
-rw-r--r-- | idlc/test/parser/methodoverload.tests | 177 | ||||
-rw-r--r-- | idlc/test/parser/oldstyle.tests | 28 | ||||
-rw-r--r-- | idlc/test/parser/polystruct.tests | 251 | ||||
-rw-r--r-- | idlc/test/parser/published.tests | 681 | ||||
-rw-r--r-- | idlc/test/parser/struct.tests | 46 | ||||
-rw-r--r-- | idlc/test/parser/typedef.tests | 63 | ||||
-rw-r--r-- | idlc/test/service.idl | 64 | ||||
-rw-r--r-- | idlc/test/singleton.idl | 61 | ||||
-rw-r--r-- | idlc/test/struct.idl | 121 | ||||
-rw-r--r-- | idlc/test/typelookup.idl | 80 |
20 files changed, 2916 insertions, 0 deletions
diff --git a/idlc/test/const.idl b/idlc/test/const.idl new file mode 100644 index 000000000..aeb638e22 --- /dev/null +++ b/idlc/test/const.idl @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +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; +}; + +}; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/idlc/test/enum.idl b/idlc/test/enum.idl new file mode 100644 index 000000000..9ddbd6e76 --- /dev/null +++ b/idlc/test/enum.idl @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +module idlc +{ +module test +{ + +enum Error +{ + NONE, + FATAL, + SYSTEM, + RUNTIME +}; + +enum Warning +{ + NO, + USER = 2, + WRONGPASSWORD = 4, + IDFAILURE +}; + + +}; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/idlc/test/exception.idl b/idlc/test/exception.idl new file mode 100644 index 000000000..cc15069f4 --- /dev/null +++ b/idlc/test/exception.idl @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +module idlc +{ +module test +{ + +exception BaseException +{ + string Description; +}; + +exception RuntimeException : BaseException +{ + long Id; + type Context; +}; + + +}; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/idlc/test/identifiers.idl b/idlc/test/identifiers.idl new file mode 100644 index 000000000..d845b3729 --- /dev/null +++ b/idlc/test/identifiers.idl @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +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 + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/idlc/test/interface.idl b/idlc/test/interface.idl new file mode 100644 index 000000000..5de90a07b --- /dev/null +++ b/idlc/test/interface.idl @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <enum.idl> +#include <struct.idl> + +module idlc +{ + +module test +{ + +interface XBase +{ + [readonly, attribute] string description; + + string getDescription(); +}; + +interface XTestBaseTypes : XBase +{ + void voidFunc(); + + 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); +}; + +}; + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/idlc/test/parser/attribute.tests b/idlc/test/parser/attribute.tests new file mode 100644 index 000000000..dd0b85bde --- /dev/null +++ b/idlc/test/parser/attribute.tests @@ -0,0 +1,232 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +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 FAILURE "attribute.tests 3a": +interface I1 { + [attribute] long a { + set 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 OLD-FAILURE "attribute.tests 9": +exception E1 {}; +interface I1 { + void E1(); + [attribute] long a { + get raises (E1); + }; +}; + + +EXPECT OLD-FAILURE "attribute.tests 10": +exception E1 {}; +interface I1 { + [attribute] long E1 { + get raises (E1); + }; +}; + + +EXPECT NEW-FAILURE "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, maybeambiguous] long a; +}; + + +EXPECT FAILURE "attribute.tests 22": +interface I1 { + [attribute, maybedefault] long a; +}; + + +EXPECT FAILURE "attribute.tests 23": +interface I1 { + [attribute, removable] 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; +}; + + +EXPECT SUCCESS "attribute.tests 28": +exception E1 {}; +interface I1 { + [attribute, bound] long a { + get raises (E1); + set raises (E1); + }; +}; diff --git a/idlc/test/parser/constant.tests b/idlc/test/parser/constant.tests new file mode 100644 index 000000000..49183d4d1 --- /dev/null +++ b/idlc/test/parser/constant.tests @@ -0,0 +1,294 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +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 FAILURE "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": +constants C { + const byte C1 = -128; + const byte C2 = -0200; + const byte C3 = -0x80; + const byte C4 = 127; + const byte C5 = 0177; + const byte C6 = 0x7F; + 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 NEW-FAILURE "constant.tests 8a": +constants C { + const byte C4 = 255; + const byte C5 = 0377; + const byte C6 = 0xFF; +}; + + +EXPECT FAILURE "constant.tests 9": +constants C { const byte C1 = -129; }; + + +EXPECT FAILURE "constant.tests 10": +constants C { const byte C1 = -0201; }; + + +EXPECT FAILURE "constant.tests 11": +constants C { const byte C1 = -0x81; }; + + +EXPECT FAILURE "constant.tests 12": +constants C { const byte C1 = 256; }; + + +EXPECT FAILURE "constant.tests 13": +constants C { const byte C1 = 0400; }; + + +EXPECT FAILURE "constant.tests 14": +constants C { const byte C1 = 0x100; }; + + +EXPECT FAILURE "constant.tests 15": +constants C { const short C1 = -32769; }; + + +EXPECT FAILURE "constant.tests 16": +constants C { const short C1 = -0100001; }; + + +EXPECT FAILURE "constant.tests 17": +constants C { const short C1 = -0x8001; }; + + +EXPECT FAILURE "constant.tests 18": +constants C { const short C1 = 32768; }; + + +EXPECT FAILURE "constant.tests 19": +constants C { const short C1 = 0100000; }; + + +EXPECT FAILURE "constant.tests 20": +constants C { const short C1 = 0x8000; }; + + +EXPECT FAILURE "constant.tests 21": +constants C { const unsigned short C1 = -1; }; + + +EXPECT FAILURE "constant.tests 22": +constants C { const unsigned short C1 = -01; }; + + +EXPECT FAILURE "constant.tests 23": +constants C { const unsigned short C1 = -0x1; }; + + +EXPECT FAILURE "constant.tests 24": +constants C { const unsigned short C1 = 65536; }; + + +EXPECT FAILURE "constant.tests 25": +constants C { const unsigned short C1 = 0200000; }; + + +EXPECT FAILURE "constant.tests 26": +constants C { const unsigned short C1 = 0x10000; }; + + +EXPECT FAILURE "constant.tests 27": +constants C { const long C1 = -2147483649; }; + + +EXPECT FAILURE "constant.tests 28": +constants C { const long C1 = -020000000001; }; + + +EXPECT FAILURE "constant.tests 29": +constants C { const long C1 = -0x80000001; }; + + +EXPECT FAILURE "constant.tests 30": +constants C { const long C1 = 2147483648; }; + + +EXPECT FAILURE "constant.tests 31": +constants C { const long C1 = 020000000000; }; + + +EXPECT FAILURE "constant.tests 32": +constants C { const long C1 = 0x80000000; }; + + +EXPECT FAILURE "constant.tests 33": +constants C { const unsigned long C1 = -1; }; + + +EXPECT FAILURE "constant.tests 34": +constants C { const unsigned long C1 = -01; }; + + +EXPECT FAILURE "constant.tests 35": +constants C { const unsigned long C1 = -0x1; }; + + +EXPECT FAILURE "constant.tests 36": +constants C { const unsigned long C1 = 4294967296; }; + + +EXPECT FAILURE "constant.tests 37": +constants C { const unsigned long C1 = 040000000000; }; + + +EXPECT FAILURE "constant.tests 38": +constants C { const unsigned long C1 = 0x100000000; }; + + +EXPECT FAILURE "constant.tests 39": +constants C { const hyper C1 = -9223372036854775809; }; + + +EXPECT FAILURE "constant.tests 40": +constants C { const hyper C1 = -01000000000000000000001; }; + + +EXPECT FAILURE "constant.tests 41": +constants C { const hyper C1 = -0x8000000000000001; }; + + +EXPECT FAILURE "constant.tests 42": +constants C { const hyper C1 = 9223372036854775808; }; + + +EXPECT FAILURE "constant.tests 43": +constants C { const hyper C1 = 01000000000000000000000; }; + + +EXPECT FAILURE "constant.tests 44": +constants C { const hyper C1 = 0x8000000000000000; }; + + +EXPECT FAILURE "constant.tests 45": +constants C { const unsigned hyper C1 = -1; }; + + +EXPECT FAILURE "constant.tests 46": +constants C { const unsigned hyper C1 = -01; }; + + +EXPECT FAILURE "constant.tests 47": +constants C { const unsigned hyper C1 = -0x1; }; + + +EXPECT FAILURE "constant.tests 48": +constants C { const unsigned hyper C1 = 18446744073709551616; }; + + +EXPECT FAILURE "constant.tests 49": +constants C { const unsigned hyper C1 = 02000000000000000000000; }; + + +EXPECT FAILURE "constant.tests 50": +constants C { const unsigned hyper C1 = 0x10000000000000000; }; diff --git a/idlc/test/parser/constructor.tests b/idlc/test/parser/constructor.tests new file mode 100644 index 000000000..ce2438b98 --- /dev/null +++ b/idlc/test/parser/constructor.tests @@ -0,0 +1,190 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +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/conversion.tests b/idlc/test/parser/conversion.tests new file mode 100644 index 000000000..4f1d6bc7d --- /dev/null +++ b/idlc/test/parser/conversion.tests @@ -0,0 +1,79 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +EXPECT SUCCESS "conversion.tests 1": +constants C { + const byte C1 = -128.0; + const byte C2 = -127.9; + const byte C3 = 254.9; + const byte C4 = 255.0; + const short C5 = -32768.0; + const short C6 = -32767.9; + const short C7 = 32766.9; + const short C8 = 32767.0; + const unsigned short C9 = 0.0; + const unsigned short C10 = 0.1; + const unsigned short C11 = 65534.9; + const unsigned short C12 = 65535.0; + const long C13 = -2147483648.0; + const long C14 = -2147483647.9; + const long C15 = 2147483646.9; + const long C16 = 2147483647.0; + const unsigned long C17 = 0.0; + const unsigned long C18 = 0.1; + const unsigned long C19 = 4294967294.9; + const unsigned long C20 = 4294967295.0; + const hyper C21 = -9223372036854774784.0; // -0x7FFFFFFFFFFFFC00 = -0x1.FFFFFFFFFFFFFp62 + const hyper C22 = 9223372036854774784.0; // 0x7FFFFFFFFFFFFC00 = 0x1.FFFFFFFFFFFFFp62 + const unsigned hyper C23 = 0.0; + const unsigned hyper C24 = 0.1; + const unsigned hyper C25 = 18446744073709549568.0; // 0xFFFFFFFFFFFFF800 = 0x1.FFFFFFFFFFFFFp63 +}; + +EXPECT FAILURE "conversion.tests 2": +constants C { const byte C1 = -128.1; }; + +EXPECT FAILURE "conversion.tests 3": +constants C { const byte C1 = 255.1; }; + +EXPECT FAILURE "conversion.tests 4": +constants C { const short C1 = -32768.1; }; + +EXPECT FAILURE "conversion.tests 5": +constants C { const short C1 = 32767.1; }; + +EXPECT FAILURE "conversion.tests 6": +constants C { const unsigned short C1 = -0.1; }; + +EXPECT FAILURE "conversion.tests 7": +constants C { const unsigned short C1 = 65535.1; }; + +EXPECT FAILURE "conversion.tests 8": +constants C { const long C1 = -2147483648.1; }; + +EXPECT FAILURE "conversion.tests 9": +constants C { const long C1 = 2147483647.1; }; + +EXPECT FAILURE "conversion.tests 10": +constants C { const unsigned long C1 = -0.1; }; + +EXPECT FAILURE "conversion.tests 11": +constants C { const unsigned long C1 = 4294967295.1; }; + +EXPECT FAILURE "conversion.tests 12": +constants C { const hyper C1 = -9223372036854775808.0; }; // -0x8000000000000000 = -0x1p63 + +EXPECT FAILURE "conversion.tests 13": +constants C { const hyper C1 = 9223372036854775807.0; }; // 0x7FFFFFFFFFFFFFFF rounds up to 0x1p63 + +EXPECT FAILURE "conversion.tests 14": +constants C { const unsigned hyper C1 = -0.1; }; + +EXPECT FAILURE "conversion.tests 15": +constants C { const unsigned hyper C1 = 18446744073709551615.0; }; + // 0xFFFFFFFFFFFFFFFF rounds up to 0x1p64 diff --git a/idlc/test/parser/interfaceinheritance.tests b/idlc/test/parser/interfaceinheritance.tests new file mode 100644 index 000000000..f9cac4ca2 --- /dev/null +++ b/idlc/test/parser/interfaceinheritance.tests @@ -0,0 +1,279 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +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; +}; + + +EXPECT FAILURE "interfaceinheritance.tests 30": +interface Base {}; +interface Derived { + interface Base; + [optional] interface com::sun::star::uno::XInterface; +}; diff --git a/idlc/test/parser/methodoverload.tests b/idlc/test/parser/methodoverload.tests new file mode 100644 index 000000000..9a07a4b2c --- /dev/null +++ b/idlc/test/parser/methodoverload.tests @@ -0,0 +1,177 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +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; +}; + + +EXPECT FAILURE "methodoverload.tests 10": +interface I { + [attribute] long a; + [attribute] short a; +}; + + +EXPECT FAILURE "methodoverload.tests 11": +interface I1 { + [attribute] long a; +}; +interface I2 { + [attribute] short a; + interface I1; +}; + + +EXPECT FAILURE "methodoverload.tests 12": +interface I { + [attribute] long a; + void a(); +}; + + +EXPECT FAILURE "methodoverload.tests 13": +interface I1 { + [attribute] long a; +} +interface I2 { + void a(); + interface I1; +}; + + +EXPECT FAILURE "methodoverload.tests 14": +interface I1 { + void a(); +} +interface I2 { + [attribute] long a; + interface I1; +}; + + +EXPECT SUCCESS "methodoverload.tests 15": +interface I { + [attribute] long a; + void geta(); + void seta(); +}; + + +EXPECT SUCCESS "methodoverload.tests 16": +interface I1 { + [attribute] long a; +}; +interface I2: I1 { + void geta(); + void seta(); +}; diff --git a/idlc/test/parser/oldstyle.tests b/idlc/test/parser/oldstyle.tests new file mode 100644 index 000000000..c6692b977 --- /dev/null +++ b/idlc/test/parser/oldstyle.tests @@ -0,0 +1,28 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +EXPECT SUCCESS "oldstyle.tests 1": +service S1 {}; +service S2 { service S1; }; + + +EXPECT FAILURE "oldstyle.tests 2": +interface X {}; +service S1: X; +service S2 { service S1; }; + + +EXPECT SUCCESS "oldstyle.tests 3": +service S1 {}; +singleton S2 { service S1; }; + + +EXPECT FAILURE "oldstyle.tests 4": +interface X {}; +service S1: X; +singleton S2 { service S1; }; diff --git a/idlc/test/parser/polystruct.tests b/idlc/test/parser/polystruct.tests new file mode 100644 index 000000000..89b0817c9 --- /dev/null +++ b/idlc/test/parser/polystruct.tests @@ -0,0 +1,251 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +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 SUCCESS "polystruct.tests 25a": +struct Struct<T> { long member; }; +interface X { [attribute] Struct<X> 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 000000000..f81ef6b41 --- /dev/null +++ b/idlc/test/parser/published.tests @@ -0,0 +1,681 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +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 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 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 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; +constants Cs { const T C = 1; }; + + +EXPECT FAILURE "published.tests 88": +typedef long T; +published constants Cs { const T C = 1; }; + + +EXPECT SUCCESS "published.tests 89": +published typedef long T; +constants Cs { const T C = 1; }; + + +EXPECT SUCCESS "published.tests 90": +published typedef long T; +published constants Cs { 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; + + +EXPECT FAILURE "published.tests 119": +interface I1 {}; +published interface I2 { [optional] interface I1; }; + + +EXPECT FAILURE "published.tests 120": +service S1 {}; +published service S2 { [optional] service S1; }; + + +EXPECT SUCCESS "published.tests 121": +interface I {}; +published service S { [optional] interface I; }; + + +EXPECT FAILURE "published.tests 122": +interface I {}; +published service S { [optional, property] I p; }; + + +EXPECT FAILURE "published.tests 123": +interface I {}; +published service S { [optional, property] sequence<I> p; }; + + +EXPECT FAILURE "published.tests 124": +struct P<T> { T m; }; +interface I {}; +published service S { [optional, property] P<I> p; }; + + +EXPECT FAILURE "published.tests 125": +published struct P<T> { T m; }; +interface I {}; +published service S { [optional, property] P<I> p; }; + + +EXPECT FAILURE "published.tests 126": +struct P<T> { T m; }; +published interface I {}; +published service S { [optional, property] P<I> p; }; diff --git a/idlc/test/parser/struct.tests b/idlc/test/parser/struct.tests new file mode 100644 index 000000000..77d500e89 --- /dev/null +++ b/idlc/test/parser/struct.tests @@ -0,0 +1,46 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +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 000000000..0eaf5d634 --- /dev/null +++ b/idlc/test/parser/typedef.tests @@ -0,0 +1,63 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +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; + + +EXPECT FAILURE "typdef.tests 8": +constants C {}; +typedef C T; diff --git a/idlc/test/service.idl b/idlc/test/service.idl new file mode 100644 index 000000000..79107f933 --- /dev/null +++ b/idlc/test/service.idl @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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; +}; + +}; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/idlc/test/singleton.idl b/idlc/test/singleton.idl new file mode 100644 index 000000000..e69e2900f --- /dev/null +++ b/idlc/test/singleton.idl @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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; +}; + +}; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/idlc/test/struct.idl b/idlc/test/struct.idl new file mode 100644 index 000000000..133471d2e --- /dev/null +++ b/idlc/test/struct.idl @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +/* 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 * initial struct + */ +struct BaseStruct +{ + Id Id; + + /// a short member + short m1; + + /// an unsigned short member + unsigned short m2; + + /// a long member + long m3; + + /// an unsigned long member + unsigned long m4; + + /// a hyper member + hyper m5; + + /// an 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; + + /// an 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; + + /// an interface member + XTestBaseTypes ms5; + + /// a typedef member + LongSeq ms6; + + /// a further typedef member + LongSeqSeq ms7; + + /// a sequence typedef member + sequence<LongSeq> ms8; + +}; + +}; }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/idlc/test/typelookup.idl b/idlc/test/typelookup.idl new file mode 100644 index 000000000..a9b5612ef --- /dev/null +++ b/idlc/test/typelookup.idl @@ -0,0 +1,80 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +/* 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 * initial struct + */ +struct BaseStruct +{ + /// a long member + long m1; + /// a string member + string m2; + /// a byte member + byte m3; + /// a type member + type m4; + /// an enum member, Error in module idlc::test + Error m5; + /// a typedef member, global Error (typedef short) + ::Error m6; + /// a typedef member, Error in module idlc (typedef long) + ::idlc::Error m7; + /// a typedef member, Error in module idlc (typedef long) + idlc::Error m8; + /// an enum member, Error in module 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; +}; + +}; // test + +}; // idlc + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |