diff options
Diffstat (limited to 'libvtv/testsuite/environment.cc')
-rw-r--r-- | libvtv/testsuite/environment.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libvtv/testsuite/environment.cc b/libvtv/testsuite/environment.cc new file mode 100644 index 00000000000..83adf53b601 --- /dev/null +++ b/libvtv/testsuite/environment.cc @@ -0,0 +1,37 @@ + +extern "C" int printf(const char *, ...); + +class Environment { + public: + virtual ~Environment(); + + // Static factory method that returns the implementation that provide the + // appropriate platform-specific instance. + static Environment* Create(); + + // Gets an environment variable's value and stores it in |result|. + // Returns false if the key is unset. + virtual bool GetVar(const char* variable_name, char* result) = 0; +}; + +class EnvironmentImpl : public Environment { + public: + virtual bool GetVar(const char* variable_name, char* result) { + return true; + } +}; + +Environment::~Environment() {} + +// static +Environment* Environment::Create() { + return new EnvironmentImpl(); +} + +int main() +{ + char * null = 0; + Environment * env = Environment::Create(); + env->GetVar(0, null); + printf("%p\n", env); +} |