patch 9.1.0516: need more tests for nested dicts and list comparision

Commit: 
https://github.com/vim/vim/commit/88bbdb04c2776ba69b8e5da58051fd94f8842b03
Author: Yegappan Lakshmanan <yegap...@yahoo.com>
Date:   Sun Jun 23 10:00:04 2024 +0200

    patch 9.1.0516: need more tests for nested dicts and list comparision
    
    Problem:  need more tests for nested dicts and list comparision
    Solution: Add tests for comparing deeply nested List/Dict values
              (Yegappan Lakshmanan)
    
    closes: #15081
    
    Signed-off-by: Yegappan Lakshmanan <yegap...@yahoo.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/testdir/test_listdict.vim b/src/testdir/test_listdict.vim
index 12a6dd4fe..f2d4a3e75 100644
--- a/src/testdir/test_listdict.vim
+++ b/src/testdir/test_listdict.vim
@@ -1557,4 +1557,53 @@ func Test_extendnew_leak()
   for i in range(100) | silent! call extendnew({}, {}, {}) | endfor
 endfunc
 
+" Test for comparing deeply nested List/Dict values
+func Test_deep_nested_listdict_compare()
+  let lines =<< trim END
+    def GetNestedList(sz: number): list<any>
+      var l: list<any> = []
+      var x: list<any> = l
+      for i in range(sz)
+        var y: list<any> = [1]
+        add(x, y)
+        x = y
+      endfor
+      return l
+    enddef
+
+    VAR l1 = GetNestedList(1000)
+    VAR l2 = GetNestedList(999)
+    call assert_false(l1 == l2)
+
+    #" after 1000 nested items, the lists are considered to be equal
+    VAR l3 = GetNestedList(1001)
+    VAR l4 = GetNestedList(1002)
+    call assert_true(l3 == l4)
+  END
+  call v9.CheckLegacyAndVim9Success(lines)
+
+  let lines =<< trim END
+    def GetNestedDict(sz: number): dict<any>
+      var d: dict<any> = {}
+      var x: dict<any> = d
+      for i in range(sz)
+        var y: dict<any> = {}
+        x['a'] = y
+        x = y
+      endfor
+      return d
+    enddef
+
+    VAR d1 = GetNestedDict(1000)
+    VAR d2 = GetNestedDict(999)
+    call assert_false(d1 == d2)
+
+    #" after 1000 nested items, the Dicts are considered to be equal
+    VAR d3 = GetNestedDict(1001)
+    VAR d4 = GetNestedDict(1002)
+    call assert_true(d3 == d4)
+  END
+  call v9.CheckLegacyAndVim9Success(lines)
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 357f9c1e3..0fb66979d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    516,
 /**/
     515,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1sLINN-00CZqf-CX%40256bit.org.

Raspunde prin e-mail lui