Skip to content
Permalink
Browse files

Add cross2 test.

  • Loading branch information...
egorpugin committed Aug 15, 2019
1 parent 6fcb81b commit 5cf2e32ce5e8b6c88757eddbf8e810bec6692d29
Showing with 53 additions and 0 deletions.
  1. +11 −0 test/build/cross2/exceptions.cpp
  2. +14 −0 test/build/cross2/exceptions.h
  3. +17 −0 test/build/cross2/main.cpp
  4. +11 −0 test/build/cross2/sw.cpp
@@ -0,0 +1,11 @@
#include "exceptions.h"

namespace sw
{

RuntimeError::RuntimeError(const std::string &msg)
: std::runtime_error("")
{
}

} // namespace sw
@@ -0,0 +1,14 @@
#pragma once

#include <stdexcept>
#include <string>

namespace sw
{

struct API RuntimeError : std::runtime_error
{
RuntimeError(const std::string &msg);
};

}
@@ -0,0 +1,17 @@
#include "exceptions.h"

#include <iostream>

void f()
{
try { throw 5; }
catch (int) { std::cout << "int\n"; }
try { throw sw::RuntimeError(""); }
catch (sw::RuntimeError) { std::cout << "sw::RuntimeError\n"; }
}

int main()
{
f();
return 0;
}
@@ -0,0 +1,11 @@
void build(Solution &s)
{
auto &lib = s.addStaticLibrary("lib");
lib.ApiName = "API";
lib += "exceptions.h";
lib += "exceptions.cpp";

auto &t = s.addExecutable("test");
t += "main.cpp";
t += lib;
}

0 comments on commit 5cf2e32

Please sign in to comment.
You can’t perform that action at this time.