diff --git a/jerry-core/ecma/base/ecma-helpers-char.cpp b/jerry-core/ecma/base/ecma-helpers-char.cpp index 1f0196efa..9cd7a5ca8 100644 --- a/jerry-core/ecma/base/ecma-helpers-char.cpp +++ b/jerry-core/ecma/base/ecma-helpers-char.cpp @@ -32,7 +32,7 @@ bool ecma_char_is_new_line (ecma_char_t c) /**< character value */ { - return (c == '\x0D'); + return (c == '\x0A'); } /* ecma_char_is_new_line */ /** @@ -44,7 +44,7 @@ ecma_char_is_new_line (ecma_char_t c) /**< character value */ bool ecma_char_is_carriage_return (ecma_char_t c) /**< character value */ { - return (c == '\x0A'); + return (c == '\x0D'); } /* ecma_char_is_carriage_return */ /** diff --git a/tests/jerry/new-line-in-literal.js b/tests/jerry/new-line-in-literal.js new file mode 100644 index 000000000..b11048178 --- /dev/null +++ b/tests/jerry/new-line-in-literal.js @@ -0,0 +1,17 @@ +// Copyright 2015 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +assert (eval ("'1\\\r\n2'") === '12'); + +assert (eval ("'1\\\n2'") === '12');