 ;;; Error parsing
 
 (defconst err-brace-str
-  "{\"Kind\":\"errors\",\"Data\":[{\"FileName\":\"/Users/robnea/dev/rneatherway-fsharpbinding/FSharp.AutoComplete/test/integration/Test1Json/Program.fs\",\"StartLine\":11,\"EndLine\":11,\"StartColumn\":0,\"EndColumn\":2,\"Severity\":\"Warning\",\"Message\":\"Possible incorrect indentation: this token is offside of context started at position (8:1). Try indenting this token further or using standard formatting conventions.\",\"Subcategory\":\"parse\"},{\"FileName\":\"/Users/robnea/dev/rneatherway-fsharpbinding/FSharp.AutoComplete/test/integration/Test1Json/Program.fs\",\"StartLine\":11,\"EndLine\":11,\"StartColumn\":0,\"EndColumn\":2,\"Severity\":\"Error\",\"Message\":\"Unexpected symbol '[<' in expression\",\"Subcategory\":\"parse\"},{\"FileName\":\"/Users/robnea/dev/rneatherway-fsharpbinding/FSharp.AutoComplete/test/integration/Test1Json/Program.fs\",\"StartLine\":12,\"EndLine\":12,\"StartColumn\":0,\"EndColumn\":3,\"Severity\":\"Warning\",\"Message\":\"Possible incorrect indentation: this token is offside of context started at position (8:1). Try indenting this token further or using standard formatting conventions.\",\"Subcategory\":\"parse\"}]}"
+  "{\"Kind\":\"errors\",\"Data\":[{\"FileName\":\"/Users/robnea/dev/rneatherway-fsharpbinding/FSharp.AutoComplete/test/integration/Test1Json/Program.fs\",\"StartLine\":9,\"EndLine\":9,\"StartColumn\":0,\"EndColumn\":2,\"Severity\":\"Warning\",\"Message\":\"Possible incorrect indentation: this token is offside of context started at position (8:1). Try indenting this token further or using standard formatting conventions.\",\"Subcategory\":\"parse\"},{\"FileName\":\"/Users/robnea/dev/rneatherway-fsharpbinding/FSharp.AutoComplete/test/integration/Test1Json/Program.fs\",\"StartLine\":11,\"EndLine\":11,\"StartColumn\":0,\"EndColumn\":2,\"Severity\":\"Error\",\"Message\":\"Unexpected symbol '[<' in expression\",\"Subcategory\":\"parse\"},{\"FileName\":\"/Users/robnea/dev/rneatherway-fsharpbinding/FSharp.AutoComplete/test/integration/Test1Json/Program.fs\",\"StartLine\":12,\"EndLine\":12,\"StartColumn\":0,\"EndColumn\":3,\"Severity\":\"Warning\",\"Message\":\"Possible incorrect indentation: this token is offside of context started at position (8:1). Try indenting this token further or using standard formatting conventions.\",\"Subcategory\":\"parse\"}]}\n"
   "A list of errors containing a square bracket to check the parsing")
 
 (check "parses errors from given string"
-    (should= 3 (length (fsharp-ac-parse-errors err-brace-str))))
+  (using-file (concat fs-file-dir "Program.fs")
+    (let ((json-array-type 'list)
+          (json-object-type 'hash-table)
+          (json-key-type 'string))
+      (should= 3 (length (fsharp-ac-parse-errors
+                          (gethash "Data" (json-read-from-string err-brace-str))))))))
 
 (defmacro check-filter (desc &rest body)
   "Test properties of filtered output from the ac-process."

    (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.")))))

(check-filter "first overlay should have the warning face"


(check-handler "prints message on error"
  (stub-fn message err
    (fsharp-ac-filter-output nil "{\"Kind\": \"ERROR\", \"Data\": \"foo\"}\n")
    (should-match "foo" err)))

;;; Tooltips and typesigs

(defconst tooltip-msg
  "{\"Kind\": \"tooltip\", \"Data\": \"foo\"}\n"
  "A simple tooltip message")

(check-handler "uses popup in terminal if tooltip is requested"
