Пример #1
0
        public void JS_CG_LiteralObjArray_Test()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName = "TS_LitObjArray.ts";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName);
        }
Пример #2
0
        public void JS_CG_Misc_AST_Test()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName = "ASTTest.ts";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName);
        }
Пример #3
0
        public void JS_CG_CustomSerialParamNoRaw_Test()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName = "TS_CustomSerialParamNoRawParam.ts";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName);
        }
Пример #4
0
        public void JS_CodeGen_EventHandler_Test()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName = "TS_EventHandlers.ts";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName);
        }
Пример #5
0
        public void JS_CG_GenTypeConcrete2_Test()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName = "TS_GenType2.ts";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName);
        }
Пример #6
0
        public void JS_CG_Neg_UnknownAtt_Type()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName          = "TS_UnknownAtt_Type.ts";
            string PrimaryErrorMessage   = "Error: Unknown @ambrosia attribute 'published'";
            string SecondaryErrorMessage = "valid attributes are: publish";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, PrimaryErrorMessage, SecondaryErrorMessage);
        }
Пример #7
0
        public void JS_CG_Neg_CommaAttrib()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_CommasBetweenAttrib.ts";
            string ConsumerErrorMsg  = "Error: Malformed @ambrosia attribute 'publish=true version=1 doRuntimeTypeChecking=true'";
            string PublisherErrorMsg = "expected format is: attrName=attrValue, ...";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #8
0
        public void JS_CG_Neg_AmbrosiaTagNewLine()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_AmbrosiaTagNewline.ts";
            string ConsumerErrorMsg  = "Error: A newline is not allowed in the attributes of an @ambrosia tag";
            string PublisherErrorMsg = "Error: A newline is not allowed in the attributes of an @ambrosia tag";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #9
0
        public void JS_CG_Neg_UnknownAttribute()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_UnknownAttribute.ts";
            string ConsumerErrorMsg  = "Error: The @ambrosia attribute 'published' is invalid for a function";
            string PublisherErrorMsg = "valid attributes are: publish, version, methodID, doRuntimeTypeChecking";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #10
0
        public void JS_CG_Neg_UnionType()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_UnionType.ts";
            string ConsumerErrorMsg  = "Error: Unable to publish type alias 'MyUnionType'";
            string PublisherErrorMsg = "as a type (reason: The published type 'MyUnionType' has an invalid type ('string|number'); union types are not supported)";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #11
0
        public void JS_CG_Neg_TagMethod()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_TagMethod.ts";
            string ConsumerErrorMsg  = "Error: The input source file (TS_TagMethod.ts) does not publish any entities (exported functions, type aliases and enums annotated with an @ambrosia JSDoc tag)";
            string PublisherErrorMsg = "Error: The input source file (TS_TagMethod.ts) does not publish any entities (exported functions, type aliases and enums annotated with an @ambrosia JSDoc tag)";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #12
0
        public void JS_CG_Neg_PublishMethodType()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_PublishMethodBeforeTypes.ts";
            string ConsumerErrorMsg  = "Error: Unable to publish function 'showNames'";
            string PublisherErrorMsg = "as a post method (reason: The parameter 'names' of method 'showNames' has an invalid type ('NameList'); check the syntax or casing or, if this is a custom type, check that it has been published";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #13
0
        public void JS_CG_Neg_CircularReference()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName          = "TS_CircReference.ts";
            string PrimaryErrorMessage   = "Error: Unable to publish type alias 'CNames'";
            string SecondaryErrorMessage = "as a type (reason: Deferred expansion of type(s) failed (reason: Unable to expand type definition '{ first: string, last: string, priorNames: CNames[] }' because it has a circular reference with definition 'CName[]')) ";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, PrimaryErrorMessage, SecondaryErrorMessage);
        }
Пример #14
0
        public void JS_CG_Neg_AsyncFcthn()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName          = "TS_AsyncFctn.ts";
            string PrimaryErrorMessage   = "as a post method (reason: async functions are not supported)";
            string SecondaryErrorMessage = "Error: Unable to publish function 'ComputePI'";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, PrimaryErrorMessage, SecondaryErrorMessage);
        }
Пример #15
0
        public void JS_CG_Neg_VersionInt()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName          = "TS_VersionInt.ts";
            string PrimaryErrorMessage   = "Error: The value ('Hello') supplied for @ambrosia attribute 'version' is not an integer";
            string SecondaryErrorMessage = "";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, PrimaryErrorMessage, SecondaryErrorMessage);
        }
Пример #16
0
        public void JS_CG_Neg_QuoteAttribVal()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_QuoteAttributeValue.ts";
            string ConsumerErrorMsg  = "Error: The value ('\"true\"') supplied for @ambrosia attribute 'publish' is not a boolean";
            string PublisherErrorMsg = "Error: The value ('\"true\"') supplied for @ambrosia attribute 'publish' is not a boolean";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #17
0
        public void JS_CG_Neg_RunTimeBool()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_RunTimeBool.ts";
            string ConsumerErrorMsg  = "Error: The value ('Hello') supplied for @ambrosia attribute 'doRuntimeTypeChecking' is not a boolean ";
            string PublisherErrorMsg = "Error: The value ('Hello') supplied for @ambrosia attribute 'doRuntimeTypeChecking' is not a boolean ";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #18
0
        public void JS_CG_Neg_MethodIDNeg()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_MethodIDNeg.ts";
            string ConsumerErrorMsg  = "Error: Unable to publish function 'MyFn'";
            string PublisherErrorMsg = "as a method (reason: Method ID -2 is invalid";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #19
0
        public void JS_CG_Neg_TwoAmbrTag()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_TwoAmbrTags.ts";
            string ConsumerErrorMsg  = "Error: The @ambrosia tag is defined more than once at";
            string PublisherErrorMsg = "Error: The @ambrosia tag is defined more than once at";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #20
0
        public void JS_CG_Neg_NestedFctn()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_NestedFunction.ts";
            string ConsumerErrorMsg  = "Error: The @ambrosia tag is not valid on a local function ('localFn'";
            string PublisherErrorMsg = "Error: The @ambrosia tag is not valid on a local function ('localFn'";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #21
0
        public void JS_CG_Neg_UnionTypeCommented()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_UnionTypeCommented.ts";
            string ConsumerErrorMsg  = "Error: Unable to publish function 'myComplexReturnFunction'";
            string PublisherErrorMsg = "as a post method (reason: The return type of method 'myComplexReturnFunction' [property 'r2'] has an invalid type ('number|string'); union types are not supported)";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #22
0
        public void JS_CG_Neg_NoFunctionComplexTypes()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_NoFunctionComplexType.ts";
            string ConsumerErrorMsg  = "Error: Unable to publish type alias 'myComplexType'";
            string PublisherErrorMsg = "as a type (reason: The published type 'myComplexType' [property 'fn'] has an invalid type ('()=>void'); function types are not supported)";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #23
0
        public void JS_CG_Neg_SingleUInt8Array()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_SingleUInt8Array.ts";
            string ConsumerErrorMsg  = "Unable to publish function 'takesCustomSerializedParams'";
            string PublisherErrorMsg = "Uint8Array parameter; Post methods do NOT support custom (raw byte) parameter serialization - all parameters are always serialized to JSON)";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #24
0
        public void JS_CG_Neg_OptionalProp()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_OptionalProperties.ts";
            string ConsumerErrorMsg  = "Error: Unable to publish type alias 'MyTypeWithOptionalMembers'";
            string PublisherErrorMsg = "as a type (reason: Property 'bar' is optional, but types with optional properties are not supported)";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #25
0
        public void JS_CG_Neg_AsyncFcthn()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_AsyncFctn.ts";
            string ConsumerErrorMsg  = "as a post method (reason: async functions are not supported)";
            string PublisherErrorMsg = "Error: Unable to publish type alias 'Digits'";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #26
0
        public void JS_CG_Neg_OverloadFctn()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_OverloadedFunction.ts";
            string ConsumerErrorMsg  = "Error: Unable to publish function 'fnOverload'";
            string PublisherErrorMsg = "as a post method (reason: The @ambrosia tag must appear on the implementation of an overloaded function";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #27
0
        public void JS_CG_Neg_MethodIDInt()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_MethodIDInt.ts";
            string ConsumerErrorMsg  = "Error: The value ('Hello') supplied for @ambrosia attribute 'methodID' is not an integer";
            string PublisherErrorMsg = "Error: The value ('Hello') supplied for @ambrosia attribute 'methodID' is not an integer";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #28
0
        public void JS_CG_Neg_PublishClass()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_PublishClass.ts";
            string ConsumerErrorMsg  = "Error: The @ambrosia tag is not valid on a class; valid targets are: function, type alias, enum";
            string PublisherErrorMsg = "Error: The @ambrosia tag is not valid on a class; valid targets are: function, type alias, enum";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #29
0
        public void JS_CG_Neg_PublishMethodRef()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName      = "TS_PublishMethodBeforeRef.ts";
            string ConsumerErrorMsg  = "Error: Unable to publish function 'fn'";
            string PublisherErrorMsg = "as a post method (reason: The following types must be published before any method can be published: 'Name' found in published type 'MyType')";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg);
        }
Пример #30
0
        public void JS_CG_Neg_TupleType()
        {
            JS_Utilities JSUtils = new JS_Utilities();

            string testfileName          = "TS_TupleType.ts";
            string PrimaryErrorMessage   = "Error: Unable to publish type alias 'MyTupleType'";
            string SecondaryErrorMessage = "as a type (reason: The published type 'MyTupleType' has an invalid type ('[string, number]'); tuple types are not supported)";

            // Generate the consumer and publisher files and verify output and the generated files to cmp files
            JSUtils.Test_CodeGen_TSFile(testfileName, true, PrimaryErrorMessage, SecondaryErrorMessage);
        }