Added test for the APPLY DICTIONARY command.
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 30 Jun 2019 08:23:44 +0000 (10:23 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 30 Jun 2019 08:23:44 +0000 (10:23 +0200)
There appeared to be no existing test for this command.

tests/automake.mk
tests/language/dictionary/apply.at [new file with mode: 0644]

index 3af1e2a278a16fc976e4a7683d5737ab76329ee5..cfbf271fc3a94e5f373bbab785cfabb332ac5d55 100644 (file)
@@ -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 (file)
index 0000000..adfff8d
--- /dev/null
@@ -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