summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/GenerateExportHeader/libstatic
diff options
context:
space:
mode:
authorMatthew Woehlke <matthew.woehlke@kitware.com>2016-09-02 20:53:34 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-12 14:29:20 (GMT)
commit612d6f29f8743ec100f135aed55d0920b3ea9fda (patch)
tree1fe4fccd5a9db03c4c178920958001cf99145462 /Tests/RunCMake/GenerateExportHeader/libstatic
parentce76abb4c49a85d491a99318637c6e9e37729f6e (diff)
downloadCMake-612d6f29f8743ec100f135aed55d0920b3ea9fda.zip
CMake-612d6f29f8743ec100f135aed55d0920b3ea9fda.tar.gz
CMake-612d6f29f8743ec100f135aed55d0920b3ea9fda.tar.bz2
Tests: Refactor GenerateExportHeader test code
Refactor the library code used in the GenerateExportHeader test to use an improved naming convention that more directly identifies what it being tested, making use of namespaces to avoid possible symbol collisions. This also eliminates duplicate cases such as `libshared()` and `libshared_not_exported()` which had the same decoration, and adds consistent pairings of <name>_EXPORT and <name>_DEPRECATED_EXPORT which were missing previously. The data tests from the previous commit are also added to `libstatic` and `libshared_and_static` for consistency. Note that there are no exported members of exported classes, as these are not allowed on Windows.
Diffstat (limited to 'Tests/RunCMake/GenerateExportHeader/libstatic')
-rw-r--r--Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp68
-rw-r--r--Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h75
2 files changed, 100 insertions, 43 deletions
diff --git a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp
index 89381af..e1d1255 100644
--- a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp
+++ b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp
@@ -1,97 +1,125 @@
-
#include "libstatic.h"
-int Libstatic::libstatic() const
+int libstatic::Class::method() const
{
return 0;
}
-int Libstatic::libstatic_exported() const
+int libstatic::Class::method_exported() const
{
return 0;
}
-int Libstatic::libstatic_deprecated() const
+int libstatic::Class::method_deprecated() const
{
return 0;
}
-int Libstatic::libstatic_not_exported() const
+int libstatic::Class::method_deprecated_exported() const
{
return 0;
}
-int Libstatic::libstatic_excluded() const
+int libstatic::Class::method_excluded() const
{
return 0;
}
-int LibstaticNotExported::libstatic() const
+int const libstatic::Class::data = 1;
+
+int const libstatic::Class::data_exported = 1;
+
+int const libstatic::Class::data_excluded = 1;
+
+int libstatic::ExportedClass::method() const
{
return 0;
}
-int LibstaticNotExported::libstatic_exported() const
+int libstatic::ExportedClass::method_exported() const
{
return 0;
}
-int LibstaticNotExported::libstatic_deprecated() const
+int libstatic::ExportedClass::method_deprecated() const
{
return 0;
}
-int LibstaticNotExported::libstatic_not_exported() const
+int libstatic::ExportedClass::method_deprecated_exported() const
{
return 0;
}
-int LibstaticNotExported::libstatic_excluded() const
+int libstatic::ExportedClass::method_excluded() const
{
return 0;
}
-int LibstaticExcluded::libstatic() const
+int const libstatic::ExportedClass::data = 1;
+
+int const libstatic::ExportedClass::data_exported = 1;
+
+int const libstatic::ExportedClass::data_excluded = 1;
+
+int libstatic::ExcludedClass::method() const
{
return 0;
}
-int LibstaticExcluded::libstatic_exported() const
+int libstatic::ExcludedClass::method_exported() const
{
return 0;
}
-int LibstaticExcluded::libstatic_deprecated() const
+int libstatic::ExcludedClass::method_deprecated() const
{
return 0;
}
-int LibstaticExcluded::libstatic_not_exported() const
+int libstatic::ExcludedClass::method_deprecated_exported() const
{
return 0;
}
-int LibstaticExcluded::libstatic_excluded() const
+int libstatic::ExcludedClass::method_excluded() const
{
return 0;
}
-int libstatic_exported()
+int const libstatic::ExcludedClass::data = 1;
+
+int const libstatic::ExcludedClass::data_exported = 1;
+
+int const libstatic::ExcludedClass::data_excluded = 1;
+
+int libstatic::function()
+{
+ return 0;
+}
+
+int libstatic::function_exported()
{
return 0;
}
-int libstatic_deprecated()
+int libstatic::function_deprecated()
{
return 0;
}
-int libstatic_not_exported()
+int libstatic::function_deprecated_exported()
{
return 0;
}
-int libstatic_excluded()
+int libstatic::function_excluded()
{
return 0;
}
+
+int const libstatic::data = 1;
+
+int const libstatic::data_exported = 1;
+
+int const libstatic::data_excluded = 1;
diff --git a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h
index 6072d9b..1017e12 100644
--- a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h
+++ b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h
@@ -1,57 +1,86 @@
-
#ifndef LIBSTATIC_H
#define LIBSTATIC_H
#include "libstatic_export.h"
-class LIBSTATIC_EXPORT Libstatic
+namespace libstatic {
+
+class Class
{
public:
- int libstatic() const;
+ int method() const;
+
+ int LIBSTATIC_EXPORT method_exported() const;
+
+ int LIBSTATIC_DEPRECATED method_deprecated() const;
- int libstatic_exported() const;
+ int LIBSTATIC_DEPRECATED_EXPORT method_deprecated_exported() const;
- int LIBSTATIC_DEPRECATED libstatic_deprecated() const;
+ int LIBSTATIC_NO_EXPORT method_excluded() const;
- int libstatic_not_exported() const;
+ static int const data;
- int LIBSTATIC_NO_EXPORT libstatic_excluded() const;
+ static int const LIBSTATIC_EXPORT data_exported;
+
+ static int const LIBSTATIC_NO_EXPORT data_excluded;
};
-class LibstaticNotExported
+class LIBSTATIC_EXPORT ExportedClass
{
public:
- int libstatic() const;
+ int method() const;
+
+ int LIBSTATIC_EXPORT method_exported() const;
+
+ int LIBSTATIC_DEPRECATED method_deprecated() const;
+
+ int LIBSTATIC_DEPRECATED_EXPORT method_deprecated_exported() const;
- int LIBSTATIC_EXPORT libstatic_exported() const;
+ int LIBSTATIC_NO_EXPORT method_excluded() const;
- int LIBSTATIC_DEPRECATED libstatic_deprecated() const;
+ static int const data;
- int libstatic_not_exported() const;
+ static int const LIBSTATIC_EXPORT data_exported;
- int LIBSTATIC_NO_EXPORT libstatic_excluded() const;
+ static int const LIBSTATIC_NO_EXPORT data_excluded;
};
-class LIBSTATIC_NO_EXPORT LibstaticExcluded
+class LIBSTATIC_NO_EXPORT ExcludedClass
{
public:
- int libstatic() const;
+ int method() const;
- int LIBSTATIC_EXPORT libstatic_exported() const;
+ int LIBSTATIC_EXPORT method_exported() const;
- int LIBSTATIC_DEPRECATED libstatic_deprecated() const;
+ int LIBSTATIC_DEPRECATED method_deprecated() const;
- int libstatic_not_exported() const;
+ int LIBSTATIC_DEPRECATED_EXPORT method_deprecated_exported() const;
- int LIBSTATIC_NO_EXPORT libstatic_excluded() const;
+ int LIBSTATIC_NO_EXPORT method_excluded() const;
+
+ static int const data;
+
+ static int const LIBSTATIC_EXPORT data_exported;
+
+ static int const LIBSTATIC_NO_EXPORT data_excluded;
};
-LIBSTATIC_EXPORT int libstatic_exported();
+int function();
+
+int LIBSTATIC_EXPORT function_exported();
+
+int LIBSTATIC_DEPRECATED function_deprecated();
+
+int LIBSTATIC_DEPRECATED_EXPORT function_deprecated_exported();
+
+int LIBSTATIC_NO_EXPORT function_excluded();
+
+extern int const data;
-LIBSTATIC_DEPRECATED_EXPORT int libstatic_deprecated();
+extern int const LIBSTATIC_EXPORT data_exported;
-int libstatic_not_exported();
+extern int const LIBSTATIC_NO_EXPORT data_excluded;
-int LIBSTATIC_NO_EXPORT libstatic_excluded();
+} // namespace libstatic
#endif