Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: tools/json_schema_compiler/test/features_generation_unittest.cc

Issue 2542163002: Fix invalid casts from ComplexFeature to SimpleFeature. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/test/features_generation_unittest.cc
diff --git a/tools/json_schema_compiler/test/features_generation_unittest.cc b/tools/json_schema_compiler/test/features_generation_unittest.cc
index 3b7e8e13ab961a60012495a2849c85cd8bd73c76..ab0b1cb561babd5303e2e50ebff62e95bad8c9ad 100644
--- a/tools/json_schema_compiler/test/features_generation_unittest.cc
+++ b/tools/json_schema_compiler/test/features_generation_unittest.cc
@@ -96,6 +96,7 @@ TEST(FeaturesGenerationTest, FeaturesTest) {
CompilerTestFeatureProvider provider;
auto GetAPIFeature = [&provider](const std::string& name) {
+ fprintf(stderr, "GetAPIFeature(\"%s\")\n", name.c_str());
tbarzic 2016/12/01 19:02:29 remove :)
krasin1 2016/12/01 20:41:12 Done.
Feature* feature = provider.GetFeature(name);
// Shame we can't test this more safely, but if our feature is declared as
// the wrong class, things should blow up in a spectacular fashion.
@@ -287,12 +288,14 @@ TEST(FeaturesGenerationTest, FeaturesTest) {
comparator.CompareFeature(feature);
}
{
- Feature* feature = GetAPIFeature("complex_alias");
+ Feature* feature =
+ static_cast<ComplexFeature*>(provider.GetFeature("complex_alias"));
tbarzic 2016/12/01 19:02:29 I don't think cast is needed if provider.GetFeatur
krasin1 2016/12/01 20:41:13 Done.
ASSERT_EQ("", feature->alias());
ASSERT_EQ("complex_alias_source", feature->source());
}
{
- Feature* feature = GetAPIFeature("complex_alias_source");
+ Feature* feature = static_cast<ComplexFeature*>(
+ provider.GetFeature("complex_alias_source"));
ASSERT_EQ("complex_alias", feature->alias());
ASSERT_EQ("", feature->source());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698