Artifact 28af7a55521364af679fed44963de17c7eb2ce0fce2f65f36a7323c37519246b:


# 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
     #
     # Won't work without hashes
     #>
    """
    print(_parse(ps1_style))
    assert _parse(ps1_style).version == "2.1"
    # requires adapting the continuation line detection (including spaced points)
    # and detecting multiline markers, and stripping them (end up in doc else)

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"