Skip to content

Commit

Permalink
Just adding some new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bdw429s committed Jul 1, 2024
1 parent 41044f9 commit 5330de3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/test/java/TestCases/phase3/ClassTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,7 @@ public void testStaticImportDot() {
myInstance = new StaticTest();
result7 = myInstance.foo;
result8 = StaticTest.foo;
result9 = myInstance.myInstanceFunc2()
""", context, BoxSourceType.BOXSCRIPT );
assertThat( variables.get( Key.of( "result1" ) ) ).isEqualTo( 9000 );
assertThat( variables.get( Key.of( "result2" ) ) ).isEqualTo( "static9000" );
Expand All @@ -1118,6 +1119,12 @@ public void testStaticImportDot() {
assertThat( variables.get( Key.of( "result6" ) ) ).isEqualTo( "luis" );
assertThat( variables.get( Key.of( "result7" ) ) ).isEqualTo( 42 );
assertThat( variables.get( Key.of( "result8" ) ) ).isEqualTo( 42 );
assertThat( variables.get( Key.of( "result9" ) ) ).isInstanceOf( Array.class );
Array result9 = variables.getAsArray( Key.of( "result9" ) );
assertThat( result9.size() ).isEqualTo( 3 );
assertThat( result9.get( 0 ) ).isEqualTo( "brad" );
assertThat( result9.get( 1 ) ).isEqualTo( "wood" );
assertThat( result9.get( 2 ) ).isEqualTo( 42 );
}

@Test
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/TestCases/phase3/StaticTest.bx
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ class {
return "instance" & myStaticFunc();
}

array function myInstanceFunc2() {
return [static.scoped,
static.unscoped,
static.foo];
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,17 @@ public void testWithLocale() {
public void testBifUKSeparator() {
assertFalse( ( Boolean ) instance.executeStatement( "IsNumeric( '999#char(160)#999', 'en_UK' )" ) );
}

@DisplayName( "It tests a date" )
@Test
public void testADate() {
instance.executeSource(
"""
myDate = createObject("java", "java.sql.Date").valueOf("2011-03-24")
result = isNumeric(myDate)
""",
context );
assertFalse( variables.getAsBoolean( Key.of( "result" ) ) );
}

}

0 comments on commit 5330de3

Please sign in to comment.