Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix test suite failures on Windows #586

Merged
merged 3 commits into from
Oct 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Running test suite will update test expectations to use LF line endings,
# so they need to be checked out using LF as well.
* text=auto eol=lf
2 changes: 1 addition & 1 deletion contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Thanks for wanting to contribute!

If you want help or mentorship, please file a Github issue and I'll be sure to provide guidance to the best of my ability.

Otherwise be sure to check out `ARCHITECTURE.md` for an overview on the internals.
Otherwise be sure to check out `internals.md` for an overview on the internals.

## Filing a pull request

Expand Down
2 changes: 1 addition & 1 deletion src/bindgen/ir/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl Literal {
syn::Lit::Byte(ref value) => Ok(Literal::Expr(format!("{}", value.value()))),
syn::Lit::Char(ref value) => Ok(Literal::Expr(match value.value() as u32 {
0..=255 => format!("'{}'", value.value().escape_default()),
other_code => format!(r"L'\U{:08X}'", other_code),
other_code => format!(r"U'\U{:08X}'", other_code),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To maintain maximum compatibility with existing code U'...' could be emitted only for really large literals or only on Windows though.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine. Next version needs to be a major bump anyways for #578 and this looks good.

})),
syn::Lit::Int(ref value) => {
if value.base10_parse::<i64>().is_err() {
Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/both/constant.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

#define DOUBLE_CAST (uint32_t)(float)1

#define EQUID L'\U00010083'
#define EQUID U'\U00010083'

#define FOO 10

#define HEART L'\U00002764'
#define HEART U'\U00002764'

#define LEFTCURLY '{'

Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/both/constant.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

#define DOUBLE_CAST (uint32_t)(float)1

#define EQUID L'\U00010083'
#define EQUID U'\U00010083'

#define FOO 10

#define HEART L'\U00002764'
#define HEART U'\U00002764'

#define LEFTCURLY '{'

Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/constant.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

#define DOUBLE_CAST (uint32_t)(float)1

#define EQUID L'\U00010083'
#define EQUID U'\U00010083'

#define FOO 10

#define HEART L'\U00002764'
#define HEART U'\U00002764'

#define LEFTCURLY '{'

Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/constant.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

#define DOUBLE_CAST (uint32_t)(float)1

#define EQUID L'\U00010083'
#define EQUID U'\U00010083'

#define FOO 10

#define HEART L'\U00002764'
#define HEART U'\U00002764'

#define LEFTCURLY '{'

Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/constant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ static const uint32_t DELIMITER = ':';

static const uint32_t DOUBLE_CAST = (uint32_t)(float)1;

static const uint32_t EQUID = L'\U00010083';
static const uint32_t EQUID = U'\U00010083';

static const int32_t FOO = 10;

static const uint32_t HEART = L'\U00002764';
static const uint32_t HEART = U'\U00002764';

static const uint32_t LEFTCURLY = '{';

Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/tag/constant.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

#define DOUBLE_CAST (uint32_t)(float)1

#define EQUID L'\U00010083'
#define EQUID U'\U00010083'

#define FOO 10

#define HEART L'\U00002764'
#define HEART U'\U00002764'

#define LEFTCURLY '{'

Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/tag/constant.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

#define DOUBLE_CAST (uint32_t)(float)1

#define EQUID L'\U00010083'
#define EQUID U'\U00010083'

#define FOO 10

#define HEART L'\U00002764'
#define HEART U'\U00002764'

#define LEFTCURLY '{'

Expand Down