public void NoArgumentTokens() { var formatString = "a~%bc~&~ade~sf"; Assert.True(LispFormatter.TryGetFormatTokens(formatString, out var tokens, out var errorMessage), $"Error from formatter: {errorMessage}"); Assert.Equal(8, tokens.Count); Assert.Equal("a", ((LispLiteralFormatToken)tokens[0]).GetTokenText(formatString)); Assert.Equal("~%", ((LispFormatTokenNewLine)tokens[1]).GetTokenText(formatString)); Assert.Equal("bc", ((LispLiteralFormatToken)tokens[2]).GetTokenText(formatString)); Assert.Equal("~&", ((LispFormatTokenLineStart)tokens[3]).GetTokenText(formatString)); Assert.Equal("~a", ((LispFormatTokenAExpression)tokens[4]).GetTokenText(formatString)); Assert.Equal("de", ((LispLiteralFormatToken)tokens[5]).GetTokenText(formatString)); Assert.Equal("~s", ((LispFormatTokenSExpression)tokens[6]).GetTokenText(formatString)); Assert.Equal("f", ((LispLiteralFormatToken)tokens[7]).GetTokenText(formatString)); }
private static void TestFormat(string expected, string formatString, params LispObject[] args) { Assert.True(LispFormatter.TryFormatString(formatString, args, out var result), $"Error from formatter: {result}"); Assert.Equal(expected, result); }