2019-02-13 15:48:03 +00:00
|
|
|
// Copyright 2019 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter_tools/src/build_info.dart';
|
|
|
|
|
2019-07-13 18:51:44 +00:00
|
|
|
import '../src/common.dart';
|
|
|
|
import '../src/context.dart';
|
2019-02-13 15:48:03 +00:00
|
|
|
|
|
|
|
void main() {
|
2019-03-22 23:02:21 +00:00
|
|
|
setUpAll(() { });
|
2019-02-13 15:48:03 +00:00
|
|
|
|
|
|
|
group('Validate build number', () {
|
2019-03-22 23:02:21 +00:00
|
|
|
setUp(() async { });
|
2019-02-13 15:48:03 +00:00
|
|
|
|
|
|
|
testUsingContext('CFBundleVersion for iOS', () async {
|
|
|
|
String buildName = validatedBuildNumberForPlatform(TargetPlatform.ios, 'xyz');
|
|
|
|
expect(buildName, '0');
|
|
|
|
buildName = validatedBuildNumberForPlatform(TargetPlatform.ios, '123.xyz');
|
|
|
|
expect(buildName, '123');
|
|
|
|
buildName = validatedBuildNumberForPlatform(TargetPlatform.ios, '123.456.xyz');
|
|
|
|
expect(buildName, '123.456');
|
|
|
|
});
|
|
|
|
|
|
|
|
testUsingContext('versionCode for Android', () async {
|
|
|
|
String buildName = validatedBuildNumberForPlatform(TargetPlatform.android_arm, '123.abc+-');
|
|
|
|
expect(buildName, '123');
|
|
|
|
buildName = validatedBuildNumberForPlatform(TargetPlatform.android_arm, 'abc');
|
|
|
|
expect(buildName, '1');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
group('Validate build name', () {
|
2019-03-22 23:02:21 +00:00
|
|
|
setUp(() async { });
|
2019-02-13 15:48:03 +00:00
|
|
|
|
|
|
|
testUsingContext('CFBundleShortVersionString for iOS', () async {
|
|
|
|
String buildName = validatedBuildNameForPlatform(TargetPlatform.ios, 'xyz');
|
|
|
|
expect(buildName, '0.0.0');
|
|
|
|
buildName = validatedBuildNameForPlatform(TargetPlatform.ios, '123.456.xyz');
|
|
|
|
expect(buildName, '123.456.0');
|
|
|
|
buildName = validatedBuildNameForPlatform(TargetPlatform.ios, '123.xyz');
|
|
|
|
expect(buildName, '123.0.0');
|
|
|
|
});
|
|
|
|
|
|
|
|
testUsingContext('versionName for Android', () async {
|
|
|
|
String buildName = validatedBuildNameForPlatform(TargetPlatform.android_arm, '123.abc+-');
|
|
|
|
expect(buildName, '123.abc+-');
|
|
|
|
buildName = validatedBuildNameForPlatform(TargetPlatform.android_arm, 'abc+-');
|
|
|
|
expect(buildName, 'abc+-');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|