Skip to content
This repository has been archived by the owner on Jul 17, 2019. It is now read-only.

the mock registry should be created on demand #54

Closed
GoogleCodeExporter opened this issue Aug 24, 2015 · 1 comment
Closed

the mock registry should be created on demand #54

GoogleCodeExporter opened this issue Aug 24, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link
Contributor

googlemock uses a global registry object to record the states of mock
objects.  If a mock object is created and expectations are set on it before
the registry is created, the program will crash.

We should create the registry the first time it's needed.

Original issue reported on code.google.com by zhanyong...@gmail.com on 23 Jun 2009 at 4:55

@GoogleCodeExporter
Copy link
Contributor Author

On second thought, we probably don't want to support this.

InitGoogleMock() must be called to initialize Google Mock before it can be 
used, as 
the behavior of Google Mock can be affected by command line flags.  The command 
line 
flags cannot be obtained before main() is entered.  Therefore, Google Mock must 
not 
be used before main() is entered.

Once main() is entered, the global registry object is already created and can 
be 
used.

So, it's invalid for a user program to create a mock and set expectations on it 
before main() is entered.

Original comment by zhanyong...@gmail.com on 21 Sep 2009 at 10:55

  • Changed state: WontFix

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant