blob: 7e6de5b3642f1372fbd4fa8905c9e41c2d2aa73f [file] [log] [blame]
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/**
* @assertion The yield statement adds an element to the result of a generator
* function.
* yieldStatement:
* yield expression ‘;’
* ;
*
* @description Check correct usage of yield statement in synchronous
* static generator method
*
* @author a.semenov@unipro.ru
*/
import '../../../../Utils/expect.dart';
class A {
static Iterable<int> test() sync* {
yield 1;
}
}
main() {
int k = 0;
for (int i in A.test()) {
k = k + i;
}
Expect.equals(1, k);
}