From 485261120307d4669926c3d398b6fab4bc9ce65e Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Fri, 27 Dec 2019 13:00:02 -0500 Subject: [PATCH] Move tests, examples --- .../examples => examples}/SampleClass.h | 0 .../examples => examples}/readSampleClass.py | 14 ++++++++------ run_tests.sh | 2 +- {CppHeaderParser/test => test}/LineNumTest.h | 0 {CppHeaderParser/test => test}/TestSampleClass.h | 0 .../test => test}/test_CppHeaderParser.py | 0 6 files changed, 9 insertions(+), 7 deletions(-) rename {CppHeaderParser/examples => examples}/SampleClass.h (100%) rename {CppHeaderParser/examples => examples}/readSampleClass.py (85%) rename {CppHeaderParser/test => test}/LineNumTest.h (100%) rename {CppHeaderParser/test => test}/TestSampleClass.h (100%) rename {CppHeaderParser/test => test}/test_CppHeaderParser.py (100%) diff --git a/CppHeaderParser/examples/SampleClass.h b/examples/SampleClass.h similarity index 100% rename from CppHeaderParser/examples/SampleClass.h rename to examples/SampleClass.h diff --git a/CppHeaderParser/examples/readSampleClass.py b/examples/readSampleClass.py similarity index 85% rename from CppHeaderParser/examples/readSampleClass.py rename to examples/readSampleClass.py index 35d4ac4..1b9e9be 100755 --- a/CppHeaderParser/examples/readSampleClass.py +++ b/examples/readSampleClass.py @@ -1,12 +1,13 @@ -#!/usr/bin/python +#!/usr/bin/env python +import pprint import sys sys.path = ["../"] + sys.path -import CppHeaderParser +from CppHeaderParser import CppHeader, CppParseError try: - cppHeader = CppHeaderParser.CppHeader("SampleClass.h") -except CppHeaderParser.CppParseError as e: + cppHeader = CppHeader("SampleClass.h") +except CppParseError as e: print(e) sys.exit(1) @@ -19,7 +20,8 @@ 0 ] # get meth3 meth3ParamTypes = [t["type"] for t in meth3["parameters"]] # get meth3s parameters -print("Parameter Types for public method meth3 %s" % (meth3ParamTypes)) +print("Parameter Types for public method meth3") +pprint.pprint(meth3ParamTypes) print("\nReturn type for meth1:") print(cppHeader.classes["SampleClass"]["methods"]["public"][1]["rtnType"]) @@ -28,7 +30,7 @@ print(cppHeader.classes["SampleClass"]["methods"]["public"][2]["doxygen"]) print("\nParameters for meth3:") -print(cppHeader.classes["SampleClass"]["methods"]["public"][3]["parameters"]) +pprint.pprint(cppHeader.classes["SampleClass"]["methods"]["public"][3]["parameters"]) print("\nDoxygen for meth4:") print(cppHeader.classes["SampleClass"]["methods"]["public"][4]["doxygen"]) diff --git a/run_tests.sh b/run_tests.sh index ff74e60..83b59b6 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,4 +1,4 @@ #!/bin/sh -e -cd CppHeaderParser/test/ +cd test/ python test_CppHeaderParser.py diff --git a/CppHeaderParser/test/LineNumTest.h b/test/LineNumTest.h similarity index 100% rename from CppHeaderParser/test/LineNumTest.h rename to test/LineNumTest.h diff --git a/CppHeaderParser/test/TestSampleClass.h b/test/TestSampleClass.h similarity index 100% rename from CppHeaderParser/test/TestSampleClass.h rename to test/TestSampleClass.h diff --git a/CppHeaderParser/test/test_CppHeaderParser.py b/test/test_CppHeaderParser.py similarity index 100% rename from CppHeaderParser/test/test_CppHeaderParser.py rename to test/test_CppHeaderParser.py