comparison src/testdir/test_functions.vim @ 25048:82ae6fcd86c8 v8.2.3061

patch 8.2.3061: testing the shell option is incomplete and spread out Commit: https://github.com/vim/vim/commit/054794c20f6322bbd9482c4124041dc0a140c78e Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sun Jun 27 12:07:49 2021 +0200 patch 8.2.3061: testing the shell option is incomplete and spread out Problem: Testing the shell option is incomplete and spread out. Solution: Move shell tests to one file and increase coverage. (Yegappan Lakshmanan, closes #8464)
author Bram Moolenaar <Bram@vim.org>
date Sun, 27 Jun 2021 12:15:03 +0200
parents 0c415a0f54f9
children cd5e8df05a64
comparison
equal deleted inserted replaced
25047:0ea3ceb86a0d 25048:82ae6fcd86c8
1577 nunmap g. 1577 nunmap g.
1578 delfunc Operator 1578 delfunc Operator
1579 delfunc Apply 1579 delfunc Apply
1580 endfunc 1580 endfunc
1581 1581
1582 func Test_shellescape()
1583 let save_shell = &shell
1584 set shell=bash
1585 call assert_equal("'text'", shellescape('text'))
1586 call assert_equal("'te\"xt'", 'te"xt'->shellescape())
1587 call assert_equal("'te'\\''xt'", shellescape("te'xt"))
1588
1589 call assert_equal("'te%xt'", shellescape("te%xt"))
1590 call assert_equal("'te\\%xt'", shellescape("te%xt", 1))
1591 call assert_equal("'te#xt'", shellescape("te#xt"))
1592 call assert_equal("'te\\#xt'", shellescape("te#xt", 1))
1593 call assert_equal("'te!xt'", shellescape("te!xt"))
1594 call assert_equal("'te\\!xt'", shellescape("te!xt", 1))
1595
1596 call assert_equal("'te\nxt'", shellescape("te\nxt"))
1597 call assert_equal("'te\\\nxt'", shellescape("te\nxt", 1))
1598 set shell=tcsh
1599 call assert_equal("'te\\!xt'", shellescape("te!xt"))
1600 call assert_equal("'te\\\\!xt'", shellescape("te!xt", 1))
1601 call assert_equal("'te\\\nxt'", shellescape("te\nxt"))
1602 call assert_equal("'te\\\\\nxt'", shellescape("te\nxt", 1))
1603
1604 let &shell = save_shell
1605 endfunc
1606
1607 func Test_trim() 1582 func Test_trim()
1608 call assert_equal("Testing", trim(" \t\r\r\x0BTesting \t\n\r\n\t\x0B\x0B")) 1583 call assert_equal("Testing", trim(" \t\r\r\x0BTesting \t\n\r\n\t\x0B\x0B"))
1609 call assert_equal("Testing", " \t \r\r\n\n\x0BTesting \t\n\r\n\t\x0B\x0B"->trim()) 1584 call assert_equal("Testing", " \t \r\r\n\n\x0BTesting \t\n\r\n\t\x0B\x0B"->trim())
1610 call assert_equal("RESERVE", trim("xyz \twwRESERVEzyww \t\t", " wxyz\t")) 1585 call assert_equal("RESERVE", trim("xyz \twwRESERVEzyww \t\t", " wxyz\t"))
1611 call assert_equal("wRE \tSERVEzyww", trim("wRE \tSERVEzyww")) 1586 call assert_equal("wRE \tSERVEzyww", trim("wRE \tSERVEzyww"))