From 1b615c04a26337f0170ecff49b0a6c2522b49eaf Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Fri, 13 Nov 2020 20:01:35 -0800 Subject: [PATCH 01/64] Updated csspp to compile against the newest version of advgetopt. --- debian/changelog | 6 ++++++ src/csspp.cpp | 1 + 2 files changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index fa81917..9177c01 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +csspp (1.0.27.0~xenial) xenial; urgency=high + + * Updated csspp to compile against the newest version of advgetopt. + + -- Alexis Wilke Fri, 13 Nov 2020 20:01:29 -0800 + csspp (1.0.26.0~xenial) xenial; urgency=high * Fixed the advgetopt exception names. diff --git a/src/csspp.cpp b/src/csspp.cpp index f2afa03..03369d5 100644 --- a/src/csspp.cpp +++ b/src/csspp.cpp @@ -353,6 +353,7 @@ constexpr advgetopt::option g_options[] = advgetopt::options_environment const g_options_environment = { .f_project_name = "csspp", + .f_group_name = nullptr, .f_options = g_options, .f_options_files_directory = nullptr, .f_environment_variable_name = "CSSPPFLAGS", From 58419e1ff6121e857544703f7fdd4f7365bf605e Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Fri, 13 Nov 2020 20:44:19 -0800 Subject: [PATCH 02/64] Adjusted version for advgetopt --- debian/changelog | 7 +++++++ debian/control | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 9177c01..4dacbae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +csspp (1.0.27.1~xenial) xenial; urgency=high + + * Bump version for a rebuild. + * Adjusted version for advgetopt (min. needed is 2.0.14 now). + + -- Alexis Wilke Fri, 13 Nov 2020 20:44:08 -0800 + csspp (1.0.27.0~xenial) xenial; urgency=high * Updated csspp to compile against the newest version of advgetopt. diff --git a/debian/control b/debian/control index 428568f..553d2d0 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,7 @@ Build-Depends: catch (>= 1.0), debhelper, doxygen, graphviz, - libadvgetopt-dev (>= 2.0.4.0~xenial), + libadvgetopt-dev (>= 2.0.14.0~xenial), libboost-dev, libexcept-dev (>= 1.0.5.0~xenial), libutf8-dev (>= 1.0.6.0~xenial), From 8f37032b2f0930e51ccedab4f4a2aa8d776aeae9 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Fri, 15 Jan 2021 20:39:03 -0800 Subject: [PATCH 03/64] Bumped version to recompile. --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 4dacbae..0c9925f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +csspp (1.0.27.2~xenial) xenial; urgency=high + + * Bump version for a rebuild for newer cppthread. + + -- Alexis Wilke Fri, 15 Jan 2021 20:38:56 -0800 + csspp (1.0.27.1~xenial) xenial; urgency=high * Bump version for a rebuild. From 10a8f9a7bb6d955ffa561ba948ce887dff72b679 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Mon, 15 Mar 2021 23:10:08 -0700 Subject: [PATCH 04/64] Updated the copyright notices. --- CMakeLists.txt | 2 +- debian/changelog | 7 +++++++ dev/MasterCMakeLists.txt | 2 +- dev/build-release | 2 +- dev/coverage | 2 +- dev/pack | 2 +- dev/version | 2 +- doc/CMakeLists.txt | 2 +- doc/pages/compiler-at-keywords.cpp | 2 +- doc/pages/compiler-expression-by-type.cpp | 2 +- doc/pages/compiler-expression-page.cpp | 2 +- doc/pages/compiler-page.cpp | 2 +- doc/pages/compiler-selectors-rules.cpp | 2 +- doc/pages/lexer-page.cpp | 4 ++-- doc/pages/main.cpp | 2 +- doc/pages/parser-page.cpp | 2 +- include/CMakeLists.txt | 2 +- include/csspp/assembler.h | 2 +- include/csspp/color.h | 2 +- include/csspp/compiler.h | 2 +- include/csspp/csspp.h.in | 2 +- include/csspp/error.h | 2 +- include/csspp/exceptions.h | 2 +- include/csspp/expression.h | 2 +- include/csspp/lexer.h | 2 +- include/csspp/node.h | 2 +- include/csspp/nth_child.h | 2 +- include/csspp/parser.h | 2 +- include/csspp/position.h | 2 +- include/csspp/unicode_range.h | 2 +- lib/CMakeLists.txt | 2 +- lib/CSSPPConfig.cmake.in | 2 +- lib/CSSPPConfigVersion.cmake.in | 2 +- lib/assembler.cpp | 2 +- lib/color.cpp | 2 +- lib/compiler.cpp | 2 +- lib/csspp.cpp | 2 +- lib/error.cpp | 2 +- lib/expr_additive.cpp | 2 +- lib/expr_conditional.cpp | 2 +- lib/expr_equality.cpp | 2 +- lib/expr_list.cpp | 2 +- lib/expr_logical_and.cpp | 2 +- lib/expr_logical_or.cpp | 2 +- lib/expr_multiplicative.cpp | 2 +- lib/expr_power.cpp | 2 +- lib/expr_relational.cpp | 2 +- lib/expr_unary.cpp | 2 +- lib/expression.cpp | 2 +- lib/internal_functions.cpp | 2 +- lib/lexer.cpp | 2 +- lib/node.cpp | 2 +- lib/nth_child.cpp | 2 +- lib/parser.cpp | 2 +- lib/position.cpp | 2 +- lib/unicode_range.cpp | 2 +- scripts/CMakeLists.txt | 2 +- scripts/system/close.scss | 2 +- scripts/system/constants.scss | 2 +- scripts/system/functions.scss | 2 +- scripts/system/init.scss | 2 +- scripts/system/logo.scss | 2 +- scripts/system/selectors.scss | 2 +- scripts/system/version.scss.in | 2 +- scripts/validation/countries.scss | 2 +- scripts/validation/has-font-metrics.scss | 2 +- scripts/validation/languages.scss | 2 +- scripts/validation/pseudo-classes.scss | 2 +- scripts/validation/pseudo-elements.scss | 2 +- scripts/validation/pseudo-functions.scss | 2 +- scripts/validation/pseudo-nth-functions.scss | 2 +- scripts/validation/slash-separator.scss | 2 +- src/CMakeLists.txt | 2 +- src/csspp.cpp | 2 +- tests/CMakeLists.txt | 2 +- tests/catch_assembler.cpp | 22 ++++++++++---------- tests/catch_color.cpp | 2 +- tests/catch_compiler.cpp | 2 +- tests/catch_csspp.cpp | 2 +- tests/catch_error.cpp | 2 +- tests/catch_expr_additive.cpp | 2 +- tests/catch_expr_conditional.cpp | 2 +- tests/catch_expr_equality.cpp | 2 +- tests/catch_expr_list.cpp | 2 +- tests/catch_expr_logical_and.cpp | 2 +- tests/catch_expr_logical_or.cpp | 2 +- tests/catch_expr_multiplicative.cpp | 2 +- tests/catch_expr_power.cpp | 2 +- tests/catch_expr_relational.cpp | 2 +- tests/catch_expr_unary.cpp | 2 +- tests/catch_internal_functions.cpp | 2 +- tests/catch_lexer.cpp | 2 +- tests/catch_node.cpp | 2 +- tests/catch_nth_child.cpp | 2 +- tests/catch_parser.cpp | 6 +++--- tests/catch_position.cpp | 2 +- tests/catch_tests.cpp | 2 +- tests/catch_tests.h | 2 +- tests/catch_unicode_range.cpp | 2 +- 99 files changed, 118 insertions(+), 111 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cf10526..e0b3112 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/debian/changelog b/debian/changelog index 0c9925f..86c33aa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +csspp (1.0.27.3~xenial) xenial; urgency=high + + * Bump version for a rebuild for newer cppthread. + * Updated the copyright notices. + + -- Alexis Wilke Mon, 15 Mar 2021 23:08:31 -0700 + csspp (1.0.27.2~xenial) xenial; urgency=high * Bump version for a rebuild for newer cppthread. diff --git a/dev/MasterCMakeLists.txt b/dev/MasterCMakeLists.txt index 3f1a8a4..1064931 100644 --- a/dev/MasterCMakeLists.txt +++ b/dev/MasterCMakeLists.txt @@ -11,7 +11,7 @@ # See the CMake documentation. # # License: -# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/dev/build-release b/dev/build-release index fd51220..1177ff1 100755 --- a/dev/build-release +++ b/dev/build-release @@ -12,7 +12,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/dev/coverage b/dev/coverage index 9cac22a..25ea5a3 100755 --- a/dev/coverage +++ b/dev/coverage @@ -11,7 +11,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/dev/pack b/dev/pack index 5395f6b..d3a94c1 100755 --- a/dev/pack +++ b/dev/pack @@ -14,7 +14,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/dev/version b/dev/version index 0500df3..19e2afd 100755 --- a/dev/version +++ b/dev/version @@ -11,7 +11,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index a20f79c..bdcafc8 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -10,7 +10,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/doc/pages/compiler-at-keywords.cpp b/doc/pages/compiler-at-keywords.cpp index 87e83b3..c919702 100644 --- a/doc/pages/compiler-at-keywords.cpp +++ b/doc/pages/compiler-at-keywords.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/compiler-expression-by-type.cpp b/doc/pages/compiler-expression-by-type.cpp index ecbb045..aa899e1 100644 --- a/doc/pages/compiler-expression-by-type.cpp +++ b/doc/pages/compiler-expression-by-type.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/compiler-expression-page.cpp b/doc/pages/compiler-expression-page.cpp index a7e41c2..0350082 100644 --- a/doc/pages/compiler-expression-page.cpp +++ b/doc/pages/compiler-expression-page.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/compiler-page.cpp b/doc/pages/compiler-page.cpp index 20dcd46..5f77d4f 100644 --- a/doc/pages/compiler-page.cpp +++ b/doc/pages/compiler-page.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/compiler-selectors-rules.cpp b/doc/pages/compiler-selectors-rules.cpp index a1f4146..1992ef6 100644 --- a/doc/pages/compiler-selectors-rules.cpp +++ b/doc/pages/compiler-selectors-rules.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/lexer-page.cpp b/doc/pages/lexer-page.cpp index bd1afb4..128d143 100644 --- a/doc/pages/lexer-page.cpp +++ b/doc/pages/lexer-page.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -298,7 +298,7 @@ * * \code * // CSS Preprocessor - * // Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved + * // Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved * // * // @preserve * \endcode diff --git a/doc/pages/main.cpp b/doc/pages/main.cpp index f85d4d2..416aeb9 100644 --- a/doc/pages/main.cpp +++ b/doc/pages/main.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/parser-page.cpp b/doc/pages/parser-page.cpp index 5ee8303..42a2d3c 100644 --- a/doc/pages/parser-page.cpp +++ b/doc/pages/parser-page.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 972f390..129a257 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -9,7 +9,7 @@ # See the CMake documentation. # # License: -# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/include/csspp/assembler.h b/include/csspp/assembler.h index 0294a89..0d1cbb1 100644 --- a/include/csspp/assembler.h +++ b/include/csspp/assembler.h @@ -1,7 +1,7 @@ #ifndef CSSPP_ASSEMBLER_H #define CSSPP_ASSEMBLER_H // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/include/csspp/color.h b/include/csspp/color.h index 5e1d37a..ced78cc 100644 --- a/include/csspp/color.h +++ b/include/csspp/color.h @@ -1,7 +1,7 @@ #ifndef CSSPP_COLOR_H #define CSSPP_COLOR_H // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/include/csspp/compiler.h b/include/csspp/compiler.h index b49676c..797a87d 100644 --- a/include/csspp/compiler.h +++ b/include/csspp/compiler.h @@ -1,7 +1,7 @@ #ifndef CSSPP_COMPILER_H #define CSSPP_COMPILER_H // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/include/csspp/csspp.h.in b/include/csspp/csspp.h.in index 7638b22..53b4519 100644 --- a/include/csspp/csspp.h.in +++ b/include/csspp/csspp.h.in @@ -1,7 +1,7 @@ #ifndef CSSPP_CSSPP_H #define CSSPP_CSSPP_H // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/include/csspp/error.h b/include/csspp/error.h index a0fa556..3d781e6 100644 --- a/include/csspp/error.h +++ b/include/csspp/error.h @@ -1,7 +1,7 @@ #ifndef CSSPP_ERROR_H #define CSSPP_ERROR_H // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/include/csspp/exceptions.h b/include/csspp/exceptions.h index 09f2656..98b4edd 100644 --- a/include/csspp/exceptions.h +++ b/include/csspp/exceptions.h @@ -1,7 +1,7 @@ #ifndef CSSPP_EXCEPTIONS_H #define CSSPP_EXCEPTIONS_H // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/include/csspp/expression.h b/include/csspp/expression.h index ea9f7fb..0ab53bd 100644 --- a/include/csspp/expression.h +++ b/include/csspp/expression.h @@ -1,7 +1,7 @@ #ifndef CSSPP_EXPRESSION_H #define CSSPP_EXPRESSION_H // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/include/csspp/lexer.h b/include/csspp/lexer.h index dfd8b9e..fd31a24 100644 --- a/include/csspp/lexer.h +++ b/include/csspp/lexer.h @@ -1,7 +1,7 @@ #ifndef CSSPP_LEXER_H #define CSSPP_LEXER_H // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/include/csspp/node.h b/include/csspp/node.h index a12d85d..7fd5846 100644 --- a/include/csspp/node.h +++ b/include/csspp/node.h @@ -1,7 +1,7 @@ #ifndef CSSPP_NODE_H #define CSSPP_NODE_H // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/include/csspp/nth_child.h b/include/csspp/nth_child.h index 1f54326..a3fb951 100644 --- a/include/csspp/nth_child.h +++ b/include/csspp/nth_child.h @@ -1,7 +1,7 @@ #ifndef CSSPP_NTH_CHILD_H #define CSSPP_NTH_CHILD_H // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/include/csspp/parser.h b/include/csspp/parser.h index 9a058ba..c69c8b4 100644 --- a/include/csspp/parser.h +++ b/include/csspp/parser.h @@ -1,7 +1,7 @@ #ifndef CSSPP_PARSER_H #define CSSPP_PARSER_H // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/include/csspp/position.h b/include/csspp/position.h index e4096b2..1159575 100644 --- a/include/csspp/position.h +++ b/include/csspp/position.h @@ -1,7 +1,7 @@ #ifndef CSSPP_POSITION_H #define CSSPP_POSITION_H // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/include/csspp/unicode_range.h b/include/csspp/unicode_range.h index 25b5ba4..d9f6c65 100644 --- a/include/csspp/unicode_range.h +++ b/include/csspp/unicode_range.h @@ -1,7 +1,7 @@ #ifndef CSSPP_UNICODE_RANGE_H #define CSSPP_UNICODE_RANGE_H // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 2c3e75f..8102710 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -9,7 +9,7 @@ # See the CMake documentation. # # License: -# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/lib/CSSPPConfig.cmake.in b/lib/CSSPPConfig.cmake.in index 4a1b7ef..814355f 100644 --- a/lib/CSSPPConfig.cmake.in +++ b/lib/CSSPPConfig.cmake.in @@ -8,7 +8,7 @@ # CSSPP_DEFINITIONS - Compiler switches required for linking against csspp # # License: -# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/lib/CSSPPConfigVersion.cmake.in b/lib/CSSPPConfigVersion.cmake.in index e5ff346..07c253b 100644 --- a/lib/CSSPPConfigVersion.cmake.in +++ b/lib/CSSPPConfigVersion.cmake.in @@ -1,7 +1,7 @@ # Verify CSS Preprocessor version validity. # # License: -# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/lib/assembler.cpp b/lib/assembler.cpp index de8a03a..adf1cda 100644 --- a/lib/assembler.cpp +++ b/lib/assembler.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/color.cpp b/lib/color.cpp index 10ebe4a..6313243 100644 --- a/lib/color.cpp +++ b/lib/color.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/compiler.cpp b/lib/compiler.cpp index 059e0d2..3ee0fb2 100644 --- a/lib/compiler.cpp +++ b/lib/compiler.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/csspp.cpp b/lib/csspp.cpp index 626874d..0f08b01 100644 --- a/lib/csspp.cpp +++ b/lib/csspp.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/error.cpp b/lib/error.cpp index dbc7609..6925c84 100644 --- a/lib/error.cpp +++ b/lib/error.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/expr_additive.cpp b/lib/expr_additive.cpp index 4d45770..4a61b8e 100644 --- a/lib/expr_additive.cpp +++ b/lib/expr_additive.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/expr_conditional.cpp b/lib/expr_conditional.cpp index b6c11ba..0601348 100644 --- a/lib/expr_conditional.cpp +++ b/lib/expr_conditional.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/expr_equality.cpp b/lib/expr_equality.cpp index b422588..0e4b27a 100644 --- a/lib/expr_equality.cpp +++ b/lib/expr_equality.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/expr_list.cpp b/lib/expr_list.cpp index 0091668..760444b 100644 --- a/lib/expr_list.cpp +++ b/lib/expr_list.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/expr_logical_and.cpp b/lib/expr_logical_and.cpp index 26a30c5..cd461f0 100644 --- a/lib/expr_logical_and.cpp +++ b/lib/expr_logical_and.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/expr_logical_or.cpp b/lib/expr_logical_or.cpp index 29938d6..6c32091 100644 --- a/lib/expr_logical_or.cpp +++ b/lib/expr_logical_or.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/expr_multiplicative.cpp b/lib/expr_multiplicative.cpp index 0a0674c..2dfa742 100644 --- a/lib/expr_multiplicative.cpp +++ b/lib/expr_multiplicative.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/expr_power.cpp b/lib/expr_power.cpp index d02a377..0be7aa8 100644 --- a/lib/expr_power.cpp +++ b/lib/expr_power.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/expr_relational.cpp b/lib/expr_relational.cpp index 3275704..5e9895b 100644 --- a/lib/expr_relational.cpp +++ b/lib/expr_relational.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/expr_unary.cpp b/lib/expr_unary.cpp index 4458b89..2f6848d 100644 --- a/lib/expr_unary.cpp +++ b/lib/expr_unary.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/expression.cpp b/lib/expression.cpp index 68baf81..63b61b5 100644 --- a/lib/expression.cpp +++ b/lib/expression.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/internal_functions.cpp b/lib/internal_functions.cpp index e5f804d..ad57e7c 100644 --- a/lib/internal_functions.cpp +++ b/lib/internal_functions.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/lexer.cpp b/lib/lexer.cpp index 9786e9e..603279e 100644 --- a/lib/lexer.cpp +++ b/lib/lexer.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/node.cpp b/lib/node.cpp index 7d9d224..411e9ef 100644 --- a/lib/node.cpp +++ b/lib/node.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/nth_child.cpp b/lib/nth_child.cpp index 7090f8b..d191839 100644 --- a/lib/nth_child.cpp +++ b/lib/nth_child.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/parser.cpp b/lib/parser.cpp index 3ae7c88..21d9837 100644 --- a/lib/parser.cpp +++ b/lib/parser.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/position.cpp b/lib/position.cpp index 593fa9b..45b77c4 100644 --- a/lib/position.cpp +++ b/lib/position.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/lib/unicode_range.cpp b/lib/unicode_range.cpp index 0861179..18f4b91 100644 --- a/lib/unicode_range.cpp +++ b/lib/unicode_range.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 4492e34..4d918e9 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -10,7 +10,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/scripts/system/close.scss b/scripts/system/close.scss index 0b801df..fcf5a01 100644 --- a/scripts/system/close.scss +++ b/scripts/system/close.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/constants.scss b/scripts/system/constants.scss index 0bfe6e6..55f48ab 100644 --- a/scripts/system/constants.scss +++ b/scripts/system/constants.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/functions.scss b/scripts/system/functions.scss index 5904dc2..93b41b2 100644 --- a/scripts/system/functions.scss +++ b/scripts/system/functions.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/init.scss b/scripts/system/init.scss index 951c348..a13771f 100644 --- a/scripts/system/init.scss +++ b/scripts/system/init.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/logo.scss b/scripts/system/logo.scss index aa9346c..804b9bb 100644 --- a/scripts/system/logo.scss +++ b/scripts/system/logo.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/selectors.scss b/scripts/system/selectors.scss index f55c784..45a447a 100644 --- a/scripts/system/selectors.scss +++ b/scripts/system/selectors.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/version.scss.in b/scripts/system/version.scss.in index 3bcef7a..dcd1f91 100644 --- a/scripts/system/version.scss.in +++ b/scripts/system/version.scss.in @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/countries.scss b/scripts/validation/countries.scss index 0bc35e4..5cb4713 100644 --- a/scripts/validation/countries.scss +++ b/scripts/validation/countries.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/has-font-metrics.scss b/scripts/validation/has-font-metrics.scss index 9b7134f..cdbd4d7 100644 --- a/scripts/validation/has-font-metrics.scss +++ b/scripts/validation/has-font-metrics.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/languages.scss b/scripts/validation/languages.scss index 11b15a9..1cd3918 100644 --- a/scripts/validation/languages.scss +++ b/scripts/validation/languages.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/pseudo-classes.scss b/scripts/validation/pseudo-classes.scss index 99209be..69811a7 100644 --- a/scripts/validation/pseudo-classes.scss +++ b/scripts/validation/pseudo-classes.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/pseudo-elements.scss b/scripts/validation/pseudo-elements.scss index bc90a86..52b2ff2 100644 --- a/scripts/validation/pseudo-elements.scss +++ b/scripts/validation/pseudo-elements.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/pseudo-functions.scss b/scripts/validation/pseudo-functions.scss index ce88aed..eefcb12 100644 --- a/scripts/validation/pseudo-functions.scss +++ b/scripts/validation/pseudo-functions.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/pseudo-nth-functions.scss b/scripts/validation/pseudo-nth-functions.scss index 6d9275d..32db331 100644 --- a/scripts/validation/pseudo-nth-functions.scss +++ b/scripts/validation/pseudo-nth-functions.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/slash-separator.scss b/scripts/validation/slash-separator.scss index 13127b5..9b83395 100644 --- a/scripts/validation/slash-separator.scss +++ b/scripts/validation/slash-separator.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5b0d168..a1ba9c8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,7 +10,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/src/csspp.cpp b/src/csspp.cpp index 03369d5..69162b9 100644 --- a/src/csspp.cpp +++ b/src/csspp.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f67dc79..7cc05aa 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -10,7 +10,7 @@ # # License: # CSS Preprocessor -- Test Suite -# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/tests/catch_assembler.cpp b/tests/catch_assembler.cpp index b36e75c..3997a95 100644 --- a/tests/catch_assembler.cpp +++ b/tests/catch_assembler.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -2431,7 +2431,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") ++i) { std::stringstream ss; - ss << "// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version {$_csspp_version} -- @preserve\n" + ss << "// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version {$_csspp_version} -- @preserve\n" << "body.error { color: red }\n"; csspp::position pos("test.css"); csspp::lexer::pointer_t l(new csspp::lexer(ss, pos)); @@ -2462,7 +2462,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") { case csspp::output_mode_t::COMPACT: REQUIRE(out.str() == -"/* Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error { color: red }\n" + csspp_test::get_close_comment() ); @@ -2470,7 +2470,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::COMPRESSED: REQUIRE(out.str() == -"/* Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error{color:red}\n" + csspp_test::get_close_comment() ); @@ -2478,7 +2478,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::EXPANDED: REQUIRE(out.str() == -"/* Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error\n" "{\n" " color: red;\n" @@ -2489,7 +2489,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::TIDY: REQUIRE(out.str() == -"/* Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version" CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version" CSSPP_VERSION " -- @preserve */\n" "body.error{color:red}\n" + csspp_test::get_close_comment() ); @@ -2506,7 +2506,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") ++i) { std::stringstream ss; - ss << "// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved.\n" + ss << "// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved.\n" << "// Assembler Test\n" << "// @preserve\n" << "body.error { color: red }\n"; @@ -2539,7 +2539,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") { case csspp::output_mode_t::COMPACT: REQUIRE(out.str() == -"/* Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved.\n" +"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" " */\n" @@ -2550,7 +2550,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::COMPRESSED: REQUIRE(out.str() == -"/* Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved.\n" +"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" " */\n" @@ -2561,7 +2561,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::EXPANDED: REQUIRE(out.str() == -"/* Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved.\n" +"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" " */\n" @@ -2575,7 +2575,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::TIDY: REQUIRE(out.str() == -"/* Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved.\n" +"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" " */\n" diff --git a/tests/catch_color.cpp b/tests/catch_color.cpp index cc1ae28..40e97cf 100644 --- a/tests/catch_color.cpp +++ b/tests/catch_color.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_compiler.cpp b/tests/catch_compiler.cpp index f45f142..3430d07 100644 --- a/tests/catch_compiler.cpp +++ b/tests/catch_compiler.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_csspp.cpp b/tests/catch_csspp.cpp index 7751ca0..e22e563 100644 --- a/tests/catch_csspp.cpp +++ b/tests/catch_csspp.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_error.cpp b/tests/catch_error.cpp index 6ac75c5..1e2682e 100644 --- a/tests/catch_error.cpp +++ b/tests/catch_error.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_expr_additive.cpp b/tests/catch_expr_additive.cpp index ad3a4cc..9550959 100644 --- a/tests/catch_expr_additive.cpp +++ b/tests/catch_expr_additive.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_expr_conditional.cpp b/tests/catch_expr_conditional.cpp index 7726403..eab6147 100644 --- a/tests/catch_expr_conditional.cpp +++ b/tests/catch_expr_conditional.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_expr_equality.cpp b/tests/catch_expr_equality.cpp index bbb6ed5..1f6a352 100644 --- a/tests/catch_expr_equality.cpp +++ b/tests/catch_expr_equality.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_expr_list.cpp b/tests/catch_expr_list.cpp index 559aceb..8fd5a47 100644 --- a/tests/catch_expr_list.cpp +++ b/tests/catch_expr_list.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_expr_logical_and.cpp b/tests/catch_expr_logical_and.cpp index cd78cae..c9616cb 100644 --- a/tests/catch_expr_logical_and.cpp +++ b/tests/catch_expr_logical_and.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_expr_logical_or.cpp b/tests/catch_expr_logical_or.cpp index 0f59136..e96e565 100644 --- a/tests/catch_expr_logical_or.cpp +++ b/tests/catch_expr_logical_or.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_expr_multiplicative.cpp b/tests/catch_expr_multiplicative.cpp index dd02b87..a452894 100644 --- a/tests/catch_expr_multiplicative.cpp +++ b/tests/catch_expr_multiplicative.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_expr_power.cpp b/tests/catch_expr_power.cpp index e0485f0..e1bf948 100644 --- a/tests/catch_expr_power.cpp +++ b/tests/catch_expr_power.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_expr_relational.cpp b/tests/catch_expr_relational.cpp index dfd35fa..9f7b02b 100644 --- a/tests/catch_expr_relational.cpp +++ b/tests/catch_expr_relational.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_expr_unary.cpp b/tests/catch_expr_unary.cpp index b0b300a..fc4460b 100644 --- a/tests/catch_expr_unary.cpp +++ b/tests/catch_expr_unary.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_internal_functions.cpp b/tests/catch_internal_functions.cpp index e66db9e..e9f5d02 100644 --- a/tests/catch_internal_functions.cpp +++ b/tests/catch_internal_functions.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_lexer.cpp b/tests/catch_lexer.cpp index 6db8108..e938f7b 100644 --- a/tests/catch_lexer.cpp +++ b/tests/catch_lexer.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_node.cpp b/tests/catch_node.cpp index 0c6b8b1..4825b92 100644 --- a/tests/catch_node.cpp +++ b/tests/catch_node.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_nth_child.cpp b/tests/catch_nth_child.cpp index c814c18..b374bf3 100644 --- a/tests/catch_nth_child.cpp +++ b/tests/catch_nth_child.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_parser.cpp b/tests/catch_parser.cpp index d9cda2d..fc0e51e 100644 --- a/tests/catch_parser.cpp +++ b/tests/catch_parser.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -200,7 +200,7 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") std::stringstream ss; ss << "// $Id: ...$\n" << "div { border: 1px; }\n" - << "/* @preserve Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved. */"; + << "/* @preserve Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. */"; csspp::position pos("test.css"); csspp::lexer::pointer_t l(new csspp::lexer(ss, pos)); @@ -223,7 +223,7 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") " COLON\n" " WHITESPACE\n" " INTEGER \"px\" I:1\n" -" COMMENT \"@preserve Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved.\" I:1\n" +" COMMENT \"@preserve Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved.\" I:1\n" ); diff --git a/tests/catch_position.cpp b/tests/catch_position.cpp index 74a483e..14d8729 100644 --- a/tests/catch_position.cpp +++ b/tests/catch_position.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_tests.cpp b/tests/catch_tests.cpp index 4248987..185ddea 100644 --- a/tests/catch_tests.cpp +++ b/tests/catch_tests.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_tests.h b/tests/catch_tests.h index db47145..867c18a 100644 --- a/tests/catch_tests.h +++ b/tests/catch_tests.h @@ -1,7 +1,7 @@ #ifndef CSSPP_TESTS_H #define CSSPP_TESTS_H // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_unicode_range.cpp b/tests/catch_unicode_range.cpp index 38243f8..ae0c8fe 100644 --- a/tests/catch_unicode_range.cpp +++ b/tests/catch_unicode_range.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by From 701133ae74eb3f2cd937dde7f23b71817c474306 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Thu, 29 Apr 2021 18:07:00 -0700 Subject: [PATCH 05/64] Removed the DOT_FONTNAME value. --- doc/csspp.doxy.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/csspp.doxy.in b/doc/csspp.doxy.in index b1d3904..7ad4a6c 100644 --- a/doc/csspp.doxy.in +++ b/doc/csspp.doxy.in @@ -2178,7 +2178,7 @@ DOT_NUM_THREADS = 0 # The default value is: Helvetica. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTNAME = FreeSans +DOT_FONTNAME = # The DOT_FONTSIZE tag can be used to set the size (in points) of the font of # dot graphs. From eac5e1321e3e0e707ed30d5d1ce8ceb6b176597a Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Mon, 10 May 2021 17:12:47 -0700 Subject: [PATCH 06/64] Updated the dev/pack script. We have many dependencies now. --- INSTALL.txt | 24 +++------ README.md | 4 +- debian/changelog | 6 +++ dev/INSTALL | 20 -------- dev/INSTALL.md | 44 ++++++++++++++++ dev/MasterCMakeLists.txt | 60 ++++++++++++++++++---- dev/pack | 106 ++++++++++++++++++++++++++++++++------- 7 files changed, 197 insertions(+), 67 deletions(-) delete mode 100644 dev/INSTALL create mode 100644 dev/INSTALL.md diff --git a/INSTALL.txt b/INSTALL.txt index 69a51d8..b7009e3 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -1,21 +1,9 @@ -To build csspp, use cmake: +With the current setup, compiling csspp should be done from within the +snapcpp environment or using the standalone tarball (see dev/INSTALL.md +for details about that other option). - tar xf csspp.tar.gz - mkdir BUILD - cd BUILD - cmake ../csspp - make - make install - -The csspp directory is likely to include a version by default. Change the -references in that script as required. - -The creation of the documentation requires doxygen: - - sudo apt-get install doxygen - -The creation of the tests require catch.hpp, under Ubuntu: - - sudo apt-get install catch +The csspp project is also available pre-compiled on launchpad, which is +probably you best/easiest option if you have Ubuntu or some other Debian +flavor system. diff --git a/README.md b/README.md index 712efe9..c6e0ef1 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,8 @@ generated. # Compile the library and `csspp` command line tool -The INSTALL in the root directory tells you how to generate the -distribution directory (or dev/INSTALL in the `csspp` project itself.) +The `INSTALL.md` in the root directory tells you how to generate the +distribution directory (or `dev/INSTALL.md` in the standalone `csspp` project). We will be looking at making this simpler with time... for now, the environment is a bit convoluted. diff --git a/debian/changelog b/debian/changelog index 86c33aa..58f11d9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +csspp (1.0.27.4~xenial) xenial; urgency=high + + * Updated the dev/pack script. We have many dependencies now. + + -- Alexis Wilke Mon, 10 May 2021 17:12:42 -0700 + csspp (1.0.27.3~xenial) xenial; urgency=high * Bump version for a rebuild for newer cppthread. diff --git a/dev/INSTALL b/dev/INSTALL deleted file mode 100644 index b44af2b..0000000 --- a/dev/INSTALL +++ /dev/null @@ -1,20 +0,0 @@ - -Note: at this point we only support Linux although everything compiles as - is under cygwin. The library is likely to compile and work under - other OSes though, especially Unices. - -To generate csspp from its tarball, you need cmake and a C++ compiler, -then run the following commands: - - mkdir BUILD - cd BUILD - cmake .. - make - -The results will be under the "dist" directory. However, that is "installed" -meaning that it won't know how to find shared libraries (works under cygwin -since the DLL appears along the EXE). You may, however, immediately test the -binary "csspp/src/csspp". - -The dist directory is otherwise ready to be installed under /usr. - diff --git a/dev/INSTALL.md b/dev/INSTALL.md new file mode 100644 index 0000000..6347946 --- /dev/null +++ b/dev/INSTALL.md @@ -0,0 +1,44 @@ + +**Note:** at this point we only support Linux. + +This installation documentation applies to the _packed_ version (a.k.a. a +standalong tarball). See also the `dev/pack` script and `MasterCMakeLists.txt` +file. + +To generate csspp from its tarball, you need cmake and a C++ compiler +and a few other dependencies. We suggest to run the following commands: + + tar xf csspp-all_1.0.27.3~xenial.tar.gz + sudo csspp/ubuntu-depdendencies.sh + mkdir BUILD + cd BUILD + cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_PREFIX_PATH=../csspp/cmake/Modules/ \ + ../csspp + make + +The `ubuntu-depdendencies.sh` script will install all the necessary +dependencies. + +The `CMAKE_BUILD_TYPE` can be set to `Release` as well. + +The cmake command can also use a number of processors to run the make in +parallel: + + ... -DMAKEFLAGS=-j`nproc` ... + +(Keep in mind that parallel compilation uses a lot of memory so you may want +to limit that number if you're low on RAM.) + +The results will be under the "dist" directory. However, that is "installed" +meaning that it won't know how to find shared libraries (it would works under +cygwin since the DLL appears along the EXE, but I don't think it still compiles +on Win32). You may, however, immediately test the binary without installing +to a final destination with: + + BUILD/csspp/src/csspp --help + +The dist directory is otherwise ready to be installed under `/usr`. Many files +are not really required, but that's up to you to decide how to handle that +part. + diff --git a/dev/MasterCMakeLists.txt b/dev/MasterCMakeLists.txt index 1064931..5fe78cf 100644 --- a/dev/MasterCMakeLists.txt +++ b/dev/MasterCMakeLists.txt @@ -55,18 +55,60 @@ find_package( SnapBuild REQUIRED ) ################################################################################ # Snap libraries # -ConfigureMakeProject( PROJECT_NAME cmake ) +ConfigureMakeProject( + PROJECT_NAME + advgetopt + COMPONENT + contrib +) + +ConfigureMakeProject( + PROJECT_NAME + cmake + COMPONENT + contrib +) + +ConfigureMakeProject( + PROJECT_NAME + cppthread + COMPONENT + contrib +) + +ConfigureMakeProject( + PROJECT_NAME + csspp + COMPONENT + contrib +) + +ConfigureMakeProject( + PROJECT_NAME + libexcept + COMPONENT + contrib +) + +ConfigureMakeProject( + PROJECT_NAME + libutf8 + COMPONENT + contrib +) -ConfigureMakeProject( PROJECT_NAME advgetopt - CONFIG_ARGS - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - DEPENDS cmake +ConfigureMakeProject( + PROJECT_NAME + snapcatch2 + COMPONENT + contrib ) -ConfigureMakeProject( PROJECT_NAME csspp - CONFIG_ARGS - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - DEPENDS cmake advgetopt +ConfigureMakeProject( + PROJECT_NAME + snapdev + COMPONENT + contrib ) get_property( BUILD_TARGETS GLOBAL PROPERTY BUILD_TARGETS ) diff --git a/dev/pack b/dev/pack index d3a94c1..7593b91 100755 --- a/dev/pack +++ b/dev/pack @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e # # File: # dev/pack @@ -38,19 +38,32 @@ set -e SOURCE_REPO=../../../sources-repo +echo "-- verify clean source availability" if ! test -d $SOURCE_REPO then + echo "ERROR:" echo "To use this script, we expect you to have a directory named" echo "sources-repo, which is a pristine copy of the git repository." echo "Create that directory like any other git repository and place" - echo "it in the parent of the csspp directory. The script will update" - echo "the files on each run." + echo "it in the parent of the snapcpp directory. The script will" + echo "automatically update the files on each run." + echo + echo " cd ../../.." + echo " git clone --recursive https://github.com/m2osw/snapcpp.git sources-repo" + exit 1 +fi + +echo "-- verify version" +if ! test -x dev/version +then + echo "ERROR:" + echo "Are you in the top directory of the project?" exit 1 fi # Get both versions . dev/version -DEBIAN_VERSION=`dpkg-parsechangelog --show-field Version | sed -e s/~.*// -e s/\.0$//` +DEBIAN_VERSION=`dpkg-parsechangelog --show-field Version | sed -e s/~.*// -e 's/\(^[0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/'` if test "$FULL_VERSION" != "$DEBIAN_VERSION" then @@ -59,25 +72,82 @@ then exit 1; fi +echo "-- prepare package directory" cd $SOURCE_REPO -mkdir -p ../packages -git pull origin master -rm -f snapcmakemodules_*.tar.gz advgetopt_*.tar.gz csspp_*.tar.gz -dpkg-source -b cmake -cp snapcmakemodules_*.tar.gz ../packages -cd contrib -dpkg-source -b advgetopt -dpkg-source -b csspp -cp advgetopt_*.tar.gz csspp_*.tar.gz ../../packages -cd ../.. +SOURCE_REPO=`pwd` +cd .. +rm -rf packages +mkdir packages +cd packages +PACKAGES_DIR=`pwd` +cd $SOURCE_REPO + +# this top folder probably doesn't need to be updated, but for cleanliness +# +echo "-- update top folder" +MAIN=`git branch --list main` +if test "${MAIN}" != "" +then + git pull origin main +else + git pull origin master +fi + +# For list of dependencies, see ../../../BUILD/clean-dependencies.svg + +DEPENDENCIES=" + advgetopt + cmake + cppthread + csspp + libexcept + libutf8 + snapcatch2 + snapdev + " + +for p in ${DEPENDENCIES} +do + ( + echo "-- process project \"${p}\"" + name=$p + if test "$p" = "cmake" + then + name=snapcmakemodules + else + cd contrib + fi + + # We use submodules now, make sure to update each one of them individually + ( + cd $p + MAIN=`git branch --list main` + if test "${MAIN}" != "" + then + git pull origin main + else + git pull origin master + fi + ) + + rm -f ${p}_*.tar.gz + echo "-- process project \"${p}\" [dpkg-source -b $name]" + dpkg-source -b $p + mv ${name}_*.tar.gz $PACKAGES_DIR + ) +done + +cd .. rm -rf tmp/csspp mkdir -p tmp/csspp cd tmp/csspp -tar xf ../../sources-repo/snapcmakemodules_*.tar.gz -tar xf ../../sources-repo/contrib/advgetopt_*.tar.gz -tar xf ../../sources-repo/contrib/csspp_*.tar.gz +for f in ../../packages/*.tar.gz +do + tar xf $f +done cp csspp/dev/MasterCMakeLists.txt CMakeLists.txt -cp csspp/dev/INSTALL INSTALL +cp csspp/dev/INSTALL.md . +cp csspp/dev/ubuntu-dependencies.sh . cd csspp VERSION=`dpkg-parsechangelog --show-field Version` cd ../.. From e8cfe07186bb71d80b631c8a562b35d892f184a7 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Mon, 10 May 2021 17:13:51 -0700 Subject: [PATCH 07/64] Missed adding the new script too. --- dev/ubuntu-dependencies.sh | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 dev/ubuntu-dependencies.sh diff --git a/dev/ubuntu-dependencies.sh b/dev/ubuntu-dependencies.sh new file mode 100755 index 0000000..a875ab3 --- /dev/null +++ b/dev/ubuntu-dependencies.sh @@ -0,0 +1,42 @@ +#!/bin/sh -e +# +# Install the dependencies required by that project + +apt-get install \ + cmake \ + dpkg-dev \ + g++ \ + libboost-all-dev \ + + + +#apt-get install \ +# catch \ +# dh-systemd \ +# freeglut3-dev \ +# gcc \ +# libhiredis-dev \ +# libicu-dev \ +# libmagic-dev \ +# libmagick++-dev \ +# libncurses-dev \ +# libprocps-dev \ +# libqrencode-dev \ +# libqt5script5 \ +# libqt5scripttools5 \ +# libqt5x11extras5-dev \ +# libqt5xmlpatterns5-dev \ +# libqt5webkit5-dev \ +# libreadline-dev \ +# libssl-dev \ +# libxml2-utils \ +# libyaml-cpp-dev \ +# mysql-server \ +# qt5-default \ +# qtscript5-dev \ +# uuid-dev \ +# zip \ +# zlib1g-dev + + +# vim: ts=4 sw=4 et From 073031cfdb3437cc9e4020cd2da28941cc897a18 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Thu, 13 May 2021 22:16:48 -0700 Subject: [PATCH 08/64] Fixed the color which would become int instead of uint. --- tests/catch_color.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/catch_color.cpp b/tests/catch_color.cpp index 40e97cf..44faa13 100644 --- a/tests/catch_color.cpp +++ b/tests/catch_color.cpp @@ -864,19 +864,19 @@ TEST_CASE("Color to string", "[color] [output]") static_cast(0xFF)); switch(c.get_color()) { - case (255 << 0) | (0 << 8) | (0 << 16) | (255 << 24): + case (255U << 0) | (0U << 8) | (0U << 16) | (255U << 24): REQUIRE(c.to_string() == "red"); break; - case (0 << 0) | (255 << 8) | (0 << 16) | (255 << 24): + case (0U << 0) | (255U << 8) | (0U << 16) | (255U << 24): REQUIRE(c.to_string() == "lime"); break; - case (0 << 0) | (0 << 8) | (255 << 16) | (255 << 24): + case (0U << 0) | (0U << 8) | (255U << 16) | (255U << 24): REQUIRE(c.to_string() == "blue"); break; - case (0 << 0) | (255 << 8) | (255 << 16) | (255 << 24): + case (0U << 0) | (255U << 8) | (255U << 16) | (255U << 24): REQUIRE(c.to_string() == "aqua"); break; From 3ab86137dea3ce6ba9ab994fa2e1ca4d42c814a3 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Fri, 14 May 2021 09:28:39 -0700 Subject: [PATCH 09/64] Moved the cmake files to the cmake folder. Updated the CMakeLists.txt accordingly. --- CMakeLists.txt | 5 +- cmake/CMakeLists.txt | 50 ++++++++++++++++++++ {lib => cmake}/CSSPPConfig.cmake.in | 12 +++-- {lib => cmake}/CSSPPConfigVersion.cmake.in | 0 lib/CMakeLists.txt | 54 ++++++---------------- 5 files changed, 76 insertions(+), 45 deletions(-) create mode 100644 cmake/CMakeLists.txt rename {lib => cmake}/CSSPPConfig.cmake.in (92%) rename {lib => cmake}/CSSPPConfigVersion.cmake.in (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index e0b3112..5120a86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,8 +75,9 @@ include_directories( ## add_subdirectory(include) # public headers add_subdirectory(lib) # csspp library -add_subdirectory(scripts) # command line tools -add_subdirectory(src) # command line tools +add_subdirectory(cmake) # cmake include files +add_subdirectory(scripts) # command line tools as scripts +add_subdirectory(src) # command line tools as binaries add_subdirectory(tests) # tests add_subdirectory(doc) # library API documentation diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt new file mode 100644 index 0000000..6cdeff8 --- /dev/null +++ b/cmake/CMakeLists.txt @@ -0,0 +1,50 @@ +# +# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +# +# https://snapwebsites.org/ +# contact@m2osw.com +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +project(csspp) + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/CSSPPConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/CSSPPConfig.cmake + @ONLY +) + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/CSSPPConfigVersion.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/CSSPPConfigVersion.cmake + @ONLY +) + +install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/CSSPPConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/CSSPPConfigVersion.cmake + + DESTINATION + share/cmake/CSSPP +) + +# Local Variables: +# indent-tabs-mode: nil +# tab-width: 4 +# End: + +# vim: ts=4 sw=4 et nocindent diff --git a/lib/CSSPPConfig.cmake.in b/cmake/CSSPPConfig.cmake.in similarity index 92% rename from lib/CSSPPConfig.cmake.in rename to cmake/CSSPPConfig.cmake.in index 814355f..8bb17a0 100644 --- a/lib/CSSPPConfig.cmake.in +++ b/cmake/CSSPPConfig.cmake.in @@ -1,4 +1,4 @@ -# - Try to find the CSS Preprocessor development files (libcsspp.so) +# Try to find the CSS Preprocessor development files # # Once done this will define # @@ -48,9 +48,15 @@ mark_as_advanced(CSSPP_INCLUDE_DIR CSSPP_LIBRARY) set(CSSPP_INCLUDE_DIRS ${CSSPP_INCLUDE_DIR}) set(CSSPP_LIBRARIES ${CSSPP_LIBRARY}) -include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set CSSPP_FOUND to TRUE # if all listed variables are TRUE -find_package_handle_standard_args(csspp DEFAULT_MSG CSSPP_INCLUDE_DIR CSSPP_LIBRARY) +# +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + CSSPP + DEFAULT_MSG + CSSPP_INCLUDE_DIR + CSSPP_LIBRARY +) # vim: ts=4 sw=4 et diff --git a/lib/CSSPPConfigVersion.cmake.in b/cmake/CSSPPConfigVersion.cmake.in similarity index 100% rename from lib/CSSPPConfigVersion.cmake.in rename to cmake/CSSPPConfigVersion.cmake.in diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 8102710..07f5fb2 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,43 +1,26 @@ # -# File: -# lib/CMakeLists.txt +# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved # -# Description: -# The csspp library. +# https://snapwebsites.org/ +# contact@m2osw.com # -# Documentation: -# See the CMake documentation. +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. # -# License: -# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# https://snapwebsites.org/ -# contact@m2osw.com -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # project(csspp) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CSSPPConfig.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/CSSPPConfig.cmake - @ONLY) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CSSPPConfigVersion.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/CSSPPConfigVersion.cmake - @ONLY) add_library( ${PROJECT_NAME} SHARED assembler.cpp # Write the nodes back out @@ -65,10 +48,6 @@ add_library( ${PROJECT_NAME} SHARED unicode_range.cpp # Handle a Unicode Range value ) -#target_link_libraries( ${PROJECT_NAME} -# ${LIBTLD_LIBRARIES} -#) - set_target_properties( ${PROJECT_NAME} PROPERTIES VERSION ${CSSPP_VERSION_MAJOR}.${CSSPP_VERSION_MINOR} SOVERSION ${CSSPP_VERSION_MAJOR} @@ -81,11 +60,6 @@ install( ARCHIVE DESTINATION lib ) -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/CSSPPConfig.cmake - ${CMAKE_CURRENT_BINARY_DIR}/CSSPPConfigVersion.cmake - DESTINATION share/cmake/CSSPP -) # Local Variables: # indent-tabs-mode: nil From 4c3284069fb1327a7565ce98b3338a074f5e7c83 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 15 May 2021 11:03:16 -0700 Subject: [PATCH 10/64] Adding an Hirsute version. --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 58f11d9..71a17b2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +csspp (1.0.28.0~xenial) xenial; urgency=high + + * Adding an Hirsute version. + * Fixed the library name in the CSSPPFind.cmake file. + + -- Alexis Wilke Sat, 15 May 2021 11:02:18 -0700 + csspp (1.0.27.4~xenial) xenial; urgency=high * Updated the dev/pack script. We have many dependencies now. From ebf8b62d73940293b9b3a226f34043a21725880f Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 29 May 2021 18:30:00 -0700 Subject: [PATCH 11/64] Bumped version to recompile. --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 71a17b2..680f740 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +csspp (1.0.28.1~xenial) xenial; urgency=high + + * Bump version to rebuild against latest. + + -- Alexis Wilke Sat, 29 May 2021 18:28:35 -0700 + csspp (1.0.28.0~xenial) xenial; urgency=high * Adding an Hirsute version. From 674874ce2e9a5d0d18b90838968f2c189f0bfbaa Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Fri, 4 Jun 2021 13:54:15 -0700 Subject: [PATCH 12/64] Updated the mk script. --- mk | 60 +++++++++++++++++++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/mk b/mk index baaa16e..bcc7038 100755 --- a/mk +++ b/mk @@ -1,33 +1,35 @@ #!/bin/sh -set -e -if test "$1" = "-d" +# +# See the snapcmakemodules project for details about this script +# https://github.com/m2osw/snapcmakemodules + +if test -x ../../cmake/scripts/mk then - . dev/version - rm -f ../../../BUILD/contrib/csspp/doc/csspp-doc-${VERSION}.tar.gz - make -C ../../../BUILD/contrib/csspp/ csspp_Documentation -elif test "$1" = "-t" -then - make -C ../../../BUILD/contrib/csspp/ - shift - TEST="$1" - if test -n "$TEST" - then - shift - echo run with \"$TEST\" - fi - ../../../BUILD/contrib/csspp/tests/csspp_tests --scripts scripts --version-script ../../../BUILD/contrib/csspp/scripts "$TEST" $* -elif test "$1" = "-i" -then - make -C ../../../BUILD/contrib/csspp install -elif test "$1" = "-c" -then - if test -z "$2" - then - echo "the -c option requires a second option with the name of the tag" - exit 1 - fi - make -C ../../../BUILD/contrib/csspp install - ../../../BUILD/contrib/csspp/tests/csspp_tests --scripts ../../../BUILD/dist/lib/csspp/scripts --show-errors "[$2]" 2>&1 | less + export TEST_OPTIONS="--scripts scripts --version-script ../../BUILD/Debug/contrib/csspp/scripts --show-errors" + ../../cmake/scripts/mk $* else - make -C ../../../BUILD/contrib/csspp + echo "error: could not locate the cmake mk script" + exit 1 fi + +#if test "$1" = "-t" +#then +# make -C ../../../BUILD/contrib/csspp/ +# shift +# TEST="$1" +# if test -n "$TEST" +# then +# shift +# echo run with \"$TEST\" +# fi +# ../../../BUILD/contrib/csspp/tests/csspp_tests --scripts scripts --version-script ../../../BUILD/contrib/csspp/scripts "$TEST" $* +#elif test "$1" = "-c" +#then +# if test -z "$2" +# then +# echo "the -c option requires a second option with the name of the tag" +# exit 1 +# fi +# make -C ../../../BUILD/contrib/csspp install +# ../../../BUILD/contrib/csspp/tests/csspp_tests --scripts ../../../BUILD/dist/lib/csspp/scripts --show-errors "[$2]" 2>&1 | less +#fi From ea659eb13a691c82ac2cb1015d415dfac1b20359 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Fri, 4 Jun 2021 21:07:24 -0700 Subject: [PATCH 13/64] Bumped build version to rebuild on Launchpad. --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 680f740..57d025c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +csspp (1.0.28.2~bionic) bionic; urgency=high + + * Bumped build version to rebuild on Launchpad. + + -- Alexis Wilke Fri, 04 Jun 2021 21:07:22 -0700 + csspp (1.0.28.1~xenial) xenial; urgency=high * Bump version to rebuild against latest. From 99deda2640d7eb887534e3d6e562b4f003c2e7cd Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Tue, 24 Aug 2021 16:59:23 -0700 Subject: [PATCH 14/64] Bumped build version to rebuild on Launchpad. --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 57d025c..09d6639 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +csspp (1.0.28.3~bionic) bionic; urgency=high + + * Bumped build version to rebuild on Launchpad. + + -- Alexis Wilke Tue, 24 Aug 2021 16:59:22 -0700 + csspp (1.0.28.2~bionic) bionic; urgency=high * Bumped build version to rebuild on Launchpad. From 3c2ce1cdae620985c1e2058e10d4e1e061f0790d Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sun, 29 Aug 2021 15:24:53 -0700 Subject: [PATCH 15/64] Bumped build version to rebuild on Launchpad. --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 09d6639..bfa955a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +csspp (1.0.28.4~bionic) bionic; urgency=high + + * Bumped build version to rebuild on Launchpad. + + -- Alexis Wilke Sun, 29 Aug 2021 15:24:51 -0700 + csspp (1.0.28.3~bionic) bionic; urgency=high * Bumped build version to rebuild on Launchpad. From 83c58ea8e9f61c086d0187d6ce9e8abf94629581 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Fri, 12 Nov 2021 18:16:16 -0800 Subject: [PATCH 16/64] Bumped cmake minimum required version. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5120a86..0835f53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ ## ## Initialization ## -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.10.2) project( csspp_project ) From 6d2e271db29c32bdaaf449538ede783ac326a968 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sun, 16 Jan 2022 06:27:38 -0800 Subject: [PATCH 17/64] Added a separate script to upload the website. Cleaned up some copyright notices. --- CMakeLists.txt | 40 ++++++++++++++-------------------------- TODO.txt | 4 ++++ cmake/CMakeLists.txt | 11 +++++------ dev/upload-website.sh | 41 +++++++++++++++++++++++++++++++++++++++++ doc/CMakeLists.txt | 40 ++++++++++++++-------------------------- include/CMakeLists.txt | 39 ++++++++++++++------------------------- scripts/CMakeLists.txt | 40 ++++++++++++++-------------------------- src/CMakeLists.txt | 40 ++++++++++++++-------------------------- src/csspp.cpp | 9 ++++----- tests/CMakeLists.txt | 40 ++++++++++++++-------------------------- 10 files changed, 138 insertions(+), 166 deletions(-) create mode 100755 dev/upload-website.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 0835f53..2aea8b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,33 +1,21 @@ +# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved # -# File: -# CMakeLists.txt +# https://snapwebsites.org/project/csspp +# contact@m2osw.com # -# Description: -# Definitions to create the build environment with cmake +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. # -# Documentation: -# See the CMake documentation. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# License: -# csspp -- a CSS Preprocessor -# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved -# -# https://snapwebsites.org/ -# contact@m2osw.com -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ## diff --git a/TODO.txt b/TODO.txt index 4245001..3f387fb 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,4 +1,8 @@ +. Move includes along the source and rename the src folder as csspp. +. Make sure the include_directories(...) in cmake files are correct. + + To be closer to what SASS supports, we shall implement the following additional features: diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 6cdeff8..aaac618 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1,7 +1,6 @@ +# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved # -# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved -# -# https://snapwebsites.org/ +# https://snapwebsites.org/project/csspp # contact@m2osw.com # # This program is free software; you can redistribute it and/or modify @@ -14,9 +13,9 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # project(csspp) diff --git a/dev/upload-website.sh b/dev/upload-website.sh new file mode 100755 index 0000000..deed579 --- /dev/null +++ b/dev/upload-website.sh @@ -0,0 +1,41 @@ +#!/bin/sh -e +# + +URL=csspp.org + +while test -n "$1" +do + case "$1" in + "--help"|"-h") + echo "Usage: $0 " + echo "where is:" + echo " --help | -h print out this help screen" + echo " --url change the default destination URL" + exit 1 + ;; + + "--url") + shift + URL="$1" + shift + ;; + + *) + echo "error: unknown option \"${1}\"." + exit 1 + ;; + + esac +done + +echo "info: uploading website (will fail unless you are me)." +echo "info: you must build once to get the index.html file." +echo + +# TODO: review how to handle this path, it won't work for everyone like this... +scp ../../BUILD/Debug/contrib/csspp/doc/front-page.html ${URL}:/var/www/csspp/public_html/index.html + +scp doc/favicon.ico ${URL}:/var/www/csspp/public_html/favicon.ico +scp doc/images/csspp-logo.png ${URL}:/var/www/csspp/public_html/images/csspp-logo.png +scp doc/images/open-source-initiative-logo.png ${URL}:/var/www/csspp/public_html/images/open-source-initiative-logo.png + diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index bdcafc8..33798c6 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,33 +1,21 @@ +# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved # -# File: -# doc/CMakeLists.txt +# https://snapwebsites.org/project/csspp +# contact@m2osw.com # -# Description: -# Definitions to create the build environment with cmake +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. # -# Documentation: -# See the CMake documentation. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# License: -# csspp -- a CSS Preprocessor -# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved -# -# https://snapwebsites.org/ -# contact@m2osw.com -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ## diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 129a257..bc231ac 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,32 +1,21 @@ +# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved # -# File: -# include/CMakeLists.txt +# https://snapwebsites.org/project/csspp +# contact@m2osw.com # -# Description: -# Definitions to create the build environment with cmake +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. # -# Documentation: -# See the CMake documentation. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# License: -# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved -# -# https://snapwebsites.org/ -# contact@m2osw.com -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # project(csspp_include) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 4d918e9..6705c2b 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -1,33 +1,21 @@ +# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved # -# File: -# scripts/CMakeLists.txt +# https://snapwebsites.org/project/csspp +# contact@m2osw.com # -# Description: -# Definitions to create the build environment with cmake +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. # -# Documentation: -# See the CMake documentation. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# License: -# csspp -- a CSS Preprocessor -# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved -# -# https://snapwebsites.org/ -# contact@m2osw.com -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # project(csspp_scripts) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a1ba9c8..e573f16 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,33 +1,21 @@ +# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved # -# File: -# src/CMakeLists.txt +# https://snapwebsites.org/project/csspp +# contact@m2osw.com # -# Description: -# Definitions to create the build environment with cmake +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. # -# Documentation: -# See the CMake documentation. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# License: -# csspp -- a CSS Preprocessor -# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved -# -# https://snapwebsites.org/ -# contact@m2osw.com -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # project(csspp-tool) diff --git a/src/csspp.cpp b/src/csspp.cpp index 69162b9..5cb3214 100644 --- a/src/csspp.cpp +++ b/src/csspp.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor command line tool. diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7cc05aa..6515475 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,33 +1,21 @@ +# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved # -# File: -# tests/CMakeLists.txt +# https://snapwebsites.org/project/csspp +# contact@m2osw.com # -# Description: -# Build csspp tests. +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. # -# Documentation: -# See the CMake documentation. +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. # -# License: -# CSS Preprocessor -- Test Suite -# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved -# -# https://snapwebsites.org/ -# contact@m2osw.com -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# You should have received a copy of the GNU Lesser General Public License along +# with this library; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # find_package( Catch ) From 8b1b6e2f6a38a8c2792bfedf6bce0a491c15f8e9 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sun, 16 Jan 2022 07:07:40 -0800 Subject: [PATCH 18/64] Moved headers along library code. Renamed the "lib" directory "csspp" so the #include work as expected. Renamed the test "unittest" like our mk script expects. --- CMakeLists.txt | 27 ++++++------ TODO.txt | 3 -- {lib => csspp}/CMakeLists.txt | 54 ++++++++++++++++++++---- {lib => csspp}/assembler.cpp | 9 ++-- {include/csspp => csspp}/assembler.h | 9 ++-- {lib => csspp}/color.cpp | 9 ++-- {include/csspp => csspp}/color.h | 9 ++-- {lib => csspp}/compiler.cpp | 9 ++-- {include/csspp => csspp}/compiler.h | 9 ++-- {lib => csspp}/csspp.cpp | 9 ++-- {include/csspp => csspp}/csspp.h.in | 9 ++-- {lib => csspp}/error.cpp | 9 ++-- {include/csspp => csspp}/error.h | 9 ++-- {include/csspp => csspp}/exceptions.h | 9 ++-- {lib => csspp}/expr_additive.cpp | 9 ++-- {lib => csspp}/expr_conditional.cpp | 9 ++-- {lib => csspp}/expr_equality.cpp | 9 ++-- {lib => csspp}/expr_list.cpp | 9 ++-- {lib => csspp}/expr_logical_and.cpp | 9 ++-- {lib => csspp}/expr_logical_or.cpp | 9 ++-- {lib => csspp}/expr_multiplicative.cpp | 9 ++-- {lib => csspp}/expr_power.cpp | 9 ++-- {lib => csspp}/expr_relational.cpp | 9 ++-- {lib => csspp}/expr_unary.cpp | 9 ++-- {lib => csspp}/expression.cpp | 9 ++-- {include/csspp => csspp}/expression.h | 9 ++-- {lib => csspp}/internal_functions.cpp | 9 ++-- {lib => csspp}/lexer.cpp | 9 ++-- {include/csspp => csspp}/lexer.h | 9 ++-- {lib => csspp}/node.cpp | 9 ++-- {include/csspp => csspp}/node.h | 9 ++-- {lib => csspp}/nth_child.cpp | 9 ++-- {include/csspp => csspp}/nth_child.h | 9 ++-- {lib => csspp}/parser.cpp | 9 ++-- {include/csspp => csspp}/parser.h | 9 ++-- {lib => csspp}/position.cpp | 9 ++-- {include/csspp => csspp}/position.h | 9 ++-- {lib => csspp}/unicode_range.cpp | 9 ++-- {include/csspp => csspp}/unicode_range.h | 9 ++-- debian/changelog | 7 +++ include/CMakeLists.txt | 40 ------------------ scripts/CMakeLists.txt | 18 +++++--- src/CMakeLists.txt | 12 +++--- tests/CMakeLists.txt | 17 +++++--- 44 files changed, 238 insertions(+), 264 deletions(-) rename {lib => csspp}/CMakeLists.txt (75%) rename {lib => csspp}/assembler.cpp (99%) rename {include/csspp => csspp}/assembler.h (90%) rename {lib => csspp}/color.cpp (98%) rename {include/csspp => csspp}/color.h (92%) rename {lib => csspp}/compiler.cpp (99%) rename {include/csspp => csspp}/compiler.h (96%) rename {lib => csspp}/csspp.cpp (94%) rename {include/csspp => csspp}/csspp.h.in (92%) rename {lib => csspp}/error.cpp (96%) rename {include/csspp => csspp}/error.h (94%) rename {include/csspp => csspp}/exceptions.h (91%) rename {lib => csspp}/expr_additive.cpp (97%) rename {lib => csspp}/expr_conditional.cpp (92%) rename {lib => csspp}/expr_equality.cpp (97%) rename {lib => csspp}/expr_list.cpp (98%) rename {lib => csspp}/expr_logical_and.cpp (92%) rename {lib => csspp}/expr_logical_or.cpp (89%) rename {lib => csspp}/expr_multiplicative.cpp (99%) rename {lib => csspp}/expr_power.cpp (96%) rename {lib => csspp}/expr_relational.cpp (95%) rename {lib => csspp}/expr_unary.cpp (97%) rename {lib => csspp}/expression.cpp (94%) rename {include/csspp => csspp}/expression.h (97%) rename {lib => csspp}/internal_functions.cpp (99%) rename {lib => csspp}/lexer.cpp (99%) rename {include/csspp => csspp}/lexer.h (94%) rename {lib => csspp}/node.cpp (99%) rename {include/csspp => csspp}/node.h (97%) rename {lib => csspp}/nth_child.cpp (97%) rename {include/csspp => csspp}/nth_child.h (88%) rename {lib => csspp}/parser.cpp (99%) rename {include/csspp => csspp}/parser.h (91%) rename {lib => csspp}/position.cpp (85%) rename {include/csspp => csspp}/position.h (86%) rename {lib => csspp}/unicode_range.cpp (95%) rename {include/csspp => csspp}/unicode_range.h (85%) delete mode 100644 include/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 2aea8b1..a742f01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,46 +23,45 @@ ## cmake_minimum_required(VERSION 3.10.2) -project( csspp_project ) +project(csspp_project) -enable_language( CXX ) +enable_language(CXX) enable_testing() ## Include support modules ## set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) -find_package( AdvGetOpt REQUIRED ) -find_package( LibExcept REQUIRED ) -find_package( LibUtf8 REQUIRED ) -find_package( SnapCMakeModules REQUIRED ) -find_package( SnapDoxygen ) +find_package(AdvGetOpt REQUIRED) +find_package(LibExcept REQUIRED) +find_package(LibUtf8 REQUIRED) +find_package(SnapCMakeModules REQUIRED) +find_package(SnapDoxygen ) SnapGetVersion( CSSPP ${CMAKE_CURRENT_SOURCE_DIR} ) if( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) message("Debug is in effect for csspp!") - add_definitions( -DDEBUG -D_DEBUG ) + add_definitions(-DDEBUG -D_DEBUG) else() message("Debug is turned OFF") - add_definitions( -DNDEBUG ) + add_definitions(-DNDEBUG) endif() # A few extra warnings specifically for snapwebsites libraries and tools # You can also play with -Weffc++ although we are definitively not compliant # (especially we do not define all the auto-initialized variables!) # -Wconversion -- would be nice, a few things are still not cooperating with that one -set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wold-style-cast -Wnoexcept" ) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wold-style-cast -Wnoexcept") include_directories( - ${PROJECT_SOURCE_DIR}/include - ${PROJECT_BINARY_DIR}/include + ${PROJECT_SOURCE_DIR} + ${PROJECT_BINARY_DIR} ) ## ## Compiling ## -add_subdirectory(include) # public headers -add_subdirectory(lib) # csspp library +add_subdirectory(csspp) # csspp library add_subdirectory(cmake) # cmake include files add_subdirectory(scripts) # command line tools as scripts add_subdirectory(src) # command line tools as binaries diff --git a/TODO.txt b/TODO.txt index 3f387fb..d526158 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,7 +1,4 @@ -. Move includes along the source and rename the src folder as csspp. -. Make sure the include_directories(...) in cmake files are correct. - To be closer to what SASS supports, we shall implement the following additional features: diff --git a/lib/CMakeLists.txt b/csspp/CMakeLists.txt similarity index 75% rename from lib/CMakeLists.txt rename to csspp/CMakeLists.txt index 07f5fb2..28f3a63 100644 --- a/lib/CMakeLists.txt +++ b/csspp/CMakeLists.txt @@ -1,7 +1,6 @@ +# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved # -# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved -# -# https://snapwebsites.org/ +# https://snapwebsites.org/project/csspp # contact@m2osw.com # # This program is free software; you can redistribute it and/or modify @@ -21,8 +20,12 @@ project(csspp) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/csspp.h.in + ${CMAKE_CURRENT_BINARY_DIR}/csspp.h +) -add_library( ${PROJECT_NAME} SHARED +add_library(${PROJECT_NAME} SHARED assembler.cpp # Write the nodes back out csspp.cpp # Some basics about the library color.cpp # Manager RGBA colors @@ -48,16 +51,49 @@ add_library( ${PROJECT_NAME} SHARED unicode_range.cpp # Handle a Unicode Range value ) -set_target_properties( ${PROJECT_NAME} PROPERTIES +target_include_directories(${PROJECT_NAME} + PUBLIC + ${ADVGETOPT_INCLUDE_DIRS} + ${LIBEXCEPT_INCLUDE_DIRS} +) + +set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${CSSPP_VERSION_MAJOR}.${CSSPP_VERSION_MINOR} SOVERSION ${CSSPP_VERSION_MAJOR} ) install( - TARGETS ${PROJECT_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + TARGETS + ${PROJECT_NAME} + + RUNTIME DESTINATION + bin + + LIBRARY DESTINATION + lib + + ARCHIVE DESTINATION + lib +) + +install( + FILES + assembler.h + color.h + compiler.h + ${CMAKE_CURRENT_BINARY_DIR}/csspp.h + error.h + exceptions.h + expression.h + lexer.h + node.h + nth_child.h + parser.h + position.h + unicode_range.h + + DESTINATION + include/csspp ) diff --git a/lib/assembler.cpp b/csspp/assembler.cpp similarity index 99% rename from lib/assembler.cpp rename to csspp/assembler.cpp index adf1cda..bd2953d 100644 --- a/lib/assembler.cpp +++ b/csspp/assembler.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor assembler. diff --git a/include/csspp/assembler.h b/csspp/assembler.h similarity index 90% rename from include/csspp/assembler.h rename to csspp/assembler.h index 0d1cbb1..b867e3f 100644 --- a/include/csspp/assembler.h +++ b/csspp/assembler.h @@ -1,7 +1,6 @@ #ifndef CSSPP_ASSEMBLER_H #define CSSPP_ASSEMBLER_H -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -13,9 +12,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "csspp/node.h" diff --git a/lib/color.cpp b/csspp/color.cpp similarity index 98% rename from lib/color.cpp rename to csspp/color.cpp index 6313243..664f542 100644 --- a/lib/color.cpp +++ b/csspp/color.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor color class. diff --git a/include/csspp/color.h b/csspp/color.h similarity index 92% rename from include/csspp/color.h rename to csspp/color.h index ced78cc..b3e5d61 100644 --- a/include/csspp/color.h +++ b/csspp/color.h @@ -1,7 +1,6 @@ #ifndef CSSPP_COLOR_H #define CSSPP_COLOR_H -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -13,9 +12,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include diff --git a/lib/compiler.cpp b/csspp/compiler.cpp similarity index 99% rename from lib/compiler.cpp rename to csspp/compiler.cpp index 3ee0fb2..e4efaac 100644 --- a/lib/compiler.cpp +++ b/csspp/compiler.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor compiler. diff --git a/include/csspp/compiler.h b/csspp/compiler.h similarity index 96% rename from include/csspp/compiler.h rename to csspp/compiler.h index 797a87d..d311b11 100644 --- a/include/csspp/compiler.h +++ b/csspp/compiler.h @@ -1,7 +1,6 @@ #ifndef CSSPP_COMPILER_H #define CSSPP_COMPILER_H -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -13,9 +12,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "csspp/expression.h" diff --git a/lib/csspp.cpp b/csspp/csspp.cpp similarity index 94% rename from lib/csspp.cpp rename to csspp/csspp.cpp index 0f08b01..33369d0 100644 --- a/lib/csspp.cpp +++ b/csspp/csspp.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor library. diff --git a/include/csspp/csspp.h.in b/csspp/csspp.h.in similarity index 92% rename from include/csspp/csspp.h.in rename to csspp/csspp.h.in index 53b4519..04310ac 100644 --- a/include/csspp/csspp.h.in +++ b/csspp/csspp.h.in @@ -1,7 +1,6 @@ #ifndef CSSPP_CSSPP_H #define CSSPP_CSSPP_H -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -13,9 +12,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "csspp/exceptions.h" diff --git a/lib/error.cpp b/csspp/error.cpp similarity index 96% rename from lib/error.cpp rename to csspp/error.cpp index 6925c84..452862c 100644 --- a/lib/error.cpp +++ b/csspp/error.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor error handling. diff --git a/include/csspp/error.h b/csspp/error.h similarity index 94% rename from include/csspp/error.h rename to csspp/error.h index 3d781e6..01da07b 100644 --- a/include/csspp/error.h +++ b/csspp/error.h @@ -1,7 +1,6 @@ #ifndef CSSPP_ERROR_H #define CSSPP_ERROR_H -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -13,9 +12,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "csspp/position.h" diff --git a/include/csspp/exceptions.h b/csspp/exceptions.h similarity index 91% rename from include/csspp/exceptions.h rename to csspp/exceptions.h index 98b4edd..60788b1 100644 --- a/include/csspp/exceptions.h +++ b/csspp/exceptions.h @@ -1,7 +1,6 @@ #ifndef CSSPP_EXCEPTIONS_H #define CSSPP_EXCEPTIONS_H -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -13,9 +12,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include diff --git a/lib/expr_additive.cpp b/csspp/expr_additive.cpp similarity index 97% rename from lib/expr_additive.cpp rename to csspp/expr_additive.cpp index 4a61b8e..a17f841 100644 --- a/lib/expr_additive.cpp +++ b/csspp/expr_additive.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor expression. diff --git a/lib/expr_conditional.cpp b/csspp/expr_conditional.cpp similarity index 92% rename from lib/expr_conditional.cpp rename to csspp/expr_conditional.cpp index 0601348..f1256a2 100644 --- a/lib/expr_conditional.cpp +++ b/csspp/expr_conditional.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor expression. diff --git a/lib/expr_equality.cpp b/csspp/expr_equality.cpp similarity index 97% rename from lib/expr_equality.cpp rename to csspp/expr_equality.cpp index 0e4b27a..57b9317 100644 --- a/lib/expr_equality.cpp +++ b/csspp/expr_equality.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor expression. diff --git a/lib/expr_list.cpp b/csspp/expr_list.cpp similarity index 98% rename from lib/expr_list.cpp rename to csspp/expr_list.cpp index 760444b..19bd3ab 100644 --- a/lib/expr_list.cpp +++ b/csspp/expr_list.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor expression. diff --git a/lib/expr_logical_and.cpp b/csspp/expr_logical_and.cpp similarity index 92% rename from lib/expr_logical_and.cpp rename to csspp/expr_logical_and.cpp index cd461f0..62a6b5e 100644 --- a/lib/expr_logical_and.cpp +++ b/csspp/expr_logical_and.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor expression. diff --git a/lib/expr_logical_or.cpp b/csspp/expr_logical_or.cpp similarity index 89% rename from lib/expr_logical_or.cpp rename to csspp/expr_logical_or.cpp index 6c32091..1d93edb 100644 --- a/lib/expr_logical_or.cpp +++ b/csspp/expr_logical_or.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor expression. diff --git a/lib/expr_multiplicative.cpp b/csspp/expr_multiplicative.cpp similarity index 99% rename from lib/expr_multiplicative.cpp rename to csspp/expr_multiplicative.cpp index 2dfa742..1567e32 100644 --- a/lib/expr_multiplicative.cpp +++ b/csspp/expr_multiplicative.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor expression. diff --git a/lib/expr_power.cpp b/csspp/expr_power.cpp similarity index 96% rename from lib/expr_power.cpp rename to csspp/expr_power.cpp index 0be7aa8..0b30f9c 100644 --- a/lib/expr_power.cpp +++ b/csspp/expr_power.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor expression. diff --git a/lib/expr_relational.cpp b/csspp/expr_relational.cpp similarity index 95% rename from lib/expr_relational.cpp rename to csspp/expr_relational.cpp index 5e9895b..cbbb121 100644 --- a/lib/expr_relational.cpp +++ b/csspp/expr_relational.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor expression. diff --git a/lib/expr_unary.cpp b/csspp/expr_unary.cpp similarity index 97% rename from lib/expr_unary.cpp rename to csspp/expr_unary.cpp index 2f6848d..156f1a7 100644 --- a/lib/expr_unary.cpp +++ b/csspp/expr_unary.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor expression. diff --git a/lib/expression.cpp b/csspp/expression.cpp similarity index 94% rename from lib/expression.cpp rename to csspp/expression.cpp index 63b61b5..7ffc99d 100644 --- a/lib/expression.cpp +++ b/csspp/expression.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor expression. diff --git a/include/csspp/expression.h b/csspp/expression.h similarity index 97% rename from include/csspp/expression.h rename to csspp/expression.h index 0ab53bd..12fbe72 100644 --- a/include/csspp/expression.h +++ b/csspp/expression.h @@ -1,7 +1,6 @@ #ifndef CSSPP_EXPRESSION_H #define CSSPP_EXPRESSION_H -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -13,9 +12,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "csspp/node.h" diff --git a/lib/internal_functions.cpp b/csspp/internal_functions.cpp similarity index 99% rename from lib/internal_functions.cpp rename to csspp/internal_functions.cpp index ad57e7c..2301a7e 100644 --- a/lib/internal_functions.cpp +++ b/csspp/internal_functions.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor expression. diff --git a/lib/lexer.cpp b/csspp/lexer.cpp similarity index 99% rename from lib/lexer.cpp rename to csspp/lexer.cpp index 603279e..24359a8 100644 --- a/lib/lexer.cpp +++ b/csspp/lexer.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor lexer. diff --git a/include/csspp/lexer.h b/csspp/lexer.h similarity index 94% rename from include/csspp/lexer.h rename to csspp/lexer.h index fd31a24..7e1f7d8 100644 --- a/include/csspp/lexer.h +++ b/csspp/lexer.h @@ -1,7 +1,6 @@ #ifndef CSSPP_LEXER_H #define CSSPP_LEXER_H -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -13,9 +12,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "csspp/node.h" diff --git a/lib/node.cpp b/csspp/node.cpp similarity index 99% rename from lib/node.cpp rename to csspp/node.cpp index 411e9ef..b1ba888 100644 --- a/lib/node.cpp +++ b/csspp/node.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor node. diff --git a/include/csspp/node.h b/csspp/node.h similarity index 97% rename from include/csspp/node.h rename to csspp/node.h index 7fd5846..94d5b4c 100644 --- a/include/csspp/node.h +++ b/csspp/node.h @@ -1,7 +1,6 @@ #ifndef CSSPP_NODE_H #define CSSPP_NODE_H -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -13,9 +12,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include diff --git a/lib/nth_child.cpp b/csspp/nth_child.cpp similarity index 97% rename from lib/nth_child.cpp rename to csspp/nth_child.cpp index d191839..7521faa 100644 --- a/lib/nth_child.cpp +++ b/csspp/nth_child.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor nth-child handling. diff --git a/include/csspp/nth_child.h b/csspp/nth_child.h similarity index 88% rename from include/csspp/nth_child.h rename to csspp/nth_child.h index a3fb951..d6aacce 100644 --- a/include/csspp/nth_child.h +++ b/csspp/nth_child.h @@ -1,7 +1,6 @@ #ifndef CSSPP_NTH_CHILD_H #define CSSPP_NTH_CHILD_H -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -13,9 +12,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "csspp/csspp.h" diff --git a/lib/parser.cpp b/csspp/parser.cpp similarity index 99% rename from lib/parser.cpp rename to csspp/parser.cpp index 21d9837..b30a16c 100644 --- a/lib/parser.cpp +++ b/csspp/parser.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Implementation of the CSS Preprocessor parser. diff --git a/include/csspp/parser.h b/csspp/parser.h similarity index 91% rename from include/csspp/parser.h rename to csspp/parser.h index c69c8b4..331a7da 100644 --- a/include/csspp/parser.h +++ b/csspp/parser.h @@ -1,7 +1,6 @@ #ifndef CSSPP_PARSER_H #define CSSPP_PARSER_H -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -13,9 +12,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "csspp/lexer.h" diff --git a/lib/position.cpp b/csspp/position.cpp similarity index 85% rename from lib/position.cpp rename to csspp/position.cpp index 45b77c4..f00114e 100644 --- a/lib/position.cpp +++ b/csspp/position.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "csspp/position.h" diff --git a/include/csspp/position.h b/csspp/position.h similarity index 86% rename from include/csspp/position.h rename to csspp/position.h index 1159575..f83e93d 100644 --- a/include/csspp/position.h +++ b/csspp/position.h @@ -1,7 +1,6 @@ #ifndef CSSPP_POSITION_H #define CSSPP_POSITION_H -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -13,9 +12,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "csspp/csspp.h" diff --git a/lib/unicode_range.cpp b/csspp/unicode_range.cpp similarity index 95% rename from lib/unicode_range.cpp rename to csspp/unicode_range.cpp index 18f4b91..b0bbb4a 100644 --- a/lib/unicode_range.cpp +++ b/csspp/unicode_range.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "csspp/unicode_range.h" diff --git a/include/csspp/unicode_range.h b/csspp/unicode_range.h similarity index 85% rename from include/csspp/unicode_range.h rename to csspp/unicode_range.h index d9f6c65..f4b31af 100644 --- a/include/csspp/unicode_range.h +++ b/csspp/unicode_range.h @@ -1,7 +1,6 @@ #ifndef CSSPP_UNICODE_RANGE_H #define CSSPP_UNICODE_RANGE_H -// CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -13,9 +12,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include diff --git a/debian/changelog b/debian/changelog index bfa955a..1b6834b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +csspp (1.0.29.0~bionic) bionic; urgency=high + + * Moved the headers along the code and renamed the directory csspp. + * Started some clean up of the copyright notice. + + -- Alexis Wilke Sun, 16 Jan 2022 07:06:15 -0800 + csspp (1.0.28.4~bionic) bionic; urgency=high * Bumped build version to rebuild on Launchpad. diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt deleted file mode 100644 index bc231ac..0000000 --- a/include/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved -# -# https://snapwebsites.org/project/csspp -# contact@m2osw.com -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# - -project(csspp_include) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/csspp/csspp.h.in ${CMAKE_CURRENT_BINARY_DIR}/csspp/csspp.h) - -install( - DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/csspp - DESTINATION include -) - -install( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/csspp - DESTINATION include -) - -# Local Variables: -# indent-tabs-mode: nil -# tab-width: 4 -# End: - -# vim: ts=4 sw=4 et nocindent diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 6705c2b..fcc39d5 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -26,14 +26,22 @@ configure_file( ) install( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DESTINATION lib/csspp - FILES_MATCHING PATTERN "*.scss" + DIRECTORY + ${CMAKE_CURRENT_SOURCE_DIR} + + DESTINATION + lib/csspp + + FILES_MATCHING PATTERN + "*.scss" ) install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/system/version.scss - DESTINATION lib/csspp/scripts/system + FILES + ${CMAKE_CURRENT_BINARY_DIR}/system/version.scss + + DESTINATION + lib/csspp/scripts/system ) # Local Variables: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e573f16..b54d4f5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,20 +20,20 @@ project(csspp-tool) -include_directories( - ${ADVGETOPT_INCLUDE_DIRS} - ${LIBEXCEPT_INCLUDE_DIRS} -) - add_executable(${PROJECT_NAME} csspp.cpp ) +target_include_directories(${PROJECT_NAME} + PUBLIC + ${ADVGETOPT_INCLUDE_DIRS} + ${LIBEXCEPT_INCLUDE_DIRS} +) + target_link_libraries(${PROJECT_NAME} csspp ${ADVGETOPT_LIBRARIES} ${LIBEXCEPT_LIBRARIES} - ${LIBUTF8_LIBRARIES} ) set_target_properties(${PROJECT_NAME} PROPERTIES diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6515475..1526ef8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -22,11 +22,7 @@ find_package( Catch ) if(CATCH_FOUND) - project( csspp_tests ) - - include_directories( - ${CATCH_INCLUDE_DIR} - ) + project(unittest) add_executable( ${PROJECT_NAME} catch_tests.cpp @@ -54,12 +50,19 @@ if(CATCH_FOUND) catch_unicode_range.cpp ) - target_link_libraries( ${PROJECT_NAME} csspp ) + target_include_directories(${PROJECT_NAME} + PUBLIC + ${CATCH_INCLUDE_DIR} + ) + + target_link_libraries(${PROJECT_NAME} + csspp + ) # You can use the --success command line option to see all the tests # as they run; it is a LOT of output though, thus by default we don't # use it - add_test( csspp_tests ${PROJECT_NAME} ) + add_test(unittest ${PROJECT_NAME}) else(CATCH_FOUND) From 75e72799fde61d49fea6c788aa26675f6f034bdd Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 22 Jan 2022 23:27:07 -0800 Subject: [PATCH 19/64] Updated the tests to work with Catch2 v3. This version uses the CATCH_... macro introducer. Removed the emacs comments. No need here at this point. Renamed the main test "main" instead of "tests". --- csspp/assembler.h | 18 +- csspp/color.h | 20 +- csspp/compiler.h | 17 +- csspp/csspp.h.in | 27 +- csspp/error.h | 25 +- csspp/exceptions.h | 16 +- csspp/expression.h | 18 +- csspp/lexer.h | 18 +- csspp/node.h | 27 +- csspp/nth_child.h | 18 +- csspp/parser.h | 18 +- csspp/position.h | 19 +- csspp/unicode_range.h | 15 +- tests/CMakeLists.txt | 30 +- tests/catch_assembler.cpp | 527 +-- tests/catch_color.cpp | 420 +-- tests/catch_compiler.cpp | 1757 +++++----- tests/catch_csspp.cpp | 183 +- tests/catch_error.cpp | 295 +- tests/catch_expr_additive.cpp | 528 +-- tests/catch_expr_conditional.cpp | 123 +- tests/catch_expr_equality.cpp | 366 ++- tests/catch_expr_list.cpp | 247 +- tests/catch_expr_logical_and.cpp | 81 +- tests/catch_expr_logical_or.cpp | 81 +- tests/catch_expr_multiplicative.cpp | 1147 ++++--- tests/catch_expr_power.cpp | 248 +- tests/catch_expr_relational.cpp | 298 +- tests/catch_expr_unary.cpp | 130 +- tests/catch_internal_functions.cpp | 1094 ++++--- tests/catch_lexer.cpp | 3593 +++++++++++---------- tests/{catch_tests.cpp => catch_main.cpp} | 56 +- tests/{catch_tests.h => catch_main.h} | 44 +- tests/catch_node.cpp | 1086 +++---- tests/catch_nth_child.cpp | 249 +- tests/catch_parser.cpp | 487 +-- tests/catch_position.cpp | 163 +- tests/catch_unicode_range.cpp | 145 +- 38 files changed, 7079 insertions(+), 6555 deletions(-) rename tests/{catch_tests.cpp => catch_main.cpp} (97%) rename tests/{catch_tests.h => catch_main.h} (74%) diff --git a/csspp/assembler.h b/csspp/assembler.h index b867e3f..654ee7e 100644 --- a/csspp/assembler.h +++ b/csspp/assembler.h @@ -1,5 +1,3 @@ -#ifndef CSSPP_ASSEMBLER_H -#define CSSPP_ASSEMBLER_H // Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify @@ -15,8 +13,12 @@ // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#pragma once + +// self +// +#include "csspp/node.h" -#include "csspp/node.h" namespace csspp { @@ -58,14 +60,4 @@ class assembler std::ostream & operator << (std::ostream & out, csspp::output_mode_t const type); -#endif -// #ifndef CSSPP_ASSEMBLER_H - -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/csspp/color.h b/csspp/color.h index b3e5d61..eab759e 100644 --- a/csspp/color.h +++ b/csspp/color.h @@ -1,5 +1,3 @@ -#ifndef CSSPP_COLOR_H -#define CSSPP_COLOR_H // Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify @@ -15,9 +13,13 @@ // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#pragma once + +// C++ lib +// +#include +#include -#include -#include namespace csspp { @@ -66,14 +68,4 @@ class color }; } // namespace csspp -#endif -// #ifndef CSSPP_COLOR_H - -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/csspp/compiler.h b/csspp/compiler.h index d311b11..f39ed0b 100644 --- a/csspp/compiler.h +++ b/csspp/compiler.h @@ -1,5 +1,3 @@ -#ifndef CSSPP_COMPILER_H -#define CSSPP_COMPILER_H // Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify @@ -15,8 +13,11 @@ // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#pragma once -#include "csspp/expression.h" +// self +// +#include "csspp/expression.h" namespace csspp { @@ -129,14 +130,4 @@ class compiler }; } // namespace csspp -#endif -// #ifndef CSSPP_COMPILER_H - -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/csspp/csspp.h.in b/csspp/csspp.h.in index 04310ac..aad64a6 100644 --- a/csspp/csspp.h.in +++ b/csspp/csspp.h.in @@ -1,5 +1,3 @@ -#ifndef CSSPP_CSSPP_H -#define CSSPP_CSSPP_H // Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify @@ -15,12 +13,19 @@ // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#pragma once -#include "csspp/exceptions.h" +// self +// +#include "csspp/exceptions.h" + + +// C++ lib +// +#include +#include +#include -#include -#include -#include #ifdef __CYGWIN__ namespace std @@ -115,14 +120,4 @@ private: }; } // namespace csspp -#endif -// #ifndef CSSPP_CSSPP_H - -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/csspp/error.h b/csspp/error.h index 01da07b..9ae031e 100644 --- a/csspp/error.h +++ b/csspp/error.h @@ -1,5 +1,3 @@ -#ifndef CSSPP_ERROR_H -#define CSSPP_ERROR_H // Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify @@ -15,11 +13,18 @@ // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#pragma once -#include "csspp/position.h" +// self +// +#include "csspp/position.h" + + +// C++ lib +// +#include +#include -#include -#include namespace csspp { @@ -127,14 +132,4 @@ class error_happened_t std::ostream & operator << (std::ostream & out, csspp::error_mode_t const type); -#endif -// #ifndef CSSPP_LEXER_H - -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/csspp/exceptions.h b/csspp/exceptions.h index 60788b1..a621c8e 100644 --- a/csspp/exceptions.h +++ b/csspp/exceptions.h @@ -1,5 +1,3 @@ -#ifndef CSSPP_EXCEPTIONS_H -#define CSSPP_EXCEPTIONS_H // Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify @@ -15,9 +13,13 @@ // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#pragma once +// C++ lib +// #include + namespace csspp { @@ -75,14 +77,4 @@ class csspp_exception_exit : public csspp_exception_runtime }; } // namespace csspp -#endif -// #ifndef CSSPP_EXCEPTIONS_H - -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/csspp/expression.h b/csspp/expression.h index 12fbe72..8df7173 100644 --- a/csspp/expression.h +++ b/csspp/expression.h @@ -1,5 +1,3 @@ -#ifndef CSSPP_EXPRESSION_H -#define CSSPP_EXPRESSION_H // Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify @@ -15,8 +13,12 @@ // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#pragma once + +// self +// +#include "csspp/node.h" -#include "csspp/node.h" namespace csspp { @@ -158,14 +160,4 @@ class expression #pragma GCC diagnostic pop } // namespace csspp -#endif -// #ifndef CSSPP_LEXER_H - -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/csspp/lexer.h b/csspp/lexer.h index 7e1f7d8..00938de 100644 --- a/csspp/lexer.h +++ b/csspp/lexer.h @@ -1,5 +1,3 @@ -#ifndef CSSPP_LEXER_H -#define CSSPP_LEXER_H // Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify @@ -15,8 +13,12 @@ // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#pragma once + +// self +// +#include "csspp/node.h" -#include "csspp/node.h" namespace csspp { @@ -129,14 +131,4 @@ class lexer }; } // namespace csspp -#endif -// #ifndef CSSPP_LEXER_H - -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/csspp/node.h b/csspp/node.h index 94d5b4c..7188a03 100644 --- a/csspp/node.h +++ b/csspp/node.h @@ -1,5 +1,3 @@ -#ifndef CSSPP_NODE_H -#define CSSPP_NODE_H // Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify @@ -15,12 +13,19 @@ // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#pragma once -#include -#include +// self +// +#include "csspp/color.h" +#include "csspp/error.h" + + +// C++ lib +// +#include +#include -#include -#include namespace csspp { @@ -215,14 +220,4 @@ std::ostream & operator << (std::ostream & out, csspp::node const & n); csspp::error & operator << (csspp::error & out, csspp::node_type_t const type); -#endif -// #ifndef CSSPP_NODE_H - -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/csspp/nth_child.h b/csspp/nth_child.h index d6aacce..e40b3e0 100644 --- a/csspp/nth_child.h +++ b/csspp/nth_child.h @@ -1,5 +1,3 @@ -#ifndef CSSPP_NTH_CHILD_H -#define CSSPP_NTH_CHILD_H // Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify @@ -15,8 +13,12 @@ // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#pragma once + +// self +// +#include "csspp/csspp.h" -#include "csspp/csspp.h" namespace csspp { @@ -48,14 +50,4 @@ class nth_child }; } // namespace csspp -#endif -// #ifndef CSSPP_NTH_CHILD_H - -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/csspp/parser.h b/csspp/parser.h index 331a7da..466d73b 100644 --- a/csspp/parser.h +++ b/csspp/parser.h @@ -1,5 +1,3 @@ -#ifndef CSSPP_PARSER_H -#define CSSPP_PARSER_H // Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify @@ -15,8 +13,12 @@ // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#pragma once + +// self +// +#include "csspp/lexer.h" -#include "csspp/lexer.h" namespace csspp { @@ -57,14 +59,4 @@ class parser }; } // namespace csspp -#endif -// #ifndef CSSPP_PARSER_H - -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/csspp/position.h b/csspp/position.h index f83e93d..64de793 100644 --- a/csspp/position.h +++ b/csspp/position.h @@ -1,5 +1,3 @@ -#ifndef CSSPP_POSITION_H -#define CSSPP_POSITION_H // Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify @@ -15,11 +13,18 @@ // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#pragma once + +// self +// +#include "csspp/csspp.h" -#include "csspp/csspp.h" +// C++ lib +// #include + namespace csspp { @@ -48,12 +53,4 @@ class position }; } // namespace csspp -#endif -// #ifndef CSSPP_POSITION_H - -// Local Variables: -// indent-tabs-mode: nil -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/csspp/unicode_range.h b/csspp/unicode_range.h index f4b31af..6a4800a 100644 --- a/csspp/unicode_range.h +++ b/csspp/unicode_range.h @@ -1,5 +1,3 @@ -#ifndef CSSPP_UNICODE_RANGE_H -#define CSSPP_UNICODE_RANGE_H // Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify @@ -15,7 +13,10 @@ // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#pragma once +// self +// #include namespace csspp @@ -43,14 +44,4 @@ class unicode_range_t }; } // namespace csspp -#endif -// #ifndef CSSPP_UNICODE_RANGE_H - -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1526ef8..14df3f6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -16,16 +16,19 @@ # You should have received a copy of the GNU Lesser General Public License along # with this library; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -find_package( Catch ) +## +## CSS Pre-Processor Unit Tests +## +project(unittest) + +find_package(SnapCatch2) -if(CATCH_FOUND) +if(SnapCatch2_FOUND) - project(unittest) + add_executable(${PROJECT_NAME} + catch_main.cpp - add_executable( ${PROJECT_NAME} - catch_tests.cpp catch_assembler.cpp catch_color.cpp catch_compiler.cpp @@ -52,11 +55,12 @@ if(CATCH_FOUND) target_include_directories(${PROJECT_NAME} PUBLIC - ${CATCH_INCLUDE_DIR} + ${SNAPCATCH2_INCLUDE_DIRS} ) target_link_libraries(${PROJECT_NAME} csspp + ${SNAPCATCH2_LIBRARIES} ) # You can use the --success command line option to see all the tests @@ -64,16 +68,10 @@ if(CATCH_FOUND) # use it add_test(unittest ${PROJECT_NAME}) -else(CATCH_FOUND) - - # You may use 'apt-get install catch' under Ubuntu - message("No test will be created because you do not seem to have catch.hpp installed...") +else(SnapCatch2_FOUND) -endif(CATCH_FOUND) + message("snapcatch2 not found... no test will be built.") -# Local Variables: -# indent-tabs-mode: nil -# tab-width: 4 -# End: +endif(SnapCatch2_FOUND) # vim: ts=4 sw=4 et diff --git a/tests/catch_assembler.cpp b/tests/catch_assembler.cpp index 3997a95..be88eb9 100644 --- a/tests/catch_assembler.cpp +++ b/tests/catch_assembler.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the assembler.cpp file. @@ -22,21 +24,39 @@ * full coverage and many edge cases of CSS encoding. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// csspp lib +// +#include +#include +#include +#include + + +// C++ lib +// +#include +#include +#include + -#include "csspp/assembler.h" -#include "csspp/compiler.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" +// C lib +// +#include +#include +#include +#include + + +// last include +// +#include -#include -#include -#include -#include -#include -#include -#include namespace { @@ -78,9 +98,9 @@ bool is_valid_char(csspp::wide_char_t c) } // no name namespace -TEST_CASE("Assemble rules", "[assembler]") +CATCH_TEST_CASE("Assemble rules", "[assembler]") { - SECTION("with many spaces") + CATCH_START_SECTION("with many spaces") { for(int i(static_cast(csspp::output_mode_t::COMPACT)); i <= static_cast(csspp::output_mode_t::TIDY); @@ -117,7 +137,7 @@ TEST_CASE("Assemble rules", "[assembler]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div { color: #000 }\n" "span { border: 3px solid #cff6f7 }\n" "p { font: 13px/135% sans-serif }\n" @@ -127,14 +147,14 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{color:#000}span{border:3px solid #cff6f7}p{font:13px/135% sans-serif}section{width:calc(30px - 5%)}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div\n" "{\n" " color: #000;\n" @@ -156,7 +176,7 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{color:#000}\n" "span{border:3px solid #cff6f7}\n" "p{font:13px/135% sans-serif}\n" @@ -167,11 +187,12 @@ TEST_CASE("Assemble rules", "[assembler]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("with a calc including a divide after parenthesis") + CATCH_START_SECTION("with a calc including a divide after parenthesis") { for(int i(static_cast(csspp::output_mode_t::COMPACT)); i <= static_cast(csspp::output_mode_t::TIDY); @@ -205,21 +226,21 @@ TEST_CASE("Assemble rules", "[assembler]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "#left-margin { width: calc( (100% - 300px) / 2) }\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "#left-margin{width:calc( (100% - 300px) / 2)}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "#left-margin\n" "{\n" " width: calc( (100% - 300px) / 2);\n" @@ -229,7 +250,7 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "#left-margin{width:calc( (100% - 300px) / 2)}\n" + csspp_test::get_close_comment() ); @@ -237,11 +258,12 @@ TEST_CASE("Assemble rules", "[assembler]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("test multiple declarations in one rule") + CATCH_START_SECTION("test multiple declarations in one rule") { for(int i(static_cast(csspp::output_mode_t::COMPACT)); i <= static_cast(csspp::output_mode_t::TIDY); @@ -288,7 +310,7 @@ TEST_CASE("Assemble rules", "[assembler]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div { color: #fff; font-size: 1.3rem }\n" "span { border: 3px solid #f5c3c2; border-bottom-width: 1px; box-shadow: 1px 0px 7px #8a1, 0px 3px 1px #a83; font: 17.2px/1.35em Arial }\n" + csspp_test::get_close_comment() @@ -296,14 +318,14 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{color:#fff;font-size:1.3rem}span{border:3px solid #f5c3c2;border-bottom-width:1px;box-shadow:1px 0px 7px #8a1,0px 3px 1px #a83;font:17.2px/1.35em Arial}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div\n" "{\n" " color: #fff;\n" @@ -321,7 +343,7 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{color:#fff;font-size:1.3rem}\n" "span{border:3px solid #f5c3c2;border-bottom-width:1px;box-shadow:1px 0px 7px #8a1,0px 3px 1px #a83;font:17.2px/1.35em Arial}\n" + csspp_test::get_close_comment() @@ -330,11 +352,12 @@ TEST_CASE("Assemble rules", "[assembler]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("test multiple selector lists") + CATCH_START_SECTION("test multiple selector lists") { for(int i(static_cast(csspp::output_mode_t::COMPACT)); i <= static_cast(csspp::output_mode_t::TIDY); @@ -378,21 +401,21 @@ TEST_CASE("Assemble rules", "[assembler]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div a b, p span i { color: gray; font-size: 1.3em; border: 3px solid #f6d1d0; box-shadow: 1px 0px 7px #8a1, 0px 3px 1px #a83, 1px 2px 3px #92af54; border-bottom-width: 1px }\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div a b,p span i{color:gray;font-size:1.3em;border:3px solid #f6d1d0;box-shadow:1px 0px 7px #8a1,0px 3px 1px #a83,1px 2px 3px #92af54;border-bottom-width:1px}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div a b, p span i\n" "{\n" " color: gray;\n" @@ -406,7 +429,7 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div a b,p span i{color:gray;font-size:1.3em;border:3px solid #f6d1d0;box-shadow:1px 0px 7px #8a1,0px 3px 1px #a83,1px 2px 3px #92af54;border-bottom-width:1px}\n" + csspp_test::get_close_comment() ); @@ -414,11 +437,12 @@ TEST_CASE("Assemble rules", "[assembler]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("test set_unit() to various numbers") + CATCH_START_SECTION("test set_unit() to various numbers") { for(int i(static_cast(csspp::output_mode_t::COMPACT)); i <= static_cast(csspp::output_mode_t::TIDY); @@ -470,21 +494,21 @@ TEST_CASE("Assemble rules", "[assembler]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div { width: 33px; height: 3.3em; margin-left: 33cm; margin-right: 3.3mm; margin-top: 1.23px; margin-bottom: 4500%; border-bottom-width: 450%; border-top-width: 4500%; border-left-width: 45%; border-right-width: 68; background-x: 68; background-y: 6.8; padding-left: .638 }\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:33px;height:3.3em;margin-left:33cm;margin-right:3.3mm;margin-top:1.23px;margin-bottom:4500%;border-bottom-width:450%;border-top-width:4500%;border-left-width:45%;border-right-width:68;background-x:68;background-y:6.8;padding-left:.638}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div\n" "{\n" " width: 33px;\n" @@ -506,7 +530,7 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:33px;height:3.3em;margin-left:33cm;margin-right:3.3mm;margin-top:1.23px;margin-bottom:4500%;border-bottom-width:450%;border-top-width:4500%;border-left-width:45%;border-right-width:68;background-x:68;background-y:6.8;padding-left:.638}\n" + csspp_test::get_close_comment() ); @@ -514,11 +538,12 @@ TEST_CASE("Assemble rules", "[assembler]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("test unitless() to various numbers") + CATCH_START_SECTION("test unitless() to various numbers") { for(int i(static_cast(csspp::output_mode_t::COMPACT)); i <= static_cast(csspp::output_mode_t::TIDY); @@ -560,21 +585,21 @@ TEST_CASE("Assemble rules", "[assembler]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div { width: 3em; height: 3mm; content: \"correct\"; border-bottom-width: 30vm; border-left-width: 131px }\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:3em;height:3mm;content:\"correct\";border-bottom-width:30vm;border-left-width:131px}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div\n" "{\n" " width: 3em;\n" @@ -588,7 +613,7 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:3em;height:3mm;content:\"correct\";border-bottom-width:30vm;border-left-width:131px}\n" + csspp_test::get_close_comment() ); @@ -596,11 +621,12 @@ TEST_CASE("Assemble rules", "[assembler]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("test unique_id()") + CATCH_START_SECTION("test unique_id()") { for(int i(static_cast(csspp::output_mode_t::COMPACT)); i <= static_cast(csspp::output_mode_t::TIDY); @@ -646,7 +672,7 @@ TEST_CASE("Assemble rules", "[assembler]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div { content: \"_csspp_unique1\"; border: 3px _csspp_unique2 #b0c4de }\n" "a.withColor { padding: _csspp_unique3 }\n" + csspp_test::get_close_comment() @@ -654,14 +680,14 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{content:\"_csspp_unique1\";border:3px _csspp_unique2 #b0c4de}a.withColor{padding:_csspp_unique3}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div\n" "{\n" " content: \"_csspp_unique1\";\n" @@ -676,7 +702,7 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{content:\"_csspp_unique1\";border:3px _csspp_unique2 #b0c4de}\n" "a.withColor{padding:_csspp_unique3}\n" + csspp_test::get_close_comment() @@ -685,11 +711,12 @@ TEST_CASE("Assemble rules", "[assembler]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("identifier with unicode characters and starting with a digit and including a period") + CATCH_START_SECTION("identifier with unicode characters and starting with a digit and including a period") { for(int i(static_cast(csspp::output_mode_t::COMPACT)); i <= static_cast(csspp::output_mode_t::TIDY); @@ -731,7 +758,7 @@ TEST_CASE("Assemble rules", "[assembler]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "\xc3\xa9t\xc3\xa9 { color: #ffd700 }\n" "\\33 21 { color: rgba(210,180,140,.8) }\n" "\\36 face { color: #da70d6 }\n" @@ -745,7 +772,7 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "\xc3\xa9t\xc3\xa9{color:#ffd700}" "\\33 21{color:rgba(210,180,140,.8)}" "\\36 face{color:#da70d6}" @@ -760,7 +787,7 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "\xc3\xa9t\xc3\xa9\n" "{\n" " color: #ffd700;\n" @@ -798,7 +825,7 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "\xc3\xa9t\xc3\xa9{color:#ffd700}\n" "\\33 21{color:rgba(210,180,140,.8)}\n" "\\36 face{color:#da70d6}\n" @@ -813,11 +840,12 @@ TEST_CASE("Assemble rules", "[assembler]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("whitespace at the beginning of a rule") + CATCH_START_SECTION("whitespace at the beginning of a rule") { for(int i(static_cast(csspp::output_mode_t::COMPACT)); i <= static_cast(csspp::output_mode_t::TIDY); @@ -854,12 +882,12 @@ TEST_CASE("Assemble rules", "[assembler]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE_ERRORS("test.css(3): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); + VERIFY_ERRORS("test.css(3): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "/* @preserve this comment */\n" ".face { content: \"\xe4\x96\x82\" }\n" ".hair { color: rgba(50,100,150,.6) }\n" @@ -869,7 +897,7 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "/* @preserve this comment */\n" ".face{content:\"\xe4\x96\x82\"}" ".hair{color:rgba(50,100,150,.6)}" @@ -880,7 +908,7 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "/* @preserve this comment */\n" ".face\n" "{\n" @@ -899,7 +927,7 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "/* @preserve this comment */\n" ".face{content:\"\xe4\x96\x82\"}\n" ".hair{color:rgba(50,100,150,.6)}\n" @@ -910,11 +938,12 @@ TEST_CASE("Assemble rules", "[assembler]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("whitespace at the beginning of a variable") + CATCH_START_SECTION("whitespace at the beginning of a variable") { for(int i(static_cast(csspp::output_mode_t::COMPACT)); i <= static_cast(csspp::output_mode_t::TIDY); @@ -966,12 +995,12 @@ TEST_CASE("Assemble rules", "[assembler]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "p { background-color: #626262 }\n" "p div.flowers { background-image: url( images/ladybug.jpeg ); z-index: 300 }\n" + csspp_test::get_close_comment() @@ -979,7 +1008,7 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "p{background-color:#626262}" "p div.flowers{background-image:url(images/ladybug.jpeg);z-index:300}" "\n" @@ -988,7 +1017,7 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "p\n" "{\n" " background-color: #626262;\n" @@ -1003,7 +1032,7 @@ TEST_CASE("Assemble rules", "[assembler]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "p{background-color:#626262}\n" "p div.flowers{background-image:url(images/ladybug.jpeg);z-index:300}\n" + csspp_test::get_close_comment() @@ -1012,15 +1041,16 @@ TEST_CASE("Assemble rules", "[assembler]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Assemble selectors", "[assembler] [selectors]") +CATCH_TEST_CASE("Assemble selectors", "[assembler] [selectors]") { // check various selectors without the operators @@ -1057,21 +1087,21 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div span a { color: #000 }\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div span a{color:#000}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div span a\n" "{\n" " color: #000;\n" @@ -1081,7 +1111,7 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div span a{color:#000}\n" + csspp_test::get_close_comment() ); @@ -1089,7 +1119,7 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test a simple attribute @@ -1125,21 +1155,21 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div[foo] { color: #000 }\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div[foo]{color:#000}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div[foo]\n" "{\n" " color: #000;\n" @@ -1149,7 +1179,7 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div[foo]{color:#000}\n" + csspp_test::get_close_comment() ); @@ -1157,7 +1187,7 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // Test with a class @@ -1193,21 +1223,21 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div.foo { color: #000 }\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div.foo{color:#000}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div.foo\n" "{\n" " color: #000;\n" @@ -1217,7 +1247,7 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div.foo{color:#000}\n" + csspp_test::get_close_comment() ); @@ -1225,7 +1255,7 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // Test with an identifier @@ -1261,21 +1291,21 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "#foo div { color: #000 }\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "#foo div{color:#000}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "#foo div\n" "{\n" " color: #000;\n" @@ -1285,7 +1315,7 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "#foo div{color:#000}\n" + csspp_test::get_close_comment() ); @@ -1293,7 +1323,7 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test an attribute with a test @@ -1329,21 +1359,21 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div[foo = \"a b c\"] { color: #000 }\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div[foo=\"a b c\"]{color:#000}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div[foo = \"a b c\"]\n" "{\n" " color: #000;\n" @@ -1353,7 +1383,7 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div[foo=\"a b c\"]{color:#000}\n" + csspp_test::get_close_comment() ); @@ -1361,7 +1391,7 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test an :lang() pseudo function @@ -1397,21 +1427,21 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div:lang(fr) { color: #000 }\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div:lang(fr){color:#000}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div:lang(fr)\n" "{\n" " color: #000;\n" @@ -1421,7 +1451,7 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div:lang(fr){color:#000}\n" + csspp_test::get_close_comment() ); @@ -1429,7 +1459,7 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test an :not() pseudo function @@ -1465,21 +1495,21 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div:not(:lang(fr)):not(:nth-child(odd)) { color: #000 }\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div:not(:lang(fr)):not(:nth-child(odd)){color:#000}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div:not(:lang(fr)):not(:nth-child(odd))\n" "{\n" " color: #000;\n" @@ -1489,7 +1519,7 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div:not(:lang(fr)):not(:nth-child(odd)){color:#000}\n" + csspp_test::get_close_comment() ); @@ -1497,7 +1527,7 @@ TEST_CASE("Assemble selectors", "[assembler] [selectors]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test the pseudo classes @@ -1580,8 +1610,8 @@ expected << "div:" << pseudo_classes[j] << "{color:#000}\n" } - REQUIRE(out.str() == expected.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(out.str() == expected.str()); + CATCH_REQUIRE(c.get_root() == n); } } @@ -1652,8 +1682,8 @@ expected << "div::" << pseudo_elements[j] << "{color:#000}\n" } - REQUIRE(out.str() == expected.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(out.str() == expected.str()); + CATCH_REQUIRE(c.get_root() == n); } } @@ -1724,8 +1754,8 @@ expected << "div:" << pseudo_functions[j] << "(5n+2){color:#000}\n" } - REQUIRE(out.str() == expected.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(out.str() == expected.str()); + CATCH_REQUIRE(c.get_root() == n); } } @@ -1797,16 +1827,16 @@ expected << "with " << scope[j] << " scope{color:#000}\n" } - REQUIRE(out.str() == expected.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(out.str() == expected.str()); + CATCH_REQUIRE(c.get_root() == n); } } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Assemble numbers", "[assembler] [numbers]") +CATCH_TEST_CASE("Assemble numbers", "[assembler] [numbers]") { // create strings with more single quotes (') for(int i(static_cast(csspp::output_mode_t::COMPACT)); @@ -1909,15 +1939,15 @@ expected << "#wrapper div * span a:hover{" } - REQUIRE(out.str() == expected.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(out.str() == expected.str()); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Assemble unicode range", "[assembler] [unicode-range-value] [at-keyword]") +CATCH_TEST_CASE("Assemble unicode range", "[assembler] [unicode-range-value] [at-keyword]") { // a valid @supports for(int i(static_cast(csspp::output_mode_t::COMPACT)); @@ -1938,7 +1968,7 @@ TEST_CASE("Assemble unicode range", "[assembler] [unicode-range-value] [at-keywo csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1951,7 +1981,7 @@ TEST_CASE("Assemble unicode range", "[assembler] [unicode-range-value] [at-keywo //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *n << "]\n"; @@ -1964,7 +1994,7 @@ TEST_CASE("Assemble unicode range", "[assembler] [unicode-range-value] [at-keywo switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@font-face \n" "{\n" "unicode-range: U+4??; " @@ -1976,14 +2006,14 @@ TEST_CASE("Assemble unicode range", "[assembler] [unicode-range-value] [at-keywo break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@font-face {unicode-range:U+4??;font-style:italic}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@font-face \n" "{\n" " unicode-range: U+4??;\n" @@ -1994,7 +2024,7 @@ TEST_CASE("Assemble unicode range", "[assembler] [unicode-range-value] [at-keywo break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@font-face \n" "{\n" "unicode-range:U+4??;font-style:italic}\n" @@ -2005,14 +2035,14 @@ TEST_CASE("Assemble unicode range", "[assembler] [unicode-range-value] [at-keywo } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Assemble strings", "[assembler] [strings]") +CATCH_TEST_CASE("Assemble strings", "[assembler] [strings]") { // create strings with more single quotes (') for(int i(static_cast(csspp::output_mode_t::COMPACT)); @@ -2083,21 +2113,21 @@ TEST_CASE("Assemble strings", "[assembler] [strings]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div::before { content: \"" + str + "\" }\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div::before{content:\"" + str + "\"}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div::before\n" "{\n" " content: \"" + str + "\";\n" @@ -2107,7 +2137,7 @@ TEST_CASE("Assemble strings", "[assembler] [strings]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div::before{content:\"" + str + "\"}\n" + csspp_test::get_close_comment() ); @@ -2115,7 +2145,7 @@ TEST_CASE("Assemble strings", "[assembler] [strings]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // create strings with more double quotes (") @@ -2187,21 +2217,21 @@ TEST_CASE("Assemble strings", "[assembler] [strings]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div::after { content: '" + str + "' }\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div::after{content:'" + str + "'}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div::after\n" "{\n" " content: '" + str + "';\n" @@ -2211,7 +2241,7 @@ TEST_CASE("Assemble strings", "[assembler] [strings]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div::after{content:'" + str + "'}\n" + csspp_test::get_close_comment() ); @@ -2219,14 +2249,14 @@ TEST_CASE("Assemble strings", "[assembler] [strings]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Assemble URI", "[assembler] [uri]") +CATCH_TEST_CASE("Assemble URI", "[assembler] [uri]") { // all characters can be inserted as is (no switching to string) for(int i(static_cast(csspp::output_mode_t::COMPACT)); @@ -2280,21 +2310,21 @@ TEST_CASE("Assemble URI", "[assembler] [uri]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div { background-image: url( /images/" + name + ".png ) }\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{background-image:url(/images/" + name + ".png)}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div\n" "{\n" " background-image: url( /images/" + name + ".png );\n" @@ -2304,7 +2334,7 @@ TEST_CASE("Assemble URI", "[assembler] [uri]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{background-image:url(/images/" + name + ".png)}\n" + csspp_test::get_close_comment() ); @@ -2312,7 +2342,7 @@ TEST_CASE("Assemble URI", "[assembler] [uri]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // at least one character requires the use of a string @@ -2384,21 +2414,21 @@ TEST_CASE("Assemble URI", "[assembler] [uri]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div { background-image: url( " + quote + "/images/" + name + ".png" + quote + " ) }\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{background-image:url(" + quote + "/images/" + name + ".png" + quote + ")}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div\n" "{\n" " background-image: url( " + quote + "/images/" + name + ".png" + quote + " );\n" @@ -2408,7 +2438,7 @@ TEST_CASE("Assemble URI", "[assembler] [uri]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{background-image:url(" + quote + "/images/" + name + ".png" + quote + ")}\n" + csspp_test::get_close_comment() ); @@ -2416,14 +2446,14 @@ TEST_CASE("Assemble URI", "[assembler] [uri]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Assemble C++ comment", "[assembler] [comment]") +CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") { // One line C++ comment for(int i(static_cast(csspp::output_mode_t::COMPACT)); @@ -2440,7 +2470,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") csspp::node::pointer_t n(p.stylesheet()); - REQUIRE_ERRORS("test.css(1): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); + VERIFY_ERRORS("test.css(1): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); csspp::compiler c; c.set_root(n); @@ -2461,7 +2491,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error { color: red }\n" + csspp_test::get_close_comment() @@ -2469,7 +2499,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error{color:red}\n" + csspp_test::get_close_comment() @@ -2477,7 +2507,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error\n" "{\n" @@ -2488,7 +2518,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version" CSSPP_VERSION " -- @preserve */\n" "body.error{color:red}\n" + csspp_test::get_close_comment() @@ -2497,7 +2527,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // Multi-line C++ comment @@ -2517,7 +2547,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") csspp::node::pointer_t n(p.stylesheet()); - REQUIRE_ERRORS("test.css(1): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); + VERIFY_ERRORS("test.css(1): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); csspp::compiler c; c.set_root(n); @@ -2538,7 +2568,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" @@ -2549,7 +2579,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" @@ -2560,7 +2590,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" @@ -2574,7 +2604,7 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" @@ -2586,14 +2616,14 @@ TEST_CASE("Assemble C++ comment", "[assembler] [comment]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") +CATCH_TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") { // Standard @document with a sub-rule for(int i(static_cast(csspp::output_mode_t::COMPACT)); @@ -2633,7 +2663,7 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@document url( http://www.example.com/ ), regexp(\"https://.*\")\n" "{\n" "body { width: 8.5in; height: 9in }\n" @@ -2646,14 +2676,14 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@document url(http://www.example.com/),regexp(\"https://.*\"){body{width:8.5in;height:9in}div{border:.25in solid #d3d3d3}}#edge{border:1px solid #000}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@document url( http://www.example.com/ ), regexp(\"https://.*\")\n" "{\n" "body\n" @@ -2676,7 +2706,7 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@document url(http://www.example.com/),regexp(\"https://.*\")\n" "{\n" "body{width:8.5in;height:9in}\n" @@ -2690,7 +2720,7 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // Standard @media with a sub-rule @@ -2727,7 +2757,7 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@media screen or (printer and color) \n" "{\n" "body { width: 8.5in; height: 9in }\n" @@ -2739,14 +2769,14 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@media screen or (printer and color){body{width:8.5in;height:9in}}#edge{border:1px solid #000}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@media screen or (printer and color) \n" "{\n" "body\n" @@ -2765,7 +2795,7 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@media screen or (printer and color)\n" "{\n" "body{width:8.5in;height:9in}\n" @@ -2778,7 +2808,7 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // @media with many parenthesis and multiple sub-rules @@ -2819,7 +2849,7 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@media not (screen or ((laser or matrix or jet-printer) and color)) \n" "{\n" "body { width: 8.5in; height: 9in }\n" @@ -2833,14 +2863,14 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@media not (screen or ((laser or matrix or jet-printer) and color)){body{width:8.5in;height:9in}div{margin:.15in;padding:.07in}p{margin-bottom:2em}}#edge{border:1px solid #000}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@media not (screen or ((laser or matrix or jet-printer) and color)) \n" "{\n" "body\n" @@ -2868,7 +2898,7 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@media not (screen or ((laser or matrix or jet-printer) and color))\n" "{\n" "body{width:8.5in;height:9in}\n" @@ -2883,7 +2913,7 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // simple @import to see the ';' at the end of the line @@ -2919,28 +2949,28 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@import url( //css.m2osw.com/store/colors.css ) only screen or (printer and color) ;\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@import url(//css.m2osw.com/store/colors.css) only screen or (printer and color);\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@import url( //css.m2osw.com/store/colors.css ) only screen or (printer and color) ;\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@import url(//css.m2osw.com/store/colors.css) only screen or (printer and color);\n" + csspp_test::get_close_comment() ); @@ -2948,7 +2978,7 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // @keyframes @@ -2997,7 +3027,7 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@keyframes name {\n" "0% { left: 0 }\n" "33% { left: 5px }\n" @@ -3009,14 +3039,14 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@keyframes name{0%{left:0}33%{left:5px}67%{left:45px}to{left:50px}}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@keyframes name {\n" "0%\n" "{\n" @@ -3040,7 +3070,7 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "@keyframes name{\n" "0%{left:0}\n" "33%{left:5px}\n" @@ -3053,14 +3083,14 @@ TEST_CASE("Assemble @-keyword", "[assembler] [at-keyword]") } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Assemble functions", "[assembler] [function]") +CATCH_TEST_CASE("Assemble functions", "[assembler] [function]") { // Test with gradient() function for(int i(static_cast(csspp::output_mode_t::COMPACT)); @@ -3121,9 +3151,9 @@ expected << "a~b{border:3px solid #39458a;width:450px;height:200px}\n"; } expected << csspp_test::get_close_comment(); - REQUIRE(out.str() == expected.str()); + CATCH_REQUIRE(out.str() == expected.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // CSS Function which is an internal CSS Preprocess function @@ -3183,9 +3213,9 @@ expected << "a b{color:rgba(7,2,3,.5)}\n"; } expected << csspp_test::get_close_comment(); - REQUIRE(out.str() == expected.str()); + CATCH_REQUIRE(out.str() == expected.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // CSS Function which is not replaced by CSS Proprocessor @@ -3244,16 +3274,16 @@ expected << "a b{transform:translate(-50%,0)}\n"; } expected << csspp_test::get_close_comment(); - REQUIRE(out.str() == expected.str()); + CATCH_REQUIRE(out.str() == expected.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Assemble placeholder", "[assembler] [placeholder]") +CATCH_TEST_CASE("Assemble placeholder", "[assembler] [placeholder]") { // Test with gradient() function for(int i(static_cast(csspp::output_mode_t::COMPACT)); @@ -3313,16 +3343,16 @@ expected << ".error{color:#e09756}\n"; } expected << csspp_test::get_close_comment(); - REQUIRE(out.str() == expected.str()); + CATCH_REQUIRE(out.str() == expected.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Assemble operators", "[assembler] [operators]") +CATCH_TEST_CASE("Assemble operators", "[assembler] [operators]") { // Selector unary operator for(int i(static_cast(csspp::output_mode_t::COMPACT)); @@ -3378,9 +3408,9 @@ expected << "a * b{color:red}\n"; } expected << csspp_test::get_close_comment(); - REQUIRE(out.str() == expected.str()); + CATCH_REQUIRE(out.str() == expected.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // Selector binary operators @@ -3451,9 +3481,9 @@ expected << "a" << selector_operator[op] << "b{color:red}\n"; } expected << csspp_test::get_close_comment(); - REQUIRE(out.str() == expected.str()); + CATCH_REQUIRE(out.str() == expected.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } @@ -3543,9 +3573,9 @@ expected << "a[b" << attribute_operator[op] << "3]{color:red}\n"; } expected << csspp_test::get_close_comment(); - REQUIRE(out.str() == expected.str()); + CATCH_REQUIRE(out.str() == expected.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } @@ -3585,21 +3615,21 @@ expected << "a[b" << attribute_operator[op] << "3]{color:red}\n"; switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "[b = 3] { color: red !important }\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "[b=3]{color:red!important}\n" + csspp_test::get_close_comment() ); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "[b = 3]\n" "{\n" " color: red !important;\n" @@ -3609,7 +3639,7 @@ expected << "a[b" << attribute_operator[op] << "3]{color:red}\n"; break; case csspp::output_mode_t::TIDY: - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "[b=3]{color:red!important}\n" + csspp_test::get_close_comment() ); @@ -3617,14 +3647,14 @@ expected << "a[b" << attribute_operator[op] << "3]{color:red}\n"; } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Assembler modes", "[assembler] [mode]") +CATCH_TEST_CASE("Assembler modes", "[assembler] [mode]") { for(int i(static_cast(csspp::output_mode_t::COMPACT)); i <= static_cast(csspp::output_mode_t::TIDY); @@ -3636,29 +3666,29 @@ TEST_CASE("Assembler modes", "[assembler] [mode]") switch(static_cast(i)) { case csspp::output_mode_t::COMPACT: - REQUIRE(ss.str() == "COMPACT"); + CATCH_REQUIRE(ss.str() == "COMPACT"); break; case csspp::output_mode_t::COMPRESSED: - REQUIRE(ss.str() == "COMPRESSED"); + CATCH_REQUIRE(ss.str() == "COMPRESSED"); break; case csspp::output_mode_t::EXPANDED: - REQUIRE(ss.str() == "EXPANDED"); + CATCH_REQUIRE(ss.str() == "EXPANDED"); break; case csspp::output_mode_t::TIDY: - REQUIRE(ss.str() == "TIDY"); + CATCH_REQUIRE(ss.str() == "TIDY"); break; } } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid assembler mode", "[assembler] [mode] [invalid]") +CATCH_TEST_CASE("Invalid assembler mode", "[assembler] [mode] [invalid]") { // with many spaces for(int i(0); i < 100; ++i) @@ -3672,14 +3702,14 @@ TEST_CASE("Invalid assembler mode", "[assembler] [mode] [invalid]") { mode = static_cast(rand()); } - REQUIRE_THROWS_AS(a.output(n, mode), csspp::csspp_exception_logic &); + CATCH_REQUIRE_THROWS_AS(a.output(n, mode), csspp::csspp_exception_logic); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Inacceptable nodes", "[assembler] [invalid]") +CATCH_TEST_CASE("Inacceptable nodes", "[assembler] [invalid]") { // list of "invalid" nodes in the assembler csspp::node_type_t node_types[] = @@ -3727,12 +3757,12 @@ TEST_CASE("Inacceptable nodes", "[assembler] [invalid]") std::stringstream out; csspp::assembler a(out); - REQUIRE_THROWS_AS(a.output(root, static_cast(i)), csspp::csspp_exception_logic &); + CATCH_REQUIRE_THROWS_AS(a.output(root, static_cast(i)), csspp::csspp_exception_logic); } } } -TEST_CASE("CSS incompatible dimensions", "[assembler] [invalid] [dimension]") +CATCH_TEST_CASE("CSS incompatible dimensions", "[assembler] [invalid] [dimension]") { for(int i(static_cast(csspp::output_mode_t::COMPACT)); i <= static_cast(csspp::output_mode_t::TIDY); @@ -3758,7 +3788,7 @@ TEST_CASE("CSS incompatible dimensions", "[assembler] [invalid] [dimension]") //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; // no errors yet - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; csspp::assembler a(out); @@ -3766,20 +3796,13 @@ TEST_CASE("CSS incompatible dimensions", "[assembler] [invalid] [dimension]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: \"px * px\" is not a valid CSS dimension.\n"); + VERIFY_ERRORS("test.css(1): error: \"px * px\" is not a valid CSS dimension.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_color.cpp b/tests/catch_color.cpp index 44faa13..bb90c86 100644 --- a/tests/catch_color.cpp +++ b/tests/catch_color.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the color.cpp file. @@ -22,15 +24,35 @@ * implementation to ensure full coverage. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// csspp lib +// +#include +#include +#include + + +// C++ lib +// +#include +#include + -#include "csspp/exceptions.h" -#include "csspp/color.h" -#include "csspp/lexer.h" +// C lib +// +#include +#include + + +// last include +// +#include -#include -#include namespace { @@ -188,59 +210,56 @@ char const test_colors[] = } // no name namespace -TEST_CASE("Invalid colors", "[color] [invalid]") +CATCH_TEST_CASE("Invalid colors", "[color] [invalid]") { csspp::color c; - REQUIRE(!c.set_color("", false)); - REQUIRE(!c.set_color("1", false)); - REQUIRE(!c.set_color("12", false)); - REQUIRE(!c.set_color("1234", false)); - REQUIRE(!c.set_color("12345", false)); - REQUIRE(!c.set_color("1234567", false)); - REQUIRE(!c.set_color("12345G", false)); - REQUIRE(!c.set_color("/01234", false)); - REQUIRE(!c.set_color("/05", false)); - REQUIRE(!c.set_color("44G", false)); - REQUIRE(!c.set_color("#333", false)); - REQUIRE(!c.set_color("unknown", false)); - - REQUIRE(!c.set_color("", true)); - REQUIRE(!c.set_color("1", true)); - REQUIRE(!c.set_color("12", true)); - REQUIRE(!c.set_color("123", true)); // this would work with false - REQUIRE(!c.set_color("1234", true)); - REQUIRE(!c.set_color("12345", true)); - REQUIRE(!c.set_color("123456", true)); // this would work with false - REQUIRE(!c.set_color("1234567", true)); - REQUIRE(!c.set_color("12345G", true)); - REQUIRE(!c.set_color("/01234", true)); - REQUIRE(!c.set_color("/05", true)); - REQUIRE(!c.set_color("44G", true)); - REQUIRE(!c.set_color("#333", true)); - REQUIRE(!c.set_color("unknown", true)); + CATCH_REQUIRE(!c.set_color("", false)); + CATCH_REQUIRE(!c.set_color("1", false)); + CATCH_REQUIRE(!c.set_color("12", false)); + CATCH_REQUIRE(!c.set_color("1234", false)); + CATCH_REQUIRE(!c.set_color("12345", false)); + CATCH_REQUIRE(!c.set_color("1234567", false)); + CATCH_REQUIRE(!c.set_color("12345G", false)); + CATCH_REQUIRE(!c.set_color("/01234", false)); + CATCH_REQUIRE(!c.set_color("/05", false)); + CATCH_REQUIRE(!c.set_color("44G", false)); + CATCH_REQUIRE(!c.set_color("#333", false)); + CATCH_REQUIRE(!c.set_color("unknown", false)); + + CATCH_REQUIRE(!c.set_color("", true)); + CATCH_REQUIRE(!c.set_color("1", true)); + CATCH_REQUIRE(!c.set_color("12", true)); + CATCH_REQUIRE(!c.set_color("123", true)); // this would work with false + CATCH_REQUIRE(!c.set_color("1234", true)); + CATCH_REQUIRE(!c.set_color("12345", true)); + CATCH_REQUIRE(!c.set_color("123456", true)); // this would work with false + CATCH_REQUIRE(!c.set_color("1234567", true)); + CATCH_REQUIRE(!c.set_color("12345G", true)); + CATCH_REQUIRE(!c.set_color("/01234", true)); + CATCH_REQUIRE(!c.set_color("/05", true)); + CATCH_REQUIRE(!c.set_color("44G", true)); + CATCH_REQUIRE(!c.set_color("#333", true)); + CATCH_REQUIRE(!c.set_color("unknown", true)); } -TEST_CASE("Default color", "[color] [default]") +CATCH_TEST_CASE("Default color", "[color] [default]") { csspp::color c; - REQUIRE(c.get_color() == 0xFF000000); + CATCH_REQUIRE(c.get_color() == 0xFF000000U); csspp::color_component_t cr; csspp::color_component_t cg; csspp::color_component_t cb; csspp::color_component_t ca; c.get_color(cr, cg, cb, ca); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wfloat-equal" - REQUIRE(cr == 0.0); - REQUIRE(cg == 0.0); - REQUIRE(cb == 0.0); - REQUIRE(ca == 1.0); -#pragma GCC diagnostic pop + CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(cr, 0.0f, 0.0f)); + CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(cg, 0.0f, 0.0f)); + CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(cb, 0.0f, 0.0f)); + CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(ca, 1.0f, 0.0f)); } -TEST_CASE("Verify #XXX colors", "[color] [parse]") +CATCH_TEST_CASE("Verify #XXX colors", "[color] [parse]") { for(int i(0); i < 0x1000; ++i) { @@ -252,28 +271,25 @@ TEST_CASE("Verify #XXX colors", "[color] [parse]") ss << std::hex << static_cast(r) << static_cast(g) << static_cast(b); csspp::color c; - REQUIRE(c.set_color(ss.str(), false)); + CATCH_REQUIRE(c.set_color(ss.str(), false)); - REQUIRE(c.get_color() == (r * 0x11) + (g * 0x1100) + (b * 0x110000) + 0xFF000000); - REQUIRE(c.is_solid()); - REQUIRE(!c.is_transparent()); + CATCH_REQUIRE(c.get_color() == (r * 0x11) + (g * 0x1100) + (b * 0x110000) + 0xFF000000); + CATCH_REQUIRE(c.is_solid()); + CATCH_REQUIRE(!c.is_transparent()); csspp::color_component_t cr; csspp::color_component_t cg; csspp::color_component_t cb; csspp::color_component_t ca; c.get_color(cr, cg, cb, ca); - REQUIRE((fabs(cr - (r * 0x11) / 255.0) < 0.0001)); - REQUIRE((fabs(cg - (g * 0x11) / 255.0) < 0.0001)); - REQUIRE((fabs(cb - (b * 0x11) / 255.0) < 0.0001)); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wfloat-equal" - REQUIRE(ca == 1.0); -#pragma GCC diagnostic pop + CATCH_REQUIRE((fabs(cr - (r * 0x11U) / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cg - (g * 0x11U) / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cb - (b * 0x11U) / 255.0) < 0.0001)); + CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(ca, 1.0f, 0.0f)); } } -TEST_CASE("Verify #XXXXXX colors", "[color] [parse]") +CATCH_TEST_CASE("Verify #XXXXXX colors", "[color] [parse]") { for(int i(0); i < 0x1000000; i += rand() % 2000 + 1) { @@ -288,28 +304,25 @@ TEST_CASE("Verify #XXXXXX colors", "[color] [parse]") << std::setw(2) << static_cast(b); csspp::color c; - REQUIRE(c.set_color(ss.str(), false)); + CATCH_REQUIRE(c.set_color(ss.str(), false)); - REQUIRE(c.get_color() == (r * 0x1) + (g * 0x100) + (b * 0x10000) + 0xFF000000); - REQUIRE(c.is_solid()); - REQUIRE(!c.is_transparent()); + CATCH_REQUIRE(c.get_color() == (r * 0x1) + (g * 0x100) + (b * 0x10000) + 0xFF000000); + CATCH_REQUIRE(c.is_solid()); + CATCH_REQUIRE(!c.is_transparent()); csspp::color_component_t cr; csspp::color_component_t cg; csspp::color_component_t cb; csspp::color_component_t ca; c.get_color(cr, cg, cb, ca); - REQUIRE((fabs(cr - r / 255.0) < 0.0001)); - REQUIRE((fabs(cg - g / 255.0) < 0.0001)); - REQUIRE((fabs(cb - b / 255.0) < 0.0001)); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wfloat-equal" - REQUIRE(ca == 1.0); -#pragma GCC diagnostic pop + CATCH_REQUIRE((fabs(cr - r / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cg - g / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cb - b / 255.0) < 0.0001)); + CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(ca, 1.0f, 0.0f)); } } -TEST_CASE("Verify named colors", "[color] [parse]") +CATCH_TEST_CASE("Verify named colors", "[color] [parse]") { // we got raw data here, parse it and make sure it is equal to // what our library produces @@ -329,7 +342,7 @@ TEST_CASE("Verify named colors", "[color] [parse]") for(; *s == ' '; ++s); // read the hash - REQUIRE(*s == '#'); + CATCH_REQUIRE(*s == '#'); // we do ++s at the start to skip the '#' for(++s; *s != ' '; ++s) { @@ -346,49 +359,43 @@ TEST_CASE("Verify named colors", "[color] [parse]") ++s; // skip the '\n' csspp::color c; - REQUIRE(c.set_color(name, false)); - REQUIRE(c.is_solid()); - REQUIRE(!c.is_transparent()); - REQUIRE(c.get_color() == (r << 0) + (g << 8) + (b << 16) + 0xFF000000); + CATCH_REQUIRE(c.set_color(name, false)); + CATCH_REQUIRE(c.is_solid()); + CATCH_REQUIRE(!c.is_transparent()); + CATCH_REQUIRE(c.get_color() == (r << 0) + (g << 8) + (b << 16) + 0xFF000000); csspp::color_component_t cr; csspp::color_component_t cg; csspp::color_component_t cb; csspp::color_component_t ca; c.get_color(cr, cg, cb, ca); - REQUIRE((fabs(cr - r / 255.0) < 0.0001)); - REQUIRE((fabs(cg - g / 255.0) < 0.0001)); - REQUIRE((fabs(cb - b / 255.0) < 0.0001)); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wfloat-equal" - REQUIRE(ca == 1.0); -#pragma GCC diagnostic pop + CATCH_REQUIRE((fabs(cr - r / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cg - g / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cb - b / 255.0) < 0.0001)); + CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(ca, 1.0f, 0.0f)); } // verify the transparent color { csspp::color c; - REQUIRE(c.set_color("transparent", false)); - REQUIRE(!c.is_solid()); - REQUIRE(c.is_transparent()); - REQUIRE(c.get_color() == 0); + CATCH_REQUIRE(c.set_color("transparent", false)); + CATCH_REQUIRE(!c.is_solid()); + CATCH_REQUIRE(c.is_transparent()); + CATCH_REQUIRE(c.get_color() == 0); csspp::color_component_t cr; csspp::color_component_t cg; csspp::color_component_t cb; csspp::color_component_t ca; c.get_color(cr, cg, cb, ca); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wfloat-equal" - REQUIRE(cr == 0.0); - REQUIRE(cg == 0.0); - REQUIRE(cb == 0.0); - REQUIRE(ca == 0.0); -#pragma GCC diagnostic pop + CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(cr, 0.0f, 0.0f)); + CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(cg, 0.0f, 0.0f)); + CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(cb, 0.0f, 0.0f)); + CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(ca, 0.0f, 0.0f)); } } -TEST_CASE("Direct colors", "[color]") +CATCH_TEST_CASE("Direct colors", "[color]") { for(int i(0); i < 1000; ++i) { @@ -399,23 +406,23 @@ TEST_CASE("Direct colors", "[color]") csspp::color c; c.set_color(r, g, b, a); - REQUIRE(c.get_color() == (r * 0x1) + (g * 0x100) + (b * 0x10000) + (a * 0x1000000)); + CATCH_REQUIRE(c.get_color() == (r * 0x1U) + (g * 0x100U) + (b * 0x10000U) + (a * 0x1000000U)); - if(a == 255) + if(a == 255U) { - REQUIRE(c.is_solid()); + CATCH_REQUIRE(c.is_solid()); } else { - REQUIRE(!c.is_solid()); + CATCH_REQUIRE(!c.is_solid()); } - if(a == 0) + if(a == 0U) { - REQUIRE(c.is_transparent()); + CATCH_REQUIRE(c.is_transparent()); } else { - REQUIRE(!c.is_transparent()); + CATCH_REQUIRE(!c.is_transparent()); } csspp::color_component_t cr; @@ -423,182 +430,182 @@ TEST_CASE("Direct colors", "[color]") csspp::color_component_t cb; csspp::color_component_t ca; c.get_color(cr, cg, cb, ca); - REQUIRE((fabs(cr - r / 255.0) < 0.0001)); - REQUIRE((fabs(cg - g / 255.0) < 0.0001)); - REQUIRE((fabs(cb - b / 255.0) < 0.0001)); - REQUIRE((fabs(ca - a / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cr - r / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cg - g / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cb - b / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(ca - a / 255.0) < 0.0001)); // try again with one uint32_t value - c.set_color((r * 0x1) + (g * 0x100) + (b * 0x10000) + (a * 0x1000000)); - REQUIRE(c.get_color() == (r * 0x1) + (g * 0x100) + (b * 0x10000) + (a * 0x1000000)); + c.set_color((r * 0x1U) + (g * 0x100U) + (b * 0x10000U) + (a * 0x1000000U)); + CATCH_REQUIRE(c.get_color() == (r * 0x1U) + (g * 0x100U) + (b * 0x10000U) + (a * 0x1000000U)); - if(a == 255) + if(a == 255U) { - REQUIRE(c.is_solid()); + CATCH_REQUIRE(c.is_solid()); } else { - REQUIRE(!c.is_solid()); + CATCH_REQUIRE(!c.is_solid()); } - if(a == 0) + if(a == 0U) { - REQUIRE(c.is_transparent()); + CATCH_REQUIRE(c.is_transparent()); } else { - REQUIRE(!c.is_transparent()); + CATCH_REQUIRE(!c.is_transparent()); } c.get_color(cr, cg, cb, ca); - REQUIRE((fabs(cr - r / 255.0) < 0.0001)); - REQUIRE((fabs(cg - g / 255.0) < 0.0001)); - REQUIRE((fabs(cb - b / 255.0) < 0.0001)); - REQUIRE((fabs(ca - a / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cr - r / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cg - g / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cb - b / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(ca - a / 255.0) < 0.0001)); // try again with component values c.set_color(static_cast(r / 255.0), static_cast(g / 255.0), static_cast(b / 255.0), static_cast(a / 255.0)); - REQUIRE(c.get_color() == (r * 0x1) + (g * 0x100) + (b * 0x10000) + (a * 0x1000000)); + CATCH_REQUIRE(c.get_color() == (r * 0x1U) + (g * 0x100U) + (b * 0x10000U) + (a * 0x1000000U)); - if(a == 255) + if(a == 255U) { - REQUIRE(c.is_solid()); + CATCH_REQUIRE(c.is_solid()); } else { - REQUIRE(!c.is_solid()); + CATCH_REQUIRE(!c.is_solid()); } - if(a == 0) + if(a == 0U) { - REQUIRE(c.is_transparent()); + CATCH_REQUIRE(c.is_transparent()); } else { - REQUIRE(!c.is_transparent()); + CATCH_REQUIRE(!c.is_transparent()); } c.get_color(cr, cg, cb, ca); - REQUIRE((fabs(cr - r / 255.0) < 0.0001)); - REQUIRE((fabs(cg - g / 255.0) < 0.0001)); - REQUIRE((fabs(cb - b / 255.0) < 0.0001)); - REQUIRE((fabs(ca - a / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cr - r / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cg - g / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cb - b / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(ca - a / 255.0) < 0.0001)); // try again with doubles c.set_color(r / 255.0, g / 255.0, b / 255.0, a / 255.0); - REQUIRE(c.get_color() == (r * 0x1) + (g * 0x100) + (b * 0x10000) + (a * 0x1000000)); + CATCH_REQUIRE(c.get_color() == (r * 0x1U) + (g * 0x100U) + (b * 0x10000U) + (a * 0x1000000U)); - if(a == 255) + if(a == 255U) { - REQUIRE(c.is_solid()); + CATCH_REQUIRE(c.is_solid()); } else { - REQUIRE(!c.is_solid()); + CATCH_REQUIRE(!c.is_solid()); } - if(a == 0) + if(a == 0U) { - REQUIRE(c.is_transparent()); + CATCH_REQUIRE(c.is_transparent()); } else { - REQUIRE(!c.is_transparent()); + CATCH_REQUIRE(!c.is_transparent()); } c.get_color(cr, cg, cb, ca); - REQUIRE((fabs(cr - r / 255.0) < 0.0001)); - REQUIRE((fabs(cg - g / 255.0) < 0.0001)); - REQUIRE((fabs(cb - b / 255.0) < 0.0001)); - REQUIRE((fabs(ca - a / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cr - r / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cg - g / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cb - b / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(ca - a / 255.0) < 0.0001)); // make sure no clamping happens on the floating point numbers c.set_color(r / -255.0, g + 265.0, b / 255.0, a / 255.0); - REQUIRE(c.get_color() == (0 * 0x1) + (0xFF00) + (b * 0x10000) + (a * 0x1000000)); + CATCH_REQUIRE(c.get_color() == (0 * 0x1U) + (0xFF00U) + (b * 0x10000U) + (a * 0x1000000U)); - if(a == 255) + if(a == 255U) { - REQUIRE(c.is_solid()); + CATCH_REQUIRE(c.is_solid()); } else { - REQUIRE(!c.is_solid()); + CATCH_REQUIRE(!c.is_solid()); } - if(a == 0) + if(a == 0U) { - REQUIRE(c.is_transparent()); + CATCH_REQUIRE(c.is_transparent()); } else { - REQUIRE(!c.is_transparent()); + CATCH_REQUIRE(!c.is_transparent()); } c.get_color(cr, cg, cb, ca); - REQUIRE((fabs(cr - r / -255.0) < 0.0001)); - REQUIRE((fabs(cg - (g + 265.0)) < 0.0001)); - REQUIRE((fabs(cb - b / 255.0) < 0.0001)); - REQUIRE((fabs(ca - a / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cr - r / -255.0) < 0.0001)); + CATCH_REQUIRE((fabs(cg - (g + 265.0)) < 0.0001)); + CATCH_REQUIRE((fabs(cb - b / 255.0) < 0.0001)); + CATCH_REQUIRE((fabs(ca - a / 255.0) < 0.0001)); } } -TEST_CASE("HSLA colors", "[color]") +CATCH_TEST_CASE("HSLA colors", "[color]") { csspp::color c; // red c.set_hsl(0.0 * M_PI / 180.0, 1.0, 0.5, 1.0); - REQUIRE(c.get_color() == 0xFF0000FF); + CATCH_REQUIRE(c.get_color() == 0xFF0000FFU); // lime c.set_hsl(120.0 * M_PI / 180.0, 1.0, 0.5, 1.0); - REQUIRE(c.get_color() == 0xFF00FF00); + CATCH_REQUIRE(c.get_color() == 0xFF00FF00U); // darkgreen c.set_hsl(120.0 * M_PI / 180.0, 1.0, 0.25, 1.0); - REQUIRE(c.get_color() == 0xFF008000); + CATCH_REQUIRE(c.get_color() == 0xFF008000U); // lightgreen c.set_hsl(120.0 * M_PI / 180.0, 1.0, 0.75, 1.0); - REQUIRE(c.get_color() == 0xFF80FF80); + CATCH_REQUIRE(c.get_color() == 0xFF80FF80U); // blue c.set_hsl(120.0 * M_PI / 180.0, 1.0, 0.5, 0.5); - REQUIRE(c.get_color() == 0x8000FF00); + CATCH_REQUIRE(c.get_color() == 0x8000FF00U); // orange c.set_hsl(30.0 * M_PI / 180.0, 1.0, 0.5, 0.5); - REQUIRE(c.get_color() == 0x800080FF); + CATCH_REQUIRE(c.get_color() == 0x800080FFU); for(int i(0); i < 100; ++i) { // black c.set_hsl(rand() % 3600 * M_PI / 180.0, 0.0, 0.0, 0.5); - REQUIRE(c.get_color() == 0x80000000); + CATCH_REQUIRE(c.get_color() == 0x80000000U); // white c.set_hsl(rand() % 3600 * M_PI / 180.0, 0.0, 1.0, 0.5); - REQUIRE(c.get_color() == 0x80FFFFFF); + CATCH_REQUIRE(c.get_color() == 0x80FFFFFFU); // gray c.set_hsl(rand() % 3600 * M_PI / 180.0, 0.0, 0.5, 0.5); - REQUIRE(c.get_color() == 0x80808080); + CATCH_REQUIRE(c.get_color() == 0x80808080U); } // ... c.set_hsl(61.8 * M_PI / 180.0, 0.638, 0.393, 0.25); - REQUIRE(c.get_color() == 0x4024A4A0); + CATCH_REQUIRE(c.get_color() == 0x4024A4A0U); // ... c.set_hsl(162.4 * M_PI / 180.0, 0.779, 0.447, 0.25); - REQUIRE(c.get_color() == 0x4097CB19); + CATCH_REQUIRE(c.get_color() == 0x4097CB19U); // ... c.set_hsl(180.0 * M_PI / 180.0, 1.0, 0.75, 0.75); - REQUIRE(c.get_color() == 0xBFFFFF80); + CATCH_REQUIRE(c.get_color() == 0xBFFFFF80U); // ... c.set_hsl(251.1 * M_PI / 180.0, 0.832, 0.511, 0.75); - REQUIRE(c.get_color() == 0xBFEA1B41); + CATCH_REQUIRE(c.get_color() == 0xBFEA1B41U); // ... // helper computation to make sure the assembler tests work as expected @@ -612,15 +619,15 @@ TEST_CASE("HSLA colors", "[color]") // add 180deg to the hue c.set_hsl(hue + M_PI, saturation, lightness, alpha); - REQUIRE(c.get_color() == 0xFFF7F6CF); + CATCH_REQUIRE(c.get_color() == 0xFFF7F6CFU); // darken by 3% c.set_hsl(hue, saturation, lightness - 0.03, alpha); - REQUIRE(c.get_color() == 0xFFC2C3F5); + CATCH_REQUIRE(c.get_color() == 0xFFC2C3F5U); // desaturate by 5% c.set_hsl(hue, saturation - 0.05, lightness, alpha); - REQUIRE(c.get_color() == 0xFFD0D1F6); + CATCH_REQUIRE(c.get_color() == 0xFFD0D1F6U); } // ... @@ -635,12 +642,12 @@ TEST_CASE("HSLA colors", "[color]") // add 180deg to the hue c.set_hsl(hue + M_PI, saturation, lightness, alpha); - REQUIRE(c.get_color() == 0xFF6A56AF); + CATCH_REQUIRE(c.get_color() == 0xFF6A56AFU); } // ... c.set_hsl(-251.1 * M_PI / 180.0, 0.832, 0.511, 0.75); - REQUIRE(c.get_color() == 0xBF1B1B1B); + CATCH_REQUIRE(c.get_color() == 0xBF1B1B1BU); { csspp::color_component_t hue; csspp::color_component_t saturation; @@ -715,7 +722,7 @@ TEST_CASE("HSLA colors", "[color]") csspp::color_component_t lightness; csspp::color_component_t hsl_alpha; c.get_hsl(hue, saturation, lightness, hsl_alpha); - REQUIRE(fabs(hsl_alpha - alpha / 255.0) < 0.00001); + CATCH_REQUIRE(fabs(hsl_alpha - alpha / 255.0) < 0.00001); // setting those values back must resolve to the // exact same RGBA as what we defined earlier @@ -726,10 +733,10 @@ TEST_CASE("HSLA colors", "[color]") csspp::byte_component_t g((col >> 8) & 255); csspp::byte_component_t b((col >> 16) & 255); csspp::byte_component_t a((col >> 24) & 255); - REQUIRE(r == red ); - REQUIRE(g == green); - REQUIRE(b == blue ); - REQUIRE(a == alpha); + CATCH_REQUIRE(r == red ); + CATCH_REQUIRE(g == green); + CATCH_REQUIRE(b == blue ); + CATCH_REQUIRE(a == alpha); // if(red - green >= 10 // || red - blue >= 10 @@ -740,7 +747,7 @@ TEST_CASE("HSLA colors", "[color]") // csspp::color_component_t new_saturation; // csspp::color_component_t new_lightness; // c.get_hsl(new_hue, new_saturation, new_lightness, hsl_alpha); -// REQUIRE(fabs(hsl_alpha - alpha / 255.0) < 0.00001); +// CATCH_REQUIRE(fabs(hsl_alpha - alpha / 255.0) < 0.00001); // // // hue is not considered valid when RGB are equal // double hue_diff(fabs(fabs(hue - new_hue) - 180.0)); @@ -749,7 +756,7 @@ TEST_CASE("HSLA colors", "[color]") ////std::cerr << "rgb: " << static_cast(r) << ", " << static_cast(g) << ", " << static_cast(b) //// << " old hue: " << hue << " & new hue: " << new_hue << " diff = " << fabs(new_hue - hue) << " delta " << fabs(fabs(new_hue - hue) - 180.0) << "\n"; ////} -// REQUIRE(hue_diff <= 0.0001); +// CATCH_REQUIRE(hue_diff <= 0.0001); // // // restore the color to test the adjust_hue() function // c.set_hsl(hue, saturation, lightness, hsl_alpha); @@ -760,7 +767,7 @@ TEST_CASE("HSLA colors", "[color]") ////{ ////std::cerr << "old saturation: " << saturation << " -> " << new_saturation << " diff = " << fabs(new_saturation - saturation) << "\n"; ////} -// REQUIRE(saturation_diff < 0.0001); +// CATCH_REQUIRE(saturation_diff < 0.0001); // // // restore the color to test the adjust_lightness() function // c.set_hsl(hue, saturation, lightness, hsl_alpha); @@ -771,12 +778,12 @@ TEST_CASE("HSLA colors", "[color]") ////{ ////std::cerr << "old lightness: " << lightness << " -> " << new_lightness << " diff = " << fabs(new_lightness - lightness) << "\n"; ////} -// REQUIRE(lightness_diff < 0.0001); +// CATCH_REQUIRE(lightness_diff < 0.0001); // } } } -TEST_CASE("Color to string", "[color] [output]") +CATCH_TEST_CASE("Color to string", "[color] [output]") { csspp::color c; @@ -786,73 +793,73 @@ TEST_CASE("Color to string", "[color] [output]") static_cast(0xC0), static_cast(0xC0), static_cast(0xFF)); - REQUIRE(c.to_string() == "silver"); + CATCH_REQUIRE(c.to_string() == "silver"); c.set_color(static_cast(0x80), static_cast(0x80), static_cast(0x80), static_cast(0xFF)); - REQUIRE(c.to_string() == "gray"); + CATCH_REQUIRE(c.to_string() == "gray"); c.set_color(static_cast(0x80), static_cast(0x00), static_cast(0x00), static_cast(0xFF)); - REQUIRE(c.to_string() == "maroon"); + CATCH_REQUIRE(c.to_string() == "maroon"); c.set_color(static_cast(0xFF), static_cast(0x00), static_cast(0x00), static_cast(0xFF)); - REQUIRE(c.to_string() == "red"); + CATCH_REQUIRE(c.to_string() == "red"); c.set_color(static_cast(0x80), static_cast(0x00), static_cast(0x80), static_cast(0xFF)); - REQUIRE(c.to_string() == "purple"); + CATCH_REQUIRE(c.to_string() == "purple"); c.set_color(static_cast(0x00), static_cast(0x80), static_cast(0x00), static_cast(0xFF)); - REQUIRE(c.to_string() == "green"); + CATCH_REQUIRE(c.to_string() == "green"); c.set_color(static_cast(0x00), static_cast(0xFF), static_cast(0x00), static_cast(0xFF)); - REQUIRE(c.to_string() == "lime"); + CATCH_REQUIRE(c.to_string() == "lime"); c.set_color(static_cast(0x80), static_cast(0x80), static_cast(0x00), static_cast(0xFF)); - REQUIRE(c.to_string() == "olive"); + CATCH_REQUIRE(c.to_string() == "olive"); c.set_color(static_cast(0x00), static_cast(0x00), static_cast(0x80), static_cast(0xFF)); - REQUIRE(c.to_string() == "navy"); + CATCH_REQUIRE(c.to_string() == "navy"); c.set_color(static_cast(0x00), static_cast(0x00), static_cast(0xFF), static_cast(0xFF)); - REQUIRE(c.to_string() == "blue"); + CATCH_REQUIRE(c.to_string() == "blue"); c.set_color(static_cast(0x00), static_cast(0x80), static_cast(0x80), static_cast(0xFF)); - REQUIRE(c.to_string() == "teal"); + CATCH_REQUIRE(c.to_string() == "teal"); c.set_color(static_cast(0x00), static_cast(0xFF), static_cast(0xFF), static_cast(0xFF)); - REQUIRE(c.to_string() == "aqua"); + CATCH_REQUIRE(c.to_string() == "aqua"); } // #XXX cases -- none are special cases @@ -865,19 +872,19 @@ TEST_CASE("Color to string", "[color] [output]") switch(c.get_color()) { case (255U << 0) | (0U << 8) | (0U << 16) | (255U << 24): - REQUIRE(c.to_string() == "red"); + CATCH_REQUIRE(c.to_string() == "red"); break; case (0U << 0) | (255U << 8) | (0U << 16) | (255U << 24): - REQUIRE(c.to_string() == "lime"); + CATCH_REQUIRE(c.to_string() == "lime"); break; case (0U << 0) | (0U << 8) | (255U << 16) | (255U << 24): - REQUIRE(c.to_string() == "blue"); + CATCH_REQUIRE(c.to_string() == "blue"); break; case (0U << 0) | (255U << 8) | (255U << 16) | (255U << 24): - REQUIRE(c.to_string() == "aqua"); + CATCH_REQUIRE(c.to_string() == "aqua"); break; default: @@ -887,7 +894,7 @@ TEST_CASE("Color to string", "[color] [output]") << static_cast((i >> 0) & 15) << static_cast((i >> 4) & 15) << static_cast((i >> 8) & 15); - REQUIRE(c.to_string() == ss.str()); + CATCH_REQUIRE(c.to_string() == ss.str()); } break; @@ -943,7 +950,7 @@ TEST_CASE("Color to string", "[color] [output]") << std::setw(2) << static_cast(r) << std::setw(2) << static_cast(g) << std::setw(2) << static_cast(b); - REQUIRE(c.to_string() == ss.str()); + CATCH_REQUIRE(c.to_string() == ss.str()); } // transparent special case @@ -952,11 +959,11 @@ TEST_CASE("Color to string", "[color] [output]") static_cast(0), static_cast(0), static_cast(0)); - REQUIRE(c.to_string() == "transparent"); + CATCH_REQUIRE(c.to_string() == "transparent"); } // rgba() - for(uint32_t i(0); i < 0x1000000; i += rand() % 500 + 1) + for(uint32_t i(0); i < 0x1000000U; i += rand() % 500 + 1) { csspp::byte_component_t const r((i >> 0) & 255); csspp::byte_component_t const g((i >> 0) & 255); @@ -971,15 +978,8 @@ TEST_CASE("Color to string", "[color] [output]") << "," << static_cast(b) << "," << csspp::decimal_number_to_string(static_cast(a) / 255.0, true) << ")"; - REQUIRE(c.to_string() == ss.str()); + CATCH_REQUIRE(c.to_string() == ss.str()); } } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_compiler.cpp b/tests/catch_compiler.cpp index 3430d07..8d20dc0 100644 --- a/tests/catch_compiler.cpp +++ b/tests/catch_compiler.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the compiler.cpp file. @@ -23,20 +25,36 @@ * CSS Preprocessor extensions. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" -#include "csspp/compiler.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include -#include -#include +// csspp lib +// +#include +#include +#include + + +// C++ lib +// +#include +#include +#include + + +// C lib +// +#include +#include +#include + + +// last include +// +#include -#include -#include -#include -#include void free_char(char * ptr) @@ -44,13 +62,13 @@ void free_char(char * ptr) free(ptr); } -TEST_CASE("Compile set_date_time_variables() called too soon", "[compiler] [invalid]") +CATCH_TEST_CASE("Compile set_date_time_variables() called too soon", "[compiler] [invalid]") { csspp::compiler c; - REQUIRE_THROWS_AS(c.set_date_time_variables(csspp_test::get_now()), csspp::csspp_exception_logic &); + CATCH_REQUIRE_THROWS_AS(c.set_date_time_variables(csspp_test::get_now()), csspp::csspp_exception_logic); } -TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") +CATCH_TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") { // with many spaces { @@ -66,7 +84,7 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -81,7 +99,7 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -130,9 +148,9 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // without spaces @@ -149,7 +167,7 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -164,7 +182,7 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -213,9 +231,9 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // rules with !important @@ -230,7 +248,7 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -245,7 +263,7 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -263,9 +281,9 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // rules with ! important @@ -280,7 +298,7 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -295,7 +313,7 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -313,9 +331,9 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // rules with !important and no spaces @@ -330,7 +348,7 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -345,7 +363,7 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -363,9 +381,9 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // empty rules have to compile too @@ -382,7 +400,7 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -397,7 +415,7 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() @@ -406,9 +424,9 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // special IE8 value which has to be skipped @@ -428,7 +446,7 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -440,7 +458,7 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") c.compile(false); // no error left over - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(4): warning: the alpha(), chroma() and similar functions of the filter field are Internet Explorer specific extensions which are not supported across browsers.\n" "test.css(5): warning: the alpha(), chroma() and similar functions of the filter field are Internet Explorer specific extensions which are not supported across browsers.\n" ); @@ -449,7 +467,7 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -487,9 +505,9 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // a simple test with '--no-logo' specified @@ -507,7 +525,7 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -522,11 +540,11 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables(csspp_test::flag_no_logo_true) + @@ -543,15 +561,15 @@ TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } -TEST_CASE("Compile user defined functions", "[compiler] [function]") +CATCH_TEST_CASE("Compile user defined functions", "[compiler] [function]") { - SECTION("deg2rad() function and translate() CSS function") + CATCH_START_SECTION("deg2rad() function and translate() CSS function") { std::stringstream ss; ss << "/* testing user defined functions */\n" @@ -566,7 +584,7 @@ TEST_CASE("Compile user defined functions", "[compiler] [function]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -581,7 +599,7 @@ TEST_CASE("Compile user defined functions", "[compiler] [function]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -611,12 +629,13 @@ TEST_CASE("Compile user defined functions", "[compiler] [function]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("define an $undefined variable but no undefined() function") + CATCH_START_SECTION("define an $undefined variable but no undefined() function") { // this is not invalid, until we check for all the CSS function names std::stringstream ss; @@ -632,7 +651,7 @@ TEST_CASE("Compile user defined functions", "[compiler] [function]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -647,7 +666,7 @@ TEST_CASE("Compile user defined functions", "[compiler] [function]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -670,12 +689,13 @@ TEST_CASE("Compile user defined functions", "[compiler] [function]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("function with default parameters") + CATCH_START_SECTION("function with default parameters") { // this is not invalid, until we check for all the CSS function names std::stringstream ss; @@ -690,7 +710,7 @@ TEST_CASE("Compile user defined functions", "[compiler] [function]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -705,7 +725,7 @@ TEST_CASE("Compile user defined functions", "[compiler] [function]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -722,12 +742,13 @@ TEST_CASE("Compile user defined functions", "[compiler] [function]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("function with *complex* default parameter") + CATCH_START_SECTION("function with *complex* default parameter") { // this is not invalid, until we check for all the CSS function names std::stringstream ss; @@ -743,7 +764,7 @@ TEST_CASE("Compile user defined functions", "[compiler] [function]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -758,7 +779,7 @@ TEST_CASE("Compile user defined functions", "[compiler] [function]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -791,12 +812,13 @@ TEST_CASE("Compile user defined functions", "[compiler] [function]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("function called with a *complex* parameter") + CATCH_START_SECTION("function called with a *complex* parameter") { // this is not invalid, until we check for all the CSS function names std::stringstream ss; @@ -812,7 +834,7 @@ TEST_CASE("Compile user defined functions", "[compiler] [function]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -827,7 +849,7 @@ TEST_CASE("Compile user defined functions", "[compiler] [function]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -853,15 +875,16 @@ TEST_CASE("Compile user defined functions", "[compiler] [function]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() } -TEST_CASE("Compile invalid declaration in link with user defined functions", "[compiler] [invalid] [function]") +CATCH_TEST_CASE("Compile invalid declaration in link with user defined functions", "[compiler] [invalid] [function]") { - SECTION("attempt to call a function with an invalid definition") + CATCH_START_SECTION("attempt to call a function with an invalid definition") { std::stringstream ss; ss << "/* testing user defined functions */\n" @@ -876,7 +899,7 @@ TEST_CASE("Compile invalid declaration in link with user defined functions", "[c csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -890,12 +913,13 @@ TEST_CASE("Compile invalid declaration in link with user defined functions", "[c //std::cerr << "Result is: [" << *c.get_root() << "]\n"; // no error left over - REQUIRE_ERRORS("test.css(2): error: function declarations expect variables for each of their arguments, not a IDENTIFIER.\n"); + VERIFY_ERRORS("test.css(2): error: function declarations expect variables for each of their arguments, not a IDENTIFIER.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("attempt to call a function with a missing argument") + CATCH_START_SECTION("attempt to call a function with a missing argument") { std::stringstream ss; ss << "/* testing user defined functions */\n" @@ -909,7 +933,7 @@ TEST_CASE("Compile invalid declaration in link with user defined functions", "[c csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -923,12 +947,13 @@ TEST_CASE("Compile invalid declaration in link with user defined functions", "[c //std::cerr << "Result is: [" << *c.get_root() << "]\n"; // no error left over - REQUIRE_ERRORS("scripts/system/functions.scss(39): error: missing function variable named \"percent\" when calling desaturate();.\n"); + VERIFY_ERRORS("scripts/system/functions.scss(39): error: missing function variable named \"percent\" when calling desaturate();.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("@return is empty") + CATCH_START_SECTION("@return is empty") { std::stringstream ss; ss << "/* testing user defined functions */\n" @@ -943,7 +968,7 @@ TEST_CASE("Compile invalid declaration in link with user defined functions", "[c csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -957,12 +982,13 @@ TEST_CASE("Compile invalid declaration in link with user defined functions", "[c //std::cerr << "Result is: [" << *c.get_root() << "]\n"; // no error left over - REQUIRE_ERRORS("test.css(2): error: @return must be followed by a valid expression.\n"); + VERIFY_ERRORS("test.css(2): error: @return must be followed by a valid expression.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("@return with an invalid expression") + CATCH_START_SECTION("@return with an invalid expression") { std::stringstream ss; ss << "/* testing user defined functions */\n" @@ -977,7 +1003,7 @@ TEST_CASE("Compile invalid declaration in link with user defined functions", "[c csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -991,15 +1017,16 @@ TEST_CASE("Compile invalid declaration in link with user defined functions", "[c //std::cerr << "Result is: [" << *c.get_root() << "]\n"; // no error left over - REQUIRE_ERRORS("test.css(2): error: unsupported type EOF_TOKEN as a unary expression token.\n"); + VERIFY_ERRORS("test.css(2): error: unsupported type EOF_TOKEN as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Check all argify", "[compiler] [stylesheet]") +CATCH_TEST_CASE("Check all argify", "[compiler] [stylesheet]") { // valid argify with/without spaces { @@ -1020,7 +1047,7 @@ TEST_CASE("Check all argify", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1034,7 +1061,7 @@ TEST_CASE("Check all argify", "[compiler] [stylesheet]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -1104,9 +1131,9 @@ TEST_CASE("Check all argify", "[compiler] [stylesheet]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // now check declarations with multiple entries like text-shadow @@ -1125,7 +1152,7 @@ TEST_CASE("Check all argify", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1139,7 +1166,7 @@ TEST_CASE("Check all argify", "[compiler] [stylesheet]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -1195,13 +1222,13 @@ TEST_CASE("Check all argify", "[compiler] [stylesheet]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } -TEST_CASE("Invalid arguments", "[compiler] [invalid]") +CATCH_TEST_CASE("Invalid arguments", "[compiler] [invalid]") { // A starting comma is illegal { @@ -1215,7 +1242,7 @@ TEST_CASE("Invalid arguments", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1228,9 +1255,9 @@ TEST_CASE("Invalid arguments", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; // no error left over - REQUIRE_ERRORS("test.css(1): error: dangling comma at the beginning of a list of arguments or selectors.\n"); + VERIFY_ERRORS("test.css(1): error: dangling comma at the beginning of a list of arguments or selectors.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // An ending comma is illegal @@ -1245,7 +1272,7 @@ TEST_CASE("Invalid arguments", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1258,9 +1285,9 @@ TEST_CASE("Invalid arguments", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; // no error left over - REQUIRE_ERRORS("test.css(1): error: dangling comma at the end of a list of arguments or selectors.\n"); + VERIFY_ERRORS("test.css(1): error: dangling comma at the end of a list of arguments or selectors.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // Two commas in a row is illegal @@ -1275,7 +1302,7 @@ TEST_CASE("Invalid arguments", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1288,9 +1315,9 @@ TEST_CASE("Invalid arguments", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; // no error left over - REQUIRE_ERRORS("test.css(1): error: two commas in a row are invalid in a list of arguments or selectors.\n"); + VERIFY_ERRORS("test.css(1): error: two commas in a row are invalid in a list of arguments or selectors.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // Just a comma is illegal @@ -1305,7 +1332,7 @@ TEST_CASE("Invalid arguments", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1318,9 +1345,9 @@ TEST_CASE("Invalid arguments", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; // no error left over - REQUIRE_ERRORS("test.css(1): error: dangling comma at the beginning of a list of arguments or selectors.\n"); + VERIFY_ERRORS("test.css(1): error: dangling comma at the beginning of a list of arguments or selectors.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // A repeated hash @@ -1335,7 +1362,7 @@ TEST_CASE("Invalid arguments", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1347,9 +1374,9 @@ TEST_CASE("Invalid arguments", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: found #color twice in selector: \"#color div #color\".\n"); + VERIFY_ERRORS("test.css(1): error: found #color twice in selector: \"#color div #color\".\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // rules with !important at the wrong place @@ -1364,7 +1391,7 @@ TEST_CASE("Invalid arguments", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1377,11 +1404,11 @@ TEST_CASE("Invalid arguments", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): warning: A special flag, !important in this case, must only appear at the end of a declaration.\n"); + VERIFY_ERRORS("test.css(1): warning: A special flag, !important in this case, must only appear at the end of a declaration.\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1399,16 +1426,16 @@ TEST_CASE("Invalid arguments", "[compiler] [invalid]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Selector attribute tests", "[compiler] [stylesheet] [attribute]") +CATCH_TEST_CASE("Selector attribute tests", "[compiler] [stylesheet] [attribute]") { char const * op[] = { @@ -1472,7 +1499,7 @@ TEST_CASE("Selector attribute tests", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1484,7 +1511,7 @@ TEST_CASE("Selector attribute tests", "[compiler] [stylesheet] [attribute]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; @@ -1503,9 +1530,9 @@ TEST_CASE("Selector attribute tests", "[compiler] [stylesheet] [attribute]") " ARG\n" " COLOR H:ff0000ff\n" ; - REQUIRE_TREES(out.str(), expected.str()); + VERIFY_TREES(out.str(), expected.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } @@ -1551,7 +1578,7 @@ TEST_CASE("Selector attribute tests", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1563,7 +1590,7 @@ TEST_CASE("Selector attribute tests", "[compiler] [stylesheet] [attribute]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; @@ -1584,9 +1611,9 @@ TEST_CASE("Selector attribute tests", "[compiler] [stylesheet] [attribute]") " ARG\n" " COLOR H:ff0000ff\n" ; - REQUIRE_TREES(out.str(), expected.str()); + VERIFY_TREES(out.str(), expected.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } @@ -1620,7 +1647,7 @@ TEST_CASE("Selector attribute tests", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1632,7 +1659,7 @@ TEST_CASE("Selector attribute tests", "[compiler] [stylesheet] [attribute]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; @@ -1649,17 +1676,17 @@ TEST_CASE("Selector attribute tests", "[compiler] [stylesheet] [attribute]") " ARG\n" " COLOR H:ff0000ff\n" ; - REQUIRE_TREES(out.str(), expected.str()); + VERIFY_TREES(out.str(), expected.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } -TEST_CASE("Invalid attributes", "[compiler] [invalid]") +CATCH_TEST_CASE("Invalid attributes", "[compiler] [invalid]") { // attribute name cannot be an integer, decimal number, opening // brackets or parenthesis, delimiter, etc. only an identifier - SECTION("Missing operator or value") + CATCH_START_SECTION("Missing operator or value") { char const * invalid_value[] = { @@ -1709,7 +1736,7 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1721,15 +1748,16 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: an attribute selector expects to first find an identifier.\n"); + VERIFY_ERRORS("test.css(1): error: an attribute selector expects to first find an identifier.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // attribute only accept a very few binary operators: =, |=, ~=, $=, ^=, *= // anything else is an error (including another identifier) - SECTION("Not an attribute operator") + CATCH_START_SECTION("Not an attribute operator") { char const * invalid_value[] = { @@ -1778,7 +1806,7 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1787,15 +1815,16 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: expected attribute operator missing, supported operators are '=', '!=', '~=', '^=', '$=', '*=', and '|='.\n"); + VERIFY_ERRORS("test.css(1): error: expected attribute operator missing, supported operators are '=', '!=', '~=', '^=', '$=', '*=', and '|='.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // attribute and a binary operators: =, |=, ~=, $=, ^=, *= // not followed by any value - SECTION("Valid operators, missing right hand side value") + CATCH_START_SECTION("Valid operators, missing right hand side value") { char const * invalid_value[] = { @@ -1842,7 +1871,7 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1851,15 +1880,16 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: the attribute selector is expected to be an IDENTIFIER optionally followed by an operator and a value.\n"); + VERIFY_ERRORS("test.css(1): error: the attribute selector is expected to be an IDENTIFIER optionally followed by an operator and a value.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // attribute value can only be identifier, string, integer, // and decimal number - SECTION("Valid operators, invalid right hand side value") + CATCH_START_SECTION("Valid operators, invalid right hand side value") { char const * invalid_value[] = { @@ -1914,7 +1944,7 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1938,9 +1968,9 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") errmsg << "test.css(1): error: attribute selector value must be an identifier, a string, an integer, or a decimal number, a " << op_node->get_type() << " is not acceptable.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } for(auto iv : invalid_value) @@ -1956,7 +1986,7 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -1980,9 +2010,9 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") errmsg << "test.css(1): error: attribute selector value must be an identifier, a string, an integer, or a decimal number, a " << op_node->get_type() << " is not acceptable.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } for(auto iv : invalid_value) @@ -1998,7 +2028,7 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -2022,9 +2052,9 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") errmsg << "test.css(1): error: attribute selector value must be an identifier, a string, an integer, or a decimal number, a " << op_node->get_type() << " is not acceptable.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } for(auto iv : invalid_value) @@ -2040,7 +2070,7 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -2064,14 +2094,15 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") errmsg << "test.css(1): error: attribute selector value must be an identifier, a string, an integer, or a decimal number, a " << op_node->get_type() << " is not acceptable.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // attribute value can only be one token - SECTION("Valid operators, right hand side value followed by something") + CATCH_START_SECTION("Valid operators, right hand side value followed by something") { char const * invalid_value[] = { @@ -2138,7 +2169,7 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -2162,9 +2193,9 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") errmsg << "test.css(1): error: attribute selector cannot be followed by more than one value, found " << op_node->get_type() << " after the value, missing quotes?\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } for(auto iv : invalid_value) @@ -2180,7 +2211,7 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -2204,9 +2235,9 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") errmsg << "test.css(1): error: attribute selector cannot be followed by more than one value, found " << op_node->get_type() << " after the value, missing quotes?\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } for(auto iv : invalid_value) @@ -2230,7 +2261,7 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -2254,9 +2285,9 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") errmsg << "test.css(1): error: attribute selector cannot be followed by more than one value, found " << op_node->get_type() << " after the value, missing quotes?\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } for(auto iv : invalid_value) @@ -2272,7 +2303,7 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -2296,14 +2327,15 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") errmsg << "test.css(1): error: attribute selector cannot be followed by more than one value, found " << op_node->get_type() << " after the value, missing quotes?\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // attribute value can only be one token - SECTION("Valid operators, right hand side value missing, no spaces") + CATCH_START_SECTION("Valid operators, right hand side value missing, no spaces") { char const *op[] = { @@ -2329,7 +2361,7 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -2351,9 +2383,9 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") std::stringstream errmsg; errmsg << "test.css(1): error: the attribute selector is expected to be an IDENTIFIER optionally followed by an operator and a value.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } for(auto o : op) @@ -2369,7 +2401,7 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -2391,17 +2423,18 @@ TEST_CASE("Invalid attributes", "[compiler] [invalid]") std::stringstream errmsg; errmsg << "test.css(1): error: the attribute selector is expected to be an IDENTIFIER optionally followed by an operator and a value.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Undefined paths", "[compiler] [invalid]") +CATCH_TEST_CASE("Undefined paths", "[compiler] [invalid]") { // compile without defining the paths // @@ -2419,7 +2452,7 @@ TEST_CASE("Undefined paths", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -2439,7 +2472,7 @@ TEST_CASE("Undefined paths", "[compiler] [invalid]") // that the result is fine std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2457,17 +2490,17 @@ TEST_CASE("Undefined paths", "[compiler] [invalid]") } catch(csspp::csspp_exception_exit const &) { - REQUIRE(ignore.str() == "validation/pseudo-nth-functions(1): fatal: validation script \"validation/pseudo-nth-functions\" was not found.\n"); + CATCH_REQUIRE(ignore.str() == "validation/pseudo-nth-functions(1): fatal: validation script \"validation/pseudo-nth-functions\" was not found.\n"); } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Simple terms", "[compiler] [stylesheet]") +CATCH_TEST_CASE("Simple terms", "[compiler] [stylesheet]") { // simple terms are: // HASH @@ -2496,7 +2529,7 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -2507,13 +2540,13 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") c.compile(true); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *c.get_root() << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2585,9 +2618,9 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // check all pseudo-classes @@ -2628,7 +2661,7 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -2642,7 +2675,7 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2656,11 +2689,11 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // check all pseudo-classes @@ -2701,7 +2734,7 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -2715,7 +2748,7 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2729,11 +2762,11 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // test all nth pseudo-functions @@ -2758,7 +2791,7 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -2769,13 +2802,13 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") c.compile(true); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *c.get_root() << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2796,11 +2829,11 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // test the lang() function @@ -2816,7 +2849,7 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -2827,13 +2860,13 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") c.compile(true); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *c.get_root() << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2855,9 +2888,9 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test the lang() function with 3 parameters @@ -2873,7 +2906,7 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -2884,13 +2917,13 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") c.compile(true); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *c.get_root() << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2912,9 +2945,9 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test the lang() multiple times to verify that the cache works @@ -2930,7 +2963,7 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -2941,13 +2974,13 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") c.compile(true); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *c.get_root() << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2978,9 +3011,9 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // one :not(...) @@ -2995,7 +3028,7 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3009,7 +3042,7 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -3029,9 +3062,9 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") ); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // two :not(...) in a row @@ -3046,7 +3079,7 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3060,7 +3093,7 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -3085,9 +3118,9 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") ); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // two #hash generate an information message @@ -3102,7 +3135,7 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3114,11 +3147,11 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): info: found multiple #id entries, note that in most cases, assuming your HTML is proper (identifiers are not repeated) then only the last #id is necessary.\n"); + VERIFY_ERRORS("test.css(1): info: found multiple #id entries, note that in most cases, assuming your HTML is proper (identifiers are not repeated) then only the last #id is necessary.\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -3137,11 +3170,11 @@ TEST_CASE("Simple terms", "[compiler] [stylesheet]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } -TEST_CASE("Invalid simple terms", "[compiler] [invalid]") +CATCH_TEST_CASE("Invalid simple terms", "[compiler] [invalid]") { // two terms in one :not(...) { @@ -3155,7 +3188,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3165,9 +3198,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: the :not() function accepts at most one simple term.\n"); + VERIFY_ERRORS("test.css(1): error: the :not() function accepts at most one simple term.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // scope must be followed by * or IDENTIFIER @@ -3182,7 +3215,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3192,9 +3225,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: the scope operator (|) requires a right hand side identifier or '*'.\n"); + VERIFY_ERRORS("test.css(1): error: the scope operator (|) requires a right hand side identifier or '*'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // scope must be followed by * or IDENTIFIER @@ -3209,7 +3242,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3219,9 +3252,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: the right hand side of a scope operator (|) must be an identifier or '*'.\n"); + VERIFY_ERRORS("test.css(1): error: the right hand side of a scope operator (|) must be an identifier or '*'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // scope must be followed by * or IDENTIFIER @@ -3236,7 +3269,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3246,9 +3279,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: a scope selector (|) must be followed by an identifier or '*'.\n"); + VERIFY_ERRORS("test.css(1): error: a scope selector (|) must be followed by an identifier or '*'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // scope must be followed by * or IDENTIFIER @@ -3263,7 +3296,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3273,9 +3306,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: the right hand side of a scope operator (|) must be an identifier or '*'.\n"); + VERIFY_ERRORS("test.css(1): error: the right hand side of a scope operator (|) must be an identifier or '*'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // scope must be followed by * or IDENTIFIER @@ -3290,7 +3323,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3300,9 +3333,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: found #hash twice in selector: \"#hash and #hash\".\n"); + VERIFY_ERRORS("test.css(1): error: found #hash twice in selector: \"#hash and #hash\".\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // ':' must be followed by an IDENTIFIER or a FUNCTION @@ -3317,7 +3350,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3327,9 +3360,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: a selector list cannot end with a standalone ':'.\n"); + VERIFY_ERRORS("test.css(1): error: a selector list cannot end with a standalone ':'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // ':' must be followed a known pseudo-class name @@ -3344,7 +3377,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3354,9 +3387,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("scripts/validation/pseudo-classes.scss(38): error: unknown is not a valid name for a pseudo class; CSS only supports root, first-child, last-child, first-of-type, last-of-type, only-child, only-of-type, empty, link, visitived, active, hover, focus, target, enabled, disabled, and checked. (functions are not included in this list since you did not use '(' at the end of the word.)\n"); + VERIFY_ERRORS("scripts/validation/pseudo-classes.scss(38): error: unknown is not a valid name for a pseudo class; CSS only supports root, first-child, last-child, first-of-type, last-of-type, only-child, only-of-type, empty, link, visitived, active, hover, focus, target, enabled, disabled, and checked. (functions are not included in this list since you did not use '(' at the end of the word.)\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // ':' must be followed a known pseudo-function name @@ -3371,7 +3404,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3381,9 +3414,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("scripts/validation/pseudo-functions.scss(20): error: unknown is not a valid name for a pseudo function; CSS only supports lang() and not().\n"); + VERIFY_ERRORS("scripts/validation/pseudo-functions.scss(20): error: unknown is not a valid name for a pseudo function; CSS only supports lang() and not().\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // ':' must be followed an identifier or a function @@ -3398,7 +3431,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3408,9 +3441,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: a ':' selector must be followed by an identifier or a function, a PERIOD was found instead.\n"); + VERIFY_ERRORS("test.css(1): error: a ':' selector must be followed by an identifier or a function, a PERIOD was found instead.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // '>' at the wrong place @@ -3425,7 +3458,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3435,9 +3468,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: found token GREATER_THAN, which is expected to be followed by another selector term.\n"); + VERIFY_ERRORS("test.css(1): error: found token GREATER_THAN, which is expected to be followed by another selector term.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // :not(INTEGER) is not good @@ -3452,7 +3485,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3462,9 +3495,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: found token INTEGER, which is not a valid selector token (simple term).\n"); + VERIFY_ERRORS("test.css(1): error: found token INTEGER, which is not a valid selector token (simple term).\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // :not(FUNCTION) is not good @@ -3479,7 +3512,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3489,9 +3522,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: found function \"func()\", which may be a valid selector token but only if immediately preceeded by one ':' (simple term).\n"); + VERIFY_ERRORS("test.css(1): error: found function \"func()\", which may be a valid selector token but only if immediately preceeded by one ':' (simple term).\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // :not(>) is not good @@ -3506,7 +3539,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3516,9 +3549,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: found token GREATER_THAN, which cannot be used to start a selector expression.\n"); + VERIFY_ERRORS("test.css(1): error: found token GREATER_THAN, which cannot be used to start a selector expression.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // :not(+) is not good @@ -3533,7 +3566,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3543,9 +3576,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: found token ADD, which cannot be used to start a selector expression.\n"); + VERIFY_ERRORS("test.css(1): error: found token ADD, which cannot be used to start a selector expression.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // :not(~) is not good @@ -3560,7 +3593,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3570,9 +3603,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: found token PRECEDED, which cannot be used to start a selector expression.\n"); + VERIFY_ERRORS("test.css(1): error: found token PRECEDED, which cannot be used to start a selector expression.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // :not(:) is not good @@ -3587,7 +3620,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3597,9 +3630,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: a selector list cannot end with a standalone ':'.\n"); + VERIFY_ERRORS("test.css(1): error: a selector list cannot end with a standalone ':'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // '.' by itself (at the end) @@ -3614,7 +3647,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3624,9 +3657,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: a selector list cannot end with a standalone '.'.\n"); + VERIFY_ERRORS("test.css(1): error: a selector list cannot end with a standalone '.'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // '.' must be followed by IDENTIFIER @@ -3641,7 +3674,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3651,9 +3684,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: a class selector (after a period: '.') must be an identifier.\n"); + VERIFY_ERRORS("test.css(1): error: a class selector (after a period: '.') must be an identifier.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test an invalid An+B in an :nth-child() function @@ -3668,7 +3701,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3678,9 +3711,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: The first number has to be followed by the 'n' character.\n"); + VERIFY_ERRORS("test.css(1): error: The first number has to be followed by the 'n' character.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // :not(:not(...)) @@ -3695,7 +3728,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3705,9 +3738,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: the :not() selector does not accept an inner :not().\n"); + VERIFY_ERRORS("test.css(1): error: the :not() selector does not accept an inner :not().\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // :not(:.white) @@ -3722,7 +3755,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3732,9 +3765,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: a ':' selector must be followed by an identifier or a function, a FUNCTION was found instead.\n"); + VERIFY_ERRORS("test.css(1): error: a ':' selector must be followed by an identifier or a function, a FUNCTION was found instead.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // :lang() accepts only one argument @@ -3749,7 +3782,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3761,9 +3794,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a lang() function selector must have exactly one identifier as its parameter.\n"); + VERIFY_ERRORS("test.css(1): error: a lang() function selector must have exactly one identifier as its parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // invalid name for :lang() @@ -3778,7 +3811,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3790,9 +3823,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("scripts/validation/languages.scss(154): error: notalanguagename is not a valid language name for :lang().\n"); + VERIFY_ERRORS("scripts/validation/languages.scss(154): error: notalanguagename is not a valid language name for :lang().\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // invalid name for :lang(), with a valid country @@ -3807,7 +3840,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3819,9 +3852,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("scripts/validation/languages.scss(154): error: stillnotalanguagename is not a valid language name for :lang().\n"); + VERIFY_ERRORS("scripts/validation/languages.scss(154): error: stillnotalanguagename is not a valid language name for :lang().\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // invalid name for :lang(), with a valid country @@ -3836,7 +3869,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3848,9 +3881,9 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("scripts/validation/countries.scss(267): error: withaninvalidcountry is not a valid country name for :lang().\n"); + VERIFY_ERRORS("scripts/validation/countries.scss(267): error: withaninvalidcountry is not a valid country name for :lang().\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // :lang() name must be an identifier @@ -3865,7 +3898,7 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3877,16 +3910,16 @@ TEST_CASE("Invalid simple terms", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a lang() function selector expects an identifier as its parameter.\n"); + VERIFY_ERRORS("test.css(1): error: a lang() function selector expects an identifier as its parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Complex terms", "[compiler] [stylesheet]") +CATCH_TEST_CASE("Complex terms", "[compiler] [stylesheet]") { // [complex] terms are: // term: simple-term @@ -3895,7 +3928,7 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") // | ':' FUNCTION (="not") component-value-list ')' // | ':' ':' IDENTIFIER - SECTION("test a placeholder") + CATCH_START_SECTION("test a placeholder") { std::stringstream ss; ss << "div p%image" @@ -3910,7 +3943,7 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3923,11 +3956,11 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -3947,12 +3980,13 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("test a reference") + CATCH_START_SECTION("test a reference") { std::stringstream ss; ss << "div a" @@ -3965,7 +3999,7 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -3978,11 +4012,11 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -4014,12 +4048,13 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("test the not() function") + CATCH_START_SECTION("test the not() function") { std::stringstream ss; ss << "div a:not(:hover)" @@ -4032,7 +4067,7 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4043,13 +4078,13 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") c.compile(true); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *c.get_root() << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -4072,12 +4107,13 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("test the not() function + a sub-function") + CATCH_START_SECTION("test the not() function + a sub-function") { std::stringstream ss; ss << "div a:not(:nth-last-of-type(5n+3))" @@ -4090,7 +4126,7 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4101,13 +4137,13 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") c.compile(true); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *c.get_root() << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -4131,12 +4167,13 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("check all pseudo-elements") + CATCH_START_SECTION("check all pseudo-elements") { char const * pseudo_name_table[] = { @@ -4160,7 +4197,7 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4174,7 +4211,7 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -4191,14 +4228,15 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } + CATCH_END_SECTION() - SECTION("check filter with alpha() function") + CATCH_START_SECTION("check filter with alpha() function") { std::stringstream ss; ss << "div {\n" @@ -4213,7 +4251,7 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4225,11 +4263,11 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(3): warning: the alpha(), chroma() and similar functions of the filter field are Internet Explorer specific extensions which are not supported across browsers.\n"); + VERIFY_ERRORS("test.css(3): warning: the alpha(), chroma() and similar functions of the filter field are Internet Explorer specific extensions which are not supported across browsers.\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -4250,13 +4288,14 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } + CATCH_END_SECTION() - SECTION("check \"-filter\" with alpha() function") + CATCH_START_SECTION("check \"-filter\" with alpha() function") { std::stringstream ss; ss << "div {\n" @@ -4271,7 +4310,7 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4283,11 +4322,11 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(3): warning: the alpha(), chroma() and similar functions of the filter field are Internet Explorer specific extensions which are not supported across browsers.\n"); + VERIFY_ERRORS("test.css(3): warning: the alpha(), chroma() and similar functions of the filter field are Internet Explorer specific extensions which are not supported across browsers.\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -4308,13 +4347,14 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } + CATCH_END_SECTION() - SECTION("check progid:...") + CATCH_START_SECTION("check progid:...") { std::stringstream ss; ss << "div {\n" @@ -4329,7 +4369,7 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4341,11 +4381,11 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(2): warning: the alpha(), chroma() and similar functions of the filter field are Internet Explorer specific extensions which are not supported across browsers.\n"); + VERIFY_ERRORS("test.css(2): warning: the alpha(), chroma() and similar functions of the filter field are Internet Explorer specific extensions which are not supported across browsers.\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -4370,14 +4410,15 @@ TEST_CASE("Complex terms", "[compiler] [stylesheet]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } + CATCH_END_SECTION() } -TEST_CASE("Invalid complex terms", "[compiler] [invalid]") +CATCH_TEST_CASE("Invalid complex terms", "[compiler] [invalid]") { // '::' must be followed by an IDENTIFIER { @@ -4391,7 +4432,7 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4401,9 +4442,9 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: a selector list cannot end with a '::' without an identifier after it.\n"); + VERIFY_ERRORS("test.css(1): error: a selector list cannot end with a '::' without an identifier after it.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // '::' must be followed a known pseudo-element name @@ -4418,7 +4459,7 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4428,7 +4469,7 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("scripts/validation/pseudo-elements.scss(39): error: unknown is not a valid name for a pseudo element; CSS only supports after, before, first-letter, first-line, grammar-error, marker, placeholder, selection, and spelling-error.\n"); + VERIFY_ERRORS("scripts/validation/pseudo-elements.scss(39): error: unknown is not a valid name for a pseudo element; CSS only supports after, before, first-letter, first-line, grammar-error, marker, placeholder, selection, and spelling-error.\n"); } // '::' must be followed an IDENTIFIER @@ -4443,7 +4484,7 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4453,9 +4494,9 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: a pseudo element name (defined after a '::' in a list of selectors) must be defined using an identifier.\n"); + VERIFY_ERRORS("test.css(1): error: a pseudo element name (defined after a '::' in a list of selectors) must be defined using an identifier.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // '>' cannot start a selector list @@ -4470,7 +4511,7 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4480,9 +4521,9 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: found token GREATER_THAN, which cannot be used to start a selector expression.\n"); + VERIFY_ERRORS("test.css(1): error: found token GREATER_THAN, which cannot be used to start a selector expression.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // '+' cannot start a selector list @@ -4497,7 +4538,7 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4507,9 +4548,9 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: found token ADD, which cannot be used to start a selector expression.\n"); + VERIFY_ERRORS("test.css(1): error: found token ADD, which cannot be used to start a selector expression.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // '~' cannot start a selector list @@ -4524,7 +4565,7 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4534,9 +4575,9 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: found token PRECEDED, which cannot be used to start a selector expression.\n"); + VERIFY_ERRORS("test.css(1): error: found token PRECEDED, which cannot be used to start a selector expression.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // selector cannot start with a FUNCTION @@ -4551,7 +4592,7 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4561,9 +4602,9 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: found function \"func()\", which may be a valid selector token but only if immediately preceeded by one ':' (term).\n"); + VERIFY_ERRORS("test.css(1): error: found function \"func()\", which may be a valid selector token but only if immediately preceeded by one ':' (term).\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // selectors do not support INTEGER @@ -4578,7 +4619,7 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4588,9 +4629,9 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: found token INTEGER, which is not a valid selector token (term).\n"); + VERIFY_ERRORS("test.css(1): error: found token INTEGER, which is not a valid selector token (term).\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // selectors do not support DECIMAL_NUMBER @@ -4605,7 +4646,7 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4615,9 +4656,9 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: found token DECIMAL_NUMBER, which is not a valid selector token (term).\n"); + VERIFY_ERRORS("test.css(1): error: found token DECIMAL_NUMBER, which is not a valid selector token (term).\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // selectors do not support PERCENT @@ -4632,7 +4673,7 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4642,9 +4683,9 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: found token PERCENT, which is not a valid selector token (term).\n"); + VERIFY_ERRORS("test.css(1): error: found token PERCENT, which is not a valid selector token (term).\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // check pseudo-elements not at the end @@ -4671,7 +4712,7 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4683,13 +4724,13 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a pseudo element name (defined after a '::' in a list of selectors) must be defined as the last element in the list of selectors.\n"); + VERIFY_ERRORS("test.css(1): error: a pseudo element name (defined after a '::' in a list of selectors) must be defined as the last element in the list of selectors.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // check the few invalid characters before "identifier ':' ..." @@ -4709,7 +4750,7 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4721,7 +4762,7 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(2): warning: the '[*|.|!]: ...' syntax is not allowed in csspp, we offer other ways to control field names per browser and do not allow such tricks.\n" "test.css(3): warning: the '[*|.|!]: ...' syntax is not allowed in csspp, we offer other ways to control field names per browser and do not allow such tricks.\n" "test.css(3): warning: the alpha(), chroma() and similar functions of the filter field are Internet Explorer specific extensions which are not supported across browsers.\n" @@ -4731,7 +4772,7 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -4758,10 +4799,10 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // check that & cannot be used in the middle of a selector list @@ -4780,7 +4821,7 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4792,18 +4833,18 @@ TEST_CASE("Invalid complex terms", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: a selector reference (&) can only appear as the very first item in a list of selectors.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid node", "[compiler] [invalid]") +CATCH_TEST_CASE("Invalid node", "[compiler] [invalid]") { // create a fake node tree with some invalid node types to // exercise the compile() switch default entry @@ -4826,9 +4867,9 @@ TEST_CASE("Invalid node", "[compiler] [invalid]") c.add_path(csspp_test::get_script_path()); c.add_path(csspp_test::get_version_script_path()); - REQUIRE_THROWS_AS(c.compile(true), csspp::csspp_exception_unexpected_token &); + CATCH_REQUIRE_THROWS_AS(c.compile(true), csspp::csspp_exception_unexpected_token); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } @@ -4844,7 +4885,7 @@ TEST_CASE("Invalid node", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4854,9 +4895,9 @@ TEST_CASE("Invalid node", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: a qualified rule without selectors is not valid.\n"); + VERIFY_ERRORS("test.css(1): error: a qualified rule without selectors is not valid.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // qualified rule must start with an identifier @@ -4871,7 +4912,7 @@ TEST_CASE("Invalid node", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // the qualified rule is invalid... - REQUIRE_ERRORS("test.css(1): error: A qualified rule must end with a { ... } block.\n"); + VERIFY_ERRORS("test.css(1): error: A qualified rule must end with a { ... } block.\n"); // ...but we still compile it so we get a specific error that we do // not get otherwise. @@ -4883,9 +4924,9 @@ TEST_CASE("Invalid node", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: expected a ':' after the identifier of this declaration value; got a: COMPONENT_VALUE instead.\n"); + VERIFY_ERRORS("test.css(1): error: expected a ':' after the identifier of this declaration value; got a: COMPONENT_VALUE instead.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // a declaration needs an identifier @@ -4900,7 +4941,7 @@ TEST_CASE("Invalid node", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4910,9 +4951,9 @@ TEST_CASE("Invalid node", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: expected an identifier to start a declaration value; got a: ADD instead.\n"); + VERIFY_ERRORS("test.css(1): error: expected an identifier to start a declaration value; got a: ADD instead.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // a declaration needs an identifier @@ -4931,7 +4972,7 @@ TEST_CASE("Invalid node", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4941,19 +4982,19 @@ TEST_CASE("Invalid node", "[compiler] [invalid]") c.compile(true); - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(2): error: somehow a declaration list is missing a field name or ':'.\n" "test.css(3): error: somehow a declaration list is missing a field name or ':'.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Compile font metrics", "[compiler] [font-metrics]") +CATCH_TEST_CASE("Compile font metrics", "[compiler] [font-metrics]") { // define a sub-declaration inside a declaration { @@ -4971,7 +5012,7 @@ TEST_CASE("Compile font metrics", "[compiler] [font-metrics]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -4983,11 +5024,11 @@ TEST_CASE("Compile font metrics", "[compiler] [font-metrics]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - //REQUIRE_ERRORS(""); + //VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -5021,7 +5062,7 @@ TEST_CASE("Compile font metrics", "[compiler] [font-metrics]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // define a sub-declaration inside a declaration @@ -5040,7 +5081,7 @@ TEST_CASE("Compile font metrics", "[compiler] [font-metrics]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -5052,11 +5093,11 @@ TEST_CASE("Compile font metrics", "[compiler] [font-metrics]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - //REQUIRE_ERRORS(""); + //VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -5090,14 +5131,14 @@ TEST_CASE("Compile font metrics", "[compiler] [font-metrics]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // still no errors - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Nested declarations", "[compiler] [nested]") +CATCH_TEST_CASE("Nested declarations", "[compiler] [nested]") { // define a sub-declaration inside a declaration { @@ -5131,7 +5172,7 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -5143,11 +5184,11 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -5196,7 +5237,7 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // define a sub-declaration inside a declaration @@ -5213,7 +5254,7 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -5225,11 +5266,11 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:size\n" @@ -5258,10 +5299,10 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } - SECTION("just one sub-declaration inside a field definition") + CATCH_START_SECTION("just one sub-declaration inside a field definition") { std::stringstream ss; ss << "p.boxed { border: { width: 25px + 5px; }; }"; @@ -5273,7 +5314,7 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -5285,11 +5326,11 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -5304,8 +5345,9 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // define the sub-declaration in a variable { @@ -5320,7 +5362,7 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -5332,11 +5374,11 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:m\n" @@ -5379,7 +5421,7 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // 5 levels nested declarations @@ -5411,7 +5453,7 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -5423,11 +5465,11 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -5512,7 +5554,7 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // Test that functions prevent a field to look like a declaration @@ -5531,7 +5573,7 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -5543,11 +5585,11 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), //ss << "border {\n" // << " left:not(.long) div{color: red};\n" @@ -5575,7 +5617,7 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // // define the sub-declaration in a variable @@ -5592,7 +5634,7 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") // csspp::node::pointer_t n(p.stylesheet()); // // // no errors so far -// REQUIRE_ERRORS(""); +// VERIFY_ERRORS(""); // // csspp::compiler c; // c.set_root(n); @@ -5604,11 +5646,11 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") // //std::cerr << "Result is: [" << *c.get_root() << "]\n"; // -// REQUIRE_ERRORS(""); +// VERIFY_ERRORS(""); // // std::stringstream out; // out << *n; -// REQUIRE_TREES(out.str(), +// VERIFY_TREES(out.str(), // //"LIST\n" //" V:m\n" @@ -5647,14 +5689,14 @@ TEST_CASE("Nested declarations", "[compiler] [nested]") // // ); // -// REQUIRE(c.get_root() == n); +// CATCH_REQUIRE(c.get_root() == n); // } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid nested declarations", "[compiler] [nested] [invalid]") +CATCH_TEST_CASE("Invalid nested declarations", "[compiler] [nested] [invalid]") { // define a sub-declaration inside a declaration { @@ -5675,7 +5717,7 @@ TEST_CASE("Invalid nested declarations", "[compiler] [nested] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -5687,16 +5729,16 @@ TEST_CASE("Invalid nested declarations", "[compiler] [nested] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(5): error: a nested declaration cannot include a rule.\n"); + VERIFY_ERRORS("test.css(5): error: a nested declaration cannot include a rule.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Advanced variables", "[compiler] [variable]") +CATCH_TEST_CASE("Advanced variables", "[compiler] [variable]") { // define a variable function with a parameter { @@ -5713,7 +5755,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -5725,11 +5767,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:m\n" @@ -5777,7 +5819,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // define a variable function with a parameter and more spaces @@ -5793,7 +5835,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -5805,11 +5847,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:m\n" @@ -5857,7 +5899,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test a variable function default parameter @@ -5873,7 +5915,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -5885,11 +5927,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:m\n" @@ -5937,7 +5979,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // a multi value default @@ -5953,7 +5995,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -5965,11 +6007,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:m\n" @@ -6017,7 +6059,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // a variable function with multiple fields copied @@ -6035,7 +6077,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -6047,11 +6089,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:m\n" @@ -6078,7 +6120,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test a default variable @@ -6095,7 +6137,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -6107,11 +6149,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:m\n" @@ -6128,7 +6170,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test a variable inside a qualified rule {}-block @@ -6151,7 +6193,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -6163,11 +6205,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -6191,7 +6233,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test that blocks define locations to save variables as expected @@ -6215,7 +6257,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -6227,11 +6269,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:size\n" @@ -6266,7 +6308,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test that !global forces definitions to be global @@ -6290,7 +6332,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -6302,11 +6344,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:size\n" @@ -6337,7 +6379,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test that !default prevents redefinitions of existing variables @@ -6361,7 +6403,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -6373,11 +6415,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:size\n" @@ -6408,7 +6450,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test a null variable @@ -6424,7 +6466,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -6436,11 +6478,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:empty_variable\n" @@ -6459,7 +6501,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test inexistant variable when 'accept empty' flag is ON @@ -6474,7 +6516,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -6487,11 +6529,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -6506,7 +6548,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test @include instead of $blah @@ -6522,7 +6564,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -6535,11 +6577,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:var\n" @@ -6572,7 +6614,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test @include with a function definition @@ -6588,7 +6630,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -6601,11 +6643,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:var\n" @@ -6640,7 +6682,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test @include with @mixin @@ -6658,7 +6700,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -6671,11 +6713,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:nice-button\n" @@ -6708,7 +6750,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test @include with @mixin @@ -6726,7 +6768,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -6739,11 +6781,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:var\n" @@ -6778,7 +6820,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test $var with @mixin definition @@ -6796,7 +6838,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -6809,11 +6851,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:var\n" @@ -6840,7 +6882,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test $var with @mixin definition @@ -6858,7 +6900,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -6871,11 +6913,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): info: found an #id entry which is not at the beginning of the list of selectors; unless your HTML changes that much, #id should be the first selector only.\n"); + VERIFY_ERRORS("test.css(1): info: found an #id entry which is not at the beginning of the list of selectors; unless your HTML changes that much, #id should be the first selector only.\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:var\n" @@ -6900,7 +6942,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test $var with @mixin definition @@ -6918,7 +6960,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -6931,14 +6973,14 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): info: found an #id entry which is not at the beginning of the list of selectors; unless your HTML changes that much, #id should be the first selector only.\n" "test.css(1): info: found an #id entry which is not at the beginning of the list of selectors; unless your HTML changes that much, #id should be the first selector only.\n" ); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:var\n" @@ -6974,7 +7016,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test $var with @mixin definition @@ -6992,7 +7034,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7005,11 +7047,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): info: found an #id entry which is not at the beginning of the list of selectors; unless your HTML changes that much, #id should be the first selector only.\n"); + VERIFY_ERRORS("test.css(1): info: found an #id entry which is not at the beginning of the list of selectors; unless your HTML changes that much, #id should be the first selector only.\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:var\n" @@ -7045,7 +7087,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test $var with @mixin definition @@ -7063,7 +7105,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7076,11 +7118,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:var\n" @@ -7111,7 +7153,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test $var with @mixin definition @@ -7129,7 +7171,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7142,11 +7184,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:var\n" @@ -7175,7 +7217,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test $var with @mixin definition @@ -7256,7 +7298,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7269,7 +7311,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; @@ -7321,9 +7363,9 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") " ARG\n" " COLOR H:ffeeeeee\n"; - REQUIRE_TREES(out.str(), expected.str()); + VERIFY_TREES(out.str(), expected.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } @@ -7342,7 +7384,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7355,12 +7397,12 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:var\n" @@ -7399,7 +7441,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // wrote this test out of a mistake really, @@ -7419,7 +7461,7 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7432,11 +7474,11 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:b\n" @@ -7455,14 +7497,14 @@ TEST_CASE("Advanced variables", "[compiler] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") +CATCH_TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") { // undefined variable with whitespace before { @@ -7476,7 +7518,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7488,12 +7530,12 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: variable named \"m\" is not set.\n" "test.css(1): error: somehow a declaration list is missing fields, this happens if you used an invalid variable.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // null variable in a place where something is required @@ -7509,7 +7551,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7521,11 +7563,11 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(2): error: somehow a declaration list is missing fields, this happens if you used an invalid variable.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // undefined variable without whitespace @@ -7540,7 +7582,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7552,12 +7594,12 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: variable named \"m\" is not set.\n" "test.css(1): error: somehow a declaration list is missing fields, this happens if you used an invalid variable.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // variable type mismatch (func/var) @@ -7573,7 +7615,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7585,12 +7627,12 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: variable named \"m\" is not a function and it cannot be referenced as such.\n" "test.css(1): error: somehow a declaration list is missing fields, this happens if you used an invalid variable.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // variable type mismatch (var/func) @@ -7606,7 +7648,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7618,12 +7660,12 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: variable named \"m\" is a function and it can only be referenced with a function ($m() or @include m;).\n" "test.css(1): error: somehow a declaration list is missing fields, this happens if you used an invalid variable.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // variable is missing in function call @@ -7639,7 +7681,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7651,12 +7693,12 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: missing function variable named \"a3\" when calling sum() or using @include sum();).\n" "test.css(1): error: somehow a declaration list is missing fields, this happens if you used an invalid variable.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // variable parameter is not a variable @@ -7672,7 +7714,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7684,13 +7726,13 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: function declarations expect variables for each of their arguments, not a IDENTIFIER.\n" //"test.css(1): error: function declaration requires all parameters to be variables, IDENTIFIER is not acceptable.\n" -- removed not useful "test.css(1): error: somehow a declaration list is missing fields, this happens if you used an invalid variable.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // missing value for optional parameter @@ -7706,7 +7748,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7718,12 +7760,12 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: function declarations with optional parameters must make all parameters optional from the first one that is given an optional value up to the end of the list of arguments.\n" //"test.css(1): error: unsupported type LIST as a unary expression token.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // missing ':' to define the optional value @@ -7739,7 +7781,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7751,12 +7793,12 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: function declarations expect variable with optional parameters to use a ':' after the variable name and before the optional value.\n" //"test.css(1): error: unsupported type LIST as a unary expression token.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test @include with something else than an identifier or function @@ -7771,7 +7813,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7784,9 +7826,9 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: @include is expected to be followed by an IDENTIFIER or a FUNCTION naming the variable/mixin to include.\n"); + VERIFY_ERRORS("test.css(1): error: @include is expected to be followed by an IDENTIFIER or a FUNCTION naming the variable/mixin to include.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test @include with something else than an identifier or function @@ -7802,7 +7844,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7815,9 +7857,9 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(2): error: a qualified rule without selectors is not valid.\n"); + VERIFY_ERRORS("test.css(2): error: a qualified rule without selectors is not valid.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // @mixin with one parameter @@ -7834,7 +7876,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7847,9 +7889,9 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a @mixin definition expects exactly two parameters: an identifier or function and a {}-block.\n"); + VERIFY_ERRORS("test.css(1): error: a @mixin definition expects exactly two parameters: an identifier or function and a {}-block.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // @mixin with one parameter @@ -7866,7 +7908,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7879,9 +7921,9 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a @mixin definition expects exactly two parameters: an identifier or function and a {}-block.\n"); + VERIFY_ERRORS("test.css(1): error: a @mixin definition expects exactly two parameters: an identifier or function and a {}-block.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // @mixin with too many entries (i.e. "color" " " "#ff3241") @@ -7898,7 +7940,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7911,9 +7953,9 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a @mixin definition expects exactly two parameters: an identifier or function and a {}-block.\n"); + VERIFY_ERRORS("test.css(1): error: a @mixin definition expects exactly two parameters: an identifier or function and a {}-block.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // @mixin not with a {}-block @@ -7930,7 +7972,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7943,9 +7985,9 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a @mixin definition expects a {}-block as its second parameter.\n"); + VERIFY_ERRORS("test.css(1): error: a @mixin definition expects a {}-block as its second parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // @mixin not with a IDENTIFIER or FUNCTION as first parameter @@ -7962,7 +8004,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -7975,9 +8017,9 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a @mixin expects either an IDENTIFIER or a FUNCTION as its first parameter.\n"); + VERIFY_ERRORS("test.css(1): error: a @mixin expects either an IDENTIFIER or a FUNCTION as its first parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // @mixin with VARIABLE generates an special error @@ -7994,7 +8036,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8007,9 +8049,9 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a @mixin must use an IDENTIFIER or FUNCTION and no a VARIABLE or VARIABLE_FUNCTION.\n"); + VERIFY_ERRORS("test.css(1): error: a @mixin must use an IDENTIFIER or FUNCTION and no a VARIABLE or VARIABLE_FUNCTION.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // @mixin with VARIABLE generates an special error @@ -8026,7 +8068,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8039,9 +8081,9 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a @mixin must use an IDENTIFIER or FUNCTION and no a VARIABLE or VARIABLE_FUNCTION.\n"); + VERIFY_ERRORS("test.css(1): error: a @mixin must use an IDENTIFIER or FUNCTION and no a VARIABLE or VARIABLE_FUNCTION.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // try !global at the wrong place and see the warning @@ -8065,7 +8107,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8077,14 +8119,14 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(2): warning: A special flag, !global in this case, must only appear at the end of a declaration.\n" "test.css(3): warning: A special flag, !global in this case, must only appear at the end of a declaration.\n" ); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:size\n" @@ -8115,7 +8157,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // try !default at the wrong place and see the warning @@ -8139,7 +8181,7 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8151,14 +8193,14 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(2): warning: A special flag, !default in this case, must only appear at the end of a declaration.\n" "test.css(3): warning: A special flag, !default in this case, must only appear at the end of a declaration.\n" ); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:size\n" @@ -8189,14 +8231,14 @@ TEST_CASE("Invalid variables", "[compiler] [variable] [invalid]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("At-Keyword ignored", "[compiler] [at-keyword]") +CATCH_TEST_CASE("At-Keyword ignored", "[compiler] [at-keyword]") { // make sure @ is left alone as expected by CSS 3 { @@ -8210,7 +8252,7 @@ TEST_CASE("At-Keyword ignored", "[compiler] [at-keyword]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8220,11 +8262,11 @@ TEST_CASE("At-Keyword ignored", "[compiler] [at-keyword]") c.compile(true); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"unknown\" I:0\n" @@ -8232,7 +8274,7 @@ TEST_CASE("At-Keyword ignored", "[compiler] [at-keyword]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // make sure @ is left alone as expected by CSS 3 @@ -8247,7 +8289,7 @@ TEST_CASE("At-Keyword ignored", "[compiler] [at-keyword]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8257,11 +8299,11 @@ TEST_CASE("At-Keyword ignored", "[compiler] [at-keyword]") c.compile(true); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"unknown\" I:0\n" @@ -8280,14 +8322,14 @@ TEST_CASE("At-Keyword ignored", "[compiler] [at-keyword]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("At-Keyword messages", "[compiler] [output]") +CATCH_TEST_CASE("At-Keyword messages", "[compiler] [output]") { // generate an error with @error { @@ -8301,7 +8343,7 @@ TEST_CASE("At-Keyword messages", "[compiler] [output]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8311,9 +8353,9 @@ TEST_CASE("At-Keyword messages", "[compiler] [output]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: This is an error.\n"); + VERIFY_ERRORS("test.css(1): error: This is an error.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // generate a warning with @warning @@ -8328,7 +8370,7 @@ TEST_CASE("At-Keyword messages", "[compiler] [output]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8338,9 +8380,9 @@ TEST_CASE("At-Keyword messages", "[compiler] [output]") c.compile(true); - REQUIRE_ERRORS("test.css(1): warning: This is a warning.\n"); + VERIFY_ERRORS("test.css(1): warning: This is a warning.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // output a message with @info @@ -8355,7 +8397,7 @@ TEST_CASE("At-Keyword messages", "[compiler] [output]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8365,9 +8407,9 @@ TEST_CASE("At-Keyword messages", "[compiler] [output]") c.compile(true); - REQUIRE_ERRORS("test.css(1): info: This is an info message.\n"); + VERIFY_ERRORS("test.css(1): info: This is an info message.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // make sure @message does the same as @info @@ -8382,7 +8424,7 @@ TEST_CASE("At-Keyword messages", "[compiler] [output]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8392,9 +8434,9 @@ TEST_CASE("At-Keyword messages", "[compiler] [output]") c.compile(true); - REQUIRE_ERRORS("test.css(1): info: This is an info message.\n"); + VERIFY_ERRORS("test.css(1): info: This is an info message.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // test @debug does nothing by default @@ -8409,7 +8451,7 @@ TEST_CASE("At-Keyword messages", "[compiler] [output]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8420,9 +8462,9 @@ TEST_CASE("At-Keyword messages", "[compiler] [output]") c.compile(true); // by default debug messages do not make it to the output - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // make sure @debug does the same as @info @@ -8437,7 +8479,7 @@ TEST_CASE("At-Keyword messages", "[compiler] [output]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8449,16 +8491,16 @@ TEST_CASE("At-Keyword messages", "[compiler] [output]") c.compile(true); csspp::error::instance().set_show_debug(false); - REQUIRE_ERRORS("test.css(1): debug: This is a debug message.\n"); + VERIFY_ERRORS("test.css(1): debug: This is a debug message.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") +CATCH_TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") { // a valid @document { @@ -8472,7 +8514,7 @@ TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8484,11 +8526,11 @@ TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"document\" I:0\n" @@ -8503,7 +8545,7 @@ TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // a valid @document with @if inside of there @@ -8522,7 +8564,7 @@ TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8534,11 +8576,11 @@ TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:agent\n" @@ -8575,7 +8617,7 @@ TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // a valid @media @@ -8590,7 +8632,7 @@ TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8602,11 +8644,11 @@ TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"media\" I:0\n" @@ -8623,7 +8665,7 @@ TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // nested @media @@ -8643,7 +8685,7 @@ TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8655,11 +8697,11 @@ TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"media\" I:0\n" @@ -8689,7 +8731,7 @@ TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // a valid @supports @@ -8704,7 +8746,7 @@ TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8716,11 +8758,11 @@ TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"supports\" I:0\n" @@ -8743,14 +8785,14 @@ TEST_CASE("At-Keyword with qualified rules", "[compiler] [at-keyword]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid at-keyword expecting qualified rules", "[compiler] [at-keyword]") +CATCH_TEST_CASE("Invalid at-keyword expecting qualified rules", "[compiler] [at-keyword]") { // a @supports without a {}-block { @@ -8764,7 +8806,7 @@ TEST_CASE("Invalid at-keyword expecting qualified rules", "[compiler] [at-keywor csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8776,11 +8818,11 @@ TEST_CASE("Invalid at-keyword expecting qualified rules", "[compiler] [at-keywor //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"supports\" I:0\n" @@ -8794,14 +8836,14 @@ TEST_CASE("Invalid at-keyword expecting qualified rules", "[compiler] [at-keywor ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("At-Keyword with declarations", "[compiler] [at-keyword]") +CATCH_TEST_CASE("At-Keyword with declarations", "[compiler] [at-keyword]") { // a valid @page { @@ -8815,7 +8857,7 @@ TEST_CASE("At-Keyword with declarations", "[compiler] [at-keyword]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8827,11 +8869,11 @@ TEST_CASE("At-Keyword with declarations", "[compiler] [at-keyword]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"page\" I:0\n" @@ -8846,7 +8888,7 @@ TEST_CASE("At-Keyword with declarations", "[compiler] [at-keyword]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // @page with an @media inside @@ -8867,7 +8909,7 @@ TEST_CASE("At-Keyword with declarations", "[compiler] [at-keyword]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8879,11 +8921,11 @@ TEST_CASE("At-Keyword with declarations", "[compiler] [at-keyword]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"page\" I:0\n" @@ -8911,7 +8953,7 @@ TEST_CASE("At-Keyword with declarations", "[compiler] [at-keyword]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // a valid @supports @@ -8926,7 +8968,7 @@ TEST_CASE("At-Keyword with declarations", "[compiler] [at-keyword]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8938,11 +8980,11 @@ TEST_CASE("At-Keyword with declarations", "[compiler] [at-keyword]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"font-face\" I:0\n" @@ -8957,14 +8999,14 @@ TEST_CASE("At-Keyword with declarations", "[compiler] [at-keyword]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Charset", "[compiler] [invalid]") +CATCH_TEST_CASE("Charset", "[compiler] [invalid]") { // a valid @charset { @@ -8979,7 +9021,7 @@ TEST_CASE("Charset", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -8991,11 +9033,11 @@ TEST_CASE("Charset", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -9008,7 +9050,7 @@ TEST_CASE("Charset", "[compiler] [invalid]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // a valid @charset with many spaces @@ -9024,7 +9066,7 @@ TEST_CASE("Charset", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9036,11 +9078,11 @@ TEST_CASE("Charset", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -9053,7 +9095,7 @@ TEST_CASE("Charset", "[compiler] [invalid]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // an @charset with a refused encoding @@ -9069,7 +9111,7 @@ TEST_CASE("Charset", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9081,11 +9123,11 @@ TEST_CASE("Charset", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: we only support @charset \"utf-8\";, any other encoding is refused.\n"); + VERIFY_ERRORS("test.css(1): error: we only support @charset \"utf-8\";, any other encoding is refused.\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -9098,7 +9140,7 @@ TEST_CASE("Charset", "[compiler] [invalid]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // an @charset with a decimal number @@ -9114,7 +9156,7 @@ TEST_CASE("Charset", "[compiler] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9126,11 +9168,11 @@ TEST_CASE("Charset", "[compiler] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: the @charset is expected to be followed by exactly one string.\n"); + VERIFY_ERRORS("test.css(1): error: the @charset is expected to be followed by exactly one string.\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -9143,14 +9185,14 @@ TEST_CASE("Charset", "[compiler] [invalid]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Conditional compilation", "[compiler] [conditional]") +CATCH_TEST_CASE("Conditional compilation", "[compiler] [conditional]") { // script with @if / @else if / @else keywords { @@ -9170,7 +9212,7 @@ TEST_CASE("Conditional compilation", "[compiler] [conditional]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9182,11 +9224,11 @@ TEST_CASE("Conditional compilation", "[compiler] [conditional]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(2): info: Got here! (1)\n"); + VERIFY_ERRORS("test.css(2): info: Got here! (1)\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:var\n" @@ -9203,7 +9245,7 @@ TEST_CASE("Conditional compilation", "[compiler] [conditional]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // script with @if / @else if / @else keywords @@ -9222,7 +9264,7 @@ TEST_CASE("Conditional compilation", "[compiler] [conditional]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9234,11 +9276,11 @@ TEST_CASE("Conditional compilation", "[compiler] [conditional]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(3): info: Got here! (2)\n"); + VERIFY_ERRORS("test.css(3): info: Got here! (2)\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:var\n" @@ -9255,7 +9297,7 @@ TEST_CASE("Conditional compilation", "[compiler] [conditional]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // script with @if / @else if / @else keywords @@ -9274,7 +9316,7 @@ TEST_CASE("Conditional compilation", "[compiler] [conditional]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9286,11 +9328,11 @@ TEST_CASE("Conditional compilation", "[compiler] [conditional]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(4): info: Got here! (3)\n"); + VERIFY_ERRORS("test.css(4): info: Got here! (3)\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:var\n" @@ -9307,14 +9349,14 @@ TEST_CASE("Conditional compilation", "[compiler] [conditional]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") +CATCH_TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") { // script with @if / @else if / @else keywords // invalid "@else if" which includes an expression @@ -9335,7 +9377,7 @@ TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") //std::cerr << "Parser result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9348,7 +9390,7 @@ TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(2): error: @if is expected to have exactly 2 parameters: an expression and a block. This @if has 1 parameters.\n" "test.css(3): error: '@else if ...' is missing an expression or a block.\n" //"test.css(3): error: a standalone @else is not legal, it has to be preceeded by an @if ... or @else if ...\n" @@ -9357,7 +9399,7 @@ TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -9376,7 +9418,7 @@ TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // script with @if / @else if / @else keywords @@ -9396,7 +9438,7 @@ TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9408,7 +9450,7 @@ TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(3): error: unsupported type OPEN_CURLYBRACKET as a unary expression token.\n" "test.css(3): error: '@else { ... }' is expected to have 1 parameter, '@else if ... { ... }' is expected to have 2 parameters. This @else has 2 parameters.\n" //"test.css(4): error: a standalone @else is not legal, it has to be preceeded by an @if ... or @else if ...\n" @@ -9416,7 +9458,7 @@ TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:var\n" @@ -9433,7 +9475,7 @@ TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // script with @if / @else if / @else keywords @@ -9453,7 +9495,7 @@ TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9465,7 +9507,7 @@ TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("" + VERIFY_ERRORS("" "test.css(4): error: '@else { ... }' is expected to have 1 parameter, '@else if ... { ... }' is expected to have 2 parameters. This @else has 2 parameters.\n" //"test.css(3): error: '@else if ...' is missing an expression or a block.\n" //"test.css(3): error: '@else { ... }' cannot follow another '@else { ... }'. Maybe you are missing an 'if expr'?\n" @@ -9475,7 +9517,7 @@ TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:var\n" @@ -9492,7 +9534,7 @@ TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // script with @if / @else if / @else keywords @@ -9513,7 +9555,7 @@ TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9525,7 +9567,7 @@ TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("" + VERIFY_ERRORS("" "test.css(4): error: '@else { ... }' cannot follow another '@else { ... }'. Maybe you are missing an 'if expr'?\n" "test.css(5): error: a standalone @else is not legal, it has to be preceeded by an @if ... or @else if ...\n" //"test.css(4): info: Got here! (3)\n" @@ -9533,7 +9575,7 @@ TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " V:var\n" @@ -9550,14 +9592,14 @@ TEST_CASE("Invalid conditional", "[compiler] [conditional] [invalid]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("User @import", "[compiler] [at-keyword]") +CATCH_TEST_CASE("User @import", "[compiler] [at-keyword]") { // @import with a valid URL { @@ -9565,7 +9607,7 @@ TEST_CASE("User @import", "[compiler] [at-keyword]") { std::ofstream importing; importing.open("importing.scss"); - REQUIRE(!!importing); + CATCH_REQUIRE(!!importing); importing << "/* @preserve this worked! {$_csspp_version} */"; } std::stringstream ss; @@ -9583,7 +9625,7 @@ TEST_CASE("User @import", "[compiler] [at-keyword]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9594,11 +9636,11 @@ TEST_CASE("User @import", "[compiler] [at-keyword]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -9609,7 +9651,7 @@ TEST_CASE("User @import", "[compiler] [at-keyword]") unlink("importing.scss"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // @import with a valid path as a URL (thus not recognized as a file://) @@ -9624,7 +9666,7 @@ TEST_CASE("User @import", "[compiler] [at-keyword]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9634,11 +9676,11 @@ TEST_CASE("User @import", "[compiler] [at-keyword]") c.compile(true); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"import\" I:0\n" @@ -9646,7 +9688,7 @@ TEST_CASE("User @import", "[compiler] [at-keyword]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // @import with a valid path as a URL (thus not recognized as a file://) @@ -9661,7 +9703,7 @@ TEST_CASE("User @import", "[compiler] [at-keyword]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9671,11 +9713,11 @@ TEST_CASE("User @import", "[compiler] [at-keyword]") c.compile(true); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"import\" I:0\n" @@ -9683,14 +9725,14 @@ TEST_CASE("User @import", "[compiler] [at-keyword]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") +CATCH_TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") { // @import with URL representing a an inexistant file { @@ -9704,7 +9746,7 @@ TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9714,11 +9756,11 @@ TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): info: @import uri(/this/shall/not/exist/anywhere/on/your/drive); left alone by the CSS Preprocessor, no matching file found.\n"); + VERIFY_ERRORS("test.css(1): info: @import uri(/this/shall/not/exist/anywhere/on/your/drive); left alone by the CSS Preprocessor, no matching file found.\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"import\" I:0\n" @@ -9726,7 +9768,7 @@ TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // @import with URL representing a an inexistant file @@ -9741,7 +9783,7 @@ TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9751,11 +9793,11 @@ TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): info: @import uri(/this/shall/not/exist/either/on/your/drive); left alone by the CSS Preprocessor, no matching file found.\n"); + VERIFY_ERRORS("test.css(1): info: @import uri(/this/shall/not/exist/either/on/your/drive); left alone by the CSS Preprocessor, no matching file found.\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"import\" I:0\n" @@ -9763,7 +9805,7 @@ TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // @import with a string that includes a URL @@ -9778,7 +9820,7 @@ TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9788,11 +9830,11 @@ TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): info: @import \"/this/shall/not/ever/exist/on/your/drive\"; left alone by the CSS Preprocessor, no matching file found.\n"); + VERIFY_ERRORS("test.css(1): info: @import \"/this/shall/not/ever/exist/on/your/drive\"; left alone by the CSS Preprocessor, no matching file found.\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"import\" I:0\n" @@ -9800,7 +9842,7 @@ TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // @import with a string that includes a URL @@ -9815,7 +9857,7 @@ TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9825,11 +9867,11 @@ TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): info: @import \"include/a/file:///in/the/filename/but/still/a/regular/filename\"; left alone by the CSS Preprocessor, no matching file found.\n"); + VERIFY_ERRORS("test.css(1): info: @import \"include/a/file:///in/the/filename/but/still/a/regular/filename\"; left alone by the CSS Preprocessor, no matching file found.\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"import\" I:0\n" @@ -9837,7 +9879,7 @@ TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // @import a script named "" (empty string!) @@ -9852,7 +9894,7 @@ TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9862,11 +9904,11 @@ TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") c.compile(true); - REQUIRE_ERRORS("test.css(1): error: @import \"\"; and @import url(); are not valid.\n"); + VERIFY_ERRORS("test.css(1): error: @import \"\"; and @import url(); are not valid.\n"); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"import\" I:0\n" @@ -9874,14 +9916,14 @@ TEST_CASE("Invalid @import", "[compiler] [at-keyword] [invalid]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid variable in comment", "[compiler] [conditional] [invalid]") +CATCH_TEST_CASE("Invalid variable in comment", "[compiler] [conditional] [invalid]") { // variable is not defined { @@ -9895,7 +9937,7 @@ TEST_CASE("Invalid variable in comment", "[compiler] [conditional] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9908,11 +9950,11 @@ TEST_CASE("Invalid variable in comment", "[compiler] [conditional] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): warning: variable named \"unknown\", used in a comment, is not set.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // variable is not defined @@ -9928,7 +9970,7 @@ TEST_CASE("Invalid variable in comment", "[compiler] [conditional] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9941,11 +9983,11 @@ TEST_CASE("Invalid variable in comment", "[compiler] [conditional] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(2): warning: variable named \"func\", is a function which is not supported in a comment.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // variable is not defined @@ -9961,7 +10003,7 @@ TEST_CASE("Invalid variable in comment", "[compiler] [conditional] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -9974,18 +10016,18 @@ TEST_CASE("Invalid variable in comment", "[compiler] [conditional] [invalid]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(2): warning: variable named \"simple_var\", is not a function, yet you referenced it as such (and functions are not yet supported in comments).\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no left over? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") +CATCH_TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") { { std::stringstream ss; @@ -10019,7 +10061,7 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -10034,7 +10076,7 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -10089,9 +10131,9 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // without spaces @@ -10108,7 +10150,7 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -10123,7 +10165,7 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -10172,9 +10214,9 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // rules with !important @@ -10189,7 +10231,7 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -10204,7 +10246,7 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -10222,9 +10264,9 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // rules with ! important @@ -10239,7 +10281,7 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -10254,7 +10296,7 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -10272,9 +10314,9 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // rules with !important and no spaces @@ -10289,7 +10331,7 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -10304,7 +10346,7 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -10322,9 +10364,9 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // empty rules have to compile too @@ -10341,7 +10383,7 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -10356,7 +10398,7 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() @@ -10365,9 +10407,9 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // special IE8 value which has to be skipped @@ -10387,7 +10429,7 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -10399,7 +10441,7 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") c.compile(false); // no error left over - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(4): warning: the alpha(), chroma() and similar functions of the filter field are Internet Explorer specific extensions which are not supported across browsers.\n" "test.css(5): warning: the alpha(), chroma() and similar functions of the filter field are Internet Explorer specific extensions which are not supported across browsers.\n" ); @@ -10408,7 +10450,7 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -10446,9 +10488,9 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // a simple test with '--no-logo' specified @@ -10466,7 +10508,7 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::compiler c; c.set_root(n); @@ -10481,11 +10523,11 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" + csspp_test::get_default_variables(csspp_test::flag_no_logo_true) + @@ -10502,23 +10544,23 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } // This does not work under Linux, the ifstream.open() accepts a // directory name as input without generating an error // -//TEST_CASE("Cannot open file", "[compiler] [invalid] [input]") +//CATCH_TEST_CASE("Cannot open file", "[compiler] [invalid] [input]") //{ // // generate an error with @error // { // // create a directory in place of the script, so it exists // // and is readable but cannot be opened // rmdir("pseudo-nth-functions.scss"); // in case you run more than once -// REQUIRE(mkdir("pseudo-nth-functions.scss", 0700) == 0); +// CATCH_REQUIRE(mkdir("pseudo-nth-functions.scss", 0700) == 0); // // std::stringstream ss; // ss << "div:nth-child(3n+2){font-style:normal}"; @@ -10530,32 +10572,25 @@ TEST_CASE("Compile keyframes", "[compiler] [stylesheet] [attribute]") // csspp::node::pointer_t n(p.stylesheet()); // // // no errors so far -// REQUIRE_ERRORS(""); +// VERIFY_ERRORS(""); // // csspp::compiler c; // c.set_root(n); // c.clear_paths(); // c.add_path("."); // -// REQUIRE_THROWS_AS(c.compile(true), csspp::csspp_exception_exit &); +// CATCH_REQUIRE_THROWS_AS(c.compile(true), csspp::csspp_exception_exit); // // // TODO: use an RAII class instead // rmdir("pseudo-nth-functions.scss"); // in case you run more than once // -// REQUIRE_ERRORS("pseudo-nth-functions(1): fatal: validation script \"pseudo-nth-functions\" was not found.\n"); +// VERIFY_ERRORS("pseudo-nth-functions(1): fatal: validation script \"pseudo-nth-functions\" was not found.\n"); // -// REQUIRE(c.get_root() == n); +// CATCH_REQUIRE(c.get_root() == n); // } // // // no left over? -// REQUIRE_ERRORS(""); +// VERIFY_ERRORS(""); //} -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_csspp.cpp b/tests/catch_csspp.cpp index e22e563..b3ed928 100644 --- a/tests/catch_csspp.cpp +++ b/tests/catch_csspp.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the csspp.cpp file. @@ -22,15 +24,33 @@ * implementation to ensure full coverage. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// css lib +// +#include +#include +#include + + +// C++ lib +// +#include + -#include "csspp/exceptions.h" -#include "csspp/lexer.h" -#include "csspp/unicode_range.h" +// C lib +// +#include + + +// last include +// +#include -#include -#include namespace { @@ -39,145 +59,145 @@ namespace } // no name namespace -TEST_CASE("Version string", "[csspp] [version]") +CATCH_TEST_CASE("Version string", "[csspp] [version]") { // we expect the test suite to be compiled with the exact same version - REQUIRE(csspp::csspp_library_version() == std::string(CSSPP_VERSION)); + CATCH_REQUIRE(csspp::csspp_library_version() == std::string(CSSPP_VERSION)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Safe boolean", "[csspp] [output]") +CATCH_TEST_CASE("Safe boolean", "[csspp] [output]") { { bool flag(false); - REQUIRE(flag == false); + CATCH_REQUIRE(flag == false); { csspp::safe_bool_t safe(flag); - REQUIRE(flag == true); + CATCH_REQUIRE(flag == true); } - REQUIRE(flag == false); + CATCH_REQUIRE(flag == false); } { bool flag(false); - REQUIRE(flag == false); + CATCH_REQUIRE(flag == false); { csspp::safe_bool_t safe(flag); - REQUIRE(flag == true); + CATCH_REQUIRE(flag == true); flag = false; - REQUIRE(flag == false); + CATCH_REQUIRE(flag == false); } - REQUIRE(flag == false); + CATCH_REQUIRE(flag == false); } { bool flag(true); - REQUIRE(flag == true); + CATCH_REQUIRE(flag == true); { csspp::safe_bool_t safe(flag); - REQUIRE(flag == true); + CATCH_REQUIRE(flag == true); flag = false; - REQUIRE(flag == false); + CATCH_REQUIRE(flag == false); } - REQUIRE(flag == true); + CATCH_REQUIRE(flag == true); } { bool flag(false); - REQUIRE(flag == false); + CATCH_REQUIRE(flag == false); { csspp::safe_bool_t safe(flag, true); - REQUIRE(flag == true); + CATCH_REQUIRE(flag == true); flag = false; - REQUIRE(flag == false); + CATCH_REQUIRE(flag == false); } - REQUIRE(flag == false); + CATCH_REQUIRE(flag == false); } { bool flag(false); - REQUIRE(flag == false); + CATCH_REQUIRE(flag == false); { csspp::safe_bool_t safe(flag, false); - REQUIRE(flag == false); + CATCH_REQUIRE(flag == false); flag = true; - REQUIRE(flag == true); + CATCH_REQUIRE(flag == true); } - REQUIRE(flag == false); + CATCH_REQUIRE(flag == false); } { bool flag(true); - REQUIRE(flag == true); + CATCH_REQUIRE(flag == true); { csspp::safe_bool_t safe(flag, true); - REQUIRE(flag == true); + CATCH_REQUIRE(flag == true); flag = false; - REQUIRE(flag == false); + CATCH_REQUIRE(flag == false); } - REQUIRE(flag == true); + CATCH_REQUIRE(flag == true); } { bool flag(true); - REQUIRE(flag == true); + CATCH_REQUIRE(flag == true); { csspp::safe_bool_t safe(flag, false); - REQUIRE(flag == false); + CATCH_REQUIRE(flag == false); flag = true; - REQUIRE(flag == true); + CATCH_REQUIRE(flag == true); } - REQUIRE(flag == true); + CATCH_REQUIRE(flag == true); } } -TEST_CASE("Decimal number output", "[csspp] [output]") +CATCH_TEST_CASE("Decimal number output", "[csspp] [output]") { - REQUIRE(csspp::decimal_number_to_string(1.0, false) == "1"); - REQUIRE(csspp::decimal_number_to_string(1.2521, false) == "1.252"); - REQUIRE(csspp::decimal_number_to_string(1.2526, false) == "1.253"); - REQUIRE(csspp::decimal_number_to_string(0.0, false) == "0"); - REQUIRE(csspp::decimal_number_to_string(0.2521, false) == "0.252"); - REQUIRE(csspp::decimal_number_to_string(0.2526, false) == "0.253"); + CATCH_REQUIRE(csspp::decimal_number_to_string(1.0, false) == "1"); + CATCH_REQUIRE(csspp::decimal_number_to_string(1.2521, false) == "1.252"); + CATCH_REQUIRE(csspp::decimal_number_to_string(1.2526, false) == "1.253"); + CATCH_REQUIRE(csspp::decimal_number_to_string(0.0, false) == "0"); + CATCH_REQUIRE(csspp::decimal_number_to_string(0.2521, false) == "0.252"); + CATCH_REQUIRE(csspp::decimal_number_to_string(0.2526, false) == "0.253"); { csspp::safe_precision_t precision(2); - REQUIRE(csspp::decimal_number_to_string(1.2513, false) == "1.25"); - REQUIRE(csspp::decimal_number_to_string(1.2561, false) == "1.26"); + CATCH_REQUIRE(csspp::decimal_number_to_string(1.2513, false) == "1.25"); + CATCH_REQUIRE(csspp::decimal_number_to_string(1.2561, false) == "1.26"); } - REQUIRE(csspp::decimal_number_to_string(-1.2526, false) == "-1.253"); - REQUIRE(csspp::decimal_number_to_string(-0.9, false) == "-0.9"); - REQUIRE(csspp::decimal_number_to_string(-0.0009, false) == "-0.001"); - REQUIRE(csspp::decimal_number_to_string(-1000.0, false) == "-1000"); - REQUIRE(csspp::decimal_number_to_string(1000.0, false) == "1000"); - REQUIRE(csspp::decimal_number_to_string(100.0, false) == "100"); - REQUIRE(csspp::decimal_number_to_string(10.0, false) == "10"); - - REQUIRE(csspp::decimal_number_to_string(1.0, true) == "1"); - REQUIRE(csspp::decimal_number_to_string(1.2521, true) == "1.252"); - REQUIRE(csspp::decimal_number_to_string(1.2526, true) == "1.253"); - REQUIRE(csspp::decimal_number_to_string(0.0, true) == "0"); - REQUIRE(csspp::decimal_number_to_string(0.2521, true) == ".252"); - REQUIRE(csspp::decimal_number_to_string(0.2526, true) == ".253"); + CATCH_REQUIRE(csspp::decimal_number_to_string(-1.2526, false) == "-1.253"); + CATCH_REQUIRE(csspp::decimal_number_to_string(-0.9, false) == "-0.9"); + CATCH_REQUIRE(csspp::decimal_number_to_string(-0.0009, false) == "-0.001"); + CATCH_REQUIRE(csspp::decimal_number_to_string(-1000.0, false) == "-1000"); + CATCH_REQUIRE(csspp::decimal_number_to_string(1000.0, false) == "1000"); + CATCH_REQUIRE(csspp::decimal_number_to_string(100.0, false) == "100"); + CATCH_REQUIRE(csspp::decimal_number_to_string(10.0, false) == "10"); + + CATCH_REQUIRE(csspp::decimal_number_to_string(1.0, true) == "1"); + CATCH_REQUIRE(csspp::decimal_number_to_string(1.2521, true) == "1.252"); + CATCH_REQUIRE(csspp::decimal_number_to_string(1.2526, true) == "1.253"); + CATCH_REQUIRE(csspp::decimal_number_to_string(0.0, true) == "0"); + CATCH_REQUIRE(csspp::decimal_number_to_string(0.2521, true) == ".252"); + CATCH_REQUIRE(csspp::decimal_number_to_string(0.2526, true) == ".253"); { csspp::safe_precision_t precision(2); - REQUIRE(csspp::decimal_number_to_string(1.2513, true) == "1.25"); - REQUIRE(csspp::decimal_number_to_string(1.2561, true) == "1.26"); + CATCH_REQUIRE(csspp::decimal_number_to_string(1.2513, true) == "1.25"); + CATCH_REQUIRE(csspp::decimal_number_to_string(1.2561, true) == "1.26"); } - REQUIRE(csspp::decimal_number_to_string(-1.2526, true) == "-1.253"); - REQUIRE(csspp::decimal_number_to_string(-0.9, true) == "-.9"); - REQUIRE(csspp::decimal_number_to_string(-0.0009, true) == "-.001"); - REQUIRE(csspp::decimal_number_to_string(-1000.0, true) == "-1000"); - REQUIRE(csspp::decimal_number_to_string(1000.0, true) == "1000"); - REQUIRE(csspp::decimal_number_to_string(100.0, true) == "100"); - REQUIRE(csspp::decimal_number_to_string(10.0, true) == "10"); + CATCH_REQUIRE(csspp::decimal_number_to_string(-1.2526, true) == "-1.253"); + CATCH_REQUIRE(csspp::decimal_number_to_string(-0.9, true) == "-.9"); + CATCH_REQUIRE(csspp::decimal_number_to_string(-0.0009, true) == "-.001"); + CATCH_REQUIRE(csspp::decimal_number_to_string(-1000.0, true) == "-1000"); + CATCH_REQUIRE(csspp::decimal_number_to_string(1000.0, true) == "1000"); + CATCH_REQUIRE(csspp::decimal_number_to_string(100.0, true) == "100"); + CATCH_REQUIRE(csspp::decimal_number_to_string(10.0, true) == "10"); // super small negative numbers must be output as "0" - REQUIRE(csspp::decimal_number_to_string(-1.2526e-10, true) == "0"); + CATCH_REQUIRE(csspp::decimal_number_to_string(-1.2526e-10, true) == "0"); } -TEST_CASE("Invalid precision", "[csspp] [invalid]") +CATCH_TEST_CASE("Invalid precision", "[csspp] [invalid]") { // we want to keep the default precision in place csspp::safe_precision_t precision; @@ -185,21 +205,14 @@ TEST_CASE("Invalid precision", "[csspp] [invalid]") // negative not available for(int i(-10); i < 0; ++i) { - REQUIRE_THROWS_AS(csspp::set_precision(i), csspp::csspp_exception_overflow &); + CATCH_REQUIRE_THROWS_AS(csspp::set_precision(i), csspp::csspp_exception_overflow); } // too large not acceptable for(int i(11); i <= 20; ++i) { - REQUIRE_THROWS_AS(csspp::set_precision(i), csspp::csspp_exception_overflow &); + CATCH_REQUIRE_THROWS_AS(csspp::set_precision(i), csspp::csspp_exception_overflow); } } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_error.cpp b/tests/catch_error.cpp index 1e2682e..e8dbb71 100644 --- a/tests/catch_error.cpp +++ b/tests/catch_error.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the error.cpp file. @@ -22,18 +24,36 @@ * implementation to ensure full coverage. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// csspp lib +// +#include +#include +#include +#include + + +// C++ lib +// +#include + -#include "csspp/error.h" -#include "csspp/exceptions.h" -#include "csspp/lexer.h" -#include "csspp/unicode_range.h" +// C lib +// +#include -#include -#include +// last include +// +#include -TEST_CASE("Error names", "[error]") + + +CATCH_TEST_CASE("Error names", "[error]") { csspp::error_mode_t e(csspp::error_mode_t::ERROR_DEC); while(e <= csspp::error_mode_t::ERROR_WARNING) @@ -45,31 +65,31 @@ TEST_CASE("Error names", "[error]") switch(e) { case csspp::error_mode_t::ERROR_DEBUG: - REQUIRE(name == "debug"); + CATCH_REQUIRE(name == "debug"); break; case csspp::error_mode_t::ERROR_DEC: - REQUIRE(name == "dec"); + CATCH_REQUIRE(name == "dec"); break; case csspp::error_mode_t::ERROR_ERROR: - REQUIRE(name == "error"); + CATCH_REQUIRE(name == "error"); break; case csspp::error_mode_t::ERROR_FATAL: - REQUIRE(name == "fatal"); + CATCH_REQUIRE(name == "fatal"); break; case csspp::error_mode_t::ERROR_HEX: - REQUIRE(name == "hex"); + CATCH_REQUIRE(name == "hex"); break; case csspp::error_mode_t::ERROR_INFO: - REQUIRE(name == "info"); + CATCH_REQUIRE(name == "info"); break; case csspp::error_mode_t::ERROR_WARNING: - REQUIRE(name == "warning"); + CATCH_REQUIRE(name == "warning"); break; } @@ -78,10 +98,10 @@ TEST_CASE("Error names", "[error]") } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Error messages", "[error] [output]") +CATCH_TEST_CASE("Error messages", "[error] [output]") { csspp::error_count_t error_count(csspp::error::instance().get_error_count()); csspp::error_count_t warning_count(csspp::error::instance().get_warning_count()); @@ -96,13 +116,13 @@ TEST_CASE("Error messages", "[error] [output]") << " U+" << csspp::error_mode_t::ERROR_HEX << 123 << "." << csspp::error_mode_t::ERROR_FATAL; - REQUIRE_ERRORS("test.css(1): fatal: testing errors: 123 U+7b.\n"); + VERIFY_ERRORS("test.css(1): fatal: testing errors: 123 U+7b.\n"); ++error_count; - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); - REQUIRE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); } { @@ -114,13 +134,13 @@ TEST_CASE("Error messages", "[error] [output]") << " (" << csspp::error_mode_t::ERROR_DEC << 133 << ")." << csspp::error_mode_t::ERROR_ERROR; - REQUIRE_ERRORS("test.css(1): error: testing errors: U+53 (133).\n"); + VERIFY_ERRORS("test.css(1): error: testing errors: U+53 (133).\n"); ++error_count; - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); - REQUIRE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); } { @@ -134,13 +154,13 @@ TEST_CASE("Error messages", "[error] [output]") << " decimal: " << csspp::error_mode_t::ERROR_DEC << 123.25 << "." << csspp::error_mode_t::ERROR_WARNING; - REQUIRE_ERRORS("test.css(1): warning: testing warnings: U+7b decimal: 123.25.\n"); + VERIFY_ERRORS("test.css(1): warning: testing warnings: U+7b decimal: 123.25.\n"); ++warning_count; - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); - REQUIRE_FALSE(happened.error_happened()); - REQUIRE(happened.warning_happened()); + CATCH_REQUIRE_FALSE(happened.error_happened()); + CATCH_REQUIRE(happened.warning_happened()); } { @@ -152,14 +172,14 @@ TEST_CASE("Error messages", "[error] [output]") << " decimal: " << csspp::error_mode_t::ERROR_DEC << 123.25 << "." << csspp::error_mode_t::ERROR_WARNING; - REQUIRE_ERRORS("test.css(1): warning: testing warnings: U+7b decimal: 123.25.\n"); + VERIFY_ERRORS("test.css(1): warning: testing warnings: U+7b decimal: 123.25.\n"); ++error_count; - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); csspp::error::instance().set_count_warnings_as_errors(false); - REQUIRE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); } { @@ -170,20 +190,20 @@ TEST_CASE("Error messages", "[error] [output]") << " decimal: " << csspp::error_mode_t::ERROR_DEC << 123.25 << "." << csspp::error_mode_t::ERROR_WARNING; - REQUIRE_ERRORS("test.css(1): warning: testing warnings: U+7b decimal: 123.25.\n"); + VERIFY_ERRORS("test.css(1): warning: testing warnings: U+7b decimal: 123.25.\n"); ++warning_count; - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); - REQUIRE_FALSE(happened.error_happened()); - REQUIRE(happened.warning_happened()); + CATCH_REQUIRE_FALSE(happened.error_happened()); + CATCH_REQUIRE(happened.warning_happened()); } } // the safe_error restores the counters to what they were before the '{' --error_count; warning_count -= 2; - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); { csspp::error_happened_t happened; @@ -193,12 +213,12 @@ TEST_CASE("Error messages", "[error] [output]") << " decimal: " << csspp::error_mode_t::ERROR_DEC << 213.25 << "." << csspp::error_mode_t::ERROR_INFO; - REQUIRE_ERRORS("test.css(1): info: testing info: U+78 decimal: 213.25.\n"); - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + VERIFY_ERRORS("test.css(1): info: testing info: U+78 decimal: 213.25.\n"); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); - REQUIRE_FALSE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE_FALSE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); } { @@ -209,12 +229,12 @@ TEST_CASE("Error messages", "[error] [output]") << " decimal: " << csspp::error_mode_t::ERROR_DEC << 13.25 << "." << csspp::error_mode_t::ERROR_DEBUG; - REQUIRE_ERRORS(""); - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + VERIFY_ERRORS(""); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); - REQUIRE_FALSE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE_FALSE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); } { @@ -226,13 +246,13 @@ TEST_CASE("Error messages", "[error] [output]") << " decimal: " << csspp::error_mode_t::ERROR_DEC << 13.25 << "." << csspp::error_mode_t::ERROR_DEBUG; - REQUIRE_ERRORS("test.css(1): debug: testing debug: U+70 decimal: 13.25.\n"); - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + VERIFY_ERRORS("test.css(1): debug: testing debug: U+70 decimal: 13.25.\n"); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); csspp::error::instance().set_show_debug(false); - REQUIRE_FALSE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE_FALSE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); } { @@ -243,12 +263,12 @@ TEST_CASE("Error messages", "[error] [output]") << " decimal: " << csspp::error_mode_t::ERROR_DEC << 13.25 << "." << csspp::error_mode_t::ERROR_DEBUG; - REQUIRE_ERRORS(""); - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + VERIFY_ERRORS(""); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); - REQUIRE_FALSE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE_FALSE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); } { @@ -257,21 +277,21 @@ TEST_CASE("Error messages", "[error] [output]") csspp::error::instance().set_verbose(true); csspp::error::instance() << p << "verbose message to debug the compiler." << csspp::error_mode_t::ERROR_INFO; - REQUIRE_ERRORS("test.css(1): info: verbose message to debug the compiler.\n"); - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + VERIFY_ERRORS("test.css(1): info: verbose message to debug the compiler.\n"); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); - REQUIRE_FALSE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE_FALSE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); csspp::error::instance().set_verbose(false); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Error messages when hidden", "[error] [output] [hidden]") +CATCH_TEST_CASE("Error messages when hidden", "[error] [output] [hidden]") { csspp::error_count_t error_count(csspp::error::instance().get_error_count()); csspp::error_count_t warning_count(csspp::error::instance().get_warning_count()); @@ -288,13 +308,13 @@ TEST_CASE("Error messages when hidden", "[error] [output] [hidden]") << " U+" << csspp::error_mode_t::ERROR_HEX << 123 << "." << csspp::error_mode_t::ERROR_FATAL; - REQUIRE_ERRORS("test.css(1): fatal: testing errors: 123 U+7b.\n"); + VERIFY_ERRORS("test.css(1): fatal: testing errors: 123 U+7b.\n"); ++error_count; - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); - REQUIRE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); } { @@ -306,13 +326,13 @@ TEST_CASE("Error messages when hidden", "[error] [output] [hidden]") << " (" << csspp::error_mode_t::ERROR_DEC << 133 << ")." << csspp::error_mode_t::ERROR_ERROR; - REQUIRE_ERRORS("test.css(1): error: testing errors: U+53 (133).\n"); + VERIFY_ERRORS("test.css(1): error: testing errors: U+53 (133).\n"); ++error_count; - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); - REQUIRE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); } { @@ -326,12 +346,12 @@ TEST_CASE("Error messages when hidden", "[error] [output] [hidden]") << " decimal: " << csspp::error_mode_t::ERROR_DEC << 123.25 << "." << csspp::error_mode_t::ERROR_WARNING; - REQUIRE_ERRORS(""); - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + VERIFY_ERRORS(""); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); - REQUIRE_FALSE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE_FALSE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); } { @@ -343,14 +363,14 @@ TEST_CASE("Error messages when hidden", "[error] [output] [hidden]") << " decimal: " << csspp::error_mode_t::ERROR_DEC << 123.25 << "." << csspp::error_mode_t::ERROR_WARNING; - REQUIRE_ERRORS("test.css(1): warning: testing warnings: U+7b decimal: 123.25.\n"); + VERIFY_ERRORS("test.css(1): warning: testing warnings: U+7b decimal: 123.25.\n"); ++error_count; - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); csspp::error::instance().set_count_warnings_as_errors(false); - REQUIRE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); } { @@ -361,19 +381,19 @@ TEST_CASE("Error messages when hidden", "[error] [output] [hidden]") << " decimal: " << csspp::error_mode_t::ERROR_DEC << 123.25 << "." << csspp::error_mode_t::ERROR_WARNING; - REQUIRE_ERRORS(""); - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + VERIFY_ERRORS(""); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); - REQUIRE_FALSE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE_FALSE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); } } // the safe_error restores the counters to what they were before the '{' --error_count; warning_count -= 0; - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); { csspp::error_happened_t happened; @@ -383,12 +403,12 @@ TEST_CASE("Error messages when hidden", "[error] [output] [hidden]") << " decimal: " << csspp::error_mode_t::ERROR_DEC << 213.25 << "." << csspp::error_mode_t::ERROR_INFO; - REQUIRE_ERRORS(""); - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + VERIFY_ERRORS(""); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); - REQUIRE_FALSE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE_FALSE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); } { @@ -399,12 +419,12 @@ TEST_CASE("Error messages when hidden", "[error] [output] [hidden]") << " decimal: " << csspp::error_mode_t::ERROR_DEC << 13.25 << "." << csspp::error_mode_t::ERROR_DEBUG; - REQUIRE_ERRORS(""); - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + VERIFY_ERRORS(""); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); - REQUIRE_FALSE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE_FALSE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); } { @@ -416,13 +436,13 @@ TEST_CASE("Error messages when hidden", "[error] [output] [hidden]") << " decimal: " << csspp::error_mode_t::ERROR_DEC << 13.25 << "." << csspp::error_mode_t::ERROR_DEBUG; - REQUIRE_ERRORS(""); - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + VERIFY_ERRORS(""); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); csspp::error::instance().set_show_debug(false); - REQUIRE_FALSE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE_FALSE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); } { @@ -433,12 +453,12 @@ TEST_CASE("Error messages when hidden", "[error] [output] [hidden]") << " decimal: " << csspp::error_mode_t::ERROR_DEC << 13.25 << "." << csspp::error_mode_t::ERROR_DEBUG; - REQUIRE_ERRORS(""); - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + VERIFY_ERRORS(""); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); - REQUIRE_FALSE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE_FALSE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); } { @@ -447,12 +467,12 @@ TEST_CASE("Error messages when hidden", "[error] [output] [hidden]") csspp::error::instance().set_verbose(true); csspp::error::instance() << p << "verbose message to debug the compiler." << csspp::error_mode_t::ERROR_INFO; - REQUIRE_ERRORS(""); - REQUIRE(error_count == csspp::error::instance().get_error_count()); - REQUIRE(warning_count == csspp::error::instance().get_warning_count()); + VERIFY_ERRORS(""); + CATCH_REQUIRE(error_count == csspp::error::instance().get_error_count()); + CATCH_REQUIRE(warning_count == csspp::error::instance().get_warning_count()); - REQUIRE_FALSE(happened.error_happened()); - REQUIRE_FALSE(happened.warning_happened()); + CATCH_REQUIRE_FALSE(happened.error_happened()); + CATCH_REQUIRE_FALSE(happened.warning_happened()); csspp::error::instance().set_verbose(false); } @@ -460,29 +480,22 @@ TEST_CASE("Error messages when hidden", "[error] [output] [hidden]") csspp::error::instance().set_hide_all(false); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Error stream", "[error] [stream]") +CATCH_TEST_CASE("Error stream", "[error] [stream]") { { std::stringstream ss; std::ostream & errout(csspp::error::instance().get_error_stream()); - REQUIRE(&errout != &ss); + CATCH_REQUIRE(&errout != &ss); { csspp::safe_error_stream_t safe_stream(ss); - REQUIRE(&csspp::error::instance().get_error_stream() == &ss); + CATCH_REQUIRE(&csspp::error::instance().get_error_stream() == &ss); } - REQUIRE(&csspp::error::instance().get_error_stream() != &ss); - REQUIRE(&csspp::error::instance().get_error_stream() == &errout); + CATCH_REQUIRE(&csspp::error::instance().get_error_stream() != &ss); + CATCH_REQUIRE(&csspp::error::instance().get_error_stream() == &errout); } } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_expr_additive.cpp b/tests/catch_expr_additive.cpp index 9550959..9433974 100644 --- a/tests/catch_expr_additive.cpp +++ b/tests/catch_expr_additive.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the expression.cpp file: "+" and "-" operators. @@ -32,16 +34,31 @@ * classes. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// csspp lib +// +#include +#include +#include +#include + + +// C++ lib +// +#include + + +// last include +// +#include -#include "csspp/assembler.h" -#include "csspp/compiler.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include -TEST_CASE("Expression integer +/- integer", "[expression] [additive]") +CATCH_TEST_CASE("Expression integer +/- integer", "[expression] [additive]") { // add sizes without dimensions { @@ -68,7 +85,7 @@ TEST_CASE("Expression integer +/- integer", "[expression] [additive]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -89,12 +106,12 @@ TEST_CASE("Expression integer +/- integer", "[expression] [additive]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:13}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract sizes without dimensions @@ -122,7 +139,7 @@ TEST_CASE("Expression integer +/- integer", "[expression] [additive]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -143,12 +160,12 @@ TEST_CASE("Expression integer +/- integer", "[expression] [additive]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:-7}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // add pixels @@ -176,7 +193,7 @@ TEST_CASE("Expression integer +/- integer", "[expression] [additive]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -197,12 +214,12 @@ TEST_CASE("Expression integer +/- integer", "[expression] [additive]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:13px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract pixels @@ -230,7 +247,7 @@ TEST_CASE("Expression integer +/- integer", "[expression] [additive]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -251,19 +268,19 @@ TEST_CASE("Expression integer +/- integer", "[expression] [additive]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:7px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression integer +/- integer with incompatible dimensions", "[expression] [additive] [invalid]") +CATCH_TEST_CASE("Expression integer +/- integer with incompatible dimensions", "[expression] [additive] [invalid]") { // px + "" { @@ -286,9 +303,9 @@ TEST_CASE("Expression integer +/- integer with incompatible dimensions", "[expre //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible dimensions: \"px\" and \"\" cannot be used as is with operator '+'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible dimensions: \"px\" and \"\" cannot be used as is with operator '+'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // px - "" @@ -312,9 +329,9 @@ TEST_CASE("Expression integer +/- integer with incompatible dimensions", "[expre //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible dimensions: \"px\" and \"\" cannot be used as is with operator '-'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible dimensions: \"px\" and \"\" cannot be used as is with operator '-'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // "" + em @@ -338,9 +355,9 @@ TEST_CASE("Expression integer +/- integer with incompatible dimensions", "[expre //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible dimensions: \"\" and \"em\" cannot be used as is with operator '+'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible dimensions: \"\" and \"em\" cannot be used as is with operator '+'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // "" - em @@ -364,9 +381,9 @@ TEST_CASE("Expression integer +/- integer with incompatible dimensions", "[expre //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible dimensions: \"\" and \"em\" cannot be used as is with operator '-'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible dimensions: \"\" and \"em\" cannot be used as is with operator '-'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // px + em @@ -390,9 +407,9 @@ TEST_CASE("Expression integer +/- integer with incompatible dimensions", "[expre //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible dimensions: \"px\" and \"em\" cannot be used as is with operator '+'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible dimensions: \"px\" and \"em\" cannot be used as is with operator '+'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // px - em @@ -416,9 +433,9 @@ TEST_CASE("Expression integer +/- integer with incompatible dimensions", "[expre //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible dimensions: \"px\" and \"em\" cannot be used as is with operator '-'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible dimensions: \"px\" and \"em\" cannot be used as is with operator '-'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // string - string @@ -442,18 +459,18 @@ TEST_CASE("Expression integer +/- integer with incompatible dimensions", "[expre //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types between STRING (lhs) and STRING (rhs) for operator '-'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types between STRING (lhs) and STRING (rhs) for operator '-'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression additive errors", "[expression] [additive] [invalid]") +CATCH_TEST_CASE("Expression additive errors", "[expression] [additive] [invalid]") { - SECTION("an invalid unary value generates an error caught in additive") + CATCH_START_SECTION("an invalid unary value generates an error caught in additive") { std::stringstream ss; ss << "div { width: ?; }"; @@ -474,12 +491,13 @@ TEST_CASE("Expression additive errors", "[expression] [additive] [invalid]") //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("an invalid unary on the right side of the operator") + CATCH_START_SECTION("an invalid unary on the right side of the operator") { std::stringstream ss; ss << "div { width: 3 + ?; }"; @@ -500,12 +518,13 @@ TEST_CASE("Expression additive errors", "[expression] [additive] [invalid]") //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("cannot add a unicode range with anything") + CATCH_START_SECTION("cannot add a unicode range with anything") { std::stringstream ss; ss << "div { width: 3 + U+4??; }"; @@ -526,16 +545,17 @@ TEST_CASE("Expression additive errors", "[expression] [additive] [invalid]") //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types between INTEGER and UNICODE_RANGE for operator '+'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types between INTEGER and UNICODE_RANGE for operator '+'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression decimal number or integer +/- decimal number or integer", "[expression] [additive]") +CATCH_TEST_CASE("Expression decimal number or integer +/- decimal number or integer", "[expression] [additive]") { // add sizes without dimensions; both decimal with non zero decimals { @@ -556,7 +576,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -564,7 +584,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -585,12 +605,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:13.7}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // add sizes without dimensions; one integer and one decimal with non zero decimals @@ -612,7 +632,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -620,7 +640,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -641,12 +661,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:13.2}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // add sizes without dimensions; one integer and one decimal with non zero decimals @@ -668,7 +688,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -676,7 +696,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -697,12 +717,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:13.5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // add sizes without dimensions; both decimal with zero decimals @@ -724,7 +744,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -732,7 +752,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -753,12 +773,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:13}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // add sizes without dimensions; one integer and one decimal with zero decimals @@ -780,7 +800,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -788,7 +808,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -809,12 +829,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:13}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // add sizes without dimensions; one integer and one decimal with zero decimals @@ -836,7 +856,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -844,7 +864,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -865,12 +885,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:13}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract sizes without dimensions; with decimal numbers @@ -892,7 +912,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -900,7 +920,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -921,12 +941,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:-6.5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract sizes without dimensions; with integer and decimal numbers @@ -948,7 +968,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -956,7 +976,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -977,12 +997,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:-7.2}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract sizes without dimensions; with integer and decimal numbers @@ -1004,7 +1024,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1012,7 +1032,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1033,12 +1053,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:-6.5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract sizes without dimensions; with decimal numbers @@ -1060,7 +1080,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1068,7 +1088,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1089,12 +1109,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:-7}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract sizes without dimensions; with an integer and a decimal number @@ -1116,7 +1136,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1124,7 +1144,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1145,12 +1165,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:-7}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract sizes without dimensions; with an integer and a decimal number @@ -1172,7 +1192,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1180,7 +1200,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1201,12 +1221,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:-7}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // add pixels; both decimal numbers @@ -1228,7 +1248,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1236,7 +1256,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1257,12 +1277,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:13.7px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // add pixels; both decimal numbers @@ -1284,7 +1304,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1292,7 +1312,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1313,12 +1333,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:13.7px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // add pixels; integer and decimal number @@ -1340,7 +1360,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1348,7 +1368,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1369,12 +1389,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:13.5px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // add pixels; integer and decimal number @@ -1396,7 +1416,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1404,7 +1424,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1425,12 +1445,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:13.2px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract pixels; both decimals @@ -1452,7 +1472,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1460,7 +1480,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1481,12 +1501,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:6.7px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract pixels; one integer and one decimal @@ -1508,7 +1528,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1516,7 +1536,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1537,12 +1557,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:6.5px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract pixels; one integer and one decimal @@ -1564,7 +1584,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1572,7 +1592,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1593,12 +1613,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:7.2px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // add pixels; both decimal numbers @@ -1620,7 +1640,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1628,7 +1648,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1649,12 +1669,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:13em}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // add pixels; integer and decimal number @@ -1676,7 +1696,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1684,7 +1704,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1705,12 +1725,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:13em}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // add pixels; integer and decimal number @@ -1732,7 +1752,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1740,7 +1760,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1761,12 +1781,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:13em}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract pixels; both decimals @@ -1788,7 +1808,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1796,7 +1816,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1817,12 +1837,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:7em}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract pixels; one integer and one decimal @@ -1844,7 +1864,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1852,7 +1872,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1873,12 +1893,12 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:7em}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract pixels; one integer and one decimal @@ -1900,7 +1920,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1908,7 +1928,7 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1929,19 +1949,19 @@ TEST_CASE("Expression decimal number or integer +/- decimal number or integer", //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:7em}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression percent +/- percent", "[expression] [additive]") +CATCH_TEST_CASE("Expression percent +/- percent", "[expression] [additive]") { // add percents; both decimal with non zero decimals { @@ -1962,7 +1982,7 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1970,7 +1990,7 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1991,12 +2011,12 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:13.7%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // add percents; use what looks like an integer and a decimal number @@ -2018,7 +2038,7 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2026,7 +2046,7 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2047,12 +2067,12 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:13.2%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // add percents; use what looks like an integer and a decimal number @@ -2074,7 +2094,7 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2082,7 +2102,7 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2103,12 +2123,12 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:13.5%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract percents; both decimal with non zero decimals @@ -2130,7 +2150,7 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2138,7 +2158,7 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2159,12 +2179,12 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:6.7%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract percents; use what looks like an integer and a decimal number @@ -2186,7 +2206,7 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2194,7 +2214,7 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2215,12 +2235,12 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:7.2%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // subtract percents; use what looks like an integer and a decimal number @@ -2242,7 +2262,7 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2250,7 +2270,7 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2271,21 +2291,21 @@ TEST_CASE("Expression percent +/- percent", "[expression] [additive]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:6.5%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [additive] [colors]") +CATCH_TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [additive] [colors]") { - SECTION("add two colors together") + CATCH_START_SECTION("add two colors together") { std::stringstream ss; ss << "div { color: (red + blue) / 2; }"; @@ -2304,7 +2324,7 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2312,7 +2332,7 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2333,15 +2353,16 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:purple}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("subtract a color from another") + CATCH_START_SECTION("subtract a color from another") { std::stringstream ss; ss << "div { color: white - purple; }"; @@ -2360,7 +2381,7 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2368,7 +2389,7 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2389,15 +2410,16 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:transparent}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("subtract a color from another and rescue the alpha channel") + CATCH_START_SECTION("subtract a color from another and rescue the alpha channel") { std::stringstream ss; ss << "div { color: rgba(white - purple, 1); }"; @@ -2416,7 +2438,7 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2424,7 +2446,7 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2445,15 +2467,16 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:#7fff7f}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("add an offset to a color") + CATCH_START_SECTION("add an offset to a color") { std::stringstream ss; ss << "div { color: black + 1; background-color: black + 0.25; }"; @@ -2472,7 +2495,7 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2480,7 +2503,7 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2505,15 +2528,16 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:#fff;background-color:#404040}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("add an offset to a color (swapped)") + CATCH_START_SECTION("add an offset to a color (swapped)") { std::stringstream ss; ss << "div { color: 1 + black; background-color: 0.25 + black; }"; @@ -2532,7 +2556,7 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2540,7 +2564,7 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2565,15 +2589,16 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:#fff;background-color:#404040}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("subtract an offset from a color") + CATCH_START_SECTION("subtract an offset from a color") { std::stringstream ss; ss << "div { color: white - 1; background-color: white - 0.25; }"; @@ -2592,7 +2617,7 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2600,7 +2625,7 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2625,15 +2650,16 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:transparent;background-color:rgba(191,191,191,.75)}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("subtract a color from an offset") + CATCH_START_SECTION("subtract a color from an offset") { std::stringstream ss; ss << "div { color: 1 - forestgreen; background-color: 0.25 - chocolate; }"; @@ -2652,7 +2678,7 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2660,7 +2686,7 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2685,21 +2711,22 @@ TEST_CASE("Expression color or offset +/- color or offsets", "[expression] [addi //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:transparent;background-color:transparent}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression color +/- offset with a dimension", "[expression] [additive] [colors] [invalid]") +CATCH_TEST_CASE("Expression color +/- offset with a dimension", "[expression] [additive] [colors] [invalid]") { - SECTION("color + 3px") + CATCH_START_SECTION("color + 3px") { std::stringstream ss; ss << "div { color: red + 3px; }"; @@ -2718,14 +2745,15 @@ TEST_CASE("Expression color +/- offset with a dimension", "[expression] [additiv c.compile(false); - REQUIRE_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3px is not acceptable.\n"); + VERIFY_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3px is not acceptable.\n"); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("color - 3px") + CATCH_START_SECTION("color - 3px") { std::stringstream ss; ss << "div { color: red - 3px; }"; @@ -2744,14 +2772,15 @@ TEST_CASE("Expression color +/- offset with a dimension", "[expression] [additiv c.compile(false); - REQUIRE_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3px is not acceptable.\n"); + VERIFY_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3px is not acceptable.\n"); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("3px + color") + CATCH_START_SECTION("3px + color") { std::stringstream ss; ss << "div { color: 3px + red; }"; @@ -2770,14 +2799,15 @@ TEST_CASE("Expression color +/- offset with a dimension", "[expression] [additiv c.compile(false); - REQUIRE_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3px is not acceptable.\n"); + VERIFY_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3px is not acceptable.\n"); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("3px - color") + CATCH_START_SECTION("3px - color") { std::stringstream ss; ss << "div { color: 3px - red; }"; @@ -2796,14 +2826,15 @@ TEST_CASE("Expression color +/- offset with a dimension", "[expression] [additiv c.compile(false); - REQUIRE_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3px is not acceptable.\n"); + VERIFY_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3px is not acceptable.\n"); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("color + 3.2px") + CATCH_START_SECTION("color + 3.2px") { std::stringstream ss; ss << "div { color: red + 3.2px; }"; @@ -2822,14 +2853,15 @@ TEST_CASE("Expression color +/- offset with a dimension", "[expression] [additiv c.compile(false); - REQUIRE_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3.2px is not acceptable.\n"); + VERIFY_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3.2px is not acceptable.\n"); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("color - 3.2px") + CATCH_START_SECTION("color - 3.2px") { std::stringstream ss; ss << "div { color: red - 3.2px; }"; @@ -2848,14 +2880,15 @@ TEST_CASE("Expression color +/- offset with a dimension", "[expression] [additiv c.compile(false); - REQUIRE_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3.2px is not acceptable.\n"); + VERIFY_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3.2px is not acceptable.\n"); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("3.2px + color") + CATCH_START_SECTION("3.2px + color") { std::stringstream ss; ss << "div { color: 3.2px + red; }"; @@ -2874,14 +2907,15 @@ TEST_CASE("Expression color +/- offset with a dimension", "[expression] [additiv c.compile(false); - REQUIRE_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3.2px is not acceptable.\n"); + VERIFY_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3.2px is not acceptable.\n"); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("3.2px - color") + CATCH_START_SECTION("3.2px - color") { std::stringstream ss; ss << "div { color: 3.2px - red; }"; @@ -2900,22 +2934,16 @@ TEST_CASE("Expression color +/- offset with a dimension", "[expression] [additiv c.compile(false); - REQUIRE_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3.2px is not acceptable.\n"); + VERIFY_ERRORS("test.css(1): error: color offsets (numbers added with + or - operators) must be unit less values, 3.2px is not acceptable.\n"); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_expr_conditional.cpp b/tests/catch_expr_conditional.cpp index eab6147..720fb85 100644 --- a/tests/catch_expr_conditional.cpp +++ b/tests/catch_expr_conditional.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the expression.cpp file: "?:" operator. @@ -32,18 +34,33 @@ * classes. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// csspp lib +// +#include +#include +#include +#include + + +// C++ lib +// +#include + + +// last include +// +#include -#include "csspp/assembler.h" -#include "csspp/compiler.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include -TEST_CASE("Expression boolean ? a : b", "[expression] [conditional]") +CATCH_TEST_CASE("Expression boolean ? a : b", "[expression] [conditional]") { - SECTION("check 10 = 3 ? 9 : 5") + CATCH_START_SECTION("check 10 = 3 ? 9 : 5") { std::stringstream ss; ss << "div { z-index: 10 = 3 ? 9 : 5; }"; @@ -68,7 +85,7 @@ TEST_CASE("Expression boolean ? a : b", "[expression] [conditional]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -89,17 +106,18 @@ TEST_CASE("Expression boolean ? a : b", "[expression] [conditional]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("check 10 != 3 ? 9 : 5") + CATCH_START_SECTION("check 10 != 3 ? 9 : 5") { std::stringstream ss; ss << "div { z-index: 10 != 3 ? 9 : 5; }"; @@ -124,7 +142,7 @@ TEST_CASE("Expression boolean ? a : b", "[expression] [conditional]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -145,17 +163,18 @@ TEST_CASE("Expression boolean ? a : b", "[expression] [conditional]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:9}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("check 10 != 3 ? \"string\" : 5") + CATCH_START_SECTION("check 10 != 3 ? \"string\" : 5") { std::stringstream ss; ss << "div { content: 10 != 3 ? \"string\" : 5; }"; @@ -180,7 +199,7 @@ TEST_CASE("Expression boolean ? a : b", "[expression] [conditional]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -201,23 +220,24 @@ TEST_CASE("Expression boolean ? a : b", "[expression] [conditional]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{content:\"string\"}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression invalid ? invalid : invalid", "[expression] [conditional] [invalid]") +CATCH_TEST_CASE("Expression invalid ? invalid : invalid", "[expression] [conditional] [invalid]") { - SECTION("just ? is not a valid number") + CATCH_START_SECTION("just ? is not a valid number") { std::stringstream ss; ss << "div { border: ?; }"; @@ -238,12 +258,13 @@ TEST_CASE("Expression invalid ? invalid : invalid", "[expression] [conditional] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("number ? ? ... is invalid") + CATCH_START_SECTION("number ? ? ... is invalid") { std::stringstream ss; ss << "div { width: 10px ? ?; }"; @@ -264,12 +285,13 @@ TEST_CASE("Expression invalid ? invalid : invalid", "[expression] [conditional] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("true ? 3em : ? is invalid") + CATCH_START_SECTION("true ? 3em : ? is invalid") { std::stringstream ss; ss << "div { width: true ? 3em : ?; }"; @@ -290,12 +312,13 @@ TEST_CASE("Expression invalid ? invalid : invalid", "[expression] [conditional] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type EOF_TOKEN as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type EOF_TOKEN as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("true ? 3em 10em is invalid, missing ':'") + CATCH_START_SECTION("true ? 3em 10em is invalid, missing ':'") { std::stringstream ss; ss << "div { width: true ? 3em 10em; }"; @@ -316,12 +339,13 @@ TEST_CASE("Expression invalid ? invalid : invalid", "[expression] [conditional] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a mandatory ':' was expected after a '?' first expression.\n"); + VERIFY_ERRORS("test.css(1): error: a mandatory ':' was expected after a '?' first expression.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("unicode-range ? 3em : 10em is invalid, not a boolean") + CATCH_START_SECTION("unicode-range ? 3em : 10em is invalid, not a boolean") { std::stringstream ss; ss << "div { width: unicode-range ? 3em : 10em; }"; @@ -342,12 +366,13 @@ TEST_CASE("Expression invalid ? invalid : invalid", "[expression] [conditional] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a boolean expression was expected.\n"); + VERIFY_ERRORS("test.css(1): error: a boolean expression was expected.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("' false ? 3em : ' is invalid, something's missing") + CATCH_START_SECTION("' false ? 3em : ' is invalid, something's missing") { std::stringstream ss; ss << "div { width: false ? 3em : ; }"; @@ -368,20 +393,14 @@ TEST_CASE("Expression invalid ? invalid : invalid", "[expression] [conditional] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type EOF_TOKEN as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type EOF_TOKEN as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_expr_equality.cpp b/tests/catch_expr_equality.cpp index 1f6a352..39ba12b 100644 --- a/tests/catch_expr_equality.cpp +++ b/tests/catch_expr_equality.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the expression.cpp file: "=", "!=", "~=", "^=", "$=", @@ -35,18 +37,33 @@ * classes. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// csspp lib +// +#include +#include +#include +#include + + +// C++ lib +// +#include + + +// last include +// +#include -#include "csspp/assembler.h" -#include "csspp/compiler.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include -TEST_CASE("Expression number =,!= number", "[expression] [equality]") +CATCH_TEST_CASE("Expression number =,!= number", "[expression] [equality]") { - SECTION("compare 10 = 3") + CATCH_START_SECTION("compare 10 = 3") { std::stringstream ss; ss << "div { z-index: 10 = 3 ? 9 : 5; }"; @@ -71,7 +88,7 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -92,17 +109,18 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("compare 10 != 3") + CATCH_START_SECTION("compare 10 != 3") { std::stringstream ss; ss << "div { z-index: 10 " @@ -129,7 +147,7 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -150,17 +168,18 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:9}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("compare 10.2 = 3.1") + CATCH_START_SECTION("compare 10.2 = 3.1") { std::stringstream ss; ss << "div { z-index: 10.2 = 3.1 ? 9 : 5; }"; @@ -185,7 +204,7 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -206,17 +225,18 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("compare 10.2 != 3.1") + CATCH_START_SECTION("compare 10.2 != 3.1") { std::stringstream ss; ss << "div { z-index: 10.2 != 3.1 ? 9 : 5; }"; @@ -241,7 +261,7 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -262,17 +282,18 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:9}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("compare 10 = 3.1") + CATCH_START_SECTION("compare 10 = 3.1") { std::stringstream ss; ss << "div { z-index: 10 = 3.1 ? 9 : 5; }"; @@ -297,7 +318,7 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -318,17 +339,18 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("compare 10 != 3.1") + CATCH_START_SECTION("compare 10 != 3.1") { std::stringstream ss; ss << "div { z-index: 10 not-equal 3.1 ? 9 : 5; }"; @@ -353,7 +375,7 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -374,17 +396,18 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:9}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("compare 10.2 = 3") + CATCH_START_SECTION("compare 10.2 = 3") { std::stringstream ss; ss << "div { z-index: 10.2 = 3 ? 9 : 5; }"; @@ -409,7 +432,7 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -430,17 +453,18 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("compare 10.2 != 3") + CATCH_START_SECTION("compare 10.2 != 3") { std::stringstream ss; ss << "div { z-index: 10.2 " @@ -467,7 +491,7 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -488,17 +512,18 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:9}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("compare (5 = 5) = (7.1 = 7.1)") + CATCH_START_SECTION("compare (5 = 5) = (7.1 = 7.1)") { std::stringstream ss; ss << "div { z-index: (5 = 5) = (7.1 = 7.1)" @@ -524,7 +549,7 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -545,17 +570,18 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:9}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("compare (5 = 5) != (7.1 = 7.1)") + CATCH_START_SECTION("compare (5 = 5) != (7.1 = 7.1)") { std::stringstream ss; ss << "div { z-index: (5 = 5) != (7.1 = 7.1)" @@ -581,7 +607,7 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -602,17 +628,18 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("compare 7.1% = 7.1%)") + CATCH_START_SECTION("compare 7.1% = 7.1%)") { std::stringstream ss; ss << "div { z-index: 7.1% = 7.1% ? 9 : 5; }"; @@ -637,7 +664,7 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -658,17 +685,18 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:9}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("compare 7.1% != 7.1%)") + CATCH_START_SECTION("compare 7.1% != 7.1%)") { std::stringstream ss; ss << "div { z-index: 7.1% != 7.1% ? 9 : 5; }"; @@ -693,7 +721,7 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -714,23 +742,24 @@ TEST_CASE("Expression number =,!= number", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression color =,!= color", "[expression] [equality]") +CATCH_TEST_CASE("Expression color =,!= color", "[expression] [equality]") { - SECTION("compare black = white") + CATCH_START_SECTION("compare black = white") { std::stringstream ss; ss << "div { z-index: black = white ? 9 : 5; }"; @@ -755,7 +784,7 @@ TEST_CASE("Expression color =,!= color", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -776,17 +805,18 @@ TEST_CASE("Expression color =,!= color", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("compare black = #000") + CATCH_START_SECTION("compare black = #000") { std::stringstream ss; ss << "div { z-index: black = #000 ? 9 : 5; }"; @@ -811,7 +841,7 @@ TEST_CASE("Expression color =,!= color", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -832,17 +862,18 @@ TEST_CASE("Expression color =,!= color", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:9}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("compare rgba(r,g,b,a) = rgba(r,g,b,a)") + CATCH_START_SECTION("compare rgba(r,g,b,a) = rgba(r,g,b,a)") { csspp::integer_t const r(rand() % 256); csspp::integer_t const g(rand() % 256); @@ -887,7 +918,7 @@ TEST_CASE("Expression color =,!= color", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -908,28 +939,29 @@ TEST_CASE("Expression color =,!= color", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:9}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") +CATCH_TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") { char const * colors[] { "bleu", "blanc", "rouge" }; - SECTION("compare 'blue'/'blanc'/'rouge' ~= 'bleu blanc rouge' -- always true") + CATCH_START_SECTION("compare 'blue'/'blanc'/'rouge' ~= 'bleu blanc rouge' -- always true") { for(size_t idx(0); idx < sizeof(colors) / sizeof(colors[0]); ++idx) { @@ -958,7 +990,7 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -979,18 +1011,19 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:9}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 'blue'/'blanc'/'rouge' ~= 'blue white red' -- always false") + CATCH_START_SECTION("compare 'blue'/'blanc'/'rouge' ~= 'blue white red' -- always false") { for(size_t idx(0); idx < sizeof(colors) / sizeof(colors[0]); ++idx) { @@ -1019,7 +1052,7 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1040,18 +1073,19 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 'blue blanc rouge'.substr(...) ^= 'bleu blanc rouge' -- always true") + CATCH_START_SECTION("compare 'blue blanc rouge'.substr(...) ^= 'bleu blanc rouge' -- always true") { std::string const str("bleu blanc rouge"); for(size_t idx(0); idx < str.length(); ++idx) @@ -1081,7 +1115,7 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1102,18 +1136,19 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:9}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 'blue blanc rouge'.substr(...) ^= 'bleu blanc rouge' -- always false") + CATCH_START_SECTION("compare 'blue blanc rouge'.substr(...) ^= 'bleu blanc rouge' -- always false") { std::string const str("bleu blanc rouge"); for(size_t idx(1); idx < str.length(); ++idx) @@ -1143,7 +1178,7 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1164,19 +1199,20 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // slight variation - SECTION("compare 'bleue' ^= 'bleu blanc rouge' -- always false") + CATCH_START_SECTION("compare 'bleue' ^= 'bleu blanc rouge' -- always false") { std::stringstream ss; ss << "div { z-index: 'bleue' ^= 'bleu blanc rouge' ? 9 : 5; }"; @@ -1201,7 +1237,7 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1222,18 +1258,19 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // left side larger than right side - SECTION("compare 'bleu blanc rouge' ^= 'bleu' -- always false") + CATCH_START_SECTION("compare 'bleu blanc rouge' ^= 'bleu' -- always false") { std::stringstream ss; ss << "div { z-index: 'bleu blanc rouge' ^= 'bleu' ? 9 : 5; }"; @@ -1258,7 +1295,7 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1279,17 +1316,18 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("compare 'blue blanc rouge'.substr(...) $= 'bleu blanc rouge' -- always true") + CATCH_START_SECTION("compare 'blue blanc rouge'.substr(...) $= 'bleu blanc rouge' -- always true") { std::string const str("bleu blanc rouge"); for(size_t idx(0); idx < str.length(); ++idx) @@ -1319,7 +1357,7 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1340,18 +1378,19 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:9}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 'blue blanc rouge'.substr(...) $= 'bleu blanc rouge' -- always false") + CATCH_START_SECTION("compare 'blue blanc rouge'.substr(...) $= 'bleu blanc rouge' -- always false") { std::string const str("bleu blanc rouge"); for(size_t idx(1); idx < str.length() - 1; ++idx) @@ -1381,7 +1420,7 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1402,19 +1441,20 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // slight variation - SECTION("compare 'bouge' $= 'bleu blanc rouge' -- always false") + CATCH_START_SECTION("compare 'bouge' $= 'bleu blanc rouge' -- always false") { std::stringstream ss; ss << "div { z-index: 'bouge' $= 'bleu blanc rouge' ? 9 : 5; }"; @@ -1439,7 +1479,7 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1460,18 +1500,19 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // left larger than right - SECTION("compare 'bleu blanc rouge' $= 'rouge' -- always false") + CATCH_START_SECTION("compare 'bleu blanc rouge' $= 'rouge' -- always false") { std::stringstream ss; ss << "div { z-index: 'bleu blanc rouge' $= 'rouge' ? 9 : 5; }"; @@ -1496,7 +1537,7 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1517,17 +1558,18 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("compare 'blue blanc rouge'.substr(...) *= 'bleu blanc rouge' -- always true") + CATCH_START_SECTION("compare 'blue blanc rouge'.substr(...) *= 'bleu blanc rouge' -- always true") { std::string const str("bleu blanc rouge"); for(size_t idx(0); idx < 10; ++idx) @@ -1561,7 +1603,7 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1582,18 +1624,19 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:9}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 'blue blanc rouge'.substr(...) *= 'bleu blanc rouge' -- always false") + CATCH_START_SECTION("compare 'blue blanc rouge'.substr(...) *= 'bleu blanc rouge' -- always false") { std::string const str("bleu blanc rouge"); for(size_t idx(0); idx < 10; ++idx) @@ -1628,7 +1671,7 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1649,19 +1692,20 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // slight variation - SECTION("compare 'bouge' *= 'bleu blanc rouge' -- always false") + CATCH_START_SECTION("compare 'bouge' *= 'bleu blanc rouge' -- always false") { std::stringstream ss; ss << "div { z-index: 'bouge' *= 'bleu blanc rouge' ? 9 : 5; }"; @@ -1686,7 +1730,7 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1707,17 +1751,18 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("compare 'bleu'|'blanc'|'rouge' |= 'bleu-blanc-rouge' -- always true") + CATCH_START_SECTION("compare 'bleu'|'blanc'|'rouge' |= 'bleu-blanc-rouge' -- always true") { for(size_t idx(0); idx < sizeof(colors) / sizeof(colors[0]); ++idx) { @@ -1746,7 +1791,7 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1767,18 +1812,19 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:9}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 'bleu#' |= 'bleu-blanc-rouge' -- always false") + CATCH_START_SECTION("compare 'bleu#' |= 'bleu-blanc-rouge' -- always false") { for(size_t idx(0); idx < sizeof(colors) / sizeof(colors[0]); ++idx) { @@ -1808,7 +1854,7 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1829,19 +1875,20 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // slight variation - SECTION("compare 'bouge' *= 'bleu-blanc-rouge' -- always false") + CATCH_START_SECTION("compare 'bouge' *= 'bleu-blanc-rouge' -- always false") { std::stringstream ss; ss << "div { z-index: 'bouge' *= 'bleu-blanc-rouge' ? 9 : 5; }"; @@ -1866,7 +1913,7 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1887,21 +1934,22 @@ TEST_CASE("Expression string ~=,^=,$=,*=,|= string", "[expression] [equality]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression number/string/invalid <,<=,>,>= number/string/invalid", "[expression] [equality] [invalid]") +CATCH_TEST_CASE("Expression number/string/invalid <,<=,>,>= number/string/invalid", "[expression] [equality] [invalid]") { char const * op[] = { @@ -1914,7 +1962,7 @@ TEST_CASE("Expression number/string/invalid <,<=,>,>= number/string/invalid", "[ "|=" }; - SECTION("just ? is not a valid number") + CATCH_START_SECTION("just ? is not a valid number") { std::stringstream ss; ss << "div { border: ?; }"; @@ -1935,12 +1983,13 @@ TEST_CASE("Expression number/string/invalid <,<=,>,>= number/string/invalid", "[ //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("number ?? ? is invalid") + CATCH_START_SECTION("number ?? ? is invalid") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -1965,13 +2014,14 @@ TEST_CASE("Expression number/string/invalid <,<=,>,>= number/string/invalid", "[ //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("number ~=,^=,$=,*=,|= number is invalid") + CATCH_START_SECTION("number ~=,^=,$=,*=,|= number is invalid") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -2000,9 +2050,9 @@ TEST_CASE("Expression number/string/invalid <,<=,>,>= number/string/invalid", "[ //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types between INTEGER and INTEGER for operator '~=', '^=', '$=', '*=', '|='.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types between INTEGER and INTEGER for operator '~=', '^=', '$=', '*=', '|='.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // mismatched dimensions are caught earlier with a different @@ -2031,22 +2081,16 @@ TEST_CASE("Expression number/string/invalid <,<=,>,>= number/string/invalid", "[ //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types or dimensions between INTEGER and INTEGER for operator '=', '!=', '<', '<=', '>', '>=', '~=', '^=', '$=', '*=', or '|='.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types or dimensions between INTEGER and INTEGER for operator '=', '!=', '<', '<=', '>', '>=', '~=', '^=', '$=', '*=', or '|='.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_expr_list.cpp b/tests/catch_expr_list.cpp index 8fd5a47..f7bece1 100644 --- a/tests/catch_expr_list.cpp +++ b/tests/catch_expr_list.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the expression.cpp file: "(..., ..., ...)" (list) operator. @@ -32,18 +34,33 @@ * classes. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// csspp lib +// +#include +#include +#include +#include + + +// C++ lib +// +#include + + +// last include +// +#include -#include "csspp/assembler.h" -#include "csspp/compiler.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include -TEST_CASE("Expression arrays", "[expression] [list] [array]") +CATCH_TEST_CASE("Expression arrays", "[expression] [list] [array]") { - SECTION("test a compiled array") + CATCH_START_SECTION("test a compiled array") { std::stringstream ss; ss << "div { z-index: (15, 1, -39, 44, 10); }"; @@ -68,7 +85,7 @@ TEST_CASE("Expression arrays", "[expression] [list] [array]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -88,10 +105,11 @@ TEST_CASE("Expression arrays", "[expression] [list] [array]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("create an array and retrieve each element") + CATCH_START_SECTION("create an array and retrieve each element") { int const results[6] = { @@ -129,7 +147,7 @@ TEST_CASE("Expression arrays", "[expression] [list] [array]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -157,7 +175,7 @@ TEST_CASE("Expression arrays", "[expression] [list] [array]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:" + std::to_string(results[idx]) + "}" "span{z-index:" + std::to_string(results[6 - idx]) + "}" @@ -166,11 +184,12 @@ TEST_CASE("Expression arrays", "[expression] [list] [array]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("use list to do some computation and retrieve the last result") + CATCH_START_SECTION("use list to do some computation and retrieve the last result") { std::stringstream ss; ss << "div {\n" @@ -197,7 +216,7 @@ TEST_CASE("Expression arrays", "[expression] [list] [array]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -222,7 +241,7 @@ TEST_CASE("Expression arrays", "[expression] [list] [array]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{" "border:20px solid #f1a932" @@ -231,16 +250,17 @@ TEST_CASE("Expression arrays", "[expression] [list] [array]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression maps", "[expression] [list] [map]") +CATCH_TEST_CASE("Expression maps", "[expression] [list] [map]") { - SECTION("test a compiled map") + CATCH_START_SECTION("test a compiled map") { std::stringstream ss; ss << "div { z-index: (a: 15, b:1,c: -39,d:44, e : 10 ); }"; @@ -265,7 +285,7 @@ TEST_CASE("Expression maps", "[expression] [list] [map]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -290,10 +310,11 @@ TEST_CASE("Expression maps", "[expression] [list] [map]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("create a map and retrieve each element with block-[] (number and name) and '.'") + CATCH_START_SECTION("create a map and retrieve each element with block-[] (number and name) and '.'") { int const results[6] = { @@ -336,7 +357,7 @@ TEST_CASE("Expression maps", "[expression] [list] [map]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -364,7 +385,7 @@ TEST_CASE("Expression maps", "[expression] [list] [map]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:" + std::to_string(results[idx]) + "}" "span{z-index:" + std::to_string(results[6 - idx]) + "}" @@ -373,7 +394,7 @@ TEST_CASE("Expression maps", "[expression] [list] [map]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // retrieve using an identifier, a string, and the period syntax @@ -423,7 +444,7 @@ TEST_CASE("Expression maps", "[expression] [list] [map]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -458,7 +479,7 @@ TEST_CASE("Expression maps", "[expression] [list] [map]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:" + std::to_string(results[idx]) + "}" "p{z-index:" + std::to_string(results[idx]) + "}" @@ -468,11 +489,12 @@ TEST_CASE("Expression maps", "[expression] [list] [map]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("test with empty entries in a map") + CATCH_START_SECTION("test with empty entries in a map") { char const * results[6] = { @@ -518,7 +540,7 @@ TEST_CASE("Expression maps", "[expression] [list] [map]") if(idx == 3) { - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -542,7 +564,7 @@ TEST_CASE("Expression maps", "[expression] [list] [map]") } else { - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -570,7 +592,7 @@ TEST_CASE("Expression maps", "[expression] [list] [map]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + results[idx] + "}" "span{z-index:" + results[6 - idx] + "}" @@ -580,7 +602,7 @@ std::string("div{z-index:") + results[idx] + "}" ); } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // retrieve using an identifier, a string, and the period syntax @@ -633,7 +655,7 @@ std::string("div{z-index:") + results[idx] + "}" if(idx == 3) { - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -664,7 +686,7 @@ std::string("div{z-index:") + results[idx] + "}" } else { - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -699,7 +721,7 @@ std::string("div{z-index:") + results[idx] + "}" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + results[idx] + "}" "p{z-index:" + results[idx] + "}" @@ -710,11 +732,12 @@ std::string("div{z-index:") + results[idx] + "}" ); } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("test once more with no ending value") + CATCH_START_SECTION("test once more with no ending value") { char const * results[6] = { @@ -758,7 +781,7 @@ std::string("div{z-index:") + results[idx] + "}" std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -797,7 +820,7 @@ std::string("div{z-index:") + results[idx] + "}" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + results[idx] + "}" "span{z-index:" + results[6 - idx] + "}" @@ -807,7 +830,7 @@ std::string("div{z-index:") + results[idx] + "}" ); } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // retrieve using an identifier, a string, and the period syntax @@ -860,7 +883,7 @@ std::string("div{z-index:") + results[idx] + "}" if(idx == 5) { - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -891,7 +914,7 @@ std::string("div{z-index:") + results[idx] + "}" } else { - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -926,7 +949,7 @@ std::string("div{z-index:") + results[idx] + "}" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + results[idx] + "}" "p{z-index:" + results[idx] + "}" @@ -937,17 +960,18 @@ std::string("div{z-index:") + results[idx] + "}" ); } - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invalid]") +CATCH_TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invalid]") { - SECTION("array was an invalid number") + CATCH_START_SECTION("array was an invalid number") { std::stringstream ss; ss << "div { border: (1, ?, 3); }"; @@ -968,12 +992,13 @@ TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invali //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("array accessed with an invalid index") + CATCH_START_SECTION("array accessed with an invalid index") { std::stringstream ss; ss << "div { border: (1, 2, 3)[?]; }"; @@ -994,12 +1019,13 @@ TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invali //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("dereferencing something which cannot be dereferenced") + CATCH_START_SECTION("dereferencing something which cannot be dereferenced") { std::stringstream ss; ss << "div { border: U+A??[1]; }"; @@ -1020,12 +1046,13 @@ TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invali //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type UNICODE_RANGE for the 'array[]' operation.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type UNICODE_RANGE for the 'array[]' operation.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("array accessed with a decimal number index") + CATCH_START_SECTION("array accessed with a decimal number index") { std::stringstream ss; ss << "div { border: (1, 2, 3)[3.4]; }"; @@ -1046,12 +1073,13 @@ TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invali //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: an integer, an identifier, or a string was expected as the index (defined in '[ ... ]'). A DECIMAL_NUMBER was not expected.\n"); + VERIFY_ERRORS("test.css(1): error: an integer, an identifier, or a string was expected as the index (defined in '[ ... ]'). A DECIMAL_NUMBER was not expected.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("array[0] is invalid") + CATCH_START_SECTION("array[0] is invalid") { std::stringstream ss; ss << "div { border: (1, 2, 3)[0]; }"; @@ -1072,12 +1100,13 @@ TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invali //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: index 0 is out of range. The allowed range is 1 to 3.\n"); + VERIFY_ERRORS("test.css(1): error: index 0 is out of range. The allowed range is 1 to 3.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("array[-x or +y] are invalid when out of range") + CATCH_START_SECTION("array[-x or +y] are invalid when out of range") { for(int idx(4); idx <= 100; ++idx) { @@ -1108,9 +1137,9 @@ TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invali errmsg << "test.css(1): error: index " << idx << " is out of range. The allowed range is 1 to 3.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // from the back @@ -1140,14 +1169,15 @@ TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invali errmsg << "test.css(1): error: index " << -idx << " is out of range. The allowed range is 1 to 3.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } + CATCH_END_SECTION() - SECTION("array.field is not invalid") + CATCH_START_SECTION("array.field is not invalid") { std::stringstream ss; ss << "div { border: (1, 2, 3).unexpected; }"; @@ -1168,12 +1198,13 @@ TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invali //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported left handside type ARRAY for the '.' operation.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported left handside type ARRAY for the '.' operation.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("map with an invalid number") + CATCH_START_SECTION("map with an invalid number") { std::stringstream ss; ss << "div { border: (aaa: 1, bbb: ?, ccc: 3); }"; @@ -1194,12 +1225,13 @@ TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invali //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("map accessed with an invalid index") + CATCH_START_SECTION("map accessed with an invalid index") { std::stringstream ss; ss << "div { border: (poors: 1, man: 2, test: 3)[?]; }"; @@ -1220,12 +1252,13 @@ TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invali //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("map accessed with a decimal number index") + CATCH_START_SECTION("map accessed with a decimal number index") { std::stringstream ss; ss << "div { border: (map: 1, and: 2, decimal_number: 3)[3.4]; }"; @@ -1246,12 +1279,13 @@ TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invali //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: an integer, an identifier, or a string was expected as the index (defined in '[ ... ]'). A DECIMAL_NUMBER was not expected.\n"); + VERIFY_ERRORS("test.css(1): error: an integer, an identifier, or a string was expected as the index (defined in '[ ... ]'). A DECIMAL_NUMBER was not expected.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("map[0] is invalid") + CATCH_START_SECTION("map[0] is invalid") { std::stringstream ss; ss << "div { border: (zero: 1, as: 2, index: 3)[0]; }"; @@ -1272,12 +1306,13 @@ TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invali //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: index 0 is out of range. The allowed range is 1 to 3.\n"); + VERIFY_ERRORS("test.css(1): error: index 0 is out of range. The allowed range is 1 to 3.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("map[-x or +y] are invalid when out of range") + CATCH_START_SECTION("map[-x or +y] are invalid when out of range") { for(int idx(4); idx <= 100; ++idx) { @@ -1308,9 +1343,9 @@ TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invali errmsg << "test.css(1): error: index " << idx << " is out of range. The allowed range is 1 to 3.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // from the back @@ -1340,14 +1375,15 @@ TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invali errmsg << "test.css(1): error: index " << -idx << " is out of range. The allowed range is 1 to 3.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } + CATCH_END_SECTION() - SECTION("map[unknown] is similar to an 'out of range' error") + CATCH_START_SECTION("map[unknown] is similar to an 'out of range' error") { std::stringstream ss; ss << "div { border: (large: 1, index: 2, out-of-range: 3)['unknown']; }"; @@ -1368,12 +1404,13 @@ TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invali //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: 'map[\"unknown\"]' is not set.\n"); + VERIFY_ERRORS("test.css(1): error: 'map[\"unknown\"]' is not set.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("map . 123 is not possible") + CATCH_START_SECTION("map . 123 is not possible") { std::stringstream ss; ss << "div { border: (large: 1, index: 2, out-of-range: 3) . 123; }"; @@ -1394,20 +1431,14 @@ TEST_CASE("Expression invalid lists", "[expression] [list] [array] [map] [invali //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: only an identifier is expected after a '.'.\n"); + VERIFY_ERRORS("test.css(1): error: only an identifier is expected after a '.'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_expr_logical_and.cpp b/tests/catch_expr_logical_and.cpp index c9616cb..997b05a 100644 --- a/tests/catch_expr_logical_and.cpp +++ b/tests/catch_expr_logical_and.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the expression.cpp file: "&&" operator. @@ -32,16 +34,31 @@ * classes. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// csspp lib +// +#include +#include +#include +#include + + +// C++ lib +// +#include + + +// last include +// +#include -#include "csspp/assembler.h" -#include "csspp/compiler.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include -TEST_CASE("Expression value && value", "[expression] [logical-and]") +CATCH_TEST_CASE("Expression value && value", "[expression] [logical-and]") { struct value_t { @@ -105,7 +122,7 @@ TEST_CASE("Expression value && value", "[expression] [logical-and]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -126,24 +143,24 @@ TEST_CASE("Expression value && value", "[expression] [logical-and]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (values[i].f_true && values[j].f_true ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression invalid && invalid", "[expression] [logical-and] [invalid]") +CATCH_TEST_CASE("Expression invalid && invalid", "[expression] [logical-and] [invalid]") { - SECTION("just ? is not a valid boolean") + CATCH_START_SECTION("just ? is not a valid boolean") { std::stringstream ss; ss << "div { border: ?; }"; @@ -164,12 +181,13 @@ TEST_CASE("Expression invalid && invalid", "[expression] [logical-and] [invalid] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("boolean && ? is invalid") + CATCH_START_SECTION("boolean && ? is invalid") { std::stringstream ss; ss << "div { width: true && ?; }"; @@ -190,12 +208,13 @@ TEST_CASE("Expression invalid && invalid", "[expression] [logical-and] [invalid] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("boolean && U+A?? is invalid") + CATCH_START_SECTION("boolean && U+A?? is invalid") { std::stringstream ss; ss << "div { width: false && U+A??; }"; @@ -216,20 +235,14 @@ TEST_CASE("Expression invalid && invalid", "[expression] [logical-and] [invalid] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a boolean expression was expected.\n"); + VERIFY_ERRORS("test.css(1): error: a boolean expression was expected.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_expr_logical_or.cpp b/tests/catch_expr_logical_or.cpp index e96e565..04ae26d 100644 --- a/tests/catch_expr_logical_or.cpp +++ b/tests/catch_expr_logical_or.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the expression.cpp file: "||" operator. @@ -32,16 +34,31 @@ * classes. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// csspp lib +// +#include +#include +#include +#include + + +// C++ lib +// +#include + + +// last include +// +#include -#include "csspp/assembler.h" -#include "csspp/compiler.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include -TEST_CASE("Expression value || value", "[expression] [logical-or]") +CATCH_TEST_CASE("Expression value || value", "[expression] [logical-or]") { struct value_t { @@ -105,7 +122,7 @@ TEST_CASE("Expression value || value", "[expression] [logical-or]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -126,24 +143,24 @@ TEST_CASE("Expression value || value", "[expression] [logical-or]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (values[i].f_true || values[j].f_true ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression invalid || invalid", "[expression] [logical-or] [invalid]") +CATCH_TEST_CASE("Expression invalid || invalid", "[expression] [logical-or] [invalid]") { - SECTION("just ? is not a valid number") + CATCH_START_SECTION("just ? is not a valid number") { std::stringstream ss; ss << "div { border: ?; }"; @@ -164,12 +181,13 @@ TEST_CASE("Expression invalid || invalid", "[expression] [logical-or] [invalid]" //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("number || ? is invalid") + CATCH_START_SECTION("number || ? is invalid") { std::stringstream ss; ss << "div { width: 10px || ? }"; @@ -190,12 +208,13 @@ TEST_CASE("Expression invalid || invalid", "[expression] [logical-or] [invalid]" //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("boolean && U+A?? is invalid") + CATCH_START_SECTION("boolean && U+A?? is invalid") { std::stringstream ss; ss << "div { width: false || U+A??; }"; @@ -216,20 +235,14 @@ TEST_CASE("Expression invalid || invalid", "[expression] [logical-or] [invalid]" //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a boolean expression was expected.\n"); + VERIFY_ERRORS("test.css(1): error: a boolean expression was expected.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_expr_multiplicative.cpp b/tests/catch_expr_multiplicative.cpp index a452894..b5fd0e6 100644 --- a/tests/catch_expr_multiplicative.cpp +++ b/tests/catch_expr_multiplicative.cpp @@ -1,5 +1,4 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the expression.cpp file: "*", "/", and "%" operators. @@ -32,18 +31,33 @@ * classes. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// csspp lib +// +#include +#include +#include +#include + -#include "csspp/assembler.h" -#include "csspp/compiler.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" +// C++ lib +// +#include -#include -TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") +// last include +// +#include + + + +CATCH_TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") { - SECTION("multiple sizes without dimensions (*)") + CATCH_START_SECTION("multiple sizes without dimensions (*)") { std::stringstream ss; ss << "div { z-index: 3 * 10; }"; @@ -68,7 +82,7 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -89,15 +103,16 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:30}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("multiple sizes without dimensions (mul)") + CATCH_START_SECTION("multiple sizes without dimensions (mul)") { std::stringstream ss; ss << "div { z-index: 3 mul 10; }"; @@ -122,7 +137,7 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -143,15 +158,16 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:30}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("divide sizes without dimensions (/)") + CATCH_START_SECTION("divide sizes without dimensions (/)") { std::stringstream ss; ss << "div { z-index: 10 / 3; }"; @@ -176,7 +192,7 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -197,15 +213,16 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:3}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("divide sizes without dimensions (div)") + CATCH_START_SECTION("divide sizes without dimensions (div)") { std::stringstream ss; ss << "div { z-index: 10 div 3; }"; @@ -230,7 +247,7 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -251,15 +268,16 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:3}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("modulo sizes without dimensions (%)") + CATCH_START_SECTION("modulo sizes without dimensions (%)") { std::stringstream ss; ss << "div { z-index: 10 % 3; }"; @@ -284,7 +302,7 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -305,15 +323,16 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:1}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("modulo sizes without dimensions (mod)") + CATCH_START_SECTION("modulo sizes without dimensions (mod)") { std::stringstream ss; ss << "div { z-index: 10 mod 3; }"; @@ -338,7 +357,7 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -359,15 +378,16 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:1}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("remove dimension (simple divide)") + CATCH_START_SECTION("remove dimension (simple divide)") { std::stringstream ss; ss << "div { width: 3px / 1px; }"; @@ -392,7 +412,7 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -413,15 +433,16 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:3}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("convert px to em (multiple + divide)") + CATCH_START_SECTION("convert px to em (multiple + divide)") { std::stringstream ss; ss << "div { width: 3px * 10em / 1px; }"; @@ -446,7 +467,7 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -467,15 +488,16 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:30em}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("operation going through a unit less dividend") + CATCH_START_SECTION("operation going through a unit less dividend") { std::stringstream ss; ss << "div { width: 30px / 1px / 10 * 10cm; }"; @@ -500,7 +522,7 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -521,15 +543,16 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:30cm}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("complex operations with unitless dividend") + CATCH_START_SECTION("complex operations with unitless dividend") { std::stringstream ss; ss << "div { width: 3px * 10em / 1px / 5em / 2vw * 3em * 5vw; }"; @@ -554,7 +577,7 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -575,15 +598,16 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:45em}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("many divisions with many dimension, then multiplications") + CATCH_START_SECTION("many divisions with many dimension, then multiplications") { std::stringstream ss; ss << "div { width: 60 / 5px / 3em / 2vw * 3em * 5vw * 2px * 3px; }"; @@ -608,7 +632,7 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -629,15 +653,16 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:180px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("many multiplications and divisions with differen dimensions") + CATCH_START_SECTION("many multiplications and divisions with differen dimensions") { std::stringstream ss; // first we get "deg * px * em * vw / pt * rad * cm * mm" then @@ -666,7 +691,7 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -687,15 +712,16 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:1}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("modulo of a distance, require same dimension") + CATCH_START_SECTION("modulo of a distance, require same dimension") { std::stringstream ss; ss << "div { width: 10px % 3px; }"; @@ -720,7 +746,7 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -741,19 +767,20 @@ TEST_CASE("Expression integer *,/,% integer", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(out.str() == + CATCH_REQUIRE(out.str() == "div{width:1px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[expression] [multiplicative] [invalid]") +CATCH_TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[expression] [multiplicative] [invalid]") { // px * px -- cannot output { @@ -780,7 +807,7 @@ TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[exp // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -796,7 +823,7 @@ TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[exp ); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; csspp::assembler a(out); @@ -804,9 +831,9 @@ TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[exp //std::cerr << "----------------- Result is [" << out.str() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: \"px * px\" is not a valid CSS dimension.\n"); + VERIFY_ERRORS("test.css(1): error: \"px * px\" is not a valid CSS dimension.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // px / em -- cannot output @@ -834,7 +861,7 @@ TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[exp // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -850,7 +877,7 @@ TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[exp ); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; csspp::assembler a(out); @@ -858,9 +885,9 @@ TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[exp //std::cerr << "----------------- Result is [" << out.str() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: \"px / em\" is not a valid CSS dimension.\n"); + VERIFY_ERRORS("test.css(1): error: \"px / em\" is not a valid CSS dimension.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // px % em -- cannot calculate @@ -884,9 +911,9 @@ TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[exp //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible dimensions (\"px\" and \"em\") cannot be used with operator '%'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible dimensions (\"px\" and \"em\") cannot be used with operator '%'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // string * -integer @@ -910,9 +937,9 @@ TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[exp //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: string * integer requires that the integer not be negative (-2).\n"); + VERIFY_ERRORS("test.css(1): error: string * integer requires that the integer not be negative (-2).\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // string / integer @@ -936,9 +963,9 @@ TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[exp //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types between STRING and INTEGER for operator '/' or '%'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types between STRING and INTEGER for operator '/' or '%'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // string % integer @@ -962,9 +989,9 @@ TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[exp //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types between STRING and INTEGER for operator '/' or '%'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types between STRING and INTEGER for operator '/' or '%'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // string * decimal-number @@ -988,9 +1015,9 @@ TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[exp //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types between STRING and DECIMAL_NUMBER for operator '*', '/', or '%'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types between STRING and DECIMAL_NUMBER for operator '*', '/', or '%'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // string * percent @@ -1014,12 +1041,12 @@ TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[exp //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types between STRING and PERCENT for operator '*', '/', or '%'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types between STRING and PERCENT for operator '*', '/', or '%'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } - SECTION("unicode-range % string") + CATCH_START_SECTION("unicode-range % string") { std::stringstream ss; ss << "div { width: U+5?? % \"rhs\"; }"; @@ -1040,10 +1067,11 @@ TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[exp //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types between UNICODE_RANGE and STRING for operator '*', '/', or '%'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types between UNICODE_RANGE and STRING for operator '*', '/', or '%'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // string * string { @@ -1066,9 +1094,9 @@ TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[exp //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types between STRING and STRING for operator '*', '/', or '%'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types between STRING and STRING for operator '*', '/', or '%'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // string / string @@ -1092,9 +1120,9 @@ TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[exp //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types between STRING and STRING for operator '*', '/', or '%'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types between STRING and STRING for operator '*', '/', or '%'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // string % string @@ -1118,16 +1146,16 @@ TEST_CASE("Expression integer *,/,% integer with incompatible dimensions", "[exp //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types between STRING and STRING for operator '*', '/', or '%'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types between STRING and STRING for operator '*', '/', or '%'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression string * integer", "[expression] [multiplicative] [string]") +CATCH_TEST_CASE("Expression string * integer", "[expression] [multiplicative] [string]") { // duplicate a string (string x integer) { @@ -1154,7 +1182,7 @@ TEST_CASE("Expression string * integer", "[expression] [multiplicative] [string] // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1178,12 +1206,12 @@ TEST_CASE("Expression string * integer", "[expression] [multiplicative] [string] //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div::before{content:\"strstrstr\"}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // duplicate a string (integer x string) @@ -1211,7 +1239,7 @@ TEST_CASE("Expression string * integer", "[expression] [multiplicative] [string] // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1235,12 +1263,12 @@ TEST_CASE("Expression string * integer", "[expression] [multiplicative] [string] //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div::before{content:\"strstrstr\"}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // duplicate a string (string x 0) @@ -1268,7 +1296,7 @@ TEST_CASE("Expression string * integer", "[expression] [multiplicative] [string] // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1292,12 +1320,12 @@ TEST_CASE("Expression string * integer", "[expression] [multiplicative] [string] //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div::before{content:\"\"}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // duplicate a string (0 x string) @@ -1325,7 +1353,7 @@ TEST_CASE("Expression string * integer", "[expression] [multiplicative] [string] // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1349,21 +1377,21 @@ TEST_CASE("Expression string * integer", "[expression] [multiplicative] [string] //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div::before{content:\"\"}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression multiplicative errors", "[expression] [multiplicative] [invalid]") +CATCH_TEST_CASE("Expression multiplicative errors", "[expression] [multiplicative] [invalid]") { - SECTION("? is not a valid unary") + CATCH_START_SECTION("? is not a valid unary") { std::stringstream ss; ss << "div { width: ?; }"; @@ -1384,12 +1412,13 @@ TEST_CASE("Expression multiplicative errors", "[expression] [multiplicative] [in //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("5 * ? is not valid") + CATCH_START_SECTION("5 * ? is not valid") { std::stringstream ss; ss << "div { width: 5 * ?; }"; @@ -1410,12 +1439,13 @@ TEST_CASE("Expression multiplicative errors", "[expression] [multiplicative] [in //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("3 / ? is not valid") + CATCH_START_SECTION("3 / ? is not valid") { std::stringstream ss; ss << "div { width: 3 / ?; }"; @@ -1436,12 +1466,13 @@ TEST_CASE("Expression multiplicative errors", "[expression] [multiplicative] [in //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("3 % ? is not valid") + CATCH_START_SECTION("3 % ? is not valid") { std::stringstream ss; ss << "div { width: 3 % ?; }"; @@ -1462,12 +1493,13 @@ TEST_CASE("Expression multiplicative errors", "[expression] [multiplicative] [in //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("3 / 0 is not accepted") + CATCH_START_SECTION("3 / 0 is not accepted") { std::stringstream ss; ss << "div { width: 3 / 0; }"; @@ -1488,12 +1520,13 @@ TEST_CASE("Expression multiplicative errors", "[expression] [multiplicative] [in //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: division by zero.\n"); + VERIFY_ERRORS("test.css(1): error: division by zero.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("3.3 / 0.0 is not accepted") + CATCH_START_SECTION("3.3 / 0.0 is not accepted") { std::stringstream ss; ss << "div { width: 3.3 / 0.0; }"; @@ -1514,12 +1547,13 @@ TEST_CASE("Expression multiplicative errors", "[expression] [multiplicative] [in //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: division by zero.\n"); + VERIFY_ERRORS("test.css(1): error: division by zero.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("3 % 0 is not accepted") + CATCH_START_SECTION("3 % 0 is not accepted") { std::stringstream ss; ss << "div { width: 3 % 0; }"; @@ -1540,12 +1574,13 @@ TEST_CASE("Expression multiplicative errors", "[expression] [multiplicative] [in //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: modulo by zero.\n"); + VERIFY_ERRORS("test.css(1): error: modulo by zero.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("3.9 % 0.0 is not accepted") + CATCH_START_SECTION("3.9 % 0.0 is not accepted") { std::stringstream ss; ss << "div { width: 3.9 % 0.0; }"; @@ -1566,18 +1601,19 @@ TEST_CASE("Expression multiplicative errors", "[expression] [multiplicative] [in //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: modulo by zero.\n"); + VERIFY_ERRORS("test.css(1): error: modulo by zero.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer", "[expression] [multiplicative]") +CATCH_TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer", "[expression] [multiplicative]") { - SECTION("multiply two decimal numbers") + CATCH_START_SECTION("multiply two decimal numbers") { std::stringstream ss; ss << "div { z-index: 3.5 * 10.2; }"; @@ -1596,7 +1632,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1604,7 +1640,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1625,15 +1661,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:35.7}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("multiply an integer with a decimal number") + CATCH_START_SECTION("multiply an integer with a decimal number") { std::stringstream ss; ss << "div { z-index: 3 * 10.2; }"; @@ -1652,7 +1689,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1660,7 +1697,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1681,15 +1718,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:30.6}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("multiply a decimal number with an integer") + CATCH_START_SECTION("multiply a decimal number with an integer") { std::stringstream ss; ss << "div { z-index: 3.5 * 10; }"; @@ -1708,7 +1746,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1716,7 +1754,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1737,15 +1775,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:35}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("multiply decimal numbers with 0 in their fraction") + CATCH_START_SECTION("multiply decimal numbers with 0 in their fraction") { std::stringstream ss; ss << "div { z-index: 3.0 * 10.0; }"; @@ -1764,7 +1803,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1772,7 +1811,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1793,15 +1832,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:30}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("multiply an integer and a decimal number with 0 in their fraction") + CATCH_START_SECTION("multiply an integer and a decimal number with 0 in their fraction") { std::stringstream ss; ss << "div { z-index: 3 * 10.0; }"; @@ -1820,7 +1860,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1828,7 +1868,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1849,15 +1889,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:30}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("multiply a decimal number with 0 in their fraction and an integer") + CATCH_START_SECTION("multiply a decimal number with 0 in their fraction and an integer") { std::stringstream ss; ss << "div { z-index: 3.0 * 10; }"; @@ -1876,7 +1917,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1884,7 +1925,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1905,15 +1946,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:30}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("divide two decimal numbers") + CATCH_START_SECTION("divide two decimal numbers") { std::stringstream ss; ss << "div { z-index: 3.2 / 12.5; }"; @@ -1932,7 +1974,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1940,7 +1982,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1961,15 +2003,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:.256}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("divide an integer with a decimal number") + CATCH_START_SECTION("divide an integer with a decimal number") { std::stringstream ss; ss << "div { z-index: 3 / 12.5; }"; @@ -1988,7 +2031,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -1996,7 +2039,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2017,15 +2060,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:.24}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("divide a decimal number with an integer") + CATCH_START_SECTION("divide a decimal number with an integer") { std::stringstream ss; ss << "div { z-index: 3.5 / 10; }"; @@ -2044,7 +2088,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2052,7 +2096,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2073,15 +2117,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:.35}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("divide decimal numbers with 0 in their fraction") + CATCH_START_SECTION("divide decimal numbers with 0 in their fraction") { std::stringstream ss; ss << "div { z-index: 3.0 / 10.0; }"; @@ -2100,7 +2145,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2108,7 +2153,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2129,15 +2174,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:.3}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("divide an integer and a decimal number with 0 in their fraction") + CATCH_START_SECTION("divide an integer and a decimal number with 0 in their fraction") { std::stringstream ss; ss << "div { z-index: 350 / 10.0; }"; @@ -2156,7 +2202,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2164,7 +2210,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2185,15 +2231,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:35}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("divide a decimal number with 0 in their fraction and an integer") + CATCH_START_SECTION("divide a decimal number with 0 in their fraction and an integer") { std::stringstream ss; ss << "div { z-index: 30.0 / 10; }"; @@ -2212,7 +2259,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2220,7 +2267,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2241,15 +2288,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:3}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("modulo two decimal numbers") + CATCH_START_SECTION("modulo two decimal numbers") { std::stringstream ss; ss << "div { z-index: 3.5 % 10.2; }"; @@ -2268,7 +2316,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2276,7 +2324,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2297,15 +2345,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:3.5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("modulo an integer with a decimal number") + CATCH_START_SECTION("modulo an integer with a decimal number") { std::stringstream ss; ss << "div { z-index: 33 % 10.2; }"; @@ -2324,7 +2373,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2332,7 +2381,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2353,15 +2402,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:2.4}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("modulo a decimal number with an integer") + CATCH_START_SECTION("modulo a decimal number with an integer") { std::stringstream ss; ss << "div { z-index: 3.5 % 10; }"; @@ -2380,7 +2430,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2388,7 +2438,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2409,15 +2459,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:3.5}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("modulo decimal numbers with 0 in their fraction") + CATCH_START_SECTION("modulo decimal numbers with 0 in their fraction") { std::stringstream ss; ss << "div { z-index: 3.0 % 10.0; }"; @@ -2436,7 +2487,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2444,7 +2495,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2465,15 +2516,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:3}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("modulo an integer and a decimal number with 0 in their fraction") + CATCH_START_SECTION("modulo an integer and a decimal number with 0 in their fraction") { std::stringstream ss; ss << "div { z-index: 3 % 10.0; }"; @@ -2492,7 +2544,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2500,7 +2552,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2521,15 +2573,16 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:3}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("modulo a decimal number with 0 in their fraction and an integer") + CATCH_START_SECTION("modulo a decimal number with 0 in their fraction and an integer") { std::stringstream ss; ss << "div { z-index: 3.0 % 10; }"; @@ -2548,7 +2601,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2556,7 +2609,7 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2577,21 +2630,22 @@ TEST_CASE("Expression decimal number or integer *,/,% decimal number or integer" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:3}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expression] [multiplicative] [dimension]") +CATCH_TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expression] [multiplicative] [dimension]") { - SECTION("px * px / px") + CATCH_START_SECTION("px * px / px") { std::stringstream ss; ss << "p.edged { border: { width: 25px\\ \\*\\ px / 1px; }; }"; @@ -2612,7 +2666,7 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2620,7 +2674,7 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2643,15 +2697,16 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "p.edged{border-width:25px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("px*px/px (i.e. not spaces this time)") + CATCH_START_SECTION("px*px/px (i.e. not spaces this time)") { std::stringstream ss; ss << "p.edged{border:{width:21px\\*px/7px};}"; @@ -2672,7 +2727,7 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2680,7 +2735,7 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2703,15 +2758,16 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "p.edged{border-width:3px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("px*px/px (i.e. not spaces this time)") + CATCH_START_SECTION("px*px/px (i.e. not spaces this time)") { std::stringstream ss; ss << "p.edged{border:{width:21px\\*px/7px};}"; @@ -2732,7 +2788,7 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2740,7 +2796,7 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2763,15 +2819,16 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "p.edged{border-width:3px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("em *px / px (missing one space") + CATCH_START_SECTION("em *px / px (missing one space") { std::stringstream ss; ss << "p.edged{border:{width:28em\\ \\*px/7px};}"; @@ -2792,7 +2849,7 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2800,7 +2857,7 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2823,15 +2880,16 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "p.edged{border-width:4em}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("em* px / px (missing the other space)") + CATCH_START_SECTION("em* px / px (missing the other space)") { std::stringstream ss; ss << "p.edged{border:{width:28em\\*\\ px/7px};}"; @@ -2852,7 +2910,7 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2860,7 +2918,7 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2883,15 +2941,16 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "p.edged{border-width:4em}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("one space after the dimension is ignored") + CATCH_START_SECTION("one space after the dimension is ignored") { std::stringstream ss; ss << "p.edged{border:{width:28em\\ *1px};}"; @@ -2912,7 +2971,7 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2920,7 +2979,7 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2944,15 +3003,16 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi // // //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; // -// REQUIRE(assembler_out.str() == +// CATCH_REQUIRE(assembler_out.str() == // "p.edged{border-width:4em}\n" // + csspp_test::get_close_comment() // ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("\"1 / px\" test") + CATCH_START_SECTION("\"1 / px\" test") { std::stringstream ss; // IMPORTANT NOTE: to start the dimension with "1" we need to @@ -2975,7 +3035,7 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -2983,7 +3043,7 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3007,21 +3067,22 @@ TEST_CASE("Expression number *,/,% number with hand-made dimensions", "[expressi //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "p .edged{border-width:420px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // make sure we really had no errors - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression number *,/,% number with invalid hand-made dimensions", "[expression] [multiplicative] [invalid] [dimension]") +CATCH_TEST_CASE("Expression number *,/,% number with invalid hand-made dimensions", "[expression] [multiplicative] [invalid] [dimension]") { - SECTION("\"25px *\" -- missing second dimension") + CATCH_START_SECTION("\"25px *\" -- missing second dimension") { std::stringstream ss; ss << "p.edged { width: 25px\\ \\* * 3px; }"; @@ -3042,14 +3103,15 @@ TEST_CASE("Expression number *,/,% number with invalid hand-made dimensions", "[ c.compile(false); - REQUIRE_ERRORS("test.css(1): error: number dimension is missing a dimension name.\n"); + VERIFY_ERRORS("test.css(1): error: number dimension is missing a dimension name.\n"); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("\"25px*\" -- missing second dimension (no space)") + CATCH_START_SECTION("\"25px*\" -- missing second dimension (no space)") { std::stringstream ss; ss << "p.edged { width: 25px\\* * 3px; }"; @@ -3070,14 +3132,15 @@ TEST_CASE("Expression number *,/,% number with invalid hand-made dimensions", "[ c.compile(false); - REQUIRE_ERRORS("test.css(1): error: number dimension is missing a dimension name.\n"); + VERIFY_ERRORS("test.css(1): error: number dimension is missing a dimension name.\n"); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("\"25\\ *\\ px\" -- missing first dimension") + CATCH_START_SECTION("\"25\\ *\\ px\" -- missing first dimension") { std::stringstream ss; ss << "p.edged { width: 25\\ \\*\\ px * 3px; }"; @@ -3098,14 +3161,15 @@ TEST_CASE("Expression number *,/,% number with invalid hand-made dimensions", "[ c.compile(false); - REQUIRE_ERRORS("test.css(1): error: number dimension is missing a dimension name.\n"); + VERIFY_ERRORS("test.css(1): error: number dimension is missing a dimension name.\n"); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("\"25\\*px\" -- missing first dimension (no space)") + CATCH_START_SECTION("\"25\\*px\" -- missing first dimension (no space)") { std::stringstream ss; ss << "p.edged { width: 25\\*px * 3px; }"; @@ -3126,14 +3190,15 @@ TEST_CASE("Expression number *,/,% number with invalid hand-made dimensions", "[ c.compile(false); - REQUIRE_ERRORS("test.css(1): error: number dimension is missing a dimension name.\n"); + VERIFY_ERRORS("test.css(1): error: number dimension is missing a dimension name.\n"); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("\"px / em / pt\" -- two slashes is not valid") + CATCH_START_SECTION("\"px / em / pt\" -- two slashes is not valid") { std::stringstream ss; ss << "p.edged { width: 25px\\ \\/\\ em\\ \\/\\ pt * 3px; }"; @@ -3154,14 +3219,15 @@ TEST_CASE("Expression number *,/,% number with invalid hand-made dimensions", "[ c.compile(false); - REQUIRE_ERRORS("test.css(1): error: a valid dimension can have any number of '*' operators and a single '/' operator, here we found a second '/'.\n"); + VERIFY_ERRORS("test.css(1): error: a valid dimension can have any number of '*' operators and a single '/' operator, here we found a second '/'.\n"); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("\"1 / em / pt\" -- two slashes is not valid") + CATCH_START_SECTION("\"1 / em / pt\" -- two slashes is not valid") { std::stringstream ss; // IMPORTANT NOTE: to start the dimension with "1" we need to @@ -3184,14 +3250,15 @@ TEST_CASE("Expression number *,/,% number with invalid hand-made dimensions", "[ c.compile(false); - REQUIRE_ERRORS("test.css(1): error: a valid dimension can have any number of '*' operators and a single '/' operator, here we found a second '/'.\n"); + VERIFY_ERRORS("test.css(1): error: a valid dimension can have any number of '*' operators and a single '/' operator, here we found a second '/'.\n"); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("\"1/em/pt\" -- two slashes is not valid (no spaces)") + CATCH_START_SECTION("\"1/em/pt\" -- two slashes is not valid (no spaces)") { std::stringstream ss; // IMPORTANT NOTE: to start the dimension with "1" we need to @@ -3214,14 +3281,15 @@ TEST_CASE("Expression number *,/,% number with invalid hand-made dimensions", "[ c.compile(false); - REQUIRE_ERRORS("test.css(1): error: a valid dimension can have any number of '*' operators and a single '/' operator, here we found a second '/'.\n"); + VERIFY_ERRORS("test.css(1): error: a valid dimension can have any number of '*' operators and a single '/' operator, here we found a second '/'.\n"); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("\"em % pt\" -- '%' is not a valid dimension separator") + CATCH_START_SECTION("\"em % pt\" -- '%' is not a valid dimension separator") { std::stringstream ss; ss << "p.edged { width: 25em\\ \\%\\ pt / 5pt; }"; @@ -3242,20 +3310,21 @@ TEST_CASE("Expression number *,/,% number with invalid hand-made dimensions", "[ c.compile(false); - REQUIRE_ERRORS("test.css(1): error: multiple dimensions can only be separated by '*' or '/' not '%'.\n"); + VERIFY_ERRORS("test.css(1): error: multiple dimensions can only be separated by '*' or '/' not '%'.\n"); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // make sure we really had no errors - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") +CATCH_TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") { - SECTION("percent multiplication") + CATCH_START_SECTION("percent multiplication") { std::stringstream ss; ss << "div { height: 3.5% * 10.2%; }"; @@ -3274,7 +3343,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -3282,7 +3351,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3303,15 +3372,16 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:.357%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("percent multiplication with what looks like an integer (lhs)") + CATCH_START_SECTION("percent multiplication with what looks like an integer (lhs)") { std::stringstream ss; ss << "div { height: 3% * 10.2%; }"; @@ -3330,7 +3400,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -3338,7 +3408,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3359,15 +3429,16 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:.306%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("percent multiplication with what looks like an integer (rhs)") + CATCH_START_SECTION("percent multiplication with what looks like an integer (rhs)") { std::stringstream ss; ss << "div { height: 3.5% * 10%; }"; @@ -3386,7 +3457,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -3394,7 +3465,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3415,15 +3486,16 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:.35%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("percent division") + CATCH_START_SECTION("percent division") { std::stringstream ss; ss << "div { height: 3.5% / 12.5%; }"; @@ -3442,7 +3514,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -3450,7 +3522,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3471,15 +3543,16 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:28%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("percent division with what looks like an integer (lhs)") + CATCH_START_SECTION("percent division with what looks like an integer (lhs)") { std::stringstream ss; ss << "div { height: 3% / 12.5%; }"; @@ -3498,7 +3571,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -3506,7 +3579,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3527,15 +3600,16 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:24%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("percent division with what looks like an integer (rhs)") + CATCH_START_SECTION("percent division with what looks like an integer (rhs)") { std::stringstream ss; ss << "div { height: 3.5% / 10%; }"; @@ -3554,7 +3628,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -3562,7 +3636,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3583,15 +3657,16 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:35%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("percent modulo") + CATCH_START_SECTION("percent modulo") { std::stringstream ss; ss << "div { height: 13.5% mod 12.5%; }"; @@ -3610,7 +3685,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -3618,7 +3693,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3639,15 +3714,16 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:1%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("percent modulo with what looks like an integer (lhs)") + CATCH_START_SECTION("percent modulo with what looks like an integer (lhs)") { std::stringstream ss; ss << "div { height: 23% mod 12.5%; }"; @@ -3666,7 +3742,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -3674,7 +3750,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3695,15 +3771,16 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:10.5%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("percent modulo with what looks like an integer (rhs)") + CATCH_START_SECTION("percent modulo with what looks like an integer (rhs)") { std::stringstream ss; ss << "div { height: 3.5% mod 10%; }"; @@ -3722,7 +3799,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -3730,7 +3807,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3751,15 +3828,16 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:3.5%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("percent and decimal number multiplication") + CATCH_START_SECTION("percent and decimal number multiplication") { std::stringstream ss; ss << "div { height: 3.5% * 10.2px; }"; @@ -3778,7 +3856,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -3786,7 +3864,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3807,15 +3885,16 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:.357px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("percent multiplication with what looks like an integer (lhs)") + CATCH_START_SECTION("percent multiplication with what looks like an integer (lhs)") { std::stringstream ss; ss << "div { height: 3% * 10.2em; }"; @@ -3834,7 +3913,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -3842,7 +3921,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3863,15 +3942,16 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:.306em}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("percent multiplication with what looks like an integer (rhs)") + CATCH_START_SECTION("percent multiplication with what looks like an integer (rhs)") { std::stringstream ss; ss << "div { height: 3.5% * 10cm; }"; @@ -3890,7 +3970,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -3898,7 +3978,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3919,15 +3999,16 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:.35cm}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("percent and decimal number division") + CATCH_START_SECTION("percent and decimal number division") { std::stringstream ss; ss << "div { height: 70.0vw / 3.5%; }"; @@ -3946,7 +4027,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -3954,7 +4035,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3975,15 +4056,16 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:2000vw}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("percent division with what looks like an integer (lhs)") + CATCH_START_SECTION("percent division with what looks like an integer (lhs)") { std::stringstream ss; ss << "div { height: 3px / 12.5%; }"; @@ -4002,7 +4084,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -4010,7 +4092,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4031,15 +4113,16 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:24px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("percent division with what looks like an integer (rhs)") + CATCH_START_SECTION("percent division with what looks like an integer (rhs)") { std::stringstream ss; ss << "div { height: 3.5em / 10%; }"; @@ -4058,7 +4141,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -4066,7 +4149,7 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4087,21 +4170,22 @@ TEST_CASE("Expression percent *,/,% percent", "[expression] [multiplicative]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{height:35em}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multiplicative] [unicode-range-value]") +CATCH_TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multiplicative] [unicode-range-value]") { - SECTION("null * null = null") + CATCH_START_SECTION("null * null = null") { std::stringstream ss; ss << "@font-face { unicode-range: null * null; }"; @@ -4122,7 +4206,7 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -4130,7 +4214,7 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4150,15 +4234,16 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip // // //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; // -// REQUIRE(assembler_out.str() == +// CATCH_REQUIRE(assembler_out.str() == // "div{font:35pt/40pt serif}\n" // + csspp_test::get_close_comment() // ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("unicode * null = null") + CATCH_START_SECTION("unicode * null = null") { std::stringstream ss; ss << "@font-face { unicode-range: U+7?? * null; }"; @@ -4179,7 +4264,7 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -4187,7 +4272,7 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4207,15 +4292,16 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip // // //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; // -// REQUIRE(assembler_out.str() == +// CATCH_REQUIRE(assembler_out.str() == // "div{font:35pt/40pt serif}\n" // + csspp_test::get_close_comment() // ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("null * unicode = null") + CATCH_START_SECTION("null * unicode = null") { std::stringstream ss; ss << "@font-face { unicode-range: null * U+7??; }"; @@ -4236,7 +4322,7 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -4244,7 +4330,7 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4264,15 +4350,16 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip // // //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; // -// REQUIRE(assembler_out.str() == +// CATCH_REQUIRE(assembler_out.str() == // "div{font:35pt/40pt serif}\n" // + csspp_test::get_close_comment() // ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("unicode * unicode = unicode (smaller range included in other range)") + CATCH_START_SECTION("unicode * unicode = unicode (smaller range included in other range)") { std::stringstream ss; ss << "@font-face { unicode-range: U+1??? * U+17??; }"; @@ -4293,7 +4380,7 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -4301,7 +4388,7 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4320,15 +4407,16 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "@font-face {unicode-range:U+17??}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("unicode * unicode = null (no overlap)") + CATCH_START_SECTION("unicode * unicode = null (no overlap)") { std::stringstream ss; ss << "@font-face { unicode-range: U+1??? * U+7??; }"; @@ -4349,7 +4437,7 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -4357,7 +4445,7 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4377,15 +4465,16 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip // // //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; // -// REQUIRE(assembler_out.str() == +// CATCH_REQUIRE(assembler_out.str() == // "div{font:35pt/40pt serif}\n" // + csspp_test::get_close_comment() // ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("unicode * unicode = null (start/end overlap)") + CATCH_START_SECTION("unicode * unicode = null (start/end overlap)") { std::stringstream ss; ss << "@font-face { unicode-range: U+1000-18FF * U+1750-1FFF; }"; @@ -4406,7 +4495,7 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -4414,7 +4503,7 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4433,21 +4522,22 @@ TEST_CASE("Expression with multiplicative unicode ranges", "[expression] [multip //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "@font-face {unicode-range:U+1750-18ff}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression with invalid multiplicative unicode ranges", "[expression] [multiplicative] [unicode-range-value] [invalid]") +CATCH_TEST_CASE("Expression with invalid multiplicative unicode ranges", "[expression] [multiplicative] [unicode-range-value] [invalid]") { - SECTION("null / null = null") + CATCH_START_SECTION("null / null = null") { std::stringstream ss; ss << "@font-face { unicode-range: null / null; }"; @@ -4468,12 +4558,13 @@ TEST_CASE("Expression with invalid multiplicative unicode ranges", "[expression] c.compile(false); - REQUIRE_ERRORS("test.css(1): error: unicode_range * unicode_range is the only multiplicative operator accepted with unicode ranges, '/' and '%' are not allowed.\n"); + VERIFY_ERRORS("test.css(1): error: unicode_range * unicode_range is the only multiplicative operator accepted with unicode ranges, '/' and '%' are not allowed.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("unicode % null = null") + CATCH_START_SECTION("unicode % null = null") { std::stringstream ss; ss << "@font-face { unicode-range: U+7?? % null; }"; @@ -4494,12 +4585,13 @@ TEST_CASE("Expression with invalid multiplicative unicode ranges", "[expression] c.compile(false); - REQUIRE_ERRORS("test.css(1): error: unicode_range * unicode_range is the only multiplicative operator accepted with unicode ranges, '/' and '%' are not allowed.\n"); + VERIFY_ERRORS("test.css(1): error: unicode_range * unicode_range is the only multiplicative operator accepted with unicode ranges, '/' and '%' are not allowed.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("null / unicode = null") + CATCH_START_SECTION("null / unicode = null") { std::stringstream ss; ss << "@font-face { unicode-range: null / U+7??; }"; @@ -4520,12 +4612,13 @@ TEST_CASE("Expression with invalid multiplicative unicode ranges", "[expression] c.compile(false); - REQUIRE_ERRORS("test.css(1): error: unicode_range * unicode_range is the only multiplicative operator accepted with unicode ranges, '/' and '%' are not allowed.\n"); + VERIFY_ERRORS("test.css(1): error: unicode_range * unicode_range is the only multiplicative operator accepted with unicode ranges, '/' and '%' are not allowed.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("unicode % unicode is an error") + CATCH_START_SECTION("unicode % unicode is an error") { std::stringstream ss; ss << "@font-face { unicode-range: U+1??? % U+17??; }"; @@ -4546,12 +4639,13 @@ TEST_CASE("Expression with invalid multiplicative unicode ranges", "[expression] c.compile(false); - REQUIRE_ERRORS("test.css(1): error: unicode_range * unicode_range is the only multiplicative operator accepted with unicode ranges, '/' and '%' are not allowed.\n"); + VERIFY_ERRORS("test.css(1): error: unicode_range * unicode_range is the only multiplicative operator accepted with unicode ranges, '/' and '%' are not allowed.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("unicode / unicode = null (no overlap)") + CATCH_START_SECTION("unicode / unicode = null (no overlap)") { std::stringstream ss; ss << "@font-face { unicode-range: U+1??? / U+7??; }"; @@ -4572,12 +4666,13 @@ TEST_CASE("Expression with invalid multiplicative unicode ranges", "[expression] c.compile(false); - REQUIRE_ERRORS("test.css(1): error: unicode_range * unicode_range is the only multiplicative operator accepted with unicode ranges, '/' and '%' are not allowed.\n"); + VERIFY_ERRORS("test.css(1): error: unicode_range * unicode_range is the only multiplicative operator accepted with unicode ranges, '/' and '%' are not allowed.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("unicode % unicode = error really") + CATCH_START_SECTION("unicode % unicode = error really") { std::stringstream ss; ss << "@font-face { unicode-range: U+1000-18FF % U+1750-1FFF; }"; @@ -4598,18 +4693,19 @@ TEST_CASE("Expression with invalid multiplicative unicode ranges", "[expression] c.compile(false); - REQUIRE_ERRORS("test.css(1): error: unicode_range * unicode_range is the only multiplicative operator accepted with unicode ranges, '/' and '%' are not allowed.\n"); + VERIFY_ERRORS("test.css(1): error: unicode_range * unicode_range is the only multiplicative operator accepted with unicode ranges, '/' and '%' are not allowed.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression with a font metrics", "[expression] [multiplicative] [font-metrics]") +CATCH_TEST_CASE("Expression with a font metrics", "[expression] [multiplicative] [font-metrics]") { - SECTION("Not a division, two integers") + CATCH_START_SECTION("Not a division, two integers") { std::stringstream ss; ss << "div { font: 35pt/40pt serif; }"; @@ -4628,7 +4724,7 @@ TEST_CASE("Expression with a font metrics", "[expression] [multiplicative] [font c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -4636,7 +4732,7 @@ TEST_CASE("Expression with a font metrics", "[expression] [multiplicative] [font // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4659,15 +4755,16 @@ TEST_CASE("Expression with a font metrics", "[expression] [multiplicative] [font //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{font:35pt/40pt serif}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Not a division, integer and percent") + CATCH_START_SECTION("Not a division, integer and percent") { std::stringstream ss; ss << "div { font: 35pt/120% sans-serif; }"; @@ -4686,7 +4783,7 @@ TEST_CASE("Expression with a font metrics", "[expression] [multiplicative] [font c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -4694,7 +4791,7 @@ TEST_CASE("Expression with a font metrics", "[expression] [multiplicative] [font // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4717,15 +4814,16 @@ TEST_CASE("Expression with a font metrics", "[expression] [multiplicative] [font //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{font:35pt/120% sans-serif}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Not a division, spaces and percent twice") + CATCH_START_SECTION("Not a division, spaces and percent twice") { std::stringstream ss; ss << "div { font: 80% / 120% sans-serif; }"; @@ -4744,7 +4842,7 @@ TEST_CASE("Expression with a font metrics", "[expression] [multiplicative] [font c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -4752,7 +4850,7 @@ TEST_CASE("Expression with a font metrics", "[expression] [multiplicative] [font // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4775,21 +4873,22 @@ TEST_CASE("Expression with a font metrics", "[expression] [multiplicative] [font //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{font:80%/120% sans-serif}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") +CATCH_TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") { - SECTION("Multiply color by 5") + CATCH_START_SECTION("Multiply color by 5") { std::stringstream ss; ss << "div {" @@ -4815,7 +4914,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -4823,7 +4922,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4857,15 +4956,16 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:red;border-top-left-color:aqua;background-color:#000;border-bottom-left-color:#fff;border-top-right-color:#5affff}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Divide color by 5") + CATCH_START_SECTION("Divide color by 5") { // note: we do not check the swapped version here, that's done in the // test checking for invalid operations @@ -4890,7 +4990,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -4898,7 +4998,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4926,15 +5026,16 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:rgba(51,0,0,.2);background-color:rgba(0,0,0,.2);border-top-right-color:rgba(4,10,17,.2)}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Modulo color by 55") + CATCH_START_SECTION("Modulo color by 55") { std::stringstream ss; ss << "div {" @@ -4957,7 +5058,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -4965,7 +5066,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4993,15 +5094,16 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:rgba(35,0,0,.14);background-color:rgba(0,0,0,.14);border-top-right-color:rgba(18,52,31,.14)}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Multiply color by 1.5") + CATCH_START_SECTION("Multiply color by 1.5") { std::stringstream ss; ss << "div { color: red * 1.5; background-color: black * 1.5; border-color: #123456 * 1.5 }"; @@ -5020,7 +5122,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -5028,7 +5130,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -5056,15 +5158,16 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:red;background-color:#000;border-color:#1b4e81}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Multiply color by 1.5") + CATCH_START_SECTION("Multiply color by 1.5") { std::stringstream ss; ss << "div { color: 1.5 * red; background-color: 1.5 * black; border-color: 1.5 * #123456 }"; @@ -5083,7 +5186,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -5091,7 +5194,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -5119,15 +5222,16 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:red;background-color:#000;border-color:#1b4e81}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Divide color by 1.5") + CATCH_START_SECTION("Divide color by 1.5") { std::stringstream ss; ss << "div { color: red / 1.5; background-color: black / 1.5; border-color: #123456 / 1.5 }"; @@ -5146,7 +5250,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -5154,7 +5258,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -5182,15 +5286,16 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:rgba(170,0,0,.67);background-color:rgba(0,0,0,.67);border-color:rgba(12,35,57,.67)}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Modulo color by 0.7") + CATCH_START_SECTION("Modulo color by 0.7") { std::stringstream ss; ss << "div { color: red % 0.7; background-color: black % 0.7; border-color: #123456 % 0.7 }"; @@ -5209,7 +5314,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -5217,7 +5322,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -5245,15 +5350,16 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:rgba(77,0,0,.3);background-color:rgba(0,0,0,.3);border-color:rgba(18,52,86,.3)}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Color * color") + CATCH_START_SECTION("Color * color") { std::stringstream ss; ss << "div { color: red * blue; background-color: frgba(0.3, 0.7, 0.2, 0.5) * frgba(0.9, 0.85, 1.2, 0.5) }"; @@ -5272,7 +5378,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -5280,7 +5386,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -5305,15 +5411,16 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:#000;background-color:rgba(69,152,61,.25)}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Color / color") + CATCH_START_SECTION("Color / color") { std::stringstream ss; ss << "div { color: red / #0a0a0a; background-color: frgba(0.3, 0.7, 0.2, 0.5) / frgba(0.9, 0.85, 1.2, 0.5) }"; @@ -5332,7 +5439,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -5340,7 +5447,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -5365,15 +5472,16 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:red;background-color:#55d22a}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Color % color") + CATCH_START_SECTION("Color % color") { std::stringstream ss; ss << "div { color: red % #0a0a0a; background-color: frgba(0.97, 0.85, 1.2, 0.75) % frgba(0.31, 0.7, 0.2, 0.5) }"; @@ -5392,7 +5500,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") c.compile(false); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -5400,7 +5508,7 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -5425,21 +5533,22 @@ TEST_CASE("Expression with colors", "[expression] [multiplicative] [colors]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{color:transparent;background-color:rgba(10,38,0,.25)}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid expressions with colors", "[expression] [multiplicative] [colors] [invalid]") +CATCH_TEST_CASE("Invalid expressions with colors", "[expression] [multiplicative] [colors] [invalid]") { - SECTION("Divide 5 by a color is not valid") + CATCH_START_SECTION("Divide 5 by a color is not valid") { std::stringstream ss; ss << "div { border-top-left-color: 5 / teal; }"; @@ -5458,12 +5567,13 @@ TEST_CASE("Invalid expressions with colors", "[expression] [multiplicative] [col c.compile(false); - REQUIRE_ERRORS("test.css(1): error: 'number / color' and 'number % color' are not available.\n"); + VERIFY_ERRORS("test.css(1): error: 'number / color' and 'number % color' are not available.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Modulo 5 by a color is not valid") + CATCH_START_SECTION("Modulo 5 by a color is not valid") { std::stringstream ss; ss << "div { border-top-left-color: 5 % teal; }"; @@ -5482,12 +5592,13 @@ TEST_CASE("Invalid expressions with colors", "[expression] [multiplicative] [col c.compile(false); - REQUIRE_ERRORS("test.css(1): error: 'number / color' and 'number % color' are not available.\n"); + VERIFY_ERRORS("test.css(1): error: 'number / color' and 'number % color' are not available.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Divide 5.8 by a color is not valid") + CATCH_START_SECTION("Divide 5.8 by a color is not valid") { std::stringstream ss; ss << "div { border-top-left-color: 5.8 / teal; }"; @@ -5507,12 +5618,13 @@ TEST_CASE("Invalid expressions with colors", "[expression] [multiplicative] [col c.compile(false); - REQUIRE_ERRORS("test.css(1): error: 'number / color' and 'number % color' are not available.\n"); + VERIFY_ERRORS("test.css(1): error: 'number / color' and 'number % color' are not available.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Modulo 5.8 by a color is not valid") + CATCH_START_SECTION("Modulo 5.8 by a color is not valid") { std::stringstream ss; ss << "div { border-top-left-color: 5.8 % teal; }"; @@ -5532,12 +5644,13 @@ TEST_CASE("Invalid expressions with colors", "[expression] [multiplicative] [col c.compile(false); - REQUIRE_ERRORS("test.css(1): error: 'number / color' and 'number % color' are not available.\n"); + VERIFY_ERRORS("test.css(1): error: 'number / color' and 'number % color' are not available.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Multiply 3px by a color is not valid") + CATCH_START_SECTION("Multiply 3px by a color is not valid") { std::stringstream ss; ss << "div { border-top-left-color: 3px * chocolate; }"; @@ -5557,12 +5670,13 @@ TEST_CASE("Invalid expressions with colors", "[expression] [multiplicative] [col c.compile(false); - REQUIRE_ERRORS("test.css(1): error: color factors must be unit less values, 3px is not acceptable.\n"); + VERIFY_ERRORS("test.css(1): error: color factors must be unit less values, 3px is not acceptable.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Color division by zero") + CATCH_START_SECTION("Color division by zero") { std::stringstream ss; ss << "div { border-top-left-color: teal / blue; }"; @@ -5581,12 +5695,13 @@ TEST_CASE("Invalid expressions with colors", "[expression] [multiplicative] [col c.compile(false); - REQUIRE_ERRORS("test.css(1): error: color division does not accept any color component set to zero.\n"); + VERIFY_ERRORS("test.css(1): error: color division does not accept any color component set to zero.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("Color modulo by zero") + CATCH_START_SECTION("Color modulo by zero") { std::stringstream ss; ss << "div { border-top-left-color: teal % blue; }"; @@ -5605,20 +5720,14 @@ TEST_CASE("Invalid expressions with colors", "[expression] [multiplicative] [col c.compile(false); - REQUIRE_ERRORS("test.css(1): error: color modulo does not accept any color component set to zero.\n"); + VERIFY_ERRORS("test.css(1): error: color modulo does not accept any color component set to zero.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // still no errors? - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_expr_power.cpp b/tests/catch_expr_power.cpp index e1bf948..710fd79 100644 --- a/tests/catch_expr_power.cpp +++ b/tests/catch_expr_power.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the expression.cpp file: "**" operator. @@ -32,18 +34,32 @@ * classes. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + +// csspp lib +// +#include +#include +#include +#include + -#include "csspp/assembler.h" -#include "csspp/compiler.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" +// C++ lib +// +#include -#include -TEST_CASE("Expression number ** number", "[expression] [power]") +// last include +// +#include + + + +CATCH_TEST_CASE("Expression number ** number", "[expression] [power]") { - SECTION("no units, integers") + CATCH_START_SECTION("no units, integers") { std::stringstream ss; ss << "div { z-index: 10 ** 3; }"; @@ -68,7 +84,7 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -89,15 +105,16 @@ TEST_CASE("Expression number ** number", "[expression] [power]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:1000}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("no units, integers two powers, parenthesis right") + CATCH_START_SECTION("no units, integers two powers, parenthesis right") { std::stringstream ss; ss << "div { z-index: 4 ** (3 ** 2); }"; @@ -122,7 +139,7 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -143,15 +160,16 @@ TEST_CASE("Expression number ** number", "[expression] [power]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:262144}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("no units, integers two powers, parenthesis left") + CATCH_START_SECTION("no units, integers two powers, parenthesis left") { std::stringstream ss; ss << "div { z-index: (4 ** 3) ** 2; }"; @@ -176,7 +194,7 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -197,15 +215,16 @@ TEST_CASE("Expression number ** number", "[expression] [power]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:4096}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("px unit, integers") + CATCH_START_SECTION("px unit, integers") { std::stringstream ss; ss << "div { width: 10px ** 3 / 2px\\*px; }"; @@ -230,7 +249,7 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -251,15 +270,16 @@ TEST_CASE("Expression number ** number", "[expression] [power]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{width:500px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("no units, decimal number / integer") + CATCH_START_SECTION("no units, decimal number / integer") { std::stringstream ss; ss << "div { z-index: 7.3 ** 3; }"; @@ -284,7 +304,7 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -305,15 +325,16 @@ TEST_CASE("Expression number ** number", "[expression] [power]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:389.017}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("no units, integer and decimal number") + CATCH_START_SECTION("no units, integer and decimal number") { std::stringstream ss; ss << "div { z-index: 7 ** 3.1; }"; @@ -338,7 +359,7 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -359,15 +380,16 @@ TEST_CASE("Expression number ** number", "[expression] [power]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:416.681}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("no units, decimal number / negative power") + CATCH_START_SECTION("no units, decimal number / negative power") { std::stringstream ss; ss << "div { z-index: 0.3 ** -3.2; }"; @@ -392,7 +414,7 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -413,15 +435,16 @@ TEST_CASE("Expression number ** number", "[expression] [power]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:47.121}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("px unit, decimal number / integer") + CATCH_START_SECTION("px unit, decimal number / integer") { std::stringstream ss; ss << "div { width: 7.5px pow 3 / 3px\\*px; }"; @@ -446,7 +469,7 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -467,15 +490,16 @@ TEST_CASE("Expression number ** number", "[expression] [power]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{width:140.625px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("px/em unit, decimal number / integer") + CATCH_START_SECTION("px/em unit, decimal number / integer") { std::stringstream ss; ss << "div { width: (15.0px div 2.0em) pow 3; }"; @@ -500,7 +524,7 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -521,15 +545,16 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // // //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; // -// REQUIRE(assembler_out.str() == +// CATCH_REQUIRE(assembler_out.str() == // "div{width:421.875px}\n" // + csspp_test::get_close_comment() // ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("px/em unit, decimal number / integer") + CATCH_START_SECTION("px/em unit, decimal number / integer") { std::stringstream ss; ss << "div { width: (50.0px div 2.0em) pow -2; }"; @@ -554,7 +579,7 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -575,15 +600,16 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // // //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; // -// REQUIRE(assembler_out.str() == +// CATCH_REQUIRE(assembler_out.str() == // "div{width:421.875px}\n" // + csspp_test::get_close_comment() // ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("px unit, decimal number / -integer") + CATCH_START_SECTION("px unit, decimal number / -integer") { std::stringstream ss; ss << "div { width: .75px pow -3 * 3px\\*px\\*px\\*px; }"; @@ -608,7 +634,7 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -629,15 +655,16 @@ TEST_CASE("Expression number ** number", "[expression] [power]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{width:7.111px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("no units, decimal numbers") + CATCH_START_SECTION("no units, decimal numbers") { std::stringstream ss; ss << "div { z-index: 7.3 ** 3.1; }"; @@ -662,7 +689,7 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -683,15 +710,16 @@ TEST_CASE("Expression number ** number", "[expression] [power]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:474.571}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("px unit, decimal numbers") + CATCH_START_SECTION("px unit, decimal numbers") { std::stringstream ss; ss << "div { width: 7.5px pow 3.0 / 3px\\*px; }"; @@ -716,7 +744,7 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -737,15 +765,16 @@ TEST_CASE("Expression number ** number", "[expression] [power]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{width:140.625px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("% and integer") + CATCH_START_SECTION("% and integer") { std::stringstream ss; ss << "div { width: 105% pow 4; }"; @@ -770,7 +799,7 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -791,15 +820,16 @@ TEST_CASE("Expression number ** number", "[expression] [power]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{width:121.551%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("% and decimal numbers") + CATCH_START_SECTION("% and decimal numbers") { std::stringstream ss; ss << "div { width: 107.5% pow 5.3; }"; @@ -824,7 +854,7 @@ TEST_CASE("Expression number ** number", "[expression] [power]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -845,21 +875,22 @@ TEST_CASE("Expression number ** number", "[expression] [power]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{width:146.712%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression number/invalid ** number/invalid", "[expression] [power] [invalid]") +CATCH_TEST_CASE("Expression number/invalid ** number/invalid", "[expression] [power] [invalid]") { - SECTION("just ? is not a valid number") + CATCH_START_SECTION("just ? is not a valid number") { std::stringstream ss; ss << "div { border: ?; }"; @@ -880,12 +911,13 @@ TEST_CASE("Expression number/invalid ** number/invalid", "[expression] [power] [ //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("number ** ? is invalid") + CATCH_START_SECTION("number ** ? is invalid") { std::stringstream ss; ss << "div { width: 10px ** ?; }"; @@ -906,18 +938,19 @@ TEST_CASE("Expression number/invalid ** number/invalid", "[expression] [power] [ //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Power expressions with invalid dimensions or decimal numbers", "[expression] [power] [invalid]") +CATCH_TEST_CASE("Power expressions with invalid dimensions or decimal numbers", "[expression] [power] [invalid]") { - SECTION("right hand side cannot have a dimension") + CATCH_START_SECTION("right hand side cannot have a dimension") { std::stringstream ss; ss << "div { border: 3px ** 2em; }"; @@ -938,12 +971,13 @@ TEST_CASE("Power expressions with invalid dimensions or decimal numbers", "[expr //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: the number representing the power cannot be a dimension (em); it has to be unitless.\n"); + VERIFY_ERRORS("test.css(1): error: the number representing the power cannot be a dimension (em); it has to be unitless.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("power cannot be a percent") + CATCH_START_SECTION("power cannot be a percent") { std::stringstream ss; ss << "div { z-index: 10 ** 5%; }"; @@ -964,12 +998,13 @@ TEST_CASE("Power expressions with invalid dimensions or decimal numbers", "[expr //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types between INTEGER and PERCENT for operator '**'.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types between INTEGER and PERCENT for operator '**'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("power must be integral if left hand side has a dimension") + CATCH_START_SECTION("power must be integral if left hand side has a dimension") { std::stringstream ss; ss << "div { width: 7.3px ** 3.1; }"; @@ -990,12 +1025,13 @@ TEST_CASE("Power expressions with invalid dimensions or decimal numbers", "[expr //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a number with a dimension only supports integers as their power (i.e. 3px ** 2 is fine, 3px ** 2.1 is not supported).\n"); + VERIFY_ERRORS("test.css(1): error: a number with a dimension only supports integers as their power (i.e. 3px ** 2 is fine, 3px ** 2.1 is not supported).\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("power zero with a dimension is not allowed") + CATCH_START_SECTION("power zero with a dimension is not allowed") { std::stringstream ss; ss << "div { width: 7.5px ** 0.0; }"; @@ -1016,12 +1052,13 @@ TEST_CASE("Power expressions with invalid dimensions or decimal numbers", "[expr //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a number with a dimension power zero cannot be calculated (i.e. 3px ** 0 = 1 what?).\n"); + VERIFY_ERRORS("test.css(1): error: a number with a dimension power zero cannot be calculated (i.e. 3px ** 0 = 1 what?).\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("power too large") + CATCH_START_SECTION("power too large") { std::stringstream ss; ss << "div { width: 7.5px ** 1584.000; }"; @@ -1042,12 +1079,13 @@ TEST_CASE("Power expressions with invalid dimensions or decimal numbers", "[expr //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a number with a dimension power 101 or more would generate a very large string so we refuse it at this time. You may use unitless numbers instead.\n"); + VERIFY_ERRORS("test.css(1): error: a number with a dimension power 101 or more would generate a very large string so we refuse it at this time. You may use unitless numbers instead.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("'a ** b ** c' is not valid") + CATCH_START_SECTION("'a ** b ** c' is not valid") { std::stringstream ss; ss << "div { z-index: 4 ** 3 ** 2; }"; @@ -1068,20 +1106,14 @@ TEST_CASE("Power expressions with invalid dimensions or decimal numbers", "[expr //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type POWER as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type POWER as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_expr_relational.cpp b/tests/catch_expr_relational.cpp index 9f7b02b..670df4a 100644 --- a/tests/catch_expr_relational.cpp +++ b/tests/catch_expr_relational.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the expression.cpp file: "<", "<=", ">", ">=" operators. @@ -33,16 +35,31 @@ * classes. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// csspp lib +// +#include +#include +#include +#include + + +// C++ lib +// +#include + + +// last include +// +#include -#include "csspp/assembler.h" -#include "csspp/compiler.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include -TEST_CASE("Expression number <,<=,>,>= number", "[expression] [relational]") +CATCH_TEST_CASE("Expression number <,<=,>,>= number", "[expression] [relational]") { struct operator_results_t { @@ -61,7 +78,7 @@ TEST_CASE("Expression number <,<=,>,>= number", "[expression] [relational]") { ">=", false, true } }; - SECTION("compare 10 ?? 3") + CATCH_START_SECTION("compare 10 ?? 3") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -90,7 +107,7 @@ TEST_CASE("Expression number <,<=,>,>= number", "[expression] [relational]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -111,16 +128,17 @@ TEST_CASE("Expression number <,<=,>,>= number", "[expression] [relational]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 3 ?? 10") + CATCH_START_SECTION("compare 3 ?? 10") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -149,7 +167,7 @@ std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -170,16 +188,17 @@ std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 10 ?? 10") + CATCH_START_SECTION("compare 10 ?? 10") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -208,7 +227,7 @@ std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -229,16 +248,17 @@ std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 10% ?? 3%") + CATCH_START_SECTION("compare 10% ?? 3%") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -267,7 +287,7 @@ std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -288,16 +308,17 @@ std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 3% ?? 10%") + CATCH_START_SECTION("compare 3% ?? 10%") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -326,7 +347,7 @@ std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -347,16 +368,17 @@ std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 10% ?? 10%") + CATCH_START_SECTION("compare 10% ?? 10%") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -385,7 +407,7 @@ std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -406,16 +428,17 @@ std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 10.5 ?? 3.15") + CATCH_START_SECTION("compare 10.5 ?? 3.15") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -444,7 +467,7 @@ std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -465,16 +488,17 @@ std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 3.15 ?? 10.5") + CATCH_START_SECTION("compare 3.15 ?? 10.5") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -503,7 +527,7 @@ std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -524,16 +548,17 @@ std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 10.5 ?? 10.5") + CATCH_START_SECTION("compare 10.5 ?? 10.5") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -562,7 +587,7 @@ std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -583,16 +608,17 @@ std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 10 ?? 3.15") + CATCH_START_SECTION("compare 10 ?? 3.15") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -621,7 +647,7 @@ std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -642,16 +668,17 @@ std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 3.15 ?? 10") + CATCH_START_SECTION("compare 3.15 ?? 10") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -680,7 +707,7 @@ std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -701,16 +728,17 @@ std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 10 ?? 10.0") + CATCH_START_SECTION("compare 10 ?? 10.0") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -739,7 +767,7 @@ std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -760,16 +788,17 @@ std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 10.5 ?? 3") + CATCH_START_SECTION("compare 10.5 ?? 3") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -798,7 +827,7 @@ std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -819,16 +848,17 @@ std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 3 ?? 10.5") + CATCH_START_SECTION("compare 3 ?? 10.5") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -857,7 +887,7 @@ std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -878,16 +908,17 @@ std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 10 ?? 10.0") + CATCH_START_SECTION("compare 10 ?? 10.0") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -916,7 +947,7 @@ std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -937,16 +968,17 @@ std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare true ?? false") + CATCH_START_SECTION("compare true ?? false") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -975,7 +1007,7 @@ std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -996,12 +1028,12 @@ std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) @@ -1031,7 +1063,7 @@ std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1052,12 +1084,12 @@ std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) @@ -1087,7 +1119,7 @@ std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1108,12 +1140,12 @@ std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) @@ -1143,7 +1175,7 @@ std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1164,16 +1196,17 @@ std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 'xyz' ?? 'abc'") + CATCH_START_SECTION("compare 'xyz' ?? 'abc'") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -1202,7 +1235,7 @@ std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1223,16 +1256,17 @@ std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 'abc' ?? 'xyz'") + CATCH_START_SECTION("compare 'abc' ?? 'xyz'") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -1261,7 +1295,7 @@ std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1282,16 +1316,17 @@ std::string("div{z-index:") + (!op[idx].f_different_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("compare 'abc' ?? 'abc'") + CATCH_START_SECTION("compare 'abc' ?? 'abc'") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -1320,7 +1355,7 @@ std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1341,20 +1376,21 @@ std::string("div{z-index:") + (op[idx].f_different_result ? "9" : "5") + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (op[idx].f_equal_result ? "9" : "5") + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression number/invalid <,<=,>,>= number/invalid", "[expression] [relational] [invalid]") +CATCH_TEST_CASE("Expression number/invalid <,<=,>,>= number/invalid", "[expression] [relational] [invalid]") { char const * op[] = { @@ -1364,7 +1400,7 @@ TEST_CASE("Expression number/invalid <,<=,>,>= number/invalid", "[expression] [r ">=" }; - SECTION("just ? is not a valid number") + CATCH_START_SECTION("just ? is not a valid number") { std::stringstream ss; ss << "div { border: ?; }"; @@ -1385,12 +1421,13 @@ TEST_CASE("Expression number/invalid <,<=,>,>= number/invalid", "[expression] [r //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("number ?? ? is invalid") + CATCH_START_SECTION("number ?? ? is invalid") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -1415,17 +1452,18 @@ TEST_CASE("Expression number/invalid <,<=,>,>= number/invalid", "[expression] [r //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Relational expressions with invalid dimensions or decimal numbers", "[expression] [relational] [invalid]") +CATCH_TEST_CASE("Relational expressions with invalid dimensions or decimal numbers", "[expression] [relational] [invalid]") { char const * op[] = { @@ -1435,7 +1473,7 @@ TEST_CASE("Relational expressions with invalid dimensions or decimal numbers", " ">=" }; - SECTION("left and right must have the same dimension") + CATCH_START_SECTION("left and right must have the same dimension") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -1460,13 +1498,14 @@ TEST_CASE("Relational expressions with invalid dimensions or decimal numbers", " //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types or dimensions between INTEGER and INTEGER for operator '=', '!=', '<', '<=', '>', '>=', '~=', '^=', '$=', '*=', or '|='.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types or dimensions between INTEGER and INTEGER for operator '=', '!=', '<', '<=', '>', '>=', '~=', '^=', '$=', '*=', or '|='.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("try again with a percent number") + CATCH_START_SECTION("try again with a percent number") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -1491,11 +1530,11 @@ TEST_CASE("Relational expressions with invalid dimensions or decimal numbers", " //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: incompatible types or dimensions between INTEGER and PERCENT for operator '=', '!=', '<', '<=', '>', '>=', '~=', '^=', '$=', '*=', or '|='.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) @@ -1521,9 +1560,9 @@ TEST_CASE("Relational expressions with invalid dimensions or decimal numbers", " //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types or dimensions between INTEGER and PERCENT for operator '=', '!=', '<', '<=', '>', '>=', '~=', '^=', '$=', '*=', or '|='.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types or dimensions between INTEGER and PERCENT for operator '=', '!=', '<', '<=', '>', '>=', '~=', '^=', '$=', '*=', or '|='.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) @@ -1549,9 +1588,9 @@ TEST_CASE("Relational expressions with invalid dimensions or decimal numbers", " //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types or dimensions between PERCENT and INTEGER for operator '=', '!=', '<', '<=', '>', '>=', '~=', '^=', '$=', '*=', or '|='.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types or dimensions between PERCENT and INTEGER for operator '=', '!=', '<', '<=', '>', '>=', '~=', '^=', '$=', '*=', or '|='.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) @@ -1577,17 +1616,18 @@ TEST_CASE("Relational expressions with invalid dimensions or decimal numbers", " //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types or dimensions between PERCENT and INTEGER for operator '=', '!=', '<', '<=', '>', '>=', '~=', '^=', '$=', '*=', or '|='.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types or dimensions between PERCENT and INTEGER for operator '=', '!=', '<', '<=', '>', '>=', '~=', '^=', '$=', '*=', or '|='.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Relational expressions with colors fail", "[expression] [relational] [invalid]") +CATCH_TEST_CASE("Relational expressions with colors fail", "[expression] [relational] [invalid]") { char const * op[] = { @@ -1597,7 +1637,7 @@ TEST_CASE("Relational expressions with colors fail", "[expression] [relational] ">=" }; - SECTION("color op color always fails") + CATCH_START_SECTION("color op color always fails") { for(size_t idx(0); idx < sizeof(op) / sizeof(op[0]); ++idx) { @@ -1622,21 +1662,15 @@ TEST_CASE("Relational expressions with colors fail", "[expression] [relational] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: incompatible types between COLOR and COLOR for operator '<', '<=', '>', or '>='.\n"); + VERIFY_ERRORS("test.css(1): error: incompatible types between COLOR and COLOR for operator '<', '<=', '>', or '>='.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_expr_unary.cpp b/tests/catch_expr_unary.cpp index fc4460b..d0ec272 100644 --- a/tests/catch_expr_unary.cpp +++ b/tests/catch_expr_unary.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the expression.cpp file for all possible unary expressions. @@ -31,18 +33,33 @@ * classes. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// csspp lib +// +#include +#include +#include +#include + + +// C++ lib +// +#include + + +// last include +// +#include -#include "csspp/assembler.h" -#include "csspp/compiler.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include -TEST_CASE("Unary expressions", "[expression] [unary]") +CATCH_TEST_CASE("Unary expressions", "[expression] [unary]") { - SECTION("integer, identifier, hash color, color") + CATCH_START_SECTION("integer, identifier, hash color, color") { std::stringstream ss; ss << "$zzzrv: $_csspp_major > 0;\n" @@ -87,7 +104,7 @@ TEST_CASE("Unary expressions", "[expression] [unary]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -186,7 +203,7 @@ TEST_CASE("Unary expressions", "[expression] [unary]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{" "border:3px solid #f1a932;" "z-index:175;" @@ -208,10 +225,11 @@ TEST_CASE("Unary expressions", "[expression] [unary]") + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("null token (can't output)") + CATCH_START_SECTION("null token (can't output)") { std::stringstream ss; ss << "div{width:null}"; @@ -236,7 +254,7 @@ TEST_CASE("Unary expressions", "[expression] [unary]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -251,10 +269,11 @@ TEST_CASE("Unary expressions", "[expression] [unary]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("important width") + CATCH_START_SECTION("important width") { std::stringstream ss; ss << "div{width:3px !important}"; @@ -279,7 +298,7 @@ TEST_CASE("Unary expressions", "[expression] [unary]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -294,16 +313,17 @@ TEST_CASE("Unary expressions", "[expression] [unary]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Variables in expressions", "[expression] [unary] [variable]") +CATCH_TEST_CASE("Variables in expressions", "[expression] [unary] [variable]") { - SECTION("set expression variable and reuse") + CATCH_START_SECTION("set expression variable and reuse") { std::stringstream ss; ss << "div {\n" @@ -330,7 +350,7 @@ TEST_CASE("Variables in expressions", "[expression] [unary] [variable]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -355,7 +375,7 @@ TEST_CASE("Variables in expressions", "[expression] [unary] [variable]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{" "border:20px solid #f1a932" @@ -364,16 +384,17 @@ TEST_CASE("Variables in expressions", "[expression] [unary] [variable]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid unary expressions", "[expression] [unary] [invalid]") +CATCH_TEST_CASE("Invalid unary expressions", "[expression] [unary] [invalid]") { - SECTION("not a unary token") + CATCH_START_SECTION("not a unary token") { std::stringstream ss; ss << "div { border: ?; }\n"; @@ -394,12 +415,13 @@ TEST_CASE("Invalid unary expressions", "[expression] [unary] [invalid]") //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("invalid # color") + CATCH_START_SECTION("invalid # color") { std::stringstream ss; ss << "div { border: #identifier; }\n"; @@ -420,12 +442,13 @@ TEST_CASE("Invalid unary expressions", "[expression] [unary] [invalid]") //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: the color in #identifier is not valid.\n"); + VERIFY_ERRORS("test.css(1): error: the color in #identifier is not valid.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("not a valid token for minus") + CATCH_START_SECTION("not a valid token for minus") { std::stringstream ss; ss << "div { border: - \"test\"; }\n"; @@ -446,18 +469,20 @@ TEST_CASE("Invalid unary expressions", "[expression] [unary] [invalid]") //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type STRING for operator '-'.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type STRING for operator '-'.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("improper initialization of an expression object") + CATCH_START_SECTION("improper initialization of an expression object") { csspp::node::pointer_t null_node; - REQUIRE_THROWS_AS(new csspp::expression(null_node), csspp::csspp_exception_logic &); + CATCH_REQUIRE_THROWS_AS(new csspp::expression(null_node), csspp::csspp_exception_logic); } + CATCH_END_SECTION() - SECTION("important width, wrong order") + CATCH_START_SECTION("important width, wrong order") { std::stringstream ss; ss << "div { width: !important 3px; }"; @@ -478,12 +503,13 @@ TEST_CASE("Invalid unary expressions", "[expression] [unary] [invalid]") //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): warning: A special flag, !important in this case, must only appear at the end of a declaration.\n"); + VERIFY_ERRORS("test.css(1): warning: A special flag, !important in this case, must only appear at the end of a declaration.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("minus by itself") + CATCH_START_SECTION("minus by itself") { std::stringstream ss; ss << "div { width: -; }"; @@ -504,20 +530,14 @@ TEST_CASE("Invalid unary expressions", "[expression] [unary] [invalid]") //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unsupported type EOF_TOKEN as a unary expression token.\n"); + VERIFY_ERRORS("test.css(1): error: unsupported type EOF_TOKEN as a unary expression token.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_internal_functions.cpp b/tests/catch_internal_functions.cpp index e9f5d02..df964df 100644 --- a/tests/catch_internal_functions.cpp +++ b/tests/catch_internal_functions.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the internal_functions.cpp file. @@ -31,18 +33,35 @@ * classes. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// csspp lib +// +#include +#include +#include +#include + + +// C++ lib +// +#include +#include +#include + + +// last include +// +#include -#include "csspp/assembler.h" -#include "csspp/compiler.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include -TEST_CASE("Expression calc()", "[expression] [internal-functions] [calc]") +CATCH_TEST_CASE("Expression calc()", "[expression] [internal-functions] [calc]") { - SECTION("calc() -- leave that one alone!") + CATCH_START_SECTION("calc() -- leave that one alone!") { std::stringstream ss; ss << "div { width: calc(3px + 5%); }"; @@ -63,11 +82,11 @@ TEST_CASE("Expression calc()", "[expression] [internal-functions] [calc]") //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -94,23 +113,24 @@ TEST_CASE("Expression calc()", "[expression] [internal-functions] [calc]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{width:calc(3px + 5%)}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression cos()/sin()/tan()", "[expression] [internal-functions] [cos] [sin] [tan]") +CATCH_TEST_CASE("Expression cos()/sin()/tan()", "[expression] [internal-functions] [cos] [sin] [tan]") { - SECTION("cos(pi)") + CATCH_START_SECTION("cos(pi)") { for(int angle(-180); angle <= 180; angle += rand() % 25 + 1) { @@ -141,7 +161,7 @@ TEST_CASE("Expression cos()/sin()/tan()", "[expression] [internal-functions] [co // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -162,14 +182,14 @@ TEST_CASE("Expression cos()/sin()/tan()", "[expression] [internal-functions] [co //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(cos(angle * M_PI / 180.0), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // degrees @@ -199,7 +219,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(cos(angle * M_PI / // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -220,14 +240,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(cos(angle * M_PI / //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(cos(angle * M_PI / 180.0), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // radians @@ -257,7 +277,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(cos(angle * M_PI / // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -278,14 +298,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(cos(angle * M_PI / //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(cos(angle * M_PI / 180.0), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // gradians @@ -315,7 +335,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(cos(angle * M_PI / // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -336,14 +356,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(cos(angle * M_PI / //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(cos(angle * M_PI / 180.0), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // turns @@ -373,7 +393,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(cos(angle * M_PI / // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -394,19 +414,20 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(cos(angle * M_PI / //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(cos(angle * M_PI / 180.0), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } + CATCH_END_SECTION() - SECTION("sin(pi)") + CATCH_START_SECTION("sin(pi)") { for(int angle(-180); angle <= 180; angle += rand() % 12) { @@ -437,7 +458,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(cos(angle * M_PI / // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -458,14 +479,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(cos(angle * M_PI / //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(sin(angle * M_PI / 180.0), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // degrees @@ -495,7 +516,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(sin(angle * M_PI / // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -516,14 +537,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(sin(angle * M_PI / //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(sin(angle * M_PI / 180.0), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // radians @@ -553,7 +574,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(sin(angle * M_PI / // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -574,14 +595,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(sin(angle * M_PI / //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(sin(angle * M_PI / 180.0), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // gradians @@ -611,7 +632,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(sin(angle * M_PI / // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -632,14 +653,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(sin(angle * M_PI / //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(sin(angle * M_PI / 180.0), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // turns @@ -669,7 +690,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(sin(angle * M_PI / // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -690,19 +711,20 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(sin(angle * M_PI / //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(sin(angle * M_PI / 180.0), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } + CATCH_END_SECTION() - SECTION("tan(pi)") + CATCH_START_SECTION("tan(pi)") { for(int angle(-180); angle <= 180; angle += rand() % 12) { @@ -734,7 +756,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(sin(angle * M_PI / // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -755,14 +777,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(sin(angle * M_PI / //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(tan(angle * M_PI / 180.0), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // degrees @@ -792,7 +814,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(tan(angle * M_PI / // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -813,14 +835,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(tan(angle * M_PI / //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(tan(angle * M_PI / 180.0), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // radians @@ -855,7 +877,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(tan(angle * M_PI / // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -876,14 +898,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(tan(angle * M_PI / //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(tan(rd), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // gradians @@ -918,7 +940,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(tan(rd), true) + " // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -939,14 +961,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(tan(rd), true) + " //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(tan(gd * M_PI / 200.0), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // turns @@ -981,7 +1003,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(tan(gd * M_PI / 20 // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1002,26 +1024,27 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(tan(gd * M_PI / 20 //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(tan(tn * M_PI * 2.0), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression acos()/asin()/atan()", "[expression] [internal-functions] [acos] [asin] [atan]") +CATCH_TEST_CASE("Expression acos()/asin()/atan()", "[expression] [internal-functions] [acos] [asin] [atan]") { - SECTION("acos(ratio)") + CATCH_START_SECTION("acos(ratio)") { for(int angle(-180); angle <= 180; angle += rand() % 25 + 1) { @@ -1050,7 +1073,7 @@ TEST_CASE("Expression acos()/asin()/atan()", "[expression] [internal-functions] // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1071,14 +1094,14 @@ TEST_CASE("Expression acos()/asin()/atan()", "[expression] [internal-functions] //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(labs(angle) * M_PI / 180.0, true) + "rad}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // another test with an integer @@ -1106,7 +1129,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(labs(angle) * M_PI // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1127,18 +1150,19 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(labs(angle) * M_PI //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(acos(2), true) + "rad}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("asin(pi)") + CATCH_START_SECTION("asin(pi)") { for(int angle(-180); angle <= 180; angle += rand() % 12) { @@ -1167,7 +1191,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(acos(2), true) + " // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1188,14 +1212,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(acos(2), true) + " //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(asin(sin(angle * M_PI / 180.0)), true) + "rad}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // another test with an integer @@ -1223,7 +1247,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(asin(sin(angle * M // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1244,18 +1268,19 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(asin(sin(angle * M //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(asin(2), true) + "rad}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("atan(pi)") + CATCH_START_SECTION("atan(pi)") { for(int angle(-180); angle <= 180; angle += rand() % 12) { @@ -1284,7 +1309,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(asin(2), true) + " // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1305,14 +1330,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(asin(2), true) + " //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(atan(tan(angle * M_PI / 180.0)), true) + "rad}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // another test with an integer @@ -1340,7 +1365,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(atan(tan(angle * M // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1361,24 +1386,25 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(atan(tan(angle * M //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(atan(2), true) + "rad}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression abs()/ceil()/floor()/round()/log()/sign()/sqrt()", "[expression] [internal-functions] [abs] [ceil] [floor] [round]") +CATCH_TEST_CASE("Expression abs()/ceil()/floor()/round()/log()/sign()/sqrt()", "[expression] [internal-functions] [abs] [ceil] [floor] [round]") { - SECTION("abs(number)") + CATCH_START_SECTION("abs(number)") { for(int number(-10000); number <= 10000; number += rand() % 250 + 1) { @@ -1411,7 +1437,7 @@ TEST_CASE("Expression abs()/ceil()/floor()/round()/log()/sign()/sqrt()", "[expre // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1432,14 +1458,14 @@ TEST_CASE("Expression abs()/ceil()/floor()/round()/log()/sign()/sqrt()", "[expre //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{width:") + std::to_string(labs(number)) + dimension + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // abs(float) @@ -1472,7 +1498,7 @@ std::string("div{width:") + std::to_string(labs(number)) + dimension + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1493,19 +1519,20 @@ std::string("div{width:") + std::to_string(labs(number)) + dimension + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{width:") + csspp::decimal_number_to_string(fabs(static_cast(number) / 1000.0), true) + dimension + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } + CATCH_END_SECTION() - SECTION("ceil(number)") + CATCH_START_SECTION("ceil(number)") { for(int number(-10000); number <= 10000; number += rand() % 250 + 1) { @@ -1536,7 +1563,7 @@ std::string("div{width:") + csspp::decimal_number_to_string(fabs(static_cast<< *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1557,14 +1584,14 @@ std::string("div{width:") + csspp::decimal_number_to_string(fabs(static_cast<< "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + std::to_string(number) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // ceil(float) @@ -1597,7 +1624,7 @@ std::string("div{z-index:") + std::to_string(number) + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1618,19 +1645,20 @@ std::string("div{z-index:") + std::to_string(number) + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(ceil(static_cast(number) / 1000.0), true) + dimension + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } + CATCH_END_SECTION() - SECTION("floor(number)") + CATCH_START_SECTION("floor(number)") { for(int number(-10000); number <= 10000; number += rand() % 250 + 1) { @@ -1661,7 +1689,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(ceil(static_cast<< *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1682,14 +1710,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(ceil(static_cast<< "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + std::to_string(number) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // floor(float) @@ -1722,7 +1750,7 @@ std::string("div{z-index:") + std::to_string(number) + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1743,19 +1771,20 @@ std::string("div{z-index:") + std::to_string(number) + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{width:") + csspp::decimal_number_to_string(floor(static_cast(number) / 1000.0), true) + dimension + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } + CATCH_END_SECTION() - SECTION("round(number)") + CATCH_START_SECTION("round(number)") { for(int number(-10000); number <= 10000; number += rand() % 250 + 1) { @@ -1786,7 +1815,7 @@ std::string("div{width:") + csspp::decimal_number_to_string(floor(static_cast<< *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1807,14 +1836,14 @@ std::string("div{width:") + csspp::decimal_number_to_string(floor(static_cast<< "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + std::to_string(number) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // round(float) @@ -1847,7 +1876,7 @@ std::string("div{z-index:") + std::to_string(number) + "}\n" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1868,19 +1897,20 @@ std::string("div{z-index:") + std::to_string(number) + "}\n" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{width:") + csspp::decimal_number_to_string(round(static_cast(number) / 1000.0), true) + dimension + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } + CATCH_END_SECTION() - SECTION("log(number)") + CATCH_START_SECTION("log(number)") { // log(-1) and log(0) are invalid for(int number(1); number <= 10000; number += rand() % 250 + 1) @@ -1912,7 +1942,7 @@ std::string("div{width:") + csspp::decimal_number_to_string(round(static_cast<< *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1933,14 +1963,14 @@ std::string("div{width:") + csspp::decimal_number_to_string(round(static_cast<< "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(log(static_cast(number)), false) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // log(float) @@ -1971,7 +2001,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(log(static_cast<< *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -1992,19 +2022,20 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(log(static_cast<< "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(log(static_cast(number) / 1000.0), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } + CATCH_END_SECTION() - SECTION("sign(number)") + CATCH_START_SECTION("sign(number)") { for(int number(-10000); number <= 10000; number += rand() % 250 + 1) { @@ -2035,7 +2066,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(log(static_cast<< *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2056,14 +2087,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(log(static_cast<< "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:" + std::to_string(number == 0 ? 0 : (number < 0 ? -1 : 1)) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // sign(float) @@ -2094,7 +2125,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(log(static_cast<< *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2115,14 +2146,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(log(static_cast<< "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + (number == 0 ? "0" : (number < 0 ? "-1" : "1")) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // sign(percent) @@ -2153,7 +2184,7 @@ std::string("div{z-index:") + (number == 0 ? "0" : (number < 0 ? "-1" : "1")) + // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2174,19 +2205,20 @@ std::string("div{z-index:") + (number == 0 ? "0" : (number < 0 ? "-1" : "1")) + //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{width:") + (number == 0 ? "0" : (number < 0 ? "-100": "100")) + "%}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } + CATCH_END_SECTION() - SECTION("sqrt(number)") + CATCH_START_SECTION("sqrt(number)") { // sqrt(-number) is not valid, so skip negative numbers for(int number(0); number <= 10000; number += rand() % 250 + 1) @@ -2218,7 +2250,7 @@ std::string("div{width:") + (number == 0 ? "0" : (number < 0 ? "-100": "100")) + // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2239,14 +2271,14 @@ std::string("div{width:") + (number == 0 ? "0" : (number < 0 ? "-100": "100")) + //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:" + csspp::decimal_number_to_string(sqrt(static_cast(number)), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // sqrt(float) @@ -2277,7 +2309,7 @@ std::string("div{width:") + (number == 0 ? "0" : (number < 0 ? "-100": "100")) + // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2298,14 +2330,14 @@ std::string("div{width:") + (number == 0 ? "0" : (number < 0 ? "-100": "100")) + //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{z-index:") + csspp::decimal_number_to_string(sqrt(static_cast(number) / 1000.0), true) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // sqrt(dimension) @@ -2336,7 +2368,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(sqrt(static_cast<< *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2357,14 +2389,14 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(sqrt(static_cast<< "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{width:") + csspp::decimal_number_to_string(sqrt(static_cast(number) / 1000.0), true) + "px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } // sqrt(dimension) -- dividend and divisor @@ -2395,7 +2427,7 @@ std::string("div{width:") + csspp::decimal_number_to_string(sqrt(static_cast<< *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2416,25 +2448,26 @@ std::string("div{width:") + csspp::decimal_number_to_string(sqrt(static_cast<< "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == std::string("div{width:") + csspp::decimal_number_to_string(sqrt(static_cast(number) / 1000.0), true) + "px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression red()/green()/blue()/alpha()", "[expression] [internal-functions] [red] [green] [blue] [alpha]") +CATCH_TEST_CASE("Expression red()/green()/blue()/alpha()", "[expression] [internal-functions] [red] [green] [blue] [alpha]") { - SECTION("check color components") + CATCH_START_SECTION("check color components") { for(int r(0); r < 256; r += rand() % 100 + 1) { @@ -2667,7 +2700,7 @@ TEST_CASE("Expression red()/green()/blue()/alpha()", "[expression] [internal-fun // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -2855,7 +2888,7 @@ TEST_CASE("Expression red()/green()/blue()/alpha()", "[expression] [internal-fun //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == // rgba() std::string("div{z-index:") + std::to_string(r) + "}" @@ -2892,15 +2925,16 @@ std::string("div{z-index:") + std::to_string(r) + "}" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } } } } + CATCH_END_SECTION() - SECTION("rgb/rgba/frgb/frgba from #color") + CATCH_START_SECTION("rgb/rgba/frgb/frgba from #color") { std::stringstream ss; ss << "div { z-index: red( rgba( darkolivegreen, 0.5)); }\n" @@ -2940,7 +2974,7 @@ std::string("div{z-index:") + std::to_string(r) + "}" // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3070,7 +3104,7 @@ std::string("div{z-index:") + std::to_string(r) + "}" //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == // rgba(darkolivegreen, 0.5) "div{z-index:85}" @@ -3097,16 +3131,17 @@ std::string("div{z-index:") + std::to_string(r) + "}" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression hue()/saturation()/lightness()/alpha()", "[expression] [internal-functions] [hue] [saturation] [lightness] [alpha]") +CATCH_TEST_CASE("Expression hue()/saturation()/lightness()/alpha()", "[expression] [internal-functions] [hue] [saturation] [lightness] [alpha]") { - SECTION("check color components") + CATCH_START_SECTION("check color components") { for(int h(46); h < 180; h += rand() % 50 + 1) { @@ -3210,7 +3245,7 @@ TEST_CASE("Expression hue()/saturation()/lightness()/alpha()", "[expression] [in // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3282,7 +3317,7 @@ TEST_CASE("Expression hue()/saturation()/lightness()/alpha()", "[expression] [in //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == // hsla() std::string("div{z-index:") + csspp::decimal_number_to_string(h1 * 180.0 / M_PI, true) + "deg}" @@ -3299,14 +3334,15 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(h1 * 180.0 / M_PI, ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } } } } + CATCH_END_SECTION() - SECTION("rgb/rgba/frgb/frgba from #color") + CATCH_START_SECTION("rgb/rgba/frgb/frgba from #color") { std::stringstream ss; ss << "div { z-index: red( rgba( darkolivegreen, 0.5)); }\n" @@ -3346,7 +3382,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(h1 * 180.0 / M_PI, // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3476,7 +3512,7 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(h1 * 180.0 / M_PI, //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == // rgba(darkolivegreen, 0.5) "div{z-index:85}" @@ -3503,16 +3539,17 @@ std::string("div{z-index:") + csspp::decimal_number_to_string(h1 * 180.0 / M_PI, ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression function_exists()/variable_exists()/global_variable_exists()", "[expression] [internal-functions] [function-exists] [variable-exists] [global-variable-exists]") +CATCH_TEST_CASE("Expression function_exists()/variable_exists()/global_variable_exists()", "[expression] [internal-functions] [function-exists] [variable-exists] [global-variable-exists]") { - SECTION("check existance of internal functions") + CATCH_START_SECTION("check existance of internal functions") { // list of internal functions, they all must return true // those that start with '*' are colors that are viewed @@ -3610,7 +3647,7 @@ TEST_CASE("Expression function_exists()/variable_exists()/global_variable_exists // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3645,22 +3682,23 @@ TEST_CASE("Expression function_exists()/variable_exists()/global_variable_exists //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:3.14}div{z-index:3.14}div{z-index:17}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // system defined functions are just like user defined functions // so we don't have to test more (although these are only global // functions, we could add a test to verify that functions defined // in a {}-block are ignored from outside that block.) - SECTION("check existance of system functions") + CATCH_START_SECTION("check existance of system functions") { // list of system functions, they all must return true // those that start with '*' are colors that are viewed @@ -3734,7 +3772,7 @@ TEST_CASE("Expression function_exists()/variable_exists()/global_variable_exists // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3769,18 +3807,19 @@ TEST_CASE("Expression function_exists()/variable_exists()/global_variable_exists //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:3.14}div{z-index:3.14}div{z-index:17}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("check that the system defined variables exist") + CATCH_START_SECTION("check that the system defined variables exist") { // list of system variables char const * internal_variables[] = @@ -3852,7 +3891,7 @@ TEST_CASE("Expression function_exists()/variable_exists()/global_variable_exists // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -3899,18 +3938,19 @@ TEST_CASE("Expression function_exists()/variable_exists()/global_variable_exists //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:3.14}div{z-index:3.14}div{z-index:17}div{z-index:17}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() - SECTION("check that various variables exist") + CATCH_START_SECTION("check that various variables exist") { // list of system variables char const * internal_variables[] = @@ -3984,7 +4024,7 @@ TEST_CASE("Expression function_exists()/variable_exists()/global_variable_exists // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4038,24 +4078,25 @@ TEST_CASE("Expression function_exists()/variable_exists()/global_variable_exists //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:3.14}div{z-index:3.14}div{z-index:17}div{z-index:3.14}div{z-index:17}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression unique_id()", "[expression] [internal-functions] [unique-id]") +CATCH_TEST_CASE("Expression unique_id()", "[expression] [internal-functions] [unique-id]") { - SECTION("unique_id() without an identifier") + CATCH_START_SECTION("unique_id() without an identifier") { std::stringstream ss; ss << "a { content: string(unique_id()); }" @@ -4075,7 +4116,7 @@ TEST_CASE("Expression unique_id()", "[expression] [internal-functions] [unique-i // reset counter so we can compare with 1, 2, 3 each time csspp::expression::set_unique_id_counter(0); - REQUIRE(csspp::expression::get_unique_id_counter() == 0); + CATCH_REQUIRE(csspp::expression::get_unique_id_counter() == 0); csspp::compiler c; c.set_root(n); @@ -4085,7 +4126,7 @@ TEST_CASE("Expression unique_id()", "[expression] [internal-functions] [unique-i c.compile(false); - REQUIRE(csspp::expression::get_unique_id_counter() == 6); + CATCH_REQUIRE(csspp::expression::get_unique_id_counter() == 6); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -4093,7 +4134,7 @@ TEST_CASE("Expression unique_id()", "[expression] [internal-functions] [unique-i // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4149,7 +4190,7 @@ TEST_CASE("Expression unique_id()", "[expression] [internal-functions] [unique-i //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "a{content:\"_csspp_unique1\"}" "b{content:\"_csspp_unique2\"}" @@ -4162,10 +4203,11 @@ TEST_CASE("Expression unique_id()", "[expression] [internal-functions] [unique-i ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("unique_id() with out own identifier") + CATCH_START_SECTION("unique_id() with out own identifier") { std::stringstream ss; ss << "a { content: string(unique_id(my_id)); }\n" @@ -4185,7 +4227,7 @@ TEST_CASE("Expression unique_id()", "[expression] [internal-functions] [unique-i // reset counter so we can compare with 1, 2, 3 each time csspp::expression::set_unique_id_counter(0); - REQUIRE(csspp::expression::get_unique_id_counter() == 0); + CATCH_REQUIRE(csspp::expression::get_unique_id_counter() == 0); csspp::compiler c; c.set_root(n); @@ -4195,7 +4237,7 @@ TEST_CASE("Expression unique_id()", "[expression] [internal-functions] [unique-i c.compile(false); - REQUIRE(csspp::expression::get_unique_id_counter() == 6); + CATCH_REQUIRE(csspp::expression::get_unique_id_counter() == 6); //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; @@ -4203,7 +4245,7 @@ TEST_CASE("Expression unique_id()", "[expression] [internal-functions] [unique-i // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4259,7 +4301,7 @@ TEST_CASE("Expression unique_id()", "[expression] [internal-functions] [unique-i //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "a{content:\"my_id1\"}" "b{content:\"this_id2\"}" @@ -4272,16 +4314,17 @@ TEST_CASE("Expression unique_id()", "[expression] [internal-functions] [unique-i ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression if()", "[expression] [internal-functions] [if]") +CATCH_TEST_CASE("Expression if()", "[expression] [internal-functions] [if]") { - SECTION("check that the inetrnal if() function works as expected") + CATCH_START_SECTION("check that the inetrnal if() function works as expected") { std::stringstream ss; ss << "div { width: if(3.14 = 17, 1.22em, 44px) }\n" @@ -4311,7 +4354,7 @@ TEST_CASE("Expression if()", "[expression] [internal-functions] [if]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4351,23 +4394,24 @@ TEST_CASE("Expression if()", "[expression] [internal-functions] [if]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{width:44px}div{width:1.23em}div{border:.2em solid #000}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression inspect()", "[expression] [internal-functions] [inspect]") +CATCH_TEST_CASE("Expression inspect()", "[expression] [internal-functions] [inspect]") { - SECTION("check that the internal inspect() function works as expected") + CATCH_START_SECTION("check that the internal inspect() function works as expected") { std::stringstream ss; ss << "div { content: inspect(0.2em solid black) }\n"; @@ -4395,7 +4439,7 @@ TEST_CASE("Expression inspect()", "[expression] [internal-functions] [inspect]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4416,23 +4460,24 @@ TEST_CASE("Expression inspect()", "[expression] [internal-functions] [inspect]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{content:\"0.2em solid #000\"}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression random()", "[expression] [internal-functions] [random]") +CATCH_TEST_CASE("Expression random()", "[expression] [internal-functions] [random]") { - SECTION("check that the internal random() function \"works as expected\"") + CATCH_START_SECTION("check that the internal random() function \"works as expected\"") { std::stringstream ss; ss << "div { width: random() * 1.0px }\n"; @@ -4482,7 +4527,7 @@ TEST_CASE("Expression random()", "[expression] [internal-functions] [random]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4503,23 +4548,24 @@ TEST_CASE("Expression random()", "[expression] [internal-functions] [random]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{width:" + csspp::decimal_number_to_string(v, true) + "px}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression min()/max()", "[expression] [internal-functions] [min] [max]") +CATCH_TEST_CASE("Expression min()/max()", "[expression] [internal-functions] [min] [max]") { - SECTION("check the min()/max() functions against a list of random numbers") + CATCH_START_SECTION("check the min()/max() functions against a list of random numbers") { for(int i(0); i < 10; ++i) { @@ -4593,7 +4639,7 @@ TEST_CASE("Expression min()/max()", "[expression] [internal-functions] [min] [ma // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4677,7 +4723,7 @@ TEST_CASE("Expression min()/max()", "[expression] [internal-functions] [min] [ma //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{width:" + std::to_string(min) + "}" "sub{height:" + std::to_string(max) + "}" @@ -4694,17 +4740,18 @@ TEST_CASE("Expression min()/max()", "[expression] [internal-functions] [min] [ma ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression str_length()", "[expression] [internal-functions] [str-length]") +CATCH_TEST_CASE("Expression str_length()", "[expression] [internal-functions] [str-length]") { - SECTION("check the str_length() function") + CATCH_START_SECTION("check the str_length() function") { for(int i(0); i < 30; ++i) { @@ -4753,7 +4800,7 @@ TEST_CASE("Expression str_length()", "[expression] [internal-functions] [str-len // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4774,24 +4821,25 @@ TEST_CASE("Expression str_length()", "[expression] [internal-functions] [str-len //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "p{z-index:" + std::to_string(i) + "}\n" + csspp_test::get_close_comment() ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression type_of()", "[expression] [internal-functions] [type-of]") +CATCH_TEST_CASE("Expression type_of()", "[expression] [internal-functions] [type-of]") { - SECTION("check the type_of() function") + CATCH_START_SECTION("check the type_of() function") { std::stringstream ss; ss << "p { content: type_of(\"string\") }\n" @@ -4833,7 +4881,7 @@ TEST_CASE("Expression type_of()", "[expression] [internal-functions] [type-of]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -4945,7 +4993,7 @@ TEST_CASE("Expression type_of()", "[expression] [internal-functions] [type-of]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "p{content:\"string\"}" "div{content:\"integer\"}" @@ -4966,16 +5014,17 @@ TEST_CASE("Expression type_of()", "[expression] [internal-functions] [type-of]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression unit()", "[expression] [internal-functions] [unit]") +CATCH_TEST_CASE("Expression unit()", "[expression] [internal-functions] [unit]") { - SECTION("check the unit() function -- standard CSS units") + CATCH_START_SECTION("check the unit() function -- standard CSS units") { std::stringstream ss; ss << "p { content: unit(12) }\n" @@ -5007,7 +5056,7 @@ TEST_CASE("Expression unit()", "[expression] [internal-functions] [unit]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -5049,7 +5098,7 @@ TEST_CASE("Expression unit()", "[expression] [internal-functions] [unit]") //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "p{content:\"\"}" "div{content:\"px\"}" @@ -5060,10 +5109,11 @@ TEST_CASE("Expression unit()", "[expression] [internal-functions] [unit]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("check the unit() function -- non-standard CSS units") + CATCH_START_SECTION("check the unit() function -- non-standard CSS units") { std::stringstream ss; ss << "p { content: unit(12px ** 2 / 17em) }\n" @@ -5094,7 +5144,7 @@ TEST_CASE("Expression unit()", "[expression] [internal-functions] [unit]") // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -5123,16 +5173,17 @@ TEST_CASE("Expression unit()", "[expression] [internal-functions] [unit]") ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifier()", "[expression] [internal-functions] [decimal-number] [integer] [percentage] [string] [identifier]") +CATCH_TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifier()", "[expression] [internal-functions] [decimal-number] [integer] [percentage] [string] [identifier]") { - SECTION("check conversions to decimal number") + CATCH_START_SECTION("check conversions to decimal number") { std::stringstream ss; ss << "div { z-index: decimal_number(314) }\n" @@ -5168,7 +5219,7 @@ TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifie // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -5245,7 +5296,7 @@ TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifie //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:314}" "span{z-index:3.14}" @@ -5261,10 +5312,11 @@ TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifie ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("check conversions to integer") + CATCH_START_SECTION("check conversions to integer") { std::stringstream ss; ss << "div { z-index: integer(314) }\n" @@ -5300,7 +5352,7 @@ TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifie // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -5377,7 +5429,7 @@ TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifie //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:314}" "span{z-index:3}" @@ -5393,10 +5445,11 @@ TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifie ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("check conversions to percentage") + CATCH_START_SECTION("check conversions to percentage") { std::stringstream ss; ss << "div { z-index: percentage(314) }\n" @@ -5432,7 +5485,7 @@ TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifie // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -5509,7 +5562,7 @@ TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifie //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:31400%}" "span{z-index:314%}" @@ -5525,10 +5578,11 @@ TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifie ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("check conversions to string") + CATCH_START_SECTION("check conversions to string") { std::stringstream ss; ss << "div { z-index: string(314) }\n" @@ -5563,7 +5617,7 @@ TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifie // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -5633,7 +5687,7 @@ TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifie //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:\"314\"}" "span{z-index:\"3.14\"}" @@ -5648,10 +5702,11 @@ TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifie ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("check conversions to identifiers") + CATCH_START_SECTION("check conversions to identifiers") { std::stringstream ss; ss << "div { z-index: identifier(test) }\n" @@ -5686,7 +5741,7 @@ TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifie // test the root node here std::stringstream compiler_out; compiler_out << *n; - REQUIRE_TREES(compiler_out.str(), + VERIFY_TREES(compiler_out.str(), "LIST\n" + csspp_test::get_default_variables() + @@ -5756,7 +5811,7 @@ TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifie //std::cerr << "----------------- Result is " << static_cast(i) << "\n[" << out.str() << "]\n"; - REQUIRE(assembler_out.str() == + CATCH_REQUIRE(assembler_out.str() == "div{z-index:test}" "span{z-index:test}" @@ -5771,16 +5826,17 @@ TEST_CASE("Expression decimal_number()/integer()/percentage()/string()/identifie ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid sub-expression decimal_number()/integer()/string()/identifier()", "[expression] [internal-functions] [decimal-number] [integer] [string] [identifier] [invalid]") +CATCH_TEST_CASE("Invalid sub-expression decimal_number()/integer()/string()/identifier()", "[expression] [internal-functions] [decimal-number] [integer] [string] [identifier] [invalid]") { - SECTION("check conversions to decimal number with an invalid string") + CATCH_START_SECTION("check conversions to decimal number with an invalid string") { std::stringstream ss; ss << "div { z-index: decimal_number(\"invalid\") }\n"; @@ -5803,12 +5859,13 @@ TEST_CASE("Invalid sub-expression decimal_number()/integer()/string()/identifier //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: decimal_number() expects a string parameter to represent a valid integer, decimal number, or percent value.\n"); + VERIFY_ERRORS("test.css(1): error: decimal_number() expects a string parameter to represent a valid integer, decimal number, or percent value.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("check decimal number without a parameter") + CATCH_START_SECTION("check decimal number without a parameter") { std::stringstream ss; ss << "div { z-index: decimal_number() }\n"; @@ -5831,12 +5888,13 @@ TEST_CASE("Invalid sub-expression decimal_number()/integer()/string()/identifier //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: decimal_number() expects exactly 1 parameter.\n"); + VERIFY_ERRORS("test.css(1): error: decimal_number() expects exactly 1 parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("check conversions to decimal number with a unicode range") + CATCH_START_SECTION("check conversions to decimal number with a unicode range") { std::stringstream ss; ss << "div { z-index: decimal_number(U+1-5) }\n"; @@ -5859,14 +5917,15 @@ TEST_CASE("Invalid sub-expression decimal_number()/integer()/string()/identifier //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: decimal_number() expects one value as parameter.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("check conversions to integer with an invalid string") + CATCH_START_SECTION("check conversions to integer with an invalid string") { std::stringstream ss; ss << "div { z-index: integer(\"invalid\") }\n"; @@ -5889,12 +5948,13 @@ TEST_CASE("Invalid sub-expression decimal_number()/integer()/string()/identifier //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: decimal_number() expects a string parameter to represent a valid integer, decimal number, or percent value.\n"); + VERIFY_ERRORS("test.css(1): error: decimal_number() expects a string parameter to represent a valid integer, decimal number, or percent value.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("check conversions to integer with an invalid expression as parameter") + CATCH_START_SECTION("check conversions to integer with an invalid expression as parameter") { std::stringstream ss; ss << "div { z-index: integer(?) }\n"; @@ -5917,15 +5977,16 @@ TEST_CASE("Invalid sub-expression decimal_number()/integer()/string()/identifier //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: unsupported type CONDITIONAL as a unary expression token.\n" "test.css(1): error: integer() expects one value as parameter.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("check conversions to integer with a unicode range") + CATCH_START_SECTION("check conversions to integer with a unicode range") { std::stringstream ss; ss << "div { z-index: integer(U+1-5) }\n"; @@ -5948,20 +6009,21 @@ TEST_CASE("Invalid sub-expression decimal_number()/integer()/string()/identifier //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: integer() expects one value as parameter.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Expression calling functions with invalid parameters", "[expression] [internal-functions] [invalid]") +CATCH_TEST_CASE("Expression calling functions with invalid parameters", "[expression] [internal-functions] [invalid]") { - SECTION("abs(\"wrong\")") + CATCH_START_SECTION("abs(\"wrong\")") { std::stringstream ss; ss << "div { width: abs(\"wrong\"); }"; @@ -5982,12 +6044,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: abs() expects a number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: abs() expects a number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("acos(true)") + CATCH_START_SECTION("acos(true)") { std::stringstream ss; ss << "div { width: acos(true); }"; @@ -6008,12 +6071,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: acos() expects a number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: acos() expects a number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("alpha(12)") + CATCH_START_SECTION("alpha(12)") { std::stringstream ss; ss << "div { width: alpha(12); }"; @@ -6034,12 +6098,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: alpha() expects a color as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: alpha() expects a color as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("asin(U+4\x3F?)") + CATCH_START_SECTION("asin(U+4\x3F?)") { std::stringstream ss; ss << "div { width: asin(U+4\x3F?); }"; @@ -6060,12 +6125,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: asin() expects a number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: asin() expects a number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("atan(U+1-2)") + CATCH_START_SECTION("atan(U+1-2)") { std::stringstream ss; ss << "div { width: atan(U+1-2); }"; @@ -6086,12 +6152,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: atan() expects a number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: atan() expects a number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("blue(15)") + CATCH_START_SECTION("blue(15)") { std::stringstream ss; ss << "div { width: blue(15); }"; @@ -6112,12 +6179,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: blue() expects a color as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: blue() expects a color as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("ceil(false)") + CATCH_START_SECTION("ceil(false)") { std::stringstream ss; ss << "div { width: ceil(false); }"; @@ -6138,12 +6206,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: ceil() expects a number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: ceil() expects a number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("cos(white)") + CATCH_START_SECTION("cos(white)") { std::stringstream ss; ss << "div { width: cos(white); }"; @@ -6164,12 +6233,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: cos() expects an angle as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: cos() expects an angle as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("floor(false)") + CATCH_START_SECTION("floor(false)") { std::stringstream ss; ss << "div { width: floor(false); }"; @@ -6190,12 +6260,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: floor() expects a number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: floor() expects a number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("frgb(\"200\")") + CATCH_START_SECTION("frgb(\"200\")") { std::stringstream ss; ss << "div { width: frgb(\"200\"); }"; @@ -6216,12 +6287,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: frgb() expects exactly one color parameter or three numbers (Red, Green, Blue).\n"); + VERIFY_ERRORS("test.css(1): error: frgb() expects exactly one color parameter or three numbers (Red, Green, Blue).\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("frgb(1, 2, 3, 4, 5)") + CATCH_START_SECTION("frgb(1, 2, 3, 4, 5)") { std::stringstream ss; ss << "div { width: frgb(1, 2, 3, 4, 5); }"; @@ -6242,12 +6314,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: frgb() expects between 1 and 3 parameters.\n"); + VERIFY_ERRORS("test.css(1): error: frgb() expects between 1 and 3 parameters.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("frgba(\"200\", 1.0)") + CATCH_START_SECTION("frgba(\"200\", 1.0)") { std::stringstream ss; ss << "div { width: frgba(\"200\", 1.0); }"; @@ -6268,12 +6341,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: frgba() expects exactly one color parameter followed by one number (Color, Alpha), or four numbers (Red, Green, Blue, Alpha).\n"); + VERIFY_ERRORS("test.css(1): error: frgba() expects exactly one color parameter followed by one number (Color, Alpha), or four numbers (Red, Green, Blue, Alpha).\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("function_exists(200)") + CATCH_START_SECTION("function_exists(200)") { std::stringstream ss; ss << "div { width: function_exists(200); }"; @@ -6294,12 +6368,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: function_exists() expects a string or an identifier as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: function_exists() expects a string or an identifier as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("global_variable_exists(200)") + CATCH_START_SECTION("global_variable_exists(200)") { std::stringstream ss; ss << "div { width: global_variable_exists(200); }"; @@ -6320,12 +6395,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: global_variable_exists() expects a string or an identifier as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: global_variable_exists() expects a string or an identifier as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("green(1 = 5)") + CATCH_START_SECTION("green(1 = 5)") { std::stringstream ss; ss << "div { width: green(1 = 5); }"; @@ -6346,12 +6422,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: green() expects a color as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: green() expects a color as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("hsl(5, '3', 2)") + CATCH_START_SECTION("hsl(5, '3', 2)") { std::stringstream ss; ss << "div { width: hsl(5, '3', 2); }"; @@ -6372,12 +6449,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: hsl() expects exactly three numbers: Hue (angle), Saturation (%), and Lightness (%).\n"); + VERIFY_ERRORS("test.css(1): error: hsl() expects exactly three numbers: Hue (angle), Saturation (%), and Lightness (%).\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("hsl(3deg, 3%)") // 3rd % is missing + CATCH_START_SECTION("hsl(3deg, 3%)") // 3rd % is missing { std::stringstream ss; ss << "div { width: hsl(U+3?\?); }"; @@ -6398,12 +6476,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: hsl() expects exactly 3 parameters.\n"); + VERIFY_ERRORS("test.css(1): error: hsl() expects exactly 3 parameters.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("hsla(5, '3', 2, 0.4)") + CATCH_START_SECTION("hsla(5, '3', 2, 0.4)") { std::stringstream ss; ss << "div { width: hsla(5, '3', 2, 0.4); }"; @@ -6424,12 +6503,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: hsla() expects exactly four numbers: Hue (angle), Saturation (%), Lightness (%), and Alpha (0.0 to 1.0).\n"); + VERIFY_ERRORS("test.css(1): error: hsla() expects exactly four numbers: Hue (angle), Saturation (%), Lightness (%), and Alpha (0.0 to 1.0).\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("hue('string')") + CATCH_START_SECTION("hue('string')") { std::stringstream ss; ss << "div { width: hue('string'); }"; @@ -6450,12 +6530,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: hue() expects a color as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: hue() expects a color as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("identifier(U+333)") + CATCH_START_SECTION("identifier(U+333)") { std::stringstream ss; ss << "div { width: identifier(U+333); }"; @@ -6476,12 +6557,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: identifier() expects one value as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: identifier() expects one value as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("if(true false)") + CATCH_START_SECTION("if(true false)") { std::stringstream ss; ss << "div { width: if(true false, result if true, result if false); }"; @@ -6502,12 +6584,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: if() expects a boolean as its first argument.\n"); + VERIFY_ERRORS("test.css(1): error: if() expects a boolean as its first argument.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("lightness(3px solid #439812)") + CATCH_START_SECTION("lightness(3px solid #439812)") { std::stringstream ss; ss << "div { width: lightness(3px solid #439812); }"; @@ -6528,12 +6611,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: lightness() expects a color as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: lightness() expects a color as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("log(5.3px)") + CATCH_START_SECTION("log(5.3px)") { std::stringstream ss; ss << "div { width: log(5.3px); }"; @@ -6554,12 +6638,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: log() expects a unit less number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: log() expects a unit less number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("log(0.0)") + CATCH_START_SECTION("log(0.0)") { std::stringstream ss; ss << "div { width: log(0.0); }"; @@ -6580,12 +6665,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: log() expects a positive number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: log() expects a positive number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("log(-7)") + CATCH_START_SECTION("log(-7)") { std::stringstream ss; ss << "div { width: log(-7); }"; @@ -6606,12 +6692,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: log() expects a positive number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: log() expects a positive number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("log(\"not accepted\")") + CATCH_START_SECTION("log(\"not accepted\")") { std::stringstream ss; ss << "div { width: log(\"not accepted\"); }"; @@ -6632,12 +6719,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: log() expects a number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: log() expects a number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("max(3px, 5em)") + CATCH_START_SECTION("max(3px, 5em)") { std::stringstream ss; ss << "div { width: max(3px, 5em); }"; @@ -6658,12 +6746,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: max() expects all numbers to have the same dimension.\n"); + VERIFY_ERRORS("test.css(1): error: max() expects all numbers to have the same dimension.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("max(3px 5px, 1px 3px)") + CATCH_START_SECTION("max(3px 5px, 1px 3px)") { std::stringstream ss; ss << "div { width: max(3px, 5em); }"; @@ -6684,12 +6773,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: max() expects all numbers to have the same dimension.\n"); + VERIFY_ERRORS("test.css(1): error: max() expects all numbers to have the same dimension.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("max('strings', 'are', 'illegal', 'here')") + CATCH_START_SECTION("max('strings', 'are', 'illegal', 'here')") { std::stringstream ss; ss << "div { width: max('strings', 'are', 'illegal', 'here'); }"; @@ -6710,17 +6800,18 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: max() expects any number of numbers.\n" "test.css(1): error: max() expects any number of numbers.\n" "test.css(1): error: max() expects any number of numbers.\n" "test.css(1): error: max() expects any number of numbers.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("min(3px, 5em)") + CATCH_START_SECTION("min(3px, 5em)") { std::stringstream ss; ss << "div { width: min(3px, 5em); }"; @@ -6741,12 +6832,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: min() expects all numbers to have the same dimension.\n"); + VERIFY_ERRORS("test.css(1): error: min() expects all numbers to have the same dimension.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("min(3px 5px, 1px 3px)") + CATCH_START_SECTION("min(3px 5px, 1px 3px)") { std::stringstream ss; ss << "div { width: min(3px, 5em); }"; @@ -6767,12 +6859,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: min() expects all numbers to have the same dimension.\n"); + VERIFY_ERRORS("test.css(1): error: min() expects all numbers to have the same dimension.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("min('strings', 'are', 'illegal', 'here')") + CATCH_START_SECTION("min('strings', 'are', 'illegal', 'here')") { std::stringstream ss; ss << "div { width: min('strings', 'are', 'illegal', 'here'); }"; @@ -6793,17 +6886,18 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: min() expects any number of numbers.\n" "test.css(1): error: min() expects any number of numbers.\n" "test.css(1): error: min() expects any number of numbers.\n" "test.css(1): error: min() expects any number of numbers.\n" ); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("not(U+78-7F)") + CATCH_START_SECTION("not(U+78-7F)") { std::stringstream ss; ss << "div { width: not(U+78-7F); }"; @@ -6824,12 +6918,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: a boolean expression was expected.\n"); + VERIFY_ERRORS("test.css(1): error: a boolean expression was expected.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("not(true false)") + CATCH_START_SECTION("not(true false)") { std::stringstream ss; ss << "div { width: not(true false); }"; @@ -6850,12 +6945,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: not() expects a boolean as its first argument.\n"); + VERIFY_ERRORS("test.css(1): error: not() expects a boolean as its first argument.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("percentage(U+333)") + CATCH_START_SECTION("percentage(U+333)") { std::stringstream ss; ss << "div { width: percentage(U+333); }"; @@ -6876,12 +6972,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: percentage() expects one value as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: percentage() expects one value as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("percentage(\"not a number\")") + CATCH_START_SECTION("percentage(\"not a number\")") { std::stringstream ss; ss << "div { width: percentage(\"not a number\"); }"; @@ -6902,12 +6999,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: percentage() expects a string parameter to represent a valid integer, decimal number, or percent value.\n"); + VERIFY_ERRORS("test.css(1): error: percentage() expects a string parameter to represent a valid integer, decimal number, or percent value.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("red(15)") + CATCH_START_SECTION("red(15)") { std::stringstream ss; ss << "div { width: red(15); }"; @@ -6928,12 +7026,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: red() expects a color as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: red() expects a color as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("rgb(\"200\")") + CATCH_START_SECTION("rgb(\"200\")") { std::stringstream ss; ss << "div { width: rgb(\"200\"); }"; @@ -6954,12 +7053,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: rgb() expects exactly one color parameter (Color) or three numbers (Red, Green, Blue).\n"); + VERIFY_ERRORS("test.css(1): error: rgb() expects exactly one color parameter (Color) or three numbers (Red, Green, Blue).\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("rgb(red green blue)") + CATCH_START_SECTION("rgb(red green blue)") { std::stringstream ss; ss << "div { width: rgb(red green blue); }"; @@ -6980,12 +7080,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: rgb() expects exactly one color parameter (Color) or three numbers (Red, Green, Blue).\n"); + VERIFY_ERRORS("test.css(1): error: rgb() expects exactly one color parameter (Color) or three numbers (Red, Green, Blue).\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("rgba(\"200\", 1.0)") + CATCH_START_SECTION("rgba(\"200\", 1.0)") { std::stringstream ss; ss << "div { width: rgba(\"200\", 1.0); }"; @@ -7006,12 +7107,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: rgba() expects exactly one color parameter followed by alpha (Color, Alpha) or four numbers (Red, Green, Blue, Alpha).\n"); + VERIFY_ERRORS("test.css(1): error: rgba() expects exactly one color parameter followed by alpha (Color, Alpha) or four numbers (Red, Green, Blue, Alpha).\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("round(false)") + CATCH_START_SECTION("round(false)") { std::stringstream ss; ss << "div { width: round(false); }"; @@ -7032,12 +7134,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: round() expects a number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: round() expects a number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("saturation(U+3?\?)") + CATCH_START_SECTION("saturation(U+3?\?)") { std::stringstream ss; ss << "div { width: saturation(U+3?\?); }"; @@ -7058,12 +7161,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: saturation() expects a color as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: saturation() expects a color as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("sign('number')") + CATCH_START_SECTION("sign('number')") { std::stringstream ss; ss << "div { width: sign('number'); }"; @@ -7084,12 +7188,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: sign() expects a number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: sign() expects a number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("sin('number')") + CATCH_START_SECTION("sin('number')") { std::stringstream ss; ss << "div { width: sin('number'); }"; @@ -7110,12 +7215,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: sin() expects an angle as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: sin() expects an angle as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("sqrt(-4.0)") + CATCH_START_SECTION("sqrt(-4.0)") { std::stringstream ss; ss << "div { width: sqrt(-4.0); }"; @@ -7136,12 +7242,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: sqrt() expects zero or a positive number.\n"); + VERIFY_ERRORS("test.css(1): error: sqrt() expects zero or a positive number.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("sqrt(4.0px)") + CATCH_START_SECTION("sqrt(4.0px)") { std::stringstream ss; ss << "div { width: sqrt(4.0px); }"; @@ -7162,12 +7269,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: sqrt() expects dimensions to be squarely defined (i.e. 'px * px').\n"); + VERIFY_ERRORS("test.css(1): error: sqrt() expects dimensions to be squarely defined (i.e. 'px * px').\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("sqrt(4.0px*px/em*cm)") + CATCH_START_SECTION("sqrt(4.0px*px/em*cm)") { std::stringstream ss; ss << "div { width: sqrt(4.0px\\*px\\/em\\*cm); }"; @@ -7188,12 +7296,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: sqrt() expects dimensions to be squarely defined (i.e. 'px * px').\n"); + VERIFY_ERRORS("test.css(1): error: sqrt() expects dimensions to be squarely defined (i.e. 'px * px').\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("sqrt(4.0px*cm/em*em)") + CATCH_START_SECTION("sqrt(4.0px*cm/em*em)") { std::stringstream ss; ss << "div { width: sqrt(4.0px\\*cm\\/em\\*em); }"; @@ -7214,12 +7323,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: sqrt() expects dimensions to be squarely defined (i.e. 'px * px').\n"); + VERIFY_ERRORS("test.css(1): error: sqrt() expects dimensions to be squarely defined (i.e. 'px * px').\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("sqrt(35%)") + CATCH_START_SECTION("sqrt(35%)") { std::stringstream ss; ss << "div { width: sqrt(35%); }"; @@ -7240,12 +7350,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: sqrt() expects a number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: sqrt() expects a number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("sqrt('number')") + CATCH_START_SECTION("sqrt('number')") { std::stringstream ss; ss << "div { width: sqrt('number'); }"; @@ -7266,12 +7377,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: sqrt() expects a number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: sqrt() expects a number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("sqrt(12px dashed chocolate)") + CATCH_START_SECTION("sqrt(12px dashed chocolate)") { std::stringstream ss; ss << "div { width: sqrt(12px dashed chocolate); }"; @@ -7292,12 +7404,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: sqrt() expects a number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: sqrt() expects a number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("string(U+110-11f)") + CATCH_START_SECTION("string(U+110-11f)") { std::stringstream ss; ss << "div { width: string(U+110-11f); }"; @@ -7318,12 +7431,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: string() expects one value as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: string() expects one value as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("str_length(110)") + CATCH_START_SECTION("str_length(110)") { std::stringstream ss; ss << "div { width: str_length(110); }"; @@ -7344,12 +7458,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: str_length() expects one string as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: str_length() expects one string as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("str_length(10px solid blue)") + CATCH_START_SECTION("str_length(10px solid blue)") { std::stringstream ss; ss << "div { width: str_length(10px solid blue); }"; @@ -7370,12 +7485,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: str_length() expects one string as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: str_length() expects one string as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("tan(true)") + CATCH_START_SECTION("tan(true)") { std::stringstream ss; ss << "div { width: tan(true); }"; @@ -7396,12 +7512,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: tan() expects an angle as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: tan() expects an angle as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("tan(30px)") + CATCH_START_SECTION("tan(30px)") { std::stringstream ss; ss << "div { width: tan(30px); }"; @@ -7422,12 +7539,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: trigonometry functions expect an angle (deg, grad, rad, turn) as a parameter.\n"); + VERIFY_ERRORS("test.css(1): error: trigonometry functions expect an angle (deg, grad, rad, turn) as a parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("type_of(30pear 3carrot 15apple)") + CATCH_START_SECTION("type_of(30pear 3carrot 15apple)") { std::stringstream ss; ss << "div { width: type_of(30pear 3carrot 15apple); }"; @@ -7448,12 +7566,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: type_of() expects one value as a parameter.\n"); + VERIFY_ERRORS("test.css(1): error: type_of() expects one value as a parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("unique_id() with an integer") + CATCH_START_SECTION("unique_id() with an integer") { std::stringstream ss; ss << "a { z-index: unique_id(33); }\n"; @@ -7476,12 +7595,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unique_id() expects a string or an identifier as its optional parameter.\n"); + VERIFY_ERRORS("test.css(1): error: unique_id() expects a string or an identifier as its optional parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("unique_id() with a unicode range") + CATCH_START_SECTION("unique_id() with a unicode range") { std::stringstream ss; ss << "a { z-index: unique_id(U+33-44); }\n"; @@ -7504,12 +7624,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unique_id() expects a string or an identifier as its optional parameter.\n"); + VERIFY_ERRORS("test.css(1): error: unique_id() expects a string or an identifier as its optional parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("unit('string')") + CATCH_START_SECTION("unit('string')") { std::stringstream ss; ss << "div { width: unit('string'); }"; @@ -7530,12 +7651,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unit() expects a number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: unit() expects a number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("unit(5px dashed tan)") + CATCH_START_SECTION("unit(5px dashed tan)") { std::stringstream ss; ss << "div { width: unit(5px dashed tan); }"; @@ -7556,12 +7678,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: unit() expects a number as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: unit() expects a number as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("variable_exists(200)") + CATCH_START_SECTION("variable_exists(200)") { std::stringstream ss; ss << "div { width: variable_exists(200); }"; @@ -7582,12 +7705,13 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: variable_exists() expects a string or an identifier as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: variable_exists() expects a string or an identifier as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() - SECTION("variable_exists(3px solid white)") + CATCH_START_SECTION("variable_exists(3px solid white)") { std::stringstream ss; ss << "div { width: variable_exists(3px solid white); }"; @@ -7608,20 +7732,14 @@ TEST_CASE("Expression calling functions with invalid parameters", "[expression] //std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; - REQUIRE_ERRORS("test.css(1): error: variable_exists() expects a string or an identifier as parameter.\n"); + VERIFY_ERRORS("test.css(1): error: variable_exists() expects a string or an identifier as parameter.\n"); - REQUIRE(c.get_root() == n); + CATCH_REQUIRE(c.get_root() == n); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_lexer.cpp b/tests/catch_lexer.cpp index e938f7b..5450d34 100644 --- a/tests/catch_lexer.cpp +++ b/tests/catch_lexer.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the lexer.cpp file. @@ -26,16 +28,36 @@ * UTF-8 as input. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// csspp lib +// +#include +#include +#include + + +// C++ lib +// +#include +#include +#include + -#include "csspp/exceptions.h" -#include "csspp/lexer.h" -#include "csspp/unicode_range.h" +// C lib +// +#include +#include + + +// last include +// +#include -#include -#include -#include namespace { @@ -45,7 +67,7 @@ namespace -TEST_CASE("UTF-8 conversions", "[lexer] [unicode]") +CATCH_TEST_CASE("UTF-8 conversions", "[lexer] [unicode]") { std::stringstream ss; csspp::position pos("test.css"); @@ -63,7 +85,7 @@ TEST_CASE("UTF-8 conversions", "[lexer] [unicode]") std::string const str(l.wctomb(i)); csspp::wide_char_t const wc(l.mbtowc(str.c_str())); - REQUIRE(wc == i); + CATCH_REQUIRE(wc == i); } // make sure the test for the buffer size works as expected @@ -71,7 +93,7 @@ TEST_CASE("UTF-8 conversions", "[lexer] [unicode]") { char buf[6]; csspp::wide_char_t const wc(rand() % 0x1FFFFF); - REQUIRE_THROWS_AS(l.wctomb(wc, buf, i), csspp::csspp_exception_overflow &); + CATCH_REQUIRE_THROWS_AS(l.wctomb(wc, buf, i), csspp::csspp_exception_overflow); } // make sure surrogates are not allowed @@ -80,8 +102,8 @@ TEST_CASE("UTF-8 conversions", "[lexer] [unicode]") char buf[6]; buf[0] = '?'; l.wctomb(i, buf, sizeof(buf) / sizeof(buf[0])); - REQUIRE(buf[0] == '\0'); // make sure we get an empty string on errors - REQUIRE_ERRORS("test.css(1): error: surrogate characters cannot be encoded in UTF-8.\n"); + CATCH_REQUIRE(buf[0] == '\0'); // make sure we get an empty string on errors + VERIFY_ERRORS("test.css(1): error: surrogate characters cannot be encoded in UTF-8.\n"); } // page 0 -- error is slightly different @@ -90,14 +112,14 @@ TEST_CASE("UTF-8 conversions", "[lexer] [unicode]") // test FFFE buf[0] = '?'; l.wctomb(0xFFFE, buf, sizeof(buf) / sizeof(buf[0])); - REQUIRE(buf[0] == '\0'); // make sure we get an empty string on errors - REQUIRE_ERRORS("test.css(1): error: characters 0xFFFE and 0xFFFF are not valid.\n"); + CATCH_REQUIRE(buf[0] == '\0'); // make sure we get an empty string on errors + VERIFY_ERRORS("test.css(1): error: characters 0xFFFE and 0xFFFF are not valid.\n"); // test FFFF buf[0] = '?'; l.wctomb(0xFFFF, buf, sizeof(buf) / sizeof(buf[0])); - REQUIRE(buf[0] == '\0'); // make sure we get an empty string on errors - REQUIRE_ERRORS("test.css(1): error: characters 0xFFFE and 0xFFFF are not valid.\n"); + CATCH_REQUIRE(buf[0] == '\0'); // make sure we get an empty string on errors + VERIFY_ERRORS("test.css(1): error: characters 0xFFFE and 0xFFFF are not valid.\n"); } // page 1 to 16 @@ -108,15 +130,15 @@ TEST_CASE("UTF-8 conversions", "[lexer] [unicode]") csspp::wide_char_t wc((page << 16) | 0xFFFE); buf[0] = '?'; l.wctomb(wc, buf, sizeof(buf) / sizeof(buf[0])); - REQUIRE(buf[0] == '\0'); // make sure we get an empty string on errors - REQUIRE_ERRORS("test.css(1): error: any characters that end with 0xFFFE or 0xFFFF are not valid.\n"); + CATCH_REQUIRE(buf[0] == '\0'); // make sure we get an empty string on errors + VERIFY_ERRORS("test.css(1): error: any characters that end with 0xFFFE or 0xFFFF are not valid.\n"); // test FFFF wc = (page << 16) | 0xFFFF; buf[0] = '?'; l.wctomb(wc, buf, sizeof(buf) / sizeof(buf[0])); - REQUIRE(buf[0] == '\0'); // make sure we get an empty string on errors - REQUIRE_ERRORS("test.css(1): error: any characters that end with 0xFFFE or 0xFFFF are not valid.\n"); + CATCH_REQUIRE(buf[0] == '\0'); // make sure we get an empty string on errors + VERIFY_ERRORS("test.css(1): error: any characters that end with 0xFFFE or 0xFFFF are not valid.\n"); } // test 1,000 characters with a number that's too large @@ -132,8 +154,8 @@ TEST_CASE("UTF-8 conversions", "[lexer] [unicode]") char buf[6]; buf[0] = '?'; l.wctomb(wc, buf, sizeof(buf) / sizeof(buf[0])); - REQUIRE(buf[0] == '\0'); // make sure we get an empty string on errors - REQUIRE_ERRORS("test.css(1): error: character too large, it cannot be encoded in UTF-8.\n"); + CATCH_REQUIRE(buf[0] == '\0'); // make sure we get an empty string on errors + VERIFY_ERRORS("test.css(1): error: character too large, it cannot be encoded in UTF-8.\n"); } // check that bytes 0xF8 and over generate an error @@ -146,10 +168,10 @@ TEST_CASE("UTF-8 conversions", "[lexer] [unicode]") buf[3] = static_cast(0x80); buf[4] = static_cast(0x80); buf[5] = 0; - REQUIRE(l.mbtowc(buf) == 0xFFFD); + CATCH_REQUIRE(l.mbtowc(buf) == 0xFFFD); std::stringstream errmsg; errmsg << "test.css(1): error: byte U+" << std::hex << i << " not valid in a UTF-8 stream.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); } // continuation bytes at the start @@ -162,10 +184,10 @@ TEST_CASE("UTF-8 conversions", "[lexer] [unicode]") buf[3] = static_cast(0x80); buf[4] = static_cast(0x80); buf[5] = 0; - REQUIRE(l.mbtowc(buf) == 0xFFFD); + CATCH_REQUIRE(l.mbtowc(buf) == 0xFFFD); std::stringstream errmsg; errmsg << "test.css(1): error: byte U+" << std::hex << i << " not valid to introduce a UTF-8 encoded character.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); } // not enough bytes ('\0' too soon) @@ -174,10 +196,10 @@ TEST_CASE("UTF-8 conversions", "[lexer] [unicode]") char buf[6]; buf[0] = i; buf[1] = 0; - REQUIRE(l.mbtowc(buf) == 0xFFFD); + CATCH_REQUIRE(l.mbtowc(buf) == 0xFFFD); std::stringstream errmsg; errmsg << "test.css(1): error: sequence of bytes too short to represent a valid UTF-8 encoded character.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); } // too many bytes ('\0' missing), and @@ -195,10 +217,10 @@ TEST_CASE("UTF-8 conversions", "[lexer] [unicode]") // the sequence is one too many bytes { std::string const too_long(str + static_cast(rand() % 64 + 0x80)); // add one byte - REQUIRE(l.mbtowc(too_long.c_str()) == 0xFFFD); + CATCH_REQUIRE(l.mbtowc(too_long.c_str()) == 0xFFFD); std::stringstream errmsg; errmsg << "test.css(1): error: sequence of bytes too long, it cannot represent a valid UTF-8 encoded character.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); } // one of the bytes in the sequence is not between 0x80 and 0xBF @@ -218,18 +240,18 @@ TEST_CASE("UTF-8 conversions", "[lexer] [unicode]") c += 64; } wrong_sequence[p + 1] = static_cast(c); - REQUIRE(l.mbtowc(wrong_sequence.c_str()) == 0xFFFD); + CATCH_REQUIRE(l.mbtowc(wrong_sequence.c_str()) == 0xFFFD); std::stringstream errmsg; errmsg << "test.css(1): error: invalid sequence of bytes, it cannot represent a valid UTF-8 encoded character.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); } } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid characters", "[lexer] [invalid]") +CATCH_TEST_CASE("Invalid characters", "[lexer] [invalid]") { // 0xFFFD { @@ -239,13 +261,13 @@ TEST_CASE("Invalid characters", "[lexer] [invalid]") ss << l.wctomb(0xFFFD); // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS("test.css(1): error: invalid input character: U+fffd.\n"); + VERIFY_ERRORS("test.css(1): error: invalid input character: U+fffd.\n"); } // '\0' @@ -256,13 +278,13 @@ TEST_CASE("Invalid characters", "[lexer] [invalid]") csspp::lexer l(ss, pos); // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS("test.css(1): error: invalid input character: U+fffd.\n"); + VERIFY_ERRORS("test.css(1): error: invalid input character: U+fffd.\n"); } // '^', '<', etc. @@ -321,15 +343,15 @@ TEST_CASE("Invalid characters", "[lexer] [invalid]") csspp::lexer l(ss, pos); // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error std::stringstream errmsg; errmsg << "test.css(1): error: invalid input character: U+" << std::hex << static_cast(i) << "." << std::endl; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); } } @@ -349,12 +371,12 @@ TEST_CASE("Invalid characters", "[lexer] [invalid]") csspp::lexer l(ss, pos); // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected errors - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: too many follow bytes, it cannot represent a valid UTF-8 character.\n" "test.css(1): error: invalid input character: U+fffd.\n" ); @@ -378,22 +400,22 @@ TEST_CASE("Invalid characters", "[lexer] [invalid]") csspp::lexer l(ss, pos); // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); // comment { csspp::node::pointer_t comment(l.next_token()); - REQUIRE(comment->is(csspp::node_type_t::COMMENT)); - REQUIRE(comment->get_string() == "plus a comment to @preserve"); - REQUIRE(comment->get_integer() == 0); // C++ comment + CATCH_REQUIRE(comment->is(csspp::node_type_t::COMMENT)); + CATCH_REQUIRE(comment->get_string() == "plus a comment to @preserve"); + CATCH_REQUIRE(comment->get_integer() == 0); // C++ comment csspp::position const & npos(comment->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); // make sure we got the expected errors - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: too many follow bytes, it cannot represent a valid UTF-8 character.\n" "test.css(1): error: invalid input character: U+fffd.\n" "test.css(1): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n" @@ -403,28 +425,28 @@ TEST_CASE("Invalid characters", "[lexer] [invalid]") // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // string { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::STRING)); - REQUIRE(string->get_string() == " and a string "); + CATCH_REQUIRE(string->is(csspp::node_type_t::STRING)); + CATCH_REQUIRE(string->get_string() == " and a string "); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // invalid UTF-8 sequence (i.e. incorrect introducer) @@ -446,16 +468,16 @@ TEST_CASE("Invalid characters", "[lexer] [invalid]") csspp::lexer l(ss, pos); // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected errors std::stringstream errmsg; errmsg << "test.css(1): error: unexpected byte in input buffer: U+" << std::hex << (i == 0xC0 ? 0xFF : i) << ".\ntest.css(1): error: invalid input character: U+fffd.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); } // ends with comment and string @@ -476,46 +498,46 @@ TEST_CASE("Invalid characters", "[lexer] [invalid]") csspp::lexer l(ss, pos); // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); // comment { csspp::node::pointer_t comment(l.next_token()); - REQUIRE(comment->is(csspp::node_type_t::COMMENT)); - REQUIRE(comment->get_string() == "plus one comment to @preserve"); - REQUIRE(comment->get_integer() == 0); // C++ comment + CATCH_REQUIRE(comment->is(csspp::node_type_t::COMMENT)); + CATCH_REQUIRE(comment->get_string() == "plus one comment to @preserve"); + CATCH_REQUIRE(comment->get_integer() == 0); // C++ comment csspp::position const & npos(comment->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // string { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::STRING)); - REQUIRE(string->get_string() == " and that string "); + CATCH_REQUIRE(string->is(csspp::node_type_t::STRING)); + CATCH_REQUIRE(string->get_string() == " and that string "); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected errors std::stringstream errmsg; @@ -523,15 +545,15 @@ TEST_CASE("Invalid characters", "[lexer] [invalid]") << std::hex << (i == 0xC0 ? 0xFF : i) << ".\ntest.css(1): error: invalid input character: U+fffd.\n" << "test.css(1): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"; - REQUIRE_ERRORS(errmsg.str()); + VERIFY_ERRORS(errmsg.str()); } } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") +CATCH_TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") { // ' ' -> WHITESPACE { @@ -547,13 +569,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << whitespaces[i]; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::WHITESPACE)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // try 1,000 combo of 3 to 12 whitespaces @@ -570,13 +592,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") } // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::WHITESPACE)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } } @@ -588,13 +610,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "="; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::EQUAL)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EQUAL)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '==' -> EQUAL + warning @@ -605,14 +627,14 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "=="; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::EQUAL)); - REQUIRE_ERRORS("test.css(1): warning: we accepted '==' instead of '=' in an expression, you probably want to change the operator to just '=', though.\n"); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EQUAL)); + VERIFY_ERRORS("test.css(1): warning: we accepted '==' instead of '=' in an expression, you probably want to change the operator to just '=', though.\n"); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // ',' -> COMMA @@ -623,13 +645,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << ","; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::COMMA)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::COMMA)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // ':' -> COLON @@ -640,13 +662,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << ":"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::COLON)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::COLON)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // ';' -> SEMICOLON @@ -657,13 +679,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << ";"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::SEMICOLON)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::SEMICOLON)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '.' -> PERIOD @@ -674,13 +696,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "."; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::PERIOD)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::PERIOD)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '$' -> DOLLAR @@ -691,13 +713,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "$"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::DOLLAR)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::DOLLAR)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '?' -> CONDITIONAL @@ -708,13 +730,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "?"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::CONDITIONAL)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::CONDITIONAL)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '%' -> MODULO @@ -725,13 +747,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "%"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::MODULO)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::MODULO)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '/' -> DIVIDE @@ -742,13 +764,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "/"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::DIVIDE)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::DIVIDE)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '*' -> MULTIPLY @@ -759,13 +781,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "*"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::MULTIPLY)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::MULTIPLY)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '**' -> POWER @@ -776,13 +798,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << '*' << '*'; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::POWER)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::POWER)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '&' -> REFERENCE @@ -793,13 +815,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "&"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::REFERENCE)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::REFERENCE)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '&&' -> AND @@ -810,13 +832,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << '&' << '&'; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::AND)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::AND)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '~' -> PRECEDED @@ -827,13 +849,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "~"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::PRECEDED)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::PRECEDED)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '+' -> ADD @@ -844,13 +866,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "+"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::ADD)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::ADD)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '-' -> SUBTRACT @@ -861,13 +883,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "-"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::SUBTRACT)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::SUBTRACT)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '|' -> SCOPE @@ -878,13 +900,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "|"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::SCOPE)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::SCOPE)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '>' -> GREATER_THAN @@ -895,13 +917,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << ">"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::GREATER_THAN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::GREATER_THAN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '>=' -> GREATER_EQUAL @@ -912,13 +934,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << ">="; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::GREATER_EQUAL)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::GREATER_EQUAL)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // "<" @@ -929,13 +951,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") csspp::lexer l(ss, pos); // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::LESS_THAN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::LESS_THAN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // "<=" @@ -946,13 +968,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") csspp::lexer l(ss, pos); // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::LESS_EQUAL)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::LESS_EQUAL)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // "is(csspp::node_type_t::LESS_THAN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EXCLAMATION)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::LESS_THAN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EXCLAMATION)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // "is(csspp::node_type_t::LESS_THAN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EXCLAMATION)); - REQUIRE(l.next_token()->is(csspp::node_type_t::SUBTRACT)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::LESS_THAN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EXCLAMATION)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::SUBTRACT)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // "!" @@ -1003,14 +1025,14 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") csspp::lexer l(ss, pos); // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); // The '!' is returned as EXCLAMATION - REQUIRE(l.next_token()->is(csspp::node_type_t::EXCLAMATION)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EXCLAMATION)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // "!=" @@ -1021,14 +1043,14 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") csspp::lexer l(ss, pos); // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); // The '!=' is returned as NOT_EQUAL - REQUIRE(l.next_token()->is(csspp::node_type_t::NOT_EQUAL)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::NOT_EQUAL)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '(' -> OPEN_PARENTHESIS @@ -1039,13 +1061,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "("; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::OPEN_PARENTHESIS)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::OPEN_PARENTHESIS)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // ')' -> OPEN_PARENTHESIS @@ -1056,13 +1078,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << ")"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::CLOSE_PARENTHESIS)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::CLOSE_PARENTHESIS)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '{' -> OPEN_CURLYBRACKET @@ -1073,13 +1095,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "{"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::OPEN_CURLYBRACKET)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::OPEN_CURLYBRACKET)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '}' -> OPEN_CURLYBRACKET @@ -1090,13 +1112,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "}"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::CLOSE_CURLYBRACKET)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::CLOSE_CURLYBRACKET)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '[' -> OPEN_SQUAREBRACKET @@ -1107,13 +1129,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "["; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::OPEN_SQUAREBRACKET)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::OPEN_SQUAREBRACKET)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // ']' -> OPEN_SQUAREBRACKET @@ -1124,13 +1146,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "]"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::CLOSE_SQUAREBRACKET)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::CLOSE_SQUAREBRACKET)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::CDC)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::CDC)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '^=' -> PREFIX_MATCH @@ -1175,13 +1197,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "^="; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::PREFIX_MATCH)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::PREFIX_MATCH)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '|=' -> DASH_MATCH @@ -1192,13 +1214,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "|="; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::DASH_MATCH)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::DASH_MATCH)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '$=' -> SUFFIX_MATCH @@ -1209,13 +1231,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "$="; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::SUFFIX_MATCH)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::SUFFIX_MATCH)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '~=' -> INCLUDE_MATCH @@ -1226,13 +1248,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "~="; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::INCLUDE_MATCH)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::INCLUDE_MATCH)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '*=' -> SUBSTRING_MATCH @@ -1243,13 +1265,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "*="; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::SUBSTRING_MATCH)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::SUBSTRING_MATCH)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // ':=' -> ASSIGNMENT @@ -1260,13 +1282,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << ":="; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::ASSIGNMENT)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::ASSIGNMENT)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // '||' -> COLUMN @@ -1277,13 +1299,13 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "||"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); - REQUIRE(l.next_token()->is(csspp::node_type_t::COLUMN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::COLUMN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // A "special" sequence div+.alpha @@ -1294,24 +1316,24 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "div+.alpha"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::node::pointer_t div(l.next_token()); - REQUIRE(div->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(div->get_string() == "div"); + CATCH_REQUIRE(div->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(div->get_string() == "div"); - REQUIRE(l.next_token()->is(csspp::node_type_t::ADD)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::ADD)); - REQUIRE(l.next_token()->is(csspp::node_type_t::PERIOD)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::PERIOD)); csspp::node::pointer_t alpha(l.next_token()); - REQUIRE(alpha->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(alpha->get_string() == "alpha"); + CATCH_REQUIRE(alpha->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(alpha->get_string() == "alpha"); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // A "special" sequence div -.alpha @@ -1322,33 +1344,33 @@ TEST_CASE("Simple tokens", "[lexer] [basics] [delimiters]") ss << "div -.alpha"; // so far, no error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); csspp::node::pointer_t div(l.next_token()); - REQUIRE(div->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(div->get_string() == "div"); + CATCH_REQUIRE(div->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(div->get_string() == "div"); - REQUIRE(l.next_token()->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::WHITESPACE)); - REQUIRE(l.next_token()->is(csspp::node_type_t::SUBTRACT)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::SUBTRACT)); - REQUIRE(l.next_token()->is(csspp::node_type_t::PERIOD)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::PERIOD)); csspp::node::pointer_t alpha(l.next_token()); - REQUIRE(alpha->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(alpha->get_string() == "alpha"); + CATCH_REQUIRE(alpha->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(alpha->get_string() == "alpha"); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // make sure we got the expected error - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Newline", "[lexer] [newline] [characters]") +CATCH_TEST_CASE("Newline", "[lexer] [newline] [characters]") { // we have a special case with '\r' followed by a character // other than '\n' @@ -1420,135 +1442,135 @@ TEST_CASE("Newline", "[lexer] [newline] [characters]") { // check the whitespace csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // make sure the next character is viewed as an identifier // just as expected { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == out.str()); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == out.str()); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // character on the second line (\n char) { // check the whitespace csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 3); - REQUIRE(npos.get_total_line() == 3); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 3); + CATCH_REQUIRE(npos.get_total_line() == 3); } // make sure the next character is viewed as an identifier // just as expected { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == out.str()); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == out.str()); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 3); - REQUIRE(npos.get_total_line() == 3); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 3); + CATCH_REQUIRE(npos.get_total_line() == 3); } // character on the second line (\f char) { // check the whitespace csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 2); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 3); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 2); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 3); } // make sure the next character is viewed as an identifier // just as expected { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == out.str()); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == out.str()); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 2); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 3); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 2); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 3); } // character on the second line (\r\n char) { // check the whitespace csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 2); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 4); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 2); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 4); } // make sure the next character is viewed as an identifier // just as expected { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == out.str()); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == out.str()); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 2); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 4); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 2); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 4); } // character on the second line (\n\r char) { // check the whitespace csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 2); - REQUIRE(npos.get_line() == 3); - REQUIRE(npos.get_total_line() == 5); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 2); + CATCH_REQUIRE(npos.get_line() == 3); + CATCH_REQUIRE(npos.get_total_line() == 5); } // make sure the next character is viewed as an identifier // just as expected { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == out.str()); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == out.str()); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 2); - REQUIRE(npos.get_line() == 4); - REQUIRE(npos.get_total_line() == 6); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 2); + CATCH_REQUIRE(npos.get_line() == 4); + CATCH_REQUIRE(npos.get_total_line() == 6); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("C-like comments", "[lexer] [comment]") +CATCH_TEST_CASE("C-like comments", "[lexer] [comment]") { // a comment without @preserve gets lost { @@ -1557,9 +1579,9 @@ TEST_CASE("C-like comments", "[lexer] [comment]") csspp::position pos("test.css"); csspp::lexer l(ss, pos); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // one simple comment @@ -1572,19 +1594,19 @@ TEST_CASE("C-like comments", "[lexer] [comment]") // comment { csspp::node::pointer_t comment(l.next_token()); - REQUIRE(comment->is(csspp::node_type_t::COMMENT)); - REQUIRE(comment->get_string() == "test simple comment @preserve"); - REQUIRE(comment->get_integer() == 1); // C-like comment + CATCH_REQUIRE(comment->is(csspp::node_type_t::COMMENT)); + CATCH_REQUIRE(comment->get_string() == "test simple comment @preserve"); + CATCH_REQUIRE(comment->get_integer() == 1); // C-like comment csspp::position const & npos(comment->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // an unterminated simple comment @@ -1597,21 +1619,21 @@ TEST_CASE("C-like comments", "[lexer] [comment]") // comment { csspp::node::pointer_t comment(l.next_token()); - REQUIRE(comment->is(csspp::node_type_t::COMMENT)); - REQUIRE(comment->get_string() == "test simple comment @preserve"); - REQUIRE(comment->get_integer() == 1); // C-like comment + CATCH_REQUIRE(comment->is(csspp::node_type_t::COMMENT)); + CATCH_REQUIRE(comment->get_string() == "test simple comment @preserve"); + CATCH_REQUIRE(comment->get_integer() == 1); // C-like comment csspp::position const & npos(comment->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE_ERRORS("test.css(1): error: unclosed C-like comment at the end of your document.\n"); + VERIFY_ERRORS("test.css(1): error: unclosed C-like comment at the end of your document.\n"); } // a comment on multiple lines @@ -1624,31 +1646,31 @@ TEST_CASE("C-like comments", "[lexer] [comment]") // comment { csspp::node::pointer_t comment(l.next_token()); - REQUIRE(comment->is(csspp::node_type_t::COMMENT)); - REQUIRE(comment->get_string() == "test\na\nmulti-line\ncomment\n\ntoo @preserve"); - REQUIRE(comment->get_integer() == 1); // C-like comment + CATCH_REQUIRE(comment->is(csspp::node_type_t::COMMENT)); + CATCH_REQUIRE(comment->get_string() == "test\na\nmulti-line\ncomment\n\ntoo @preserve"); + CATCH_REQUIRE(comment->get_integer() == 1); // C-like comment csspp::position const & npos(comment->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 2); - REQUIRE(npos.get_line() == 3); - REQUIRE(npos.get_total_line() == 5); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 2); + CATCH_REQUIRE(npos.get_line() == 3); + CATCH_REQUIRE(npos.get_total_line() == 5); } // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // one multi-line comment followed by another simple comment @@ -1661,43 +1683,43 @@ TEST_CASE("C-like comments", "[lexer] [comment]") // 1st comment { csspp::node::pointer_t comment1(l.next_token()); - REQUIRE(comment1->is(csspp::node_type_t::COMMENT)); - REQUIRE(comment1->get_string() == "test\na\nmulti-line\ncomment\n\ntoo @preserve"); - REQUIRE(comment1->get_integer() == 1); // C-like comment + CATCH_REQUIRE(comment1->is(csspp::node_type_t::COMMENT)); + CATCH_REQUIRE(comment1->get_string() == "test\na\nmulti-line\ncomment\n\ntoo @preserve"); + CATCH_REQUIRE(comment1->get_integer() == 1); // C-like comment csspp::position const & npos(comment1->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace in between { csspp::node::pointer_t whitespace(l.next_token()); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 2); - REQUIRE(npos.get_line() == 3); - REQUIRE(npos.get_total_line() == 5); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 2); + CATCH_REQUIRE(npos.get_line() == 3); + CATCH_REQUIRE(npos.get_total_line() == 5); } // 2nd comment { csspp::node::pointer_t comment(l.next_token()); - REQUIRE(comment->is(csspp::node_type_t::COMMENT)); - REQUIRE(comment->get_string() == "with a second comment @preserve"); - REQUIRE(comment->get_integer() == 1); // C-like comment + CATCH_REQUIRE(comment->is(csspp::node_type_t::COMMENT)); + CATCH_REQUIRE(comment->get_string() == "with a second comment @preserve"); + CATCH_REQUIRE(comment->get_integer() == 1); // C-like comment csspp::position const & npos(comment->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 2); - REQUIRE(npos.get_line() == 4); - REQUIRE(npos.get_total_line() == 6); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 2); + CATCH_REQUIRE(npos.get_line() == 4); + CATCH_REQUIRE(npos.get_total_line() == 6); } // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // test with all types of characters that are considered valid by @@ -1775,27 +1797,27 @@ TEST_CASE("C-like comments", "[lexer] [comment]") // comment { csspp::node::pointer_t comment(l.next_token()); - REQUIRE(comment->is(csspp::node_type_t::COMMENT)); - REQUIRE(comment->get_string() == cmt + " @preserve"); - REQUIRE(comment->get_integer() == 1); // C-like comment + CATCH_REQUIRE(comment->is(csspp::node_type_t::COMMENT)); + CATCH_REQUIRE(comment->get_string() == cmt + " @preserve"); + CATCH_REQUIRE(comment->get_integer() == 1); // C-like comment csspp::position const & npos(comment->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("C++ comments", "[lexer] [comment]") +CATCH_TEST_CASE("C++ comments", "[lexer] [comment]") { // a comment without @preserve gets lost { @@ -1807,21 +1829,21 @@ TEST_CASE("C++ comments", "[lexer] [comment]") // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // one simple comment @@ -1834,36 +1856,36 @@ TEST_CASE("C++ comments", "[lexer] [comment]") // comment { csspp::node::pointer_t comment(l.next_token()); - REQUIRE(comment->is(csspp::node_type_t::COMMENT)); - REQUIRE(comment->get_string() == "test simple comment @preserve"); - REQUIRE(comment->get_integer() == 0); // C++ comment + CATCH_REQUIRE(comment->is(csspp::node_type_t::COMMENT)); + CATCH_REQUIRE(comment->get_string() == "test simple comment @preserve"); + CATCH_REQUIRE(comment->get_integer() == 0); // C++ comment csspp::position const & npos(comment->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); + VERIFY_ERRORS("test.css(1): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // a C++ comment on multiple lines is just a comment @@ -1877,36 +1899,36 @@ TEST_CASE("C++ comments", "[lexer] [comment]") // comment { csspp::node::pointer_t comment(l.next_token()); - REQUIRE(comment->is(csspp::node_type_t::COMMENT)); - REQUIRE(comment->get_string() == "test\na\nmulti-line\ncomment\ntoo @preserve"); - REQUIRE(comment->get_integer() == 0); // C++ comment + CATCH_REQUIRE(comment->is(csspp::node_type_t::COMMENT)); + CATCH_REQUIRE(comment->get_string() == "test\na\nmulti-line\ncomment\ntoo @preserve"); + CATCH_REQUIRE(comment->get_integer() == 0); // C++ comment csspp::position const & npos(comment->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); + VERIFY_ERRORS("test.css(1): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 2); - REQUIRE(npos.get_line() == 3); - REQUIRE(npos.get_total_line() == 5); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 2); + CATCH_REQUIRE(npos.get_line() == 3); + CATCH_REQUIRE(npos.get_total_line() == 5); } // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // one multi-line comment followed by another simple comment @@ -1919,51 +1941,51 @@ TEST_CASE("C++ comments", "[lexer] [comment]") // 1st comment { csspp::node::pointer_t comment(l.next_token()); - REQUIRE(comment->is(csspp::node_type_t::COMMENT)); - REQUIRE(comment->get_string() == "test\na\nmulti-line\ncomment\ntoo @preserve"); - REQUIRE(comment->get_integer() == 0); // C++ comment + CATCH_REQUIRE(comment->is(csspp::node_type_t::COMMENT)); + CATCH_REQUIRE(comment->get_string() == "test\na\nmulti-line\ncomment\ntoo @preserve"); + CATCH_REQUIRE(comment->get_integer() == 0); // C++ comment csspp::position const & npos(comment->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); + VERIFY_ERRORS("test.css(1): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 2); - REQUIRE(npos.get_line() == 4); - REQUIRE(npos.get_total_line() == 6); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 2); + CATCH_REQUIRE(npos.get_line() == 4); + CATCH_REQUIRE(npos.get_total_line() == 6); } // 2nd comment { csspp::node::pointer_t comment(l.next_token()); - REQUIRE(comment->is(csspp::node_type_t::COMMENT)); - REQUIRE(comment->get_string() == "with a second comment @preserve"); - REQUIRE(comment->get_integer() == 0); // C++ comment + CATCH_REQUIRE(comment->is(csspp::node_type_t::COMMENT)); + CATCH_REQUIRE(comment->get_string() == "with a second comment @preserve"); + CATCH_REQUIRE(comment->get_integer() == 0); // C++ comment csspp::position const & npos(comment->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 2); - REQUIRE(npos.get_line() == 4); - REQUIRE(npos.get_total_line() == 6); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 2); + CATCH_REQUIRE(npos.get_line() == 4); + CATCH_REQUIRE(npos.get_total_line() == 6); - REQUIRE_ERRORS("test.css(4): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); + VERIFY_ERRORS("test.css(4): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); } // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // one comment nearly multi-line @@ -1976,70 +1998,70 @@ TEST_CASE("C++ comments", "[lexer] [comment]") // comment { csspp::node::pointer_t comment(l.next_token()); - REQUIRE(comment->is(csspp::node_type_t::COMMENT)); - REQUIRE(comment->get_string() == "test comment and @preserve"); - REQUIRE(comment->get_integer() == 0); // C++ comment + CATCH_REQUIRE(comment->is(csspp::node_type_t::COMMENT)); + CATCH_REQUIRE(comment->get_string() == "test comment and @preserve"); + CATCH_REQUIRE(comment->get_integer() == 0); // C++ comment csspp::position const & npos(comment->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); + VERIFY_ERRORS("test.css(1): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // divide { csspp::node::pointer_t comment(l.next_token()); - REQUIRE(comment->is(csspp::node_type_t::DIVIDE)); + CATCH_REQUIRE(comment->is(csspp::node_type_t::DIVIDE)); csspp::position const & npos(comment->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // identifier { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == "divide"); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == "divide"); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // test with all types of characters that are considered valid by @@ -2117,29 +2139,29 @@ TEST_CASE("C++ comments", "[lexer] [comment]") // comment { csspp::node::pointer_t comment(l.next_token()); - REQUIRE(comment->is(csspp::node_type_t::COMMENT)); - REQUIRE(comment->get_string() == cmt + " @preserve"); - REQUIRE(comment->get_integer() == 0); // C++ comment + CATCH_REQUIRE(comment->is(csspp::node_type_t::COMMENT)); + CATCH_REQUIRE(comment->get_string() == cmt + " @preserve"); + CATCH_REQUIRE(comment->get_integer() == 0); // C++ comment csspp::position const & npos(comment->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); + VERIFY_ERRORS("test.css(1): warning: C++ comments should not be preserved as they are not supported by most CSS parsers.\n"); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } } -TEST_CASE("Strings", "[lexer] [string]") +CATCH_TEST_CASE("Strings", "[lexer] [string]") { // one simple string with " { @@ -2161,19 +2183,19 @@ TEST_CASE("Strings", "[lexer] [string]") // string { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::STRING)); - REQUIRE(string->get_string() == word); + CATCH_REQUIRE(string->is(csspp::node_type_t::STRING)); + CATCH_REQUIRE(string->get_string() == word); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // one simple string with " and including ' @@ -2186,19 +2208,19 @@ TEST_CASE("Strings", "[lexer] [string]") // string { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::STRING)); - REQUIRE(string->get_string() == "c'est un teste"); + CATCH_REQUIRE(string->is(csspp::node_type_t::STRING)); + CATCH_REQUIRE(string->get_string() == "c'est un teste"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // one simple string with ' @@ -2221,19 +2243,19 @@ TEST_CASE("Strings", "[lexer] [string]") // string { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::STRING)); - REQUIRE(string->get_string() == word); + CATCH_REQUIRE(string->is(csspp::node_type_t::STRING)); + CATCH_REQUIRE(string->get_string() == word); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // one simple string with ' including " @@ -2246,19 +2268,19 @@ TEST_CASE("Strings", "[lexer] [string]") // string { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::STRING)); - REQUIRE(string->get_string() == "This \"word\" sounds wrong!"); + CATCH_REQUIRE(string->is(csspp::node_type_t::STRING)); + CATCH_REQUIRE(string->get_string() == "This \"word\" sounds wrong!"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // string with escaped characters @@ -2338,24 +2360,24 @@ TEST_CASE("Strings", "[lexer] [string]") // string { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::STRING)); + CATCH_REQUIRE(string->is(csspp::node_type_t::STRING)); std::stringstream out; out << "escape character #" << std::dec << i << " as: " << l.wctomb(i) << (i < 0x100000 ? "" : " ") // space gets eaten if less than 6 characters in escape sequence << "to see whether it works"; - REQUIRE(string->get_string() == out.str()); + CATCH_REQUIRE(string->get_string() == out.str()); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } } @@ -2369,21 +2391,21 @@ TEST_CASE("Strings", "[lexer] [string]") // string { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::STRING)); - REQUIRE(string->get_string() == "No terminator"); + CATCH_REQUIRE(string->is(csspp::node_type_t::STRING)); + CATCH_REQUIRE(string->get_string() == "No terminator"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: found an unterminated string.\n"); + VERIFY_ERRORS("test.css(1): error: found an unterminated string.\n"); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // unterminated string before \n @@ -2396,90 +2418,90 @@ TEST_CASE("Strings", "[lexer] [string]") // string { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::STRING)); - REQUIRE(string->get_string() == "No terminator"); + CATCH_REQUIRE(string->is(csspp::node_type_t::STRING)); + CATCH_REQUIRE(string->get_string() == "No terminator"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: found an unterminated string with an unescaped newline.\n"); + VERIFY_ERRORS("test.css(1): error: found an unterminated string with an unescaped newline.\n"); } // whitespace { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(string->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "to"); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "to"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // whitespace { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(string->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "that"); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "that"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // whitespace { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(string->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "string"); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "string"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // special escapes in a string: \ + @@ -2493,21 +2515,21 @@ TEST_CASE("Strings", "[lexer] [string]") // string { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::STRING)); - REQUIRE(string->get_string() == "No terminator"); + CATCH_REQUIRE(string->is(csspp::node_type_t::STRING)); + CATCH_REQUIRE(string->get_string() == "No terminator"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: found an unterminated string.\n"); + VERIFY_ERRORS("test.css(1): error: found an unterminated string.\n"); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // special escapes in a string: \ + '\n' @@ -2521,19 +2543,19 @@ TEST_CASE("Strings", "[lexer] [string]") // string { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::STRING)); - REQUIRE(string->get_string() == "Line ncontinues on\nthe next line."); + CATCH_REQUIRE(string->is(csspp::node_type_t::STRING)); + CATCH_REQUIRE(string->get_string() == "Line ncontinues on\nthe next line."); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // special escapes in a string: \ + @@ -2546,20 +2568,20 @@ TEST_CASE("Strings", "[lexer] [string]") // string { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::STRING)); - REQUIRE(string->get_string() == "Bad Escape String"); + CATCH_REQUIRE(string->is(csspp::node_type_t::STRING)); + CATCH_REQUIRE(string->get_string() == "Bad Escape String"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); - REQUIRE_ERRORS("test.css(1): error: invalid character after a \\ character.\n"); + VERIFY_ERRORS("test.css(1): error: invalid character after a \\ character.\n"); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // escapes in a string: \ + @@ -2573,25 +2595,25 @@ TEST_CASE("Strings", "[lexer] [string]") // string { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::STRING)); - REQUIRE(string->get_string() == "Bad Escape String"); + CATCH_REQUIRE(string->is(csspp::node_type_t::STRING)); + CATCH_REQUIRE(string->get_string() == "Bad Escape String"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: escape character too large for Unicode.\n"); + VERIFY_ERRORS("test.css(1): error: escape character too large for Unicode.\n"); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } } -TEST_CASE("Identifiers", "[lexer] [identifier]") +CATCH_TEST_CASE("Identifiers", "[lexer] [identifier]") { // a few simple identifiers for(int count(0); count < 10; ++count) @@ -2612,16 +2634,16 @@ TEST_CASE("Identifiers", "[lexer] [identifier]") // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == word); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == word); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // a few simple identifiers starting with '_' @@ -2644,16 +2666,16 @@ TEST_CASE("Identifiers", "[lexer] [identifier]") // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == word); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == word); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // a few simple identifiers starting with '@' @@ -2676,16 +2698,16 @@ TEST_CASE("Identifiers", "[lexer] [identifier]") // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::AT_KEYWORD)); - REQUIRE(string->get_string() == word); + CATCH_REQUIRE(string->is(csspp::node_type_t::AT_KEYWORD)); + CATCH_REQUIRE(string->get_string() == word); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // try with empty '@' characters (i.e. invalid identifiers) @@ -2698,22 +2720,22 @@ TEST_CASE("Identifiers", "[lexer] [identifier]") // prefix-match { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::MULTIPLY)); + CATCH_REQUIRE(string->is(csspp::node_type_t::MULTIPLY)); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: found an empty identifier.\n"); + VERIFY_ERRORS("test.css(1): error: found an empty identifier.\n"); } // EOF { csspp::node::pointer_t eof(l.next_token()); - REQUIRE(eof->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(eof->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE_ERRORS("test.css(1): error: found an empty identifier.\n"); + VERIFY_ERRORS("test.css(1): error: found an empty identifier.\n"); } } @@ -2738,16 +2760,16 @@ TEST_CASE("Identifiers", "[lexer] [identifier]") // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == word); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == word); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // identifiers cannot start with '--' @@ -2760,85 +2782,85 @@ TEST_CASE("Identifiers", "[lexer] [identifier]") // subtract { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::SUBTRACT)); + CATCH_REQUIRE(string->is(csspp::node_type_t::SUBTRACT)); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "-not-double-dash"); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "-not-double-dash"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "--double-dash"); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "--double-dash"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 3); - REQUIRE(npos.get_total_line() == 3); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 3); + CATCH_REQUIRE(npos.get_total_line() == 3); } // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "-----quintuple-dash-----"); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "-----quintuple-dash-----"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 3); - REQUIRE(npos.get_total_line() == 3); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 3); + CATCH_REQUIRE(npos.get_total_line() == 3); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 4); - REQUIRE(npos.get_total_line() == 4); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 4); + CATCH_REQUIRE(npos.get_total_line() == 4); } // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // identifiers starting with an escape (\) @@ -2853,74 +2875,74 @@ TEST_CASE("Identifiers", "[lexer] [identifier]") // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "Alexis"); // identifiers are forced to lowercase since they are case insensitive + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "Alexis"); // identifiers are forced to lowercase since they are case insensitive csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "Babar"); // prove the space is eaten as expected + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "Babar"); // prove the space is eaten as expected csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 3); - REQUIRE(npos.get_total_line() == 3); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 3); + CATCH_REQUIRE(npos.get_total_line() == 3); } // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "Carlos"); // prove the space is not required with 6 digits + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "Carlos"); // prove the space is not required with 6 digits csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 3); - REQUIRE(npos.get_total_line() == 3); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 3); + CATCH_REQUIRE(npos.get_total_line() == 3); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 4); - REQUIRE(npos.get_total_line() == 4); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 4); + CATCH_REQUIRE(npos.get_total_line() == 4); } // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // identifier with an empty escape (\ + ) @@ -2933,19 +2955,19 @@ TEST_CASE("Identifiers", "[lexer] [identifier]") // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "This"); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "This"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: found EOF right after \\.\n"); + VERIFY_ERRORS("test.css(1): error: found EOF right after \\.\n"); } // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // empty identifier with an empty escape (\ + ) @@ -2958,30 +2980,30 @@ TEST_CASE("Identifiers", "[lexer] [identifier]") // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "This"); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "This"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: found EOF right after \\.\n" "test.css(1): error: found an empty identifier.\n" ); @@ -2997,15 +3019,15 @@ TEST_CASE("Identifiers", "[lexer] [identifier]") // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "This"); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "This"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: spurious newline character after a \\ character outside of a string.\n" ); } @@ -3013,28 +3035,28 @@ TEST_CASE("Identifiers", "[lexer] [identifier]") // whitespace -- this one gets lost and we do not care much //{ // csspp::node::pointer_t whitespace(l.next_token()); - // REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + // CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); // csspp::position const & npos(whitespace->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "That"); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "That"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // identifiers written between parenthesis and "don't do that" @@ -3065,39 +3087,39 @@ TEST_CASE("Identifiers", "[lexer] [identifier]") // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == word); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == word); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "\"don't do that\""); // yes, it's possible + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "\"don't do that\""); // yes, it's possible csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 2); - REQUIRE(npos.get_total_line() == 2); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 2); + CATCH_REQUIRE(npos.get_total_line() == 2); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // identifier with an escape followed by 0xFFFD (\ + ) @@ -3110,31 +3132,31 @@ TEST_CASE("Identifiers", "[lexer] [identifier]") // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "This"); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "This"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: invalid character after a \\ character.\n"); + VERIFY_ERRORS("test.css(1): error: invalid character after a \\ character.\n"); } // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == " ID"); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == " ID"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // identifier with an escape followed by "0" (\0) @@ -3147,41 +3169,41 @@ TEST_CASE("Identifiers", "[lexer] [identifier]") // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "This"); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "This"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: escape character '\\0' is not acceptable in CSS.\n"); + VERIFY_ERRORS("test.css(1): error: escape character '\\0' is not acceptable in CSS.\n"); } // identifier { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(string->get_string() == "ID"); + CATCH_REQUIRE(string->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(string->get_string() == "ID"); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // EOF - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Urls", "[lexer] [identifier] [url] [function]") +CATCH_TEST_CASE("Urls", "[lexer] [identifier] [url] [function]") { // a few simple URLs - SECTION("simple URLs") + CATCH_START_SECTION("simple URLs") { for(int count(0); count < 10; ++count) { @@ -3213,23 +3235,24 @@ TEST_CASE("Urls", "[lexer] [identifier] [url] [function]") // url { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::URL)); - REQUIRE(string->get_string() == word); + CATCH_REQUIRE(string->is(csspp::node_type_t::URL)); + CATCH_REQUIRE(string->get_string() == word); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } + CATCH_END_SECTION() // a few simple quoted URLs - SECTION("simple quoted URLs") + CATCH_START_SECTION("simple quoted URLs") { for(int count(0); count < 10; ++count) { @@ -3264,23 +3287,24 @@ TEST_CASE("Urls", "[lexer] [identifier] [url] [function]") // url { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::URL)); - REQUIRE(string->get_string() == word); + CATCH_REQUIRE(string->is(csspp::node_type_t::URL)); + CATCH_REQUIRE(string->get_string() == word); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } + CATCH_END_SECTION() // an invalid URL with EOF too soon - SECTION("invalid URL with EOF too soon") + CATCH_START_SECTION("invalid URL with EOF too soon") { for(int count(0); count < 10; ++count) { @@ -3306,27 +3330,28 @@ TEST_CASE("Urls", "[lexer] [identifier] [url] [function]") // url { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::URL)); - REQUIRE(string->get_string() == word); + CATCH_REQUIRE(string->is(csspp::node_type_t::URL)); + CATCH_REQUIRE(string->get_string() == word); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: found an invalid URL, one with forbidden characters.\n" ); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } + CATCH_END_SECTION() // an invalid URL with '"', "'", '(', and non-printable - SECTION("invalid URL with various unacceptable characters") + CATCH_START_SECTION("invalid URL with various unacceptable characters") { char const invalid_chars[] = "\"'(\x8\xb\xe\xf\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f"; for(size_t ic(0); ic < sizeof(invalid_chars) / sizeof(invalid_chars[0]); ++ic) @@ -3369,33 +3394,34 @@ TEST_CASE("Urls", "[lexer] [identifier] [url] [function]") // url { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::URL)); - REQUIRE(string->get_string() == word); + CATCH_REQUIRE(string->is(csspp::node_type_t::URL)); + CATCH_REQUIRE(string->get_string() == word); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS( + VERIFY_ERRORS( trailing == 0 ? "test.css(1): error: found an invalid URL, one with forbidden characters.\n" : "test.css(1): error: found an invalid URL, one which includes spaces or has a missing ')'.\n" ); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } } - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } + CATCH_END_SECTION() // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Functions", "[lexer] [identifier] [function]") +CATCH_TEST_CASE("Functions", "[lexer] [identifier] [function]") { // a few simple functions for(int count(0); count < 10; ++count) @@ -3417,46 +3443,46 @@ TEST_CASE("Functions", "[lexer] [identifier] [function]") // function { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::FUNCTION)); - REQUIRE(string->get_string() == word); + CATCH_REQUIRE(string->is(csspp::node_type_t::FUNCTION)); + CATCH_REQUIRE(string->get_string() == word); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // number { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::INTEGER)); - REQUIRE(string->get_integer() == 123); + CATCH_REQUIRE(string->is(csspp::node_type_t::INTEGER)); + CATCH_REQUIRE(string->get_integer() == 123); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // parenthesis { csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::CLOSE_PARENTHESIS)); + CATCH_REQUIRE(string->is(csspp::node_type_t::CLOSE_PARENTHESIS)); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Numbers", "[lexer] [number]") +CATCH_TEST_CASE("Numbers", "[lexer] [number]") { // a few simple integers for(int i(-10000); i <= 10000; ++i) @@ -3470,27 +3496,27 @@ TEST_CASE("Numbers", "[lexer] [number]") //if(i < 0) //{ // csspp::node::pointer_t integer(l.next_token()); - // REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(integer->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // integer { csspp::node::pointer_t integer(l.next_token()); - REQUIRE(integer->is(csspp::node_type_t::INTEGER)); - REQUIRE(integer->get_integer() == i); + CATCH_REQUIRE(integer->is(csspp::node_type_t::INTEGER)); + CATCH_REQUIRE(integer->get_integer() == i); csspp::position const & npos(integer->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // a few simple numbers (decimal / decimal) @@ -3512,63 +3538,63 @@ TEST_CASE("Numbers", "[lexer] [number]") //if(negative) //{ // csspp::node::pointer_t subtract(l.next_token()); - // REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(subtract->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} //else if(*sign == '+') //{ // csspp::node::pointer_t subtract(l.next_token()); - // REQUIRE(subtract->is(csspp::node_type_t::ADD)); + // CATCH_REQUIRE(subtract->is(csspp::node_type_t::ADD)); // csspp::position const & npos(subtract->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} if(floating_point) { // decimal number csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::DECIMAL_NUMBER)); + CATCH_REQUIRE(string->is(csspp::node_type_t::DECIMAL_NUMBER)); //std::cerr << "*** from [" << ss.str() // << "] or [" << static_cast(i) / 1000.0 // << "] we got [" << string->get_decimal_number() // << "] |" << fabs(string->get_decimal_number()) // << "| (sign: " << (negative ? "-" : "+") << ")\n"; - REQUIRE(fabs(fabs(string->get_decimal_number()) - static_cast(i) / 1000.0) < 0.00001); + CATCH_REQUIRE(fabs(fabs(string->get_decimal_number()) - static_cast(i) / 1000.0) < 0.00001); if(negative) { - REQUIRE(string->get_decimal_number() <= 0.0); + CATCH_REQUIRE(string->get_decimal_number() <= 0.0); } else { - REQUIRE(string->get_decimal_number() >= 0.0); + CATCH_REQUIRE(string->get_decimal_number() >= 0.0); } csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } else { // integer csspp::node::pointer_t string(l.next_token()); - REQUIRE(string->is(csspp::node_type_t::INTEGER)); - REQUIRE(string->get_integer() == (negative ? -1 : 1) * i / 1000); + CATCH_REQUIRE(string->is(csspp::node_type_t::INTEGER)); + CATCH_REQUIRE(string->get_integer() == (negative ? -1 : 1) * i / 1000); csspp::position const & npos(string->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // a few simple decimals with an exponent @@ -3610,29 +3636,29 @@ TEST_CASE("Numbers", "[lexer] [number]") //if(i < 0) //{ // csspp::node::pointer_t subtract(l.next_token()); - // REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(subtract->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} //else if(*sign == '+') //{ // csspp::node::pointer_t subtract(l.next_token()); - // REQUIRE(subtract->is(csspp::node_type_t::ADD)); + // CATCH_REQUIRE(subtract->is(csspp::node_type_t::ADD)); // csspp::position const & npos(subtract->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // decimal number { csspp::node::pointer_t decimal_number(l.next_token()); //std::cerr << "*** type is " << static_cast(decimal_number->get_type()) << " ***\n"; - REQUIRE(decimal_number->is(csspp::node_type_t::DECIMAL_NUMBER)); + CATCH_REQUIRE(decimal_number->is(csspp::node_type_t::DECIMAL_NUMBER)); csspp::decimal_number_t const result(fabs(decimal_number->get_decimal_number())); csspp::decimal_number_t const abs_number(fabs(our_number)); csspp::decimal_number_t const delta(fabs(result - abs_number)); @@ -3647,23 +3673,23 @@ TEST_CASE("Numbers", "[lexer] [number]") //std::cerr << std::hex // << *reinterpret_cast(&r) << "\n" // << *reinterpret_cast(&q) << " " << (r - q) << " -> " << diff << "\n"; - REQUIRE(diff < 0.00001); + CATCH_REQUIRE(diff < 0.00001); if(*sign == '-') { - REQUIRE(decimal_number->get_decimal_number() <= 0); + CATCH_REQUIRE(decimal_number->get_decimal_number() <= 0); } else { - REQUIRE(decimal_number->get_decimal_number() >= 0); + CATCH_REQUIRE(decimal_number->get_decimal_number() >= 0); } csspp::position const & npos(decimal_number->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // numbers starting with a period (.25e3) @@ -3703,28 +3729,28 @@ TEST_CASE("Numbers", "[lexer] [number]") //if(i < 0) //{ // csspp::node::pointer_t subtract(l.next_token()); - // REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(subtract->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} //else if(*sign == '+') //{ // csspp::node::pointer_t subtract(l.next_token()); - // REQUIRE(subtract->is(csspp::node_type_t::ADD)); + // CATCH_REQUIRE(subtract->is(csspp::node_type_t::ADD)); // csspp::position const & npos(subtract->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // decimal number { csspp::node::pointer_t decimal_number(l.next_token()); - REQUIRE(decimal_number->is(csspp::node_type_t::DECIMAL_NUMBER)); + CATCH_REQUIRE(decimal_number->is(csspp::node_type_t::DECIMAL_NUMBER)); csspp::decimal_number_t const result(fabs(decimal_number->get_decimal_number())); csspp::decimal_number_t const abs_number(fabs(our_number)); csspp::decimal_number_t const delta(fabs(result - abs_number)); @@ -3739,23 +3765,23 @@ TEST_CASE("Numbers", "[lexer] [number]") //std::cerr << std::hex // << *reinterpret_cast(&r) << "\n" // << *reinterpret_cast(&q) << " " << (r - q) << " -> " << diff << "\n"; - REQUIRE(diff < 0.00001); + CATCH_REQUIRE(diff < 0.00001); if(*sign == '-') { - REQUIRE(decimal_number->get_decimal_number() <= 0); + CATCH_REQUIRE(decimal_number->get_decimal_number() <= 0); } else { - REQUIRE(decimal_number->get_decimal_number() >= 0); + CATCH_REQUIRE(decimal_number->get_decimal_number() >= 0); } csspp::position const & npos(decimal_number->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } } @@ -3770,50 +3796,50 @@ TEST_CASE("Numbers", "[lexer] [number]") // identifier { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == "perfect"); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == "perfect"); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // colon { csspp::node::pointer_t colon(l.next_token()); - REQUIRE(colon->is(csspp::node_type_t::COLON)); + CATCH_REQUIRE(colon->is(csspp::node_type_t::COLON)); csspp::position const & npos(colon->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // decimal number { csspp::node::pointer_t integer(l.next_token()); - REQUIRE(integer->is(csspp::node_type_t::INTEGER)); - REQUIRE(integer->get_integer() == 9223372036854775807LL); + CATCH_REQUIRE(integer->is(csspp::node_type_t::INTEGER)); + CATCH_REQUIRE(integer->get_integer() == 9223372036854775807LL); csspp::position const & npos(integer->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // check a number so large that it fails @@ -3827,52 +3853,52 @@ TEST_CASE("Numbers", "[lexer] [number]") // identifier { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == "too large"); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == "too large"); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // colon { csspp::node::pointer_t colon(l.next_token()); - REQUIRE(colon->is(csspp::node_type_t::COLON)); + CATCH_REQUIRE(colon->is(csspp::node_type_t::COLON)); csspp::position const & npos(colon->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // integer { csspp::node::pointer_t integer(l.next_token()); - REQUIRE(integer->is(csspp::node_type_t::INTEGER)); - //REQUIRE(integer->get_integer() == ???); -- there is an overflow so we decide not to replicate it here + CATCH_REQUIRE(integer->is(csspp::node_type_t::INTEGER)); + //CATCH_REQUIRE(integer->get_integer() == ???); -- there is an overflow so we decide not to replicate it here csspp::position const & npos(integer->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: integral part too large for a number.\n"); + VERIFY_ERRORS("test.css(1): error: integral part too large for a number.\n"); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // check a decimal part that's too large @@ -3886,52 +3912,52 @@ TEST_CASE("Numbers", "[lexer] [number]") // identifier { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == "decimal_part_too_long"); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == "decimal_part_too_long"); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // colon { csspp::node::pointer_t colon(l.next_token()); - REQUIRE(colon->is(csspp::node_type_t::COLON)); + CATCH_REQUIRE(colon->is(csspp::node_type_t::COLON)); csspp::position const & npos(colon->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // decimal number { csspp::node::pointer_t decimal_number(l.next_token()); - REQUIRE(decimal_number->is(csspp::node_type_t::DECIMAL_NUMBER)); - //REQUIRE(decimal_number->get_decimal_number() == ???); -- there may be an overflow so we decide not to replicate it here + CATCH_REQUIRE(decimal_number->is(csspp::node_type_t::DECIMAL_NUMBER)); + //CATCH_REQUIRE(decimal_number->get_decimal_number() == ???); -- there may be an overflow so we decide not to replicate it here csspp::position const & npos(decimal_number->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: fraction too large for a decimal number.\n"); + VERIFY_ERRORS("test.css(1): error: fraction too large for a decimal number.\n"); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // decimal number with no digits in the decimal fraction part is an error @@ -3944,66 +3970,63 @@ TEST_CASE("Numbers", "[lexer] [number]") // identifier { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == "font-size"); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == "font-size"); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // colon { csspp::node::pointer_t colon(l.next_token()); - REQUIRE(colon->is(csspp::node_type_t::COLON)); + CATCH_REQUIRE(colon->is(csspp::node_type_t::COLON)); csspp::position const & npos(colon->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // decimal number { csspp::node::pointer_t decimal_number(l.next_token()); - REQUIRE(decimal_number->is(csspp::node_type_t::DECIMAL_NUMBER)); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wfloat-equal" - REQUIRE(decimal_number->get_decimal_number() == 154.0); -#pragma GCC diagnostic pop + CATCH_REQUIRE(decimal_number->is(csspp::node_type_t::DECIMAL_NUMBER)); + CATCH_REQUIRE(decimal_number->get_decimal_number() == 154.0_a); csspp::position const & npos(decimal_number->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: decimal number must have at least one digit after the decimal point.\n"); + VERIFY_ERRORS("test.css(1): error: decimal number must have at least one digit after the decimal point.\n"); } // semi-colon { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::SEMICOLON)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::SEMICOLON)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // try parsing an expression @@ -4016,84 +4039,84 @@ TEST_CASE("Numbers", "[lexer] [number]") // identifier { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == "font-size"); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == "font-size"); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // colon { csspp::node::pointer_t colon(l.next_token()); - REQUIRE(colon->is(csspp::node_type_t::COLON)); + CATCH_REQUIRE(colon->is(csspp::node_type_t::COLON)); csspp::position const & npos(colon->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // integer { csspp::node::pointer_t integer(l.next_token()); - REQUIRE(integer->is(csspp::node_type_t::INTEGER)); - REQUIRE(integer->get_integer() == 154); + CATCH_REQUIRE(integer->is(csspp::node_type_t::INTEGER)); + CATCH_REQUIRE(integer->get_integer() == 154); csspp::position const & npos(integer->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // multiply { csspp::node::pointer_t integer(l.next_token()); - REQUIRE(integer->is(csspp::node_type_t::MULTIPLY)); + CATCH_REQUIRE(integer->is(csspp::node_type_t::MULTIPLY)); csspp::position const & npos(integer->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // integer { csspp::node::pointer_t integer(l.next_token()); - REQUIRE(integer->is(csspp::node_type_t::INTEGER)); - REQUIRE(integer->get_integer() == 3); + CATCH_REQUIRE(integer->is(csspp::node_type_t::INTEGER)); + CATCH_REQUIRE(integer->get_integer() == 3); csspp::position const & npos(integer->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // semi-colon { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::SEMICOLON)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::SEMICOLON)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // test with an exponent that's too large @@ -4106,70 +4129,70 @@ TEST_CASE("Numbers", "[lexer] [number]") // identifier { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == "font-size"); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == "font-size"); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // colon { csspp::node::pointer_t colon(l.next_token()); - REQUIRE(colon->is(csspp::node_type_t::COLON)); + CATCH_REQUIRE(colon->is(csspp::node_type_t::COLON)); csspp::position const & npos(colon->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // decimal number { csspp::node::pointer_t decimal_number(l.next_token()); - REQUIRE(decimal_number->is(csspp::node_type_t::DECIMAL_NUMBER)); - //REQUIRE(decimal_number->get_decimal_number() == ...); -- this is not a valid number + CATCH_REQUIRE(decimal_number->is(csspp::node_type_t::DECIMAL_NUMBER)); + //CATCH_REQUIRE(decimal_number->get_decimal_number() == ...); -- this is not a valid number csspp::position const & npos(decimal_number->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: exponent too large for a decimal number.\n"); + VERIFY_ERRORS("test.css(1): error: exponent too large for a decimal number.\n"); } // semi-colon { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::SEMICOLON)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::SEMICOLON)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Dimensions", "[lexer] [number] [dimension] [identifier]") +CATCH_TEST_CASE("Dimensions", "[lexer] [number] [dimension] [identifier]") { // well known dimensions with integers { @@ -4198,12 +4221,12 @@ TEST_CASE("Dimensions", "[lexer] [number] [dimension] [identifier]") //if(i < 0) //{ // csspp::node::pointer_t integer(l.next_token()); - // REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(integer->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // dimension @@ -4211,14 +4234,14 @@ TEST_CASE("Dimensions", "[lexer] [number] [dimension] [identifier]") // a dimension is an integer or a decimal number // with a string expressing the dimension csspp::node::pointer_t dimension(l.next_token()); - REQUIRE(dimension->is(csspp::node_type_t::INTEGER)); - REQUIRE(dimension->get_integer() == i); - REQUIRE(dimension->get_string() == dimensions[j]); + CATCH_REQUIRE(dimension->is(csspp::node_type_t::INTEGER)); + CATCH_REQUIRE(dimension->get_integer() == i); + CATCH_REQUIRE(dimension->get_string() == dimensions[j]); csspp::position const & npos(dimension->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // direct escape? @@ -4227,24 +4250,24 @@ TEST_CASE("Dimensions", "[lexer] [number] [dimension] [identifier]") // comma { csspp::node::pointer_t comma(l.next_token()); - REQUIRE(comma->is(csspp::node_type_t::COMMA)); + CATCH_REQUIRE(comma->is(csspp::node_type_t::COMMA)); csspp::position const & npos(comma->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // sign //if(i < 0) //{ // csspp::node::pointer_t integer(l.next_token()); - // REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(integer->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // dimension @@ -4252,38 +4275,38 @@ TEST_CASE("Dimensions", "[lexer] [number] [dimension] [identifier]") // a dimension is an integer or a decimal number // with a string expressing the dimension csspp::node::pointer_t dimension(l.next_token()); - REQUIRE(dimension->is(csspp::node_type_t::INTEGER)); - REQUIRE(dimension->get_integer() == i); - REQUIRE(dimension->get_string() == dimensions[j]); + CATCH_REQUIRE(dimension->is(csspp::node_type_t::INTEGER)); + CATCH_REQUIRE(dimension->get_integer() == i); + CATCH_REQUIRE(dimension->get_string() == dimensions[j]); csspp::position const & npos(dimension->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } } // comma { csspp::node::pointer_t comma(l.next_token()); - REQUIRE(comma->is(csspp::node_type_t::COMMA)); + CATCH_REQUIRE(comma->is(csspp::node_type_t::COMMA)); csspp::position const & npos(comma->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // sign //if(i < 0) //{ // csspp::node::pointer_t integer(l.next_token()); - // REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(integer->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // dimension @@ -4291,61 +4314,61 @@ TEST_CASE("Dimensions", "[lexer] [number] [dimension] [identifier]") // a dimension is an integer or a decimal number // with a string expressing the dimension csspp::node::pointer_t dimension(l.next_token()); - REQUIRE(dimension->is(csspp::node_type_t::INTEGER)); - REQUIRE(dimension->get_integer() == i); - REQUIRE(dimension->get_string() == dimensions[j]); + CATCH_REQUIRE(dimension->is(csspp::node_type_t::INTEGER)); + CATCH_REQUIRE(dimension->get_integer() == i); + CATCH_REQUIRE(dimension->get_string() == dimensions[j]); csspp::position const & npos(dimension->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // comma { csspp::node::pointer_t comma(l.next_token()); - REQUIRE(comma->is(csspp::node_type_t::COMMA)); + CATCH_REQUIRE(comma->is(csspp::node_type_t::COMMA)); csspp::position const & npos(comma->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // sign //if(i < 0) //{ // csspp::node::pointer_t integer(l.next_token()); - // REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(integer->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // integer (separated!) { csspp::node::pointer_t integer(l.next_token()); - REQUIRE(integer->is(csspp::node_type_t::INTEGER)); - REQUIRE(integer->get_integer() == i); - REQUIRE(integer->get_string() == ""); + CATCH_REQUIRE(integer->is(csspp::node_type_t::INTEGER)); + CATCH_REQUIRE(integer->get_integer() == i); + CATCH_REQUIRE(integer->get_string() == ""); csspp::position const & npos(integer->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // "dimension" (as a separate identifier) @@ -4353,15 +4376,15 @@ TEST_CASE("Dimensions", "[lexer] [number] [dimension] [identifier]") // a dimension is an integer or a decimal number // with a string expressing the dimension csspp::node::pointer_t dimension(l.next_token()); - REQUIRE(dimension->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(dimension->get_string() == dimensions[j]); + CATCH_REQUIRE(dimension->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(dimension->get_string() == dimensions[j]); csspp::position const & npos(dimension->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } } } @@ -4387,12 +4410,12 @@ TEST_CASE("Dimensions", "[lexer] [number] [dimension] [identifier]") //if(i < 0) //{ // csspp::node::pointer_t integer(l.next_token()); - // REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(integer->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // dimension @@ -4400,61 +4423,61 @@ TEST_CASE("Dimensions", "[lexer] [number] [dimension] [identifier]") // a dimension is an integer or a decimal number // with a string expressing the dimension csspp::node::pointer_t dimension(l.next_token()); - REQUIRE(dimension->is(csspp::node_type_t::DECIMAL_NUMBER)); - REQUIRE(fabs(dimension->get_decimal_number() - i / 100.0) < 0.00001); - REQUIRE(dimension->get_string() == dimensions[j]); + CATCH_REQUIRE(dimension->is(csspp::node_type_t::DECIMAL_NUMBER)); + CATCH_REQUIRE(fabs(dimension->get_decimal_number() - i / 100.0) < 0.00001); + CATCH_REQUIRE(dimension->get_string() == dimensions[j]); csspp::position const & npos(dimension->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // comma { csspp::node::pointer_t comma(l.next_token()); - REQUIRE(comma->is(csspp::node_type_t::COMMA)); + CATCH_REQUIRE(comma->is(csspp::node_type_t::COMMA)); csspp::position const & npos(comma->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // sign //if(i < 0) //{ // csspp::node::pointer_t integer(l.next_token()); - // REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(integer->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // decimal number (separated!) { csspp::node::pointer_t decimal_number(l.next_token()); - REQUIRE(decimal_number->is(csspp::node_type_t::DECIMAL_NUMBER)); - REQUIRE(fabs(decimal_number->get_decimal_number() - i / 100.0) < 0.00001); - REQUIRE(decimal_number->get_string() == ""); + CATCH_REQUIRE(decimal_number->is(csspp::node_type_t::DECIMAL_NUMBER)); + CATCH_REQUIRE(fabs(decimal_number->get_decimal_number() - i / 100.0) < 0.00001); + CATCH_REQUIRE(decimal_number->get_string() == ""); csspp::position const & npos(decimal_number->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // "dimension" (as a separate identifier) @@ -4462,15 +4485,15 @@ TEST_CASE("Dimensions", "[lexer] [number] [dimension] [identifier]") // a dimension is an integer or a decimal number // with a string expressing the dimension csspp::node::pointer_t dimension(l.next_token()); - REQUIRE(dimension->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(dimension->get_string() == dimensions[j]); + CATCH_REQUIRE(dimension->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(dimension->get_string() == dimensions[j]); csspp::position const & npos(dimension->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } } } @@ -4496,12 +4519,12 @@ TEST_CASE("Dimensions", "[lexer] [number] [dimension] [identifier]") //if(i < 0) //{ // csspp::node::pointer_t integer(l.next_token()); - // REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(integer->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // dimension @@ -4509,61 +4532,61 @@ TEST_CASE("Dimensions", "[lexer] [number] [dimension] [identifier]") // a dimension is an integer or a decimal number // with a string expressing the dimension csspp::node::pointer_t dimension(l.next_token()); - REQUIRE(dimension->is(csspp::node_type_t::DECIMAL_NUMBER)); - REQUIRE(fabs(dimension->get_decimal_number() - i / 100.0) < 0.00001); - REQUIRE(dimension->get_string() == dimensions[j]); + CATCH_REQUIRE(dimension->is(csspp::node_type_t::DECIMAL_NUMBER)); + CATCH_REQUIRE(fabs(dimension->get_decimal_number() - i / 100.0) < 0.00001); + CATCH_REQUIRE(dimension->get_string() == dimensions[j]); csspp::position const & npos(dimension->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // comma { csspp::node::pointer_t comma(l.next_token()); - REQUIRE(comma->is(csspp::node_type_t::COMMA)); + CATCH_REQUIRE(comma->is(csspp::node_type_t::COMMA)); csspp::position const & npos(comma->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // sign //if(i < 0) //{ // csspp::node::pointer_t integer(l.next_token()); - // REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(integer->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(integer->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // decimal number (separated!) { csspp::node::pointer_t decimal_number(l.next_token()); - REQUIRE(decimal_number->is(csspp::node_type_t::DECIMAL_NUMBER)); - REQUIRE(fabs(decimal_number->get_decimal_number() - i / 100.0) < 0.00001); - REQUIRE(decimal_number->get_string() == ""); + CATCH_REQUIRE(decimal_number->is(csspp::node_type_t::DECIMAL_NUMBER)); + CATCH_REQUIRE(fabs(decimal_number->get_decimal_number() - i / 100.0) < 0.00001); + CATCH_REQUIRE(decimal_number->get_string() == ""); csspp::position const & npos(decimal_number->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // "dimension" (as a separate identifier) @@ -4571,15 +4594,15 @@ TEST_CASE("Dimensions", "[lexer] [number] [dimension] [identifier]") // a dimension is an integer or a decimal number // with a string expressing the dimension csspp::node::pointer_t dimension(l.next_token()); - REQUIRE(dimension->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(dimension->get_string() == dimensions[j]); + CATCH_REQUIRE(dimension->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(dimension->get_string() == dimensions[j]); csspp::position const & npos(dimension->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } } } @@ -4596,26 +4619,26 @@ TEST_CASE("Dimensions", "[lexer] [number] [dimension] [identifier]") // a dimension is an integer or a decimal number // with a string expressing the dimension csspp::node::pointer_t dimension(l.next_token()); - REQUIRE(dimension->is(csspp::node_type_t::DECIMAL_NUMBER)); - REQUIRE(fabs(dimension->get_decimal_number() - 1.25) < 0.00001); - REQUIRE(dimension->get_string() == "e"); + CATCH_REQUIRE(dimension->is(csspp::node_type_t::DECIMAL_NUMBER)); + CATCH_REQUIRE(fabs(dimension->get_decimal_number() - 1.25) < 0.00001); + CATCH_REQUIRE(dimension->get_string() == "e"); csspp::position const & npos(dimension->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE_ERRORS("test.css(1): error: spurious newline character after a \\ character outside of a string.\n"); + VERIFY_ERRORS("test.css(1): error: spurious newline character after a \\ character outside of a string.\n"); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Percent", "[lexer] [number] [percent]") +CATCH_TEST_CASE("Percent", "[lexer] [number] [percent]") { // percent with integers, converts to decimal number anyway { @@ -4633,155 +4656,152 @@ TEST_CASE("Percent", "[lexer] [number] [percent]") //if(i < 0) //{ // csspp::node::pointer_t subtract(l.next_token()); - // REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(subtract->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // percent { csspp::node::pointer_t percent(l.next_token()); - REQUIRE(percent->is(csspp::node_type_t::PERCENT)); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wfloat-equal" - REQUIRE(percent->get_decimal_number() == static_cast(i) / 100.0); -#pragma GCC diagnostic pop + CATCH_REQUIRE(percent->is(csspp::node_type_t::PERCENT)); + CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(percent->get_decimal_number(), static_cast(i) / 100.0, 0.0)); csspp::position const & npos(percent->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // comma { csspp::node::pointer_t comma(l.next_token()); - REQUIRE(comma->is(csspp::node_type_t::COMMA)); + CATCH_REQUIRE(comma->is(csspp::node_type_t::COMMA)); csspp::position const & npos(comma->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // sign //if(i < 0) //{ // csspp::node::pointer_t subtract(l.next_token()); - // REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(subtract->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // dimension (because '%' written '\%' is not a PERCENT...) { csspp::node::pointer_t integer(l.next_token()); - REQUIRE(integer->is(csspp::node_type_t::INTEGER)); - REQUIRE(integer->get_integer() == i); - REQUIRE(integer->get_string() == "%"); + CATCH_REQUIRE(integer->is(csspp::node_type_t::INTEGER)); + CATCH_REQUIRE(integer->get_integer() == i); + CATCH_REQUIRE(integer->get_string() == "%"); csspp::position const & npos(integer->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // comma { csspp::node::pointer_t comma(l.next_token()); - REQUIRE(comma->is(csspp::node_type_t::COMMA)); + CATCH_REQUIRE(comma->is(csspp::node_type_t::COMMA)); csspp::position const & npos(comma->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // sign //if(i < 0) //{ // csspp::node::pointer_t subtract(l.next_token()); - // REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(subtract->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // dimension (again \25 is not a PERCENT) { csspp::node::pointer_t dimension(l.next_token()); - REQUIRE(dimension->is(csspp::node_type_t::INTEGER)); - REQUIRE(dimension->get_integer() == i); - REQUIRE(dimension->get_string() == "%"); + CATCH_REQUIRE(dimension->is(csspp::node_type_t::INTEGER)); + CATCH_REQUIRE(dimension->get_integer() == i); + CATCH_REQUIRE(dimension->get_string() == "%"); csspp::position const & npos(dimension->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // comma { csspp::node::pointer_t comma(l.next_token()); - REQUIRE(comma->is(csspp::node_type_t::COMMA)); + CATCH_REQUIRE(comma->is(csspp::node_type_t::COMMA)); csspp::position const & npos(comma->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // sign //if(i < 0) //{ // csspp::node::pointer_t subtract(l.next_token()); - // REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(subtract->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // integer (separated!) { csspp::node::pointer_t integer(l.next_token()); - REQUIRE(integer->is(csspp::node_type_t::INTEGER)); - REQUIRE(integer->get_integer() == i); - REQUIRE(integer->get_string() == ""); - REQUIRE(integer->get_string() == ""); + CATCH_REQUIRE(integer->is(csspp::node_type_t::INTEGER)); + CATCH_REQUIRE(integer->get_integer() == i); + CATCH_REQUIRE(integer->get_string() == ""); + CATCH_REQUIRE(integer->get_string() == ""); csspp::position const & npos(integer->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // "percent" by itself is MODULO { - REQUIRE(l.next_token()->is(csspp::node_type_t::MODULO)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::MODULO)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } } } @@ -4800,88 +4820,88 @@ TEST_CASE("Percent", "[lexer] [number] [percent]") //if(i < 0) //{ // csspp::node::pointer_t subtract(l.next_token()); - // REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(subtract->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // percent { csspp::node::pointer_t percent(l.next_token()); - REQUIRE(percent->is(csspp::node_type_t::PERCENT)); - REQUIRE(fabs(percent->get_decimal_number() - i / 10000.0) < 0.00001); + CATCH_REQUIRE(percent->is(csspp::node_type_t::PERCENT)); + CATCH_REQUIRE(fabs(percent->get_decimal_number() - i / 10000.0) < 0.00001); csspp::position const & npos(percent->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // comma { csspp::node::pointer_t comma(l.next_token()); - REQUIRE(comma->is(csspp::node_type_t::COMMA)); + CATCH_REQUIRE(comma->is(csspp::node_type_t::COMMA)); csspp::position const & npos(comma->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // sign //if(i < 0) //{ // csspp::node::pointer_t subtract(l.next_token()); - // REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); + // CATCH_REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); // csspp::position const & npos(subtract->get_position()); - // REQUIRE(npos.get_filename() == "test.css"); - // REQUIRE(npos.get_page() == 1); - // REQUIRE(npos.get_line() == 1); - // REQUIRE(npos.get_total_line() == 1); + // CATCH_REQUIRE(npos.get_filename() == "test.css"); + // CATCH_REQUIRE(npos.get_page() == 1); + // CATCH_REQUIRE(npos.get_line() == 1); + // CATCH_REQUIRE(npos.get_total_line() == 1); //} // decimal number (separated!) { csspp::node::pointer_t decimal_number(l.next_token()); - REQUIRE(decimal_number->is(csspp::node_type_t::DECIMAL_NUMBER)); - REQUIRE(fabs(decimal_number->get_decimal_number() - i / 100.0) < 0.00001); - REQUIRE(decimal_number->get_string() == ""); + CATCH_REQUIRE(decimal_number->is(csspp::node_type_t::DECIMAL_NUMBER)); + CATCH_REQUIRE(fabs(decimal_number->get_decimal_number() - i / 100.0) < 0.00001); + CATCH_REQUIRE(decimal_number->get_string() == ""); csspp::position const & npos(decimal_number->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // "percent" by itself is MODULO { - REQUIRE(l.next_token()->is(csspp::node_type_t::MODULO)); - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::MODULO)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } } } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Unicode range", "[lexer] [unicode]") +CATCH_TEST_CASE("Unicode range", "[lexer] [unicode]") { // a small test to make sure we get U or u as identifiers when // the + is not followed by the right character @@ -4894,108 +4914,108 @@ TEST_CASE("Unicode range", "[lexer] [unicode]") // identifier { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == "U"); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == "U"); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // add { csspp::node::pointer_t add(l.next_token()); - REQUIRE(add->is(csspp::node_type_t::ADD)); + CATCH_REQUIRE(add->is(csspp::node_type_t::ADD)); csspp::position const & npos(add->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // identifier { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == "U"); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == "U"); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // identifier { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == "or"); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == "or"); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // whitespace { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // identifier { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == "u"); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == "u"); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // add { csspp::node::pointer_t add(l.next_token()); - REQUIRE(add->is(csspp::node_type_t::ADD)); + CATCH_REQUIRE(add->is(csspp::node_type_t::ADD)); csspp::position const & npos(add->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // identifier { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == "u"); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == "u"); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // one value (U+) @@ -5017,62 +5037,62 @@ TEST_CASE("Unicode range", "[lexer] [unicode]") // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - REQUIRE(unicode_range->get_integer() == range.get_range()); + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + CATCH_REQUIRE(unicode_range->get_integer() == static_cast(range.get_range())); csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // comma { csspp::node::pointer_t comma(l.next_token()); - REQUIRE(comma->is(csspp::node_type_t::COMMA)); + CATCH_REQUIRE(comma->is(csspp::node_type_t::COMMA)); csspp::position const & npos(comma->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - REQUIRE(unicode_range->get_integer() == range.get_range()); + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + CATCH_REQUIRE(unicode_range->get_integer() == static_cast(range.get_range())); csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // comma { csspp::node::pointer_t comma(l.next_token()); - REQUIRE(comma->is(csspp::node_type_t::COMMA)); + CATCH_REQUIRE(comma->is(csspp::node_type_t::COMMA)); csspp::position const & npos(comma->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - REQUIRE(unicode_range->get_integer() == range.get_range()); + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + CATCH_REQUIRE(unicode_range->get_integer() == static_cast(range.get_range())); csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } for(int i(0); i < 1000; ++i) @@ -5090,62 +5110,62 @@ TEST_CASE("Unicode range", "[lexer] [unicode]") // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - REQUIRE(unicode_range->get_integer() == range.get_range()); + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + CATCH_REQUIRE(unicode_range->get_integer() == static_cast(range.get_range())); csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // comma { csspp::node::pointer_t comma(l.next_token()); - REQUIRE(comma->is(csspp::node_type_t::COMMA)); + CATCH_REQUIRE(comma->is(csspp::node_type_t::COMMA)); csspp::position const & npos(comma->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - REQUIRE(unicode_range->get_integer() == range.get_range()); + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + CATCH_REQUIRE(unicode_range->get_integer() == static_cast(range.get_range())); csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // comma { csspp::node::pointer_t comma(l.next_token()); - REQUIRE(comma->is(csspp::node_type_t::COMMA)); + CATCH_REQUIRE(comma->is(csspp::node_type_t::COMMA)); csspp::position const & npos(comma->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - REQUIRE(unicode_range->get_integer() == range.get_range()); + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + CATCH_REQUIRE(unicode_range->get_integer() == static_cast(range.get_range())); csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } } @@ -5162,28 +5182,28 @@ TEST_CASE("Unicode range", "[lexer] [unicode]") // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - REQUIRE(unicode_range->get_integer() == range.get_range()); + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + CATCH_REQUIRE(unicode_range->get_integer() == static_cast(range.get_range())); csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // identifier { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == "Alexis"); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == "Alexis"); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // test that we recover the number right after a Unicode Range @@ -5199,28 +5219,28 @@ TEST_CASE("Unicode range", "[lexer] [unicode]") // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - REQUIRE(unicode_range->get_integer() == range.get_range()); + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + CATCH_REQUIRE(unicode_range->get_integer() == static_cast(range.get_range())); csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // integer { csspp::node::pointer_t integer(l.next_token()); - REQUIRE(integer->is(csspp::node_type_t::INTEGER)); - REQUIRE(integer->get_integer() == 123); + CATCH_REQUIRE(integer->is(csspp::node_type_t::INTEGER)); + CATCH_REQUIRE(integer->get_integer() == 123); csspp::position const & npos(integer->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // try various masks @@ -5236,16 +5256,16 @@ TEST_CASE("Unicode range", "[lexer] [unicode]") // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - REQUIRE(unicode_range->get_integer() == range.get_range()); + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + CATCH_REQUIRE(unicode_range->get_integer() == static_cast(range.get_range())); csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } for(int i(0); i < 3; i++) { @@ -5279,16 +5299,16 @@ TEST_CASE("Unicode range", "[lexer] [unicode]") // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - REQUIRE(unicode_range->get_integer() == range.get_range()); + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + CATCH_REQUIRE(unicode_range->get_integer() == static_cast(range.get_range())); csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } for(int i(0); i < 0x11; ++i) { @@ -5324,16 +5344,16 @@ TEST_CASE("Unicode range", "[lexer] [unicode]") // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - REQUIRE(unicode_range->get_integer() == range.get_range()); + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + CATCH_REQUIRE(unicode_range->get_integer() == static_cast(range.get_range())); csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } for(int i(0); i < 1000; ++i) //1433656549 { @@ -5367,16 +5387,16 @@ TEST_CASE("Unicode range", "[lexer] [unicode]") // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - REQUIRE(unicode_range->get_integer() == range.get_range()); + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + CATCH_REQUIRE(unicode_range->get_integer() == static_cast(range.get_range())); csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // test simple range (start only) with values that are too large @@ -5394,18 +5414,18 @@ TEST_CASE("Unicode range", "[lexer] [unicode]") // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - //REQUIRE(unicode_range->get_integer() == range.f_range); -- there was an overflow + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + //CATCH_REQUIRE(unicode_range->get_integer() == range.f_range); -- there was an overflow csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: unicode character too large, range is U+000000 to U+10FFFF.\n"); + VERIFY_ERRORS("test.css(1): error: unicode character too large, range is U+000000 to U+10FFFF.\n"); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // check with the second unicode too large @@ -5421,18 +5441,18 @@ TEST_CASE("Unicode range", "[lexer] [unicode]") // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - //REQUIRE(unicode_range->get_integer() == range.f_range); -- there was an overflow + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + //CATCH_REQUIRE(unicode_range->get_integer() == range.f_range); -- there was an overflow csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: unicode character too large, range is U+000000 to U+10FFFF.\n"); + VERIFY_ERRORS("test.css(1): error: unicode character too large, range is U+000000 to U+10FFFF.\n"); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // check with a mask which is too large @@ -5462,18 +5482,18 @@ TEST_CASE("Unicode range", "[lexer] [unicode]") // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - //REQUIRE(unicode_range->get_integer() == range.f_range); -- there was an overflow, what could we check? + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + //CATCH_REQUIRE(unicode_range->get_integer() == range.f_range); -- there was an overflow, what could we check? csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: unicode character too large, range is U+000000 to U+10FFFF.\n"); + VERIFY_ERRORS("test.css(1): error: unicode character too large, range is U+000000 to U+10FFFF.\n"); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } } @@ -5505,48 +5525,48 @@ TEST_CASE("Unicode range", "[lexer] [unicode]") // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - REQUIRE(unicode_range->get_integer() == range.get_range()); + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + CATCH_REQUIRE(unicode_range->get_integer() == static_cast(range.get_range())); csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // comma { csspp::node::pointer_t whitespace(l.next_token()); - REQUIRE(whitespace->is(csspp::node_type_t::COMMA)); + CATCH_REQUIRE(whitespace->is(csspp::node_type_t::COMMA)); csspp::position const & npos(whitespace->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // unicode range { csspp::node::pointer_t unicode_range(l.next_token()); - REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); - //REQUIRE(unicode_range->get_integer() == range.f_range); -- we get an error, we know what the range is, but we do not want to assume so in the test + CATCH_REQUIRE(unicode_range->is(csspp::node_type_t::UNICODE_RANGE)); + //CATCH_REQUIRE(unicode_range->get_integer() == range.f_range); -- we get an error, we know what the range is, but we do not want to assume so in the test csspp::position const & npos(unicode_range->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: unicode range cannot have a start character larger than the end character.\n"); + VERIFY_ERRORS("test.css(1): error: unicode range cannot have a start character larger than the end character.\n"); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Hash", "[lexer] [hash]") +CATCH_TEST_CASE("Hash", "[lexer] [hash]") { // test a standard hash { @@ -5558,16 +5578,16 @@ TEST_CASE("Hash", "[lexer] [hash]") // hash { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::HASH)); - REQUIRE(identifier->get_string() == "-escape=33-"); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::HASH)); + CATCH_REQUIRE(identifier->get_string() == "-escape=33-"); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // generate a set of simple and valid hashes @@ -5607,16 +5627,16 @@ TEST_CASE("Hash", "[lexer] [hash]") // hash { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::HASH)); - REQUIRE(identifier->get_string() == word); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::HASH)); + CATCH_REQUIRE(identifier->get_string() == word); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // test a standard hash @@ -5629,45 +5649,45 @@ TEST_CASE("Hash", "[lexer] [hash]") // hash { csspp::node::pointer_t hash(l.next_token()); - REQUIRE(hash->is(csspp::node_type_t::HASH)); - REQUIRE(hash->get_string() == "-escape"); + CATCH_REQUIRE(hash->is(csspp::node_type_t::HASH)); + CATCH_REQUIRE(hash->get_string() == "-escape"); csspp::position const & npos(hash->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: escape character '\\0' is not acceptable in CSS.\n"); + VERIFY_ERRORS("test.css(1): error: escape character '\\0' is not acceptable in CSS.\n"); } // integer { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::INTEGER)); - REQUIRE(identifier->get_integer() == 33); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::INTEGER)); + CATCH_REQUIRE(identifier->get_integer() == 33); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // subtract { csspp::node::pointer_t subtract(l.next_token()); - REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); + CATCH_REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); csspp::position const & npos(subtract->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } } -TEST_CASE("Invalid hash", "[lexer] [hash]") +CATCH_TEST_CASE("Invalid hash", "[lexer] [hash]") { // test an empty hash { @@ -5679,28 +5699,28 @@ TEST_CASE("Invalid hash", "[lexer] [hash]") // identifier (empty) { csspp::node::pointer_t hash(l.next_token()); - REQUIRE(hash->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(hash->get_string() == "empty"); + CATCH_REQUIRE(hash->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(hash->get_string() == "empty"); csspp::position const & npos(hash->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // whitespace { csspp::node::pointer_t hash(l.next_token()); - REQUIRE(hash->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(hash->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(hash->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // hash @@ -5709,36 +5729,36 @@ TEST_CASE("Invalid hash", "[lexer] [hash]") // whitespace { csspp::node::pointer_t hash(l.next_token()); - REQUIRE(hash->is(csspp::node_type_t::WHITESPACE)); + CATCH_REQUIRE(hash->is(csspp::node_type_t::WHITESPACE)); csspp::position const & npos(hash->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: '#' by itself is not valid.\n"); + VERIFY_ERRORS("test.css(1): error: '#' by itself is not valid.\n"); } // identifier (here) { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(identifier->get_string() == "here"); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(identifier->get_string() == "here"); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Placeholders", "[lexer] [hash]") +CATCH_TEST_CASE("Placeholders", "[lexer] [hash]") { // test a standard placeholder { @@ -5750,16 +5770,16 @@ TEST_CASE("Placeholders", "[lexer] [hash]") // hash { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::PLACEHOLDER)); - REQUIRE(identifier->get_string() == "es-cape=33-"); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::PLACEHOLDER)); + CATCH_REQUIRE(identifier->get_string() == "es-cape=33-"); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // generate a set of simple and valid placeholders @@ -5801,17 +5821,17 @@ TEST_CASE("Placeholders", "[lexer] [hash]") // placeholder { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::PLACEHOLDER)); - REQUIRE(identifier->get_string() == word); - REQUIRE(identifier->get_lowercase_string() == lword); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::PLACEHOLDER)); + CATCH_REQUIRE(identifier->get_string() == word); + CATCH_REQUIRE(identifier->get_lowercase_string() == lword); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // test a standard placeholder @@ -5824,48 +5844,48 @@ TEST_CASE("Placeholders", "[lexer] [hash]") // placeholder { csspp::node::pointer_t hash(l.next_token()); - REQUIRE(hash->is(csspp::node_type_t::PLACEHOLDER)); - REQUIRE(hash->get_string() == "es-cape"); + CATCH_REQUIRE(hash->is(csspp::node_type_t::PLACEHOLDER)); + CATCH_REQUIRE(hash->get_string() == "es-cape"); csspp::position const & npos(hash->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); - REQUIRE_ERRORS("test.css(1): error: escape character '\\0' is not acceptable in CSS.\n"); + VERIFY_ERRORS("test.css(1): error: escape character '\\0' is not acceptable in CSS.\n"); } // integer { csspp::node::pointer_t identifier(l.next_token()); - REQUIRE(identifier->is(csspp::node_type_t::INTEGER)); - REQUIRE(identifier->get_integer() == 33); + CATCH_REQUIRE(identifier->is(csspp::node_type_t::INTEGER)); + CATCH_REQUIRE(identifier->get_integer() == 33); csspp::position const & npos(identifier->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // subtract { csspp::node::pointer_t subtract(l.next_token()); - REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); + CATCH_REQUIRE(subtract->is(csspp::node_type_t::SUBTRACT)); csspp::position const & npos(subtract->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Variables", "[lexer] [variable]") +CATCH_TEST_CASE("Variables", "[lexer] [variable]") { // test variables for(int i(0); i < 1000; ++i) @@ -5912,19 +5932,19 @@ TEST_CASE("Variables", "[lexer] [variable]") // variable { csspp::node::pointer_t variable(l.next_token()); - REQUIRE(variable->is(csspp::node_type_t::VARIABLE)); - REQUIRE(variable->get_string() == lword); + CATCH_REQUIRE(variable->is(csspp::node_type_t::VARIABLE)); + CATCH_REQUIRE(variable->get_string() == lword); csspp::position const & npos(variable->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // test variable functions @@ -5972,50 +5992,43 @@ TEST_CASE("Variables", "[lexer] [variable]") // variable function { csspp::node::pointer_t variable(l.next_token()); - REQUIRE(variable->is(csspp::node_type_t::VARIABLE_FUNCTION)); - REQUIRE(variable->get_string() == lword); + CATCH_REQUIRE(variable->is(csspp::node_type_t::VARIABLE_FUNCTION)); + CATCH_REQUIRE(variable->get_string() == lword); csspp::position const & npos(variable->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // args { csspp::node::pointer_t variable(l.next_token()); - REQUIRE(variable->is(csspp::node_type_t::IDENTIFIER)); - REQUIRE(variable->get_string() == "args"); + CATCH_REQUIRE(variable->is(csspp::node_type_t::IDENTIFIER)); + CATCH_REQUIRE(variable->get_string() == "args"); csspp::position const & npos(variable->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } // ')' { csspp::node::pointer_t variable(l.next_token()); - REQUIRE(variable->is(csspp::node_type_t::CLOSE_PARENTHESIS)); + CATCH_REQUIRE(variable->is(csspp::node_type_t::CLOSE_PARENTHESIS)); csspp::position const & npos(variable->get_position()); - REQUIRE(npos.get_filename() == "test.css"); - REQUIRE(npos.get_page() == 1); - REQUIRE(npos.get_line() == 1); - REQUIRE(npos.get_total_line() == 1); + CATCH_REQUIRE(npos.get_filename() == "test.css"); + CATCH_REQUIRE(npos.get_page() == 1); + CATCH_REQUIRE(npos.get_line() == 1); + CATCH_REQUIRE(npos.get_total_line() == 1); } - REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); + CATCH_REQUIRE(l.next_token()->is(csspp::node_type_t::EOF_TOKEN)); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_tests.cpp b/tests/catch_main.cpp similarity index 97% rename from tests/catch_tests.cpp rename to tests/catch_main.cpp index 185ddea..0230544 100644 --- a/tests/catch_tests.cpp +++ b/tests/catch_main.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief csspp main unit test. @@ -26,15 +28,32 @@ // Tell catch we want it to add the runner code in this file. #define CATCH_CONFIG_RUNNER -#include "catch_tests.h" +// self +// +#include "catch_main.h" -#include "csspp/csspp.h" -#include "csspp/error.h" -#include "csspp/node.h" -#include +// csspp lib +// +#include +#include +#include + + +// C++ lib +// +#include + + +// C lib +// +#include + + +// last include +// +#include -#include namespace csspp_test { @@ -87,7 +106,7 @@ void trace_error::expected_error(std::string const & msg, char const * filename, // print a message otherwise filename & line get lost std::cerr << filename << "(" << line << "): error: error messages are not equal.\n"; // LCOV_EXCL_LINE } - REQUIRE(e == msg); + CATCH_REQUIRE(e == msg); } our_unicode_range_t::our_unicode_range_t(csspp::wide_char_t start, csspp::wide_char_t end) @@ -157,7 +176,7 @@ void compare(std::string const & generated, std::string const & expected, char c { std::cerr << filename << "(" << line << "):error: compare trees: on line " << pos << ": \"" << gs << "\" != \"" << es << "\".\n"; // LCOV_EXCL_LINE } - REQUIRE(gs == es); + CATCH_REQUIRE(gs == es); } if(*g != '\0' && *e != '\0') @@ -169,13 +188,13 @@ void compare(std::string const & generated, std::string const & expected, char c { std::cerr << filename << "(" << line << "):error: compare trees: on line " << pos << ": end of expected reached, still have \"" << g << "\" left in generated.\n"; // LCOV_EXCL_LINE } - REQUIRE(*g == '\0'); + CATCH_REQUIRE(*g == '\0'); if(*e != '\0') { std::cerr << filename << "(" << line << "):error: compare trees: on line " << pos << ": end of generated reached, still have \"" << e << "\" left in expected.\n"; // LCOV_EXCL_LINE } - REQUIRE(*e == '\0'); + CATCH_REQUIRE(*e == '\0'); } std::string get_script_path() @@ -875,11 +894,4 @@ int main(int argc, char *argv[]) return Catch::Session().run(argc, argv); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_tests.h b/tests/catch_main.h similarity index 74% rename from tests/catch_tests.h rename to tests/catch_main.h index 867c18a..e32ad84 100644 --- a/tests/catch_tests.h +++ b/tests/catch_main.h @@ -1,7 +1,7 @@ -#ifndef CSSPP_TESTS_H -#define CSSPP_TESTS_H -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -13,20 +13,28 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#pragma once /** \file - * \brief Common header for all our catch tests. + * \brief Common header for all our catch2 tests. * * csspp comes with a unit test suite. This header defines things - * that all the tests access, such as the catch.hpp header file. + * that all the tests access, such as the snapcatch2.hpp header file. */ -#include +// catch2 lib +// +#include + + +// csspp lib +// +#include + -#include namespace csspp_test { @@ -47,7 +55,7 @@ class trace_error bool m_verbose = false; }; -#define REQUIRE_ERRORS( msg ) ::csspp_test::trace_error::instance().expected_error((msg), __FILE__, __LINE__) +#define VERIFY_ERRORS(msg) ::csspp_test::trace_error::instance().expected_error((msg), __FILE__, __LINE__) class our_unicode_range_t { @@ -69,7 +77,7 @@ class our_unicode_range_t // this compares two resulting trees, line by line void compare(std::string const & generated, std::string const & expected, char const * filename, int line); -#define REQUIRE_TREES( a, b ) ::csspp_test::compare((a), (b), __FILE__, __LINE__) +#define VERIFY_TREES(a, b) ::csspp_test::compare((a), (b), __FILE__, __LINE__) typedef uint64_t default_variables_flags_t; @@ -82,14 +90,4 @@ std::string get_close_comment(bool token = false); time_t get_now(); } // csspp_test namespace -#endif -// #ifndef CSSPP_TESTS_H - -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_node.cpp b/tests/catch_node.cpp index 4825b92..a82fccc 100644 --- a/tests/catch_node.cpp +++ b/tests/catch_node.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the node.cpp file. @@ -22,17 +24,35 @@ * implementation to ensure full coverage. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + -#include "csspp/exceptions.h" -#include "csspp/lexer.h" -#include "csspp/unicode_range.h" +// csspp lib +// +#include +#include +#include + + +// C++ lib +// +#include +#include -#include -#include +// C lib +// #include + +// last include +// +#include + + + namespace { @@ -40,7 +60,7 @@ namespace } // no name namespace -TEST_CASE("Node types", "[node] [type]") +CATCH_TEST_CASE("Node types", "[node] [type]") { // we expect the test suite to be compiled with the exact same version csspp::node_type_t w(csspp::node_type_t::UNKNOWN); @@ -50,12 +70,12 @@ TEST_CASE("Node types", "[node] [type]") csspp::node::pointer_t n(new csspp::node(w, pos)); // verify the type - REQUIRE(n->get_type() == w); + CATCH_REQUIRE(n->get_type() == w); n->set_flag("important", true); - REQUIRE(n->get_flag("important")); + CATCH_REQUIRE(n->get_flag("important")); n->set_flag("important", false); - REQUIRE_FALSE(n->get_flag("important")); + CATCH_REQUIRE_FALSE(n->get_flag("important")); // boolean switch(w) @@ -65,14 +85,14 @@ TEST_CASE("Node types", "[node] [type]") { bool b(rand() % 1 == 0); n->set_boolean(b); - REQUIRE(n->get_boolean() == b); + CATCH_REQUIRE(n->get_boolean() == b); if(w == csspp::node_type_t::OPEN_CURLYBRACKET) { - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_INVALID); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_INVALID); } else { - REQUIRE(n->to_boolean() == (b ? csspp::boolean_t::BOOLEAN_TRUE : csspp::boolean_t::BOOLEAN_FALSE)); + CATCH_REQUIRE(n->to_boolean() == (b ? csspp::boolean_t::BOOLEAN_TRUE : csspp::boolean_t::BOOLEAN_FALSE)); } } break; @@ -83,17 +103,17 @@ TEST_CASE("Node types", "[node] [type]") { bool b(rand() % 1 == 0); n->set_boolean(b); - REQUIRE(n->get_boolean() == b); + CATCH_REQUIRE(n->get_boolean() == b); // the to_boolean() converts the value not the f_boolean field // this test MUST happen before the next or we would not know // whether it true or false - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); } break; default: - REQUIRE_THROWS_AS(n->set_boolean(true), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->get_boolean(), csspp::csspp_exception_logic &); + CATCH_REQUIRE_THROWS_AS(n->set_boolean(true), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->get_boolean(), csspp::csspp_exception_logic); break; } @@ -110,21 +130,21 @@ TEST_CASE("Node types", "[node] [type]") { if(w == csspp::node_type_t::INTEGER) { - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); } csspp::integer_t i(static_cast(rand()) + (static_cast(rand()) << 32)); n->set_integer(i); - REQUIRE(n->get_integer() == i); + CATCH_REQUIRE(n->get_integer() == i); if(w == csspp::node_type_t::INTEGER) { - REQUIRE(n->to_boolean() == (i != 0 ? csspp::boolean_t::BOOLEAN_TRUE : csspp::boolean_t::BOOLEAN_FALSE)); + CATCH_REQUIRE(n->to_boolean() == (i != 0 ? csspp::boolean_t::BOOLEAN_TRUE : csspp::boolean_t::BOOLEAN_FALSE)); } } break; default: - REQUIRE_THROWS_AS(n->set_integer(123), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->get_integer(), csspp::csspp_exception_logic &); + CATCH_REQUIRE_THROWS_AS(n->set_integer(123), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->get_integer(), csspp::csspp_exception_logic); break; } @@ -134,27 +154,21 @@ TEST_CASE("Node types", "[node] [type]") { case csspp::node_type_t::DECIMAL_NUMBER: case csspp::node_type_t::PERCENT: - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); n->set_decimal_number(123.456); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wfloat-equal" - REQUIRE(n->get_decimal_number() == 123.456); -#pragma GCC diagnostic pop - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_TRUE); + CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(n->get_decimal_number(), 123.456, 0.0)); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_TRUE); break; case csspp::node_type_t::FRAME: // no boolean for FRAME (TBD?) n->set_decimal_number(123.456); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wfloat-equal" - REQUIRE(n->get_decimal_number() == 123.456); -#pragma GCC diagnostic pop + CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(n->get_decimal_number(), 123.456, 0.0)); break; default: - REQUIRE_THROWS_AS(n->set_decimal_number(3.14159), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->get_decimal_number(), csspp::csspp_exception_logic &); + CATCH_REQUIRE_THROWS_AS(n->set_decimal_number(3.14159), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->get_decimal_number(), csspp::csspp_exception_logic); break; } @@ -178,35 +192,35 @@ TEST_CASE("Node types", "[node] [type]") case csspp::node_type_t::VARIABLE_FUNCTION: if(w == csspp::node_type_t::STRING) { - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); } n->set_lowercase_string("test-boolean-string"); - REQUIRE(n->get_lowercase_string() == "test-boolean-string"); - REQUIRE(n->get_string() == ""); + CATCH_REQUIRE(n->get_lowercase_string() == "test-boolean-string"); + CATCH_REQUIRE(n->get_string() == ""); if(w == csspp::node_type_t::STRING) { // the lowercase string has no effect on the boolean value - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); } n->set_string("test-string"); - REQUIRE(n->get_string() == "test-string"); - REQUIRE(n->get_lowercase_string() == "test-boolean-string"); + CATCH_REQUIRE(n->get_string() == "test-string"); + CATCH_REQUIRE(n->get_lowercase_string() == "test-boolean-string"); if(w == csspp::node_type_t::STRING) { - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_TRUE); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_TRUE); } n->set_lowercase_string("test-lowercase-string"); - REQUIRE(n->get_lowercase_string() == "test-lowercase-string"); - REQUIRE(n->get_string() == "test-string"); + CATCH_REQUIRE(n->get_lowercase_string() == "test-lowercase-string"); + CATCH_REQUIRE(n->get_string() == "test-string"); if(w == csspp::node_type_t::STRING) { - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_TRUE); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_TRUE); } break; default: - REQUIRE_THROWS_AS(n->set_string("add"), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->get_string(), csspp::csspp_exception_logic &); + CATCH_REQUIRE_THROWS_AS(n->set_string("add"), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->get_string(), csspp::csspp_exception_logic); break; } @@ -219,27 +233,27 @@ TEST_CASE("Node types", "[node] [type]") { // by default a color is black (transparent) and thus // represents false - REQUIRE_FALSE(n->to_boolean()); + CATCH_REQUIRE_FALSE(n->to_boolean()); c.set_color(rand() % 255, rand() % 255, rand() % 255, rand() % 255); n->set_color(c); csspp::color d(n->get_color()); - REQUIRE(c.get_color() == d.get_color()); + CATCH_REQUIRE(c.get_color() == d.get_color()); if((c.get_color() & 0x00FFFFFF) == 0) { // we tested with black... so it is still false - REQUIRE_FALSE(n->to_boolean()); + CATCH_REQUIRE_FALSE(n->to_boolean()); } else { // otherwise we have a "true color" - REQUIRE(n->to_boolean()); + CATCH_REQUIRE(n->to_boolean()); } } break; default: - REQUIRE_THROWS_AS(n->set_color(c), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->get_color(), csspp::csspp_exception_logic &); + CATCH_REQUIRE_THROWS_AS(n->set_color(c), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->get_color(), csspp::csspp_exception_logic); break; } @@ -253,50 +267,47 @@ TEST_CASE("Node types", "[node] [type]") n->set_dim1("px"); n->set_line_height(24.3); n->set_dim2("%"); - //REQUIRE(n->get_string() == "px/%"); -- we do not allow get_string() - //REQUIRE(n->get_integer() == 12.5 as a double); -- we do not allow get_integer() - //REQUIRE(n->get_decimal_number() == 24.3); -- we do not allow get_decimal_number() -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wfloat-equal" - REQUIRE(n->get_font_size() == 12.5); - REQUIRE(n->get_dim1() == "px"); - REQUIRE(n->get_line_height() == 24.3); - REQUIRE(n->get_dim2() == "%"); -#pragma GCC diagnostic pop + //CATCH_REQUIRE(n->get_string() == "px/%"); -- we do not allow get_string() + //CATCH_REQUIRE(n->get_integer() == 12.5 as a double); -- we do not allow get_integer() + //CATCH_REQUIRE(n->get_decimal_number() == 24.3); -- we do not allow get_decimal_number() + CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(n->get_font_size(), 12.5, 0.0)); + CATCH_REQUIRE(n->get_dim1() == "px"); + CATCH_REQUIRE(SNAP_CATCH2_NAMESPACE::nearly_equal(n->get_line_height(), 24.3, 0.0)); + CATCH_REQUIRE(n->get_dim2() == "%"); // dimensions require a few more tests n->set_dim2("deg"); // chane dim2 - REQUIRE(n->get_dim1() == "px"); - REQUIRE(n->get_dim2() == "deg"); + CATCH_REQUIRE(n->get_dim1() == "px"); + CATCH_REQUIRE(n->get_dim2() == "deg"); n->set_dim2(""); // remove dim2 - REQUIRE(n->get_dim1() == "px"); - REQUIRE(n->get_dim2() == ""); + CATCH_REQUIRE(n->get_dim1() == "px"); + CATCH_REQUIRE(n->get_dim2() == ""); n->set_dim1(""); // remove dim1 - REQUIRE(n->get_dim1() == ""); - REQUIRE(n->get_dim2() == ""); + CATCH_REQUIRE(n->get_dim1() == ""); + CATCH_REQUIRE(n->get_dim2() == ""); n->set_dim2("em"); // set dim2 without a dim1 - REQUIRE(n->get_dim1() == ""); - REQUIRE(n->get_dim2() == "em"); + CATCH_REQUIRE(n->get_dim1() == ""); + CATCH_REQUIRE(n->get_dim2() == "em"); n->set_dim1("px"); // set a dim1 with a dim2 - REQUIRE(n->get_dim1() == "px"); - REQUIRE(n->get_dim2() == "em"); + CATCH_REQUIRE(n->get_dim1() == "px"); + CATCH_REQUIRE(n->get_dim2() == "em"); n->set_dim1(""); // remove dim1 with a dim2 - REQUIRE(n->get_dim1() == ""); - REQUIRE(n->get_dim2() == "em"); + CATCH_REQUIRE(n->get_dim1() == ""); + CATCH_REQUIRE(n->get_dim2() == "em"); n->set_dim2(""); // remove dim2 without a dim1 - REQUIRE(n->get_dim1() == ""); - REQUIRE(n->get_dim2() == ""); + CATCH_REQUIRE(n->get_dim1() == ""); + CATCH_REQUIRE(n->get_dim2() == ""); break; default: - REQUIRE_THROWS_AS(n->set_font_size(12.5), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->get_font_size(), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->set_line_height(24.3), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->get_line_height(), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->set_dim1("px"), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->get_dim1(), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->set_dim2("%"), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->get_dim2(), csspp::csspp_exception_logic &); + CATCH_REQUIRE_THROWS_AS(n->set_font_size(12.5), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->get_font_size(), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->set_line_height(24.3), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->get_line_height(), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->set_dim1("px"), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->get_dim1(), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->set_dim2("%"), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->get_dim2(), csspp::csspp_exception_logic); break; } @@ -321,14 +332,14 @@ TEST_CASE("Node types", "[node] [type]") // try adding one child if(w == csspp::node_type_t::LIST) { - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); } - REQUIRE(n->empty()); - REQUIRE(n->size() == 0); - REQUIRE_THROWS_AS(n->get_child(0), csspp::csspp_exception_overflow &); - REQUIRE_THROWS_AS(n->get_last_child(), csspp::csspp_exception_overflow &); - REQUIRE_THROWS_AS(n->remove_child(0), csspp::csspp_exception_overflow &); - REQUIRE_THROWS_AS(n->remove_child(n), csspp::csspp_exception_logic &); + CATCH_REQUIRE(n->empty()); + CATCH_REQUIRE(n->size() == 0); + CATCH_REQUIRE_THROWS_AS(n->get_child(0), csspp::csspp_exception_overflow); + CATCH_REQUIRE_THROWS_AS(n->get_last_child(), csspp::csspp_exception_overflow); + CATCH_REQUIRE_THROWS_AS(n->remove_child(0), csspp::csspp_exception_overflow); + CATCH_REQUIRE_THROWS_AS(n->remove_child(n), csspp::csspp_exception_logic); csspp::node::pointer_t child1(new csspp::node(csspp::node_type_t::COMMA, n->get_position())); csspp::node::pointer_t child2(new csspp::node(csspp::node_type_t::EXCLAMATION, n->get_position())); @@ -339,37 +350,37 @@ TEST_CASE("Node types", "[node] [type]") n->add_child(child1); if(w == csspp::node_type_t::LIST) { - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_TRUE); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_TRUE); } - REQUIRE(n->size() == 1); - REQUIRE_FALSE(n->empty()); - REQUIRE(n->get_last_child() == child1); - REQUIRE(n->get_child(0) == child1); - REQUIRE_THROWS_AS(n->remove_child(n), csspp::csspp_exception_logic &); + CATCH_REQUIRE(n->size() == 1); + CATCH_REQUIRE_FALSE(n->empty()); + CATCH_REQUIRE(n->get_last_child() == child1); + CATCH_REQUIRE(n->get_child(0) == child1); + CATCH_REQUIRE_THROWS_AS(n->remove_child(n), csspp::csspp_exception_logic); n->add_child(child2); if(w == csspp::node_type_t::LIST) { - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_TRUE); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_TRUE); } - REQUIRE(n->size() == 2); - REQUIRE_FALSE(n->empty()); - REQUIRE(n->get_last_child() == child2); - REQUIRE(n->get_child(0) == child1); - REQUIRE(n->get_child(1) == child2); - REQUIRE_THROWS_AS(n->remove_child(n), csspp::csspp_exception_logic &); + CATCH_REQUIRE(n->size() == 2); + CATCH_REQUIRE_FALSE(n->empty()); + CATCH_REQUIRE(n->get_last_child() == child2); + CATCH_REQUIRE(n->get_child(0) == child1); + CATCH_REQUIRE(n->get_child(1) == child2); + CATCH_REQUIRE_THROWS_AS(n->remove_child(n), csspp::csspp_exception_logic); if(rand() & 1) { n->remove_child(0); - REQUIRE(n->size() == 1); + CATCH_REQUIRE(n->size() == 1); n->remove_child(child2); } else { n->remove_child(child2); - REQUIRE(n->size() == 1); + CATCH_REQUIRE(n->size() == 1); n->remove_child(0); } @@ -377,70 +388,70 @@ TEST_CASE("Node types", "[node] [type]") // fully empty again, all fails like follow if(w == csspp::node_type_t::LIST) { - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); } - REQUIRE(n->empty()); - REQUIRE(n->size() == 0); - REQUIRE_THROWS_AS(n->get_child(0), csspp::csspp_exception_overflow &); - REQUIRE_THROWS_AS(n->get_last_child(), csspp::csspp_exception_overflow &); - REQUIRE_THROWS_AS(n->remove_child(0), csspp::csspp_exception_overflow &); - REQUIRE_THROWS_AS(n->remove_child(n), csspp::csspp_exception_logic &); + CATCH_REQUIRE(n->empty()); + CATCH_REQUIRE(n->size() == 0); + CATCH_REQUIRE_THROWS_AS(n->get_child(0), csspp::csspp_exception_overflow); + CATCH_REQUIRE_THROWS_AS(n->get_last_child(), csspp::csspp_exception_overflow); + CATCH_REQUIRE_THROWS_AS(n->remove_child(0), csspp::csspp_exception_overflow); + CATCH_REQUIRE_THROWS_AS(n->remove_child(n), csspp::csspp_exception_logic); // test a few more things n->add_child(child1); - REQUIRE(n->size() == 1); + CATCH_REQUIRE(n->size() == 1); n->insert_child(1, whitespace1); - REQUIRE(n->size() == 2); + CATCH_REQUIRE(n->size() == 2); n->add_child(whitespace2); // ignore two whitespaces in a row - REQUIRE(n->size() == 2); + CATCH_REQUIRE(n->size() == 2); n->insert_child(0, child2); - REQUIRE(n->size() == 3); + CATCH_REQUIRE(n->size() == 3); n->add_child(eof_token); // never add EOF_TOKEN - REQUIRE(n->size() == 3); - REQUIRE(n->get_child(0) == child2); - REQUIRE(n->get_child(1) == child1); - REQUIRE(n->get_child(2) == whitespace1); - REQUIRE(n->child_position(child1) == 1); - REQUIRE(n->child_position(child2) == 0); - REQUIRE(n->child_position(whitespace1) == 2); - REQUIRE(n->child_position(whitespace2) == csspp::node::npos); - REQUIRE(n->child_position(eof_token) == csspp::node::npos); + CATCH_REQUIRE(n->size() == 3); + CATCH_REQUIRE(n->get_child(0) == child2); + CATCH_REQUIRE(n->get_child(1) == child1); + CATCH_REQUIRE(n->get_child(2) == whitespace1); + CATCH_REQUIRE(n->child_position(child1) == 1); + CATCH_REQUIRE(n->child_position(child2) == 0); + CATCH_REQUIRE(n->child_position(whitespace1) == 2); + CATCH_REQUIRE(n->child_position(whitespace2) == csspp::node::npos); + CATCH_REQUIRE(n->child_position(eof_token) == csspp::node::npos); n->clear(); - REQUIRE(n->size() == 0); - REQUIRE(n->child_position(child1) == csspp::node::npos); - REQUIRE(n->child_position(child2) == csspp::node::npos); - REQUIRE(n->child_position(whitespace1) == csspp::node::npos); - REQUIRE(n->child_position(whitespace2) == csspp::node::npos); - REQUIRE(n->child_position(eof_token) == csspp::node::npos); + CATCH_REQUIRE(n->size() == 0); + CATCH_REQUIRE(n->child_position(child1) == csspp::node::npos); + CATCH_REQUIRE(n->child_position(child2) == csspp::node::npos); + CATCH_REQUIRE(n->child_position(whitespace1) == csspp::node::npos); + CATCH_REQUIRE(n->child_position(whitespace2) == csspp::node::npos); + CATCH_REQUIRE(n->child_position(eof_token) == csspp::node::npos); // test the replace n->add_child(child1); - REQUIRE(n->size() == 1); - REQUIRE(n->get_child(0) == child1); + CATCH_REQUIRE(n->size() == 1); + CATCH_REQUIRE(n->get_child(0) == child1); n->replace_child(child1, child2); - REQUIRE(n->size() == 1); - REQUIRE(n->get_child(0) == child2); + CATCH_REQUIRE(n->size() == 1); + CATCH_REQUIRE(n->get_child(0) == child2); csspp::node::pointer_t list(new csspp::node(csspp::node_type_t::LIST, n->get_position())); n->add_child(child1); list->take_over_children_of(n); - REQUIRE(n->size() == 0); - REQUIRE(list->size() == 2); - REQUIRE(list->get_child(0) == child2); - REQUIRE(list->get_child(1) == child1); + CATCH_REQUIRE(n->size() == 0); + CATCH_REQUIRE(list->size() == 2); + CATCH_REQUIRE(list->get_child(0) == child2); + CATCH_REQUIRE(list->get_child(1) == child1); } break; default: - REQUIRE_THROWS_AS(n->empty(), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->size(), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->clear(), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->add_child(n), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->remove_child(n), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->remove_child(0), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->get_child(0), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->get_last_child(), csspp::csspp_exception_logic &); - REQUIRE_THROWS_AS(n->take_over_children_of(0), csspp::csspp_exception_logic &); + CATCH_REQUIRE_THROWS_AS(n->empty(), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->size(), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->clear(), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->add_child(n), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->remove_child(n), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->remove_child(0), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->get_child(0), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->get_last_child(), csspp::csspp_exception_logic); + CATCH_REQUIRE_THROWS_AS(n->take_over_children_of(0), csspp::csspp_exception_logic); break; } @@ -461,7 +472,7 @@ TEST_CASE("Node types", "[node] [type]") break; default: - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_INVALID); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_INVALID); break; } @@ -471,10 +482,10 @@ TEST_CASE("Node types", "[node] [type]") } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid tree handling", "[node] [invalid]") +CATCH_TEST_CASE("Invalid tree handling", "[node] [invalid]") { // replace with an invalid child { @@ -489,7 +500,7 @@ TEST_CASE("Invalid tree handling", "[node] [invalid]") n->add_child(child1); // child2, child1 are inverted - REQUIRE_THROWS_AS(n->replace_child(child2, child1), csspp::csspp_exception_logic &); + CATCH_REQUIRE_THROWS_AS(n->replace_child(child2, child1), csspp::csspp_exception_logic); } // insert with invalid index @@ -507,42 +518,42 @@ TEST_CASE("Invalid tree handling", "[node] [invalid]") // insert index can be 0 or 1, anything else and it is an overflow for(int i(-100); i < 0; ++i) { - REQUIRE_THROWS_AS(n->insert_child(i, child2), csspp::csspp_exception_overflow &); + CATCH_REQUIRE_THROWS_AS(n->insert_child(i, child2), csspp::csspp_exception_overflow); } for(int i(2); i <= 100; ++i) { - REQUIRE_THROWS_AS(n->insert_child(i, child2), csspp::csspp_exception_overflow &); + CATCH_REQUIRE_THROWS_AS(n->insert_child(i, child2), csspp::csspp_exception_overflow); } } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("True and false", "[node] [type] [output]") +CATCH_TEST_CASE("True and false", "[node] [type] [output]") { // test boolean values from an identifier { csspp::position pos("test.css"); csspp::node::pointer_t n(new csspp::node(csspp::node_type_t::IDENTIFIER, pos)); - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_INVALID); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_INVALID); n->set_string("true"); - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_TRUE); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_TRUE); n->set_string("false"); - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); n->set_string("null"); - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); n->set_string("other"); - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_INVALID); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_INVALID); // fortuitious... n->set_string("invalid"); - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_INVALID); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_INVALID); } // test boolean values from the NULL token @@ -550,14 +561,14 @@ TEST_CASE("True and false", "[node] [type] [output]") csspp::position pos("test.css"); csspp::node::pointer_t n(new csspp::node(csspp::node_type_t::NULL_TOKEN, pos)); - REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); + CATCH_REQUIRE(n->to_boolean() == csspp::boolean_t::BOOLEAN_FALSE); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Node variables", "[node] [variable]") +CATCH_TEST_CASE("Node variables", "[node] [variable]") { // set/get variables { @@ -572,7 +583,7 @@ TEST_CASE("Node variables", "[node] [variable]") t[i + 10]->set_string("test" + nb); n->set_variable("t" + nb, t[i + 10]); - REQUIRE(n->get_variable("t" + nb) == t[i + 10]); + CATCH_REQUIRE(n->get_variable("t" + nb) == t[i + 10]); } // check contents again @@ -581,8 +592,8 @@ TEST_CASE("Node variables", "[node] [variable]") std::string nb(std::to_string(i)); csspp::node::pointer_t p(n->get_variable("t" + nb)); - REQUIRE(p == t[i + 10]); - REQUIRE(p->get_string() == "test" + nb); + CATCH_REQUIRE(p == t[i + 10]); + CATCH_REQUIRE(p->get_string() == "test" + nb); } n->clear_variables(); @@ -593,15 +604,15 @@ TEST_CASE("Node variables", "[node] [variable]") std::string nb(std::to_string(i)); csspp::node::pointer_t p(n->get_variable("t" + nb)); - REQUIRE(!p); + CATCH_REQUIRE(!p); } } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Node flags", "[node] [flag]") +CATCH_TEST_CASE("Node flags", "[node] [flag]") { // read/write flags { @@ -613,11 +624,11 @@ TEST_CASE("Node flags", "[node] [flag]") std::string nb("t" + std::to_string(i)); n->set_flag(nb, true); - REQUIRE(n->get_flag(nb)); + CATCH_REQUIRE(n->get_flag(nb)); n->set_flag(nb, false); - REQUIRE_FALSE(n->get_flag(nb)); + CATCH_REQUIRE_FALSE(n->get_flag(nb)); n->set_flag(nb, true); - REQUIRE(n->get_flag(nb)); + CATCH_REQUIRE(n->get_flag(nb)); } // check contents again @@ -625,7 +636,7 @@ TEST_CASE("Node flags", "[node] [flag]") { std::string nb("t" + std::to_string(i)); - REQUIRE(n->get_flag(nb)); + CATCH_REQUIRE(n->get_flag(nb)); } n->clear_flags(); @@ -635,15 +646,15 @@ TEST_CASE("Node flags", "[node] [flag]") { std::string nb("t" + std::to_string(i)); - REQUIRE_FALSE(n->get_flag(nb)); + CATCH_REQUIRE_FALSE(n->get_flag(nb)); } } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Type names", "[node] [type] [output]") +CATCH_TEST_CASE("Type names", "[node] [type] [output]") { // we expect the test suite to be compiled with the exact same version csspp::node_type_t w(csspp::node_type_t::UNKNOWN); @@ -659,276 +670,276 @@ TEST_CASE("Type names", "[node] [type] [output]") switch(w) { case csspp::node_type_t::UNKNOWN: - REQUIRE(name == "UNKNOWN"); + CATCH_REQUIRE(name == "UNKNOWN"); break; case csspp::node_type_t::ADD: - REQUIRE(name == "ADD"); + CATCH_REQUIRE(name == "ADD"); break; case csspp::node_type_t::AND: - REQUIRE(name == "AND"); + CATCH_REQUIRE(name == "AND"); break; case csspp::node_type_t::ASSIGNMENT: - REQUIRE(name == "ASSIGNMENT"); + CATCH_REQUIRE(name == "ASSIGNMENT"); break; case csspp::node_type_t::AT_KEYWORD: - REQUIRE(name == "AT_KEYWORD"); + CATCH_REQUIRE(name == "AT_KEYWORD"); break; case csspp::node_type_t::BOOLEAN: - REQUIRE(name == "BOOLEAN"); + CATCH_REQUIRE(name == "BOOLEAN"); break; case csspp::node_type_t::CDC: - REQUIRE(name == "CDC"); + CATCH_REQUIRE(name == "CDC"); break; case csspp::node_type_t::CDO: - REQUIRE(name == "CDO"); + CATCH_REQUIRE(name == "CDO"); break; case csspp::node_type_t::CLOSE_CURLYBRACKET: - REQUIRE(name == "CLOSE_CURLYBRACKET"); + CATCH_REQUIRE(name == "CLOSE_CURLYBRACKET"); break; case csspp::node_type_t::CLOSE_PARENTHESIS: - REQUIRE(name == "CLOSE_PARENTHESIS"); + CATCH_REQUIRE(name == "CLOSE_PARENTHESIS"); break; case csspp::node_type_t::CLOSE_SQUAREBRACKET: - REQUIRE(name == "CLOSE_SQUAREBRACKET"); + CATCH_REQUIRE(name == "CLOSE_SQUAREBRACKET"); break; case csspp::node_type_t::COLON: - REQUIRE(name == "COLON"); + CATCH_REQUIRE(name == "COLON"); break; case csspp::node_type_t::COLOR: - REQUIRE(name == "COLOR"); + CATCH_REQUIRE(name == "COLOR"); break; case csspp::node_type_t::COLUMN: - REQUIRE(name == "COLUMN"); + CATCH_REQUIRE(name == "COLUMN"); break; case csspp::node_type_t::COMMA: - REQUIRE(name == "COMMA"); + CATCH_REQUIRE(name == "COMMA"); break; case csspp::node_type_t::COMMENT: - REQUIRE(name == "COMMENT"); + CATCH_REQUIRE(name == "COMMENT"); break; case csspp::node_type_t::CONDITIONAL: - REQUIRE(name == "CONDITIONAL"); + CATCH_REQUIRE(name == "CONDITIONAL"); break; case csspp::node_type_t::DASH_MATCH: - REQUIRE(name == "DASH_MATCH"); + CATCH_REQUIRE(name == "DASH_MATCH"); break; case csspp::node_type_t::DECIMAL_NUMBER: - REQUIRE(name == "DECIMAL_NUMBER"); + CATCH_REQUIRE(name == "DECIMAL_NUMBER"); break; case csspp::node_type_t::DIVIDE: - REQUIRE(name == "DIVIDE"); + CATCH_REQUIRE(name == "DIVIDE"); break; case csspp::node_type_t::DOLLAR: - REQUIRE(name == "DOLLAR"); + CATCH_REQUIRE(name == "DOLLAR"); break; case csspp::node_type_t::EOF_TOKEN: - REQUIRE(name == "EOF_TOKEN"); + CATCH_REQUIRE(name == "EOF_TOKEN"); break; case csspp::node_type_t::EQUAL: - REQUIRE(name == "EQUAL"); + CATCH_REQUIRE(name == "EQUAL"); break; case csspp::node_type_t::EXCLAMATION: - REQUIRE(name == "EXCLAMATION"); + CATCH_REQUIRE(name == "EXCLAMATION"); break; case csspp::node_type_t::FONT_METRICS: - REQUIRE(name == "FONT_METRICS"); + CATCH_REQUIRE(name == "FONT_METRICS"); break; case csspp::node_type_t::FUNCTION: - REQUIRE(name == "FUNCTION"); + CATCH_REQUIRE(name == "FUNCTION"); break; case csspp::node_type_t::GREATER_EQUAL: - REQUIRE(name == "GREATER_EQUAL"); + CATCH_REQUIRE(name == "GREATER_EQUAL"); break; case csspp::node_type_t::GREATER_THAN: - REQUIRE(name == "GREATER_THAN"); + CATCH_REQUIRE(name == "GREATER_THAN"); break; case csspp::node_type_t::HASH: - REQUIRE(name == "HASH"); + CATCH_REQUIRE(name == "HASH"); break; case csspp::node_type_t::IDENTIFIER: - REQUIRE(name == "IDENTIFIER"); + CATCH_REQUIRE(name == "IDENTIFIER"); break; case csspp::node_type_t::INCLUDE_MATCH: - REQUIRE(name == "INCLUDE_MATCH"); + CATCH_REQUIRE(name == "INCLUDE_MATCH"); break; case csspp::node_type_t::INTEGER: - REQUIRE(name == "INTEGER"); + CATCH_REQUIRE(name == "INTEGER"); break; case csspp::node_type_t::LESS_EQUAL: - REQUIRE(name == "LESS_EQUAL"); + CATCH_REQUIRE(name == "LESS_EQUAL"); break; case csspp::node_type_t::LESS_THAN: - REQUIRE(name == "LESS_THAN"); + CATCH_REQUIRE(name == "LESS_THAN"); break; case csspp::node_type_t::MODULO: - REQUIRE(name == "MODULO"); + CATCH_REQUIRE(name == "MODULO"); break; case csspp::node_type_t::MULTIPLY: - REQUIRE(name == "MULTIPLY"); + CATCH_REQUIRE(name == "MULTIPLY"); break; case csspp::node_type_t::NOT_EQUAL: - REQUIRE(name == "NOT_EQUAL"); + CATCH_REQUIRE(name == "NOT_EQUAL"); break; case csspp::node_type_t::NULL_TOKEN: - REQUIRE(name == "NULL_TOKEN"); + CATCH_REQUIRE(name == "NULL_TOKEN"); break; case csspp::node_type_t::OPEN_CURLYBRACKET: - REQUIRE(name == "OPEN_CURLYBRACKET"); + CATCH_REQUIRE(name == "OPEN_CURLYBRACKET"); break; case csspp::node_type_t::OPEN_PARENTHESIS: - REQUIRE(name == "OPEN_PARENTHESIS"); + CATCH_REQUIRE(name == "OPEN_PARENTHESIS"); break; case csspp::node_type_t::OPEN_SQUAREBRACKET: - REQUIRE(name == "OPEN_SQUAREBRACKET"); + CATCH_REQUIRE(name == "OPEN_SQUAREBRACKET"); break; case csspp::node_type_t::PERCENT: - REQUIRE(name == "PERCENT"); + CATCH_REQUIRE(name == "PERCENT"); break; case csspp::node_type_t::PERIOD: - REQUIRE(name == "PERIOD"); + CATCH_REQUIRE(name == "PERIOD"); break; case csspp::node_type_t::PLACEHOLDER: - REQUIRE(name == "PLACEHOLDER"); + CATCH_REQUIRE(name == "PLACEHOLDER"); break; case csspp::node_type_t::POWER: - REQUIRE(name == "POWER"); + CATCH_REQUIRE(name == "POWER"); break; case csspp::node_type_t::PRECEDED: - REQUIRE(name == "PRECEDED"); + CATCH_REQUIRE(name == "PRECEDED"); break; case csspp::node_type_t::PREFIX_MATCH: - REQUIRE(name == "PREFIX_MATCH"); + CATCH_REQUIRE(name == "PREFIX_MATCH"); break; case csspp::node_type_t::REFERENCE: - REQUIRE(name == "REFERENCE"); + CATCH_REQUIRE(name == "REFERENCE"); break; case csspp::node_type_t::SCOPE: - REQUIRE(name == "SCOPE"); + CATCH_REQUIRE(name == "SCOPE"); break; case csspp::node_type_t::SEMICOLON: - REQUIRE(name == "SEMICOLON"); + CATCH_REQUIRE(name == "SEMICOLON"); break; case csspp::node_type_t::STRING: - REQUIRE(name == "STRING"); + CATCH_REQUIRE(name == "STRING"); break; case csspp::node_type_t::SUBSTRING_MATCH: - REQUIRE(name == "SUBSTRING_MATCH"); + CATCH_REQUIRE(name == "SUBSTRING_MATCH"); break; case csspp::node_type_t::SUBTRACT: - REQUIRE(name == "SUBTRACT"); + CATCH_REQUIRE(name == "SUBTRACT"); break; case csspp::node_type_t::SUFFIX_MATCH: - REQUIRE(name == "SUFFIX_MATCH"); + CATCH_REQUIRE(name == "SUFFIX_MATCH"); break; case csspp::node_type_t::UNICODE_RANGE: - REQUIRE(name == "UNICODE_RANGE"); + CATCH_REQUIRE(name == "UNICODE_RANGE"); break; case csspp::node_type_t::URL: - REQUIRE(name == "URL"); + CATCH_REQUIRE(name == "URL"); break; case csspp::node_type_t::VARIABLE: - REQUIRE(name == "VARIABLE"); + CATCH_REQUIRE(name == "VARIABLE"); break; case csspp::node_type_t::VARIABLE_FUNCTION: - REQUIRE(name == "VARIABLE_FUNCTION"); + CATCH_REQUIRE(name == "VARIABLE_FUNCTION"); break; case csspp::node_type_t::WHITESPACE: - REQUIRE(name == "WHITESPACE"); + CATCH_REQUIRE(name == "WHITESPACE"); break; // second part case csspp::node_type_t::AN_PLUS_B: - REQUIRE(name == "AN_PLUS_B"); + CATCH_REQUIRE(name == "AN_PLUS_B"); break; case csspp::node_type_t::ARG: - REQUIRE(name == "ARG"); + CATCH_REQUIRE(name == "ARG"); break; case csspp::node_type_t::ARRAY: - REQUIRE(name == "ARRAY"); + CATCH_REQUIRE(name == "ARRAY"); break; case csspp::node_type_t::COMPONENT_VALUE: - REQUIRE(name == "COMPONENT_VALUE"); + CATCH_REQUIRE(name == "COMPONENT_VALUE"); break; case csspp::node_type_t::DECLARATION: - REQUIRE(name == "DECLARATION"); + CATCH_REQUIRE(name == "DECLARATION"); break; case csspp::node_type_t::LIST: - REQUIRE(name == "LIST"); + CATCH_REQUIRE(name == "LIST"); break; case csspp::node_type_t::MAP: - REQUIRE(name == "MAP"); + CATCH_REQUIRE(name == "MAP"); break; case csspp::node_type_t::FRAME: - REQUIRE(name == "FRAME"); + CATCH_REQUIRE(name == "FRAME"); break; case csspp::node_type_t::max_type: - REQUIRE(name == "max_type"); + CATCH_REQUIRE(name == "max_type"); break; } @@ -938,10 +949,10 @@ TEST_CASE("Type names", "[node] [type] [output]") } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Node output", "[node] [output]") +CATCH_TEST_CASE("Node output", "[node] [output]") { // we expect the test suite to be compiled with the exact same version csspp::node_type_t w(csspp::node_type_t::UNKNOWN); @@ -957,276 +968,276 @@ TEST_CASE("Node output", "[node] [output]") switch(w) { case csspp::node_type_t::UNKNOWN: - REQUIRE(name == "UNKNOWN"); + CATCH_REQUIRE(name == "UNKNOWN"); break; case csspp::node_type_t::ADD: - REQUIRE(name == "ADD"); + CATCH_REQUIRE(name == "ADD"); break; case csspp::node_type_t::AND: - REQUIRE(name == "AND"); + CATCH_REQUIRE(name == "AND"); break; case csspp::node_type_t::ASSIGNMENT: - REQUIRE(name == "ASSIGNMENT"); + CATCH_REQUIRE(name == "ASSIGNMENT"); break; case csspp::node_type_t::AT_KEYWORD: - REQUIRE(name == "AT_KEYWORD"); + CATCH_REQUIRE(name == "AT_KEYWORD"); break; case csspp::node_type_t::BOOLEAN: - REQUIRE(name == "BOOLEAN"); + CATCH_REQUIRE(name == "BOOLEAN"); break; case csspp::node_type_t::CDC: - REQUIRE(name == "CDC"); + CATCH_REQUIRE(name == "CDC"); break; case csspp::node_type_t::CDO: - REQUIRE(name == "CDO"); + CATCH_REQUIRE(name == "CDO"); break; case csspp::node_type_t::CLOSE_CURLYBRACKET: - REQUIRE(name == "CLOSE_CURLYBRACKET"); + CATCH_REQUIRE(name == "CLOSE_CURLYBRACKET"); break; case csspp::node_type_t::CLOSE_PARENTHESIS: - REQUIRE(name == "CLOSE_PARENTHESIS"); + CATCH_REQUIRE(name == "CLOSE_PARENTHESIS"); break; case csspp::node_type_t::CLOSE_SQUAREBRACKET: - REQUIRE(name == "CLOSE_SQUAREBRACKET"); + CATCH_REQUIRE(name == "CLOSE_SQUAREBRACKET"); break; case csspp::node_type_t::COLON: - REQUIRE(name == "COLON"); + CATCH_REQUIRE(name == "COLON"); break; case csspp::node_type_t::COLOR: - REQUIRE(name == "COLOR"); + CATCH_REQUIRE(name == "COLOR"); break; case csspp::node_type_t::COLUMN: - REQUIRE(name == "COLUMN"); + CATCH_REQUIRE(name == "COLUMN"); break; case csspp::node_type_t::COMMA: - REQUIRE(name == "COMMA"); + CATCH_REQUIRE(name == "COMMA"); break; case csspp::node_type_t::COMMENT: - REQUIRE(name == "COMMENT"); + CATCH_REQUIRE(name == "COMMENT"); break; case csspp::node_type_t::CONDITIONAL: - REQUIRE(name == "CONDITIONAL"); + CATCH_REQUIRE(name == "CONDITIONAL"); break; case csspp::node_type_t::DASH_MATCH: - REQUIRE(name == "DASH_MATCH"); + CATCH_REQUIRE(name == "DASH_MATCH"); break; case csspp::node_type_t::DECIMAL_NUMBER: - REQUIRE(name == "DECIMAL_NUMBER"); + CATCH_REQUIRE(name == "DECIMAL_NUMBER"); break; case csspp::node_type_t::DIVIDE: - REQUIRE(name == "DIVIDE"); + CATCH_REQUIRE(name == "DIVIDE"); break; case csspp::node_type_t::DOLLAR: - REQUIRE(name == "DOLLAR"); + CATCH_REQUIRE(name == "DOLLAR"); break; case csspp::node_type_t::EOF_TOKEN: - REQUIRE(name == "EOF_TOKEN"); + CATCH_REQUIRE(name == "EOF_TOKEN"); break; case csspp::node_type_t::EQUAL: - REQUIRE(name == "EQUAL"); + CATCH_REQUIRE(name == "EQUAL"); break; case csspp::node_type_t::EXCLAMATION: - REQUIRE(name == "EXCLAMATION"); + CATCH_REQUIRE(name == "EXCLAMATION"); break; case csspp::node_type_t::FONT_METRICS: - REQUIRE(name == "FONT_METRICS"); + CATCH_REQUIRE(name == "FONT_METRICS"); break; case csspp::node_type_t::FUNCTION: - REQUIRE(name == "FUNCTION"); + CATCH_REQUIRE(name == "FUNCTION"); break; case csspp::node_type_t::GREATER_EQUAL: - REQUIRE(name == "GREATER_EQUAL"); + CATCH_REQUIRE(name == "GREATER_EQUAL"); break; case csspp::node_type_t::GREATER_THAN: - REQUIRE(name == "GREATER_THAN"); + CATCH_REQUIRE(name == "GREATER_THAN"); break; case csspp::node_type_t::HASH: - REQUIRE(name == "HASH"); + CATCH_REQUIRE(name == "HASH"); break; case csspp::node_type_t::IDENTIFIER: - REQUIRE(name == "IDENTIFIER"); + CATCH_REQUIRE(name == "IDENTIFIER"); break; case csspp::node_type_t::INCLUDE_MATCH: - REQUIRE(name == "INCLUDE_MATCH"); + CATCH_REQUIRE(name == "INCLUDE_MATCH"); break; case csspp::node_type_t::INTEGER: - REQUIRE(name == "INTEGER"); + CATCH_REQUIRE(name == "INTEGER"); break; case csspp::node_type_t::LESS_EQUAL: - REQUIRE(name == "LESS_EQUAL"); + CATCH_REQUIRE(name == "LESS_EQUAL"); break; case csspp::node_type_t::LESS_THAN: - REQUIRE(name == "LESS_THAN"); + CATCH_REQUIRE(name == "LESS_THAN"); break; case csspp::node_type_t::MODULO: - REQUIRE(name == "MODULO"); + CATCH_REQUIRE(name == "MODULO"); break; case csspp::node_type_t::MULTIPLY: - REQUIRE(name == "MULTIPLY"); + CATCH_REQUIRE(name == "MULTIPLY"); break; case csspp::node_type_t::NOT_EQUAL: - REQUIRE(name == "NOT_EQUAL"); + CATCH_REQUIRE(name == "NOT_EQUAL"); break; case csspp::node_type_t::NULL_TOKEN: - REQUIRE(name == "NULL_TOKEN"); + CATCH_REQUIRE(name == "NULL_TOKEN"); break; case csspp::node_type_t::OPEN_CURLYBRACKET: - REQUIRE(name == "OPEN_CURLYBRACKET"); + CATCH_REQUIRE(name == "OPEN_CURLYBRACKET"); break; case csspp::node_type_t::OPEN_PARENTHESIS: - REQUIRE(name == "OPEN_PARENTHESIS"); + CATCH_REQUIRE(name == "OPEN_PARENTHESIS"); break; case csspp::node_type_t::OPEN_SQUAREBRACKET: - REQUIRE(name == "OPEN_SQUAREBRACKET"); + CATCH_REQUIRE(name == "OPEN_SQUAREBRACKET"); break; case csspp::node_type_t::PERCENT: - REQUIRE(name == "PERCENT"); + CATCH_REQUIRE(name == "PERCENT"); break; case csspp::node_type_t::PERIOD: - REQUIRE(name == "PERIOD"); + CATCH_REQUIRE(name == "PERIOD"); break; case csspp::node_type_t::PLACEHOLDER: - REQUIRE(name == "PLACEHOLDER"); + CATCH_REQUIRE(name == "PLACEHOLDER"); break; case csspp::node_type_t::POWER: - REQUIRE(name == "POWER"); + CATCH_REQUIRE(name == "POWER"); break; case csspp::node_type_t::PRECEDED: - REQUIRE(name == "PRECEDED"); + CATCH_REQUIRE(name == "PRECEDED"); break; case csspp::node_type_t::PREFIX_MATCH: - REQUIRE(name == "PREFIX_MATCH"); + CATCH_REQUIRE(name == "PREFIX_MATCH"); break; case csspp::node_type_t::REFERENCE: - REQUIRE(name == "REFERENCE"); + CATCH_REQUIRE(name == "REFERENCE"); break; case csspp::node_type_t::SCOPE: - REQUIRE(name == "SCOPE"); + CATCH_REQUIRE(name == "SCOPE"); break; case csspp::node_type_t::SEMICOLON: - REQUIRE(name == "SEMICOLON"); + CATCH_REQUIRE(name == "SEMICOLON"); break; case csspp::node_type_t::STRING: - REQUIRE(name == "STRING"); + CATCH_REQUIRE(name == "STRING"); break; case csspp::node_type_t::SUBSTRING_MATCH: - REQUIRE(name == "SUBSTRING_MATCH"); + CATCH_REQUIRE(name == "SUBSTRING_MATCH"); break; case csspp::node_type_t::SUBTRACT: - REQUIRE(name == "SUBTRACT"); + CATCH_REQUIRE(name == "SUBTRACT"); break; case csspp::node_type_t::SUFFIX_MATCH: - REQUIRE(name == "SUFFIX_MATCH"); + CATCH_REQUIRE(name == "SUFFIX_MATCH"); break; case csspp::node_type_t::UNICODE_RANGE: - REQUIRE(name == "UNICODE_RANGE"); + CATCH_REQUIRE(name == "UNICODE_RANGE"); break; case csspp::node_type_t::URL: - REQUIRE(name == "URL"); + CATCH_REQUIRE(name == "URL"); break; case csspp::node_type_t::VARIABLE: - REQUIRE(name == "VARIABLE"); + CATCH_REQUIRE(name == "VARIABLE"); break; case csspp::node_type_t::VARIABLE_FUNCTION: - REQUIRE(name == "VARIABLE_FUNCTION"); + CATCH_REQUIRE(name == "VARIABLE_FUNCTION"); break; case csspp::node_type_t::WHITESPACE: - REQUIRE(name == "WHITESPACE"); + CATCH_REQUIRE(name == "WHITESPACE"); break; // second part case csspp::node_type_t::AN_PLUS_B: - REQUIRE(name == "AN_PLUS_B"); + CATCH_REQUIRE(name == "AN_PLUS_B"); break; case csspp::node_type_t::ARG: - REQUIRE(name == "ARG"); + CATCH_REQUIRE(name == "ARG"); break; case csspp::node_type_t::ARRAY: - REQUIRE(name == "ARRAY"); + CATCH_REQUIRE(name == "ARRAY"); break; case csspp::node_type_t::COMPONENT_VALUE: - REQUIRE(name == "COMPONENT_VALUE"); + CATCH_REQUIRE(name == "COMPONENT_VALUE"); break; case csspp::node_type_t::DECLARATION: - REQUIRE(name == "DECLARATION"); + CATCH_REQUIRE(name == "DECLARATION"); break; case csspp::node_type_t::LIST: - REQUIRE(name == "LIST"); + CATCH_REQUIRE(name == "LIST"); break; case csspp::node_type_t::MAP: - REQUIRE(name == "MAP"); + CATCH_REQUIRE(name == "MAP"); break; case csspp::node_type_t::FRAME: - REQUIRE(name == "FRAME"); + CATCH_REQUIRE(name == "FRAME"); break; case csspp::node_type_t::max_type: - REQUIRE(name == "max_type"); + CATCH_REQUIRE(name == "max_type"); break; } @@ -1236,10 +1247,10 @@ TEST_CASE("Node output", "[node] [output]") } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Node to string", "[node] [type] [output]") +CATCH_TEST_CASE("Node to string", "[node] [type] [output]") { // we expect the test suite to be compiled with the exact same version for(int flags(0); flags < 4; ++flags) @@ -1253,107 +1264,107 @@ TEST_CASE("Node to string", "[node] [type] [output]") switch(w) { case csspp::node_type_t::ADD: - REQUIRE(n->to_string(flags) == "+"); + CATCH_REQUIRE(n->to_string(flags) == "+"); break; case csspp::node_type_t::AND: - REQUIRE(n->to_string(flags) == "&&"); + CATCH_REQUIRE(n->to_string(flags) == "&&"); break; case csspp::node_type_t::ASSIGNMENT: - REQUIRE(n->to_string(flags) == ":="); + CATCH_REQUIRE(n->to_string(flags) == ":="); break; case csspp::node_type_t::AT_KEYWORD: - REQUIRE(n->to_string(flags) == "@"); + CATCH_REQUIRE(n->to_string(flags) == "@"); n->set_string("test"); - REQUIRE(n->to_string(flags) == "@test"); + CATCH_REQUIRE(n->to_string(flags) == "@test"); break; case csspp::node_type_t::BOOLEAN: - REQUIRE(n->to_string(flags) == "false"); + CATCH_REQUIRE(n->to_string(flags) == "false"); n->set_boolean(true); - REQUIRE(n->to_string(flags) == "true"); + CATCH_REQUIRE(n->to_string(flags) == "true"); break; case csspp::node_type_t::COLON: - REQUIRE(n->to_string(flags) == ":"); + CATCH_REQUIRE(n->to_string(flags) == ":"); break; case csspp::node_type_t::COLOR: { - REQUIRE(n->to_string(flags) == "transparent"); + CATCH_REQUIRE(n->to_string(flags) == "transparent"); csspp::color c; c.set_color(0x58, 0x32, 0xff, 0xff); n->set_color(c); - REQUIRE(n->to_string(flags) == "#5832ff"); + CATCH_REQUIRE(n->to_string(flags) == "#5832ff"); c.set_color(0x58, 0x32, 0xff, 0x7f); n->set_color(c); - REQUIRE(n->to_string(flags) == "rgba(88,50,255,.5)"); + CATCH_REQUIRE(n->to_string(flags) == "rgba(88,50,255,.5)"); } break; case csspp::node_type_t::COLUMN: - REQUIRE(n->to_string(flags) == "||"); + CATCH_REQUIRE(n->to_string(flags) == "||"); break; case csspp::node_type_t::COMMA: - REQUIRE(n->to_string(flags) == ","); + CATCH_REQUIRE(n->to_string(flags) == ","); break; case csspp::node_type_t::COMMENT: // once we remove the @preserve, this could happen - REQUIRE(n->to_string(flags) == ""); + CATCH_REQUIRE(n->to_string(flags) == ""); n->set_string("the comment"); - REQUIRE(n->to_string(flags) == "// the comment\n"); + CATCH_REQUIRE(n->to_string(flags) == "// the comment\n"); n->set_string("the comment\non two lines"); - REQUIRE(n->to_string(flags) == "// the comment\n// on two lines\n"); + CATCH_REQUIRE(n->to_string(flags) == "// the comment\n// on two lines\n"); n->set_integer(1); n->set_string("the C-like comment\non two lines"); - REQUIRE(n->to_string(flags) == "/* the C-like comment\non two lines */"); + CATCH_REQUIRE(n->to_string(flags) == "/* the C-like comment\non two lines */"); break; case csspp::node_type_t::CONDITIONAL: - REQUIRE(n->to_string(flags) == "?"); + CATCH_REQUIRE(n->to_string(flags) == "?"); break; case csspp::node_type_t::DASH_MATCH: - REQUIRE(n->to_string(flags) == "|="); + CATCH_REQUIRE(n->to_string(flags) == "|="); break; case csspp::node_type_t::DECIMAL_NUMBER: - REQUIRE(n->to_string(flags) == "0"); + CATCH_REQUIRE(n->to_string(flags) == "0"); n->set_string("em"); - REQUIRE(n->to_string(flags) == "0em"); + CATCH_REQUIRE(n->to_string(flags) == "0em"); n->set_decimal_number(1.25); - REQUIRE(n->to_string(flags) == "1.25em"); + CATCH_REQUIRE(n->to_string(flags) == "1.25em"); break; case csspp::node_type_t::DIVIDE: if((flags & csspp::node::g_to_string_flag_add_spaces) != 0) { - REQUIRE(n->to_string(flags) == " / "); + CATCH_REQUIRE(n->to_string(flags) == " / "); } else { - REQUIRE(n->to_string(flags) == "/"); + CATCH_REQUIRE(n->to_string(flags) == "/"); } break; case csspp::node_type_t::DOLLAR: - REQUIRE(n->to_string(flags) == "$"); + CATCH_REQUIRE(n->to_string(flags) == "$"); break; case csspp::node_type_t::EQUAL: - REQUIRE(n->to_string(flags) == "="); + CATCH_REQUIRE(n->to_string(flags) == "="); break; case csspp::node_type_t::EXCLAMATION: - REQUIRE(n->to_string(flags) == "!"); + CATCH_REQUIRE(n->to_string(flags) == "!"); break; case csspp::node_type_t::FONT_METRICS: - REQUIRE(n->to_string(flags) == + CATCH_REQUIRE(n->to_string(flags) == csspp::decimal_number_to_string(n->get_font_size(), false) + n->get_dim1() + "/" @@ -1364,7 +1375,7 @@ TEST_CASE("Node to string", "[node] [type] [output]") case csspp::node_type_t::FUNCTION: { // the defaults are empty... - REQUIRE(n->to_string(flags) == "()"); + CATCH_REQUIRE(n->to_string(flags) == "()"); // test with an actual function n->set_string("rgba"); @@ -1377,80 +1388,80 @@ TEST_CASE("Node to string", "[node] [type] [output]") p.reset(new csspp::node(csspp::node_type_t::DECIMAL_NUMBER, n->get_position())); p->set_decimal_number(1.0); n->add_child(p); - REQUIRE(n->to_string(flags) == "rgba(0,0,0,1)"); + CATCH_REQUIRE(n->to_string(flags) == "rgba(0,0,0,1)"); } break; case csspp::node_type_t::GREATER_EQUAL: - REQUIRE(n->to_string(flags) == ">="); + CATCH_REQUIRE(n->to_string(flags) == ">="); break; case csspp::node_type_t::GREATER_THAN: - REQUIRE(n->to_string(flags) == ">"); + CATCH_REQUIRE(n->to_string(flags) == ">"); break; case csspp::node_type_t::HASH: - REQUIRE(n->to_string(flags) == "#"); + CATCH_REQUIRE(n->to_string(flags) == "#"); n->set_string("random"); - REQUIRE(n->to_string(flags) == "#random"); + CATCH_REQUIRE(n->to_string(flags) == "#random"); break; case csspp::node_type_t::IDENTIFIER: - REQUIRE(n->to_string(flags) == ""); + CATCH_REQUIRE(n->to_string(flags) == ""); n->set_string("an identifier in CSS can be absolutely anything!"); - REQUIRE(n->to_string(flags) == "an identifier in CSS can be absolutely anything!"); + CATCH_REQUIRE(n->to_string(flags) == "an identifier in CSS can be absolutely anything!"); break; case csspp::node_type_t::INCLUDE_MATCH: - REQUIRE(n->to_string(flags) == "~="); + CATCH_REQUIRE(n->to_string(flags) == "~="); break; case csspp::node_type_t::INTEGER: { - REQUIRE(n->to_string(flags) == "0"); + CATCH_REQUIRE(n->to_string(flags) == "0"); csspp::integer_t i(static_cast(rand()) + (static_cast(rand()) << 32)); n->set_integer(i); - REQUIRE(n->to_string(flags) == std::to_string(i)); + CATCH_REQUIRE(n->to_string(flags) == std::to_string(i)); n->set_string("px"); - REQUIRE(n->to_string(flags) == std::to_string(i) + "px"); + CATCH_REQUIRE(n->to_string(flags) == std::to_string(i) + "px"); } break; case csspp::node_type_t::LESS_EQUAL: - REQUIRE(n->to_string(flags) == "<="); + CATCH_REQUIRE(n->to_string(flags) == "<="); break; case csspp::node_type_t::LESS_THAN: - REQUIRE(n->to_string(flags) == "<"); + CATCH_REQUIRE(n->to_string(flags) == "<"); break; case csspp::node_type_t::MODULO: if((flags & csspp::node::g_to_string_flag_add_spaces) != 0) { - REQUIRE(n->to_string(flags) == " % "); + CATCH_REQUIRE(n->to_string(flags) == " % "); } else { - REQUIRE(n->to_string(flags) == "%"); + CATCH_REQUIRE(n->to_string(flags) == "%"); } break; case csspp::node_type_t::MULTIPLY: - REQUIRE(n->to_string(flags) == "*"); + CATCH_REQUIRE(n->to_string(flags) == "*"); break; case csspp::node_type_t::NOT_EQUAL: - REQUIRE(n->to_string(flags) == "!="); + CATCH_REQUIRE(n->to_string(flags) == "!="); break; case csspp::node_type_t::NULL_TOKEN: - REQUIRE(n->to_string(flags) == ""); + CATCH_REQUIRE(n->to_string(flags) == ""); break; case csspp::node_type_t::OPEN_CURLYBRACKET: { // the defaults are empty... - REQUIRE(n->to_string(flags) == "{}"); + CATCH_REQUIRE(n->to_string(flags) == "{}"); // test with an actual expression csspp::node::pointer_t p(new csspp::node(csspp::node_type_t::INTEGER, n->get_position())); @@ -1463,11 +1474,11 @@ TEST_CASE("Node to string", "[node] [type] [output]") n->add_child(p); if((flags & csspp::node::g_to_string_flag_add_spaces) != 0) { - REQUIRE(n->to_string(flags) == "{7 % 52}"); + CATCH_REQUIRE(n->to_string(flags) == "{7 % 52}"); } else { - REQUIRE(n->to_string(flags) == "{7%52}"); + CATCH_REQUIRE(n->to_string(flags) == "{7%52}"); } } break; @@ -1475,7 +1486,7 @@ TEST_CASE("Node to string", "[node] [type] [output]") case csspp::node_type_t::OPEN_PARENTHESIS: { // the defaults are empty... - REQUIRE(n->to_string(flags) == "()"); + CATCH_REQUIRE(n->to_string(flags) == "()"); // test with an actual function csspp::node::pointer_t p(new csspp::node(csspp::node_type_t::INTEGER, n->get_position())); @@ -1486,14 +1497,14 @@ TEST_CASE("Node to string", "[node] [type] [output]") p.reset(new csspp::node(csspp::node_type_t::INTEGER, n->get_position())); p->set_integer(502); n->add_child(p); - REQUIRE(n->to_string(flags) == "(17*502)"); + CATCH_REQUIRE(n->to_string(flags) == "(17*502)"); } break; case csspp::node_type_t::OPEN_SQUAREBRACKET: { // the defaults are empty... - REQUIRE(n->to_string(flags) == "[]"); + CATCH_REQUIRE(n->to_string(flags) == "[]"); // test with an actual function csspp::node::pointer_t p(new csspp::node(csspp::node_type_t::INTEGER, n->get_position())); @@ -1506,145 +1517,145 @@ TEST_CASE("Node to string", "[node] [type] [output]") n->add_child(p); if((flags & csspp::node::g_to_string_flag_add_spaces) != 0) { - REQUIRE(n->to_string(flags) == "[5 / 152]"); + CATCH_REQUIRE(n->to_string(flags) == "[5 / 152]"); } else { - REQUIRE(n->to_string(flags) == "[5/152]"); + CATCH_REQUIRE(n->to_string(flags) == "[5/152]"); } } break; case csspp::node_type_t::PERCENT: - REQUIRE(n->to_string(flags) == "0%"); + CATCH_REQUIRE(n->to_string(flags) == "0%"); n->set_decimal_number(1.25); - REQUIRE(n->to_string(flags) == "125%"); + CATCH_REQUIRE(n->to_string(flags) == "125%"); break; case csspp::node_type_t::PERIOD: - REQUIRE(n->to_string(flags) == "."); + CATCH_REQUIRE(n->to_string(flags) == "."); break; case csspp::node_type_t::PLACEHOLDER: - REQUIRE(n->to_string(flags) == "%"); + CATCH_REQUIRE(n->to_string(flags) == "%"); n->set_string("the-name-of-the-placeholder"); - REQUIRE(n->to_string(flags) == "%the-name-of-the-placeholder"); + CATCH_REQUIRE(n->to_string(flags) == "%the-name-of-the-placeholder"); break; case csspp::node_type_t::POWER: - REQUIRE(n->to_string(flags) == "**"); + CATCH_REQUIRE(n->to_string(flags) == "**"); break; case csspp::node_type_t::PRECEDED: - REQUIRE(n->to_string(flags) == "~"); + CATCH_REQUIRE(n->to_string(flags) == "~"); break; case csspp::node_type_t::PREFIX_MATCH: - REQUIRE(n->to_string(flags) == "^="); + CATCH_REQUIRE(n->to_string(flags) == "^="); break; case csspp::node_type_t::REFERENCE: - REQUIRE(n->to_string(flags) == "&"); + CATCH_REQUIRE(n->to_string(flags) == "&"); break; case csspp::node_type_t::SCOPE: - REQUIRE(n->to_string(flags) == "|"); + CATCH_REQUIRE(n->to_string(flags) == "|"); break; case csspp::node_type_t::SEMICOLON: - REQUIRE(n->to_string(flags) == ";"); + CATCH_REQUIRE(n->to_string(flags) == ";"); break; case csspp::node_type_t::STRING: // with an empty string if((flags & csspp::node::g_to_string_flag_show_quotes) != 0) { - REQUIRE(n->to_string(flags) == "\"\""); + CATCH_REQUIRE(n->to_string(flags) == "\"\""); } else { - REQUIRE(n->to_string(flags) == ""); + CATCH_REQUIRE(n->to_string(flags) == ""); } // with a ' in the string n->set_string("whatever string content we'd want really..."); if((flags & csspp::node::g_to_string_flag_show_quotes) != 0) { - REQUIRE(n->to_string(flags) == "\"whatever string content we'd want really...\""); + CATCH_REQUIRE(n->to_string(flags) == "\"whatever string content we'd want really...\""); } else { - REQUIRE(n->to_string(flags) == "whatever string content we'd want really..."); + CATCH_REQUIRE(n->to_string(flags) == "whatever string content we'd want really..."); } // with a " in the string n->set_string("yet if we have one quote like this: \" then the other is used to quote the string"); if((flags & csspp::node::g_to_string_flag_show_quotes) != 0) { - REQUIRE(n->to_string(flags) == "'yet if we have one quote like this: \" then the other is used to quote the string'"); + CATCH_REQUIRE(n->to_string(flags) == "'yet if we have one quote like this: \" then the other is used to quote the string'"); } else { - REQUIRE(n->to_string(flags) == "yet if we have one quote like this: \" then the other is used to quote the string"); + CATCH_REQUIRE(n->to_string(flags) == "yet if we have one quote like this: \" then the other is used to quote the string"); } // with both ' and ", more ' n->set_string("counter: ''''' > \"\"\""); if((flags & csspp::node::g_to_string_flag_show_quotes) != 0) { - REQUIRE(n->to_string(flags) == "\"counter: ''''' > \\\"\\\"\\\"\""); + CATCH_REQUIRE(n->to_string(flags) == "\"counter: ''''' > \\\"\\\"\\\"\""); } else { - REQUIRE(n->to_string(flags) == "counter: ''''' > \"\"\""); + CATCH_REQUIRE(n->to_string(flags) == "counter: ''''' > \"\"\""); } // with both ' and ", more " n->set_string("counter: ''' < \"\"\"\"\""); if((flags & csspp::node::g_to_string_flag_show_quotes) != 0) { - REQUIRE(n->to_string(flags) == "'counter: \\'\\'\\' < \"\"\"\"\"'"); + CATCH_REQUIRE(n->to_string(flags) == "'counter: \\'\\'\\' < \"\"\"\"\"'"); } else { - REQUIRE(n->to_string(flags) == "counter: ''' < \"\"\"\"\""); + CATCH_REQUIRE(n->to_string(flags) == "counter: ''' < \"\"\"\"\""); } break; case csspp::node_type_t::SUBSTRING_MATCH: - REQUIRE(n->to_string(flags) == "*="); + CATCH_REQUIRE(n->to_string(flags) == "*="); break; case csspp::node_type_t::SUBTRACT: - REQUIRE(n->to_string(flags) == "-"); + CATCH_REQUIRE(n->to_string(flags) == "-"); break; case csspp::node_type_t::SUFFIX_MATCH: - REQUIRE(n->to_string(flags) == "$="); + CATCH_REQUIRE(n->to_string(flags) == "$="); break; case csspp::node_type_t::UNICODE_RANGE: - REQUIRE(n->to_string(flags) == "U+0"); + CATCH_REQUIRE(n->to_string(flags) == "U+0"); n->set_integer(0x00004FFF00004000); - REQUIRE(n->to_string(flags) == "U+4???"); + CATCH_REQUIRE(n->to_string(flags) == "U+4???"); break; case csspp::node_type_t::URL: - REQUIRE(n->to_string(flags) == "url()"); + CATCH_REQUIRE(n->to_string(flags) == "url()"); n->set_string("http://this.should.be/a/valid/url"); - REQUIRE(n->to_string(flags) == "url(http://this.should.be/a/valid/url)"); + CATCH_REQUIRE(n->to_string(flags) == "url(http://this.should.be/a/valid/url)"); break; case csspp::node_type_t::VARIABLE: - REQUIRE(n->to_string(flags) == "$"); + CATCH_REQUIRE(n->to_string(flags) == "$"); n->set_string("varname"); - REQUIRE(n->to_string(flags) == "$varname"); + CATCH_REQUIRE(n->to_string(flags) == "$varname"); break; case csspp::node_type_t::VARIABLE_FUNCTION: { // the defaults are empty... - REQUIRE(n->to_string(flags) == "$()"); + CATCH_REQUIRE(n->to_string(flags) == "$()"); // test with an actual function n->set_string("my_function"); @@ -1661,31 +1672,31 @@ TEST_CASE("Node to string", "[node] [type] [output]") n->add_child(p); if((flags & csspp::node::g_to_string_flag_show_quotes) != 0) { - REQUIRE(n->to_string(flags) == "$my_function(0,\"colorful\",33,1)"); + CATCH_REQUIRE(n->to_string(flags) == "$my_function(0,\"colorful\",33,1)"); } else { - REQUIRE(n->to_string(flags) == "$my_function(0,colorful,33,1)"); + CATCH_REQUIRE(n->to_string(flags) == "$my_function(0,colorful,33,1)"); } } break; case csspp::node_type_t::WHITESPACE: - REQUIRE(n->to_string(flags) == " "); + CATCH_REQUIRE(n->to_string(flags) == " "); break; // second part case csspp::node_type_t::AN_PLUS_B: - REQUIRE(n->to_string(flags) == "0"); + CATCH_REQUIRE(n->to_string(flags) == "0"); n->set_integer(0x0000000500000003); - REQUIRE(n->to_string(flags) == "3n+5"); + CATCH_REQUIRE(n->to_string(flags) == "3n+5"); break; case csspp::node_type_t::ARG: { // the defaults are empty... - REQUIRE(n->to_string(flags) == ""); - REQUIRE(n->get_integer() == 0); + CATCH_REQUIRE(n->to_string(flags) == ""); + CATCH_REQUIRE(n->get_integer() == 0); // test with an actual function csspp::node::pointer_t p(new csspp::node(csspp::node_type_t::INTEGER, n->get_position())); @@ -1695,14 +1706,14 @@ TEST_CASE("Node to string", "[node] [type] [output]") p.reset(new csspp::node(csspp::node_type_t::INTEGER, n->get_position())); p->set_integer(33); n->add_child(p); - REQUIRE(n->to_string(flags) == "0+33"); + CATCH_REQUIRE(n->to_string(flags) == "0+33"); } break; case csspp::node_type_t::ARRAY: { // the defaults are empty... - REQUIRE(n->to_string(flags) == "()"); + CATCH_REQUIRE(n->to_string(flags) == "()"); // each item is comma separated csspp::node::pointer_t p(new csspp::node(csspp::node_type_t::IDENTIFIER, n->get_position())); @@ -1717,7 +1728,7 @@ TEST_CASE("Node to string", "[node] [type] [output]") p->set_string("hello world!"); n->add_child(p); - REQUIRE(n->to_string(flags) == "(number, 3.22, **, \"hello world!\")"); + CATCH_REQUIRE(n->to_string(flags) == "(number, 3.22, **, \"hello world!\")"); } break; @@ -1725,7 +1736,7 @@ TEST_CASE("Node to string", "[node] [type] [output]") // test with the default (undefined) separator { // the defaults are empty... - REQUIRE(n->to_string(flags) == ""); + CATCH_REQUIRE(n->to_string(flags) == ""); // test with an actual function csspp::node::pointer_t a(new csspp::node(csspp::node_type_t::ARG, n->get_position())); @@ -1747,11 +1758,11 @@ TEST_CASE("Node to string", "[node] [type] [output]") if((flags & csspp::node::g_to_string_flag_show_quotes) != 0) { - REQUIRE(n->to_string(flags) == "0,\"orange\",33"); + CATCH_REQUIRE(n->to_string(flags) == "0,\"orange\",33"); } else { - REQUIRE(n->to_string(flags) == "0,orange,33"); + CATCH_REQUIRE(n->to_string(flags) == "0,orange,33"); } // test with an actual function but not argified @@ -1772,11 +1783,11 @@ TEST_CASE("Node to string", "[node] [type] [output]") if((flags & csspp::node::g_to_string_flag_show_quotes) != 0) { - REQUIRE(n->to_string(flags) == "111,\"purple\",301"); + CATCH_REQUIRE(n->to_string(flags) == "111,\"purple\",301"); } else { - REQUIRE(n->to_string(flags) == "111,purple,301"); + CATCH_REQUIRE(n->to_string(flags) == "111,purple,301"); } } @@ -1807,11 +1818,11 @@ TEST_CASE("Node to string", "[node] [type] [output]") if((flags & csspp::node::g_to_string_flag_show_quotes) != 0) { - REQUIRE(n->to_string(flags) == "0,\"orange\",33"); + CATCH_REQUIRE(n->to_string(flags) == "0,\"orange\",33"); } else { - REQUIRE(n->to_string(flags) == "0,orange,33"); + CATCH_REQUIRE(n->to_string(flags) == "0,orange,33"); } // test with an actual function but not argified @@ -1832,11 +1843,11 @@ TEST_CASE("Node to string", "[node] [type] [output]") if((flags & csspp::node::g_to_string_flag_show_quotes) != 0) { - REQUIRE(n->to_string(flags) == "111,\"purple\",301"); + CATCH_REQUIRE(n->to_string(flags) == "111,\"purple\",301"); } else { - REQUIRE(n->to_string(flags) == "111,purple,301"); + CATCH_REQUIRE(n->to_string(flags) == "111,purple,301"); } } @@ -1867,11 +1878,11 @@ TEST_CASE("Node to string", "[node] [type] [output]") if((flags & csspp::node::g_to_string_flag_show_quotes) != 0) { - REQUIRE(n->to_string(flags) == "0/\"orange\"/33"); + CATCH_REQUIRE(n->to_string(flags) == "0/\"orange\"/33"); } else { - REQUIRE(n->to_string(flags) == "0/orange/33"); + CATCH_REQUIRE(n->to_string(flags) == "0/orange/33"); } // test with an actual function but not argified @@ -1894,22 +1905,22 @@ TEST_CASE("Node to string", "[node] [type] [output]") { if((flags & csspp::node::g_to_string_flag_add_spaces) != 0) { - REQUIRE(n->to_string(flags) == "111 / \"purple\" / 301"); + CATCH_REQUIRE(n->to_string(flags) == "111 / \"purple\" / 301"); } else { - REQUIRE(n->to_string(flags) == "111/\"purple\"/301"); + CATCH_REQUIRE(n->to_string(flags) == "111/\"purple\"/301"); } } else { if((flags & csspp::node::g_to_string_flag_add_spaces) != 0) { - REQUIRE(n->to_string(flags) == "111 / purple / 301"); + CATCH_REQUIRE(n->to_string(flags) == "111 / purple / 301"); } else { - REQUIRE(n->to_string(flags) == "111/purple/301"); + CATCH_REQUIRE(n->to_string(flags) == "111/purple/301"); } } } @@ -1918,9 +1929,9 @@ TEST_CASE("Node to string", "[node] [type] [output]") case csspp::node_type_t::DECLARATION: { // the defaults are empty... - REQUIRE(n->to_string(flags) == ""); + CATCH_REQUIRE(n->to_string(flags) == ""); n->set_string("name"); - REQUIRE(n->to_string(flags) == "name: "); + CATCH_REQUIRE(n->to_string(flags) == "name: "); // test with an actual function csspp::node::pointer_t p(new csspp::node(csspp::node_type_t::INTEGER, n->get_position())); @@ -1934,7 +1945,7 @@ TEST_CASE("Node to string", "[node] [type] [output]") p.reset(new csspp::node(csspp::node_type_t::INTEGER, n->get_position())); p->set_integer(33); n->add_child(p); - REQUIRE(n->to_string(flags) == "name: 0 - 33"); + CATCH_REQUIRE(n->to_string(flags) == "name: 0 - 33"); } { @@ -1964,14 +1975,14 @@ TEST_CASE("Node to string", "[node] [type] [output]") p->set_decimal_number(1.15); arg->add_child(p); - REQUIRE(n->to_string(flags) == "name: 1.45+15,7-1.15"); + CATCH_REQUIRE(n->to_string(flags) == "name: 1.45+15,7-1.15"); } break; case csspp::node_type_t::LIST: { // the defaults are empty... - REQUIRE(n->to_string(flags) == ""); + CATCH_REQUIRE(n->to_string(flags) == ""); // test with an actual expression csspp::node::pointer_t p(new csspp::node(csspp::node_type_t::DECIMAL_NUMBER, n->get_position())); @@ -1986,7 +1997,7 @@ TEST_CASE("Node to string", "[node] [type] [output]") p.reset(new csspp::node(csspp::node_type_t::DECIMAL_NUMBER, n->get_position())); p->set_decimal_number(5.3); n->add_child(p); - REQUIRE(n->to_string(flags) == "3.22 ** 5.3"); + CATCH_REQUIRE(n->to_string(flags) == "3.22 ** 5.3"); } { @@ -2049,14 +2060,14 @@ TEST_CASE("Node to string", "[node] [type] [output]") p->set_decimal_number(15.03); arg->add_child(p); - REQUIRE(n->to_string(flags) == "14.53+150,107-115.23;1.453+1,19-15.03"); + CATCH_REQUIRE(n->to_string(flags) == "14.53+150,107-115.23;1.453+1,19-15.03"); } break; case csspp::node_type_t::MAP: { // the defaults are empty... - REQUIRE(n->to_string(flags) == "()"); + CATCH_REQUIRE(n->to_string(flags) == "()"); // number: 3.22 csspp::node::pointer_t p(new csspp::node(csspp::node_type_t::IDENTIFIER, n->get_position())); @@ -2074,17 +2085,17 @@ TEST_CASE("Node to string", "[node] [type] [output]") p->set_string("hello world!"); n->add_child(p); - REQUIRE(n->to_string(flags) == "(number: 3.22, string: \"hello world!\")"); + CATCH_REQUIRE(n->to_string(flags) == "(number: 3.22, string: \"hello world!\")"); } break; case csspp::node_type_t::FRAME: { - REQUIRE(n->to_string(flags) == "from{}"); + CATCH_REQUIRE(n->to_string(flags) == "from{}"); n->set_decimal_number(0.25); - REQUIRE(n->to_string(flags) == "25%{}"); + CATCH_REQUIRE(n->to_string(flags) == "25%{}"); n->set_decimal_number(1.0); - REQUIRE(n->to_string(flags) == "to{}"); + CATCH_REQUIRE(n->to_string(flags) == "to{}"); // 68% { right: 322px } n->set_decimal_number(0.68); @@ -2098,14 +2109,14 @@ TEST_CASE("Node to string", "[node] [type] [output]") r->set_integer(322); q->add_child(r); - REQUIRE(n->to_string(flags) == "68%{right: 322px}"); + CATCH_REQUIRE(n->to_string(flags) == "68%{right: 322px}"); } break; // anything else is an error default: // other node types generate a throw - REQUIRE_THROWS_AS(n->to_string(flags), csspp::csspp_exception_logic &); + CATCH_REQUIRE_THROWS_AS(n->to_string(flags), csspp::csspp_exception_logic); break; } @@ -2116,10 +2127,10 @@ TEST_CASE("Node to string", "[node] [type] [output]") } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Node to string ARG with wrong type", "[node] [output] [invalid]") +CATCH_TEST_CASE("Node to string ARG with wrong type", "[node] [output] [invalid]") { // we expect the test suite to be compiled with the exact same version for(int flags(0); flags < 4; ++flags) @@ -2164,15 +2175,15 @@ TEST_CASE("Node to string ARG with wrong type", "[node] [output] [invalid]") a->add_child(p); // w is not valid as an ARG separator so it throws - REQUIRE_THROWS_AS(n->to_string(flags), csspp::csspp_exception_logic &); + CATCH_REQUIRE_THROWS_AS(n->to_string(flags), csspp::csspp_exception_logic); } } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Error with node names", "[node] [type] [output]") +CATCH_TEST_CASE("Error with node names", "[node] [type] [output]") { // we expect the test suite to be compiled with the exact same version csspp::node_type_t w(csspp::node_type_t::UNKNOWN); @@ -2191,276 +2202,276 @@ TEST_CASE("Error with node names", "[node] [type] [output]") switch(w) { case csspp::node_type_t::UNKNOWN: - REQUIRE_ERRORS("test.css(1): error: node name \"UNKNOWN\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"UNKNOWN\".\n"); break; case csspp::node_type_t::ADD: - REQUIRE_ERRORS("test.css(1): error: node name \"ADD\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"ADD\".\n"); break; case csspp::node_type_t::AND: - REQUIRE_ERRORS("test.css(1): error: node name \"AND\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"AND\".\n"); break; case csspp::node_type_t::ASSIGNMENT: - REQUIRE_ERRORS("test.css(1): error: node name \"ASSIGNMENT\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"ASSIGNMENT\".\n"); break; case csspp::node_type_t::AT_KEYWORD: - REQUIRE_ERRORS("test.css(1): error: node name \"AT_KEYWORD\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"AT_KEYWORD\".\n"); break; case csspp::node_type_t::BOOLEAN: - REQUIRE_ERRORS("test.css(1): error: node name \"BOOLEAN\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"BOOLEAN\".\n"); break; case csspp::node_type_t::CDC: - REQUIRE_ERRORS("test.css(1): error: node name \"CDC\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"CDC\".\n"); break; case csspp::node_type_t::CDO: - REQUIRE_ERRORS("test.css(1): error: node name \"CDO\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"CDO\".\n"); break; case csspp::node_type_t::CLOSE_CURLYBRACKET: - REQUIRE_ERRORS("test.css(1): error: node name \"CLOSE_CURLYBRACKET\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"CLOSE_CURLYBRACKET\".\n"); break; case csspp::node_type_t::CLOSE_PARENTHESIS: - REQUIRE_ERRORS("test.css(1): error: node name \"CLOSE_PARENTHESIS\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"CLOSE_PARENTHESIS\".\n"); break; case csspp::node_type_t::CLOSE_SQUAREBRACKET: - REQUIRE_ERRORS("test.css(1): error: node name \"CLOSE_SQUAREBRACKET\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"CLOSE_SQUAREBRACKET\".\n"); break; case csspp::node_type_t::COLON: - REQUIRE_ERRORS("test.css(1): error: node name \"COLON\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"COLON\".\n"); break; case csspp::node_type_t::COLOR: - REQUIRE_ERRORS("test.css(1): error: node name \"COLOR\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"COLOR\".\n"); break; case csspp::node_type_t::COLUMN: - REQUIRE_ERRORS("test.css(1): error: node name \"COLUMN\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"COLUMN\".\n"); break; case csspp::node_type_t::COMMA: - REQUIRE_ERRORS("test.css(1): error: node name \"COMMA\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"COMMA\".\n"); break; case csspp::node_type_t::COMMENT: - REQUIRE_ERRORS("test.css(1): error: node name \"COMMENT\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"COMMENT\".\n"); break; case csspp::node_type_t::CONDITIONAL: - REQUIRE_ERRORS("test.css(1): error: node name \"CONDITIONAL\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"CONDITIONAL\".\n"); break; case csspp::node_type_t::DASH_MATCH: - REQUIRE_ERRORS("test.css(1): error: node name \"DASH_MATCH\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"DASH_MATCH\".\n"); break; case csspp::node_type_t::DECIMAL_NUMBER: - REQUIRE_ERRORS("test.css(1): error: node name \"DECIMAL_NUMBER\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"DECIMAL_NUMBER\".\n"); break; case csspp::node_type_t::DIVIDE: - REQUIRE_ERRORS("test.css(1): error: node name \"DIVIDE\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"DIVIDE\".\n"); break; case csspp::node_type_t::DOLLAR: - REQUIRE_ERRORS("test.css(1): error: node name \"DOLLAR\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"DOLLAR\".\n"); break; case csspp::node_type_t::EOF_TOKEN: - REQUIRE_ERRORS("test.css(1): error: node name \"EOF_TOKEN\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"EOF_TOKEN\".\n"); break; case csspp::node_type_t::EQUAL: - REQUIRE_ERRORS("test.css(1): error: node name \"EQUAL\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"EQUAL\".\n"); break; case csspp::node_type_t::EXCLAMATION: - REQUIRE_ERRORS("test.css(1): error: node name \"EXCLAMATION\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"EXCLAMATION\".\n"); break; case csspp::node_type_t::FONT_METRICS: - REQUIRE_ERRORS("test.css(1): error: node name \"FONT_METRICS\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"FONT_METRICS\".\n"); break; case csspp::node_type_t::FUNCTION: - REQUIRE_ERRORS("test.css(1): error: node name \"FUNCTION\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"FUNCTION\".\n"); break; case csspp::node_type_t::GREATER_EQUAL: - REQUIRE_ERRORS("test.css(1): error: node name \"GREATER_EQUAL\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"GREATER_EQUAL\".\n"); break; case csspp::node_type_t::GREATER_THAN: - REQUIRE_ERRORS("test.css(1): error: node name \"GREATER_THAN\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"GREATER_THAN\".\n"); break; case csspp::node_type_t::HASH: - REQUIRE_ERRORS("test.css(1): error: node name \"HASH\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"HASH\".\n"); break; case csspp::node_type_t::IDENTIFIER: - REQUIRE_ERRORS("test.css(1): error: node name \"IDENTIFIER\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"IDENTIFIER\".\n"); break; case csspp::node_type_t::INCLUDE_MATCH: - REQUIRE_ERRORS("test.css(1): error: node name \"INCLUDE_MATCH\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"INCLUDE_MATCH\".\n"); break; case csspp::node_type_t::INTEGER: - REQUIRE_ERRORS("test.css(1): error: node name \"INTEGER\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"INTEGER\".\n"); break; case csspp::node_type_t::LESS_EQUAL: - REQUIRE_ERRORS("test.css(1): error: node name \"LESS_EQUAL\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"LESS_EQUAL\".\n"); break; case csspp::node_type_t::LESS_THAN: - REQUIRE_ERRORS("test.css(1): error: node name \"LESS_THAN\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"LESS_THAN\".\n"); break; case csspp::node_type_t::MODULO: - REQUIRE_ERRORS("test.css(1): error: node name \"MODULO\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"MODULO\".\n"); break; case csspp::node_type_t::MULTIPLY: - REQUIRE_ERRORS("test.css(1): error: node name \"MULTIPLY\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"MULTIPLY\".\n"); break; case csspp::node_type_t::NOT_EQUAL: - REQUIRE_ERRORS("test.css(1): error: node name \"NOT_EQUAL\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"NOT_EQUAL\".\n"); break; case csspp::node_type_t::NULL_TOKEN: - REQUIRE_ERRORS("test.css(1): error: node name \"NULL_TOKEN\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"NULL_TOKEN\".\n"); break; case csspp::node_type_t::OPEN_CURLYBRACKET: - REQUIRE_ERRORS("test.css(1): error: node name \"OPEN_CURLYBRACKET\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"OPEN_CURLYBRACKET\".\n"); break; case csspp::node_type_t::OPEN_PARENTHESIS: - REQUIRE_ERRORS("test.css(1): error: node name \"OPEN_PARENTHESIS\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"OPEN_PARENTHESIS\".\n"); break; case csspp::node_type_t::OPEN_SQUAREBRACKET: - REQUIRE_ERRORS("test.css(1): error: node name \"OPEN_SQUAREBRACKET\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"OPEN_SQUAREBRACKET\".\n"); break; case csspp::node_type_t::PERCENT: - REQUIRE_ERRORS("test.css(1): error: node name \"PERCENT\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"PERCENT\".\n"); break; case csspp::node_type_t::PERIOD: - REQUIRE_ERRORS("test.css(1): error: node name \"PERIOD\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"PERIOD\".\n"); break; case csspp::node_type_t::PLACEHOLDER: - REQUIRE_ERRORS("test.css(1): error: node name \"PLACEHOLDER\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"PLACEHOLDER\".\n"); break; case csspp::node_type_t::POWER: - REQUIRE_ERRORS("test.css(1): error: node name \"POWER\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"POWER\".\n"); break; case csspp::node_type_t::PRECEDED: - REQUIRE_ERRORS("test.css(1): error: node name \"PRECEDED\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"PRECEDED\".\n"); break; case csspp::node_type_t::PREFIX_MATCH: - REQUIRE_ERRORS("test.css(1): error: node name \"PREFIX_MATCH\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"PREFIX_MATCH\".\n"); break; case csspp::node_type_t::REFERENCE: - REQUIRE_ERRORS("test.css(1): error: node name \"REFERENCE\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"REFERENCE\".\n"); break; case csspp::node_type_t::SCOPE: - REQUIRE_ERRORS("test.css(1): error: node name \"SCOPE\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"SCOPE\".\n"); break; case csspp::node_type_t::SEMICOLON: - REQUIRE_ERRORS("test.css(1): error: node name \"SEMICOLON\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"SEMICOLON\".\n"); break; case csspp::node_type_t::STRING: - REQUIRE_ERRORS("test.css(1): error: node name \"STRING\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"STRING\".\n"); break; case csspp::node_type_t::SUBSTRING_MATCH: - REQUIRE_ERRORS("test.css(1): error: node name \"SUBSTRING_MATCH\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"SUBSTRING_MATCH\".\n"); break; case csspp::node_type_t::SUBTRACT: - REQUIRE_ERRORS("test.css(1): error: node name \"SUBTRACT\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"SUBTRACT\".\n"); break; case csspp::node_type_t::SUFFIX_MATCH: - REQUIRE_ERRORS("test.css(1): error: node name \"SUFFIX_MATCH\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"SUFFIX_MATCH\".\n"); break; case csspp::node_type_t::UNICODE_RANGE: - REQUIRE_ERRORS("test.css(1): error: node name \"UNICODE_RANGE\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"UNICODE_RANGE\".\n"); break; case csspp::node_type_t::URL: - REQUIRE_ERRORS("test.css(1): error: node name \"URL\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"URL\".\n"); break; case csspp::node_type_t::VARIABLE: - REQUIRE_ERRORS("test.css(1): error: node name \"VARIABLE\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"VARIABLE\".\n"); break; case csspp::node_type_t::VARIABLE_FUNCTION: - REQUIRE_ERRORS("test.css(1): error: node name \"VARIABLE_FUNCTION\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"VARIABLE_FUNCTION\".\n"); break; case csspp::node_type_t::WHITESPACE: - REQUIRE_ERRORS("test.css(1): error: node name \"WHITESPACE\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"WHITESPACE\".\n"); break; // second part case csspp::node_type_t::AN_PLUS_B: - REQUIRE_ERRORS("test.css(1): error: node name \"AN_PLUS_B\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"AN_PLUS_B\".\n"); break; case csspp::node_type_t::ARG: - REQUIRE_ERRORS("test.css(1): error: node name \"ARG\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"ARG\".\n"); break; case csspp::node_type_t::ARRAY: - REQUIRE_ERRORS("test.css(1): error: node name \"ARRAY\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"ARRAY\".\n"); break; case csspp::node_type_t::COMPONENT_VALUE: - REQUIRE_ERRORS("test.css(1): error: node name \"COMPONENT_VALUE\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"COMPONENT_VALUE\".\n"); break; case csspp::node_type_t::DECLARATION: - REQUIRE_ERRORS("test.css(1): error: node name \"DECLARATION\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"DECLARATION\".\n"); break; case csspp::node_type_t::LIST: - REQUIRE_ERRORS("test.css(1): error: node name \"LIST\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"LIST\".\n"); break; case csspp::node_type_t::MAP: - REQUIRE_ERRORS("test.css(1): error: node name \"MAP\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"MAP\".\n"); break; case csspp::node_type_t::FRAME: - REQUIRE_ERRORS("test.css(1): error: node name \"FRAME\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"FRAME\".\n"); break; case csspp::node_type_t::max_type: - REQUIRE_ERRORS("test.css(1): error: node name \"max_type\".\n"); + VERIFY_ERRORS("test.css(1): error: node name \"max_type\".\n"); break; } @@ -2470,10 +2481,10 @@ TEST_CASE("Error with node names", "[node] [type] [output]") } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Print nodes", "[node] [output]") +CATCH_TEST_CASE("Print nodes", "[node] [output]") { // create a tree of nodes, then print it to exercise all the possible // cases of the display() function @@ -2540,7 +2551,7 @@ TEST_CASE("Print nodes", "[node] [output]") std::stringstream ss; ss << *root; - REQUIRE_TREES(ss.str(), + VERIFY_TREES(ss.str(), "LIST\n" " INTEGER \"\" I:123\n" @@ -2566,7 +2577,7 @@ TEST_CASE("Print nodes", "[node] [output]") std::stringstream ss2; ss2 << *p; - REQUIRE_TREES(ss2.str(), + VERIFY_TREES(ss2.str(), "LIST\n" " INTEGER \"\" I:123\n" @@ -2587,10 +2598,10 @@ TEST_CASE("Print nodes", "[node] [output]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Font metrics", "[node] [output]") +CATCH_TEST_CASE("Font metrics", "[node] [output]") { // create a tree of nodes, then print it to exercise all the possible // cases of the display() function @@ -2601,32 +2612,25 @@ TEST_CASE("Font metrics", "[node] [output]") { csspp::decimal_number_t const size(static_cast(rand() % 1000) / 10.0); font_metrics->set_font_size(size); - REQUIRE((font_metrics->get_font_size() - size) < 0.0001); + CATCH_REQUIRE((font_metrics->get_font_size() - size) < 0.0001); csspp::decimal_number_t const height(static_cast(rand() % 1000) / 10.0); font_metrics->set_line_height(height); - REQUIRE((font_metrics->get_line_height() - height) < 0.0001); + CATCH_REQUIRE((font_metrics->get_line_height() - height) < 0.0001); // line height has no effect on the font size - REQUIRE((font_metrics->get_font_size() - size) < 0.0001); + CATCH_REQUIRE((font_metrics->get_font_size() - size) < 0.0001); // to see that font size has no effect on line height... csspp::decimal_number_t const size2(static_cast(rand() % 1000) / 10.0); font_metrics->set_font_size(size2); - REQUIRE((font_metrics->get_font_size() - size2) < 0.0001); + CATCH_REQUIRE((font_metrics->get_font_size() - size2) < 0.0001); - REQUIRE((font_metrics->get_line_height() - height) < 0.0001); + CATCH_REQUIRE((font_metrics->get_line_height() - height) < 0.0001); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_nth_child.cpp b/tests/catch_nth_child.cpp index b374bf3..d620494 100644 --- a/tests/catch_nth_child.cpp +++ b/tests/catch_nth_child.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the nth_child.cpp file. @@ -22,15 +24,27 @@ * implementation to ensure full coverage. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// csspp lib +// +#include "csspp/nth_child.h" + + +// C++ lib +// +#include + + +// last include +// +#include -//#include "csspp/exceptions.h" -//#include "csspp/lexer.h" -#include "csspp/nth_child.h" -#include -//#include namespace { @@ -39,72 +53,72 @@ namespace } // no name namespace -TEST_CASE("Nth child", "[nth-child] [constructors]") +CATCH_TEST_CASE("Nth child", "[nth-child] [constructors]") { { csspp::nth_child a((4LL << 32) + 3); - REQUIRE(a.get_a() == 3); - REQUIRE(a.get_b() == 4); - REQUIRE(a.get_nth() == ((4LL << 32) + 3)); - REQUIRE(a.get_error() == ""); - REQUIRE(a.to_string() == "3n+4"); + CATCH_REQUIRE(a.get_a() == 3); + CATCH_REQUIRE(a.get_b() == 4); + CATCH_REQUIRE(a.get_nth() == ((4LL << 32) + 3)); + CATCH_REQUIRE(a.get_error() == ""); + CATCH_REQUIRE(a.to_string() == "3n+4"); } { csspp::nth_child a(3, 4); - REQUIRE(a.get_a() == 3); - REQUIRE(a.get_b() == 4); - REQUIRE(a.get_nth() == ((4LL << 32) + 3)); - REQUIRE(a.get_error() == ""); - REQUIRE(a.to_string() == "3n+4"); + CATCH_REQUIRE(a.get_a() == 3); + CATCH_REQUIRE(a.get_b() == 4); + CATCH_REQUIRE(a.get_nth() == ((4LL << 32) + 3)); + CATCH_REQUIRE(a.get_error() == ""); + CATCH_REQUIRE(a.to_string() == "3n+4"); } { csspp::nth_child a("3n+4"); - REQUIRE(a.get_a() == 3); - REQUIRE(a.get_b() == 4); - REQUIRE(a.get_nth() == ((4LL << 32) + 3)); - REQUIRE(a.get_error() == ""); - REQUIRE(a.to_string() == "3n+4"); + CATCH_REQUIRE(a.get_a() == 3); + CATCH_REQUIRE(a.get_b() == 4); + CATCH_REQUIRE(a.get_nth() == ((4LL << 32) + 3)); + CATCH_REQUIRE(a.get_error() == ""); + CATCH_REQUIRE(a.to_string() == "3n+4"); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Simple nth child", "[nth-child] [basics]") +CATCH_TEST_CASE("Simple nth child", "[nth-child] [basics]") { { csspp::nth_child a(-3, 9); - REQUIRE(a.get_a() == -3); - REQUIRE(a.get_b() == 9); - REQUIRE(a.get_nth() == ((9LL << 32) + 0xFFFFFFFD)); - REQUIRE(a.get_error() == ""); - REQUIRE(a.to_string() == "-3n+9"); + CATCH_REQUIRE(a.get_a() == -3); + CATCH_REQUIRE(a.get_b() == 9); + CATCH_REQUIRE(a.get_nth() == ((9LL << 32) + 0xFFFFFFFD)); + CATCH_REQUIRE(a.get_error() == ""); + CATCH_REQUIRE(a.to_string() == "-3n+9"); // special cases a.parse("odd"); - REQUIRE(a.get_a() == 2); - REQUIRE(a.get_b() == 1); - REQUIRE(a.get_nth() == ((1LL << 32) + 2)); - REQUIRE(a.get_error() == ""); - REQUIRE(a.to_string() == "odd"); + CATCH_REQUIRE(a.get_a() == 2); + CATCH_REQUIRE(a.get_b() == 1); + CATCH_REQUIRE(a.get_nth() == ((1LL << 32) + 2)); + CATCH_REQUIRE(a.get_error() == ""); + CATCH_REQUIRE(a.to_string() == "odd"); a.parse("even"); - REQUIRE(a.get_a() == 2); - REQUIRE(a.get_b() == 0); - REQUIRE(a.get_nth() == ((0LL << 32) + 2)); - REQUIRE(a.get_error() == ""); - REQUIRE(a.to_string() == "2n"); + CATCH_REQUIRE(a.get_a() == 2); + CATCH_REQUIRE(a.get_b() == 0); + CATCH_REQUIRE(a.get_nth() == ((0LL << 32) + 2)); + CATCH_REQUIRE(a.get_error() == ""); + CATCH_REQUIRE(a.to_string() == "2n"); } { csspp::nth_child a(3, 4); - REQUIRE(a.get_a() == 3); - REQUIRE(a.get_b() == 4); - REQUIRE(a.get_nth() == ((4LL << 32) + 3)); - REQUIRE(a.get_error() == ""); - REQUIRE(a.to_string() == "3n+4"); + CATCH_REQUIRE(a.get_a() == 3); + CATCH_REQUIRE(a.get_b() == 4); + CATCH_REQUIRE(a.get_nth() == ((4LL << 32) + 3)); + CATCH_REQUIRE(a.get_error() == ""); + CATCH_REQUIRE(a.to_string() == "3n+4"); std::string expected; for(int i(-100); i <= 100; ++i) @@ -114,10 +128,10 @@ TEST_CASE("Simple nth child", "[nth-child] [basics]") a.set_a(i); a.set_b(j); - REQUIRE(a.get_a() == i); - REQUIRE(a.get_b() == j); - REQUIRE(a.get_nth() == ((static_cast(j) << 32) + (i & 0xFFFFFFFF))); - REQUIRE(a.get_error() == ""); + CATCH_REQUIRE(a.get_a() == i); + CATCH_REQUIRE(a.get_b() == j); + CATCH_REQUIRE(a.get_nth() == ((static_cast(j) << 32) + (i & 0xFFFFFFFF))); + CATCH_REQUIRE(a.get_error() == ""); if(i == 2 && j == 1) { expected = "odd"; @@ -134,7 +148,7 @@ TEST_CASE("Simple nth child", "[nth-child] [basics]") { expected = std::to_string(i) + "n" + (j >= 0 ? "+" : "") + std::to_string(j); } - REQUIRE(a.to_string() == expected); + CATCH_REQUIRE(a.to_string() == expected); // try all combos with spaces for(int k(0); k < (1 << 6); ++k) @@ -153,11 +167,11 @@ TEST_CASE("Simple nth child", "[nth-child] [basics]") + ((k & (1 << 5)) ? " " : "") ); - REQUIRE(a.get_a() == i); - REQUIRE(a.get_b() == j); - REQUIRE(a.get_nth() == ((static_cast(j) << 32) + (i & 0xFFFFFFFF))); - REQUIRE(a.get_error() == ""); - REQUIRE(a.to_string() == expected); + CATCH_REQUIRE(a.get_a() == i); + CATCH_REQUIRE(a.get_b() == j); + CATCH_REQUIRE(a.get_nth() == ((static_cast(j) << 32) + (i & 0xFFFFFFFF))); + CATCH_REQUIRE(a.get_error() == ""); + CATCH_REQUIRE(a.to_string() == expected); } if(i == 0) @@ -172,11 +186,11 @@ TEST_CASE("Simple nth child", "[nth-child] [basics]") + ((k & (1 << 2)) ? " " : "") ); - REQUIRE(a.get_a() == i); - REQUIRE(a.get_b() == j); - REQUIRE(a.get_nth() == ((static_cast(j) << 32) + (i & 0xFFFFFFFF))); - REQUIRE(a.get_error() == ""); - REQUIRE(a.to_string() == expected); + CATCH_REQUIRE(a.get_a() == i); + CATCH_REQUIRE(a.get_b() == j); + CATCH_REQUIRE(a.get_nth() == ((static_cast(j) << 32) + (i & 0xFFFFFFFF))); + CATCH_REQUIRE(a.get_error() == ""); + CATCH_REQUIRE(a.to_string() == expected); } } } @@ -184,92 +198,85 @@ TEST_CASE("Simple nth child", "[nth-child] [basics]") } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid nth child", "[nth-child] [invalid]") +CATCH_TEST_CASE("Invalid nth child", "[nth-child] [invalid]") { { csspp::nth_child a(5, 3); - REQUIRE(a.get_a() == 5); - REQUIRE(a.get_b() == 3); - REQUIRE(a.get_nth() == ((3LL << 32) + 5)); - REQUIRE(a.get_error() == ""); - REQUIRE(a.to_string() == "5n+3"); + CATCH_REQUIRE(a.get_a() == 5); + CATCH_REQUIRE(a.get_b() == 3); + CATCH_REQUIRE(a.get_nth() == ((3LL << 32) + 5)); + CATCH_REQUIRE(a.get_error() == ""); + CATCH_REQUIRE(a.to_string() == "5n+3"); - REQUIRE_FALSE(a.parse("random")); - REQUIRE(a.get_error() == "In an An+B expression, we expect an optional signed followed by a number or 'even' or 'odd'."); + CATCH_REQUIRE_FALSE(a.parse("random")); + CATCH_REQUIRE(a.get_error() == "In an An+B expression, we expect an optional signed followed by a number or 'even' or 'odd'."); - REQUIRE_FALSE(a.parse("electric")); - REQUIRE(a.get_error() == "In an An+B expression, we expect an optional signed followed by a number or 'even' or 'odd'."); + CATCH_REQUIRE_FALSE(a.parse("electric")); + CATCH_REQUIRE(a.get_error() == "In an An+B expression, we expect an optional signed followed by a number or 'even' or 'odd'."); - REQUIRE_FALSE(a.parse("even3")); - REQUIRE(a.get_error() == "'even' cannot be followed by anything else in an An+B expression."); + CATCH_REQUIRE_FALSE(a.parse("even3")); + CATCH_REQUIRE(a.get_error() == "'even' cannot be followed by anything else in an An+B expression."); - REQUIRE_FALSE(a.parse("odor")); - REQUIRE(a.get_error() == "In an An+B expression, we expect an optional signed followed by a number or 'even' or 'odd'."); + CATCH_REQUIRE_FALSE(a.parse("odor")); + CATCH_REQUIRE(a.get_error() == "In an An+B expression, we expect an optional signed followed by a number or 'even' or 'odd'."); - REQUIRE_FALSE(a.parse("odd+3")); - REQUIRE(a.get_error() == "'odd' cannot be followed by anything else in an An+B expression."); + CATCH_REQUIRE_FALSE(a.parse("odd+3")); + CATCH_REQUIRE(a.get_error() == "'odd' cannot be followed by anything else in an An+B expression."); - REQUIRE_FALSE(a.parse("++5")); - REQUIRE(a.get_error() == "In an An+B expression, we expect an optional signed followed by a number or 'even' or 'odd'."); + CATCH_REQUIRE_FALSE(a.parse("++5")); + CATCH_REQUIRE(a.get_error() == "In an An+B expression, we expect an optional signed followed by a number or 'even' or 'odd'."); - REQUIRE_FALSE(a.parse("--5")); - REQUIRE(a.get_error() == "In an An+B expression, we expect an optional signed followed by a number or 'even' or 'odd'."); + CATCH_REQUIRE_FALSE(a.parse("--5")); + CATCH_REQUIRE(a.get_error() == "In an An+B expression, we expect an optional signed followed by a number or 'even' or 'odd'."); - REQUIRE_FALSE(a.parse("5+3")); - REQUIRE(a.get_error() == "The first number has to be followed by the 'n' character."); + CATCH_REQUIRE_FALSE(a.parse("5+3")); + CATCH_REQUIRE(a.get_error() == "The first number has to be followed by the 'n' character."); - REQUIRE_FALSE(a.parse("5n3")); - REQUIRE(a.get_error() == "A sign (+ or -) is expected between the 'An' and the 'B' parts in 'An+B'."); + CATCH_REQUIRE_FALSE(a.parse("5n3")); + CATCH_REQUIRE(a.get_error() == "A sign (+ or -) is expected between the 'An' and the 'B' parts in 'An+B'."); - REQUIRE_FALSE(a.parse("5n+odd")); - REQUIRE(a.get_error() == "The value B must be a valid integer in 'An+B'."); + CATCH_REQUIRE_FALSE(a.parse("5n+odd")); + CATCH_REQUIRE(a.get_error() == "The value B must be a valid integer in 'An+B'."); - REQUIRE_FALSE(a.parse("5n+even")); - REQUIRE(a.get_error() == "The value B must be a valid integer in 'An+B'."); + CATCH_REQUIRE_FALSE(a.parse("5n+even")); + CATCH_REQUIRE(a.get_error() == "The value B must be a valid integer in 'An+B'."); - REQUIRE_FALSE(a.parse("5n++")); - REQUIRE(a.get_error() == "The value B must be a valid integer in 'An+B'."); + CATCH_REQUIRE_FALSE(a.parse("5n++")); + CATCH_REQUIRE(a.get_error() == "The value B must be a valid integer in 'An+B'."); - REQUIRE_FALSE(a.parse("5n-+")); - REQUIRE(a.get_error() == "The value B must be a valid integer in 'An+B'."); + CATCH_REQUIRE_FALSE(a.parse("5n-+")); + CATCH_REQUIRE(a.get_error() == "The value B must be a valid integer in 'An+B'."); - REQUIRE_FALSE(a.parse("5n+-")); - REQUIRE(a.get_error() == "The value B must be a valid integer in 'An+B'."); + CATCH_REQUIRE_FALSE(a.parse("5n+-")); + CATCH_REQUIRE(a.get_error() == "The value B must be a valid integer in 'An+B'."); - REQUIRE_FALSE(a.parse("5n--")); - REQUIRE(a.get_error() == "The value B must be a valid integer in 'An+B'."); + CATCH_REQUIRE_FALSE(a.parse("5n--")); + CATCH_REQUIRE(a.get_error() == "The value B must be a valid integer in 'An+B'."); - REQUIRE_FALSE(a.parse("5n-3odd")); - REQUIRE(a.get_error() == "An 'An+B' expression cannot be followed by anything else."); + CATCH_REQUIRE_FALSE(a.parse("5n-3odd")); + CATCH_REQUIRE(a.get_error() == "An 'An+B' expression cannot be followed by anything else."); - REQUIRE_FALSE(a.parse("5n-3even")); - REQUIRE(a.get_error() == "An 'An+B' expression cannot be followed by anything else."); + CATCH_REQUIRE_FALSE(a.parse("5n-3even")); + CATCH_REQUIRE(a.get_error() == "An 'An+B' expression cannot be followed by anything else."); - REQUIRE_FALSE(a.parse("5n-3+")); - REQUIRE(a.get_error() == "An 'An+B' expression cannot be followed by anything else."); + CATCH_REQUIRE_FALSE(a.parse("5n-3+")); + CATCH_REQUIRE(a.get_error() == "An 'An+B' expression cannot be followed by anything else."); - REQUIRE_FALSE(a.parse("5n-3-")); - REQUIRE(a.get_error() == "An 'An+B' expression cannot be followed by anything else."); + CATCH_REQUIRE_FALSE(a.parse("5n-3-")); + CATCH_REQUIRE(a.get_error() == "An 'An+B' expression cannot be followed by anything else."); - REQUIRE_FALSE(a.parse("5n-3 3")); - REQUIRE(a.get_error() == "An 'An+B' expression cannot be followed by anything else."); + CATCH_REQUIRE_FALSE(a.parse("5n-3 3")); + CATCH_REQUIRE(a.get_error() == "An 'An+B' expression cannot be followed by anything else."); - REQUIRE_FALSE(a.parse("5n-3n")); - REQUIRE(a.get_error() == "An 'An+B' expression cannot be followed by anything else."); + CATCH_REQUIRE_FALSE(a.parse("5n-3n")); + CATCH_REQUIRE(a.get_error() == "An 'An+B' expression cannot be followed by anything else."); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_parser.cpp b/tests/catch_parser.cpp index fc0e51e..016829d 100644 --- a/tests/catch_parser.cpp +++ b/tests/catch_parser.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the parser.cpp file. @@ -29,15 +31,33 @@ * is not known at the time the parser returns. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + -#include "csspp/exceptions.h" -#include "csspp/parser.h" +// csspp lib +// +#include +#include + +// C++ lib +// #include + +// C lib +// #include + +// last include +// +#include + + + namespace { @@ -46,7 +66,7 @@ namespace -TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") +CATCH_TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") { { std::stringstream ss; @@ -62,7 +82,7 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -80,7 +100,7 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } { @@ -97,7 +117,7 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -123,7 +143,7 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // one large rule with semicolons inside @@ -146,7 +166,7 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -192,7 +212,7 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // a comment, a simple rule, a comment @@ -212,7 +232,7 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -228,7 +248,7 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // one empty C-like comment @@ -246,7 +266,7 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -261,7 +281,7 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // multiple empty C-like comments @@ -279,7 +299,7 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -294,7 +314,7 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // cascading fields @@ -313,11 +333,11 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") csspp::node::pointer_t n(p.stylesheet()); //std::cerr << "Result is: [" << *n << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -368,7 +388,7 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // verify support of an empty {}-block @@ -384,11 +404,11 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") csspp::node::pointer_t n(p.stylesheet()); //std::cerr << "Result is: [" << *n << "]\n"; - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -411,11 +431,11 @@ TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } } -TEST_CASE("Invalid stylesheets", "[parser] [stylesheet] [invalid]") +CATCH_TEST_CASE("Invalid stylesheets", "[parser] [stylesheet] [invalid]") { // closing '}' one too many times { @@ -432,7 +452,7 @@ TEST_CASE("Invalid stylesheets", "[parser] [stylesheet] [invalid]") // this failed with an error, no need to check the "broken" output - REQUIRE_ERRORS("test.css(1): error: Unexpected closing block of type: CLOSE_CURLYBRACKET.\n"); + VERIFY_ERRORS("test.css(1): error: Unexpected closing block of type: CLOSE_CURLYBRACKET.\n"); } // closing ']' one too many times @@ -450,7 +470,7 @@ TEST_CASE("Invalid stylesheets", "[parser] [stylesheet] [invalid]") // this failed with an error, no need to check the "broken" output - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: A qualified rule must end with a { ... } block.\n" "test.css(1): error: Unexpected closing block of type: CLOSE_SQUAREBRACKET.\n" ); @@ -471,7 +491,7 @@ TEST_CASE("Invalid stylesheets", "[parser] [stylesheet] [invalid]") // this failed with an error, no need to check the "broken" output - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: Block expected to end with CLOSE_CURLYBRACKET but got CLOSE_PARENTHESIS instead.\n" //"test.css(1): error: Unexpected closing block of type: CLOSE_PARENTHESIS.\n" ); @@ -492,16 +512,16 @@ TEST_CASE("Invalid stylesheets", "[parser] [stylesheet] [invalid]") // this failed with an error, no need to check the "broken" output - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: A qualified rule cannot end a { ... } block with a ';'.\n" ); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Simple rules", "[parser] [rule-list]") +CATCH_TEST_CASE("Simple rules", "[parser] [rule-list]") { // a simple valid rule { @@ -519,7 +539,7 @@ TEST_CASE("Simple rules", "[parser] [rule-list]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -549,7 +569,7 @@ TEST_CASE("Simple rules", "[parser] [rule-list]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // a simple valid rule @@ -570,7 +590,7 @@ TEST_CASE("Simple rules", "[parser] [rule-list]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -608,11 +628,11 @@ TEST_CASE("Simple rules", "[parser] [rule-list]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } } -TEST_CASE("Nested rules", "[parser] [rule-list]") +CATCH_TEST_CASE("Nested rules", "[parser] [rule-list]") { // at rule inside another at rule { @@ -626,13 +646,13 @@ TEST_CASE("Nested rules", "[parser] [rule-list]") csspp::node::pointer_t n(p.rule_list()); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"if\" I:0\n" @@ -646,7 +666,7 @@ TEST_CASE("Nested rules", "[parser] [rule-list]") } } -TEST_CASE("Invalid rules", "[parser] [rule-list] [invalid]") +CATCH_TEST_CASE("Invalid rules", "[parser] [rule-list] [invalid]") { // breaks on the ) are not allowed in this CSS document.\n"); + VERIFY_ERRORS("test.css(1): error: HTML comment delimiters () are not allowed in this CSS document.\n"); } // breaks on the --> @@ -683,7 +703,7 @@ TEST_CASE("Invalid rules", "[parser] [rule-list] [invalid]") // this failed with an error, no need to check the "broken" output - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: A qualified rule cannot be empty; you are missing a { ... } block.\n" "test.css(1): error: HTML comment delimiters () are not allowed in this CSS document.\n" ); @@ -705,7 +725,7 @@ TEST_CASE("Invalid rules", "[parser] [rule-list] [invalid]") // this failed with an error, no need to check the "broken" output - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: A qualified rule cannot be empty; you are missing a { ... } block.\n" "test.css(1): error: Unexpected closing block of type: CLOSE_CURLYBRACKET.\n" ); @@ -727,7 +747,7 @@ TEST_CASE("Invalid rules", "[parser] [rule-list] [invalid]") // this failed with an error, no need to check the "broken" output - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: A qualified rule must end with a { ... } block.\n" "test.css(1): error: Unexpected closing block of type: CLOSE_SQUAREBRACKET.\n" ); @@ -749,7 +769,7 @@ TEST_CASE("Invalid rules", "[parser] [rule-list] [invalid]") // this failed with an error, no need to check the "broken" output - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: Block expected to end with CLOSE_CURLYBRACKET but got CLOSE_PARENTHESIS instead.\n" //"test.css(1): error: Unexpected closing block of type: CLOSE_PARENTHESIS.\n" ); @@ -770,7 +790,7 @@ TEST_CASE("Invalid rules", "[parser] [rule-list] [invalid]") //std::cerr << "Result is: [" << *n << "]\n"; - REQUIRE_ERRORS("test.css(1): error: At '@' command cannot be empty (missing expression or block) unless ended by a semicolon (;).\n"); + VERIFY_ERRORS("test.css(1): error: At '@' command cannot be empty (missing expression or block) unless ended by a semicolon (;).\n"); } // a @-rule cannot be empty @@ -787,7 +807,7 @@ TEST_CASE("Invalid rules", "[parser] [rule-list] [invalid]") //std::cerr << "Result is: [" << *n << "]\n"; - REQUIRE_ERRORS("test.css(1): error: At '@' command must end with a block or a ';'.\n"); + VERIFY_ERRORS("test.css(1): error: At '@' command must end with a block or a ';'.\n"); } // :INTEGER is not valid, plus it is viewed as a nested rule! @@ -801,14 +821,14 @@ TEST_CASE("Invalid rules", "[parser] [rule-list] [invalid]") csspp::node::pointer_t n(p.stylesheet()); - REQUIRE_ERRORS("test.css(1): error: Variable set to a block and a nested property block must end with a semicolon (;) after said block.\n"); + VERIFY_ERRORS("test.css(1): error: Variable set to a block and a nested property block must end with a semicolon (;) after said block.\n"); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("One simple rule", "[parser] [rule]") +CATCH_TEST_CASE("One simple rule", "[parser] [rule]") { // a simple valid rule { @@ -825,7 +845,7 @@ TEST_CASE("One simple rule", "[parser] [rule]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "COMPONENT_VALUE\n" " IDENTIFIER \"body\"\n" @@ -872,7 +892,7 @@ TEST_CASE("One simple rule", "[parser] [rule]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "COMPONENT_VALUE\n" " IDENTIFIER \"div\"\n" @@ -889,7 +909,7 @@ TEST_CASE("One simple rule", "[parser] [rule]") out.str(""); out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "AT_KEYWORD \"media\" I:0\n" " IDENTIFIER \"screen\"\n" @@ -908,7 +928,7 @@ TEST_CASE("One simple rule", "[parser] [rule]") out.str(""); out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "COMPONENT_VALUE\n" " IDENTIFIER \"div\"\n" @@ -929,10 +949,10 @@ TEST_CASE("One simple rule", "[parser] [rule]") } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid one rule", "[parser] [rule] [invalid]") +CATCH_TEST_CASE("Invalid one rule", "[parser] [rule] [invalid]") { // breaks on the ) are not allowed in this CSS document.\n"); + VERIFY_ERRORS("test.css(1): error: HTML comment delimiters () are not allowed in this CSS document.\n"); } // breaks on the --> @@ -967,7 +987,7 @@ TEST_CASE("Invalid one rule", "[parser] [rule] [invalid]") // this failed with an error, no need to check the "broken" output - REQUIRE_ERRORS("test.css(1): error: HTML comment delimiters () are not allowed in this CSS document.\n"); + VERIFY_ERRORS("test.css(1): error: HTML comment delimiters () are not allowed in this CSS document.\n"); } // breaks on the } @@ -986,7 +1006,7 @@ TEST_CASE("Invalid one rule", "[parser] [rule] [invalid]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "COMPONENT_VALUE\n" " IDENTIFIER \"body\"\n" @@ -1005,7 +1025,7 @@ TEST_CASE("Invalid one rule", "[parser] [rule] [invalid]") // this failed with an error, no need to check the "broken" output n = p.rule(); - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: A qualified rule cannot be empty; you are missing a { ... } block.\n" //"test.css(1): error: Unexpected closing block of type: CLOSE_CURLYBRACKET.\n" ); @@ -1027,7 +1047,7 @@ TEST_CASE("Invalid one rule", "[parser] [rule] [invalid]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "COMPONENT_VALUE\n" " IDENTIFIER \"body\"\n" @@ -1041,7 +1061,7 @@ TEST_CASE("Invalid one rule", "[parser] [rule] [invalid]") // this failed with an error, no need to check the "broken" output n = p.rule(); - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: A qualified rule must end with a { ... } block.\n" "test.css(1): error: Unexpected closing block of type: CLOSE_SQUAREBRACKET.\n" ); @@ -1062,7 +1082,7 @@ TEST_CASE("Invalid one rule", "[parser] [rule] [invalid]") // this failed with an error, no need to check the "broken" output - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: Block expected to end with CLOSE_CURLYBRACKET but got CLOSE_PARENTHESIS instead.\n" //"test.css(1): error: Unexpected closing block of type: CLOSE_PARENTHESIS.\n" ); @@ -1084,7 +1104,7 @@ TEST_CASE("Invalid one rule", "[parser] [rule] [invalid]") // // std::stringstream out; // out << *n; -// REQUIRE_TREES(out.str(), +// VERIFY_TREES(out.str(), // //"COMPONENT_VALUE\n" //" IDENTIFIER \"div\"\n" @@ -1099,7 +1119,7 @@ TEST_CASE("Invalid one rule", "[parser] [rule] [invalid]") // // this failed with an error, no need to check the "broken" output // n = p.rule(); // -// REQUIRE_ERRORS("test.css(1): error: At '@' command cannot be empty (missing expression or block) unless ended by a semicolon (;).\n"); +// VERIFY_ERRORS("test.css(1): error: At '@' command cannot be empty (missing expression or block) unless ended by a semicolon (;).\n"); // } // // // a @-rule cannot be empty @@ -1115,14 +1135,14 @@ TEST_CASE("Invalid one rule", "[parser] [rule] [invalid]") // ////std::cerr << "Result is: [" << *n << "]\n"; // -// REQUIRE_ERRORS("test.css(1): error: At '@' command must end with a block or a ';'.\n"); +// VERIFY_ERRORS("test.css(1): error: At '@' command must end with a block or a ';'.\n"); // } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Simple component values", "[parser] [component-value]") +CATCH_TEST_CASE("Simple component values", "[parser] [component-value]") { // a simple valid rule { @@ -1139,7 +1159,7 @@ TEST_CASE("Simple component values", "[parser] [component-value]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "COMPONENT_VALUE\n" " IDENTIFIER \"body\"\n" @@ -1186,7 +1206,7 @@ TEST_CASE("Simple component values", "[parser] [component-value]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "COMPONENT_VALUE\n" " IDENTIFIER \"div\"\n" @@ -1203,7 +1223,7 @@ TEST_CASE("Simple component values", "[parser] [component-value]") out.str(""); out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "AT_KEYWORD \"media\" I:0\n" " IDENTIFIER \"screen\"\n" @@ -1222,7 +1242,7 @@ TEST_CASE("Simple component values", "[parser] [component-value]") out.str(""); out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "COMPONENT_VALUE\n" " IDENTIFIER \"div\"\n" @@ -1243,10 +1263,10 @@ TEST_CASE("Simple component values", "[parser] [component-value]") } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid component values", "[parser] [component-value] [invalid]") +CATCH_TEST_CASE("Invalid component values", "[parser] [component-value] [invalid]") { // breaks on missing } { @@ -1263,7 +1283,7 @@ TEST_CASE("Invalid component values", "[parser] [component-value] [invalid]") // this failed with an error, no need to check the "broken" output - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: Block expected to end with CLOSE_CURLYBRACKET but got EOF_TOKEN instead.\n" ); } @@ -1284,7 +1304,7 @@ TEST_CASE("Invalid component values", "[parser] [component-value] [invalid]") // this failed with an error, no need to check the "broken" output - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: Block expected to end with CLOSE_SQUAREBRACKET but got CLOSE_CURLYBRACKET instead.\n" ); } @@ -1304,16 +1324,16 @@ TEST_CASE("Invalid component values", "[parser] [component-value] [invalid]") // this failed with an error, no need to check the "broken" output - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: Block expected to end with CLOSE_PARENTHESIS but got CLOSE_CURLYBRACKET instead.\n" ); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Simple one component value", "[parser] [component-value]") +CATCH_TEST_CASE("Simple one component value", "[parser] [component-value]") { // a simple valid rule { @@ -1384,17 +1404,17 @@ TEST_CASE("Simple one component value", "[parser] [component-value]") csspp::node::pointer_t n(p.component_value()); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), results[i]); + VERIFY_TREES(out.str(), results[i]); csspp_test::compare(out.str(), results[i], __FILE__, i + 1); } } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Invalid one component value", "[parser] [component-value] [invalid]") +CATCH_TEST_CASE("Invalid one component value", "[parser] [component-value] [invalid]") { // breaks on missing } { @@ -1429,11 +1449,11 @@ TEST_CASE("Invalid one component value", "[parser] [component-value] [invalid]") csspp::node::pointer_t n(p.component_value()); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), results[i]); + VERIFY_TREES(out.str(), results[i]); csspp_test::compare(out.str(), results[i], __FILE__, i + 1); } - REQUIRE_ERRORS("test.css(1): error: Block expected to end with CLOSE_CURLYBRACKET but got EOF_TOKEN instead.\n"); + VERIFY_ERRORS("test.css(1): error: Block expected to end with CLOSE_CURLYBRACKET but got EOF_TOKEN instead.\n"); } // breaks on missing ] @@ -1464,11 +1484,11 @@ TEST_CASE("Invalid one component value", "[parser] [component-value] [invalid]") csspp::node::pointer_t n(p.component_value()); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), results[i]); + VERIFY_TREES(out.str(), results[i]); csspp_test::compare(out.str(), results[i], __FILE__, i + 1); } - REQUIRE_ERRORS("test.css(1): error: Block expected to end with CLOSE_SQUAREBRACKET but got EOF_TOKEN instead.\n"); + VERIFY_ERRORS("test.css(1): error: Block expected to end with CLOSE_SQUAREBRACKET but got EOF_TOKEN instead.\n"); } // breaks on missing ) @@ -1503,18 +1523,18 @@ TEST_CASE("Invalid one component value", "[parser] [component-value] [invalid]") csspp::node::pointer_t n(p.component_value()); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), results[i]); + VERIFY_TREES(out.str(), results[i]); csspp_test::compare(out.str(), results[i], __FILE__, i + 1); } - REQUIRE_ERRORS("test.css(1): error: Block expected to end with CLOSE_PARENTHESIS but got CLOSE_CURLYBRACKET instead.\n"); + VERIFY_ERRORS("test.css(1): error: Block expected to end with CLOSE_PARENTHESIS but got CLOSE_CURLYBRACKET instead.\n"); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Simple declarations", "[parser] [declaration]") +CATCH_TEST_CASE("Simple declarations", "[parser] [declaration]") { // a simple valid declaration { @@ -1532,7 +1552,7 @@ TEST_CASE("Simple declarations", "[parser] [declaration]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " DECLARATION \"background\"\n" @@ -1562,7 +1582,7 @@ TEST_CASE("Simple declarations", "[parser] [declaration]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // a @-rule in a declaration @@ -1581,7 +1601,7 @@ TEST_CASE("Simple declarations", "[parser] [declaration]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"enhanced\" I:0\n" @@ -1611,7 +1631,7 @@ TEST_CASE("Simple declarations", "[parser] [declaration]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // multiple declarations require a ';' @@ -1630,7 +1650,7 @@ TEST_CASE("Simple declarations", "[parser] [declaration]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " DECLARATION \"a\"\n" @@ -1646,7 +1666,7 @@ TEST_CASE("Simple declarations", "[parser] [declaration]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // multiple declarations require a ';' @@ -1665,7 +1685,7 @@ TEST_CASE("Simple declarations", "[parser] [declaration]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " DECLARATION \"a\"\n" @@ -1686,11 +1706,11 @@ TEST_CASE("Simple declarations", "[parser] [declaration]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } } -TEST_CASE("Invalid declarations", "[parser] [declaration] [invalid]") +CATCH_TEST_CASE("Invalid declarations", "[parser] [declaration] [invalid]") { // declarations must end with EOF { @@ -1706,7 +1726,7 @@ TEST_CASE("Invalid declarations", "[parser] [declaration] [invalid]") //std::cerr << "Result is: [" << *n << "]\n"; - REQUIRE_ERRORS("test.css(1): error: the end of the stream was not reached in this declaration, we stopped on a CDO.\n"); + VERIFY_ERRORS("test.css(1): error: the end of the stream was not reached in this declaration, we stopped on a CDO.\n"); } // declarations missing a ':' @@ -1723,7 +1743,7 @@ TEST_CASE("Invalid declarations", "[parser] [declaration] [invalid]") //std::cerr << "Result is: [" << *n << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: ':' missing in your declaration starting with \"background\".\n" ); } @@ -1742,17 +1762,17 @@ TEST_CASE("Invalid declarations", "[parser] [declaration] [invalid]") //std::cerr << "Result is: [" << *n << "]\n"; - REQUIRE_ERRORS( + VERIFY_ERRORS( "test.css(1): error: A '!' must be followed by an identifier, got a FUNCTION instead.\n" //"test.css(1): error: the end of the stream was not reached in this declaration, we stopped on a FUNCTION.\n" ); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Multi-line, multi-level stylesheet", "[parser] [rules]") +CATCH_TEST_CASE("Multi-line, multi-level stylesheet", "[parser] [rules]") { { std::stringstream ss; @@ -1771,13 +1791,13 @@ TEST_CASE("Multi-line, multi-level stylesheet", "[parser] [rules]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -1879,10 +1899,10 @@ TEST_CASE("Multi-line, multi-level stylesheet", "[parser] [rules]") } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Is variable set", "[parser] [variable] [invalid]") +CATCH_TEST_CASE("Is variable set", "[parser] [variable] [invalid]") { // simple test with a value + value (SASS compatible) { @@ -1896,13 +1916,13 @@ TEST_CASE("Is variable set", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -1914,8 +1934,8 @@ TEST_CASE("Is variable set", "[parser] [variable] [invalid]") ); csspp::node::pointer_t var(n->get_child(0)); - REQUIRE(csspp::parser::is_variable_set(var, false)); - REQUIRE_FALSE(csspp::parser::is_variable_set(var, true)); + CATCH_REQUIRE(csspp::parser::is_variable_set(var, false)); + CATCH_REQUIRE_FALSE(csspp::parser::is_variable_set(var, true)); } // case were we actually use a variable to define a selector @@ -1931,13 +1951,13 @@ TEST_CASE("Is variable set", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -1955,8 +1975,8 @@ TEST_CASE("Is variable set", "[parser] [variable] [invalid]") ); csspp::node::pointer_t var(n->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_variable_set(var, false)); - REQUIRE_FALSE(csspp::parser::is_variable_set(var, true)); + CATCH_REQUIRE_FALSE(csspp::parser::is_variable_set(var, false)); + CATCH_REQUIRE_FALSE(csspp::parser::is_variable_set(var, true)); } // test with a variable block @@ -1971,13 +1991,13 @@ TEST_CASE("Is variable set", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -1993,8 +2013,8 @@ TEST_CASE("Is variable set", "[parser] [variable] [invalid]") ); csspp::node::pointer_t var(n->get_child(0)); - REQUIRE(csspp::parser::is_variable_set(var, false)); - REQUIRE(csspp::parser::is_variable_set(var, true)); + CATCH_REQUIRE(csspp::parser::is_variable_set(var, false)); + CATCH_REQUIRE(csspp::parser::is_variable_set(var, true)); } // test with the missing ';' @@ -2009,7 +2029,7 @@ TEST_CASE("Is variable set", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // the ';' at the end is missing - REQUIRE_ERRORS("test.css(1): error: Variable set to a block and a nested property block must end with a semicolon (;) after said block.\n"); + VERIFY_ERRORS("test.css(1): error: Variable set to a block and a nested property block must end with a semicolon (;) after said block.\n"); } // simple test with a value + value (SASS compatible) @@ -2024,13 +2044,13 @@ TEST_CASE("Is variable set", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2043,8 +2063,8 @@ TEST_CASE("Is variable set", "[parser] [variable] [invalid]") ); csspp::node::pointer_t var(n->get_child(0)); - REQUIRE(csspp::parser::is_variable_set(var, false)); - REQUIRE_FALSE(csspp::parser::is_variable_set(var, true)); + CATCH_REQUIRE(csspp::parser::is_variable_set(var, false)); + CATCH_REQUIRE_FALSE(csspp::parser::is_variable_set(var, true)); } // case were we actually use a variable to define a selector @@ -2060,13 +2080,13 @@ TEST_CASE("Is variable set", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2085,8 +2105,8 @@ TEST_CASE("Is variable set", "[parser] [variable] [invalid]") ); csspp::node::pointer_t var(n->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_variable_set(var, false)); - REQUIRE_FALSE(csspp::parser::is_variable_set(var, true)); + CATCH_REQUIRE_FALSE(csspp::parser::is_variable_set(var, false)); + CATCH_REQUIRE_FALSE(csspp::parser::is_variable_set(var, true)); } // test with a variable block @@ -2101,13 +2121,13 @@ TEST_CASE("Is variable set", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2124,8 +2144,8 @@ TEST_CASE("Is variable set", "[parser] [variable] [invalid]") ); csspp::node::pointer_t var(n->get_child(0)); - REQUIRE(csspp::parser::is_variable_set(var, false)); - REQUIRE(csspp::parser::is_variable_set(var, true)); + CATCH_REQUIRE(csspp::parser::is_variable_set(var, false)); + CATCH_REQUIRE(csspp::parser::is_variable_set(var, true)); } // test with the missing ';' @@ -2140,14 +2160,14 @@ TEST_CASE("Is variable set", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // the ';' at the end is missing - REQUIRE_ERRORS("test.css(1): error: Variable set to a block and a nested property block must end with a semicolon (;) after said block.\n"); + VERIFY_ERRORS("test.css(1): error: Variable set to a block and a nested property block must end with a semicolon (;) after said block.\n"); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") +CATCH_TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") { // which a field name with a simple nested declaration { @@ -2161,13 +2181,13 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2185,7 +2205,7 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") ); csspp::node::pointer_t var(n->get_child(0)); - REQUIRE(csspp::parser::is_nested_declaration(var)); + CATCH_REQUIRE(csspp::parser::is_nested_declaration(var)); } // which a field name with a simple nested declaration @@ -2200,13 +2220,13 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2229,7 +2249,7 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") ); csspp::node::pointer_t var(n->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(var)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(var)); } // which a field name with a simple nested declaration @@ -2244,13 +2264,13 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2271,7 +2291,7 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") ); csspp::node::pointer_t var(n->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(var)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(var)); } // in this case it is clear that none are declarations @@ -2288,13 +2308,13 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2322,15 +2342,15 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") // check the first COMPONENT_VALUE csspp::node::pointer_t div(n->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(div)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(div)); // check the second COMPONENT_VALUE csspp::node::pointer_t span(n->get_child(0)->get_child(1)->get_child(0)->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(span)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(span)); // check the third COMPONENT_VALUE csspp::node::pointer_t p_tag(n->get_child(0)->get_child(1)->get_child(0)->get_child(1)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(p_tag)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(p_tag)); } // in this case it is clear that none are declarations @@ -2347,13 +2367,13 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2375,15 +2395,15 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") // check the first COMPONENT_VALUE csspp::node::pointer_t div(n->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(div)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(div)); // check the second COMPONENT_VALUE csspp::node::pointer_t span(n->get_child(0)->get_child(1)->get_child(0)); - REQUIRE(csspp::parser::is_nested_declaration(span)); + CATCH_REQUIRE(csspp::parser::is_nested_declaration(span)); // check the third COMPONENT_VALUE csspp::node::pointer_t p_tag(n->get_child(0)->get_child(1)->get_child(0)->get_child(3)->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(p_tag)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(p_tag)); } // ':' always marks a selector @@ -2398,13 +2418,13 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2430,15 +2450,15 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") // check the first COMPONENT_VALUE csspp::node::pointer_t div(n->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(div)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(div)); // check the second COMPONENT_VALUE csspp::node::pointer_t span(n->get_child(0)->get_child(1)->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(span)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(span)); // check the third COMPONENT_VALUE csspp::node::pointer_t p_tag(n->get_child(0)->get_child(1)->get_child(0)->get_child(6)->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(p_tag)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(p_tag)); } // '%' always marks a selector @@ -2453,13 +2473,13 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2484,15 +2504,15 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") // check the first COMPONENT_VALUE csspp::node::pointer_t div(n->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(div)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(div)); // check the second COMPONENT_VALUE csspp::node::pointer_t span(n->get_child(0)->get_child(1)->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(span)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(span)); // check the third COMPONENT_VALUE csspp::node::pointer_t p_tag(n->get_child(0)->get_child(1)->get_child(0)->get_child(5)->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(p_tag)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(p_tag)); } // 'E ~ E' always marks a selector @@ -2507,13 +2527,13 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2541,15 +2561,15 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") // check the first COMPONENT_VALUE csspp::node::pointer_t div(n->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(div)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(div)); // check the second COMPONENT_VALUE csspp::node::pointer_t span(n->get_child(0)->get_child(1)->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(span)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(span)); // check the third COMPONENT_VALUE csspp::node::pointer_t p_tag(n->get_child(0)->get_child(1)->get_child(0)->get_child(8)->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(p_tag)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(p_tag)); } // 'E & E' always marks a selector @@ -2564,13 +2584,13 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2598,15 +2618,15 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") // check the first COMPONENT_VALUE csspp::node::pointer_t div(n->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(div)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(div)); // check the second COMPONENT_VALUE csspp::node::pointer_t span(n->get_child(0)->get_child(1)->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(span)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(span)); // check the third COMPONENT_VALUE csspp::node::pointer_t p_tag(n->get_child(0)->get_child(1)->get_child(0)->get_child(8)->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(p_tag)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(p_tag)); } // 'E|E' always marks a selector @@ -2621,13 +2641,13 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2655,15 +2675,15 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") // check the first COMPONENT_VALUE csspp::node::pointer_t div(n->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(div)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(div)); // check the second COMPONENT_VALUE csspp::node::pointer_t span(n->get_child(0)->get_child(1)->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(span)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(span)); // check the third COMPONENT_VALUE csspp::node::pointer_t p_tag(n->get_child(0)->get_child(1)->get_child(0)->get_child(8)->get_child(0)); - REQUIRE_FALSE(csspp::parser::is_nested_declaration(p_tag)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(p_tag)); } // a nested block must end with a ';' @@ -2678,7 +2698,7 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS("test.css(1): error: Variable set to a block and a nested property block must end with a semicolon (;) after said block.\n"); + VERIFY_ERRORS("test.css(1): error: Variable set to a block and a nested property block must end with a semicolon (;) after said block.\n"); } // test special cases which woudl be really hard to get from the @@ -2727,21 +2747,21 @@ TEST_CASE("Is nested declaration", "[parser] [variable] [invalid]") case 0x1D: case 0x17: case 0x15: - REQUIRE(csspp::parser::is_nested_declaration(root)); + CATCH_REQUIRE(csspp::parser::is_nested_declaration(root)); break; default: - REQUIRE_FALSE(csspp::parser::is_nested_declaration(root)); + CATCH_REQUIRE_FALSE(csspp::parser::is_nested_declaration(root)); break; } } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Rules defined inside an @-Keyword", "[parser] [variable] [invalid]") +CATCH_TEST_CASE("Rules defined inside an @-Keyword", "[parser] [variable] [invalid]") { // which a field name with a simple nested declaration { @@ -2760,13 +2780,13 @@ TEST_CASE("Rules defined inside an @-Keyword", "[parser] [variable] [invalid]") csspp::node::pointer_t n(p.stylesheet()); // no error happened - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " AT_KEYWORD \"document\" I:0\n" @@ -2820,10 +2840,10 @@ TEST_CASE("Rules defined inside an @-Keyword", "[parser] [variable] [invalid]") } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Parse argify", "[parser] [stylesheet]") +CATCH_TEST_CASE("Parse argify", "[parser] [stylesheet]") { { std::stringstream ss; @@ -2846,7 +2866,7 @@ TEST_CASE("Parse argify", "[parser] [stylesheet]") std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -2920,24 +2940,24 @@ TEST_CASE("Parse argify", "[parser] [stylesheet]") ); // Argify the list under each COMPONENT_VALUE - REQUIRE(n->is(csspp::node_type_t::LIST)); + CATCH_REQUIRE(n->is(csspp::node_type_t::LIST)); size_t const max_children(n->size()); for(size_t idx(0); idx < max_children; ++idx) { csspp::node::pointer_t component_value(n->get_child(idx)); - REQUIRE(component_value->is(csspp::node_type_t::COMPONENT_VALUE)); - REQUIRE(csspp::parser::argify(component_value)); + CATCH_REQUIRE(component_value->is(csspp::node_type_t::COMPONENT_VALUE)); + CATCH_REQUIRE(csspp::parser::argify(component_value)); } //std::cerr << "Argified result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out2; out2 << *n; - REQUIRE_TREES(out2.str(), + VERIFY_TREES(out2.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -3014,11 +3034,11 @@ TEST_CASE("Parse argify", "[parser] [stylesheet]") ); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } } -TEST_CASE("Invalid argify", "[parser] [stylesheet]") +CATCH_TEST_CASE("Invalid argify", "[parser] [stylesheet]") { // A starting comma is illegal { @@ -3034,11 +3054,11 @@ TEST_CASE("Invalid argify", "[parser] [stylesheet]") //std::cerr << "Result is: [" << *n << "]\n"; // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -3053,17 +3073,17 @@ TEST_CASE("Invalid argify", "[parser] [stylesheet]") ); // Argify the list under each COMPONENT_VALUE - REQUIRE(n->is(csspp::node_type_t::LIST)); + CATCH_REQUIRE(n->is(csspp::node_type_t::LIST)); size_t const max_children(n->size()); for(size_t idx(0); idx < max_children; ++idx) { csspp::node::pointer_t component_value(n->get_child(idx)); - REQUIRE(component_value->is(csspp::node_type_t::COMPONENT_VALUE)); - REQUIRE_FALSE(csspp::parser::argify(component_value)); + CATCH_REQUIRE(component_value->is(csspp::node_type_t::COMPONENT_VALUE)); + CATCH_REQUIRE_FALSE(csspp::parser::argify(component_value)); } - REQUIRE_ERRORS("test.css(1): error: dangling comma at the beginning of a list of arguments or selectors.\n"); + VERIFY_ERRORS("test.css(1): error: dangling comma at the beginning of a list of arguments or selectors.\n"); } // An ending comma is illegal @@ -3078,13 +3098,13 @@ TEST_CASE("Invalid argify", "[parser] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -3099,17 +3119,17 @@ TEST_CASE("Invalid argify", "[parser] [stylesheet]") ); // Argify the list under each COMPONENT_VALUE - REQUIRE(n->is(csspp::node_type_t::LIST)); + CATCH_REQUIRE(n->is(csspp::node_type_t::LIST)); size_t const max_children(n->size()); for(size_t idx(0); idx < max_children; ++idx) { csspp::node::pointer_t component_value(n->get_child(idx)); - REQUIRE(component_value->is(csspp::node_type_t::COMPONENT_VALUE)); - REQUIRE_FALSE(csspp::parser::argify(component_value)); + CATCH_REQUIRE(component_value->is(csspp::node_type_t::COMPONENT_VALUE)); + CATCH_REQUIRE_FALSE(csspp::parser::argify(component_value)); } - REQUIRE_ERRORS("test.css(1): error: dangling comma at the end of a list of arguments or selectors.\n"); + VERIFY_ERRORS("test.css(1): error: dangling comma at the end of a list of arguments or selectors.\n"); } // Two commas in a row is illegal @@ -3124,13 +3144,13 @@ TEST_CASE("Invalid argify", "[parser] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -3147,17 +3167,17 @@ TEST_CASE("Invalid argify", "[parser] [stylesheet]") ); // Argify the list under each COMPONENT_VALUE - REQUIRE(n->is(csspp::node_type_t::LIST)); + CATCH_REQUIRE(n->is(csspp::node_type_t::LIST)); size_t const max_children(n->size()); for(size_t idx(0); idx < max_children; ++idx) { csspp::node::pointer_t component_value(n->get_child(idx)); - REQUIRE(component_value->is(csspp::node_type_t::COMPONENT_VALUE)); - REQUIRE_FALSE(csspp::parser::argify(component_value)); + CATCH_REQUIRE(component_value->is(csspp::node_type_t::COMPONENT_VALUE)); + CATCH_REQUIRE_FALSE(csspp::parser::argify(component_value)); } - REQUIRE_ERRORS("test.css(1): error: two commas in a row are invalid in a list of arguments or selectors.\n"); + VERIFY_ERRORS("test.css(1): error: two commas in a row are invalid in a list of arguments or selectors.\n"); } // Just a comma is illegal @@ -3172,13 +3192,13 @@ TEST_CASE("Invalid argify", "[parser] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -3192,17 +3212,17 @@ TEST_CASE("Invalid argify", "[parser] [stylesheet]") ); // Argify the list under each COMPONENT_VALUE - REQUIRE(n->is(csspp::node_type_t::LIST)); + CATCH_REQUIRE(n->is(csspp::node_type_t::LIST)); size_t const max_children(n->size()); for(size_t idx(0); idx < max_children; ++idx) { csspp::node::pointer_t component_value(n->get_child(idx)); - REQUIRE(component_value->is(csspp::node_type_t::COMPONENT_VALUE)); - REQUIRE_FALSE(csspp::parser::argify(component_value)); + CATCH_REQUIRE(component_value->is(csspp::node_type_t::COMPONENT_VALUE)); + CATCH_REQUIRE_FALSE(csspp::parser::argify(component_value)); } - REQUIRE_ERRORS("test.css(1): error: dangling comma at the beginning of a list of arguments or selectors.\n"); + VERIFY_ERRORS("test.css(1): error: dangling comma at the beginning of a list of arguments or selectors.\n"); } // calling argify with the wrong separators @@ -3217,13 +3237,13 @@ TEST_CASE("Invalid argify", "[parser] [stylesheet]") csspp::node::pointer_t n(p.stylesheet()); // no errors so far - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); //std::cerr << "Result is: [" << *n << "]\n"; std::stringstream out; out << *n; - REQUIRE_TREES(out.str(), + VERIFY_TREES(out.str(), "LIST\n" " COMPONENT_VALUE\n" @@ -3240,13 +3260,13 @@ TEST_CASE("Invalid argify", "[parser] [stylesheet]") // Attempt to argify the list under each COMPONENT_VALUE using // the wrong type - REQUIRE(n->is(csspp::node_type_t::LIST)); + CATCH_REQUIRE(n->is(csspp::node_type_t::LIST)); size_t const max_children(n->size()); for(size_t idx(0); idx < max_children; ++idx) { csspp::node::pointer_t component_value(n->get_child(idx)); - REQUIRE(component_value->is(csspp::node_type_t::COMPONENT_VALUE)); + CATCH_REQUIRE(component_value->is(csspp::node_type_t::COMPONENT_VALUE)); for(csspp::node_type_t w(csspp::node_type_t::UNKNOWN); w <= csspp::node_type_t::max_type; @@ -3262,22 +3282,15 @@ TEST_CASE("Invalid argify", "[parser] [stylesheet]") break; } - REQUIRE_THROWS_AS(csspp::parser::argify(component_value, w), csspp::csspp_exception_logic &); + CATCH_REQUIRE_THROWS_AS(csspp::parser::argify(component_value, w), csspp::csspp_exception_logic); } } - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_position.cpp b/tests/catch_position.cpp index 14d8729..926570b 100644 --- a/tests/catch_position.cpp +++ b/tests/catch_position.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the error.cpp file. @@ -22,16 +24,34 @@ * implementation to ensure full coverage. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + + +// csspp lib +// +#include +#include +#include +#include + + +// C++ lib +// +#include + -#include "csspp/error.h" -#include "csspp/exceptions.h" -#include "csspp/lexer.h" -#include "csspp/unicode_range.h" +// C lib +// +#include + + +// last include +// +#include -#include -#include namespace { @@ -40,98 +60,98 @@ namespace } // no name namespace -TEST_CASE("Position defaults", "[position] [defaults]") +CATCH_TEST_CASE("Position defaults", "[position] [defaults]") { { csspp::position pos("pos.css"); - REQUIRE(pos.get_filename() == "pos.css"); - REQUIRE(pos.get_line() == 1); - REQUIRE(pos.get_page() == 1); - REQUIRE(pos.get_total_line() == 1); + CATCH_REQUIRE(pos.get_filename() == "pos.css"); + CATCH_REQUIRE(pos.get_line() == 1); + CATCH_REQUIRE(pos.get_page() == 1); + CATCH_REQUIRE(pos.get_total_line() == 1); csspp::position other("other.css"); - REQUIRE(other.get_filename() == "other.css"); - REQUIRE(other.get_line() == 1); - REQUIRE(other.get_page() == 1); - REQUIRE(other.get_total_line() == 1); + CATCH_REQUIRE(other.get_filename() == "other.css"); + CATCH_REQUIRE(other.get_line() == 1); + CATCH_REQUIRE(other.get_page() == 1); + CATCH_REQUIRE(other.get_total_line() == 1); // copy works as expected? other = pos; - REQUIRE(pos.get_filename() == "pos.css"); - REQUIRE(pos.get_line() == 1); - REQUIRE(pos.get_page() == 1); - REQUIRE(pos.get_total_line() == 1); + CATCH_REQUIRE(pos.get_filename() == "pos.css"); + CATCH_REQUIRE(pos.get_line() == 1); + CATCH_REQUIRE(pos.get_page() == 1); + CATCH_REQUIRE(pos.get_total_line() == 1); - REQUIRE(other.get_filename() == "pos.css"); - REQUIRE(other.get_line() == 1); - REQUIRE(other.get_page() == 1); - REQUIRE(other.get_total_line() == 1); + CATCH_REQUIRE(other.get_filename() == "pos.css"); + CATCH_REQUIRE(other.get_line() == 1); + CATCH_REQUIRE(other.get_page() == 1); + CATCH_REQUIRE(other.get_total_line() == 1); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Position counters", "[position] [count]") +CATCH_TEST_CASE("Position counters", "[position] [count]") { // simple check to verify there is no interaction between // a copy and the original { csspp::position pos("pos.css"); - REQUIRE(pos.get_filename() == "pos.css"); - REQUIRE(pos.get_line() == 1); - REQUIRE(pos.get_page() == 1); - REQUIRE(pos.get_total_line() == 1); + CATCH_REQUIRE(pos.get_filename() == "pos.css"); + CATCH_REQUIRE(pos.get_line() == 1); + CATCH_REQUIRE(pos.get_page() == 1); + CATCH_REQUIRE(pos.get_total_line() == 1); csspp::position other("other.css"); - REQUIRE(other.get_filename() == "other.css"); - REQUIRE(other.get_line() == 1); - REQUIRE(other.get_page() == 1); - REQUIRE(other.get_total_line() == 1); + CATCH_REQUIRE(other.get_filename() == "other.css"); + CATCH_REQUIRE(other.get_line() == 1); + CATCH_REQUIRE(other.get_page() == 1); + CATCH_REQUIRE(other.get_total_line() == 1); // copy works as expected? other = pos; - REQUIRE(pos.get_filename() == "pos.css"); - REQUIRE(pos.get_line() == 1); - REQUIRE(pos.get_page() == 1); - REQUIRE(pos.get_total_line() == 1); + CATCH_REQUIRE(pos.get_filename() == "pos.css"); + CATCH_REQUIRE(pos.get_line() == 1); + CATCH_REQUIRE(pos.get_page() == 1); + CATCH_REQUIRE(pos.get_total_line() == 1); - REQUIRE(other.get_filename() == "pos.css"); // filename changed! - REQUIRE(other.get_line() == 1); - REQUIRE(other.get_page() == 1); - REQUIRE(other.get_total_line() == 1); + CATCH_REQUIRE(other.get_filename() == "pos.css"); // filename changed! + CATCH_REQUIRE(other.get_line() == 1); + CATCH_REQUIRE(other.get_page() == 1); + CATCH_REQUIRE(other.get_total_line() == 1); // increment does not affect another position other.next_line(); - REQUIRE(pos.get_filename() == "pos.css"); - REQUIRE(pos.get_line() == 1); - REQUIRE(pos.get_page() == 1); - REQUIRE(pos.get_total_line() == 1); + CATCH_REQUIRE(pos.get_filename() == "pos.css"); + CATCH_REQUIRE(pos.get_line() == 1); + CATCH_REQUIRE(pos.get_page() == 1); + CATCH_REQUIRE(pos.get_total_line() == 1); - REQUIRE(other.get_filename() == "pos.css"); - REQUIRE(other.get_line() == 2); - REQUIRE(other.get_page() == 1); - REQUIRE(other.get_total_line() == 2); + CATCH_REQUIRE(other.get_filename() == "pos.css"); + CATCH_REQUIRE(other.get_line() == 2); + CATCH_REQUIRE(other.get_page() == 1); + CATCH_REQUIRE(other.get_total_line() == 2); // increment does not affect another position other.next_page(); - REQUIRE(pos.get_filename() == "pos.css"); - REQUIRE(pos.get_line() == 1); - REQUIRE(pos.get_page() == 1); - REQUIRE(pos.get_total_line() == 1); + CATCH_REQUIRE(pos.get_filename() == "pos.css"); + CATCH_REQUIRE(pos.get_line() == 1); + CATCH_REQUIRE(pos.get_page() == 1); + CATCH_REQUIRE(pos.get_total_line() == 1); - REQUIRE(other.get_filename() == "pos.css"); - REQUIRE(other.get_line() == 1); - REQUIRE(other.get_page() == 2); - REQUIRE(other.get_total_line() == 2); + CATCH_REQUIRE(other.get_filename() == "pos.css"); + CATCH_REQUIRE(other.get_line() == 1); + CATCH_REQUIRE(other.get_page() == 2); + CATCH_REQUIRE(other.get_total_line() == 2); } // loop and increment line/page counters @@ -157,22 +177,15 @@ TEST_CASE("Position counters", "[position] [count]") //++total_line; -- should this happen? } - REQUIRE(pos.get_filename() == "counters.css"); - REQUIRE(pos.get_line() == line); - REQUIRE(pos.get_page() == page); - REQUIRE(pos.get_total_line() == total_line); + CATCH_REQUIRE(pos.get_filename() == "counters.css"); + CATCH_REQUIRE(pos.get_line() == line); + CATCH_REQUIRE(pos.get_page() == page); + CATCH_REQUIRE(pos.get_total_line() == total_line); } } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/tests/catch_unicode_range.cpp b/tests/catch_unicode_range.cpp index ae0c8fe..64372cd 100644 --- a/tests/catch_unicode_range.cpp +++ b/tests/catch_unicode_range.cpp @@ -1,5 +1,7 @@ -// CSS Preprocessor -- Test Suite -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// +// https://snapwebsites.org/project/csspp +// contact@m2osw.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -11,9 +13,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file * \brief Test the unicode_range.cpp file. @@ -22,16 +24,34 @@ * implementation to ensure full coverage. */ -#include "catch_tests.h" +// self +// +#include "catch_main.h" + -#include "csspp/exceptions.h" -#include "csspp/lexer.h" -#include "csspp/unicode_range.h" +// csspp lib +// +#include +#include +#include + +// C++ lib +// #include + +// C lib +// #include + +// last include +// +#include + + + namespace { @@ -39,7 +59,7 @@ namespace } // no name namespace -TEST_CASE("Unicode range: start/end equal", "[unicode-range] [code-point]") +CATCH_TEST_CASE("Unicode range: start/end equal", "[unicode-range] [code-point]") { for(int i(0); i < 1000; ++i) { @@ -49,14 +69,14 @@ TEST_CASE("Unicode range: start/end equal", "[unicode-range] [code-point]") std::stringstream ss; ss << std::hex << unicode; - REQUIRE(range.to_string() == ss.str()); + CATCH_REQUIRE(range.to_string() == ss.str()); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Unicode range: start/end differ", "[unicode-range] [range]") +CATCH_TEST_CASE("Unicode range: start/end differ", "[unicode-range] [range]") { for(int i(1); i < 15; ++i) { @@ -65,7 +85,7 @@ TEST_CASE("Unicode range: start/end differ", "[unicode-range] [range]") std::stringstream ss; ss << std::hex << "0-" << i; - REQUIRE(range.to_string() == ss.str()); + CATCH_REQUIRE(range.to_string() == ss.str()); } for(int i(0); i < 1000; ++i) @@ -95,15 +115,15 @@ TEST_CASE("Unicode range: start/end differ", "[unicode-range] [range]") csspp::unicode_range_t range(unicode_start, unicode_end); csspp_test::our_unicode_range_t our_range(unicode_start, unicode_end); - REQUIRE(range.get_range() == our_range.get_range()); + CATCH_REQUIRE(range.get_range() == our_range.get_range()); - REQUIRE(range.get_start() == unicode_start); - REQUIRE(range.get_end() == unicode_end); + CATCH_REQUIRE(range.get_start() == unicode_start); + CATCH_REQUIRE(range.get_end() == unicode_end); std::stringstream ss; ss << std::hex << unicode_start << "-" << unicode_end; - REQUIRE(range.to_string() == ss.str()); + CATCH_REQUIRE(range.to_string() == ss.str()); // try again with new values and using set_range(start, end) do @@ -128,15 +148,15 @@ TEST_CASE("Unicode range: start/end differ", "[unicode-range] [range]") our_range.set_start(unicode_start); our_range.set_end(unicode_end); - REQUIRE(range.get_range() == our_range.get_range()); + CATCH_REQUIRE(range.get_range() == our_range.get_range()); - REQUIRE(range.get_start() == unicode_start); - REQUIRE(range.get_end() == unicode_end); + CATCH_REQUIRE(range.get_start() == unicode_start); + CATCH_REQUIRE(range.get_end() == unicode_end); ss.str(""); ss << std::hex << unicode_start << "-" << unicode_end; - REQUIRE(range.to_string() == ss.str()); + CATCH_REQUIRE(range.to_string() == ss.str()); // try again with new values and using set_range(range) do @@ -163,15 +183,15 @@ TEST_CASE("Unicode range: start/end differ", "[unicode-range] [range]") range.set_range(our_range.get_range()); - REQUIRE(range.get_range() == our_range.get_range()); + CATCH_REQUIRE(range.get_range() == our_range.get_range()); - REQUIRE(range.get_start() == unicode_start); - REQUIRE(range.get_end() == unicode_end); + CATCH_REQUIRE(range.get_start() == unicode_start); + CATCH_REQUIRE(range.get_end() == unicode_end); ss.str(""); ss << std::hex << unicode_start << "-" << unicode_end; - REQUIRE(range.to_string() == ss.str()); + CATCH_REQUIRE(range.to_string() == ss.str()); // try again with new values and using range constructor with range value do @@ -198,41 +218,41 @@ TEST_CASE("Unicode range: start/end differ", "[unicode-range] [range]") csspp::unicode_range_t new_range(our_range.get_range()); - REQUIRE(new_range.get_range() == our_range.get_range()); + CATCH_REQUIRE(new_range.get_range() == our_range.get_range()); - REQUIRE(new_range.get_start() == unicode_start); - REQUIRE(new_range.get_end() == unicode_end); + CATCH_REQUIRE(new_range.get_start() == unicode_start); + CATCH_REQUIRE(new_range.get_end() == unicode_end); ss.str(""); ss << std::hex << unicode_start << "-" << unicode_end; - REQUIRE(new_range.to_string() == ss.str()); + CATCH_REQUIRE(new_range.to_string() == ss.str()); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Unicode range: 6 x '?'", "[unicode-range] [mask]") +CATCH_TEST_CASE("Unicode range: 6 x '?'", "[unicode-range] [mask]") { // the mask of 6 x '?' is a special case { csspp::unicode_range_t range(0, 0x10FFFF); - REQUIRE(range.to_string() == "??????"); + CATCH_REQUIRE(range.to_string() == "??????"); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Unicode range: 5 x '?'", "[unicode-range] [mask]") +CATCH_TEST_CASE("Unicode range: 5 x '?'", "[unicode-range] [mask]") { // a mask of 5 x '?' has a very few possibilities { csspp::unicode_range_t range(0, 0x0FFFFF); - REQUIRE(range.to_string() == "?????"); + CATCH_REQUIRE(range.to_string() == "?????"); } { @@ -240,20 +260,20 @@ TEST_CASE("Unicode range: 5 x '?'", "[unicode-range] [mask]") // than what Unicode otherwise allows... csspp::unicode_range_t range(0x100000, 0x1FFFFF); - REQUIRE(range.to_string() == "1?????"); + CATCH_REQUIRE(range.to_string() == "1?????"); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Unicode range: 4 x '?'", "[unicode-range] [mask]") +CATCH_TEST_CASE("Unicode range: 4 x '?'", "[unicode-range] [mask]") { // a mask of 4 x '?' has a small number of possibilities { csspp::unicode_range_t range(0, 0x00FFFF); - REQUIRE(range.to_string() == "????"); + CATCH_REQUIRE(range.to_string() == "????"); } for(int i(1); i < 0x11; ++i) @@ -263,20 +283,20 @@ TEST_CASE("Unicode range: 4 x '?'", "[unicode-range] [mask]") std::stringstream ss; ss << std::hex << i << "????"; - REQUIRE(range.to_string() == ss.str()); + CATCH_REQUIRE(range.to_string() == ss.str()); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Unicode range: 3 x '?'", "[unicode-range] [mask]") +CATCH_TEST_CASE("Unicode range: 3 x '?'", "[unicode-range] [mask]") { // a mask of 3 x '?' has a small number of possibilities { csspp::unicode_range_t range(0, 0x000FFF); - REQUIRE(range.to_string() == "???"); + CATCH_REQUIRE(range.to_string() == "???"); } for(int i(1); i < 0x10F; ++i) @@ -286,20 +306,20 @@ TEST_CASE("Unicode range: 3 x '?'", "[unicode-range] [mask]") std::stringstream ss; ss << std::hex << i << "???"; - REQUIRE(range.to_string() == ss.str()); + CATCH_REQUIRE(range.to_string() == ss.str()); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Unicode range: 2 x '?'", "[unicode-range] [mask]") +CATCH_TEST_CASE("Unicode range: 2 x '?'", "[unicode-range] [mask]") { // a mask of 2 x '?' has a small number of possibilities { csspp::unicode_range_t range(0, 0x0000FF); - REQUIRE(range.to_string() == "??"); + CATCH_REQUIRE(range.to_string() == "??"); } for(int i(1); i < 0x10FF; ++i) @@ -309,20 +329,20 @@ TEST_CASE("Unicode range: 2 x '?'", "[unicode-range] [mask]") std::stringstream ss; ss << std::hex << i << "??"; - REQUIRE(range.to_string() == ss.str()); + CATCH_REQUIRE(range.to_string() == ss.str()); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Unicode range: 1 x '?'", "[unicode-range] [mask]") +CATCH_TEST_CASE("Unicode range: 1 x '?'", "[unicode-range] [mask]") { // a mask of 1 x '?' has a small number of possibilities { csspp::unicode_range_t range(0, 0x00000F); - REQUIRE(range.to_string() == "?"); + CATCH_REQUIRE(range.to_string() == "?"); } for(int i(1); i < 0x10FFF; ++i) @@ -332,29 +352,22 @@ TEST_CASE("Unicode range: 1 x '?'", "[unicode-range] [mask]") std::stringstream ss; ss << std::hex << i << "?"; - REQUIRE(range.to_string() == ss.str()); + CATCH_REQUIRE(range.to_string() == ss.str()); } // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -TEST_CASE("Unicode range: invalid start/end values", "[unicode-range] [code-point]") +CATCH_TEST_CASE("Unicode range: invalid start/end values", "[unicode-range] [code-point]") { // Do a little more? - REQUIRE_THROWS_AS(new csspp::unicode_range_t(0x110000, 0x012345), csspp::csspp_exception_overflow &); - REQUIRE_THROWS_AS(new csspp::unicode_range_t(0x012345, 0x200000), csspp::csspp_exception_overflow &); - REQUIRE_THROWS_AS(new csspp::unicode_range_t(0x004000, 0x000200), csspp::csspp_exception_overflow &); + CATCH_REQUIRE_THROWS_AS(new csspp::unicode_range_t(0x110000, 0x012345), csspp::csspp_exception_overflow); + CATCH_REQUIRE_THROWS_AS(new csspp::unicode_range_t(0x012345, 0x200000), csspp::csspp_exception_overflow); + CATCH_REQUIRE_THROWS_AS(new csspp::unicode_range_t(0x004000, 0x000200), csspp::csspp_exception_overflow); // no error left over - REQUIRE_ERRORS(""); + VERIFY_ERRORS(""); } -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et From 595b1a1829fbca9eb8451dabe5f5ab514461fc4b Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Wed, 26 Jan 2022 20:43:45 -0800 Subject: [PATCH 20/64] Properly added --empty-on-undefined-variable. Somehow that option was not yet part of the advgetopt tables. --- src/csspp.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/csspp.cpp b/src/csspp.cpp index 5cb3214..5743e66 100644 --- a/src/csspp.cpp +++ b/src/csspp.cpp @@ -296,6 +296,14 @@ constexpr advgetopt::option g_options[] = "prevent the \"logo\" from appearing in the output file", nullptr }, + { + '\0', + advgetopt::GETOPT_FLAG_COMMAND_LINE | advgetopt::GETOPT_FLAG_FLAG, + "empty-on-undefined-variable", + nullptr, + "if accessing an undefined variable, return an empty string, otherwise generate an error", + nullptr + }, { 'o', advgetopt::GETOPT_FLAG_COMMAND_LINE | advgetopt::GETOPT_FLAG_SHOW_USAGE_ON_ERROR, @@ -356,6 +364,7 @@ advgetopt::options_environment const g_options_environment = .f_options = g_options, .f_options_files_directory = nullptr, .f_environment_variable_name = "CSSPPFLAGS", + .f_section_variables_name = nullptr, .f_configuration_files = nullptr, .f_configuration_filename = nullptr, .f_configuration_directories = nullptr, @@ -530,7 +539,7 @@ int pp::compile() c.set_no_logo(); } - if(f_opt->is_defined("")) + if(f_opt->is_defined("empty-on-undefined-variable")) { c.set_empty_on_undefined_variable(true); } From 43b70bc20ed03a3b46d22253b87b8276e283d34b Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sun, 13 Feb 2022 13:22:01 -0800 Subject: [PATCH 21/64] Bumped version to recompile on Launchpad. --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 1b6834b..be7e5c9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +csspp (1.0.29.1~bionic) bionic; urgency=high + + * Bumped build version to rebuild on Launchpad. + + -- Alexis Wilke Sun, 13 Feb 2022 13:21:51 -0800 + csspp (1.0.29.0~bionic) bionic; urgency=high * Moved the headers along the code and renamed the directory csspp. From 4c7b6ffa7680af68dce989368c55948231219b9d Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 26 Feb 2022 08:09:58 -0800 Subject: [PATCH 22/64] The website upload now also uploads the documentation. --- debian/changelog | 6 ++++++ dev/upload-website.sh | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/debian/changelog b/debian/changelog index be7e5c9..2175b7e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +csspp (1.0.30.0~bionic) bionic; urgency=high + + * The website upload now also uploads the documentation. + + -- Alexis Wilke Sat, 26 Feb 2022 08:09:51 -0800 + csspp (1.0.29.1~bionic) bionic; urgency=high * Bumped build version to rebuild on Launchpad. diff --git a/dev/upload-website.sh b/dev/upload-website.sh index deed579..0a9036f 100755 --- a/dev/upload-website.sh +++ b/dev/upload-website.sh @@ -39,3 +39,11 @@ scp doc/favicon.ico ${URL}:/var/www/csspp/public_html/favicon.ico scp doc/images/csspp-logo.png ${URL}:/var/www/csspp/public_html/images/csspp-logo.png scp doc/images/open-source-initiative-logo.png ${URL}:/var/www/csspp/public_html/images/open-source-initiative-logo.png +if test -d ../../BUILD/Debug/dist/share/doc/csspp/html +then + . dev/version + scp -r ../../BUILD/Debug/dist/share/doc/csspp/html ${URL}:/var/www/csspp/public_html/documentation/csspp-doc-${VERSION} +else + echo "warning: documentation not found, it won't be uploaded." +fi + From 1a20b0e59018d85ab588bafa71e76677c0189b14 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 5 Mar 2022 21:11:24 -0800 Subject: [PATCH 23/64] Added the Environment Variable Into. --- debian/changelog | 7 ++ src/csspp.cpp | 204 +++++++++++++++++++++++------------------------ 2 files changed, 107 insertions(+), 104 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2175b7e..698e1c9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +csspp (1.0.31.0~bionic) bionic; urgency=high + + * Updated the advgetopt options to use the new scheme so it compiles. + * Added the Environment Variable Into. + + -- Alexis Wilke Sat, 05 Mar 2022 21:11:14 -0800 + csspp (1.0.30.0~bionic) bionic; urgency=high * The website upload now also uploads the documentation. diff --git a/src/csspp.cpp b/src/csspp.cpp index 5743e66..f2c6342 100644 --- a/src/csspp.cpp +++ b/src/csspp.cpp @@ -224,31 +224,40 @@ * \endcode */ -// csspp lib +// csspp // -#include -#include -#include -#include +#include +#include +#include +#include -// advgetopt lib + +// advgetopt // -#include -#include +#include +#include + -// boost lib +// boost // -#include +#include + -// C++ lib +// C++ // -#include -#include -#include +#include +#include +#include -// C lib + +// C // -#include +#include + + +// last include +// +#include @@ -264,94 +273,80 @@ void free_char(char * ptr) constexpr advgetopt::option g_options[] = { - { - 'a', - advgetopt::GETOPT_FLAG_COMMAND_LINE | advgetopt::GETOPT_FLAG_REQUIRED | advgetopt::GETOPT_FLAG_MULTIPLE, - "args", - nullptr, - "define values in the $_csspp_args variable map", - nullptr - }, - { - 'd', - advgetopt::GETOPT_FLAG_COMMAND_LINE | advgetopt::GETOPT_FLAG_FLAG, - "debug", - nullptr, - "show all messages, including @debug messages", - nullptr - }, - { - 'I', - advgetopt::GETOPT_FLAG_COMMAND_LINE | advgetopt::GETOPT_FLAG_MULTIPLE, - "include", - nullptr, - "specify a path to various user defined CSS files; \"-\" to clear the list (i.e. \"-I -\")", - nullptr - }, - { - '\0', - advgetopt::GETOPT_FLAG_COMMAND_LINE | advgetopt::GETOPT_FLAG_FLAG, - "no-logo", - nullptr, - "prevent the \"logo\" from appearing in the output file", - nullptr - }, - { - '\0', - advgetopt::GETOPT_FLAG_COMMAND_LINE | advgetopt::GETOPT_FLAG_FLAG, - "empty-on-undefined-variable", - nullptr, - "if accessing an undefined variable, return an empty string, otherwise generate an error", - nullptr - }, - { - 'o', - advgetopt::GETOPT_FLAG_COMMAND_LINE | advgetopt::GETOPT_FLAG_SHOW_USAGE_ON_ERROR, - "output", - "out.css", - "save the results in the specified file", - nullptr - }, - { - 'p', - advgetopt::GETOPT_FLAG_COMMAND_LINE | advgetopt::GETOPT_FLAG_FLAG, - "precision", - nullptr, - "define the number of digits to use after the decimal point, defaults to 3; note that for percent values, the precision is always 2.", - nullptr - }, - { - 'q', - advgetopt::GETOPT_FLAG_COMMAND_LINE | advgetopt::GETOPT_FLAG_FLAG, - "quiet", - nullptr, - "suppress @info and @warning messages", - nullptr - }, - { - 's', - advgetopt::GETOPT_FLAG_COMMAND_LINE | advgetopt::GETOPT_FLAG_REQUIRED, - "style", - nullptr, - "output style: compressed, tidy, compact, expanded", - nullptr - }, - { - '\0', - advgetopt::GETOPT_FLAG_COMMAND_LINE | advgetopt::GETOPT_FLAG_FLAG, - "Werror", - nullptr, - "make warnings count as errors", - nullptr - }, - { - '\0', - advgetopt::GETOPT_FLAG_COMMAND_LINE | advgetopt::GETOPT_FLAG_MULTIPLE | advgetopt::GETOPT_FLAG_DEFAULT_OPTION | advgetopt::GETOPT_FLAG_SHOW_USAGE_ON_ERROR, - "--", - nullptr, - "[file.css ...]; use stdin if no filename specified", - nullptr - }, + advgetopt::define_option( + advgetopt::Name("args") + , advgetopt::ShortName('a') + , advgetopt::Flags(advgetopt::command_flags< + advgetopt::GETOPT_FLAG_REQUIRED + , advgetopt::GETOPT_FLAG_MULTIPLE>()) + , nullptr + , "define values in the $_csspp_args variable map" + , nullptr + ), + advgetopt::define_option( + advgetopt::Name("debug") + , advgetopt::ShortName('d') + , advgetopt::Flags(advgetopt::standalone_command_flags<>()) + , advgetopt::Help("show all messages, including @debug messages") + ), + advgetopt::define_option( + advgetopt::Name("include") + , advgetopt::ShortName('I') + , advgetopt::Flags(advgetopt::command_flags< + advgetopt::GETOPT_FLAG_MULTIPLE>()) + , advgetopt::Help("specify a path to various user defined CSS files; \"-\" to clear the list (i.e. \"-I -\")") + ), + advgetopt::define_option( + advgetopt::Name("no-logo") + , advgetopt::ShortName('\0') + , advgetopt::Flags(advgetopt::standalone_command_flags<>()) + , advgetopt::Help("prevent the \"logo\" from appearing in the output file") + ), + advgetopt::define_option( + advgetopt::Name("empty-on-undefined-variable") + , advgetopt::ShortName('\0') + , advgetopt::Flags(advgetopt::standalone_command_flags<>()) + , advgetopt::Help("if accessing an undefined variable, return an empty string, otherwise generate an error") + ), + advgetopt::define_option( + advgetopt::Name("output") + , advgetopt::ShortName('o') + , advgetopt::Flags(advgetopt::standalone_command_flags< + advgetopt::GETOPT_FLAG_SHOW_USAGE_ON_ERROR>()) + , advgetopt::DefaultValue("out.css") + , advgetopt::Help("save the results in the specified file") + ), + advgetopt::define_option( + advgetopt::Name("precision") + , advgetopt::ShortName('p') + , advgetopt::Flags(advgetopt::standalone_command_flags<>()) + , advgetopt::Help("define the number of digits to use after the decimal point, defaults to 3; note that for percent values, the precision is always 2.") + ), + advgetopt::define_option( + advgetopt::Name("quiet") + , advgetopt::ShortName('q') + , advgetopt::Flags(advgetopt::standalone_command_flags<>()) + , advgetopt::Help("suppress @info and @warning messages") + ), + advgetopt::define_option( + advgetopt::Name("style") + , advgetopt::ShortName('s') + , advgetopt::Flags(advgetopt::command_flags()) + , advgetopt::Help("output style: compressed, tidy, compact, expanded") + ), + advgetopt::define_option( + advgetopt::Name("Werror") + , advgetopt::Flags(advgetopt::standalone_command_flags<>()) + , advgetopt::Help("make warnings count as errors") + ), + advgetopt::define_option( + advgetopt::Name("--") + , advgetopt::Flags(advgetopt::command_flags< + advgetopt::GETOPT_FLAG_MULTIPLE + , advgetopt::GETOPT_FLAG_DEFAULT_OPTION + , advgetopt::GETOPT_FLAG_SHOW_USAGE_ON_ERROR>()) + , advgetopt::Help("[file.css ...]; use stdin if no filename specified") + ), advgetopt::end_options() }; @@ -364,6 +359,7 @@ advgetopt::options_environment const g_options_environment = .f_options = g_options, .f_options_files_directory = nullptr, .f_environment_variable_name = "CSSPPFLAGS", + .f_environment_variable_intro = nullptr, .f_section_variables_name = nullptr, .f_configuration_files = nullptr, .f_configuration_filename = nullptr, From 71b36299aa9ae5e079349e85221bec17c81f2897 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 21 May 2022 08:56:55 -0700 Subject: [PATCH 24/64] Fixed compat version to v10. --- debian/changelog | 6 ++++++ debian/compat | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 698e1c9..e1d292e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +csspp (1.0.31.1~bionic) bionic; urgency=high + + * Fixed compat version to v10. + + -- Alexis Wilke Sat, 21 May 2022 08:56:52 -0700 + csspp (1.0.31.0~bionic) bionic; urgency=high * Updated the advgetopt options to use the new scheme so it compiles. diff --git a/debian/compat b/debian/compat index 45a4fb7..f599e28 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -8 +10 From 698d25853bd87aba4fa823b1a75f54c2f7416fed Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Fri, 3 Jun 2022 18:29:40 -0700 Subject: [PATCH 25/64] Fixed the main test to use the snapcatch2 main. Now it works properly with `./mk -t`. Cleaned up the order in which the headers are included in the tests to allow for some verification of some headers (i.e. that they can be included first). Moved the Doxygen check in the doc/CMakeLists.txt file. Fixed the tests that verified the "#id" not appearing at the start because that was wrong anyway (there are cases where it can appear somewhere else and it is valid). I fixed that a while back, but not the tests. --- CMakeLists.txt | 2 +- doc/CMakeLists.txt | 14 +- tests/CMakeLists.txt | 3 + tests/catch_assembler.cpp | 13 +- tests/catch_color.cpp | 13 +- tests/catch_compiler.cpp | 32 +++-- tests/catch_csspp.cpp | 15 ++- tests/catch_error.cpp | 11 +- tests/catch_expr_additive.cpp | 10 +- tests/catch_expr_conditional.cpp | 13 +- tests/catch_expr_equality.cpp | 10 +- tests/catch_expr_list.cpp | 10 +- tests/catch_expr_logical_and.cpp | 10 +- tests/catch_expr_logical_or.cpp | 10 +- tests/catch_expr_multiplicative.cpp | 14 +- tests/catch_expr_power.cpp | 12 +- tests/catch_expr_relational.cpp | 14 +- tests/catch_expr_unary.cpp | 14 +- tests/catch_internal_functions.cpp | 14 +- tests/catch_lexer.cpp | 16 +-- tests/catch_main.cpp | 194 +++++++++++----------------- tests/catch_main.h | 8 +- tests/catch_node.cpp | 14 +- tests/catch_nth_child.cpp | 10 +- tests/catch_parser.cpp | 14 +- tests/catch_position.cpp | 16 +-- tests/catch_unicode_range.cpp | 21 +-- 27 files changed, 248 insertions(+), 279 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a742f01..bcec9e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ find_package(AdvGetOpt REQUIRED) find_package(LibExcept REQUIRED) find_package(LibUtf8 REQUIRED) find_package(SnapCMakeModules REQUIRED) -find_package(SnapDoxygen ) +find_package(SnapDev REQUIRED) SnapGetVersion( CSSPP ${CMAKE_CURRENT_SOURCE_DIR} ) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 33798c6..0131ce7 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -21,6 +21,7 @@ ## ## Documentation ## +find_package(SnapDoxygen) AddDoxygenTarget( csspp ${CSSPP_VERSION_MAJOR} @@ -28,16 +29,16 @@ AddDoxygenTarget( ${CSSPP_VERSION_PATCH} ) -# At this point this may not work on all platform, so to make it easier +# At this point this may not work on all platforms, so to make it easier # I specialize it to Linux only; that just means one doxygen \include # will fail. -if( DOXYGEN_FOUND ) - if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" ) +if(DOXYGEN_FOUND) + if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") add_dependencies(csspp_Documentation sample.css ) - set( CSSPP_TOOL csspp-tool ) + set(CSSPP_TOOL csspp-tool) add_custom_target(sample.css DEPENDS ${CSSPP_TOOL} @@ -80,9 +81,4 @@ configure_file( ${CMAKE_CURRENT_BINARY_DIR}/front-page.html ) -# Local Variables: -# indent-tabs-mode: nil -# tab-width: 4 -# End: - # vim: ts=4 sw=4 et nocindent diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 14df3f6..d97f460 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -55,11 +55,14 @@ if(SnapCatch2_FOUND) target_include_directories(${PROJECT_NAME} PUBLIC + ${SNAPDEV_INCLUDE_DIRS} + ${LIBEXCEPT_INCLUDE_DIRS} ${SNAPCATCH2_INCLUDE_DIRS} ) target_link_libraries(${PROJECT_NAME} csspp + ${LIBEXCEPT_LIBRARIES} ${SNAPCATCH2_LIBRARIES} ) diff --git a/tests/catch_assembler.cpp b/tests/catch_assembler.cpp index be88eb9..09a33db 100644 --- a/tests/catch_assembler.cpp +++ b/tests/catch_assembler.cpp @@ -24,19 +24,20 @@ * full coverage and many edge cases of CSS encoding. */ -// self -// -#include "catch_main.h" - - // csspp lib // #include + #include #include #include +// self +// +#include "catch_main.h" + + // C++ lib // #include @@ -2519,7 +2520,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::TIDY: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version" CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error{color:red}\n" + csspp_test::get_close_comment() ); diff --git a/tests/catch_color.cpp b/tests/catch_color.cpp index bb90c86..ed6b15a 100644 --- a/tests/catch_color.cpp +++ b/tests/catch_color.cpp @@ -24,18 +24,19 @@ * implementation to ensure full coverage. */ -// self -// -#include "catch_main.h" - - // csspp lib // -#include #include + +#include #include +// self +// +#include "catch_main.h" + + // C++ lib // #include diff --git a/tests/catch_compiler.cpp b/tests/catch_compiler.cpp index 8d20dc0..7a5e401 100644 --- a/tests/catch_compiler.cpp +++ b/tests/catch_compiler.cpp @@ -25,26 +25,27 @@ * CSS Preprocessor extensions. */ -// self -// -#include "catch_main.h" - - -// csspp lib +// csspp // #include + #include #include -// C++ lib +// self +// +#include "catch_main.h" + + +// C++ // #include #include #include -// C lib +// C // #include #include @@ -6913,7 +6914,8 @@ CATCH_TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - VERIFY_ERRORS("test.css(1): info: found an #id entry which is not at the beginning of the list of selectors; unless your HTML changes that much, #id should be the first selector only.\n"); + //VERIFY_ERRORS("test.css(1): info: found an #id entry which is not at the beginning of the list of selectors; unless your HTML changes that much, #id should be the first selector only.\n"); + VERIFY_ERRORS(""); std::stringstream out; out << *n; @@ -6973,10 +6975,11 @@ CATCH_TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - VERIFY_ERRORS( - "test.css(1): info: found an #id entry which is not at the beginning of the list of selectors; unless your HTML changes that much, #id should be the first selector only.\n" - "test.css(1): info: found an #id entry which is not at the beginning of the list of selectors; unless your HTML changes that much, #id should be the first selector only.\n" - ); + //VERIFY_ERRORS( + // "test.css(1): info: found an #id entry which is not at the beginning of the list of selectors; unless your HTML changes that much, #id should be the first selector only.\n" + // "test.css(1): info: found an #id entry which is not at the beginning of the list of selectors; unless your HTML changes that much, #id should be the first selector only.\n" + // ); + VERIFY_ERRORS(""); std::stringstream out; out << *n; @@ -7047,7 +7050,8 @@ CATCH_TEST_CASE("Advanced variables", "[compiler] [variable]") //std::cerr << "Result is: [" << *c.get_root() << "]\n"; - VERIFY_ERRORS("test.css(1): info: found an #id entry which is not at the beginning of the list of selectors; unless your HTML changes that much, #id should be the first selector only.\n"); + //VERIFY_ERRORS("test.css(1): info: found an #id entry which is not at the beginning of the list of selectors; unless your HTML changes that much, #id should be the first selector only.\n"); + VERIFY_ERRORS(""); std::stringstream out; out << *n; diff --git a/tests/catch_csspp.cpp b/tests/catch_csspp.cpp index b3ed928..fa73771 100644 --- a/tests/catch_csspp.cpp +++ b/tests/catch_csspp.cpp @@ -24,19 +24,20 @@ * implementation to ensure full coverage. */ -// self +// css // -#include "catch_main.h" - +#include -// css lib -// #include -#include #include -// C++ lib +// self +// +#include "catch_main.h" + + +// C++ // #include diff --git a/tests/catch_error.cpp b/tests/catch_error.cpp index e8dbb71..7b9f282 100644 --- a/tests/catch_error.cpp +++ b/tests/catch_error.cpp @@ -24,19 +24,20 @@ * implementation to ensure full coverage. */ -// self -// -#include "catch_main.h" - - // csspp lib // #include + #include #include #include +// self +// +#include "catch_main.h" + + // C++ lib // #include diff --git a/tests/catch_expr_additive.cpp b/tests/catch_expr_additive.cpp index 9433974..32f87af 100644 --- a/tests/catch_expr_additive.cpp +++ b/tests/catch_expr_additive.cpp @@ -34,11 +34,6 @@ * classes. */ -// self -// -#include "catch_main.h" - - // csspp lib // #include @@ -47,6 +42,11 @@ #include +// self +// +#include "catch_main.h" + + // C++ lib // #include diff --git a/tests/catch_expr_conditional.cpp b/tests/catch_expr_conditional.cpp index 720fb85..0ce73d3 100644 --- a/tests/catch_expr_conditional.cpp +++ b/tests/catch_expr_conditional.cpp @@ -34,19 +34,20 @@ * classes. */ -// self -// -#include "catch_main.h" - - // csspp lib // -#include #include + +#include #include #include +// self +// +#include "catch_main.h" + + // C++ lib // #include diff --git a/tests/catch_expr_equality.cpp b/tests/catch_expr_equality.cpp index 39ba12b..616e2c1 100644 --- a/tests/catch_expr_equality.cpp +++ b/tests/catch_expr_equality.cpp @@ -37,11 +37,6 @@ * classes. */ -// self -// -#include "catch_main.h" - - // csspp lib // #include @@ -50,6 +45,11 @@ #include +// self +// +#include "catch_main.h" + + // C++ lib // #include diff --git a/tests/catch_expr_list.cpp b/tests/catch_expr_list.cpp index f7bece1..5669008 100644 --- a/tests/catch_expr_list.cpp +++ b/tests/catch_expr_list.cpp @@ -34,11 +34,6 @@ * classes. */ -// self -// -#include "catch_main.h" - - // csspp lib // #include @@ -47,6 +42,11 @@ #include +// self +// +#include "catch_main.h" + + // C++ lib // #include diff --git a/tests/catch_expr_logical_and.cpp b/tests/catch_expr_logical_and.cpp index 997b05a..e4ea5d4 100644 --- a/tests/catch_expr_logical_and.cpp +++ b/tests/catch_expr_logical_and.cpp @@ -34,11 +34,6 @@ * classes. */ -// self -// -#include "catch_main.h" - - // csspp lib // #include @@ -47,6 +42,11 @@ #include +// self +// +#include "catch_main.h" + + // C++ lib // #include diff --git a/tests/catch_expr_logical_or.cpp b/tests/catch_expr_logical_or.cpp index 04ae26d..a396802 100644 --- a/tests/catch_expr_logical_or.cpp +++ b/tests/catch_expr_logical_or.cpp @@ -34,11 +34,6 @@ * classes. */ -// self -// -#include "catch_main.h" - - // csspp lib // #include @@ -47,6 +42,11 @@ #include +// self +// +#include "catch_main.h" + + // C++ lib // #include diff --git a/tests/catch_expr_multiplicative.cpp b/tests/catch_expr_multiplicative.cpp index b5fd0e6..072735e 100644 --- a/tests/catch_expr_multiplicative.cpp +++ b/tests/catch_expr_multiplicative.cpp @@ -31,12 +31,7 @@ * classes. */ -// self -// -#include "catch_main.h" - - -// csspp lib +// csspp // #include #include @@ -44,7 +39,12 @@ #include -// C++ lib +// self +// +#include "catch_main.h" + + +// C++ // #include diff --git a/tests/catch_expr_power.cpp b/tests/catch_expr_power.cpp index 710fd79..629f7f1 100644 --- a/tests/catch_expr_power.cpp +++ b/tests/catch_expr_power.cpp @@ -34,11 +34,7 @@ * classes. */ -// self -// -#include "catch_main.h" - -// csspp lib +// csspp // #include #include @@ -46,7 +42,11 @@ #include -// C++ lib +// self +// +#include "catch_main.h" + +// C++ // #include diff --git a/tests/catch_expr_relational.cpp b/tests/catch_expr_relational.cpp index 670df4a..f404f20 100644 --- a/tests/catch_expr_relational.cpp +++ b/tests/catch_expr_relational.cpp @@ -35,12 +35,7 @@ * classes. */ -// self -// -#include "catch_main.h" - - -// csspp lib +// csspp // #include #include @@ -48,7 +43,12 @@ #include -// C++ lib +// self +// +#include "catch_main.h" + + +// C++ // #include diff --git a/tests/catch_expr_unary.cpp b/tests/catch_expr_unary.cpp index d0ec272..b664bb9 100644 --- a/tests/catch_expr_unary.cpp +++ b/tests/catch_expr_unary.cpp @@ -33,12 +33,7 @@ * classes. */ -// self -// -#include "catch_main.h" - - -// csspp lib +// csspp // #include #include @@ -46,7 +41,12 @@ #include -// C++ lib +// self +// +#include "catch_main.h" + + +// C++ // #include diff --git a/tests/catch_internal_functions.cpp b/tests/catch_internal_functions.cpp index df964df..bc85164 100644 --- a/tests/catch_internal_functions.cpp +++ b/tests/catch_internal_functions.cpp @@ -33,12 +33,7 @@ * classes. */ -// self -// -#include "catch_main.h" - - -// csspp lib +// csspp // #include #include @@ -46,7 +41,12 @@ #include -// C++ lib +// self +// +#include "catch_main.h" + + +// C++ // #include #include diff --git a/tests/catch_lexer.cpp b/tests/catch_lexer.cpp index 5450d34..e034f46 100644 --- a/tests/catch_lexer.cpp +++ b/tests/catch_lexer.cpp @@ -28,26 +28,26 @@ * UTF-8 as input. */ -// self -// -#include "catch_main.h" - - -// csspp lib +// csspp // #include #include #include -// C++ lib +// self +// +#include "catch_main.h" + + +// C++ // #include #include #include -// C lib +// C // #include #include diff --git a/tests/catch_main.cpp b/tests/catch_main.cpp index 0230544..7c8240a 100644 --- a/tests/catch_main.cpp +++ b/tests/catch_main.cpp @@ -28,24 +28,34 @@ // Tell catch we want it to add the runner code in this file. #define CATCH_CONFIG_RUNNER +// csspp +// +#include +#include +#include + + // self // #include "catch_main.h" -// csspp lib +// libexcept // -#include -#include -#include +#include + + +// snapdev +// +#include -// C++ lib +// C++ // #include -// C lib +// C // #include @@ -62,14 +72,8 @@ namespace csspp_test namespace { -char * g_progname; - trace_error * g_trace_error; -std::string g_script_path; - -std::string g_version_script_path; - time_t const g_now(1435871798); // 07/02/2015 14:16:38 } @@ -197,14 +201,30 @@ void compare(std::string const & generated, std::string const & expected, char c CATCH_REQUIRE(*e == '\0'); } + +inline std::string & g_script_path() +{ + static std::string script_path = std::string(); + + return script_path; +} + std::string get_script_path() { - return g_script_path; + return g_script_path(); +} + + +inline std::string & g_version_script_path() +{ + static std::string version_script_path = std::string(); + + return version_script_path; } std::string get_version_script_path() { - return g_version_script_path; + return g_version_script_path(); } std::string get_default_variables(default_variables_flags_t const flags) @@ -780,118 +800,58 @@ time_t get_now() return g_now; } -} // csspp_test namespace +inline bool & g_show_errors() +{ + static bool show_errors = false; -int main(int argc, char *argv[]) + return show_errors; +} + +Catch::Clara::Parser add_command_line_options(Catch::Clara::Parser const & cli) { - // define program name - csspp_test::g_progname = argv[0]; - char *e(strrchr(csspp_test::g_progname, '/')); - if(e) - { - csspp_test::g_progname = e + 1; // LCOV_EXCL_LINE - } - e = strrchr(csspp_test::g_progname, '\\'); - if(e) - { - csspp_test::g_progname = e + 1; // LCOV_EXCL_LINE - } + return cli + | Catch::Clara::Opt(g_show_errors()) + ["--show-errors"] + ("make the csspp compile more verbose, which means printing all errors.") + | Catch::Clara::Opt(g_script_path(), "scripts") + ["--scripts"] + ("specify the location of the CSS Preprocessor system scripts.") + | Catch::Clara::Opt(g_version_script_path(), "version-script") + ["--version-script"] + ("define the path to the version script.") + ; +} - unsigned int seed(static_cast(time(nullptr))); - bool help(false); - for(int i(1); i < argc;) - { - if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) - { - help = true; // LCOV_EXCL_LINE - ++i; - } - else if(strcmp(argv[i], "--seed") == 0) - { - if(i + 1 >= argc) // LCOV_EXCL_LINE - { - std::cerr << "error: --seed need to be followed by the actual seed." << std::endl; // LCOV_EXCL_LINE - exit(1); // LCOV_EXCL_LINE - } - seed = atoll(argv[i + 1]); // LCOV_EXCL_LINE - // remove the --seed and - argc -= 2; // LCOV_EXCL_LINE - for(int j(i); j < argc; ++j) // LCOV_EXCL_LINE - { - argv[j] = argv[j + 2]; // LCOV_EXCL_LINE - } - } - else if(strcmp(argv[i], "--show-errors") == 0) - { - csspp::error::instance().set_verbose(true); - argc -= 1; // LCOV_EXCL_LINE - for(int j(i); j < argc; ++j) // LCOV_EXCL_LINE - { - argv[j] = argv[j + 1]; // LCOV_EXCL_LINE - } - } - else if(strcmp(argv[i], "--scripts") == 0) - { - if(i + 1 >= argc) - { - std::cerr << "error: --scripts need to be followed by a path." << std::endl; // LCOV_EXCL_LINE - exit(1); // LCOV_EXCL_LINE - } - csspp_test::g_script_path = argv[i + 1]; - // remove the --scripts and - argc -= 2; // LCOV_EXCL_LINE - for(int j(i); j < argc; ++j) // LCOV_EXCL_LINE - { - argv[j] = argv[j + 2]; // LCOV_EXCL_LINE - } - } - else if(strcmp(argv[i], "--version-script") == 0) - { - if(i + 1 >= argc) - { - std::cerr << "error: --version-script need to be followed by a path." << std::endl; // LCOV_EXCL_LINE - exit(1); // LCOV_EXCL_LINE - } - csspp_test::g_version_script_path = argv[i + 1]; - // remove the --version-script and - argc -= 2; // LCOV_EXCL_LINE - for(int j(i); j < argc; ++j) // LCOV_EXCL_LINE - { - argv[j] = argv[j + 2]; // LCOV_EXCL_LINE - } - } - else if(strcmp(argv[i], "--version") == 0) - { - std::cout << CSSPP_VERSION << std::endl; - exit(0); - } - else - { - ++i; - } - } - srand(seed); - std::cout << csspp_test::g_progname << "[" << getpid() << "]" << ": version " << CSSPP_VERSION << ", seed is " << seed << std::endl; +int init_test(Catch::Session & session) +{ + snapdev::NOT_USED(session); // unless we get a loop going forever, we should never hit this limit - csspp::node::limit_nodes_to(1000000); + // + csspp::node::limit_nodes_to(1'000'000); - if(help) - { - std::cout << std::endl // LCOV_EXCL_LINE - << "WARNING: at this point we hack the main() to add the following options:" << std::endl // LCOV_EXCL_LINE - << " --scripts a path to the system scripts to run against the tests" << std::endl // LCOV_EXCL_LINE - << " --seed to force the seed at the start of the process to a specific value (i.e. to reproduce the exact same test over and over again)" << std::endl // LCOV_EXCL_LINE - << " --show-errors request for the errors to always be printed in std::cerr" << std::endl // LCOV_EXCL_LINE - << " --version print out the version of this test and exit with 0" << std::endl // LCOV_EXCL_LINE - << " --version-script a path to the system version script" << std::endl // LCOV_EXCL_LINE - << std::endl; // LCOV_EXCL_LINE - } + csspp::error::instance().set_verbose(g_show_errors()); // before running we need to initialize the error tracker - static_cast(csspp_test::trace_error::instance()); + // + snapdev::NOT_USED(csspp_test::trace_error::instance()); + + return 0; +} - return Catch::Session().run(argc, argv); +} // csspp_test namespace + +int main(int argc, char *argv[]) +{ + return SNAP_CATCH2_NAMESPACE::snap_catch2_main( + "eventdispatcher" + , CSSPP_VERSION + , argc + , argv + , []() { libexcept::set_collect_stack(libexcept::collect_stack_t::COLLECT_STACK_NO); } + , &csspp_test::add_command_line_options + , &csspp_test::init_test + ); } // vim: ts=4 sw=4 et diff --git a/tests/catch_main.h b/tests/catch_main.h index e32ad84..db56d51 100644 --- a/tests/catch_main.h +++ b/tests/catch_main.h @@ -25,14 +25,14 @@ * that all the tests access, such as the snapcatch2.hpp header file. */ -// catch2 lib +// csspp // -#include +#include -// csspp lib +// catch2 // -#include +#include diff --git a/tests/catch_node.cpp b/tests/catch_node.cpp index a82fccc..95e812f 100644 --- a/tests/catch_node.cpp +++ b/tests/catch_node.cpp @@ -24,19 +24,19 @@ * implementation to ensure full coverage. */ -// self -// -#include "catch_main.h" - - -// csspp lib +// csspp // #include #include #include -// C++ lib +// self +// +#include "catch_main.h" + + +// C++ // #include #include diff --git a/tests/catch_nth_child.cpp b/tests/catch_nth_child.cpp index d620494..245fd20 100644 --- a/tests/catch_nth_child.cpp +++ b/tests/catch_nth_child.cpp @@ -24,17 +24,17 @@ * implementation to ensure full coverage. */ -// self +// csspp // -#include "catch_main.h" +#include "csspp/nth_child.h" -// csspp lib +// self // -#include "csspp/nth_child.h" +#include "catch_main.h" -// C++ lib +// C++ // #include diff --git a/tests/catch_parser.cpp b/tests/catch_parser.cpp index 016829d..20fc34c 100644 --- a/tests/catch_parser.cpp +++ b/tests/catch_parser.cpp @@ -31,23 +31,23 @@ * is not known at the time the parser returns. */ -// self +// csspp // -#include "catch_main.h" +#include +#include -// csspp lib +// self // -#include -#include +#include "catch_main.h" -// C++ lib +// C++ // #include -// C lib +// C // #include diff --git a/tests/catch_position.cpp b/tests/catch_position.cpp index 926570b..9c5e1df 100644 --- a/tests/catch_position.cpp +++ b/tests/catch_position.cpp @@ -24,12 +24,7 @@ * implementation to ensure full coverage. */ -// self -// -#include "catch_main.h" - - -// csspp lib +// csspp // #include #include @@ -37,12 +32,17 @@ #include -// C++ lib +// self +// +#include "catch_main.h" + + +// C++ // #include -// C lib +// C // #include diff --git a/tests/catch_unicode_range.cpp b/tests/catch_unicode_range.cpp index 64372cd..a9a2874 100644 --- a/tests/catch_unicode_range.cpp +++ b/tests/catch_unicode_range.cpp @@ -24,26 +24,27 @@ * implementation to ensure full coverage. */ -// self +// csspp // -#include "catch_main.h" - +#include -// csspp lib -// #include #include -#include -// C++ lib +// self +// +#include "catch_main.h" + + +// C++ // -#include +#include -// C lib +// C // -#include +#include // last include From 08ef97c05a825e318ddf1fbae6d271252a746d1c Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Fri, 3 Jun 2022 18:35:24 -0700 Subject: [PATCH 26/64] Updated copyright notices to 2022. --- cmake/CSSPPConfig.cmake.in | 2 +- cmake/CSSPPConfigVersion.cmake.in | 2 +- dev/MasterCMakeLists.txt | 2 +- dev/build-release | 2 +- dev/coverage | 2 +- dev/pack | 2 +- dev/version | 2 +- doc/pages/compiler-at-keywords.cpp | 2 +- doc/pages/compiler-expression-by-type.cpp | 2 +- doc/pages/compiler-expression-page.cpp | 2 +- doc/pages/compiler-page.cpp | 2 +- doc/pages/compiler-selectors-rules.cpp | 2 +- doc/pages/lexer-page.cpp | 4 ++-- doc/pages/main.cpp | 2 +- doc/pages/parser-page.cpp | 2 +- scripts/system/close.scss | 2 +- scripts/system/constants.scss | 2 +- scripts/system/functions.scss | 2 +- scripts/system/init.scss | 2 +- scripts/system/logo.scss | 2 +- scripts/system/selectors.scss | 2 +- scripts/system/version.scss.in | 2 +- scripts/validation/countries.scss | 2 +- scripts/validation/has-font-metrics.scss | 2 +- scripts/validation/languages.scss | 2 +- scripts/validation/pseudo-classes.scss | 2 +- scripts/validation/pseudo-elements.scss | 2 +- scripts/validation/pseudo-functions.scss | 2 +- scripts/validation/pseudo-nth-functions.scss | 2 +- scripts/validation/slash-separator.scss | 2 +- tests/catch_assembler.cpp | 20 ++++++++++---------- tests/catch_parser.cpp | 4 ++-- 32 files changed, 43 insertions(+), 43 deletions(-) diff --git a/cmake/CSSPPConfig.cmake.in b/cmake/CSSPPConfig.cmake.in index 8bb17a0..0ff547e 100644 --- a/cmake/CSSPPConfig.cmake.in +++ b/cmake/CSSPPConfig.cmake.in @@ -8,7 +8,7 @@ # CSSPP_DEFINITIONS - Compiler switches required for linking against csspp # # License: -# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/cmake/CSSPPConfigVersion.cmake.in b/cmake/CSSPPConfigVersion.cmake.in index 07c253b..098b7de 100644 --- a/cmake/CSSPPConfigVersion.cmake.in +++ b/cmake/CSSPPConfigVersion.cmake.in @@ -1,7 +1,7 @@ # Verify CSS Preprocessor version validity. # # License: -# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/dev/MasterCMakeLists.txt b/dev/MasterCMakeLists.txt index 5fe78cf..5c29ecd 100644 --- a/dev/MasterCMakeLists.txt +++ b/dev/MasterCMakeLists.txt @@ -11,7 +11,7 @@ # See the CMake documentation. # # License: -# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/dev/build-release b/dev/build-release index 1177ff1..28632b2 100755 --- a/dev/build-release +++ b/dev/build-release @@ -12,7 +12,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/dev/coverage b/dev/coverage index 25ea5a3..22d6cbb 100755 --- a/dev/coverage +++ b/dev/coverage @@ -11,7 +11,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/dev/pack b/dev/pack index 7593b91..2425f1a 100755 --- a/dev/pack +++ b/dev/pack @@ -14,7 +14,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/dev/version b/dev/version index 19e2afd..aa99199 100755 --- a/dev/version +++ b/dev/version @@ -11,7 +11,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/doc/pages/compiler-at-keywords.cpp b/doc/pages/compiler-at-keywords.cpp index c919702..0b0281f 100644 --- a/doc/pages/compiler-at-keywords.cpp +++ b/doc/pages/compiler-at-keywords.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/compiler-expression-by-type.cpp b/doc/pages/compiler-expression-by-type.cpp index aa899e1..172a94c 100644 --- a/doc/pages/compiler-expression-by-type.cpp +++ b/doc/pages/compiler-expression-by-type.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/compiler-expression-page.cpp b/doc/pages/compiler-expression-page.cpp index 0350082..7449ed9 100644 --- a/doc/pages/compiler-expression-page.cpp +++ b/doc/pages/compiler-expression-page.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/compiler-page.cpp b/doc/pages/compiler-page.cpp index 5f77d4f..4058050 100644 --- a/doc/pages/compiler-page.cpp +++ b/doc/pages/compiler-page.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/compiler-selectors-rules.cpp b/doc/pages/compiler-selectors-rules.cpp index 1992ef6..b5455ca 100644 --- a/doc/pages/compiler-selectors-rules.cpp +++ b/doc/pages/compiler-selectors-rules.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/lexer-page.cpp b/doc/pages/lexer-page.cpp index 128d143..48890e9 100644 --- a/doc/pages/lexer-page.cpp +++ b/doc/pages/lexer-page.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -298,7 +298,7 @@ * * \code * // CSS Preprocessor - * // Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved + * // Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved * // * // @preserve * \endcode diff --git a/doc/pages/main.cpp b/doc/pages/main.cpp index 416aeb9..773c9a7 100644 --- a/doc/pages/main.cpp +++ b/doc/pages/main.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/parser-page.cpp b/doc/pages/parser-page.cpp index 42a2d3c..b347cde 100644 --- a/doc/pages/parser-page.cpp +++ b/doc/pages/parser-page.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/close.scss b/scripts/system/close.scss index fcf5a01..a8ccb1c 100644 --- a/scripts/system/close.scss +++ b/scripts/system/close.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/constants.scss b/scripts/system/constants.scss index 55f48ab..19247a1 100644 --- a/scripts/system/constants.scss +++ b/scripts/system/constants.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/functions.scss b/scripts/system/functions.scss index 93b41b2..b4c904c 100644 --- a/scripts/system/functions.scss +++ b/scripts/system/functions.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/init.scss b/scripts/system/init.scss index a13771f..32440e6 100644 --- a/scripts/system/init.scss +++ b/scripts/system/init.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/logo.scss b/scripts/system/logo.scss index 804b9bb..2c1c032 100644 --- a/scripts/system/logo.scss +++ b/scripts/system/logo.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/selectors.scss b/scripts/system/selectors.scss index 45a447a..b72e971 100644 --- a/scripts/system/selectors.scss +++ b/scripts/system/selectors.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/version.scss.in b/scripts/system/version.scss.in index dcd1f91..bea2ef2 100644 --- a/scripts/system/version.scss.in +++ b/scripts/system/version.scss.in @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/countries.scss b/scripts/validation/countries.scss index 5cb4713..4537e07 100644 --- a/scripts/validation/countries.scss +++ b/scripts/validation/countries.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/has-font-metrics.scss b/scripts/validation/has-font-metrics.scss index cdbd4d7..6534acd 100644 --- a/scripts/validation/has-font-metrics.scss +++ b/scripts/validation/has-font-metrics.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/languages.scss b/scripts/validation/languages.scss index 1cd3918..eefada3 100644 --- a/scripts/validation/languages.scss +++ b/scripts/validation/languages.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/pseudo-classes.scss b/scripts/validation/pseudo-classes.scss index 69811a7..44cb84a 100644 --- a/scripts/validation/pseudo-classes.scss +++ b/scripts/validation/pseudo-classes.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/pseudo-elements.scss b/scripts/validation/pseudo-elements.scss index 52b2ff2..4d4de02 100644 --- a/scripts/validation/pseudo-elements.scss +++ b/scripts/validation/pseudo-elements.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/pseudo-functions.scss b/scripts/validation/pseudo-functions.scss index eefcb12..d5db7a1 100644 --- a/scripts/validation/pseudo-functions.scss +++ b/scripts/validation/pseudo-functions.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/pseudo-nth-functions.scss b/scripts/validation/pseudo-nth-functions.scss index 32db331..5052c82 100644 --- a/scripts/validation/pseudo-nth-functions.scss +++ b/scripts/validation/pseudo-nth-functions.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/slash-separator.scss b/scripts/validation/slash-separator.scss index 9b83395..f869381 100644 --- a/scripts/validation/slash-separator.scss +++ b/scripts/validation/slash-separator.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_assembler.cpp b/tests/catch_assembler.cpp index 09a33db..1f974ab 100644 --- a/tests/catch_assembler.cpp +++ b/tests/catch_assembler.cpp @@ -2462,7 +2462,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") ++i) { std::stringstream ss; - ss << "// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version {$_csspp_version} -- @preserve\n" + ss << "// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version {$_csspp_version} -- @preserve\n" << "body.error { color: red }\n"; csspp::position pos("test.css"); csspp::lexer::pointer_t l(new csspp::lexer(ss, pos)); @@ -2493,7 +2493,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") { case csspp::output_mode_t::COMPACT: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error { color: red }\n" + csspp_test::get_close_comment() ); @@ -2501,7 +2501,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::COMPRESSED: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error{color:red}\n" + csspp_test::get_close_comment() ); @@ -2509,7 +2509,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::EXPANDED: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error\n" "{\n" " color: red;\n" @@ -2520,7 +2520,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::TIDY: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error{color:red}\n" + csspp_test::get_close_comment() ); @@ -2537,7 +2537,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") ++i) { std::stringstream ss; - ss << "// Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved.\n" + ss << "// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved.\n" << "// Assembler Test\n" << "// @preserve\n" << "body.error { color: red }\n"; @@ -2570,7 +2570,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") { case csspp::output_mode_t::COMPACT: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved.\n" +"/* Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" " */\n" @@ -2581,7 +2581,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::COMPRESSED: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved.\n" +"/* Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" " */\n" @@ -2592,7 +2592,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::EXPANDED: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved.\n" +"/* Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" " */\n" @@ -2606,7 +2606,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::TIDY: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved.\n" +"/* Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" " */\n" diff --git a/tests/catch_parser.cpp b/tests/catch_parser.cpp index 20fc34c..63ea3b3 100644 --- a/tests/catch_parser.cpp +++ b/tests/catch_parser.cpp @@ -220,7 +220,7 @@ CATCH_TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") std::stringstream ss; ss << "// $Id: ...$\n" << "div { border: 1px; }\n" - << "/* @preserve Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved. */"; + << "/* @preserve Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved. */"; csspp::position pos("test.css"); csspp::lexer::pointer_t l(new csspp::lexer(ss, pos)); @@ -243,7 +243,7 @@ CATCH_TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") " COLON\n" " WHITESPACE\n" " INTEGER \"px\" I:1\n" -" COMMENT \"@preserve Copyright (c) 2015-2021 Made to Order Software Corp. All Rights Reserved.\" I:1\n" +" COMMENT \"@preserve Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved.\" I:1\n" ); From cc199e9221c4e54757a7f3fadf28dbe0f7198451 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Fri, 3 Jun 2022 20:46:13 -0700 Subject: [PATCH 27/64] Moved the #include so they are all the same. --- csspp/assembler.cpp | 12 ++++++------ csspp/color.cpp | 10 +++++----- csspp/compiler.cpp | 16 ++++++++-------- csspp/csspp.cpp | 14 +++++++------- csspp/error.cpp | 6 +++--- csspp/exceptions.h | 2 +- csspp/expr_additive.cpp | 14 +++++++------- csspp/expr_conditional.cpp | 14 +++++++------- csspp/expr_equality.cpp | 14 +++++++------- csspp/expr_list.cpp | 14 +++++++------- csspp/expr_logical_and.cpp | 14 +++++++------- csspp/expr_logical_or.cpp | 14 +++++++------- csspp/expr_multiplicative.cpp | 14 +++++++------- csspp/expr_power.cpp | 14 +++++++------- csspp/expr_relational.cpp | 14 +++++++------- csspp/expr_unary.cpp | 14 +++++++------- csspp/expression.cpp | 14 +++++++------- csspp/internal_functions.cpp | 14 +++++++------- csspp/lexer.cpp | 12 ++++++------ csspp/node.cpp | 12 ++++++------ csspp/nth_child.cpp | 6 +++--- csspp/parser.cpp | 6 +++--- csspp/position.cpp | 2 +- csspp/position.h | 2 +- csspp/unicode_range.cpp | 10 +++++----- csspp/unicode_range.h | 2 +- doc/pages/compiler-page.cpp | 4 ++-- tests/catch_node.cpp | 2 +- tests/catch_parser.cpp | 4 ++-- 29 files changed, 145 insertions(+), 145 deletions(-) diff --git a/csspp/assembler.cpp b/csspp/assembler.cpp index bd2953d..3c9363f 100644 --- a/csspp/assembler.cpp +++ b/csspp/assembler.cpp @@ -27,14 +27,14 @@ * \sa \ref lexer_rules */ -#include "csspp/assembler.h" +#include "csspp/assembler.h" -#include "csspp/exceptions.h" -#include "csspp/lexer.h" -#include "csspp/nth_child.h" -#include "csspp/unicode_range.h" +#include "csspp/exceptions.h" +#include "csspp/lexer.h" +#include "csspp/nth_child.h" +#include "csspp/unicode_range.h" -#include +#include namespace csspp { diff --git a/csspp/color.cpp b/csspp/color.cpp index 664f542..43995e7 100644 --- a/csspp/color.cpp +++ b/csspp/color.cpp @@ -27,13 +27,13 @@ * into in string as small as possible (i.e. compress colors.) */ -#include "csspp/lexer.h" +#include "csspp/lexer.h" -#include "csspp/exceptions.h" +#include "csspp/exceptions.h" -#include -#include -#include +#include +#include +#include namespace csspp { diff --git a/csspp/compiler.cpp b/csspp/compiler.cpp index e4efaac..8f5ab0e 100644 --- a/csspp/compiler.cpp +++ b/csspp/compiler.cpp @@ -23,17 +23,17 @@ * \sa \ref compiler_reference */ -#include "csspp/compiler.h" +#include "csspp/compiler.h" -#include "csspp/exceptions.h" -#include "csspp/nth_child.h" -#include "csspp/parser.h" +#include "csspp/exceptions.h" +#include "csspp/nth_child.h" +#include "csspp/parser.h" -#include -#include -#include +#include +#include +#include -#include +#include namespace csspp { diff --git a/csspp/csspp.cpp b/csspp/csspp.cpp index 33369d0..b5fe893 100644 --- a/csspp/csspp.cpp +++ b/csspp/csspp.cpp @@ -24,15 +24,15 @@ * \sa \ref lexer_rules */ -#include "csspp/csspp.h" +#include "csspp/csspp.h" -#include "csspp/exceptions.h" +#include "csspp/exceptions.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include /** \brief The namespace of all the classes in the CSS Preprocessor. * diff --git a/csspp/error.cpp b/csspp/error.cpp index 452862c..90d267d 100644 --- a/csspp/error.cpp +++ b/csspp/error.cpp @@ -53,10 +53,10 @@ * \sa \ref lexer_rules */ -#include "csspp/error.h" +#include "csspp/error.h" -#include -#include +#include +#include namespace csspp { diff --git a/csspp/exceptions.h b/csspp/exceptions.h index a621c8e..cda4976 100644 --- a/csspp/exceptions.h +++ b/csspp/exceptions.h @@ -17,7 +17,7 @@ // C++ lib // -#include +#include namespace csspp diff --git a/csspp/expr_additive.cpp b/csspp/expr_additive.cpp index a17f841..ac7f497 100644 --- a/csspp/expr_additive.cpp +++ b/csspp/expr_additive.cpp @@ -23,15 +23,15 @@ * \sa \ref expression_rules */ -#include "csspp/expression.h" +#include "csspp/expression.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include "csspp/unicode_range.h" +#include "csspp/exceptions.h" +#include "csspp/parser.h" +#include "csspp/unicode_range.h" -#include -#include -#include +#include +#include +#include namespace csspp { diff --git a/csspp/expr_conditional.cpp b/csspp/expr_conditional.cpp index f1256a2..b617d73 100644 --- a/csspp/expr_conditional.cpp +++ b/csspp/expr_conditional.cpp @@ -23,15 +23,15 @@ * \sa \ref expression_rules */ -#include "csspp/expression.h" +#include "csspp/expression.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include "csspp/unicode_range.h" +#include "csspp/exceptions.h" +#include "csspp/parser.h" +#include "csspp/unicode_range.h" -#include -#include -#include +#include +#include +#include namespace csspp { diff --git a/csspp/expr_equality.cpp b/csspp/expr_equality.cpp index 57b9317..446d7f8 100644 --- a/csspp/expr_equality.cpp +++ b/csspp/expr_equality.cpp @@ -23,15 +23,15 @@ * \sa \ref expression_rules */ -#include "csspp/expression.h" +#include "csspp/expression.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include "csspp/unicode_range.h" +#include "csspp/exceptions.h" +#include "csspp/parser.h" +#include "csspp/unicode_range.h" -#include -#include -#include +#include +#include +#include namespace csspp { diff --git a/csspp/expr_list.cpp b/csspp/expr_list.cpp index 19bd3ab..8853e06 100644 --- a/csspp/expr_list.cpp +++ b/csspp/expr_list.cpp @@ -23,15 +23,15 @@ * \sa \ref expression_rules */ -#include "csspp/expression.h" +#include "csspp/expression.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include "csspp/unicode_range.h" +#include "csspp/exceptions.h" +#include "csspp/parser.h" +#include "csspp/unicode_range.h" -#include -#include -#include +#include +#include +#include namespace csspp { diff --git a/csspp/expr_logical_and.cpp b/csspp/expr_logical_and.cpp index 62a6b5e..be9fd7a 100644 --- a/csspp/expr_logical_and.cpp +++ b/csspp/expr_logical_and.cpp @@ -23,15 +23,15 @@ * \sa \ref expression_rules */ -#include "csspp/expression.h" +#include "csspp/expression.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include "csspp/unicode_range.h" +#include "csspp/exceptions.h" +#include "csspp/parser.h" +#include "csspp/unicode_range.h" -#include -#include -#include +#include +#include +#include namespace csspp { diff --git a/csspp/expr_logical_or.cpp b/csspp/expr_logical_or.cpp index 1d93edb..ffbcaa2 100644 --- a/csspp/expr_logical_or.cpp +++ b/csspp/expr_logical_or.cpp @@ -23,15 +23,15 @@ * \sa \ref expression_rules */ -#include "csspp/expression.h" +#include "csspp/expression.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include "csspp/unicode_range.h" +#include "csspp/exceptions.h" +#include "csspp/parser.h" +#include "csspp/unicode_range.h" -#include -#include -#include +#include +#include +#include namespace csspp { diff --git a/csspp/expr_multiplicative.cpp b/csspp/expr_multiplicative.cpp index 1567e32..9260c0d 100644 --- a/csspp/expr_multiplicative.cpp +++ b/csspp/expr_multiplicative.cpp @@ -23,15 +23,15 @@ * \sa \ref expression_rules */ -#include "csspp/expression.h" +#include "csspp/expression.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include "csspp/unicode_range.h" +#include "csspp/exceptions.h" +#include "csspp/parser.h" +#include "csspp/unicode_range.h" -#include -#include -#include +#include +#include +#include namespace csspp { diff --git a/csspp/expr_power.cpp b/csspp/expr_power.cpp index 0b30f9c..4cb4d8b 100644 --- a/csspp/expr_power.cpp +++ b/csspp/expr_power.cpp @@ -23,15 +23,15 @@ * \sa \ref expression_rules */ -#include "csspp/expression.h" +#include "csspp/expression.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include "csspp/unicode_range.h" +#include "csspp/exceptions.h" +#include "csspp/parser.h" +#include "csspp/unicode_range.h" -#include -#include -#include +#include +#include +#include namespace csspp { diff --git a/csspp/expr_relational.cpp b/csspp/expr_relational.cpp index cbbb121..c446586 100644 --- a/csspp/expr_relational.cpp +++ b/csspp/expr_relational.cpp @@ -23,15 +23,15 @@ * \sa \ref expression_rules */ -#include "csspp/expression.h" +#include "csspp/expression.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include "csspp/unicode_range.h" +#include "csspp/exceptions.h" +#include "csspp/parser.h" +#include "csspp/unicode_range.h" -#include -#include -#include +#include +#include +#include namespace csspp { diff --git a/csspp/expr_unary.cpp b/csspp/expr_unary.cpp index 156f1a7..a3a3192 100644 --- a/csspp/expr_unary.cpp +++ b/csspp/expr_unary.cpp @@ -23,15 +23,15 @@ * \sa \ref expression_rules */ -#include "csspp/expression.h" +#include "csspp/expression.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include "csspp/unicode_range.h" +#include "csspp/exceptions.h" +#include "csspp/parser.h" +#include "csspp/unicode_range.h" -#include -#include -#include +#include +#include +#include namespace csspp { diff --git a/csspp/expression.cpp b/csspp/expression.cpp index 7ffc99d..e615e98 100644 --- a/csspp/expression.cpp +++ b/csspp/expression.cpp @@ -23,15 +23,15 @@ * \sa \ref expression_rules */ -#include "csspp/expression.h" +#include "csspp/expression.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" -#include "csspp/unicode_range.h" +#include "csspp/exceptions.h" +#include "csspp/parser.h" +#include "csspp/unicode_range.h" -#include -#include -#include +#include +#include +#include namespace csspp { diff --git a/csspp/internal_functions.cpp b/csspp/internal_functions.cpp index 2301a7e..4cfb101 100644 --- a/csspp/internal_functions.cpp +++ b/csspp/internal_functions.cpp @@ -23,15 +23,15 @@ * \sa \ref expression_rules */ -#include "csspp/expression.h" +#include "csspp/expression.h" -#include "csspp/exceptions.h" -#include "csspp/parser.h" +#include "csspp/exceptions.h" +#include "csspp/parser.h" -#include -#include -#include -#include +#include +#include +#include +#include namespace csspp { diff --git a/csspp/lexer.cpp b/csspp/lexer.cpp index 24359a8..2022d30 100644 --- a/csspp/lexer.cpp +++ b/csspp/lexer.cpp @@ -37,14 +37,14 @@ * \sa \ref lexer_rules */ -#include "csspp/lexer.h" +#include "csspp/lexer.h" -#include "csspp/exceptions.h" -#include "csspp/unicode_range.h" +#include "csspp/exceptions.h" +#include "csspp/unicode_range.h" -#include -#include -#include +#include +#include +#include namespace csspp { diff --git a/csspp/node.cpp b/csspp/node.cpp index b1ba888..46dc31b 100644 --- a/csspp/node.cpp +++ b/csspp/node.cpp @@ -28,14 +28,14 @@ * \sa \ref lexer_rules */ -#include +#include -#include -#include -#include +#include +#include +#include -#include -#include +#include +#include namespace csspp { diff --git a/csspp/nth_child.cpp b/csspp/nth_child.cpp index 7521faa..16b3fbc 100644 --- a/csspp/nth_child.cpp +++ b/csspp/nth_child.cpp @@ -44,10 +44,10 @@ * | '-' INTEGER */ -#include "csspp/nth_child.h" +#include "csspp/nth_child.h" -#include -#include +#include +#include namespace csspp { diff --git a/csspp/parser.cpp b/csspp/parser.cpp index b30a16c..6b26c67 100644 --- a/csspp/parser.cpp +++ b/csspp/parser.cpp @@ -43,11 +43,11 @@ * \sa \ref parser_rules */ -#include "csspp/parser.h" +#include "csspp/parser.h" -#include "csspp/exceptions.h" +#include "csspp/exceptions.h" -#include +#include namespace csspp { diff --git a/csspp/position.cpp b/csspp/position.cpp index f00114e..b2c1f60 100644 --- a/csspp/position.cpp +++ b/csspp/position.cpp @@ -14,7 +14,7 @@ // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "csspp/position.h" +#include "csspp/position.h" namespace csspp { diff --git a/csspp/position.h b/csspp/position.h index 64de793..580e09f 100644 --- a/csspp/position.h +++ b/csspp/position.h @@ -22,7 +22,7 @@ // C++ lib // -#include +#include namespace csspp diff --git a/csspp/unicode_range.cpp b/csspp/unicode_range.cpp index b0bbb4a..a7fa57b 100644 --- a/csspp/unicode_range.cpp +++ b/csspp/unicode_range.cpp @@ -14,13 +14,13 @@ // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include "csspp/unicode_range.h" +#include "csspp/unicode_range.h" -#include "csspp/exceptions.h" +#include "csspp/exceptions.h" -#include -#include -#include +#include +#include +#include namespace csspp { diff --git a/csspp/unicode_range.h b/csspp/unicode_range.h index 6a4800a..a86579a 100644 --- a/csspp/unicode_range.h +++ b/csspp/unicode_range.h @@ -17,7 +17,7 @@ // self // -#include +#include namespace csspp { diff --git a/doc/pages/compiler-page.cpp b/doc/pages/compiler-page.cpp index 4058050..d7c0753 100644 --- a/doc/pages/compiler-page.cpp +++ b/doc/pages/compiler-page.cpp @@ -184,8 +184,8 @@ //! currently supported by csspp. //! //! \code -//! #include -//! #include +//! #include +//! #include //! //! std::ifstream in; //! if(!in.open("my-file.scss")) diff --git a/tests/catch_node.cpp b/tests/catch_node.cpp index 95e812f..db7f4d5 100644 --- a/tests/catch_node.cpp +++ b/tests/catch_node.cpp @@ -44,7 +44,7 @@ // C lib // -#include +#include // last include diff --git a/tests/catch_parser.cpp b/tests/catch_parser.cpp index 63ea3b3..4625994 100644 --- a/tests/catch_parser.cpp +++ b/tests/catch_parser.cpp @@ -44,12 +44,12 @@ // C++ // -#include +#include // C // -#include +#include // last include From 1c8d5042c26d3fb7ad88a9b3f23a08a69a676e9b Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sun, 10 Jul 2022 14:17:37 -0700 Subject: [PATCH 28/64] Dleted a few lines. --- CMakeLists.txt | 1 - cmake/CMakeLists.txt | 1 - csspp/CMakeLists.txt | 1 - doc/CMakeLists.txt | 1 - scripts/CMakeLists.txt | 1 - src/CMakeLists.txt | 1 - 6 files changed, 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bcec9e8..eeef7ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,6 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# ## ## Initialization diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index aaac618..6154359 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -16,7 +16,6 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# project(csspp) diff --git a/csspp/CMakeLists.txt b/csspp/CMakeLists.txt index 28f3a63..9daac9f 100644 --- a/csspp/CMakeLists.txt +++ b/csspp/CMakeLists.txt @@ -16,7 +16,6 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# project(csspp) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 0131ce7..fb50422 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -16,7 +16,6 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# ## ## Documentation diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index fcc39d5..7d310be 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -16,7 +16,6 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# project(csspp_scripts) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b54d4f5..a80adb7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,7 +16,6 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# project(csspp-tool) From d4a05aa6282d8587a17dd04a07d877ff42fb2a28 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Mon, 11 Jul 2022 08:16:02 -0700 Subject: [PATCH 29/64] Bumped version. --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index e1d292e..778d4b0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +csspp (1.0.31.2~bionic) bionic; urgency=high + + * Some more clean ups. + + -- Alexis Wilke Sat, 21 May 2022 08:56:52 -0700 + csspp (1.0.31.1~bionic) bionic; urgency=high * Fixed compat version to v10. From f4d14a71373284a4713a6c602e7f8cf36c0d93e4 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Mon, 11 Jul 2022 08:50:10 -0700 Subject: [PATCH 30/64] Added missing SnapCatch2 dependency. --- debian/control | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/debian/control b/debian/control index 553d2d0..acd661b 100644 --- a/debian/control +++ b/debian/control @@ -1,17 +1,18 @@ Source: csspp Priority: extra -Maintainer: R. Douglas Barbieri +Maintainer: Alexis Wilke Build-Depends: catch (>= 1.0), cmake, debhelper, doxygen, graphviz, - libadvgetopt-dev (>= 2.0.14.0~xenial), + libadvgetopt-dev (>= 2.0.14.0~bionic), libboost-dev, - libexcept-dev (>= 1.0.5.0~xenial), - libutf8-dev (>= 1.0.6.0~xenial), - snapcmakemodules (>= 1.0.35.3~xenial), - snapdev (>= 1.1.2.0~xenial) + libexcept-dev (>= 1.0.5.0~bionic), + libutf8-dev (>= 1.0.6.0~bionic), + snapcatch2 (>= 2.9.1.0~bionic), + snapcmakemodules (>= 1.0.35.3~bionic), + snapdev (>= 1.1.2.0~bionic) Standards-Version: 3.9.4 Section: libs Homepage: https://snapwebsites.org/ From 00503aa4116a9e0fdd85908140d1d2b36ef1634d Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Mon, 11 Jul 2022 17:04:03 -0700 Subject: [PATCH 31/64] Updates from the latest doxygen on 18.04. --- doc/csspp.doxy.in | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/doc/csspp.doxy.in b/doc/csspp.doxy.in index 7ad4a6c..751afdf 100644 --- a/doc/csspp.doxy.in +++ b/doc/csspp.doxy.in @@ -1,4 +1,4 @@ -# Doxyfile 1.8.11 +# Doxyfile 1.8.13 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -293,6 +293,15 @@ EXTENSION_MAPPING = in=C++ MARKDOWN_SUPPORT = YES +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by putting a % sign in front of the word or @@ -797,8 +806,8 @@ INPUT_ENCODING = UTF-8 # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, # *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl, -# *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js. +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. FILE_PATTERNS = *.h \ *.cpp @@ -2367,6 +2376,11 @@ DIAFILE_DIRS = PLANTUML_JAR_PATH = +# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a +# configuration file for plantuml. + +PLANTUML_CFG_FILE = + # When using plantuml, the specified paths are searched for files specified by # the !include statement in a plantuml block. From 958152c017d9a35a19d5d3de2a23734c93342eb9 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Mon, 11 Jul 2022 17:06:36 -0700 Subject: [PATCH 32/64] Fixed doxy file. --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 778d4b0..02245b3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +csspp (1.0.31.3~bionic) bionic; urgency=high + + * Updated the doxy file, just in case. + + -- Alexis Wilke Mon, 11 Jul 2022 17:06:18 -0700 + csspp (1.0.31.2~bionic) bionic; urgency=high * Some more clean ups. From fc4c4c11b308797bb6e8d17bef8a615c2b60a357 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Fri, 15 Jul 2022 05:39:26 -0700 Subject: [PATCH 33/64] Bump version. --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 02245b3..e281b44 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +csspp (1.0.31.4~bionic) bionic; urgency=high + + * Retry build with newer advgetopt fix. + + -- Alexis Wilke Fri, 15 Jul 2022 05:39:17 -0700 + csspp (1.0.31.3~bionic) bionic; urgency=high * Updated the doxy file, just in case. From 790cd77e05ef2376659a381ffdce2f2f83d103f9 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Thu, 4 Aug 2022 19:54:25 -0700 Subject: [PATCH 34/64] Added seed.txt to be ignored. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9c2098d..8b59ba1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ tmp *.sw? +seed.txt From 1dbe77bab4b6a34ec75aa315fbe15752483f9596 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Mon, 31 Oct 2022 14:47:17 -0700 Subject: [PATCH 35/64] Bump version to rebuild. --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index e281b44..11a09e5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +csspp (1.0.31.5~bionic) bionic; urgency=high + + * Rebuild against newer dependencies. + + -- Alexis Wilke Mon, 31 Oct 2022 14:47:09 -0700 + csspp (1.0.31.4~bionic) bionic; urgency=high * Retry build with newer advgetopt fix. From 3495ee7f717746b70b40e2c1b0f27b50939c0e5a Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 12 Nov 2022 17:47:00 -0800 Subject: [PATCH 36/64] Bumped build version to rebuild on Launchpad. --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 11a09e5..9483afb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +csspp (1.0.31.6~bionic) bionic; urgency=high + + * Bumped build version to rebuild on Launchpad. + + -- Alexis Wilke Sat, 12 Nov 2022 17:46:58 -0800 + csspp (1.0.31.5~bionic) bionic; urgency=high * Rebuild against newer dependencies. From 1c7e45d56f4537e3dadbb3857d393fdcd24c1629 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 24 Dec 2022 12:08:40 -0800 Subject: [PATCH 37/64] Renamed exceptions.h without the 's': exception.h. Some clean ups. --- csspp/CMakeLists.txt | 2 +- csspp/assembler.cpp | 14 +++++++++++++- csspp/color.cpp | 14 +++++++++++++- csspp/compiler.cpp | 17 ++++++++++++++++- csspp/csspp.cpp | 14 +++++++++++++- csspp/csspp.h.in | 2 +- csspp/{exceptions.h => exception.h} | 0 csspp/expr_additive.cpp | 13 ++++++++++++- csspp/expr_conditional.cpp | 1 - csspp/expr_equality.cpp | 2 +- csspp/expr_list.cpp | 2 +- csspp/expr_logical_and.cpp | 1 - csspp/expr_logical_or.cpp | 1 - csspp/expr_multiplicative.cpp | 14 +++++++++++++- csspp/expr_power.cpp | 2 +- csspp/expr_relational.cpp | 2 +- csspp/expr_unary.cpp | 1 - csspp/expression.cpp | 14 +++++++++++++- csspp/internal_functions.cpp | 1 - csspp/lexer.cpp | 2 +- csspp/node.cpp | 14 +++++++++++++- csspp/parser.cpp | 2 +- csspp/unicode_range.cpp | 2 +- debian/changelog | 7 +++++++ src/csspp.cpp | 2 +- tests/catch_assembler.cpp | 8 ++++---- tests/catch_color.cpp | 8 ++++---- tests/catch_compiler.cpp | 2 +- tests/catch_csspp.cpp | 2 +- tests/catch_error.cpp | 8 ++++---- tests/catch_expr_additive.cpp | 6 +++--- tests/catch_expr_conditional.cpp | 6 +++--- tests/catch_expr_equality.cpp | 6 +++--- tests/catch_expr_list.cpp | 6 +++--- tests/catch_expr_logical_and.cpp | 6 +++--- tests/catch_expr_logical_or.cpp | 6 +++--- tests/catch_expr_multiplicative.cpp | 2 +- tests/catch_expr_power.cpp | 2 +- tests/catch_expr_relational.cpp | 2 +- tests/catch_expr_unary.cpp | 2 +- tests/catch_internal_functions.cpp | 2 +- tests/catch_lexer.cpp | 2 +- tests/catch_main.h | 2 +- tests/catch_node.cpp | 4 ++-- tests/catch_parser.cpp | 2 +- tests/catch_position.cpp | 2 +- tests/catch_unicode_range.cpp | 2 +- 47 files changed, 167 insertions(+), 67 deletions(-) rename csspp/{exceptions.h => exception.h} (100%) diff --git a/csspp/CMakeLists.txt b/csspp/CMakeLists.txt index 9daac9f..ece5114 100644 --- a/csspp/CMakeLists.txt +++ b/csspp/CMakeLists.txt @@ -82,7 +82,7 @@ install( compiler.h ${CMAKE_CURRENT_BINARY_DIR}/csspp.h error.h - exceptions.h + exception.h expression.h lexer.h node.h diff --git a/csspp/assembler.cpp b/csspp/assembler.cpp index 3c9363f..96cf160 100644 --- a/csspp/assembler.cpp +++ b/csspp/assembler.cpp @@ -27,15 +27,27 @@ * \sa \ref lexer_rules */ +// self +// #include "csspp/assembler.h" -#include "csspp/exceptions.h" +#include "csspp/exception.h" #include "csspp/lexer.h" #include "csspp/nth_child.h" #include "csspp/unicode_range.h" + +// C++ +// #include + +// last include +// +#include + + + namespace csspp { diff --git a/csspp/color.cpp b/csspp/color.cpp index 43995e7..c2509d8 100644 --- a/csspp/color.cpp +++ b/csspp/color.cpp @@ -27,14 +27,26 @@ * into in string as small as possible (i.e. compress colors.) */ +// self +// #include "csspp/lexer.h" -#include "csspp/exceptions.h" +#include "csspp/exception.h" + +// C++ +// #include #include #include + +// last include +// +#include + + + namespace csspp { diff --git a/csspp/compiler.cpp b/csspp/compiler.cpp index 8f5ab0e..de19619 100644 --- a/csspp/compiler.cpp +++ b/csspp/compiler.cpp @@ -23,18 +23,33 @@ * \sa \ref compiler_reference */ +// self +// #include "csspp/compiler.h" -#include "csspp/exceptions.h" +#include "csspp/exception.h" #include "csspp/nth_child.h" #include "csspp/parser.h" + +// C++ +// #include #include #include + +// C +// #include + +// last include +// +#include + + + namespace csspp { diff --git a/csspp/csspp.cpp b/csspp/csspp.cpp index b5fe893..2f15be1 100644 --- a/csspp/csspp.cpp +++ b/csspp/csspp.cpp @@ -24,16 +24,28 @@ * \sa \ref lexer_rules */ +// self +// #include "csspp/csspp.h" -#include "csspp/exceptions.h" +#include "csspp/exception.h" + +// C++ +// #include #include #include #include #include + +// last include +// +#include + + + /** \brief The namespace of all the classes in the CSS Preprocessor. * * All the classes and many definitions appear under 'csspp'. It diff --git a/csspp/csspp.h.in b/csspp/csspp.h.in index aad64a6..5cb207e 100644 --- a/csspp/csspp.h.in +++ b/csspp/csspp.h.in @@ -17,7 +17,7 @@ // self // -#include "csspp/exceptions.h" +#include "csspp/exception.h" // C++ lib diff --git a/csspp/exceptions.h b/csspp/exception.h similarity index 100% rename from csspp/exceptions.h rename to csspp/exception.h diff --git a/csspp/expr_additive.cpp b/csspp/expr_additive.cpp index ac7f497..960b5e3 100644 --- a/csspp/expr_additive.cpp +++ b/csspp/expr_additive.cpp @@ -23,16 +23,27 @@ * \sa \ref expression_rules */ +// self +// #include "csspp/expression.h" -#include "csspp/exceptions.h" +#include "csspp/exception.h" #include "csspp/parser.h" #include "csspp/unicode_range.h" + +// C++ +// #include #include #include +// last include +// +#include + + + namespace csspp { diff --git a/csspp/expr_conditional.cpp b/csspp/expr_conditional.cpp index b617d73..863adba 100644 --- a/csspp/expr_conditional.cpp +++ b/csspp/expr_conditional.cpp @@ -25,7 +25,6 @@ #include "csspp/expression.h" -#include "csspp/exceptions.h" #include "csspp/parser.h" #include "csspp/unicode_range.h" diff --git a/csspp/expr_equality.cpp b/csspp/expr_equality.cpp index 446d7f8..3cb90bf 100644 --- a/csspp/expr_equality.cpp +++ b/csspp/expr_equality.cpp @@ -25,7 +25,7 @@ #include "csspp/expression.h" -#include "csspp/exceptions.h" +#include "csspp/exception.h" #include "csspp/parser.h" #include "csspp/unicode_range.h" diff --git a/csspp/expr_list.cpp b/csspp/expr_list.cpp index 8853e06..e5ba1d1 100644 --- a/csspp/expr_list.cpp +++ b/csspp/expr_list.cpp @@ -25,7 +25,7 @@ #include "csspp/expression.h" -#include "csspp/exceptions.h" +#include "csspp/exception.h" #include "csspp/parser.h" #include "csspp/unicode_range.h" diff --git a/csspp/expr_logical_and.cpp b/csspp/expr_logical_and.cpp index be9fd7a..6932ab1 100644 --- a/csspp/expr_logical_and.cpp +++ b/csspp/expr_logical_and.cpp @@ -25,7 +25,6 @@ #include "csspp/expression.h" -#include "csspp/exceptions.h" #include "csspp/parser.h" #include "csspp/unicode_range.h" diff --git a/csspp/expr_logical_or.cpp b/csspp/expr_logical_or.cpp index ffbcaa2..4456158 100644 --- a/csspp/expr_logical_or.cpp +++ b/csspp/expr_logical_or.cpp @@ -25,7 +25,6 @@ #include "csspp/expression.h" -#include "csspp/exceptions.h" #include "csspp/parser.h" #include "csspp/unicode_range.h" diff --git a/csspp/expr_multiplicative.cpp b/csspp/expr_multiplicative.cpp index 9260c0d..fe4ddae 100644 --- a/csspp/expr_multiplicative.cpp +++ b/csspp/expr_multiplicative.cpp @@ -23,16 +23,28 @@ * \sa \ref expression_rules */ +// self +// #include "csspp/expression.h" -#include "csspp/exceptions.h" +#include "csspp/exception.h" #include "csspp/parser.h" #include "csspp/unicode_range.h" + +// C++ +// #include #include #include + +// last include +// +#include + + + namespace csspp { diff --git a/csspp/expr_power.cpp b/csspp/expr_power.cpp index 4cb4d8b..4bb777d 100644 --- a/csspp/expr_power.cpp +++ b/csspp/expr_power.cpp @@ -25,7 +25,7 @@ #include "csspp/expression.h" -#include "csspp/exceptions.h" +#include "csspp/exception.h" #include "csspp/parser.h" #include "csspp/unicode_range.h" diff --git a/csspp/expr_relational.cpp b/csspp/expr_relational.cpp index c446586..54ca93d 100644 --- a/csspp/expr_relational.cpp +++ b/csspp/expr_relational.cpp @@ -25,7 +25,7 @@ #include "csspp/expression.h" -#include "csspp/exceptions.h" +#include "csspp/exception.h" #include "csspp/parser.h" #include "csspp/unicode_range.h" diff --git a/csspp/expr_unary.cpp b/csspp/expr_unary.cpp index a3a3192..45f9ccb 100644 --- a/csspp/expr_unary.cpp +++ b/csspp/expr_unary.cpp @@ -25,7 +25,6 @@ #include "csspp/expression.h" -#include "csspp/exceptions.h" #include "csspp/parser.h" #include "csspp/unicode_range.h" diff --git a/csspp/expression.cpp b/csspp/expression.cpp index e615e98..619a90a 100644 --- a/csspp/expression.cpp +++ b/csspp/expression.cpp @@ -23,16 +23,28 @@ * \sa \ref expression_rules */ +// self +// #include "csspp/expression.h" -#include "csspp/exceptions.h" +#include "csspp/exception.h" #include "csspp/parser.h" #include "csspp/unicode_range.h" + +// C++ +// #include #include #include + +// last include +// +#include + + + namespace csspp { diff --git a/csspp/internal_functions.cpp b/csspp/internal_functions.cpp index 4cfb101..9e4a7bb 100644 --- a/csspp/internal_functions.cpp +++ b/csspp/internal_functions.cpp @@ -25,7 +25,6 @@ #include "csspp/expression.h" -#include "csspp/exceptions.h" #include "csspp/parser.h" #include diff --git a/csspp/lexer.cpp b/csspp/lexer.cpp index 2022d30..48ff604 100644 --- a/csspp/lexer.cpp +++ b/csspp/lexer.cpp @@ -39,7 +39,7 @@ #include "csspp/lexer.h" -#include "csspp/exceptions.h" +#include "csspp/exception.h" #include "csspp/unicode_range.h" #include diff --git a/csspp/node.cpp b/csspp/node.cpp index 46dc31b..588252e 100644 --- a/csspp/node.cpp +++ b/csspp/node.cpp @@ -28,15 +28,27 @@ * \sa \ref lexer_rules */ +// self +// #include -#include +#include #include #include + +// C++ +// #include #include + +// last include +// +#include + + + namespace csspp { diff --git a/csspp/parser.cpp b/csspp/parser.cpp index 6b26c67..5f65e16 100644 --- a/csspp/parser.cpp +++ b/csspp/parser.cpp @@ -45,7 +45,7 @@ #include "csspp/parser.h" -#include "csspp/exceptions.h" +#include "csspp/exception.h" #include diff --git a/csspp/unicode_range.cpp b/csspp/unicode_range.cpp index a7fa57b..5a87d81 100644 --- a/csspp/unicode_range.cpp +++ b/csspp/unicode_range.cpp @@ -16,7 +16,7 @@ #include "csspp/unicode_range.h" -#include "csspp/exceptions.h" +#include "csspp/exception.h" #include #include diff --git a/debian/changelog b/debian/changelog index 9483afb..8ab0df8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +csspp (1.0.32.0~bionic) bionic; urgency=high + + * Renamed exceptions.h without the 's': exception.h. + * Some clean ups. + + -- Alexis Wilke Sat, 24 Dec 2022 12:08:23 -0800 + csspp (1.0.31.6~bionic) bionic; urgency=high * Bumped build version to rebuild on Launchpad. diff --git a/src/csspp.cpp b/src/csspp.cpp index f2c6342..38a4faf 100644 --- a/src/csspp.cpp +++ b/src/csspp.cpp @@ -228,7 +228,7 @@ // #include #include -#include +#include #include diff --git a/tests/catch_assembler.cpp b/tests/catch_assembler.cpp index 1f974ab..bfa089a 100644 --- a/tests/catch_assembler.cpp +++ b/tests/catch_assembler.cpp @@ -24,12 +24,12 @@ * full coverage and many edge cases of CSS encoding. */ -// csspp lib +// csspp // #include #include -#include +#include #include @@ -38,14 +38,14 @@ #include "catch_main.h" -// C++ lib +// C++ // #include #include #include -// C lib +// C // #include #include diff --git a/tests/catch_color.cpp b/tests/catch_color.cpp index ed6b15a..d8d996b 100644 --- a/tests/catch_color.cpp +++ b/tests/catch_color.cpp @@ -24,11 +24,11 @@ * implementation to ensure full coverage. */ -// csspp lib +// csspp // #include -#include +#include #include @@ -37,13 +37,13 @@ #include "catch_main.h" -// C++ lib +// C++ // #include #include -// C lib +// C // #include #include diff --git a/tests/catch_compiler.cpp b/tests/catch_compiler.cpp index 7a5e401..d5d8774 100644 --- a/tests/catch_compiler.cpp +++ b/tests/catch_compiler.cpp @@ -29,7 +29,7 @@ // #include -#include +#include #include diff --git a/tests/catch_csspp.cpp b/tests/catch_csspp.cpp index fa73771..68ef26b 100644 --- a/tests/catch_csspp.cpp +++ b/tests/catch_csspp.cpp @@ -28,7 +28,7 @@ // #include -#include +#include #include diff --git a/tests/catch_error.cpp b/tests/catch_error.cpp index 7b9f282..82522cf 100644 --- a/tests/catch_error.cpp +++ b/tests/catch_error.cpp @@ -24,11 +24,11 @@ * implementation to ensure full coverage. */ -// csspp lib +// csspp // #include -#include +#include #include #include @@ -38,12 +38,12 @@ #include "catch_main.h" -// C++ lib +// C++ // #include -// C lib +// C // #include diff --git a/tests/catch_expr_additive.cpp b/tests/catch_expr_additive.cpp index 32f87af..18c10cf 100644 --- a/tests/catch_expr_additive.cpp +++ b/tests/catch_expr_additive.cpp @@ -34,11 +34,11 @@ * classes. */ -// csspp lib +// csspp // #include #include -#include +#include #include @@ -47,7 +47,7 @@ #include "catch_main.h" -// C++ lib +// C++ // #include diff --git a/tests/catch_expr_conditional.cpp b/tests/catch_expr_conditional.cpp index 0ce73d3..c532bff 100644 --- a/tests/catch_expr_conditional.cpp +++ b/tests/catch_expr_conditional.cpp @@ -34,12 +34,12 @@ * classes. */ -// csspp lib +// csspp // #include #include -#include +#include #include @@ -48,7 +48,7 @@ #include "catch_main.h" -// C++ lib +// C++ // #include diff --git a/tests/catch_expr_equality.cpp b/tests/catch_expr_equality.cpp index 616e2c1..c35455a 100644 --- a/tests/catch_expr_equality.cpp +++ b/tests/catch_expr_equality.cpp @@ -37,11 +37,11 @@ * classes. */ -// csspp lib +// csspp // #include #include -#include +#include #include @@ -50,7 +50,7 @@ #include "catch_main.h" -// C++ lib +// C++ // #include diff --git a/tests/catch_expr_list.cpp b/tests/catch_expr_list.cpp index 5669008..e595daa 100644 --- a/tests/catch_expr_list.cpp +++ b/tests/catch_expr_list.cpp @@ -34,11 +34,11 @@ * classes. */ -// csspp lib +// csspp // #include #include -#include +#include #include @@ -47,7 +47,7 @@ #include "catch_main.h" -// C++ lib +// C++ // #include diff --git a/tests/catch_expr_logical_and.cpp b/tests/catch_expr_logical_and.cpp index e4ea5d4..d6a33f6 100644 --- a/tests/catch_expr_logical_and.cpp +++ b/tests/catch_expr_logical_and.cpp @@ -34,11 +34,11 @@ * classes. */ -// csspp lib +// csspp // #include #include -#include +#include #include @@ -47,7 +47,7 @@ #include "catch_main.h" -// C++ lib +// C++ // #include diff --git a/tests/catch_expr_logical_or.cpp b/tests/catch_expr_logical_or.cpp index a396802..bd182bd 100644 --- a/tests/catch_expr_logical_or.cpp +++ b/tests/catch_expr_logical_or.cpp @@ -34,11 +34,11 @@ * classes. */ -// csspp lib +// csspp // #include #include -#include +#include #include @@ -47,7 +47,7 @@ #include "catch_main.h" -// C++ lib +// C++ // #include diff --git a/tests/catch_expr_multiplicative.cpp b/tests/catch_expr_multiplicative.cpp index 072735e..0436bda 100644 --- a/tests/catch_expr_multiplicative.cpp +++ b/tests/catch_expr_multiplicative.cpp @@ -35,7 +35,7 @@ // #include #include -#include +#include #include diff --git a/tests/catch_expr_power.cpp b/tests/catch_expr_power.cpp index 629f7f1..e7e5e6f 100644 --- a/tests/catch_expr_power.cpp +++ b/tests/catch_expr_power.cpp @@ -38,7 +38,7 @@ // #include #include -#include +#include #include diff --git a/tests/catch_expr_relational.cpp b/tests/catch_expr_relational.cpp index f404f20..3754156 100644 --- a/tests/catch_expr_relational.cpp +++ b/tests/catch_expr_relational.cpp @@ -39,7 +39,7 @@ // #include #include -#include +#include #include diff --git a/tests/catch_expr_unary.cpp b/tests/catch_expr_unary.cpp index b664bb9..a8ba0b5 100644 --- a/tests/catch_expr_unary.cpp +++ b/tests/catch_expr_unary.cpp @@ -37,7 +37,7 @@ // #include #include -#include +#include #include diff --git a/tests/catch_internal_functions.cpp b/tests/catch_internal_functions.cpp index bc85164..d6f4805 100644 --- a/tests/catch_internal_functions.cpp +++ b/tests/catch_internal_functions.cpp @@ -37,7 +37,7 @@ // #include #include -#include +#include #include diff --git a/tests/catch_lexer.cpp b/tests/catch_lexer.cpp index e034f46..c73660b 100644 --- a/tests/catch_lexer.cpp +++ b/tests/catch_lexer.cpp @@ -30,7 +30,7 @@ // csspp // -#include +#include #include #include diff --git a/tests/catch_main.h b/tests/catch_main.h index db56d51..5750a09 100644 --- a/tests/catch_main.h +++ b/tests/catch_main.h @@ -30,7 +30,7 @@ #include -// catch2 +// snapcatch2 // #include diff --git a/tests/catch_node.cpp b/tests/catch_node.cpp index db7f4d5..42f6cb0 100644 --- a/tests/catch_node.cpp +++ b/tests/catch_node.cpp @@ -26,7 +26,7 @@ // csspp // -#include +#include #include #include @@ -42,7 +42,7 @@ #include -// C lib +// C // #include diff --git a/tests/catch_parser.cpp b/tests/catch_parser.cpp index 4625994..83b94e8 100644 --- a/tests/catch_parser.cpp +++ b/tests/catch_parser.cpp @@ -33,7 +33,7 @@ // csspp // -#include +#include #include diff --git a/tests/catch_position.cpp b/tests/catch_position.cpp index 9c5e1df..174862a 100644 --- a/tests/catch_position.cpp +++ b/tests/catch_position.cpp @@ -27,7 +27,7 @@ // csspp // #include -#include +#include #include #include diff --git a/tests/catch_unicode_range.cpp b/tests/catch_unicode_range.cpp index a9a2874..a503a2a 100644 --- a/tests/catch_unicode_range.cpp +++ b/tests/catch_unicode_range.cpp @@ -28,7 +28,7 @@ // #include -#include +#include #include From dc0cbde012b66a3e7c17f2d9cf0e237a0cfbe827 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Mon, 17 Apr 2023 20:45:39 -0700 Subject: [PATCH 38/64] Change flags to new scheme. --- tests/catch_main.cpp | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/tests/catch_main.cpp b/tests/catch_main.cpp index 7c8240a..b66ecaa 100644 --- a/tests/catch_main.cpp +++ b/tests/catch_main.cpp @@ -202,31 +202,23 @@ void compare(std::string const & generated, std::string const & expected, char c } -inline std::string & g_script_path() -{ - static std::string script_path = std::string(); +std::string g_script_path; +std::string g_version_script_path; +bool g_show_errors; - return script_path; -} std::string get_script_path() { - return g_script_path(); + return g_script_path; } -inline std::string & g_version_script_path() -{ - static std::string version_script_path = std::string(); - - return version_script_path; -} - std::string get_version_script_path() { - return g_version_script_path(); + return g_version_script_path; } + std::string get_default_variables(default_variables_flags_t const flags) { #define STRINGIFY_CONTENT(str) #str @@ -800,23 +792,16 @@ time_t get_now() return g_now; } -inline bool & g_show_errors() -{ - static bool show_errors = false; - - return show_errors; -} - Catch::Clara::Parser add_command_line_options(Catch::Clara::Parser const & cli) { return cli - | Catch::Clara::Opt(g_show_errors()) + | Catch::Clara::Opt(g_show_errors) ["--show-errors"] ("make the csspp compile more verbose, which means printing all errors.") - | Catch::Clara::Opt(g_script_path(), "scripts") + | Catch::Clara::Opt(g_script_path, "scripts") ["--scripts"] ("specify the location of the CSS Preprocessor system scripts.") - | Catch::Clara::Opt(g_version_script_path(), "version-script") + | Catch::Clara::Opt(g_version_script_path, "version-script") ["--version-script"] ("define the path to the version script.") ; @@ -830,7 +815,7 @@ int init_test(Catch::Session & session) // csspp::node::limit_nodes_to(1'000'000); - csspp::error::instance().set_verbose(g_show_errors()); + csspp::error::instance().set_verbose(g_show_errors); // before running we need to initialize the error tracker // From 9f609194fb0f44b5da8cce0648d339a2bc885399 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Mon, 17 Apr 2023 20:49:15 -0700 Subject: [PATCH 39/64] Also add the noexcept. I thought that fixing the usage of the Clara library would be enough, but in fact the noexcept still happened on g++23. Strangely enough, though, this only happens in csspp. I use the same library for other projects and do not run in this issue. --- tests/catch_main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/catch_main.cpp b/tests/catch_main.cpp index b66ecaa..78384c2 100644 --- a/tests/catch_main.cpp +++ b/tests/catch_main.cpp @@ -28,6 +28,12 @@ // Tell catch we want it to add the runner code in this file. #define CATCH_CONFIG_RUNNER +// There seem to be a conflict between our csspp headers and the catch +// environment which ends up throwing an error about a missing noexcept +// +#pragma GCC diagnostic ignored "-Wnoexcept" + + // csspp // #include From 23d67c43c3e07935222242f87439abe1dd2b605c Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sun, 14 May 2023 19:53:25 -0700 Subject: [PATCH 40/64] Remove old "catch 1.x" dependency. We already converted to catch 2.x and we do not need the old catch to compile. --- debian/control | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/debian/control b/debian/control index acd661b..6396c4f 100644 --- a/debian/control +++ b/debian/control @@ -1,8 +1,7 @@ Source: csspp Priority: extra Maintainer: Alexis Wilke -Build-Depends: catch (>= 1.0), - cmake, +Build-Depends: cmake, debhelper, doxygen, graphviz, From ce127c38f424f2057c888969b5801b21f2aa07b1 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Tue, 30 May 2023 17:44:24 -0700 Subject: [PATCH 41/64] Fixed call to sub-compiler with proper flag. Also it could be that I really meant to copy the whole state. --- csspp/compiler.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/csspp/compiler.cpp b/csspp/compiler.cpp index de19619..33bef23 100644 --- a/csspp/compiler.cpp +++ b/csspp/compiler.cpp @@ -1930,9 +1930,7 @@ void compiler::remove_empty_rules(node::pointer_t n) f_state.get_previous_parent()->remove_child(n); return; } -#if __cplusplus >= 201700 [[fallthrough]]; -#endif case node_type_t::AT_KEYWORD: //case node_type_t::ARG: case node_type_t::DECLARATION: @@ -2220,7 +2218,7 @@ void compiler::replace_variable(node::pointer_t parent, node::pointer_t n, size_ } } - compiler c(&c.f_state); + compiler c(f_compiler_validating); c.set_root(root); c.f_state.set_paths(f_state); c.f_state.set_empty_on_undefined_variable(f_state.get_empty_on_undefined_variable()); From d86dc56bc28b38a11d493ee424622da6bf7e810b Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Tue, 4 Jul 2023 10:40:46 -0700 Subject: [PATCH 42/64] Bumped release name to jammy --- debian/changelog | 2 +- debian/control | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8ab0df8..f3cb589 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -csspp (1.0.32.0~bionic) bionic; urgency=high +csspp (1.0.32.0~jammy) jammy; urgency=high * Renamed exceptions.h without the 's': exception.h. * Some clean ups. diff --git a/debian/control b/debian/control index 6396c4f..bbf556b 100644 --- a/debian/control +++ b/debian/control @@ -5,13 +5,13 @@ Build-Depends: cmake, debhelper, doxygen, graphviz, - libadvgetopt-dev (>= 2.0.14.0~bionic), + libadvgetopt-dev (>= 2.0.14.0~jammy), libboost-dev, - libexcept-dev (>= 1.0.5.0~bionic), - libutf8-dev (>= 1.0.6.0~bionic), - snapcatch2 (>= 2.9.1.0~bionic), - snapcmakemodules (>= 1.0.35.3~bionic), - snapdev (>= 1.1.2.0~bionic) + libexcept-dev (>= 1.0.5.0~jammy), + libutf8-dev (>= 1.0.6.0~jammy), + snapcatch2 (>= 2.9.1.0~jammy), + snapcmakemodules (>= 1.0.35.3~jammy), + snapdev (>= 1.1.2.0~jammy) Standards-Version: 3.9.4 Section: libs Homepage: https://snapwebsites.org/ From 500a35fac852eb0fef00d0997748760208e072a8 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 12 Aug 2023 15:17:37 -0700 Subject: [PATCH 43/64] Updated compat to latest. --- debian/compat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/compat b/debian/compat index f599e28..60d3b2f 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -10 +15 From db7c7d529c37e677f6f3f3413783c302519e234a Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 26 Aug 2023 17:39:30 -0700 Subject: [PATCH 44/64] Fixed a few command line options of the csspp. The --output, --include, --style, --precision parameters were missing the REQUIRED flag. This makes the build and documentation work (in that regard). --- CMakeLists.txt | 4 +- doc/CMakeLists.txt | 13 ++++--- src/csspp.cpp | 97 +++++++++++++++++++++++++--------------------- 3 files changed, 62 insertions(+), 52 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eeef7ff..0b9b961 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,9 +37,9 @@ find_package(LibUtf8 REQUIRED) find_package(SnapCMakeModules REQUIRED) find_package(SnapDev REQUIRED) -SnapGetVersion( CSSPP ${CMAKE_CURRENT_SOURCE_DIR} ) +SnapGetVersion(CSSPP ${CMAKE_CURRENT_SOURCE_DIR}) -if( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) +if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") message("Debug is in effect for csspp!") add_definitions(-DDEBUG -D_DEBUG) else() diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index fb50422..ba04d9f 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2023 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com @@ -39,12 +39,15 @@ if(DOXYGEN_FOUND) set(CSSPP_TOOL csspp-tool) + # The following uses an LD_LIBRARY_PATH because the debian build + # fails without it add_custom_target(sample.css DEPENDS ${CSSPP_TOOL} - COMMAND ${CSSPP_TOOL} - -I ${CMAKE_SOURCE_DIR}/scripts ${CMAKE_BINARY_DIR}/scripts - --debug --style expanded --output sample.css - ${CMAKE_CURRENT_SOURCE_DIR}/sample.scss + COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/csspp" + ${CMAKE_BINARY_DIR}/src/csspp + -I ${CMAKE_SOURCE_DIR}/scripts ${CMAKE_BINARY_DIR}/scripts + --debug --style expanded --output sample.css + ${CMAKE_CURRENT_SOURCE_DIR}/sample.scss ) # # Somehow cmake doesn't recognize the CSSPP_TOOL variable if it's diff --git a/src/csspp.cpp b/src/csspp.cpp index 38a4faf..c27adfd 100644 --- a/src/csspp.cpp +++ b/src/csspp.cpp @@ -293,8 +293,9 @@ constexpr advgetopt::option g_options[] = advgetopt::Name("include") , advgetopt::ShortName('I') , advgetopt::Flags(advgetopt::command_flags< - advgetopt::GETOPT_FLAG_MULTIPLE>()) - , advgetopt::Help("specify a path to various user defined CSS files; \"-\" to clear the list (i.e. \"-I -\")") + advgetopt::GETOPT_FLAG_REQUIRED + , advgetopt::GETOPT_FLAG_MULTIPLE>()) + , advgetopt::Help("specify one or more paths to various user defined CSS files; \"-\" to clear the list (i.e. \"-I -\")") ), advgetopt::define_option( advgetopt::Name("no-logo") @@ -306,38 +307,39 @@ constexpr advgetopt::option g_options[] = advgetopt::Name("empty-on-undefined-variable") , advgetopt::ShortName('\0') , advgetopt::Flags(advgetopt::standalone_command_flags<>()) - , advgetopt::Help("if accessing an undefined variable, return an empty string, otherwise generate an error") + , advgetopt::Help("if accessing an undefined variable, return an empty string, otherwise generate an error.") ), advgetopt::define_option( advgetopt::Name("output") , advgetopt::ShortName('o') - , advgetopt::Flags(advgetopt::standalone_command_flags< - advgetopt::GETOPT_FLAG_SHOW_USAGE_ON_ERROR>()) - , advgetopt::DefaultValue("out.css") - , advgetopt::Help("save the results in the specified file") + , advgetopt::Flags(advgetopt::command_flags< + advgetopt::GETOPT_FLAG_REQUIRED>()) + , advgetopt::Help("save the results in the specified file if specified; otherwise send output to stdout.") ), advgetopt::define_option( advgetopt::Name("precision") , advgetopt::ShortName('p') - , advgetopt::Flags(advgetopt::standalone_command_flags<>()) + , advgetopt::Flags(advgetopt::command_flags< + advgetopt::GETOPT_FLAG_REQUIRED>()) , advgetopt::Help("define the number of digits to use after the decimal point, defaults to 3; note that for percent values, the precision is always 2.") ), advgetopt::define_option( advgetopt::Name("quiet") , advgetopt::ShortName('q') , advgetopt::Flags(advgetopt::standalone_command_flags<>()) - , advgetopt::Help("suppress @info and @warning messages") + , advgetopt::Help("suppress @info and @warning messages.") ), advgetopt::define_option( advgetopt::Name("style") , advgetopt::ShortName('s') - , advgetopt::Flags(advgetopt::command_flags()) - , advgetopt::Help("output style: compressed, tidy, compact, expanded") + , advgetopt::Flags(advgetopt::command_flags< + advgetopt::GETOPT_FLAG_REQUIRED>()) + , advgetopt::Help("output style: compressed, tidy, compact, expanded.") ), advgetopt::define_option( advgetopt::Name("Werror") , advgetopt::Flags(advgetopt::standalone_command_flags<>()) - , advgetopt::Help("make warnings count as errors") + , advgetopt::Help("make warnings count as errors.") ), advgetopt::define_option( advgetopt::Name("--") @@ -345,7 +347,7 @@ constexpr advgetopt::option g_options[] = advgetopt::GETOPT_FLAG_MULTIPLE , advgetopt::GETOPT_FLAG_DEFAULT_OPTION , advgetopt::GETOPT_FLAG_SHOW_USAGE_ON_ERROR>()) - , advgetopt::Help("[file.css ...]; use stdin if no filename specified") + , advgetopt::Help("[file.css ...]; use stdin if no filename specified.") ), advgetopt::end_options() }; @@ -382,36 +384,37 @@ advgetopt::options_environment const g_options_environment = class pp { public: - pp(int argc, char * argv[]); + pp(int argc, char * argv[]); - int compile(); + int compile(); private: - std::shared_ptr f_opt; - int f_precision = 3; + advgetopt::getopt f_opt; + int f_precision = 3; }; + pp::pp(int argc, char * argv[]) - : f_opt(new advgetopt::getopt(g_options_environment, argc, argv)) + : f_opt(g_options_environment, argc, argv) { - if(f_opt->is_defined("quiet")) + if(f_opt.is_defined("quiet")) { csspp::error::instance().set_hide_all(true); } - if(f_opt->is_defined("debug")) + if(f_opt.is_defined("debug")) { csspp::error::instance().set_show_debug(true); } - if(f_opt->is_defined("Werror")) + if(f_opt.is_defined("Werror")) { csspp::error::instance().set_count_warnings_as_errors(true); } - if(f_opt->is_defined("precision")) + if(f_opt.is_defined("precision")) { - f_precision = f_opt->get_long("precision"); + f_precision = f_opt.get_long("precision"); } } @@ -423,12 +426,12 @@ int pp::compile() csspp::safe_precision_t safe_precision(f_precision); - if(f_opt->is_defined("--")) + if(f_opt.is_defined("--")) { // one or more filename specified - int const arg_count(f_opt->size("--")); + int const arg_count(f_opt.size("--")); if(arg_count == 1 - && f_opt->get_string("--") == "-") + && f_opt.get_string("--") == "-") { // user asked for stdin pos.reset(new csspp::position("-")); @@ -442,7 +445,7 @@ int pp::compile() for(int idx(0); idx < arg_count; ++idx) { // full paths so the -I have no effects on those files - std::string filename(f_opt->get_string("--", idx)); + std::string filename(f_opt.get_string("--", idx)); if(filename.empty()) { csspp::error::instance() << *pos @@ -495,13 +498,13 @@ int pp::compile() wrapper->add_child(array); csspp_args->add_child(args_var); csspp_args->add_child(wrapper); - if(f_opt->is_defined("args")) + if(f_opt.is_defined("args")) { - int const count(f_opt->size("args")); + int const count(f_opt.size("args")); for(int idx(0); idx < count; ++idx) { csspp::node::pointer_t arg(new csspp::node(csspp::node_type_t::STRING, root->get_position())); - arg->set_string(f_opt->get_string("args", idx)); + arg->set_string(f_opt.get_string("args", idx)); array->add_child(arg); } } @@ -513,12 +516,12 @@ int pp::compile() c.set_date_time_variables(time(nullptr)); // add paths to the compiler (i.e. for the user and system @imports) - if(f_opt->is_defined("I")) + if(f_opt.is_defined("include")) { - int const count(f_opt->size("I")); - for(int idx(0); idx < count; ++idx) + std::size_t const count(f_opt.size("include")); + for(std::size_t idx(0); idx < count; ++idx) { - std::string const path(f_opt->get_string("I", idx)); + std::string const path(f_opt.get_string("include", idx)); if(path == "-") { c.clear_paths(); @@ -530,12 +533,12 @@ int pp::compile() } } - if(f_opt->is_defined("no-logo")) + if(f_opt.is_defined("no-logo")) { c.set_no_logo(); } - if(f_opt->is_defined("empty-on-undefined-variable")) + if(f_opt.is_defined("empty-on-undefined-variable")) { c.set_empty_on_undefined_variable(true); } @@ -546,11 +549,10 @@ int pp::compile() return 1; } -//std::cerr << "Compiler result is: [" << *c.get_root() << "]\n"; csspp::output_mode_t output_mode(csspp::output_mode_t::COMPRESSED); - if(f_opt->is_defined("style")) + if(f_opt.is_defined("style")) { - std::string const mode(f_opt->get_string("style")); + std::string const mode(f_opt.get_string("style")); if(mode == "compressed") { output_mode = csspp::output_mode_t::COMPRESSED; @@ -578,11 +580,17 @@ int pp::compile() } } - std::ostream * out; - if(f_opt->is_defined("output") - && f_opt->get_string("output") != "-") + std::ostream * out(nullptr); + bool user_output(false); + std::string output_filename; + if(f_opt.is_defined("output")) + { + output_filename = f_opt.get_string("output"); + user_output = output_filename != "-"; + } + if(user_output) { - out = new std::ofstream(f_opt->get_string("output")); + out = new std::ofstream(output_filename); } else { @@ -590,8 +598,7 @@ int pp::compile() } csspp::assembler a(*out); a.output(c.get_root(), output_mode); - if(f_opt->is_defined("output") - && f_opt->get_string("output") != "-") + if(user_output) { delete out; } From 9f3d7ecfe585dc58522e85689354542f514232ea Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Wed, 1 Nov 2023 21:58:31 -0700 Subject: [PATCH 45/64] Got the coverage test to work. Since I converted to the ./mk -c option, I had not had this project working properly just yet. Now it generates the coverage as expected and in the same place as the other projects (lcov.snapwebsites.org). Fixed memory leaks in a compiler test. Added a few more lines to ignore (because they are never reached). --- csspp/assembler.cpp | 14 +++++++------- csspp/compiler.cpp | 4 ++-- csspp/expr_additive.cpp | 2 +- csspp/expr_equality.cpp | 4 ++-- csspp/expr_multiplicative.cpp | 12 ++++++------ mk | 4 +++- tests/catch_compiler.cpp | 6 ++++++ 7 files changed, 27 insertions(+), 19 deletions(-) diff --git a/csspp/assembler.cpp b/csspp/assembler.cpp index 96cf160..2929102 100644 --- a/csspp/assembler.cpp +++ b/csspp/assembler.cpp @@ -745,17 +745,17 @@ void assembler::output_component_value(node::pointer_t n) std::stringstream ss; // LCOV_EXCL_LINE ss << "assembler.cpp: expected all direct children of COMPONENT_VALUE to be ARG instead of " // LCOV_EXCL_LINE << c->get_type() // LCOV_EXCL_LINE - << " on line " - << c->get_position().get_line() - << " in \"" - << c->get_position().get_filename() + << " on line " // LCOV_EXCL_LINE + << c->get_position().get_line() // LCOV_EXCL_LINE + << " in \"" // LCOV_EXCL_LINE + << c->get_position().get_filename() // LCOV_EXCL_LINE << "\"."; // LCOV_EXCL_LINE - if(c->is(node_type_t::IDENTIFIER)) + if(c->is(node_type_t::IDENTIFIER)) // LCOV_EXCL_LINE { - ss << " (identifier is \"" << escape_id(c->get_string()) << "\")"; + ss << " (identifier is \"" << escape_id(c->get_string()) << "\")"; // LCOV_EXCL_LINE } throw csspp_exception_logic(ss.str()); // LCOV_EXCL_LINE - } + } // LCOV_EXCL_LINE else if(c->empty() || !c->get_last_child()->is(node_type_t::PLACEHOLDER)) { // TODO: if we compile out PLACEHOLDER nodes in the compiler diff --git a/csspp/compiler.cpp b/csspp/compiler.cpp index 33bef23..1152675 100644 --- a/csspp/compiler.cpp +++ b/csspp/compiler.cpp @@ -1147,7 +1147,7 @@ void compiler::compile_declaration_values(node::pointer_t declaration) << component->get_type() // LCOV_EXCL_LINE << ", expected a LIST."; // LCOV_EXCL_LINE throw csspp_exception_logic(errmsg.str()); // LCOV_EXCL_LINE - } + } // LCOV_EXCL_LINE if(j < item->size() && component == item->get_child(j)) { @@ -4128,7 +4128,7 @@ void compiler::expand_nested_declarations(std::string const & name, node::pointe } break; - case node_type_t::AT_KEYWORD: + case node_type_t::AT_KEYWORD: // LCOV_EXCL_LINE // we may have to handle declarations within an @-keyword, but // it is not a sub-expand-nested-declaration throw csspp_exception_logic("compiler.cpp:compiler::expand_nested_declarations(): @-keyword cannot appear within a declaration."); // LCOV_EXCL_LINE diff --git a/csspp/expr_additive.cpp b/csspp/expr_additive.cpp index 960b5e3..5b4a917 100644 --- a/csspp/expr_additive.cpp +++ b/csspp/expr_additive.cpp @@ -291,7 +291,7 @@ node::pointer_t add(node::pointer_t lhs, node::pointer_t rhs, bool subtract) } break; - default: + default: // LCOV_EXCL_LINE throw csspp_exception_logic("expression.cpp:add(): 'type' set to a value which is not handled here."); // LCOV_EXCL_LINE } diff --git a/csspp/expr_equality.cpp b/csspp/expr_equality.cpp index 3cb90bf..5f62fb6 100644 --- a/csspp/expr_equality.cpp +++ b/csspp/expr_equality.cpp @@ -92,7 +92,7 @@ bool match(node_type_t op, node::pointer_t lhs, node::pointer_t rhs) s = "-" + s + "-"; break; - default: + default: // LCOV_EXCL_LINE throw csspp_exception_logic("expression.cpp:include_match(): called with an invalid operator."); // LCOV_EXCL_LINE } @@ -269,7 +269,7 @@ node::pointer_t expression::equality() boolean_result = match(op, result, rhs); break; - default: + default: // LCOV_EXCL_LINE throw csspp_exception_logic("expression.cpp:equality(): unexpected operator in 'op'."); // LCOV_EXCL_LINE } diff --git a/csspp/expr_multiplicative.cpp b/csspp/expr_multiplicative.cpp index fe4ddae..6efa1c0 100644 --- a/csspp/expr_multiplicative.cpp +++ b/csspp/expr_multiplicative.cpp @@ -497,7 +497,7 @@ node::pointer_t expression::multiply(node_type_t op, node::pointer_t lhs, node:: alpha = fmod(alpha, bf); break; - default: + default: // LCOV_EXCL_LINE throw csspp_exception_logic("expression.cpp:multiply(): unexpected operator."); // LCOV_EXCL_LINE } @@ -577,7 +577,7 @@ node::pointer_t expression::multiply(node_type_t op, node::pointer_t lhs, node:: lalpha = fmod(lalpha , ralpha); break; - default: + default: // LCOV_EXCL_LINE throw csspp_exception_logic("expression.cpp:multiply(): unexpected operator."); // LCOV_EXCL_LINE } @@ -682,7 +682,7 @@ node::pointer_t expression::multiply(node_type_t op, node::pointer_t lhs, node:: result->set_string(multiplicative_dimension(lhs->get_position(), ldim, op, rdim)); break; - default: + default: // LCOV_EXCL_LINE // that should never happen throw csspp_exception_logic("expression.cpp:multiply(): unexpected operator."); // LCOV_EXCL_LINE @@ -720,7 +720,7 @@ node::pointer_t expression::multiply(node_type_t op, node::pointer_t lhs, node:: result->set_integer(ai % bi); break; - default: + default: // LCOV_EXCL_LINE throw csspp_exception_logic("expression.cpp:multiply(): unexpected operator."); // LCOV_EXCL_LINE } @@ -762,13 +762,13 @@ node::pointer_t expression::multiply(node_type_t op, node::pointer_t lhs, node:: result->set_decimal_number(fmod(af, bf)); break; - default: + default: // LCOV_EXCL_LINE throw csspp_exception_logic("expression.cpp:multiply(): unexpected operator."); // LCOV_EXCL_LINE } break; - default: + default: // LCOV_EXCL_LINE throw csspp_exception_logic("expression.cpp:multiply(): 'type' set to a value which is not handled here."); // LCOV_EXCL_LINE } diff --git a/mk b/mk index bcc7038..89e7598 100755 --- a/mk +++ b/mk @@ -5,7 +5,9 @@ if test -x ../../cmake/scripts/mk then - export TEST_OPTIONS="--scripts scripts --version-script ../../BUILD/Debug/contrib/csspp/scripts --show-errors" + SCRIPTS=`cd scripts; pwd` + VERSION_SCRIPT=`cd ../../BUILD/Debug/contrib/csspp/scripts; pwd` + export TEST_OPTIONS="--scripts ${SCRIPTS} --version-script ${VERSION_SCRIPT} --show-errors" ../../cmake/scripts/mk $* else echo "error: could not locate the cmake mk script" diff --git a/tests/catch_compiler.cpp b/tests/catch_compiler.cpp index d5d8774..9995ab1 100644 --- a/tests/catch_compiler.cpp +++ b/tests/catch_compiler.cpp @@ -7371,6 +7371,12 @@ CATCH_TEST_CASE("Advanced variables", "[compiler] [variable]") CATCH_REQUIRE(c.get_root() == n); } + + delete start[0]; + delete start[1]; + delete start[2]; + delete start[3]; + delete start[4]; } // test $var with @mixin definition From 60790d27712bd71190f401fe73d637f09a81bee0 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Tue, 7 Nov 2023 05:52:45 +0000 Subject: [PATCH 46/64] Added pragmas to avoid issues on Lunar. --- csspp/internal_functions.cpp | 6 ++++++ tests/catch_node.cpp | 9 +++++++++ tests/catch_nth_child.cpp | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/csspp/internal_functions.cpp b/csspp/internal_functions.cpp index 9e4a7bb..a5b2dd2 100644 --- a/csspp/internal_functions.cpp +++ b/csspp/internal_functions.cpp @@ -1062,7 +1062,10 @@ node::pointer_t expression::internal_function__max(node::pointer_t func) { if(n->is(node_type_t::PERCENT)) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wrestrict" dimension = "%"; +#pragma GCC diagnostic pop } else { @@ -1121,7 +1124,10 @@ node::pointer_t expression::internal_function__min(node::pointer_t func) { if(n->is(node_type_t::PERCENT)) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wrestrict" dimension = "%"; +#pragma GCC diagnostic pop } else { diff --git a/tests/catch_node.cpp b/tests/catch_node.cpp index 42f6cb0..a2e42cf 100644 --- a/tests/catch_node.cpp +++ b/tests/catch_node.cpp @@ -621,7 +621,10 @@ CATCH_TEST_CASE("Node flags", "[node] [flag]") for(int i(-10); i <= 10; ++i) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wrestrict" std::string nb("t" + std::to_string(i)); +#pragma GCC diagnostic pop n->set_flag(nb, true); CATCH_REQUIRE(n->get_flag(nb)); @@ -634,7 +637,10 @@ CATCH_TEST_CASE("Node flags", "[node] [flag]") // check contents again for(int i(-10); i <= 10; ++i) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wrestrict" std::string nb("t" + std::to_string(i)); +#pragma GCC diagnostic pop CATCH_REQUIRE(n->get_flag(nb)); } @@ -644,7 +650,10 @@ CATCH_TEST_CASE("Node flags", "[node] [flag]") // all are gone now! for(int i(-10); i <= 10; ++i) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wrestrict" std::string nb("t" + std::to_string(i)); +#pragma GCC diagnostic pop CATCH_REQUIRE_FALSE(n->get_flag(nb)); } diff --git a/tests/catch_nth_child.cpp b/tests/catch_nth_child.cpp index 245fd20..6010100 100644 --- a/tests/catch_nth_child.cpp +++ b/tests/catch_nth_child.cpp @@ -153,6 +153,8 @@ CATCH_TEST_CASE("Simple nth child", "[nth-child] [basics]") // try all combos with spaces for(int k(0); k < (1 << 6); ++k) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-overflow" a.parse( std::string((k & (1 << 0)) ? " " : "") + (i >= 0 ? (rand() % 5 == 0 ? "+" : "") : "-") @@ -166,6 +168,7 @@ CATCH_TEST_CASE("Simple nth child", "[nth-child] [basics]") + std::to_string(abs(j)) + ((k & (1 << 5)) ? " " : "") ); +#pragma GCC diagnostic pop CATCH_REQUIRE(a.get_a() == i); CATCH_REQUIRE(a.get_b() == j); @@ -178,6 +181,8 @@ CATCH_TEST_CASE("Simple nth child", "[nth-child] [basics]") { for(int k(0); k < (1 << 3); ++k) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-overflow" a.parse( std::string((k & (1 << 0)) ? " " : "") + (j >= 0 ? (rand() % 5 <= 2 ? "+" : "") : "-") @@ -185,6 +190,7 @@ CATCH_TEST_CASE("Simple nth child", "[nth-child] [basics]") + std::to_string(abs(j)) + ((k & (1 << 2)) ? " " : "") ); +#pragma GCC diagnostic pop CATCH_REQUIRE(a.get_a() == i); CATCH_REQUIRE(a.get_b() == j); From 56641ce02b10a856a3ca0966ddb4f75f1e2328b8 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 11 Nov 2023 10:37:00 -0800 Subject: [PATCH 47/64] Added info about the last few logs. --- debian/changelog | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index f3cb589..cc0f371 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,16 @@ csspp (1.0.32.0~jammy) jammy; urgency=high * Renamed exceptions.h without the 's': exception.h. + * Added pragma -Wrestrict to compile on Lunar. + * Fixed scripts so coverage test makes it to our website. + * Fixed some memory leaks (in the tests only). + * Fixed several command line options that were missing the REQUIRED flag. + * Updated compat to 15. + * Call sub-compiler with the proper flag. + * Removed old catch 1.x dependency. We use 3.x (snapcatch2 really). * Some clean ups. - -- Alexis Wilke Sat, 24 Dec 2022 12:08:23 -0800 + -- Alexis Wilke Sat, 11 Nov 2023 10:34:40 -0800 csspp (1.0.31.6~bionic) bionic; urgency=high From 16bab98736db998829eb391737a3b519c4d5cf12 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 11 Nov 2023 11:49:15 -0800 Subject: [PATCH 48/64] Changed code to use unsigned int for abs() values. --- tests/catch_nth_child.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/catch_nth_child.cpp b/tests/catch_nth_child.cpp index 6010100..9be777d 100644 --- a/tests/catch_nth_child.cpp +++ b/tests/catch_nth_child.cpp @@ -153,22 +153,24 @@ CATCH_TEST_CASE("Simple nth child", "[nth-child] [basics]") // try all combos with spaces for(int k(0); k < (1 << 6); ++k) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstrict-overflow" +//#pragma GCC diagnostic push +//#pragma GCC diagnostic ignored "-Wstrict-overflow" + unsigned int const i_abs(abs(i)); + unsigned int const j_abs(abs(j)); a.parse( std::string((k & (1 << 0)) ? " " : "") + (i >= 0 ? (rand() % 5 == 0 ? "+" : "") : "-") + ((k & (1 << 1)) ? " " : "") - + std::to_string(abs(i)) + + std::to_string(i_abs) + ((k & (1 << 2)) ? " " : "") // this one should be illegal, we may enforce it later + "n" + ((k & (1 << 3)) ? " " : "") + (j >= 0 ? "+" : "-") + ((k & (1 << 4)) ? " " : "") - + std::to_string(abs(j)) + + std::to_string(j_abs) + ((k & (1 << 5)) ? " " : "") ); -#pragma GCC diagnostic pop +//#pragma GCC diagnostic pop CATCH_REQUIRE(a.get_a() == i); CATCH_REQUIRE(a.get_b() == j); @@ -181,16 +183,17 @@ CATCH_TEST_CASE("Simple nth child", "[nth-child] [basics]") { for(int k(0); k < (1 << 3); ++k) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstrict-overflow" +//#pragma GCC diagnostic push +//#pragma GCC diagnostic ignored "-Wstrict-overflow" + unsigned int const j_abs(abs(j)); a.parse( std::string((k & (1 << 0)) ? " " : "") + (j >= 0 ? (rand() % 5 <= 2 ? "+" : "") : "-") + ((k & (1 << 1)) ? " " : "") - + std::to_string(abs(j)) + + std::to_string(j_abs) + ((k & (1 << 2)) ? " " : "") ); -#pragma GCC diagnostic pop +//#pragma GCC diagnostic pop CATCH_REQUIRE(a.get_a() == i); CATCH_REQUIRE(a.get_b() == j); From e89bdafc345f5f4a96d0dd2092a48a4bfb242175 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 11 Nov 2023 11:52:14 -0800 Subject: [PATCH 49/64] Added info about last fix. --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index cc0f371..e479ff7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +csspp (1.0.32.1~jammy) jammy; urgency=high + + * Changed test to use unsigned int where the abs() gets used. + + -- Alexis Wilke Sat, 11 Nov 2023 11:52:08 -0800 + csspp (1.0.32.0~jammy) jammy; urgency=high * Renamed exceptions.h without the 's': exception.h. From 667b85b9009d48be881306e5147b31c7c7b89bda Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Mon, 1 Jan 2024 13:51:12 -0800 Subject: [PATCH 50/64] Fixed test using Clara. --- tests/catch_main.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/catch_main.cpp b/tests/catch_main.cpp index 78384c2..5f9acac 100644 --- a/tests/catch_main.cpp +++ b/tests/catch_main.cpp @@ -798,10 +798,9 @@ time_t get_now() return g_now; } -Catch::Clara::Parser add_command_line_options(Catch::Clara::Parser const & cli) +void add_command_line_options(Catch::Clara::Parser & cli) { - return cli - | Catch::Clara::Opt(g_show_errors) + cli |= Catch::Clara::Opt(g_show_errors) ["--show-errors"] ("make the csspp compile more verbose, which means printing all errors.") | Catch::Clara::Opt(g_script_path, "scripts") From ce286743bbcd8db848cb4c43b062d33ec1420391 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Mon, 1 Jan 2024 13:52:54 -0800 Subject: [PATCH 51/64] Updated copyright notice to 2024. --- CMakeLists.txt | 2 +- cmake/CMakeLists.txt | 2 +- cmake/CSSPPConfig.cmake.in | 2 +- cmake/CSSPPConfigVersion.cmake.in | 2 +- csspp/CMakeLists.txt | 2 +- csspp/assembler.cpp | 2 +- csspp/assembler.h | 2 +- csspp/color.cpp | 2 +- csspp/color.h | 2 +- csspp/compiler.cpp | 2 +- csspp/compiler.h | 2 +- csspp/csspp.cpp | 2 +- csspp/csspp.h.in | 2 +- csspp/error.cpp | 2 +- csspp/error.h | 2 +- csspp/exception.h | 2 +- csspp/expr_additive.cpp | 2 +- csspp/expr_conditional.cpp | 2 +- csspp/expr_equality.cpp | 2 +- csspp/expr_list.cpp | 2 +- csspp/expr_logical_and.cpp | 2 +- csspp/expr_logical_or.cpp | 2 +- csspp/expr_multiplicative.cpp | 2 +- csspp/expr_power.cpp | 2 +- csspp/expr_relational.cpp | 2 +- csspp/expr_unary.cpp | 2 +- csspp/expression.cpp | 2 +- csspp/expression.h | 2 +- csspp/internal_functions.cpp | 2 +- csspp/lexer.cpp | 2 +- csspp/lexer.h | 2 +- csspp/node.cpp | 2 +- csspp/node.h | 2 +- csspp/nth_child.cpp | 2 +- csspp/nth_child.h | 2 +- csspp/parser.cpp | 2 +- csspp/parser.h | 2 +- csspp/position.cpp | 2 +- csspp/position.h | 2 +- csspp/unicode_range.cpp | 2 +- csspp/unicode_range.h | 2 +- debian/copyright | 2 +- dev/MasterCMakeLists.txt | 2 +- dev/build-release | 2 +- dev/coverage | 2 +- dev/pack | 2 +- dev/version | 2 +- doc/CMakeLists.txt | 2 +- doc/pages/compiler-at-keywords.cpp | 2 +- doc/pages/compiler-expression-by-type.cpp | 2 +- doc/pages/compiler-expression-page.cpp | 2 +- doc/pages/compiler-page.cpp | 2 +- doc/pages/compiler-selectors-rules.cpp | 2 +- doc/pages/lexer-page.cpp | 4 ++-- doc/pages/main.cpp | 2 +- doc/pages/parser-page.cpp | 2 +- scripts/CMakeLists.txt | 2 +- scripts/system/close.scss | 2 +- scripts/system/constants.scss | 2 +- scripts/system/functions.scss | 2 +- scripts/system/init.scss | 2 +- scripts/system/logo.scss | 2 +- scripts/system/selectors.scss | 2 +- scripts/system/version.scss.in | 2 +- scripts/validation/countries.scss | 2 +- scripts/validation/has-font-metrics.scss | 2 +- scripts/validation/languages.scss | 2 +- scripts/validation/pseudo-classes.scss | 2 +- scripts/validation/pseudo-elements.scss | 2 +- scripts/validation/pseudo-functions.scss | 2 +- scripts/validation/pseudo-nth-functions.scss | 2 +- scripts/validation/slash-separator.scss | 2 +- src/CMakeLists.txt | 2 +- src/csspp.cpp | 2 +- tests/CMakeLists.txt | 2 +- tests/catch_assembler.cpp | 22 ++++++++++---------- tests/catch_color.cpp | 2 +- tests/catch_compiler.cpp | 2 +- tests/catch_csspp.cpp | 2 +- tests/catch_error.cpp | 2 +- tests/catch_expr_additive.cpp | 2 +- tests/catch_expr_conditional.cpp | 2 +- tests/catch_expr_equality.cpp | 2 +- tests/catch_expr_list.cpp | 2 +- tests/catch_expr_logical_and.cpp | 2 +- tests/catch_expr_logical_or.cpp | 2 +- tests/catch_expr_multiplicative.cpp | 2 +- tests/catch_expr_power.cpp | 2 +- tests/catch_expr_relational.cpp | 2 +- tests/catch_expr_unary.cpp | 2 +- tests/catch_internal_functions.cpp | 2 +- tests/catch_lexer.cpp | 2 +- tests/catch_main.cpp | 2 +- tests/catch_main.h | 2 +- tests/catch_node.cpp | 2 +- tests/catch_nth_child.cpp | 2 +- tests/catch_parser.cpp | 6 +++--- tests/catch_position.cpp | 2 +- tests/catch_unicode_range.cpp | 2 +- 99 files changed, 112 insertions(+), 112 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b9b961..f6f8446 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 6154359..4cae62d 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/cmake/CSSPPConfig.cmake.in b/cmake/CSSPPConfig.cmake.in index 0ff547e..5e70ee7 100644 --- a/cmake/CSSPPConfig.cmake.in +++ b/cmake/CSSPPConfig.cmake.in @@ -8,7 +8,7 @@ # CSSPP_DEFINITIONS - Compiler switches required for linking against csspp # # License: -# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/cmake/CSSPPConfigVersion.cmake.in b/cmake/CSSPPConfigVersion.cmake.in index 098b7de..9e5f255 100644 --- a/cmake/CSSPPConfigVersion.cmake.in +++ b/cmake/CSSPPConfigVersion.cmake.in @@ -1,7 +1,7 @@ # Verify CSS Preprocessor version validity. # # License: -# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/csspp/CMakeLists.txt b/csspp/CMakeLists.txt index ece5114..a3199e6 100644 --- a/csspp/CMakeLists.txt +++ b/csspp/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/csspp/assembler.cpp b/csspp/assembler.cpp index 2929102..46f3dc6 100644 --- a/csspp/assembler.cpp +++ b/csspp/assembler.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/assembler.h b/csspp/assembler.h index 654ee7e..0c80354 100644 --- a/csspp/assembler.h +++ b/csspp/assembler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/color.cpp b/csspp/color.cpp index c2509d8..6c7b31a 100644 --- a/csspp/color.cpp +++ b/csspp/color.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/color.h b/csspp/color.h index eab759e..1e54828 100644 --- a/csspp/color.h +++ b/csspp/color.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/compiler.cpp b/csspp/compiler.cpp index 1152675..2cdd9de 100644 --- a/csspp/compiler.cpp +++ b/csspp/compiler.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/compiler.h b/csspp/compiler.h index f39ed0b..bd0d8bf 100644 --- a/csspp/compiler.h +++ b/csspp/compiler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/csspp.cpp b/csspp/csspp.cpp index 2f15be1..e0ece3d 100644 --- a/csspp/csspp.cpp +++ b/csspp/csspp.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/csspp.h.in b/csspp/csspp.h.in index 5cb207e..630199a 100644 --- a/csspp/csspp.h.in +++ b/csspp/csspp.h.in @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/error.cpp b/csspp/error.cpp index 90d267d..4b4134d 100644 --- a/csspp/error.cpp +++ b/csspp/error.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/error.h b/csspp/error.h index 9ae031e..51c10b4 100644 --- a/csspp/error.h +++ b/csspp/error.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/exception.h b/csspp/exception.h index cda4976..801cab8 100644 --- a/csspp/exception.h +++ b/csspp/exception.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_additive.cpp b/csspp/expr_additive.cpp index 5b4a917..c6347f1 100644 --- a/csspp/expr_additive.cpp +++ b/csspp/expr_additive.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_conditional.cpp b/csspp/expr_conditional.cpp index 863adba..6a1f8c6 100644 --- a/csspp/expr_conditional.cpp +++ b/csspp/expr_conditional.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_equality.cpp b/csspp/expr_equality.cpp index 5f62fb6..7ab81fe 100644 --- a/csspp/expr_equality.cpp +++ b/csspp/expr_equality.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_list.cpp b/csspp/expr_list.cpp index e5ba1d1..a636c4b 100644 --- a/csspp/expr_list.cpp +++ b/csspp/expr_list.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_logical_and.cpp b/csspp/expr_logical_and.cpp index 6932ab1..af0df82 100644 --- a/csspp/expr_logical_and.cpp +++ b/csspp/expr_logical_and.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_logical_or.cpp b/csspp/expr_logical_or.cpp index 4456158..7ddf3d5 100644 --- a/csspp/expr_logical_or.cpp +++ b/csspp/expr_logical_or.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_multiplicative.cpp b/csspp/expr_multiplicative.cpp index 6efa1c0..b070ba2 100644 --- a/csspp/expr_multiplicative.cpp +++ b/csspp/expr_multiplicative.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_power.cpp b/csspp/expr_power.cpp index 4bb777d..d423799 100644 --- a/csspp/expr_power.cpp +++ b/csspp/expr_power.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_relational.cpp b/csspp/expr_relational.cpp index 54ca93d..06d148e 100644 --- a/csspp/expr_relational.cpp +++ b/csspp/expr_relational.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_unary.cpp b/csspp/expr_unary.cpp index 45f9ccb..09e68c7 100644 --- a/csspp/expr_unary.cpp +++ b/csspp/expr_unary.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expression.cpp b/csspp/expression.cpp index 619a90a..f512804 100644 --- a/csspp/expression.cpp +++ b/csspp/expression.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expression.h b/csspp/expression.h index 8df7173..d7caf8f 100644 --- a/csspp/expression.h +++ b/csspp/expression.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/internal_functions.cpp b/csspp/internal_functions.cpp index a5b2dd2..3d65369 100644 --- a/csspp/internal_functions.cpp +++ b/csspp/internal_functions.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/lexer.cpp b/csspp/lexer.cpp index 48ff604..8621436 100644 --- a/csspp/lexer.cpp +++ b/csspp/lexer.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/lexer.h b/csspp/lexer.h index 00938de..4de7777 100644 --- a/csspp/lexer.h +++ b/csspp/lexer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/node.cpp b/csspp/node.cpp index 588252e..632928a 100644 --- a/csspp/node.cpp +++ b/csspp/node.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/node.h b/csspp/node.h index 7188a03..cc57ae3 100644 --- a/csspp/node.h +++ b/csspp/node.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/nth_child.cpp b/csspp/nth_child.cpp index 16b3fbc..9f96442 100644 --- a/csspp/nth_child.cpp +++ b/csspp/nth_child.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/nth_child.h b/csspp/nth_child.h index e40b3e0..80bff24 100644 --- a/csspp/nth_child.h +++ b/csspp/nth_child.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/parser.cpp b/csspp/parser.cpp index 5f65e16..0ebeceb 100644 --- a/csspp/parser.cpp +++ b/csspp/parser.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/parser.h b/csspp/parser.h index 466d73b..eb72e2a 100644 --- a/csspp/parser.h +++ b/csspp/parser.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/position.cpp b/csspp/position.cpp index b2c1f60..8c00681 100644 --- a/csspp/position.cpp +++ b/csspp/position.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/position.h b/csspp/position.h index 580e09f..cd6f625 100644 --- a/csspp/position.h +++ b/csspp/position.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/unicode_range.cpp b/csspp/unicode_range.cpp index 5a87d81..81995ac 100644 --- a/csspp/unicode_range.cpp +++ b/csspp/unicode_range.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/unicode_range.h b/csspp/unicode_range.h index a86579a..561b2e7 100644 --- a/csspp/unicode_range.h +++ b/csspp/unicode_range.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/debian/copyright b/debian/copyright index c064db9..7e0ca91 100644 --- a/debian/copyright +++ b/debian/copyright @@ -3,7 +3,7 @@ Upstream-Name: csspp Source: https://snapwebsites.org/ Files: * -Copyright: 2015-2017 Alexis Wilke +Copyright: 2015-2024 Alexis Wilke License: GPL-2+ This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/dev/MasterCMakeLists.txt b/dev/MasterCMakeLists.txt index 5c29ecd..08c36de 100644 --- a/dev/MasterCMakeLists.txt +++ b/dev/MasterCMakeLists.txt @@ -11,7 +11,7 @@ # See the CMake documentation. # # License: -# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/dev/build-release b/dev/build-release index 28632b2..81582e3 100755 --- a/dev/build-release +++ b/dev/build-release @@ -12,7 +12,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/dev/coverage b/dev/coverage index 22d6cbb..fedf7a7 100755 --- a/dev/coverage +++ b/dev/coverage @@ -11,7 +11,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/dev/pack b/dev/pack index 2425f1a..4e5ec28 100755 --- a/dev/pack +++ b/dev/pack @@ -14,7 +14,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/dev/version b/dev/version index aa99199..098fa0c 100755 --- a/dev/version +++ b/dev/version @@ -11,7 +11,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index ba04d9f..0077037 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2023 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/doc/pages/compiler-at-keywords.cpp b/doc/pages/compiler-at-keywords.cpp index 0b0281f..78d8e5b 100644 --- a/doc/pages/compiler-at-keywords.cpp +++ b/doc/pages/compiler-at-keywords.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/compiler-expression-by-type.cpp b/doc/pages/compiler-expression-by-type.cpp index 172a94c..dded8a7 100644 --- a/doc/pages/compiler-expression-by-type.cpp +++ b/doc/pages/compiler-expression-by-type.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/compiler-expression-page.cpp b/doc/pages/compiler-expression-page.cpp index 7449ed9..babe710 100644 --- a/doc/pages/compiler-expression-page.cpp +++ b/doc/pages/compiler-expression-page.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/compiler-page.cpp b/doc/pages/compiler-page.cpp index d7c0753..bb7b0aa 100644 --- a/doc/pages/compiler-page.cpp +++ b/doc/pages/compiler-page.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/compiler-selectors-rules.cpp b/doc/pages/compiler-selectors-rules.cpp index b5455ca..38d67f9 100644 --- a/doc/pages/compiler-selectors-rules.cpp +++ b/doc/pages/compiler-selectors-rules.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/lexer-page.cpp b/doc/pages/lexer-page.cpp index 48890e9..bb7feec 100644 --- a/doc/pages/lexer-page.cpp +++ b/doc/pages/lexer-page.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -298,7 +298,7 @@ * * \code * // CSS Preprocessor - * // Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved + * // Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved * // * // @preserve * \endcode diff --git a/doc/pages/main.cpp b/doc/pages/main.cpp index 773c9a7..d737ef1 100644 --- a/doc/pages/main.cpp +++ b/doc/pages/main.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/parser-page.cpp b/doc/pages/parser-page.cpp index b347cde..bcc473a 100644 --- a/doc/pages/parser-page.cpp +++ b/doc/pages/parser-page.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 7d310be..5cd4a9d 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/scripts/system/close.scss b/scripts/system/close.scss index a8ccb1c..4881db9 100644 --- a/scripts/system/close.scss +++ b/scripts/system/close.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/constants.scss b/scripts/system/constants.scss index 19247a1..753dcdd 100644 --- a/scripts/system/constants.scss +++ b/scripts/system/constants.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/functions.scss b/scripts/system/functions.scss index b4c904c..e32bd39 100644 --- a/scripts/system/functions.scss +++ b/scripts/system/functions.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/init.scss b/scripts/system/init.scss index 32440e6..96468b5 100644 --- a/scripts/system/init.scss +++ b/scripts/system/init.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/logo.scss b/scripts/system/logo.scss index 2c1c032..cbde6b1 100644 --- a/scripts/system/logo.scss +++ b/scripts/system/logo.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/selectors.scss b/scripts/system/selectors.scss index b72e971..b3b5a3e 100644 --- a/scripts/system/selectors.scss +++ b/scripts/system/selectors.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/version.scss.in b/scripts/system/version.scss.in index bea2ef2..3bbe317 100644 --- a/scripts/system/version.scss.in +++ b/scripts/system/version.scss.in @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/countries.scss b/scripts/validation/countries.scss index 4537e07..bb85029 100644 --- a/scripts/validation/countries.scss +++ b/scripts/validation/countries.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/has-font-metrics.scss b/scripts/validation/has-font-metrics.scss index 6534acd..71d9487 100644 --- a/scripts/validation/has-font-metrics.scss +++ b/scripts/validation/has-font-metrics.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/languages.scss b/scripts/validation/languages.scss index eefada3..c11770f 100644 --- a/scripts/validation/languages.scss +++ b/scripts/validation/languages.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/pseudo-classes.scss b/scripts/validation/pseudo-classes.scss index 44cb84a..db7aebc 100644 --- a/scripts/validation/pseudo-classes.scss +++ b/scripts/validation/pseudo-classes.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/pseudo-elements.scss b/scripts/validation/pseudo-elements.scss index 4d4de02..11e67f6 100644 --- a/scripts/validation/pseudo-elements.scss +++ b/scripts/validation/pseudo-elements.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/pseudo-functions.scss b/scripts/validation/pseudo-functions.scss index d5db7a1..3765438 100644 --- a/scripts/validation/pseudo-functions.scss +++ b/scripts/validation/pseudo-functions.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/pseudo-nth-functions.scss b/scripts/validation/pseudo-nth-functions.scss index 5052c82..4c8a005 100644 --- a/scripts/validation/pseudo-nth-functions.scss +++ b/scripts/validation/pseudo-nth-functions.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/slash-separator.scss b/scripts/validation/slash-separator.scss index f869381..eab74bc 100644 --- a/scripts/validation/slash-separator.scss +++ b/scripts/validation/slash-separator.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a80adb7..95765ea 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/src/csspp.cpp b/src/csspp.cpp index c27adfd..8a4604c 100644 --- a/src/csspp.cpp +++ b/src/csspp.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d97f460..ec7011b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/tests/catch_assembler.cpp b/tests/catch_assembler.cpp index bfa089a..ea247f5 100644 --- a/tests/catch_assembler.cpp +++ b/tests/catch_assembler.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com @@ -2462,7 +2462,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") ++i) { std::stringstream ss; - ss << "// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version {$_csspp_version} -- @preserve\n" + ss << "// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version {$_csspp_version} -- @preserve\n" << "body.error { color: red }\n"; csspp::position pos("test.css"); csspp::lexer::pointer_t l(new csspp::lexer(ss, pos)); @@ -2493,7 +2493,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") { case csspp::output_mode_t::COMPACT: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error { color: red }\n" + csspp_test::get_close_comment() ); @@ -2501,7 +2501,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::COMPRESSED: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error{color:red}\n" + csspp_test::get_close_comment() ); @@ -2509,7 +2509,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::EXPANDED: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error\n" "{\n" " color: red;\n" @@ -2520,7 +2520,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::TIDY: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error{color:red}\n" + csspp_test::get_close_comment() ); @@ -2537,7 +2537,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") ++i) { std::stringstream ss; - ss << "// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved.\n" + ss << "// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved.\n" << "// Assembler Test\n" << "// @preserve\n" << "body.error { color: red }\n"; @@ -2570,7 +2570,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") { case csspp::output_mode_t::COMPACT: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved.\n" +"/* Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" " */\n" @@ -2581,7 +2581,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::COMPRESSED: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved.\n" +"/* Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" " */\n" @@ -2592,7 +2592,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::EXPANDED: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved.\n" +"/* Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" " */\n" @@ -2606,7 +2606,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::TIDY: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved.\n" +"/* Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" " */\n" diff --git a/tests/catch_color.cpp b/tests/catch_color.cpp index d8d996b..2fc3555 100644 --- a/tests/catch_color.cpp +++ b/tests/catch_color.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_compiler.cpp b/tests/catch_compiler.cpp index 9995ab1..b4c58e4 100644 --- a/tests/catch_compiler.cpp +++ b/tests/catch_compiler.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_csspp.cpp b/tests/catch_csspp.cpp index 68ef26b..e33d343 100644 --- a/tests/catch_csspp.cpp +++ b/tests/catch_csspp.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_error.cpp b/tests/catch_error.cpp index 82522cf..da36e19 100644 --- a/tests/catch_error.cpp +++ b/tests/catch_error.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_additive.cpp b/tests/catch_expr_additive.cpp index 18c10cf..90ee5cd 100644 --- a/tests/catch_expr_additive.cpp +++ b/tests/catch_expr_additive.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_conditional.cpp b/tests/catch_expr_conditional.cpp index c532bff..ecc0ca4 100644 --- a/tests/catch_expr_conditional.cpp +++ b/tests/catch_expr_conditional.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_equality.cpp b/tests/catch_expr_equality.cpp index c35455a..634cd79 100644 --- a/tests/catch_expr_equality.cpp +++ b/tests/catch_expr_equality.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_list.cpp b/tests/catch_expr_list.cpp index e595daa..dcd6064 100644 --- a/tests/catch_expr_list.cpp +++ b/tests/catch_expr_list.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_logical_and.cpp b/tests/catch_expr_logical_and.cpp index d6a33f6..d0b9bb9 100644 --- a/tests/catch_expr_logical_and.cpp +++ b/tests/catch_expr_logical_and.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_logical_or.cpp b/tests/catch_expr_logical_or.cpp index bd182bd..76fb800 100644 --- a/tests/catch_expr_logical_or.cpp +++ b/tests/catch_expr_logical_or.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_multiplicative.cpp b/tests/catch_expr_multiplicative.cpp index 0436bda..e44fead 100644 --- a/tests/catch_expr_multiplicative.cpp +++ b/tests/catch_expr_multiplicative.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_expr_power.cpp b/tests/catch_expr_power.cpp index e7e5e6f..b19f897 100644 --- a/tests/catch_expr_power.cpp +++ b/tests/catch_expr_power.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_relational.cpp b/tests/catch_expr_relational.cpp index 3754156..07689cd 100644 --- a/tests/catch_expr_relational.cpp +++ b/tests/catch_expr_relational.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_unary.cpp b/tests/catch_expr_unary.cpp index a8ba0b5..d0ce6e3 100644 --- a/tests/catch_expr_unary.cpp +++ b/tests/catch_expr_unary.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_internal_functions.cpp b/tests/catch_internal_functions.cpp index d6f4805..befbc07 100644 --- a/tests/catch_internal_functions.cpp +++ b/tests/catch_internal_functions.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_lexer.cpp b/tests/catch_lexer.cpp index c73660b..70c69d6 100644 --- a/tests/catch_lexer.cpp +++ b/tests/catch_lexer.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_main.cpp b/tests/catch_main.cpp index 5f9acac..616ba81 100644 --- a/tests/catch_main.cpp +++ b/tests/catch_main.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_main.h b/tests/catch_main.h index 5750a09..3063323 100644 --- a/tests/catch_main.h +++ b/tests/catch_main.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_node.cpp b/tests/catch_node.cpp index a2e42cf..0d8a8e7 100644 --- a/tests/catch_node.cpp +++ b/tests/catch_node.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_nth_child.cpp b/tests/catch_nth_child.cpp index 9be777d..3b4270b 100644 --- a/tests/catch_nth_child.cpp +++ b/tests/catch_nth_child.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_parser.cpp b/tests/catch_parser.cpp index 83b94e8..9a2d396 100644 --- a/tests/catch_parser.cpp +++ b/tests/catch_parser.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com @@ -220,7 +220,7 @@ CATCH_TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") std::stringstream ss; ss << "// $Id: ...$\n" << "div { border: 1px; }\n" - << "/* @preserve Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved. */"; + << "/* @preserve Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved. */"; csspp::position pos("test.css"); csspp::lexer::pointer_t l(new csspp::lexer(ss, pos)); @@ -243,7 +243,7 @@ CATCH_TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") " COLON\n" " WHITESPACE\n" " INTEGER \"px\" I:1\n" -" COMMENT \"@preserve Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved.\" I:1\n" +" COMMENT \"@preserve Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved.\" I:1\n" ); diff --git a/tests/catch_position.cpp b/tests/catch_position.cpp index 174862a..3feabc6 100644 --- a/tests/catch_position.cpp +++ b/tests/catch_position.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_unicode_range.cpp b/tests/catch_unicode_range.cpp index a503a2a..55efff3 100644 --- a/tests/catch_unicode_range.cpp +++ b/tests/catch_unicode_range.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com From a07aac413aae835f4ccedc5098d5068f5bbf0bad Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 30 Nov 2024 09:34:37 -0800 Subject: [PATCH 52/64] Added the rununittests target. --- tests/CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ec7011b..c99e83f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -77,4 +77,18 @@ else(SnapCatch2_FOUND) endif(SnapCatch2_FOUND) +if(SnapCatch2_FOUND) + + find_package(SnapTestRunner) + AddUnitTestsTarget( + PROJECT_NAME + rununittests + PROJECT_TEST_ARGS + --scripts "${CMAKE_SOURCE_DIR}/scripts" + --version-script "${CMAKE_BINARY_DIR}/scripts" + --show-errors + ) + +endif(SnapCatch2_FOUND) + # vim: ts=4 sw=4 et From f3a919d07581350d4557ae8258cbf4b48a96ab0b Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 30 Nov 2024 13:09:19 -0800 Subject: [PATCH 53/64] Added note about the lack of support of non-Debug. At the moment, the ./mk script will run the tests properly in Debug. But other setups (Release, Sanitize) will not work 100% properly because we pass the wrong path to the tests. --- TODO.txt | 6 +++++- mk | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/TODO.txt b/TODO.txt index d526158..b14c412 100644 --- a/TODO.txt +++ b/TODO.txt @@ -21,7 +21,7 @@ additional features: we may end up with what looks like an invalid expression even if it is not. By first parsing everything and creating a tree, we could 100% avoid calculating what is going to be simplified in the first place. - In the case of the ?: oeprator, that means only the true or false + In the case of the ?: operator, that means only the true or false tree is taken in account. The other tree is completely ignored. @@ -109,4 +109,8 @@ additional features: the final tarball. +. Look at fixing the ./mk script so it works for all versions (only Debug + is properly supported at the moment) + + vim: tw=2 sw=2 et diff --git a/mk b/mk index 89e7598..60d6eb9 100755 --- a/mk +++ b/mk @@ -5,6 +5,7 @@ if test -x ../../cmake/scripts/mk then + echo "warning: with this version, tests are specifically setup for the Debug version only." SCRIPTS=`cd scripts; pwd` VERSION_SCRIPT=`cd ../../BUILD/Debug/contrib/csspp/scripts; pwd` export TEST_OPTIONS="--scripts ${SCRIPTS} --version-script ${VERSION_SCRIPT} --show-errors" From 7b36133fe99dd7b71abc736923cdb10dc74a4772 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 30 Nov 2024 16:06:35 -0800 Subject: [PATCH 54/64] Removed the add_test(). We now have the rununittests target, which is sufficient. --- tests/CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c99e83f..f675654 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -66,11 +66,6 @@ if(SnapCatch2_FOUND) ${SNAPCATCH2_LIBRARIES} ) - # You can use the --success command line option to see all the tests - # as they run; it is a LOT of output though, thus by default we don't - # use it - add_test(unittest ${PROJECT_NAME}) - else(SnapCatch2_FOUND) message("snapcatch2 not found... no test will be built.") From 1e51db599709749ac7407f8786c7c1f4f6401686 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 21 Jun 2025 21:30:18 -0700 Subject: [PATCH 55/64] Fixed name/tags of a couple of tests. --- tests/catch_compiler.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/catch_compiler.cpp b/tests/catch_compiler.cpp index b4c58e4..dce5947 100644 --- a/tests/catch_compiler.cpp +++ b/tests/catch_compiler.cpp @@ -63,13 +63,19 @@ void free_char(char * ptr) free(ptr); } -CATCH_TEST_CASE("Compile set_date_time_variables() called too soon", "[compiler] [invalid]") + +CATCH_TEST_CASE("invalid_state", "[compiler][invalid]") { + CATCH_START_SECTION("Compile set_date_time_variables() called too soon") + { csspp::compiler c; CATCH_REQUIRE_THROWS_AS(c.set_date_time_variables(csspp_test::get_now()), csspp::csspp_exception_logic); + } + CATCH_END_SECTION() } -CATCH_TEST_CASE("Compile simple stylesheets", "[compiler] [stylesheet] [attribute]") + +CATCH_TEST_CASE("compile_simple_stylesheets", "[compiler][stylesheet][attribute]") { // with many spaces { From 155d7ab7cc637c17c3dafd375ae4b6b83db372d5 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sun, 29 Jun 2025 13:21:42 -0700 Subject: [PATCH 56/64] Tiny clean up. --- csspp/color.h | 2 +- csspp/csspp.h.in | 2 +- csspp/error.h | 2 +- csspp/exception.h | 2 +- csspp/node.h | 2 +- csspp/position.h | 2 +- tests/catch_csspp.cpp | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/csspp/color.h b/csspp/color.h index 1e54828..d18b2ba 100644 --- a/csspp/color.h +++ b/csspp/color.h @@ -15,7 +15,7 @@ // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #pragma once -// C++ lib +// C++ // #include #include diff --git a/csspp/csspp.h.in b/csspp/csspp.h.in index 630199a..df0e9b6 100644 --- a/csspp/csspp.h.in +++ b/csspp/csspp.h.in @@ -20,7 +20,7 @@ #include "csspp/exception.h" -// C++ lib +// C++ // #include #include diff --git a/csspp/error.h b/csspp/error.h index 51c10b4..33654be 100644 --- a/csspp/error.h +++ b/csspp/error.h @@ -20,7 +20,7 @@ #include "csspp/position.h" -// C++ lib +// C++ // #include #include diff --git a/csspp/exception.h b/csspp/exception.h index 801cab8..a39a890 100644 --- a/csspp/exception.h +++ b/csspp/exception.h @@ -15,7 +15,7 @@ // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #pragma once -// C++ lib +// C++ // #include diff --git a/csspp/node.h b/csspp/node.h index cc57ae3..f6d4ca0 100644 --- a/csspp/node.h +++ b/csspp/node.h @@ -21,7 +21,7 @@ #include "csspp/error.h" -// C++ lib +// C++ // #include #include diff --git a/csspp/position.h b/csspp/position.h index cd6f625..7c8a465 100644 --- a/csspp/position.h +++ b/csspp/position.h @@ -20,7 +20,7 @@ #include "csspp/csspp.h" -// C++ lib +// C++ // #include diff --git a/tests/catch_csspp.cpp b/tests/catch_csspp.cpp index e33d343..64ea68f 100644 --- a/tests/catch_csspp.cpp +++ b/tests/catch_csspp.cpp @@ -42,7 +42,7 @@ #include -// C lib +// C // #include From 850bf834d61a2c2274c9be0ccce929f2b67010f0 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sun, 29 Jun 2025 13:23:18 -0700 Subject: [PATCH 57/64] Bump copyright notice to 2025. --- CMakeLists.txt | 2 +- cmake/CMakeLists.txt | 2 +- cmake/CSSPPConfig.cmake.in | 2 +- cmake/CSSPPConfigVersion.cmake.in | 2 +- csspp/CMakeLists.txt | 2 +- csspp/assembler.cpp | 2 +- csspp/assembler.h | 2 +- csspp/color.cpp | 2 +- csspp/color.h | 2 +- csspp/compiler.cpp | 2 +- csspp/compiler.h | 2 +- csspp/csspp.cpp | 2 +- csspp/csspp.h.in | 2 +- csspp/error.cpp | 2 +- csspp/error.h | 2 +- csspp/exception.h | 2 +- csspp/expr_additive.cpp | 2 +- csspp/expr_conditional.cpp | 2 +- csspp/expr_equality.cpp | 2 +- csspp/expr_list.cpp | 2 +- csspp/expr_logical_and.cpp | 2 +- csspp/expr_logical_or.cpp | 2 +- csspp/expr_multiplicative.cpp | 2 +- csspp/expr_power.cpp | 2 +- csspp/expr_relational.cpp | 2 +- csspp/expr_unary.cpp | 2 +- csspp/expression.cpp | 2 +- csspp/expression.h | 2 +- csspp/internal_functions.cpp | 2 +- csspp/lexer.cpp | 2 +- csspp/lexer.h | 2 +- csspp/node.cpp | 2 +- csspp/node.h | 2 +- csspp/nth_child.cpp | 2 +- csspp/nth_child.h | 2 +- csspp/parser.cpp | 2 +- csspp/parser.h | 2 +- csspp/position.cpp | 2 +- csspp/position.h | 2 +- csspp/unicode_range.cpp | 2 +- csspp/unicode_range.h | 2 +- debian/copyright | 2 +- dev/MasterCMakeLists.txt | 2 +- dev/build-release | 2 +- dev/coverage | 2 +- dev/pack | 2 +- dev/version | 2 +- doc/CMakeLists.txt | 2 +- doc/pages/compiler-at-keywords.cpp | 2 +- doc/pages/compiler-expression-by-type.cpp | 2 +- doc/pages/compiler-expression-page.cpp | 2 +- doc/pages/compiler-page.cpp | 2 +- doc/pages/compiler-selectors-rules.cpp | 2 +- doc/pages/lexer-page.cpp | 4 ++-- doc/pages/main.cpp | 2 +- doc/pages/parser-page.cpp | 2 +- scripts/CMakeLists.txt | 2 +- scripts/system/close.scss | 2 +- scripts/system/constants.scss | 2 +- scripts/system/functions.scss | 2 +- scripts/system/init.scss | 2 +- scripts/system/logo.scss | 2 +- scripts/system/selectors.scss | 2 +- scripts/system/version.scss.in | 2 +- scripts/validation/countries.scss | 2 +- scripts/validation/has-font-metrics.scss | 2 +- scripts/validation/languages.scss | 2 +- scripts/validation/pseudo-classes.scss | 2 +- scripts/validation/pseudo-elements.scss | 2 +- scripts/validation/pseudo-functions.scss | 2 +- scripts/validation/pseudo-nth-functions.scss | 2 +- scripts/validation/slash-separator.scss | 2 +- src/CMakeLists.txt | 2 +- src/csspp.cpp | 2 +- tests/CMakeLists.txt | 2 +- tests/catch_assembler.cpp | 22 ++++++++++---------- tests/catch_color.cpp | 2 +- tests/catch_compiler.cpp | 2 +- tests/catch_csspp.cpp | 2 +- tests/catch_error.cpp | 2 +- tests/catch_expr_additive.cpp | 2 +- tests/catch_expr_conditional.cpp | 2 +- tests/catch_expr_equality.cpp | 2 +- tests/catch_expr_list.cpp | 2 +- tests/catch_expr_logical_and.cpp | 2 +- tests/catch_expr_logical_or.cpp | 2 +- tests/catch_expr_multiplicative.cpp | 2 +- tests/catch_expr_power.cpp | 2 +- tests/catch_expr_relational.cpp | 2 +- tests/catch_expr_unary.cpp | 2 +- tests/catch_internal_functions.cpp | 2 +- tests/catch_lexer.cpp | 2 +- tests/catch_main.cpp | 2 +- tests/catch_main.h | 2 +- tests/catch_node.cpp | 2 +- tests/catch_nth_child.cpp | 2 +- tests/catch_parser.cpp | 6 +++--- tests/catch_position.cpp | 2 +- tests/catch_unicode_range.cpp | 2 +- 99 files changed, 112 insertions(+), 112 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f6f8446..4686e81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 4cae62d..50cd441 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/cmake/CSSPPConfig.cmake.in b/cmake/CSSPPConfig.cmake.in index 5e70ee7..5dc91d2 100644 --- a/cmake/CSSPPConfig.cmake.in +++ b/cmake/CSSPPConfig.cmake.in @@ -8,7 +8,7 @@ # CSSPP_DEFINITIONS - Compiler switches required for linking against csspp # # License: -# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/cmake/CSSPPConfigVersion.cmake.in b/cmake/CSSPPConfigVersion.cmake.in index 9e5f255..37c0ea9 100644 --- a/cmake/CSSPPConfigVersion.cmake.in +++ b/cmake/CSSPPConfigVersion.cmake.in @@ -1,7 +1,7 @@ # Verify CSS Preprocessor version validity. # # License: -# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/csspp/CMakeLists.txt b/csspp/CMakeLists.txt index a3199e6..78a6833 100644 --- a/csspp/CMakeLists.txt +++ b/csspp/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/csspp/assembler.cpp b/csspp/assembler.cpp index 46f3dc6..ce5818b 100644 --- a/csspp/assembler.cpp +++ b/csspp/assembler.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/assembler.h b/csspp/assembler.h index 0c80354..5005258 100644 --- a/csspp/assembler.h +++ b/csspp/assembler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/color.cpp b/csspp/color.cpp index 6c7b31a..1399aac 100644 --- a/csspp/color.cpp +++ b/csspp/color.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/color.h b/csspp/color.h index d18b2ba..f8b5419 100644 --- a/csspp/color.h +++ b/csspp/color.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/compiler.cpp b/csspp/compiler.cpp index 2cdd9de..9579dc4 100644 --- a/csspp/compiler.cpp +++ b/csspp/compiler.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/compiler.h b/csspp/compiler.h index bd0d8bf..a1f76f6 100644 --- a/csspp/compiler.h +++ b/csspp/compiler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/csspp.cpp b/csspp/csspp.cpp index e0ece3d..cfadbb5 100644 --- a/csspp/csspp.cpp +++ b/csspp/csspp.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/csspp.h.in b/csspp/csspp.h.in index df0e9b6..3372999 100644 --- a/csspp/csspp.h.in +++ b/csspp/csspp.h.in @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/error.cpp b/csspp/error.cpp index 4b4134d..906b1f0 100644 --- a/csspp/error.cpp +++ b/csspp/error.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/error.h b/csspp/error.h index 33654be..98346a0 100644 --- a/csspp/error.h +++ b/csspp/error.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/exception.h b/csspp/exception.h index a39a890..e914d4a 100644 --- a/csspp/exception.h +++ b/csspp/exception.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_additive.cpp b/csspp/expr_additive.cpp index c6347f1..f2cfadf 100644 --- a/csspp/expr_additive.cpp +++ b/csspp/expr_additive.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_conditional.cpp b/csspp/expr_conditional.cpp index 6a1f8c6..422b508 100644 --- a/csspp/expr_conditional.cpp +++ b/csspp/expr_conditional.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_equality.cpp b/csspp/expr_equality.cpp index 7ab81fe..410ffba 100644 --- a/csspp/expr_equality.cpp +++ b/csspp/expr_equality.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_list.cpp b/csspp/expr_list.cpp index a636c4b..3c800ba 100644 --- a/csspp/expr_list.cpp +++ b/csspp/expr_list.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_logical_and.cpp b/csspp/expr_logical_and.cpp index af0df82..494b46d 100644 --- a/csspp/expr_logical_and.cpp +++ b/csspp/expr_logical_and.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_logical_or.cpp b/csspp/expr_logical_or.cpp index 7ddf3d5..1b780a8 100644 --- a/csspp/expr_logical_or.cpp +++ b/csspp/expr_logical_or.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_multiplicative.cpp b/csspp/expr_multiplicative.cpp index b070ba2..a2b37f5 100644 --- a/csspp/expr_multiplicative.cpp +++ b/csspp/expr_multiplicative.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_power.cpp b/csspp/expr_power.cpp index d423799..e069ac5 100644 --- a/csspp/expr_power.cpp +++ b/csspp/expr_power.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_relational.cpp b/csspp/expr_relational.cpp index 06d148e..41923f4 100644 --- a/csspp/expr_relational.cpp +++ b/csspp/expr_relational.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expr_unary.cpp b/csspp/expr_unary.cpp index 09e68c7..61cdb54 100644 --- a/csspp/expr_unary.cpp +++ b/csspp/expr_unary.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expression.cpp b/csspp/expression.cpp index f512804..084e4e1 100644 --- a/csspp/expression.cpp +++ b/csspp/expression.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/expression.h b/csspp/expression.h index d7caf8f..70b2aaf 100644 --- a/csspp/expression.h +++ b/csspp/expression.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/internal_functions.cpp b/csspp/internal_functions.cpp index 3d65369..a7d5d6d 100644 --- a/csspp/internal_functions.cpp +++ b/csspp/internal_functions.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/lexer.cpp b/csspp/lexer.cpp index 8621436..88290b6 100644 --- a/csspp/lexer.cpp +++ b/csspp/lexer.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/lexer.h b/csspp/lexer.h index 4de7777..d1e9e70 100644 --- a/csspp/lexer.h +++ b/csspp/lexer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/node.cpp b/csspp/node.cpp index 632928a..498cf10 100644 --- a/csspp/node.cpp +++ b/csspp/node.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/node.h b/csspp/node.h index f6d4ca0..32accdf 100644 --- a/csspp/node.h +++ b/csspp/node.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/nth_child.cpp b/csspp/nth_child.cpp index 9f96442..2797520 100644 --- a/csspp/nth_child.cpp +++ b/csspp/nth_child.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/nth_child.h b/csspp/nth_child.h index 80bff24..a25dc69 100644 --- a/csspp/nth_child.h +++ b/csspp/nth_child.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/parser.cpp b/csspp/parser.cpp index 0ebeceb..8275a83 100644 --- a/csspp/parser.cpp +++ b/csspp/parser.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/parser.h b/csspp/parser.h index eb72e2a..ca118a0 100644 --- a/csspp/parser.h +++ b/csspp/parser.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/position.cpp b/csspp/position.cpp index 8c00681..73c1499 100644 --- a/csspp/position.cpp +++ b/csspp/position.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/position.h b/csspp/position.h index 7c8a465..67030ad 100644 --- a/csspp/position.h +++ b/csspp/position.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/unicode_range.cpp b/csspp/unicode_range.cpp index 81995ac..373a09a 100644 --- a/csspp/unicode_range.cpp +++ b/csspp/unicode_range.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/csspp/unicode_range.h b/csspp/unicode_range.h index 561b2e7..059dae8 100644 --- a/csspp/unicode_range.h +++ b/csspp/unicode_range.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/debian/copyright b/debian/copyright index 7e0ca91..03c6d3f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -3,7 +3,7 @@ Upstream-Name: csspp Source: https://snapwebsites.org/ Files: * -Copyright: 2015-2024 Alexis Wilke +Copyright: 2015-2025 Alexis Wilke License: GPL-2+ This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/dev/MasterCMakeLists.txt b/dev/MasterCMakeLists.txt index 08c36de..9892f40 100644 --- a/dev/MasterCMakeLists.txt +++ b/dev/MasterCMakeLists.txt @@ -11,7 +11,7 @@ # See the CMake documentation. # # License: -# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/dev/build-release b/dev/build-release index 81582e3..d6ff6de 100755 --- a/dev/build-release +++ b/dev/build-release @@ -12,7 +12,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/dev/coverage b/dev/coverage index fedf7a7..019ee85 100755 --- a/dev/coverage +++ b/dev/coverage @@ -11,7 +11,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/dev/pack b/dev/pack index 4e5ec28..ee43e67 100755 --- a/dev/pack +++ b/dev/pack @@ -14,7 +14,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/dev/version b/dev/version index 098fa0c..db4015a 100755 --- a/dev/version +++ b/dev/version @@ -11,7 +11,7 @@ # # License: # csspp -- a CSS Preprocessor -# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/ # contact@m2osw.com diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 0077037..384afaa 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/doc/pages/compiler-at-keywords.cpp b/doc/pages/compiler-at-keywords.cpp index 78d8e5b..2bae011 100644 --- a/doc/pages/compiler-at-keywords.cpp +++ b/doc/pages/compiler-at-keywords.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/compiler-expression-by-type.cpp b/doc/pages/compiler-expression-by-type.cpp index dded8a7..10d6303 100644 --- a/doc/pages/compiler-expression-by-type.cpp +++ b/doc/pages/compiler-expression-by-type.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/compiler-expression-page.cpp b/doc/pages/compiler-expression-page.cpp index babe710..68b2c22 100644 --- a/doc/pages/compiler-expression-page.cpp +++ b/doc/pages/compiler-expression-page.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/compiler-page.cpp b/doc/pages/compiler-page.cpp index bb7b0aa..a8da42b 100644 --- a/doc/pages/compiler-page.cpp +++ b/doc/pages/compiler-page.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/compiler-selectors-rules.cpp b/doc/pages/compiler-selectors-rules.cpp index 38d67f9..dc3ae4b 100644 --- a/doc/pages/compiler-selectors-rules.cpp +++ b/doc/pages/compiler-selectors-rules.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/lexer-page.cpp b/doc/pages/lexer-page.cpp index bb7feec..ad67e05 100644 --- a/doc/pages/lexer-page.cpp +++ b/doc/pages/lexer-page.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -298,7 +298,7 @@ * * \code * // CSS Preprocessor - * // Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved + * // Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved * // * // @preserve * \endcode diff --git a/doc/pages/main.cpp b/doc/pages/main.cpp index d737ef1..ee2a95c 100644 --- a/doc/pages/main.cpp +++ b/doc/pages/main.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/doc/pages/parser-page.cpp b/doc/pages/parser-page.cpp index bcc473a..ea58c1a 100644 --- a/doc/pages/parser-page.cpp +++ b/doc/pages/parser-page.cpp @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 5cd4a9d..67b8441 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/scripts/system/close.scss b/scripts/system/close.scss index 4881db9..6c6cb53 100644 --- a/scripts/system/close.scss +++ b/scripts/system/close.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/constants.scss b/scripts/system/constants.scss index 753dcdd..37f338f 100644 --- a/scripts/system/constants.scss +++ b/scripts/system/constants.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/functions.scss b/scripts/system/functions.scss index e32bd39..f3c1878 100644 --- a/scripts/system/functions.scss +++ b/scripts/system/functions.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/init.scss b/scripts/system/init.scss index 96468b5..96c9434 100644 --- a/scripts/system/init.scss +++ b/scripts/system/init.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/logo.scss b/scripts/system/logo.scss index cbde6b1..88b0a97 100644 --- a/scripts/system/logo.scss +++ b/scripts/system/logo.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/selectors.scss b/scripts/system/selectors.scss index b3b5a3e..d0896f1 100644 --- a/scripts/system/selectors.scss +++ b/scripts/system/selectors.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/system/version.scss.in b/scripts/system/version.scss.in index 3bbe317..4d29c97 100644 --- a/scripts/system/version.scss.in +++ b/scripts/system/version.scss.in @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/countries.scss b/scripts/validation/countries.scss index bb85029..3600bc4 100644 --- a/scripts/validation/countries.scss +++ b/scripts/validation/countries.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/has-font-metrics.scss b/scripts/validation/has-font-metrics.scss index 71d9487..8500ca1 100644 --- a/scripts/validation/has-font-metrics.scss +++ b/scripts/validation/has-font-metrics.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/languages.scss b/scripts/validation/languages.scss index c11770f..d2a0a4c 100644 --- a/scripts/validation/languages.scss +++ b/scripts/validation/languages.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/pseudo-classes.scss b/scripts/validation/pseudo-classes.scss index db7aebc..cf861a6 100644 --- a/scripts/validation/pseudo-classes.scss +++ b/scripts/validation/pseudo-classes.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/pseudo-elements.scss b/scripts/validation/pseudo-elements.scss index 11e67f6..986c9b7 100644 --- a/scripts/validation/pseudo-elements.scss +++ b/scripts/validation/pseudo-elements.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/pseudo-functions.scss b/scripts/validation/pseudo-functions.scss index 3765438..516e412 100644 --- a/scripts/validation/pseudo-functions.scss +++ b/scripts/validation/pseudo-functions.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/pseudo-nth-functions.scss b/scripts/validation/pseudo-nth-functions.scss index 4c8a005..d4056f2 100644 --- a/scripts/validation/pseudo-nth-functions.scss +++ b/scripts/validation/pseudo-nth-functions.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/scripts/validation/slash-separator.scss b/scripts/validation/slash-separator.scss index eab74bc..a580031 100644 --- a/scripts/validation/slash-separator.scss +++ b/scripts/validation/slash-separator.scss @@ -1,5 +1,5 @@ // CSS Preprocessor -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 95765ea..60e4b7b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/src/csspp.cpp b/src/csspp.cpp index 8a4604c..db3345b 100644 --- a/src/csspp.cpp +++ b/src/csspp.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f675654..56fd240 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved # # https://snapwebsites.org/project/csspp # contact@m2osw.com diff --git a/tests/catch_assembler.cpp b/tests/catch_assembler.cpp index ea247f5..a0704af 100644 --- a/tests/catch_assembler.cpp +++ b/tests/catch_assembler.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com @@ -2462,7 +2462,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") ++i) { std::stringstream ss; - ss << "// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version {$_csspp_version} -- @preserve\n" + ss << "// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version {$_csspp_version} -- @preserve\n" << "body.error { color: red }\n"; csspp::position pos("test.css"); csspp::lexer::pointer_t l(new csspp::lexer(ss, pos)); @@ -2493,7 +2493,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") { case csspp::output_mode_t::COMPACT: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error { color: red }\n" + csspp_test::get_close_comment() ); @@ -2501,7 +2501,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::COMPRESSED: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error{color:red}\n" + csspp_test::get_close_comment() ); @@ -2509,7 +2509,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::EXPANDED: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error\n" "{\n" " color: red;\n" @@ -2520,7 +2520,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::TIDY: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" +"/* Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved. -- Assembler Test Version " CSSPP_VERSION " -- @preserve */\n" "body.error{color:red}\n" + csspp_test::get_close_comment() ); @@ -2537,7 +2537,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") ++i) { std::stringstream ss; - ss << "// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved.\n" + ss << "// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved.\n" << "// Assembler Test\n" << "// @preserve\n" << "body.error { color: red }\n"; @@ -2570,7 +2570,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") { case csspp::output_mode_t::COMPACT: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved.\n" +"/* Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" " */\n" @@ -2581,7 +2581,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::COMPRESSED: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved.\n" +"/* Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" " */\n" @@ -2592,7 +2592,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::EXPANDED: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved.\n" +"/* Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" " */\n" @@ -2606,7 +2606,7 @@ CATCH_TEST_CASE("Assemble C++ comment", "[assembler] [comment]") case csspp::output_mode_t::TIDY: CATCH_REQUIRE(out.str() == -"/* Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved.\n" +"/* Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved.\n" " * Assembler Test\n" " * @preserve\n" " */\n" diff --git a/tests/catch_color.cpp b/tests/catch_color.cpp index 2fc3555..9335985 100644 --- a/tests/catch_color.cpp +++ b/tests/catch_color.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_compiler.cpp b/tests/catch_compiler.cpp index dce5947..97a41c5 100644 --- a/tests/catch_compiler.cpp +++ b/tests/catch_compiler.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_csspp.cpp b/tests/catch_csspp.cpp index 64ea68f..cc15ea4 100644 --- a/tests/catch_csspp.cpp +++ b/tests/catch_csspp.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_error.cpp b/tests/catch_error.cpp index da36e19..2af5f08 100644 --- a/tests/catch_error.cpp +++ b/tests/catch_error.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_additive.cpp b/tests/catch_expr_additive.cpp index 90ee5cd..b54d0ab 100644 --- a/tests/catch_expr_additive.cpp +++ b/tests/catch_expr_additive.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_conditional.cpp b/tests/catch_expr_conditional.cpp index ecc0ca4..45ecca8 100644 --- a/tests/catch_expr_conditional.cpp +++ b/tests/catch_expr_conditional.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_equality.cpp b/tests/catch_expr_equality.cpp index 634cd79..1432841 100644 --- a/tests/catch_expr_equality.cpp +++ b/tests/catch_expr_equality.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_list.cpp b/tests/catch_expr_list.cpp index dcd6064..61323f3 100644 --- a/tests/catch_expr_list.cpp +++ b/tests/catch_expr_list.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_logical_and.cpp b/tests/catch_expr_logical_and.cpp index d0b9bb9..8a1b822 100644 --- a/tests/catch_expr_logical_and.cpp +++ b/tests/catch_expr_logical_and.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_logical_or.cpp b/tests/catch_expr_logical_or.cpp index 76fb800..6edde76 100644 --- a/tests/catch_expr_logical_or.cpp +++ b/tests/catch_expr_logical_or.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_multiplicative.cpp b/tests/catch_expr_multiplicative.cpp index e44fead..478e51a 100644 --- a/tests/catch_expr_multiplicative.cpp +++ b/tests/catch_expr_multiplicative.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/tests/catch_expr_power.cpp b/tests/catch_expr_power.cpp index b19f897..a7bfb45 100644 --- a/tests/catch_expr_power.cpp +++ b/tests/catch_expr_power.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_relational.cpp b/tests/catch_expr_relational.cpp index 07689cd..d97ae01 100644 --- a/tests/catch_expr_relational.cpp +++ b/tests/catch_expr_relational.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_expr_unary.cpp b/tests/catch_expr_unary.cpp index d0ce6e3..9bb4836 100644 --- a/tests/catch_expr_unary.cpp +++ b/tests/catch_expr_unary.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_internal_functions.cpp b/tests/catch_internal_functions.cpp index befbc07..1b6aefc 100644 --- a/tests/catch_internal_functions.cpp +++ b/tests/catch_internal_functions.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_lexer.cpp b/tests/catch_lexer.cpp index 70c69d6..6006136 100644 --- a/tests/catch_lexer.cpp +++ b/tests/catch_lexer.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_main.cpp b/tests/catch_main.cpp index 616ba81..ebb966f 100644 --- a/tests/catch_main.cpp +++ b/tests/catch_main.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_main.h b/tests/catch_main.h index 3063323..de768d6 100644 --- a/tests/catch_main.h +++ b/tests/catch_main.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_node.cpp b/tests/catch_node.cpp index 0d8a8e7..0c09a1b 100644 --- a/tests/catch_node.cpp +++ b/tests/catch_node.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_nth_child.cpp b/tests/catch_nth_child.cpp index 3b4270b..882dbbd 100644 --- a/tests/catch_nth_child.cpp +++ b/tests/catch_nth_child.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_parser.cpp b/tests/catch_parser.cpp index 9a2d396..d703b4e 100644 --- a/tests/catch_parser.cpp +++ b/tests/catch_parser.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com @@ -220,7 +220,7 @@ CATCH_TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") std::stringstream ss; ss << "// $Id: ...$\n" << "div { border: 1px; }\n" - << "/* @preserve Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved. */"; + << "/* @preserve Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved. */"; csspp::position pos("test.css"); csspp::lexer::pointer_t l(new csspp::lexer(ss, pos)); @@ -243,7 +243,7 @@ CATCH_TEST_CASE("Simple stylesheets", "[parser] [stylesheet] [rules]") " COLON\n" " WHITESPACE\n" " INTEGER \"px\" I:1\n" -" COMMENT \"@preserve Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved.\" I:1\n" +" COMMENT \"@preserve Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved.\" I:1\n" ); diff --git a/tests/catch_position.cpp b/tests/catch_position.cpp index 3feabc6..a5065db 100644 --- a/tests/catch_position.cpp +++ b/tests/catch_position.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com diff --git a/tests/catch_unicode_range.cpp b/tests/catch_unicode_range.cpp index 55efff3..53b6f89 100644 --- a/tests/catch_unicode_range.cpp +++ b/tests/catch_unicode_range.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2024 Made to Order Software Corp. All Rights Reserved +// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // https://snapwebsites.org/project/csspp // contact@m2osw.com From a262bac6667f74e79e51c83dff7d9e434dfaede5 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Fri, 4 Jul 2025 09:08:45 -0700 Subject: [PATCH 58/64] Changed date function to use gmtime_r(). That way we're not affected by the user's local time. --- csspp/compiler.cpp | 2 +- tests/catch_main.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/csspp/compiler.cpp b/csspp/compiler.cpp index 9579dc4..f6b20bb 100644 --- a/csspp/compiler.cpp +++ b/csspp/compiler.cpp @@ -442,7 +442,7 @@ void compiler::set_date_time_variables(time_t now) // convert date/time in a string struct tm t; - localtime_r(&now, &t); + gmtime_r(&now, &t); char buf[20]; strftime(buf, sizeof(buf), "%m/%d/%Y%T", &t); diff --git a/tests/catch_main.cpp b/tests/catch_main.cpp index ebb966f..dcea008 100644 --- a/tests/catch_main.cpp +++ b/tests/catch_main.cpp @@ -80,7 +80,7 @@ namespace trace_error * g_trace_error; -time_t const g_now(1435871798); // 07/02/2015 14:16:38 +time_t const g_now(1435871798); // 07/02/2015 21:16:38 UTC } @@ -244,7 +244,7 @@ std::string() + " V:_csspp_hour\n" " LIST\n" " VARIABLE \"_csspp_hour\"\n" -" STRING \"14\"\n" +" STRING \"21\"\n" " V:_csspp_ln10e\n" " LIST\n" " VARIABLE \"_csspp_ln10e\"\n" @@ -304,7 +304,7 @@ std::string() + " V:_csspp_time\n" " LIST\n" " VARIABLE \"_csspp_time\"\n" -" STRING \"14:16:38\"\n" +" STRING \"21:16:38\"\n" " V:_csspp_usdate\n" " LIST\n" " VARIABLE \"_csspp_usdate\"\n" From 40c609b9b3201200dbd411a9d224ce9b29c140c8 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sun, 20 Jul 2025 21:22:59 -0700 Subject: [PATCH 59/64] Updated the compat version to a control dependency. Updated changelog with latest changes (not much at the moment). --- debian/changelog | 7 +++++++ debian/compat | 1 - debian/control | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) delete mode 100644 debian/compat diff --git a/debian/changelog b/debian/changelog index e479ff7..51e2eb6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +csspp (1.0.33.0~jammy) jammy; urgency=high + + * Changed time function to use UTC. + * Enhanced some tests. + + -- Alexis Wilke Sun, 20 Jul 2025 21:22:37 -0700 + csspp (1.0.32.1~jammy) jammy; urgency=high * Changed test to use unsigned int where the abs() gets used. diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 60d3b2f..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -15 diff --git a/debian/control b/debian/control index bbf556b..4c21d29 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: csspp Priority: extra Maintainer: Alexis Wilke Build-Depends: cmake, - debhelper, + debhelper-compat (= 13), doxygen, graphviz, libadvgetopt-dev (>= 2.0.14.0~jammy), From 656515176e5dc9b6e045e76ebf97da0fca46787b Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Mon, 21 Jul 2025 21:32:52 -0700 Subject: [PATCH 60/64] Fixed OS name in changelog. --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 51e2eb6..524bf5e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -csspp (1.0.33.0~jammy) jammy; urgency=high +csspp (1.0.33.0~noble) noble; urgency=high * Changed time function to use UTC. * Enhanced some tests. From 8a2cc5bb9079875ad02829e1705bd4ce1d7ee6e6 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 2 Aug 2025 08:28:05 -0700 Subject: [PATCH 61/64] Updated the doxy file. Looking into some errors with the railroad SVG files. I've created separate images, but they are not really the same (the links are missing; the background color is lost; somehow inkscape is not capable of reading those HTML based SVG files...) Cleaned up the docs that generated errors. --- CMakeLists.txt | 4 +- csspp/expr_additive.cpp | 9 +- csspp/expression.cpp | 20 +- dev/INSTALL.md | 2 +- dev/coverage | 4 +- doc/CMakeLists.txt | 6 +- doc/csspp.doxy.in | 29 +- doc/images/assignment.svg | 76 +++ doc/images/close-comment.svg | 76 +++ doc/images/column-match.svg | 76 +++ doc/images/dash-match.svg | 76 +++ doc/images/delimiter.svg | 82 +++ doc/images/dimension.svg | 110 ++++ doc/images/double-equal.svg | 76 +++ doc/images/greater-equal.svg | 76 +++ doc/images/identifier-url.svg | 305 +++++++++++ doc/images/include-match.svg | 76 +++ doc/images/less-equal.svg | 76 +++ doc/images/logical-and.svg | 76 +++ doc/images/not-equal.svg | 76 +++ doc/images/number.svg | 595 +++++++++++++++++++++ doc/images/open-comment.svg | 76 +++ doc/images/percent.svg | 105 ++++ doc/images/power.svg | 76 +++ doc/images/prefix-match.svg | 76 +++ doc/images/substring-match.svg | 76 +++ doc/images/suffix-match.svg | 76 +++ doc/images/unicode-range.svg | 601 ++++++++++++++++++++++ doc/images/unquoted-url.svg | 180 +++++++ doc/pages/compiler-at-keywords.cpp | 48 +- doc/pages/compiler-expression-by-type.cpp | 6 +- doc/pages/compiler-page.cpp | 4 +- doc/pages/compiler-selectors-rules.cpp | 2 +- doc/pages/lexer-page.cpp | 56 +- doc/pages/main.cpp | 6 +- {src => tools}/CMakeLists.txt | 0 {src => tools}/csspp.cpp | 4 +- 37 files changed, 3204 insertions(+), 114 deletions(-) create mode 100644 doc/images/assignment.svg create mode 100644 doc/images/close-comment.svg create mode 100644 doc/images/column-match.svg create mode 100644 doc/images/dash-match.svg create mode 100644 doc/images/delimiter.svg create mode 100644 doc/images/dimension.svg create mode 100644 doc/images/double-equal.svg create mode 100644 doc/images/greater-equal.svg create mode 100644 doc/images/identifier-url.svg create mode 100644 doc/images/include-match.svg create mode 100644 doc/images/less-equal.svg create mode 100644 doc/images/logical-and.svg create mode 100644 doc/images/not-equal.svg create mode 100644 doc/images/number.svg create mode 100644 doc/images/open-comment.svg create mode 100644 doc/images/percent.svg create mode 100644 doc/images/power.svg create mode 100644 doc/images/prefix-match.svg create mode 100644 doc/images/substring-match.svg create mode 100644 doc/images/suffix-match.svg create mode 100644 doc/images/unicode-range.svg create mode 100644 doc/images/unquoted-url.svg rename {src => tools}/CMakeLists.txt (100%) rename {src => tools}/csspp.cpp (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4686e81..f3a04c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,8 +62,8 @@ include_directories( ## add_subdirectory(csspp) # csspp library add_subdirectory(cmake) # cmake include files -add_subdirectory(scripts) # command line tools as scripts -add_subdirectory(src) # command line tools as binaries +add_subdirectory(scripts) # csspp system & validation scripts +add_subdirectory(tools) # command line tools add_subdirectory(tests) # tests add_subdirectory(doc) # library API documentation diff --git a/csspp/expr_additive.cpp b/csspp/expr_additive.cpp index f2cfadf..5faec98 100644 --- a/csspp/expr_additive.cpp +++ b/csspp/expr_additive.cpp @@ -38,6 +38,7 @@ #include #include + // last include // #include @@ -339,12 +340,4 @@ node::pointer_t expression::additive() } } // namespace csspp - -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/csspp/expression.cpp b/csspp/expression.cpp index 084e4e1..37ae7f1 100644 --- a/csspp/expression.cpp +++ b/csspp/expression.cpp @@ -20,7 +20,17 @@ * The CSS Preprocessor expression class is used to reduce a list * of nodes by applying expressions to the various values. * - * \sa \ref expression_rules + * \section expression_rules Expression Rules + * + * The expression rules are as follow: + * + * \code + * expr '+' expr + * | expr '*' expr + * | ... + * \endcode + * + * TODO: determine what I meant to include in this section. */ // self @@ -148,12 +158,4 @@ void expression::next() } } // namespace csspp - -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et diff --git a/dev/INSTALL.md b/dev/INSTALL.md index 6347946..c639a0b 100644 --- a/dev/INSTALL.md +++ b/dev/INSTALL.md @@ -36,7 +36,7 @@ cygwin since the DLL appears along the EXE, but I don't think it still compiles on Win32). You may, however, immediately test the binary without installing to a final destination with: - BUILD/csspp/src/csspp --help + BUILD/csspp/tools/csspp --help The dist directory is otherwise ready to be installed under `/usr`. Many files are not really required, but that's up to you to decide how to handle that diff --git a/dev/coverage b/dev/coverage index 019ee85..242a49b 100755 --- a/dev/coverage +++ b/dev/coverage @@ -238,7 +238,7 @@ lcov --capture --no-external --directory $DIRNAME --base-directory $SOURCE_PATH mkdir -p ${DIRNAME}_html genhtml --legend --demangle-cpp --no-branch-coverage --show-details coverage.info --output-directory ${DIRNAME}_html -# gprof -q -I ../../../include -I ../../../lib -I ../../../src -I ../../../tests ../csspp_coverage_assembler/tests/csspp_tests | less -S +# gprof -q -I ../../../include -I ../../../lib -I ../../../tools -I ../../../tests ../csspp_coverage_assembler/tests/csspp_tests | less -S # only gprof does NOT profile anything outside of the binary (so csspp_test but not the library!) So unless we link statically # sprof would normally work on .so but that's complicated (by default it fails loading) # oprofile would work on the entire system, but that requires a peculiar setup of the machine... @@ -253,7 +253,7 @@ echo "csspp $FULL_VERSION statistics" >$ echo "

Statistics of the csspp $FULL_VERSION code

" >>${DIRNAME}_html/statistics.html echo "

Back to CSS Preprocessor Coverage Data.

" >>${DIRNAME}_html/statistics.html echo "
" >>${DIRNAME}_html/statistics.html
-cloc --autoconf --by-file-by-lang $SOURCE_PATH/include/ $SOURCE_PATH/lib/ $SOURCE_PATH/src/ >>${DIRNAME}_html/statistics.html
+cloc --autoconf --by-file-by-lang $SOURCE_PATH/csspp/ $SOURCE_PATH/tools/ >>${DIRNAME}_html/statistics.html
 echo "

Statistics of the csspp $FULL_VERSION tests

" >>${DIRNAME}_html/statistics.html
 cloc --autoconf --by-file-by-lang $SOURCE_PATH/tests/ >>${DIRNAME}_html/statistics.html
 echo "
" >>${DIRNAME}_html/statistics.html diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 384afaa..8764e96 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -44,7 +44,7 @@ if(DOXYGEN_FOUND) add_custom_target(sample.css DEPENDS ${CSSPP_TOOL} COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/csspp" - ${CMAKE_BINARY_DIR}/src/csspp + ${CMAKE_BINARY_DIR}/tools/csspp -I ${CMAKE_SOURCE_DIR}/scripts ${CMAKE_BINARY_DIR}/scripts --debug --style expanded --output sample.css ${CMAKE_CURRENT_SOURCE_DIR}/sample.scss @@ -59,8 +59,8 @@ if(DOXYGEN_FOUND) # (It is not required to have these to build locally, only to build # on a build system with the debuild environment.) # - # COMMAND ldd ${CMAKE_BINARY_DIR}/src/csspp - # COMMAND LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.2 ${CMAKE_BINARY_DIR}/src/csspp + # COMMAND ldd ${CMAKE_BINARY_DIR}/tools/csspp + # COMMAND LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.2 ${CMAKE_BINARY_DIR}/tools/csspp # # Note: the ldd command is used to determine the full path to the libasan.so library # diff --git a/doc/csspp.doxy.in b/doc/csspp.doxy.in index 751afdf..0970a0d 100644 --- a/doc/csspp.doxy.in +++ b/doc/csspp.doxy.in @@ -152,7 +152,8 @@ FULL_PATH_NAMES = YES # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. -STRIP_FROM_PATH = @CMAKE_CURRENT_SOURCE_DIR@ +STRIP_FROM_PATH = @CMAKE_BINARY_DIR@ \ + @CMAKE_SOURCE_DIR@ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which @@ -780,11 +781,11 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = @csspp_project_SOURCE_DIR@/lib \ - @csspp_project_SOURCE_DIR@/src \ - @csspp_project_SOURCE_DIR@/include/csspp \ - @csspp_project_BINARY_DIR@/include/csspp/csspp.h \ - @csspp_project_SOURCE_DIR@/doc/pages +# The doc/pages include additional pages of documentation +INPUT = @CMAKE_BINARY_DIR@/csspp/csspp.h \ + @CMAKE_SOURCE_DIR@/csspp \ + @CMAKE_SOURCE_DIR@/doc/pages \ + @CMAKE_SOURCE_DIR@/tools # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -809,8 +810,10 @@ INPUT_ENCODING = UTF-8 # *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, # *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. -FILE_PATTERNS = *.h \ - *.cpp +FILE_PATTERNS = *.c \ + *.cpp \ + *.h \ + *.sh # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. @@ -858,15 +861,17 @@ EXCLUDE_SYMBOLS = # that contain example code fragments that are included (see the \include # command). -EXAMPLE_PATH = @CMAKE_SOURCE_DIR@ \ - @CMAKE_BINARY_DIR@ +EXAMPLE_PATH = @CMAKE_CURRENT_BINARY_DIR@ \ + @CMAKE_CURRENT_SOURCE_DIR@ # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and # *.h) to filter out the source-files in the directories. If left blank all # files are included. -EXAMPLE_PATTERNS = +EXAMPLE_PATTERNS = *.c \ + *.cpp \ + *.h # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude commands @@ -1662,7 +1667,7 @@ COMPACT_LATEX = NO # The default value is: a4. # This tag requires that the tag GENERATE_LATEX is set to YES. -PAPER_TYPE = a4wide +PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names # that should be included in the LaTeX output. The package can be specified just diff --git a/doc/images/assignment.svg b/doc/images/assignment.svg new file mode 100644 index 0000000..0cbe6e8 --- /dev/null +++ b/doc/images/assignment.svg @@ -0,0 +1,76 @@ + + + + + + + + + + := + + + + + diff --git a/doc/images/close-comment.svg b/doc/images/close-comment.svg new file mode 100644 index 0000000..697d975 --- /dev/null +++ b/doc/images/close-comment.svg @@ -0,0 +1,76 @@ + + + + + + + + + + --> + + + + + diff --git a/doc/images/column-match.svg b/doc/images/column-match.svg new file mode 100644 index 0000000..9ce3ab5 --- /dev/null +++ b/doc/images/column-match.svg @@ -0,0 +1,76 @@ + + + + + + + + + + || + + + + + diff --git a/doc/images/dash-match.svg b/doc/images/dash-match.svg new file mode 100644 index 0000000..204023b --- /dev/null +++ b/doc/images/dash-match.svg @@ -0,0 +1,76 @@ + + + + + + + + + + |= + + + + + diff --git a/doc/images/delimiter.svg b/doc/images/delimiter.svg new file mode 100644 index 0000000..2659143 --- /dev/null +++ b/doc/images/delimiter.svg @@ -0,0 +1,82 @@ + + + + + + + + + + + ANYTHING + + + + + + diff --git a/doc/images/dimension.svg b/doc/images/dimension.svg new file mode 100644 index 0000000..b674889 --- /dev/null +++ b/doc/images/dimension.svg @@ -0,0 +1,110 @@ + + + + + + + + + + + NUMBER + + + + + + + + IDENTIFIER + + + + + + diff --git a/doc/images/double-equal.svg b/doc/images/double-equal.svg new file mode 100644 index 0000000..1ece29e --- /dev/null +++ b/doc/images/double-equal.svg @@ -0,0 +1,76 @@ + + + + + + + + + + == + + + + + diff --git a/doc/images/greater-equal.svg b/doc/images/greater-equal.svg new file mode 100644 index 0000000..5d031c7 --- /dev/null +++ b/doc/images/greater-equal.svg @@ -0,0 +1,76 @@ + + + + + + + + + + >= + + + + + diff --git a/doc/images/identifier-url.svg b/doc/images/identifier-url.svg new file mode 100644 index 0000000..bb41fad --- /dev/null +++ b/doc/images/identifier-url.svg @@ -0,0 +1,305 @@ + + + + + + + + + WHITESPACE* + + + + + ( + + + + + IDENTIFIER "url" + + + + + + + + + + + + + + + + + + + + + + + URL-UNQUOTED + + + + + + + + + + + STRING + + + + + + + + + WHITESPACE* + + + + + + + + ) + + + + + diff --git a/doc/images/include-match.svg b/doc/images/include-match.svg new file mode 100644 index 0000000..602e811 --- /dev/null +++ b/doc/images/include-match.svg @@ -0,0 +1,76 @@ + + + + + + + + + + ~= + + + + + diff --git a/doc/images/less-equal.svg b/doc/images/less-equal.svg new file mode 100644 index 0000000..eb00003 --- /dev/null +++ b/doc/images/less-equal.svg @@ -0,0 +1,76 @@ + + + + + + + + + + <= + + + + + diff --git a/doc/images/logical-and.svg b/doc/images/logical-and.svg new file mode 100644 index 0000000..23905ee --- /dev/null +++ b/doc/images/logical-and.svg @@ -0,0 +1,76 @@ + + + + + + + + + + && + + + + + diff --git a/doc/images/not-equal.svg b/doc/images/not-equal.svg new file mode 100644 index 0000000..b39a90a --- /dev/null +++ b/doc/images/not-equal.svg @@ -0,0 +1,76 @@ + + + + + + + + + + != + + + + + diff --git a/doc/images/number.svg b/doc/images/number.svg new file mode 100644 index 0000000..43c31be --- /dev/null +++ b/doc/images/number.svg @@ -0,0 +1,595 @@ + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + . + + DIGIT* + + DIGIT* + + DIGIT* + + DIGIT* + + DIGIT* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + e + + + + + + E + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + diff --git a/doc/images/open-comment.svg b/doc/images/open-comment.svg new file mode 100644 index 0000000..8656998 --- /dev/null +++ b/doc/images/open-comment.svg @@ -0,0 +1,76 @@ + + + + + + + + + + <!-- + + + + + diff --git a/doc/images/percent.svg b/doc/images/percent.svg new file mode 100644 index 0000000..43601b2 --- /dev/null +++ b/doc/images/percent.svg @@ -0,0 +1,105 @@ + + + + + + + + + + + DECIMAL_NUMBER + + + + + + + % + + + + + diff --git a/doc/images/power.svg b/doc/images/power.svg new file mode 100644 index 0000000..6ac89fe --- /dev/null +++ b/doc/images/power.svg @@ -0,0 +1,76 @@ + + + + + + + + + + ** + + + + + diff --git a/doc/images/prefix-match.svg b/doc/images/prefix-match.svg new file mode 100644 index 0000000..f633498 --- /dev/null +++ b/doc/images/prefix-match.svg @@ -0,0 +1,76 @@ + + + + + + + + + + ^= + + + + + diff --git a/doc/images/substring-match.svg b/doc/images/substring-match.svg new file mode 100644 index 0000000..5b5991b --- /dev/null +++ b/doc/images/substring-match.svg @@ -0,0 +1,76 @@ + + + + + + + + + + *= + + + + + diff --git a/doc/images/suffix-match.svg b/doc/images/suffix-match.svg new file mode 100644 index 0000000..1054df7 --- /dev/null +++ b/doc/images/suffix-match.svg @@ -0,0 +1,76 @@ + + + + + + + + + + $= + + + + + diff --git a/doc/images/unicode-range.svg b/doc/images/unicode-range.svg new file mode 100644 index 0000000..6100edb --- /dev/null +++ b/doc/images/unicode-range.svg @@ -0,0 +1,601 @@ + + + + + + + + + + + U + + + + + + u + + + + + + + + + + + + + + + + + + + + HEXDIGIT + + + + + + + + 1-6 times + + + + + + + + + + + + + + + + + + + HEXDIGIT + + + + + + + + 1-5 times + + + + + + + + + + + + + ? + + + + + 1 to (6 - digits) times + + + + + + + + + + + + + + + + + + + + + + HEXDIGIT + + + + + + + + 1-6 times + + + + + + + + - + + + + + + + + + HEXDIGIT + + + + + + + + 1-6 times + + + + + + + + + + diff --git a/doc/images/unquoted-url.svg b/doc/images/unquoted-url.svg new file mode 100644 index 0000000..5f9ae9c --- /dev/null +++ b/doc/images/unquoted-url.svg @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + not " ' ( ) \\ + + WHITESPACE + + or + + NON-PRINTABLE + + + + + + + + + + ESCAPE + + + + + + + + + + + + + + + diff --git a/doc/pages/compiler-at-keywords.cpp b/doc/pages/compiler-at-keywords.cpp index 2bae011..050f32d 100644 --- a/doc/pages/compiler-at-keywords.cpp +++ b/doc/pages/compiler-at-keywords.cpp @@ -1,4 +1,3 @@ -// CSS Preprocessor // Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved // // This program is free software; you can redistribute it and/or modify @@ -17,24 +16,10 @@ // Documentation only file -// WARNING: -// We show C-like comments in this block so we use //! as the introducer -// in order to keep everything looking like a comment even when we have -// a */ in the comment. -// -// If you use gvim, you may want to change your comment setup to: -// -// set comments=s1:/*,mb:*,ex:*/,b://,b://! -// -// in order to include the //! introducer (assuming you don't already -// have it in there!) You could also include /// -// - - /** \page at_keywords CSS Preprocessor &At;-keywords * \tableofcontents * - * \section at_charset @charset "utf-8"; + * \section at_charset \@charset "utf-8"; * * The csspp compiler accepts the \@charset keyword, but only if it * specifies UTF-8. At this time the compiler does not check whether @@ -47,7 +32,7 @@ * is also generated (i.e. the \@charset must be followed by a * string.) * - * \section at_debug @debug \ ; + * \section at_debug \@debug \ ; * * Print out a debug message (i.e. \). By default a system * should not display debug messages. The csspp command line tool @@ -56,7 +41,7 @@ * * If the message is somehow empty, then a default message is printed. * - * \section at_else @else { code } + * \section at_else \@else { code } * * The \@else command offers a way to run code when all \ref at_if "\@if" * and \ref at_else_if "\@else if" preceeding this \@else have a false @@ -77,7 +62,7 @@ * } * \endcode * - * \section at_else_if @else if \ { code } + * \section at_else_if \@else if \ { code } * * The \@else if command offers a way to verify another expression * and execute code only if all previous \ref at_if "\@if" and \@else @@ -96,7 +81,7 @@ * } * \endcode * - * \section at_error @error \ ; + * \section at_error \@error \ ; * * Print out an error message (i.e. \). If the message is somehow * empty, print out a default error message. @@ -104,7 +89,7 @@ * The error is counted just like any other errors, so a tool, such as * the csspp compiler, will return with an exit code of 1. * - * \section at_if @if \ { code } + * \section at_if \@if \ { code } * * The \@if command adds the possibility to write code that gets * compiled only when the expression is true. @@ -122,7 +107,7 @@ * } * \endcode * - * \section at_import @import \ ; + * \section at_import \@import \ ; * * The \@import command includes another .scss or .css file in place. * This allows you to create libraries of CSS rules that you can @@ -155,7 +140,7 @@ * to include \em complex variables when the simple $\ is not * going to work right. * - * \section at_include @include \ ; + * \section at_include \@include \ ; * * This \@include is used to insert a variable in place. In some * circumstance you may want to insert a rather complex variable @@ -205,7 +190,7 @@ * If you wanted to include another CSS or SCSS file in your SCSS file, * you were looking for \ref at_import "\@import" and not the \@include. * - * \section at_message @message \ ; or @info \ ; + * \section at_message \@message \ ; or @info \ ; * * Print out an informational message (i.e. \). If the message * is empty, then a default message gets written. @@ -213,7 +198,7 @@ * The error and warning counters do not get touched when an informational * message is output. * - * \section at_mixin @mixin \ { ... } + * \section at_mixin \@mixin \ { ... } * * The \@mixin comes from SASS. It is a way to declare a \em complex * variable. Although csspp does not require it, we have it to be @@ -239,9 +224,9 @@ * * To be more SASS compatible, we also support the \ref at_include "\@include". * - * \section at_return @return \ ; + * \section at_return \@return \ ; * - * When defining \ref at_mixin functions, the result of the function + * When defining \ref at_mixin "\@mixin" functions, the result of the function * can be returned using the \@return keyword. * * The \@return keyword is expected to be used last in the list of commands @@ -267,7 +252,7 @@ * div { z-index: opacity($color); } * \endcode * - * \section at_warning @warning \ ; + * \section at_warning \@warning \ ; * * Print out a warning message (i.e. \). If the message is * somehow empty, print out a default warning message. @@ -277,11 +262,4 @@ * is printed and counted as expected. */ -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et syntax=doxygen diff --git a/doc/pages/compiler-expression-by-type.cpp b/doc/pages/compiler-expression-by-type.cpp index 10d6303..affa522 100644 --- a/doc/pages/compiler-expression-by-type.cpp +++ b/doc/pages/compiler-expression-by-type.cpp @@ -83,7 +83,7 @@ * * \section expression_with_unicode_ranges Unicode Ranges * - * The @font-face keyword accepts a field named unicode-range which + * The \@font-face keyword accepts a field named unicode-range which * accepts ranges of Unicode character code points. * * These ranges can be intersected between each others uing * operator. @@ -439,9 +439,9 @@ * \li color || color -- true if one of the colors is not black * \li color && color -- true if both colors are not black * \li color == color -- true if both colors are the same (compared after - * conversion to #aabbggrr) + * conversion to \#aabbggrr) * \li color != color -- true if both colors are different (compared after - * conversion to #aabbggrr) + * conversion to \#aabbggrr) * * \note * The color +/- number is expected to be used with a decimal number. diff --git a/doc/pages/compiler-page.cpp b/doc/pages/compiler-page.cpp index a8da42b..fd9270b 100644 --- a/doc/pages/compiler-page.cpp +++ b/doc/pages/compiler-page.cpp @@ -149,7 +149,7 @@ //! //! \subsection command_line_tool csspp in your shell //! -//! You may use the \ref src/csspp.cpp "CSS Preprocessor command line tool" to compile your +//! You may use the \ref tools/csspp.cpp "CSS Preprocessor command line tool" to compile your //! SCSS files. It is very similar to using a compiler: //! //! \code{.sh} @@ -172,7 +172,7 @@ //! //! Then look at the API documentation //! for details on how to use the csspp objects. You may check out -//! the src/csspp.cpp file as an example of use of the CSS Preprocessor +//! the tools/csspp.cpp file as an example of use of the CSS Preprocessor //! library. //! //! In general, you want to open a file, give it to a lexer object. diff --git a/doc/pages/compiler-selectors-rules.cpp b/doc/pages/compiler-selectors-rules.cpp index dc3ae4b..0e2ede8 100644 --- a/doc/pages/compiler-selectors-rules.cpp +++ b/doc/pages/compiler-selectors-rules.cpp @@ -25,7 +25,7 @@ * making it easier to find potential errors in your source CSS files. * * The supported selectors are all the selected supported in CSS 3 and - * the % selector which is used to allow for optional rules + * the %\ selector which is used to allow for optional rules * defined in CSS libraries. * * Source: diff --git a/doc/pages/lexer-page.cpp b/doc/pages/lexer-page.cpp index ad67e05..6238019 100644 --- a/doc/pages/lexer-page.cpp +++ b/doc/pages/lexer-page.cpp @@ -83,14 +83,14 @@ * error if an invalid character is found. Characters that are considered * invalid are: * - * \li \0 -- the NULL terminator; the lexer can still parse strings, only + * \li \\0 -- the NULL terminator; the lexer can still parse strings, only * you have to write such strings in an I/O buffer first and * you just should not include the NULL terminator in that buffer; * (see example below) - * \li \xFFFD -- the INVALID character; in CSS 3, this character represents + * \li \\xFFFD -- the INVALID character; in CSS 3, this character represents * the EOF of a stream; in CSS Preprocessor, it is just viewed * as an error - * \li \x??FFFE and \x??FFFF -- any character that ends with FFFE or FFFF + * \li \\x??FFFE and \\x??FFFF -- any character that ends with FFFE or FFFF * is viewed as invalid and generates an error * * Note that the parsing will continue after such errors. However, if one @@ -132,7 +132,7 @@ * A valid character is any character code point defined between 0x000000 * and 0x10FFFF inclusive. * - * The \ref input-stream defines a small set of characters within that range + * The \ref input_stream defines a small set of characters within that range * that are considered invalid in CSS Preprocessor streams. Any character * considered invalid is replaced by the 0xFFFD code point so the rest of * the implementation does not have to check for invalid characters each @@ -361,7 +361,7 @@ * CSS Preprocessor also counts the total number of lines and pages in a * separate counter. * - * The line number is used to print out errors. If you use paging (\f), + * The line number is used to print out errors. If you use paging (\\f), * you may have a harder time to find your errors in the current version. * * Note that line counting also happens in C++ and C-like comments. @@ -633,7 +633,7 @@ * code points that are considered valid from the input stream are * considered valid in an escape sequence. This means any character * between 0 and 0x10FFFF except those marked as invalid in the - * \ref input-stream section. + * \ref input_stream section. * * \note * Contrary to the CSS 3 definition, this definition clearly shows that @@ -847,7 +847,7 @@ * \endcode * * \warning - * The placeholder token and rules are supported as expected. The @extend + * The placeholder token and rules are supported as expected. The \@extend * is not yet supported in version 1.0.0 of CSS Preprocessor. * * \section variable Variable "VARIABLE" (CSS Preprocessor Extension) @@ -1161,7 +1161,8 @@ * "... \" or \22 ..." * \endcode * - * Of course, you can use ' in a string quoted with " and vice versa. + * Of course, you can use an apostrophe in a string quoted with a + * double quote and vice versa. * * Strings accept the backslashed followed by a newline to insert a * newline in the string and write that string on multiple lines. In @@ -1822,13 +1823,13 @@ * * \note * The lexer makes use of the csspp::unicode_range_t class to record these - * values in a \ref unicode-range "UNICODE_RANGE" node. The range is + * values in a \ref unicode_range "UNICODE_RANGE" node. The range is * then compressed and saved in one 64 bit number. * - * A Unicode range is used by @font-face definitions to limit the number + * A Unicode range is used by \@font-face definitions to limit the number * of characters to be loaded for a page. * - * \section include_match Include Match "INCLUDE_MATCH" (CSS 3) + * \section lexer_include_match Include Match "INCLUDE_MATCH" (CSS 3) * * \htmlonly *
@@ -1855,7 +1856,7 @@ * a[class ~= "green"] // equivalent to a.green * \endcode * - * \section dash_match Dash Match "DASH_MATCH" (CSS 3) + * \section lexer_dash_match Dash Match "DASH_MATCH" (CSS 3) * * \htmlonly *
@@ -1881,7 +1882,7 @@ * [lang |= "en"] // match lang="en-US" * \endcode * - * \section prefix_match Prefix Match "PREFIX_MATCH" (CSS 3) + * \section lexer_prefix_match Prefix Match "PREFIX_MATCH" (CSS 3) * * \htmlonly *
@@ -1906,7 +1907,7 @@ * a[entity ^= 'blue'] // match entity="blue-laggoon" * \endcode * - * \section suffix_match Suffix Match "SUFFIX_MATCH" (CSS 3) + * \section lexer_suffix_match Suffix Match "SUFFIX_MATCH" (CSS 3) * * \htmlonly *
@@ -1931,7 +1932,7 @@ * a[entity $= 'laggoon'] // match entity="blue-laggoon" * \endcode * - * \section substring_match Substring Match "SUBSTRING_MATCH" (CSS 3) + * \section lexer_substring_match Substring Match "SUBSTRING_MATCH" (CSS 3) * * \htmlonly *
@@ -1992,7 +1993,7 @@ * The OR operator takes two boolean value. If at least one of these * boolean value is true, then the result is true, otherwise it is false. * - * You may also use the 'or' identifier. + * You may also use the `or` identifier. * * \code{.scss} * width: $bool1 || $bool2 ? $left-column : $right-column; @@ -2022,7 +2023,7 @@ * The '&&' operator is the logical AND operator. It returns true when * its left and right handsides are both set to true. * - * You may also use the 'and' identifier. + * You may also use the `and` identifier. * * \code{.scss} * width: $bool1 && $bool2 ? $left-column : $right-column; @@ -2110,7 +2111,7 @@ *
* \endhtmlonly * - * We added the ':=' operator to allow one to set a variable within an + * We added the `:=` operator to allow one to set a variable within an * expression. For example, you could write an assignment of a long * expression, then reuse that value many times in the rest of the * expression: @@ -2268,10 +2269,10 @@ *
* \endhtmlonly * - * The DELIMITER is activated for any character + * The \ref delimiter is activated for any character * that does not activate any other lexer rule. * - * For example, a period that is not followed by a DIGIT + * For example, a period that is not followed by a \ref digit * is returned as itself. The grammar generally shows delimiters using a * simple quoted string rather than its node_type_t name. * @@ -2292,7 +2293,7 @@ * \li { -- OPEN_CURVLYBRACKET * \li } -- CLOSE_CURVLYBRACKET * \li . -- PERIOD - * \li & -- REFERENCE + * \li & -- REFERENCE * \li < -- LESS * \li + -- ADD * \li - -- SUBTRACT (if by itself or at least not followed by an identifier) @@ -2323,9 +2324,9 @@ * * \note * The lexer cannot know what to do with the DIVIDE. The compiler, - * however, knows at the time it runs the expression since it - * has the name of the field name 'font'. In that case it tells the - * expression class to handle the DIVIDE as a CSS 3 separator. That + * however, knows at the time it processes the expression since it + * has access the name of the field: `font: ...`. In that case it tells + * the expression class to handle the DIVIDE as a CSS 3 separator. That * mean the sequence \ / \ will generate the token * FONT_METRICS. * @@ -2343,11 +2344,4 @@ * \endcode */ -// Local Variables: -// mode: cpp -// indent-tabs-mode: nil -// c-basic-offset: 4 -// tab-width: 4 -// End: - // vim: ts=4 sw=4 et syntax=doxygen diff --git a/doc/pages/main.cpp b/doc/pages/main.cpp index ee2a95c..ed6a8cb 100644 --- a/doc/pages/main.cpp +++ b/doc/pages/main.cpp @@ -42,7 +42,7 @@ * which I think is one of the most powerful feature of the CSS * Preprocessor. * - * \include doc/sample.scss + * \include sample.scss * * First there is the command line used to process the file (assuming * you installed the package as expected by default). As we can see, @@ -56,11 +56,11 @@ * * The following is the resulting output: * - * \include doc/sample.css + * \include sample.css * * \section csspreprocessor_references CSS Preprocessor References * - * The command line tool is documented in src/csspp.cpp (make sure to click + * The command line tool is documented in tools/csspp.cpp (make sure to click * on the More... link to see all the details.) * * The supported CSS extensions are defined in the \ref compiler_reference. diff --git a/src/CMakeLists.txt b/tools/CMakeLists.txt similarity index 100% rename from src/CMakeLists.txt rename to tools/CMakeLists.txt diff --git a/src/csspp.cpp b/tools/csspp.cpp similarity index 99% rename from src/csspp.cpp rename to tools/csspp.cpp index db3345b..6aceac4 100644 --- a/src/csspp.cpp +++ b/tools/csspp.cpp @@ -82,7 +82,7 @@ * \subsection include -I -- specify paths to include files * * Specify paths to user defined directories that include SCSS scripts - * one can include using the @import command. + * one can include using the \@import command. * * By default the system looks for system defined scripts (i.e. the * default validation, version, and other similar scripts) under @@ -99,7 +99,7 @@ * under a sub-directory named "validation". * * There are no specific rules for where include files will be found. - * The @import can use a full path or a local path. When a local path + * The \@import can use a full path or a local path. When a local path * is used, then all the specified -I paths are prepended until a * file matches. The first match is used. * From f239ba64cf5489567840507d194f572e50521900 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sat, 2 Aug 2025 08:30:45 -0700 Subject: [PATCH 62/64] Applied doxygen -u. --- doc/csspp.doxy.in | 966 +++++++++++++++++++++++++++++++--------------- 1 file changed, 664 insertions(+), 302 deletions(-) diff --git a/doc/csspp.doxy.in b/doc/csspp.doxy.in index 0970a0d..84095e8 100644 --- a/doc/csspp.doxy.in +++ b/doc/csspp.doxy.in @@ -1,4 +1,4 @@ -# Doxyfile 1.8.13 +# Doxyfile 1.9.8 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -12,16 +12,26 @@ # For lists, items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (\" \"). +# +# Note: +# +# Use doxygen to compare the used configuration file with the template +# configuration file: +# doxygen -x [configFile] +# Use doxygen to compare the used configuration file with the template +# configuration file without replacing the environment variables or CMake type +# replacement variables: +# doxygen -x_noenv [configFile] #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 @@ -60,16 +70,28 @@ PROJECT_LOGO = OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@ -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 +# sub-directories (in 2 levels) under the output directory of each output format +# and will distribute the generated files over these directories. Enabling this # option can be useful when feeding doxygen a huge amount of source files, where # putting all generated files in the same directory would otherwise causes -# performance problems for the file system. +# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to +# control the number of sub-directories. # The default value is: NO. CREATE_SUBDIRS = NO +# Controls the number of sub-directories that will be created when +# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every +# level increment doubles the number of directories, resulting in 4096 +# directories at level 8 which is the default and also the maximum value. The +# sub-directories are organized in 2 levels, the first level always has a fixed +# number of 16 directories. +# Minimum value: 0, maximum value: 8, default value: 8. +# This tag requires that the tag CREATE_SUBDIRS is set to YES. + +CREATE_SUBDIRS_LEVEL = 8 + # If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII # characters to appear in the names of generated files. If set to NO, non-ASCII # characters will be escaped, for example _xE3_x81_x84 will be used for Unicode @@ -81,14 +103,14 @@ ALLOW_UNICODE_NAMES = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian, +# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English +# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek, +# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with +# English messages), Korean, Korean-en (Korean with English messages), Latvian, +# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, +# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, +# Swedish, Turkish, Ukrainian and Vietnamese. # The default value is: English. OUTPUT_LANGUAGE = English @@ -180,6 +202,16 @@ SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus @@ -200,6 +232,14 @@ QT_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. @@ -223,20 +263,19 @@ TAB_SIZE = 4 # the documentation. An alias has the form: # name=value # For example adding -# "sideeffect=@par Side Effects:\n" +# "sideeffect=@par Side Effects:^^" # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. +# "Side Effects:". Note that you cannot put \n's in the value part of an alias +# to insert newlines (in the resulting output). You can put ^^ in the value part +# of an alias to insert a newline as if a physical newline was in the original +# file. When you need a literal { or } or , in the value part of an alias you +# have to escape them by means of a backslash (\), this can lead to conflicts +# with the commands \{ and \} for these it is advised to use the version @{ and +# @} or use a double escape (\\{ and \\}) ALIASES = -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all @@ -265,28 +304,40 @@ OPTIMIZE_FOR_FORTRAN = NO OPTIMIZE_OUTPUT_VHDL = NO +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice, +# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. # # Note: For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. EXTENSION_MAPPING = in=C++ # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. +# documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. @@ -298,11 +349,22 @@ MARKDOWN_SUPPORT = YES # to that level are automatically included in the table of contents, even if # they do not have an id attribute. # Note: This feature currently applies only to Markdown headings. -# Minimum value: 0, maximum value: 99, default value: 0. +# Minimum value: 0, maximum value: 99, default value: 5. # This tag requires that the tag MARKDOWN_SUPPORT is set to YES. TOC_INCLUDE_HEADINGS = 0 +# The MARKDOWN_ID_STYLE tag can be used to specify the algorithm used to +# generate identifiers for the Markdown headings. Note: Every identifier is +# unique. +# Possible values are: DOXYGEN use a fixed 'autotoc_md' string followed by a +# sequence number starting at 0 and GITHUB use the lower case version of title +# with any whitespace replaced by '-' and punctuation characters removed. +# The default value is: DOXYGEN. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +MARKDOWN_ID_STYLE = DOXYGEN + # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by putting a % sign in front of the word or @@ -328,7 +390,7 @@ BUILTIN_STL_SUPPORT = NO CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. @@ -414,6 +476,27 @@ TYPEDEF_HIDES_STRUCT = NO LOOKUP_CACHE_SIZE = 0 +# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which effectively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + +# If the TIMESTAMP tag is set different from NO then each generated page will +# contain the date or date and time when the page was generated. Setting this to +# NO can help when comparing the output of multiple runs. +# Possible values are: YES, NO, DATETIME and DATE. +# The default value is: NO. + +TIMESTAMP = YES + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- @@ -434,6 +517,12 @@ EXTRACT_ALL = YES EXTRACT_PRIVATE = YES +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. @@ -471,6 +560,13 @@ EXTRACT_LOCAL_METHODS = NO EXTRACT_ANON_NSPACES = YES +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation @@ -482,14 +578,15 @@ HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set # to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. +# will also hide undocumented C++ concepts if enabled. This option has no effect +# if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. +# declarations. If set to NO, these declarations will be included in the +# documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO @@ -508,12 +605,20 @@ HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = YES -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. +# Possible values are: SYSTEM, NO and YES. +# The default value is: SYSTEM. CASE_SENSE_NAMES = YES @@ -531,6 +636,12 @@ HIDE_SCOPE_NAMES = NO HIDE_COMPOUND_REFERENCE= NO +# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class +# will show which file needs to be included to use the class. +# The default value is: YES. + +SHOW_HEADERFILE = YES + # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. @@ -688,7 +799,8 @@ FILE_VERSION_FILTER = # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. You can # optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. +# will be used as the name of the layout file. See also section "Changing the +# layout of pages" for information. # # Note that if you run doxygen from a directory containing a file called # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE @@ -699,7 +811,7 @@ LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. @@ -734,23 +846,50 @@ WARNINGS = YES WARN_IF_UNDOCUMENTED = YES # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. +# potential errors in the documentation, such as documenting some parameters in +# a documented function twice, or documenting parameters that don't exist or +# using markup commands wrongly. # The default value is: YES. WARN_IF_DOC_ERROR = YES +# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete +# function parameter documentation. If set to NO, doxygen will accept that some +# parameters have no documentation without warning. +# The default value is: YES. + +WARN_IF_INCOMPLETE_DOC = YES + # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. +# value. If set to NO, doxygen will only warn about wrong parameter +# documentation, but not about the absence of documentation. If EXTRACT_ALL is +# set to YES then this flag will automatically be disabled. See also +# WARN_IF_INCOMPLETE_DOC # The default value is: NO. WARN_NO_PARAMDOC = YES +# If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about +# undocumented enumeration values. If set to NO, doxygen will accept +# undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: NO. + +WARN_IF_UNDOC_ENUM_VAL = NO + # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when -# a warning is encountered. +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS_PRINT then doxygen behaves +# like FAIL_ON_WARNINGS but in case no WARN_LOGFILE is defined doxygen will not +# write the warning messages in between other messages but write them at the end +# of a run, in case a WARN_LOGFILE is defined the warning messages will be +# besides being in the defined file also be shown at the end of a run, unless +# the WARN_LOGFILE is defined as - i.e. standard output (stdout) in that case +# the behavior will remain as with the setting FAIL_ON_WARNINGS. +# Possible values are: NO, YES, FAIL_ON_WARNINGS and FAIL_ON_WARNINGS_PRINT. # The default value is: NO. WARN_AS_ERROR = NO @@ -761,13 +900,27 @@ WARN_AS_ERROR = NO # and the warning text. Optionally the format may contain $version, which will # be replaced by the version of the file (if it could be obtained via # FILE_VERSION_FILTER) +# See also: WARN_LINE_FORMAT # The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text" +# In the $text part of the WARN_FORMAT command it is possible that a reference +# to a more specific place is given. To make it easier to jump to this place +# (outside of doxygen) the user can define a custom "cut" / "paste" string. +# Example: +# WARN_LINE_FORMAT = "'vi $file +$line'" +# See also: WARN_FORMAT +# The default value is: at line $line of file $file. + +WARN_LINE_FORMAT = "at line $line of file $file" + # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard -# error (stderr). +# error (stderr). In case the file specified cannot be opened for writing the +# warning and error messages are written to standard error. When as file - is +# specified the warning and error messages are written to standard output +# (stdout). WARN_LOGFILE = @@ -781,7 +934,6 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -# The doc/pages include additional pages of documentation INPUT = @CMAKE_BINARY_DIR@/csspp/csspp.h \ @CMAKE_SOURCE_DIR@/csspp \ @CMAKE_SOURCE_DIR@/doc/pages \ @@ -790,12 +942,23 @@ INPUT = @CMAKE_BINARY_DIR@/csspp/csspp.h \ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. +# See also: INPUT_FILE_ENCODING # The default value is: UTF-8. INPUT_ENCODING = UTF-8 +# This tag can be used to specify the character encoding of the source files +# that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify +# character encoding on a per file pattern basis. Doxygen will compare the file +# name with each pattern and apply the encoding instead of the default +# INPUT_ENCODING) if there is a match. The character encodings are a list of the +# form: pattern=encoding (like *.php=ISO-8859-1). See cfg_input_encoding +# "INPUT_ENCODING" for further information on supported encodings. + +INPUT_FILE_ENCODING = + # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and # *.h) to filter out the source-files in the directories. @@ -804,11 +967,15 @@ INPUT_ENCODING = UTF-8 # need to set EXTENSION_MAPPING for the extension otherwise the files are not # read by doxygen. # -# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, -# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, -# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cxxm, +# *.cpp, *.cppm, *.c++, *.c++m, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, +# *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, *.h++, *.ixx, *.l, *.cs, *.d, *.php, +# *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be +# provided as doxygen C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f18, *.f, *.for, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice. FILE_PATTERNS = *.c \ *.cpp \ @@ -850,10 +1017,7 @@ EXCLUDE_PATTERNS = # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* +# ANamespace::AClass, ANamespace::*Test EXCLUDE_SYMBOLS = @@ -901,6 +1065,11 @@ IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/images # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. # +# Note that doxygen will use the data processed and written to standard output +# for further processing, therefore nothing else, like debug statements or used +# commands (so in case of a Windows batch file always use @echo OFF), should be +# written to standard output. +# # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. @@ -942,6 +1111,15 @@ FILTER_SOURCE_PATTERNS = USE_MDFILE_AS_MAINPAGE = +# The Fortran standard specifies that for fixed formatted Fortran code all +# characters from position 72 are to be considered as comment. A common +# extension is to allow longer lines before the automatic comment starts. The +# setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can +# be processed before the automatic comment starts. +# Minimum value: 7, maximum value: 10000, default value: 72. + +FORTRAN_COMMENT_AFTER = 72 + #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- @@ -969,7 +1147,7 @@ INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. +# entity all documented functions referencing it will be listed. # The default value is: NO. REFERENCED_BY_RELATION = YES @@ -1001,12 +1179,12 @@ SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version +# (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: # - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file # - Make sure the INPUT points to the root of the source tree # - Run doxygen as normal # @@ -1029,16 +1207,24 @@ USE_HTAGS = NO VERBATIM_HEADERS = YES # If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the -# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the -# cost of reduced performance. This can be particularly helpful with template -# rich C++ code for which doxygen's built-in parser lacks the necessary type -# information. +# clang parser (see: +# http://clang.llvm.org/) for more accurate parsing at the cost of reduced +# performance. This can be particularly helpful with template rich C++ code for +# which doxygen's built-in parser lacks the necessary type information. # Note: The availability of this option depends on whether or not doxygen was -# generated with the -Duse-libclang=ON option for CMake. +# generated with the -Duse_libclang=ON option for CMake. # The default value is: NO. CLANG_ASSISTED_PARSING = NO +# If the CLANG_ASSISTED_PARSING tag is set to YES and the CLANG_ADD_INC_PATHS +# tag is set to YES then doxygen will add the directory of each input to the +# include path. +# The default value is: YES. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_ADD_INC_PATHS = YES + # If clang assisted parsing is enabled you can provide the compiler with command # line options that you would normally use when invoking the compiler. Note that # the include paths will already be set by doxygen for the files and directories @@ -1047,6 +1233,19 @@ CLANG_ASSISTED_PARSING = NO CLANG_OPTIONS = +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the directory containing a file called compile_commands.json. This +# file is the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the +# options used when the source files were built. This is equivalent to +# specifying the -p option to a clang tool, such as clang-check. These options +# will then be passed to the parser. Any options specified with CLANG_OPTIONS +# will be added as well. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. + +CLANG_DATABASE_PATH = + #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- @@ -1058,17 +1257,11 @@ CLANG_OPTIONS = ALPHABETICAL_INDEX = YES -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. +# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) +# that should be ignored while generating the index headers. The IGNORE_PREFIX +# tag works for classes, function and member names. The entity will be placed in +# the alphabetical list under the first letter of the entity name that remains +# after removing the prefix. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = f_ @@ -1147,7 +1340,12 @@ HTML_STYLESHEET = # Doxygen will copy the style sheet files to the output directory. # Note: The order of the extra style sheet files is of importance (e.g. the last # style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. +# list). +# Note: Since the styling of scrollbars can currently not be overruled in +# Webkit/Chromium, the styling will be left out of the default doxygen.css if +# one or more extra stylesheets have been specified. So if scrollbar +# customization is desired it has to be added explicitly. For an example see the +# documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/csspp-doc.css @@ -1162,10 +1360,23 @@ HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/csspp-doc.css HTML_EXTRA_FILES = +# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output +# should be rendered with a dark or light theme. +# Possible values are: LIGHT always generate light mode output, DARK always +# generate dark mode output, AUTO_LIGHT automatically set the mode according to +# the user preference, use light mode if no preference is set (the default), +# AUTO_DARK automatically set the mode according to the user preference, use +# dark mode if no preference is set and TOGGLE allow to user to switch between +# light and dark mode via a button. +# The default value is: AUTO_LIGHT. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE = AUTO_LIGHT + # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# this color. Hue is specified as an angle on a color-wheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. @@ -1174,7 +1385,7 @@ HTML_EXTRA_FILES = HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A +# in the HTML output. For a value of 0 the output will use gray-scales only. A # value of 255 will produce the most vivid colors. # Minimum value: 0, maximum value: 255, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1192,14 +1403,16 @@ HTML_COLORSTYLE_SAT = 100 HTML_COLORSTYLE_GAMMA = 80 -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to YES can help to show when doxygen was last run and thus if the -# documentation is up to date. -# The default value is: NO. +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_TIMESTAMP = YES +HTML_DYNAMIC_MENUS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the @@ -1209,6 +1422,13 @@ HTML_TIMESTAMP = YES HTML_DYNAMIC_SECTIONS = NO +# If the HTML_CODE_FOLDING tag is set to YES then classes and functions can be +# dynamically folded and expanded in the generated HTML source code. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_CODE_FOLDING = YES + # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries # shown in the various tree structured indices initially; the user can expand # and collapse entries dynamically later on. Doxygen will expand the tree to @@ -1224,13 +1444,14 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1244,6 +1465,13 @@ GENERATE_DOCSET = NO DOCSET_FEEDNAME = "Doxygen generated docs" +# This tag determines the URL of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDURL = + # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. @@ -1269,8 +1497,12 @@ DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. +# on Windows. In the beginning of 2021 Microsoft took the original page, with +# a.o. the download links, offline the HTML help workshop was already many years +# in maintenance mode). You can download the HTML help workshop from the web +# archives at Installation executable (see: +# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo +# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe). # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML @@ -1300,7 +1532,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). +# (YES) or that it should be included in the main .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. @@ -1327,6 +1559,16 @@ BINARY_TOC = NO TOC_EXPAND = NO +# The SITEMAP_URL tag is used to specify the full URL of the place where the +# generated documentation will be placed on the server by the user during the +# deployment of the documentation. The generated sitemap is called sitemap.xml +# and placed on the directory specified by HTML_OUTPUT. In case no SITEMAP_URL +# is specified no sitemap is generated. For information about the sitemap +# protocol see https://www.sitemaps.org +# This tag requires that the tag GENERATE_HTML is set to YES. + +SITEMAP_URL = + # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that # can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help @@ -1345,7 +1587,8 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1353,8 +1596,8 @@ QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1362,30 +1605,30 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = @@ -1428,16 +1671,28 @@ DISABLE_INDEX = NO # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the # HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. +# further fine tune the look of the index (see "Fine-tuning the output"). As an +# example, the default style sheet generated by doxygen has an example that +# shows how to put an image at the root of the tree instead of the PROJECT_NAME. +# Since the tree basically has the same information as the tab index, you could +# consider setting DISABLE_INDEX to YES when enabling this option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = NO +# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the +# FULL_SIDEBAR option determines if the side bar is limited to only the treeview +# area (value NO) or if it should extend to the full height of the window (value +# YES). Setting this to YES gives a layout similar to +# https://docs.readthedocs.io with more room for contents, but less room for the +# project logo, title, and description. If either GENERATE_TREEVIEW or +# DISABLE_INDEX is set to NO, this option has no effect. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FULL_SIDEBAR = NO + # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. # @@ -1462,6 +1717,24 @@ TREEVIEW_WIDTH = 250 EXT_LINKS_IN_WINDOW = NO +# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email +# addresses. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +OBFUSCATE_EMAILS = YES + +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML @@ -1471,19 +1744,14 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. -FORMULA_TRANSPARENT = YES +FORMULA_MACROFILE = # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering +# https://www.mathjax.org) which uses client side JavaScript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path @@ -1493,11 +1761,29 @@ FORMULA_TRANSPARENT = YES USE_MATHJAX = YES +# With MATHJAX_VERSION it is possible to specify the MathJax version to be used. +# Note that the different versions of MathJax have different requirements with +# regards to the different settings, so it is possible that also other MathJax +# settings have to be changed when switching between the different MathJax +# versions. +# Possible values are: MathJax_2 and MathJax_3. +# The default value is: MathJax_2. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_VERSION = MathJax_2 + # When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# the MathJax output. For more details about the output format see MathJax +# version 2 (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3 +# (see: +# http://docs.mathjax.org/en/latest/web/components/output.html). # Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. +# compatibility. This is the name for Mathjax version 2, for MathJax version 3 +# this will be translated into chtml), NativeMML (i.e. MathML. Only supported +# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This +# is the name for Mathjax version 3, for MathJax version 2 this will be +# translated into HTML-CSS) and SVG. # The default value is: HTML-CSS. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1510,22 +1796,29 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. +# MathJax from https://www.mathjax.org before deployment. The default value is: +# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2 +# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3 # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example +# for MathJax version 2 (see +# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions): # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# For example for MathJax version 3 (see +# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html): +# MATHJAX_EXTENSIONS = ams # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1553,7 +1846,7 @@ MATHJAX_CODEFILE = SEARCHENGINE = NO # When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. There +# implemented using a web server instead of a web client using JavaScript. There # are two flavors of web server based searching depending on the EXTERNAL_SEARCH # setting. When disabled, doxygen will generate a PHP script for searching and # an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing @@ -1572,7 +1865,8 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). +# Xapian (see: +# https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1585,8 +1879,9 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and -# Searching" for details. +# Xapian (see: +# https://xapian.org/). See the section "External Indexing and Searching" for +# details. # This tag requires that the tag SEARCHENGINE is set to YES. SEARCHENGINE_URL = @@ -1637,21 +1932,35 @@ LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. # -# Note that when enabling USE_PDFLATEX this option is only used for generating -# bitmaps for formulas in the HTML output, but not in the Makefile that is -# written to the output directory. -# The default file is: latex. +# Note that when not enabling USE_PDFLATEX the default is latex when enabling +# USE_PDFLATEX the default is pdflatex and when in the later case latex is +# chosen this is overwritten by pdflatex. For specific output languages the +# default can have been set differently, this depends on the implementation of +# the output language. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate # index for LaTeX. +# Note: This tag is used in the Makefile / make.bat. +# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file +# (.tex). # The default file is: makeindex. # This tag requires that the tag GENERATE_LATEX is set to YES. MAKEINDEX_CMD_NAME = makeindex +# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to +# generate index for LaTeX. In case there is no backslash (\) as first character +# it will be automatically added in the LaTeX code. +# Note: This tag is used in the generated output file (.tex). +# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat. +# The default value is: makeindex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_MAKEINDEX_CMD = makeindex + # If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX # documents. This may be useful for small projects and may help to save some # trees in general. @@ -1681,29 +1990,31 @@ PAPER_TYPE = a4 EXTRA_PACKAGES = -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the -# generated LaTeX document. The header should contain everything until the first -# chapter. If it is left blank doxygen will generate a standard header. See -# section "Doxygen usage" for information on how to let doxygen write the -# default header to a separate file. +# The LATEX_HEADER tag can be used to specify a user-defined LaTeX header for +# the generated LaTeX document. The header should contain everything until the +# first chapter. If it is left blank doxygen will generate a standard header. It +# is highly recommended to start with a default header using +# doxygen -w latex new_header.tex new_footer.tex new_stylesheet.sty +# and then modify the file new_header.tex. See also section "Doxygen usage" for +# information on how to generate the default header that doxygen normally uses. # -# Note: Only use a user-defined header if you know what you are doing! The -# following commands have a special meaning inside the header: $title, -# $datetime, $date, $doxygenversion, $projectname, $projectnumber, -# $projectbrief, $projectlogo. Doxygen will replace $title with the empty -# string, for the replacement values of the other commands the user is referred -# to HTML_HEADER. +# Note: Only use a user-defined header if you know what you are doing! +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. The following +# commands have a special meaning inside the header (and footer): For a +# description of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_HEADER = -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the -# generated LaTeX document. The footer should contain everything after the last -# chapter. If it is left blank doxygen will generate a standard footer. See +# The LATEX_FOOTER tag can be used to specify a user-defined LaTeX footer for +# the generated LaTeX document. The footer should contain everything after the +# last chapter. If it is left blank doxygen will generate a standard footer. See # LATEX_HEADER for more information on how to generate a default footer and what -# special commands can be used inside the footer. -# -# Note: Only use a user-defined footer if you know what you are doing! +# special commands can be used inside the footer. See also section "Doxygen +# usage" for information on how to generate the default footer that doxygen +# normally uses. Note: Only use a user-defined footer if you know what you are +# doing! # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_FOOTER = @@ -1736,18 +2047,26 @@ LATEX_EXTRA_FILES = PDF_HYPERLINKS = YES -# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate -# the PDF file directly from the LaTeX files. Set this option to YES, to get a -# higher quality PDF documentation. +# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as +# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX +# files. Set this option to YES, to get a higher quality PDF documentation. +# +# See also section LATEX_CMD_NAME for selecting the engine. # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. USE_PDFLATEX = YES -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode -# command to the generated LaTeX files. This will instruct LaTeX to keep running -# if errors occur, instead of asking the user for help. This option is also used -# when generating formulas in HTML. +# The LATEX_BATCHMODE tag signals the behavior of LaTeX in case of an error. +# Possible values are: NO same as ERROR_STOP, YES same as BATCH, BATCH In batch +# mode nothing is printed on the terminal, errors are scrolled as if is +# hit at every error; missing files that TeX tries to input or request from +# keyboard input (\read on a not open input stream) cause the job to abort, +# NON_STOP In nonstop mode the diagnostic message will appear on the terminal, +# but there is no possibility of user interaction just like in batch mode, +# SCROLL In scroll mode, TeX will stop only for missing files to input or if +# keyboard input is necessary and ERROR_STOP In errorstop mode, TeX will stop at +# each error, asking for user intervention. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1760,31 +2079,21 @@ LATEX_BATCHMODE = NO LATEX_HIDE_INDICES = NO -# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source -# code with syntax highlighting in the LaTeX output. -# -# Note that which sources are shown also depends on other settings such as -# SOURCE_BROWSER. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_SOURCE_CODE = NO - # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See -# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# https://en.wikipedia.org/wiki/BibTeX and \cite for more info. # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_BIB_STYLE = plain -# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated -# page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. -# The default value is: NO. +# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute) +# path from which the emoji images will be read. If a relative path is entered, +# it will be relative to the LATEX_OUTPUT directory. If left blank the +# LATEX_OUTPUT directory will be used. # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_TIMESTAMP = NO +LATEX_EMOJI_DIRECTORY = #--------------------------------------------------------------------------- # Configuration options related to the RTF output @@ -1825,9 +2134,9 @@ COMPACT_RTF = NO RTF_HYPERLINKS = NO -# Load stylesheet definitions from file. Syntax is similar to doxygen's config -# file, i.e. a series of assignments. You only have to provide replacements, -# missing definitions are set to their default value. +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# configuration file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. # # See also section "Doxygen usage" for information on how to generate the # default style sheet that doxygen normally uses. @@ -1836,22 +2145,12 @@ RTF_HYPERLINKS = NO RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an RTF document. Syntax is -# similar to doxygen's config file. A template extensions file can be generated -# using doxygen -e rtf extensionFile. +# similar to doxygen's configuration file. A template extensions file can be +# generated using doxygen -e rtf extensionFile. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_EXTENSIONS_FILE = -# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code -# with syntax highlighting in the RTF output. -# -# Note that which sources are shown also depends on other settings such as -# SOURCE_BROWSER. -# The default value is: NO. -# This tag requires that the tag GENERATE_RTF is set to YES. - -RTF_SOURCE_CODE = NO - #--------------------------------------------------------------------------- # Configuration options related to the man page output #--------------------------------------------------------------------------- @@ -1923,6 +2222,13 @@ XML_OUTPUT = xml XML_PROGRAMLISTING = YES +# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include +# namespace members in file scope as well, matching the HTML output. +# The default value is: NO. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_NS_MEMB_FILE_SCOPE = NO + #--------------------------------------------------------------------------- # Configuration options related to the DOCBOOK output #--------------------------------------------------------------------------- @@ -1941,27 +2247,44 @@ GENERATE_DOCBOOK = NO DOCBOOK_OUTPUT = docbook -# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the -# program listings (including syntax highlighting and cross-referencing -# information) to the DOCBOOK output. Note that enabling this will significantly -# increase the size of the DOCBOOK output. -# The default value is: NO. -# This tag requires that the tag GENERATE_DOCBOOK is set to YES. - -DOCBOOK_PROGRAMLISTING = NO - #--------------------------------------------------------------------------- # Configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sf.net) file that captures the -# structure of the code including all documentation. Note that this feature is -# still experimental and incomplete at the moment. +# AutoGen Definitions (see https://autogen.sourceforge.net/) file that captures +# the structure of the code including all documentation. Note that this feature +# is still experimental and incomplete at the moment. # The default value is: NO. GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# Configuration options related to Sqlite3 output +#--------------------------------------------------------------------------- + +# If the GENERATE_SQLITE3 tag is set to YES doxygen will generate a Sqlite3 +# database with symbols found by doxygen stored in tables. +# The default value is: NO. + +GENERATE_SQLITE3 = NO + +# The SQLITE3_OUTPUT tag is used to specify where the Sqlite3 database will be +# put. If a relative path is entered the value of OUTPUT_DIRECTORY will be put +# in front of it. +# The default directory is: sqlite3. +# This tag requires that the tag GENERATE_SQLITE3 is set to YES. + +SQLITE3_OUTPUT = sqlite3 + +# The SQLITE3_OVERWRITE_DB tag is set to YES, the existing doxygen_sqlite3.db +# database file will be recreated with each doxygen run. If set to NO, doxygen +# will warn if an a database file is already found and not modify it. +# The default value is: YES. +# This tag requires that the tag GENERATE_SQLITE3 is set to YES. + +SQLITE3_RECREATE_DB = YES + #--------------------------------------------------------------------------- # Configuration options related to the Perl module output #--------------------------------------------------------------------------- @@ -2036,7 +2359,8 @@ SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by the -# preprocessor. +# preprocessor. Note that the INCLUDE_PATH is not recursive, so the setting of +# RECURSIVE has no effect here. # This tag requires that the tag SEARCH_INCLUDES is set to YES. INCLUDE_PATH = @@ -2103,15 +2427,15 @@ TAGFILES = GENERATE_TAGFILE = -# If the ALLEXTERNALS tag is set to YES, all external class will be listed in -# the class index. If set to NO, only the inherited external classes will be -# listed. +# If the ALLEXTERNALS tag is set to YES, all external classes and namespaces +# will be listed in the class and namespace index. If set to NO, only the +# inherited external classes will be listed. # The default value is: NO. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will be +# in the topic index. If set to NO, only the current project's groups will be # listed. # The default value is: YES. @@ -2124,41 +2448,10 @@ EXTERNAL_GROUPS = YES EXTERNAL_PAGES = YES -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of 'which perl'). -# The default file (with absolute path) is: /usr/bin/perl. - -PERL_PATH = /usr/bin/perl - #--------------------------------------------------------------------------- -# Configuration options related to the dot tool +# Configuration options related to diagram generator tools #--------------------------------------------------------------------------- -# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram -# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to -# NO turns the diagrams off. Note that this option also works with HAVE_DOT -# disabled, but it is recommended to install and use dot, since it yields more -# powerful graphs. -# The default value is: YES. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see: -# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# You can include diagrams made with dia in doxygen documentation. Doxygen will -# then run dia to produce the diagram and insert it in the documentation. The -# DIA_PATH tag allows you to specify the directory where the dia binary resides. -# If left empty dia is assumed to be found in the default search path. - -DIA_PATH = - # If set to YES the inheritance and collaboration graphs will hide inheritance # and usage relations if the target is undocumented or is not a class. # The default value is: YES. @@ -2167,7 +2460,7 @@ HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz (see: -# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent +# https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO # The default value is: YES. @@ -2184,49 +2477,73 @@ HAVE_DOT = YES DOT_NUM_THREADS = 0 -# When you want a differently looking font in the dot files that doxygen -# generates you can specify the font name using DOT_FONTNAME. You need to make -# sure dot is able to find the font, which can be done by putting it in a -# standard location or by setting the DOTFONTPATH environment variable or by -# setting DOT_FONTPATH to the directory containing the font. -# The default value is: Helvetica. +# DOT_COMMON_ATTR is common attributes for nodes, edges and labels of +# subgraphs. When you want a differently looking font in the dot files that +# doxygen generates you can specify fontname, fontcolor and fontsize attributes. +# For details please see Node, +# Edge and Graph Attributes specification You need to make sure dot is able +# to find the font, which can be done by putting it in a standard location or by +# setting the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. Default graphviz fontsize is 14. +# The default value is: fontname=Helvetica,fontsize=10. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTNAME = +DOT_COMMON_ATTR = "fontname=Helvetica,fontsize=10" -# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of -# dot graphs. -# Minimum value: 4, maximum value: 24, default value: 10. +# DOT_EDGE_ATTR is concatenated with DOT_COMMON_ATTR. For elegant style you can +# add 'arrowhead=open, arrowtail=open, arrowsize=0.5'. Complete documentation about +# arrows shapes. +# The default value is: labelfontname=Helvetica,labelfontsize=10. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTSIZE = 10 +DOT_EDGE_ATTR = "labelfontname=Helvetica,labelfontsize=10" -# By default doxygen will tell dot to use the default font as specified with -# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set -# the path where dot can find it using this tag. +# DOT_NODE_ATTR is concatenated with DOT_COMMON_ATTR. For view without boxes +# around nodes set 'shape=plain' or 'shape=plaintext' Shapes specification +# The default value is: shape=box,height=0.2,width=0.4. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4" + +# You can set the path where dot can find font specified with fontname in +# DOT_COMMON_ATTR and others dot attributes. # This tag requires that the tag HAVE_DOT is set to YES. DOT_FONTPATH = -# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for -# each documented class showing the direct and indirect inheritance relations. -# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. +# If the CLASS_GRAPH tag is set to YES or GRAPH or BUILTIN then doxygen will +# generate a graph for each documented class showing the direct and indirect +# inheritance relations. In case the CLASS_GRAPH tag is set to YES or GRAPH and +# HAVE_DOT is enabled as well, then dot will be used to draw the graph. In case +# the CLASS_GRAPH tag is set to YES and HAVE_DOT is disabled or if the +# CLASS_GRAPH tag is set to BUILTIN, then the built-in generator will be used. +# If the CLASS_GRAPH tag is set to TEXT the direct and indirect inheritance +# relations will be shown as texts / links. +# Possible values are: NO, YES, TEXT, GRAPH and BUILTIN. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a # graph for each documented class showing the direct and indirect implementation # dependencies (inheritance, containment, and class references variables) of the -# class with other documented classes. +# class with other documented classes. Explicit enabling a collaboration graph, +# when COLLABORATION_GRAPH is set to NO, can be accomplished by means of the +# command \collaborationgraph. Disabling a collaboration graph can be +# accomplished by means of the command \hidecollaborationgraph. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for -# groups, showing the direct groups dependencies. +# groups, showing the direct groups dependencies. Explicit enabling a group +# dependency graph, when GROUP_GRAPHS is set to NO, can be accomplished by means +# of the command \groupgraph. Disabling a directory graph can be accomplished by +# means of the command \hidegroupgraph. See also the chapter Grouping in the +# manual. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2249,10 +2566,32 @@ UML_LOOK = NO # but if the number exceeds 15, the total amount of fields shown is limited to # 10. # Minimum value: 0, maximum value: 100, default value: 10. -# This tag requires that the tag HAVE_DOT is set to YES. +# This tag requires that the tag UML_LOOK is set to YES. UML_LIMIT_NUM_FIELDS = 10 +# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and +# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS +# tag is set to YES, doxygen will add type and arguments for attributes and +# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen +# will not generate fields with class member information in the UML graphs. The +# class diagrams will look similar to the default class diagrams but using UML +# notation for the relationships. +# Possible values are: NO, YES and NONE. +# The default value is: NO. +# This tag requires that the tag UML_LOOK is set to YES. + +DOT_UML_DETAILS = NO + +# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters +# to display on a single line. If the actual line length exceeds this threshold +# significantly it will wrapped across multiple lines. Some heuristics are apply +# to avoid ugly line breaks. +# Minimum value: 0, maximum value: 1000, default value: 17. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_WRAP_THRESHOLD = 17 + # If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and # collaboration graphs will show the relations between templates and their # instances. @@ -2264,7 +2603,9 @@ TEMPLATE_RELATIONS = NO # If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to # YES then doxygen will generate a graph for each documented file showing the # direct and indirect include dependencies of the file with other documented -# files. +# files. Explicit enabling an include graph, when INCLUDE_GRAPH is is set to NO, +# can be accomplished by means of the command \includegraph. Disabling an +# include graph can be accomplished by means of the command \hideincludegraph. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2273,7 +2614,10 @@ INCLUDE_GRAPH = YES # If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are # set to YES then doxygen will generate a graph for each documented file showing # the direct and indirect include dependencies of the file with other documented -# files. +# files. Explicit enabling an included by graph, when INCLUDED_BY_GRAPH is set +# to NO, can be accomplished by means of the command \includedbygraph. Disabling +# an included by graph can be accomplished by means of the command +# \hideincludedbygraph. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2313,23 +2657,32 @@ GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the # dependencies a directory has on other directories in a graphical way. The # dependency relations are determined by the #include relations between the -# files in the directories. +# files in the directories. Explicit enabling a directory graph, when +# DIRECTORY_GRAPH is set to NO, can be accomplished by means of the command +# \directorygraph. Disabling a directory graph can be accomplished by means of +# the command \hidedirectorygraph. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. DIRECTORY_GRAPH = YES +# The DIR_GRAPH_MAX_DEPTH tag can be used to limit the maximum number of levels +# of child directories generated in directory dependency graphs by dot. +# Minimum value: 1, maximum value: 25, default value: 1. +# This tag requires that the tag DIRECTORY_GRAPH is set to YES. + +DIR_GRAPH_MAX_DEPTH = 1 + # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: -# http://www.graphviz.org/)). +# https://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). -# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd, -# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo, -# gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd, png:cairo, -# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and +# Possible values are: png, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, +# gif, gif:cairo, gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd, +# png:cairo, png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and # png:gdiplus:gdiplus. # The default value is: png. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2361,11 +2714,12 @@ DOT_PATH = DOTFILE_DIRS = -# The MSCFILE_DIRS tag can be used to specify one or more directories that -# contain msc files that are included in the documentation (see the \mscfile -# command). +# You can include diagrams made with dia in doxygen documentation. Doxygen will +# then run dia to produce the diagram and insert it in the documentation. The +# DIA_PATH tag allows you to specify the directory where the dia binary resides. +# If left empty dia is assumed to be found in the default search path. -MSCFILE_DIRS = +DIA_PATH = # The DIAFILE_DIRS tag can be used to specify one or more directories that # contain dia files that are included in the documentation (see the \diafile @@ -2374,10 +2728,10 @@ MSCFILE_DIRS = DIAFILE_DIRS = # When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the -# path where java can find the plantuml.jar file. If left blank, it is assumed -# PlantUML is not used or called during a preprocessing step. Doxygen will -# generate a warning when it encounters a \startuml command in this case and -# will not generate output for the diagram. +# path where java can find the plantuml.jar file or to the filename of jar file +# to be used. If left blank, it is assumed PlantUML is not used or called during +# a preprocessing step. Doxygen will generate a warning when it encounters a +# \startuml command in this case and will not generate output for the diagram. PLANTUML_JAR_PATH = @@ -2415,18 +2769,6 @@ DOT_GRAPH_MAX_NODES = 150 MAX_DOT_GRAPH_DEPTH = 0 -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not seem -# to support this out of the box. -# -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_TRANSPARENT = NO - # Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) support @@ -2439,14 +2781,34 @@ DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page # explaining the meaning of the various boxes and arrows in the dot generated # graphs. +# Note: This tag requires that UML_LOOK isn't set, i.e. the doxygen internal +# graphical representation for inheritance and collaboration diagrams is used. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. GENERATE_LEGEND = YES -# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot +# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate # files that are used to generate the various graphs. +# +# Note: This setting is not only used for dot files but also for msc temporary +# files. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. DOT_CLEANUP = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. If the MSCGEN_TOOL tag is left empty (the default), then doxygen will +# use a built-in version of mscgen tool to produce the charts. Alternatively, +# the MSCGEN_TOOL tag can also specify the name an external tool. For instance, +# specifying prog as the value, doxygen will call the tool as prog -T +# -o . The external tool should support +# output file formats "png", "eps", "svg", and "ismap". + +MSCGEN_TOOL = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the \mscfile +# command). + +MSCFILE_DIRS = From 93fd434ac301b7f9f772cafedd957b43b08cd741 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sun, 3 Aug 2025 22:50:54 -0700 Subject: [PATCH 63/64] Small tweak in the docs. --- doc/pages/compiler-expression-by-type.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/pages/compiler-expression-by-type.cpp b/doc/pages/compiler-expression-by-type.cpp index affa522..e3865bc 100644 --- a/doc/pages/compiler-expression-by-type.cpp +++ b/doc/pages/compiler-expression-by-type.cpp @@ -343,7 +343,7 @@ * Similarly, you can convert a value to another as in: * * \code{.scss} - * 15px * 0.33em\/px = 5em + * 15px * 0.33em/px = 5em * * or * From 6ed8536e6ce282ce6231e5605dc7e79a984ee490 Mon Sep 17 00:00:00 2001 From: AlexisWilke Date: Sun, 31 Aug 2025 08:31:20 -0700 Subject: [PATCH 64/64] Small doxy clean ups. --- cmake/CSSPPConfig.cmake.in | 23 ++--------------------- doc/CMakeLists.txt | 14 ++++++++------ doc/csspp-doc.css | 8 ++++++++ doc/csspp.doxy.in | 10 +++++----- 4 files changed, 23 insertions(+), 32 deletions(-) diff --git a/cmake/CSSPPConfig.cmake.in b/cmake/CSSPPConfig.cmake.in index 5dc91d2..b563ee9 100644 --- a/cmake/CSSPPConfig.cmake.in +++ b/cmake/CSSPPConfig.cmake.in @@ -3,27 +3,9 @@ # Once done this will define # # CSSPP_FOUND - System has the csspp library -# CSSPP_INCLUDE_DIR - The csspp include directories -# CSSPP_LIBRARY - The libraries needed to use libcsspp +# CSSPP_INCLUDE_DIRS - The csspp include directories +# CSSPP_LIBRARIES - The libraries needed to use libcsspp # CSSPP_DEFINITIONS - Compiler switches required for linking against csspp -# -# License: -# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# # Version set(CSSPP_VERSION_MAJOR @CSSPP_VERSION_MAJOR@) @@ -36,7 +18,6 @@ set(CSSPP_CONFIG_DIR /usr/lib/csspp) find_path(CSSPP_INCLUDE_DIR csspp/csspp.h HINTS $ENV{CSSPP_INCLUDE_DIR} - PATH_SUFFIXES csspp ) find_library(CSSPP_LIBRARY csspp diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 8764e96..1ba7ef2 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -3,9 +3,9 @@ # https://snapwebsites.org/project/csspp # contact@m2osw.com # -# This program is free software; you can redistribute it and/or modify +# This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, @@ -13,13 +13,15 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + ## ## Documentation ## +project(csspp-documentation) + find_package(SnapDoxygen) AddDoxygenTarget( csspp @@ -76,7 +78,7 @@ execute_process( ) # Win32 date would use something like this -# execute_process(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${RESULT}) +# execute_process(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE NOW) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/front-page.html.in diff --git a/doc/csspp-doc.css b/doc/csspp-doc.css index 751b1a1..12ad9b4 100644 --- a/doc/csspp-doc.css +++ b/doc/csspp-doc.css @@ -1,3 +1,11 @@ +/* additional stylesheet for doxygen documentation */ + .directory td.entry { white-space: normal; } + +#projectlogo img +{ + max-width: 200px; + max-height: 55px; +} diff --git a/doc/csspp.doxy.in b/doc/csspp.doxy.in index 84095e8..d253067 100644 --- a/doc/csspp.doxy.in +++ b/doc/csspp.doxy.in @@ -42,7 +42,7 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = csspp +PROJECT_NAME = @TARGET_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version @@ -61,7 +61,7 @@ PROJECT_BRIEF = "CSS Preprocessor" # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # the logo to the output directory. -PROJECT_LOGO = +PROJECT_LOGO = @CMAKE_CURRENT_SOURCE_DIR@/images/@TARGET_NAME@-logo.jpg # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is @@ -934,8 +934,8 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = @CMAKE_BINARY_DIR@/csspp/csspp.h \ - @CMAKE_SOURCE_DIR@/csspp \ +INPUT = @CMAKE_BINARY_DIR@/@TARGET_NAME@/csspp.h \ + @CMAKE_SOURCE_DIR@/@TARGET_NAME@ \ @CMAKE_SOURCE_DIR@/doc/pages \ @CMAKE_SOURCE_DIR@/tools @@ -1348,7 +1348,7 @@ HTML_STYLESHEET = # documentation. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/csspp-doc.css +HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/@TARGET_NAME@-doc.css # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note