Rename CSnake project to CSnake.SourceGeneration and unify nupkgs #211
GitHub Actions / .NET Test report macos-latest-3.12
succeeded
Sep 19, 2024 in 0s
165 passed, 0 failed and 0 skipped
✔️ src/test-results/test-results-macos-latest-3.12.trx
165 tests were completed in 5s with 165 passed, 0 failed and 0 skipped.
Test suite | Passed | Failed | Skipped | Time |
---|---|---|---|---|
CSnakes.Tests.CaseHelperTests | 10✔️ | 6ms | ||
CSnakes.Tests.GeneratedSignatureTests | 25✔️ | 2s | ||
CSnakes.Tests.TokenizerTests | 81✔️ | 82ms | ||
CSnakes.Tests.TypeReflectionTests | 49✔️ | 122ms |
✔️ CSnakes.Tests.CaseHelperTests
✔️ VerifyToLowerPascalCase(input: "_Hello_World", expected: "_hello__world")
✔️ VerifyToLowerPascalCase(input: "hello_", expected: "hello_")
✔️ VerifyToLowerPascalCase(input: "hello_World", expected: "hello__world")
✔️ VerifyToLowerPascalCase(input: "hello", expected: "hello")
✔️ VerifyToLowerPascalCase(input: "helloWorld", expected: "hello_world")
✔️ VerifyToPascalCase(input: "_Hello_World", expected: "_hello__world")
✔️ VerifyToPascalCase(input: "Hello_", expected: "hello_")
✔️ VerifyToPascalCase(input: "Hello_World", expected: "hello__world")
✔️ VerifyToPascalCase(input: "Hello", expected: "hello")
✔️ VerifyToPascalCase(input: "HelloWorld", expected: "hello_world")
✔️ CSnakes.Tests.GeneratedSignatureTests
✔️ TestGeneratedSignature(code: "def hello_world() -> None:\n ...\n", expected: "void HelloWorld()")
✔️ TestGeneratedSignature(code: "def hello_world():\n ...\n", expected: "PyObject HelloWorld()")
✔️ TestGeneratedSignature(code: "def hello_world(a: bool = True, b: str = None) -> "···, expected: "bool HelloWorld(bool a = true, string? b = null)")
✔️ TestGeneratedSignature(code: "def hello_world(a: bool, b: str, c: list[tuple[int"···, expected: "bool HelloWorld(bool a, string b, IReadOnlyList<(l"···)
✔️ TestGeneratedSignature(code: "def hello_world(a: bytes, b: bool = False, c: floa"···, expected: "void HelloWorld(byte[] a, bool b = false, double c"···)
✔️ TestGeneratedSignature(code: "def hello_world(a: str = 'default') -> None: \n .."···, expected: "void HelloWorld(string a = \"default\")")
✔️ TestGeneratedSignature(code: "def hello_world(a: str, *, b: int = 3) -> None: \n"···, expected: "void HelloWorld(string a, long b = 3, PyObject[]? "···)
✔️ TestGeneratedSignature(code: "def hello_world(a: str, *, b: int) -> None: \n ..."···, expected: "void HelloWorld(string a, long b, PyObject[]? args"···)
✔️ TestGeneratedSignature(code: "def hello_world(a: str, *args, **kwargs) -> None: "···, expected: "void HelloWorld(string a, PyObject[]? args = null,"···)
✔️ TestGeneratedSignature(code: "def hello_world(a: str, *args) -> None: \n ...\n", expected: "void HelloWorld(string a, PyObject[]? args = null)")
✔️ TestGeneratedSignature(code: "def hello_world(name: str, age: int) -> str:\n "···, expected: "string HelloWorld(string name, long age)")
✔️ TestGeneratedSignature(code: "def hello_world(name: str) -> float:\n ...\n", expected: "double HelloWorld(string name)")
✔️ TestGeneratedSignature(code: "def hello_world(name: str) -> int:\n ...\n", expected: "long HelloWorld(string name)")
✔️ TestGeneratedSignature(code: "def hello_world(name: str) -> str:\n ...\n", expected: "string HelloWorld(string name)")
✔️ TestGeneratedSignature(code: "def hello_world(name): \n ...\n", expected: "PyObject HelloWorld(PyObject name)")
✔️ TestGeneratedSignature(code: "def hello_world(new): \n ...\n", expected: "PyObject HelloWorld(PyObject @new)")
✔️ TestGeneratedSignature(code: "def hello_world(numbers: list[float]) -> list[int]"···, expected: "IReadOnlyList<long> HelloWorld(IReadOnlyList<doubl"···)
✔️ TestGeneratedSignature(code: "def hello_world(numbers: List[float]) -> List[int]"···, expected: "IReadOnlyList<long> HelloWorld(IReadOnlyList<doubl"···)
✔️ TestGeneratedSignature(code: "def hello_world(value: tuple[int]) -> None:\n ."···, expected: "void HelloWorld(ValueTuple<long> value)")
✔️ TestGeneratedSignature(code: "def hello() -> Buffer:\n ...\n", expected: "IPyBuffer Hello()")
✔️ TestGeneratedSignature(code: "def hello(a: int = 0b10101010) -> None:\n ...\n", expected: "void Hello(long a = 0b10101010)")
✔️ TestGeneratedSignature(code: "def hello(a: int = 0xdeadbeef) -> None:\n ...\n", expected: "void Hello(long a = 0xDEADBEEF)")
✔️ TestGeneratedSignature(code: "def hello(a: int = 2147483648) -> None:\n ...\n", expected: "void Hello(long a = 2147483648L)")
✔️ TestGeneratedSignature(code: "def hello(a: Optional[int] = None) -> None:\n ...\"···, expected: "void Hello(long? a = null)")
✔️ TestGeneratedSignature(code: "def hello(a: typing.List[int], b: typing.Dict[str,"···, expected: "public (string, long) Hello(IReadOnlyList<long> a,"···)
✔️ CSnakes.Tests.TokenizerTests
✔️ AssertTokenKinds(code: "-1", expectedToken: Integer)
✔️ AssertTokenKinds(code: "-1123.323", expectedToken: Decimal)
✔️ AssertTokenKinds(code: "-1231", expectedToken: Integer)
✔️ AssertTokenKinds(code: "'hello'", expectedToken: SingleQuotedString)
✔️ AssertTokenKinds(code: "\"hello\"", expectedToken: DoubleQuotedString)
✔️ AssertTokenKinds(code: "1.0", expectedToken: Decimal)
✔️ AssertTokenKinds(code: "1", expectedToken: Integer)
✔️ AssertTokenKinds(code: "10123", expectedToken: Integer)
✔️ AssertTokenKinds(code: "abc123", expectedToken: Identifier)
✔️ AssertTokenKinds(code: "False", expectedToken: False)
✔️ AssertTokenKinds(code: "None", expectedToken: None)
✔️ AssertTokenKinds(code: "True", expectedToken: True)
✔️ ErrorInParamDefaultValueReturnsCorrectLineAndColumn
✔️ ErrorInParamSignatureReturnsCorrectLineAndColumn
✔️ ParseFullCode
✔️ ParseFunctionDefinition
✔️ ParseFunctionDefinitionComplex(code: "def calculate_kmeans_interia(data: list[tuple[int,"···)
✔️ ParseFunctionDefinitionComplex(code: "def foo(a: int, b: str = 'b', c: float = 1.0) -> f"···)
✔️ ParseFunctionDefinitionComplex(code: "def foo(a: int, b: str = 'b') -> str:")
✔️ ParseFunctionDefinitionComplex(code: "def foo(a: int, b: str) -> None:")
✔️ ParseFunctionDefinitionComplex(code: "def foo(a: int, c: list[int]) -> None:")
✔️ ParseFunctionDefinitionComplex(code: "def foo(data: list[int], clusters: int) -> float:")
✔️ ParseFunctionDefinitionComplex(code: "def format_name(name: str, max_length: int = 50) -"···)
✔️ ParseFunctionDefinitionComplex(code: "def invoke_mistral_inference(messages: list[str], "···)
✔️ ParseFunctionNoBlankLineAtEnd
✔️ ParseFunctionParameter(code: "a: int", expectedName: "a", expectedType: "int")
✔️ ParseFunctionParameter(code: "abc123_xyz: int", expectedName: "abc123_xyz", expectedType: "int")
✔️ ParseFunctionParameter(code: "b: str", expectedName: "b", expectedType: "str")
✔️ ParseFunctionParameter(code: "c: float", expectedName: "c", expectedType: "float")
✔️ ParseFunctionParameter(code: "d: bool", expectedName: "d", expectedType: "bool")
✔️ ParseFunctionParameter(code: "e: list[int]", expectedName: "e", expectedType: "list[int]")
✔️ ParseFunctionParameter(code: "f: tuple[str, str]", expectedName: "f", expectedType: "tuple[str, str]")
✔️ ParseFunctionParameter(code: "g: dict[str, int]", expectedName: "g", expectedType: "dict[str, int]")
✔️ ParseFunctionParameter(code: "max_length: int = 50", expectedName: "max_length", expectedType: "int")
✔️ ParseFunctionParameter(code: "max_length: int", expectedName: "max_length", expectedType: "int")
✔️ ParseFunctionParameter(code: "nest: list[tuple[int, int]]", expectedName: "nest", expectedType: "list[tuple[int, int]]")
✔️ ParseFunctionParameterDefault
✔️ ParseFunctionParameterDefaultBoolFalse
✔️ ParseFunctionParameterDefaultBoolTrue
✔️ ParseFunctionParameterDefaultDouble
✔️ ParseFunctionParameterDefaultDoubleQuotedString
✔️ ParseFunctionParameterDefaultInt
✔️ ParseFunctionParameterDefaultNone
✔️ ParseFunctionParameterDefaultSingleQuotedString
✔️ ParseFunctionParameterDefaultValuesNoType(value: "-1.01")
✔️ ParseFunctionParameterDefaultValuesNoType(value: "-1")
✔️ ParseFunctionParameterDefaultValuesNoType(value: "1.01")
✔️ ParseFunctionParameterDefaultValuesNoType(value: "123")
✔️ ParseFunctionParameterListDoubleGeneric
✔️ ParseFunctionParameterListEasy
✔️ ParseFunctionParameterListQualifiedBasicType
✔️ ParseFunctionParameterListQualifiedGenericType
✔️ ParseFunctionParameterListSingleGeneric
✔️ ParseFunctionParameterListUntyped
✔️ ParseFunctionParameterNoType
✔️ ParseFunctionTrailingSpaceAfterColon
✔️ ParseFunctionWithTrailingComment
✔️ ParseMultiLineFunctionDefinition
✔️ TestDoubleTokenization(code: "-1_000.0", expectedValue: -1000)
✔️ TestDoubleTokenization(code: "-1.0", expectedValue: -1)
✔️ TestDoubleTokenization(code: "1_000_000.4e5", expectedValue: 100000040000)
✔️ TestDoubleTokenization(code: "1.0", expectedValue: 1)
✔️ TestDoubleTokenization(code: "1e1_0", expectedValue: 10000000000)
✔️ TestDoubleTokenization(code: "3.14159", expectedValue: 3.1415899999999999)
✔️ TestDoubleTokenization(code: "3.14e159", expectedValue: 3.1399999999999999E+159)
✔️ TestDoubleTokenization(code: "314159.", expectedValue: 314159)
✔️ TestDoubleTokenization(code: "3e-1230", expectedValue: 0)
✔️ TestDoubleTokenization(code: "3E123", expectedValue: 3.0000000000000001E+123)
✔️ TestIntegerTokenization(code: "-1234567", expectedValue: -1234567)
✔️ TestIntegerTokenization(code: "0_0", expectedValue: 0)
✔️ TestIntegerTokenization(code: "0b10", expectedValue: 2)
✔️ TestIntegerTokenization(code: "0b1010_1101", expectedValue: 173)
✔️ TestIntegerTokenization(code: "0b10101101", expectedValue: 173)
✔️ TestIntegerTokenization(code: "0xdead_beef", expectedValue: 3735928559)
✔️ TestIntegerTokenization(code: "0xdeadbeef", expectedValue: 3735928559)
✔️ TestIntegerTokenization(code: "1_000_000", expectedValue: 1000000)
✔️ TestIntegerTokenization(code: "1234567", expectedValue: 1234567)
✔️ TestIntegerTokenization(code: "255", expectedValue: 255)
✔️ TestIntegerTokenization(code: "4_2", expectedValue: 42)
✔️ Tokenize
✔️ TokenizeWithDefaultValue
✔️ CSnakes.Tests.TypeReflectionTests
✔️ AsPredefinedType(pythonType: "bool", expectedType: "bool")
✔️ AsPredefinedType(pythonType: "dict[str, int]", expectedType: "IReadOnlyDictionary<string,long>")
✔️ AsPredefinedType(pythonType: "float", expectedType: "double")
✔️ AsPredefinedType(pythonType: "int", expectedType: "long")
✔️ AsPredefinedType(pythonType: "list[bool]", expectedType: "IReadOnlyList<bool>")
✔️ AsPredefinedType(pythonType: "list[float]", expectedType: "IReadOnlyList<double>")
✔️ AsPredefinedType(pythonType: "list[int]", expectedType: "IReadOnlyList<long>")
✔️ AsPredefinedType(pythonType: "list[object]", expectedType: "IReadOnlyList<PyObject>")
✔️ AsPredefinedType(pythonType: "list[str]", expectedType: "IReadOnlyList<string>")
✔️ AsPredefinedType(pythonType: "str", expectedType: "string")
✔️ AsPredefinedType(pythonType: "tuple[bool, bool]", expectedType: "(bool,bool)")
✔️ AsPredefinedType(pythonType: "tuple[float, float]", expectedType: "(double,double)")
✔️ AsPredefinedType(pythonType: "tuple[int, int, tuple[int, int]]", expectedType: "(long,long,(long,long))")
✔️ AsPredefinedType(pythonType: "tuple[int, int]", expectedType: "(long,long)")
✔️ AsPredefinedType(pythonType: "tuple[str, Any]", expectedType: "(string,PyObject)")
✔️ AsPredefinedType(pythonType: "tuple[str, list[int]]", expectedType: "(string,IReadOnlyList<long>)")
✔️ AsPredefinedType(pythonType: "tuple[str, str]", expectedType: "(string,string)")
✔️ AsPredefinedTypeOldTypeNames(pythonType: "Callable[[str], int]", expectedType: "PyObject")
✔️ AsPredefinedTypeOldTypeNames(pythonType: "Dict[str, int]", expectedType: "IReadOnlyDictionary<string,long>")
✔️ AsPredefinedTypeOldTypeNames(pythonType: "List[bool]", expectedType: "IReadOnlyList<bool>")
✔️ AsPredefinedTypeOldTypeNames(pythonType: "List[float]", expectedType: "IReadOnlyList<double>")
✔️ AsPredefinedTypeOldTypeNames(pythonType: "List[int]", expectedType: "IReadOnlyList<long>")
✔️ AsPredefinedTypeOldTypeNames(pythonType: "List[object]", expectedType: "IReadOnlyList<PyObject>")
✔️ AsPredefinedTypeOldTypeNames(pythonType: "List[str]", expectedType: "IReadOnlyList<string>")
✔️ AsPredefinedTypeOldTypeNames(pythonType: "Optional[int]", expectedType: "long")
✔️ AsPredefinedTypeOldTypeNames(pythonType: "Optional[str]", expectedType: "string")
✔️ AsPredefinedTypeOldTypeNames(pythonType: "Tuple[bool, bool]", expectedType: "(bool,bool)")
✔️ AsPredefinedTypeOldTypeNames(pythonType: "Tuple[float, float]", expectedType: "(double,double)")
✔️ AsPredefinedTypeOldTypeNames(pythonType: "Tuple[int, int, Tuple[int, int]]", expectedType: "(long,long,(long,long))")
✔️ AsPredefinedTypeOldTypeNames(pythonType: "Tuple[int, int]", expectedType: "(long,long)")
✔️ AsPredefinedTypeOldTypeNames(pythonType: "Tuple[str, Any]", expectedType: "(string,PyObject)")
✔️ AsPredefinedTypeOldTypeNames(pythonType: "Tuple[str, list[int]]", expectedType: "(string,IReadOnlyList<long>)")
✔️ AsPredefinedTypeOldTypeNames(pythonType: "Tuple[str, str]", expectedType: "(string,string)")
✔️ TupleParsingTest(pythonType: "tuple[str, str, str, str, str, str, str, str, str,"···, expectedType: "(string,string,string,string,string,string,string,"···)
✔️ TupleParsingTest(pythonType: "tuple[str, str, str, str, str, str, str, str, str,"···, expectedType: "(string,string,string,string,string,string,string,"···)
✔️ TupleParsingTest(pythonType: "tuple[str, str, str, str, str, str, str, str, str,"···, expectedType: "(string,string,string,string,string,string,string,"···)
✔️ TupleParsingTest(pythonType: "tuple[str, str, str, str, str, str, str, str, str,"···, expectedType: "(string,string,string,string,string,string,string,"···)
✔️ TupleParsingTest(pythonType: "tuple[str, str, str, str, str, str, str, str, str,"···, expectedType: "(string,string,string,string,string,string,string,"···)
✔️ TupleParsingTest(pythonType: "tuple[str, str, str, str, str, str, str, str, str,"···, expectedType: "(string,string,string,string,string,string,string,"···)
✔️ TupleParsingTest(pythonType: "tuple[str, str, str, str, str, str, str, str, str,"···, expectedType: "(string,string,string,string,string,string,string,"···)
✔️ TupleParsingTest(pythonType: "tuple[str, str, str, str, str, str, str, str, str]", expectedType: "(string,string,string,string,string,string,string,"···)
✔️ TupleParsingTest(pythonType: "tuple[str, str, str, str, str, str, str, str]", expectedType: "(string,string,string,string,string,string,string,"···)
✔️ TupleParsingTest(pythonType: "tuple[str, str, str, str, str, str, str]", expectedType: "(string,string,string,string,string,string,string)")
✔️ TupleParsingTest(pythonType: "tuple[str, str, str, str, str, str]", expectedType: "(string,string,string,string,string,string)")
✔️ TupleParsingTest(pythonType: "tuple[str, str, str, str, str]", expectedType: "(string,string,string,string,string)")
✔️ TupleParsingTest(pythonType: "tuple[str, str, str, str]", expectedType: "(string,string,string,string)")
✔️ TupleParsingTest(pythonType: "tuple[str, str, str]", expectedType: "(string,string,string)")
✔️ TupleParsingTest(pythonType: "tuple[str, str]", expectedType: "(string,string)")
✔️ TupleParsingTest(pythonType: "tuple[str]", expectedType: "ValueTuple<string>")
Loading