dovecot-2.2: lib-fts: Removed unnecessary data stack frames from...

dovecot at dovecot.org dovecot at dovecot.org
Sat Jun 13 12:12:55 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/d766dbdf871c
changeset: 18847:d766dbdf871c
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Jun 13 15:10:23 2015 +0300
description:
lib-fts: Removed unnecessary data stack frames from test-fts-filter.
They are already added by lib-test/test-common.c

diffstat:

 src/lib-fts/test-fts-filter.c |  82 +++++++++++++++++++-----------------------
 1 files changed, 37 insertions(+), 45 deletions(-)

diffs (114 lines):

diff -r b9601cc46ace -r d766dbdf871c src/lib-fts/test-fts-filter.c
--- a/src/lib-fts/test-fts-filter.c	Sat Jun 13 14:36:43 2015 +0300
+++ b/src/lib-fts/test-fts-filter.c	Sat Jun 13 15:10:23 2015 +0300
@@ -345,15 +345,13 @@
 
 	test_begin("fts filter normalizer Swedish short text");
 
-	T_BEGIN {
-		test_assert(fts_filter_create(fts_filter_normalizer_icu, NULL, NULL, settings, &norm, &error) == 0);
-		for (i = 0; i < N_ELEMENTS(input); i++) {
-			token = input[i];
-			test_assert_idx(fts_filter_filter(norm, &token, &error) == 1, i);
-			test_assert_idx(null_strcmp(token, expected_output[i]) == 0, i);
-		}
-		fts_filter_unref(&norm);
-	} T_END;
+	test_assert(fts_filter_create(fts_filter_normalizer_icu, NULL, NULL, settings, &norm, &error) == 0);
+	for (i = 0; i < N_ELEMENTS(input); i++) {
+		token = input[i];
+		test_assert_idx(fts_filter_filter(norm, &token, &error) == 1, i);
+		test_assert_idx(null_strcmp(token, expected_output[i]) == 0, i);
+	}
+	fts_filter_unref(&norm);
 	test_assert(norm == NULL);
 	test_end();
 }
@@ -380,15 +378,13 @@
 
 	test_begin("fts filter normalizer Swedish short text using default ID");
 
-	T_BEGIN {
-		test_assert(fts_filter_create(fts_filter_normalizer_icu, NULL, NULL, NULL, &norm, &error) == 0);
-		for (i = 0; i < N_ELEMENTS(input); i++) {
-			token = input[i];
-			test_assert_idx(fts_filter_filter(norm, &token, &error) == 1, i);
-			test_assert_idx(null_strcmp(token, expected_output[i]) == 0, i);
-		}
-		fts_filter_unref(&norm);
-	} T_END;
+	test_assert(fts_filter_create(fts_filter_normalizer_icu, NULL, NULL, NULL, &norm, &error) == 0);
+	for (i = 0; i < N_ELEMENTS(input); i++) {
+		token = input[i];
+		test_assert_idx(fts_filter_filter(norm, &token, &error) == 1, i);
+		test_assert_idx(null_strcmp(token, expected_output[i]) == 0, i);
+	}
+	fts_filter_unref(&norm);
 	test_assert(norm == NULL);
 	test_end();
 }
@@ -419,25 +415,23 @@
 
 	test_begin("fts filter normalizer French UDHR");
 
-	T_BEGIN {
-		udhr_path = t_strconcat(UDHRDIR, UDHR_FRA_NAME, NULL);
-		test_assert(fts_filter_create(fts_filter_normalizer_icu, NULL, NULL, settings, &norm, &error) == 0);
-		input = fopen(udhr_path, "r");
-		test_assert(input != NULL);
-		sha512_init(&ctx);
-		while (NULL != fgets(buf, sizeof(buf), input)) {
-			tokens = buf;
-			if (fts_filter_filter(norm, &tokens, &error) != 1){
-				break;
-			}
-			sha512_loop(&ctx, tokens, strlen(tokens));
+	udhr_path = t_strconcat(UDHRDIR, UDHR_FRA_NAME, NULL);
+	test_assert(fts_filter_create(fts_filter_normalizer_icu, NULL, NULL, settings, &norm, &error) == 0);
+	input = fopen(udhr_path, "r");
+	test_assert(input != NULL);
+	sha512_init(&ctx);
+	while (NULL != fgets(buf, sizeof(buf), input)) {
+		tokens = buf;
+		if (fts_filter_filter(norm, &tokens, &error) != 1){
+			break;
 		}
-		fclose(input);
-		sha512_result(&ctx, sha512_digest);
-		test_assert(memcmp(sha512_digest, correct_digest,
-		                   sizeof(sha512_digest)) == 0);
-		fts_filter_unref(&norm);
-	} T_END;
+		sha512_loop(&ctx, tokens, strlen(tokens));
+	}
+	fclose(input);
+	sha512_result(&ctx, sha512_digest);
+	test_assert(memcmp(sha512_digest, correct_digest,
+			   sizeof(sha512_digest)) == 0);
+	fts_filter_unref(&norm);
 	test_assert(norm == NULL);
 	test_end();
 }
@@ -615,15 +609,13 @@
 
 	test_begin("fts filter english possessive");
 
-	T_BEGIN {
-		test_assert(fts_filter_create(fts_filter_english_possessive, NULL, NULL, NULL, &norm, &error) == 0);
-		for (i = 0; i < N_ELEMENTS(input); i++) {
-			token = input[i];
-			test_assert_idx(fts_filter_filter(norm, &token, &error) == 1, i);
-			test_assert_idx(null_strcmp(token, expected_output[i]) == 0, i);
-		}
-		fts_filter_unref(&norm);
-	} T_END;
+	test_assert(fts_filter_create(fts_filter_english_possessive, NULL, NULL, NULL, &norm, &error) == 0);
+	for (i = 0; i < N_ELEMENTS(input); i++) {
+		token = input[i];
+		test_assert_idx(fts_filter_filter(norm, &token, &error) == 1, i);
+		test_assert_idx(null_strcmp(token, expected_output[i]) == 0, i);
+	}
+	fts_filter_unref(&norm);
 	test_assert(norm == NULL);
 	test_end();
 }


More information about the dovecot-cvs mailing list