LCOV - code coverage report
Current view: top level - libreoffice/sal/qa/rtl/bootstrap - expand.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 22 22 100.0 %
Date: 2012-12-27 Functions: 12 13 92.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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             :  */
       9             : 
      10             : #include "sal/config.h"
      11             : 
      12             : #include "cppunit/TestAssert.h"
      13             : #include "cppunit/TestFixture.h"
      14             : #include "cppunit/extensions/HelperMacros.h"
      15             : #include "cppunit/plugin/TestPlugIn.h"
      16             : #include "rtl/bootstrap.hxx"
      17             : #include "rtl/ustring.hxx"
      18             : 
      19             : namespace {
      20             : 
      21           6 : class Test: public CppUnit::TestFixture {
      22             : public:
      23             :     virtual void setUp();
      24             : 
      25             : private:
      26           2 :     CPPUNIT_TEST_SUITE(Test);
      27           1 :     CPPUNIT_TEST(testDollar);
      28           1 :     CPPUNIT_TEST(testIndirectDollar);
      29           2 :     CPPUNIT_TEST_SUITE_END();
      30             : 
      31             :     void testDollar();
      32             : 
      33             :     void testIndirectDollar();
      34             : };
      35             : 
      36           2 : void Test::setUp() {
      37           2 :     rtl::Bootstrap::set("TEST", "<expanded TEST>");
      38           2 :     rtl::Bootstrap::set("WITH_DOLLAR", "foo\\$TEST");
      39           2 :     rtl::Bootstrap::set("INDIRECT", "$WITH_DOLLAR");
      40           2 : }
      41             : 
      42           1 : void Test::testDollar() {
      43           1 :     rtl::OUString s("$WITH_DOLLAR");
      44           1 :     rtl::Bootstrap::expandMacros(s);
      45           1 :     CPPUNIT_ASSERT_EQUAL(rtl::OUString("foo$TEST"), s);
      46           1 : }
      47             : 
      48           1 : void Test::testIndirectDollar() {
      49           1 :     rtl::OUString s("$INDIRECT");
      50           1 :     rtl::Bootstrap::expandMacros(s);
      51           1 :     CPPUNIT_ASSERT_EQUAL(rtl::OUString("foo$TEST"), s);
      52           1 : }
      53             : 
      54           1 : CPPUNIT_TEST_SUITE_REGISTRATION(Test);
      55             : 
      56             : }
      57             : 
      58           4 : CPPUNIT_PLUGIN_IMPLEMENT();
      59             : 
      60             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10