Skip to content

Commit

Permalink
Retrieving a number field from an object does not convert 1.0 to 1 #40
Browse files Browse the repository at this point in the history
  • Loading branch information
aeberhart committed May 24, 2024
1 parent 9e61c40 commit b73bc4c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/test/java/com/dashjoin/jsonata/NumberTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.dashjoin.jsonata;

import static com.dashjoin.jsonata.Jsonata.jsonata;
import static java.util.Arrays.asList;
import static java.util.Map.of;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

public class NumberTest {

@Disabled
@Test
public void testDouble() {
Jsonata expr1 = jsonata("x");
var res = expr1.evaluate(of("x", 1.0));
System.out.println(res);
assertEquals(1, res);
}

@Test
public void testConst() {
Jsonata expr1 = jsonata("1.0");
var res = expr1.evaluate(of("key", asList(of("x", "y"), of("a", "b"))));
System.out.println(res);
assertEquals(1, res);
}
}

0 comments on commit b73bc4c

Please sign in to comment.