From 7e3a8088f99400ba68afbe7e846de1403e8faa00 Mon Sep 17 00:00:00 2001 From: Heliozoa Date: Fri, 1 Oct 2021 11:57:15 +0300 Subject: [PATCH 1/5] Update for check 0.15 compatibility --- Gemfile.lock | 11 +++++++---- tmc-check.c | 4 ++-- tmc-check.h | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 36df939..9ec8334 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,12 +1,15 @@ GEM remote: http://rubygems.org/ specs: - mini_portile (0.6.0) - nokogiri (1.6.3.1) - mini_portile (= 0.6.0) + nokogiri (1.12.5-x86_64-linux) + racc (~> 1.4) + racc (1.5.2) PLATFORMS - ruby + x86_64-linux DEPENDENCIES nokogiri + +BUNDLED WITH + 2.2.28 diff --git a/tmc-check.c b/tmc-check.c index 5bac1fb..bb6e08a 100644 --- a/tmc-check.c +++ b/tmc-check.c @@ -51,11 +51,11 @@ void tmc_set_tcase_points(TCase *tc, const char *tc_name, const char *points) parse_points(points, &all_points); } -void _tmc_register_test(Suite *s, TFun tf, const char *fname, const char *points) +void _tmc_register_test(Suite *s, TTest *tt, const char *fname, const char *points) { TCase *tc = tcase_create(fname); tmc_set_tcase_points(tc, fname, points); - _tcase_add_test(tc, tf, fname, 0, 0, 0, 1); + _tcase_add_test(tc, tt, 0, 0, 0, 1); suite_add_tcase(s, tc); } diff --git a/tmc-check.h b/tmc-check.h index 4f8c9ac..021a197 100644 --- a/tmc-check.h +++ b/tmc-check.h @@ -16,8 +16,8 @@ Suite* tmc_suite_create(const char *name, const char *points); * * One can also register the test function normally and then call tmc_set_tcase_points. */ -#define tmc_register_test(suite, tf, points) _tmc_register_test((suite), (tf), "" # tf, points) -void _tmc_register_test(Suite *s, TFun tf, const char *fname, const char *points); +#define tmc_register_test(suite, tt, points) _tmc_register_test((suite), (tt), "" # tt, points) +void _tmc_register_test(Suite *s, TTest *tt, const char *fname, const char *points); /** From 1d83bf4ad311b56a8340397240234c05efe06e50 Mon Sep 17 00:00:00 2001 From: Heliozoa Date: Fri, 1 Oct 2021 12:02:03 +0300 Subject: [PATCH 2/5] Update instructions --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e3b9929..1cef0f4 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ An addon to [Check](http://check.sourceforge.net/) to support C-language tests i Read the header and the example file for documentation. +- Install [Ruby](https://www.ruby-lang.org/en/downloads/) and [Bundler](https://bundler.io/). - Compile with `make`. - Install with `make install PREFIX=/usr` (defaults to `/usr/local`). - Use `make run-example` to run the example. Requires `make install` to be done first. From f59c84324ee1dd681cb327885ee93ab6c802ba5a Mon Sep 17 00:00:00 2001 From: Heliozoa Date: Fri, 1 Oct 2021 12:11:02 +0300 Subject: [PATCH 3/5] Fix error in example and missing instructions --- README.md | 2 +- tmc-check.c | 2 +- tmc-check.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1cef0f4..f5b3463 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ An addon to [Check](http://check.sourceforge.net/) to support C-language tests i Read the header and the example file for documentation. -- Install [Ruby](https://www.ruby-lang.org/en/downloads/) and [Bundler](https://bundler.io/). +- Install [Ruby](https://www.ruby-lang.org/en/downloads/), [Bundler](https://bundler.io/) and [Nokogiri](https://nokogiri.org/#installation). - Compile with `make`. - Install with `make install PREFIX=/usr` (defaults to `/usr/local`). - Use `make run-example` to run the example. Requires `make install` to be done first. diff --git a/tmc-check.c b/tmc-check.c index bb6e08a..8fdf729 100644 --- a/tmc-check.c +++ b/tmc-check.c @@ -51,7 +51,7 @@ void tmc_set_tcase_points(TCase *tc, const char *tc_name, const char *points) parse_points(points, &all_points); } -void _tmc_register_test(Suite *s, TTest *tt, const char *fname, const char *points) +void _tmc_register_test(Suite *s, const TTest *tt, const char *fname, const char *points) { TCase *tc = tcase_create(fname); tmc_set_tcase_points(tc, fname, points); diff --git a/tmc-check.h b/tmc-check.h index 021a197..0e4b080 100644 --- a/tmc-check.h +++ b/tmc-check.h @@ -17,7 +17,7 @@ Suite* tmc_suite_create(const char *name, const char *points); * One can also register the test function normally and then call tmc_set_tcase_points. */ #define tmc_register_test(suite, tt, points) _tmc_register_test((suite), (tt), "" # tt, points) -void _tmc_register_test(Suite *s, TTest *tt, const char *fname, const char *points); +void _tmc_register_test(Suite *s, const TTest *tt, const char *fname, const char *points); /** From 9e595467e9649bfe483d00575c0dc13672944f45 Mon Sep 17 00:00:00 2001 From: Heliozoa Date: Fri, 1 Oct 2021 13:15:18 +0300 Subject: [PATCH 4/5] Make backwards compatible with <0.15 --- tmc-check.c | 10 ++++++++++ tmc-check.h | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/tmc-check.c b/tmc-check.c index 8fdf729..1d55d2c 100644 --- a/tmc-check.c +++ b/tmc-check.c @@ -51,6 +51,15 @@ void tmc_set_tcase_points(TCase *tc, const char *tc_name, const char *points) parse_points(points, &all_points); } +#if CHECK_MINOR_VERSION < 15 +void _tmc_register_test(Suite *s, TFun tf, const char *fname, const char *points) +{ + TCase *tc = tcase_create(fname); + tmc_set_tcase_points(tc, fname, points); + _tcase_add_test(tc, tf, tname, 0, 0, 0, 1); + suite_add_tcase(s, tc); +} +#else void _tmc_register_test(Suite *s, const TTest *tt, const char *fname, const char *points) { TCase *tc = tcase_create(fname); @@ -58,6 +67,7 @@ void _tmc_register_test(Suite *s, const TTest *tt, const char *fname, const char _tcase_add_test(tc, tt, 0, 0, 0, 1); suite_add_tcase(s, tc); } +#endif void tmc_set_suite_points(Suite *s, const char *s_name, const char *points) { diff --git a/tmc-check.h b/tmc-check.h index 0e4b080..1f52f35 100644 --- a/tmc-check.h +++ b/tmc-check.h @@ -16,8 +16,13 @@ Suite* tmc_suite_create(const char *name, const char *points); * * One can also register the test function normally and then call tmc_set_tcase_points. */ +#if CHECK_MINOR_VERSION < 15 +#define tmc_register_test(suite, tf, points) _tmc_register_test((suite), (tf), "" # tf, points) +void _tmc_register_test(Suite *s, TFun tf, const char *fname, const char *points); +#else #define tmc_register_test(suite, tt, points) _tmc_register_test((suite), (tt), "" # tt, points) void _tmc_register_test(Suite *s, const TTest *tt, const char *fname, const char *points); +#endif /** From 10231cdb25c62aa507079451d217628983f017e4 Mon Sep 17 00:00:00 2001 From: Heliozoa Date: Fri, 1 Oct 2021 13:17:16 +0300 Subject: [PATCH 5/5] fix typo --- tmc-check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmc-check.c b/tmc-check.c index 1d55d2c..e11553d 100644 --- a/tmc-check.c +++ b/tmc-check.c @@ -56,7 +56,7 @@ void _tmc_register_test(Suite *s, TFun tf, const char *fname, const char *points { TCase *tc = tcase_create(fname); tmc_set_tcase_points(tc, fname, points); - _tcase_add_test(tc, tf, tname, 0, 0, 0, 1); + _tcase_add_test(tc, tf, fname, 0, 0, 0, 1); suite_add_tcase(s, tc); } #else