PageRenderTime 33ms CodeModel.GetById 13ms app.highlight 16ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/google-toolbox-for-mac/UnitTesting/GTMDevLogUnitTestingBridge.m

http://macfuse.googlecode.com/
Objective C | 44 lines | 12 code | 2 blank | 30 comment | 2 complexity | 71765df0da103f2002668cc7e37c2574 MD5 | raw file
 1//
 2//  GTMDevLogUnitTestingBridge.m
 3//
 4//  Copyright 2008 Google Inc.
 5//
 6//  Licensed under the Apache License, Version 2.0 (the "License"); you may not
 7//  use this file except in compliance with the License.  You may obtain a copy
 8//  of the License at
 9//
10//  http://www.apache.org/licenses/LICENSE-2.0
11//
12//  Unless required by applicable law or agreed to in writing, software
13//  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14//  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
15//  License for the specific language governing permissions and limitations under
16//  the License.
17//
18
19#include "GTMUnitTestDevLog.h"
20
21//
22// NOTE: Odds are this file should not be included in your project.  It is
23// only needed for some enhanced unit testing.
24//
25// By adding:
26//    #define _GTMDevLog _GTMUnitTestDevLog
27// to your prefix header (like the GTM Framework does), this function then
28// works to forward logging messages to the GTMUnitTestDevLog class to
29// allow logging validation during unittest, otherwise the messages go to
30// NSLog like normal.
31//
32// See GTMUnitTestDevLog.h for more information on checking logs in unittests.
33//
34void _GTMUnitTestDevLog(NSString *format, ...) {
35  Class devLogClass = NSClassFromString(@"GTMUnitTestDevLog");
36  va_list argList;
37  va_start(argList, format);
38  if (devLogClass) {
39    [devLogClass log:format args:argList];
40  } else {
41    NSLogv(format, argList); // COV_NF_LINE the class is in all our unittest setups
42  }
43  va_end(argList);
44}