Menu

[r6]: / trunk / JavaScript / UnitTest / CommentTest.cs  Maximize  Restore  History

Download this file

30 lines (26 with data), 774 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
namespace JavaScript.UnitTest
{
[TestFixture]
public class CommentTest
{
[Test]
public void Comments()
{
JsEngine eng = new JsEngine();
Assert.AreEqual("1", eng.Eval("var x = 1;\r\n//x = 99;\r\nx;").ToString(), "EOL comment");
Assert.AreEqual("1", eng.Eval("var x = 1;\r\n/*x = 99;*/\r\nx;").ToString(), "block comment");
Assert.AreEqual("1", eng.Eval("var x = 1;\r\n/*x = 99;\r\nbob&&=*/\r\nx;").ToString(), "block comment");
string src =
"var x = 1;\r\n" +
"/* x = 2; */\r\n" +
"x = 3;\r\n" +
"/* x = 4; */\r\n" +
"x;\r\n";
Assert.AreEqual("3", eng.Eval(src).ToString(), "greedy lex problem");
}
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.