view src/testdir/test_expr.vim @ 8635:3a38d465f731 v7.4.1607

commit https://github.com/vim/vim/commit/f0e86a0dbddc18568910e9e4aaae0cd88ca8087a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 19 19:38:12 2016 +0100 patch 7.4.1607 Problem: Comparing a function that exists on two dicts is not backwards compatible. (Thinca) Solution: Only compare the function, not what the partial adds.
author Christian Brabandt <cb@256bit.org>
date Sat, 19 Mar 2016 19:45:05 +0100
parents
children 03e5171c23e5
line wrap: on
line source

" Tests for expressions.

func Test_equal()
  let base = {}
  func base.method()
    return 1
  endfunc
  func base.other() dict
    return 1
  endfunc
  let instance = copy(base)
  call assert_true(base.method == instance.method)
  call assert_true([base.method] == [instance.method])
  call assert_true(base.other == instance.other)
  call assert_true([base.other] == [instance.other])

  call assert_false(base.method == base.other)
  call assert_false([base.method] == [base.other])
  call assert_false(base.method == instance.other)
  call assert_false([base.method] == [instance.other])

  call assert_fails('echo base.method > instance.method')
endfunc