dropbox / json11

A tiny JSON library for C++11.
MIT License
2.55k stars 613 forks source link

Add cmake option for DR1467 canary tests #72

Closed admsyn closed 7 years ago

admsyn commented 8 years ago

This PR adds a cmake option for the DR 1467 tests, as described in PR #71

That said, the test output seems to be the same regardless. This is the output after applying this PR, with an extra debug line printed in the relevant canary section of the tests

adam@adam-xps:~/workspace/json11/build$ cmake ..
-- The CXX compiler identification is GNU 5.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/adam/workspace/json11/build
adam@adam-xps:~/workspace/json11/build$ make
Scanning dependencies of target json11
[ 25%] Building CXX object CMakeFiles/json11.dir/json11.cpp.o
[ 50%] Linking CXX static library libjson11.a
[ 50%] Built target json11
Scanning dependencies of target json11_test
[ 75%] Building CXX object CMakeFiles/json11_test.dir/test.cpp.o
[100%] Linking CXX executable json11_test
[100%] Built target json11_test
adam@adam-xps:~/workspace/json11/build$ ./json11_test
k1: v1
k3: ["a", 123, true, false, null]
    - "a"
    - 123
    - true
    - false
    - null
Result: {"a": 1, "b": "text", "c": [1, 2, 3]}
Result: {}
Failed: malformed comment
Failed: unexpected end of input inside inline comment
Failed: unexpected end of input inside comment
Failed: unexpected end of input inside multi-line comment
obj: {"k1": "v1", "k2": 42, "k3": ["a", 123, true, false, null]}
-- performing canary test for DR1467
{"key1": "value1", "key2": false, "key3": [1, 2, 3]}
[[1, 2], [10, 20], [100, 200]]
adam@adam-xps:~/workspace/json11/build$ cmake -D JSON11_ENABLE_DR1467_CANARY=off ..
-- Configuring done
-- Generating done
-- Build files have been written to: /home/adam/workspace/json11/build
adam@adam-xps:~/workspace/json11/build$ make
[ 25%] Building CXX object CMakeFiles/json11.dir/json11.cpp.o
[ 50%] Linking CXX static library libjson11.a
[ 50%] Built target json11
[ 75%] Building CXX object CMakeFiles/json11_test.dir/test.cpp.o
[100%] Linking CXX executable json11_test
[100%] Built target json11_test
adam@adam-xps:~/workspace/json11/build$ ./json11_test
k1: v1
k3: ["a", 123, true, false, null]
    - "a"
    - 123
    - true
    - false
    - null
Result: {"a": 1, "b": "text", "c": [1, 2, 3]}
Result: {}
Failed: malformed comment
Failed: unexpected end of input inside inline comment
Failed: unexpected end of input inside comment
Failed: unexpected end of input inside multi-line comment
obj: {"k1": "v1", "k2": 42, "k3": ["a", 123, true, false, null]}
-- NOT performing canary test for DR1467
{"key1": "value1", "key2": false, "key3": [1, 2, 3]}
[[1, 2], [10, 20], [100, 200]]
smarx commented 8 years ago

Automated message from Dropbox CLA bot

@admsyn, thanks for the pull request! It looks like you haven't yet signed the Dropbox CLA. Please sign it here.

artwyman commented 8 years ago

The test output should be the same in either case. The difference should be that with the canary enabled, you should see an assertion failure on compilers which have the new/broken behavior. Your test run above seems to suggest that you didn't see that, though you mentioned seeing it in prior PR #71. Can you clarify?

artwyman commented 7 years ago

I'm about to change the default to disabling the canary, so this should probably do the same if it's going to land.

admsyn commented 7 years ago

Let me know if you want any more changes

artwyman commented 7 years ago

Ah, sorry, I made the same mistake as last time, of looking only at the individual CLA spreadsheet, not the company one. You're all set.