Skip to content

Commit da5c4b0

Browse files
committed
Add parser test containing tricky multi-byte
1 parent 160c67a commit da5c4b0

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/language/__tests__/parser.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,29 @@ fragment MissingOn Type
125125
).to.throw('Syntax Error GraphQL (1:39) Unexpected Name "null"');
126126
});
127127

128+
it('parses multi-byte characters', async () => {
129+
// Note: \u0A0A could be naively interpretted as two line-feed chars.
130+
expect(
131+
parse(`
132+
# This comment has a \u0A0A multi-byte character.
133+
{ field(arg: "Has a \u0A0A multi-byte character.") }
134+
`)
135+
).to.containSubset({
136+
definitions: [{
137+
selectionSet: {
138+
selections: [{
139+
arguments: [{
140+
value: {
141+
kind: Kind.STRING,
142+
value: 'Has a \u0A0A multi-byte character.'
143+
}
144+
}]
145+
}]
146+
}
147+
}]
148+
});
149+
});
150+
128151
var kitchenSink = readFileSync(
129152
join(__dirname, '/kitchen-sink.graphql'),
130153
{ encoding: 'utf8' }

0 commit comments

Comments
 (0)