[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #60871] NSNumberFormatter does not behave as in Mac OS X

From: Larry Campbell
Subject: [bug #60871] NSNumberFormatter does not behave as in Mac OS X
Date: Thu, 1 Jul 2021 14:13:11 -0400 (EDT)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15


                 Summary: NSNumberFormatter does not behave as in Mac OS X
                 Project: GNUstep
            Submitted by: lcampbel
            Submitted on: Thu 01 Jul 2021 06:13:10 PM UTC
                Category: Base/Foundation
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any



The following snippet demonstrates an incompatibility with Mac OS X. On Mac OS
X the test succeeds; on gnustep-base (linux, libicu) the test fails, returning
".9" instead of "0.9".

    NSNumberFormatter *nf = [[NSNumberFormatter new] autorelease];
    NSString *expected = @"0.9";
    NSString *got;
    [nf setMaximumFractionDigits:3];
    got = [nf stringFromNumber:[NSNumber numberWithDouble:0.9]];
    NSAssert([expected isEqualToString:got], @"number formatter botch,
expected \"%@\", got \"%@\"", expected, got);

On linux:

2021-07-01 18:09:42.517 gnustep-base-tests[55286:55286]
gnustep-base-tests.m:593  Assertion failed in GnustepBaseTests(instance),
method numberFormatterTest.  number formatter botch, expected "0.9", got ".9"


Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]