about summary refs log tree commit diff
path: root/IRCTokens/Tests/Tokenization.cs
diff options
context:
space:
mode:
authorBen Harris <ben@tilde.team>2020-11-10 18:35:21 -0500
committerBen Harris <ben@tilde.team>2020-11-10 18:35:21 -0500
commit35bbd30c2506b3d0b18397ef1443fb18c0d893d6 (patch)
tree893862078b9045fbfb73296a0290d16f245b2c2c /IRCTokens/Tests/Tokenization.cs
parentb8e2634193eef0b7a4db417144fe7f38a5140c3b (diff)
Move tests to a separate project
Diffstat (limited to 'IRCTokens/Tests/Tokenization.cs')
-rw-r--r--IRCTokens/Tests/Tokenization.cs133
1 files changed, 0 insertions, 133 deletions
diff --git a/IRCTokens/Tests/Tokenization.cs b/IRCTokens/Tests/Tokenization.cs
deleted file mode 100644
index c4c5c5a..0000000
--- a/IRCTokens/Tests/Tokenization.cs
+++ /dev/null
@@ -1,133 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace IRCTokens.Tests
-{
-    [TestClass]
-    public class Tokenization
-    {
-        [TestMethod]
-        public void TagsMissing()
-        {
-            var line = new Line("PRIVMSG #channel");
-            Assert.IsNull(line.Tags);
-        }
-
-        [TestMethod]
-        public void TagsMissingValue()
-        {
-            var line = new Line("@id= PRIVMSG #channel");
-            Assert.AreEqual(string.Empty, line.Tags["id"]);
-        }
-
-        [TestMethod]
-        public void TagsMissingEqual()
-        {
-            var line = new Line("@id PRIVMSG #channel");
-            Assert.AreEqual(string.Empty, line.Tags["id"]);
-        }
-
-        [TestMethod]
-        public void TagsUnescape()
-        {
-            var line = new Line(@"@id=1\\\:\r\n\s2 PRIVMSG #channel");
-            Assert.AreEqual("1\\;\r\n 2", line.Tags["id"]);
-        }
-
-        [TestMethod]
-        public void TagsOverlap()
-        {
-            var line = new Line(@"@id=1\\\s\\s PRIVMSG #channel");
-            Assert.AreEqual("1\\ \\s", line.Tags["id"]);
-        }
-
-        [TestMethod]
-        public void TagsLoneEndSlash()
-        {
-            var line = new Line("@id=1\\ PRIVMSG #channel");
-            Assert.AreEqual("1", line.Tags["id"]);
-        }
-
-        [TestMethod]
-        public void SourceWithoutTags()
-        {
-            var line = new Line(":nick!user@host PRIVMSG #channel");
-            Assert.AreEqual("nick!user@host", line.Source);
-        }
-
-        [TestMethod]
-        public void SourceWithTags()
-        {
-            var line = new Line("@id=123 :nick!user@host PRIVMSG #channel");
-            Assert.AreEqual("nick!user@host", line.Source);
-        }
-
-        [TestMethod]
-        public void SourceMissingWithoutTags()
-        {
-            var line = new Line("PRIVMSG #channel");
-            Assert.IsNull(line.Source);
-        }
-
-        [TestMethod]
-        public void SourceMissingWithTags()
-        {
-            var line = new Line("@id=123 PRIVMSG #channel");
-            Assert.IsNull(line.Source);
-        }
-
-        [TestMethod]
-        public void Command()
-        {
-            var line = new Line("privmsg #channel");
-            Assert.AreEqual("PRIVMSG", line.Command);
-        }
-
-        [TestMethod]
-        public void ParamsTrailing()
-        {
-            var line = new Line("PRIVMSG #channel :hello world");
-            CollectionAssert.AreEqual(new List<string> {"#channel", "hello world"}, line.Params);
-        }
-
-        [TestMethod]
-        public void ParamsOnlyTrailing()
-        {
-            var line = new Line("PRIVMSG :hello world");
-            CollectionAssert.AreEqual(new List<string> {"hello world"}, line.Params);
-        }
-
-        [TestMethod]
-        public void ParamsMissing()
-        {
-            var line = new Line("PRIVMSG");
-            Assert.AreEqual("PRIVMSG", line.Command);
-            CollectionAssert.AreEqual(new List<string>(), line.Params);
-        }
-
-        [TestMethod]
-        public void AllTokens()
-        {
-            var line = new Line("@id=123 :nick!user@host PRIVMSG #channel :hello world");
-            CollectionAssert.AreEqual(new Dictionary<string, string> {{"id", "123"}}, line.Tags);
-            Assert.AreEqual("nick!user@host", line.Source);
-            Assert.AreEqual("PRIVMSG", line.Command);
-            CollectionAssert.AreEqual(new List<string> {"#channel", "hello world"}, line.Params);
-        }
-
-        [TestMethod]
-        public void NulByte()
-        {
-            var decoder = new IRCTokens.StatefulDecoder();
-            var bytes = Encoding.UTF8.GetBytes(":nick!user@host PRIVMSG #channel :hello")
-                .Concat(Encoding.UTF8.GetBytes("\0"))
-                .Concat(Encoding.UTF8.GetBytes("world"))
-                .ToArray();
-            var line = decoder.Push(bytes, bytes.Length).First();
-            
-            CollectionAssert.AreEqual(new List<string> {"#channel", "hello"}, line.Params);
-        }
-    }
-}