Skip to main content
Module

x/denops_std/function/vim/mod.ts>assert_equal

📚 Standard module for denops.vim
Go to Latest
function assert_equal
import { assert_equal } from "https://deno.land/x/denops_std@v6.4.0/function/vim/mod.ts";

When {expected} and {actual} are not equal an error message is added to v:errors and 1 is returned. Otherwise zero is returned. assert-return The error is in the form "Expected {expected} but got {actual}". When {msg} is present it is prefixed to that.

There is no automatic conversion, the String "4" is different from the Number 4. And the number 4 is different from the Float 4.0. The value of 'ignorecase' is not used here, case always matters. Example:

assert_equal('foo', 'bar')

Will result in a string to be added to v:errors: test.vim line 12: Expected 'foo' but got 'bar'

Can also be used as a method, the base is passed as the second argument:

mylist->assert_equal([1, 2, 3])

Parameters

denops: Denops
expected: unknown
actual: unknown
optional
msg: unknown

Returns

Promise<number>