org-parser
org-parser copied to clipboard
Dev env questions
Can a clojure developer help me with a few things?
1
How do you compare lein test output?
FAIL in (timestamp) (parser_test.cljc:261)
date timestamp with day and time with seconds
expected: (= [:timestamp [:timestamp-active [:timestamp-inner [:timestamp-inner-w-time [:ts-date "2020-01-18"] [:ts-day "Sat"] [:ts-time "12:00:00"] [:ts-modifiers]]]]] (parse "<2020-01-18 Sat 12:00:00>"))
actual: (not (= [:timestamp [:timestamp-active [:timestamp-inner [:timestamp-inner-w-time [:ts-date "2020-01-18"] [:ts-day "Sat"] [:ts-time "12:00:00"] [:ts-modifiers]]]]] [:timestamp [:timestamp-active [:timestamp-inner [:timestamp-inner-w-time [:ts-date "2020-01-18"] [:ts-day "Sat"] [:ts-time "12:00:00"]] [:ts-modifiers]]]]))
Is there a lein test diff tool to get around copy & paste?
2
(deftest timestamp
(let [parse #(parser/org % :start :timestamp)]
(testing "date-only timestamp"
(is (= [:timestamp [:timestamp-active [:timestamp-inner [:timestamp-inner-wo-time [:ts-date "2020-01-18"]] [:ts-modifiers]]]]
(parse "<2020-01-18>"))))
How can I def a helper function that creates this huge [:timestamp [...
?
3
Can I speed up the tests by running them in lein repl
instead of lein test
. lein test
already takes 5.5 seconds to run, not funny...
Hi @schoettl
Thank you for your great questions. Since the questions are tooling related, I opted to make a quick screencast for the answer: https://www.dropbox.com/s/f9htbxmfjdd5pzw/2020-01-20_11-quick-intro-to-lisp-and-clojure-and-the-repl.mpv?dl=0
Does that help?
Thanks! That's definetly helpful. I have to check out soon, if I can do the same in my emacs :)
I'd like to leave this issue open for a while, until I made it – and for the case I have further questions.
Sure thing, good luck!
And if you're not warm with Emacs, yet, I hear good things about VIM fireplace^^
Excellent video @munen, thanks a lot! I've hacked elisp for many years, but never clojure, so this was really helpful for me, and makes me want to get stuck into this project :-) Hoping to get some free time soon...
@aspiers Thank you very much!
Clojure is a lot of fun. With your elisp experience, you'll easily grasp it. The big difference is that Clojure emphasizes immutable data structures and functional programming.
Having said that, the org-parser repo doesn't require a whole lot of Clojure coding. The parser is written in EBNF - so it's only down to the tests for which the existing tests likely include most required syntax. So it's a good starting ground to have a little go at Clojure(;
One last thing, if you do get to know Clojure data structures, there's one more benefit: In organice, we're making extensive use of ImmutableJS which is pretty much a port of Clojures data structures to JavaScript and have a high correlation in how the APIs work.
Looking forward to seeing more org-parser PRs coming in(;
@schoettl I've added a little bit of documentation and the video to the readme: https://github.com/200ok-ch/org-parser/pull/14