1 /*******************************************************************************
\r
2 * Copyright (c) 2010 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.databoard.tests;
14 import org.junit.Before;
\r
15 import org.junit.Test;
\r
16 import org.simantics.databoard.parser.repository.DataTypeRepository;
\r
17 import org.simantics.databoard.parser.repository.DataTypeSyntaxError;
\r
19 public class ParserFailureTests {
21 DataTypeRepository repository;
25 repository = new DataTypeRepository();
28 @Test(expected = DataTypeSyntaxError.class)
29 public void testIncorrectUnion1() throws DataTypeSyntaxError {
30 repository.addDefinitions("type A = A | B");
33 @Test(expected = DataTypeSyntaxError.class)
34 public void testIncorrectUnion2() throws DataTypeSyntaxError {
35 repository.addDefinitions("type X = |Integer(range=0)");
38 @Test(expected = DataTypeSyntaxError.class)
39 public void testUndefinedReference() throws DataTypeSyntaxError {
40 repository.addDefinitions("type Foo = Bar");
43 @Test(expected = DataTypeSyntaxError.class)
44 public void testCircularDefinition() throws DataTypeSyntaxError {
45 repository.addDefinitions("type Foo = Bar " +
50 @Test(expected = DataTypeSyntaxError.class)
51 public void testInvalidAttribute() throws DataTypeSyntaxError {
52 repository.addDefinitions("type Foo = String(range=3)");