Commit ff07a5de by Billy Donahue

Merge pull request #719 from paul-wilkinson/docs_formatting_fix

Fix formatting in AdvancedGuide.md
parents 77d6b173 83d3b47a
...@@ -44,7 +44,7 @@ We encourage you to use Google Mock as: ...@@ -44,7 +44,7 @@ We encourage you to use Google Mock as:
* a _testing_ tool to cut your tests' outbound dependencies and probe the interaction between your module and its collaborators. * a _testing_ tool to cut your tests' outbound dependencies and probe the interaction between your module and its collaborators.
# Getting Started # # Getting Started #
Using Google Mock is easy! Inside your C++ source file, just #include `"gtest/gtest.h"` and `"gmock/gmock.h"`, and you are ready to go. Using Google Mock is easy! Inside your C++ source file, just `#include` `"gtest/gtest.h"` and `"gmock/gmock.h"`, and you are ready to go.
# A Case for Mock Turtles # # A Case for Mock Turtles #
Let's look at an example. Suppose you are developing a graphics program that relies on a LOGO-like API for drawing. How would you test that it does the right thing? Well, you can run it and compare the screen with a golden screen snapshot, but let's admit it: tests like this are expensive to run and fragile (What if you just upgraded to a shiny new graphics card that has better anti-aliasing? Suddenly you have to update all your golden images.). It would be too painful if all your tests are like this. Fortunately, you learned about Dependency Injection and know the right thing to do: instead of having your application talk to the drawing API directly, wrap the API in an interface (say, `Turtle`) and code to that interface: Let's look at an example. Suppose you are developing a graphics program that relies on a LOGO-like API for drawing. How would you test that it does the right thing? Well, you can run it and compare the screen with a golden screen snapshot, but let's admit it: tests like this are expensive to run and fragile (What if you just upgraded to a shiny new graphics card that has better anti-aliasing? Suddenly you have to update all your golden images.). It would be too painful if all your tests are like this. Fortunately, you learned about Dependency Injection and know the right thing to do: instead of having your application talk to the drawing API directly, wrap the API in an interface (say, `Turtle`) and code to that interface:
......
...@@ -44,7 +44,7 @@ We encourage you to use Google Mock as: ...@@ -44,7 +44,7 @@ We encourage you to use Google Mock as:
* a _testing_ tool to cut your tests' outbound dependencies and probe the interaction between your module and its collaborators. * a _testing_ tool to cut your tests' outbound dependencies and probe the interaction between your module and its collaborators.
# Getting Started # # Getting Started #
Using Google Mock is easy! Inside your C++ source file, just #include `<gtest/gtest.h>` and `<gmock/gmock.h>`, and you are ready to go. Using Google Mock is easy! Inside your C++ source file, just `#include` `<gtest/gtest.h>` and `<gmock/gmock.h>`, and you are ready to go.
# A Case for Mock Turtles # # A Case for Mock Turtles #
Let's look at an example. Suppose you are developing a graphics program that relies on a LOGO-like API for drawing. How would you test that it does the right thing? Well, you can run it and compare the screen with a golden screen snapshot, but let's admit it: tests like this are expensive to run and fragile (What if you just upgraded to a shiny new graphics card that has better anti-aliasing? Suddenly you have to update all your golden images.). It would be too painful if all your tests are like this. Fortunately, you learned about Dependency Injection and know the right thing to do: instead of having your application talk to the drawing API directly, wrap the API in an interface (say, `Turtle`) and code to that interface: Let's look at an example. Suppose you are developing a graphics program that relies on a LOGO-like API for drawing. How would you test that it does the right thing? Well, you can run it and compare the screen with a golden screen snapshot, but let's admit it: tests like this are expensive to run and fragile (What if you just upgraded to a shiny new graphics card that has better anti-aliasing? Suddenly you have to update all your golden images.). It would be too painful if all your tests are like this. Fortunately, you learned about Dependency Injection and know the right thing to do: instead of having your application talk to the drawing API directly, wrap the API in an interface (say, `Turtle`) and code to that interface:
......
...@@ -44,7 +44,7 @@ We encourage you to use Google Mock as: ...@@ -44,7 +44,7 @@ We encourage you to use Google Mock as:
* a _testing_ tool to cut your tests' outbound dependencies and probe the interaction between your module and its collaborators. * a _testing_ tool to cut your tests' outbound dependencies and probe the interaction between your module and its collaborators.
# Getting Started # # Getting Started #
Using Google Mock is easy! Inside your C++ source file, just #include `"gtest/gtest.h"` and `"gmock/gmock.h"`, and you are ready to go. Using Google Mock is easy! Inside your C++ source file, just `#include` `"gtest/gtest.h"` and `"gmock/gmock.h"`, and you are ready to go.
# A Case for Mock Turtles # # A Case for Mock Turtles #
Let's look at an example. Suppose you are developing a graphics program that relies on a LOGO-like API for drawing. How would you test that it does the right thing? Well, you can run it and compare the screen with a golden screen snapshot, but let's admit it: tests like this are expensive to run and fragile (What if you just upgraded to a shiny new graphics card that has better anti-aliasing? Suddenly you have to update all your golden images.). It would be too painful if all your tests are like this. Fortunately, you learned about Dependency Injection and know the right thing to do: instead of having your application talk to the drawing API directly, wrap the API in an interface (say, `Turtle`) and code to that interface: Let's look at an example. Suppose you are developing a graphics program that relies on a LOGO-like API for drawing. How would you test that it does the right thing? Well, you can run it and compare the screen with a golden screen snapshot, but let's admit it: tests like this are expensive to run and fragile (What if you just upgraded to a shiny new graphics card that has better anti-aliasing? Suddenly you have to update all your golden images.). It would be too painful if all your tests are like this. Fortunately, you learned about Dependency Injection and know the right thing to do: instead of having your application talk to the drawing API directly, wrap the API in an interface (say, `Turtle`) and code to that interface:
......
...@@ -44,7 +44,7 @@ We encourage you to use Google Mock as: ...@@ -44,7 +44,7 @@ We encourage you to use Google Mock as:
* a _testing_ tool to cut your tests' outbound dependencies and probe the interaction between your module and its collaborators. * a _testing_ tool to cut your tests' outbound dependencies and probe the interaction between your module and its collaborators.
# Getting Started # # Getting Started #
Using Google Mock is easy! Inside your C++ source file, just #include `"gtest/gtest.h"` and `"gmock/gmock.h"`, and you are ready to go. Using Google Mock is easy! Inside your C++ source file, just `#include` `"gtest/gtest.h"` and `"gmock/gmock.h"`, and you are ready to go.
# A Case for Mock Turtles # # A Case for Mock Turtles #
Let's look at an example. Suppose you are developing a graphics program that relies on a LOGO-like API for drawing. How would you test that it does the right thing? Well, you can run it and compare the screen with a golden screen snapshot, but let's admit it: tests like this are expensive to run and fragile (What if you just upgraded to a shiny new graphics card that has better anti-aliasing? Suddenly you have to update all your golden images.). It would be too painful if all your tests are like this. Fortunately, you learned about Dependency Injection and know the right thing to do: instead of having your application talk to the drawing API directly, wrap the API in an interface (say, `Turtle`) and code to that interface: Let's look at an example. Suppose you are developing a graphics program that relies on a LOGO-like API for drawing. How would you test that it does the right thing? Well, you can run it and compare the screen with a golden screen snapshot, but let's admit it: tests like this are expensive to run and fragile (What if you just upgraded to a shiny new graphics card that has better anti-aliasing? Suddenly you have to update all your golden images.). It would be too painful if all your tests are like this. Fortunately, you learned about Dependency Injection and know the right thing to do: instead of having your application talk to the drawing API directly, wrap the API in an interface (say, `Turtle`) and code to that interface:
......
...@@ -221,7 +221,7 @@ your build script. ...@@ -221,7 +221,7 @@ your build script.
### Avoiding Macro Name Clashes ### ### Avoiding Macro Name Clashes ###
In C++, macros don't obey namespaces. Therefore two libraries that In C++, macros don't obey namespaces. Therefore two libraries that
both define a macro of the same name will clash if you #include both both define a macro of the same name will clash if you `#include` both
definitions. In case a Google Test macro clashes with another definitions. In case a Google Test macro clashes with another
library, you can force Google Test to rename its macro to avoid the library, you can force Google Test to rename its macro to avoid the
conflict. conflict.
......
...@@ -1450,7 +1450,7 @@ two cases to consider: ...@@ -1450,7 +1450,7 @@ two cases to consider:
Both static functions and definitions/declarations in an unnamed namespace are Both static functions and definitions/declarations in an unnamed namespace are
only visible within the same translation unit. To test them, you can `#include` only visible within the same translation unit. To test them, you can `#include`
the entire `.cc` file being tested in your `*_test.cc` file. (#including `.cc` the entire `.cc` file being tested in your `*_test.cc` file. (`#include`ing `.cc`
files is not a good way to reuse code - you should not do this in production files is not a good way to reuse code - you should not do this in production
code!) code!)
...@@ -1551,8 +1551,8 @@ exception, you could catch the exception and assert on it. But Google ...@@ -1551,8 +1551,8 @@ exception, you could catch the exception and assert on it. But Google
Test doesn't use exceptions, so how do we test that a piece of code Test doesn't use exceptions, so how do we test that a piece of code
generates an expected failure? generates an expected failure?
`"gtest/gtest-spi.h"` contains some constructs to do this. After `"gtest/gtest-spi.h"` contains some constructs to do this. After
#including this header, you can use `#include`ing this header, you can use
| `EXPECT_FATAL_FAILURE(`_statement, substring_`);` | | `EXPECT_FATAL_FAILURE(`_statement, substring_`);` |
|:--------------------------------------------------| |:--------------------------------------------------|
......
...@@ -994,7 +994,7 @@ you can use the _horrible_ hack of sniffing your executable name ...@@ -994,7 +994,7 @@ you can use the _horrible_ hack of sniffing your executable name
## Google Test defines a macro that clashes with one defined by another library. How do I deal with that? ## ## Google Test defines a macro that clashes with one defined by another library. How do I deal with that? ##
In C++, macros don't obey namespaces. Therefore two libraries that In C++, macros don't obey namespaces. Therefore two libraries that
both define a macro of the same name will clash if you #include both both define a macro of the same name will clash if you `#include` both
definitions. In case a Google Test macro clashes with another definitions. In case a Google Test macro clashes with another
library, you can force Google Test to rename its macro to avoid the library, you can force Google Test to rename its macro to avoid the
conflict. conflict.
......
...@@ -1365,7 +1365,7 @@ two cases to consider: ...@@ -1365,7 +1365,7 @@ two cases to consider:
Both static functions and definitions/declarations in an unnamed namespace are Both static functions and definitions/declarations in an unnamed namespace are
only visible within the same translation unit. To test them, you can `#include` only visible within the same translation unit. To test them, you can `#include`
the entire `.cc` file being tested in your `*_test.cc` file. (#including `.cc` the entire `.cc` file being tested in your `*_test.cc` file. (`#include`ing `.cc`
files is not a good way to reuse code - you should not do this in production files is not a good way to reuse code - you should not do this in production
code!) code!)
...@@ -1467,7 +1467,7 @@ Test doesn't use exceptions, so how do we test that a piece of code ...@@ -1467,7 +1467,7 @@ Test doesn't use exceptions, so how do we test that a piece of code
generates an expected failure? generates an expected failure?
`<gtest/gtest-spi.h>` contains some constructs to do this. After `<gtest/gtest-spi.h>` contains some constructs to do this. After
#including this header, you can use `#include`ing this header, you can use
| `EXPECT_FATAL_FAILURE(`_statement, substring_`);` | | `EXPECT_FATAL_FAILURE(`_statement, substring_`);` |
|:--------------------------------------------------| |:--------------------------------------------------|
......
...@@ -1447,7 +1447,7 @@ two cases to consider: ...@@ -1447,7 +1447,7 @@ two cases to consider:
Both static functions and definitions/declarations in an unnamed namespace are Both static functions and definitions/declarations in an unnamed namespace are
only visible within the same translation unit. To test them, you can `#include` only visible within the same translation unit. To test them, you can `#include`
the entire `.cc` file being tested in your `*_test.cc` file. (#including `.cc` the entire `.cc` file being tested in your `*_test.cc` file. (`#include`ing `.cc`
files is not a good way to reuse code - you should not do this in production files is not a good way to reuse code - you should not do this in production
code!) code!)
...@@ -1549,7 +1549,7 @@ Test doesn't use exceptions, so how do we test that a piece of code ...@@ -1549,7 +1549,7 @@ Test doesn't use exceptions, so how do we test that a piece of code
generates an expected failure? generates an expected failure?
`"gtest/gtest-spi.h"` contains some constructs to do this. After `"gtest/gtest-spi.h"` contains some constructs to do this. After
#including this header, you can use `#include`ing this header, you can use
| `EXPECT_FATAL_FAILURE(`_statement, substring_`);` | | `EXPECT_FATAL_FAILURE(`_statement, substring_`);` |
|:--------------------------------------------------| |:--------------------------------------------------|
......
...@@ -989,7 +989,7 @@ you can use the _horrible_ hack of sniffing your executable name ...@@ -989,7 +989,7 @@ you can use the _horrible_ hack of sniffing your executable name
## Google Test defines a macro that clashes with one defined by another library. How do I deal with that? ## ## Google Test defines a macro that clashes with one defined by another library. How do I deal with that? ##
In C++, macros don't obey namespaces. Therefore two libraries that In C++, macros don't obey namespaces. Therefore two libraries that
both define a macro of the same name will clash if you #include both both define a macro of the same name will clash if you `#include` both
definitions. In case a Google Test macro clashes with another definitions. In case a Google Test macro clashes with another
library, you can force Google Test to rename its macro to avoid the library, you can force Google Test to rename its macro to avoid the
conflict. conflict.
......
...@@ -1448,7 +1448,7 @@ two cases to consider: ...@@ -1448,7 +1448,7 @@ two cases to consider:
Both static functions and definitions/declarations in an unnamed namespace are Both static functions and definitions/declarations in an unnamed namespace are
only visible within the same translation unit. To test them, you can `#include` only visible within the same translation unit. To test them, you can `#include`
the entire `.cc` file being tested in your `*_test.cc` file. (#including `.cc` the entire `.cc` file being tested in your `*_test.cc` file. (`#include`ing `.cc`
files is not a good way to reuse code - you should not do this in production files is not a good way to reuse code - you should not do this in production
code!) code!)
...@@ -1550,7 +1550,7 @@ Test doesn't use exceptions, so how do we test that a piece of code ...@@ -1550,7 +1550,7 @@ Test doesn't use exceptions, so how do we test that a piece of code
generates an expected failure? generates an expected failure?
`"gtest/gtest-spi.h"` contains some constructs to do this. After `"gtest/gtest-spi.h"` contains some constructs to do this. After
#including this header, you can use `#include`ing this header, you can use
| `EXPECT_FATAL_FAILURE(`_statement, substring_`);` | | `EXPECT_FATAL_FAILURE(`_statement, substring_`);` |
|:--------------------------------------------------| |:--------------------------------------------------|
......
...@@ -989,7 +989,7 @@ you can use the _horrible_ hack of sniffing your executable name ...@@ -989,7 +989,7 @@ you can use the _horrible_ hack of sniffing your executable name
## Google Test defines a macro that clashes with one defined by another library. How do I deal with that? ## ## Google Test defines a macro that clashes with one defined by another library. How do I deal with that? ##
In C++, macros don't obey namespaces. Therefore two libraries that In C++, macros don't obey namespaces. Therefore two libraries that
both define a macro of the same name will clash if you #include both both define a macro of the same name will clash if you `#include` both
definitions. In case a Google Test macro clashes with another definitions. In case a Google Test macro clashes with another
library, you can force Google Test to rename its macro to avoid the library, you can force Google Test to rename its macro to avoid the
conflict. conflict.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment