From 5e94a939a805bffc8e52f44cd669a2e62f963c54 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 3 Nov 2010 14:27:31 +0000 Subject: [PATCH] Monotone-Parent: 766baf56d74d898b08d6a686cdd909e3825d8e2f Monotone-Revision: 808d40a88677de09c4168d17acc5946afe8e9813 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-11-03T14:27:31 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 ++ Tests/Integration/GNUmakefile | 19 ++++++++ Tests/Integration/teststrings.m | 79 ++++++++++++++++++++++++++++++++ Tests/Integration/teststrings.sh | 20 ++++++++ 4 files changed, 121 insertions(+) create mode 100644 Tests/Integration/GNUmakefile create mode 100644 Tests/Integration/teststrings.m create mode 100755 Tests/Integration/teststrings.sh diff --git a/ChangeLog b/ChangeLog index b551da28e..9e7a22650 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2010-11-03 Wolfgang Sourdeau + * Tests/Integration/teststrings.sh: new utility script to test the + parsability of the localization strings file. + * UI/WebServerResources/generic.js: (onCASRecoverIFrameLoaded): go back to the user's page instead of the logoff page. diff --git a/Tests/Integration/GNUmakefile b/Tests/Integration/GNUmakefile new file mode 100644 index 000000000..65ca89f55 --- /dev/null +++ b/Tests/Integration/GNUmakefile @@ -0,0 +1,19 @@ +PROGRAM=teststrings + +SRCS=teststrings.m +OBJS=$(SRCS:.m=.o) + +teststrings: $(OBJS) + $(CC) -o $@ $< $(GNUSTEP_LIBRARIES_FLAGS) -lSOGo -lgnustep-base + +include $(GNUSTEP_MAKEFILES)/common.make + +all: $(PROGRAM) + +clean: + rm -f $(PROGRAM) $(OBJS) *~ + +.m.o: + $(CC) -o $@ -c $(GNUSTEP_HEADERS_FLAGS) $(AUXILIARY_OBJCFLAGS) $(OBJCFLAGS) $(CPPFLAGS) $< + +.SUFFIXES: .m .o diff --git a/Tests/Integration/teststrings.m b/Tests/Integration/teststrings.m new file mode 100644 index 000000000..6ae5f979e --- /dev/null +++ b/Tests/Integration/teststrings.m @@ -0,0 +1,79 @@ +/* teststrings.m - this file is part of SOGO + * + * Copyright (C) 2010 Inverse inc. + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import + +#import + +static int +performTest (char *filename) +{ + NSDictionary *testDict; + NSString *nsFilename; + int rc; + + nsFilename = [NSString stringWithFormat: @"%s", filename]; + NS_DURING + { + testDict = [NSDictionary dictionaryFromStringsFile: nsFilename]; + if ([testDict count] == 0) + { + NSLog (@"Bad or empty strings file"); + rc = 2; + testDict = nil; + } + else + rc = 0; + } + NS_HANDLER + { + NSLog (@"An exception was caught: %@", localException); + rc = 1; + testDict = nil; + } + NS_ENDHANDLER; + + return rc; +} + +int +main (int argc, char *argv[]) +{ + NSAutoreleasePool *pool; + int rc; + + pool = [NSAutoreleasePool new]; + + if (argc == 2) + { + rc = performTest (argv[1]); + } + else + { + NSLog (@"Usage: %s file.strings", argv[0]); + rc = 1; + } + + [pool release]; + + return rc; +} diff --git a/Tests/Integration/teststrings.sh b/Tests/Integration/teststrings.sh new file mode 100755 index 000000000..d531e4ed6 --- /dev/null +++ b/Tests/Integration/teststrings.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +TOPDIR=../.. + +if [ ! -f teststrings ] +then + make teststrings +fi + +for stringfile in ${TOPDIR}/*/*/*.lproj/Localizable.strings +do + ./teststrings "$stringfile" > /dev/null + code=$? + if test $code -eq 0; + then + echo "$stringfile: passed"; + else + echo "$stringfile: failed (code: $code)"; + fi +done