From 6a209ca3bd4a5992670b3c6012ff6cfde4cebf6c Mon Sep 17 00:00:00 2001
From: John Darrington <john@darrington.wattle.id.au>
Date: Sun, 30 Jun 2019 10:23:44 +0200
Subject: [PATCH] Added test for the APPLY DICTIONARY command.

There appeared to be no existing test for this command.
---
 tests/automake.mk                  |  1 +
 tests/language/dictionary/apply.at | 50 ++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)
 create mode 100644 tests/language/dictionary/apply.at

diff --git a/tests/automake.mk b/tests/automake.mk
index 3af1e2a278..cfbf271fc3 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -332,6 +332,7 @@ TESTSUITE_AT = \
 	tests/language/data-io/save-translate.at \
 	tests/language/data-io/update.at \
 	tests/language/dictionary/attributes.at \
+	tests/language/dictionary/apply.at \
 	tests/language/dictionary/delete-variables.at \
 	tests/language/dictionary/formats.at \
 	tests/language/dictionary/missing-values.at \
diff --git a/tests/language/dictionary/apply.at b/tests/language/dictionary/apply.at
new file mode 100644
index 0000000000..adfff8da9d
--- /dev/null
+++ b/tests/language/dictionary/apply.at
@@ -0,0 +1,50 @@
+dnl PSPP - a program for statistical analysis.
+dnl Copyright (C) 2019 Free Software Foundation, Inc.
+dnl
+dnl This program is free software: you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation, either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
+dnl
+AT_BANNER([APPLY DICTIONARY])
+
+AT_SETUP([APPLY DICTIONARY])
+AT_DATA([apply-dict.sps], [dnl
+data list notable list /foo (TIME22.0) bar (a22).
+begin data
+end data.
+Variable label foo "This is a label".
+save outfile='ugg.sav'.
+
+new file.
+data list notable list /foo bar *.
+begin data
+end data.
+display dictionary.
+apply dictionary from = 'ugg.sav'.
+display dictionary.
+])
+
+AT_CHECK([pspp -O format=csv apply-dict.sps], [0],  [dnl
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+foo,1,,Scale,Input,8,Right,F8.2,F8.2,
+bar,2,,Scale,Input,8,Right,F8.2,F8.2,
+
+"apply-dict.sps:12: warning: APPLY DICTIONARY: Variable bar is numeric in target file, but string in source file."
+
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+foo,1,This is a label,Scale,Input,8,Right,TIME22.0,TIME22.0,
+bar,2,,Scale,Input,8,Right,F8.2,F8.2,
+])
+
+AT_CLEANUP
-- 
2.30.2