Add array parser error tests
Agent-Logs-Url: https://github.com/wesleyel/swiftui-math/sessions/56436444-e15b-4dd0-8a70-c87df1e3dc4e Co-authored-by: wesleyel <48174882+wesleyel@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
f82f9e9cea
commit
1091e9c83d
@@ -1089,6 +1089,28 @@ struct ParserTests {
|
||||
#expect(latex.contains("\\right."))
|
||||
}
|
||||
|
||||
@Test
|
||||
func arrayRejectsInvalidColumnFormat() throws {
|
||||
let str = "\\begin{array}{xyz}a\\end{array}"
|
||||
var error: Math.ParserError? = nil
|
||||
|
||||
let list = Math.Parser.build(fromString: str, error: &error)
|
||||
|
||||
#expect(list == nil)
|
||||
#expect(error?.code == .invalidEnvironment)
|
||||
}
|
||||
|
||||
@Test
|
||||
func arrayRejectsTooFewColumnSpecifiers() throws {
|
||||
let str = "\\begin{array}{l}a&b\\end{array}"
|
||||
var error: Math.ParserError? = nil
|
||||
|
||||
let list = Math.Parser.build(fromString: str, error: &error)
|
||||
|
||||
#expect(list == nil)
|
||||
#expect(error?.code == .invalidNumberOfColumns)
|
||||
}
|
||||
|
||||
@Test
|
||||
func defaultTable() throws {
|
||||
let str = "x \\\\ y"
|
||||
|
||||
Reference in New Issue
Block a user