tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sal / qa / rtl / bootstrap / expand.cxx
blobcb9acb3a200fa5b9089c5ed4f75f3f1b17fe637c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <sal/config.h>
12 #include <cppunit/TestAssert.h>
13 #include <cppunit/TestFixture.h>
14 #include <cppunit/extensions/HelperMacros.h>
15 #include <rtl/bootstrap.hxx>
16 #include <rtl/ustring.hxx>
18 namespace {
20 class Test: public CppUnit::TestFixture {
21 public:
22 virtual void setUp() override;
24 private:
25 CPPUNIT_TEST_SUITE(Test);
26 CPPUNIT_TEST(testDollar);
27 CPPUNIT_TEST(testIndirectDollar);
28 CPPUNIT_TEST_SUITE_END();
30 void testDollar();
32 void testIndirectDollar();
35 void Test::setUp() {
36 rtl::Bootstrap::set(u"TEST"_ustr, u"<expanded TEST>"_ustr);
37 rtl::Bootstrap::set(u"WITH_DOLLAR"_ustr, u"foo\\$TEST"_ustr);
38 rtl::Bootstrap::set(u"INDIRECT"_ustr, u"$WITH_DOLLAR"_ustr);
41 void Test::testDollar() {
42 OUString s(u"$WITH_DOLLAR"_ustr);
43 rtl::Bootstrap::expandMacros(s);
44 CPPUNIT_ASSERT_EQUAL(u"foo$TEST"_ustr, s);
47 void Test::testIndirectDollar() {
48 OUString s(u"$INDIRECT"_ustr);
49 rtl::Bootstrap::expandMacros(s);
50 CPPUNIT_ASSERT_EQUAL(u"foo$TEST"_ustr, s);
53 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
57 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */