patch 8.0.0167: str2nr()/str2float() fail with negative values

Problem:    str2nr() and str2float() do not always work with negative values.
Solution:   Be more flexible about handling signs. (LemonBoy, closes #1332)
            Add more tests.
diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim
index 6e989f6..d29bc3a 100644
--- a/src/testdir/test_alot.vim
+++ b/src/testdir/test_alot.vim
@@ -18,6 +18,7 @@
 source test_filter_map.vim
 source test_float_func.vim
 source test_fnamemodify.vim
+source test_functions.vim
 source test_glob2regpat.vim
 source test_goto.vim
 source test_help_tagjump.vim
diff --git a/src/testdir/test_float_func.vim b/src/testdir/test_float_func.vim
index e51b83e..981d821 100644
--- a/src/testdir/test_float_func.vim
+++ b/src/testdir/test_float_func.vim
@@ -165,9 +165,22 @@
 
 func Test_str2float()
   call assert_equal('1.0', string(str2float('1')))
+  call assert_equal('1.0', string(str2float(' 1 ')))
+  call assert_equal('1.0', string(str2float(' 1.0 ')))
   call assert_equal('1.23', string(str2float('1.23')))
   call assert_equal('1.23', string(str2float('1.23abc')))
   call assert_equal('1.0e40', string(str2float('1e40')))
+
+  call assert_equal('1.0', string(str2float('+1')))
+  call assert_equal('1.0', string(str2float('+1')))
+  call assert_equal('1.0', string(str2float(' +1 ')))
+  call assert_equal('1.0', string(str2float(' + 1 ')))
+
+  call assert_equal('-1.0', string(str2float('-1')))
+  call assert_equal('-1.0', string(str2float('-1')))
+  call assert_equal('-1.0', string(str2float(' -1 ')))
+  call assert_equal('-1.0', string(str2float(' - 1 ')))
+
   call assert_equal('inf', string(str2float('1e1000')))
   call assert_equal('inf', string(str2float('inf')))
   call assert_equal('-inf', string(str2float('-inf')))
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
new file mode 100644
index 0000000..ec816d1
--- /dev/null
+++ b/src/testdir/test_functions.vim
@@ -0,0 +1,18 @@
+" Tests for various functions.
+
+func Test_str2nr()
+  call assert_equal(0, str2nr(''))
+  call assert_equal(1, str2nr('1'))
+  call assert_equal(1, str2nr(' 1 '))
+
+  call assert_equal(1, str2nr('+1'))
+  call assert_equal(1, str2nr('+ 1'))
+  call assert_equal(1, str2nr(' + 1 '))
+
+  call assert_equal(-1, str2nr('-1'))
+  call assert_equal(-1, str2nr('- 1'))
+  call assert_equal(-1, str2nr(' - 1 '))
+
+  call assert_equal(123456789, str2nr('123456789'))
+  call assert_equal(-123456789, str2nr('-123456789'))
+endfunc