| OLD | NEW |
| 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 "include/dart_debugger_api.h" | 5 #include "include/dart_debugger_api.h" |
| 6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/dart_api_message.h" | 10 #include "vm/dart_api_message.h" |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 private: | 832 private: |
| 833 DISALLOW_COPY_AND_ASSIGN(TestSnapshotWriter); | 833 DISALLOW_COPY_AND_ASSIGN(TestSnapshotWriter); |
| 834 }; | 834 }; |
| 835 | 835 |
| 836 | 836 |
| 837 static void GenerateSourceAndCheck(const Script& script) { | 837 static void GenerateSourceAndCheck(const Script& script) { |
| 838 // Check if we are able to generate the source from the token stream. | 838 // Check if we are able to generate the source from the token stream. |
| 839 // Rescan this source and compare the token stream to see if they are | 839 // Rescan this source and compare the token stream to see if they are |
| 840 // the same. | 840 // the same. |
| 841 const TokenStream& expected_tokens = TokenStream::Handle(script.tokens()); | 841 const TokenStream& expected_tokens = TokenStream::Handle(script.tokens()); |
| 842 TokenStream::Iterator expected_iterator(expected_tokens, 0); | 842 TokenStream::Iterator expected_iterator( |
| 843 expected_tokens, 0, TokenStream::Iterator::kAllTokens); |
| 843 const String& str = String::Handle(expected_tokens.GenerateSource()); | 844 const String& str = String::Handle(expected_tokens.GenerateSource()); |
| 844 const String& private_key = String::Handle(expected_tokens.PrivateKey()); | 845 const String& private_key = String::Handle(expected_tokens.PrivateKey()); |
| 845 Scanner scanner(str, private_key); | 846 Scanner scanner(str, private_key); |
| 846 const TokenStream& reconstructed_tokens = | 847 const TokenStream& reconstructed_tokens = |
| 847 TokenStream::Handle(TokenStream::New(scanner.GetStream(), private_key)); | 848 TokenStream::Handle(TokenStream::New(scanner.GetStream(), private_key)); |
| 848 expected_iterator.SetCurrentPosition(0); | 849 expected_iterator.SetCurrentPosition(0); |
| 849 TokenStream::Iterator reconstructed_iterator(reconstructed_tokens, 0); | 850 TokenStream::Iterator reconstructed_iterator( |
| 851 reconstructed_tokens, 0, TokenStream::Iterator::kAllTokens); |
| 850 Token::Kind expected_kind = expected_iterator.CurrentTokenKind(); | 852 Token::Kind expected_kind = expected_iterator.CurrentTokenKind(); |
| 851 Token::Kind reconstructed_kind = reconstructed_iterator.CurrentTokenKind(); | 853 Token::Kind reconstructed_kind = reconstructed_iterator.CurrentTokenKind(); |
| 852 String& expected_literal = String::Handle(); | 854 String& expected_literal = String::Handle(); |
| 853 String& actual_literal = String::Handle(); | 855 String& actual_literal = String::Handle(); |
| 854 while (expected_kind != Token::kEOS && reconstructed_kind != Token::kEOS) { | 856 while (expected_kind != Token::kEOS && reconstructed_kind != Token::kEOS) { |
| 855 EXPECT_EQ(expected_kind, reconstructed_kind); | 857 EXPECT_EQ(expected_kind, reconstructed_kind); |
| 856 expected_literal ^= expected_iterator.CurrentLiteral(); | 858 expected_literal ^= expected_iterator.CurrentLiteral(); |
| 857 actual_literal ^= reconstructed_iterator.CurrentLiteral(); | 859 actual_literal ^= reconstructed_iterator.CurrentLiteral(); |
| 858 EXPECT(expected_literal.Equals(actual_literal)); | 860 EXPECT(expected_literal.Equals(actual_literal)); |
| 859 expected_iterator.Advance(); | 861 expected_iterator.Advance(); |
| (...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2660 result = Dart_RunLoop(); | 2662 result = Dart_RunLoop(); |
| 2661 EXPECT(Dart_IsError(result)); | 2663 EXPECT(Dart_IsError(result)); |
| 2662 EXPECT(Dart_ErrorHasException(result)); | 2664 EXPECT(Dart_ErrorHasException(result)); |
| 2663 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", | 2665 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", |
| 2664 Dart_GetError(result)); | 2666 Dart_GetError(result)); |
| 2665 | 2667 |
| 2666 Dart_ExitScope(); | 2668 Dart_ExitScope(); |
| 2667 } | 2669 } |
| 2668 | 2670 |
| 2669 } // namespace dart | 2671 } // namespace dart |
| OLD | NEW |