Skip to content

Commit

Permalink
fix(test): Update the regex in test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Mishra <mishra.gaurav@siemens.com>
  • Loading branch information
GMishx committed Oct 6, 2021
1 parent 35828eb commit 444833e
Show file tree
Hide file tree
Showing 21 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion nirjas/languages/tests/test_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
comment_single = readSingleLine(self.testfile, regex)
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_c_sharp.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
comment_single = readSingleLine(self.testfile, regex)
Expand All @@ -51,7 +51,7 @@ def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
expected = c_sharp.c_sharpExtractor(self.testfile).get_dict()
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
comment_single = readSingleLine(self.testfile, regex)
Expand All @@ -50,7 +50,7 @@ def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
expected = cpp.cppExtractor(self.testfile).get_dict()
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_go.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
comment_single = readSingleLine(self.testfile, regex)
Expand All @@ -50,7 +50,7 @@ def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
expected = go.goExtractor(self.testfile).get_dict()
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_haskell.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''\-\-\s*(.*)'''
regex = r'''(?<!["'`])\-\-\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
comment_single = readSingleLine(self.testfile, regex)
Expand All @@ -50,7 +50,7 @@ def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''\-\-\s*(.*)'''
regex = r'''(?<!["'`])\-\-\s*(.*)'''
syntax_start = "{-"
syntax_end = "-}"
expected = haskell.haskellExtractor(self.testfile).get_dict()
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
comment_single = readSingleLine(self.testfile, regex)
Expand All @@ -51,7 +51,7 @@ def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
expected = java.javaExtractor(self.testfile).get_dict()
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
comment_single = readSingleLine(self.testfile, regex)
Expand All @@ -51,7 +51,7 @@ def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
expected = javascript.javascriptExtractor(self.testfile).get_dict()
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_kotlin.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
comment_single = readSingleLine(self.testfile, regex)
Expand All @@ -50,7 +50,7 @@ def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
expected = kotlin.kotlinExtractor(self.testfile).get_dict()
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_matlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''\%\s*(.*)'''
regex = r'''(?<!["'`])\%\s*(.*)'''
syntax_start = "%{"
syntax_end = "%}"
comment_single = readSingleLine(self.testfile, regex)
Expand All @@ -50,7 +50,7 @@ def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''\%\s*(.*)'''
regex = r'''(?<!["'`])\%\s*(.*)'''
syntax_start = "%{"
syntax_end = "%}"
expected = matlab.matlabExtractor(self.testfile).get_dict()
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_perl.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''#+\s*(.*)'''
regex = r'''(?<!["'`])#+\s*(.*)'''
syntax_start = "=begin"
syntax_end = "=cut"
comment_single = readSingleLine(self.testfile, regex)
Expand All @@ -50,7 +50,7 @@ def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''#+\s*(.*)'''
regex = r'''(?<!["'`])#+\s*(.*)'''
syntax_start = "=begin"
syntax_end = "=cut"
expected = perl.perlExtractor(self.testfile).get_dict()
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_php.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
comment_single = readSingleLine(self.testfile, regex)
Expand All @@ -50,7 +50,7 @@ def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
expected = php.phpExtractor(self.testfile).get_dict()
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''#+\s*(.*)'''
regex = r'''(?<!["'`])#+\s*(.*)'''
syntax_single = "'''"
syntax_double = '"""'
comment_multi_single = readMultiLineSame(self.testfile, syntax_single)
Expand All @@ -51,7 +51,7 @@ def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''#+\s*(.*)'''
regex = r'''(?<!["'`])#+\s*(.*)'''
syntax_single = "'''"
syntax_double = '"""'
expected = python.pythonExtractor(self.testfile).get_dict()
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_r.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''#+\s*(.*)'''
regex = r'''(?<!["'`])#+\s*(.*)'''
comment_single = readSingleLine(self.testfile, regex)
self.assertTrue(comment_single)

def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''#+\s*(.*)'''
regex = r'''(?<!["'`])#+\s*(.*)'''
expected = r.rExtractor(self.testfile).get_dict()
comment_single = readSingleLine(self.testfile, regex)
file = self.testfile.split("/")
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_ruby.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''#+\s*(.*)'''
regex = r'''(?<!["'`])#+(?!\{)\s*(.*)'''
syntax_start = "=begin"
syntax_end = "=end"
comment_single = readSingleLine(self.testfile, regex)
Expand All @@ -50,7 +50,7 @@ def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''#+\s*(.*)'''
regex = r'''(?<!["'`])#+(?!\{)\s*(.*)'''
syntax_start = "=begin"
syntax_end = "=cut"
expected = ruby.rubyExtractor(self.testfile).get_dict()
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
comment_single = readSingleLine(self.testfile, regex)
Expand All @@ -50,7 +50,7 @@ def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
expected = rust.rustExtractor(self.testfile).get_dict()
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_scala.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
comment_single = readSingleLine(self.testfile, regex)
Expand All @@ -51,7 +51,7 @@ def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
expected = scala.scalaExtractor(self.testfile).get_dict()
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_scss.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_output(self):
Check for the scan correctness.
'''
regex1 = r'''(?<!\/)\/\/(?!\/)\s*(.*)'''
regex2 = r'''\/\/\/\s*(.*)'''
regex2 = r'''(?<!["'`])\/\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
comment_single_doubleSlash = readSingleLine(self.testfile, regex1)
Expand All @@ -59,7 +59,7 @@ def test_outputFormat(self):
Check for the output format correctness.
'''
regex1 = r'''(?<!\/)\/\/(?!\/)\s*(.*)'''
regex2 = r'''\/\/\/\s*(.*)'''
regex2 = r'''(?<!["'`])\/\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
expected = scss.scssExtractor(self.testfile).get_dict()
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''#+\s*(.*)'''
regex = r'''(?<!["'`])#+\s*(.*)'''
comment_single = readSingleLine(self.testfile, regex)
self.assertTrue(comment_single)

def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''#+\s*(.*)'''
regex = r'''(?<!["'`])#+\s*(.*)'''
expected = shell.shellExtractor(self.testfile).get_dict()
comment_single = readSingleLine(self.testfile, regex)
comment_contSingleline = contSingleLines(comment_single)
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_swift.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
comment_single = readSingleLine(self.testfile, regex)
Expand All @@ -51,7 +51,7 @@ def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = "*/"
expected = swift.swiftExtractor(self.testfile).get_dict()
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/tests/test_typescript.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_output(self):
'''
Check for the scan correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
comment_single = readSingleLine(self.testfile, regex)
Expand All @@ -52,7 +52,7 @@ def test_outputFormat(self):
'''
Check for the output format correctness.
'''
regex = r'''(?<![pst]:)\/\/\s*(.*)'''
regex = r'''(?<![pst'"`]:)\/\/\s*(.*)'''
syntax_start = "/*"
syntax_end = '*/'
expected = typescript.typescriptExtractor(self.testfile).get_dict()
Expand Down
2 changes: 1 addition & 1 deletion testScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def download_files(cwd):
ext = file_name[-1]
with urllib.request.urlopen(url) as data:
filename = "textcomment." + ext
with open(os.path.join(directory, filename), 'w') as newfile:
with open(os.path.join(directory, filename), 'w', encoding='utf-8') as newfile:
newfile.write(data.read().decode('utf-8'))
print(".", end="")
print()
Expand Down

0 comments on commit 444833e

Please sign in to comment.