Repository: neovim/neovim
File: test/functional/editor/mode_insert_spec.lua (Lua)

Code before:
        {5:-- INSERT --}                                      |
      ]])
      feed("=function('add')")
      screen:expect([[
        {18:"}                                                 |
        {1:~                                                 }|*4
        ={25:function}{16:(}{26:'add'}{16:)}^                                  |
      ]])
      feed('<CR>')
      screen:expect([[
        {18:"}                                                 |
        {1:~                                                 }|
        {3:                                                  }|
        ={25:function}{16:(}{26:'add'}{16:)}                                  |
        {9:E729: Using a Funcref as a String}                 |
        {6:Press ENTER or type command to continue}^           |
      ]])
      feed('<CR>')
      screen:expect([[
        ^                                                  |
        {1:~                                                 }|*4
        {5:-- INSERT --}                                      |
      ]])
    end)

    it('inserts named registers literaly', function()
      local screen = Screen.new(50, 6)
      -- regular text without special charecter command
      command('let @a = "test"')
      feed('i<C-R>a<ESC>')
      screen:expect([[
        tes^t                                              |
        {1:~                                                 }|*4
                                                          |
      ]])

      -- text with backspace character gets written literaly by default
      command('let @a = "test\\<C-H>"')
      feed('cc<C-R>a<ESC>')
      screen:expect([[
        test{18:^^H}                                            |
        {1:~                                                 }|*4
                                                          |
      ]])

      -- =@reg<CR> can be used to get effect of keypress
      command('let @a = "test\\<C-H>"')
      feed('cc<C-R>=@a<CR><ESC>')
      screen:expect([[
        te^s                                               |
        {1:~                                                 }|*4

Review comment (suggestion):
```suggestion
    it('inserts named registers literally', function()
```

Code after:
        {5:-- INSERT --}                                      |
      ]])
      feed("=function('add')")
      screen:expect([[
        {18:"}                                                 |
        {1:~                                                 }|*4
        ={25:function}{16:(}{26:'add'}{16:)}^                                  |
      ]])
      feed('<CR>')
      screen:expect([[
        {18:"}                                                 |
        {1:~                                                 }|
        {3:                                                  }|
        ={25:function}{16:(}{26:'add'}{16:)}                                  |
        {9:E729: Using a Funcref as a String}                 |
        {6:Press ENTER or type command to continue}^           |
      ]])
      feed('<CR>')
      screen:expect([[
        ^                                                  |
        {1:~                                                 }|*4
        {5:-- INSERT --}                                      |
      ]])
    end)

    it('inserts named registers literally', function()
      local screen = Screen.new(50, 6)
      -- regular text without special charecter command
      command('let @a = "test"')
      feed('i<C-R>a<ESC>')
      screen:expect([[
        tes^t                                              |
        {1:~                                                 }|*4
                                                          |
      ]])

      -- text with backspace character gets written literally by default
      command('let @a = "test\\<C-H>"')
      feed('cc<C-R>a<ESC>')
      screen:expect([[
        test{18:^^H}                                            |
        {1:~                                                 }|*4
                                                          |
      ]])

      -- =@reg<CR> can be used to get effect of keypress
      command('let @a = "test\\<C-H>"')
      feed('cc<C-R>=@a<CR><ESC>')
      screen:expect([[
        te^s                                               |
        {1:~                                                 }|*4