sys-file-reader: Successfully read files with duplicate names.
[pspp] / tests / data / sys-file-reader.at
index 4b7a2b541fc306e0b903670085932916b859bbd4..3bbc8060d6185896cefa0a81f05564ea18db2d02 100644 (file)
@@ -140,11 +140,11 @@ File label: PSPP synthetic test file: ôõöø
 
 Variable,Description,,Position
 num1,Format: F8.0,,1
-num2,Numeric variable 2's label (ùúû),,2
+num2,Label: Numeric variable 2's label (ùúû),,2
 ,Format: F8.0,,
 num3,Format: F8.0,,3
 ,Missing Values: 1,,
-num4,Another numeric variable label,,4
+num4,Label: Another numeric variable label,,4
 ,Format: F8.0,,
 ,Missing Values: 1,,
 num5,Format: F8.0,,5
@@ -160,11 +160,11 @@ num9,Format: F8.0,,9
 numàèìñò,Format: F8.0,,10
 ,Missing Values: LOWEST THRU 1; 5,,
 str1,Format: A4,,11
-str2,String variable 2's label,,12
+str2,Label: String variable 2's label,,12
 ,Format: A4,,
 str3,Format: A4,,13
 ,"Missing Values: ""MISS""",,
-str4,Another string variable label,,14
+str4,Label: Another string variable label,,14
 ,Format: A4,,
 ,"Missing Values: ""OTHR""",,
 str5,Format: A4,,15
@@ -179,7 +179,7 @@ str9,Format: A10,,19
 ,"Missing Values: ""abcdefgh""; ""01234567""",,
 str10,Format: A11,,20
 ,"Missing Values: ""abcdefgh""; ""01234567""; ""0       """,,
-str11,25-byte string,,21
+str11,Label: 25-byte string,,21
 ,Format: A25,,
 
 Table: Data List
@@ -232,7 +232,7 @@ LIST.
   AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
 Variable,Description,,Position
 num1,Format: F8.0,,1
-num2,Numeric variable 2's label,,2
+num2,Label: Numeric variable 2's label,,2
 ,Format: F8.0,,
 
 Table: Data List
@@ -288,7 +288,7 @@ LIST.
   AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
 Variable,Description,,Position
 num1,Format: F8.0,,1
-num2,Numeric variable 2's label,,2
+num2,Label: Numeric variable 2's label,,2
 ,Format: F8.0,,
 
 Table: Data List
@@ -1755,6 +1755,8 @@ do
 done
 AT_CLEANUP
 
+dnl SPSS-generated system file can contain duplicate variable names
+dnl (see bug #41475).
 AT_SETUP([duplicate variable name])
 AT_KEYWORDS([sack synthetic system file negative])
 AT_DATA([sys-file.sack], [dnl
@@ -1777,9 +1779,20 @@ do
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
 ])
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+DISPLAY DICTIONARY.
 ])
-  AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
-   [error: `sys-file.sav' near offset 0xd4: Duplicate variable name `VAR1'.
+  AT_CHECK([pspp -O format=csv sys-file.sps], [0],
+   [warning: `sys-file.sav' near offset 0xd4: Renaming variable with duplicate name `VAR1' to `VAR001'.
+
+Variable,Description,,Position
+var1,Format: F8.0,,1
+,Measure: Scale,,
+,Display Alignment: Right,,
+,Display Width: 8,,
+var001,Format: F8.0,,2
+,Measure: Scale,,
+,Display Alignment: Right,,
+,Display Width: 8,,
 ])
 done
 AT_CLEANUP
@@ -3811,7 +3824,7 @@ AT_CLEANUP
 
 AT_SETUP([zcompressed data - wrong compressed_ofs])
 AT_KEYWORDS([sack synthetic system file negative zlib])
-zcompressed_sack | sed 's/.*\bcompressed_ofs.*/i64 >>0x191<<;/' > sys-file.sack
+zcompressed_sack | sed 's/.*@%:@ compressed_ofs.*/i64 >>0x191<<;/' > sys-file.sack
 for variant in \
        "be 652e28f8d3f8e4ce47ad18d0f30e7bb9" \
        "le ebf2c647f2d7c47858d4f5ed683526e6"
@@ -3914,7 +3927,7 @@ AT_CLEANUP
 AT_SETUP([zcompressed data - compression expands data too much])
 AT_KEYWORDS([sack synthetic system file negative zlib])
 zcompressed_sack | sed 's/.*uncompressed_size.*/>>50<<;/
-s/.*\bcompressed_size.*/>>100<<;/' > sys-file.sack
+s/.*@%:@ compressed_size.*/>>100<<;/' > sys-file.sack
 for variant in \
        "be e11cadde5f0855c965a1cb388dedc36e" \
        "le 37953e71462b6554c5644fec8b539164"
@@ -3931,7 +3944,7 @@ AT_CLEANUP
 
 AT_SETUP([zcompressed data - compressed sizes don't add up])
 AT_KEYWORDS([sack synthetic system file negative zlib])
-zcompressed_sack | sed 's/.*\bcompressed_size.*/>>88<<;/' > sys-file.sack
+zcompressed_sack | sed 's/.*@%:@ compressed_size.*/>>88<<;/' > sys-file.sack
 for variant in \
        "be 366eaf85be1f26fb6549e2f8ee393628" \
        "le a756e5125e6a908cb4990f66cc419bef"