Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


SSL break.tst   Sprache: unbekannt

 
#@local f, i
gap> START_TEST("break.tst");

#
gap> break;
Syntax error: 'break' statement not enclosed in a loop in stream:1
break;
^^^^^
gap> if true then break; fi;
Syntax error: 'break' statement not enclosed in a loop in stream:1
if true then break; fi;
             ^^^^^
gap> if false then break; fi;
Syntax error: 'break' statement not enclosed in a loop in stream:1
if false then break; fi;
              ^^^^^
gap> f := function() break; end;
Syntax error: 'break' statement not enclosed in a loop in stream:1
f := function() break; end;
                ^^^^^
gap> for i in [1..5] do List([1..5], function(x) break; return 1; end); od;
Syntax error: 'break' statement not enclosed in a loop in stream:1
for i in [1..5] do List([1..5], function(x) break; return 1; end); od;
                                            ^^^^^

#
gap> continue;
Syntax error: 'continue' statement not enclosed in a loop in stream:1
continue;
^^^^^^^^
gap> if true then continue; fi;
Syntax error: 'continue' statement not enclosed in a loop in stream:1
if true then continue; fi;
             ^^^^^^^^
gap> if false then continue; fi;
Syntax error: 'continue' statement not enclosed in a loop in stream:1
if false then continue; fi;
              ^^^^^^^^
gap> f := function() continue; end;
Syntax error: 'continue' statement not enclosed in a loop in stream:1
f := function() continue; end;
                ^^^^^^^^
gap> for i in [1..5] do List([1..5], function(x) continue; return 1; end); od;
Syntax error: 'continue' statement not enclosed in a loop in stream:1
for i in [1..5] do List([1..5], function(x) continue; return 1; end); od;
                                            ^^^^^^^^

#
gap> return;
'return' must not be used in file read-eval loop
gap> if true then return; fi;
'return' must not be used in file read-eval loop
gap> if false then return; fi; # FIXME: this should ideally also trigger an error
gap> function() return; end();
gap> for i in [1..5] do return; od; # FIXME: this should not be allowed
gap> i;
1

#
gap> return 42;
'return' must not be used in file read-eval loop
gap> if true then return 42; fi;
'return' must not be used in file read-eval loop
gap> if false then return 42; fi; # FIXME: this should ideally also trigger an error
gap> function() return 42; end();
42
gap> for i in [1..5] do return 42; od; # FIXME: this should not be allowed
gap> i;
1

#
#
gap> quit; # ignored
gap> quit; 1; # ignore everything after `quit`
gap> if true then quit; fi;
Syntax error: 'quit;' cannot be used in this context in stream:1
if true then quit; fi;
             ^^^^
gap> if false then quit; fi;
Syntax error: 'quit;' cannot be used in this context in stream:1
if false then quit; fi;
              ^^^^
gap> f := function() quit; end;
Syntax error: 'quit;' cannot be used in this context in stream:1
f := function() quit; end;
                ^^^^
gap> for i in [1..5] do quit; od;
Syntax error: 'quit;' cannot be used in this context in stream:1
for i in [1..5] do quit; od;
                   ^^^^

#
gap> QUIT; # ignored
gap> QUIT; 1; # ignore everything after `QUIT`
gap> if true then QUIT; fi;
Syntax error: 'QUIT;' cannot be used in this context in stream:1
if true then QUIT; fi;
             ^^^^
gap> if false then QUIT; fi;
Syntax error: 'QUIT;' cannot be used in this context in stream:1
if false then QUIT; fi;
              ^^^^
gap> f := function() QUIT; end;
Syntax error: 'QUIT;' cannot be used in this context in stream:1
f := function() QUIT; end;
                ^^^^
gap> for i in [1..5] do QUIT; od;
Syntax error: 'QUIT;' cannot be used in this context in stream:1
for i in [1..5] do QUIT; od;
                   ^^^^

# some more similar tests, which (together with the above)
# cover all calls to IntrAbortCoding
gap> while true do QUIT; od;
Syntax error: 'QUIT;' cannot be used in this context in stream:1
while true do QUIT; od;
              ^^^^
gap> repeat QUIT; until false;
Syntax error: 'QUIT;' cannot be used in this context in stream:1
repeat QUIT; until false;
       ^^^^
gap> atomic fail do QUIT; od;
Syntax error: 'QUIT;' cannot be used in this context in stream:1
atomic fail do QUIT; od;
               ^^^^
gap> f:=ReadAsFunction(InputTextString("QUIT; return 1;"));
Syntax error: 'QUIT;' cannot be used in this context in stream:1
QUIT; return 1;
^^^^
fail

#
gap> f := function() local i; for i in [1..5] do continue; od; end;;
gap> f();
gap> f := function() local i; for i in [1..5] do break; od; end;;
gap> f();
gap> f := function() local i; i := 1; while i in [1..5] do i := i + 1; continue; od; end;;
gap> f();
gap> f := function() local i; i := 1; while i in [1..5] do break; od; end;;
gap> f();
gap> f := function() local i; i := 1; repeat i := i + 1; continue; until i in [1..5]; end;;
gap> f();
gap> f := function() local i; i := 1; repeat i := i + 1; break; until i in [1..5]; end;;
gap> f();

#
gap> STOP_TEST("break.tst");

[ Verzeichnis aufwärts0.42unsichere Verbindung  Übersetzung europäischer Sprachen durch Browser  ]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge