Skip to content

Commit

Permalink
ignore some unreached lines
Browse files Browse the repository at this point in the history
  • Loading branch information
pit-ray committed Mar 29, 2024
1 parent 70fc497 commit a4c813c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
8 changes: 8 additions & 0 deletions include/fluent_tray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,20 @@ namespace fluent_tray
CP_UTF8, 0,
str.c_str(), static_cast<int>(str.length()),
NULL, 0) ;
#ifndef _FLUENT_TRAY_IGNORE_IN_TEST
if(needed_size <= 0) {
return false ;
}
#endif

wstr.resize(needed_size) ;
if(MultiByteToWideChar(
CP_UTF8, 0,
str.c_str(), static_cast<int>(str.length()),
&wstr[0], static_cast<int>(wstr.length())) <= 0) {
#ifndef _FLUENT_TRAY_IGNORE_IN_TEST
return false;
#endif
}
return true ;
}
Expand All @@ -137,17 +141,21 @@ namespace fluent_tray
wstr.c_str(), static_cast<int>(wstr.length()),
NULL, 0,
NULL, NULL) ;
#ifndef _FLUENT_TRAY_IGNORE_IN_TEST
if(needed_size <= 0) {
return false ;
}
#endif

str.resize(needed_size) ;
if(WideCharToMultiByte(
CP_UTF8, 0,
wstr.c_str(), static_cast<int>(wstr.length()),
&str[0], static_cast<int>(str.size()),
NULL, NULL) <= 0) {
#ifndef _FLUENT_TRAY_IGNORE_IN_TEST
return false ;
#endif
}
return true ;
}
Expand Down
4 changes: 1 addition & 3 deletions tests/menu_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "doctest.h"

#include "fluent_tray.hpp"
#include "test.hpp"

using namespace fluent_tray ;

Expand Down
4 changes: 1 addition & 3 deletions tests/string_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "doctest.h"

#include "fluent_tray.hpp"
#include "test.hpp"

using namespace fluent_tray ;

Expand Down
10 changes: 10 additions & 0 deletions tests/test.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef _TEST_HPP
#define _TEST_HPP

#include "doctest.h"

#define _FLUENT_TRAY_IGNORE_IN_TEST

#include "fluent_tray.hpp"

#endif
4 changes: 1 addition & 3 deletions tests/tray_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "doctest.h"

#include "fluent_tray.hpp"
#include "test.hpp"

#include <string.h>

Expand Down

0 comments on commit a4c813c

Please sign in to comment.