Browse Source

Merge branch 'missing-nodiscards' of public/ls-standard-library into development

patrick-christopher.mattulat 1 năm trước cách đây
mục cha
commit
5069687ae7

+ 1 - 0
README.md

@@ -39,6 +39,7 @@ A __Date__ class comes with this submodule, which you can use to represent a dat
 #### Improvements ####
 
 - made test constructors public and reduced test setup overhead
+- added missing __nodiscard__ attributes to test package
 
 #### Fixes ####
 

+ 12 - 12
test/classes/TestHelper.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-15
- * Changed:         2023-02-23
+ * Changed:         2023-03-27
  *
  * */
 
@@ -22,26 +22,26 @@ namespace ls::std::test
       TestHelper();
       ~TestHelper();
 
-      static ::std::string getResourcesFolderLocation();
-      static ::std::string getTestFolderLocation();
+      [[nodiscard]] static ::std::string getResourcesFolderLocation();
+      [[nodiscard]] static ::std::string getTestFolderLocation();
 
     private:
 
-      static char _getFilePathSeparator();
-      static ::std::string _getParent(const ::std::string &_path);
-      static ::std::string _getWorkingDirectory();
+      [[nodiscard]] static char _getFilePathSeparator();
+      [[nodiscard]] static ::std::string _getParent(const ::std::string &_path);
+      [[nodiscard]] static ::std::string _getWorkingDirectory();
 
 #if defined(unix) || defined(__APPLE__)
-      static ::std::string _getWorkingDirectoryUnix();
+      [[nodiscard]] static ::std::string _getWorkingDirectoryUnix();
 #endif
 #ifdef _WIN32
-      static ::std::string _getWorkingDirectoryWindows();
+      [[nodiscard]] static ::std::string _getWorkingDirectoryWindows();
 #endif
 
-      static ::std::string _normalizePath(::std::string _path);
-      static ::std::string _reduceSeparators(const ::std::string &_path);
-      static ::std::string _replaceWrongSeparator(::std::string _path);
-      static ::std::vector<::std::string> _splitIntoSubDirectoryNames(const ::std::string &_path);
+      [[nodiscard]] static ::std::string _normalizePath(::std::string _path);
+      [[nodiscard]] static ::std::string _reduceSeparators(const ::std::string &_path);
+      [[nodiscard]] static ::std::string _replaceWrongSeparator(::std::string _path);
+      [[nodiscard]] static ::std::vector<::std::string> _splitIntoSubDirectoryNames(const ::std::string &_path);
   };
 }
 

+ 2 - 2
test/classes/event/DailyNewsAgency.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-11-27
- * Changed:         2023-02-23
+ * Changed:         2023-03-27
  *
  * */
 
@@ -32,7 +32,7 @@ namespace test::event
       // additional functionality
 
       void clear();
-      ::std::string getNews();
+      [[nodiscard]] ::std::string getNews();
 
     private:
 

+ 2 - 2
test/classes/event/GossipNewsAgency.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-11-27
- * Changed:         2023-02-23
+ * Changed:         2023-03-27
  *
  * */
 
@@ -32,7 +32,7 @@ namespace test::event
       // additional functionality
 
       void clear();
-      ::std::string getNews();
+      [[nodiscard]] ::std::string getNews();
 
     private:
 

+ 2 - 2
test/classes/event/NewsAgency.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-11-27
- * Changed:         2023-02-05
+ * Changed:         2023-03-27
  *
  * */
 
@@ -21,7 +21,7 @@ namespace test::event
       explicit NewsAgency(::std::string _agencyName);
       virtual ~NewsAgency();
 
-      ::std::string getName();
+      [[nodiscard]] ::std::string getName();
 
     private:
 

+ 2 - 2
test/classes/event/TestDataCar.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-11-14
- * Changed:         2023-02-05
+ * Changed:         2023-03-27
  *
  * */
 
@@ -21,7 +21,7 @@ namespace test::event
       TestDataCar();
       virtual ~TestDataCar();
 
-      ::std::string getColor();
+      [[nodiscard]] ::std::string getColor();
       void setColor(::std::string _color);
 
     private:

+ 4 - 4
test/classes/io/section-pair/SectionPairDocumentProvider.hpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-16
-* Changed:         2023-02-21
+* Changed:         2023-03-27
 *
 * */
 
@@ -24,9 +24,9 @@ namespace test::io
       SectionPairDocumentProvider();
       ~SectionPairDocumentProvider();
 
-      static ::std::shared_ptr<ls::std::io::SectionPairDocument> createDocument();
-      static ls::std::core::type::byte_field createSerializedDocument(const ::std::string &_newLine);
-      static ls::std::core::type::byte_field createSerializedDocumentComputerExample(const ::std::string &_newLine);
+      [[nodiscard]] static ::std::shared_ptr<ls::std::io::SectionPairDocument> createDocument();
+      [[nodiscard]] static ls::std::core::type::byte_field createSerializedDocument(const ::std::string &_newLine);
+      [[nodiscard]] static ls::std::core::type::byte_field createSerializedDocumentComputerExample(const ::std::string &_newLine);
   };
 }
 

+ 5 - 5
test/classes/io/section-pair/SerializableSectionPairRowProvider.hpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-17
-* Changed:         2023-02-17
+* Changed:         2023-03-27
 *
 * */
 
@@ -23,10 +23,10 @@ namespace test::io
       SerializableSectionPairRowProvider();
       ~SerializableSectionPairRowProvider();
 
-      static ::std::shared_ptr<ls::std::io::SerializableSectionPairRow> createListValueForMarshal(const ::std::string &_newLine);
-      static ::std::shared_ptr<ls::std::io::SerializableSectionPairRow> createListValueForUnmarshal(const ::std::string &_newLine);
-      static ::std::shared_ptr<ls::std::io::SerializableSectionPairRow> createSingleValueForMarshal(const ::std::string &_newLine);
-      static ::std::shared_ptr<ls::std::io::SerializableSectionPairRow> createSingleValueForUnmarshal(const ::std::string &_newLine);
+      [[nodiscard]] static ::std::shared_ptr<ls::std::io::SerializableSectionPairRow> createListValueForMarshal(const ::std::string &_newLine);
+      [[nodiscard]] static ::std::shared_ptr<ls::std::io::SerializableSectionPairRow> createListValueForUnmarshal(const ::std::string &_newLine);
+      [[nodiscard]] static ::std::shared_ptr<ls::std::io::SerializableSectionPairRow> createSingleValueForMarshal(const ::std::string &_newLine);
+      [[nodiscard]] static ::std::shared_ptr<ls::std::io::SerializableSectionPairRow> createSingleValueForUnmarshal(const ::std::string &_newLine);
   };
 }
 

+ 2 - 2
test/classes/io/xml/TestDataFactory.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2022-05-14
- * Changed:         2023-02-05
+ * Changed:         2023-03-27
  *
  * */
 
@@ -22,7 +22,7 @@ namespace test::io
       TestDataFactory();
       ~TestDataFactory();
 
-      static ::std::shared_ptr<ls::std::io::XmlNode> createXmlContent();
+      [[nodiscard]] static ::std::shared_ptr<ls::std::io::XmlNode> createXmlContent();
   };
 }
 

+ 3 - 3
test/classes/io/xml/XmlParserTestWrapper.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-10-18
- * Changed:         2023-02-23
+ * Changed:         2023-03-27
  *
  * */
 
@@ -21,8 +21,8 @@ namespace test::io
       XmlParserTestWrapper();
       ~XmlParserTestWrapper() noexcept override;
 
-      static ::std::pair<::std::string, ::std::string> readAttribute(const ls::std::core::type::byte_field &_data);
-      static ::std::list<::std::pair<::std::string, ::std::string>> readAttributes(ls::std::core::type::byte_field _data);
+      [[nodiscard]] static ::std::pair<::std::string, ::std::string> readAttribute(const ls::std::core::type::byte_field &_data);
+      [[nodiscard]] static ::std::list<::std::pair<::std::string, ::std::string>> readAttributes(ls::std::core::type::byte_field _data);
   };
 }