Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable integration target version ranges #338

Merged
merged 6 commits into from
May 7, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
integration loader tests for versions
  • Loading branch information
colin-higgins committed May 7, 2019
commit 4bc14e54c06fb90a15772cb689c1eb68bb0893ec
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,24 @@ TEST(IntegrationLoaderTest, HandlesSingleIntegrationWithMethodReplacements) {
"name": "test-integration",
"method_replacements": [{
"caller": { },
"target": { "assembly": "Assembly.One", "type": "Type.One", "method": "Method.One" },
"target": { "assembly": "Assembly.One", "type": "Type.One", "method": "Method.One", "minimum_major": 0, "minimum_minor": 1, "maximum_major": 10, "maximum_minor": 0 },
"wrapper": { "assembly": "Assembly.Two", "type": "Type.Two", "method": "Method.Two", "signature": [0, 1, 1, 28] }
}]
}]
)TEXT");

auto integrations = LoadIntegrationsFromStream(str);
EXPECT_EQ(1, integrations.size());
EXPECT_STREQ(L"test-integration", integrations[0].integration_name.c_str());
}

TEST(IntegrationLoaderTest, DoesNotCrashWithOutOfRangeVersion) {
std::stringstream str(R"TEXT(
[{
"name": "test-integration",
"method_replacements": [{
"caller": { },
"target": { "assembly": "Assembly.One", "type": "Type.One", "method": "Method.One", "minimum_major": 0, "minimum_minor": 1, "maximum_major": 75555, "maximum_minor": 0 },
"wrapper": { "assembly": "Assembly.Two", "type": "Type.Two", "method": "Method.Two", "signature": [0, 1, 1, 28] }
}]
}]
Expand Down Expand Up @@ -103,7 +120,7 @@ TEST(IntegrationLoaderTest, HandlesSingleIntegrationWithMissingCaller) {
[{
"name": "test-integration",
"method_replacements": [{
"target": { "assembly": "Assembly.One", "type": "Type.One", "method": "Method.One" },
"target": { "assembly": "Assembly.One", "type": "Type.One", "method": "Method.One", "minimum_major": 1, "minimum_minor": 2, "maximum_major": 10, "maximum_minor": 99 },
"wrapper": { "assembly": "Assembly.Two", "type": "Type.Two", "method": "Method.Two", "signature": [0, 1, 1, 28] }
}]
}]
Expand All @@ -124,6 +141,11 @@ TEST(IntegrationLoaderTest, HandlesSingleIntegrationWithMissingCaller) {
EXPECT_STREQ(L"Assembly.Two", mr.wrapper_method.assembly.name.c_str());
EXPECT_STREQ(L"Type.Two", mr.wrapper_method.type_name.c_str());
EXPECT_STREQ(L"Method.Two", mr.wrapper_method.method_name.c_str());
EXPECT_STREQ(L"Method.Two", mr.wrapper_method.method_name.c_str());
EXPECT_EQ(1, mr.target_method.min_v_major);
EXPECT_EQ(2, mr.target_method.min_v_minor);
EXPECT_EQ(10, mr.target_method.max_v_major);
EXPECT_EQ(99, mr.target_method.max_v_minor);
EXPECT_EQ(std::vector<uint8_t>({0, 1, 1, 28}),
mr.wrapper_method.method_signature.data);
}
Expand Down