Browse Source

Rename and adjust MaxRecursionDepth method in order to improve configuration readability

auz34 11 years ago
parent
commit
e28dcd584d
2 changed files with 9 additions and 10 deletions
  1. 6 6
      Jint.Tests/Runtime/EngineTests.cs
  2. 3 4
      Jint/Options.cs

+ 6 - 6
Jint.Tests/Runtime/EngineTests.cs

@@ -627,7 +627,7 @@ namespace Jint.Tests.Runtime
             ";
 
             Assert.Throws<RecursionDepthOverflowException>(
-                () => new Engine(cfg => cfg.MaxRecursionDepth(0)).Execute(script)
+                () => new Engine(cfg => cfg.LimitRecursion()).Execute(script)
             );
         }
 
@@ -646,7 +646,7 @@ namespace Jint.Tests.Runtime
             ";
 
             Assert.Throws<RecursionDepthOverflowException>(
-                () => new Engine(cfg => cfg.MaxRecursionDepth(0)).Execute(script)
+                () => new Engine(cfg => cfg.LimitRecursion()).Execute(script)
             );
         }
 
@@ -679,7 +679,7 @@ namespace Jint.Tests.Runtime
             ";
 
             Assert.Throws<RecursionDepthOverflowException>(
-                () => new Engine(cfg => cfg.MaxRecursionDepth(0)).Execute(script)
+                () => new Engine(cfg => cfg.LimitRecursion()).Execute(script)
             );
         }
 
@@ -715,7 +715,7 @@ namespace Jint.Tests.Runtime
 
             try
             {
-                new Engine(cfg => cfg.MaxRecursionDepth(0)).Execute(script);
+                new Engine(cfg => cfg.LimitRecursion()).Execute(script);
             }
             catch (RecursionDepthOverflowException ex)
             {
@@ -739,7 +739,7 @@ namespace Jint.Tests.Runtime
             var result = factorial(8);
             ";
 
-            new Engine(cfg => cfg.MaxRecursionDepth(20)).Execute(script);
+            new Engine(cfg => cfg.LimitRecursion(20)).Execute(script);
         }
 
         [Fact]
@@ -755,7 +755,7 @@ namespace Jint.Tests.Runtime
             ";
 
             Assert.Throws<RecursionDepthOverflowException>(
-                () => new Engine(cfg => cfg.MaxRecursionDepth(20)).Execute(script)
+                () => new Engine(cfg => cfg.LimitRecursion(20)).Execute(script)
             );
         }
 

+ 3 - 4
Jint/Options.cs

@@ -91,12 +91,11 @@ namespace Jint
         /// </summary>
         /// <param name="maxRecursionDepth">
         /// The allowed depth.
-        /// a) In case max depth is negative engine ignores stack overflow protection logic;
-        /// b) In case max depth is zero no recursion is allowed.
-        /// c) In case max depth is equal to n it means that in one scope function can be called no more than n times.
+        /// a) In case max depth is zero no recursion is allowed.
+        /// b) In case max depth is equal to n it means that in one scope function can be called no more than n times.
         /// </param>
         /// <returns>Options instance for fluent syntax</returns>
-        public Options MaxRecursionDepth(int maxRecursionDepth = -1)
+        public Options LimitRecursion(int maxRecursionDepth = 0)
         {
             _maxRecursionDepth = maxRecursionDepth;
             return this;