From e89a6f2dde83e1f4556f9499da1ffcf3468b6e50 Mon Sep 17 00:00:00 2001 From: Mike Cifelli Date: Sun, 12 Mar 2017 12:19:45 -0400 Subject: [PATCH] Add unit tests for the backquote facility Renamed BackTick to Backquote globally. --- ...Evaluator.java => BackquoteEvaluator.java} | 33 +++++--- src/function/builtin/EVAL.java | 4 +- ...pression.java => BackquoteExpression.java} | 6 +- src/sexpression/SExpression.java | 2 +- src/token/{BackTick.java => Backquote.java} | 6 +- src/token/TokenFactoryImpl.java | 4 +- src/util/Characters.java | 4 +- ...ter.java => BackquoteEvaluatorTester.java} | 76 ++++++++++++------- test/function/builtin/EVALTester.java | 34 +++++---- test/scanner/LispScannerTypeTester.java | 2 +- test/sexpression/SExpressionTester.java | 9 ++- test/testutil/TestUtilities.java | 24 ++++-- test/testutil/TypeAssertions.java | 16 ++-- test/token/TokenFactoryTester.java | 2 +- 14 files changed, 137 insertions(+), 85 deletions(-) rename src/function/builtin/{BackTickEvaluator.java => BackquoteEvaluator.java} (84%) rename src/sexpression/{BackTickExpression.java => BackquoteExpression.java} (65%) rename src/token/{BackTick.java => Backquote.java} (70%) rename test/function/builtin/{BackTickEvaluatorTester.java => BackquoteEvaluatorTester.java} (57%) diff --git a/src/function/builtin/BackTickEvaluator.java b/src/function/builtin/BackquoteEvaluator.java similarity index 84% rename from src/function/builtin/BackTickEvaluator.java rename to src/function/builtin/BackquoteEvaluator.java index 1459728..c882423 100644 --- a/src/function/builtin/BackTickEvaluator.java +++ b/src/function/builtin/BackquoteEvaluator.java @@ -4,16 +4,21 @@ import static function.builtin.EVAL.eval; import static sexpression.Nil.NIL; import error.LispException; +import function.ArgumentValidator; import sexpression.*; -class BackTickEvaluator { +class BackquoteEvaluator { - private BackTickExpression backTick; + private ArgumentValidator listValidator; + private ArgumentValidator atSignValidator; + private BackquoteExpression backTick; private Cons resolvedList; private Cons leader; private Cons follower; - public BackTickEvaluator(BackTickExpression backTick) { + public BackquoteEvaluator(BackquoteExpression backTick) { + this.listValidator = new ArgumentValidator("`|list|"); + this.atSignValidator = new ArgumentValidator("@|list|"); this.backTick = backTick; this.resolvedList = new Cons(NIL, NIL); this.leader = resolvedList; @@ -34,6 +39,7 @@ class BackTickEvaluator { } public SExpression resolveList(Cons list) { + listValidator.validate(list); createResolvedList(list); return resolvedList; @@ -81,22 +87,29 @@ class BackTickEvaluator { private Cons evaluateAtSign(AtSignExpression atSign) { SExpression expression = atSign.getExpression(); - validateAtSignExpression(expression); - SExpression result = eval(expression); + validateAtSignUnevaluatedExpression(expression); + SExpression evaluation = eval(expression); - if (!result.isList()) - throw new AtSignNotListException(); - - return (Cons) result; + return getValidatedList(evaluation); } - private void validateAtSignExpression(SExpression expression) { + private void validateAtSignUnevaluatedExpression(SExpression expression) { if (expression.isComma()) throw new NestedCommaException(); else if (expression.isAtSign()) throw new NestedAtSignException(); } + private Cons getValidatedList(SExpression evaluation) { + if (!evaluation.isList()) + throw new AtSignNotListException(); + + Cons evaluatedList = (Cons) evaluation; + atSignValidator.validate(evaluatedList); + + return evaluatedList; + } + private void unpackResolvedList(Cons list) { for (; list.isCons(); list = (Cons) list.getRest()) addResolvedExpression(list.getFirst()); diff --git a/src/function/builtin/EVAL.java b/src/function/builtin/EVAL.java index e24098a..8627a38 100644 --- a/src/function/builtin/EVAL.java +++ b/src/function/builtin/EVAL.java @@ -70,7 +70,7 @@ public class EVAL extends LispFunction { return evaluateList(argument); else if (argument.isSymbol()) return evaluateSymbol(argument); - else if (argument.isBackTick()) + else if (argument.isBackquote()) return evaluateBackTick(argument); else if (argument.isComma()) throw new UnmatchedCommaException(); @@ -133,7 +133,7 @@ public class EVAL extends LispFunction { } private SExpression evaluateBackTick(SExpression argument) { - BackTickEvaluator evaluator = new BackTickEvaluator((BackTickExpression) argument); + BackquoteEvaluator evaluator = new BackquoteEvaluator((BackquoteExpression) argument); return evaluator.evaluate(); } diff --git a/src/sexpression/BackTickExpression.java b/src/sexpression/BackquoteExpression.java similarity index 65% rename from src/sexpression/BackTickExpression.java rename to src/sexpression/BackquoteExpression.java index f76aad0..2d8fe73 100644 --- a/src/sexpression/BackTickExpression.java +++ b/src/sexpression/BackquoteExpression.java @@ -1,10 +1,10 @@ package sexpression; -public class BackTickExpression extends SExpression { +public class BackquoteExpression extends SExpression { private SExpression expression; - public BackTickExpression(SExpression expression) { + public BackquoteExpression(SExpression expression) { this.expression = expression; } @@ -12,7 +12,7 @@ public class BackTickExpression extends SExpression { return expression; } - public boolean isBackTick() { + public boolean isBackquote() { return true; } diff --git a/src/sexpression/SExpression.java b/src/sexpression/SExpression.java index ff8bf76..acc99ed 100644 --- a/src/sexpression/SExpression.java +++ b/src/sexpression/SExpression.java @@ -35,7 +35,7 @@ public abstract class SExpression { return false; } - public boolean isBackTick() { + public boolean isBackquote() { return false; } diff --git a/src/token/BackTick.java b/src/token/Backquote.java similarity index 70% rename from src/token/BackTick.java rename to src/token/Backquote.java index 91648f7..f9a6f83 100644 --- a/src/token/BackTick.java +++ b/src/token/Backquote.java @@ -5,9 +5,9 @@ import java.util.function.Supplier; import file.FilePosition; import sexpression.*; -public class BackTick extends Token { +public class Backquote extends Token { - public BackTick(String text, FilePosition position) { + public Backquote(String text, FilePosition position) { super(text, position); } @@ -16,7 +16,7 @@ public class BackTick extends Token { Token nextToken = getNextToken.get(); SExpression argument = nextToken.parseSExpression(getNextToken); - return new BackTickExpression(argument); + return new BackquoteExpression(argument); } } diff --git a/src/token/TokenFactoryImpl.java b/src/token/TokenFactoryImpl.java index d1db477..56ea29a 100644 --- a/src/token/TokenFactoryImpl.java +++ b/src/token/TokenFactoryImpl.java @@ -22,8 +22,8 @@ public class TokenFactoryImpl implements TokenFactory { return new QuoteMark(text, position); case DOUBLE_QUOTE: return new QuotedString(text, position); - case BACK_TICK: - return new BackTick(text, position); + case BACKQUOTE: + return new Backquote(text, position); case AT_SIGN: return new AtSign(text, position); case COMMA: diff --git a/src/util/Characters.java b/src/util/Characters.java index 2720d8e..fd2092e 100644 --- a/src/util/Characters.java +++ b/src/util/Characters.java @@ -9,8 +9,8 @@ public final class Characters { public static final int EOF = -1; public static final char AT_SIGN = '@'; + public static final char BACKQUOTE = '`'; public static final char BACKSLASH = '\\'; - public static final char BACK_TICK = '`'; public static final char COMMA = ','; public static final char DASH = '-'; public static final char DOUBLE_QUOTE = '\"'; @@ -29,8 +29,8 @@ public final class Characters { static { illegalIdentifierCharacters.add(AT_SIGN); + illegalIdentifierCharacters.add(BACKQUOTE); illegalIdentifierCharacters.add(BACKSLASH); - illegalIdentifierCharacters.add(BACK_TICK); illegalIdentifierCharacters.add(COMMA); illegalIdentifierCharacters.add(DOUBLE_QUOTE); illegalIdentifierCharacters.add(HASH); diff --git a/test/function/builtin/BackTickEvaluatorTester.java b/test/function/builtin/BackquoteEvaluatorTester.java similarity index 57% rename from test/function/builtin/BackTickEvaluatorTester.java rename to test/function/builtin/BackquoteEvaluatorTester.java index 629729e..571b3c4 100644 --- a/test/function/builtin/BackTickEvaluatorTester.java +++ b/test/function/builtin/BackquoteEvaluatorTester.java @@ -1,22 +1,24 @@ package function.builtin; import static sexpression.Nil.NIL; +import static sexpression.Symbol.T; import static testutil.TestUtilities.*; import org.junit.Test; -import function.builtin.BackTickEvaluator.*; +import function.ArgumentValidator.DottedArgumentListException; +import function.builtin.BackquoteEvaluator.*; import sexpression.*; -public class BackTickEvaluatorTester { +public class BackquoteEvaluatorTester { - private BackTickEvaluator createBackTickEvaluator(SExpression expression) { - return new BackTickEvaluator(new BackTickExpression(expression)); + private BackquoteEvaluator createBackquoteEvaluator(SExpression expression) { + return new BackquoteEvaluator(new BackquoteExpression(expression)); } @Test public void evaluateNil() { - BackTickEvaluator evaluator = createBackTickEvaluator(NIL); + BackquoteEvaluator evaluator = createBackquoteEvaluator(NIL); assertSExpressionsMatch(NIL, evaluator.evaluate()); } @@ -24,7 +26,7 @@ public class BackTickEvaluatorTester { @Test public void evaluateNumber() { SExpression input = new LispNumber("99"); - BackTickEvaluator evaluator = createBackTickEvaluator(input); + BackquoteEvaluator evaluator = createBackquoteEvaluator(input); assertSExpressionsMatch(input, evaluator.evaluate()); } @@ -32,7 +34,7 @@ public class BackTickEvaluatorTester { @Test public void evaluateList() { SExpression input = makeList(new LispNumber("1"), new LispNumber("99")); - BackTickEvaluator evaluator = createBackTickEvaluator(input); + BackquoteEvaluator evaluator = createBackquoteEvaluator(input); assertSExpressionsMatch(input, evaluator.evaluate()); } @@ -40,7 +42,7 @@ public class BackTickEvaluatorTester { @Test public void evaluateComma() { SExpression input = new CommaExpression(makeList(new Symbol("+"), new LispNumber("1"), new LispNumber("9"))); - BackTickEvaluator evaluator = createBackTickEvaluator(input); + BackquoteEvaluator evaluator = createBackquoteEvaluator(input); assertSExpressionsMatch(new LispNumber("10"), evaluator.evaluate()); } @@ -49,7 +51,7 @@ public class BackTickEvaluatorTester { public void evaluateListWithComma() { SExpression input = makeList(new CommaExpression(makeList(new Symbol("+"), new LispNumber("1"), new LispNumber("9")))); - BackTickEvaluator evaluator = createBackTickEvaluator(input); + BackquoteEvaluator evaluator = createBackquoteEvaluator(input); assertSExpressionsMatch(makeList(new LispNumber("10")), evaluator.evaluate()); } @@ -57,7 +59,7 @@ public class BackTickEvaluatorTester { @Test(expected = NestedCommaException.class) public void evaluateListWithNestedComma() { SExpression input = makeList(new CommaExpression(new CommaExpression(new Symbol("+")))); - BackTickEvaluator evaluator = createBackTickEvaluator(input); + BackquoteEvaluator evaluator = createBackquoteEvaluator(input); evaluator.evaluate(); } @@ -65,7 +67,7 @@ public class BackTickEvaluatorTester { @Test(expected = AtSignNotInCommaException.class) public void evaluateListWithNoCommaPrecedingAtSign() { SExpression input = makeList(new AtSignExpression(makeList(new Symbol("+")))); - BackTickEvaluator evaluator = createBackTickEvaluator(input); + BackquoteEvaluator evaluator = createBackquoteEvaluator(input); evaluator.evaluate(); } @@ -73,7 +75,7 @@ public class BackTickEvaluatorTester { @Test(expected = AtSignNotInCommaException.class) public void evaluateAtSign() { SExpression input = new AtSignExpression(makeList(new Symbol("+"))); - BackTickEvaluator evaluator = createBackTickEvaluator(input); + BackquoteEvaluator evaluator = createBackquoteEvaluator(input); evaluator.evaluate(); } @@ -81,7 +83,7 @@ public class BackTickEvaluatorTester { @Test(expected = NestedAtSignException.class) public void evaluateListWithNestedAtSigns() { SExpression input = makeList(new CommaExpression(new AtSignExpression(new AtSignExpression(makeList(new Symbol("+")))))); - BackTickEvaluator evaluator = createBackTickEvaluator(input); + BackquoteEvaluator evaluator = createBackquoteEvaluator(input); evaluator.evaluate(); } @@ -89,7 +91,7 @@ public class BackTickEvaluatorTester { @Test(expected = NestedCommaException.class) public void evaluateListWithCommaAfterAtSign() { SExpression input = makeList(new CommaExpression(new AtSignExpression(new CommaExpression(makeList(new Symbol("+")))))); - BackTickEvaluator evaluator = createBackTickEvaluator(input); + BackquoteEvaluator evaluator = createBackquoteEvaluator(input); evaluator.evaluate(); } @@ -100,7 +102,7 @@ public class BackTickEvaluatorTester { new LispNumber("1"), new LispNumber("9"))))); SExpression expected = makeList(new LispNumber("1"), new LispNumber("9")); - BackTickEvaluator evaluator = createBackTickEvaluator(input); + BackquoteEvaluator evaluator = createBackquoteEvaluator(input); assertSExpressionsMatch(expected, evaluator.evaluate()); } @@ -108,28 +110,50 @@ public class BackTickEvaluatorTester { @Test(expected = AtSignNotListException.class) public void atSignDoesNotEvaluateToList() { SExpression input = makeList(new CommaExpression(new AtSignExpression(new LispNumber("1")))); - BackTickEvaluator evaluator = createBackTickEvaluator(input); + BackquoteEvaluator evaluator = createBackquoteEvaluator(input); evaluator.evaluate(); } @Test public void evaluateListWithCommasAndAtSign() { - SExpression input = makeList(new LispNumber("78"), - new CommaExpression(new AtSignExpression(makeList(new Symbol("LIST"), - new LispNumber("1"), - new LispNumber("9")))), - new CommaExpression(makeList(new Symbol("+"), new LispNumber("20"), - new LispNumber("5"))), - new CommaExpression(makeList(new Symbol("LIST"), new LispNumber("7"), - new LispNumber("6"))), - new LispString("\"sky\"")); + Cons list1 = makeList(new Symbol("LIST"), new LispNumber("1"), new LispNumber("9")); + Cons list2 = makeList(new Symbol("+"), new LispNumber("20"), new LispNumber("5")); + Cons list3 = makeList(new Symbol("LIST"), new LispNumber("7"), new LispNumber("6")); + + SExpression input = makeList(new LispNumber("78"), new CommaExpression(new AtSignExpression(list1)), + new CommaExpression(list2), new CommaExpression(list3), new LispString("\"sky\"")); + SExpression expected = makeList(new LispNumber("78"), new LispNumber("1"), new LispNumber("9"), new LispNumber("25"), makeList(new LispNumber("7"), new LispNumber("6")), new LispString("\"sky\"")); - BackTickEvaluator evaluator = createBackTickEvaluator(input); + + BackquoteEvaluator evaluator = createBackquoteEvaluator(input); assertSExpressionsMatch(expected, evaluator.evaluate()); } + @Test(expected = DottedArgumentListException.class) + public void evaluateDottedList() { + BackquoteEvaluator evaluator = createBackquoteEvaluator(new Cons(T, T)); + + evaluator.evaluate(); + } + + @Test(expected = DottedArgumentListException.class) + public void atSignWithDottedList() { + SExpression input = makeList(new CommaExpression(new AtSignExpression(makeList(new Symbol("CONS"), T, T)))); + BackquoteEvaluator evaluator = createBackquoteEvaluator(input); + + evaluator.evaluate(); + } + + @Test + public void backquoteExceptionsHaveCorrectAttributes() { + assertIsErrorWithMessage(new NestedCommaException()); + assertIsErrorWithMessage(new NestedAtSignException()); + assertIsErrorWithMessage(new AtSignNotInCommaException()); + assertIsErrorWithMessage(new AtSignNotListException()); + } + } diff --git a/test/function/builtin/EVALTester.java b/test/function/builtin/EVALTester.java index 75c7274..2b51bd4 100644 --- a/test/function/builtin/EVALTester.java +++ b/test/function/builtin/EVALTester.java @@ -1,15 +1,14 @@ package function.builtin; -import static error.ErrorManager.Severity.ERROR; import static function.builtin.EVAL.lookupSymbol; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNull; import static sexpression.Nil.NIL; import static testutil.TestUtilities.*; import org.junit.Test; import function.ArgumentValidator.*; -import function.builtin.BackTickEvaluator.AtSignNotInCommaException; +import function.builtin.BackquoteEvaluator.AtSignNotInCommaException; import function.builtin.EVAL.*; public class EVALTester { @@ -84,20 +83,12 @@ public class EVALTester { @Test public void undefinedFunctionException_HasCorrectAttributes() { - UndefinedFunctionException e = new UndefinedFunctionException(NIL); - - assertEquals(ERROR, e.getSeverity()); - assertNotNull(e.getMessage()); - assertTrue(e.getMessage().length() > 0); + assertIsErrorWithMessage(new UndefinedFunctionException(NIL)); } @Test public void undefinedSymbolException_HasCorrectAttributes() { - UndefinedSymbolException e = new UndefinedSymbolException(NIL); - - assertEquals(ERROR, e.getSeverity()); - assertNotNull(e.getMessage()); - assertTrue(e.getMessage().length() > 0); + assertIsErrorWithMessage(new UndefinedSymbolException(NIL)); } @Test(expected = UnmatchedCommaException.class) @@ -137,9 +128,24 @@ public class EVALTester { @Test(expected = AtSignNotInCommaException.class) public void evalBackTickOnAtSign() { - String input = "`@9"; + evaluateString("`@9"); + } + + @Test + public void evalNestedBackquotes() { + String input = "`,`,`,`,9"; assertSExpressionsMatch(parseString("9"), evaluateString(input)); } + @Test + public void unmatchedCommaException_HasCorrectAttributes() { + assertIsErrorWithMessage(new UnmatchedCommaException()); + } + + @Test + public void unmatchedAtSignException_HasCorrectAttributes() { + assertIsErrorWithMessage(new UnmatchedAtSignException()); + } + } diff --git a/test/scanner/LispScannerTypeTester.java b/test/scanner/LispScannerTypeTester.java index 423b40d..f437db5 100644 --- a/test/scanner/LispScannerTypeTester.java +++ b/test/scanner/LispScannerTypeTester.java @@ -281,7 +281,7 @@ public class LispScannerTypeTester { @Test public void givenBackTickExpression_ReturnsCorrectTypes() { String input = "`(list ,a ,@b)"; - expectedTypes.add(BackTick.class); + expectedTypes.add(Backquote.class); expectedTypes.add(LeftParenthesis.class); expectedTypes.add(Identifier.class); expectedTypes.add(Comma.class); diff --git a/test/sexpression/SExpressionTester.java b/test/sexpression/SExpressionTester.java index d679e9f..fafab3d 100644 --- a/test/sexpression/SExpressionTester.java +++ b/test/sexpression/SExpressionTester.java @@ -166,7 +166,7 @@ public class SExpressionTester { @Test public void backTickExpression_ToString() { String expected = "`(TEST)"; - SExpression backTick = new BackTickExpression(makeList(new Symbol("TEST"))); + SExpression backTick = new BackquoteExpression(makeList(new Symbol("TEST"))); assertSExpressionMatchesString(expected, backTick); } @@ -190,8 +190,9 @@ public class SExpressionTester { @Test public void complexBackTickExpression_ToString() { String expected = "`(LIST ,A ,@B)"; - SExpression backTick = new BackTickExpression(makeList(new Symbol("LIST"), new CommaExpression(new Symbol("A")), - new CommaExpression(new AtSignExpression(new Symbol("B"))))); + SExpression backTick = new BackquoteExpression(makeList(new Symbol("LIST"), + new CommaExpression(new Symbol("A")), + new CommaExpression(new AtSignExpression(new Symbol("B"))))); assertSExpressionMatchesString(expected, backTick); } @@ -199,7 +200,7 @@ public class SExpressionTester { @Test public void backTickExpression_GetExpression() { SExpression expression = makeList(new Symbol("TEST")); - BackTickExpression backTick = new BackTickExpression(expression); + BackquoteExpression backTick = new BackquoteExpression(expression); assertSExpressionsMatch(expression, backTick.getExpression()); } diff --git a/test/testutil/TestUtilities.java b/test/testutil/TestUtilities.java index 5760a00..d660b7f 100644 --- a/test/testutil/TestUtilities.java +++ b/test/testutil/TestUtilities.java @@ -1,5 +1,6 @@ package testutil; +import static error.ErrorManager.Severity.ERROR; import static function.builtin.EVAL.eval; import static org.junit.Assert.*; import static sexpression.Nil.NIL; @@ -7,6 +8,7 @@ import static sexpression.Nil.NIL; import java.io.*; import java.util.Arrays; +import error.LispException; import parser.LispParser; import sexpression.*; @@ -35,14 +37,6 @@ public final class TestUtilities { return new LispParser(stringInputStream, "testFile").getNextSExpression(); } - public static void assertSExpressionsMatch(SExpression one, SExpression two) { - assertEquals(one.toString(), two.toString()); - } - - public static void assertSExpressionsDoNotMatch(SExpression one, SExpression two) { - assertNotEquals(one.toString(), two.toString()); - } - public static Cons makeList(SExpression... expressionList) { if (expressionList.length == 0) return NIL; @@ -52,4 +46,18 @@ public final class TestUtilities { return new Cons(expressionList[0], rest); } + public static void assertSExpressionsMatch(SExpression one, SExpression two) { + assertEquals(one.toString(), two.toString()); + } + + public static void assertSExpressionsDoNotMatch(SExpression one, SExpression two) { + assertNotEquals(one.toString(), two.toString()); + } + + public static void assertIsErrorWithMessage(LispException e) { + assertEquals(ERROR, e.getSeverity()); + assertNotNull(e.getMessage()); + assertTrue(e.getMessage().length() > 0); + } + } diff --git a/test/testutil/TypeAssertions.java b/test/testutil/TypeAssertions.java index 959c904..d0e804d 100644 --- a/test/testutil/TypeAssertions.java +++ b/test/testutil/TypeAssertions.java @@ -17,7 +17,7 @@ public final class TypeAssertions { assertFalse(sExpression.isNumber()); assertFalse(sExpression.isString()); assertFalse(sExpression.isSymbol()); - assertFalse(sExpression.isBackTick()); + assertFalse(sExpression.isBackquote()); assertFalse(sExpression.isComma()); assertFalse(sExpression.isAtSign()); } @@ -33,7 +33,7 @@ public final class TypeAssertions { assertFalse(sExpression.isNumber()); assertFalse(sExpression.isString()); assertTrue(sExpression.isSymbol()); - assertFalse(sExpression.isBackTick()); + assertFalse(sExpression.isBackquote()); assertFalse(sExpression.isComma()); assertFalse(sExpression.isAtSign()); } @@ -47,7 +47,7 @@ public final class TypeAssertions { assertTrue(sExpression.isNumber()); assertFalse(sExpression.isString()); assertFalse(sExpression.isSymbol()); - assertFalse(sExpression.isBackTick()); + assertFalse(sExpression.isBackquote()); assertFalse(sExpression.isComma()); assertFalse(sExpression.isAtSign()); } @@ -61,7 +61,7 @@ public final class TypeAssertions { assertFalse(sExpression.isNumber()); assertTrue(sExpression.isString()); assertFalse(sExpression.isSymbol()); - assertFalse(sExpression.isBackTick()); + assertFalse(sExpression.isBackquote()); assertFalse(sExpression.isComma()); assertFalse(sExpression.isAtSign()); } @@ -75,7 +75,7 @@ public final class TypeAssertions { assertFalse(sExpression.isNumber()); assertFalse(sExpression.isString()); assertTrue(sExpression.isSymbol()); - assertFalse(sExpression.isBackTick()); + assertFalse(sExpression.isBackquote()); assertFalse(sExpression.isComma()); assertFalse(sExpression.isAtSign()); } @@ -93,7 +93,7 @@ public final class TypeAssertions { assertFalse(sExpression.isNumber()); assertFalse(sExpression.isString()); assertFalse(sExpression.isSymbol()); - assertTrue(sExpression.isBackTick()); + assertTrue(sExpression.isBackquote()); assertFalse(sExpression.isComma()); assertFalse(sExpression.isAtSign()); } @@ -107,7 +107,7 @@ public final class TypeAssertions { assertFalse(sExpression.isNumber()); assertFalse(sExpression.isString()); assertFalse(sExpression.isSymbol()); - assertFalse(sExpression.isBackTick()); + assertFalse(sExpression.isBackquote()); assertTrue(sExpression.isComma()); assertFalse(sExpression.isAtSign()); } @@ -121,7 +121,7 @@ public final class TypeAssertions { assertFalse(sExpression.isNumber()); assertFalse(sExpression.isString()); assertFalse(sExpression.isSymbol()); - assertFalse(sExpression.isBackTick()); + assertFalse(sExpression.isBackquote()); assertFalse(sExpression.isComma()); assertTrue(sExpression.isAtSign()); } diff --git a/test/token/TokenFactoryTester.java b/test/token/TokenFactoryTester.java index dbc50c5..21d264d 100644 --- a/test/token/TokenFactoryTester.java +++ b/test/token/TokenFactoryTester.java @@ -103,7 +103,7 @@ public class TokenFactoryTester { @Test public void backTickCreation() { String text = "`"; - assertTrue(createToken(text) instanceof BackTick); + assertTrue(createToken(text) instanceof Backquote); } @Test