LCOV - code coverage report
Current view: top level - autotest/cpp - testlog.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 13 13 100.0 %
Date: 2025-01-18 12:42:00 Functions: 4 4 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  Test CPL_LOG
       5             :  * Author:   Even Rouault, even.rouault at spatialys.com
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2021, Even Rouault <even.rouault at spatialys.com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #include "cpl_conv.h"
      14             : #include "cpl_error.h"
      15             : #include "cpl_vsi.h"
      16             : 
      17             : #include "gtest_include.h"
      18             : 
      19             : namespace
      20             : {
      21             : 
      22             : // ---------------------------------------------------------------------------
      23             : 
      24           4 : TEST(testlog, test)
      25             : {
      26           1 :     const char *logname = "log_with_âccent.txt";
      27           1 :     CPLSetConfigOption("CPL_LOG", logname);
      28           1 :     CPLError(CE_Failure, CPLE_AppDefined, "test");
      29           1 :     VSILFILE *fp = VSIFOpenL(logname, "rb");
      30             :     char szGot[20 + 1];
      31           1 :     size_t nRead = VSIFReadL(szGot, 1, 20, fp);
      32           1 :     szGot[nRead] = 0;
      33           1 :     VSIFCloseL(fp);
      34           1 :     CPLCleanupErrorMutex();
      35           1 :     VSIUnlink(logname);
      36             : 
      37           1 :     EXPECT_TRUE(strstr(szGot, "ERROR 1") != nullptr) << szGot;
      38           1 :     EXPECT_TRUE(strstr(szGot, "test") != nullptr) << szGot;
      39           1 : }
      40             : 
      41             : }  // namespace

Generated by: LCOV version 1.14