🦠 The Definitive Gemini Protocol Toolkit
gemini gemini-protocol gemtext parser zero-dependency toolkit ast converter html markdown cli networking
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(ast): Gracefully handle malformed link lines

Fuwn b4515608 2647162d

+15 -1
+1 -1
src/ast/container.rs
··· 206 206 .into_iter(); 207 207 208 208 nodes.push(Node::Link { 209 - to: split.next().expect("no location in link"), 209 + to: split.next().unwrap_or_default(), 210 210 text: { 211 211 let rest = split.collect::<Vec<String>>().join(" "); 212 212
+14
tests/ast.rs
··· 84 84 "=> / Home" 85 85 ); 86 86 } 87 + 88 + #[test] 89 + fn build_malformed_link_without_url() { 90 + let ast = Ast::from_string("=>"); 91 + 92 + assert_eq!(ast.inner().len(), 1); 93 + 94 + if let Node::Link { to, text } = ast.inner().first().unwrap() { 95 + assert_eq!(to, ""); 96 + assert_eq!(text, &None); 97 + } else { 98 + panic!("Expected Link node"); 99 + } 100 + } 87 101 }