Branch: Tag:

2001-01-10

2001-01-10 21:45:03 by Martin Stjernholm <mast@lysator.liu.se>

Some tests for labeled breaks and continues.

Rev: src/testsuite.in:1.363

1: - test_true([["$Id: testsuite.in,v 1.362 2001/01/07 04:19:47 nilsson Exp $"]]); + test_true([["$Id: testsuite.in,v 1.363 2001/01/10 21:45:03 mast Exp $"]]);      cond([[all_constants()->_verify_internals]],   [[
4299:   test_any(int e;string t=""; for(e=0;e<10;e++) switch(e) { default: t+=e; case 4..8: } return t,"01239")   test_any([[float e,q; q=0.0; for(e=0.1;e<10.0;e+=1.0) switch(e) { default: q+=e; case 4.0..8.0: } return q]],0.1+1.1+2.1+3.1+8.1+9.1)    + // Breaks and continues with labels + test_compile_error([[int a; foo: if (a++) a++; else foo: a++;]]) + test_compile_error([[int a; foo: foo: if (a++) a++; else a++;]]) + test_compile([[int a; foo: if (a++) a++; foo: a++;]]) + test_compile_error([[int a; do if (a++) break foo; while (0);]]) + test_compile([[int a; do foo: if (a++) break foo; while (0);]]) + test_compile([[int a; foo: do if (a++) break foo; while (0);]]) + test_compile_error([[int a; do foo: if (a++) continue foo; while (0);]]) + test_compile([[int a; foo: do if (a++) continue foo; while (0);]]) + test_any_equal([[ +  int a, b; + foo: +  for (int i = 1; i <= 4; i++) { +  a = i; +  switch (1) { +  case 1: +  if (i >= 3) break foo; +  if (i >= 2) continue foo; +  } +  b = i; +  } +  return ({a, b}); + ]], ({3, 1})); + test_any_equal([[ +  int a, b; + foo: +  for (int i = 1; i <= 4; i++) { +  a = i; +  catch { +  catch { +  if (i >= 3) break foo; +  if (i >= 2) continue foo; +  }; +  }; +  b = i; +  } +  return ({a, b}); + ]], ({3, 1})); + test_any_equal([[ +  int a, b; + foo: +  for (int i = 1; i <= 4; i++) { +  a = i; +  catch { +  catch { +  if (i >= 3) break; +  if (i >= 2) continue; +  }; +  }; +  b += i; +  } +  return ({a, b}); + ]], ({4, 8})); +    cond([[all_constants()->_verify_internals]],   [[    test_do(_verify_internals())