patch 8.2.0578: heredoc for interfaces does not support "trim"

Problem:    Heredoc for interfaces does not support "trim".
Solution:   Update the script heredoc support to be same as the :let command.
            (Yegappan Lakshmanan, closes #5916)
diff --git a/src/testdir/test_pyx2.vim b/src/testdir/test_pyx2.vim
index 20199a4..93a2b89 100644
--- a/src/testdir/test_pyx2.vim
+++ b/src/testdir/test_pyx2.vim
@@ -15,10 +15,10 @@
 
 func Test_pyx()
   redir => var
-  pyx << EOF
-import sys
-print(sys.version)
-EOF
+  pyx << trim EOF
+    import sys
+    print(sys.version)
+  EOF
   redir END
   call assert_match(s:py2pattern, split(var)[0])
 endfunc
@@ -79,3 +79,22 @@
     call assert_match( '^Vim(.*):RuntimeError: TEST$', v:exception )
   endtry
 endfunc
+
+" Test for various heredoc syntaxes
+func Test_pyx2_heredoc()
+  pyx << END
+result='A'
+END
+  pyx <<
+result+='B'
+.
+  pyx << trim END
+    result+='C'
+  END
+  pyx << trim
+    result+='D'
+  .
+  call assert_equal('ABCD', pyxeval('result'))
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab