aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-07-29 00:49:53 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-07-29 00:49:53 +0300
commit07e8fc8a6afe790f7e225601392cf6d17b6a3591 (patch)
tree8d11d1574df20477a8f7359cb0403511948add3a
parentc675f974b1787097237be644f77ba1d40385e425 (diff)
downloadidest-07e8fc8a6afe790f7e225601392cf6d17b6a3591.tar.gz
idest-07e8fc8a6afe790f7e225601392cf6d17b6a3591.tar.bz2
Add testsuite
* Makefile.am (SUBDIRS): Add tests * configure.ac: Initialize testsuite. * src/cmdline.opt (get_options): Bugfix. * src/frametab.gperf: Use condesc instead of descr, which is reserved. * src/getopt.m4: Fix version output. * src/guile.c: Bugfixes. * src/main.c (guile_argv): Declare here, instead of in guile.c. * tests/Makefile.am: New file. * tests/testsuite.at: New file. * tests/.gitignore: New file. * tests/Makefile.am: New file. * tests/atlocal.in: New file. * tests/genfile.c: New file. * tests/id3v1: New file. * tests/id3v1-2: New file. * tests/id3v2: New file. * tests/idest-32.png: New file. * tests/idest-68.png: New file. * tests/info-v1-00.at: New file. * tests/info-v12-00.at: New file. * tests/info-v2-00.at: New file. * tests/query-v1-00.at: New file. * tests/query-v1-01.at: New file. * tests/query-v2-00.at: New file. * tests/query-v2-01.at: New file. * tests/query-v2-02.at: New file. * tests/query-v2-03.at: New file. * tests/query-v2-04.at: New file. * tests/set-v1-00.at: New file. * tests/set-v2-00.at: New file. * tests/version.at: New file.
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac5
-rw-r--r--src/Makefile.am1
-rw-r--r--src/cmdline.opt2
-rw-r--r--src/frametab.gperf4
-rw-r--r--src/getopt.m42
-rw-r--r--src/guile.c5
-rw-r--r--src/main.c1
-rw-r--r--tests/.gitignore7
-rw-r--r--tests/Makefile.am95
-rw-r--r--tests/atlocal.in10
-rw-r--r--tests/genfile.c128
-rw-r--r--tests/id3v1bin0 -> 128 bytes
-rw-r--r--tests/id3v1-2bin0 -> 2081 bytes
-rw-r--r--tests/id3v2bin0 -> 1953 bytes
-rw-r--r--tests/idest-32.pngbin0 -> 314 bytes
-rw-r--r--tests/idest-68.pngbin0 -> 419 bytes
-rw-r--r--tests/info-v1-00.at33
-rw-r--r--tests/info-v12-00.at36
-rw-r--r--tests/info-v2-00.at33
-rw-r--r--tests/query-v1-00.at35
-rw-r--r--tests/query-v1-01.at31
-rw-r--r--tests/query-v2-00.at35
-rw-r--r--tests/query-v2-01.at31
-rw-r--r--tests/query-v2-02.at31
-rw-r--r--tests/query-v2-03.at34
-rw-r--r--tests/query-v2-04.at52
-rw-r--r--tests/set-v1-00.at52
-rw-r--r--tests/set-v2-00.at69
-rw-r--r--tests/testsuite.at42
-rw-r--r--tests/version.at34
31 files changed, 802 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am
index e19d967..dd2c846 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,7 +20,7 @@ if IDEST_COND_GUILE
SCHEME_DIR = scheme
endif
-SUBDIRS=gnu libid3tag gint src doc examples $(SCHEME_DIR)
+SUBDIRS=gnu libid3tag gint src doc examples $(SCHEME_DIR) tests
.PHONY: ChangeLog
ChangeLog:
diff --git a/configure.ac b/configure.ac
index 772ea62..296ae0e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,11 @@ EOF
],
[status_guile=$status_guile])
+# Initialize the test suite.
+AC_CONFIG_TESTDIR(tests)
+AC_CONFIG_FILES([tests/Makefile tests/atlocal])
+AM_MISSING_PROG([AUTOM4TE], [autom4te])
+
AC_CONFIG_FILES([Makefile
gnu/Makefile
gint/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 1cd02d8..bd06dbf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,6 +15,7 @@
# along with Idest. If not, see <http://www.gnu.org/licenses/>.
bin_PROGRAMS=idest
+
idest_SOURCES=\
backup.c\
editem.c\
diff --git a/src/cmdline.opt b/src/cmdline.opt
index c43d285..9ed798f 100644
--- a/src/cmdline.opt
+++ b/src/cmdline.opt
@@ -246,7 +246,7 @@ get_options(int argc, char *argv[])
if (optind < argc && mode == MODE_MOD) {
char *p;
/* See if we've been given any assignment arguments */
- while (p = strchr(argv[optind], '=')) {
+ while (argv[optind] && (p = strchr(argv[optind], '='))) {
*p++ = 0;
input_list_add_assignment(argv[optind++], p);
}
diff --git a/src/frametab.gperf b/src/frametab.gperf
index dd4acd2..15310c9 100644
--- a/src/frametab.gperf
+++ b/src/frametab.gperf
@@ -22,8 +22,8 @@
#define DQ(name) static char *QID(name)[]
DQ(COMM) = { "lang", "condesc" };
-DQ(TXXX) = { "descr" };
-DQ(WXXX) = { "descr" };
+DQ(TXXX) = { "condesc" };
+DQ(WXXX) = { "condesc" };
DQ(APIC) = { "mime-type", "pic-type", "condesc" };
#define QUAL(name) sizeof(QID(name))/sizeof(QID(name)[0]), QID(name)
diff --git a/src/getopt.m4 b/src/getopt.m4
index 19ee33c..9267de2 100644
--- a/src/getopt.m4
+++ b/src/getopt.m4
@@ -496,7 +496,7 @@ define([<OPTIONS_BEGIN>],
[<divert(-1)
define([<GETOPT_STYLE>],[<$1>])
ifelse([<$1>],[<gnu>],
- [<STDFUNC([<$2 " (" PACKAGE_STRING ")">], [<$2>], [<$3>], [<$4>])>])
+ [<STDFUNC([<$2 " (" PACKAGE_NAME ") " PACKAGE_VERSION>], [<$2>], [<$3>], [<$4>])>])
>])
define([<OPTIONS_END>],[<
diff --git a/src/guile.c b/src/guile.c
index 901d398..d3ceade 100644
--- a/src/guile.c
+++ b/src/guile.c
@@ -23,7 +23,6 @@
int no_init_files_option;
int guile_inited = 0;
int guile_debug = 1;
-char **guile_argv;
SCM_GLOBAL_VARIABLE_INIT(sym_idest_main, "idest-main", SCM_EOL);
SCM_GLOBAL_VARIABLE_INIT(sym_idest_readonly, "idest-readonly", SCM_BOOL_T);
@@ -720,12 +719,12 @@ guile_list(const char *file, struct id3_tag *tag)
}
void
-guile_init(int *pargc, char **pargv)
+guile_init(int *pargc, char ***pargv)
{
}
void
-guile_add_load_path(const char *arg)
+guile_add_load_path(const char *arg, int li)
{
}
diff --git a/src/main.c b/src/main.c
index e3a82df..54a987d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -32,6 +32,7 @@ struct id3_tag *source_tag;
char *format_name;
char *batch_name;
+char **guile_argv;
struct item_info {
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 0000000..11f17b8
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,7 @@
+atconfig
+atlocal
+genfile
+package.m4
+testsuite
+testsuite.dir
+testsuite.log
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..4463d13
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,95 @@
+# This file is part of idest
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest 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 3, or (at your option)
+# any later version.
+#
+# Idest 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 idest. If not, see <http://www.gnu.org/licenses/>.
+
+EXTRA_DIST = \
+ $(TESTSUITE_AT)\
+ testsuite\
+ package.m4\
+ id3v1\
+ id3v1-2\
+ id3v2
+
+DISTCLEANFILES = atconfig
+MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
+
+
+## ------------ ##
+## package.m4. ##
+## ------------ ##
+
+$(srcdir)/package.m4: $(top_srcdir)/configure.ac $(srcdir)/Makefile
+ $(AM_V_GEN){ \
+ echo '# Signature of the current package.'; \
+ echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \
+ echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \
+ echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \
+ echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \
+ echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+ echo 'm4_define([AT_PACKAGE_GUILE], [@GUILE_VERSION@])'; \
+ } >$(srcdir)/package.m4
+
+#
+
+## ------------ ##
+## Test suite. ##
+## ------------ ##
+
+TESTSUITE_AT = \
+ testsuite.at\
+ version.at\
+ info-v1-00.at\
+ info-v2-00.at\
+ info-v12-00.at\
+ set-v1-00.at\
+ set-v2-00.at\
+ query-v1-00.at\
+ query-v1-01.at\
+ query-v2-00.at\
+ query-v2-01.at\
+ query-v2-02.at\
+ query-v2-03.at\
+ query-v2-04.at
+
+TESTSUITE = $(srcdir)/testsuite
+M4=m4
+
+AUTOTEST = $(AUTOM4TE) --language=autotest
+$(TESTSUITE): package.m4 $(TESTSUITE_AT)
+ $(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp
+ mv $@.tmp $@
+
+atconfig: $(top_builddir)/config.status
+ cd $(top_builddir) && ./config.status tests/$@
+
+clean-local:
+ test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
+
+check-local: atconfig atlocal $(TESTSUITE)
+ $(SHELL) $(TESTSUITE)
+
+# Run the test suite on the *installed* tree.
+#installcheck-local:
+# $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
+
+## ------------ ##
+## genfile ##
+## ------------ ##
+
+check_PROGRAMS = genfile
+
+genfile_SOURCES = genfile.c
+
+
diff --git a/tests/atlocal.in b/tests/atlocal.in
new file mode 100644
index 0000000..420c2c9
--- /dev/null
+++ b/tests/atlocal.in
@@ -0,0 +1,10 @@
+# @configure_input@ -*- shell-script -*-
+# Configurable variable values for the Idest test suite.
+# Copyright (C) 2011 Sergey Poznyakoff
+
+PATH=@abs_top_builddir@/src:$PATH
+
+XFAILFILE=$abs_builddir/.badversion
+
+trap "cleanup; test -r $XFAILFILE && cat $XFAILFILE; exit $?" 1 2 13 15
+
diff --git a/tests/genfile.c b/tests/genfile.c
new file mode 100644
index 0000000..26b046f
--- /dev/null
+++ b/tests/genfile.c
@@ -0,0 +1,128 @@
+/* This file is part of Idest.
+ Copyright (C) 2009-2011 Sergey Poznyakoff
+
+ Idest 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 3, or (at your option)
+ any later version.
+
+ Idest 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 Idest. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#ifdef HAVE_GETOPT_H
+# include <getopt.h>
+#endif
+
+static void
+copyfile(FILE *file, const char *name)
+{
+ int c;
+ FILE *in = fopen(name, "r");
+ if (!in) {
+ perror(name);
+ exit(1);
+ }
+ while ((c = fgetc(in)) != EOF)
+ fputc(c, file);
+ fclose(in);
+}
+
+int
+main(int argc, char **argv)
+{
+ char *suf;
+ unsigned int length, i, c;
+ char *filename = NULL, *suffix = NULL, *prefix = NULL;
+ FILE *fp;
+
+ while ((c = getopt(argc, argv, "hf:p:s:")) != EOF) {
+ switch (c) {
+ case 'f':
+ filename = optarg;
+ break;
+
+ case 'p':
+ prefix = optarg;
+ break;
+
+ case 's':
+ suffix = optarg;
+ break;
+
+ case 'h':
+ fprintf(stdout,
+ "usage: %s [-f FILE] [-p PREFIX]"
+ " [-s SUFFIX] SIZE\n", argv[0]);
+ exit(0);
+
+ default:
+ exit(1);
+ }
+ }
+
+ if (optind + 1 != argc) {
+ fprintf(stderr, "%s: invalid usage\n", argv[0]);
+ exit(1);
+ }
+
+ length = strtoul(argv[optind], &suf, 10);
+ if (suf[0] && suf[1]) {
+ fprintf(stderr, "%s: unknown size suffix: %s\n", argv[0], suf);
+ exit(1);
+ }
+
+ switch (*suf) {
+ case 0:
+ break;
+ case 'g':
+ case 'G':
+ length *= 1024;
+ case 'm':
+ case 'M':
+ length *= 1024;
+ case 'k':
+ case 'K':
+ length *= 1024;
+ break;
+ default:
+ fprintf(stderr, "%s: unknown size suffix: %s\n", argv[0], suf);
+ exit(1);
+ }
+
+ if (filename) {
+ fp = fopen(filename, "w");
+ if (!fp) {
+ perror(filename);
+ exit(1);
+ }
+ } else
+ fp = stdout;
+
+ if (prefix)
+ copyfile(fp, prefix);
+
+ for (i = 0; i < length; i++)
+ fputc (i & 255, fp);
+
+ if (suffix)
+ copyfile(fp, suffix);
+
+ if (ferror(fp)) {
+ fprintf(stderr, "%s: write error", argv[0]);
+ exit(1);
+ }
+ fclose(fp);
+ exit(0);
+}
+
diff --git a/tests/id3v1 b/tests/id3v1
new file mode 100644
index 0000000..cf8a482
--- /dev/null
+++ b/tests/id3v1
Binary files differ
diff --git a/tests/id3v1-2 b/tests/id3v1-2
new file mode 100644
index 0000000..b0e1848
--- /dev/null
+++ b/tests/id3v1-2
Binary files differ
diff --git a/tests/id3v2 b/tests/id3v2
new file mode 100644
index 0000000..64a228e
--- /dev/null
+++ b/tests/id3v2
Binary files differ
diff --git a/tests/idest-32.png b/tests/idest-32.png
new file mode 100644
index 0000000..e92556a
--- /dev/null
+++ b/tests/idest-32.png
Binary files differ
diff --git a/tests/idest-68.png b/tests/idest-68.png
new file mode 100644
index 0000000..07bc3e3
--- /dev/null
+++ b/tests/idest-68.png
Binary files differ
diff --git a/tests/info-v1-00.at b/tests/info-v1-00.at
new file mode 100644
index 0000000..fcb55ee
--- /dev/null
+++ b/tests/info-v1-00.at
@@ -0,0 +1,33 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest 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 3, or (at your option)
+# any later version.
+#
+# Idest 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 idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([info (v1)])
+AT_KEYWORDS([info v1 info-v1-00])
+
+AT_CHECK([
+genfile -f file -s $abs_srcdir/id3v1 1000
+idest -i file
+],
+[0],
+[file: file
+ntags: 1
+version: 1.1
+offset: 1000
+length: 128
+])
+
+AT_CLEANUP
+
diff --git a/tests/info-v12-00.at b/tests/info-v12-00.at
new file mode 100644
index 0000000..1665060
--- /dev/null
+++ b/tests/info-v12-00.at
@@ -0,0 +1,36 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest 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 3, or (at your option)
+# any later version.
+#
+# Idest 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 idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([info (both versions)])
+AT_KEYWORDS([info v1 v2 info-v12-00])
+
+AT_CHECK([
+genfile -f file -p $abs_srcdir/id3v2 -s $abs_srcdir/id3v1 1000
+idest -i file
+],
+[0],
+[file: file
+ntags: 2
+version: 2.4.0
+offset: 0
+length: 1953
+version: 1.1
+offset: 2953
+length: 128
+])
+
+AT_CLEANUP
+
diff --git a/tests/info-v2-00.at b/tests/info-v2-00.at
new file mode 100644
index 0000000..b0c047b
--- /dev/null
+++ b/tests/info-v2-00.at
@@ -0,0 +1,33 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest 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 3, or (at your option)
+# any later version.
+#
+# Idest 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 idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([info (v2)])
+AT_KEYWORDS([info v2 info-v2-00])
+
+AT_CHECK([
+genfile -f file -p $abs_srcdir/id3v2 1000
+idest -i file
+],
+[0],
+[file: file
+ntags: 1
+version: 2.4.0
+offset: 0
+length: 1953
+])
+
+AT_CLEANUP
+
diff --git a/tests/query-v1-00.at b/tests/query-v1-00.at
new file mode 100644
index 0000000..3e66179
--- /dev/null
+++ b/tests/query-v1-00.at
@@ -0,0 +1,35 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest 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 3, or (at your option)
+# any later version.
+#
+# Idest 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 idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([default query (v1)])
+AT_KEYWORDS([query v1 query-v1-00])
+
+AT_CHECK([
+genfile -f file -s $abs_srcdir/id3v1 10k
+idest file
+],
+[0],
+[title: File
+album: Idest Test Suite
+track: 1
+comment:XXX:: Sample ID3 headers for idest
+artist: Sergey Poznyakoff
+year: 2011
+genre: Other
+])
+
+AT_CLEANUP
+
diff --git a/tests/query-v1-01.at b/tests/query-v1-01.at
new file mode 100644
index 0000000..e99aebf
--- /dev/null
+++ b/tests/query-v1-01.at
@@ -0,0 +1,31 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest 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 3, or (at your option)
+# any later version.
+#
+# Idest 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 idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([selected query (v1)])
+AT_KEYWORDS([query v1 query-v1-01])
+
+AT_CHECK([
+genfile -f file -s $abs_srcdir/id3v1 10k
+idest --filter title,comment,year file
+],
+[0],
+[title: File
+comment:XXX:: Sample ID3 headers for idest
+year: 2011
+])
+
+AT_CLEANUP
+
diff --git a/tests/query-v2-00.at b/tests/query-v2-00.at
new file mode 100644
index 0000000..d556cca
--- /dev/null
+++ b/tests/query-v2-00.at
@@ -0,0 +1,35 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest 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 3, or (at your option)
+# any later version.
+#
+# Idest 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 idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([default query (v2)])
+AT_KEYWORDS([query v2 query-v2-00])
+
+AT_CHECK([
+genfile -f file -p $abs_srcdir/id3v2 10k
+idest file
+],
+[0],
+[title: File
+album: Idest Test Suite
+track: 1
+comment:eng:: Sample ID3 headers for idest testsuite
+artist: Sergey Poznyakoff
+year: 2011
+genre: Sample headers
+])
+
+AT_CLEANUP
+
diff --git a/tests/query-v2-01.at b/tests/query-v2-01.at
new file mode 100644
index 0000000..0d40aa1
--- /dev/null
+++ b/tests/query-v2-01.at
@@ -0,0 +1,31 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest 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 3, or (at your option)
+# any later version.
+#
+# Idest 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 idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([selected query (v2)])
+AT_KEYWORDS([query v2 query-v2-01])
+
+AT_CHECK([
+genfile -f file -p $abs_srcdir/id3v2 10k
+idest --filter title,comment,year file
+],
+[0],
+[title: File
+comment:eng:: Sample ID3 headers for idest testsuite
+year: 2011
+])
+
+AT_CLEANUP
+
diff --git a/tests/query-v2-02.at b/tests/query-v2-02.at
new file mode 100644
index 0000000..398cc32
--- /dev/null
+++ b/tests/query-v2-02.at
@@ -0,0 +1,31 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest 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 3, or (at your option)
+# any later version.
+#
+# Idest 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 idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([selected query by ID3 IDs (v2)])
+AT_KEYWORDS([query v2 query-v2-02])
+
+AT_CHECK([
+genfile -f file -p $abs_srcdir/id3v2 10k
+idest --filter TIT2,COMM,TDRC file
+],
+[0],
+[TIT2: File
+COMM:eng:: Sample ID3 headers for idest testsuite
+TDRC: 2011
+])
+
+AT_CLEANUP
+
diff --git a/tests/query-v2-03.at b/tests/query-v2-03.at
new file mode 100644
index 0000000..d1e689d
--- /dev/null
+++ b/tests/query-v2-03.at
@@ -0,0 +1,34 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest 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 3, or (at your option)
+# any later version.
+#
+# Idest 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 idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([qualified query (v2)])
+AT_KEYWORDS([query v2 query-v2-03])
+
+AT_CHECK([
+genfile -f file -p $abs_srcdir/id3v2 10k
+idest --filter WXXX file
+echo separator
+idest --filter WXXX:documentation file
+],
+[0],
+[WXXX:documentation: http://www.gnu.org.ua/software/idest/manual
+WXXX:author: http://gray.gnu.org.ua
+separator
+WXXX:documentation: http://www.gnu.org.ua/software/idest/manual
+])
+
+AT_CLEANUP
+
diff --git a/tests/query-v2-04.at b/tests/query-v2-04.at
new file mode 100644
index 0000000..64e535c
--- /dev/null
+++ b/tests/query-v2-04.at
@@ -0,0 +1,52 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest 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 3, or (at your option)
+# any later version.
+#
+# Idest 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 idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([query all (v2)])
+AT_KEYWORDS([query v2 query-v2-04])
+
+AT_CHECK([
+genfile -f file -p $abs_srcdir/id3v2 10k
+idest -a file | sed 's/ *$//'
+],
+[0],
+[TIT2: File
+TALB: Idest Test Suite
+TRCK: 1
+COMM:eng:: Sample ID3 headers for idest testsuite
+TPE1: Sergey Poznyakoff
+TDRC: 2011
+TCON: Sample headers
+TCOP: This file is part of Idest Copyright (C) 2009-2011 Sergey Poznyakoff Idest 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 3, or (at your option) any later version. Idest 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 Idest. If not, see <http://www.gnu.org/licenses/>.
+TENC: Idest
+USLT:eng:: IdEst is an ID3 Edit and Scripting Tool, a command line utility for
+manipulating ID3 tags. ID3 tag is a metadata container which supplies
+related information for a MP3 audio file. It allows information such
+as the title, artist, album, track number, etc. to be stored in the file
+itself.
+
+The idest utility allows to create new tags, and to view,
+modify or delete the existing ones. When compiled with Guile,
+IdEst allows you to write programs of arbitrary complexity for
+manipulating ID3 tags and to apply them to any number of files.
+WPUB: http://www.gnu.org.ua/software/idest
+WXXX:documentation: http://www.gnu.org.ua/software/idest/manual
+WXXX:author: http://gray.gnu.org.ua
+APIC:image/png:5:32x32 sample image: 89504E470D0A1A0A0000000D4948445200000020000000200806000000737A7AF4000000017352474200AECE1CE900000006624B474400FF00FF00FFA0BDA793000000097048597300000B1300000B1301009A9C180000000774494D4507DB071C093A2D7365CBF80000001974455874436F6D6D656E74004372656174656420776974682047494D5057810E17000000954944415458C3ED56D10A002108D3E8FF7F79F7D421125D696107FA16452E5D6E0C00141885826309003313339BF7AFAC40F55EB0FAE2AD1568C9019095CBFF226102D0D1FA6EF97E2F8F72122680049000AE96E3DE749B9D5B5229DD7EE0E4B07419125D21A90DF2CCE801653691169C911991EBE32D98EDF5F65FA0135AE5D8ED07BC04ADAB64EB116DD4822F12A6214900E1001E26BD48441311DC6B0000000049454E44AE426082
+APIC:image/png:0:68x68 sample image: 89504E470D0A1A0A0000000D4948445200000044000000440806000000381393B2000000017352474200AECE1CE900000006624B474400FF00FF00FFA0BDA793000000097048597300000B1300000B1301009A9C180000000774494D4507DB071C0A0032D982A62D0000001974455874436F6D6D656E74004372656174656420776974682047494D5057810E17000000FE4944415478DAEDDADB0E82300C005047F8FF5FAE6F8410196C949B397D3266A9DDB1EB345A22223E628A0101102040800001020408102040800001020408100104081020408000B923C6EC84A594E9F11B7F141CFF7573BDB53B32404E9C21F3B63C7AACF6E65AAEFBB57EB9A6A5CE316B03B5625BF3CC9FAF6DF4311DB2267EB4E0963CB5773922EE1BAAF3176B3D326B455FDD15A77E0EC93C8257CDAFD7DE32B54D6775D2F886CDD6D6651FA921B3D55B8BDB9A15A59443F92FEB90E514CF2A744F9E8CABBDD68D43668BF70CB688D8BC427B72F40ED9E27FAABECB0001020408102040800001020408102040800820408000010204081020401E1F5F46586895430352C20000000049454E44AE426082
+])
+
+AT_CLEANUP
+
diff --git a/tests/set-v1-00.at b/tests/set-v1-00.at
new file mode 100644
index 0000000..24fe2df
--- /dev/null
+++ b/tests/set-v1-00.at
@@ -0,0 +1,52 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest 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 3, or (at your option)
+# any later version.
+#
+# Idest 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 idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([set new fields (v1)])
+AT_KEYWORDS([set v1 set-v1-00])
+
+AT_CHECK([
+genfile -f file 10k
+cp file file.bak
+idest -V1 --set title='Something' album='set v1 00' \
+ track=2 comment='Comment' \
+ artist=gray year=2011 genre=Folk file || exit 1
+echo structure
+idest -i file
+echo tags
+idest file
+echo file data
+dd if=file of=file.raw bs=1024 count=10 2>/dev/null
+cmp file.raw file.bak
+],
+[0],
+[structure
+file: file
+ntags: 1
+version: 1.1
+offset: 10240
+length: 128
+tags
+title: Something
+album: set v1 00
+track: 2
+comment:XXX:: Comment
+artist: gray
+year: 2011
+genre: Folk
+file data
+])
+
+AT_CLEANUP
diff --git a/tests/set-v2-00.at b/tests/set-v2-00.at
new file mode 100644
index 0000000..c1d72a4
--- /dev/null
+++ b/tests/set-v2-00.at
@@ -0,0 +1,69 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznya