Replace === with ==

This commit is contained in:
Naoki Takezoe
2016-02-04 00:27:00 +09:00
parent bcc05f021c
commit f40f8427aa
4 changed files with 66 additions and 66 deletions

View File

@@ -6,7 +6,7 @@ class DirectorySpec extends FunSpec {
describe("GitBucketHome"){ describe("GitBucketHome"){
it("should set under target in test scope"){ it("should set under target in test scope"){
assert(Directory.GitBucketHome === new java.io.File("target/gitbucket_home_for_test").getAbsolutePath) assert(Directory.GitBucketHome == new java.io.File("target/gitbucket_home_for_test").getAbsolutePath)
} }
} }
// test("GitBucketHome should exists"){ // test("GitBucketHome should exists"){

View File

@@ -9,85 +9,85 @@ class JGitUtilSpec extends FunSuite {
withTestRepository { git => withTestRepository { git =>
def list(branch: String, path: String) = def list(branch: String, path: String) =
JGitUtil.getFileList(git, branch, path).map(finfo => (finfo.name, finfo.message, finfo.isDirectory)) JGitUtil.getFileList(git, branch, path).map(finfo => (finfo.name, finfo.message, finfo.isDirectory))
assert(list("master", ".") === Nil) assert(list("master", ".") == Nil)
assert(list("master", "dir/subdir") === Nil) assert(list("master", "dir/subdir") == Nil)
assert(list("branch", ".") === Nil) assert(list("branch", ".") == Nil)
assert(list("branch", "dir/subdir") === Nil) assert(list("branch", "dir/subdir") == Nil)
createFile(git, "master", "README.md", "body1", message = "commit1") createFile(git, "master", "README.md", "body1", message = "commit1")
assert(list("master", ".") === List(("README.md", "commit1", false))) assert(list("master", ".") == List(("README.md", "commit1", false)))
assert(list("master", "dir/subdir") === Nil) assert(list("master", "dir/subdir") == Nil)
assert(list("branch", ".") === Nil) assert(list("branch", ".") == Nil)
assert(list("branch", "dir/subdir") === Nil) assert(list("branch", "dir/subdir") == Nil)
createFile(git, "master", "README.md", "body2", message = "commit2") createFile(git, "master", "README.md", "body2", message = "commit2")
assert(list("master", ".") === List(("README.md", "commit2", false))) assert(list("master", ".") == List(("README.md", "commit2", false)))
assert(list("master", "dir/subdir") === Nil) assert(list("master", "dir/subdir") == Nil)
assert(list("branch", ".") === Nil) assert(list("branch", ".") == Nil)
assert(list("branch", "dir/subdir") === Nil) assert(list("branch", "dir/subdir") == Nil)
createFile(git, "master", "dir/subdir/File3.md", "body3", message = "commit3") createFile(git, "master", "dir/subdir/File3.md", "body3", message = "commit3")
assert(list("master", ".") === List(("dir/subdir", "commit3", true), ("README.md", "commit2", false))) assert(list("master", ".") == List(("dir/subdir", "commit3", true), ("README.md", "commit2", false)))
assert(list("master", "dir/subdir") === List(("File3.md", "commit3", false))) assert(list("master", "dir/subdir") == List(("File3.md", "commit3", false)))
assert(list("branch", ".") === Nil) assert(list("branch", ".") == Nil)
assert(list("branch", "dir/subdir") === Nil) assert(list("branch", "dir/subdir") == Nil)
createFile(git, "master", "dir/subdir/File4.md", "body4", message = "commit4") createFile(git, "master", "dir/subdir/File4.md", "body4", message = "commit4")
assert(list("master", ".") === List(("dir/subdir", "commit4", true), ("README.md", "commit2", false))) assert(list("master", ".") == List(("dir/subdir", "commit4", true), ("README.md", "commit2", false)))
assert(list("master", "dir/subdir") === List(("File3.md", "commit3", false), ("File4.md", "commit4", false))) assert(list("master", "dir/subdir") == List(("File3.md", "commit3", false), ("File4.md", "commit4", false)))
assert(list("branch", ".") === Nil) assert(list("branch", ".") == Nil)
assert(list("branch", "dir/subdir") === Nil) assert(list("branch", "dir/subdir") == Nil)
createFile(git, "master", "README5.md", "body5", message = "commit5") createFile(git, "master", "README5.md", "body5", message = "commit5")
assert(list("master", ".") === List(("dir/subdir", "commit4", true), ("README.md", "commit2", false), ("README5.md", "commit5", false))) assert(list("master", ".") == List(("dir/subdir", "commit4", true), ("README.md", "commit2", false), ("README5.md", "commit5", false)))
assert(list("master", "dir/subdir") === List(("File3.md", "commit3", false), ("File4.md", "commit4", false))) assert(list("master", "dir/subdir") == List(("File3.md", "commit3", false), ("File4.md", "commit4", false)))
assert(list("branch", ".") === Nil) assert(list("branch", ".") == Nil)
assert(list("branch", "dir/subdir") === Nil) assert(list("branch", "dir/subdir") == Nil)
createFile(git, "master", "README.md", "body6", message = "commit6") createFile(git, "master", "README.md", "body6", message = "commit6")
assert(list("master", ".") === List(("dir/subdir", "commit4", true), ("README.md", "commit6", false), ("README5.md", "commit5", false))) assert(list("master", ".") == List(("dir/subdir", "commit4", true), ("README.md", "commit6", false), ("README5.md", "commit5", false)))
assert(list("master", "dir/subdir") === List(("File3.md", "commit3", false), ("File4.md", "commit4", false))) assert(list("master", "dir/subdir") == List(("File3.md", "commit3", false), ("File4.md", "commit4", false)))
assert(list("branch", ".") === Nil) assert(list("branch", ".") == Nil)
assert(list("branch", "dir/subdir") === Nil) assert(list("branch", "dir/subdir") == Nil)
git.branchCreate().setName("branch").setStartPoint("master").call() git.branchCreate().setName("branch").setStartPoint("master").call()
assert(list("master", ".") === List(("dir/subdir", "commit4", true), ("README.md", "commit6", false), ("README5.md", "commit5", false))) assert(list("master", ".") == List(("dir/subdir", "commit4", true), ("README.md", "commit6", false), ("README5.md", "commit5", false)))
assert(list("master", "dir/subdir") === List(("File3.md", "commit3", false), ("File4.md", "commit4", false))) assert(list("master", "dir/subdir") == List(("File3.md", "commit3", false), ("File4.md", "commit4", false)))
assert(list("branch", ".") === List(("dir/subdir", "commit4", true), ("README.md", "commit6", false), ("README5.md", "commit5", false))) assert(list("branch", ".") == List(("dir/subdir", "commit4", true), ("README.md", "commit6", false), ("README5.md", "commit5", false)))
assert(list("branch", "dir/subdir") === List(("File3.md", "commit3", false), ("File4.md", "commit4", false))) assert(list("branch", "dir/subdir") == List(("File3.md", "commit3", false), ("File4.md", "commit4", false)))
createFile(git, "branch", "dir/subdir/File3.md", "body7", message = "commit7") createFile(git, "branch", "dir/subdir/File3.md", "body7", message = "commit7")
assert(list("master", ".") === List(("dir/subdir", "commit4", true), ("README.md", "commit6", false), ("README5.md", "commit5", false))) assert(list("master", ".") == List(("dir/subdir", "commit4", true), ("README.md", "commit6", false), ("README5.md", "commit5", false)))
assert(list("master", "dir/subdir") === List(("File3.md", "commit3", false), ("File4.md", "commit4", false))) assert(list("master", "dir/subdir") == List(("File3.md", "commit3", false), ("File4.md", "commit4", false)))
assert(list("branch", ".") === List(("dir/subdir", "commit7", true), ("README.md", "commit6", false), ("README5.md", "commit5", false))) assert(list("branch", ".") == List(("dir/subdir", "commit7", true), ("README.md", "commit6", false), ("README5.md", "commit5", false)))
assert(list("branch", "dir/subdir") === List(("File3.md", "commit7", false), ("File4.md", "commit4", false))) assert(list("branch", "dir/subdir") == List(("File3.md", "commit7", false), ("File4.md", "commit4", false)))
createFile(git, "master", "dir8/File8.md", "body8", message = "commit8") createFile(git, "master", "dir8/File8.md", "body8", message = "commit8")
assert(list("master", ".") === List(("dir/subdir", "commit4", true), ("dir8", "commit8", true), ("README.md", "commit6", false), ("README5.md", "commit5", false))) assert(list("master", ".") == List(("dir/subdir", "commit4", true), ("dir8", "commit8", true), ("README.md", "commit6", false), ("README5.md", "commit5", false)))
assert(list("master", "dir/subdir") === List(("File3.md", "commit3", false), ("File4.md", "commit4", false))) assert(list("master", "dir/subdir") == List(("File3.md", "commit3", false), ("File4.md", "commit4", false)))
assert(list("branch", ".") === List(("dir/subdir", "commit7", true), ("README.md", "commit6", false), ("README5.md", "commit5", false))) assert(list("branch", ".") == List(("dir/subdir", "commit7", true), ("README.md", "commit6", false), ("README5.md", "commit5", false)))
assert(list("branch", "dir/subdir") === List(("File3.md", "commit7", false), ("File4.md", "commit4", false))) assert(list("branch", "dir/subdir") == List(("File3.md", "commit7", false), ("File4.md", "commit4", false)))
createFile(git, "branch", "dir/subdir9/File9.md", "body9", message = "commit9") createFile(git, "branch", "dir/subdir9/File9.md", "body9", message = "commit9")
assert(list("master", ".") === List(("dir/subdir", "commit4", true), ("dir8", "commit8", true), ("README.md", "commit6", false), ("README5.md", "commit5", false))) assert(list("master", ".") == List(("dir/subdir", "commit4", true), ("dir8", "commit8", true), ("README.md", "commit6", false), ("README5.md", "commit5", false)))
assert(list("master", "dir/subdir") === List(("File3.md", "commit3", false), ("File4.md", "commit4", false))) assert(list("master", "dir/subdir") == List(("File3.md", "commit3", false), ("File4.md", "commit4", false)))
assert(list("branch", ".") === List(("dir", "commit9", true), ("README.md", "commit6", false), ("README5.md", "commit5", false))) assert(list("branch", ".") == List(("dir", "commit9", true), ("README.md", "commit6", false), ("README5.md", "commit5", false)))
assert(list("branch", "dir/subdir") === List(("File3.md", "commit7", false), ("File4.md", "commit4", false))) assert(list("branch", "dir/subdir") == List(("File3.md", "commit7", false), ("File4.md", "commit4", false)))
mergeAndCommit(git, "master", "branch", message = "merge10") mergeAndCommit(git, "master", "branch", message = "merge10")
assert(list("master", ".") === List(("dir", "commit9", true), ("dir8", "commit8", true), ("README.md", "commit6", false), ("README5.md", "commit5", false))) assert(list("master", ".") == List(("dir", "commit9", true), ("dir8", "commit8", true), ("README.md", "commit6", false), ("README5.md", "commit5", false)))
assert(list("master", "dir/subdir") === List(("File3.md", "commit7", false), ("File4.md", "commit4", false))) assert(list("master", "dir/subdir") == List(("File3.md", "commit7", false), ("File4.md", "commit4", false)))
} }
} }
@@ -98,7 +98,7 @@ class JGitUtilSpec extends FunSuite {
createFile(git, "master", "README.md", "body1", message = "commit1") createFile(git, "master", "README.md", "body1", message = "commit1")
createFile(git, "branch", "test/text2.txt", "body2", message = "commit2") createFile(git, "branch", "test/text2.txt", "body2", message = "commit2")
mergeAndCommit(git, "master", "branch", message = "merge3") mergeAndCommit(git, "master", "branch", message = "merge3")
assert(list("master", "test") === List(("text2.txt", "commit2", false))) assert(list("master", "test") == List(("text2.txt", "commit2", false)))
} }
} }
} }

View File

@@ -8,60 +8,60 @@ class StringUtilSpec extends FunSpec {
describe("urlEncode") { describe("urlEncode") {
it("should encode whitespace to %20") { it("should encode whitespace to %20") {
val encoded = StringUtil.urlEncode("aa bb") val encoded = StringUtil.urlEncode("aa bb")
assert(encoded === "aa%20bb") assert(encoded == "aa%20bb")
} }
} }
describe("urlDecode") { describe("urlDecode") {
it("should decode encoded string to original string") { it("should decode encoded string to original string") {
val encoded = StringUtil.urlEncode("あいうえお") val encoded = StringUtil.urlEncode("あいうえお")
assert(StringUtil.urlDecode(encoded) === "あいうえお") assert(StringUtil.urlDecode(encoded) == "あいうえお")
} }
it("should decode en%20 to whitespace") { it("should decode en%20 to whitespace") {
assert(StringUtil.urlDecode("aa%20bb") === "aa bb") assert(StringUtil.urlDecode("aa%20bb") == "aa b1")
} }
} }
describe("splitWords") { describe("splitWords") {
it("should split string by whitespaces") { it("should split string by whitespaces") {
val split = StringUtil.splitWords("aa bb\tcc dd \t ee") val split = StringUtil.splitWords("aa bb\tcc dd \t ee")
assert(split === Array("aa", "bb", "cc", "dd", "ee")) assert(split == Array("aa", "bb", "cc", "dd", "ee"))
} }
} }
describe("escapeHtml") { describe("escapeHtml") {
it("should escape &, <, > and \"") { it("should escape &, <, > and \"") {
assert(StringUtil.escapeHtml("<a href=\"/test\">a & b</a>") === "&lt;a href=&quot;/test&quot;&gt;a &amp; b&lt;/a&gt;") assert(StringUtil.escapeHtml("<a href=\"/test\">a & b</a>") == "&lt;a href=&quot;/test&quot;&gt;a &amp; b&lt;/a&gt;")
} }
} }
describe("md5") { describe("md5") {
it("should generate MD5 hash") { it("should generate MD5 hash") {
assert(StringUtil.md5("abc") === "900150983cd24fb0d6963f7d28e17f72") assert(StringUtil.md5("abc") == "900150983cd24fb0d6963f7d28e17f72")
} }
} }
describe("sha1") { describe("sha1") {
it("should generate SHA1 hash") { it("should generate SHA1 hash") {
assert(StringUtil.sha1("abc") === "a9993e364706816aba3e25717850c26c9cd0d89d") assert(StringUtil.sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d")
} }
} }
describe("extractIssueId") { describe("extractIssueId") {
it("should extract '#xxx' and return extracted id") { it("should extract '#xxx' and return extracted id") {
assert(StringUtil.extractIssueId("(refs #123)").toSeq === Seq("123")) assert(StringUtil.extractIssueId("(refs #123)").toSeq == Seq("123"))
} }
it("should return Nil from message which does not contain #xxx") { it("should return Nil from message which does not contain #xxx") {
assert(StringUtil.extractIssueId("this is test!").toSeq === Nil) assert(StringUtil.extractIssueId("this is test!").toSeq == Nil)
} }
} }
describe("extractCloseId") { describe("extractCloseId") {
it("should extract 'close #xxx' and return extracted id") { it("should extract 'close #xxx' and return extracted id") {
assert(StringUtil.extractCloseId("(close #123)").toSeq === Seq("123")) assert(StringUtil.extractCloseId("(close #123)").toSeq == Seq("123"))
} }
it("should returns Nil from message which does not contain close command") { it("should returns Nil from message which does not contain close command") {
assert(StringUtil.extractCloseId("(refs #123)").toSeq === Nil) assert(StringUtil.extractCloseId("(refs #123)").toSeq == Nil)
} }
} }
} }

View File

@@ -7,18 +7,18 @@ class ValidationsSpec extends FunSpec with Validations {
describe("identifier") { describe("identifier") {
it("should validate id string ") { it("should validate id string ") {
assert(identifier.validate("id", "aa_ZZ-00.01", null) === None) assert(identifier.validate("id", "aa_ZZ-00.01", null) == None)
assert(identifier.validate("id", "_aaaa", null) === Some("id starts with invalid character.")) assert(identifier.validate("id", "_aaaa", null) == Some("id starts with invalid character."))
assert(identifier.validate("id", "-aaaa", null) === Some("id starts with invalid character.")) assert(identifier.validate("id", "-aaaa", null) == Some("id starts with invalid character."))
assert(identifier.validate("id", "aa_ZZ#01", null) === Some("id contains invalid character.")) assert(identifier.validate("id", "aa_ZZ#01", null) == Some("id contains invalid character."))
} }
} }
describe("color") { describe("color") {
it("should validate color string ") { it("should validate color string ") {
val messages = Messages() val messages = Messages()
assert(color.validate("color", "#88aaff", messages) === None) assert(color.validate("color", "#88aaff", messages) == None)
assert(color.validate("color", "#gghhii", messages) === Some("color must be '#[0-9a-fA-F]{6}'.")) assert(color.validate("color", "#gghhii", messages) == Some("color must be '#[0-9a-fA-F]{6}'."))
} }
} }
@@ -29,7 +29,7 @@ class ValidationsSpec extends FunSpec with Validations {
// } // }
it("should convert date string ") { it("should convert date string ") {
val result = date().convert("2013-10-05", null) val result = date().convert("2013-10-05", null)
assert(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(result) === "2013-10-05 00:00:00") assert(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(result) == "2013-10-05 00:00:00")
} }
} }