Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

g.proj: fix wkt output on Windows #3306

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion general/g.proj/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#include <grass/glocale.h>
#include <grass/config.h>

#ifdef HAVE_OGR
#include <cpl_csv.h>
#endif

#include "local_proto.h"

static int check_xy(int shell);
Expand Down Expand Up @@ -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"));
Expand Down
27 changes: 27 additions & 0 deletions general/g.proj/testsuite/test_g_proj.py
Original file line number Diff line number Diff line change
@@ -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()
Loading