8000 Support for redir in vroom tests · Issue #86 · google/vroom · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Aug 15, 2026. It is now read-only.
This repository was archived by the owner on Aug 15, 2026. It is now read-only.

Support for redir in vroom tests #86

Open

Description

@paulhybryant

Trying to test a syntax plugin.

Here is the vroom test:

Vroom test for foldcol

Test environment setup.
  @system (RELAXED)
  > :set nocompatible<CR>
  > :set rtp+=$HOME/.vim/bundle/foldcol<CR>
  > :runtime! plugin/foldcol.vim<CR>
  > :set rtp+=$HOME/.vim/bundle/Align<CR>
  > :runtime! plugin/cecutil.vim<CR>
  > :runtime! plugin/AlignPlugin.vim<CR>
  > :runtime! plugin/AlignMapsPlugin.vim<CR>
  > :let b:folds = {}<CR>


  Test plugin loaded
  > :echomsg g:loaded_foldcol<CR>
  ~ v3g


  Try to fold column with default delimeter
  % 111111,222,33333<CR>
  % 1,222,333333333333333<CR>
  % 1111111111111,2,333
  > :FoldCol 2<CR>
  111111        , 222 , 33333
  1             , 222 , 333333333333333
  1111111111111 , 2   , 333
  > :redir => b:synfold<CR>
  > :silent! syn list FoldCol2<CR>
  > :redir END<CR>
  > :echomsg "syn:".b:synfold<CR>
  ~ 1

The first two tests work fine. The last assert in the last test is expected to fail ("~ 1") but it actually passes.

Activity

  1. dbarnett commented on Mar 12, 2015

    @dbarnett
    Contributor

    Could you define a test helper function in the plugin that uses :redir instead of trying to use it directly from vroom?

  2. paulhybryant commented on Mar 12, 2015

    @paulhybryant
    Author

    Sure. That would work too.

  3. dbarnett commented on Mar 12, 2015

    @dbarnett
    Contributor

    We may still try to support :redir in some capacity, but FWIW it seems a little awkward in a vroom file anyway.

  4. paulhybryant commented on Mar 12, 2015

    @paulhybryant
    Author

    Sure. One question though. With a helper function, I get the following error

    Unexpected message:
    FoldCol2 xxx match /%16c...../ conceal

    Expected message not received:
    "FoldCol2 xxx match /%16c...../ conceal" (verbatim mode)

    The two message seems the same to me

    Revised test below
    Vroom test for foldcol

    Test environment setup.
      @system (RELAXED)
      > :set nocompatible<CR>
      > :set rtp+=$HOME/.vim/bundle/foldcol<CR>
      > :runtime! plugin/foldcol.vim<CR>
      > :set rtp+=$HOME/.vim/bundle/Align<CR>
      > :runtime! plugin/cecutil.vim<CR>
      > :runtime! plugin/AlignPlugin.vim<CR>
      > :runtime! plugin/AlignMapsPlugin.vim<CR>
      > :let b:folds = {}<CR>
    
    
      Test plugin loaded
      > :echomsg g:loaded_foldcol<CR>
      ~ v3g
    
    
      Try to fold column with default delimeter
      % 111111,222,33333<CR>
      % 1,222,333333333333333<CR>
      % 1111111111111,2,333
      > :FoldCol 2<CR>
      111111        , 222 , 33333
      1             , 222 , 333333333333333
      1111111111111 , 2   , 333
      > :let b:syngroup = foldcol#GetSynGroup("FoldCol2")<CR>
      > :echomsg b:syngroup<CR>
      ~ FoldCol2       xxx match /\%16c...../  conceal
    
  5. dbarnett commented on Mar 12, 2015

    @dbarnett
    Contributor

    Yeah, looks the same to me. Any chance there's a tab character involved? You could also try weird things like slicing the string to see if it matches up to a certain point, or try temporarily hacking your test to base64 encode it or something to verify the actual bytes.

  6. paulhybryant commented on Mar 13, 2015

    @paulhybryant
    Author

    Thanks. Turns out there is a trailing space.

  7. dbarnett commented on Mar 13, 2015

    @dbarnett
    Contributor

    Another caveat: I checked your command and the output seems to vary according to window size even though it's not actually being printed to the screen (i.e., if the vim window is really narrow, there are more line wraps). It's unlikely in practice and probably best to just accept it will fail if your window is too narrow, but thought I'd mention it.

  8. paulhybryant commented on Mar 13, 2015

    @paulhybryant
    Author

    Sounds good. Thanks for bringing that up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0