use of com.amazon.ion.Span in project ion-java by amzn.
the class SeekableReaderTest method testWalkingBackwards.
@Test
public void testWalkingBackwards() {
if (getStreamingMode() == StreamingMode.NEW_STREAMING_INCREMENTAL) {
// See ion-java/issues/382 and ion-java/issues/383.
return;
}
String text = "null true 3 4e0 5.0 6666-06-06T '7' \"8\" {{\"\"}} {{}} [] () {}";
IonDatagram dg = loader().load(text);
Span[] positions = new Span[dg.size()];
read(text);
for (int i = 0; i < dg.size(); i++) {
assertEquals(dg.get(i).getType(), in.next());
positions[i] = sr.currentSpan();
}
expectEof();
checkSpans(dg, positions);
// Collect spans *after* extracting scalar body.
read(text);
for (int i = 0; i < dg.size(); i++) {
IonType t = in.next();
assertEquals(dg.get(i).getType(), t);
if (!IonType.isContainer(t)) {
TestUtils.consumeCurrentValue(in);
}
positions[i] = sr.currentSpan();
}
expectTopEof();
checkSpans(dg, positions);
}
use of com.amazon.ion.Span in project ion-java by amzn.
the class SeekableReaderTest method testTrivialSpan.
@Test
public void testTrivialSpan() {
if (getStreamingMode() == StreamingMode.NEW_STREAMING_INCREMENTAL) {
// See ion-java/issues/382 and ion-java/issues/383.
return;
}
String text = "null";
read(text);
in.next();
Span s = sr.currentSpan();
expectTopEof();
hoist(s);
assertSame(IonType.NULL, in.next());
expectTopLevel();
expectTopEof();
}
use of com.amazon.ion.Span in project ion-java by amzn.
the class SeekableReaderTest method testHoistingAnnotatedTopLevelValue.
@Test
public void testHoistingAnnotatedTopLevelValue() throws IOException {
if (getStreamingMode() == StreamingMode.NEW_STREAMING_INCREMENTAL) {
// See ion-java/issues/382 and ion-java/issues/383.
return;
}
read("a::v");
in.next();
Span span = sr.currentSpan();
expectTopEof();
hoist(span);
assertSame(IonType.SYMBOL, in.next());
expectTopLevel();
Assert.assertArrayEquals(new String[] { "a" }, in.getTypeAnnotations());
expectTopEof();
}
use of com.amazon.ion.Span in project ion-java by amzn.
the class SpanReaderTest method testCurrentSpanWithinContainers.
@Test
public void testCurrentSpanWithinContainers() {
if (getStreamingMode() == StreamingMode.NEW_STREAMING_INCREMENTAL) {
// See ion-java/issues/382 and ion-java/issues/383.
return;
}
read("{f:v,g:[c]} s");
in.next();
in.stepIn();
in.next();
Span fPos = sp.currentSpan();
assertEquals("v", in.stringValue());
in.next();
Span gPos = sp.currentSpan();
in.stepIn();
in.next();
assertEquals("c", in.stringValue());
Span cPos = sp.currentSpan();
expectEof();
in.stepOut();
expectEof();
in.stepOut();
in.next();
Span sPos = sp.currentSpan();
expectTopEof();
}
Aggregations