Merge in changes from master

This commit is contained in:
Simon Brand
2019-04-26 13:33:10 +01:00
parent f6c92068ac
commit d721366fe2
8 changed files with 164 additions and 22 deletions
+14
View File
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 2.8.12)
project(PackageTest CXX)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
add_executable(example example.cpp)
target_link_libraries(example ${CONAN_LIBS})
# CTest is a testing tool that can be used to test your project.
# enable_testing()
# add_test(NAME example
# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
# COMMAND example)
+25
View File
@@ -0,0 +1,25 @@
import os
from conans import ConanFile, CMake, tools
class ExpectedTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
def build(self):
cmake = CMake(self)
# Current dir is "test_package/build/<build_id>" and CMakeLists.txt is
# in "test_package"
cmake.configure()
cmake.build()
def imports(self):
self.copy("*.dll", dst="bin", src="bin")
self.copy("*.dylib*", dst="bin", src="lib")
self.copy('*.so*', dst='bin', src='lib')
def test(self):
if not tools.cross_building(self.settings):
os.chdir("bin")
self.run(".%sexample" % os.sep)
+16
View File
@@ -0,0 +1,16 @@
#include <tl/expected.hpp>
tl::expected<int, const char*> maybe_do_something(int i) {
if (i < 5) {
return 0;
}
else {
return tl::make_unexpected("Uh oh");
}
}
int main(int argc, char** argv) {
(void)argv;
return maybe_do_something(0).value_or(-1);
}