From 3dce67d2f0ef3f6132ddedebfdc79a7a17168dcb Mon Sep 17 00:00:00 2001 From: Anna Petrasova Date: Thu, 14 Dec 2023 17:24:14 -0500 Subject: [PATCH 1/2] g.proj: add test of g.proj -w --- general/g.proj/testsuite/test_g_proj.py | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 general/g.proj/testsuite/test_g_proj.py diff --git a/general/g.proj/testsuite/test_g_proj.py b/general/g.proj/testsuite/test_g_proj.py new file mode 100644 index 00000000000..4ef67e5781b --- /dev/null +++ b/general/g.proj/testsuite/test_g_proj.py @@ -0,0 +1,27 @@ +"""g.proj tests + +(C) 2023 by the GRASS Development Team +This program is free software under the GNU General Public +License (>=v2). Read the file COPYING that comes with GRASS +for details. + +:author: Anna Petrasova +""" + +from grass.gunittest.case import TestCase +from grass.gunittest.main import test +from grass.gunittest.gmodules import SimpleModule + + +class GProjWKTTestCase(TestCase): + """Test g.proj with WKT output""" + + def test_wkt_output(self): + """Test if g.proj returns WKT""" + module = SimpleModule("g.proj", flags="w") + self.assertModule(module) + self.assertIn("PROJCRS", module.outputs.stdout) + + +if __name__ == "__main__": + test() From 8ab8e5e7461f52ddce0abe0bd275eddfea5c6da3 Mon Sep 17 00:00:00 2001 From: Anna Petrasova Date: Fri, 15 Dec 2023 10:31:18 -0500 Subject: [PATCH 2/2] attempt to fix g.proj -w on windows --- general/g.proj/output.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/general/g.proj/output.c b/general/g.proj/output.c index 365578ab527..33b7b6042d9 100644 --- a/general/g.proj/output.c +++ b/general/g.proj/output.c @@ -22,6 +22,10 @@ #include #include +#ifdef HAVE_OGR +#include +#endif + #include "local_proto.h" static int check_xy(int shell); @@ -274,7 +278,7 @@ void print_wkt(int esristyle, int dontprettify) if (outwkt != NULL) { fprintf(stdout, "%s\n", outwkt); - G_free(outwkt); + CPLFree(outwkt); } else G_warning(_("Unable to convert to WKT"));