Skip to content

Commit

Permalink
added junit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jlangch committed Sep 4, 2023
1 parent 08059ae commit 3c3adba
Show file tree
Hide file tree
Showing 6 changed files with 344 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import com.github.jlangch.venice.impl.reader.HighlightParser;
import com.github.jlangch.venice.impl.reader.Reader;
import com.github.jlangch.venice.impl.thread.ThreadContext;
import com.github.jlangch.venice.impl.types.Constants;
import com.github.jlangch.venice.impl.types.IVncFunction;
import com.github.jlangch.venice.impl.types.VncBigDecimal;
import com.github.jlangch.venice.impl.types.VncBigInteger;
Expand Down Expand Up @@ -4166,6 +4167,10 @@ public VncVal apply(final VncList args) {
public VncVal apply(final VncList args) {
ArityExceptions.assertArity(this, args, 2, 3);

if (args.first() == Constants.Nil) {
return Constants.Nil;
}

VncCollection coll = Coerce.toVncCollection(args.first());
VncSequence keys = Coerce.toVncSequence(args.second());
VncVal key_not_found = (args.size() == 3) ? args.nth(2) : Nil;
Expand Down
43 changes: 23 additions & 20 deletions src/main/resources/com/github/jlangch/venice/core.venice
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,20 @@

(defmacro
^{ :arglists '(
"(assert-false expr)"
"(assert-false expr message)")
:doc """
Evaluates expr and throws an `:AssertionException`
exception if it does not evaluate to logical false.
"""
"(assert-false expr)"
"(assert-false expr message)")
:doc
"""
Evaluates expr and throws an `:AssertionException`
exception if it does not evaluate to logical false.
"""
:examples '(
"(assert-false (= 3 (+ 1 3)))"
"(assert-false (= 4 (+ 1 3)))" )
"(assert-false (= 3 (+ 1 3)))"
"(assert-false (= 4 (+ 1 3)))" )
:see-also '(
"assert", "assert-eq", "assert-ne",
"assert-throws", "assert-does-not-throw", "test/deftest") }
"assert", "assert-eq", "assert-ne",
"assert-throws", "assert-does-not-throw",
"test/deftest") }

assert-false

Expand Down Expand Up @@ -148,18 +150,19 @@

(defmacro
^{ :arglists '(
"(assert-eq expected actual)"
"(assert-eq expected actual message)")
:doc """
Assert that expected and actual are equal.
Throws an `:AssertionException` exception if they are not equal.
"""
"(assert-eq expected actual)"
"(assert-eq expected actual message)")
:doc
"""
Assert that expected and actual are equal.
Throws an `:AssertionException` exception if they are not equal.
"""
:examples '(
"(assert-eq 3 (+ 1 2))"
"(assert-eq 4 (+ 1 2))" )
"(assert-eq 3 (+ 1 2))"
"(assert-eq 4 (+ 1 2))" )
:see-also '(
"assert", "assert-false", "assert-ne",
"assert-throws", "assert-does-not-throw", "test/deftest") }
"assert", "assert-false", "assert-ne",
"assert-throws", "assert-does-not-throw", "test/deftest") }

assert-eq

Expand Down
Loading

0 comments on commit 3c3adba

Please sign in to comment.