()
| 863 | |
| 864 | #[mz_ore::test] |
| 865 | fn test_copy_format_text_parser() { |
| 866 | let text = "\t\\nt e\t\\N\t\n\\x60\\xA\\x7D\\x4a\n\\44\\044\\123".as_bytes(); |
| 867 | let mut parser = CopyTextFormatParser::new(text, b'\t', "\\N"); |
| 868 | assert!(parser.is_column_delimiter()); |
| 869 | parser |
| 870 | .expect_column_delimiter() |
| 871 | .expect("expected column delimiter"); |
| 872 | assert_eq!( |
| 873 | parser |
| 874 | .consume_raw_value() |
| 875 | .expect("unexpected error") |
| 876 | .expect("unexpected empty result"), |
| 877 | "\nt e".as_bytes() |
| 878 | ); |
| 879 | parser |
| 880 | .expect_column_delimiter() |
| 881 | .expect("expected column delimiter"); |
| 882 | // null value |
| 883 | assert!( |
| 884 | parser |
| 885 | .consume_raw_value() |
| 886 | .expect("unexpected error") |
| 887 | .is_none() |
| 888 | ); |
| 889 | parser |
| 890 | .expect_column_delimiter() |
| 891 | .expect("expected column delimiter"); |
| 892 | assert!(parser.is_end_of_line()); |
| 893 | parser.expect_end_of_line().expect("expected eol"); |
| 894 | // hex value |
| 895 | assert_eq!( |
| 896 | parser |
| 897 | .consume_raw_value() |
| 898 | .expect("unexpected error") |
| 899 | .expect("unexpected empty result"), |
| 900 | "`\n}J".as_bytes() |
| 901 | ); |
| 902 | parser.expect_end_of_line().expect("expected eol"); |
| 903 | // octal value |
| 904 | assert_eq!( |
| 905 | parser |
| 906 | .consume_raw_value() |
| 907 | .expect("unexpected error") |
| 908 | .expect("unexpected empty result"), |
| 909 | "$$S".as_bytes() |
| 910 | ); |
| 911 | assert!(parser.is_eof()); |
| 912 | } |
| 913 | |
| 914 | #[mz_ore::test] |
| 915 | fn test_copy_format_text_empty_null_string() { |
nothing calls this directly
no test coverage detected