@@ -1,9 +1,7 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, - * 2018, 2019, 2020 - * Jonathan Schleifer + * Copyright (c) 2008-2021 Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -15,45 +13,39 @@ * file. */ #import "ObjFW.h" -#define TEST(test, ...) \ - { \ - [self outputTesting: test \ - inModule: module]; \ - \ - if (__VA_ARGS__) \ - [self outputSuccess: test \ - inModule: module]; \ - else { \ - [self outputFailure: test \ - inModule: module]; \ - _fails++; \ - } \ - } -#define EXPECT_EXCEPTION(test, exception, code) \ - { \ - bool caught = false; \ - \ - [self outputTesting: test \ - inModule: module]; \ - \ - @try { \ - code; \ - } @catch (exception *e) { \ - caught = true; \ - } \ - \ - if (caught) \ - [self outputSuccess: test \ - inModule: module]; \ - else { \ - [self outputFailure: test \ - inModule: module]; \ - _fails++; \ - } \ +#define TEST(test, ...) \ + { \ + [self outputTesting: test inModule: module]; \ + \ + if (__VA_ARGS__) \ + [self outputSuccess: test inModule: module]; \ + else { \ + [self outputFailure: test inModule: module]; \ + _fails++; \ + } \ + } +#define EXPECT_EXCEPTION(test, exception, code) \ + { \ + bool caught = false; \ + \ + [self outputTesting: test inModule: module]; \ + \ + @try { \ + code; \ + } @catch (exception *e) { \ + caught = true; \ + } \ + \ + if (caught) \ + [self outputSuccess: test inModule: module]; \ + else { \ + [self outputFailure: test inModule: module]; \ + _fails++; \ + } \ } #define R(...) (__VA_ARGS__, 1) @class OFString; @@ -60,16 +52,13 @@ @interface TestsAppDelegate: OFObject { int _fails; } -- (void)outputTesting: (OFString *)test - inModule: (OFString *)module; -- (void)outputSuccess: (OFString *)test - inModule: (OFString *)module; -- (void)outputFailure: (OFString *)test - inModule: (OFString *)module; +- (void)outputTesting: (OFString *)test inModule: (OFString *)module; +- (void)outputSuccess: (OFString *)test inModule: (OFString *)module; +- (void)outputFailure: (OFString *)test inModule: (OFString *)module; @end @interface TestsAppDelegate (OFArrayTests) - (void)arrayTests; @end