js/src/tests/ecma_2/Statements/dowhile-001.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma_2/Statements/dowhile-001.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,44 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +
    1.10 +/**
    1.11 + *  File Name:          dowhile-001
    1.12 + *  ECMA Section:
    1.13 + *  Description:        do...while statements
    1.14 + *
    1.15 + *
    1.16 + *
    1.17 + *  Author:             christine@netscape.com
    1.18 + *  Date:               11 August 1998
    1.19 + */
    1.20 +var SECTION = "dowhile-002";
    1.21 +var VERSION = "ECMA_2";
    1.22 +var TITLE   = "do...while with a labeled continue statement";
    1.23 +
    1.24 +startTest();
    1.25 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.26 +
    1.27 +LabeledContinue( 0, 1 );
    1.28 +LabeledContinue( 1, 1 );
    1.29 +LabeledContinue( -1, 1 );
    1.30 +LabeledContinue( 5, 5 );
    1.31 +
    1.32 +test();
    1.33 +
    1.34 +function LabeledContinue( limit, expect ) {
    1.35 +  i = 0;
    1.36 +woohoo:
    1.37 +  do {
    1.38 +    i++;
    1.39 +    continue woohoo;
    1.40 +  } while ( i < limit );
    1.41 +
    1.42 +  new TestCase(
    1.43 +    SECTION,
    1.44 +    "do while ( " + i +" < " + limit +" )",
    1.45 +    expect,
    1.46 +    i );
    1.47 +}

mercurial