1 /*******************************************************************************
2 * Copyright (c) 2010 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.databoard.tests;
14 import org.junit.Before;
15 import org.junit.Test;
16 import org.simantics.databoard.parser.repository.DataTypeRepository;
17 import org.simantics.databoard.parser.repository.DataTypeSyntaxError;
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)");