Skip to content

Commit 7fb6e2e

Browse files
author
Ivan Zhakov
committed
Add minimal test for apr_os_default_encoding() and apr_os_locale_encoding().
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1934299 13f79535-47bb-0310-9956-ffa450edef68
1 parent 930827a commit 7fb6e2e

5 files changed

Lines changed: 64 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ set(APR_TEST_SUITES
417417
testbase64
418418
testbuckets
419419
testbuffer
420+
testcharset
420421
testcond
421422
testcrypto
422423
testdate

test/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ TESTS = testtime.lo teststr.lo testvsn.lo testipsub.lo testshm.lo \
3838
testreslist.lo testbase64.lo testhooks.lo testlfsabi.lo \
3939
testlfsabi32.lo testlfsabi64.lo testescape.lo testskiplist.lo \
4040
testsiphash.lo testredis.lo testencode.lo testjson.lo \
41-
testjose.lo testbuffer.lo testldap.lo
41+
testjose.lo testbuffer.lo testldap.lo testcharset.lo
4242

4343
OTHER_PROGRAMS = \
4444
echod@EXEEXT@ \

test/abts_tests.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const struct testlist {
2424
abts_suite *(*func)(abts_suite *suite);
2525
} alltests[] = {
2626
{testatomic},
27+
{testcharset},
2728
{testdir},
2829
{testdso},
2930
{testdup},

test/testcharset.c

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/* Licensed to the Apache Software Foundation (ASF) under one or more
2+
* contributor license agreements. See the NOTICE file distributed with
3+
* this work for additional information regarding copyright ownership.
4+
* The ASF licenses this file to You under the Apache License, Version 2.0
5+
* (the "License"); you may not use this file except in compliance with
6+
* the License. You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <assert.h>
18+
#include <stdio.h>
19+
#include <stdlib.h>
20+
21+
#include "apr_portable.h"
22+
23+
#include "abts.h"
24+
#include "testutil.h"
25+
26+
static void test_os_default_encoding(abts_case *tc, void *data)
27+
{
28+
apr_pool_t *pool;
29+
const char *encoding;
30+
31+
apr_pool_create(&pool, NULL);
32+
33+
encoding = apr_os_default_encoding(pool);
34+
35+
/* We cannot assert for actual value, so just log it. */
36+
abts_log_message("apr_os_default_encoding() = %s", encoding);
37+
}
38+
39+
static void test_os_locale_encoding(abts_case *tc, void *data)
40+
{
41+
apr_pool_t *pool;
42+
const char *encoding;
43+
44+
apr_pool_create(&pool, NULL);
45+
46+
encoding = apr_os_locale_encoding(pool);
47+
48+
/* We cannot assert for actual value, so just log it. */
49+
abts_log_message("apr_os_locale_encoding() = %s", encoding);
50+
}
51+
52+
abts_suite *testcharset(abts_suite *suite)
53+
{
54+
suite = ADD_SUITE(suite);
55+
56+
abts_run_test(suite, test_os_default_encoding, NULL);
57+
abts_run_test(suite, test_os_locale_encoding, NULL);
58+
59+
return suite;
60+
}

test/testutil.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ void apr_assert_failure(abts_case* tc, const char *context,
6565
void initialize(void);
6666

6767
abts_suite *testatomic(abts_suite *suite);
68+
abts_suite *testcharset(abts_suite *suite);
6869
abts_suite *testdir(abts_suite *suite);
6970
abts_suite *testdso(abts_suite *suite);
7071
abts_suite *testdup(abts_suite *suite);

0 commit comments

Comments
 (0)