Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libstorage-ng for openSUSE:Factory checked in at 2026-05-16 19:24:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libstorage-ng (Old) and /work/SRC/openSUSE:Factory/.libstorage-ng.new.1966 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libstorage-ng" Sat May 16 19:24:13 2026 rev:338 rq:1353532 version:4.5.320 Changes: -------- --- /work/SRC/openSUSE:Factory/libstorage-ng/libstorage-ng.changes 2026-05-14 21:42:59.370679877 +0200 +++ /work/SRC/openSUSE:Factory/.libstorage-ng.new.1966/libstorage-ng.changes 2026-05-16 19:25:04.091370678 +0200 @@ -1,0 +2,33 @@ +Sat May 16 10:56:49 UTC 2026 - [email protected] + +- Translated using Weblate (Spanish) (bsc#1149754) +- 4.5.320 + +-------------------------------------------------------------------- +Fri May 15 16:52:20 UTC 2026 - [email protected] + +- merge gh#openSUSE/libstorage-ng#1073 +- make parser for /proc/mdstat more robust +- added test cases +- 4.5.319 + +-------------------------------------------------------------------- +Fri May 15 10:10:34 UTC 2026 - [email protected] + +- Translated using Weblate (Chinese (China) (zh_CN)) (bsc#1149754) +- 4.5.318 + +-------------------------------------------------------------------- +Fri May 15 10:10:33 UTC 2026 - [email protected] + +- Translated using Weblate (Chinese (Taiwan) (zh_TW)) (bsc#1149754) + +-------------------------------------------------------------------- +Fri May 15 10:10:32 UTC 2026 - [email protected] + +- merge gh#openSUSE/libstorage-ng#1072 +- fixed logging empty lines +- added test cases +- 4.5.317 + +-------------------------------------------------------------------- Old: ---- libstorage-ng-4.5.316.tar.xz New: ---- libstorage-ng-4.5.320.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libstorage-ng.spec ++++++ --- /var/tmp/diff_new_pack.wnzanP/_old 2026-05-16 19:25:05.203416189 +0200 +++ /var/tmp/diff_new_pack.wnzanP/_new 2026-05-16 19:25:05.207416353 +0200 @@ -18,7 +18,7 @@ %define libname %{name}1 Name: libstorage-ng -Version: 4.5.316 +Version: 4.5.320 Release: 0 Summary: Library for storage management License: GPL-2.0-only ++++++ libstorage-ng-4.5.316.tar.xz -> libstorage-ng-4.5.320.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.316/VERSION new/libstorage-ng-4.5.320/VERSION --- old/libstorage-ng-4.5.316/VERSION 2026-05-13 18:49:39.000000000 +0200 +++ new/libstorage-ng-4.5.320/VERSION 2026-05-16 15:12:50.000000000 +0200 @@ -1 +1 @@ -4.5.316 +4.5.320 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.316/po/es.po new/libstorage-ng-4.5.320/po/es.po --- old/libstorage-ng-4.5.316/po/es.po 2026-05-13 18:49:39.000000000 +0200 +++ new/libstorage-ng-4.5.320/po/es.po 2026-05-16 15:12:50.000000000 +0200 @@ -17,8 +17,8 @@ "Project-Id-Version: YaST (@memory@)\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-01-29 14:48+0100\n" -"PO-Revision-Date: 2026-03-13 15:04+0000\n" -"Last-Translator: \"Marina J. Donis\" <[email protected]>\n" +"PO-Revision-Date: 2026-05-16 13:12+0000\n" +"Last-Translator: Antonio Simón <[email protected]>\n" "Language-Team: Spanish <https://l10n.opensuse.org/projects/libstorage/ng-" "master/es/>\n" "Language: es\n" @@ -26,7 +26,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 5.16.2\n" +"X-Generator: Weblate 2026.5\n" "X-Poedit-Language: Spanish\n" msgid "" @@ -2092,7 +2092,7 @@ #. TRANSLATORS: symbol for "gibi bytes" (best keep untranslated) msgid "GiB" -msgstr "GB" +msgstr "GiB" #. TRANSLATORS: displayed before action, #. %1$s is replaced by device name (e.g. /dev/sda1), @@ -2568,7 +2568,7 @@ #. TRANSLATORS: symbol for "pebi bytes" (best keep untranslated) msgid "PiB" -msgstr "PB" +msgstr "PiB" #. TRANSLATORS: name of object msgid "Plain Encryption" @@ -3373,7 +3373,7 @@ #. TRANSLATORS: symbol for "tebi bytes" (best keep untranslated) msgid "TiB" -msgstr "TB" +msgstr "TiB" #. TRANSLATORS: name of object msgid "UDF" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.316/po/zh_CN.po new/libstorage-ng-4.5.320/po/zh_CN.po --- old/libstorage-ng-4.5.316/po/zh_CN.po 2026-05-13 18:49:39.000000000 +0200 +++ new/libstorage-ng-4.5.320/po/zh_CN.po 2026-05-16 15:12:50.000000000 +0200 @@ -10,8 +10,8 @@ "Project-Id-Version: YaST (@memory@)\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-01-29 14:48+0100\n" -"PO-Revision-Date: 2025-07-22 15:01+0000\n" -"Last-Translator: Julia Faltenbacher <[email protected]>\n" +"PO-Revision-Date: 2026-05-15 11:12+0000\n" +"Last-Translator: Emily Dong <[email protected]>\n" "Language-Team: Chinese (China) <https://l10n.opensuse.org/projects/" "libstorage/ng-master/zh_CN/>\n" "Language: zh_CN\n" @@ -19,7 +19,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 5.12.2\n" +"X-Generator: Weblate 5.17.1\n" msgid "" "\n" @@ -1898,7 +1898,7 @@ #. TRANSLATORS: name of object msgid "Erofs" -msgstr "" +msgstr "Erofs" #. TRANSLATORS: name of object msgid "Ext2" @@ -3261,7 +3261,7 @@ #. TRANSLATORS: name of object msgid "Squashfs" -msgstr "" +msgstr "Squashfs" #. TRANSLATORS: name of object msgid "Stray Block Device" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.316/po/zh_TW.po new/libstorage-ng-4.5.320/po/zh_TW.po --- old/libstorage-ng-4.5.316/po/zh_TW.po 2026-05-13 18:49:39.000000000 +0200 +++ new/libstorage-ng-4.5.320/po/zh_TW.po 2026-05-16 15:12:50.000000000 +0200 @@ -12,8 +12,8 @@ "Project-Id-Version: libstorage\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-01-29 14:48+0100\n" -"PO-Revision-Date: 2025-07-22 15:01+0000\n" -"Last-Translator: Julia Faltenbacher <[email protected]>\n" +"PO-Revision-Date: 2026-05-15 11:12+0000\n" +"Last-Translator: Emily Dong <[email protected]>\n" "Language-Team: Chinese (Taiwan) <https://l10n.opensuse.org/projects/" "libstorage/ng-master/zh_TW/>\n" "Language: zh_TW\n" @@ -21,7 +21,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 5.12.2\n" +"X-Generator: Weblate 5.17.1\n" msgid "" "\n" @@ -1909,7 +1909,7 @@ #. TRANSLATORS: name of object msgid "Erofs" -msgstr "" +msgstr "Erofs" #. TRANSLATORS: name of object msgid "Ext2" @@ -3280,7 +3280,7 @@ #. TRANSLATORS: name of object msgid "Squashfs" -msgstr "" +msgstr "Squashfs" #. TRANSLATORS: name of object msgid "Stray Block Device" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.316/storage/SystemInfo/ProcMdstat.cc new/libstorage-ng-4.5.320/storage/SystemInfo/ProcMdstat.cc --- old/libstorage-ng-4.5.316/storage/SystemInfo/ProcMdstat.cc 2026-05-13 18:49:39.000000000 +0200 +++ new/libstorage-ng-4.5.320/storage/SystemInfo/ProcMdstat.cc 2026-05-16 15:12:50.000000000 +0200 @@ -1,6 +1,6 @@ /* * Copyright (c) [2004-2014] Novell, Inc. - * Copyright (c) [2017-2023] SUSE LLC + * Copyright (c) [2017-2026] SUSE LLC * * All Rights Reserved. * @@ -21,6 +21,7 @@ */ +#include <cctype> #include <locale> #include <boost/algorithm/string.hpp> @@ -50,14 +51,26 @@ void ProcMdstat::parse(const vector<string>& lines) { - for (vector<string>::const_iterator it1 = lines.begin(); it1 != lines.end(); ++it1) + auto is_blank = [](const string& s) { + return std::all_of(s.begin(), s.end(), [](unsigned char c) { + return std::isspace(c); + }); + }; + + if (lines.empty()) + return; + + vector<string>::const_iterator b = std::find_if_not(std::next(lines.begin()), lines.end(), is_blank); + + while (b != lines.end()) { - if (extractNthWord(1, *it1) == ":") - { - string name = extractNthWord(0, *it1); - if (boost::starts_with(name, "md")) - data[name] = parse_entry(*it1, *(it1 + 1)); - } + vector<string>::const_iterator e = std::find_if(b, lines.end(), is_blank); + + string name = extractNthWord(0, *b); + if (boost::starts_with(name, "md")) + data[name] = parse_entry(b, e); + + b = std::find_if_not(e, lines.end(), is_blank); } y2mil(*this); @@ -65,58 +78,62 @@ ProcMdstat::Entry - ProcMdstat::parse_entry(const string& line1, const string& line2) const + ProcMdstat::parse_entry(vector<string>::const_iterator b, vector<string>::const_iterator e) const { + if (std::distance(b, e) < 2) + ST_THROW(ParseException("truncated raid entry", "just one line", "at least two lines")); + ProcMdstat::Entry entry; string::size_type pos; string tmp; - string line = line1; - if( (pos=line.find( ':' ))!=string::npos ) - line.erase( 0, pos+1 ); - boost::trim_left(line, locale::classic()); - if( (pos=line.find_first_of( app_ws ))!=string::npos ) + string line1 = *b++; + + if( (pos=line1.find( ':' ))!=string::npos ) + line1.erase( 0, pos+1 ); + boost::trim_left(line1, locale::classic()); + if( (pos=line1.find_first_of( app_ws ))!=string::npos ) { - if (line.substr(0, pos) == "active") - line.erase(0, pos); + if (line1.substr(0, pos) == "active") + line1.erase(0, pos); } - boost::trim_left(line, locale::classic()); - if( (pos=line.find_first_of( app_ws ))!=string::npos ) + boost::trim_left(line1, locale::classic()); + if( (pos=line1.find_first_of( app_ws ))!=string::npos ) { - tmp = line.substr( 0, pos ); + tmp = line1.substr( 0, pos ); if( tmp=="(read-only)" || tmp=="(auto-read-only)" || tmp=="inactive" ) { entry.read_only = true; entry.inactive = tmp=="inactive"; - line.erase( 0, pos ); - boost::trim_left(line, locale::classic()); + line1.erase( 0, pos ); + boost::trim_left(line1, locale::classic()); } } - boost::trim_left(line, locale::classic()); - if( (pos=line.find_first_of( app_ws ))!=string::npos ) + boost::trim_left(line1, locale::classic()); + if( (pos=line1.find_first_of( app_ws ))!=string::npos ) { - if( line.substr( 0, pos ).find( "active" )!=string::npos ) - line.erase( 0, pos ); + if( line1.substr( 0, pos ).find( "active" )!=string::npos ) + line1.erase( 0, pos ); } - boost::trim_left(line, locale::classic()); + boost::trim_left(line1, locale::classic()); - tmp = extractNthWord( 0, line ); + tmp = extractNthWord( 0, line1 ); if (boost::starts_with(tmp, "raid") || tmp == "linear") { entry.md_level = toValueWithFallback(boost::to_upper_copy(tmp, locale::classic()), MdLevel::UNKNOWN); if (entry.md_level == MdLevel::UNKNOWN) y2war("unknown raid type " << tmp); - if( (pos=line.find_first_of( app_ws ))!=string::npos ) - line.erase( 0, pos ); - if( (pos=line.find_first_not_of( app_ws ))!=string::npos && pos!=0 ) - line.erase( 0, pos ); + if( (pos=line1.find_first_of( app_ws ))!=string::npos ) + line1.erase( 0, pos ); + if( (pos=line1.find_first_not_of( app_ws ))!=string::npos && pos!=0 ) + line1.erase( 0, pos ); } - while( (pos=line.find_first_not_of( app_ws ))==0 ) + while( (pos=line1.find_first_not_of( app_ws ))==0 ) { - tmp = extractNthWord( 0, line ); + tmp = extractNthWord( 0, line1 ); string d; string::size_type bracket = tmp.find( '[' ); @@ -132,13 +149,15 @@ entry.devices.emplace_back(d, is_spare, is_faulty, is_journal); - line.erase( 0, tmp.length() ); - if( (pos=line.find_first_not_of( app_ws ))!=string::npos && pos!=0 ) - line.erase( 0, pos ); + line1.erase( 0, tmp.length() ); + if( (pos=line1.find_first_not_of( app_ws ))!=string::npos && pos!=0 ) + line1.erase( 0, pos ); } sort(entry.devices.begin(), entry.devices.end()); + string line2 = *b++; + extractNthWord(0, line2) >> entry.size; entry.size *= KiB; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.316/storage/SystemInfo/ProcMdstat.h new/libstorage-ng-4.5.320/storage/SystemInfo/ProcMdstat.h --- old/libstorage-ng-4.5.316/storage/SystemInfo/ProcMdstat.h 2026-05-13 18:49:39.000000000 +0200 +++ new/libstorage-ng-4.5.320/storage/SystemInfo/ProcMdstat.h 2026-05-16 15:12:50.000000000 +0200 @@ -1,6 +1,6 @@ /* * Copyright (c) [2004-2014] Novell, Inc. - * Copyright (c) [2017-2022] SUSE LLC + * Copyright (c) [2017-2026] SUSE LLC * * All Rights Reserved. * @@ -102,7 +102,7 @@ void parse(const vector<string>& lines); - Entry parse_entry(const string& line1, const string& line2) const; + Entry parse_entry(vector<string>::const_iterator b, vector<string>::const_iterator e) const; map<string, Entry> data; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.316/storage/Utils/Logger.cc new/libstorage-ng-4.5.320/storage/Utils/Logger.cc --- old/libstorage-ng-4.5.316/storage/Utils/Logger.cc 2026-05-13 18:49:39.000000000 +0200 +++ new/libstorage-ng-4.5.320/storage/Utils/Logger.cc 2026-05-16 15:12:50.000000000 +0200 @@ -21,7 +21,7 @@ */ -#include <stdio.h> +#include <cstdio> #include <fcntl.h> #include <unistd.h> #include <sys/types.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.316/storage/Utils/LoggerImpl.cc new/libstorage-ng-4.5.320/storage/Utils/LoggerImpl.cc --- old/libstorage-ng-4.5.316/storage/Utils/LoggerImpl.cc 2026-05-13 18:49:39.000000000 +0200 +++ new/libstorage-ng-4.5.320/storage/Utils/LoggerImpl.cc 2026-05-16 15:12:50.000000000 +0200 @@ -1,6 +1,6 @@ /* * Copyright (c) 2015 Novell, Inc. - * Copyright (c) 2016 SUSE LLC + * Copyright (c) [2016-2026] SUSE LLC * * All Rights Reserved. * @@ -36,21 +36,25 @@ query_log_level(LogLevel log_level) { Logger* logger = get_logger(); + if (logger) - { return logger->test(log_level, component); - } return false; } - void - prepare_log_stream(ostringstream& stream) + namespace { - stream.imbue(std::locale::classic()); - stream.setf(std::ios::boolalpha); - stream.setf(std::ios::showbase); + + void + prepare_log_stream(ostringstream& stream) + { + stream.imbue(std::locale::classic()); + stream.setf(std::ios::boolalpha); + stream.setf(std::ios::showbase); + } + } @@ -68,20 +72,22 @@ ostringstream* stream) { Logger* logger = get_logger(); - if (logger) + + // No need to check if logger is set since close_log_stream is only called from + // y2log_op if logger is set. + + const string content = stream->str(); + + string::size_type pos1 = 0; + while (true) { - string content = stream->str(); - string::size_type pos1 = 0; - while (true) - { - string::size_type pos2 = content.find('\n', pos1); - if (pos2 != string::npos || pos1 != content.length()) - logger->write(log_level, component, file, line, func, - content.substr(pos1, pos2 - pos1)); - if (pos2 == string::npos) - break; - pos1 = pos2 + 1; - } + string::size_type pos2 = content.find('\n', pos1); + if (pos1 == 0 || pos2 != string::npos || pos1 != content.length()) + logger->write(log_level, component, file, line, func, + content.substr(pos1, pos2 - pos1)); + if (pos2 == string::npos) + break; + pos1 = pos2 + 1; } delete stream; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.316/testsuite/SystemInfo/proc-mdstat.cc new/libstorage-ng-4.5.320/testsuite/SystemInfo/proc-mdstat.cc --- old/libstorage-ng-4.5.316/testsuite/SystemInfo/proc-mdstat.cc 2026-05-13 18:49:39.000000000 +0200 +++ new/libstorage-ng-4.5.320/testsuite/SystemInfo/proc-mdstat.cc 2026-05-16 15:12:50.000000000 +0200 @@ -4,7 +4,6 @@ #include <numeric> #include <boost/test/unit_test.hpp> -#include <boost/algorithm/string.hpp> #include "storage/SystemInfo/ProcMdstat.h" #include "storage/Utils/Mockup.h" @@ -226,3 +225,19 @@ check(input, output); } + + +BOOST_AUTO_TEST_CASE(parse_error1) +{ + // Truncated input. + + vector<string> input = { + "Personalities : [raid1] ", + "md0 : active raid1 sda1[1] sdb1[0]" + }; + + vector<string> output = { + }; + + BOOST_CHECK_THROW({ check(input, output); }, ParseException); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.316/testsuite/Utils/Makefile.am new/libstorage-ng-4.5.320/testsuite/Utils/Makefile.am --- old/libstorage-ng-4.5.316/testsuite/Utils/Makefile.am 2026-05-13 18:49:39.000000000 +0200 +++ new/libstorage-ng-4.5.320/testsuite/Utils/Makefile.am 2026-05-16 15:12:50.000000000 +0200 @@ -10,7 +10,7 @@ exception.test topology.test alignment.test math.test systemcmd.test \ dirname.test basename.test algorithm.test format.test join.test \ regex.test sort-by.test jsonfile.test rootprefix.test \ - udev-filters.test dm-encoding.test xml.test + udev-filters.test dm-encoding.test logger.test xml.test AM_DEFAULT_SOURCE_EXT = .cc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.316/testsuite/Utils/logger.cc new/libstorage-ng-4.5.320/testsuite/Utils/logger.cc --- old/libstorage-ng-4.5.316/testsuite/Utils/logger.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-ng-4.5.320/testsuite/Utils/logger.cc 2026-05-16 15:12:50.000000000 +0200 @@ -0,0 +1,159 @@ + +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE libstorage + +#include <boost/test/unit_test.hpp> + +#include "storage/Utils/LoggerImpl.h" + + +using namespace std; +using namespace storage; + + +class Recorder : public Logger +{ +public: + + bool test(LogLevel log_level, const std::string& component) override + { + return log_level > LogLevel::DEBUG; + } + + void write(LogLevel log_level, const std::string& component, const string& file, + int line, const string& function, const string& content) override + { + entries.emplace_back(log_level, file, line, content); + } + + struct Entry + { + Entry(LogLevel log_level, const string& file, int line, const string& content) + : log_level(log_level), file(file), line(line), content(content) + { + } + + LogLevel log_level; + string file; + int line; + string content; + }; + + std::vector<Entry> entries; + +}; + + +BOOST_AUTO_TEST_CASE(logger1) +{ + Recorder recorder; + + set_logger(&recorder); + + y2mil("milestone"); + + BOOST_REQUIRE_EQUAL(recorder.entries.size(), 1); + + BOOST_CHECK(recorder.entries[0].log_level == LogLevel::MILESTONE); + BOOST_CHECK_EQUAL(recorder.entries[0].file, "logger.cc"); + BOOST_CHECK_EQUAL(recorder.entries[0].line, 53); + BOOST_CHECK_EQUAL(recorder.entries[0].content, "milestone"); +} + + +BOOST_AUTO_TEST_CASE(multiline1) +{ + Recorder recorder; + + set_logger(&recorder); + + y2mil("hello"); + y2mil(" "); + y2mil("world"); + y2mil(""); + + BOOST_REQUIRE_EQUAL(recorder.entries.size(), 4); + + BOOST_CHECK_EQUAL(recorder.entries[0].content, "hello"); + BOOST_CHECK_EQUAL(recorder.entries[1].content, " "); + BOOST_CHECK_EQUAL(recorder.entries[2].content, "world"); + BOOST_CHECK_EQUAL(recorder.entries[3].content, ""); +} + + +BOOST_AUTO_TEST_CASE(multiline2) +{ + Recorder recorder; + + set_logger(&recorder); + + y2mil("hello\nworld"); + + BOOST_REQUIRE_EQUAL(recorder.entries.size(), 2); + + BOOST_CHECK_EQUAL(recorder.entries[0].content, "hello"); + BOOST_CHECK_EQUAL(recorder.entries[1].content, "world"); +} + + +BOOST_AUTO_TEST_CASE(multiline3) +{ + Recorder recorder; + + set_logger(&recorder); + + y2mil("\n hello \n \n world \n"); + + BOOST_REQUIRE_EQUAL(recorder.entries.size(), 4); + + BOOST_CHECK_EQUAL(recorder.entries[0].content, ""); + BOOST_CHECK_EQUAL(recorder.entries[1].content, " hello "); + BOOST_CHECK_EQUAL(recorder.entries[2].content, " "); + BOOST_CHECK_EQUAL(recorder.entries[3].content, " world "); +} + + +BOOST_AUTO_TEST_CASE(multiline4) +{ + Recorder recorder; + + set_logger(&recorder); + + y2mil("\nhello\n\nworld\n\n"); + + BOOST_REQUIRE_EQUAL(recorder.entries.size(), 5); + + BOOST_CHECK_EQUAL(recorder.entries[0].content, ""); + BOOST_CHECK_EQUAL(recorder.entries[1].content, "hello"); + BOOST_CHECK_EQUAL(recorder.entries[2].content, ""); + BOOST_CHECK_EQUAL(recorder.entries[3].content, "world"); + BOOST_CHECK_EQUAL(recorder.entries[4].content, ""); +} + + +BOOST_AUTO_TEST_CASE(no_logger) +{ + set_logger(nullptr); + + y2mil("no logger, no crash"); +} + + +BOOST_AUTO_TEST_CASE(conditional_expansion) +{ + Recorder recorder; + + set_logger(&recorder); + + size_t n_mil = 0; + size_t n_deb = 0; + + y2mil("test mil " << ++n_mil); + y2deb("test deb " << ++n_deb); + + BOOST_REQUIRE_EQUAL(recorder.entries.size(), 1); + BOOST_CHECK_EQUAL(recorder.entries[0].content, "test mil 1"); + + BOOST_CHECK_EQUAL(n_mil, 1); + BOOST_CHECK_EQUAL(n_deb, 0); +}
