New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle BOM in the beginning of the script #439
Changes from 3 commits
f37d0e1
1d78233
1e8f7f9
efbebee
a024db0
c09af92
322568b
0d44b0b
60c0a0b
b70a9e7
be29b0a
d880d46
f9615ef
df6bc8f
67dcd3e
4ada12a
ac10575
edadb7a
51bb793
51693aa
0e964da
42c355a
1711d50
393f8d3
fb63503
0f67b2f
b3f77f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -352,6 +352,16 @@ TEST_CASE("Functor cast") | |
CHECK(d == 3 * 6); | ||
} | ||
|
||
TEST_CASE("BOM at beginning of string") | ||
{ | ||
chaiscript::ChaiScript_Basic chai(create_chaiscript_stdlib(),create_chaiscript_parser()); | ||
|
||
chai.add(chaiscript::fun(&functor_cast_test_call), "test_call"); | ||
|
||
chai.eval("def func() { return \"Hello World\"; };"); | ||
|
||
CHECK(chai.eval<std::string>("\xef\xbb\xbf(func())") == "Hello World"); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still needs a test case for other binary/non-ANSI garbage in the input at random positions (beginning, middle, end). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I left just one non-ASCII character and moved it to the middle of the string. |
||
|
||
|
||
int set_state_test_myfun() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this whole script should be inline (i.e. don't use
func()
), since you want to test the script running, not the function call working. Also you should probably remove line 359 as well.