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

import 'package:flutter/foundation.dart';
6
import '../flutter_test_alternative.dart';
7 8 9 10

void main() {
  // TODO(devoncarew): This test - while very nice - isn't testing what we really want to know:
  // that the code in the `profile` closure is omitted in release mode.
Ian Hickson's avatar
Ian Hickson committed
11
  test('profile invokes its closure in debug or profile mode', () {
12
    int count = 0;
13
    profile(() { // ignore: deprecated_member_use_from_same_package
14 15
      count++;
    });
16 17 18
    // We run our tests in debug mode, so kReleaseMode will always evaluate to
    // false...
    expect(count, kReleaseMode ? 0 : 1);
19 20
  });
}