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

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

Issue 14791005: BREAKING CHANGE: enforce part of directive (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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/find_code_object_test.cc ('k') | runtime/vm/parser.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/assert.h" 5 #include "platform/assert.h"
6 #include "vm/assembler.h" 6 #include "vm/assembler.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/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 } 1956 }
1957 1957
1958 1958
1959 TEST_CASE(Script) { 1959 TEST_CASE(Script) {
1960 const char* url_chars = "builtin:test-case"; 1960 const char* url_chars = "builtin:test-case";
1961 const char* source_chars = "This will not compile."; 1961 const char* source_chars = "This will not compile.";
1962 const String& url = String::Handle(String::New(url_chars)); 1962 const String& url = String::Handle(String::New(url_chars));
1963 const String& source = String::Handle(String::New(source_chars)); 1963 const String& source = String::Handle(String::New(source_chars));
1964 const Script& script = Script::Handle(Script::New(url, 1964 const Script& script = Script::Handle(Script::New(url,
1965 source, 1965 source,
1966 RawScript::kSourceTag)); 1966 RawScript::kScriptTag));
1967 EXPECT(!script.IsNull()); 1967 EXPECT(!script.IsNull());
1968 EXPECT(script.IsScript()); 1968 EXPECT(script.IsScript());
1969 String& str = String::Handle(script.url()); 1969 String& str = String::Handle(script.url());
1970 EXPECT_EQ(17, str.Length()); 1970 EXPECT_EQ(17, str.Length());
1971 EXPECT_EQ('b', str.CharAt(0)); 1971 EXPECT_EQ('b', str.CharAt(0));
1972 EXPECT_EQ(':', str.CharAt(7)); 1972 EXPECT_EQ(':', str.CharAt(7));
1973 EXPECT_EQ('e', str.CharAt(16)); 1973 EXPECT_EQ('e', str.CharAt(16));
1974 str = script.Source(); 1974 str = script.Source();
1975 EXPECT_EQ(22, str.Length()); 1975 EXPECT_EQ(22, str.Length());
1976 EXPECT_EQ('T', str.CharAt(0)); 1976 EXPECT_EQ('T', str.CharAt(0));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 // Dart script starts with "main" on line 3. 2011 // Dart script starts with "main" on line 3.
2012 intptr_t col_offset = script_begin - line3; 2012 intptr_t col_offset = script_begin - line3;
2013 ASSERT(col_offset > 0); 2013 ASSERT(col_offset > 0);
2014 2014
2015 char* src_chars = strdup(script_begin); 2015 char* src_chars = strdup(script_begin);
2016 src_chars[script_length] = '\0'; 2016 src_chars[script_length] = '\0';
2017 2017
2018 const String& url = String::Handle(String::New(url_chars)); 2018 const String& url = String::Handle(String::New(url_chars));
2019 const String& source = String::Handle(String::New(src_chars)); 2019 const String& source = String::Handle(String::New(src_chars));
2020 const Script& script = Script::Handle( 2020 const Script& script = Script::Handle(
2021 Script::New(url, source, RawScript::kSourceTag)); 2021 Script::New(url, source, RawScript::kScriptTag));
2022 script.SetLocationOffset(line_offset, col_offset); 2022 script.SetLocationOffset(line_offset, col_offset);
2023 2023
2024 String& str = String::Handle(); 2024 String& str = String::Handle();
2025 str = script.GetLine(first_dart_line); 2025 str = script.GetLine(first_dart_line);
2026 EXPECT_STREQ("main() {", str.ToCString()); 2026 EXPECT_STREQ("main() {", str.ToCString());
2027 str = script.GetLine(last_dart_line); 2027 str = script.GetLine(last_dart_line);
2028 EXPECT_STREQ(" }", str.ToCString()); 2028 EXPECT_STREQ(" }", str.ToCString());
2029 2029
2030 2030
2031 script.Tokenize(String::Handle(String::New("ABC"))); 2031 script.Tokenize(String::Handle(String::New("ABC")));
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
3198 const Function& test7 = Function::Handle(GetFunction(class_a, "test7")); 3198 const Function& test7 = Function::Handle(GetFunction(class_a, "test7"));
3199 EXPECT_EQ(test1.SourceFingerprint(), test2.SourceFingerprint()); 3199 EXPECT_EQ(test1.SourceFingerprint(), test2.SourceFingerprint());
3200 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint()); 3200 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint());
3201 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint()); 3201 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint());
3202 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint()); 3202 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint());
3203 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint()); 3203 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint());
3204 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint()); 3204 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint());
3205 } 3205 }
3206 3206
3207 } // namespace dart 3207 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/find_code_object_test.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698