Skip to content

Commit 74a9616

Browse files
committed
update tests
1 parent c6dcf38 commit 74a9616

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lazy-static-include"
3-
version = "3.0.0"
3+
version = "3.0.1"
44
authors = ["Magic Len <len@magiclen.org>"]
55
edition = "2018"
66
repository = "https://github.com/magiclen/lazy-static-include"

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ lazy_static_include_str! {
3030
}
3131

3232
assert_eq!("This is just a test text.", TEST);
33-
assert_eq!(TEST2, "Some text...");
33+
assert_eq!("Some text...", TEST2);
3434
```
3535

3636
```rust
@@ -43,8 +43,8 @@ lazy_static_include_bytes! {
4343
pub TEST2 => "data/test-2.txt",
4444
}
4545

46-
assert_eq!(b"This is just a test text.".as_ref(), TEST);
47-
assert_eq!(TEST2, b"Some text...".as_ref());
46+
assert_eq!("This is just a test text.".as_bytes(), TEST);
47+
assert_eq!("Some text...".as_bytes(), TEST2);
4848
```
4949

5050
You should notice that the value created from `lazy_static_include_bytes` and `lazy_static_include_str` macros isn't equal to `&'static [u8]` or `&'static str` when you are not using the **release** profile. If you want to get an exact `&'static [u8]` or `&'static str` reference, you can **dereference** the value or just use the `as_ref` method.

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ lazy_static_include_str! {
2828
}
2929
3030
assert_eq!("This is just a test text.", TEST);
31-
assert_eq!(TEST2, "Some text...");
31+
assert_eq!("Some text...", TEST2);
3232
```
3333
3434
```rust
@@ -41,8 +41,8 @@ lazy_static_include_bytes! {
4141
pub TEST2 => "data/test-2.txt",
4242
}
4343
44-
assert_eq!(b"This is just a test text.".as_ref(), TEST);
45-
assert_eq!(TEST2, b"Some text...".as_ref());
44+
assert_eq!("This is just a test text.".as_bytes(), TEST);
45+
assert_eq!("Some text...".as_bytes(), TEST2);
4646
```
4747
4848
You should notice that the value created from `lazy_static_include_bytes` and `lazy_static_include_str` macros isn't equal to `&'static [u8]` or `&'static str` when you are not using the **release** profile. If you want to get an exact `&'static [u8]` or `&'static str` reference, you can **dereference** the value or just use the `as_ref` method.

tests/macros.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn include_str() {
2020
let _data: &'static str = TEST.as_ref();
2121

2222
assert_eq!("This is just a test text.", TEST);
23-
assert_eq!(TEST2, "Some text...");
23+
assert_eq!("Some text...", TEST2);
2424
}
2525

2626
#[test]
@@ -38,8 +38,8 @@ fn include_bytes() {
3838

3939
let _data: &'static [u8] = TEST.as_ref();
4040

41-
assert_eq!(b"This is just a test text.".as_ref(), TEST);
42-
assert_eq!(TEST2, b"Some text...".as_ref());
41+
assert_eq!("This is just a test text.".as_bytes(), TEST);
42+
assert_eq!("Some text...".as_bytes(), TEST2);
4343
}
4444

4545
#[test]

0 commit comments

Comments
 (0)