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 @@ -67,6 +67,16 @@ public void tearDown() throws Exception
6767 shell .execute ( "MATCH (n) DETACH DELETE (n)" );
6868 }
6969
70+ @ Test
71+ public void parseDuration () throws CommandException
72+ {
73+ //when
74+ shell .execute ( "RETURN duration({months:0.75})" );
75+
76+ //then
77+ assertThat ( linePrinter .output (), containsString ( "P22DT19H51M49.5S" ) );
78+ }
79+
7080 @ Test
7181 public void cypherWithNoReturnStatements () throws CommandException
7282 {
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 ;
@@ -210,6 +211,8 @@ default String formatValue( final Value value )
210211 return pathAsString ( value .asPath () );
211212 case POINT :
212213 return pointAsString ( value .asPoint () );
214+ case DURATION :
215+ return DurationValue .parse ( value .toString () ).prettyPrint ();
213216 case ANY :
214217 case BOOLEAN :
215218 case BYTES :
@@ -222,7 +225,6 @@ default String formatValue( final Value value )
222225 case DATE_TIME :
223226 case LOCAL_TIME :
224227 case LOCAL_DATE_TIME :
225- case DURATION :
226228 case NULL :
227229 default :
228230 return value .toString ();
You can’t perform that action at this time.
0 commit comments