On Thu, Feb 19, 2015, at 06:32 AM, a...@mozilla.com wrote: > On Tuesday, February 17, 2015 at 6:33:42 PM UTC+1, Ted Mielczarek wrote: > > On Tue, Feb 17, 2015, at 10:27 AM, Axel Hecht wrote: > > > Hi, > > > > > > I'd like to write tests to validate my assumptions around what's an error > > > and what's a warning for localized values going into > > > nsTextFormatter::smprintf. > > > > > > Basically, the tests would start with a reference string, and then a more > > > or less random modification of that string, and a check if the segments > > > are in, or if it crashes [1]. > > > > > > So I'll need a .cpp core, and a wrapper that feeds it data and checks the > > > output. > > > > > > Any suggestions on how to do that "right"? > > > > When you say "crashes" do you mean an actual program crash? If so, > > shouldn't we just be fixing these in nsTextFormatter? If you don't need > > to monitor actual crashes then a Gtest should work just fine here. > > > > -Ted > > I'm talking actual crashes, and I don't know how we would fix the text > formatter. I'm glancing at > http://mxr.mozilla.org/mozilla-central/source/xpcom/glue/nsTextFormatter.cpp#778, > and I had no idea how to fix the C++ API there. > > bug 1133554#c2 is a bug where we got it wrong in en-US, too. Doesn't > crash, but produces undesirable results. > > Note, folks using the stringbundle.formatStringFromName just use a > wstring array. The only code paths affected are those that get the > string, and explicitly call into nsTextFormatter from c++.
Can you provide an example of a call that crashes? I still feel like the right outcome here is to make the code not crash. -Ted _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform