OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 CheckDST(TimeFromYearMonthDay(date_cache, year, 5, 5)); | 159 CheckDST(TimeFromYearMonthDay(date_cache, year, 5, 5)); |
160 } | 160 } |
161 CheckDST((august_20 + september_10) / 2); | 161 CheckDST((august_20 + september_10) / 2); |
162 CheckDST(september_10); | 162 CheckDST(september_10); |
163 CheckDST(september_10 + 2 * 3600); | 163 CheckDST(september_10 + 2 * 3600); |
164 CheckDST(september_10 + 2 * 3600 - 1000); | 164 CheckDST(september_10 + 2 * 3600 - 1000); |
165 CheckDST(august_20 + 2 * 3600); | 165 CheckDST(august_20 + 2 * 3600); |
166 CheckDST(august_20 + 2 * 3600 - 1000); | 166 CheckDST(august_20 + 2 * 3600 - 1000); |
167 CheckDST(august_20); | 167 CheckDST(august_20); |
168 } | 168 } |
169 | |
170 | |
171 TEST(DateCacheVersion) { | |
172 FLAG_allow_natives_syntax = true; | |
173 v8::Isolate* isolate = CcTest::isolate(); | |
174 v8::Isolate::Scope isolate_scope(isolate); | |
175 v8::HandleScope scope(isolate); | |
176 v8::Local<v8::Context> context = v8::Context::New(isolate); | |
177 v8::Context::Scope context_scope(context); | |
178 v8::Local<v8::Array> date_cache_version = | |
179 v8::Local<v8::Array>::Cast(CompileRun("%DateCacheVersion()")); | |
180 | |
181 CHECK_EQ(1, static_cast<int32_t>(date_cache_version->Length())); | |
182 CHECK(date_cache_version->Get(context, 0).ToLocalChecked()->IsNumber()); | |
183 CHECK_EQ(0.0, date_cache_version->Get(context, 0) | |
184 .ToLocalChecked() | |
185 ->NumberValue(context) | |
186 .FromJust()); | |
187 | |
188 v8::Date::DateTimeConfigurationChangeNotification(isolate); | |
189 | |
190 CHECK_EQ(1, static_cast<int32_t>(date_cache_version->Length())); | |
191 CHECK(date_cache_version->Get(context, 0).ToLocalChecked()->IsNumber()); | |
192 CHECK_EQ(1.0, date_cache_version->Get(context, 0) | |
193 .ToLocalChecked() | |
194 ->NumberValue(context) | |
195 .FromJust()); | |
196 } | |
OLD | NEW |