Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
2d268697
Commit
2d268697
authored
Aug 31, 2010
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test about chain escaping escaping.
parent
e2238b5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
0 deletions
+85
-0
test/Makefile.am
test/Makefile.am
+6
-0
test/src/config/chain.c
test/src/config/chain.c
+79
-0
No files found.
test/Makefile.am
View file @
2d268697
...
...
@@ -18,6 +18,7 @@ check_PROGRAMS = \
test_libvlc_media
\
test_libvlc_media_list
\
test_libvlc_media_player
\
test_src_config_chain
\
test_src_misc_variables
\
$(NULL)
...
...
@@ -91,6 +92,11 @@ test_src_misc_variables_LDADD = $(top_builddir)/src/libvlc.la
test_src_misc_variables_CFLAGS
=
$(CFLAGS_tests)
test_src_misc_variables_LDFLAGS
=
$(LDFLAGS_tests)
test_src_config_chain_SOURCES
=
src/config/chain.c
test_src_config_chain_LDADD
=
$(top_builddir)
/src/libvlc.la
test_src_config_chain_CFLAGS
=
$(CFLAGS_tests)
test_src_config_chain_LDFLAGS
=
$(LDFLAGS_tests)
checkall
:
$(MAKE)
check_PROGRAMS
=
"
$(check_PROGRAMS)
$(EXTRA_PROGRAMS)
"
check
...
...
test/src/config/chain.c
0 → 100644
View file @
2d268697
/*****************************************************************************
* chain.c: test configuration chains
*****************************************************************************
* Copyright (C) 2010 VideoLAN and authors
* $Id$
*
* Authors: Rémi Duraffort <ivoire@videolan.org>
*
* This program 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 of the License, or
* (at your option) any later version.
*
* This program 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; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <stdlib.h>
#include <string.h>
#include "../../libvlc/test.h"
#include <vlc_common.h>
#include <vlc_configuration.h>
typedef
struct
{
const
char
*
psz_string
;
const
char
*
psz_escaped
;
}
sample_t
;
static
const
sample_t
samples
[]
=
{
{
"a"
,
"a"
},
{
"azertyuiop"
,
"azertyuiop"
},
{
" test "
,
" test "
},
{
"it's"
,
"it
\\
's"
},
{
"''''"
,
"
\\
'
\\
'
\\
'
\\
'"
},
{
"' a '"
,
"
\\
' a
\\
'"
},
{
"
\"
quote
\"
"
,
"
\\\"
quote
\\\"
"
},
{
" az
\"
"
,
" az
\\\"
"
},
{
"
\\
test"
,
"
\\\\
test"
},
{
NULL
,
NULL
}
};
static
void
test_config_StringEscape
()
{
for
(
int
i
=
0
;
samples
[
i
].
psz_string
;
i
++
)
{
char
*
psz_tmp
=
config_StringEscape
(
samples
[
i
].
psz_string
);
assert
(
!
strcmp
(
psz_tmp
,
samples
[
i
].
psz_escaped
)
);
free
(
psz_tmp
);
}
}
static
void
test_config_StringUnEscape
()
{
for
(
int
i
=
0
;
samples
[
i
].
psz_string
;
i
++
)
{
char
*
psz_tmp
=
strdup
(
samples
[
i
].
psz_escaped
);
config_StringUnescape
(
psz_tmp
);
assert
(
!
strcmp
(
psz_tmp
,
samples
[
i
].
psz_string
)
);
free
(
psz_tmp
);
}
}
int
main
(
void
)
{
log
(
"Testing config chain escaping
\n
"
);
test_config_StringEscape
();
log
(
"Testing config chain un-escaping
\n
"
);
test_config_StringUnEscape
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment