blob: 7df4ea6f3889a4264383cb355f1f8bda98e2e128 [file] [log] [blame]
alanknighte6756422017-10-31 10:30:12 -07001// 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
3// BSD-style license that can be found in the LICENSE file.
4
5/// Test date formatting and parsing using locale data directly imported.
6///
7/// This is a copy of date_time_format_local_even_test.dart which also
8/// verifies the time zone against an environment variable.
9
10import 'dart:io';
11
alanknighte6756422017-10-31 10:30:12 -070012import 'package:intl/date_symbol_data_local.dart';
13import 'package:test/test.dart';
14
Dart Team795c4902019-08-29 10:58:28 -070015import 'date_time_format_test_stub.dart';
16
17void main() {
alanknighte6756422017-10-31 10:30:12 -070018 var tzOffset = Platform.environment['EXPECTED_TZ_OFFSET_FOR_TEST'];
19 var timezoneName = Platform.environment['TZ'];
20 if (tzOffset != null) {
Dart Team795c4902019-08-29 10:58:28 -070021 test('Actually running in the correct time zone: $timezoneName', () {
alanknighte6756422017-10-31 10:30:12 -070022 // Pick a constant Date so that the offset is known.
Dart Team795c4902019-08-29 10:58:28 -070023 var d = DateTime(2012, 1, 1, 7, 6, 5);
24 print('Time zone offset is ${d.timeZoneOffset.inHours}');
25 print('Time zone name is ${d.timeZoneName}');
alanknighte6756422017-10-31 10:30:12 -070026 expect(tzOffset, '${d.timeZoneOffset.inHours}');
27 });
28 }
29
30 // Run the main date formatting tests with a large set of locales.
31 runWith(evenLocales, null, initializeDateFormatting);
32}