diff options
Diffstat (limited to 'tests/cpp-unit-tests/IcedTeaPluginUtilsTest.cc')
-rw-r--r-- | tests/cpp-unit-tests/IcedTeaPluginUtilsTest.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/cpp-unit-tests/IcedTeaPluginUtilsTest.cc b/tests/cpp-unit-tests/IcedTeaPluginUtilsTest.cc index e8e9289..7df0a1e 100644 --- a/tests/cpp-unit-tests/IcedTeaPluginUtilsTest.cc +++ b/tests/cpp-unit-tests/IcedTeaPluginUtilsTest.cc @@ -34,15 +34,16 @@ obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ +#include <fstream> #include <UnitTest++.h> #include <npapi.h> #include "browser_mock.h" +#include "MemoryLeakDetector.h" #include "IcedTeaPluginUtils.h" #include "IcedTeaNPPlugin.h" -#include <fstream> TEST(NPVariantAsString) { NPVariant var; @@ -84,6 +85,17 @@ TEST(NPVariantStringCopy) { CHECK_EQUAL(0, browsermock_unfreed_allocations()); } +TEST(NPIdentifierAsString) { + // NB: Mocked definition of 'utf8fromidentifier' simply reads NPIdentifier as a char* string. + const char test_string[] = "foobar"; + MemoryLeakDetector leak_detector; + /* Ensure destruction */{ + std::string str = IcedTeaPluginUtilities::NPIdentifierAsString((NPIdentifier)test_string); + CHECK_EQUAL(test_string, str); + } + CHECK_EQUAL(0, leak_detector.memory_leaks()); +} + TEST(trim) { std::string toBeTrimmed = std::string(" testX "); IcedTeaPluginUtilities::trim (toBeTrimmed); |