utils_test.dart 1.19 KB
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4 5 6
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter_devicelab/framework/utils.dart';

7 8
import 'common.dart';

9 10 11 12 13 14 15
void main() {
  group('grep', () {
    test('greps lines', () {
      expect(grep('b', from: 'ab\ncd\nba'), <String>['ab', 'ba']);
    });

    test('understands RegExp', () {
16
      expect(grep(RegExp('^b'), from: 'ab\nba'), <String>['ba']);
17 18
    });
  });
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

  group('parse service', () {
    const String badOutput = 'No uri here';
    const String sampleOutput = 'An Observatory debugger and profiler on '
      'Pixel 3 XL is available at: http://127.0.0.1:9090/LpjUpsdEjqI=/';

    test('uri', () {
        expect(parseServiceUri(sampleOutput),
          Uri.parse('http://127.0.0.1:9090/LpjUpsdEjqI=/'));
      expect(parseServiceUri(badOutput), null);
    });

    test('port', () {
      expect(parseServicePort(sampleOutput), 9090);
      expect(parseServicePort(badOutput), null);
    });
  });
36 37 38 39 40 41 42

  group('engine environment declarations', () {
    test('localEngine', () {
      expect(localEngine, null);
      expect(localEngineSrcPath, null);
    });
  });
43
}