Skip to content

Instantly share code, notes, and snippets.

@tomdalling
Last active August 8, 2020 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomdalling/5cfc4548146695c6ee6bfc3910df3f64 to your computer and use it in GitHub Desktop.
Save tomdalling/5cfc4548146695c6ee6bfc3910df3f64 to your computer and use it in GitHub Desktop.
TestBench output
Running test/automated/zettel/hashtag_query.rb
Zettel::HashtagQuery
matches the presence of a hashtag
with syntax: #a
provides logical NOT
with syntax: NOT #a
with syntax: not #a
with syntax: !#a
provides logical AND
with syntax: #a AND #b
with syntax: #a and #b
with syntax: #a & #b
with syntax: #a && #b
provides logical OR
with syntax: #a OR #b
with syntax: #a or #b
with syntax: #a | #b
with syntax: #a || #b
gives NOT a higher precedence than AND and OR
with syntax: !#a AND !#b AND !#c
with syntax: !#a OR !#b OR !#c
is left-associative
with syntax: #a AND #b OR #c
allows brackets for explicit precedence
with syntax: #a AND (#b OR #c)
allows arbitrary nesting
with syntax: (#a) AND (NOT (#b OR (#c)) AND () #d)
Finished running 1 file
Ran 77 tests in 0.035s (2200.0 tests/second)
77 passed, 0 skipped, 0 failed, 0 total errors
TEST_BENCH_DETAIL=on be bench test/automated/zettel/hashtag_query.rb
Running test/automated/zettel/hashtag_query.rb
Zettel::HashtagQuery
matches the presence of a hashtag
with syntax: #a
should match ["a"]
should match ["a", "b"]
should NOT match []
should NOT match ["b"]
provides logical NOT
with syntax: NOT #a
should match []
should match ["b"]
should NOT match ["a"]
with syntax: not #a
should match []
should match ["b"]
should NOT match ["a"]
with syntax: !#a
should match []
should match ["b"]
should NOT match ["a"]
provides logical AND
with syntax: #a AND #b
should match ["a", "b"]
should match ["a", "b", "c"]
should NOT match ["a"]
should NOT match ["b"]
with syntax: #a and #b
should match ["a", "b"]
should match ["a", "b", "c"]
should NOT match ["a"]
should NOT match ["b"]
with syntax: #a & #b
should match ["a", "b"]
should match ["a", "b", "c"]
should NOT match ["a"]
should NOT match ["b"]
with syntax: #a && #b
should match ["a", "b"]
should match ["a", "b", "c"]
should NOT match ["a"]
should NOT match ["b"]
provides logical OR
with syntax: #a OR #b
should match ["a"]
should match ["b"]
should match ["a", "b"]
should NOT match []
should NOT match ["c"]
with syntax: #a or #b
should match ["a"]
should match ["b"]
should match ["a", "b"]
should NOT match []
should NOT match ["c"]
with syntax: #a | #b
should match ["a"]
should match ["b"]
should match ["a", "b"]
should NOT match []
should NOT match ["c"]
with syntax: #a || #b
should match ["a"]
should match ["b"]
should match ["a", "b"]
should NOT match []
should NOT match ["c"]
gives NOT a higher precedence than AND and OR
with syntax: !#a AND !#b AND !#c
should match []
should match ["d"]
should NOT match ["a"]
should NOT match ["b"]
should NOT match ["c"]
with syntax: !#a OR !#b OR !#c
should match []
should match ["a"]
should match ["b"]
should match ["c"]
should NOT match ["a", "b", "c"]
is left-associative
with syntax: #a AND #b OR #c
should match ["a", "b"]
should match ["c"]
allows brackets for explicit precedence
with syntax: #a AND (#b OR #c)
should match ["a", "b"]
should match ["a", "c"]
should NOT match ["c"]
allows arbitrary nesting
with syntax: (#a) AND (NOT (#b OR (#c)) AND () #d)
should match ["a", "d"]
should match ["a", "x", "d"]
should NOT match ["a", "b", "d"]
should NOT match ["a", "c", "d"]
should NOT match ["a"]
Finished running 1 file
Ran 77 tests in 0.052s (1480.8 tests/second)
77 passed, 0 skipped, 0 failed, 0 total errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment