mirror of
https://github.com/gnustep/tools-make.git
synced 2025-04-23 22:33:28 +00:00
Add example
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@32295 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
499c91e80e
commit
50f188c7ed
5 changed files with 56 additions and 3 deletions
|
@ -1,3 +1,11 @@
|
|||
2011-01-22 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* TestFramework/example9.m:
|
||||
* TestFramework/Testing.h:
|
||||
* TestFramework/Summary.sh:
|
||||
* GNUmakefile.in:
|
||||
Add example for dealing with an unsupported feature.
|
||||
|
||||
2011-01-22 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* TestFramework/gnustep-tests.in:
|
||||
|
|
|
@ -143,7 +143,7 @@ INSTANCE_DOC_MAKE_FILES = autogsdoc.make gsdoc.make install_files.make \
|
|||
TEST_FRAMEWORK_FILES = \
|
||||
GNUmakefile.in Testing.h ObjectTesting.h README \
|
||||
example1.m example2.m example3.m example4.m example5.m \
|
||||
example6.m example7.m example8.m
|
||||
example6.m example7.m example8.m example9.m
|
||||
|
||||
# Decide which version of the GNUstep.conf file we are going to
|
||||
# install; the standard one, or the strict gnustep-make v2 one ?
|
||||
|
|
|
@ -57,6 +57,7 @@ then
|
|||
echo "software was built (in which case you can install that library"
|
||||
echo "and rebuild, then re-run the tests), or the required functions"
|
||||
echo "may not be available on your operating system at all."
|
||||
echo "Please see $GSTESTLOG for more detail.
|
||||
echo "If you would like to contribute code to add the missing"
|
||||
echo "functionality, please contact the package maintainer."
|
||||
fi
|
||||
|
|
|
@ -317,7 +317,9 @@ static void unsupported(const char *format, ...)
|
|||
|
||||
/* The END_SET() macro terminates a set of grouped tests. It's argument is
|
||||
* a literal printf style format string and variable arguments to print a
|
||||
* message describing the set.
|
||||
* message giving the reason for skipping the set. This should be a short
|
||||
* message (for immediate display), preferably with a more detailed
|
||||
* explanation on subsequent lines.
|
||||
*/
|
||||
#define END_SET(format, ...) \
|
||||
} \
|
||||
|
@ -330,7 +332,8 @@ static void unsupported(const char *format, ...)
|
|||
[[localException reason] UTF8String], \
|
||||
[[[localException userInfo] description] UTF8String]); \
|
||||
} \
|
||||
unresolved("%s:%d ... " format, __FILE__, __LINE__, ## __VA_ARGS__); \
|
||||
unresolved("%s:%d ... problem occurred inside set.", \
|
||||
__FILE__, __LINE__, ## __VA_ARGS__); \
|
||||
NS_ENDHANDLER \
|
||||
testHopeful = save_hopeful; \
|
||||
} \
|
||||
|
|
41
TestFramework/example9.m
Normal file
41
TestFramework/example9.m
Normal file
|
@ -0,0 +1,41 @@
|
|||
#import <Testing.h>
|
||||
#import <NSFoundation/NSGeometry.h>
|
||||
|
||||
/* A ninth test ... unsupported tests
|
||||
*
|
||||
* If you run the test with 'gnustep-tests example9.m' it should
|
||||
* report one set skipped.
|
||||
*/
|
||||
int
|
||||
main()
|
||||
{
|
||||
#define HAVE_XXX NO
|
||||
|
||||
/* Start a set, but only if we have the XXX library.
|
||||
*/
|
||||
START_SET(HAVE_XXX)
|
||||
|
||||
/* Here we demonstrate that the 'expression' evaluated by the PASS
|
||||
* macro can actually be an arbitrarily complex piece of code as
|
||||
* long as the last statement returns an integral value which can
|
||||
* be used to represent a pass (non zero) or fail (if zero).
|
||||
* Where such a code fragment contains commas, it must be written
|
||||
* inside brackets to let the macro preprocessor know that the whole
|
||||
* code fragement is the first parameter to the macro.
|
||||
*/
|
||||
PASS(({
|
||||
NSRange r = NSMakeRange(1, 10);
|
||||
|
||||
NSEqualRanges(r, NSMakeRange(1, 10));
|
||||
}), "a long code-fragment/expression works")
|
||||
|
||||
/* Here we end the set with a message to be displayed if the set is
|
||||
* skipped. The first line will be displayed immediately when the set
|
||||
* is skipped, and lets the user know that some functionality is missing.
|
||||
* The remainder of the message is written to the log file so the user
|
||||
* can find out what to do about the problem.
|
||||
*/
|
||||
END_SET("Feature 'foo' is unsupported.\nThis is because the 'XXX' package was built without the 'YYY' library.\nIf you need 'foo' then please obtain 'YYY' and build and install 'XXX' again before re-running this testsuite.")
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue