This repository was archived by the owner on Jul 6, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
integration-test/java/org/neo4j/shell/commands
main/java/org/neo4j/shell/prettyprint Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,16 @@ public void tearDown() throws Exception
7474 shell .execute ( "MATCH (n) DETACH DELETE (n)" );
7575 }
7676
77+ @ Test
78+ public void parseDuration () throws CommandException
79+ {
80+ //when
81+ shell .execute ( "RETURN duration({months:0.75})" );
82+
83+ //then
84+ assertThat ( linePrinter .output (), containsString ( "P22DT19H51M49.5S" ) );
85+ }
86+
7787 @ Test
7888 public void cypherWithNoReturnStatements () throws CommandException
7989 {
Original file line number Diff line number Diff line change 3939import org .neo4j .driver .types .Point ;
4040import org .neo4j .driver .types .Relationship ;
4141import org .neo4j .shell .state .BoltResult ;
42+ import org .neo4j .values .storable .DurationValue ;
4243
4344import static java .util .Arrays .asList ;
4445import static java .util .concurrent .TimeUnit .MILLISECONDS ;
@@ -205,6 +206,8 @@ default String formatValue( final Value value )
205206 return pathAsString ( value .asPath () );
206207 case POINT :
207208 return pointAsString ( value .asPoint () );
209+ case DURATION :
210+ return DurationValue .parse ( value .toString () ).prettyPrint ();
208211 case ANY :
209212 case BOOLEAN :
210213 case BYTES :
@@ -217,7 +220,6 @@ default String formatValue( final Value value )
217220 case DATE_TIME :
218221 case LOCAL_TIME :
219222 case LOCAL_DATE_TIME :
220- case DURATION :
221223 case NULL :
222224 default :
223225 return value .toString ();
You can’t perform that action at this time.
0 commit comments