Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: runtime/vm/snapshot_test.cc

Issue 254553003: Generate escape sequence for non-printable ascii characters (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/unit_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "include/dart_debugger_api.h" 7 #include "include/dart_debugger_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 TokenStream::Iterator reconstructed_iterator( 853 TokenStream::Iterator reconstructed_iterator(
854 reconstructed_tokens, 0, TokenStream::Iterator::kAllTokens); 854 reconstructed_tokens, 0, TokenStream::Iterator::kAllTokens);
855 Token::Kind expected_kind = expected_iterator.CurrentTokenKind(); 855 Token::Kind expected_kind = expected_iterator.CurrentTokenKind();
856 Token::Kind reconstructed_kind = reconstructed_iterator.CurrentTokenKind(); 856 Token::Kind reconstructed_kind = reconstructed_iterator.CurrentTokenKind();
857 String& expected_literal = String::Handle(); 857 String& expected_literal = String::Handle();
858 String& actual_literal = String::Handle(); 858 String& actual_literal = String::Handle();
859 while (expected_kind != Token::kEOS && reconstructed_kind != Token::kEOS) { 859 while (expected_kind != Token::kEOS && reconstructed_kind != Token::kEOS) {
860 EXPECT_EQ(expected_kind, reconstructed_kind); 860 EXPECT_EQ(expected_kind, reconstructed_kind);
861 expected_literal ^= expected_iterator.CurrentLiteral(); 861 expected_literal ^= expected_iterator.CurrentLiteral();
862 actual_literal ^= reconstructed_iterator.CurrentLiteral(); 862 actual_literal ^= reconstructed_iterator.CurrentLiteral();
863 EXPECT(expected_literal.Equals(actual_literal)); 863 EXPECT_STREQ(expected_literal.ToCString(), actual_literal.ToCString());
864 expected_iterator.Advance(); 864 expected_iterator.Advance();
865 reconstructed_iterator.Advance(); 865 reconstructed_iterator.Advance();
866 expected_kind = expected_iterator.CurrentTokenKind(); 866 expected_kind = expected_iterator.CurrentTokenKind();
867 reconstructed_kind = reconstructed_iterator.CurrentTokenKind(); 867 reconstructed_kind = reconstructed_iterator.CurrentTokenKind();
868 } 868 }
869 } 869 }
870 870
871 871
872 TEST_CASE(SerializeScript) { 872 TEST_CASE(SerializeScript) {
873 const char* kScriptChars = 873 const char* kScriptChars =
(...skipping 27 matching lines...) Expand all
901 "abc\n" 901 "abc\n"
902 "${def}\n" 902 "${def}\n"
903 "ghi''';\n" 903 "ghi''';\n"
904 " }\n" 904 " }\n"
905 " static ms5() {\n" 905 " static ms5() {\n"
906 " return '''\n" 906 " return '''\n"
907 "a b c\n" 907 "a b c\n"
908 "d ${d} e\n" 908 "d ${d} e\n"
909 "g h i''';\n" 909 "g h i''';\n"
910 " }\n" 910 " }\n"
911 " static ms6() {\n"
912 " return '\\t \\n \\x00 \\xFF';\n"
913 " }\n"
911 "}\n"; 914 "}\n";
912 915
913 String& url = String::Handle(String::New("dart-test:SerializeScript")); 916 String& url = String::Handle(String::New("dart-test:SerializeScript"));
914 String& source = String::Handle(String::New(kScriptChars)); 917 String& source = String::Handle(String::New(kScriptChars));
915 Script& script = Script::Handle(Script::New(url, 918 Script& script = Script::Handle(Script::New(url,
916 source, 919 source,
917 RawScript::kScriptTag)); 920 RawScript::kScriptTag));
918 const String& lib_url = String::Handle(Symbols::New("TestLib")); 921 const String& lib_url = String::Handle(Symbols::New("TestLib"));
919 Library& lib = Library::Handle(Library::New(lib_url)); 922 Library& lib = Library::Handle(Library::New(lib_url));
920 lib.Register(); 923 lib.Register();
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after
2712 EXPECT(Dart_ErrorHasException(result)); 2715 EXPECT(Dart_ErrorHasException(result));
2713 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", 2716 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n",
2714 Dart_GetError(result)); 2717 Dart_GetError(result));
2715 2718
2716 Dart_ExitScope(); 2719 Dart_ExitScope();
2717 } 2720 }
2718 2721
2719 #endif // !defined(TARGET_ARCH_ARM64) 2722 #endif // !defined(TARGET_ARCH_ARM64)
2720 2723
2721 } // namespace dart 2724 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/unit_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698