Exemplo n.º 1
0
        public void TestIncorrectGenericEvent()
        {
            var test = @"
namespace Foo {
machine M {
start state S
{
on e<<int> goto S2;
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Unexpected token inside a generic name.", test);
        }
Exemplo n.º 2
0
        public void TestMonitorOnEventDoActionDeclarationWithoutSemicolon()
        {
            var test = @"
namespace Foo {
monitor M {
start state S1
{
on e do Bar
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Expected \";\".", test);
        }
Exemplo n.º 3
0
        public void TestQualifiedDefaultEvent()
        {
            var test = @"
namespace Foo {
machine M {
start state S
{
on Foo.default goto S2;
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Expected identifier.", test);
        }
Exemplo n.º 4
0
        public void TestGenericDefaultEvent()
        {
            var test = @"
namespace Foo {
machine M {
start state S
{
on default<int> goto S2;
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Invalid generic expression.", test);
        }
Exemplo n.º 5
0
        public void TestOnEventDeclarationWithoutHandler()
        {
            var test = @"
namespace Foo {
machine M {
start state S1
{
on e;
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Expected \"do\", \"goto\" or \"push\".", test);
        }
Exemplo n.º 6
0
        public void TestDeferEventDeclarationWithoutComma()
        {
            var test = @"
namespace Foo {
machine M {
start state S
{
defer e1 e2;
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Expected \",\".", test);
        }
Exemplo n.º 7
0
        public void TestOnEventDoActionDeclarationWithIncorrectWildcardUse()
        {
            var test = @"
namespace Foo {
machine M {
start state S1
{
on e.* do Bar
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Expected identifier.", test);
        }
Exemplo n.º 8
0
        public void TestMonitorMethodInsideGroup()
        {
            var test = @"
namespace Foo {
monitor M {
group G
{
void Bar() { }
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Unexpected token 'void'.", test);
        }
Exemplo n.º 9
0
        public void TestAsyncInWrongExitLocation()
        {
            var test = @"
namespace Foo {
machine M {
state S1
{
    exit async {}
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Expected \"{\".", test);
        }
Exemplo n.º 10
0
        public void TestOnEventDoActionDeclarationWithoutAction()
        {
            var test = @"
namespace Foo {
machine M {
start state S1
{
on e do;
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Expected async keyword, action identifier, or opening curly bracket.", test);
        }
Exemplo n.º 11
0
        public void TestAsyncInWrongDoLocation()
        {
            var test = @"
namespace Foo {
machine M {
state S1
{
async on e do {}
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("'async' was used in an incorrect context.", test);
        }
Exemplo n.º 12
0
        public void TestAsyncOnState()
        {
            var test = @"
namespace Foo {
machine M {
async state S1
{
on e do {}
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("A machine state cannot be async.", test);
        }
Exemplo n.º 13
0
        public void TestAsyncOnMachine()
        {
            var test = @"
namespace Foo {
async machine M {
start state S1
{
on e do {}
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Unexpected token.", test);
        }
Exemplo n.º 14
0
        public void TestOnEventDoActionAnonymousHandlerWithAwaitedAction()
        {
            var test = @"
namespace Foo {
machine M {
start state S1
{
on e do await {}
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("'await' should not be used on actions.", test);
        }
Exemplo n.º 15
0
        public void TestOnEventDoActionDeclarationWithGenericError2()
        {
            var test = @"
namespace Foo {
machine M {
start state S1
{
on e> do Bar;
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Invalid generic expression.", test);
        }
Exemplo n.º 16
0
        public void TestMonitorEmptyNestedGroup()
        {
            var test = @"
namespace Foo {
monitor M {
group G
{
group G2 { }
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("A state group must declare at least one state.", test);
        }
Exemplo n.º 17
0
        public void TestMonitorGroupInsideState()
        {
            var test = @"
namespace Foo {
monitor M {
start state S
{
group G { }
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Unexpected token.", test);
        }
Exemplo n.º 18
0
        public void TestOnEventDoActionDeclarationWithCommaError()
        {
            var test = @"
namespace Foo {
machine M {
start state S1
{
on e, do Bar
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Expected event identifier.", test);
        }
Exemplo n.º 19
0
        public void TestOnEventGotoStateDeclarationWithGenericError3()
        {
            var test = @"
namespace Foo {
machine M {
start state S1
{
on e<List<int>>> goto S2;
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Invalid generic expression.", test);
        }
Exemplo n.º 20
0
        public void TestOnEventGotoStateDeclarationWithGenericError1()
        {
            var test = @"
namespace Foo {
machine M {
start state S1
{
on <> goto S2;
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Expected event identifier.", test);
        }
Exemplo n.º 21
0
        public void TestOnEventGotoStateDeclarationWithoutState()
        {
            var test = @"
namespace Foo {
machine M {
start state S1
{
on e goto;
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Expected state identifier.", test);
        }
Exemplo n.º 22
0
        public void TestOnEventGotoStateDeclarationWithoutSemicolon()
        {
            var test = @"
namespace Foo {
machine M {
start state S1
{
on e goto S2
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Expected \";\".", test);
        }
Exemplo n.º 23
0
        public void TestEntryDeclarationWithUnexpectedIdentifier()
        {
            var test = @"
namespace Foo {
machine M {
start state S
{
entry Bar {}
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Expected \"{\".", test);
        }
Exemplo n.º 24
0
        public void TestOnlyOneStartState()
        {
            var test = @"
namespace Foo {
    machine Machine1 {
        start state Init : BaseState {
        }

        start state BaseState {
        }
    }
}";

            LanguageTestUtilities.AssertFailedTestLog("A machine can declare only a single start state.", test);
        }
Exemplo n.º 25
0
        public void TestStateDeclarationWithMoreThanOneExit()
        {
            var test = @"
namespace Foo {
machine M {
start state S
{
exit{}
exit {}
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Duplicate exit declaration.", test);
        }
Exemplo n.º 26
0
        public void TestMonitorIgnoreEventDeclarationWithExtraComma()
        {
            var test = @"
namespace Foo {
monitor M {
group G {
start state S
{
ignore e1,e2,;
}
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Expected event identifier.", test);
        }
Exemplo n.º 27
0
        public void TestMonitorIgnoreEventDeclarationWithoutComma()
        {
            var test = @"
namespace Foo {
monitor M {
group G {
start state S
{
ignore e1 e2;
}
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Expected \",\".", test);
        }
Exemplo n.º 28
0
        public void TestMachineDeferEventDeclarationWithExtraComma()
        {
            var test = @"
namespace Foo {
machine M {
group G {
start state S
{
defer e1,e2,;
}
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Expected event identifier.", test);
        }
Exemplo n.º 29
0
        public void TestMonitorStateDeclarationWithMoreThanOneEntry()
        {
            var test = @"
namespace Foo {
monitor M {
group G {
start state S
{
entry {}
entry{}
}
}
}
}";

            LanguageTestUtilities.AssertFailedTestLog("Duplicate entry declaration.", test);
        }
Exemplo n.º 30
0
        public void TestUsingDeclarationWithoutIdentifier()
        {
            var test = "using;";

            LanguageTestUtilities.AssertFailedTestLog("Expected identifier.", test);
        }