@@ -118,12 +118,14 @@ func Test_func_string_length(t *testing.T) {
118118func Test_func_substring (t * testing.T ) {
119119 test_xpath_eval (t , empty_example , `substring("motor car", 6)` , " car" )
120120 test_xpath_eval (t , empty_example , `substring("metadata", 4, 3)` , "ada" )
121- //test_xpath_eval(t, empty_example, `substring("12345", 5, -3)`, "") // ?? it should be 1 ??
122- //test_xpath_eval(t, empty_example, `substring("12345", 1.5, 2.6)`, "234")
123- //test_xpath_eval(t, empty_example, `substring("12345", 0, 3)`, "12") // panic??
124- //test_xpath_eval(t, empty_example, `substring("12345", 5, -3)`, "1")
121+ test_xpath_eval (t , empty_example , `substring("12345", 5, -3)` , "" )
122+ test_xpath_eval (t , empty_example , `substring("12345", 1.5, 2.6)` , "234" )
123+ test_xpath_eval (t , empty_example , `substring("12345", 0, 3)` , "12" )
124+ test_xpath_eval (t , empty_example , `substring("12345", 5, -3)` , "" )
125+ test_xpath_eval (t , empty_example , `substring("12345", 0, 5)` , "1234" )
126+ test_xpath_eval (t , empty_example , `substring("12345", 1, 5)` , "12345" )
127+ test_xpath_eval (t , empty_example , `substring("12345", 1, 6)` , "12345" )
125128 test_xpath_eval (t , html_example , `substring(//title/child::node(), 1)` , "My page" )
126- //assertPanic(t, func() { selectNode(empty_example, `substring("12345", 5, -3)`) }) // Should be supports a negative value
127129 //assertPanic(t, func() { selectNode(empty_example, `substring("12345", 5, "")`) })
128130}
129131
0 commit comments