      (flet ((,sym (x &rest xs) (setq ,var x)))
        ,@body)))
 
-(defun format-output (header &optional content)
-  (concat header "\n" content
-          fsharp-ac-eom))
-
 (check-handler "prints message on error"
   (stub-fn message err
-    (fsharp-ac-filter-output nil (format-output "ERROR: foo"))
+    (fsharp-ac-filter-output nil ("{\"Kind\": \"ERROR\", \"Data\": \"foo\""))
     (should-match "foo" err)))
 
-(check-handler "does not print message on type information error"
-  (stub-fn message called
-    (fsharp-ac-filter-output nil (format-output "ERROR: could not get type information"))
-    (should-not called)))
+;;; Tooltips and typesigs
 
-;;; Tooltips and typesigs
+(defconst tooltip-msg
+  "{\"Kind\": \"tooltip\", \"Data\": \"foo\""
+  "A simple tooltip message")
 
 (check-handler "uses popup in terminal if tooltip is requested"
   (let ((fsharp-ac-use-popup t))
     (flet ((display-graphic-p () nil))
       (stub-fn popup-tip tip
         (fsharp-ac/show-tooltip-at-point)
-        (fsharp-ac-filter-output nil (format-output "DATA: tooltip" "foo"))
+        (fsharp-ac-filter-output nil tooltip-msg)
         (should-match "foo" tip)))))
 
 (check-handler "uses pos-tip in GUI if tooltip is requested"

;;; Error parsing

(defconst err-brace-str
  (mapconcat
     'identity
     '("DATA: errors"
       "[9:0-9:2] WARNING Possible incorrect indentation: this token is offside of context started at position (2:16)."
       "Try indenting this token further or using standard formatting conventions."
       "[11:0-11:2] ERROR Unexpected symbol '[<' in expression"
       "Followed by more stuff on this line"
       "[12:0-12:3] WARNING Possible incorrect indentation: this token is offside of context started at position (2:16).
Try indenting this token further or using standard formatting conventions."
       "<<EOF>>"
       "")
     "\n")
  "A list of errors containing a square bracket to check the parsing")

(check "parses errors from given string"

    (should (equal text
                   (concat "Possible incorrect indentation: "
                           "this token is offside of context started at "
                           "position (8:1)."
                           "\nTry indenting this token further or using standard "
                           "formatting conventions.")))))

