Skip to content
Permalink
Browse files

Added failing test case.

  • Loading branch information...
jose committed Nov 19, 2018
1 parent f76d2e1 commit ff197e52de137b3084ff91fdf8e0eb5af72f329b
@@ -0,0 +1,14 @@
package foo.bar;

import org.junit.Test;

import static org.junit.Assert.assertNotNull;

public class Regex {

@Test
public void test0() {
String str = "\\s*(?:'((?:\\\\'|[^'])*?)'|\"((?:\\\\\"|[^\"])*?)\")\\s*";
assertNotNull(str)
}
}
@@ -0,0 +1,17 @@
package foo.bar;

import org.junit.Test;

import static org.junit.Assert.assertNotNull;

public class Regex {

@Test
public void test0() {}
// Defects4J: flaky method
// @Test
// public void test0() {
// String str = "\\s*(?:'((?:\\\\'|[^'])*?)'|\"((?:\\\\\"|[^\"])*?)\")\\s*";
// assertNotNull(str)
// }
}
@@ -0,0 +1,14 @@
package foo.bar;

import org.junit.Test;

import static org.junit.Assert.assertNotNull;

public class Regex {

@Test
public void test0() {
String str = "\\s*(?:'((?:\\\\'|[^'])*?)'|\"((?:\\\\\"|[^\"])*?)\")\\s*";
assertNotNull(str)
}
}
@@ -292,10 +292,42 @@ test_InvalidCharacters() { # Issue 105
return 0
}

test_RegexString() { # Issue 184
local suites_dir="$TMP_DIR/test_RegexString"

local pid="Math"
local bid="1b"

run_fix_test_suite_test_case "$pid" "$bid" \
"foo/bar/Regex.java" "foo/bar/Regex.java foo/bar/Regex.java.bak" \
"$suites_dir" || return 1

if ! perl -e 'use DBI; use DBD::CSV;' 2>/dev/null; then
echo "Warning: Please make sure perl modules 'DBI' and 'DBD:CSV' are installed."
return 0
fi

run_fix_test_suite_test_case "$pid" "$bid" \
"foo/bar/Regex.java" "foo/bar/Regex.java foo/bar/Regex.java.bak" \
"$suites_dir" \
"-L" || return 1

# Columns of 'fix' database file:
# project_id,version_id,test_suite_source,test_id,num_uncompilable_tests,num_uncompilable_test_classes,num_failing_tests
local expected_db_data="$pid,$bid,test,1,1,0,0"
_check_fix_db "$suites_dir/fix" "$expected_db_data" || return 1

# Clean up
rm -rf "$suites_dir"

return 0
}

test_FailingTests || die "Test 'test_FailingTests' has failed!"
test_InvalidImport || die "Test 'test_InvalidImport' has failed!"
test_UnitTestsWithCompilationIssues || die "Test 'test_UnitTestsWithCompilationIssues' has failed!"
test_ValidTestClass || die "Test 'test_ValidTestClass' has failed!"
test_LineCommentsWithWhitespaces || die "Test 'test_LineCommentsWithWhitespaces' has failed!"
test_InvalidCharacters || die "Test 'test_InvalidCharacters' has failed!"
test_RegexString || die "Test 'test_RegexString' has failed!"

0 comments on commit ff197e5

Please sign in to comment.
You can’t perform that action at this time.