/src/test/rustdoc/playground.rs

https://gitlab.com/jianglu/rust · Rust · 39 lines · 2 code · 5 blank · 32 comment · 0 complexity · 848e454a655aa958a8e37df3478ce66f MD5 · raw file

  1. // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
  2. // file at the top-level directory of this distribution and at
  3. // http://rust-lang.org/COPYRIGHT.
  4. //
  5. // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
  6. // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
  7. // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
  8. // option. This file may not be copied, modified, or distributed
  9. // except according to those terms.
  10. // ignore-tidy-linelength
  11. #![crate_name = "foo"]
  12. #![doc(html_playground_url = "https://www.example.com/")]
  13. //! module docs
  14. //!
  15. //! ```
  16. //! println!("Hello, world!");
  17. //! ```
  18. //!
  19. //! ```
  20. //! fn main() {
  21. //! println!("Hello, world!");
  22. //! }
  23. //! ```
  24. //!
  25. //! ```
  26. //! #![feature(something)]
  27. //!
  28. //! fn main() {
  29. //! println!("Hello, world!");
  30. //! }
  31. //! ```
  32. // @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0A%20%20%20%20println!(%22Hello%2C%20world!%22)%3B%0A%7D"]' "Run"
  33. // @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aprintln!(%22Hello%2C%20world!%22)%3B%0A%7D"]' "Run"
  34. // @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0A%23!%5Bfeature(something)%5D%0A%0Afn%20main()%20%7B%0A%20%20%20%20println!(%22Hello%2C%20world!%22)%3B%0A%7D&version=nightly"]' "Run"