82
class MockOutputDirectory : public OutputDirectory {
82
class MockGeneratorContext : public GeneratorContext {
84
MockOutputDirectory() {}
85
~MockOutputDirectory() {
84
MockGeneratorContext() {}
85
~MockGeneratorContext() {
86
86
STLDeleteValues(&files_);
105
// implements OutputDirectory --------------------------------------
105
// implements GeneratorContext --------------------------------------
107
107
virtual io::ZeroCopyOutputStream* Open(const string& filename) {
108
108
string** map_slot = &files_[filename];
130
130
ASSERT_TRUE(plugin_proto_file != NULL);
132
132
CppGenerator generator;
133
MockOutputDirectory output_directory;
133
MockGeneratorContext context;
135
135
string parameter;
136
136
parameter = "dllexport_decl=LIBPROTOBUF_EXPORT";
137
137
ASSERT_TRUE(generator.Generate(proto_file, parameter,
138
&output_directory, &error));
139
139
parameter = "dllexport_decl=LIBPROTOC_EXPORT";
140
140
ASSERT_TRUE(generator.Generate(plugin_proto_file, parameter,
141
&output_directory, &error));
143
output_directory.ExpectFileMatches("google/protobuf/descriptor.pb.h",
144
"google/protobuf/descriptor.pb.h");
145
output_directory.ExpectFileMatches("google/protobuf/descriptor.pb.cc",
146
"google/protobuf/descriptor.pb.cc");
147
output_directory.ExpectFileMatches("google/protobuf/compiler/plugin.pb.h",
148
"google/protobuf/compiler/plugin.pb.h");
149
output_directory.ExpectFileMatches("google/protobuf/compiler/plugin.pb.cc",
150
"google/protobuf/compiler/plugin.pb.cc");
143
context.ExpectFileMatches("google/protobuf/descriptor.pb.h",
144
"google/protobuf/descriptor.pb.h");
145
context.ExpectFileMatches("google/protobuf/descriptor.pb.cc",
146
"google/protobuf/descriptor.pb.cc");
147
context.ExpectFileMatches("google/protobuf/compiler/plugin.pb.h",
148
"google/protobuf/compiler/plugin.pb.h");
149
context.ExpectFileMatches("google/protobuf/compiler/plugin.pb.cc",
150
"google/protobuf/compiler/plugin.pb.cc");