chiark / gitweb /
Make all the tests compile again (ahem).
authorSimon Tatham <anakin@pobox.com>
Fri, 5 Jan 2024 10:27:30 +0000 (10:27 +0000)
committerSimon Tatham <anakin@pobox.com>
Fri, 5 Jan 2024 10:27:39 +0000 (10:27 +0000)
src/editor.rs
src/posting.rs
src/text.rs

index 967f7d89594f6ba3233e37020b27cdbc273ca413..6135de7327ffd50fbd8fc7fef70f4870c7576147 100644 (file)
@@ -507,6 +507,8 @@ fn test_single_line_extra_ops() {
         },
         width: 0,
         first_visible: 0,
+        prompt: ColouredString::plain(""),
+        promptwidth: 0,
     };
 
     sle.cut_to_end();
@@ -535,6 +537,8 @@ fn test_single_line_visibility() {
         },
         width: 5,
         first_visible: 0,
+        prompt: ColouredString::plain(""),
+        promptwidth: 0,
     };
 
     assert_eq!(sle.draw(sle.width),
@@ -803,7 +807,8 @@ impl Composer {
 
     #[cfg(test)]
     fn test_new(conf: InstanceStatusConfig, text: &str) -> Self {
-        Self::new(conf, FileHeader::new(ColouredString::plain("dummy")), text)
+        Self::new(conf, FileHeader::new(ColouredString::plain("dummy")),
+                  None, Post::with_text(text))
     }
 
     fn is_line_boundary(c: char) -> bool {
index 67f1fee538b8d60d037391debd11822ad838aaa8..e720d83b4818378394907d490c5b2ecf2410deb4 100644 (file)
@@ -48,6 +48,19 @@ impl Post {
         }
     }
 
+    #[cfg(test)]
+    pub fn with_text(text: &str) -> Self {
+        Post {
+            text: text.to_owned(),
+            m: PostMetadata {
+                in_reply_to_id: None,
+                visibility: Visibility::Public,
+                content_warning: None,
+                language: default_language(),
+            },
+        }
+    }
+
     pub fn reply_to(id: &str, client: &mut Client) ->
         Result<Self, ClientError>
     {
index 8d2d39156e1578c16140f967376c871f35a72f8a..fde9cdc6c691ea62e90fe5e0a9869fddae3882ba 100644 (file)
@@ -1133,8 +1133,8 @@ fn test_notification_log() {
     ));
 
     assert_eq!(NotificationLog::new(
-            t, "foo@example.com", "Foo Bar", "123", None,
-            NotificationType::Reblog, Some(&post)).render(80), vec! {
+            t, "foo@example.com", "Foo Bar", "123",
+            NotificationType::Reblog, Some(&post), None).render(80), vec! {
             ColouredString::general("Fri Aug  3 04:05:06 2001 Foo Bar (foo@example.com) boosted: take a look at this",
                                     "                                                                               "),
             ColouredString::general("  otter! @badger might also like it",
@@ -1142,8 +1142,8 @@ fn test_notification_log() {
         });
 
     assert_eq!(NotificationLog::new(
-            t, "foo@example.com", "Foo Bar", "123", None,
-            NotificationType::Favourite, Some(&post)).render(51), vec! {
+            t, "foo@example.com", "Foo Bar", "123",
+            NotificationType::Favourite, Some(&post), None).render(51), vec! {
             ColouredString::general("Fri Aug  3 04:05:06 2001 Foo Bar (foo@example.com)",
                                     "                                                  "),
             ColouredString::general("  favourited: take a look at this otter! @badger...",
@@ -1151,8 +1151,8 @@ fn test_notification_log() {
         });
 
     assert_eq!(NotificationLog::new(
-            t, "foo@example.com", "Foo Bar", "123", None,
-            NotificationType::Follow, None).render(80), vec! {
+            t, "foo@example.com", "Foo Bar", "123",
+            NotificationType::Follow, None, None).render(80), vec! {
             ColouredString::general("Fri Aug  3 04:05:06 2001 Foo Bar (foo@example.com) followed you",
                                     "                                                               "),
         });
@@ -1212,7 +1212,7 @@ impl TextFragment for UserListEntry {
 
 #[test]
 fn test_user_list_entry() {
-    assert_eq!(UserListEntry::new("foo@example.com", "Foo Bar")
+    assert_eq!(UserListEntry::new("foo@example.com", "Foo Bar", "123")
                .render(80), vec! {
             ColouredString::general("Foo Bar (foo@example.com)",
                                     "                         "),