Skip to content

forward length != reverse lengthΒ #14

@donhcd

Description

@donhcd

Extremely sorry if this is actually part of the spec, but this doesn't seem quite right. With this code:

#[test]
fn it_works() {
    use unicode_segmentation::UnicodeSegmentation;

    let s = "πŸšπŸš¦πŸ‘¨β€πŸ‘§β€πŸ‘¦πŸ‘©β€πŸ‘§β€πŸ‘¦";
    println!("forwards:");
    for cluster in s.graphemes(true) {
        println!("{}", cluster);
    }
    println!("backwards:");
    for cluster in s.graphemes(true).rev() {
        println!("{}", cluster);
    }
    assert_eq!(s.graphemes(true).count(), s.graphemes(true).rev().count());
}

both with 1.0.1 and master, I get

running 1 test
test it_works ... FAILED

failures:

---- it_works stdout ----
        forwards:
🚁
🚦
πŸ‘¨β€πŸ‘§β€πŸ‘¦
πŸ‘©β€πŸ‘§β€πŸ‘¦
backwards:
β€πŸ‘¦
β€πŸ‘§
πŸ‘©
β€πŸ‘¦
β€πŸ‘§
πŸ‘¨
🚦
🚁
thread 'it_works' panicked at 'assertion failed: `(left == right)` (left: `4`, right: `8`)', src/lib.rs:16
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy