mirror of
https://github.com/nushell/nushell.git
synced 2025-08-15 01:02:42 +02:00
Correct line folding in from ics
/from vcf
(#10577)
# Description Potential fix for #10398 datatracker.ietf.org/doc/html/rfc5545#section-3.1 datatracker.ietf.org/doc/html/rfc6350#section-3.2 --------- Co-authored-by: Joerg <joerg@schuetter.org>
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||
use nu_test_support::fs::Stub::{FileWithContent, FileWithContentToBeTrimmed};
|
||||
use nu_test_support::nu_with_plugins;
|
||||
use nu_test_support::playground::Playground;
|
||||
use pretty_assertions::assert_eq;
|
||||
@ -82,3 +82,42 @@ fn from_vcf_text_to_table() {
|
||||
assert_eq!(actual.out, "john.doe99@gmail.com");
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn from_vcf_text_with_linebreak_to_table() {
|
||||
Playground::setup("filter_from_vcf_test_3", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContent(
|
||||
"contacts.txt",
|
||||
r"BEGIN:VCARD
|
||||
VERSION:3.0
|
||||
FN:John Doe
|
||||
N:Doe;John;;;
|
||||
EMAIL;TYPE=INTERNET:john.doe99
|
||||
@gmail.com
|
||||
item1.ORG:'Alpine Ski Resort'
|
||||
item1.X-ABLabel:Other
|
||||
item2.TITLE:'Ski Instructor'
|
||||
item2.X-ABLabel:Other
|
||||
BDAY:19001106
|
||||
NOTE:Facebook: john.doe.3\nWebsite: \nHometown: Cleveland\, Ohio
|
||||
CATEGORIES:myContacts
|
||||
END:VCARD",
|
||||
)]);
|
||||
|
||||
let cwd = dirs.test();
|
||||
let actual = nu_with_plugins!(
|
||||
cwd: cwd,
|
||||
plugin: ("nu_plugin_formats"),
|
||||
r#"
|
||||
open contacts.txt
|
||||
| from vcf
|
||||
| get properties.0
|
||||
| where name == "EMAIL"
|
||||
| first
|
||||
| get value
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "john.doe99@gmail.com");
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user