Skip to content

Commit

Permalink
Add test for simple pmatrix box (ForNeVeR#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed May 26, 2019
1 parent 77bc77b commit d48160d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/WpfMath.Tests/ApprovalTestUtils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ let private jsonSettings = JsonSerializerSettings(ContractResolver = InnerProper
let private serialize o =
JsonConvert.SerializeObject(o, jsonSettings)

let verifyObject : obj -> unit =
serialize >> Approvals.Verify

let verifyParseResult(formulaText : string) : unit =
let parser = TexFormulaParser()
let formula = parser.Parse formulaText
let result = serialize formula
Approvals.Verify result
verifyObject formula

let verifyParseResultScenario (scenario : string) (formulaText : string) : unit =
use block = NamerFactory.AsEnvironmentSpecificTest(fun () -> sprintf "(%s)" scenario)
Expand Down
8 changes: 8 additions & 0 deletions src/WpfMath.Tests/BoxTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ open Xunit
open WpfMath
open WpfMath.Atoms
open WpfMath.Boxes
open WpfMath.Tests.ApprovalTestUtils

let private parse text =
let parser = TexFormulaParser()
Expand Down Expand Up @@ -89,3 +90,10 @@ let ``Cyrillic followed by Latin should be rendered properly``() =
let atom = parse @"\text{Ц}V"
let box = atom.CreateBox environment
Assert.NotNull(box)

[<Fact>]
let simpleMatrixAtomBox() =
let source = @"\pmatrix{2 & 2 \\ 2 & 2}"
let atom = parse source
let box = atom.CreateBox environment
verifyObject box

0 comments on commit d48160d

Please sign in to comment.