Skip to content

Conversation

@CelsoSimoes
Copy link

New regression tests; attempt to find edge cases.

Copy link
Contributor

@flavluc flavluc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CelsoSimoes The PR looks good, but there are some changes that need to be done. Mostly removing comments and commented code.

Also, a person should be able to tell what is being tested just by looking at the test case. What is error-1 inside syntax-error folder? Can you give it a more descriptive name? What about the others?

@@ -0,0 +1,16 @@
import Syntax;
// Esse teste PASSA. (Baseado no WrongName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the comments

}

@Test
@DisplayName("Should return a null pointer Error") // kotlin.KotlinNullPointerException
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give it a more descriptive name. What is this test case testing?

val file = "src/test/fixtures/syntax-error/error-1/Main.hp"
val priority = listOf("Actors", "Actions", "Resources")
val exception = assertFailsWith<Exception> { IR.generate(file, priority) }
assertEquals(null, exception.message)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Errors should be handled with a descriptive message instead of a not cool KotlinNullPointerException. What would be a good message that make explicit the error that is occurring?

fun shouldReturnSyntaxError2() {
val file = "src/test/fixtures/syntax-error/error-2/Main.hp"
val priority = listOf("Actors", "Actions", "Resources")
//val exception = assertFailsWith<Exception> { IR.generate(file, priority) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments

}

@Test
@DisplayName("Should DENY Alice Reads CCN") // Or Should return a Syntax Error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this testing a syntax error? which one?

@CelsoSimoes
Copy link
Author

Done:

  • Refactored tests, with folder changes to try to fit a theme better;
  • Comments removed;
  • Suggestive Names added;

What's next:

  • Make the 2 failed checks pass. For this:
    • Add a 'more cool' message for a KotlinNullPointerException instead of just <null>;
    • Define what kind of error the program should appoint when theres an DENY after an ALLOW on imported variables;
      exemplified on Test "Should return a syntax error on imported variable: DENY after an ALLOW".

Yowgf pushed a commit that referenced this pull request Dec 29, 2020
* build(docker): Docker file created

* build(script): Build script DONE

* fix(gitignore): removign unecessary directories

* fix(comments): Removing unecessary comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants