• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zbraniecki / icu4x / 11904027177

19 Nov 2024 12:33AM UTC coverage: 75.477% (+0.3%) from 75.174%
11904027177

push

github

web-flow
Move DateTimePattern into pattern module (#5834)

#1317

Also removes `NeoNeverMarker` and fixes #5689

258 of 319 new or added lines in 6 files covered. (80.88%)

6967 existing lines in 278 files now uncovered.

54522 of 72237 relevant lines covered (75.48%)

655305.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.59
/utils/tinystr/src/databake.rs
1
// This file is part of ICU4X. For terms of use, please see the file
2
// called LICENSE at the top level of the ICU4X source tree
3
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4

5
use crate::TinyAsciiStr;
6
use crate::UnvalidatedTinyAsciiStr;
7
use databake::*;
8

9
impl<const N: usize> Bake for TinyAsciiStr<N> {
10
    fn bake(&self, env: &CrateEnv) -> TokenStream {
2✔
11
        env.insert("tinystr");
2✔
12
        let string = self.as_str();
2✔
13
        quote! {
2✔
14
            tinystr::tinystr!(#N, #string)
15
        }
16
    }
2✔
17
}
18

19
impl<const N: usize> BakeSize for TinyAsciiStr<N> {
UNCOV
20
    fn borrows_size(&self) -> usize {
×
21
        0
UNCOV
22
    }
×
23
}
24

25
impl<const N: usize> databake::Bake for UnvalidatedTinyAsciiStr<N> {
26
    fn bake(&self, env: &databake::CrateEnv) -> databake::TokenStream {
2✔
27
        match self.try_into_tinystr() {
2✔
28
            Ok(tiny) => {
1✔
29
                let tiny = tiny.bake(env);
1✔
30
                databake::quote! {
1✔
31
                    #tiny.to_unvalidated()
32
                }
33
            }
1✔
34
            Err(_) => {
35
                let bytes = self.0.bake(env);
1✔
36
                env.insert("tinystr");
1✔
37
                databake::quote! {
1✔
38
                    tinystr::UnvalidatedTinyAsciiStr::from_utf8_unchecked(#bytes)
39
                }
40
            }
1✔
41
        }
42
    }
2✔
43
}
44

45
impl<const N: usize> databake::BakeSize for UnvalidatedTinyAsciiStr<N> {
46
    fn borrows_size(&self) -> usize {
47
        0
48
    }
49
}
50

51
#[test]
52
fn test() {
2✔
53
    test_bake!(
3✔
54
        TinyAsciiStr<10>,
55
        const,
56
        crate::tinystr!(10usize, "foo"),
57
        tinystr
58
    );
59
}
2✔
60

61
#[test]
62
fn test_unvalidated() {
2✔
63
    test_bake!(
3✔
64
        UnvalidatedTinyAsciiStr<10>,
65
        const,
66
        crate::tinystr!(10usize, "foo").to_unvalidated(),
1✔
67
        tinystr
68
    );
69
    test_bake!(
3✔
70
        UnvalidatedTinyAsciiStr<3>,
71
        const,
72
        crate::UnvalidatedTinyAsciiStr::from_utf8_unchecked(*b"AB\xCD"),
1✔
73
        tinystr
74
    );
75
}
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc