From: <fab...@us...> - 2009-06-18 18:51:05
|
Revision: 4488 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4488&view=rev Author: fabiomaulo Date: 2009-06-18 18:51:03 +0000 (Thu, 18 Jun 2009) Log Message: ----------- Additional tests to fix for ANTR parser Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BaseFixture.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SqlTranslationFixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BaseFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BaseFixture.cs 2009-06-16 14:29:49 UTC (rev 4487) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BaseFixture.cs 2009-06-18 18:51:03 UTC (rev 4488) @@ -43,5 +43,12 @@ qt.Compile(null, false); return qt.SQLString; } + + public string GetSqlWithClassicParser(string query) + { + var qt = new NHibernate.Hql.Classic.QueryTranslator(null, query, emptyfilters, sessions); + qt.Compile(new Dictionary<string, string>(), false); + return qt.SQLString; + } } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SqlTranslationFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SqlTranslationFixture.cs 2009-06-16 14:29:49 UTC (rev 4487) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SqlTranslationFixture.cs 2009-06-18 18:51:03 UTC (rev 4488) @@ -12,5 +12,25 @@ Assert.That(GetSql(query), Text.StartsWith("select 123.5")); } + + [Test, Ignore("Not fixed yet.")] + public void CaseClauseWithMath() + { + const string query = "from SimpleClass s where (case when s.IntValue > 0 then (cast(s.IntValue as long) * :pAValue) else 1 end) > 0"; + Assert.DoesNotThrow(() => GetSql(query)); + + // This query fail because parenthesis on the math operation and does not fail in the old parser + const string queryWithoutParen = "from SimpleClass s where (case when s.IntValue > 0 then cast(s.IntValue as long) * :pAValue else 1 end) > 0"; + Assert.DoesNotThrow(() => GetSqlWithClassicParser(queryWithoutParen)); + Assert.DoesNotThrow(() => GetSql(queryWithoutParen)); + } + + [Test, Ignore("Not fixed yet.")] + public void Union() + { + const string query = "from SimpleClass s where s.id in ((select s1.id from SimpleClass s1) union (select s2.id from SimpleClass s2))"; + Assert.DoesNotThrow(() => GetSqlWithClassicParser(query)); + Assert.DoesNotThrow(() => GetSql(query)); + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |