From 9d7cd404cc2d09c82b65be4828be0ac74eca20a7 Mon Sep 17 00:00:00 2001
From: gcontini <1121667+gcontini@users.noreply.github.com>
Date: 周三, 01 1月 2020 20:26:43 +0800
Subject: [PATCH] cleanup & new api

---
 test/library/LicenseLocator_test.cpp |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/test/library/LicenseLocator_test.cpp b/test/library/LicenseLocator_test.cpp
index 6c83fc0..65c225a 100644
--- a/test/library/LicenseLocator_test.cpp
+++ b/test/library/LicenseLocator_test.cpp
@@ -1,10 +1,11 @@
 #define BOOST_TEST_MODULE "test_license_locator"
+#define __STDC_WANT_LIB_EXT1__ 1
+#include <string.h>
 
 #include <iostream>
 #include <iterator>
 #include <cstdio>
 #include <fstream>
-#include <string>
 #include <vector>
 #include <boost/filesystem.hpp>
 #include <boost/optional.hpp>
@@ -88,13 +89,14 @@
 
 BOOST_AUTO_TEST_CASE(external_definition) {
 	// an application can define multiple license locations separated by ';'
-	const char *applicationDefinedString = MOCK_LICENSE ";/this/one/doesnt/exist";
+	string applicationDefinedString = MOCK_LICENSE ";/this/one/doesnt/exist";
 
 	// read test license
 	std::ifstream src(MOCK_LICENSE, std::ios::binary);
 	std::string referenceContent((std::istreambuf_iterator<char>(src)), std::istreambuf_iterator<char>());
 	license::EventRegistry registry;
-	const LicenseLocation licLocation = {applicationDefinedString, nullptr};
+	LicenseLocation licLocation = {LICENSE_PATH};
+	std::copy(applicationDefinedString.begin(), applicationDefinedString.end(), licLocation.licenseData);
 	ExternalDefinition externalDefinition(&licLocation);
 	vector<string> licenseInfos = externalDefinition.license_locations(registry);
 	BOOST_CHECK(registry.isGood());
@@ -109,9 +111,10 @@
  * The license file doesn't exist. Check that the locator reports the right error
  */
 BOOST_AUTO_TEST_CASE(external_definition_not_found) {
-	const char *applicationDefinedString = PROJECT_TEST_SRC_DIR "/this/file/doesnt/exist";
+	string applicationDefinedString = PROJECT_TEST_SRC_DIR "/this/file/doesnt/exist";
 	license::EventRegistry registry;
-	const LicenseLocation licLocation = {applicationDefinedString, nullptr};
+	LicenseLocation licLocation = {LICENSE_PATH};
+	std::copy(applicationDefinedString.begin(), applicationDefinedString.end(), licLocation.licenseData);
 	ExternalDefinition externalDefinition(&licLocation);
 	vector<string> licenseInfos = externalDefinition.license_locations(registry);
 

--
Gitblit v1.9.1