aboutsummaryrefslogtreecommitdiff
path: root/src/backend/search.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/search.rs')
-rw-r--r--src/backend/search.rs29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/backend/search.rs b/src/backend/search.rs
index 7319acc..2c11355 100644
--- a/src/backend/search.rs
+++ b/src/backend/search.rs
@@ -26,7 +26,7 @@ impl Default for BibiSearch {
impl BibiSearch {
// Stringify inner Vec<String> by joining/concat
fn convert_to_string(inner_vec: &Vec<String>) -> String {
- inner_vec.join(" ")
+ inner_vec[0..6].join(" ")
}
// Return a filtered entry list
@@ -89,3 +89,30 @@ impl BibiSearch {
filtered_list
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_vector_join() {
+ let bibvec = vec![
+ "Author".to_string(),
+ "Title".to_string(),
+ "1999".to_string(),
+ "article".to_string(),
+ "hello, bye".to_string(),
+ "author_1999".to_string(),
+ "An abstract with multiple sentences. Sometimes thats necessary".to_string(),
+ "www.bibiman.org".to_string(),
+ "/home/file/path.pdf".to_string(),
+ ];
+
+ let joined_vec = BibiSearch::convert_to_string(&bibvec);
+
+ assert_eq!(
+ joined_vec,
+ "Author Title 1999 article hello, bye author_1999"
+ )
+ }
+}