kastnermario / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

0.5.0 tests do not compile #182

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. compile run-tests

What is the expected output? What do you see instead?
compiled test

What version of the product are you using? On what operating system?
yaml-cpp 0.5.0, VS 2008, Win7

Please provide any additional information below.
The tests do not compile due to missing overloads for some template functions 
for "const char[]" (which is for example called when accessing doc["somekey"] ).

The attached patch fixes this. 

Original issue reported on code.google.com by joh.stal...@gmail.com on 10 Jan 2013 at 1:53

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by jbe...@gmail.com on 30 Jan 2013 at 5:34

GoogleCodeExporter commented 8 years ago

Original comment by jbe...@gmail.com on 30 Jan 2013 at 5:34

GoogleCodeExporter commented 8 years ago
Windows 7x64, Visual Studio 2010 SP1-latest
Run CMAKE to generate solution for Visual Studio 2010 amd64.  Tell it where to 
define boost by adding BOOST_ROOT.  CMAKE is happy to configure and generate.   
Open solution, set to DEBUG mode and x64 architecture.  Right-click ALL_BUILD 
and select "Build".  Lots of pieces do build successfully but these are the 
errors (attached and slightly anonymized).

Original comment by JohnMich...@gmail.com on 30 Jan 2013 at 5:47

Attachments:

GoogleCodeExporter commented 8 years ago
OK I have an idea, the compiler complains that
include\yaml-cpp/node/detail/impl.h(146): error C2734: 'lhs' : const object 
must be initialized if not extern
because it doesn't want you to do things like
const MyType awesomeVar;
Because then it's not defined and const!
When we do
YAML::Node node = blahblah;
node["key"]
type("key") == const char*
on line 146 of impl.h
T lhs == const char* lhs
and the compiler complains.

Original comment by JohnMich...@gmail.com on 30 Jan 2013 at 5:52

GoogleCodeExporter commented 8 years ago
I checked it out today, and it appears there was no specialized handler for 
const char[N], only for char[N].  I've inserted the specialized handler code 
and it now compiles and passes most of the tests except a few edge specs.

In line impl.h at line 312, insert
template<std::size_t N>
        struct to_value_t<const char [N]> {
            explicit to_value_t(const char *t_): t(t_) {}
            const char *t;
            typedef std::string return_type;

            const std::string operator()() const { return t; }
        };

Original comment by JohnMich...@gmail.com on 1 Feb 2013 at 1:25

GoogleCodeExporter commented 8 years ago
Specs which fail
Emitter tests: 84/84 passed
Spec test 6.25 failed: Invalid Verbatim Tags
  not implemented yet
Spec test 6.27 failed: Invalid Tag Shorthands
  not implemented yet
Spec test 8.5 failed: Chomping Trailing Lines
  Assert failed: doc["keep"].as<std::string>() == "# text\n"
Spec test 8.21 failed: Block Scalar Nodes
  Assert failed: doc["literal"].as<std::string>() == "value"
Spec tests: 104/108 passed
Node tests: 35/35 passed
Press any key to continue . . .

Original comment by JohnMich...@gmail.com on 1 Feb 2013 at 1:26

GoogleCodeExporter commented 8 years ago
Issue 193 has been merged into this issue.

Original comment by jbe...@gmail.com on 12 Feb 2013 at 2:10

GoogleCodeExporter commented 8 years ago
well I'll use 0.3 for now.

does it still compile on g++or clang++ ?

is the fix that much non trivial ?

Original comment by ezjonas on 12 Feb 2013 at 6:57

GoogleCodeExporter commented 8 years ago
It does compile on both gcc and clang. I believe the fix is trivial-ish (there 
are a few patches in this thread), but my Windows machine isn't set up, and 
I've been busy lately - sorry, everyone who's waiting for this :(

Original comment by jbe...@gmail.com on 12 Feb 2013 at 10:51

GoogleCodeExporter commented 8 years ago
I encountered the same problem Visual Studio 2010 RTM. While the first patch 
(overloads.diff) seems a little messy to me, it does work.

Original comment by joshthep...@gmail.com on 27 Mar 2013 at 3:49

GoogleCodeExporter commented 8 years ago
Fixed (finally!), rf303ab9e8f7c in the default repo.

Please confirm if this compiles for you. Thanks, and sorry for the delay!

Original comment by jbe...@gmail.com on 2 Apr 2013 at 3:36

GoogleCodeExporter commented 8 years ago
Builds and runs without issue.  Thanks for the fix.  When I run_test's though 
only one test runs (and passes) -- did I cmake wrong to miss all the original 
tests?

Original comment by JohnMich...@gmail.com on 2 Apr 2013 at 9:05

GoogleCodeExporter commented 8 years ago
Thanks for confirming!

The tests are a little non-standard - it's just a single executable, with 
standard output. What's the output that you see?

Original comment by jbe...@gmail.com on 2 Apr 2013 at 1:41

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Debug x64, VS2010 SP1
Right click RUN_TESTS, select build.
1>------ Build started: Project: RUN_TESTS, Configuration: Debug x64 ------
1>Build started 4/2/2013 3:57:18 PM.
1>InitializeBuildStatus:
1>  Creating "x64\Debug\RUN_TESTS\RUN_TESTS.unsuccessfulbuild" because 
"AlwaysCreate" was specified.
1>PostBuildEvent:
1>  Test project C:/Users/USER/Desktop/local_work/yamlCpp-bin
1>      Start 1: yaml-reader-test
1>  1/1 Test #1: yaml-reader-test .................   Passed    0.87 sec
1>  
1>  100% tests passed, 0 tests failed out of 1
1>  
1>  Total Test time (real) =   0.88 sec
1>FinalizeBuildStatus:
1>  Deleting file "x64\Debug\RUN_TESTS\RUN_TESTS.unsuccessfulbuild".
1>  Touching "x64\Debug\RUN_TESTS\RUN_TESTS.lastbuildstate".
1>
1>Build succeeded.
1>
1>Time Elapsed 00:00:01.07
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Original comment by JohnMich...@gmail.com on 2 Apr 2013 at 2:04

GoogleCodeExporter commented 8 years ago
Ah, I see. Yeah, that's my bad for making it so confusing. CMake makes a target 
called RUN_TESTS, but that actually doesn't do the right thing. What you should 
run is the test/run_tests target (lowercase!).

Original comment by jbe...@gmail.com on 2 Apr 2013 at 2:15

GoogleCodeExporter commented 8 years ago
Doing that I get
Emitter tests: 84/84 passed
Spec test 6.25 failed: Invalid Verbatim Tags
  not implemented yet
Spec test 6.27 failed: Invalid Tag Shorthands
  not implemented yet
Spec test 8.5 failed: Chomping Trailing Lines
  Assert failed: doc["keep"].as<std::string>() == "# text\n"
Spec test 8.21 failed: Block Scalar Nodes
  Assert failed: doc["literal"].as<std::string>() == "value"
Spec tests: 104/108 passed
Node tests: 35/35 passed
Press any key to continue . . .

Original comment by JohnMich...@gmail.com on 2 Apr 2013 at 2:17

GoogleCodeExporter commented 8 years ago
Looks great - thanks so much!

Original comment by jbe...@gmail.com on 2 Apr 2013 at 2:19