Skip to content

MathListToString: What is a correct way to handle placeholder ? #94

@FoggyFinder

Description

@FoggyFinder

Since 82317faf commit 2 test for CSharpMath.Editor.Tests.MathKeyboardTests are broken:

TestName Inputs Expected Actual
AtomInput [Power, Power, Power] □^{□^{□^■}} \square ^{\square ^{\square ^■}}
SubscriptWorksAtBeginningOfLine [Subscript] □_■ \square _■

Handler for this case was counted separately:

var command = MathAtoms.LatexSymbolNameForAtom((MathAtom)atom);
if (command == null) {
  if (atom is Extension.I_ExtensionAtom ext)
    builder.Append(Extension._MathListDestructor.MathAtomToString(ext));
  else
    builder.Append(aNucleus);
} else {
  builder.Append(@"\" + command + " ");
}

Now command isn't null but square, so the check doesn't apply here.

I'm not sure what will be the best way to handle it:

  • Check special cases before requesting LatexSymbolNameForAtom?
  • Don't change the code but adjust tests ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution/ImplementedThe described enhancement or housekeeping work has been implemented.Type/HousekeepingThis includes internal only changes.Type/Question

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions