Skip to content

Commit

Permalink
add test related to bug-69147
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918499 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
pjfanning committed Jun 21, 2024
1 parent 2a47c18 commit 461691e
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
import java.text.DateFormatSymbols;
import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
import java.util.TimeZone;
Expand All @@ -33,6 +34,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.StringEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.util.LocaleUtil;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -278,6 +280,12 @@ void testTextBooleanWithNumberFormat() {
testText(BoolEval.FALSE, new StringEval("#0.000"), BoolEval.FALSE.getStringValue());
}

@Test
void testTextMMM() {
LocalDate ld = LocalDate.parse("2022-02-28");
testText(new NumberEval(DateUtil.getExcelDate(ld)), new StringEval("MMM"), "Feb");
}

private void testText(ValueEval valueArg, ValueEval formatArg, String expectedResult) {
ValueEval[] args = { valueArg, formatArg };
ValueEval result = TextFunction.TEXT.evaluate(args, -1, -1);
Expand Down

0 comments on commit 461691e

Please sign in to comment.