File test/config_altsyntax.py from the latest check-in


# type: test
# title: alternative syntaxes
# description: other comment types
# version: 0.7.8
# 
# Kinda have to do snippets here.

import pytest
import re
import textwrap
import pluginconf

def _parse(text):
    text = re.sub(r"\A\n", "", text)
    text = textwrap.dedent(text)
    return pluginconf.plugin_meta(src=text)


def multiline_c():
    c_style= """
    /**
     * api: c
     * title: example
     * version: 3.5.1
     * category: multiline
     *
     * Do we get a comment?
     */
    """
    assert _parse(c_style).version == "3.5.1"
    assert _parse(c_style).doc == "Do we get a comment?"

def multiline_ps1():
    ps1_style= """
    <#
     # api: cpp
     # title: second
     # version: 2.1
     # category: nonpython
     #
     # Didn't work without hashes
     #>
    """
    print(_parse(ps1_style))
    assert _parse(ps1_style).version == "2.1"
    # Required adapting the continuation line detection (including spaced points).
    # Multiline enclosures contents are now captured, thus trailign #> or */ stripped.
    ps1_style= """
    <#
       api: cpp
       title: second
       version: 2.2
       category: nonpython
       config: {name:x}
       {name:y}
       priority: bad
     
       Didn't work without hashes
     #>
    """
    # Notably will only work with up to 3 spaces. Acceptable format constraint,
    # but makes continuation less readable
    print(_parse(ps1_style))
    assert _parse(ps1_style).version == "2.2"
    assert len(_parse(ps1_style).config) == 2
    assert _parse(ps1_style).priority == "bad"
    # should still migrate to hash() detection and regex generation

def indent_cpp():
    cpp_style= """
    // api: cpp
    // title: third
    // version: 3.3
    // category: doubleprefix
    //
    // Basically just // instead of #
    """
    assert _parse(cpp_style).version == "3.3"