From b9bff22c5a75f422a0eb84226a9b7f8551355618 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Thu, 7 May 2015 18:08:46 +0000 Subject: [PATCH] YAML: Enable the YAMLParser tests. This commit enables the tests located in test/YAMLParser directory. Those tests were never actually enabled, as llvm-lit didn't pick up the files with the 'data' extension. The commit renames those test files to files with the 'test' extension so that llvm-lit would find them. This commit also modifies yaml-bench so that it returns an error status if an error occurred during parsing. It also adds the '-use-color' command line option to yaml-bench (to make sure that file check matches the error messages in the output stream). This commit modifies some of the renamed tests so that they wouldn't fail. It gets rid of XFAILs and uses the 'not' command instead for some of the tests that have to fail during parsing. This commit also adds some 'FIXME' comments to a couple of tests that are supposed to fail but currently pass because of various bugs in the implementation of the yaml parser. Reviewers: Justin Bogner Differential Revision: http://reviews.llvm.org/D9448 llvm-svn: 236754 --- include/llvm/Support/YAMLParser.h | 4 ++-- lib/Support/YAMLParser.cpp | 23 +++++++++++-------- test/YAMLParser/{bool.data => bool.test} | 0 ...onstruct-bool.data => construct-bool.test} | 0 ...ruct-custom.data => construct-custom.test} | 0 ...struct-float.data => construct-float.test} | 0 ...{construct-int.data => construct-int.test} | 0 ...{construct-map.data => construct-map.test} | 0 ...struct-merge.data => construct-merge.test} | 0 ...onstruct-null.data => construct-null.test} | 0 ...onstruct-omap.data => construct-omap.test} | 0 ...struct-pairs.data => construct-pairs.test} | 0 ...{construct-seq.data => construct-seq.test} | 0 ...{construct-set.data => construct-set.test} | 0 ...tr-ascii.data => construct-str-ascii.test} | 0 ...{construct-str.data => construct-str.test} | 0 ...imestamp.data => construct-timestamp.test} | 0 ...struct-value.data => construct-value.test} | 0 ...=> duplicate-key.former-loader-error.test} | 0 ...cate-mapping-key.former-loader-error.test} | 0 ...licate-merge-key.former-loader-error.test} | 0 ...licate-value-key.former-loader-error.test} | 0 ...ock-scalar-in-simple-key-context-bug.test} | 0 ...ument-bug.data => empty-document-bug.test} | 0 test/YAMLParser/{float.data => float.test} | 0 test/YAMLParser/{int.data => int.test} | 0 ...bug.data => invalid-single-quote-bug.test} | 0 test/YAMLParser/{merge.data => merge.test} | 0 .../{more-floats.data => more-floats.test} | 0 ...float-bug.data => negative-float-bug.test} | 0 test/YAMLParser/{null.data => null.test} | 0 .../{resolver.data => resolver.test} | 0 ...ash-bug.data => run-parser-crash-bug.test} | 0 ...nd-bug.data => scan-document-end-bug.test} | 0 ...reak-bug.data => scan-line-break-bug.test} | 0 ....data => single-dot-is-not-float-bug.test} | 0 ...dentation.data => sloppy-indentation.test} | 0 .../{spec-02-01.data => spec-02-01.test} | 0 .../{spec-02-02.data => spec-02-02.test} | 0 .../{spec-02-03.data => spec-02-03.test} | 0 .../{spec-02-04.data => spec-02-04.test} | 0 .../{spec-02-05.data => spec-02-05.test} | 0 .../{spec-02-06.data => spec-02-06.test} | 0 .../{spec-02-07.data => spec-02-07.test} | 0 .../{spec-02-08.data => spec-02-08.test} | 0 .../{spec-02-09.data => spec-02-09.test} | 0 .../{spec-02-10.data => spec-02-10.test} | 0 .../{spec-02-11.data => spec-02-11.test} | 0 .../{spec-02-12.data => spec-02-12.test} | 0 .../{spec-02-13.data => spec-02-13.test} | 0 .../{spec-02-14.data => spec-02-14.test} | 0 .../{spec-02-15.data => spec-02-15.test} | 0 .../{spec-02-16.data => spec-02-16.test} | 0 .../{spec-02-17.data => spec-02-17.test} | 0 .../{spec-02-18.data => spec-02-18.test} | 0 .../{spec-02-19.data => spec-02-19.test} | 0 .../{spec-02-20.data => spec-02-20.test} | 0 .../{spec-02-21.data => spec-02-21.test} | 0 .../{spec-02-22.data => spec-02-22.test} | 0 .../{spec-02-23.data => spec-02-23.test} | 0 .../{spec-02-24.data => spec-02-24.test} | 0 .../{spec-02-25.data => spec-02-25.test} | 0 .../{spec-02-26.data => spec-02-26.test} | 0 .../{spec-02-27.data => spec-02-27.test} | 0 .../{spec-02-28.data => spec-02-28.test} | 0 ...c-05-01-utf8.data => spec-05-01-utf8.test} | 0 ...c-05-02-utf8.data => spec-05-02-utf8.test} | 2 +- .../{spec-05-03.data => spec-05-03.test} | 0 .../{spec-05-04.data => spec-05-04.test} | 0 .../{spec-05-05.data => spec-05-05.test} | 0 .../{spec-05-06.data => spec-05-06.test} | 0 .../{spec-05-07.data => spec-05-07.test} | 0 .../{spec-05-08.data => spec-05-08.test} | 0 .../{spec-05-09.data => spec-05-09.test} | 0 .../{spec-05-10.data => spec-05-10.test} | 2 +- .../{spec-05-11.data => spec-05-11.test} | 0 .../{spec-05-12.data => spec-05-12.test} | 6 +++-- .../{spec-05-13.data => spec-05-13.test} | 0 .../{spec-05-14.data => spec-05-14.test} | 0 test/YAMLParser/spec-05-15.data | 7 ------ test/YAMLParser/spec-05-15.test | 7 ++++++ .../{spec-06-01.data => spec-06-01.test} | 0 .../{spec-06-02.data => spec-06-02.test} | 0 .../{spec-06-03.data => spec-06-03.test} | 0 .../{spec-06-04.data => spec-06-04.test} | 0 .../{spec-06-05.data => spec-06-05.test} | 0 .../{spec-06-06.data => spec-06-06.test} | 0 .../{spec-06-07.data => spec-06-07.test} | 0 .../{spec-06-08.data => spec-06-08.test} | 0 .../{spec-07-01.data => spec-07-01.test} | 0 .../{spec-07-02.data => spec-07-02.test} | 0 test/YAMLParser/spec-07-03.data | 7 ------ test/YAMLParser/spec-07-03.test | 7 ++++++ .../{spec-07-04.data => spec-07-04.test} | 0 test/YAMLParser/spec-07-05.data | 10 -------- test/YAMLParser/spec-07-05.test | 8 +++++++ .../{spec-07-06.data => spec-07-06.test} | 0 .../{spec-07-07a.data => spec-07-07a.test} | 0 .../{spec-07-07b.data => spec-07-07b.test} | 0 .../{spec-07-08.data => spec-07-08.test} | 0 .../{spec-07-09.data => spec-07-09.test} | 0 .../{spec-07-10.data => spec-07-10.test} | 0 .../{spec-07-11.data => spec-07-11.test} | 0 .../{spec-07-12a.data => spec-07-12a.test} | 0 .../{spec-07-12b.data => spec-07-12b.test} | 0 .../{spec-07-13.data => spec-07-13.test} | 0 .../{spec-08-01.data => spec-08-01.test} | 0 .../{spec-08-02.data => spec-08-02.test} | 0 .../{spec-08-03.data => spec-08-03.test} | 0 test/YAMLParser/spec-08-04.data | 9 -------- test/YAMLParser/spec-08-04.test | 7 ++++++ .../{spec-08-05.data => spec-08-05.test} | 0 .../{spec-08-06.data => spec-08-06.test} | 5 ++-- .../{spec-08-07.data => spec-08-07.test} | 0 .../{spec-08-08.data => spec-08-08.test} | 0 .../{spec-08-09.data => spec-08-09.test} | 0 .../{spec-08-10.data => spec-08-10.test} | 0 .../{spec-08-11.data => spec-08-11.test} | 0 .../{spec-08-12.data => spec-08-12.test} | 0 .../{spec-08-13.data => spec-08-13.test} | 0 .../{spec-08-14.data => spec-08-14.test} | 0 .../{spec-08-15.data => spec-08-15.test} | 0 .../{spec-09-01.data => spec-09-01.test} | 0 test/YAMLParser/spec-09-02.data | 14 ----------- test/YAMLParser/spec-09-02.test | 14 +++++++++++ .../{spec-09-03.data => spec-09-03.test} | 0 .../{spec-09-04.data => spec-09-04.test} | 0 .../{spec-09-05.data => spec-09-05.test} | 0 .../{spec-09-06.data => spec-09-06.test} | 0 .../{spec-09-07.data => spec-09-07.test} | 0 .../{spec-09-08.data => spec-09-08.test} | 0 .../{spec-09-09.data => spec-09-09.test} | 0 .../{spec-09-10.data => spec-09-10.test} | 0 .../{spec-09-11.data => spec-09-11.test} | 0 .../{spec-09-12.data => spec-09-12.test} | 0 .../{spec-09-13.data => spec-09-13.test} | 0 test/YAMLParser/spec-09-14.data | 21 ----------------- test/YAMLParser/spec-09-14.test | 21 +++++++++++++++++ .../{spec-09-15.data => spec-09-15.test} | 0 .../{spec-09-16.data => spec-09-16.test} | 0 .../{spec-09-17.data => spec-09-17.test} | 0 .../{spec-09-18.data => spec-09-18.test} | 0 .../{spec-09-19.data => spec-09-19.test} | 0 .../{spec-09-20.data => spec-09-20.test} | 0 .../{spec-09-21.data => spec-09-21.test} | 2 +- .../{spec-09-22.data => spec-09-22.test} | 0 .../{spec-09-23.data => spec-09-23.test} | 0 .../{spec-09-24.data => spec-09-24.test} | 0 .../{spec-09-25.data => spec-09-25.test} | 0 .../{spec-09-26.data => spec-09-26.test} | 0 .../{spec-09-27.data => spec-09-27.test} | 0 .../{spec-09-28.data => spec-09-28.test} | 0 .../{spec-09-29.data => spec-09-29.test} | 0 .../{spec-09-30.data => spec-09-30.test} | 0 .../{spec-09-31.data => spec-09-31.test} | 0 .../{spec-09-32.data => spec-09-32.test} | 0 .../{spec-09-33.data => spec-09-33.test} | 0 .../{spec-10-01.data => spec-10-01.test} | 0 .../{spec-10-02.data => spec-10-02.test} | 0 .../{spec-10-03.data => spec-10-03.test} | 0 .../{spec-10-04.data => spec-10-04.test} | 0 .../{spec-10-05.data => spec-10-05.test} | 0 .../{spec-10-06.data => spec-10-06.test} | 0 .../{spec-10-07.data => spec-10-07.test} | 0 .../{spec-10-08.data => spec-10-08.test} | 8 +++---- .../{spec-10-09.data => spec-10-09.test} | 0 .../{spec-10-10.data => spec-10-10.test} | 0 .../{spec-10-11.data => spec-10-11.test} | 0 .../{spec-10-12.data => spec-10-12.test} | 0 .../{spec-10-13.data => spec-10-13.test} | 0 .../{spec-10-14.data => spec-10-14.test} | 0 .../{spec-10-15.data => spec-10-15.test} | 0 test/YAMLParser/{str.data => str.test} | 0 ...imestamp-bugs.data => timestamp-bugs.test} | 0 .../{timestamp.data => timestamp.test} | 0 ...{utf8-implicit.data => utf8-implicit.test} | 0 test/YAMLParser/{utf8.data => utf8.test} | 0 test/YAMLParser/{value.data => value.test} | 0 test/YAMLParser/{yaml.data => yaml.test} | 0 utils/yaml-bench/YAMLBench.cpp | 12 +++++++++- 180 files changed, 104 insertions(+), 92 deletions(-) rename test/YAMLParser/{bool.data => bool.test} (100%) rename test/YAMLParser/{construct-bool.data => construct-bool.test} (100%) rename test/YAMLParser/{construct-custom.data => construct-custom.test} (100%) rename test/YAMLParser/{construct-float.data => construct-float.test} (100%) rename test/YAMLParser/{construct-int.data => construct-int.test} (100%) rename test/YAMLParser/{construct-map.data => construct-map.test} (100%) rename test/YAMLParser/{construct-merge.data => construct-merge.test} (100%) rename test/YAMLParser/{construct-null.data => construct-null.test} (100%) rename test/YAMLParser/{construct-omap.data => construct-omap.test} (100%) rename test/YAMLParser/{construct-pairs.data => construct-pairs.test} (100%) rename test/YAMLParser/{construct-seq.data => construct-seq.test} (100%) rename test/YAMLParser/{construct-set.data => construct-set.test} (100%) rename test/YAMLParser/{construct-str-ascii.data => construct-str-ascii.test} (100%) rename test/YAMLParser/{construct-str.data => construct-str.test} (100%) rename test/YAMLParser/{construct-timestamp.data => construct-timestamp.test} (100%) rename test/YAMLParser/{construct-value.data => construct-value.test} (100%) rename test/YAMLParser/{duplicate-key.former-loader-error.data => duplicate-key.former-loader-error.test} (100%) rename test/YAMLParser/{duplicate-mapping-key.former-loader-error.data => duplicate-mapping-key.former-loader-error.test} (100%) rename test/YAMLParser/{duplicate-merge-key.former-loader-error.data => duplicate-merge-key.former-loader-error.test} (100%) rename test/YAMLParser/{duplicate-value-key.former-loader-error.data => duplicate-value-key.former-loader-error.test} (100%) rename test/YAMLParser/{emit-block-scalar-in-simple-key-context-bug.data => emit-block-scalar-in-simple-key-context-bug.test} (100%) rename test/YAMLParser/{empty-document-bug.data => empty-document-bug.test} (100%) rename test/YAMLParser/{float.data => float.test} (100%) rename test/YAMLParser/{int.data => int.test} (100%) rename test/YAMLParser/{invalid-single-quote-bug.data => invalid-single-quote-bug.test} (100%) rename test/YAMLParser/{merge.data => merge.test} (100%) rename test/YAMLParser/{more-floats.data => more-floats.test} (100%) rename test/YAMLParser/{negative-float-bug.data => negative-float-bug.test} (100%) rename test/YAMLParser/{null.data => null.test} (100%) rename test/YAMLParser/{resolver.data => resolver.test} (100%) rename test/YAMLParser/{run-parser-crash-bug.data => run-parser-crash-bug.test} (100%) rename test/YAMLParser/{scan-document-end-bug.data => scan-document-end-bug.test} (100%) rename test/YAMLParser/{scan-line-break-bug.data => scan-line-break-bug.test} (100%) rename test/YAMLParser/{single-dot-is-not-float-bug.data => single-dot-is-not-float-bug.test} (100%) rename test/YAMLParser/{sloppy-indentation.data => sloppy-indentation.test} (100%) rename test/YAMLParser/{spec-02-01.data => spec-02-01.test} (100%) rename test/YAMLParser/{spec-02-02.data => spec-02-02.test} (100%) rename test/YAMLParser/{spec-02-03.data => spec-02-03.test} (100%) rename test/YAMLParser/{spec-02-04.data => spec-02-04.test} (100%) rename test/YAMLParser/{spec-02-05.data => spec-02-05.test} (100%) rename test/YAMLParser/{spec-02-06.data => spec-02-06.test} (100%) rename test/YAMLParser/{spec-02-07.data => spec-02-07.test} (100%) rename test/YAMLParser/{spec-02-08.data => spec-02-08.test} (100%) rename test/YAMLParser/{spec-02-09.data => spec-02-09.test} (100%) rename test/YAMLParser/{spec-02-10.data => spec-02-10.test} (100%) rename test/YAMLParser/{spec-02-11.data => spec-02-11.test} (100%) rename test/YAMLParser/{spec-02-12.data => spec-02-12.test} (100%) rename test/YAMLParser/{spec-02-13.data => spec-02-13.test} (100%) rename test/YAMLParser/{spec-02-14.data => spec-02-14.test} (100%) rename test/YAMLParser/{spec-02-15.data => spec-02-15.test} (100%) rename test/YAMLParser/{spec-02-16.data => spec-02-16.test} (100%) rename test/YAMLParser/{spec-02-17.data => spec-02-17.test} (100%) rename test/YAMLParser/{spec-02-18.data => spec-02-18.test} (100%) rename test/YAMLParser/{spec-02-19.data => spec-02-19.test} (100%) rename test/YAMLParser/{spec-02-20.data => spec-02-20.test} (100%) rename test/YAMLParser/{spec-02-21.data => spec-02-21.test} (100%) rename test/YAMLParser/{spec-02-22.data => spec-02-22.test} (100%) rename test/YAMLParser/{spec-02-23.data => spec-02-23.test} (100%) rename test/YAMLParser/{spec-02-24.data => spec-02-24.test} (100%) rename test/YAMLParser/{spec-02-25.data => spec-02-25.test} (100%) rename test/YAMLParser/{spec-02-26.data => spec-02-26.test} (100%) rename test/YAMLParser/{spec-02-27.data => spec-02-27.test} (100%) rename test/YAMLParser/{spec-02-28.data => spec-02-28.test} (100%) rename test/YAMLParser/{spec-05-01-utf8.data => spec-05-01-utf8.test} (100%) rename test/YAMLParser/{spec-05-02-utf8.data => spec-05-02-utf8.test} (53%) rename test/YAMLParser/{spec-05-03.data => spec-05-03.test} (100%) rename test/YAMLParser/{spec-05-04.data => spec-05-04.test} (100%) rename test/YAMLParser/{spec-05-05.data => spec-05-05.test} (100%) rename test/YAMLParser/{spec-05-06.data => spec-05-06.test} (100%) rename test/YAMLParser/{spec-05-07.data => spec-05-07.test} (100%) rename test/YAMLParser/{spec-05-08.data => spec-05-08.test} (100%) rename test/YAMLParser/{spec-05-09.data => spec-05-09.test} (100%) rename test/YAMLParser/{spec-05-10.data => spec-05-10.test} (50%) rename test/YAMLParser/{spec-05-11.data => spec-05-11.test} (100%) rename test/YAMLParser/{spec-05-12.data => spec-05-12.test} (61%) rename test/YAMLParser/{spec-05-13.data => spec-05-13.test} (100%) rename test/YAMLParser/{spec-05-14.data => spec-05-14.test} (100%) delete mode 100644 test/YAMLParser/spec-05-15.data create mode 100644 test/YAMLParser/spec-05-15.test rename test/YAMLParser/{spec-06-01.data => spec-06-01.test} (100%) rename test/YAMLParser/{spec-06-02.data => spec-06-02.test} (100%) rename test/YAMLParser/{spec-06-03.data => spec-06-03.test} (100%) rename test/YAMLParser/{spec-06-04.data => spec-06-04.test} (100%) rename test/YAMLParser/{spec-06-05.data => spec-06-05.test} (100%) rename test/YAMLParser/{spec-06-06.data => spec-06-06.test} (100%) rename test/YAMLParser/{spec-06-07.data => spec-06-07.test} (100%) rename test/YAMLParser/{spec-06-08.data => spec-06-08.test} (100%) rename test/YAMLParser/{spec-07-01.data => spec-07-01.test} (100%) rename test/YAMLParser/{spec-07-02.data => spec-07-02.test} (100%) delete mode 100644 test/YAMLParser/spec-07-03.data create mode 100644 test/YAMLParser/spec-07-03.test rename test/YAMLParser/{spec-07-04.data => spec-07-04.test} (100%) delete mode 100644 test/YAMLParser/spec-07-05.data create mode 100644 test/YAMLParser/spec-07-05.test rename test/YAMLParser/{spec-07-06.data => spec-07-06.test} (100%) rename test/YAMLParser/{spec-07-07a.data => spec-07-07a.test} (100%) rename test/YAMLParser/{spec-07-07b.data => spec-07-07b.test} (100%) rename test/YAMLParser/{spec-07-08.data => spec-07-08.test} (100%) rename test/YAMLParser/{spec-07-09.data => spec-07-09.test} (100%) rename test/YAMLParser/{spec-07-10.data => spec-07-10.test} (100%) rename test/YAMLParser/{spec-07-11.data => spec-07-11.test} (100%) rename test/YAMLParser/{spec-07-12a.data => spec-07-12a.test} (100%) rename test/YAMLParser/{spec-07-12b.data => spec-07-12b.test} (100%) rename test/YAMLParser/{spec-07-13.data => spec-07-13.test} (100%) rename test/YAMLParser/{spec-08-01.data => spec-08-01.test} (100%) rename test/YAMLParser/{spec-08-02.data => spec-08-02.test} (100%) rename test/YAMLParser/{spec-08-03.data => spec-08-03.test} (100%) delete mode 100644 test/YAMLParser/spec-08-04.data create mode 100644 test/YAMLParser/spec-08-04.test rename test/YAMLParser/{spec-08-05.data => spec-08-05.test} (100%) rename test/YAMLParser/{spec-08-06.data => spec-08-06.test} (55%) rename test/YAMLParser/{spec-08-07.data => spec-08-07.test} (100%) rename test/YAMLParser/{spec-08-08.data => spec-08-08.test} (100%) rename test/YAMLParser/{spec-08-09.data => spec-08-09.test} (100%) rename test/YAMLParser/{spec-08-10.data => spec-08-10.test} (100%) rename test/YAMLParser/{spec-08-11.data => spec-08-11.test} (100%) rename test/YAMLParser/{spec-08-12.data => spec-08-12.test} (100%) rename test/YAMLParser/{spec-08-13.data => spec-08-13.test} (100%) rename test/YAMLParser/{spec-08-14.data => spec-08-14.test} (100%) rename test/YAMLParser/{spec-08-15.data => spec-08-15.test} (100%) rename test/YAMLParser/{spec-09-01.data => spec-09-01.test} (100%) delete mode 100644 test/YAMLParser/spec-09-02.data create mode 100644 test/YAMLParser/spec-09-02.test rename test/YAMLParser/{spec-09-03.data => spec-09-03.test} (100%) rename test/YAMLParser/{spec-09-04.data => spec-09-04.test} (100%) rename test/YAMLParser/{spec-09-05.data => spec-09-05.test} (100%) rename test/YAMLParser/{spec-09-06.data => spec-09-06.test} (100%) rename test/YAMLParser/{spec-09-07.data => spec-09-07.test} (100%) rename test/YAMLParser/{spec-09-08.data => spec-09-08.test} (100%) rename test/YAMLParser/{spec-09-09.data => spec-09-09.test} (100%) rename test/YAMLParser/{spec-09-10.data => spec-09-10.test} (100%) rename test/YAMLParser/{spec-09-11.data => spec-09-11.test} (100%) rename test/YAMLParser/{spec-09-12.data => spec-09-12.test} (100%) rename test/YAMLParser/{spec-09-13.data => spec-09-13.test} (100%) delete mode 100644 test/YAMLParser/spec-09-14.data create mode 100644 test/YAMLParser/spec-09-14.test rename test/YAMLParser/{spec-09-15.data => spec-09-15.test} (100%) rename test/YAMLParser/{spec-09-16.data => spec-09-16.test} (100%) rename test/YAMLParser/{spec-09-17.data => spec-09-17.test} (100%) rename test/YAMLParser/{spec-09-18.data => spec-09-18.test} (100%) rename test/YAMLParser/{spec-09-19.data => spec-09-19.test} (100%) rename test/YAMLParser/{spec-09-20.data => spec-09-20.test} (100%) rename test/YAMLParser/{spec-09-21.data => spec-09-21.test} (50%) rename test/YAMLParser/{spec-09-22.data => spec-09-22.test} (100%) rename test/YAMLParser/{spec-09-23.data => spec-09-23.test} (100%) rename test/YAMLParser/{spec-09-24.data => spec-09-24.test} (100%) rename test/YAMLParser/{spec-09-25.data => spec-09-25.test} (100%) rename test/YAMLParser/{spec-09-26.data => spec-09-26.test} (100%) rename test/YAMLParser/{spec-09-27.data => spec-09-27.test} (100%) rename test/YAMLParser/{spec-09-28.data => spec-09-28.test} (100%) rename test/YAMLParser/{spec-09-29.data => spec-09-29.test} (100%) rename test/YAMLParser/{spec-09-30.data => spec-09-30.test} (100%) rename test/YAMLParser/{spec-09-31.data => spec-09-31.test} (100%) rename test/YAMLParser/{spec-09-32.data => spec-09-32.test} (100%) rename test/YAMLParser/{spec-09-33.data => spec-09-33.test} (100%) rename test/YAMLParser/{spec-10-01.data => spec-10-01.test} (100%) rename test/YAMLParser/{spec-10-02.data => spec-10-02.test} (100%) rename test/YAMLParser/{spec-10-03.data => spec-10-03.test} (100%) rename test/YAMLParser/{spec-10-04.data => spec-10-04.test} (100%) rename test/YAMLParser/{spec-10-05.data => spec-10-05.test} (100%) rename test/YAMLParser/{spec-10-06.data => spec-10-06.test} (100%) rename test/YAMLParser/{spec-10-07.data => spec-10-07.test} (100%) rename test/YAMLParser/{spec-10-08.data => spec-10-08.test} (91%) rename test/YAMLParser/{spec-10-09.data => spec-10-09.test} (100%) rename test/YAMLParser/{spec-10-10.data => spec-10-10.test} (100%) rename test/YAMLParser/{spec-10-11.data => spec-10-11.test} (100%) rename test/YAMLParser/{spec-10-12.data => spec-10-12.test} (100%) rename test/YAMLParser/{spec-10-13.data => spec-10-13.test} (100%) rename test/YAMLParser/{spec-10-14.data => spec-10-14.test} (100%) rename test/YAMLParser/{spec-10-15.data => spec-10-15.test} (100%) rename test/YAMLParser/{str.data => str.test} (100%) rename test/YAMLParser/{timestamp-bugs.data => timestamp-bugs.test} (100%) rename test/YAMLParser/{timestamp.data => timestamp.test} (100%) rename test/YAMLParser/{utf8-implicit.data => utf8-implicit.test} (100%) rename test/YAMLParser/{utf8.data => utf8.test} (100%) rename test/YAMLParser/{value.data => value.test} (100%) rename test/YAMLParser/{yaml.data => yaml.test} (100%) diff --git a/include/llvm/Support/YAMLParser.h b/include/llvm/Support/YAMLParser.h index db888b816cf..37becaa7b6d 100644 --- a/include/llvm/Support/YAMLParser.h +++ b/include/llvm/Support/YAMLParser.h @@ -76,9 +76,9 @@ std::string escape(StringRef Input); class Stream { public: /// \brief This keeps a reference to the string referenced by \p Input. - Stream(StringRef Input, SourceMgr &); + Stream(StringRef Input, SourceMgr &, bool ShowColors = true); - Stream(MemoryBufferRef InputBuffer, SourceMgr &); + Stream(MemoryBufferRef InputBuffer, SourceMgr &, bool ShowColors = true); ~Stream(); document_iterator begin(); diff --git a/lib/Support/YAMLParser.cpp b/lib/Support/YAMLParser.cpp index cb21eb58e94..83c96510846 100644 --- a/lib/Support/YAMLParser.cpp +++ b/lib/Support/YAMLParser.cpp @@ -260,8 +260,8 @@ namespace yaml { /// @brief Scans YAML tokens from a MemoryBuffer. class Scanner { public: - Scanner(StringRef Input, SourceMgr &SM); - Scanner(MemoryBufferRef Buffer, SourceMgr &SM_); + Scanner(StringRef Input, SourceMgr &SM, bool ShowColors = true); + Scanner(MemoryBufferRef Buffer, SourceMgr &SM_, bool ShowColors = true); /// @brief Parse the next token and return it without popping it. Token &peekNext(); @@ -271,7 +271,7 @@ public: void printError(SMLoc Loc, SourceMgr::DiagKind Kind, const Twine &Message, ArrayRef Ranges = None) { - SM.PrintMessage(Loc, Kind, Message, Ranges); + SM.PrintMessage(Loc, Kind, Message, Ranges, /* FixIts= */ None, ShowColors); } void setError(const Twine &Message, StringRef::iterator Position) { @@ -505,6 +505,9 @@ private: /// @brief True if an error has occurred. bool Failed; + /// @brief Should colors be used when printing out the diagnostic messages? + bool ShowColors; + /// @brief Queue of tokens. This is required to queue up tokens while looking /// for the end of a simple key. And for cases where a single character /// can produce multiple tokens (e.g. BlockEnd). @@ -706,11 +709,13 @@ std::string yaml::escape(StringRef Input) { return EscapedInput; } -Scanner::Scanner(StringRef Input, SourceMgr &sm) : SM(sm) { +Scanner::Scanner(StringRef Input, SourceMgr &sm, bool ShowColors) + : SM(sm), ShowColors(ShowColors) { init(MemoryBufferRef(Input, "YAML")); } -Scanner::Scanner(MemoryBufferRef Buffer, SourceMgr &SM_) : SM(SM_) { +Scanner::Scanner(MemoryBufferRef Buffer, SourceMgr &SM_, bool ShowColors) + : SM(SM_), ShowColors(ShowColors) { init(Buffer); } @@ -1525,11 +1530,11 @@ bool Scanner::fetchMoreTokens() { return false; } -Stream::Stream(StringRef Input, SourceMgr &SM) - : scanner(new Scanner(Input, SM)), CurrentDoc() {} +Stream::Stream(StringRef Input, SourceMgr &SM, bool ShowColors) + : scanner(new Scanner(Input, SM, ShowColors)), CurrentDoc() {} -Stream::Stream(MemoryBufferRef InputBuffer, SourceMgr &SM) - : scanner(new Scanner(InputBuffer, SM)), CurrentDoc() {} +Stream::Stream(MemoryBufferRef InputBuffer, SourceMgr &SM, bool ShowColors) + : scanner(new Scanner(InputBuffer, SM, ShowColors)), CurrentDoc() {} Stream::~Stream() {} diff --git a/test/YAMLParser/bool.data b/test/YAMLParser/bool.test similarity index 100% rename from test/YAMLParser/bool.data rename to test/YAMLParser/bool.test diff --git a/test/YAMLParser/construct-bool.data b/test/YAMLParser/construct-bool.test similarity index 100% rename from test/YAMLParser/construct-bool.data rename to test/YAMLParser/construct-bool.test diff --git a/test/YAMLParser/construct-custom.data b/test/YAMLParser/construct-custom.test similarity index 100% rename from test/YAMLParser/construct-custom.data rename to test/YAMLParser/construct-custom.test diff --git a/test/YAMLParser/construct-float.data b/test/YAMLParser/construct-float.test similarity index 100% rename from test/YAMLParser/construct-float.data rename to test/YAMLParser/construct-float.test diff --git a/test/YAMLParser/construct-int.data b/test/YAMLParser/construct-int.test similarity index 100% rename from test/YAMLParser/construct-int.data rename to test/YAMLParser/construct-int.test diff --git a/test/YAMLParser/construct-map.data b/test/YAMLParser/construct-map.test similarity index 100% rename from test/YAMLParser/construct-map.data rename to test/YAMLParser/construct-map.test diff --git a/test/YAMLParser/construct-merge.data b/test/YAMLParser/construct-merge.test similarity index 100% rename from test/YAMLParser/construct-merge.data rename to test/YAMLParser/construct-merge.test diff --git a/test/YAMLParser/construct-null.data b/test/YAMLParser/construct-null.test similarity index 100% rename from test/YAMLParser/construct-null.data rename to test/YAMLParser/construct-null.test diff --git a/test/YAMLParser/construct-omap.data b/test/YAMLParser/construct-omap.test similarity index 100% rename from test/YAMLParser/construct-omap.data rename to test/YAMLParser/construct-omap.test diff --git a/test/YAMLParser/construct-pairs.data b/test/YAMLParser/construct-pairs.test similarity index 100% rename from test/YAMLParser/construct-pairs.data rename to test/YAMLParser/construct-pairs.test diff --git a/test/YAMLParser/construct-seq.data b/test/YAMLParser/construct-seq.test similarity index 100% rename from test/YAMLParser/construct-seq.data rename to test/YAMLParser/construct-seq.test diff --git a/test/YAMLParser/construct-set.data b/test/YAMLParser/construct-set.test similarity index 100% rename from test/YAMLParser/construct-set.data rename to test/YAMLParser/construct-set.test diff --git a/test/YAMLParser/construct-str-ascii.data b/test/YAMLParser/construct-str-ascii.test similarity index 100% rename from test/YAMLParser/construct-str-ascii.data rename to test/YAMLParser/construct-str-ascii.test diff --git a/test/YAMLParser/construct-str.data b/test/YAMLParser/construct-str.test similarity index 100% rename from test/YAMLParser/construct-str.data rename to test/YAMLParser/construct-str.test diff --git a/test/YAMLParser/construct-timestamp.data b/test/YAMLParser/construct-timestamp.test similarity index 100% rename from test/YAMLParser/construct-timestamp.data rename to test/YAMLParser/construct-timestamp.test diff --git a/test/YAMLParser/construct-value.data b/test/YAMLParser/construct-value.test similarity index 100% rename from test/YAMLParser/construct-value.data rename to test/YAMLParser/construct-value.test diff --git a/test/YAMLParser/duplicate-key.former-loader-error.data b/test/YAMLParser/duplicate-key.former-loader-error.test similarity index 100% rename from test/YAMLParser/duplicate-key.former-loader-error.data rename to test/YAMLParser/duplicate-key.former-loader-error.test diff --git a/test/YAMLParser/duplicate-mapping-key.former-loader-error.data b/test/YAMLParser/duplicate-mapping-key.former-loader-error.test similarity index 100% rename from test/YAMLParser/duplicate-mapping-key.former-loader-error.data rename to test/YAMLParser/duplicate-mapping-key.former-loader-error.test diff --git a/test/YAMLParser/duplicate-merge-key.former-loader-error.data b/test/YAMLParser/duplicate-merge-key.former-loader-error.test similarity index 100% rename from test/YAMLParser/duplicate-merge-key.former-loader-error.data rename to test/YAMLParser/duplicate-merge-key.former-loader-error.test diff --git a/test/YAMLParser/duplicate-value-key.former-loader-error.data b/test/YAMLParser/duplicate-value-key.former-loader-error.test similarity index 100% rename from test/YAMLParser/duplicate-value-key.former-loader-error.data rename to test/YAMLParser/duplicate-value-key.former-loader-error.test diff --git a/test/YAMLParser/emit-block-scalar-in-simple-key-context-bug.data b/test/YAMLParser/emit-block-scalar-in-simple-key-context-bug.test similarity index 100% rename from test/YAMLParser/emit-block-scalar-in-simple-key-context-bug.data rename to test/YAMLParser/emit-block-scalar-in-simple-key-context-bug.test diff --git a/test/YAMLParser/empty-document-bug.data b/test/YAMLParser/empty-document-bug.test similarity index 100% rename from test/YAMLParser/empty-document-bug.data rename to test/YAMLParser/empty-document-bug.test diff --git a/test/YAMLParser/float.data b/test/YAMLParser/float.test similarity index 100% rename from test/YAMLParser/float.data rename to test/YAMLParser/float.test diff --git a/test/YAMLParser/int.data b/test/YAMLParser/int.test similarity index 100% rename from test/YAMLParser/int.data rename to test/YAMLParser/int.test diff --git a/test/YAMLParser/invalid-single-quote-bug.data b/test/YAMLParser/invalid-single-quote-bug.test similarity index 100% rename from test/YAMLParser/invalid-single-quote-bug.data rename to test/YAMLParser/invalid-single-quote-bug.test diff --git a/test/YAMLParser/merge.data b/test/YAMLParser/merge.test similarity index 100% rename from test/YAMLParser/merge.data rename to test/YAMLParser/merge.test diff --git a/test/YAMLParser/more-floats.data b/test/YAMLParser/more-floats.test similarity index 100% rename from test/YAMLParser/more-floats.data rename to test/YAMLParser/more-floats.test diff --git a/test/YAMLParser/negative-float-bug.data b/test/YAMLParser/negative-float-bug.test similarity index 100% rename from test/YAMLParser/negative-float-bug.data rename to test/YAMLParser/negative-float-bug.test diff --git a/test/YAMLParser/null.data b/test/YAMLParser/null.test similarity index 100% rename from test/YAMLParser/null.data rename to test/YAMLParser/null.test diff --git a/test/YAMLParser/resolver.data b/test/YAMLParser/resolver.test similarity index 100% rename from test/YAMLParser/resolver.data rename to test/YAMLParser/resolver.test diff --git a/test/YAMLParser/run-parser-crash-bug.data b/test/YAMLParser/run-parser-crash-bug.test similarity index 100% rename from test/YAMLParser/run-parser-crash-bug.data rename to test/YAMLParser/run-parser-crash-bug.test diff --git a/test/YAMLParser/scan-document-end-bug.data b/test/YAMLParser/scan-document-end-bug.test similarity index 100% rename from test/YAMLParser/scan-document-end-bug.data rename to test/YAMLParser/scan-document-end-bug.test diff --git a/test/YAMLParser/scan-line-break-bug.data b/test/YAMLParser/scan-line-break-bug.test similarity index 100% rename from test/YAMLParser/scan-line-break-bug.data rename to test/YAMLParser/scan-line-break-bug.test diff --git a/test/YAMLParser/single-dot-is-not-float-bug.data b/test/YAMLParser/single-dot-is-not-float-bug.test similarity index 100% rename from test/YAMLParser/single-dot-is-not-float-bug.data rename to test/YAMLParser/single-dot-is-not-float-bug.test diff --git a/test/YAMLParser/sloppy-indentation.data b/test/YAMLParser/sloppy-indentation.test similarity index 100% rename from test/YAMLParser/sloppy-indentation.data rename to test/YAMLParser/sloppy-indentation.test diff --git a/test/YAMLParser/spec-02-01.data b/test/YAMLParser/spec-02-01.test similarity index 100% rename from test/YAMLParser/spec-02-01.data rename to test/YAMLParser/spec-02-01.test diff --git a/test/YAMLParser/spec-02-02.data b/test/YAMLParser/spec-02-02.test similarity index 100% rename from test/YAMLParser/spec-02-02.data rename to test/YAMLParser/spec-02-02.test diff --git a/test/YAMLParser/spec-02-03.data b/test/YAMLParser/spec-02-03.test similarity index 100% rename from test/YAMLParser/spec-02-03.data rename to test/YAMLParser/spec-02-03.test diff --git a/test/YAMLParser/spec-02-04.data b/test/YAMLParser/spec-02-04.test similarity index 100% rename from test/YAMLParser/spec-02-04.data rename to test/YAMLParser/spec-02-04.test diff --git a/test/YAMLParser/spec-02-05.data b/test/YAMLParser/spec-02-05.test similarity index 100% rename from test/YAMLParser/spec-02-05.data rename to test/YAMLParser/spec-02-05.test diff --git a/test/YAMLParser/spec-02-06.data b/test/YAMLParser/spec-02-06.test similarity index 100% rename from test/YAMLParser/spec-02-06.data rename to test/YAMLParser/spec-02-06.test diff --git a/test/YAMLParser/spec-02-07.data b/test/YAMLParser/spec-02-07.test similarity index 100% rename from test/YAMLParser/spec-02-07.data rename to test/YAMLParser/spec-02-07.test diff --git a/test/YAMLParser/spec-02-08.data b/test/YAMLParser/spec-02-08.test similarity index 100% rename from test/YAMLParser/spec-02-08.data rename to test/YAMLParser/spec-02-08.test diff --git a/test/YAMLParser/spec-02-09.data b/test/YAMLParser/spec-02-09.test similarity index 100% rename from test/YAMLParser/spec-02-09.data rename to test/YAMLParser/spec-02-09.test diff --git a/test/YAMLParser/spec-02-10.data b/test/YAMLParser/spec-02-10.test similarity index 100% rename from test/YAMLParser/spec-02-10.data rename to test/YAMLParser/spec-02-10.test diff --git a/test/YAMLParser/spec-02-11.data b/test/YAMLParser/spec-02-11.test similarity index 100% rename from test/YAMLParser/spec-02-11.data rename to test/YAMLParser/spec-02-11.test diff --git a/test/YAMLParser/spec-02-12.data b/test/YAMLParser/spec-02-12.test similarity index 100% rename from test/YAMLParser/spec-02-12.data rename to test/YAMLParser/spec-02-12.test diff --git a/test/YAMLParser/spec-02-13.data b/test/YAMLParser/spec-02-13.test similarity index 100% rename from test/YAMLParser/spec-02-13.data rename to test/YAMLParser/spec-02-13.test diff --git a/test/YAMLParser/spec-02-14.data b/test/YAMLParser/spec-02-14.test similarity index 100% rename from test/YAMLParser/spec-02-14.data rename to test/YAMLParser/spec-02-14.test diff --git a/test/YAMLParser/spec-02-15.data b/test/YAMLParser/spec-02-15.test similarity index 100% rename from test/YAMLParser/spec-02-15.data rename to test/YAMLParser/spec-02-15.test diff --git a/test/YAMLParser/spec-02-16.data b/test/YAMLParser/spec-02-16.test similarity index 100% rename from test/YAMLParser/spec-02-16.data rename to test/YAMLParser/spec-02-16.test diff --git a/test/YAMLParser/spec-02-17.data b/test/YAMLParser/spec-02-17.test similarity index 100% rename from test/YAMLParser/spec-02-17.data rename to test/YAMLParser/spec-02-17.test diff --git a/test/YAMLParser/spec-02-18.data b/test/YAMLParser/spec-02-18.test similarity index 100% rename from test/YAMLParser/spec-02-18.data rename to test/YAMLParser/spec-02-18.test diff --git a/test/YAMLParser/spec-02-19.data b/test/YAMLParser/spec-02-19.test similarity index 100% rename from test/YAMLParser/spec-02-19.data rename to test/YAMLParser/spec-02-19.test diff --git a/test/YAMLParser/spec-02-20.data b/test/YAMLParser/spec-02-20.test similarity index 100% rename from test/YAMLParser/spec-02-20.data rename to test/YAMLParser/spec-02-20.test diff --git a/test/YAMLParser/spec-02-21.data b/test/YAMLParser/spec-02-21.test similarity index 100% rename from test/YAMLParser/spec-02-21.data rename to test/YAMLParser/spec-02-21.test diff --git a/test/YAMLParser/spec-02-22.data b/test/YAMLParser/spec-02-22.test similarity index 100% rename from test/YAMLParser/spec-02-22.data rename to test/YAMLParser/spec-02-22.test diff --git a/test/YAMLParser/spec-02-23.data b/test/YAMLParser/spec-02-23.test similarity index 100% rename from test/YAMLParser/spec-02-23.data rename to test/YAMLParser/spec-02-23.test diff --git a/test/YAMLParser/spec-02-24.data b/test/YAMLParser/spec-02-24.test similarity index 100% rename from test/YAMLParser/spec-02-24.data rename to test/YAMLParser/spec-02-24.test diff --git a/test/YAMLParser/spec-02-25.data b/test/YAMLParser/spec-02-25.test similarity index 100% rename from test/YAMLParser/spec-02-25.data rename to test/YAMLParser/spec-02-25.test diff --git a/test/YAMLParser/spec-02-26.data b/test/YAMLParser/spec-02-26.test similarity index 100% rename from test/YAMLParser/spec-02-26.data rename to test/YAMLParser/spec-02-26.test diff --git a/test/YAMLParser/spec-02-27.data b/test/YAMLParser/spec-02-27.test similarity index 100% rename from test/YAMLParser/spec-02-27.data rename to test/YAMLParser/spec-02-27.test diff --git a/test/YAMLParser/spec-02-28.data b/test/YAMLParser/spec-02-28.test similarity index 100% rename from test/YAMLParser/spec-02-28.data rename to test/YAMLParser/spec-02-28.test diff --git a/test/YAMLParser/spec-05-01-utf8.data b/test/YAMLParser/spec-05-01-utf8.test similarity index 100% rename from test/YAMLParser/spec-05-01-utf8.data rename to test/YAMLParser/spec-05-01-utf8.test diff --git a/test/YAMLParser/spec-05-02-utf8.data b/test/YAMLParser/spec-05-02-utf8.test similarity index 53% rename from test/YAMLParser/spec-05-02-utf8.data rename to test/YAMLParser/spec-05-02-utf8.test index 028f41bb557..3666f990e47 100644 --- a/test/YAMLParser/spec-05-02-utf8.data +++ b/test/YAMLParser/spec-05-02-utf8.test @@ -1,4 +1,4 @@ -# RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s +# RUN: not yaml-bench -canonical %s 2>&1 | FileCheck %s # Invalid use of BOM # inside a diff --git a/test/YAMLParser/spec-05-03.data b/test/YAMLParser/spec-05-03.test similarity index 100% rename from test/YAMLParser/spec-05-03.data rename to test/YAMLParser/spec-05-03.test diff --git a/test/YAMLParser/spec-05-04.data b/test/YAMLParser/spec-05-04.test similarity index 100% rename from test/YAMLParser/spec-05-04.data rename to test/YAMLParser/spec-05-04.test diff --git a/test/YAMLParser/spec-05-05.data b/test/YAMLParser/spec-05-05.test similarity index 100% rename from test/YAMLParser/spec-05-05.data rename to test/YAMLParser/spec-05-05.test diff --git a/test/YAMLParser/spec-05-06.data b/test/YAMLParser/spec-05-06.test similarity index 100% rename from test/YAMLParser/spec-05-06.data rename to test/YAMLParser/spec-05-06.test diff --git a/test/YAMLParser/spec-05-07.data b/test/YAMLParser/spec-05-07.test similarity index 100% rename from test/YAMLParser/spec-05-07.data rename to test/YAMLParser/spec-05-07.test diff --git a/test/YAMLParser/spec-05-08.data b/test/YAMLParser/spec-05-08.test similarity index 100% rename from test/YAMLParser/spec-05-08.data rename to test/YAMLParser/spec-05-08.test diff --git a/test/YAMLParser/spec-05-09.data b/test/YAMLParser/spec-05-09.test similarity index 100% rename from test/YAMLParser/spec-05-09.data rename to test/YAMLParser/spec-05-09.test diff --git a/test/YAMLParser/spec-05-10.data b/test/YAMLParser/spec-05-10.test similarity index 50% rename from test/YAMLParser/spec-05-10.data rename to test/YAMLParser/spec-05-10.test index bab2c1b89ca..14112c1eed5 100644 --- a/test/YAMLParser/spec-05-10.data +++ b/test/YAMLParser/spec-05-10.test @@ -1,4 +1,4 @@ -# RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s +# RUN: not yaml-bench -canonical %s 2>&1 | FileCheck %s commercial-at: @text grave-accent: `text diff --git a/test/YAMLParser/spec-05-11.data b/test/YAMLParser/spec-05-11.test similarity index 100% rename from test/YAMLParser/spec-05-11.data rename to test/YAMLParser/spec-05-11.test diff --git a/test/YAMLParser/spec-05-12.data b/test/YAMLParser/spec-05-12.test similarity index 61% rename from test/YAMLParser/spec-05-12.data rename to test/YAMLParser/spec-05-12.test index eedfc08cf38..7ecc36dee8b 100644 --- a/test/YAMLParser/spec-05-12.data +++ b/test/YAMLParser/spec-05-12.test @@ -1,7 +1,8 @@ # RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s # +# FIXME: This test should actually fail. Yaml-bench should report an error +# that a tab is being used to indent a plain scalar at line 15. # We don't currently reject tabs as indentation. -# XFAIL: * # Tabs do's and don'ts: # comment: @@ -13,4 +14,5 @@ block: | elsewhere: # separation indentation, in plain scalar -# CHECK: error + +# CHECK: !!str "Quoted\t\t" diff --git a/test/YAMLParser/spec-05-13.data b/test/YAMLParser/spec-05-13.test similarity index 100% rename from test/YAMLParser/spec-05-13.data rename to test/YAMLParser/spec-05-13.test diff --git a/test/YAMLParser/spec-05-14.data b/test/YAMLParser/spec-05-14.test similarity index 100% rename from test/YAMLParser/spec-05-14.data rename to test/YAMLParser/spec-05-14.test diff --git a/test/YAMLParser/spec-05-15.data b/test/YAMLParser/spec-05-15.data deleted file mode 100644 index 27dbd8396ea..00000000000 --- a/test/YAMLParser/spec-05-15.data +++ /dev/null @@ -1,7 +0,0 @@ -# RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s - -Bad escapes: - "\c - \xq-" - -# CHECK: error diff --git a/test/YAMLParser/spec-05-15.test b/test/YAMLParser/spec-05-15.test new file mode 100644 index 00000000000..46228bae215 --- /dev/null +++ b/test/YAMLParser/spec-05-15.test @@ -0,0 +1,7 @@ +# RUN: not yaml-bench -canonical %s 2>&1 | FileCheck %s + +Bad escapes: + "\c + \xq-" + +# CHECK: error diff --git a/test/YAMLParser/spec-06-01.data b/test/YAMLParser/spec-06-01.test similarity index 100% rename from test/YAMLParser/spec-06-01.data rename to test/YAMLParser/spec-06-01.test diff --git a/test/YAMLParser/spec-06-02.data b/test/YAMLParser/spec-06-02.test similarity index 100% rename from test/YAMLParser/spec-06-02.data rename to test/YAMLParser/spec-06-02.test diff --git a/test/YAMLParser/spec-06-03.data b/test/YAMLParser/spec-06-03.test similarity index 100% rename from test/YAMLParser/spec-06-03.data rename to test/YAMLParser/spec-06-03.test diff --git a/test/YAMLParser/spec-06-04.data b/test/YAMLParser/spec-06-04.test similarity index 100% rename from test/YAMLParser/spec-06-04.data rename to test/YAMLParser/spec-06-04.test diff --git a/test/YAMLParser/spec-06-05.data b/test/YAMLParser/spec-06-05.test similarity index 100% rename from test/YAMLParser/spec-06-05.data rename to test/YAMLParser/spec-06-05.test diff --git a/test/YAMLParser/spec-06-06.data b/test/YAMLParser/spec-06-06.test similarity index 100% rename from test/YAMLParser/spec-06-06.data rename to test/YAMLParser/spec-06-06.test diff --git a/test/YAMLParser/spec-06-07.data b/test/YAMLParser/spec-06-07.test similarity index 100% rename from test/YAMLParser/spec-06-07.data rename to test/YAMLParser/spec-06-07.test diff --git a/test/YAMLParser/spec-06-08.data b/test/YAMLParser/spec-06-08.test similarity index 100% rename from test/YAMLParser/spec-06-08.data rename to test/YAMLParser/spec-06-08.test diff --git a/test/YAMLParser/spec-07-01.data b/test/YAMLParser/spec-07-01.test similarity index 100% rename from test/YAMLParser/spec-07-01.data rename to test/YAMLParser/spec-07-01.test diff --git a/test/YAMLParser/spec-07-02.data b/test/YAMLParser/spec-07-02.test similarity index 100% rename from test/YAMLParser/spec-07-02.data rename to test/YAMLParser/spec-07-02.test diff --git a/test/YAMLParser/spec-07-03.data b/test/YAMLParser/spec-07-03.data deleted file mode 100644 index c4a5299562a..00000000000 --- a/test/YAMLParser/spec-07-03.data +++ /dev/null @@ -1,7 +0,0 @@ -# RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s - -%YAML 1.1 -%YAML 1.1 -foo - -# CHECK: error diff --git a/test/YAMLParser/spec-07-03.test b/test/YAMLParser/spec-07-03.test new file mode 100644 index 00000000000..76266b896d7 --- /dev/null +++ b/test/YAMLParser/spec-07-03.test @@ -0,0 +1,7 @@ +# RUN: not yaml-bench -canonical %s 2>&1 | FileCheck %s + +%YAML 1.1 +%YAML 1.1 +foo + +# CHECK: error diff --git a/test/YAMLParser/spec-07-04.data b/test/YAMLParser/spec-07-04.test similarity index 100% rename from test/YAMLParser/spec-07-04.data rename to test/YAMLParser/spec-07-04.test diff --git a/test/YAMLParser/spec-07-05.data b/test/YAMLParser/spec-07-05.data deleted file mode 100644 index f7cff3a8390..00000000000 --- a/test/YAMLParser/spec-07-05.data +++ /dev/null @@ -1,10 +0,0 @@ -# RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s -# -# We don't currently parse TAG directives. -# XFAIL: * - -%TAG ! !foo -%TAG ! !foo -bar - -# CHECK: error diff --git a/test/YAMLParser/spec-07-05.test b/test/YAMLParser/spec-07-05.test new file mode 100644 index 00000000000..447cba81902 --- /dev/null +++ b/test/YAMLParser/spec-07-05.test @@ -0,0 +1,8 @@ +# RUN: not yaml-bench -canonical %s 2>&1 | FileCheck %s +# +# We don't currently parse TAG directives. +# CHECK: error: Unexpected token + +%TAG ! !foo +%TAG ! !foo +bar diff --git a/test/YAMLParser/spec-07-06.data b/test/YAMLParser/spec-07-06.test similarity index 100% rename from test/YAMLParser/spec-07-06.data rename to test/YAMLParser/spec-07-06.test diff --git a/test/YAMLParser/spec-07-07a.data b/test/YAMLParser/spec-07-07a.test similarity index 100% rename from test/YAMLParser/spec-07-07a.data rename to test/YAMLParser/spec-07-07a.test diff --git a/test/YAMLParser/spec-07-07b.data b/test/YAMLParser/spec-07-07b.test similarity index 100% rename from test/YAMLParser/spec-07-07b.data rename to test/YAMLParser/spec-07-07b.test diff --git a/test/YAMLParser/spec-07-08.data b/test/YAMLParser/spec-07-08.test similarity index 100% rename from test/YAMLParser/spec-07-08.data rename to test/YAMLParser/spec-07-08.test diff --git a/test/YAMLParser/spec-07-09.data b/test/YAMLParser/spec-07-09.test similarity index 100% rename from test/YAMLParser/spec-07-09.data rename to test/YAMLParser/spec-07-09.test diff --git a/test/YAMLParser/spec-07-10.data b/test/YAMLParser/spec-07-10.test similarity index 100% rename from test/YAMLParser/spec-07-10.data rename to test/YAMLParser/spec-07-10.test diff --git a/test/YAMLParser/spec-07-11.data b/test/YAMLParser/spec-07-11.test similarity index 100% rename from test/YAMLParser/spec-07-11.data rename to test/YAMLParser/spec-07-11.test diff --git a/test/YAMLParser/spec-07-12a.data b/test/YAMLParser/spec-07-12a.test similarity index 100% rename from test/YAMLParser/spec-07-12a.data rename to test/YAMLParser/spec-07-12a.test diff --git a/test/YAMLParser/spec-07-12b.data b/test/YAMLParser/spec-07-12b.test similarity index 100% rename from test/YAMLParser/spec-07-12b.data rename to test/YAMLParser/spec-07-12b.test diff --git a/test/YAMLParser/spec-07-13.data b/test/YAMLParser/spec-07-13.test similarity index 100% rename from test/YAMLParser/spec-07-13.data rename to test/YAMLParser/spec-07-13.test diff --git a/test/YAMLParser/spec-08-01.data b/test/YAMLParser/spec-08-01.test similarity index 100% rename from test/YAMLParser/spec-08-01.data rename to test/YAMLParser/spec-08-01.test diff --git a/test/YAMLParser/spec-08-02.data b/test/YAMLParser/spec-08-02.test similarity index 100% rename from test/YAMLParser/spec-08-02.data rename to test/YAMLParser/spec-08-02.test diff --git a/test/YAMLParser/spec-08-03.data b/test/YAMLParser/spec-08-03.test similarity index 100% rename from test/YAMLParser/spec-08-03.data rename to test/YAMLParser/spec-08-03.test diff --git a/test/YAMLParser/spec-08-04.data b/test/YAMLParser/spec-08-04.data deleted file mode 100644 index 73c493d7637..00000000000 --- a/test/YAMLParser/spec-08-04.data +++ /dev/null @@ -1,9 +0,0 @@ -# RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s -# -# We don't currently look at the content of literal tags. -# XFAIL: * - -- ! foo -- !<$:?> bar - -# CHECK: error diff --git a/test/YAMLParser/spec-08-04.test b/test/YAMLParser/spec-08-04.test new file mode 100644 index 00000000000..5b502ae3a17 --- /dev/null +++ b/test/YAMLParser/spec-08-04.test @@ -0,0 +1,7 @@ +# RUN: not yaml-bench -canonical %s 2>&1 | FileCheck %s +# +# We don't currently look at the content of literal tags. +# CHECK: error: Unknown tag handle + +- ! foo +- !<$:?> bar diff --git a/test/YAMLParser/spec-08-05.data b/test/YAMLParser/spec-08-05.test similarity index 100% rename from test/YAMLParser/spec-08-05.data rename to test/YAMLParser/spec-08-05.test diff --git a/test/YAMLParser/spec-08-06.data b/test/YAMLParser/spec-08-06.test similarity index 55% rename from test/YAMLParser/spec-08-06.data rename to test/YAMLParser/spec-08-06.test index 9844f53a4ef..b457d59b569 100644 --- a/test/YAMLParser/spec-08-06.data +++ b/test/YAMLParser/spec-08-06.test @@ -1,7 +1,7 @@ -# RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s +# RUN: not yaml-bench -canonical %s 2>&1 | FileCheck %s # # We don't currently validate tags. -# XFAIL: * +# CHECK: error: Unknown tag handle %TAG !o! tag:ben-kiki.org,2000: --- @@ -9,4 +9,3 @@ - !o! bar - !h!type baz -# CHECK: error diff --git a/test/YAMLParser/spec-08-07.data b/test/YAMLParser/spec-08-07.test similarity index 100% rename from test/YAMLParser/spec-08-07.data rename to test/YAMLParser/spec-08-07.test diff --git a/test/YAMLParser/spec-08-08.data b/test/YAMLParser/spec-08-08.test similarity index 100% rename from test/YAMLParser/spec-08-08.data rename to test/YAMLParser/spec-08-08.test diff --git a/test/YAMLParser/spec-08-09.data b/test/YAMLParser/spec-08-09.test similarity index 100% rename from test/YAMLParser/spec-08-09.data rename to test/YAMLParser/spec-08-09.test diff --git a/test/YAMLParser/spec-08-10.data b/test/YAMLParser/spec-08-10.test similarity index 100% rename from test/YAMLParser/spec-08-10.data rename to test/YAMLParser/spec-08-10.test diff --git a/test/YAMLParser/spec-08-11.data b/test/YAMLParser/spec-08-11.test similarity index 100% rename from test/YAMLParser/spec-08-11.data rename to test/YAMLParser/spec-08-11.test diff --git a/test/YAMLParser/spec-08-12.data b/test/YAMLParser/spec-08-12.test similarity index 100% rename from test/YAMLParser/spec-08-12.data rename to test/YAMLParser/spec-08-12.test diff --git a/test/YAMLParser/spec-08-13.data b/test/YAMLParser/spec-08-13.test similarity index 100% rename from test/YAMLParser/spec-08-13.data rename to test/YAMLParser/spec-08-13.test diff --git a/test/YAMLParser/spec-08-14.data b/test/YAMLParser/spec-08-14.test similarity index 100% rename from test/YAMLParser/spec-08-14.data rename to test/YAMLParser/spec-08-14.test diff --git a/test/YAMLParser/spec-08-15.data b/test/YAMLParser/spec-08-15.test similarity index 100% rename from test/YAMLParser/spec-08-15.data rename to test/YAMLParser/spec-08-15.test diff --git a/test/YAMLParser/spec-09-01.data b/test/YAMLParser/spec-09-01.test similarity index 100% rename from test/YAMLParser/spec-09-01.data rename to test/YAMLParser/spec-09-01.test diff --git a/test/YAMLParser/spec-09-02.data b/test/YAMLParser/spec-09-02.data deleted file mode 100644 index 9d8a58ca33a..00000000000 --- a/test/YAMLParser/spec-09-02.data +++ /dev/null @@ -1,14 +0,0 @@ -# RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s -# -# Indent trimming is not yet implemented. -# XFAIL: * - - "as space - trimmed - - specific - - escaped \ - none" - -# CHECK: !!str "as space trimmed\nspecific\nescaped\tnone" diff --git a/test/YAMLParser/spec-09-02.test b/test/YAMLParser/spec-09-02.test new file mode 100644 index 00000000000..3f8e49a8bd3 --- /dev/null +++ b/test/YAMLParser/spec-09-02.test @@ -0,0 +1,14 @@ +# RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s + + "as space + trimmed + + specific + + escaped \ + none" + +# FIXME: The string below should actually be +# "as space trimmed\nspecific\nescaped\tnone", but the parser currently has +# a bug when parsing multiline quoted strings. +# CHECK: !!str "as space\n trimmed\n specific\n escaped\t none" diff --git a/test/YAMLParser/spec-09-03.data b/test/YAMLParser/spec-09-03.test similarity index 100% rename from test/YAMLParser/spec-09-03.data rename to test/YAMLParser/spec-09-03.test diff --git a/test/YAMLParser/spec-09-04.data b/test/YAMLParser/spec-09-04.test similarity index 100% rename from test/YAMLParser/spec-09-04.data rename to test/YAMLParser/spec-09-04.test diff --git a/test/YAMLParser/spec-09-05.data b/test/YAMLParser/spec-09-05.test similarity index 100% rename from test/YAMLParser/spec-09-05.data rename to test/YAMLParser/spec-09-05.test diff --git a/test/YAMLParser/spec-09-06.data b/test/YAMLParser/spec-09-06.test similarity index 100% rename from test/YAMLParser/spec-09-06.data rename to test/YAMLParser/spec-09-06.test diff --git a/test/YAMLParser/spec-09-07.data b/test/YAMLParser/spec-09-07.test similarity index 100% rename from test/YAMLParser/spec-09-07.data rename to test/YAMLParser/spec-09-07.test diff --git a/test/YAMLParser/spec-09-08.data b/test/YAMLParser/spec-09-08.test similarity index 100% rename from test/YAMLParser/spec-09-08.data rename to test/YAMLParser/spec-09-08.test diff --git a/test/YAMLParser/spec-09-09.data b/test/YAMLParser/spec-09-09.test similarity index 100% rename from test/YAMLParser/spec-09-09.data rename to test/YAMLParser/spec-09-09.test diff --git a/test/YAMLParser/spec-09-10.data b/test/YAMLParser/spec-09-10.test similarity index 100% rename from test/YAMLParser/spec-09-10.data rename to test/YAMLParser/spec-09-10.test diff --git a/test/YAMLParser/spec-09-11.data b/test/YAMLParser/spec-09-11.test similarity index 100% rename from test/YAMLParser/spec-09-11.data rename to test/YAMLParser/spec-09-11.test diff --git a/test/YAMLParser/spec-09-12.data b/test/YAMLParser/spec-09-12.test similarity index 100% rename from test/YAMLParser/spec-09-12.data rename to test/YAMLParser/spec-09-12.test diff --git a/test/YAMLParser/spec-09-13.data b/test/YAMLParser/spec-09-13.test similarity index 100% rename from test/YAMLParser/spec-09-13.data rename to test/YAMLParser/spec-09-13.test diff --git a/test/YAMLParser/spec-09-14.data b/test/YAMLParser/spec-09-14.data deleted file mode 100644 index a83fcd45e2c..00000000000 --- a/test/YAMLParser/spec-09-14.data +++ /dev/null @@ -1,21 +0,0 @@ -# RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s -# -# Not quite sure why this doesn't fail. -# XFAIL: * - ---- ---- ||| : foo -... >>>: bar ---- -[ ---- -, -... , -{ ---- : -... # Nested -} -] -... - -# CHECK: error diff --git a/test/YAMLParser/spec-09-14.test b/test/YAMLParser/spec-09-14.test new file mode 100644 index 00000000000..55d881de433 --- /dev/null +++ b/test/YAMLParser/spec-09-14.test @@ -0,0 +1,21 @@ +# RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s +# +# FIXME: This test should actually fail. Yaml bench should report an error that +# says that the '---' and '...' document start/end markers must not be specified +# as the first content line of a non-indented plain scalar. +# CHECK: !!str + +--- +--- ||| : foo +... >>>: bar +--- +[ +--- +, +... , +{ +--- : +... # Nested +} +] +... diff --git a/test/YAMLParser/spec-09-15.data b/test/YAMLParser/spec-09-15.test similarity index 100% rename from test/YAMLParser/spec-09-15.data rename to test/YAMLParser/spec-09-15.test diff --git a/test/YAMLParser/spec-09-16.data b/test/YAMLParser/spec-09-16.test similarity index 100% rename from test/YAMLParser/spec-09-16.data rename to test/YAMLParser/spec-09-16.test diff --git a/test/YAMLParser/spec-09-17.data b/test/YAMLParser/spec-09-17.test similarity index 100% rename from test/YAMLParser/spec-09-17.data rename to test/YAMLParser/spec-09-17.test diff --git a/test/YAMLParser/spec-09-18.data b/test/YAMLParser/spec-09-18.test similarity index 100% rename from test/YAMLParser/spec-09-18.data rename to test/YAMLParser/spec-09-18.test diff --git a/test/YAMLParser/spec-09-19.data b/test/YAMLParser/spec-09-19.test similarity index 100% rename from test/YAMLParser/spec-09-19.data rename to test/YAMLParser/spec-09-19.test diff --git a/test/YAMLParser/spec-09-20.data b/test/YAMLParser/spec-09-20.test similarity index 100% rename from test/YAMLParser/spec-09-20.data rename to test/YAMLParser/spec-09-20.test diff --git a/test/YAMLParser/spec-09-21.data b/test/YAMLParser/spec-09-21.test similarity index 50% rename from test/YAMLParser/spec-09-21.data rename to test/YAMLParser/spec-09-21.test index 6eb7917a97e..76bc7d6bd31 100644 --- a/test/YAMLParser/spec-09-21.data +++ b/test/YAMLParser/spec-09-21.test @@ -1,4 +1,4 @@ -# RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s +# RUN: not yaml-bench -canonical %s 2>&1 | FileCheck %s - | diff --git a/test/YAMLParser/spec-09-22.data b/test/YAMLParser/spec-09-22.test similarity index 100% rename from test/YAMLParser/spec-09-22.data rename to test/YAMLParser/spec-09-22.test diff --git a/test/YAMLParser/spec-09-23.data b/test/YAMLParser/spec-09-23.test similarity index 100% rename from test/YAMLParser/spec-09-23.data rename to test/YAMLParser/spec-09-23.test diff --git a/test/YAMLParser/spec-09-24.data b/test/YAMLParser/spec-09-24.test similarity index 100% rename from test/YAMLParser/spec-09-24.data rename to test/YAMLParser/spec-09-24.test diff --git a/test/YAMLParser/spec-09-25.data b/test/YAMLParser/spec-09-25.test similarity index 100% rename from test/YAMLParser/spec-09-25.data rename to test/YAMLParser/spec-09-25.test diff --git a/test/YAMLParser/spec-09-26.data b/test/YAMLParser/spec-09-26.test similarity index 100% rename from test/YAMLParser/spec-09-26.data rename to test/YAMLParser/spec-09-26.test diff --git a/test/YAMLParser/spec-09-27.data b/test/YAMLParser/spec-09-27.test similarity index 100% rename from test/YAMLParser/spec-09-27.data rename to test/YAMLParser/spec-09-27.test diff --git a/test/YAMLParser/spec-09-28.data b/test/YAMLParser/spec-09-28.test similarity index 100% rename from test/YAMLParser/spec-09-28.data rename to test/YAMLParser/spec-09-28.test diff --git a/test/YAMLParser/spec-09-29.data b/test/YAMLParser/spec-09-29.test similarity index 100% rename from test/YAMLParser/spec-09-29.data rename to test/YAMLParser/spec-09-29.test diff --git a/test/YAMLParser/spec-09-30.data b/test/YAMLParser/spec-09-30.test similarity index 100% rename from test/YAMLParser/spec-09-30.data rename to test/YAMLParser/spec-09-30.test diff --git a/test/YAMLParser/spec-09-31.data b/test/YAMLParser/spec-09-31.test similarity index 100% rename from test/YAMLParser/spec-09-31.data rename to test/YAMLParser/spec-09-31.test diff --git a/test/YAMLParser/spec-09-32.data b/test/YAMLParser/spec-09-32.test similarity index 100% rename from test/YAMLParser/spec-09-32.data rename to test/YAMLParser/spec-09-32.test diff --git a/test/YAMLParser/spec-09-33.data b/test/YAMLParser/spec-09-33.test similarity index 100% rename from test/YAMLParser/spec-09-33.data rename to test/YAMLParser/spec-09-33.test diff --git a/test/YAMLParser/spec-10-01.data b/test/YAMLParser/spec-10-01.test similarity index 100% rename from test/YAMLParser/spec-10-01.data rename to test/YAMLParser/spec-10-01.test diff --git a/test/YAMLParser/spec-10-02.data b/test/YAMLParser/spec-10-02.test similarity index 100% rename from test/YAMLParser/spec-10-02.data rename to test/YAMLParser/spec-10-02.test diff --git a/test/YAMLParser/spec-10-03.data b/test/YAMLParser/spec-10-03.test similarity index 100% rename from test/YAMLParser/spec-10-03.data rename to test/YAMLParser/spec-10-03.test diff --git a/test/YAMLParser/spec-10-04.data b/test/YAMLParser/spec-10-04.test similarity index 100% rename from test/YAMLParser/spec-10-04.data rename to test/YAMLParser/spec-10-04.test diff --git a/test/YAMLParser/spec-10-05.data b/test/YAMLParser/spec-10-05.test similarity index 100% rename from test/YAMLParser/spec-10-05.data rename to test/YAMLParser/spec-10-05.test diff --git a/test/YAMLParser/spec-10-06.data b/test/YAMLParser/spec-10-06.test similarity index 100% rename from test/YAMLParser/spec-10-06.data rename to test/YAMLParser/spec-10-06.test diff --git a/test/YAMLParser/spec-10-07.data b/test/YAMLParser/spec-10-07.test similarity index 100% rename from test/YAMLParser/spec-10-07.data rename to test/YAMLParser/spec-10-07.test diff --git a/test/YAMLParser/spec-10-08.data b/test/YAMLParser/spec-10-08.test similarity index 91% rename from test/YAMLParser/spec-10-08.data rename to test/YAMLParser/spec-10-08.test index 53faeb9e001..c4cb8e65ef2 100644 --- a/test/YAMLParser/spec-10-08.data +++ b/test/YAMLParser/spec-10-08.test @@ -1,8 +1,8 @@ # RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s # -# This fails because even without a key token, some contexts (in this case flow -# maps) allow implicit null keys, which mix with this in weird ways. -# XFAIL: * +# FIXME: This test should fail. Yaml bench should report an error that a simple +# key spans across multiple lines and that another simple key is longer than +# 1024 characters. { multi-line @@ -10,4 +10,4 @@ multi-line very long ...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................(>1KB)................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... key: value } -# CHECK: error +# CHECK: ? !!str "very long diff --git a/test/YAMLParser/spec-10-09.data b/test/YAMLParser/spec-10-09.test similarity index 100% rename from test/YAMLParser/spec-10-09.data rename to test/YAMLParser/spec-10-09.test diff --git a/test/YAMLParser/spec-10-10.data b/test/YAMLParser/spec-10-10.test similarity index 100% rename from test/YAMLParser/spec-10-10.data rename to test/YAMLParser/spec-10-10.test diff --git a/test/YAMLParser/spec-10-11.data b/test/YAMLParser/spec-10-11.test similarity index 100% rename from test/YAMLParser/spec-10-11.data rename to test/YAMLParser/spec-10-11.test diff --git a/test/YAMLParser/spec-10-12.data b/test/YAMLParser/spec-10-12.test similarity index 100% rename from test/YAMLParser/spec-10-12.data rename to test/YAMLParser/spec-10-12.test diff --git a/test/YAMLParser/spec-10-13.data b/test/YAMLParser/spec-10-13.test similarity index 100% rename from test/YAMLParser/spec-10-13.data rename to test/YAMLParser/spec-10-13.test diff --git a/test/YAMLParser/spec-10-14.data b/test/YAMLParser/spec-10-14.test similarity index 100% rename from test/YAMLParser/spec-10-14.data rename to test/YAMLParser/spec-10-14.test diff --git a/test/YAMLParser/spec-10-15.data b/test/YAMLParser/spec-10-15.test similarity index 100% rename from test/YAMLParser/spec-10-15.data rename to test/YAMLParser/spec-10-15.test diff --git a/test/YAMLParser/str.data b/test/YAMLParser/str.test similarity index 100% rename from test/YAMLParser/str.data rename to test/YAMLParser/str.test diff --git a/test/YAMLParser/timestamp-bugs.data b/test/YAMLParser/timestamp-bugs.test similarity index 100% rename from test/YAMLParser/timestamp-bugs.data rename to test/YAMLParser/timestamp-bugs.test diff --git a/test/YAMLParser/timestamp.data b/test/YAMLParser/timestamp.test similarity index 100% rename from test/YAMLParser/timestamp.data rename to test/YAMLParser/timestamp.test diff --git a/test/YAMLParser/utf8-implicit.data b/test/YAMLParser/utf8-implicit.test similarity index 100% rename from test/YAMLParser/utf8-implicit.data rename to test/YAMLParser/utf8-implicit.test diff --git a/test/YAMLParser/utf8.data b/test/YAMLParser/utf8.test similarity index 100% rename from test/YAMLParser/utf8.data rename to test/YAMLParser/utf8.test diff --git a/test/YAMLParser/value.data b/test/YAMLParser/value.test similarity index 100% rename from test/YAMLParser/value.data rename to test/YAMLParser/value.test diff --git a/test/YAMLParser/yaml.data b/test/YAMLParser/yaml.test similarity index 100% rename from test/YAMLParser/yaml.data rename to test/YAMLParser/yaml.test diff --git a/utils/yaml-bench/YAMLBench.cpp b/utils/yaml-bench/YAMLBench.cpp index 0fb31387fc2..bd5aa152dff 100644 --- a/utils/yaml-bench/YAMLBench.cpp +++ b/utils/yaml-bench/YAMLBench.cpp @@ -19,6 +19,7 @@ #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/Timer.h" +#include "llvm/Support/Process.h" #include "llvm/Support/YAMLParser.h" #include "llvm/Support/raw_ostream.h" #include @@ -52,6 +53,10 @@ static cl::opt "Do not use more megabytes of memory"), cl::init(1000)); +cl::opt + UseColor("use-color", cl::desc("Emit colored output (default=autodetect)"), + cl::init(cl::BOU_UNSET)); + struct indent { unsigned distance; indent(unsigned d) : distance(d) {} @@ -187,6 +192,9 @@ static std::string createJSONText(size_t MemoryMB, unsigned ValueSize) { int main(int argc, char **argv) { llvm::cl::ParseCommandLineOptions(argc, argv); + bool ShowColors = UseColor == cl::BOU_UNSET + ? sys::Process::StandardOutHasColors() + : UseColor == cl::BOU_TRUE; if (Input.getNumOccurrences()) { ErrorOr> BufOrErr = MemoryBuffer::getFileOrSTDIN(Input); @@ -200,8 +208,10 @@ int main(int argc, char **argv) { } if (DumpCanonical) { - yaml::Stream stream(Buf.getBuffer(), sm); + yaml::Stream stream(Buf.getBuffer(), sm, ShowColors); dumpStream(stream); + if (stream.failed()) + return 1; } }