fix property test

pull/2986/head
leizhe 2021-10-20 11:01:57 +08:00 committed by Tienson Qin
parent 8f2140e537
commit 625c75494e
2 changed files with 6 additions and 4 deletions

View File

@ -240,7 +240,9 @@
result (cond
(and org? (not has-properties?))
(let [properties (build-properties-str format {key value})]
(string/join "\n" (concat [title] scheduled deadline [properties] body-without-timestamps)))
(if title
(string/join "\n" (concat [title] scheduled deadline [properties] body-without-timestamps))
(str properties content)))
(and has-properties? (>= start-idx 0) (> end-idx 0) (> end-idx start-idx))
(let [exists? (atom false)

View File

@ -141,11 +141,11 @@
"title:: a/b/c\ntags:: d,e\n")
(are [x y] (= (property/build-properties-str :org x) y)
{:title "a"}
":PROPERTIES:\n:title: a\n:END:\n"
":PROPERTIES:\n:title: a\n:END:"
{:title "a/b/c"}
":PROPERTIES:\n:title: a/b/c\n:END:\n"
":PROPERTIES:\n:title: a/b/c\n:END:"
{:title "a/b/c" :tags "d,e"}
":PROPERTIES:\n:title: a/b/c\n:tags: d,e\n:END:\n"))
":PROPERTIES:\n:title: a/b/c\n:tags: d,e\n:END:"))
(deftest test-with-built-in-properties
(let [content "#+BEGIN_QUERY\n{:title \"cool NEXT\"\n :query [:find (pull ?h [*])\n :in $ ?start ?next\n :where\n [?h :block/marker ?marker]\n [(contains? #{\"NOW\" \"LATER\" \"TODO\"} ?marker)]\n [?h :block/ref-pages ?p]\n [?p :block/journal? true]\n [?p :block/journal-day ?d]\n [(> ?d ?start)]\n [(< ?d ?next)]]\n :inputs [:today :7d-after]\n :collapsed? false}\n#+END_QUERY"]